Class HRegion.MutationBatchOperation
java.lang.Object
org.apache.hadoop.hbase.regionserver.HRegion.BatchOperation<Mutation>
org.apache.hadoop.hbase.regionserver.HRegion.MutationBatchOperation
- Enclosing class:
- HRegion
Batch of mutation operations. Base class is shared with
HRegion.ReplayBatchOperation as most of
the logic is same.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.regionserver.HRegion.BatchOperation
HRegion.BatchOperation.Visitor -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprivate longprivate longFields inherited from class org.apache.hadoop.hbase.regionserver.HRegion.BatchOperation
atomic, durability, familyCellMaps, nextIndexToProcess, observedExceptions, operations, region, results, retCodeDetails, walEditsFromCoprocessors -
Constructor Summary
ConstructorsConstructorDescriptionMutationBatchOperation(HRegion region, Mutation[] operations, boolean atomic, long nonceGroup, long nonce) -
Method Summary
Modifier and TypeMethodDescriptionbuildWALEdits(MiniBatchOperationInProgress<Mutation> miniBatchOp) Builds separate WALEdit per nonce by applying input mutations.private voidcallPreMutateCPHook(int index, WALEdit walEdit, int[] metrics) Runs prePut/preDelete/preIncrement/preAppend coprocessor hook for input mutation in a batchprivate voidcheckAndMergeCPMutations(MiniBatchOperationInProgress<Mutation> miniBatchOp, List<Region.RowLock> acquiredRowLocks, long timestamp) voidValidates each mutation and prepares a batch for write.voidImplement any Put request specific check and prepare logic here.voidvoidcompleteMiniBatchOperations(MiniBatchOperationInProgress<Mutation> miniBatchOp, MultiVersionConcurrencyControl.WriteEntry writeEntry) This method completes mini-batch operations by calling postBatchMutate() CP hook (if required) and completing mvcc.voiddoPostOpCleanupForMiniBatch(MiniBatchOperationInProgress<Mutation> miniBatchOp, WALEdit walEdit, boolean success) private voidendNonceOperation(boolean success) Ends nonce operation for a mutation, if needed.private static longgetLongValue(Cell cell) Returns Get the long out of the passed in CellgetMutation(int index) Mutation[]This method is potentially expensive and useful mostly for non-replay CP path.longgetNonce(int index) longgetNonceGroup(int index) longbooleanprivate voidvoidprepareMiniBatchOperations(MiniBatchOperationInProgress<Mutation> miniBatchOp, long timestamp, List<Region.RowLock> acquiredRowLocks) If necessary, calls preBatchMutate() CP hook for a mini-batch and updates metrics, cell count, tags and timestamp for all cells of all operations in a mini-batch.private static CellreckonDelta(Cell delta, Cell currentCell, byte[] columnFamily, long now, Mutation mutation, Function<Cell, byte[]> supplier) reckonDeltas(Mutation mutation, List<Cell> results, long now) reckonDeltasByStore(HStore store, Mutation mutation, long now, List<Cell> deltas, List<Cell> results) Reckon the Cells to apply to WAL, memstore, and to return to the Client in passed column family/Store.private booleanStarts the nonce operation for a mutation, if needed.voidprivate static GetwriteMiniBatchOperationsToMemStore(MiniBatchOperationInProgress<Mutation> miniBatchOp, MultiVersionConcurrencyControl.WriteEntry writeEntry) Write mini-batch operations to MemStoreMethods inherited from class org.apache.hadoop.hbase.regionserver.HRegion.BatchOperation
applyFamilyMapToMemStore, checkAndPrepareMutation, checkAndPrepareMutation, createMiniBatch, getClusterIds, isAtomic, isDone, isOperationPending, lockRowsAndBuildMiniBatch, size, visitBatchOperations, writeMiniBatchOperationsToMemStore
-
Field Details
-
nonceGroup
-
nonce
-
canProceed
-
-
Constructor Details
-
MutationBatchOperation
public MutationBatchOperation(HRegion region, Mutation[] operations, boolean atomic, long nonceGroup, long nonce)
-
-
Method Details
-
getMutation
- Specified by:
getMutationin classHRegion.BatchOperation<Mutation>
-
getNonceGroup
- Specified by:
getNonceGroupin classHRegion.BatchOperation<Mutation>
-
getNonce
- Specified by:
getNoncein classHRegion.BatchOperation<Mutation>
-
getMutationsForCoprocs
Description copied from class:HRegion.BatchOperationThis method is potentially expensive and useful mostly for non-replay CP path.- Specified by:
getMutationsForCoprocsin classHRegion.BatchOperation<Mutation>
-
isInReplay
- Specified by:
isInReplayin classHRegion.BatchOperation<Mutation>
-
getOrigLogSeqNum
- Specified by:
getOrigLogSeqNumin classHRegion.BatchOperation<Mutation>
-
startRegionOperation
- Specified by:
startRegionOperationin classHRegion.BatchOperation<Mutation>- Throws:
IOException
-
closeRegionOperation
- Specified by:
closeRegionOperationin classHRegion.BatchOperation<Mutation>- Throws:
IOException
-
checkAndPreparePut
Description copied from class:HRegion.BatchOperationImplement any Put request specific check and prepare logic here. Please refer toHRegion.BatchOperation.checkAndPrepareMutation(Mutation, long)for how its used.- Specified by:
checkAndPreparePutin classHRegion.BatchOperation<Mutation>- Throws:
IOException
-
checkAndPrepare
Description copied from class:HRegion.BatchOperationValidates each mutation and prepares a batch for write. If necessary (non-replay case), runs CP prePut()/preDelete()/preIncrement()/preAppend() hooks for all mutations in a batch. This is intended to operate on entire batch and will be called from outside of class to check and prepare batch. This can be implemented by calling helper methodHRegion.BatchOperation.checkAndPrepareMutation(int, long)in a 'for' loop over mutations.- Specified by:
checkAndPreparein classHRegion.BatchOperation<Mutation>- Throws:
IOException
-
prepareMiniBatchOperations
public void prepareMiniBatchOperations(MiniBatchOperationInProgress<Mutation> miniBatchOp, long timestamp, List<Region.RowLock> acquiredRowLocks) throws IOException Description copied from class:HRegion.BatchOperationIf necessary, calls preBatchMutate() CP hook for a mini-batch and updates metrics, cell count, tags and timestamp for all cells of all operations in a mini-batch.- Specified by:
prepareMiniBatchOperationsin classHRegion.BatchOperation<Mutation>- Throws:
IOException
-
startNonceOperation
Starts the nonce operation for a mutation, if needed.- Returns:
- whether to proceed this mutation.
- Throws:
IOException
-
endNonceOperation
Ends nonce operation for a mutation, if needed.- Parameters:
success- Whether the operation for this nonce has succeeded.
-
toGet
- Throws:
IOException
-
reckonDeltas
private Map<byte[],List<Cell>> reckonDeltas(Mutation mutation, List<Cell> results, long now) throws IOException - Throws:
IOException
-
reckonDeltasByStore
private List<Cell> reckonDeltasByStore(HStore store, Mutation mutation, long now, List<Cell> deltas, List<Cell> results) throws IOException Reckon the Cells to apply to WAL, memstore, and to return to the Client in passed column family/Store. Does Get of current value and then adds passed in deltas for this Store returning the result.- Parameters:
mutation- The encompassing Mutation objectdeltas- Changes to apply to this Store; either increment amount or data to appendresults- In here we accumulate all the Cells we are to return to the client. If null, client doesn't want results returned.- Returns:
- Resulting Cells after
deltashave been applied to current values. Side effect is our filling out of theresultsList. - Throws:
IOException
-
reckonDelta
private static Cell reckonDelta(Cell delta, Cell currentCell, byte[] columnFamily, long now, Mutation mutation, Function<Cell, byte[]> supplier) throws IOException- Throws:
IOException
-
getLongValue
Returns Get the long out of the passed in Cell- Throws:
DoNotRetryIOException
-
buildWALEdits
public List<Pair<NonceKey,WALEdit>> buildWALEdits(MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException Description copied from class:HRegion.BatchOperationBuilds separate WALEdit per nonce by applying input mutations. If WALEdits from CP are present, they are merged to result WALEdit.- Overrides:
buildWALEditsin classHRegion.BatchOperation<Mutation>- Throws:
IOException
-
writeMiniBatchOperationsToMemStore
public MultiVersionConcurrencyControl.WriteEntry writeMiniBatchOperationsToMemStore(MiniBatchOperationInProgress<Mutation> miniBatchOp, @Nullable MultiVersionConcurrencyControl.WriteEntry writeEntry) throws IOException Description copied from class:HRegion.BatchOperationWrite mini-batch operations to MemStore- Specified by:
writeMiniBatchOperationsToMemStorein classHRegion.BatchOperation<Mutation>- Throws:
IOException
-
completeMiniBatchOperations
public void completeMiniBatchOperations(MiniBatchOperationInProgress<Mutation> miniBatchOp, MultiVersionConcurrencyControl.WriteEntry writeEntry) throws IOException Description copied from class:HRegion.BatchOperationThis method completes mini-batch operations by calling postBatchMutate() CP hook (if required) and completing mvcc.- Overrides:
completeMiniBatchOperationsin classHRegion.BatchOperation<Mutation>- Throws:
IOException
-
doPostOpCleanupForMiniBatch
public void doPostOpCleanupForMiniBatch(MiniBatchOperationInProgress<Mutation> miniBatchOp, WALEdit walEdit, boolean success) throws IOException - Overrides:
doPostOpCleanupForMiniBatchin classHRegion.BatchOperation<Mutation>- Throws:
IOException
-
callPreMutateCPHook
Runs prePut/preDelete/preIncrement/preAppend coprocessor hook for input mutation in a batch- Parameters:
metrics- Array of 2 ints. index 0: count of puts, index 1: count of deletes, index 2: count of increments and 3: count of appends- Throws:
IOException
-
checkAndMergeCPMutations
private void checkAndMergeCPMutations(MiniBatchOperationInProgress<Mutation> miniBatchOp, List<Region.RowLock> acquiredRowLocks, long timestamp) throws IOException - Throws:
IOException
-
mergeFamilyMaps
-