-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-29841: Split bulky ReadOnlyController into multiple smaller controllers #7661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: HBASE-29081
Are you sure you want to change the base?
Conversation
360a366 to
6e3b3e4
Compare
|
🎊 +1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
wchevreuil
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just have few nits.
| return Optional.of(this); | ||
| } | ||
|
|
||
| /* ---- ConfigurationObserver Overrides ---- */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove this comment and add @Override annotation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| HConstants.HBASE_GLOBAL_READONLY_ENABLED_KEY, this.globalReadOnlyEnabled); | ||
| } | ||
|
|
||
| /* ---- BulkLoadObserver Overrides ---- */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove this comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| return Optional.of(this); | ||
| } | ||
|
|
||
| /* ---- ConfigurationObserver Overrides ---- */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove this comment and add @Override annotation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| if (!isOnMeta(c)) { | ||
| internalReadOnlyGuard(); | ||
| /* ---- ConfigurationObserver Overrides ---- */ | ||
| public void onConfigurationChange(Configuration conf) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove this comment and add @Override annotation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| return Optional.of(this); | ||
| } | ||
|
|
||
| /* ---- MasterObserver Overrides ---- */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove this comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| } | ||
|
|
||
| /* ---- ConfigurationObserver Overrides ---- */ | ||
| public void onConfigurationChange(Configuration conf) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove this comment and add @Override annotation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| HConstants.HBASE_GLOBAL_READONLY_ENABLED_KEY, this.globalReadOnlyEnabled); | ||
| } | ||
|
|
||
| /* ---- RegionServerObserver Overrides ---- */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove this comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| } | ||
|
|
||
| /* ---- ConfigurationObserver Overrides ---- */ | ||
| public void onConfigurationChange(Configuration conf) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove this comment and add @Override annotation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| } | ||
| } | ||
|
|
||
| /* ---- RegionObserver Overrides ---- */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove this comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
…trollers Currently we have created a single ReadOnlyController which needs to get added as coprocessor for master, region and region server. In this task we will be breaking ReadOnlyController into multiple smaller controller to avoid unnecessarily adding methods which are not relevant for particular role for example, master copocessor should only register methods which may run on master and not on region or region server.
6e3b3e4 to
15fcc92
Compare
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few comments, but it LGTM overall.
| private static final Logger LOG = LoggerFactory.getLogger(BulkLoadReadOnlyController.class); | ||
| private volatile boolean globalReadOnlyEnabled; | ||
|
|
||
| private void internalReadOnlyGuard() throws DoNotRetryIOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed there are come common methods among these different types of ReadOnlyController classes. The ones I noticed are internalReadOnlyGuard(), start(), stop(), and onConfigurationChange(). I see the MasterReadOnlyController class has some different implementations for start() and onConfigurationChange(), but the other methods seem roughly the same for each class. Do you think it would make sense to have some kind of ReadOnlyControllerBase class that defines these methods and MasterReadOnlyController can override anything that needs to be implemented differently?
| internalReadOnlyGuard(); | ||
| RegionObserver.super.preCommitStoreFile(ctx, family, pairs); | ||
| } | ||
| private void manageActiveClusterIdFile(boolean newValue) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Can we change newValue to something like isEnablingReadOnly (or similar)? When I first saw newValue, it made me think this newValue was being used to assign its value to something. However, it looks like it's just used to determine what we are doing with the active cluster file.
| public void onConfigurationChange(Configuration conf) { | ||
| boolean maybeUpdatedConfValue = conf.getBoolean(HConstants.HBASE_GLOBAL_READONLY_ENABLED_KEY, | ||
| HConstants.HBASE_GLOBAL_READONLY_ENABLED_DEFAULT); | ||
| if (this.globalReadOnlyEnabled != maybeUpdatedConfValue) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why this implementation of onConfigurationChange() has the if (this.globalReadOnlyEnabled != maybeUpdatedConfValue) block while the other implementations of this method don't? We may want this if block in each method to prevent extra logging when nothing was actually changed.
Currently we have created a single ReadOnlyController which needs to get added as coprocessor for master, region and region server. In this task we will be breaking ReadOnlyController into multiple smaller controller to avoid unnecessarily adding methods which are not relevant for particular role for example, master copocessor should only register methods which may run on master and not on region or region server.