@Override public Void answer(InvocationOnMock invocation) throws Throwable { MiniBatchOperationInProgress<Mutation> mb = invocation.getArgument(0); mb.addOperationsFromCP(0, new Mutation[]{addPut}); return null; } }).when(mockedCPHost).preBatchMutate(Mockito.isA(MiniBatchOperationInProgress.class));
@Override public void preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c, MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException { Mutation mut = miniBatchOp.getOperation(0); if (mut instanceof Delete) { List<Cell> cells = mut.getFamilyCellMap().get(test); Delete[] deletes = new Delete[] { // delete only 2 rows new Delete(row1, cells.get(0).getTimestamp()), new Delete(row2, cells.get(0).getTimestamp()), }; LOG.info("Deleting:" + Arrays.toString(deletes)); miniBatchOp.addOperationsFromCP(0, deletes); } } }
@Override public void preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c, MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException { Mutation mut = miniBatchOp.getOperation(0); List<Cell> cells = mut.getFamilyCellMap().get(test); Put[] puts = new Put[] { new Put(Bytes.toBytes("cpPut")).addColumn(test, dummy, cells.get(0).getTimestamp(), Bytes.toBytes("cpdummy")).setTTL(mut.getTTL()) }; LOG.info("Putting:" + Arrays.toString(puts)); miniBatchOp.addOperationsFromCP(0, puts); } }
@Override public void preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c, MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException { Mutation mut = miniBatchOp.getOperation(0); if (mut instanceof Delete) { List<Cell> cells = mut.getFamilyCellMap().get(test); Delete[] deletes = new Delete[] { // delete only 2 rows new Delete(row1).addFamily(test, cells.get(0).getTimestamp()), new Delete(row2).addFamily(test, cells.get(0).getTimestamp()), }; LOG.info("Deleting:" + Arrays.toString(deletes)); miniBatchOp.addOperationsFromCP(0, deletes); } } }
@Override public void preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c, MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException { Mutation mut = miniBatchOp.getOperation(0); if (mut instanceof Delete) { List<Cell> cells = mut.getFamilyCellMap().get(test); Delete[] deletes = new Delete[] { // delete only 2 rows new Delete(row1).addColumns(test, dummy, cells.get(0).getTimestamp()), new Delete(row2).addColumns(test, dummy, cells.get(0).getTimestamp()), }; LOG.info("Deleting:" + Arrays.toString(deletes)); miniBatchOp.addOperationsFromCP(0, deletes); } } }
@Override public void preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c, MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException { Mutation mut = miniBatchOp.getOperation(0); List<Cell> cells = mut.getFamilyCellMap().get(test); Put[] puts = new Put[] { new Put(row1).addColumn(test, dummy, cells.get(0).getTimestamp(), Bytes.toBytes("cpdummy")), new Put(row2).addColumn(test, dummy, cells.get(0).getTimestamp(), dummy), new Put(row3).addColumn(test, dummy, cells.get(0).getTimestamp(), dummy), }; LOG.info("Putting:" + Arrays.toString(puts)); miniBatchOp.addOperationsFromCP(0, puts); } }
miniBatchOp.addOperationsFromCP(0, localUpdates.toArray(new Mutation[localUpdates.size()]));
miniBatchOp.addOperationsFromCP(0, localUpdates.toArray(new Mutation[localUpdates.size()]));
@Override public Object answer(InvocationOnMock invocation) throws Throwable { MiniBatchOperationInProgress<Mutation> mb = invocation.getArgument(0); mb.addOperationsFromCP(0, new Mutation[]{addPut}); return null; } }).when(mockedCPHost).preBatchMutate(Mockito.isA(MiniBatchOperationInProgress.class));
@Override public void preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c, MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException { Mutation mut = miniBatchOp.getOperation(0); if (mut instanceof Delete) { List<Cell> cells = mut.getFamilyCellMap().get(test); Delete[] deletes = new Delete[] { // delete only 2 rows new Delete(row1, cells.get(0).getTimestamp()), new Delete(row2, cells.get(0).getTimestamp()), }; LOG.info("Deleting:" + Arrays.toString(deletes)); miniBatchOp.addOperationsFromCP(0, deletes); } } }
@Override public void preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c, MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException { Mutation mut = miniBatchOp.getOperation(0); List<Cell> cells = mut.getFamilyCellMap().get(test); Put[] puts = new Put[] { new Put(row1).addColumn(test, dummy, cells.get(0).getTimestamp(), Bytes.toBytes("cpdummy")), new Put(row2).addColumn(test, dummy, cells.get(0).getTimestamp(), dummy), new Put(row3).addColumn(test, dummy, cells.get(0).getTimestamp(), dummy), }; LOG.info("Putting:" + Arrays.toString(puts)); miniBatchOp.addOperationsFromCP(0, puts); } }
@Override public void preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c, MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException { Mutation mut = miniBatchOp.getOperation(0); if (mut instanceof Delete) { List<Cell> cells = mut.getFamilyCellMap().get(test); Delete[] deletes = new Delete[] { // delete only 2 rows new Delete(row1).addColumns(test, dummy, cells.get(0).getTimestamp()), new Delete(row2).addColumns(test, dummy, cells.get(0).getTimestamp()), }; LOG.info("Deleting:" + Arrays.toString(deletes)); miniBatchOp.addOperationsFromCP(0, deletes); } } }
@Override public void preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c, MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException { Mutation mut = miniBatchOp.getOperation(0); if (mut instanceof Delete) { List<Cell> cells = mut.getFamilyCellMap().get(test); Delete[] deletes = new Delete[] { // delete only 2 rows new Delete(row1).addFamily(test, cells.get(0).getTimestamp()), new Delete(row2).addFamily(test, cells.get(0).getTimestamp()), }; LOG.info("Deleting:" + Arrays.toString(deletes)); miniBatchOp.addOperationsFromCP(0, deletes); } } }
miniBatchOp.addOperationsFromCP(0, localUpdates.toArray(new Mutation[localUpdates.size()]));
miniBatchOp.addOperationsFromCP(0, localUpdates.toArray(new Mutation[localUpdates.size()]));
miniBatchOp.addOperationsFromCP(0, localUpdates.toArray(new Mutation[localUpdates.size()]));
miniBatchOp.addOperationsFromCP(0, localUpdates.toArray(new Mutation[localUpdates.size()]));