public void writeMutation(Mutation m) { writeMutations(Collections.singletonList(m)); }
private void writeWeakNotifications(long commitTs) { if (weakNotifications.size() > 0) { SharedBatchWriter sbw = env.getSharedResources().getBatchWriter(); ArrayList<Mutation> mutations = new ArrayList<>(); for (Entry<Bytes, Set<Column>> entry : weakNotifications.entrySet()) { Flutation m = new Flutation(env, entry.getKey()); for (Column col : entry.getValue()) { Notification.put(env, m, col, commitTs); } mutations.add(m); } sbw.writeMutations(mutations); } }
env.getSharedResources().getBatchWriter().writeMutations(new ArrayList<>(mutations.values()));
private void rollback(CommitData cd) throws MutationsRejectedException { // roll back locks // TODO let rollback be done lazily? this makes GC more difficult Flutation m; ArrayList<Mutation> mutations = new ArrayList<>(cd.acceptedRows.size()); for (Bytes row : cd.acceptedRows) { m = new Flutation(env, row); for (Column col : updates.get(row).keySet()) { m.put(col, ColumnConstants.DEL_LOCK_PREFIX | startTs, DelLockValue.encode(startTs, false, true)); } mutations.add(m); } env.getSharedResources().getBatchWriter().writeMutations(mutations); // mark transaction as complete for garbage collection purposes m = new Flutation(env, cd.prow); // TODO timestamp? // TODO writing the primary column with a batch writer is iffy m.put(cd.pcol, ColumnConstants.DEL_LOCK_PREFIX | startTs, DelLockValue.encode(startTs, false, true)); m.put(cd.pcol, ColumnConstants.TX_DONE_PREFIX | startTs, EMPTY); env.getSharedResources().getBatchWriter().writeMutation(m); }