// first group all the updates for a single row into a single update to be processed
Map<ImmutableBytesPtr, MultiMutation> mutations =
new HashMap<ImmutableBytesPtr, MultiMutation>();
Durability defaultDurability = Durability.SYNC_WAL;
if(c.getEnvironment().getRegion() != null) {
defaultDurability = c.getEnvironment().getRegion().getTableDesc().getDurability();
defaultDurability = (defaultDurability == Durability.USE_DEFAULT) ?
Durability.SYNC_WAL : defaultDurability;
}
Durability durability = Durability.SKIP_WAL;
for (int i = 0; i < miniBatchOp.size(); i++) {
// remove the batch keyvalue marker - its added for all puts
WALEdit edit = miniBatchOp.getWalEdit(i);
// we don't have a WALEdit for immutable index cases, which still see this path
// we could check is indexing is enable for the mutation in prePut and then just skip this
// after checking here, but this saves us the checking again.
if (edit != null) {
KeyValue kv = edit.getKeyValues().get(0);
if (kv == BATCH_MARKER) {
// remove batch marker from the WALEdit
edit.getKeyValues().remove(0);
}
}
Mutation m = miniBatchOp.getOperation(i);
// skip this mutation if we aren't enabling indexing
// unfortunately, we really should ask if the raw mutation (rather than the combined mutation)
// should be indexed, which means we need to expose another method on the builder. Such is the
// way optimization go though.
if (!this.builder.isEnabled(m)) {
continue;
}
Durability effectiveDurablity = (m.getDurability() == Durability.USE_DEFAULT) ?
defaultDurability : m.getDurability();
if (effectiveDurablity.ordinal() > durability.ordinal()) {
durability = effectiveDurablity;
}
// add the mutation to the batch set
ImmutableBytesPtr row = new ImmutableBytesPtr(m.getRow());