Skip to content

fix(committer): retry a transient discard failure for Fabric-invalid transactions - #2260

Merged
SaidAltury-ibm merged 1 commit into
hyperledger-labs:mainfrom
mbrandenburger:fix/2252-discard-retry
Oct 26, 2026
Merged

SaidAltury-ibm merged 1 commit into
hyperledger-labs:mainfrom
mbrandenburger:fix/2252-discard-retry

Conversation

@mbrandenburger

Copy link
Copy Markdown
Member

Summary

A transaction that Fabric marked invalid now reaches Invalid in the vault even when the vault fails while recording it. A transient failure (ErrConnectionLost, SqlBusy, DeadlockDetected) is returned so the committer retries the block. Before this, the block committed, the transaction stayed Busy for good, and finality listeners never saw Invalid.

Fixes #2252

Differences from the original issue

The issue body has been updated to match. Changing only DiscardEndorserTransaction is not enough:

  • Committer.DiscardTx also logged and dropped the errors from Vault.DiscardTx and Vault.SetDiscarded, so nothing reached DiscardEndorserTransaction.
  • Vault.DiscardTx unmaps the in-memory read-write set before it writes the status. After a failed write, the retry failed deterministically with read-write set ... could not be found. A node restart has the same effect. DiscardTx now writes the status with SetDiscarded when the vault holds no set, unless the status is already Valid or Invalid.
  • VaultStore.SetStatuses did not pass its exec error through the store's error wrapper, so on Postgres a lost connection during the status write classified as degrade.

Changes

  • Committer.DiscardTx: release the set and write the status when the vault holds the set, otherwise write the status directly. Return the error. The Unknown branch's EnvelopeService.Exists check is dropped, because Committer.Status already loads a stored envelope into the vault.
  • DiscardEndorserTransaction: return the DiscardTx error when classify(err) == classRetry, log any other, as commitUnknown does.
  • VaultStore.SetStatuses: wrap the exec error with db.errorWrapper. On SQLite this also makes SQLITE_BUSY on the status write retryable.
  • Godoc for both functions and for driver.Committer.DiscardTx.

How it was verified

  • TestDiscardEndorserTransactionRetriesATransientVaultFailure runs against a real memory vault whose first SetStatuses fails with ErrConnectionLost. The first call returns a classRetry error and the second leaves the transaction Invalid. Without the fix both calls return nil and the transaction stays Busy.
  • New TestDiscardTxAdditionalBranches cases (Busy with and without a set, final statuses, both write errors) and TestVaultSQL_SetStatuses_WrapsError fail without the fix.
  • make checks and make unit-tests-root pass.

Notes for reviewers

  • No exported signature changes. driver.Committer.DiscardTx already returned an error and now reports write failures. Its only caller in FSC is DiscardEndorserTransaction, and Panurus does not call DiscardTx or SetDiscarded.
  • The gate is classRetry, matching commitUnknown. DiscardTx cannot produce a classFatal error today.

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Hey @mbrandenburger 👋 thanks for the PR!
I'm your friendly PR Helper Bot 🤖 and I'll be riding shotgun on this one, keeping track of your PR's status to help you get it approved and merged.

This comment updates automatically as you push changes -- think of it as your PR's live scoreboard!
Here's the latest:


PR Checks

✅ DCO Sign-off -- All commits have valid sign-offs. Nice work!


❌ GPG Signature -- Heads up! The following commits don't have a verified GPG signature:

  • 0f29cc5 fix(committer): retry a transient discard failure for Fabric-invalid transactions

You'll need to sign your commits with GPG (e.g. git commit -S). See the Signing Guide for a step-by-step walkthrough.


✅ Merge Conflicts -- No merge conflicts detected. Smooth sailing!


✅ Issue Link -- Linked to #2252 (assigned to you).


⏳ All checks must pass before this PR can be reviewed. You've got this!

@github-actions github-actions Bot added the status: needs revision The pull request requires changes from the author before it can be reviewed or merged label Oct 26, 2026
@mbrandenburger mbrandenburger added this to the 26Q4 milestone Oct 26, 2026
@mbrandenburger mbrandenburger added status: needs review The pull request is ready for maintainer review and removed status: needs revision The pull request requires changes from the author before it can be reviewed or merged labels Oct 26, 2026

@SaidAltury-ibm SaidAltury-ibm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you @mbrandenburger, LGTM

…transactions

A transaction that Fabric marked invalid now reaches Invalid in the vault even when the vault fails while recording it.

Committer.DiscardTx returns the vault's write error instead of logging it. It releases the transaction's read-write set and writes Invalid when the vault holds the set, and otherwise writes the status directly. The set is gone after an attempt whose status write failed, or after a restart, so a retry still reaches Invalid. A Valid or Invalid transaction without a set is left unchanged. The check for a stored envelope is dropped, because Committer.Status already loads one into the vault.

DiscardEndorserTransaction returns the DiscardTx error when classify retries it and logs any other, as commitUnknown does.

VaultStore.SetStatuses passes exec errors through the store's error wrapper, so a lost Postgres connection matches driver.ErrConnectionLost and SQLITE_BUSY matches driver.SqlBusy.

Fixes hyperledger-labs#2252

Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
@SaidAltury-ibm
SaidAltury-ibm enabled auto-merge (squash) October 26, 2026 15:17
@github-actions github-actions Bot added status: needs revision The pull request requires changes from the author before it can be reviewed or merged and removed status: needs review The pull request is ready for maintainer review labels Oct 26, 2026
@mergify

mergify Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@SaidAltury-ibm
SaidAltury-ibm merged commit aeeff47 into hyperledger-labs:main Oct 26, 2026
45 checks passed
@github-actions

Copy link
Copy Markdown

👋 Hi @mbrandenburger! Great work on your recent contribution! 🎉

Here are some issues you might want to explore next:

Happy coding! 🚀

@mbrandenburger
mbrandenburger deleted the fix/2252-discard-retry branch October 26, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: needs revision The pull request requires changes from the author before it can be reviewed or merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(committer): retry a transient DiscardTx failure for Fabric-invalid transactions

2 participants