/** * Atomically checks if a row/family/qualifier value matches the expected * value. If it does, it adds the delete. If the passed value is null, the * check is for the lack of column (ie: non-existance) * * @param row to check * @param family column family to check * @param qualifier column qualifier to check * @param value the expected value * @param delete data to delete if check succeeds * @throws IOException e * @return true if the new delete was executed, false otherwise * @deprecated Since 2.0.0. Will be removed in 3.0.0. Use {@link #checkAndMutate(byte[], byte[])} */ @Deprecated default boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, byte[] value, Delete delete) throws IOException { return checkAndDelete(row, family, qualifier, CompareOperator.EQUAL, value, delete); }
@Override public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, CompareOp compareOp, byte[] value, Delete delete) throws IOException { return delegate.checkAndDelete(row, family, qualifier, compareOp, value, delete); }
@Override public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, CompareOperator op, byte[] value, Delete delete) throws IOException { return delegate.checkAndDelete(row, family, qualifier, op, value, delete); }
@Override public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, byte[] value, Delete delete) throws IOException { return delegate.checkAndDelete(row, family, qualifier, value, delete); }
assertObserverHasExecuted(); assertTrue(table.checkAndDelete(ROW, FAMILY, QUALIFIER, VALUE, delete)); assertObserverHasExecuted();
/** * Atomically checks if a row/family/qualifier value matches the expected * value. If it does, it adds the delete. If the passed value is null, the * check is for the lack of column (ie: non-existance) * * @param row to check * @param family column family to check * @param qualifier column qualifier to check * @param value the expected value * @param delete data to delete if check succeeds * @throws IOException e * @return true if the new delete was executed, false otherwise * @deprecated Since 2.0.0. Will be removed in 3.0.0. Use {@link #checkAndMutate(byte[], byte[])} */ @Deprecated default boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, byte[] value, Delete delete) throws IOException { return checkAndDelete(row, family, qualifier, CompareOperator.EQUAL, value, delete); }
delete1.addColumns(Bytes.toBytes("colfam1"), Bytes.toBytes("qual3")); // co CheckAndDeleteExample-1-Delete1 Create a new Delete instance. boolean res1 = table.checkAndDelete(Bytes.toBytes("row1"), Bytes.toBytes("colfam2"), Bytes.toBytes("qual3"), null, delete1); // co CheckAndDeleteExample-2-CAS1 Check if column does not exist and perform optional delete operation. System.out.println("Delete 1 successful: " + res1); // co CheckAndDeleteExample-3-SOUT1 Print out the result, should be "Delete successful: false". table.delete(delete2); boolean res2 = table.checkAndDelete(Bytes.toBytes("row1"), Bytes.toBytes("colfam2"), Bytes.toBytes("qual3"), null, delete1); // co CheckAndDeleteExample-5-CAS2 Attempt to delete same cell again. System.out.println("Delete 2 successful: " + res2); // co CheckAndDeleteExample-6-SOUT2 Print out the result, should be "Delete successful: true" since the checked column now is gone. boolean res4 = table.checkAndDelete(Bytes.toBytes("row1"), Bytes.toBytes("colfam1"), Bytes.toBytes("qual1"), // co CheckAndDeleteExample-8-CAS4 Try to delete while checking a different row. Bytes.toBytes("val1"), delete3);
delete = new Delete(Bytes.toBytes("row10")); delete.addColumn(Bytes.toBytes("colfam1"), Bytes.toBytes("qual17")); cap = table.checkAndDelete(Bytes.toBytes("row10"), Bytes.toBytes("colfam1"), Bytes.toBytes("qual15"), null, delete); System.out.println(" -> success: " + cap); cap = table.checkAndDelete(Bytes.toBytes("row10"), Bytes.toBytes("colfam1"), Bytes.toBytes("qual18"), null, delete); System.out.println(" -> success: " + cap);
@Override public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, CompareOperator op, byte[] value, Delete delete) throws IOException { return delegate.checkAndDelete(row, family, qualifier, op, value, delete); }
@Override public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, CompareOp compareOp, byte[] value, Delete delete) throws IOException { return delegate.checkAndDelete(row, family, qualifier, compareOp, value, delete); }
@Override public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, CompareOperator op, byte[] value, Delete delete) throws IOException { return delegate.checkAndDelete(row, family, qualifier, op, value, delete); }
@Override public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, byte[] value, Delete delete) throws IOException { return delegate.checkAndDelete(row, family, qualifier, value, delete); }
@Override public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, byte[] value, Delete delete) throws IOException { return delegate.checkAndDelete(row, family, qualifier, value, delete); }
@Override public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, CompareOp compareOp, byte[] value, Delete delete) throws IOException { return delegate.checkAndDelete(row, family, qualifier, compareOp, value, delete); }
@Override public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, byte[] value, Delete delete) throws IOException { if (allowNonTransactional) { return hTable.checkAndDelete(row, family, qualifier, value, delete); } else { throw new UnsupportedOperationException("Operation is not supported transactionally"); } }
@Override public boolean checkAndDelete(byte[] bytes, byte[] bytes1, byte[] bytes2, CompareFilter.CompareOp compareOp, byte[] bytes3, Delete delete) throws IOException { if (allowNonTransactional) { return hTable.checkAndDelete(bytes, bytes1, bytes2, compareOp, bytes3, delete); } else { throw new UnsupportedOperationException("Operation is not supported transactionally"); } }
@Override protected boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, byte[] value, Delete delete) throws IOException { return getDefaultTable().checkAndDelete(row, family, qualifier, value, delete); }
assertObserverHasExecuted(); assertTrue(table.checkAndDelete(ROW, FAMILY, QUALIFIER, VALUE, delete)); assertObserverHasExecuted();