fix: subgraph catalog entries persistance across checkpoint + reopen#688
Merged
Conversation
… main database has pre-existing tables Bug: DatabaseManager::createGraph() set defaultGraph to the newly created graph before the transaction committed. This caused Catalog::Get() in Transaction::publishCommit() to return the graph's catalog instead of the main catalog when incrementing the version counter. The main catalog's version was never bumped, so changedSinceLastCheckpoint() returned false during CHECKPOINT. With a valid catalogPageRange from a prior checkpoint (e.g., from pre-existing tables), the main catalog was skipped during serialization — the graph entry in the graphs CatalogSet was lost on reopen. The bug only manifested when the database already had tables because: - Without tables: catalogPageRange.startPageIdx == INVALID_PAGE_IDX, forcing unconditional catalog serialization. - With tables: the page range was valid, so version-driven skipping was the only guard — and it always said 'no changes'. Fix: Remove the automatic defaultGraph assignment in createGraph() and loadGraphsFromCatalog(). Users must explicitly USE GRAPH to work in a graph, matching Cypher semantics and the pattern used in all tests. Regression test: SubgraphCatalogPersistsAfterCheckpointWithPreExistingTables reproduces the exact scenario (Hyper-Extract-style schema + subgraph + checkpoint + reopen) and verifies the subgraph survives.
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.
Bug
DatabaseManager::createGraph()setdefaultGraphto the newly created graph before the transaction committed. This causedCatalog::Get()inTransaction::publishCommit()to return the graph's catalog instead of the main catalog when incrementing the version counter. The main catalog's version was never bumped, sochangedSinceLastCheckpoint()returnedfalseduringCHECKPOINT. With a validcatalogPageRangefrom a prior checkpoint (e.g., from pre-existing tables), the main catalog was skipped during serialization — the graph entry in the main catalog'sgraphsCatalogSetwas lost on reopen.Why only with pre-existing tables?
catalogPageRange.startPageIdx == INVALID_PAGE_IDX, forcing unconditional catalog serialization regardless of the version check.Fix
Remove the automatic
defaultGraphassignment increateGraph()andloadGraphsFromCatalog(). Users must explicitlyUSE GRAPHto work in a graph, matching Cypher semantics and the pattern used in all existing tests.Regression test
SubgraphCatalogPersistsAfterCheckpointWithPreExistingTablesreproduces the exact scenario (Hyper-Extract-style schema with 4 node/rel tables + subgraph creation + CHECKPOINT + database reopen) and verifies the subgraph survives.