summaryrefslogtreecommitdiff
path: root/same/src/main/java/com/orbekk/paxos
diff options
context:
space:
mode:
authorKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-03-20 12:45:26 +0100
committerKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-03-20 12:45:35 +0100
commit409dfe838e8ae30e2512256852c1fef31f3255b4 (patch)
tree002c0011d3549fb0da3ec3067e8376c84151a947 /same/src/main/java/com/orbekk/paxos
parent6299172d3b9ba0b98b77583c0c3c5fc90d1b7db5 (diff)
Make sure there is only one valid new master.
This is done using the paxos proposal number as a certificate.
Diffstat (limited to 'same/src/main/java/com/orbekk/paxos')
-rw-r--r--same/src/main/java/com/orbekk/paxos/MasterProposer.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/same/src/main/java/com/orbekk/paxos/MasterProposer.java b/same/src/main/java/com/orbekk/paxos/MasterProposer.java
index 8469cf4..094a749 100644
--- a/same/src/main/java/com/orbekk/paxos/MasterProposer.java
+++ b/same/src/main/java/com/orbekk/paxos/MasterProposer.java
@@ -91,9 +91,9 @@ public class MasterProposer extends Thread {
}
Integer proposeRetry(int proposalNumber, Runnable retryAction) {
- assert proposalNumber >= 0;
+ assert proposalNumber > 0;
int nextProposal = proposalNumber;
- int result = -1;
+ int result = nextProposal - 1;
while (!Thread.interrupted() && result != nextProposal) {
result = internalPropose(nextProposal);