-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-22707 [HBCK2] MasterRpcServices assigns method should try to reload regions from meta if the passed regions isn't found under AssignmentManager RegionsStateStore #403
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
Closed
Closed
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6965920
HBASE-22707 [HBCK2] MasterRpcServices assigns method should try to re…
wchevreuil a42cf36
HBASE-22707 [HBCK2] MasterRpcServices assigns method should try to re…
wchevreuil 54e52c3
Fixes to address UT failures
wchevreuil 5a94343
addressing checkstyle
wchevreuil fb54acc
Addressing PR review suggestions
wchevreuil f2e4ecb
UTs for each of the new public methods added on this PR.
wchevreuil 688cb9e
missed this new test class on previous commit
wchevreuil 57a8371
addressing checkstyles
wchevreuil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
102 changes: 102 additions & 0 deletions
102
...-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestRegionStateStore.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| /** | ||
| * 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. | ||
| */ | ||
| package org.apache.hadoop.hbase.master.assignment; | ||
|
|
||
| import static org.junit.Assert.assertEquals; | ||
| import static org.junit.Assert.assertFalse; | ||
| import static org.junit.Assert.assertTrue; | ||
| import org.apache.hadoop.hbase.HBaseClassTestRule; | ||
| import org.apache.hadoop.hbase.HBaseTestingUtility; | ||
| import org.apache.hadoop.hbase.ServerName; | ||
| import org.apache.hadoop.hbase.TableName; | ||
| import org.apache.hadoop.hbase.client.RegionInfo; | ||
| import org.apache.hadoop.hbase.client.Result; | ||
| import org.apache.hadoop.hbase.master.RegionState; | ||
| import org.apache.hadoop.hbase.regionserver.HRegion; | ||
| import org.apache.hadoop.hbase.testclassification.MasterTests; | ||
| import org.apache.hadoop.hbase.testclassification.MediumTests; | ||
| import org.junit.After; | ||
| import org.junit.Before; | ||
| import org.junit.ClassRule; | ||
| import org.junit.Test; | ||
| import org.junit.experimental.categories.Category; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
| import java.util.List; | ||
| import java.util.concurrent.atomic.AtomicBoolean; | ||
|
|
||
| @Category({ MasterTests.class, MediumTests.class }) | ||
| public class TestRegionStateStore { | ||
|
|
||
| @ClassRule | ||
| public static final HBaseClassTestRule CLASS_RULE = | ||
| HBaseClassTestRule.forClass(TestRegionStateStore.class); | ||
|
|
||
| private static final Logger LOG = LoggerFactory.getLogger(TestRegionStateStore.class); | ||
|
|
||
| protected HBaseTestingUtility util; | ||
|
|
||
| @Before | ||
| public void setup() throws Exception { | ||
| util = new HBaseTestingUtility(); | ||
| util.startMiniCluster(); | ||
| } | ||
|
|
||
| @After | ||
| public void tearDown() throws Exception { | ||
| util.shutdownMiniCluster(); | ||
| } | ||
|
|
||
| @Test | ||
| public void testVisitMetaForRegionExistingRegion() throws Exception { | ||
| final TableName tableName = TableName.valueOf("testVisitMetaForRegion"); | ||
| util.createTable(tableName, "cf"); | ||
| final List<HRegion> regions = util.getHBaseCluster().getRegions(tableName); | ||
| final String encodedName = regions.get(0).getRegionInfo().getEncodedName(); | ||
| final RegionStateStore regionStateStore = util.getHBaseCluster().getMaster(). | ||
| getAssignmentManager().getRegionStateStore(); | ||
| final AtomicBoolean visitorCalled = new AtomicBoolean(false); | ||
| regionStateStore.visitMetaForRegion(encodedName, new RegionStateStore.RegionStateVisitor() { | ||
| @Override | ||
| public void visitRegionState(Result result, RegionInfo regionInfo, RegionState.State state, | ||
| ServerName regionLocation, ServerName lastHost, long openSeqNum) { | ||
| assertEquals(encodedName, regionInfo.getEncodedName()); | ||
| visitorCalled.set(true); | ||
| } | ||
| }); | ||
| assertTrue("Visitor has not been called.", visitorCalled.get()); | ||
| } | ||
|
|
||
| @Test | ||
| public void testVisitMetaForRegionNonExistingRegion() throws Exception { | ||
| final String encodedName = "fakeencodedregionname"; | ||
| final RegionStateStore regionStateStore = util.getHBaseCluster().getMaster(). | ||
| getAssignmentManager().getRegionStateStore(); | ||
| final AtomicBoolean visitorCalled = new AtomicBoolean(false); | ||
| regionStateStore.visitMetaForRegion(encodedName, new RegionStateStore.RegionStateVisitor() { | ||
| @Override | ||
| public void visitRegionState(Result result, RegionInfo regionInfo, RegionState.State state, | ||
| ServerName regionLocation, ServerName lastHost, long openSeqNum) { | ||
| visitorCalled.set(true); | ||
| } | ||
| }); | ||
| assertFalse("Visitor has been called, but it shouldn't.", visitorCalled.get()); | ||
| } | ||
|
|
||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.