private RangeRequest computeRangeRequestForRows(byte[] startRowInclusive, byte[] endRowInclusive) { return RangeRequest.builder() .startRowInclusive(startRowInclusive) .endRowExclusive(RangeRequests.nextLexicographicName(endRowInclusive)) .retainColumns(ColumnSelection.all()) .build(); }
protected static CandidateCellForSweepingRequest thoroughRequest(byte[] startRow, long sweepTs, int batchSizeHint) { return ImmutableCandidateCellForSweepingRequest.builder() .startRowInclusive(startRow) .maxTimestampExclusive(sweepTs) .shouldCheckIfLatestValueIsEmpty(true) .shouldDeleteGarbageCollectionSentinels(true) .batchSizeHint(batchSizeHint) .build(); }
static CandidateCellForSweeping of(Cell cell, Collection<Long> sortedTimestamps) { return ImmutableCandidateCellForSweeping.builder() .sortedTimestamps(sortedTimestamps) .cell(cell) .build(); }
@Override public ClosableIterator<RowResult<Value>> getBatch(int batchSize, @Nullable byte[] lastToken) { RangeRequest.Builder newRange = range.getBuilder(); if (lastToken != null) { newRange.startRowInclusive(RangeRequests.getNextStartRow(range.isReverse(), lastToken)); } newRange.batchHint(batchSize); return keyValueService.getRange(tableRef, newRange.build(), timestamp); }
private void setupTestRowsZeroOneAndTwoAndDeleteFrom(byte[] start, byte[] end, boolean reverse) { putTestDataForRowsZeroOneAndTwo(); RangeRequest range = RangeRequest.builder(reverse) .startRowInclusive(start) .endRowExclusive(end) .build(); keyValueService.deleteRange(TEST_TABLE, range); }
private RangeRequest getRangeRequest(boolean reverse, byte[] firstRow, int rowBatchSize) { return RangeRequest.builder(reverse) .startRowInclusive(firstRow) .batchHint(rowBatchSize) .build(); }
private byte[] getRowsForCell(Cell cell) { return keyValueService.getRows(TEST_TABLE, ImmutableSet.of(cell.getRowName()), ColumnSelection.all(), TEST_TIMESTAMP + 3) .get(cell).getContents(); }
private void createTwoTablesWithSamePrefix(String tableNamePrefix) { TableReference longTableName1 = TableReference.create(TEST_NAMESPACE, tableNamePrefix + "1"); TableReference longTableName2 = TableReference.create(TEST_NAMESPACE, tableNamePrefix + "2"); try { keyValueService.createTable(longTableName1, AtlasDbConstants.GENERIC_TABLE_METADATA); keyValueService.createTable(longTableName2, AtlasDbConstants.GENERIC_TABLE_METADATA); } finally { keyValueService.dropTable(longTableName1); keyValueService.dropTable(longTableName2); } } }
private static BatchColumnRangeSelection nextLexicographicalRangeEnd( BatchColumnRangeSelection currentRange, byte[] rangeEnd) { if (rangeEnd.length != 0 && !RangeRequests.isTerminalRow(false, rangeEnd)) { return BatchColumnRangeSelection.create( currentRange.getStartCol(), RangeRequests.getNextStartRow(false, rangeEnd), currentRange.getBatchHint()); } else { return currentRange; } }
private byte[] getOnlyItemInTableRange() { try (ClosableIterator<RowResult<Value>> rangeIterator = keyValueService.getRange(TEST_TABLE, RangeRequest.all(), TEST_TIMESTAMP + 3)) { byte[] contents = rangeIterator.next().getOnlyColumnValue().getContents(); assertFalse("There should only be one row in the table", rangeIterator.hasNext()); return contents; } }
default CandidateCellForSweepingRequest withStartRow(byte[] startRow) { return ImmutableCandidateCellForSweepingRequest.builder() .from(this) .startRowInclusive(startRow) .build(); }
public Builder startRowInclusive(Prefix start) { return startRowInclusive(start.getBytes()); }
public Builder endRowExclusive(Prefix end) { return endRowExclusive(end.getBytes()); }
@Override public ClusterAvailabilityStatus getClusterAvailabilityStatus() { ClusterAvailabilityStatus clusterAvailabilityStatus1 = delegate1.getClusterAvailabilityStatus(); ClusterAvailabilityStatus clusterAvailabilityStatus2 = delegate2.getClusterAvailabilityStatus(); if (clusterAvailabilityStatus1.compareTo(clusterAvailabilityStatus2) < 0) { return clusterAvailabilityStatus1; } return clusterAvailabilityStatus2; }
public static WriteReference of(TableReference tableRef, Cell cell, boolean isTombstone) { return ImmutableWriteReference.builder().tableRef(tableRef).cell(cell).isTombstone(isTombstone).build(); } }
protected static CandidateCellForSweepingRequest conservativeRequest(byte[] startRow, long sweepTs, int batchSizeHint) { return ImmutableCandidateCellForSweepingRequest.builder() .startRowInclusive(startRow) .maxTimestampExclusive(sweepTs) .shouldCheckIfLatestValueIsEmpty(false) .shouldDeleteGarbageCollectionSentinels(false) .batchSizeHint(batchSizeHint) .build(); }