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


##########
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(

Review Comment:
   Yes, you are right that this solution here is eventual consistent. The 
precompact is called for minor and major compaction. Yes, major compaction is 
done periodically typically once a week. However, the compaction policy may 
decide to skip it.  Minor compaction is supposed to run whenever the number of 
HFiles exceeds the configured threshold. If the eventual consistency is fine 
for data table regions, then eventual consistency between data table region and 
index from the max lookback perspective should be also fine. However, I think 
we need a better solution than this such that we need to populate and 
invalidate this cache whenever the max lookback config changes. The solution 
here is a stopgap. Hopefully, we will implement a better solution before 5.3.  
Please note we can continue to configure "phoenix.max.lookback.age.seconds" at 
the table level to using the Phoenix alter table command to get much better 
eventual consistency meanwhile.
   
   



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