cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject git commit: fix NPE patch by Benedict Elliott Smith; reviewed by jbellis for CASSANDRA-6671
Date Fri, 07 Feb 2014 02:29:31 GMT
Updated Branches:
  refs/heads/trunk ff2a92c13 -> 5fe060074


fix NPE
patch by Benedict Elliott Smith; reviewed by jbellis for CASSANDRA-6671


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

Branch: refs/heads/trunk
Commit: 5fe0600744cba01d8e238746c0bd363f2059320c
Parents: ff2a92c
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Thu Feb 6 20:28:35 2014 -0600
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Thu Feb 6 20:29:09 2014 -0600

----------------------------------------------------------------------
 src/java/org/apache/cassandra/db/DataTracker.java             | 7 ++++---
 src/java/org/apache/cassandra/utils/concurrent/WaitQueue.java | 4 ++--
 2 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/5fe06007/src/java/org/apache/cassandra/db/DataTracker.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/DataTracker.java b/src/java/org/apache/cassandra/db/DataTracker.java
index f2aae50..d90c0ff 100644
--- a/src/java/org/apache/cassandra/db/DataTracker.java
+++ b/src/java/org/apache/cassandra/db/DataTracker.java
@@ -437,11 +437,12 @@ public class DataTracker
     public int getMeanColumns()
     {
         long sum = 0;
-        int count = 0;
+        long count = 0;
         for (SSTableReader sstable : getSSTables())
         {
-            sum += sstable.getEstimatedColumnCount().mean();
-            count++;
+            long n = sstable.getEstimatedColumnCount().count();
+            sum += sstable.getEstimatedColumnCount().mean() * n;
+            count += n;
         }
         return count > 0 ? (int) (sum / count) : 0;
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5fe06007/src/java/org/apache/cassandra/utils/concurrent/WaitQueue.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/concurrent/WaitQueue.java b/src/java/org/apache/cassandra/utils/concurrent/WaitQueue.java
index 3b4ce5f..4f3747d 100644
--- a/src/java/org/apache/cassandra/utils/concurrent/WaitQueue.java
+++ b/src/java/org/apache/cassandra/utils/concurrent/WaitQueue.java
@@ -111,7 +111,8 @@ public final class WaitQueue
      */
     public void signalAll()
     {
-        if (!hasWaiters())
+        RegisteredSignal last = queue.peekLast();
+        if (last == null)
             return;
         List<Thread> woke = null;
         if (logger.isTraceEnabled())
@@ -119,7 +120,6 @@ public final class WaitQueue
         long start = System.nanoTime();
         // we wake up only a snapshot of the queue, to avoid a race where the condition is
not met and the woken thread
         // immediately waits on the queue again
-        RegisteredSignal last = queue.getLast();
         Iterator<RegisteredSignal> iter = queue.iterator();
         while (iter.hasNext())
         {


Mime
View raw message