Skip to content

Commit 872e4e4

Browse files
author
Taichi Yamakawa
committed
Add diagnostic infomation (lastApplied,eventSourcingIndex,preserveLogSize) to warn log
1 parent 3bb9a43 commit 872e4e4

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/main/scala/lerna/akka/entityreplication/raft/RaftActor.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,11 +475,13 @@ private[raft] class RaftActor(
475475
log.warning(
476476
"[{}] Skipping compaction since compaction might not delete enough entries " +
477477
"(even if this compaction continues, the remaining entries will trigger new compaction at the next tick). " +
478-
"Estimated compacted log size is [{}] entries. compaction.log-size-threshold is [{}] entries. " +
478+
s"Estimated compacted log size is [{}] entries (lastApplied [{}], eventSourcingIndex [{}], preserveLogSize [${settings.compactionPreserveLogSize}]), " +
479+
s"however compaction.log-size-threshold is [${settings.compactionLogSizeThreshold}] entries. " +
479480
"This warning happens if event sourcing is too slow or compaction is too fast.",
480481
currentState,
481482
estimatedCompactedLogSize,
482-
settings.compactionLogSizeThreshold,
483+
currentData.lastApplied,
484+
currentData.eventSourcingIndex,
483485
)
484486
}
485487
} else {

src/test/scala/lerna/akka/entityreplication/raft/RaftActorSpec.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,8 @@ class RaftActorSpec extends TestKit(ActorSystem()) with RaftActorSpecBase {
538538
.warn(
539539
"[Follower] Skipping compaction since compaction might not delete enough entries " +
540540
"(even if this compaction continues, the remaining entries will trigger new compaction at the next tick). " +
541-
"Estimated compacted log size is [3] entries. compaction.log-size-threshold is [3] entries. " +
541+
"Estimated compacted log size is [3] entries (lastApplied [3], eventSourcingIndex [Some(0)], preserveLogSize [1]), " +
542+
"however compaction.log-size-threshold is [3] entries. " +
542543
"This warning happens if event sourcing is too slow or compaction is too fast.",
543544
).expect {
544545
val leaderMemberIndex = createUniqueMemberIndex()

0 commit comments

Comments
 (0)