Fix no known bookies after reset racks for all BKs#4128
Merged
Conversation
6 tasks
zymap
approved these changes
Nov 10, 2023
horizonzy
reviewed
Nov 10, 2023
| // Register 2 BKs with depth 1 rack. | ||
| BookieNode dp1BkNode1 = new BookieNode(bkId1, dp1Rack); | ||
| BookieNode dp1BkNode2 = new BookieNode(bkId2, dp1Rack); | ||
| networkTopology.add(dp1BkNode1); |
Member
There was a problem hiding this comment.
Adding a case for the middle state will be better.
The only one bks shutdown, then restart it with depth 2 rack, it also can't add successfully.
horizonzy
approved these changes
Nov 10, 2023
zymap
pushed a commit
that referenced
this pull request
Dec 7, 2023
* Fix no known bookies after reset racks for all BKs (cherry picked from commit c07e72a)
yangl
pushed a commit
to yangl/bookkeeper
that referenced
this pull request
Dec 11, 2023
* Fix no known bookies after reset racks for all BKs
hangc0276
pushed a commit
to hangc0276/bookkeeper
that referenced
this pull request
Jan 18, 2024
* Fix no known bookies after reset racks for all BKs (cherry picked from commit c07e72a)
Ghatage
pushed a commit
to sijie/bookkeeper
that referenced
this pull request
Jul 12, 2024
* Fix no known bookies after reset racks for all BKs
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
Background
NetworkTopologyImpldoes not allow multi Bks register with differentdepthOfAllLeaves.NetworkTopologyImpl,once a node is added, thedepthOfAllLeaveswill be initiated.EnsemblePlacementPolicy.networkTopology.add( newBkNode )EnsemblePlacementPolicy.knownBookies.add( newBkNode )network topology.add(newBkNode)fail, it will not callknownBookies.add( newBkNode )The scenarios that would hit bugs.
Scenario 1: Reset racks for all BK nodes, for Example:
[BK1,BK2]with rack/r_1depthOfAllLeavesis2now.[BK1,BK2]with rack/region_1/r_1/region_1/r_1is3, different with2depthOfAllLeavesofNetworkTopologyImplis still2,[BK1, BK2]could not be added, and get an errorcan't add leaf node BK1 at depth 3 to the topology.You can reproduce this by the new test
testRestartBKWithNewRackDepth.Scenario 2: A race condition caused
depthOfAllLeavesto be initialized with a wrong value.BK1 start/shutdownZK mainRegistrationClientBK1startbkInfosofRegistrationClientEnsemblePlacementPolicy: a node addedBK1shutdownbkInfosofRegistrationClient,bkInfosis empty nowNetworkTopologyImpltries to calculate the network location but getsnull,so use a default valuedefault-region/default-rack[1]depthOfAllLeaveswas initialized to3BK1could not be added toNetworkTopologyImplanymore[1]: https://github.com/apache/bookkeeper/blob/master/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/TopologyAwareEnsemblePlacementPolicy.java#L830
The above scenario will cause
EnsemblePlacementPolicy.knownBookiesto be an empty collection, leading to errorNot enough non-faulty bookies availableThe issue below occurs on the version
4.16.3Changes
Reset
depthOfAllLeavesafter all BKs have been removed.