{"record":{"id":"4f8724d23a99a8fa","repo":"aeron-io/aeron","slug":"truncating-cluster-log-memberid-memberid-state-state-this","errorCode":null,"errorMessage":"Truncating Cluster Log - memberId=${memberId} state=${state} this.logLeadershipTermId=${logLeadershipTermId} this.leadershipTermId=${leadershipTermId} this.candidateTermId=${candidateTermId} this.commitPosition=${commitPosition} this.logPosition=${logPosition} this.appendPosition=${appendPosition} oldPosition=${oldPosition} newPosition=${newPosition}","messagePattern":"Truncating Cluster Log - memberId=(.+?) state=(.+?) this\\.logLeadershipTermId=(.+?) this\\.leadershipTermId=(.+?) this\\.candidateTermId=(.+?) this\\.commitPosition=(.+?) this\\.logPosition=(.+?) this\\.appendPosition=(.+?) oldPosition=(.+?) newPosition=(.+?)","errorType":"exception","errorClass":"ClusterEvent","httpStatus":null,"severity":"info","filePath":"aeron-cluster/src/main/java/io/aeron/cluster/Election.java","lineNumber":636,"sourceCode":"        final long appendPosition,\n        final long oldPosition,\n        final long newPosition)\n    {\n        ClusterTracing.traceOnTruncateLogEntry(\n            memberId,\n            state,\n            logLeadershipTermId,\n            leadershipTermId,\n            candidateTermId,\n            commitPosition,\n            logPosition,\n            appendPosition,\n            oldPosition,\n            newPosition);\n\n        consensusModuleAgent.truncateLogEntry(logLeadershipTermId, newPosition);\n        this.appendPosition = newPosition;\n        throw new ClusterEvent(\"Truncating Cluster Log - memberId=\" + memberId +\n            \" state=\" + state +\n            \" this.logLeadershipTermId=\" + logLeadershipTermId +\n            \" this.leadershipTermId=\" + leadershipTermId +\n            \" this.candidateTermId=\" + candidateTermId +\n            \" this.commitPosition=\" + commitPosition +\n            \" this.logPosition=\" + logPosition +\n            \" this.appendPosition=\" + appendPosition +\n            \" oldPosition=\" + oldPosition +\n            \" newPosition=\" + newPosition);\n    }\n\n    long notifiedCommitPosition()\n    {\n        return notifiedCommitPosition;\n    }\n\n    private int init(final long nowNs)\n    {","sourceCodeStart":618,"sourceCodeEnd":654,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-cluster/src/main/java/io/aeron/cluster/Election.java#L618-L654","documentation":"ClusterEvent thrown by Election.onTruncateLogEntry after the follower's local log has been truncated back to newPosition via consensusModuleAgent.truncateLogEntry. It is an informational marker recording full election state (memberId, terms, positions) at the moment the log was rolled back, typically when a follower discovers the leader's log diverges from its own. The truncation has already been applied; this exception communicates the state transition.","triggerScenarios":"A follower in an election receives a NEW_LEADERSHIP_TERM event whose logPosition/appendPosition is behind what it has already appended, so onNewLeadershipTerm calls onTruncateLogEntry to roll its local recording log back to the leader's position.","commonSituations":"Cluster recovery after a leader crash where the previous leader committed entries that the new leader never had; split-brain residue; rejoining a stale member with a longer log than the elected leader.","solutions":["Inspect the log lines preceding this event to confirm truncation was expected; no action is needed if the cluster recovers and elects normally","If truncation loops repeatedly, verify all members share the same recording log directory and aeron.cluster.dir configuration","Check that the recording log (cluster-mark.mark / segment files) was not manually copied or restored from a different cluster","Upgrade to the latest Aeron patch release; election truncation edge cases have been fixed over time"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Election runs inside the cluster container; catch at service level if embedding\ncatch (ClusterEvent e) {\n    // informational: log truncation already applied; monitor and let election continue\n    LOG.info(\"Election log truncation event: {}\", e.getMessage());\n}","preventionTips":["Never manually copy recording logs between cluster members","Keep all members on the same Aeron version","Monitor election events in logs to detect repeated truncation loops"],"tags":["raft-consensus","log-truncation","cluster-election"],"backgroundTag":"invalid-state-transition","analyzedSha":"6d60124e15e35c11b49ba2e3c2c2858a09a18803","analyzedAt":"2026-09-12T11:17:07.683Z","contentChangedAt":"2026-09-12T11:17:07.683Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}