Skip to content

Commit 791b115

Browse files
author
Iulian Moraru
committed
Fixed 3-replica execution bug that caused crash.
1 parent b3ab2cf commit 791b115

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

src/epaxos/epaxos-exec.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,9 @@ func (e *Exec) strongconnect(v *Instance, index *int) bool {
6565
stack = stack[0 : l+1]
6666
stack[l] = v
6767

68-
for q, inst := range v.Deps {
68+
for q := int32(0); q < int32(e.r.N); q++ {
69+
inst := v.Deps[q]
6970
for i := e.r.ExecedUpTo[q] + 1; i <= inst; i++ {
70-
if i <= e.r.ExecedUpTo[q] {
71-
continue
72-
}
7371
for e.r.InstanceSpace[q][i] == nil || e.r.InstanceSpace[q][i].Cmds == nil || v.Cmds == nil {
7472
time.Sleep(1000 * 1000)
7573
}

src/epaxos/epaxos.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const ADAPT_TIME_SEC = 10
2424

2525
const MAX_BATCH = 1000
2626

27-
const COMMIT_GRACE_PERIOD = 2 * 1e9 //2 seconds
27+
const COMMIT_GRACE_PERIOD = 10 * 1e9 //10 seconds
2828

2929
const BF_K = 4
3030
const BF_M_N = 32.0
@@ -440,6 +440,12 @@ func (r *Replica) executeCommands() {
440440
for q := 0; q < r.N; q++ {
441441
inst := int32(0)
442442
for inst = r.ExecedUpTo[q] + 1; inst < r.crtInstance[q]; inst++ {
443+
if r.InstanceSpace[q][inst] != nil && r.InstanceSpace[q][inst].Status == epaxosproto.EXECUTED {
444+
if inst == r.ExecedUpTo[q]+1 {
445+
r.ExecedUpTo[q] = inst
446+
}
447+
continue
448+
}
443449
if r.InstanceSpace[q][inst] == nil || r.InstanceSpace[q][inst].Status != epaxosproto.COMMITTED {
444450
if inst == problemInstance[q] {
445451
timeout[q] += SLEEP_TIME_NS
@@ -456,12 +462,6 @@ func (r *Replica) executeCommands() {
456462
}
457463
break
458464
}
459-
if r.InstanceSpace[q][inst].Status == epaxosproto.EXECUTED {
460-
if inst == r.ExecedUpTo[q]+1 {
461-
r.ExecedUpTo[q] = inst
462-
}
463-
continue
464-
}
465465
if ok := r.exec.executeCommand(int32(q), inst); ok {
466466
executed = true
467467
if inst == r.ExecedUpTo[q]+1 {

0 commit comments

Comments
 (0)