/** * Adds a cell, assuming that: * - it's non-gc-able (if a tombstone) or not a tombstone * - it has a more recent timestamp than any partition/range tombstone shadowing it * - it sorts *strictly after* the current-last cell in the array. */ public void maybeAppendColumn(Cell cell, DeletionInfo.InOrderTester tester, int gcBefore) { if (cell.getLocalDeletionTime() >= gcBefore && !tester.isDeleted(cell)) { internalAdd(cell); sortedSize++; } }
public void add(Cell c) { current.add(isDead(c) ? null : value(c)); if (timestamps != null) { timestamps[current.size() - 1] = isDead(c) ? Long.MIN_VALUE : c.timestamp(); } if (ttls != null) { int ttl = -1; if (!isDead(c) && c instanceof ExpiringCell) ttl = c.getLocalDeletionTime() - (int) (now / 1000); ttls[current.size() - 1] = ttl; } }
serializedColumn.add(cell.getLocalDeletionTime()); serializedColumn.add(cell.getLocalDeletionTime());
@Override public Cell reconcile(Cell cell) { long ts1 = timestamp(), ts2 = cell.timestamp(); if (ts1 != ts2) return ts1 < ts2 ? cell : this; // we should prefer tombstones if (cell instanceof DeletedCell) return cell; int c = value().compareTo(cell.value()); if (c != 0) return c < 0 ? cell : this; // If we have same timestamp and value, prefer the longest ttl if (cell instanceof ExpiringCell) { int let1 = localExpirationTime, let2 = cell.getLocalDeletionTime(); if (let1 < let2) return cell; } return this; }
@Override public Cell reconcile(Cell cell) { long ts1 = timestamp(), ts2 = cell.timestamp(); if (ts1 != ts2) return ts1 < ts2 ? cell : this; // we should prefer tombstones if (cell instanceof DeletedCell) return cell; int c = value().compareTo(cell.value()); if (c != 0) return c < 0 ? cell : this; // If we have same timestamp and value, prefer the longest ttl if (cell instanceof ExpiringCell) { int let1 = getLocalDeletionTime(), let2 = cell.getLocalDeletionTime(); if (let1 < let2) return cell; } return this; }
if (cell.getLocalDeletionTime() < gcBefore) continue;
/** * Removes only per-cell tombstones, cells that are shadowed by a row-level or range tombstone, or * columns that have been dropped from the schema (for CQL3 tables only). * @return the updated ColumnFamily */ public static ColumnFamily removeDeletedColumnsOnly(ColumnFamily cf, int gcBefore, SecondaryIndexManager.Updater indexer) { BatchRemoveIterator<Cell> iter = cf.batchRemoveIterator(); DeletionInfo.InOrderTester tester = cf.inOrderDeletionTester(); boolean hasDroppedColumns = !cf.metadata.getDroppedColumns().isEmpty(); while (iter.hasNext()) { Cell c = iter.next(); // remove columns if // (a) the column itself is gcable or // (b) the column is shadowed by a CF tombstone // (c) the column has been dropped from the CF schema (CQL3 tables only) if (c.getLocalDeletionTime() < gcBefore || tester.isDeleted(c) || (hasDroppedColumns && isDroppedColumn(c, cf.metadata()))) { iter.remove(); indexer.remove(c); } } iter.commit(); return cf; }
public void serialize(Cell cell, DataOutputPlus out) throws IOException { assert !cell.name().isEmpty(); type.cellSerializer().serialize(cell.name(), out); try { out.writeByte(cell.serializationFlags()); if (cell instanceof CounterCell) { out.writeLong(((CounterCell) cell).timestampOfLastDelete()); } else if (cell instanceof ExpiringCell) { out.writeInt(((ExpiringCell) cell).getTimeToLive()); out.writeInt(cell.getLocalDeletionTime()); } out.writeLong(cell.timestamp()); ByteBufferUtil.writeWithLength(cell.value(), out); } catch (IOException e) { throw new RuntimeException(e); } }
Iterator<Cell> iter = container.iterator(); Cell c = iter.next(); boolean shouldPurge = c.getLocalDeletionTime() < Integer.MAX_VALUE && c.timestamp() < getMaxPurgeableTimestamp(); removeDeleted(container, shouldPurge, key, controller); iter = container.iterator(); minTimestampTracker.update(reduced.timestamp()); maxTimestampTracker.update(reduced.timestamp()); maxDeletionTimeTracker.update(reduced.getLocalDeletionTime()); minColumnNameSeen = ColumnNameHelper.minComponents(minColumnNameSeen, reduced.name(), controller.cfs.metadata.comparator); maxColumnNameSeen = ColumnNameHelper.maxComponents(maxColumnNameSeen, reduced.name(), controller.cfs.metadata.comparator); int deletionTime = reduced.getLocalDeletionTime(); if (deletionTime < Integer.MAX_VALUE) tombstones.update(deletionTime);
maxDeletionTimeTracker.update(cell.getLocalDeletionTime()); int deletionTime = cell.getLocalDeletionTime(); if (deletionTime < Integer.MAX_VALUE) tombstones.update(deletionTime);