Skip to main content
Version: latest

FalkorDB mixed-read window

The mixed-read window is the period during an add commit on FalkorDB when a read can return part of the change and miss the rest. FalkorDB runs each query atomically on its own, and it has no transaction that spans several queries. The commit of one document is several queries, so each query's writes become visible when that query returns. Neo4j runs the same commit in one transaction, so a reader sees the old version or the new version and never a mix.

Rows stay hidden until commit​

An add writes each node and relationship tagged with the ID of the job that created it. Retrieval queries read only rows without a pending tag, so a read outside the job sees the document's previous version while the job is pending. Vector search, graph walks, and evidence queries apply the same filter.

A write that reaches a committed row does not change that row before the commit. The store holds the write, and the commit replays it.

Commit steps on FalkorDB​

The commit runs these steps in order:

  1. Take the match lock, check the stored schema, and record that the commit started.
  2. Check the job's pending entity matches against committed rules.
  3. Replay the held writes over committed rows.
  4. Fold the job's new relationships into their canonical IDs.
  5. Close the open edges of the superseded version.
  6. Remove the job's tag from each node label and each relationship type.
  7. Mark the job as committed.

On FalkorDB, each step is one or more separate queries, and each one takes effect when it returns. On Neo4j, the same steps run in one transaction.

What a reader can see during the commit​

A read can fall between any two steps, so these partial states can occur on FalkorDB:

  • Some node labels show their new rows while other labels still hide theirs. Step 6 runs once for each label and once for each relationship type.
  • A committed row that step 3 changed can show its new value while the new rows that link to it are still hidden.
  • Step 5 closes the superseded version's edges before step 6 exposes the new version's edges. A read in that gap finds no current version for the document.
  • Retrieval filters on row tags and does not check the job's status. New rows become visible at step 6, before step 7 marks the job as committed.

Neo4j does not show these states. The window exists only because the steps are separate queries.

What a reader sees on each backend​

MomentNeo4jFalkorDB
Before the commit startsThe previous versionThe previous version
During the commitThe previous version or the new versionAny mix of the steps that have finished
After the commit finishesThe new versionThe new version
The commit failsThe transaction rolls back, and the job stays pending until recoveryFinished steps remain. A commit that reached its start marker is finished by Graph.open after the lease expires.

The backend comparison in Graph storage lists the same transaction difference for multi-statement writes.

Reason about a read during an add​

Use these rules when a read can run while an add or update commits:

  1. Treat a read during a commit as a read of one of the states above. On FalkorDB, seeing some new rows does not show that the commit has finished.
  2. Treat the return of the add call as the end of the commit. The call awaits its job, so a later read from the same process sees the complete new version.
  3. Do not rely on a group of reads for one consistent view on FalkorDB. A callback passed to run_in_transaction runs its statements in order and gives no snapshot, so another commit can land between two reads on either backend.
  4. Use Neo4j when a query must read one consistent version of a document across several statements. The configuration guide explains the FalkorDB atomicity limit.

Failures and timeouts​

FalkorDB waits up to 300 seconds for a reply on an open connection. A write that times out may still have committed. Calling add again with the same documents writes only what changed, so a retry does not repeat a committed document.

On FalkorDB, a commit that hits a uniqueness conflict with another job retries under the same lease for up to one lease TTL. A write conflict is raised at once, and the job is left for a later Graph.open after its lease expires. Set the TTL with CUTOVER_JOB_LEASE_TTL_SECONDS. The crash recovery section describes the finish-or-roll-back rules after a stopped process.