fix(raft): multi-stmt write gate, rich apply, delete kv convention
CI / test (push) Has been cancelled
CI / verify (push) Has been cancelled
Clients CI / build-server (push) Has been cancelled
Clients CI / test-python (push) Has been cancelled
Clients CI / test-javascript (push) Has been cancelled
Clients CI / test-nim (push) Has been cancelled
Clients CI / test-rust (push) Has been cancelled

- Reject follower writes if any statement in the batch is DML/COMMIT
  (not only stmts[0]).
- COMMIT always emits empty-valued kvPairs for isDelete entries.
- applyCommand updates LSM plus secondary B-tree/FTS/HNSW indexes
  (applyReplicatedPut/Delete) so follower index scans see replicated rows.
- Tests: not-leader append, commit timeout, index apply unit, E2E
  index-backed SELECT on follower.
This commit is contained in:
2026-07-30 21:14:46 +03:00
parent a462d21b25
commit 0d51497f57
7 changed files with 193 additions and 9 deletions
+12
View File
@@ -396,3 +396,15 @@ suite "Raft write classification":
check not isWrite(parse("CREATE TABLE t (id INT)").stmts[0])
check not isWrite(parse("BEGIN").stmts[0])
check not isWrite(parse("ROLLBACK").stmts[0])
test "multi-statement queries with a trailing write are still writes":
## Server rejection must not look only at stmts[0] — a SELECT first
## would otherwise let a follower execute the INSERT.
let ast = parse("SELECT 1; INSERT INTO t (id) VALUES (1)")
check ast.stmts.len == 2
check not isWrite(ast.stmts[0])
check isWrite(ast.stmts[1])
var anyWrite = false
for s in ast.stmts:
if isWrite(s): anyWrite = true
check anyWrite