Decrement pending range calculator counter in finally block

Patch by Sankalp Kohli; reviewed by Tyler Hobbs for CASSANDRA-12554


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/38ff407c
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/38ff407c
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/38ff407c

Branch: refs/heads/cassandra-3.0
Commit: 38ff407c26bd05cc46739e322aa22707f84a5aff
Parents: 465496f
Author: sankalp kohli <kohlisank...@gmail.com>
Authored: Wed Sep 14 14:51:29 2016 -0500
Committer: Tyler Hobbs <tylerlho...@gmail.com>
Committed: Wed Sep 21 13:48:57 2016 -0500

----------------------------------------------------------------------
 CHANGES.txt                                           |  2 ++
 .../service/PendingRangeCalculatorService.java        | 14 +++++++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/38ff407c/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 6c5fded..96f97f4 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,6 @@
 2.2.8
+ * Decrement pending range calculator jobs counter in finally block
+  (CASSANDRA-12554)
  * Add local address entry in PropertyFileSnitch (CASSANDRA-11332)
  * cqlshlib tests: increase default execute timeout (CASSANDRA-12481)
  * Forward writes to replacement node when replace_address != 
broadcast_address (CASSANDRA-8523)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/38ff407c/src/java/org/apache/cassandra/service/PendingRangeCalculatorService.java
----------------------------------------------------------------------
diff --git 
a/src/java/org/apache/cassandra/service/PendingRangeCalculatorService.java 
b/src/java/org/apache/cassandra/service/PendingRangeCalculatorService.java
index 2276c4a..806f6a5 100644
--- a/src/java/org/apache/cassandra/service/PendingRangeCalculatorService.java
+++ b/src/java/org/apache/cassandra/service/PendingRangeCalculatorService.java
@@ -55,13 +55,17 @@ public class PendingRangeCalculatorService
     {
         public void run()
         {
-            long start = System.currentTimeMillis();
-            for (String keyspaceName : Schema.instance.getNonSystemKeyspaces())
+            try
+            {
+                long start = System.currentTimeMillis();
+                for (String keyspaceName : 
Schema.instance.getNonSystemKeyspaces())
+                    
calculatePendingRanges(Keyspace.open(keyspaceName).getReplicationStrategy(), 
keyspaceName);
+                logger.debug("finished calculation for {} keyspaces in {}ms", 
Schema.instance.getNonSystemKeyspaces().size(), System.currentTimeMillis() - 
start);
+            }
+            finally
             {
-                
calculatePendingRanges(Keyspace.open(keyspaceName).getReplicationStrategy(), 
keyspaceName);
+                PendingRangeCalculatorService.instance.finishUpdate();
             }
-            PendingRangeCalculatorService.instance.finishUpdate();
-            logger.debug("finished calculation for {} keyspaces in {}ms", 
Schema.instance.getNonSystemKeyspaces().size(), System.currentTimeMillis() - 
start);
         }
     }
 

Reply via email to