Java Code Examples for org.apache.hadoop.hbase.regionserver.MiniBatchOperationInProgress#setOperationStatus()
The following examples show how to use
org.apache.hadoop.hbase.regionserver.MiniBatchOperationInProgress#setOperationStatus() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WriteSinkCoprocessor.java From hbase with Apache License 2.0 | 5 votes |
@Override public void preBatchMutate(final ObserverContext<RegionCoprocessorEnvironment> c, final MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException { if (ops.incrementAndGet() % 20000 == 0) { LOG.info("Wrote " + ops.get() + " times in region " + regionName); } for (int i = 0; i < miniBatchOp.size(); i++) { miniBatchOp.setOperationStatus(i, new OperationStatus(HConstants.OperationStatusCode.SUCCESS)); } c.bypass(); }
Example 2
Source File: IndexRegionObserver.java From phoenix with Apache License 2.0 | 5 votes |
private void ignoreAtomicOperations (MiniBatchOperationInProgress<Mutation> miniBatchOp) { for (int i = 0; i < miniBatchOp.size(); i++) { Mutation m = miniBatchOp.getOperation(i); if (this.builder.isAtomicOp(m)) { miniBatchOp.setOperationStatus(i, IGNORE); continue; } } }
Example 3
Source File: IndexRegionObserver.java From phoenix with Apache License 2.0 | 4 votes |
/** * This method applies pending delete mutations on the next row states */ private void applyPendingDeleteMutations(MiniBatchOperationInProgress<Mutation> miniBatchOp, BatchMutateContext context) throws IOException { for (int i = 0; i < miniBatchOp.size(); i++) { if (miniBatchOp.getOperationStatus(i) == IGNORE) { continue; } Mutation m = miniBatchOp.getOperation(i); if (!this.builder.isEnabled(m)) { continue; } if (!(m instanceof Delete)) { continue; } ImmutableBytesPtr rowKeyPtr = new ImmutableBytesPtr(m.getRow()); Pair<Put, Put> dataRowState = context.dataRowStates.get(rowKeyPtr); if (dataRowState == null) { dataRowState = new Pair<Put, Put>(null, null); context.dataRowStates.put(rowKeyPtr, dataRowState); } Put nextDataRowState = dataRowState.getSecond(); if (nextDataRowState == null) { if (dataRowState.getFirst() == null) { // This is a delete row mutation on a non-existing row. There is no need to apply this mutation // on the data table miniBatchOp.setOperationStatus(i, NOWRITE); } continue; } for (List<Cell> cells : m.getFamilyCellMap().values()) { for (Cell cell : cells) { switch (KeyValue.Type.codeToType(cell.getTypeByte())) { case DeleteFamily: case DeleteFamilyVersion: nextDataRowState.getFamilyCellMap().remove(CellUtil.cloneFamily(cell)); break; case DeleteColumn: case Delete: removeColumn(nextDataRowState, cell); } } } if (nextDataRowState != null && nextDataRowState.getFamilyCellMap().size() == 0) { dataRowState.setSecond(null); } } }