Repository navigation
fix: Calvin predicate writes in transactions, fusion primary keys, bitemporal predicate writes - #429
Merged
Merged
Conversation
…state Predicate UPDATE and DELETE inside a session transaction now read their rows at the statement as the transaction sees them. The plan carries the matched surrogates and implicit edges, the stage refuses a mismatched prediction, and a Calvin COMMIT stages exactly those rows and checks them again at its turn. Redo records and admission keys name every collection a transaction writes. Bitemporal collections gain system-time index lookups, version-aware index backfill, point delete and truncate, and CONVERT COLLECTION that rewrites live versions in place. Index lookups fall back to a version scan for valid-time and all-versions reads. Array table functions form relations: ARRAY_AGG and ARRAY_ELEMENTWISE rows are selectable, and temporal reads append a horizon summary row. GraphRAG fusion keys legs by graph node name, then surrogate, so a node name never collides with a surrogate. Response translation resolves primary keys and shapes fusion results accordingly.
2 of 7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Predicate writes commit through Calvin from every transaction path, GRAPH RAG FUSION returns primary keys,
ARRAY_AGGoutput is a relation, and predicate writes on bitemporal collections work.Closes #424. Closes #425. Settles #428: every search response names rows through one Control-Plane resolver, not the Data Plane.
Calvin predicate writes (#424 part A)
UPDATEorDELETEinsideBEGIN … COMMIT, a trigger body or a procedure body reads its rows at its own statement and carries them in its plan. Before this, the buffered plan carried no rows and the Calvin stage refused it with XX000.PredictionDrift: autocommit retries, andCOMMITaborts with SQLSTATE40001.UPDATEthat moves an edge's_fromor_towrites the edge update.Calvin stage refusals (#425)
calvin_stage_refusallogs every refusal:debugfor prediction drift,warnfor any other.GRAPH RAG FUSION naming (#424 part B)
RagKey(graph node, row surrogate, unbound entry), so a key"7"never merges with surrogate 7. A text hit on a graph node fuses with that node.translate_search_responseandshape_response_materializedare async through every caller.ARRAY_AGGandARRAY_ELEMENTWISEas relationsWHERE, computed columns,GROUP BY,ORDER BY,DISTINCTandLIMITapply to their rows directly, through the same pathARRAY_SLICEuses.truncated_before_horizoncolumn.Bitemporal collections
On a bitemporal collection, predicate
UPDATEandDELETEmatched no rows: they read only the plain table. This PR adds one shared current-version read, and every caller uses it.UPDATEandDELETEwrite versions through the same per-row path as point writes: tombstones, versioned index entries, and versioned redo entries.TRUNCATE, in autocommit and in a transaction, closes every current version. History stays readable withAS OF.DROP INDEXremoves the versioned index entries in the same transaction as the plain ones.CREATE INDEXbackfills each version at its own system time.AS OF SYSTEM TIMEindexed equality reads the versioned index at the cutoff. Before this, it answered from the current index. The same holds for anIN (SELECT …)side readAS OF.CONVERTto a document engine rewrites every version.CONVERTtokvis refused before any row moves.Behaviour changes
COMMITabort with40001. The client retries the transaction.TRUNCATEon a bitemporal collection keeps the history.CONVERTof a bitemporal collection tokvis refused.Lite
Lite compiles against this branch. Lite answers an
AS OFindexed equality from the current index, which it already did before this change. The fix needs the newIndexedFetch.system_as_of_msfield at:nodedb-lite/src/query/visitor/queries.rslower_document_index_lookupnodedb-lite/src/query/physical_visitor/adapter/document/dispatch.rs, theDocumentOp::IndexedFetcharmTesting
sync_peer_id_collision::a_second_replica_claiming_an_owned_peer_id_is_refused_not_absorbed, sits in CRDT sync code this PR does not touch. It passed 25/25 when run alone.nodedb-clientfeature sets,cargo deny, every static gate, the wasm32 check, and the replay of all fuzz targets.40001on a concurrent change, materialized sums, edge moves, fusion naming on one node and across three nodes, array relations, and bitemporal writes,TRUNCATE,CONVERT,DROP INDEXandAS OFindex reads.trigger_e2epublish waits, audit group commit, and event-consumer catch-up.