private static class HRegion.MutationBatchOperation extends HRegion.BatchOperation<Mutation>
HRegion.ReplayBatchOperation as most of
the logic is same.HRegion.BatchOperation.Visitor| Modifier and Type | Field and Description |
|---|---|
protected boolean |
canProceed |
private long |
nonce |
private long |
nonceGroup |
atomic, durability, familyCellMaps, nextIndexToProcess, observedExceptions, operations, region, results, retCodeDetails, walEditsFromCoprocessors| Constructor and Description |
|---|
MutationBatchOperation(HRegion region,
Mutation[] operations,
boolean atomic,
long nonceGroup,
long nonce) |
| Modifier and Type | Method and Description |
|---|---|
List<Pair<NonceKey,WALEdit>> |
buildWALEdits(MiniBatchOperationInProgress<Mutation> miniBatchOp)
Builds separate WALEdit per nonce by applying input mutations.
|
private void |
callPreMutateCPHook(int index,
WALEdit walEdit,
int[] metrics)
Runs prePut/preDelete/preIncrement/preAppend coprocessor hook for input mutation in a batch
|
private void |
checkAndMergeCPMutations(MiniBatchOperationInProgress<Mutation> miniBatchOp,
List<Region.RowLock> acquiredRowLocks,
long timestamp) |
void |
checkAndPrepare()
Validates each mutation and prepares a batch for write.
|
void |
checkAndPreparePut(Put p)
Implement any Put request specific check and prepare logic here.
|
void |
closeRegionOperation() |
void |
completeMiniBatchOperations(MiniBatchOperationInProgress<Mutation> miniBatchOp,
MultiVersionConcurrencyControl.WriteEntry writeEntry)
This method completes mini-batch operations by calling postBatchMutate() CP hook (if
required) and completing mvcc.
|
void |
doPostOpCleanupForMiniBatch(MiniBatchOperationInProgress<Mutation> miniBatchOp,
WALEdit walEdit,
boolean success) |
private void |
endNonceOperation(boolean success)
Ends nonce operation for a mutation, if needed.
|
private static long |
getLongValue(Cell cell)
Returns Get the long out of the passed in Cell
|
Mutation |
getMutation(int index) |
Mutation[] |
getMutationsForCoprocs()
This method is potentially expensive and useful mostly for non-replay CP path.
|
long |
getNonce(int index) |
long |
getNonceGroup(int index) |
long |
getOrigLogSeqNum() |
boolean |
isInReplay() |
private void |
mergeFamilyMaps(Map<byte[],List<Cell>> familyMap,
Map<byte[],List<Cell>> toBeMerged) |
void |
prepareMiniBatchOperations(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 Cell |
reckonDelta(Cell delta,
Cell currentCell,
byte[] columnFamily,
long now,
Mutation mutation,
Function<Cell,byte[]> supplier) |
private Map<byte[],List<Cell>> |
reckonDeltas(Mutation mutation,
List<Cell> results,
long now) |
private List<Cell> |
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 boolean |
startNonceOperation()
Starts the nonce operation for a mutation, if needed.
|
void |
startRegionOperation() |
private static Get |
toGet(Mutation mutation) |
MultiVersionConcurrencyControl.WriteEntry |
writeMiniBatchOperationsToMemStore(MiniBatchOperationInProgress<Mutation> miniBatchOp,
MultiVersionConcurrencyControl.WriteEntry writeEntry)
Write mini-batch operations to MemStore
|
applyFamilyMapToMemStore, checkAndPrepareMutation, checkAndPrepareMutation, createMiniBatch, getClusterIds, isAtomic, isDone, isOperationPending, lockRowsAndBuildMiniBatch, size, visitBatchOperations, writeMiniBatchOperationsToMemStoreprivate long nonceGroup
private long nonce
protected boolean canProceed
public MutationBatchOperation(HRegion region, Mutation[] operations, boolean atomic, long nonceGroup, long nonce)
public Mutation getMutation(int index)
getMutation in class HRegion.BatchOperation<Mutation>public long getNonceGroup(int index)
getNonceGroup in class HRegion.BatchOperation<Mutation>public long getNonce(int index)
getNonce in class HRegion.BatchOperation<Mutation>public Mutation[] getMutationsForCoprocs()
HRegion.BatchOperationgetMutationsForCoprocs in class HRegion.BatchOperation<Mutation>public boolean isInReplay()
isInReplay in class HRegion.BatchOperation<Mutation>public long getOrigLogSeqNum()
getOrigLogSeqNum in class HRegion.BatchOperation<Mutation>public void startRegionOperation() throws IOException
startRegionOperation in class HRegion.BatchOperation<Mutation>IOExceptionpublic void closeRegionOperation() throws IOException
closeRegionOperation in class HRegion.BatchOperation<Mutation>IOExceptionpublic void checkAndPreparePut(Put p) throws IOException
HRegion.BatchOperationHRegion.BatchOperation.checkAndPrepareMutation(Mutation, long) for how its used.checkAndPreparePut in class HRegion.BatchOperation<Mutation>IOExceptionpublic void checkAndPrepare() throws IOException
HRegion.BatchOperationHRegion.BatchOperation.checkAndPrepareMutation(int, long) in a 'for' loop over mutations.checkAndPrepare in class HRegion.BatchOperation<Mutation>IOExceptionpublic void prepareMiniBatchOperations(MiniBatchOperationInProgress<Mutation> miniBatchOp, long timestamp, List<Region.RowLock> acquiredRowLocks) throws IOException
HRegion.BatchOperationprepareMiniBatchOperations in class HRegion.BatchOperation<Mutation>IOExceptionprivate boolean startNonceOperation() throws IOException
IOExceptionprivate void endNonceOperation(boolean success)
success - Whether the operation for this nonce has succeeded.private static Get toGet(Mutation mutation) throws IOException
IOExceptionprivate Map<byte[],List<Cell>> reckonDeltas(Mutation mutation, List<Cell> results, long now) throws IOException
IOExceptionprivate List<Cell> reckonDeltasByStore(HStore store, Mutation mutation, long now, List<Cell> deltas, List<Cell> results) throws IOException
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.deltas have been applied to current values. Side
effect is our filling out of the results List.IOExceptionprivate static Cell reckonDelta(Cell delta, Cell currentCell, byte[] columnFamily, long now, Mutation mutation, Function<Cell,byte[]> supplier) throws IOException
IOExceptionprivate static long getLongValue(Cell cell) throws DoNotRetryIOException
DoNotRetryIOExceptionpublic List<Pair<NonceKey,WALEdit>> buildWALEdits(MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException
HRegion.BatchOperationbuildWALEdits in class HRegion.BatchOperation<Mutation>IOExceptionpublic MultiVersionConcurrencyControl.WriteEntry writeMiniBatchOperationsToMemStore(MiniBatchOperationInProgress<Mutation> miniBatchOp, @Nullable MultiVersionConcurrencyControl.WriteEntry writeEntry) throws IOException
HRegion.BatchOperationwriteMiniBatchOperationsToMemStore in class HRegion.BatchOperation<Mutation>IOExceptionpublic void completeMiniBatchOperations(MiniBatchOperationInProgress<Mutation> miniBatchOp, MultiVersionConcurrencyControl.WriteEntry writeEntry) throws IOException
HRegion.BatchOperationcompleteMiniBatchOperations in class HRegion.BatchOperation<Mutation>IOExceptionpublic void doPostOpCleanupForMiniBatch(MiniBatchOperationInProgress<Mutation> miniBatchOp, WALEdit walEdit, boolean success) throws IOException
doPostOpCleanupForMiniBatch in class HRegion.BatchOperation<Mutation>IOExceptionprivate void callPreMutateCPHook(int index, WALEdit walEdit, int[] metrics) throws IOException
metrics - Array of 2 ints. index 0: count of puts, index 1: count of deletes, index 2:
count of increments and 3: count of appendsIOExceptionprivate void checkAndMergeCPMutations(MiniBatchOperationInProgress<Mutation> miniBatchOp, List<Region.RowLock> acquiredRowLocks, long timestamp) throws IOException
IOExceptionCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.