AbstractReadCommandBuilder(ColumnFamilyStore cfs) { this.cfs = cfs; this.nowInSeconds = FBUtilities.nowInSeconds(); }
private RowUpdater(AtomicBTreePartition updating, MemtableAllocator allocator, OpOrder.Group writeOp, UpdateTransaction indexer) { this.updating = updating; this.allocator = allocator; this.writeOp = writeOp; this.indexer = indexer; this.nowInSec = FBUtilities.nowInSeconds(); }
AbstractReadCommandBuilder(ColumnFamilyStore cfs) { this.cfs = cfs; this.nowInSeconds = FBUtilities.nowInSeconds(); }
private void forceCompaction(Collection<Descriptor> descriptors) { try { CompactionManager.instance.submitUserDefined(legacyHintsTable, descriptors, FBUtilities.nowInSeconds()).get(); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } }
private void forceCompaction(Collection<Descriptor> descriptors) { try { CompactionManager.instance.submitUserDefined(legacyHintsTable, descriptors, FBUtilities.nowInSeconds()).get(); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } }
private CellGrouper(CFMetaData metadata, SerializationHelper helper, boolean isStatic) { this.metadata = metadata; this.isStatic = isStatic; this.helper = helper; // We cannot use a sorted builder because we don't have exactly the same ordering in 3.0 and pre-3.0. More precisely, within a row, we // store all simple columns before the complex ones in 3.0, which we use to sort everything sorted by the column name before. Note however // that the unsorted builder won't have to reconcile cells, so the exact value we pass for nowInSec doesn't matter. this.builder = BTreeRow.unsortedBuilder(FBUtilities.nowInSeconds()); }
@Override public void execute(LifecycleTransaction txn) throws IOException { CleanupStrategy cleanupStrategy = CleanupStrategy.get(cfStore, ranges, FBUtilities.nowInSeconds()); doCleanupOne(cfStore, txn, cleanupStrategy, ranges, hasIndexes); } }, jobs, OperationType.CLEANUP);
private CellGrouper(CFMetaData metadata, SerializationHelper helper, boolean isStatic) { this.metadata = metadata; this.isStatic = isStatic; this.helper = helper; // We cannot use a sorted builder because we don't have exactly the same ordering in 3.0 and pre-3.0. More precisely, within a row, we // store all simple columns before the complex ones in 3.0, which we use to sort everything sorted by the column name before. Note however // that the unsorted builder won't have to reconcile cells, so the exact value we pass for nowInSec doesn't matter. this.builder = BTreeRow.unsortedBuilder(FBUtilities.nowInSeconds()); }
public int replay(RateLimiter rateLimiter, Set<InetAddress> hintedNodes) throws IOException { logger.trace("Replaying batch {}", id); if (mutations.isEmpty()) return 0; int gcgs = gcgs(mutations); if (TimeUnit.MILLISECONDS.toSeconds(writtenAt) + gcgs <= FBUtilities.nowInSeconds()) return 0; replayHandlers = sendReplays(mutations, writtenAt, hintedNodes); rateLimiter.acquire(replayedBytes); // acquire afterwards, to not mess up ttl calculation. return replayHandlers.size(); }
public static UntypedResultSet resultify(String query, PartitionIterator partitions) { try (PartitionIterator iter = partitions) { SelectStatement ss = (SelectStatement) getStatement(query, null).statement; ResultSet cqlRows = ss.process(iter, FBUtilities.nowInSeconds()); return UntypedResultSet.create(cqlRows); } }
public static UntypedResultSet resultify(String query, PartitionIterator partitions) { try (PartitionIterator iter = partitions) { SelectStatement ss = (SelectStatement) getStatement(query, null).statement; ResultSet cqlRows = ss.process(iter, FBUtilities.nowInSeconds()); return UntypedResultSet.create(cqlRows); } }
private static Hint convertLegacyHint(UntypedResultSet.Row row) { Mutation mutation = deserializeLegacyMutation(row); if (mutation == null) return null; long creationTime = row.getLong("write_time"); // milliseconds, not micros, for the hints table int expirationTime = FBUtilities.nowInSeconds() + row.getInt("ttl"); int originalGCGS = expirationTime - (int) TimeUnit.MILLISECONDS.toSeconds(creationTime); int gcgs = Math.min(originalGCGS, mutation.smallestGCGS()); return Hint.create(mutation, creationTime, gcgs); }
private static Hint convertLegacyHint(UntypedResultSet.Row row) { Mutation mutation = deserializeLegacyMutation(row); if (mutation == null) return null; long creationTime = row.getLong("write_time"); // milliseconds, not micros, for the hints table int expirationTime = FBUtilities.nowInSeconds() + row.getInt("ttl"); int originalGCGS = expirationTime - (int) TimeUnit.MILLISECONDS.toSeconds(creationTime); int gcgs = Math.min(originalGCGS, mutation.smallestGCGS()); return Hint.create(mutation, creationTime, gcgs); }
private static void deleteLegacyHintsPartition(UUID hostId) { // intentionally use millis, like the rest of the legacy implementation did, just in case Mutation mutation = new Mutation(PartitionUpdate.fullPartitionDelete(SystemKeyspace.LegacyHints, UUIDType.instance.decompose(hostId), System.currentTimeMillis(), FBUtilities.nowInSeconds())); mutation.applyUnsafe(); } }
public static UntypedResultSet executeInternalWithPaging(String query, int pageSize, Object... values) { ParsedStatement.Prepared prepared = prepareInternal(query); if (!(prepared.statement instanceof SelectStatement)) throw new IllegalArgumentException("Only SELECTs can be paged"); SelectStatement select = (SelectStatement)prepared.statement; QueryPager pager = select.getQuery(makeInternalOptions(prepared, values), FBUtilities.nowInSeconds()).getPager(null, ProtocolVersion.CURRENT); return UntypedResultSet.create(select, pager, pageSize); }
public static UntypedResultSet executeInternalWithPaging(String query, int pageSize, Object... values) { ParsedStatement.Prepared prepared = prepareInternal(query); if (!(prepared.statement instanceof SelectStatement)) throw new IllegalArgumentException("Only SELECTs can be paged"); SelectStatement select = (SelectStatement)prepared.statement; QueryPager pager = select.getQuery(makeInternalOptions(prepared, values), FBUtilities.nowInSeconds()).getPager(null, ProtocolVersion.CURRENT); return UntypedResultSet.create(select, pager, pageSize); }
private Cell cellFromColumn(CFMetaData metadata, LegacyLayout.LegacyCellName name, Column column) { CellPath path = name.collectionElement == null ? null : CellPath.create(name.collectionElement); int ttl = getTtl(metadata, column); return ttl == LivenessInfo.NO_TTL ? BufferCell.live(name.column, column.timestamp, column.value, path) : BufferCell.expiring(name.column, column.timestamp, ttl, FBUtilities.nowInSeconds(), column.value, path); }
public static void remove(UUID id) { new Mutation(PartitionUpdate.fullPartitionDelete(SystemKeyspace.Batches, UUIDType.instance.decompose(id), FBUtilities.timestampMicros(), FBUtilities.nowInSeconds())) .apply(); }
public static void remove(UUID id) { new Mutation(PartitionUpdate.fullPartitionDelete(SystemKeyspace.Batches, UUIDType.instance.decompose(id), FBUtilities.timestampMicros(), FBUtilities.nowInSeconds())) .apply(); }
public Pair<RowCacheKey, IRowCacheEntry> call() throws Exception { DecoratedKey key = cfs.decorateKey(buffer); int nowInSec = FBUtilities.nowInSeconds(); SinglePartitionReadCommand cmd = SinglePartitionReadCommand.fullPartitionRead(cfs.metadata, nowInSec, key); try (ReadExecutionController controller = cmd.executionController(); UnfilteredRowIterator iter = cmd.queryMemtableAndDisk(cfs, controller)) { CachedPartition toCache = CachedBTreePartition.create(DataLimits.cqlLimits(rowsToCache).filter(iter, nowInSec, true), nowInSec); return Pair.create(new RowCacheKey(cfs.metadata.ksAndCFName, key), (IRowCacheEntry)toCache); } } });