-
Notifications
You must be signed in to change notification settings - Fork 18
fix: Thread index database migrations are now atomic #2280
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
Files not reviewed (1)
- packages/cli/package.json: Language not supported
Comments suppressed due to low confidence (2)
packages/cli/src/rpc/navie/services/threadIndexService.ts:127
- Consider wrapping the lock release call in a try-catch block to handle potential errors during the lock release process.
if (lockRelease) { await lockRelease(); }
packages/cli/src/rpc/navie/services/threadIndexService.ts:109
- Confirm that setting the journal mode outside of a transaction aligns with the intended behavior, especially under concurrent startup scenarios.
this.db.exec('PRAGMA journal_mode = WAL');
9c5ef44 to
0130ef8
Compare
A single process will now migrate the database when needed. Migrations will no longer be run every time the RPC service starts.
0130ef8 to
5754e31
Compare
| CREATE INDEX IF NOT EXISTS idx_thread_id ON project_directories (thread_id); | ||
| PRAGMA user_version = ${SCHEMA_VERSION}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat! I didn't know about this feature.
# [@appland/appmap-v3.188.5](https://github.com/getappmap/appmap-js/compare/@appland/appmap-v3.188.4...@appland/appmap-v3.188.5) (2025-04-22) ### Bug Fixes * Thread index database migrations are now atomic ([#2280](#2280)) ([0e114d9](0e114d9))
|
🎉 This PR is included in version @appland/appmap-v3.188.5 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
We're still seeing some cases where the database is locked upon startup. This change aims to resolve this entirely by enforcing the process hold a lock file in order to migrate and setting a busy timeout of 3s on all db connections.
This change adds proper database migration handling to the thread index service. Previously, idempotent migrations were run every time the RPC service started, which could lead to race conditions when multiple instances tried to migrate simultaneously.
Now:
This change improves reliability and prevents potential database corruption when multiple AppMap instances are running.
Dependencies:
proper-lockfilefor file locking