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, writeMiniBatchOperationsToMemStore
private 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.BatchOperation
getMutationsForCoprocs
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>
IOException
public void closeRegionOperation() throws IOException
closeRegionOperation
in class HRegion.BatchOperation<Mutation>
IOException
public void checkAndPreparePut(Put p) throws IOException
HRegion.BatchOperation
HRegion.BatchOperation.checkAndPrepareMutation(Mutation, long)
for how its used.checkAndPreparePut
in class HRegion.BatchOperation<Mutation>
IOException
public void checkAndPrepare() throws IOException
HRegion.BatchOperation
HRegion.BatchOperation.checkAndPrepareMutation(int, long)
in a 'for' loop over mutations.checkAndPrepare
in class HRegion.BatchOperation<Mutation>
IOException
public void prepareMiniBatchOperations(MiniBatchOperationInProgress<Mutation> miniBatchOp, long timestamp, List<Region.RowLock> acquiredRowLocks) throws IOException
HRegion.BatchOperation
prepareMiniBatchOperations
in class HRegion.BatchOperation<Mutation>
IOException
private boolean startNonceOperation() throws IOException
IOException
private void endNonceOperation(boolean success)
success
- Whether the operation for this nonce has succeeded.private static Get toGet(Mutation mutation) throws IOException
IOException
private Map<byte[],List<Cell>> reckonDeltas(Mutation mutation, List<Cell> results, long now) throws IOException
IOException
private 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.IOException
private static Cell reckonDelta(Cell delta, Cell currentCell, byte[] columnFamily, long now, Mutation mutation, Function<Cell,byte[]> supplier) throws IOException
IOException
private static long getLongValue(Cell cell) throws DoNotRetryIOException
DoNotRetryIOException
public List<Pair<NonceKey,WALEdit>> buildWALEdits(MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException
HRegion.BatchOperation
buildWALEdits
in class HRegion.BatchOperation<Mutation>
IOException
public MultiVersionConcurrencyControl.WriteEntry writeMiniBatchOperationsToMemStore(MiniBatchOperationInProgress<Mutation> miniBatchOp, @Nullable MultiVersionConcurrencyControl.WriteEntry writeEntry) throws IOException
HRegion.BatchOperation
writeMiniBatchOperationsToMemStore
in class HRegion.BatchOperation<Mutation>
IOException
public void completeMiniBatchOperations(MiniBatchOperationInProgress<Mutation> miniBatchOp, MultiVersionConcurrencyControl.WriteEntry writeEntry) throws IOException
HRegion.BatchOperation
completeMiniBatchOperations
in class HRegion.BatchOperation<Mutation>
IOException
public void doPostOpCleanupForMiniBatch(MiniBatchOperationInProgress<Mutation> miniBatchOp, WALEdit walEdit, boolean success) throws IOException
doPostOpCleanupForMiniBatch
in class HRegion.BatchOperation<Mutation>
IOException
private 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 appendsIOException
private void checkAndMergeCPMutations(MiniBatchOperationInProgress<Mutation> miniBatchOp, List<Region.RowLock> acquiredRowLocks, long timestamp) throws IOException
IOException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.