Repository navigation
Conversation
tcode.redb replaces sessions.json. Each index change writes the rows it touches in one transaction on the blocking pool, and the store writer commits back-to-back index writes together, instead of re-reading and rewriting the whole file for every change. The host opens the database as redb's single writer under experimental-multiprocess: another process can read it while the host runs, and a second host on the same data directory fails with an explicit error instead of silently overwriting. A relaunch waits for the outgoing instance to close it. sessions.json is imported once into a temporary database, read back and compared, then kept as sessions.json.migrated. A row this build cannot decode is skipped and left in place rather than failing the whole index. Closes #523
This was referenced Oct 4, 2026
Owner
Author
|
Folded into #591, which carries this commit unchanged as one PR for the whole storage phase. |
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
Third slice of the storage work in #535, stacked on #587. Closes #523.
The project and thread index moves from one rewritten-whole
sessions.jsonto a redb database, so an index write costs what changed rather than the whole file.experimental-multiprocessinConcurrencyMode::SingleWriter(maintainer's decision, Principle 8; already in the locked 4.3.0). A second host on the same data directory fails: headless exits 1, the desktop shows a critical alert and exits 1. A start after a relaunch marker waits up to 15 s for the outgoing instance.SessionStore::open_atstays directory-only: only a host opens the database;set-password,pairand clients never do.Departure from the issue. #523 proposed
Durability::Nonefor index-only updates. redb refuses it in multi-process modes, so every commit is durable. See the table below.Evidence
One meta upsert on a 2,957-session index:
sessions.json)Three batched writes cost the same as one.
sessions.json(23 projects, 2,957 sessions) imports with every row equal field for field to a plain parse;.migratedis byte-identical; a second start changes no row. Import 44 ms, database 4.2 MB.tcode.redbin place failed 1 of 60, which is why the import builds under a temporary name. SIGKILL during commits, 60 runs: no torn transaction, no acknowledged commit lost.store/index.rs: literal legacy inputs import once; the four interrupted-import states reopen to the full index; an unparseablesessions.jsonis preserved and the index starts empty; undecodable rows are skipped and kept; a second host is refused until the first closes; replacing or removing a project deletes only its managed icon; compaction after doubling.session_index_upserts_orders_and_removes_only_the_selected_session(ordering is the host's sort at load; the rest is covered by the index and cascade tests). Two tests that ran a second host while the first was alive, which the app never does, now stop the first or read the live host's rows.Merge Danger
Door: one-way
After the first start,
tcode.redbis the truth. Rolling back to a JSON build means restoring fromsessions.json.migratedand losing every index change made since. The migrated file is byte-identical, so that rollback is possible but manual.Blast Radius: every host's data directory
LockFileExrange locks and Linux OFD locks are verified only by the second-host test in CI; not run locally on Android, Windows or Linux. The startup-failure alert was exercised on macOS.