-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-27028 Add a shell command for flushing master local region #4457
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
Changes from 1 commit
eda23a5
8718a5e
638621d
83b4092
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -457,6 +457,9 @@ public class HMaster extends HBaseServerBase<MasterRpcServices> implements Maste | |
| public static final String WARMUP_BEFORE_MOVE = "hbase.master.warmup.before.move"; | ||
| private static final boolean DEFAULT_WARMUP_BEFORE_MOVE = true; | ||
|
|
||
| // Only for testing | ||
| private boolean isLocalRegionFlushed = false; | ||
|
||
|
|
||
| /** | ||
| * Initializes the HMaster. The steps are as follows: | ||
| * <p> | ||
|
|
@@ -4207,6 +4210,19 @@ public List<HRegionLocation> getMetaLocations() { | |
| return metaRegionLocationCache.getMetaRegionLocations(); | ||
| } | ||
|
|
||
| @Override | ||
| public void flushMasterStore() throws IOException { | ||
| LOG.info("Force flush master local region."); | ||
| masterRegion.flush(true); | ||
| isLocalRegionFlushed = true; | ||
| } | ||
|
|
||
| @RestrictedApi(explanation = "Should only be called in tests", link = "", | ||
| allowedOnPath = ".*/src/test/.*") | ||
| public boolean isLocalRegionFlushed() { | ||
| return isLocalRegionFlushed; | ||
| } | ||
|
|
||
| public Collection<ServerName> getLiveRegionServers() { | ||
| return regionServerTracker.getRegionServers(); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -161,9 +161,8 @@ public RegionScanner getRegionScanner(Scan scan) throws IOException { | |
| return region.getScanner(scan); | ||
| } | ||
|
|
||
| @RestrictedApi(explanation = "Should only be called in tests", link = "", | ||
| allowedOnPath = ".*/src/test/.*") | ||
| public FlushResult flush(boolean force) throws IOException { | ||
| flusherAndCompactor.resetChangesAfterLastFlush(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We add a line, but where do we reset this in tha past? We do not need to remove the original one?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At present, the flush method is only called by test cases, reset is not called in this method, and there is no reset logic in the relevant test cases: TestMasterRegionWALCleaner/TestMasterRegionOnTwoFileSystems and so on. Can you help me make sure we don't need reset logic either?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Do you mean the following changes are OK? public FlushResult flush(boolean force) throws IOException { @Apache9 sir.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean we have reset logic in MasterRegionFlusherAndCompactor, before calling this flush method. Now we move the reset logic into this method, then we should remove the reset logic in MasterRegionFlusherAndCompactor?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aha! I have understood what you mean.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We do not need to record the lastFlushTime here? |
||
| return region.flush(force); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
|
|
||
| module Shell | ||
| module Commands | ||
| class FlushMasterStore < Command | ||
| def help | ||
| <<-EOF | ||
| Flush master local region. | ||
| For example: | ||
|
|
||
| hbase> flush_master_store | ||
| EOF | ||
| end | ||
|
|
||
| def command() | ||
| admin.flush_master_store() | ||
| end | ||
| end | ||
| end | ||
| end |
Uh oh!
There was an error while loading. Please reload this page.