Simplify and document region life cycle - #227
Draft
aaronbee wants to merge 1 commit into
Draft
Conversation
* Removed RegionInfo.SetClient. The client is now set to nil by MarkUnavailable, and then set again with MarkAvailable. This removes bugs and races where a region info may have its Client set when it shouldn't be. A region now has 3 distinct states it may be in: 1. Unavailable: AvailabilityChan() is non-nil and Client() is nil 2. Available: AvailabilityChan() is nil and Client() is non-nil 3. Stale: AvailabilityChan() is nil and Client() is nil * Documented RegionInfo type with information about those 3 states and the lifecycle. * Documented establishRegion with what it does and what it's requirements are. * Removed calls to SetClient(nil)/MarkUnavailable in clientRegionCache methods. That work is the responsibility of the caller. * getRegionAndClientForRPC no longer marks a region as unavailable if Client is nil after waiting on the AvailabilityChan. If Client is nil, that indicates the region is stale and a lookup has to be performed. Marking it as unavailable and trying to reestablish it is wasted effort. * The above change broke the use of the meta and admin regions, which are created when creating the gohbase Client/AdminClient, but don't have a Client set. These regions were relying on a missing Client to cause the region to be established. Now the meta and admin regions are established as part of NewClient and NewAdminClient, respectively.
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## master #227 +/- ##
==========================================
+ Coverage 70.24% 70.27% +0.03%
==========================================
Files 27 27
Lines 3714 3701 -13
==========================================
- Hits 2609 2601 -8
+ Misses 988 986 -2
+ Partials 117 114 -3
☔ View full report in Codecov by Sentry. |
Collaborator
Author
|
This change still needs some work. |
aaronbee
marked this pull request as draft
August 15, 2023 22:31
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.
Documented RegionInfo type with information about those 3 states and the lifecycle.
Documented establishRegion with what it does and what it's requirements are.
Removed calls to SetClient(nil)/MarkUnavailable in clientRegionCache methods. That work is the responsibility of the caller.
getRegionAndClientForRPC no longer marks a region as unavailable if Client is nil after waiting on the AvailabilityChan. If Client is nil, that indicates the region is stale and a lookup has to be performed. Marking it as unavailable and trying to reestablish it is wasted effort.
The above change broke the use of the meta and admin regions, which are created when creating the gohbase Client/AdminClient, but don't have a Client set. These regions were relying on a missing Client to cause the region to be established. Now the meta and admin regions are established as part of NewClient and NewAdminClient, respectively.
closes: #186