Merged
Conversation
Implement graph namespaces that provide catalog-level isolation, allowing tables with the same name to exist in different graphs. Changes: - Grammar: Add CREATE GRAPH and USE GRAPH statements to Cypher.g4 - Parser: Add GraphStatement, CreateGraph, UseGraph AST nodes - Binder: Add BoundCreateGraph, BoundUseGraph bound statements - Planner: Add LogicalCreateGraph, LogicalUseGraph operators - Processor: Add CreateGraph, UseGraph physical operators - DatabaseManager: Store separate catalogs per graph - Catalog: Return graph catalog when default graph is set Tests: Add e2e tests for multi-graph table isolation Note: Storage is shared at database level. For complete data isolation, graph-specific storage paths would be needed.
Modify show_tables() to: - Show tables from all graphs and the main database - Display graph names as "<name>(graph)" in the database column - Add getGraphs() method to DatabaseManager for iterating all graphs - update tests to clean up test tables in all graphs
Implement DROP GRAPH to complement CREATE GRAPH and USE GRAPH for complete graph catalog isolation. Users can now: - Create isolated graphs with CREATE GRAPH <name> - Switch between graphs with USE GRAPH <name> - Drop graphs with DROP GRAPH <name> Key changes: - Add GRAPH to DropType enum - Implement dropGraph() in DatabaseManager and Drop operator - Fix error types to use BinderException for graph-related errors - Update tests to verify all graph operations including error cases Note: Cannot drop a graph that is currently in use - must switch away first.
- Remove SKIP_FSM_LEAK_CHECK from all test cases - Add proper cleanup to each test using DROP GRAPH - Modify dropGraph to clear defaultGraph to "local" when dropping current graph - Simplified DropGraph test by removing unnecessary SwitchAwayAndDrop section This makes the behavior more user-friendly - you can now drop a graph even if it's currently in use, and it will automatically switch to "local".
- Add special case in setDefaultGraph to accept "local" (case-insensitive) - Add test for USE GRAPH local Users can now switch back to the main database with: USE GRAPH local;
- USE GRAPH main switches to main database - LOCAL_DB_NAME changed from local(lbug) to main(graph) - SHADOW_DB_NAME changed from shadow(lbug) to shadow(graph) - Test updated to reflect new naming The (graph) suffix is more intuitive since lbug is the database type.
- Catalog now owns its own StorageManager via unique_ptr - DatabaseManager::createGraph() creates a separate StorageManager for each graph - StorageManager::Get() looks up the storage manager from the graph catalog - Fix circular include: remove catalog.h from storage_manager.h header, move to storage_manager.cpp, use forward declarations in header
Use the main storage manager during drop graph <name>, so we don't crash by accessing memory that's already been freed.
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.
This concept is similar to how postgres handles multiple databases in one instance.