Skip to content

fix(kasm): add db initialization check before migrations (upstream PR #30)#58

Open
darkhonor wants to merge 1 commit intomainfrom
upstream/pr-30-db-status-check
Open

fix(kasm): add db initialization check before migrations (upstream PR #30)#58
darkhonor wants to merge 1 commit intomainfrom
upstream/pr-30-db-status-check

Conversation

@darkhonor
Copy link
Copy Markdown
Owner

Summary

  • Ports kasmtech/kasm-helm#30 by @matonb
  • Adds pre-check: SELECT COUNT(*) FROM settings before running Alembic migrations
  • If DB is already initialized, exits immediately with success
  • Prevents redundant migration runs that cause lock contention

Why

We hit repeated deadlocks where the db-init-job ran Alembic migrations unnecessarily, acquiring AccessExclusiveLocks that blocked all other KASM components. This guard prevents that when the schema is already current. Related: kasmtech/kasm-helm#36.

Test plan

  • helm lint charts/kasm
  • helm template — verify the init script includes the settings table check
  • Deploy against an already-initialized database — verify job exits immediately
  • Deploy against a fresh database — verify initialization runs normally

🤖 Generated with Claude Code

Port of kasmtech/kasm-helm#30 (matonb). Adds a pre-check in the
db-init-job that queries SELECT COUNT(*) FROM settings before running
startup.sh. If the database is already initialized, the job exits
immediately instead of running redundant Alembic migrations.

This prevents unnecessary lock acquisition during migrations when the
schema is already current, reducing the risk of the deadlock loop
documented in kasmtech/kasm-helm#36.

Upstream-PR: kasmtech/kasm-helm#30
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant