Skip to content

fix(committer)!: keep transient vault failures retryable on the config, envelope and row-read paths - #2255

Merged
mbrandenburger merged 1 commit into
hyperledger-labs:mainfrom
mbrandenburger:fix/2248-transient-vault-retry
Oct 26, 2026
Merged

mbrandenburger merged 1 commit into
hyperledger-labs:mainfrom
mbrandenburger:fix/2248-transient-vault-retry

Conversation

@mbrandenburger

@mbrandenburger mbrandenburger commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Summary

A database failure while committing a block now reaches the committer's retry as ErrConnectionLost (or another error classify retries), instead of being read as a missing envelope, a finished result set or a discarded configuration.

Fixes #2248

Differences from the issue

A failed config commit leaves the config transaction Busy, not Invalid. NewRWSet writes Busy to the status table. When CommitTX fails, the vault has already unmapped the read-write set, so the follow-up DiscardTx fails too and only logs. The retry then fails in CommitConfig with invalid configtx's [configtx_1] status [3] (3 is Busy). Dropping DiscardTx alone does not fix that. On restart, ReloadConfigTransactions waited on a Busy config transaction forever, so the node hung at startup.

applyConfigCommit never discards, not even on a deterministic failure. The issue suggests discarding when the failure is deterministic. That would mark the config transaction Invalid, and both CommitConfig and ReloadConfigTransactions reject an Invalid config transaction, so the node could neither commit the block nor start until someone edited the vault by hand. Leaving it Busy avoids that:

  • A deterministic failure classifies as degrade, so retryBlock returns it at once and delivery stops with the error logged and counted. It is not retried in a loop.
  • After a restart the node starts, replays the block and reports the same error again. An operator still has to act, but the node stays up and the cause stays visible.
  • The membership service and the orderer list have already applied the configuration when applyConfigCommit runs, so Invalid would also be wrong.

driver.EnvelopeService.Exists changes signature instead of gaining a variant. Adding a method to the interface breaks implementers just as much as changing the signature, since every implementation must provide it. A variant would also leave the rwset loaders and the processor swallowing the error, and they reach the same commit path through extractStoredEnvelopeToVault. The exported fabric.EnvelopeService.Exists keeps its bool signature (see Breaking change).

ReloadConfigTransactions stops at a Busy config transaction. On a single node, no later sequence can be committed behind a Busy one. Config transactions commit one per block, in block order. A degraded block stops delivery, and a transient failure retries the same block. So every sequence after a Busy configtx_N is Unknown, and the replay that applies N goes on to N+1. Several replicas sharing one vault are not covered: a replica can see another replica's in-flight configtx_N as Busy and stop there. That is #2253, which should be resolved before the next release.

Changes

  • Config path (committer/config.go, committer/committer.go):
    • applyConfigCommit no longer discards on failure. The configuration is already in force at that point.
    • CommitConfig accepts a Busy config transaction as well as an Unknown one.
    • ReloadConfigTransactions stops at a Busy config transaction. Delivery resumes from the last non-Busy transaction, so the config block is replayed.
  • Envelope path:
    • driver.EnvelopeService.Exists returns (bool, error).
    • The committer (four call sites), both rwset loaders (fabric, fabricx) and the rwset processor return the error.
    • fabric.EnvelopeService.Exists keeps its bool result and returns false when the store cannot be read.
  • SimpleKeyDataStore.GetData passes read errors through the store's error wrapper. Without this, a lost Postgres connection never matches ErrConnectionLost, and the envelope change would not retry on a real database.
  • commitUnknown returns a retryable error from filterUnknownEnvelope instead of skipping the transaction. filterUnknownEnvelope returns its Status error. Other filter errors still skip, as before.
  • Row reads: rowIterator.Next returns rows.Err() once rows.Next() is false. Vault.Statuses used a loop that would drop that trailing error and now uses iterators.ForEach.

Breaking change

driver.EnvelopeService.Exists(ctx, txid) bool becomes (bool, error). Implementations must return the store's error instead of false. The exported wrapper fabric.EnvelopeService.Exists is unchanged. Panurus neither implements nor calls driver.EnvelopeService, so it needs no change. Panurus uses NewIterator in about 15 places, and all of them handle the new trailing error.

Tests

