[fix] Prevent stale reads during clear by marking indexes before storage deletion - #141
Conversation
Signed-off-by: yxstev <zhangyixiang9@huawei.com>
CLA Signature Passdodatboii, thanks for your pull request. All authors of the commits have signed the CLA. 👍 |
|
Solution for #137 |
|
Unless I've misunderstood, PR uses
I think we need to modify the state machine to identify the “delete” state separately. ACTIVE --> PREPARE_CLEAR(clear_id, generation) -- > CLEARING -->delete success --> COMMIT_CLEAR --> DELETED / release index |
Thanks for the thorough analysis. You're right that The full state machine you proposed (PREPARE_CLEAR → CLEARING → COMMIT_CLEAR) would require significant changes to the tensor structure and introduce retry/generation tracking across the client and controller. I'd prefer to keep that as a future improvement if the single-threaded guarantee ever changes, rather than taking on that complexity now. |
ok, that's fine. |
|
We need to add controller side test in later PR |
Add comprehensive controller-side tests for the mark_clearing method introduced in PR #141. Tests verify the three-step clear protocol prevents stale reads and handles edge cases gracefully. - test_controller_mark_clearing: verifies mark_clearing prevents consumers from fetching samples pending deletion - test_controller_mark_clearing_idempotent: tests robustness with non-existent partitions, partial indexes, and multi-partition cases --------- Signed-off-by: dodatboii <zhangyixiang9@huawei.com>
Introduce a three-step clear protocol to close the consistency window where storage data is already deleted but the controller still considers the indexes readable: