You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sl...@apache.org on 2012/03/07 11:18:54 UTC

[4/5] git commit: Fix division by zero error on get_slice

Fix division by zero error on get_slice

patch by slebresne; reviewed by jbellis for CASSANDRA-4000


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

Branch: refs/heads/trunk
Commit: edb105ded294a78e30b416ec75e83b0e76a30e02
Parents: ef01ca5
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Wed Mar 7 11:13:18 2012 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Wed Mar 7 11:13:18 2012 +0100

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 .../apache/cassandra/db/SliceFromReadCommand.java  |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/edb105de/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index bc10ae2..6e57f35 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -8,6 +8,7 @@
  * Pig: support Counter ColumnFamilies (CASSANDRA-3973)
  * Pig: Composite column support (CASSANDRA-384)
  * Avoid NPE during repair when a keyspace has no CFs (CASSANDRA-3988)
+ * Fix division-by-zero error on get_slice (CASSANDRA-4000)
 
 
 1.0.8

http://git-wip-us.apache.org/repos/asf/cassandra/blob/edb105de/src/java/org/apache/cassandra/db/SliceFromReadCommand.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/SliceFromReadCommand.java b/src/java/org/apache/cassandra/db/SliceFromReadCommand.java
index 58b5e22..4ea89b6 100644
--- a/src/java/org/apache/cassandra/db/SliceFromReadCommand.java
+++ b/src/java/org/apache/cassandra/db/SliceFromReadCommand.java
@@ -84,7 +84,7 @@ public class SliceFromReadCommand extends ReadCommand
             // From that, we can estimate that on this row, for x requested
             // columns, only l/t end up live after reconciliation. So for next
             // round we want to ask x column so that x * (l/t) == t, i.e. x = t^2/l.
-            int retryCount = ((count * count) / liveColumnsInRow) + 1;
+            int retryCount = liveColumnsInRow == 0 ? count + 1 : ((count * count) / liveColumnsInRow) + 1;
             return new RetriedSliceFromReadCommand(table, key, queryPath, start, finish, reversed, getOriginalRequestedCount(), retryCount);
         }