Each test below fails on main and passes with this change:

  • TestCommitConfigRetriesATransientVaultFailure: a real memory vault whose Store fails once with ErrConnectionLost. The error classifies as retry, the config transaction stays Busy, and the second CommitConfig makes it Valid.
  • TestReloadConfigTransactionsAdditionalBranches/stops_at_a_busy_config_tx: hangs on main, returns with the fix.
  • TestCommitUnknownReturnsEnvelopeLookupError: the real envs over a store whose ExistsEnvelope fails. The error reaches CommitTX as retryable, and the ledger is not consulted.
  • TestCommitUnknownReturnsTransientFilterError: a transient Status error while filtering is returned and classifies as retry.
  • TestEnvelope_ExistData_WrapsError: ExistsEnvelope errors pass through the error wrapper.
  • TestIteratorReturnsRowError: sqlmock RowError is returned by Next.

make checks, make unit-tests-root and make unit-tests-postgres pass.

Follow-ups

Related

…g, envelope and row-read paths

A database failure while committing a block now reaches the committer's retry as the storage error it is, instead of being read as a missing envelope, a finished result set or a discarded configuration.

Config transactions: the vault marks a config transaction Busy when its read-write set is opened, and a commit that fails after that leaves it Busy. CommitConfig accepts a Busy config transaction as well as an Unknown one, so the retry or a replay after restart applies it. applyConfigCommit no longer discards the transaction on failure, because the configuration is already in force by then. ReloadConfigTransactions stops at a Busy config transaction instead of waiting for it, so a node that crashed mid-commit starts, and delivery replays the block.

Envelope checks: driver.EnvelopeService.Exists returns (bool, error), and the committer, both rwset loaders and the rwset processor return the error. SimpleKeyDataStore.GetData passes read errors through the store's error wrapper, so a lost Postgres connection matches driver.ErrConnectionLost. commitUnknown returns a transient error from filterUnknownEnvelope instead of skipping the transaction; other filter errors still skip it. fabric.EnvelopeService.Exists keeps its bool result and returns false when the store cannot be read.

Row reads: the SQL iterator returns rows.Err() when reading rows fails, so a truncated result is no longer taken for a complete one. Vault.Statuses reads through iterators.ForEach so that error is not dropped. The error is not yet mapped to driver.ErrConnectionLost (hyperledger-labs#2251).

BREAKING CHANGE: driver.EnvelopeService.Exists returns (bool, error). Implementations of the interface must return the store's error.

Fixes hyperledger-labs#2248

Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
@github-actions

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:

  • 3207549 fix(committer)!: keep transient vault failures retryable on the config, envelope and row-read paths

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 #2248 (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

@adecaro adecaro 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.

Review: does this address #2248?

Checked out at 3207549db.

go test -race -count=1 ./platform/fabric/... committer, transaction, rwset, sql/common, vault -> all ok
CI: all green; bot: DCO pass, GPG FAIL (3207549db)

What it fixes

Claim Verified how
Config commit failure no longer discards; retry succeeds TestCommitConfigRetriesATransientVaultFailure passes; read applyConfigCommit/CommitConfig
Envelope existence error is retryable read all Exists callers (committer, rwset loaders, fabricx); TestCommitUnknownReturnsTransientFilterError
rowIterator.Next surfaces rows.Err() sqlmock test; grep found no other raw Next loops dropping errors

Non-blocking

  • #2248 asked for an error-returning variant rather than changing the exported Exists signature; the PR changes driver.EnvelopeService.Exists (breaking for external implementers). Please justify or add the variant.
  • #2248 said to discard only on a deterministic failure; applyConfigCommit now never discards, so a non-transient CommitTX failure leaves the config tx Busy and is retried forever on replay. Consider classify(err).
  • ReloadConfigTransactions now stops at a Busy config tx instead of sleeping and retrying; please confirm no later sequence can exist behind it.

Recommendation

Good fix overall; address the two deviations.

@adecaro
adecaro self-requested a review October 26, 2026 13:24

@adecaro adecaro 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.

LGTM

@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.

@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
@mbrandenburger
mbrandenburger merged commit 50a5853 into hyperledger-labs:main Oct 26, 2026
50 checks passed
@mbrandenburger
mbrandenburger deleted the fix/2248-transient-vault-retry branch October 26, 2026 14:16
@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! 🚀

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.

bug(committer): keep transient vault failures retryable on the config, envelope and row-read paths

2 participants