Skip to content

fix: batch schema markers during shadow SQLite setup - #30

Open
johoja12 wants to merge 1 commit into
cgnl:mainfrom
johoja12:fix/batch-shadow-migrations
Open

johoja12 wants to merge 1 commit into
cgnl:mainfrom
johoja12:fix/batch-shadow-migrations

Conversation

@johoja12

Copy link
Copy Markdown

Problem

Each startup rebuilds two shadow SQLite databases. The entrypoint copied each of 447 schema_migrations markers by spawning a separate sqlite3 process, once for each database. On our QNAP canary this added several minutes to startup and made crash/restart diagnosis slow.

Fix

Generate escaped INSERT OR IGNORE statements from PostgreSQL and run them in one SQLite transaction per shadow database. Fail if either database command fails or the final row count differs from PostgreSQL.

Verification

The isolated QNAP trial used this entrypoint on a fresh import and again on a container recreation. Both shadow databases reported all 447 migration markers and Plex reached HTTP 200. The production Plex container remains on SQLite.

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