From 52c8107588ca5527a8428d667b9ea07d56d131b3 Mon Sep 17 00:00:00 2001 From: hzh0425 <58988019+hzh0425@users.noreply.github.com> Date: Thu, 28 Apr 2022 16:45:40 +0800 Subject: [PATCH] Fix bug in statemachine mode (#139) --- .../io/openmessaging/storage/dledger/DLedgerEntryPusher.java | 3 ++- .../java/io/openmessaging/storage/dledger/DLedgerServer.java | 1 + .../storage/dledger/statemachine/StateMachineCaller.java | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/openmessaging/storage/dledger/DLedgerEntryPusher.java b/src/main/java/io/openmessaging/storage/dledger/DLedgerEntryPusher.java index 97f64826..22b7b509 100644 --- a/src/main/java/io/openmessaging/storage/dledger/DLedgerEntryPusher.java +++ b/src/main/java/io/openmessaging/storage/dledger/DLedgerEntryPusher.java @@ -82,6 +82,7 @@ public DLedgerEntryPusher(DLedgerConfig dLedgerConfig, MemberState memberState, } this.entryHandler = new EntryHandler(logger); this.quorumAckChecker = new QuorumAckChecker(logger); + this.fsmCaller = Optional.empty(); } public void startup() { @@ -372,7 +373,7 @@ public void doWork() { } if (ackNum == 0) { - checkResponseFuturesTimeout(quorumIndex); + checkResponseFuturesTimeout(quorumIndex + 1); waitForRunning(1); } diff --git a/src/main/java/io/openmessaging/storage/dledger/DLedgerServer.java b/src/main/java/io/openmessaging/storage/dledger/DLedgerServer.java index 5eaf43a1..73d1d53f 100644 --- a/src/main/java/io/openmessaging/storage/dledger/DLedgerServer.java +++ b/src/main/java/io/openmessaging/storage/dledger/DLedgerServer.java @@ -88,6 +88,7 @@ public DLedgerServer(DLedgerConfig dLedgerConfig) { t.setName("DLedgerServer-ScheduledExecutor"); return t; }); + this.fsmCaller = Optional.empty(); } public void startup() { diff --git a/src/main/java/io/openmessaging/storage/dledger/statemachine/StateMachineCaller.java b/src/main/java/io/openmessaging/storage/dledger/statemachine/StateMachineCaller.java index 74cd5e5d..8e11df5f 100644 --- a/src/main/java/io/openmessaging/storage/dledger/statemachine/StateMachineCaller.java +++ b/src/main/java/io/openmessaging/storage/dledger/statemachine/StateMachineCaller.java @@ -159,7 +159,7 @@ private void doCommitted(final long committedIndex) { // Check response timeout. if (iter.getCompleteAckNums() == 0) { if (this.entryPusher != null) { - this.entryPusher.checkResponseFuturesTimeout(this.lastAppliedIndex.get()); + this.entryPusher.checkResponseFuturesTimeout(this.lastAppliedIndex.get() + 1); } } }