private static Cell createCustomCell(Delete delete) { return createCustomCell(delete.getRow(), FAMILY, QUALIFIER_FROM_CP, Cell.Type.DeleteColumn, null); }
byte[] row = delete.getRow(); if (data.get(row) == null) return;
@Override public void delete(Delete delete) throws IOException { String spec = buildRowSpec(delete.getRow(), delete.getFamilyCellMap(), delete.getTimestamp(), delete.getTimestamp(), 1); for (int i = 0; i < maxRetries; i++) { Response response = client.delete(spec); int code = response.getCode(); switch (code) { case 200: return; case 509: try { Thread.sleep(sleepTime); } catch (InterruptedException e) { throw (InterruptedIOException)new InterruptedIOException().initCause(e); } break; default: throw new IOException("delete request failed with " + code); } } throw new IOException("delete request timed out"); }
/** * 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-existence) * * The expected value argument of this call is on the left and the current * value of the cell is on the right side of the comparison operator. * * Ie. eg. GREATER operator means expected value > existing <=> add the delete. * * @param row to check * @param family column family to check * @param qualifier column qualifier to check * @param op comparison operator to use * @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, CompareOperator op, byte[] value, Delete delete) throws IOException { RowMutations mutations = new RowMutations(delete.getRow(), 1); mutations.add(delete); return checkAndMutate(row, family, qualifier, op, value, mutations); }
/** * 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-existence) * * The expected value argument of this call is on the left and the current * value of the cell is on the right side of the comparison operator. * * Ie. eg. GREATER operator means expected value > existing <=> add the delete. * * @param row to check * @param family column family to check * @param qualifier column qualifier to check * @param compareOp comparison operator to use * @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, CompareFilter.CompareOp compareOp, byte[] value, Delete delete) throws IOException { RowMutations mutations = new RowMutations(delete.getRow(), 1); mutations.add(delete); return checkAndMutate(row, family, qualifier, compareOp, value, mutations); }
@Override public boolean thenDelete(Delete delete) throws IOException { preCheck(); RowMutations rowMutations = new RowMutations(delete.getRow()); rowMutations.add(delete); return checkAndMutate(row, family, qualifier, op, value, rowMutations); }
@Override public void delete(final Delete delete) throws IOException { ClientServiceCallable<Void> callable = new ClientServiceCallable<Void>(this.connection, getName(), delete.getRow(), this.rpcControllerFactory.newController(), delete.getPriority()) { @Override protected Void rpcCall() throws Exception { MutateRequest request = RequestConverter .buildMutateRequest(getLocation().getRegionInfo().getRegionName(), delete); doMutate(request); return null; } }; rpcCallerFactory.<Void>newCaller(this.writeRpcTimeoutMs) .callWithRetries(callable, this.operationTimeoutMs); }
public static TDelete deleteFromHBase(Delete in) { TDelete out = new TDelete(ByteBuffer.wrap(in.getRow()));
@Test public void testDeleteCopyConstructor() throws IOException { Delete origin = new Delete(Bytes.toBytes("ROW-01")); origin.setPriority(100); byte[] family = Bytes.toBytes("CF-01"); origin.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY) .setRow(origin.getRow()) .setFamily(family) .setQualifier(Bytes.toBytes("q")) .setType(Type.Delete) .build()); origin.addColumn(family, Bytes.toBytes("q0")); origin.addColumns(family, Bytes.toBytes("q1")); origin.addFamily(family); origin.addColumns(family, Bytes.toBytes("q2"), 100); origin.addFamilyVersion(family, 1000); Delete clone = new Delete(origin); assertEquals(origin, clone); origin.addColumn(family, Bytes.toBytes("q3")); //They should have different cell lists assertNotEquals(origin.getCellList(family), clone.getCellList(family)); }
@Override public void delete(Delete delete) throws IOException { byte[] row = delete.getRow(); if (data.containsKey(row)) { data.remove(row); } else { throw new IOException(); } }
/** * 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-existence) * * The expected value argument of this call is on the left and the current * value of the cell is on the right side of the comparison operator. * * Ie. eg. GREATER operator means expected value > existing <=> add the delete. * * @param row to check * @param family column family to check * @param qualifier column qualifier to check * @param op comparison operator to use * @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, CompareOperator op, byte[] value, Delete delete) throws IOException { RowMutations mutations = new RowMutations(delete.getRow(), 1); mutations.add(delete); return checkAndMutate(row, family, qualifier, op, value, mutations); }
/** * 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-existence) * * The expected value argument of this call is on the left and the current * value of the cell is on the right side of the comparison operator. * * Ie. eg. GREATER operator means expected value > existing <=> add the delete. * * @param row to check * @param family column family to check * @param qualifier column qualifier to check * @param compareOp comparison operator to use * @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, CompareFilter.CompareOp compareOp, byte[] value, Delete delete) throws IOException { RowMutations mutations = new RowMutations(delete.getRow(), 1); mutations.add(delete); return checkAndMutate(row, family, qualifier, compareOp, value, mutations); }
@Override public void delete(final Delete delete) throws IOException { ClientServiceCallable<Void> callable = new ClientServiceCallable<Void>(this.connection, getName(), delete.getRow(), this.rpcControllerFactory.newController(), delete.getPriority()) { @Override protected Void rpcCall() throws Exception { MutateRequest request = RequestConverter .buildMutateRequest(getLocation().getRegionInfo().getRegionName(), delete); doMutate(request); return null; } }; rpcCallerFactory.<Void>newCaller(this.writeRpcTimeoutMs) .callWithRetries(callable, this.operationTimeoutMs); }
byte[] deleteRow = d.getRow(); for (byte[] family : this.env.getRegion().getTableDesc().getFamiliesKeys()) { state.addPendingUpdates(new KeyValue(deleteRow, family, null, now,
@Test public void testDeleteCopyConstructor() throws IOException { Delete origin = new Delete(Bytes.toBytes("ROW-01")); origin.setPriority(100); byte[] family = Bytes.toBytes("CF-01"); origin.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY) .setRow(origin.getRow()) .setFamily(family) .setQualifier(Bytes.toBytes("q")) .setType(Type.Delete) .build()); origin.addColumn(family, Bytes.toBytes("q0")); origin.addColumns(family, Bytes.toBytes("q1")); origin.addFamily(family); origin.addColumns(family, Bytes.toBytes("q2"), 100); origin.addFamilyVersion(family, 1000); Delete clone = new Delete(origin); assertEquals(origin, clone); origin.addColumn(family, Bytes.toBytes("q3")); //They should have different cell lists assertNotEquals(origin.getCellList(family), clone.getCellList(family)); }
assertArrayEquals("Didn't get expected index value", expected, m.getRow());
assertArrayEquals("Didn't get expected index value", expected, m.getRow());
PColumn existingViewColumn = null; byte[][] rkmd = new byte[5][]; getVarChars(columnDeleteForBaseTable.getRow(), rkmd); String columnName = Bytes.toString(rkmd[COLUMN_NAME_INDEX]); String columnFamily =
/** * @param d Delete to clone. */ public Delete(final Delete d) { this.row = d.getRow(); this.ts = d.getTimeStamp(); this.lockId = d.getLockId(); this.familyMap.putAll(d.getFamilyMap()); this.writeToWAL = d.writeToWAL; }
/** * <p>adapt.</p> * * @param delete a {@link org.apache.hadoop.hbase.client.Delete} object. * @return a {@link com.google.bigtable.v2.MutateRowsRequest.Entry} object. */ public MutateRowsRequest.Entry adaptEntry(Delete delete) { RowMutation rowMutation = newRowMutationModel(delete.getRow()); adapt(delete, rowMutation); return toEntry(rowMutation); }