virajjasani commented on code in PR #2658:
URL: https://github.com/apache/phoenix/pull/2658#discussion_r4503465116


##########
phoenix-core-server/src/main/java/org/apache/phoenix/hbase/index/IndexCDCConsumer.java:
##########
@@ -1263,24 +1308,44 @@ private void 
generateAndApplyIndexMutations(PhoenixConnection conn,
     refreshDataTableCache(conn);
     PTable dataTable = getDataTable(conn);
     byte[] encodedRegionNameBytes = 
env.getRegion().getRegionInfo().getEncodedNameAsBytes();
-    List<Pair<IndexMaintainer, HTableInterfaceReference>> indexTables = new 
ArrayList<>();
+    List<Pair<Pair<IndexMaintainer, HTableInterfaceReference>, Long>> targets 
= new ArrayList<>();
     for (PTable index : dataTable.getIndexes()) {
-      IndexConsistency consistency = index.getIndexConsistency();
-      if (consistency != null && consistency.isAsynchronous()) {
+      long cutoff = getApplyCutoff(dataTable, index);
+      if (cutoff != Long.MIN_VALUE) {
         IndexMaintainer maintainer = index.getIndexMaintainer(dataTable, conn);
         HTableInterfaceReference tableRef =
           new HTableInterfaceReference(new 
ImmutableBytesPtr(maintainer.getIndexTableName()));
-        indexTables.add(new Pair<>(maintainer, tableRef));
+        targets.add(new Pair<>(new Pair<>(maintainer, tableRef), cutoff));
       }
     }

Review Comment:
   The general direction looks good, but we have one problem with this. The 
data table that has CDC index and other strongly consistent indexes that were 
never converted to eventually consistent indexes, will always write to 
IDX_CDC_TRACKER table and let IndexCDCConsumer always make extra writes to each 
strongly consistent indexes (except CDC) for every region move, split and 
merged.
   
   We want to restrict the above behavior only for the data table whose 
strongly consistent indexes were converted to eventually consistent indexes. 
For indexes that were never altered to eventual, we should not bother them.
   
   Let me think about how to best solve this problem, because we are already 
making real progress towards fixing the `ALTER INDEX ... CONSISTENCY` issues.



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