fix: sqlite "database is locked" error#1009
Conversation
在sqllite+hdd+trace很容易出现 database is locked 错误, 导致trace记录不完整 通过限制sqlite并发数避免这个问题
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此PR旨在解决SQLite数据库在特定操作环境下(如结合HDD和trace时)容易出现的“database is locked”错误,该错误会导致数据记录不完整。通过限制数据库的并发连接数,此项更改显著提升了数据库的稳定性和数据完整性,从而避免了此类问题的再次发生。 Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
我看这个提交回退了,是有什么问题吗?我自己试着好像没问题呀 @looplj |
|
system 页面很慢,经常加载不出来,好像也没法备份了。 看起来是在页面使用很慢,可能只使用 API 没问题 |
|
我试试其他解决方法 |
|
开了 wal 会好点吗。 |
|
结合AI提供的资料和自己测试,只开启wal还会报错,再给DSN加上busy_timeout参数能解决这个问题。 项目使用的sqlite库不支持journal_mode=WAL这种写法,所以默认选项其实没起效。正确的写法应该是 AXONHUB_DB_DSN=file:/data/axonhub.db?_fk=1&_pragma=journal_mode(WAL)&_pragma=busy_timeout(5000) |


在sqllite+hdd+trace很容易出现 database is locked 错误, 导致trace记录不完整
通过限制sqlite并发数避免这个问题
已实际测试有效 fix #907