You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2013/09/10 00:11:31 UTC

[4/5] git commit: fix re-propose of earlier, incomplete paxos round to use new ballot patch by jbellis; reviewed by slebresne for CASSANDRA-5985

fix re-propose of earlier, incomplete paxos round to use new ballot
patch by jbellis; reviewed by slebresne for CASSANDRA-5985


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

Branch: refs/heads/cassandra-2.0
Commit: 04cd81cdbb16e4f64b950325b581c6ba573b14a8
Parents: 41798b6
Author: Jonathan Ellis <jb...@apache.org>
Authored: Sun Sep 8 23:41:24 2013 +0100
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Mon Sep 9 23:10:57 2013 +0100

----------------------------------------------------------------------
 .../org/apache/cassandra/service/StorageProxy.java     | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/04cd81cd/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 9af310d..50dfd07 100644
--- a/src/java/org/apache/cassandra/service/StorageProxy.java
+++ b/src/java/org/apache/cassandra/service/StorageProxy.java
@@ -382,8 +382,17 @@ public class StorageProxy implements StorageProxyMBean
             if (!inProgress.update.isEmpty() && inProgress.isAfter(mostRecent))
             {
                 Tracing.trace("Finishing incomplete paxos round {}", inProgress);
-                if (proposePaxos(inProgress, liveEndpoints, requiredParticipants))
-                    commitPaxos(inProgress, ConsistencyLevel.QUORUM);
+                Commit refreshedInProgress = Commit.newProposal(inProgress.key, ballot, inProgress.update);
+                if (proposePaxos(refreshedInProgress, liveEndpoints, requiredParticipants))
+                {
+                    commitPaxos(refreshedInProgress, ConsistencyLevel.QUORUM);
+                }
+                else
+                {
+                    Tracing.trace("Some replicas have already promised a higher ballot than ours; aborting");
+                    // sleep a random amount to give the other proposer a chance to finish
+                    Uninterruptibles.sleepUninterruptibly(FBUtilities.threadLocalRandom().nextInt(100), TimeUnit.MILLISECONDS);
+                }
                 continue;
             }