cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject [1/5] git commit: Fix handling of empty counter replication mutations
Date Tue, 03 Jun 2014 16:06:31 GMT
Repository: cassandra
Updated Branches:
  refs/heads/trunk 1914a1116 -> 46536510a


Fix handling of empty counter replication mutations

patch by Aleksey Yeschenko; reviewed by Richard Low for CASSANDRA-7144


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

Branch: refs/heads/trunk
Commit: 1dc157afe7da3dce57f7657e445ba12f16073d49
Parents: d48a187
Author: Aleksey Yeschenko <aleksey@apache.org>
Authored: Tue Jun 3 18:51:20 2014 +0300
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Tue Jun 3 18:51:20 2014 +0300

----------------------------------------------------------------------
 CHANGES.txt                                           |  1 +
 src/java/org/apache/cassandra/db/CounterMutation.java |  3 ++-
 .../org/apache/cassandra/service/StorageProxy.java    | 14 ++++++++++++--
 3 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/1dc157af/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index e45cc72..8014170 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 1.2.17
+ * Fix handling of empty counter replication mutations (CASSANDRA-7144)
  * Use LOCAL_ONE for non-superuser auth queries (CASSANDRA-7328)
  * Set keepalive on MessagingService connections (CASSANDRA-7170)
  * Add Cloudstack snitch (CASSANDRA-7147)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1dc157af/src/java/org/apache/cassandra/db/CounterMutation.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/CounterMutation.java b/src/java/org/apache/cassandra/db/CounterMutation.java
index 62ea3f7..76aaeb5 100644
--- a/src/java/org/apache/cassandra/db/CounterMutation.java
+++ b/src/java/org/apache/cassandra/db/CounterMutation.java
@@ -96,7 +96,8 @@ public class CounterMutation implements IMutation
                 cf.retainAll(rowMutation.getColumnFamily(cf.metadata().cfId));
             replicationMutation.add(cf);
         }
-        return replicationMutation;
+
+        return replicationMutation.isEmpty() ? null : replicationMutation;
     }
 
     private void addReadCommandFromColumnFamily(String table, ByteBuffer key, ColumnFamily
columnFamily, List<ReadCommand> commands)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1dc157af/src/java/org/apache/cassandra/service/StorageProxy.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StorageProxy.java b/src/java/org/apache/cassandra/service/StorageProxy.java
index 7ef3d72..3c3c052 100644
--- a/src/java/org/apache/cassandra/service/StorageProxy.java
+++ b/src/java/org/apache/cassandra/service/StorageProxy.java
@@ -781,8 +781,18 @@ public class StorageProxy implements StorageProxyMBean
                     {
                         public void runMayThrow() throws OverloadedException
                         {
-                            // send mutation to other replica
-                            sendToHintedEndpoints(cm.makeReplicationMutation(), remotes,
responseHandler, localDataCenter, consistency_level);
+                            // send the mutation to other replicas, if not null (see CASSANDRA-7144
for details)
+                            RowMutation replicationMutation = cm.makeReplicationMutation();
+                            if (replicationMutation != null)
+                            {
+                                sendToHintedEndpoints(cm.makeReplicationMutation(), remotes,
responseHandler, localDataCenter, consistency_level);
+                            }
+                            else
+                            {
+                                // simulate the rest of the responses to avoid the timeout
+                                for (int i = 0; i < remotes.size(); i++)
+                                    responseHandler.response(null);
+                            }
                         }
                     });
                 }


Mime
View raw message