You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by vj...@apache.org on 2026/03/27 03:30:39 UTC

(phoenix) branch tmp-ec updated (73732cfb72 -> 7873f0eebc)

This is an automated email from the ASF dual-hosted git repository.

vjasani pushed a change to branch tmp-ec
in repository https://gitbox.apache.org/repos/asf/phoenix.git


    from 73732cfb72 ignore test - too aggressive for jenkins builds
     new 0b1303a13b fix index concurrency issues
     new 7873f0eebc addendum

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/phoenix/hbase/index/IndexCDCConsumer.java |  7 +++++--
 .../apache/phoenix/hbase/index/IndexRegionObserver.java  | 16 +++++++---------
 2 files changed, 12 insertions(+), 11 deletions(-)


(phoenix) 02/02: addendum

Posted by vj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

vjasani pushed a commit to branch tmp-ec
in repository https://gitbox.apache.org/repos/asf/phoenix.git

commit 7873f0eebc713300bc9fca2282681c5e659e9c45
Author: Viraj Jasani <vj...@apache.org>
AuthorDate: Thu Mar 26 20:28:30 2026 -0700

    addendum
---
 .../main/java/org/apache/phoenix/hbase/index/IndexCDCConsumer.java | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/phoenix-core-server/src/main/java/org/apache/phoenix/hbase/index/IndexCDCConsumer.java b/phoenix-core-server/src/main/java/org/apache/phoenix/hbase/index/IndexCDCConsumer.java
index 68bfbd6d7f..191eef7598 100644
--- a/phoenix-core-server/src/main/java/org/apache/phoenix/hbase/index/IndexCDCConsumer.java
+++ b/phoenix-core-server/src/main/java/org/apache/phoenix/hbase/index/IndexCDCConsumer.java
@@ -29,6 +29,7 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ThreadLocalRandom;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.client.ConnectionUtils;
 import org.apache.hadoop.hbase.client.Mutation;
@@ -207,7 +208,9 @@ public class IndexCDCConsumer implements Runnable {
     this.pause = config.getLong(INDEX_CDC_CONSUMER_RETRY_PAUSE_MS, DEFAULT_RETRY_PAUSE_MS);
     this.startupDelayMs =
       config.getLong(INDEX_CDC_CONSUMER_STARTUP_DELAY_MS, DEFAULT_STARTUP_DELAY_MS);
-    this.batchSize = config.getInt(INDEX_CDC_CONSUMER_BATCH_SIZE, DEFAULT_CDC_BATCH_SIZE);
+    int baseBatchSize = config.getInt(INDEX_CDC_CONSUMER_BATCH_SIZE, DEFAULT_CDC_BATCH_SIZE);
+    int jitter = ThreadLocalRandom.current().nextInt(baseBatchSize / 5 + 1);
+    this.batchSize = baseBatchSize + jitter;
     this.pollIntervalMs =
       config.getLong(INDEX_CDC_CONSUMER_POLL_INTERVAL_MS, DEFAULT_POLL_INTERVAL_MS);
     this.timestampBufferMs =
@@ -781,7 +784,7 @@ public class IndexCDCConsumer implements Runnable {
     int batchCount = 0;
     while (!stopped) {
       try {
-        if (batchCount > 0 && batchCount % 5 == 0) {
+        if (batchCount > 0 && batchCount % 2 == 0) {
           if (isPartitionCompleted(partitionId)) {
             return;
           }


(phoenix) 01/02: fix index concurrency issues

Posted by vj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

vjasani pushed a commit to branch tmp-ec
in repository https://gitbox.apache.org/repos/asf/phoenix.git

commit 0b1303a13b726fa2ba94f3cd0e59c271e7ba472c
Author: Viraj Jasani <vj...@apache.org>
AuthorDate: Thu Mar 26 20:08:12 2026 -0700

    fix index concurrency issues
---
 .../apache/phoenix/hbase/index/IndexRegionObserver.java  | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/phoenix-core-server/src/main/java/org/apache/phoenix/hbase/index/IndexRegionObserver.java b/phoenix-core-server/src/main/java/org/apache/phoenix/hbase/index/IndexRegionObserver.java
index 48c823d258..17362e159d 100644
--- a/phoenix-core-server/src/main/java/org/apache/phoenix/hbase/index/IndexRegionObserver.java
+++ b/phoenix-core-server/src/main/java/org/apache/phoenix/hbase/index/IndexRegionObserver.java
@@ -245,15 +245,16 @@ public class IndexRegionObserver implements RegionCoprocessor, RegionObserver {
       this.rowKey = rowKey;
     }
 
-    public boolean add(BatchMutateContext context) {
+    public BatchMutateContext addAndGetPrevCtx(BatchMutateContext context) {
       synchronized (this) {
         if (usable) {
+          BatchMutateContext previousContext = lastContext;
           count++;
           lastContext = context;
-          return true;
+          return previousContext;
         }
       }
-      return false;
+      return null;
     }
 
     public void remove() {
@@ -270,9 +271,6 @@ public class IndexRegionObserver implements RegionCoprocessor, RegionObserver {
       return count;
     }
 
-    public BatchMutateContext getLastContext() {
-      return lastContext;
-    }
   }
 
   private static boolean ignoreIndexRebuildForTesting = false;
@@ -1175,8 +1173,8 @@ public class IndexRegionObserver implements RegionCoprocessor, RegionObserver {
         keys.add(PVarbinary.INSTANCE.getKeyRange(rowKeyPtr.get(), SortOrder.ASC));
       } else {
         // There is a pending row for this row key. We need to retrieve the row from memory
-        BatchMutateContext lastContext = existingPendingRow.getLastContext();
-        if (existingPendingRow.add(context)) {
+        BatchMutateContext lastContext = existingPendingRow.addAndGetPrevCtx(context);
+        if (lastContext != null) {
           BatchMutatePhase phase = lastContext.getCurrentPhase();
           Preconditions.checkArgument(phase != BatchMutatePhase.POST,
             "the phase of the last batch cannot be POST");
@@ -1720,7 +1718,7 @@ public class IndexRegionObserver implements RegionCoprocessor, RegionObserver {
         CountDownLatch countDownLatch = lastContext.getCountDownLatch();
         if (countDownLatch == null) {
           // phase changed from PRE to either FAILED or POST
-          if (phase == BatchMutatePhase.FAILED) {
+          if (lastContext.getCurrentPhase() == BatchMutatePhase.FAILED) {
             context.currentPhase = BatchMutatePhase.FAILED;
             break;
           }