phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajeshb...@apache.org
Subject phoenix git commit: PHOENIX-3111 Possible Deadlock/delay while building index, upsert select, delete rows at server-addendum(Rajeshbabu)
Date Wed, 03 Aug 2016 05:56:07 GMT
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 377ae6798 -> 8cb4ef188


PHOENIX-3111 Possible Deadlock/delay while building index, upsert select, delete rows at server-addendum(Rajeshbabu)


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/8cb4ef18
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/8cb4ef18
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/8cb4ef18

Branch: refs/heads/4.x-HBase-0.98
Commit: 8cb4ef18820e403ad5aa32ddf15f4d7f2f7fb62a
Parents: 377ae67
Author: Rajeshbabu Chintaguntla <rajeshbabu@apache.org>
Authored: Wed Aug 3 11:33:34 2016 +0530
Committer: Rajeshbabu Chintaguntla <rajeshbabu@apache.org>
Committed: Wed Aug 3 11:33:34 2016 +0530

----------------------------------------------------------------------
 .../UngroupedAggregateRegionObserver.java       | 37 +++++++++-----------
 1 file changed, 16 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/8cb4ef18/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
index 7c4cb33..a312020 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
@@ -189,27 +189,20 @@ public class UngroupedAggregateRegionObserver extends BaseScannerRegionObserver
           }
       }
       Mutation[] mutationArray = new Mutation[mutations.size()];
+      // When memstore size reaches blockingMemstoreSize we are waiting 3 seconds for the
+      // flush happen which decrease the memstore size and then writes allowed on the region.
+      for (int i = 0; region.getMemstoreSize().get() > blockingMemstoreSize &&
i < 30; i++) {
+          try {
+              checkForRegionClosing();
+              Thread.sleep(100);
+          } catch (InterruptedException e) {
+              Thread.currentThread().interrupt();
+              throw new IOException(e);
+          }
+      }
       // TODO: should we use the one that is all or none?
       logger.debug("Committing bactch of " + mutations.size() + " mutations for " + region.getRegionInfo().getTable().getNameAsString());
-      try {
-          region.batchMutate(mutations.toArray(mutationArray), HConstants.NO_NONCE, HConstants.NO_NONCE);
-      } catch (RegionTooBusyException rtbe) {
-            // When memstore size reaches blockingMemstoreSize we are waiting 3 seconds for
the
-            // flush happen which decrease the memstore size and then writes allowed on the
region.
-            for (int i = 0; region.getMemstoreSize().get() > blockingMemstoreSize &&
i < 30; i++) {
-                try {
-                    checkForRegionClosing();
-                    Thread.sleep(100);
-                } catch (InterruptedException e) {
-                    Thread.currentThread().interrupt();
-                    throw new IOException(e);
-                }
-            }
-            if (region.getMemstoreSize().get() > blockingMemstoreSize) {
-                throw rtbe;
-            }
-            region.batchMutate(mutationArray, HConstants.NO_NONCE, HConstants.NO_NONCE);
-      }
+      region.batchMutate(mutations.toArray(mutationArray), HConstants.NO_NONCE, HConstants.NO_NONCE);
     }
 
     /**
@@ -355,8 +348,10 @@ public class UngroupedAggregateRegionObserver extends BaseScannerRegionObserver
         }
 
         /**
-         * Upper bound of memstore size allowed for region. Updates will be blocked until
the flush
-         * happen if the memstore reaches this threshold.
+         * Slow down the writes if the memstore size more than
+         * (hbase.hregion.memstore.block.multiplier - 1) times hbase.hregion.memstore.flush.size
+         * bytes. This avoids flush storm to hdfs for cases like index building where reads
and
+         * write happen to all the table regions in the server.
          */
         final long blockingMemStoreSize = flushSize * (
                 conf.getLong(HConstants.HREGION_MEMSTORE_BLOCK_MULTIPLIER,


Mime
View raw message