Skip to content

fix(vfs): allow DROP GRAPH when the database path has no extension - #1567

Open
Tyagiquamar wants to merge 1 commit into
LadybugDB:mainfrom
Tyagiquamar:fix/1562-drop-graph-extensionless-db
Open

Tyagiquamar wants to merge 1 commit into
LadybugDB:mainfrom
Tyagiquamar:fix/1562-drop-graph-extensionless-db

Conversation

@Tyagiquamar

Copy link
Copy Markdown
Contributor

Problem

DROP GRAPH fails when the on-disk database path has no file extension (for example /tmp/x/mydb). The graph data file is created as mydb.g1, but deletion is rejected with:

Path ... is not within the allowed list of files to be removed.

Reported in #1562 for 0.22.x through current main.

Reproduction

  1. Open or create a database at a path with no extension, e.g. /tmp/x/mydb.
  2. CREATE GRAPH g1; (creates /tmp/x/mydb.g1).
  3. DROP GRAPH g1; raises an IO exception instead of removing the graph files.

With mydb.lbdb (or .db, .kuzu), graph paths look like mydb.g1.lbdb and DROP GRAPH works.

Root cause

isAllowedDeletionPath in local_file_system.cpp treats graph database files as deletable only when their extension equals the main database extension (extension == dbExt). For extensionless main DB files, dbExt is empty while graph files use dbBase.<graphName> (e.g. mydb.g1 with extension .g1), so the check never matches.

Solution

  • When dbExt is non-empty, keep the existing db.<graph>.<ext> rule unchanged.
  • When dbExt is empty, allow paths whose stem equals dbBase and whose extension is the graph suffix (matching StorageUtils::getGraphPath).

Tests

  • Added VirtualFileSystemDeleteExtensionlessDbGraphFiles in test/common/vfs_test.cpp covering graph file deletion, graph sidecars, rejection of the main DB path, and rejection of unrelated graph paths.

Local validation: targeted types_test rebuild was not completed on this Windows host (full tree reconfigure after pulling main; prior types_test binary absent). Linux CI is expected to run the common test suite.

Compatibility

No public API change. Only broadens the allowlist for safe deletion paths already created by CREATE GRAPH when the database file has no extension.

Fixes #1562

Recognize db.<graph> files when the main database path has no extension,
matching StorageUtils::getGraphPath. Add vfs regression test.

Fixes LadybugDB#1562

Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

This branch has not been deployed

No deployments
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.

Bug: DROP GRAPH fails when the database file has no extension

1 participant