@Override public void setTimestamp(Delete d, long timestamp) { d.setTimestamp(timestamp); }
@Override public void setTimestamp(Delete d, long timestamp) { d.setTimestamp(timestamp); }
@Override public void setTimestamp(Delete d, long timestamp) { d.setTimestamp(timestamp); } }
@Override public void setTimestamp(Delete d, long timestamp) { d.setTimestamp(timestamp); }
/** * Create a Delete operation for the specified row and timestamp.<p> * * If no further operations are done, this will delete all columns in all * families of the specified row with a timestamp less than or equal to the * specified timestamp.<p> * * This timestamp is ONLY used for a delete row operation. If specifying * families or columns, you must specify each timestamp individually. * @param row We make a local copy of this passed in row. * @param rowOffset * @param rowLength * @param timestamp maximum version timestamp (only for delete row) */ public Delete(final byte[] row, final int rowOffset, final int rowLength, long timestamp) { checkRow(row, rowOffset, rowLength); this.row = Bytes.copy(row, rowOffset, rowLength); setTimestamp(timestamp); }
@Test public void testTimeStamp() { long ts = 2014L; Delete delete = new Delete(ROW); delete.setTimestamp(ts); delete.addColumn(FAMILY, QUALIFIER); NavigableMap<byte[], List<Cell>> familyCellmap = delete.getFamilyCellMap(); for (Entry<byte[], List<Cell>> entry : familyCellmap.entrySet()) { for (Cell cell : entry.getValue()) { Assert.assertEquals(ts, cell.getTimestamp()); } } } }
Delete d = new Delete(res.getRow()); d.setTimestamp(timestamp); table.delete(d);
Delete d = new Delete(res.getRow()); d.setTimestamp(timestamp); table.delete(d);
Delete d = new Delete(res.getRow()); d.setTimestamp(timestamp); table.delete(d);
delete.setTimestamp(1L); table.delete(delete);
delete.setTimestamp(1L); remoteTable.delete(delete);
/** * Create a Delete operation for the specified row and timestamp.<p> * * If no further operations are done, this will delete all columns in all * families of the specified row with a timestamp less than or equal to the * specified timestamp.<p> * * This timestamp is ONLY used for a delete row operation. If specifying * families or columns, you must specify each timestamp individually. * @param row We make a local copy of this passed in row. * @param rowOffset * @param rowLength * @param timestamp maximum version timestamp (only for delete row) */ public Delete(final byte[] row, final int rowOffset, final int rowLength, long timestamp) { checkRow(row, rowOffset, rowLength); this.row = Bytes.copy(row, rowOffset, rowLength); setTimestamp(timestamp); }
delete.setTimestamp(1); // co DeleteExample-2-SetTS Set timestamp for row deletes.
delete1.setTimestamp(4); // co DeleteListExample-2-SetTS Set timestamp for row deletes. deletes.add(delete1);
@Test public void testTimeStamp() { long ts = 2014L; Delete delete = new Delete(ROW); delete.setTimestamp(ts); delete.addColumn(FAMILY, QUALIFIER); NavigableMap<byte[], List<Cell>> familyCellmap = delete.getFamilyCellMap(); for (Entry<byte[], List<Cell>> entry : familyCellmap.entrySet()) { for (Cell cell : entry.getValue()) { Assert.assertEquals(ts, cell.getTimestamp()); } } } }
/** * Get the index deletes from the codec {@link IndexCodec#getIndexDeletes(TableState)} and then * add them to the update map. * <p> * Expects the {@link LocalTableState} to already be correctly setup (correct timestamp, updates * applied, etc). * @throws IOException */ protected void addDeleteUpdatesToMap(IndexUpdateManager updateMap, LocalTableState state, long ts) throws IOException { Iterable<IndexUpdate> cleanup = codec.getIndexDeletes(state); if (cleanup != null) { for (IndexUpdate d : cleanup) { if (!d.isValid()) { continue; } // override the timestamps in the delete to match the current batch. Delete remove = (Delete)d.getUpdate(); remove.setTimestamp(ts); updateMap.addIndexUpdate(d.getTableName(), remove); } } }
now = EnvironmentEdgeManager.currentTimeMillis(); d.setTimestamp(now);
composeRowKey(state.getCurrentRowKey(), columns.getFirst(), columns.getSecond()); Delete d = new Delete(rowKey); d.setTimestamp(state.getCurrentTimestamp()); IndexUpdate update = kvs.getSecond(); update.setUpdate(d);
remove.setTimestamp(ts); updateMap.addIndexUpdate(d.getTableName(), remove);
/** * Get all the deletes necessary for a group of columns - logically, the cleanup the index table for a given index. * * @param group * index information * @return the cleanup for the given index, or <tt>null</tt> if no cleanup is necessary */ private IndexUpdate getDeleteForGroup(ColumnGroup group, TableState state, IndexMetaData indexMetaData) { List<CoveredColumn> refs = group.getColumns(); try { Pair<CoveredDeleteScanner, IndexUpdate> kvs = ((LocalTableState)state).getIndexedColumnsTableState(refs, false, false, indexMetaData); Pair<Integer, List<ColumnEntry>> columns = getNextEntries(refs, kvs.getFirst(), state.getCurrentRowKey()); // make sure we close the scanner reference kvs.getFirst().close(); // no change, just return the passed update if (columns.getFirst() == 0) { return kvs.getSecond(); } // have all the column entries, so just turn it into a Delete for the row // convert the entries to the needed values byte[] rowKey = composeRowKey(state.getCurrentRowKey(), columns.getFirst(), columns.getSecond()); Delete d = new Delete(rowKey); d.setTimestamp(state.getCurrentTimestamp()); IndexUpdate update = kvs.getSecond(); update.setUpdate(d); update.setTable(Bytes.toBytes(group.getTable())); return update; } catch (IOException e) { throw new RuntimeException("Unexpected exception when getting state for columns: " + refs); } }