feat: Add fix for kuzu lock after migration (#1147)
<!-- .github/pull_request_template.md --> ## Description Add potential fix for Kuzu database lock after migration ## DCO Affirmation I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin.
This commit is contained in:
parent
ce50863e22
commit
7f972d3ab5
1 changed files with 7 additions and 3 deletions
|
|
@ -169,6 +169,10 @@ def kuzu_migration(new_db, old_db, new_version, old_version=None, overwrite=None
|
|||
|
||||
# Rename new kuzu database to old kuzu database name if enabled
|
||||
if overwrite or delete_old:
|
||||
# Remove kuzu lock from migrated DB
|
||||
lock_file = new_db + ".lock"
|
||||
if os.path.exists(lock_file):
|
||||
os.remove(lock_file)
|
||||
rename_databases(old_db, old_version, new_db, delete_old)
|
||||
|
||||
print("✅ Kuzu graph database migration finished successfully!")
|
||||
|
|
@ -189,7 +193,7 @@ def rename_databases(old_db: str, old_version: str, new_db: str, delete_old: boo
|
|||
|
||||
if os.path.isfile(old_db):
|
||||
# File-based database: handle main file and accompanying lock/WAL
|
||||
for ext in ["", ".lock", ".wal"]:
|
||||
for ext in ["", ".wal"]:
|
||||
src = old_db + ext
|
||||
dst = backup_base + ext
|
||||
if os.path.exists(src):
|
||||
|
|
@ -211,7 +215,7 @@ def rename_databases(old_db: str, old_version: str, new_db: str, delete_old: boo
|
|||
sys.exit(1)
|
||||
|
||||
# Now move new files into place
|
||||
for ext in ["", ".lock", ".wal"]:
|
||||
for ext in ["", ".wal"]:
|
||||
src_new = new_db + ext
|
||||
dst_new = os.path.join(base_dir, name + ext)
|
||||
if os.path.exists(src_new):
|
||||
|
|
@ -227,7 +231,7 @@ Examples:
|
|||
%(prog)s --old-version 0.9.0 --new-version 0.11.0 \\
|
||||
--old-db /path/to/old/db --new-db /path/to/new/db --overwrite
|
||||
|
||||
Note: This script will create virtual environments in .kuzu_envs/ directory
|
||||
Note: This script will create temporary virtual environments in .kuzu_envs/ directory
|
||||
to isolate different Kuzu versions.
|
||||
""",
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue