Repository navigation
fix(committer): retry a transient discard failure for Fabric-invalid transactions - #2260
Conversation
|
Hey @mbrandenburger 👋 thanks for the PR! This comment updates automatically as you push changes -- think of it as your PR's live scoreboard! 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:
You'll need to sign your commits with GPG (e.g. ✅ 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! |
SaidAltury-ibm
left a comment
There was a problem hiding this comment.
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>
36e1df0 to
0f29cc5
Compare
|
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. |
|
👋 Hi @mbrandenburger! Great work on your recent contribution! 🎉 Here are some issues you might want to explore next: Happy coding! 🚀 |
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
DiscardEndorserTransactionis not enough:Committer.DiscardTxalso logged and dropped the errors fromVault.DiscardTxandVault.SetDiscarded, so nothing reachedDiscardEndorserTransaction.Vault.DiscardTxunmaps the in-memory read-write set before it writes the status. After a failed write, the retry failed deterministically withread-write set ... could not be found. A node restart has the same effect.DiscardTxnow writes the status withSetDiscardedwhen the vault holds no set, unless the status is already Valid or Invalid.VaultStore.SetStatusesdid 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'sEnvelopeService.Existscheck is dropped, becauseCommitter.Statusalready loads a stored envelope into the vault.DiscardEndorserTransaction: return theDiscardTxerror whenclassify(err) == classRetry, log any other, ascommitUnknowndoes.VaultStore.SetStatuses: wrap the exec error withdb.errorWrapper. On SQLite this also makesSQLITE_BUSYon the status write retryable.driver.Committer.DiscardTx.How it was verified
TestDiscardEndorserTransactionRetriesATransientVaultFailureruns against a real memory vault whose firstSetStatusesfails withErrConnectionLost. The first call returns aclassRetryerror and the second leaves the transaction Invalid. Without the fix both calls return nil and the transaction stays Busy.TestDiscardTxAdditionalBranchescases (Busy with and without a set, final statuses, both write errors) andTestVaultSQL_SetStatuses_WrapsErrorfail without the fix.make checksandmake unit-tests-rootpass.Notes for reviewers
driver.Committer.DiscardTxalready returned an error and now reports write failures. Its only caller in FSC isDiscardEndorserTransaction, and Panurus does not callDiscardTxorSetDiscarded.classRetry, matchingcommitUnknown.DiscardTxcannot produce aclassFatalerror today.