From cd046782d42b794104be276f6db7f9d242e5e709 Mon Sep 17 00:00:00 2001 From: RongtongJin Date: Wed, 8 Mar 2023 17:31:31 +0800 Subject: [PATCH] Polish the DLedgerControllerStateMachine log output to help troubleshoot --- .../controller/impl/DLedgerControllerStateMachine.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerControllerStateMachine.java b/controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerControllerStateMachine.java index dde94e9981e..3d37c1eaf4a 100644 --- a/controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerControllerStateMachine.java +++ b/controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerControllerStateMachine.java @@ -48,6 +48,8 @@ public DLedgerControllerStateMachine(final ReplicasInfoManager replicasInfoManag @Override public void onApply(CommittedEntryIterator iterator) { int applyingSize = 0; + long firstApplyIndex = -1; + long lastApplyIndex = -1; while (iterator.hasNext()) { final DLedgerEntry entry = iterator.next(); final byte[] body = entry.getBody(); @@ -55,9 +57,11 @@ public void onApply(CommittedEntryIterator iterator) { final EventMessage event = this.eventSerializer.deserialize(body); this.replicasInfoManager.applyEvent(event); } + firstApplyIndex = firstApplyIndex == -1 ? entry.getIndex() : firstApplyIndex; + lastApplyIndex = entry.getIndex(); applyingSize++; } - log.info("Apply {} events on controller {}", applyingSize, this.dLedgerId); + log.info("Apply {} events index from {} to {} on controller {}", applyingSize, firstApplyIndex, lastApplyIndex, this.dLedgerId); } @Override @@ -69,7 +73,6 @@ public boolean onSnapshotLoad(SnapshotReader reader) { return false; } - @Override public void onShutdown() { }