@Override public Object getMetaData(Cell element, EntryMetaData meta) { switch (meta) { case TIMESTAMP: return element.timestamp(); case TTL: return ((element instanceof ExpiringCell) ? ((ExpiringCell) element).getTimeToLive() : 0); default: throw new UnsupportedOperationException("Unsupported meta data: " + meta); } } }
public Cell diff(Cell cell) { if (timestamp() < cell.timestamp()) return cell; return null; }
public void run() { rowsReplayed.incrementAndGet(); deleteHint(hostIdBytes, hint.name(), hint.timestamp()); } };
/** * remove columns from @param filter where we already have data in @param container newer than @param sstableTimestamp */ private void reduceNameFilter(QueryFilter filter, ColumnFamily container, long sstableTimestamp) { if (container == null) return; for (Iterator<CellName> iterator = ((NamesQueryFilter) filter.filter).columns.iterator(); iterator.hasNext(); ) { CellName filterColumn = iterator.next(); Cell cell = container.getColumn(filterColumn); if (cell != null && cell.timestamp() > sstableTimestamp) iterator.remove(); } }
public long maxTimestamp() { long maxTimestamp = deletionInfo().maxTimestamp(); for (Cell cell : this) maxTimestamp = Math.max(maxTimestamp, cell.timestamp()); return maxTimestamp; }
/** * Returns whether the given name/timestamp pair is deleted by one of the tombstone * of this RangeTombstoneList. */ public boolean isDeleted(Cell cell) { int idx = searchInternal(cell.name(), 0); // No matter what the counter cell's timestamp is, a tombstone always takes precedence. See CASSANDRA-7346. return idx >= 0 && (cell instanceof CounterCell || markedAts[idx] >= cell.timestamp()); }
private static boolean isDroppedColumn(Cell c, CFMetaData meta) { Long droppedAt = meta.getDroppedColumns().get(c.name().cql3ColumnName(meta)); return droppedAt != null && c.timestamp() <= droppedAt; }
@Override public Cell reconcile(Cell cell) { // No matter what the counter cell's timestamp is, a tombstone always takes precedence. See CASSANDRA-7346. if (cell instanceof DeletedCell) return cell; assert cell instanceof CounterUpdateCell : "Wrong class type."; // The only time this could happen is if a batch ships two increments for the same cell. Hence we simply sum the deltas. return new BufferCounterUpdateCell(name, delta() + ((CounterUpdateCell) cell).delta(), Math.max(timestamp, cell.timestamp())); }
public boolean isDroppedColumn(Cell c, CFMetaData meta) { Long droppedAt = meta.getDroppedColumns().get(c.name().cql3ColumnName(meta)); return droppedAt != null && c.timestamp() <= droppedAt; }
public void deleteForCleanup(ByteBuffer rowKey, Cell cell, OpOrder.Group opGroup) { if (!cell.isLive()) return; DecoratedKey valueKey = getIndexKeyFor(getIndexedValue(rowKey, cell)); int localDeletionTime = (int) (System.currentTimeMillis() / 1000); ColumnFamily cfi = ArrayBackedSortedColumns.factory.create(indexCfs.metadata, false, 1); cfi.addTombstone(makeIndexColumnName(rowKey, cell), localDeletionTime, cell.timestamp()); indexCfs.apply(valueKey, cfi, SecondaryIndexManager.nullUpdater, opGroup, null); if (logger.isDebugEnabled()) logger.debug("removed index entry for cleaned-up value {}:{}", valueKey, cfi); }
public boolean equals(Cell cell) { return timestamp() == cell.timestamp() && name().equals(cell.name()) && value().equals(cell.value()) && serializationFlags() == cell.serializationFlags(); }
private void addCell(Cell cell, ColumnIdentifier cql3ColName, String actualColName, IndexEntryBuilder builder) { ColumnDefinition columnDefinition = tableMapper.cfMetaData.getColumnDefinition(cql3ColName); if (options.shouldIndex(actualColName)) { builder.setCurrentTimestamp(cell.timestamp()); List<Field> fields = builder.getFieldList(); addFields(cell, actualColName, columnDefinition, fields); } }
public Cell reconcile(Cell cell) { long ts1 = timestamp(), ts2 = cell.timestamp(); if (ts1 != ts2) return ts1 < ts2 ? cell : this; if (isLive() != cell.isLive()) return isLive() ? cell : this; return value().compareTo(cell.value()) < 0 ? cell : this; }
public IndexedEntry decodeEntry(DecoratedKey indexedValue, Cell indexEntry) { int count = 1 + baseCfs.metadata.clusteringColumns().size(); CBuilder builder = baseCfs.getComparator().builder(); for (int i = 0; i < count - 1; i++) builder.add(indexEntry.name().get(i + 1)); return new IndexedEntry(indexedValue, indexEntry.name(), indexEntry.timestamp(), indexEntry.name().get(0), builder.build()); }
public IndexedEntry decodeEntry(DecoratedKey indexedValue, Cell indexEntry) { int ckCount = baseCfs.metadata.clusteringColumns().size(); CBuilder builder = baseCfs.getComparator().builder(); for (int i = 0; i < ckCount; i++) builder.add(indexEntry.name().get(i + 1)); return new IndexedEntry(indexedValue, indexEntry.name(), indexEntry.timestamp(), indexEntry.name().get(0), builder.build()); }
private Column thriftifySubColumn(Cell cell) { assert !(cell instanceof CounterCell); Column thrift_column = new Column(cell.name().toByteBuffer()).setValue(cell.value()).setTimestamp(cell.timestamp()); if (cell instanceof ExpiringCell) { thrift_column.setTtl(((ExpiringCell) cell).getTimeToLive()); } return thrift_column; }
private static Column thriftify(org.apache.cassandra.db.Cell c) { ByteBuffer value = (c instanceof CounterCell) ? ByteBufferUtil.bytes(CounterContext.instance().total(c.value())) : c.value(); return new Column(c.name().toByteBuffer()).setValue(value).setTimestamp(c.timestamp()); }
public IndexedEntry decodeEntry(DecoratedKey indexedValue, Cell indexEntry) { int prefixSize = columnDef.position(); CellName name = indexEntry.name(); CBuilder builder = baseCfs.getComparator().builder(); for (int i = 0; i < prefixSize; i++) builder.add(name.get(i + 1)); return new IndexedEntry(indexedValue, name, indexEntry.timestamp(), name.get(0), builder.build(), name.get(prefixSize + 1)); }
public IndexedEntry decodeEntry(DecoratedKey indexedValue, Cell indexEntry) { CBuilder builder = baseCfs.getComparator().builder(); for (int i = 0; i < columnDef.position(); i++) builder.add(indexEntry.name().get(i + 1)); return new IndexedEntry(indexedValue, indexEntry.name(), indexEntry.timestamp(), indexEntry.name().get(0), builder.build()); }
public IndexedEntry decodeEntry(DecoratedKey indexedValue, Cell indexEntry) { int ckCount = baseCfs.metadata.clusteringColumns().size(); CBuilder builder = baseCfs.getComparator().builder(); for (int i = 0; i < columnDef.position(); i++) builder.add(indexEntry.name().get(i + 1)); builder.add(indexedValue.getKey()); for (int i = columnDef.position() + 1; i < ckCount; i++) builder.add(indexEntry.name().get(i)); return new IndexedEntry(indexedValue, indexEntry.name(), indexEntry.timestamp(), indexEntry.name().get(0), builder.build()); }