Testing tinykv project3A LeaderTransferAfterSnapshot3A

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 测试tinykv project3A LeaderTransferAfterSnapshot3A

| username: redgame

After implementing snapshot and leaderTransferee, running TestLeaderTransferAfterSnapshot3A reports an error. The direct cause of the error is that the target node 2 specified for leader transfer did not successfully execute hup() to initiate the election due to the presence of a pendingSnapshot. Referring to this test in etcd, it was found that the test case executes advance, which allows the follower’s pendingSnapshot to be cleared. However, TestLeaderTransferAfterSnapshot3A does not call advance, resulting in the follower’s applied snapshot not being cleared. Has anyone encountered this issue? Can the advance logic be omitted?

| username: Billmay表妹 | Original post link

Based on the information you provided, this issue occurs in the TiKV test case TestLeaderTransferAfterSnapshot3A. According to TiKV’s official documentation, advance is a method used to delete log entries that have already been applied from the Raft Log in the Raft state machine, thereby freeing up storage space. In TiKV, the advance method is typically called after applying a snapshot to clear the already applied log entries.

In your case, since the advance method was not called, the snapshot applied by the follower was not cleared, leading to the failure of the test case. Therefore, it is recommended that you call the advance method in TestLeaderTransferAfterSnapshot3A to clear the already applied log entries. If you do not want to call the advance method, you can also consider manually clearing the applied snapshot in the test case to ensure it runs correctly.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.