feat(tools): add logdump tool to scan and inspect raft log (pebbledb based)#415
feat(tools): add logdump tool to scan and inspect raft log (pebbledb based)#415sitano wants to merge 4 commits into
Conversation
64d4eb6 to
ee94f70
Compare
Signed-off-by: Ivan Prisyazhnyy <john.koepi@gmail.com>
Signed-off-by: Ivan Prisyazhnyy <john.koepi@gmail.com>
7d1b1a0 to
df6c320
Compare
Signed-off-by: Ivan Prisyazhnyy <john.koepi@gmail.com>
Signed-off-by: Ivan Prisyazhnyy <john.koepi@gmail.com>
|
The PR description explains what the code does but it does not explain why this tool was created. |
|
@kevburnsjr good point! thank you for pointing this out. I will update the description. We needed a tool to inspect in production environment what RSM operations led to the node crash. During roll out of a new version one replica paniced on a data consistency assert. So we had to understand what led to that object state. Our objects that failed had an epoch version that corresponded to the Raft commit index. So we were able to disect what Raft commit pushed this specific object version to the Raft SM. Then, by looking around this specific commit with this tool (logdump) we were able to identify specific subset of Raft commits (proposals) that were differently executed by the leader and a replica. And that allowed us to bisect the code changes that led to the bug. And all that was only possible because we were able to scan over the Raft log with this tool. So I thought other people would appreciate having it too for debugging different issues. |
During roll out of a new version one replica paniced on a data consistency assert. So we had to understand what led to that object state. We needed a tool to inspect in production environment what RSM operations led to the node crash.
Our objects that failed have an epoch version that corresponds to the Raft commit index. So we were able to disect what Raft commit pushed this specific object version to the Raft SM. Then, by looking around this specific commit with this tool (logdump) we were able to identify specific subset of Raft commits (proposals) that were differently executed by the leader and a replica. And that allowed us to bisect the code changes that led to the bug. And all that was only possible because we were able to scan over the Raft log with this tool.
The patch introduces a new tool
/tools/logdumpthat is capable of describing the current raft state and scan over the commit log (Currently based on PebbleDB). It can also bypass LOCK file flock() lease. It opens PebbleDB in read-only mode. It touches no Dragonboat code. The tool can decode Raft log entries as well as it can abstractly decode Entry.Cmd payload if it is encoded in Protobuf.