private abstract static class HRegion.BatchOperation<T> extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
HRegion.BatchOperation.Visitor
Visitor interface for batch operations
|
Modifier and Type | Field and Description |
---|---|
protected boolean |
atomic |
protected Durability |
durability |
protected Map<byte[],List<Cell>>[] |
familyCellMaps |
protected int |
nextIndexToProcess |
protected HRegion.ObservedExceptionsInBatch |
observedExceptions |
protected T[] |
operations |
protected HRegion |
region |
protected OperationStatus[] |
retCodeDetails |
protected WALEdit[] |
walEditsFromCoprocessors |
Constructor and Description |
---|
BatchOperation(HRegion region,
T[] operations) |
Modifier and Type | Method and Description |
---|---|
protected void |
applyFamilyMapToMemStore(Map<byte[],List<Cell>> familyMap,
MemStoreSizing memstoreAccounting)
Atomically apply the given map of family->edits to the memstore.
|
List<Pair<NonceKey,WALEdit>> |
buildWALEdits(MiniBatchOperationInProgress<Mutation> miniBatchOp)
Builds separate WALEdit per nonce by applying input mutations.
|
abstract void |
checkAndPrepare()
Validates each mutation and prepares a batch for write.
|
protected void |
checkAndPrepareMutation(int index,
long timestamp) |
protected void |
checkAndPrepareMutation(Mutation mutation,
long timestamp)
Helper method that checks and prepares only one mutation.
|
protected abstract void |
checkAndPreparePut(Put p)
Implement any Put request specific check and prepare logic here.
|
abstract 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.
|
protected MiniBatchOperationInProgress<Mutation> |
createMiniBatch(int lastIndexExclusive,
int readyToWriteCount) |
void |
doPostOpCleanupForMiniBatch(MiniBatchOperationInProgress<Mutation> miniBatchOp,
WALEdit walEdit,
boolean success) |
List<UUID> |
getClusterIds() |
abstract Mutation |
getMutation(int index) |
abstract Mutation[] |
getMutationsForCoprocs()
This method is potentially expensive and useful mostly for non-replay CP path.
|
abstract long |
getNonce(int index) |
abstract long |
getNonceGroup(int index) |
abstract long |
getOrigLogSeqNum() |
(package private) boolean |
isAtomic() |
boolean |
isDone() |
abstract boolean |
isInReplay() |
boolean |
isOperationPending(int index) |
MiniBatchOperationInProgress<Mutation> |
lockRowsAndBuildMiniBatch(List<Region.RowLock> acquiredRowLocks)
Creates Mini-batch of all operations [nextIndexToProcess, lastIndexExclusive) for which
a row lock can be acquired.
|
abstract 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.
|
int |
size() |
abstract void |
startRegionOperation() |
void |
visitBatchOperations(boolean pendingOnly,
int lastIndexExclusive,
HRegion.BatchOperation.Visitor visitor)
Helper method for visiting pending/ all batch operations
|
protected void |
writeMiniBatchOperationsToMemStore(MiniBatchOperationInProgress<Mutation> miniBatchOp,
long writeNumber) |
abstract MultiVersionConcurrencyControl.WriteEntry |
writeMiniBatchOperationsToMemStore(MiniBatchOperationInProgress<Mutation> miniBatchOp,
MultiVersionConcurrencyControl.WriteEntry writeEntry)
Write mini-batch operations to MemStore
|
protected final T[] operations
protected final OperationStatus[] retCodeDetails
protected final WALEdit[] walEditsFromCoprocessors
protected final Map<byte[],List<Cell>>[] familyCellMaps
protected int nextIndexToProcess
protected final HRegion.ObservedExceptionsInBatch observedExceptions
protected Durability durability
protected boolean atomic
public BatchOperation(HRegion region, T[] operations)
public void visitBatchOperations(boolean pendingOnly, int lastIndexExclusive, HRegion.BatchOperation.Visitor visitor) throws IOException
IOException
public abstract Mutation getMutation(int index)
public abstract long getNonceGroup(int index)
public abstract long getNonce(int index)
public abstract Mutation[] getMutationsForCoprocs()
public abstract boolean isInReplay()
public abstract long getOrigLogSeqNum()
public abstract void startRegionOperation() throws IOException
IOException
public abstract void closeRegionOperation() throws IOException
IOException
public abstract void checkAndPrepare() throws IOException
checkAndPrepareMutation(int, long)
in a
'for' loop over mutations.IOException
protected abstract void checkAndPreparePut(Put p) throws IOException
checkAndPrepareMutation(Mutation, long)
for how its used.IOException
public abstract void prepareMiniBatchOperations(MiniBatchOperationInProgress<Mutation> miniBatchOp, long timestamp, List<Region.RowLock> acquiredRowLocks) throws IOException
IOException
public abstract MultiVersionConcurrencyControl.WriteEntry writeMiniBatchOperationsToMemStore(MiniBatchOperationInProgress<Mutation> miniBatchOp, MultiVersionConcurrencyControl.WriteEntry writeEntry) throws IOException
IOException
protected void writeMiniBatchOperationsToMemStore(MiniBatchOperationInProgress<Mutation> miniBatchOp, long writeNumber) throws IOException
IOException
public boolean isDone()
public int size()
public boolean isOperationPending(int index)
public List<UUID> getClusterIds()
boolean isAtomic()
protected void checkAndPrepareMutation(Mutation mutation, long timestamp) throws IOException
checkAndPrepare()
for entire Batch.
NOTE: As CP prePut()/ preDelete() hooks may modify mutations, this method should be called
after prePut()/ preDelete() CP hooks are run for the mutationIOException
protected void checkAndPrepareMutation(int index, long timestamp) throws IOException
IOException
public MiniBatchOperationInProgress<Mutation> lockRowsAndBuildMiniBatch(List<Region.RowLock> acquiredRowLocks) throws IOException
MiniBatchOperationInProgress
. Mini batch
is window over HRegion.BatchOperation
and contains contiguous pending operations.acquiredRowLocks
- keeps track of rowLocks acquired.IOException
protected MiniBatchOperationInProgress<Mutation> createMiniBatch(int lastIndexExclusive, int readyToWriteCount)
public List<Pair<NonceKey,WALEdit>> buildWALEdits(MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException
IOException
public void completeMiniBatchOperations(MiniBatchOperationInProgress<Mutation> miniBatchOp, MultiVersionConcurrencyControl.WriteEntry writeEntry) throws IOException
IOException
public void doPostOpCleanupForMiniBatch(MiniBatchOperationInProgress<Mutation> miniBatchOp, WALEdit walEdit, boolean success) throws IOException
IOException
protected void applyFamilyMapToMemStore(Map<byte[],List<Cell>> familyMap, MemStoreSizing memstoreAccounting) throws IOException
familyMap
- Map of Cells by familyIOException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.