kadirozde commented on code in PR #1896:
URL: https://github.com/apache/phoenix/pull/1896#discussion_r1615887838


##########
phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java:
##########
@@ -581,92 +601,135 @@ private boolean areMutationsInSameTable(Table 
targetHTable, Region region) {
                 region.getTableDescriptor().getTableName().getName()) == 0);
     }
 
+    @Override
+    public InternalScanner 
preFlush(ObserverContext<RegionCoprocessorEnvironment> c, Store store,
+            InternalScanner scanner, FlushLifeCycleTracker tracker) throws 
IOException {
+        if (!isPhoenixTableTTLEnabled(c.getEnvironment().getConfiguration())) {
+            return scanner;
+        } else {
+            return User.runAsLoginUser(new 
PrivilegedExceptionAction<InternalScanner>() {
+                @Override public InternalScanner run() throws Exception {
+                    String tableName = 
c.getEnvironment().getRegion().getRegionInfo().getTable()
+                            .getNameAsString();
+                    long maxLookbackInMillis =
+                            
UngroupedAggregateRegionObserver.getMaxLookbackInMillis(
+                                    tableName, store.getColumnFamilyName(),
+                                    
BaseScannerRegionObserverConstants.getMaxLookbackInMillis(
+                                            
c.getEnvironment().getConfiguration()));
+                    maxLookbackInMillis = 
CompactionScanner.getMaxLookbackInMillis(tableName,

Review Comment:
   The one in UngroupedAggregateRegionObserver is for caching the max lookback 
age in order to prevent getTable calls in the coproc flush hook. The other is 
for overriding the cached value by other coprocs, (for example a backup coproc).



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to