Skip to content

fix: honor native index node reference policy - #45

Merged
tiensonqin merged 1 commit into
mainfrom
logseq/fix-native-weak-index-cache
Oct 16, 2026
Merged

tiensonqin merged 1 commit into
mainfrom
logseq/fix-native-weak-index-cache

Conversation

@tiensonqin

Copy link
Copy Markdown
Contributor

Native storage restore overrides persisted Weak index references with Strong, keeping every visited PSS node reachable for the database lifetime. Scanning a graph can therefore retain the decoded index in memory even after indexing finishes.

Disable the native override so restore honors the persisted reference policy, matching the other runtimes. Explicit Strong settings remain supported. Add a regression test that checks both policies and verifies that collected weak nodes reload correctly after a major GC.

Validation passed: opam exec -- dune exec test/test_storage.exe, opam exec -- dune exec test/test_conn.exe, and opam exec -- dune runtest (including native/JS/upstream SQLite parity). Optional local-graph smoke checks were skipped because their fixtures were unavailable.

Weak caching can increase storage reads after major collections; this change restores the requested cache policy rather than retaining all visited nodes indefinitely. The separate Logseq storage-payload cache fix is outside this PR.

Preserve persisted Weak and explicit Strong policies when restoring native storage-backed indexes. Cover node collection and reload behavior with a regression test.
@tiensonqin
tiensonqin merged commit 5d76912 into main Oct 16, 2026
2 checks passed
@tiensonqin
tiensonqin deleted the logseq/fix-native-weak-index-cache branch October 16, 2026 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant