Переглянути джерело

qa: sqlite WAL + busy timeout on the singleton connection — a SELECT stepping against the harness's concurrent fixture write returned SQLITE_BUSY, which the ORM's lazy enumerator reports as end-of-rows (the lifecycle flake: task_state capabilities read back EMPTY though the row existed; Invercargill-Sql's SqliteResultEnumerable treats any non-ROW step as done). WAL readers never block writers and never are blocked by them; the 5s busy timeout absorbs the remaining writer-writer window

clanker 1 місяць тому
батько
коміт
2cbcc8862f
1 змінених файлів з 15 додано та 0 видалено
  1. 15 0
      src/main.vala

+ 15 - 0
src/main.vala

@@ -26,6 +26,21 @@ int main(string[] args) {
         }
         var db = application.container.configure_with<DatabaseConfigurator>();
         db.register_connection(@"sqlite://$(db_path)");
+        // SQLite serialisation posture (the flake family where a SELECT
+        // stepping against a concurrent write lock — the test harness's
+        // fixture writes share this file — returned SQLITE_BUSY, which
+        // the ORM's lazy enumerator reports as end-of-rows: an EMPTY
+        // result for data that exists): WAL readers never block on (and
+        // are never blocked by) writers, and the busy timeout absorbs
+        // the remaining writer-writer window.
+        try {
+            var connection = application.container.create_scope()
+                .resolve<InvercargillSql.Connection>();
+            connection.execute("PRAGMA journal_mode = WAL");
+            connection.execute("PRAGMA busy_timeout = 5000");
+        } catch (Error pragma_error) {
+            print(@"[ClankerSaddle] sqlite pragmas failed: $(pragma_error.message)\n");
+        }
         db.add_migration<ClankerSaddle.Data.Migrations.M0001_Initial>();
         db.add_entity<Project>(Project.entity_mapping);
         db.add_entity<ProjectLink>(ProjectLink.entity_mapping);