Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner

/** An internal constructor. */
private StoreScanner(HStore store, Scan scan, ScanInfo scanInfo, int numColumns, long readPt,
boolean cacheBlocks, ScanType scanType) {
boolean cacheBlocks, ScanType scanType, Long timeStampOrigin) {
this.readPt = readPt;
this.store = store;
this.cacheBlocks = cacheBlocks;
Expand All @@ -170,7 +170,11 @@ private StoreScanner(HStore store, Scan scan, ScanInfo scanInfo, int numColumns,
explicitColumnQuery = numColumns > 0;
this.scan = scan;
this.now = EnvironmentEdgeManager.currentTime();
this.oldestUnexpiredTS = scan.isRaw() ? 0L : now - scanInfo.getTtl();
if (timeStampOrigin == null) {
this.oldestUnexpiredTS = scan.isRaw() ? 0L : now - scanInfo.getTtl();
} else {
this.oldestUnexpiredTS = timeStampOrigin - scanInfo.getTtl();
}
this.minVersions = scanInfo.getMinVersions();

// We look up row-column Bloom filters for multi-column queries as part of
Expand Down Expand Up @@ -215,6 +219,11 @@ private StoreScanner(HStore store, Scan scan, ScanInfo scanInfo, int numColumns,
}
}
}

private StoreScanner(HStore store, Scan scan, ScanInfo scanInfo, int numColumns, long readPt,
boolean cacheBlocks, ScanType scanType) {
this(store, scan, scanInfo, numColumns, readPt, cacheBlocks, scanType, null);
}

private void addCurrentScanners(List<? extends KeyValueScanner> scanners) {
this.currentScanners.addAll(scanners);
Expand Down Expand Up @@ -357,6 +366,17 @@ public StoreScanner(ScanInfo scanInfo, ScanType scanType,
seekAllScanner(scanInfo, scanners);
}

// Almost the same as below except for settting the start time of oldestUnexpiredTS
StoreScanner(Scan scan, ScanInfo scanInfo, NavigableSet<byte[]> columns,
List<? extends KeyValueScanner> scanners, Long timeStampOrigin) throws IOException {
// 0 is passed as readpoint because the test bypasses Store
this(null, scan, scanInfo, columns != null ? columns.size() : 0, 0L,
scan.getCacheBlocks(), ScanType.USER_SCAN, timeStampOrigin);
this.matcher =
UserScanQueryMatcher.create(scan, scanInfo, columns, oldestUnexpiredTS, now, null);
seekAllScanner(scanInfo, scanners);
}

// Used to instantiate a scanner for user scan in test
StoreScanner(Scan scan, ScanInfo scanInfo, NavigableSet<byte[]> columns,
List<? extends KeyValueScanner> scanners) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ public void testWildCardTtlScan() throws IOException {
scan.readVersions(1);
ScanInfo scanInfo = new ScanInfo(CONF, CF, 0, 1, 500, KeepDeletedCells.FALSE,
HConstants.DEFAULT_BLOCKSIZE, 0, CellComparator.getInstance(), false);
try (StoreScanner scanner = new StoreScanner(scan, scanInfo, null, scanners)) {
try (StoreScanner scanner = new StoreScanner(scan, scanInfo, null, scanners, now)) {
List<Cell> results = new ArrayList<>();
assertEquals(true, scanner.next(results));
assertEquals(2, results.size());
Expand Down