You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
transpiler/cdc: wire schema-aware upsert conflicts and remove forced WAL checkpoints
This commit completes the in-flight replication/transpiler fixes and cleans up CDC apply behavior.
Transpiler and parse pipeline:
- Add ParseOptions.SchemaProvider and thread it through parser/query context.
- Refactor InsertOnDuplicateKeyRule to return conflict metadata instead of mutating serializer state.
- Make SQLite serializer stateless for conflict targets via SerializeWithOpts.
- Consolidate transpiler flow to single final serialization, qualifier stripping, and literal extraction ordering.
- Preserve schema-derived ON CONFLICT targets when literal extraction is enabled.
- Add/adjust tests for literal extraction + ON DUPLICATE KEY, serializer behavior, and ANSI-quote/backslash handling.
- Tighten auto-increment injection behavior to skip unsafe injection when INSERT has no explicit column list.
Runtime wiring for P1:
- Extend coordinator DatabaseManager contract with GetTranspilerSchema.
- Implement GetTranspilerSchema in db.DatabaseManager using cached schema.
- Wire schema provider into coordinator and read-only replica ParseStatementWithOptions paths.
- Filter out SchemaCache rowid sentinel from conflict targeting so fallback behavior remains correct when no explicit PK exists.
- Update coordinator-facing test database manager mocks and add focused DB unit tests for GetTranspilerSchema.
CDC / replication visibility and P2 rollback:
- Keep shared-cache DSN usage across write/read/reopen and batch committer DB connections.
- Ensure snapshot/read query paths use readDB.
- Remove synchronous PRAGMA wal_checkpoint(PASSIVE) calls from CDC apply commit and batch flush commit hot paths.
- Retain adaptive/background checkpoint behavior where applicable.
Functional impact:
- INSERT ... ON DUPLICATE KEY now resolves ON CONFLICT targets from real schema at runtime (not parser-local fallback only).
- Literal extraction no longer drops schema-derived conflict targets.
- Replica local reads stay local while forwarded writes can still opt into visibility guarantees via wait-for-replication semantics, without per-commit forced checkpoint overhead.
0 commit comments