Skip to content

Commit f9e928e

Browse files
authored
HBASE-25184 Move RegionLocationFinder to hbase-balancer (#2543)
Signed-off-by: Yulin Niu <[email protected]>
1 parent 7549410 commit f9e928e

File tree

12 files changed

+423
-304
lines changed

12 files changed

+423
-304
lines changed

hbase-balancer/pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@
7474
<type>test-jar</type>
7575
<scope>test</scope>
7676
</dependency>
77+
<dependency>
78+
<groupId>org.apache.hbase</groupId>
79+
<artifactId>hbase-logging</artifactId>
80+
<type>test-jar</type>
81+
<scope>test</scope>
82+
</dependency>
7783
<dependency>
7884
<groupId>org.apache.hbase</groupId>
7985
<artifactId>hbase-common</artifactId>
@@ -92,6 +98,11 @@
9298
<scope>compile</scope>
9399
<optional>true</optional>
94100
</dependency>
101+
<dependency>
102+
<groupId>org.mockito</groupId>
103+
<artifactId>mockito-core</artifactId>
104+
<scope>test</scope>
105+
</dependency>
95106
<dependency>
96107
<groupId>junit</groupId>
97108
<artifactId>junit</artifactId>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
package org.apache.hadoop.hbase.master.balancer;
19+
20+
import java.io.IOException;
21+
import java.util.List;
22+
import org.apache.hadoop.conf.Configuration;
23+
import org.apache.hadoop.hbase.HDFSBlocksDistribution;
24+
import org.apache.hadoop.hbase.TableName;
25+
import org.apache.hadoop.hbase.client.RegionInfo;
26+
import org.apache.hadoop.hbase.client.TableDescriptor;
27+
import org.apache.yetus.audience.InterfaceAudience;
28+
29+
/**
30+
* This is the cluster we want to balance. It provides methods to let us get the information we
31+
* want.
32+
*/
33+
@InterfaceAudience.Private
34+
public interface ClusterInfoProvider {
35+
36+
/**
37+
* Get all the regions of this cluster.
38+
* <p/>
39+
* Used to refresh region block locations on HDFS.
40+
*/
41+
List<RegionInfo> getAssignedRegions();
42+
43+
/**
44+
* Get the table descriptor for the given table.
45+
*/
46+
TableDescriptor getTableDescriptor(TableName tableName) throws IOException;
47+
48+
/**
49+
* Compute the block distribution for the given region.
50+
* <p/>
51+
* Used to refresh region block locations on HDFS.
52+
*/
53+
HDFSBlocksDistribution computeHDFSBlocksDistribution(Configuration conf,
54+
TableDescriptor tableDescriptor, RegionInfo regionInfo) throws IOException;
55+
}

0 commit comments

Comments
 (0)