Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meta/sqlite3: fix database is locked error #5586

Merged
merged 4 commits into from
Jan 22, 2025

Conversation

anysql
Copy link
Contributor

@anysql anysql commented Jan 21, 2025

fix #5587
Where there is active transaction, the read will report database is locked error (can be easily reproduce by mdtest). Add cache/_journal/_timeout option to get it work.

@anysql
Copy link
Contributor Author

anysql commented Jan 21, 2025

  • ./juicefs mdtest sqlite3://test.db /bigdir --depth=1 --dirs=0 --files=10000 --threads=10 --write=8192
    2025/01/20 19:10:41.895443 juicefs[3531] : Meta address: sqlite3://test.db [[email protected]:515]
    2025/01/20 19:10:41.897027 juicefs[3531] : Data use file:///var/jfs/myjfs/ [[email protected]:207]
    2025/01/20 19:10:41.897301 juicefs[3531] : Disk cache (/var/jfsCache/e1879fad-8c73-4e66-9840-74f426209b0d/): used ratio - [space 76.5%, inode 11.5%] [newCacheStore@disk_cache.go:147]
    2025/01/20 19:10:41.901799 juicefs[3531] : Create session 2 OK with version: 1.3.0-dev+2025-01-20.232596b [[email protected]:489]
    2025/01/20 19:10:41.902268 juicefs[3531] : Prometheus metrics listening on 127.0.0.1:46303 [[email protected]:135]
    2025/01/20 19:10:41.902700 juicefs[3531] : Create 100000 files in 1 dirs [[email protected]:112]
    2025/01/20 19:10:41.908971 juicefs[3531] : Created 1 dirs in 6.230025ms (160 dirs/s) [[email protected]:127]
    2025/01/20 19:11:29.559958 juicefs[3531] : Transaction succeeded after 3 tries (15.458008ms), inodes: [1], last error: database is locked [[email protected]:930]
    2025/01/20 19:11:53.686168 juicefs[3531] : Transaction succeeded after 3 tries (15.238496ms), inodes: [1], last error: database is locked [[email protected]:930]
    2025/01/20 19:12:53.085656 juicefs[3531] : Transaction succeeded after 3 tries (16.50027ms), inodes: [1], last error: database is locked [[email protected]:930]
    2025/01/20 19:13:18.013871 juicefs[3531] : Transaction succeeded after 4 tries (18.438838ms), inodes: [1], last error: database is locked [[email protected]:930]
    2025/01/20 19:13:41.842001 juicefs[3531] : Transaction succeeded after 3 tries (16.795816ms), inodes: [1], last error: database is locked [[email protected]:930]

@anysql
Copy link
Contributor Author

anysql commented Jan 21, 2025

close #5587

@anysql anysql self-assigned this Jan 21, 2025
@jiefenghuang
Copy link
Contributor

jiefenghuang commented Jan 21, 2025

@jiefenghuang jiefenghuang changed the title fix sqlite3 database is locked error meta/sqlite3: fix database is locked error Jan 21, 2025
@jiefenghuang jiefenghuang merged commit 9de9451 into main Jan 22, 2025
35 checks passed
@jiefenghuang jiefenghuang deleted the fix_sqlite_database_locked branch January 22, 2025 08:51
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.

database is locked with sqlite3
3 participants