This is an automated email from the ASF dual-hosted git repository.

zyxxoo pushed a commit to branch refactor/rust-rewrite-design
in repository https://gitbox.apache.org/repos/asf/hugegraph.git


The following commit(s) were added to refs/heads/refactor/rust-rewrite-design 
by this push:
     new c547c7ba2 test(tools): cover overlapping raft histories
c547c7ba2 is described below

commit c547c7ba2408771ade579acf3647633295ee6b09
Author: vaughn <[email protected]>
AuthorDate: Sun Sep 13 15:22:12 2026 +0800

    test(tools): cover overlapping raft histories
---
 tools/raft-linearizability/test_checker.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tools/raft-linearizability/test_checker.py 
b/tools/raft-linearizability/test_checker.py
index bf43260d3..9ec063776 100644
--- a/tools/raft-linearizability/test_checker.py
+++ b/tools/raft-linearizability/test_checker.py
@@ -16,3 +16,21 @@ def test_invalid_read_before_completed_write():
     h = [{"id": 1, "op": "write", "value": 7, "start": 0, "end": 2},
          {"id": 2, "op": "read", "value": 0, "start": 3, "end": 4}]
     assert not checker.check(h)[0]
+
+
+def test_overlapping_writes_and_read_are_linearizable():
+    # The write and read overlap, so the read may linearize after the write.
+    h = [{"id": 1, "op": "write", "value": 1, "start": 0, "end": 5},
+         {"id": 2, "op": "write", "value": 2, "start": 1, "end": 3},
+         {"id": 3, "op": "read", "value": 1, "start": 2, "end": 6}]
+    assert checker.check(h)[0]
+
+
+def test_overlapping_writes_and_reads_are_not_linearizable():
+    # Both writes complete before either read starts; the first read cannot
+    # observe value 1 after write(2) has completed.
+    h = [{"id": 1, "op": "write", "value": 1, "start": 0, "end": 2},
+         {"id": 2, "op": "write", "value": 2, "start": 1, "end": 3},
+         {"id": 3, "op": "read", "value": 1, "start": 4, "end": 5},
+         {"id": 4, "op": "read", "value": 2, "start": 6, "end": 7}]
+    assert not checker.check(h)[0]

Reply via email to