gjacoby126 commented on a change in pull request #662: PHOENIX-5645 -
GlobalIndexChecker should prevent compaction from purg…
URL: https://github.com/apache/phoenix/pull/662#discussion_r365623839
##########
File path:
phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseScannerRegionObserver.java
##########
@@ -374,20 +382,111 @@ RegionScanner getWrappedScanner(final
ObserverContext<RegionCoprocessorEnvironme
dataRegion, indexMaintainer, null, viewConstants, null, null,
projector, ptr, useQualiferAsListIndex);
}
+
@Override
public KeyValueScanner preStoreScannerOpen(final
ObserverContext<RegionCoprocessorEnvironment> c,
final Store store, final Scan scan, final NavigableSet<byte[]>
targetCols,
final KeyValueScanner s) throws IOException {
-
- if (scan.isRaw() || ScanInfoUtil.isKeepDeletedCells(store.getScanInfo())
|| scan.getTimeRange().getMax() == HConstants.LATEST_TIMESTAMP ||
TransactionUtil.isTransactionalTimestamp(scan.getTimeRange().getMax())) {
+ if (storeFileScanDoesntNeedAlteration(store, scan)) {
return s;
}
if (s!=null) {
s.close();
}
- ScanInfo scanInfo =
ScanInfoUtil.cloneScanInfoWithKeepDeletedCells(store.getScanInfo());
+ ScanInfo scanInfo = ScanInfoUtil.cloneScanInfoWithKeepDeletedCells(store,
+ store.getScanInfo());
return ScanInfoUtil.createStoreScanner(store, scanInfo, scan, targetCols,
c.getEnvironment().getRegion().getReadpoint(scan.getIsolationLevel()));
}
+
+ private boolean storeFileScanDoesntNeedAlteration(Store store, Scan scan) {
+ boolean isRaw = scan.isRaw();
+ //true if keep deleted cells is either TRUE or TTL
+ boolean keepDeletedCells =
ScanInfoUtil.isKeepDeletedCells(store.getScanInfo());
+ boolean timeRangeIsLatest = scan.getTimeRange().getMax() ==
HConstants.LATEST_TIMESTAMP;
+ boolean timestampIsTransactional =
+
TransactionUtil.isTransactionalTimestamp(scan.getTimeRange().getMax());
+ return isRaw
+ || keepDeletedCells
+ || timeRangeIsLatest
+ || timestampIsTransactional;
+ }
+
+ @Override
+ public InternalScanner preFlushScannerOpen(final
ObserverContext<RegionCoprocessorEnvironment> c,
+ final Store store,
+ final KeyValueScanner
memstoreScanner,
+ final InternalScanner s)
+ throws IOException {
+
+ if
(!ScanInfoUtil.isMaxLookbackTimeEnabled(c.getEnvironment().getConfiguration())){
+ return s;
+ }
+
+ //close last scanner object before creating a new one
+ if(s != null) {
+ s.close();
+ }
+
+ // Called during flushing the memstore to disk.
+ // Need to retain all the delete markers & all the versions
+ Scan scan = new Scan();
+ scan.setMaxVersions(Integer.MAX_VALUE);
+ ScanInfo oldScanInfo = store.getScanInfo();
+
+ Configuration conf = c.getEnvironment().getConfiguration();
+ //minor compactions and flushes both use "compact retain deletes"
Review comment:
Compactions already set the scan type in the hook via the passed in
parameter.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services