Count the connection failure as the condition of quarantine#4727
Merged
lhotari merged 4 commits intoapache:masterfrom Mar 19, 2026
Merged
Conversation
--- ### Motivation Currently, the BookieClient quarantine mechanism primarily triggers based on read and write error responses from Bookies. However, in multi-region deployments, a common failure mode is the Network Partition or DNS Resolution Failure at the Region level. In such scenarios: A Bookie remains registered in ZooKeeper (it can still heartbeat to its local ZK observer). The Client (Broker) cannot resolve the Bookie's IP or establish a TCP connection. The EnsemblePlacementPolicy (especially RegionAwareEnsemblePlacementPolicy) sees the Bookie as "Available" and repeatedly selects it to satisfy minRack or E/Qw constraints. The LedgerHandle fails to write because it cannot initialize a connection handle, triggering an Ensemble Change. Because the connection failure didn't trigger a quarantine, the placement policy picks the same problematic Bookie again in the next iteration. This creates an infinite Ensemble Change loop, causing the Ledger write to hang indefinitely and bloating the Ledger metadata in ZooKeeper with thousands of segments.
lhotari
reviewed
Mar 13, 2026
Member
lhotari
left a comment
There was a problem hiding this comment.
suggesting a new name for the config. It seems that getBoolean would throw an exception if the setting is missing and when the default value isn't provided.
bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ClientConfiguration.java
Outdated
Show resolved
Hide resolved
bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ClientConfiguration.java
Outdated
Show resolved
Hide resolved
lhotari
reviewed
Mar 19, 2026
bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PerChannelBookieClient.java
Outdated
Show resolved
Hide resolved
lhotari
reviewed
Mar 19, 2026
bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ClientConfiguration.java
Outdated
Show resolved
Hide resolved
lhotari
reviewed
Mar 19, 2026
bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ClientConfiguration.java
Outdated
Show resolved
Hide resolved
lhotari
reviewed
Mar 19, 2026
bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ClientConfiguration.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Lari Hotari <lhotari@users.noreply.github.com>
lhotari
approved these changes
Mar 19, 2026
zymap
added a commit
that referenced
this pull request
Mar 20, 2026
* Count the connection failure as the condition of quarantine --- ### Motivation Currently, the BookieClient quarantine mechanism primarily triggers based on read and write error responses from Bookies. However, in multi-region deployments, a common failure mode is the Network Partition or DNS Resolution Failure at the Region level. In such scenarios: A Bookie remains registered in ZooKeeper (it can still heartbeat to its local ZK observer). The Client (Broker) cannot resolve the Bookie's IP or establish a TCP connection. The EnsemblePlacementPolicy (especially RegionAwareEnsemblePlacementPolicy) sees the Bookie as "Available" and repeatedly selects it to satisfy minRack or E/Qw constraints. The LedgerHandle fails to write because it cannot initialize a connection handle, triggering an Ensemble Change. Because the connection failure didn't trigger a quarantine, the placement policy picks the same problematic Bookie again in the next iteration. This creates an infinite Ensemble Change loop, causing the Ledger write to hang indefinitely and bloating the Ledger metadata in ZooKeeper with thousands of segments. * Add configuration to control the behavior (cherry picked from commit 497aa4e)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Currently, the bookie client quarantine mechanism primarily triggers based on
readandwriteerror responses from Bookies. However, in multi-region deployments, a common failure mode is the Network Partition or DNS Resolution Failure at the Region level.In such scenarios:
EnsemblePlacementPolicy(especiallyRegionAwareEnsemblePlacementPolicy) sees the Bookie as "Available" and repeatedly selects it to satisfyminRackorE/Qwconstraints.LedgerHandlefails to write because it cannot initialize a connection handle, triggering an Ensemble Change.This creates an infinite Ensemble Change loop, causing the Ledger write to hang indefinitely and bloating the Ledger metadata in ZooKeeper with thousands of segments.