Transaction visibility, errors and retry boundaries¶
Baseline: v4.2.5. Transaction mode, actual isolation, MySQL-compatible variables and freshness are different dimensions. The string returned by @@transaction_isolation does not prove the execution engine uses that named strategy.
Timestamps and states¶
Value/state |
Purpose |
Diagnostic boundary |
|---|---|---|
SnapshotTS |
Read version boundary |
RC statement refresh differs from an SI transaction snapshot |
PrepareTS / CommitTS |
TN preparation/commit ordering |
Neither UUID transaction ID nor WAL LSN |
Logtail watermark |
CN synchronized readable progress |
Compare with required snapshot and last commit |
Committing / unknown |
Commit in progress or unresolved |
A network error does not establish rollback |
BEGIN → workspace / reads / writes / locks → commit request
├→ committed → release
├→ aborted → rollback/release
└→ unknown → resolve; avoid blind replay
Pessimistic mode defaults to RC and optimistic mode to SI; confirm runtime configuration. RC needs a suitable snapshot per statement. Internal statement retry is not permission to retry an entire business transaction without idempotency. TN timestamp/MVCC validation decides optimistic conflicts; this is not pessimistic locking at commit.
Error scope¶
Case |
Default principle |
Application action |
|---|---|---|
Ordinary constraint/syntax statement error |
With |
Explicitly continue, commit or roll back |
Deadlock, lock timeout/binding changes and selected connection/state errors |
Static error set ends the transaction |
Start a new transaction after checking error and idempotency |
|
Real statement errors roll back the whole transaction |
Subsequent work is not the original transaction |
Ambiguous commit response |
Outcome may not yet be known |
Check a business idempotency key/state instead of replaying on network error alone |
Classify by error number/SQLSTATE and retain transaction ID, rather than message substrings. Internal/background sessions have their own variable and lifecycle handling.
Locks and node changes¶
CN LockService manages local lock tables and proxies remote ones. The TN allocator versions bindings; stale bindings can abort a commit. CN loss, unreachable holders and TN reconstruction require reliability handling. Reconstructible caches do not make active transactions stateless.
Deadlock/lock waits differ from WAL waits. Retain lock-table/service IDs, holders/waiters, binding versions and transaction timing, then correlate lock-service logs.
Cross-CN visibility¶
Source commit acknowledgement, destination Logtail application and destination snapshot selection are separate events. Same-session, another session on the same CN and a session on another CN are different tests. Reconnection requires subscription recovery; a healthy port does not establish catch-up.
See transaction usage, isolation and Logtail.