Commit Graph
2 Commits
Author SHA1 Message Date
unclesam b20d6a3750 fix(sqlite_checkpoint): harden concurrent safety and close lifecycle
- validateTableName: guard against empty string input to prevent malformed SQL
- Save/PruneVersions/Delete: use mu.Lock to serialize SELECT MAX(version)+INSERT
  preventing duplicate version numbers under concurrent goroutines
- Load/LoadVersion/ListVersions: retain mu.RLock to allow concurrent reads
- All methods: add nil db check after acquiring lock to fail fast after Close()
- NewSQLiteCheckpointer: set SetMaxOpenConns(1)+SetMaxIdleConns(1) to ensure
  PRAGMA WAL/busy_timeout takes effect on the single shared connection and
  eliminate SQLITE_BUSY errors under concurrent writes
- ListVersions: initialize result as make([]CheckpointVersion, 0) instead of
  nil slice for consistent caller semantics
- PruneVersions: add comment explaining the double threadID parameter
2026-08-13 20:18:48 +08:00
unclesam 3a4c1e9c84 feat: implement SQLite-based append-only multi-version state persistence for thread checkpoints 2026-08-12 13:14:18 +08:00