priyankporwal commented on a change in pull request #469: PHOENIX-5156 
Consistent Global Indexes for Non-Transactional Tables
URL: https://github.com/apache/phoenix/pull/469#discussion_r282164261
 
 

 ##########
 File path: 
phoenix-core/src/main/java/org/apache/phoenix/hbase/index/Indexer.java
 ##########
 @@ -116,18 +110,67 @@
   private static final Log LOG = LogFactory.getLog(Indexer.class);
   private static final OperationStatus IGNORE = new 
OperationStatus(OperationStatusCode.SUCCESS);
   private static final OperationStatus NOWRITE = new 
OperationStatus(OperationStatusCode.SUCCESS);
-  
+
+  /**
+   * Class to represent pending data table rows
+   */
+  private static class PendingRow {
+      private long latestTimestamp;
+      private long count;
+      PendingRow(long latestTimestamp) {
+          count = 1;
+          this.latestTimestamp = latestTimestamp;
+      }
+
+      public void add(long timestamp) {
+          count++;
+          if (latestTimestamp < timestamp) {
+              latestTimestamp = timestamp;
+          }
+      }
+
+      public void remove() {
+          count--;
+      }
+
+      public long getCount() {
+          return count;
+      }
+
+      public long getLatestTimestamp() {
+          return latestTimestamp;
+      }
+  }
 
   protected IndexWriter writer;
+  protected IndexWriter postWriter;
+
   protected IndexBuildManager builder;
   private LockManager lockManager;
+  // The collection of pending data table rows
+  private Map<ImmutableBytesPtr, PendingRow> pendingRows = new HashMap<>();
+
+  private static boolean skipPostIndexUpdatesForTesting = false;
+  private static boolean skipDataTableUpdatesForTesting = false;
+
+  public static void setSkipPostIndexUpdatesForTesting(boolean skip) {
+      skipPostIndexUpdatesForTesting = skip;
+  }
+
+  public static void setSkipDataTableUpdatesForTesting(boolean skip) { 
skipDataTableUpdatesForTesting = skip; }
 
 Review comment:
   Nit: This can the method write above have inconsistent indentation

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

Reply via email to