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


##########
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:
   One way to solve this is by introducing new enum value for IndexConsistency 
e.g. `x`, which means the index was Strong (s) before and now updated to 
Eventual (e). This index consistency gets same treatment like eventual index, 
but because of this state, IndexCDCConsumer never needs to worry about adding 
`s` (always Strong) indexes into above `targets` ever.
   
   It's fine to take this up as follow-up sub task.



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