Skip to content

feat(logging): log transaction commit lifecycle (retries, success, snapshot adds) - #890

Open
kamcheungting-db wants to merge 2 commits into
apache:mainfrom
kamcheungting-db:logging-commit-retry
Open

feat(logging): log transaction commit lifecycle (retries, success, snapshot adds)#890
kamcheungting-db wants to merge 2 commits into
apache:mainfrom
kamcheungting-db:logging-commit-retry

Conversation

@kamcheungting-db

@kamcheungting-db kamcheungting-db commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Adds logging to the transaction commit path (first real use of the logging component from #722#726). Commit-path only.

What gets logged

  • INFO — every successful commit. Names the snapshot + operation for data commits; plain success for metadata-only commits.
  • WARN — each retry, with the error that caused it.
  • ERROR — commit gave up after exhausting retries (attempt count + final error).
  • DEBUG — a snapshot was added to the table metadata (id + sequence number).

util/retry_util is untouched; all logging lives at the commit call site.

Tests (CapturingLogger + ScopedDefaultLogger): retry→success, retry-exhausted→error, single-attempt success, and snapshot-add DEBUG.

This pull request and its description were written by Isaac.

Transaction::Commit runs through a retry runner but was completely silent, so
operators could not tell whether a commit was retrying on a transient conflict or
had failed permanently. This is the first real adoption of the logging component
in the commit path.

- WARN on each genuine retry (the runner only re-invokes the task when it decides
  to retry, so attempt > 1 marks a real retry), carrying the prior error.
- INFO when a commit finally succeeds after > 1 attempt.
- ERROR when retries are exhausted, with the attempt count and final error.

Tests (TransactionRetryTest, via a CapturingLogger installed with
ScopedDefaultLogger): assert the retry WARN + success INFO on a retry-then-succeed
commit, and the exhaustion ERROR on an always-conflicting commit.

Co-authored-by: Isaac
Extend the commit-path logging beyond retries:
- Transaction::Commit now logs an INFO on every successful commit (previously only
  after a retry). When the commit advanced the current snapshot (a data commit) the
  message names the snapshot id and operation; metadata-only commits report a plain
  success.
- TableMetadataBuilder::AddSnapshot logs a DEBUG naming the snapshot id and sequence
  number when a snapshot is added to the metadata.

Tests: single-attempt commit emits the success INFO with no retry WARN
(TransactionRetryTest.CommitSuccessEmitsInfoLog); AddSnapshot emits the DEBUG
(TableMetadataBuilderTest.AddSnapshotEmitsDebugLog).

Co-authored-by: Isaac
@kamcheungting-db kamcheungting-db changed the title feat(logging): log transaction commit retries and final outcome feat(logging): log transaction commit lifecycle (retries, success, snapshot adds) Aug 17, 2026
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