private RangeRequest rangeRequestNonDedicatedRow(ShardAndStrategy shardAndStrategy, long partitionFine) { byte[] row = computeRow(partitionFine, shardAndStrategy).persistToBytes(); return computeRangeRequestForRows(row, row); }
private List<RangeRequest> rangeRequestsDedicatedRows(ShardAndStrategy shardAndStrategy, long partitionFine) { SweepableCellsTable.SweepableCellsRow row = computeRow(partitionFine, shardAndStrategy); RowColumnRangeIterator rowIterator = getWithColumnRangeAllForRow(row); List<RangeRequest> requests = new ArrayList<>(); rowIterator.forEachRemaining(entry -> requests.addAll(rangeRequestsIfDedicated(row, computeColumn(entry)))); return requests; }
private Map<Cell, byte[]> addCell(PartitionInfo info, WriteReference writeRef, boolean isDedicatedRow, long dedicatedRowNumber, long writeIndex) { SweepableCellsRow row = computeRow(info, isDedicatedRow, dedicatedRowNumber); SweepableCellsColumnValue colVal = createColVal(info.timestamp(), writeIndex, writeRef); return ImmutableMap.of(SweepQueueUtils.toCell(row, colVal), colVal.persistValue()); }
SweepBatch getBatchForPartition(ShardAndStrategy shardStrategy, long partitionFine, long minTsExclusive, long sweepTs) { SweepableCellsRow row = computeRow(partitionFine, shardStrategy); RowColumnRangeIterator resultIterator = getRowColumnRange(row, partitionFine, minTsExclusive, sweepTs); PeekingIterator<Map.Entry<Cell, Value>> peekingResultIterator = Iterators.peekingIterator(resultIterator); WriteBatch writeBatch = getBatchOfWrites(row, peekingResultIterator, sweepTs); Multimap<Long, WriteInfo> writesByStartTs = writeBatch.writesByStartTs; maybeMetrics.ifPresent(metrics -> metrics.updateEntriesRead(shardStrategy, writesByStartTs.size())); log.debug("Read {} entries from the sweep queue.", SafeArg.of("number", writesByStartTs.size())); TimestampsToSweep tsToSweep = getTimestampsToSweepDescendingAndCleanupAborted( shardStrategy, minTsExclusive, sweepTs, writesByStartTs); Collection<WriteInfo> writes = getWritesToSweep(writesByStartTs, tsToSweep.timestampsDescending()); DedicatedRows filteredDedicatedRows = getDedicatedRowsToClear(writeBatch.dedicatedRows, tsToSweep); long lastSweptTs = getLastSweptTs(tsToSweep, peekingResultIterator, partitionFine, sweepTs); return SweepBatch.of(writes, filteredDedicatedRows, lastSweptTs); }
private RangeRequest rangeRequestNonDedicatedRow(ShardAndStrategy shardAndStrategy, long partitionFine) { byte[] row = computeRow(partitionFine, shardAndStrategy).persistToBytes(); return computeRangeRequestForRows(row, row); }
private List<RangeRequest> rangeRequestsDedicatedRows(ShardAndStrategy shardAndStrategy, long partitionFine) { SweepableCellsTable.SweepableCellsRow row = computeRow(partitionFine, shardAndStrategy); RowColumnRangeIterator rowIterator = getWithColumnRangeAllForRow(row); List<RangeRequest> requests = new ArrayList<>(); rowIterator.forEachRemaining(entry -> requests.addAll(rangeRequestsIfDedicated(row, computeColumn(entry)))); return requests; }
private Map<Cell, byte[]> addCell(PartitionInfo info, WriteReference writeRef, boolean isDedicatedRow, long dedicatedRowNumber, long writeIndex) { SweepableCellsRow row = computeRow(info, isDedicatedRow, dedicatedRowNumber); SweepableCellsColumnValue colVal = createColVal(info.timestamp(), writeIndex, writeRef); return ImmutableMap.of(SweepQueueUtils.toCell(row, colVal), colVal.persistValue()); }
SweepBatch getBatchForPartition(ShardAndStrategy shardStrategy, long partitionFine, long minTsExclusive, long sweepTs) { SweepableCellsRow row = computeRow(partitionFine, shardStrategy); RowColumnRangeIterator resultIterator = getRowColumnRange(row, partitionFine, minTsExclusive, sweepTs); PeekingIterator<Map.Entry<Cell, Value>> peekingResultIterator = Iterators.peekingIterator(resultIterator); WriteBatch writeBatch = getBatchOfWrites(row, peekingResultIterator, sweepTs); Multimap<Long, WriteInfo> writesByStartTs = writeBatch.writesByStartTs; maybeMetrics.ifPresent(metrics -> metrics.updateEntriesRead(shardStrategy, writesByStartTs.size())); log.debug("Read {} entries from the sweep queue.", SafeArg.of("number", writesByStartTs.size())); TimestampsToSweep tsToSweep = getTimestampsToSweepDescendingAndCleanupAborted( shardStrategy, minTsExclusive, sweepTs, writesByStartTs); Collection<WriteInfo> writes = getWritesToSweep(writesByStartTs, tsToSweep.timestampsDescending()); DedicatedRows filteredDedicatedRows = getDedicatedRowsToClear(writeBatch.dedicatedRows, tsToSweep); long lastSweptTs = getLastSweptTs(tsToSweep, peekingResultIterator, partitionFine, sweepTs); return SweepBatch.of(writes, filteredDedicatedRows, lastSweptTs); }