Skip to content

Commit 6705d4f

Browse files
authored
HBASE-22721 Refactor HBaseFsck: move the inner class out
Signed-off-by: stack <[email protected]>
1 parent e74d501 commit 6705d4f

File tree

13 files changed

+1575
-1402
lines changed

13 files changed

+1575
-1402
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
import java.util.concurrent.ThreadPoolExecutor;
5050
import java.util.concurrent.TimeUnit;
5151
import java.util.regex.Pattern;
52+
5253
import org.apache.hadoop.conf.Configuration;
5354
import org.apache.hadoop.fs.BlockLocation;
5455
import org.apache.hadoop.fs.FSDataInputStream;
@@ -74,7 +75,6 @@
7475
import org.apache.hadoop.hbase.master.HMaster;
7576
import org.apache.hadoop.hbase.regionserver.StoreFileInfo;
7677
import org.apache.hadoop.hbase.security.AccessDeniedException;
77-
import org.apache.hadoop.hbase.util.HBaseFsck.ErrorReporter;
7878
import org.apache.hadoop.hdfs.DFSClient;
7979
import org.apache.hadoop.hdfs.DFSHedgedReadMetrics;
8080
import org.apache.hadoop.hdfs.DistributedFileSystem;
@@ -1223,10 +1223,10 @@ public static Map<String, Path> getTableStoreFilePathMap(Map<String, Path> map,
12231223
* @throws IOException When scanning the directory fails.
12241224
* @throws InterruptedException
12251225
*/
1226-
public static Map<String, Path> getTableStoreFilePathMap(
1227-
Map<String, Path> resultMap,
1226+
public static Map<String, Path> getTableStoreFilePathMap(Map<String, Path> resultMap,
12281227
final FileSystem fs, final Path hbaseRootDir, TableName tableName, final PathFilter sfFilter,
1229-
ExecutorService executor, final ErrorReporter errors) throws IOException, InterruptedException {
1228+
ExecutorService executor, final HbckErrorReporter errors)
1229+
throws IOException, InterruptedException {
12301230

12311231
final Map<String, Path> finalResultMap =
12321232
resultMap == null ? new ConcurrentHashMap<>(128, 0.75f, 32) : resultMap;
@@ -1389,7 +1389,7 @@ public static Map<String, Path> getTableStoreFilePathMap(
13891389
*/
13901390
public static Map<String, Path> getTableStoreFilePathMap(
13911391
final FileSystem fs, final Path hbaseRootDir, PathFilter sfFilter,
1392-
ExecutorService executor, ErrorReporter errors)
1392+
ExecutorService executor, HbckErrorReporter errors)
13931393
throws IOException, InterruptedException {
13941394
ConcurrentHashMap<String, Path> map = new ConcurrentHashMap<>(1024, 0.75f, 32);
13951395

hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java

Lines changed: 207 additions & 1317 deletions
Large diffs are not rendered by default.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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.util;
19+
20+
import java.util.ArrayList;
21+
22+
import org.apache.yetus.audience.InterfaceAudience;
23+
import org.apache.yetus.audience.InterfaceStability;
24+
25+
@InterfaceAudience.Private
26+
@InterfaceStability.Evolving
27+
public interface HbckErrorReporter {
28+
29+
enum ERROR_CODE {
30+
UNKNOWN, NO_META_REGION, NULL_META_REGION, NO_VERSION_FILE, NOT_IN_META_HDFS, NOT_IN_META,
31+
NOT_IN_META_OR_DEPLOYED, NOT_IN_HDFS_OR_DEPLOYED, NOT_IN_HDFS, SERVER_DOES_NOT_MATCH_META,
32+
NOT_DEPLOYED, MULTI_DEPLOYED, SHOULD_NOT_BE_DEPLOYED, MULTI_META_REGION, RS_CONNECT_FAILURE,
33+
FIRST_REGION_STARTKEY_NOT_EMPTY, LAST_REGION_ENDKEY_NOT_EMPTY, DUPE_STARTKEYS,
34+
HOLE_IN_REGION_CHAIN, OVERLAP_IN_REGION_CHAIN, REGION_CYCLE, DEGENERATE_REGION,
35+
ORPHAN_HDFS_REGION, LINGERING_SPLIT_PARENT, NO_TABLEINFO_FILE, LINGERING_REFERENCE_HFILE,
36+
LINGERING_HFILELINK, WRONG_USAGE, EMPTY_META_CELL, EXPIRED_TABLE_LOCK, BOUNDARIES_ERROR,
37+
ORPHAN_TABLE_STATE, NO_TABLE_STATE, UNDELETED_REPLICATION_QUEUE, DUPE_ENDKEYS,
38+
UNSUPPORTED_OPTION, INVALID_TABLE
39+
}
40+
41+
void clear();
42+
43+
void report(String message);
44+
45+
void reportError(String message);
46+
47+
void reportError(ERROR_CODE errorCode, String message);
48+
49+
void reportError(ERROR_CODE errorCode, String message, HbckTableInfo table);
50+
51+
void reportError(ERROR_CODE errorCode, String message, HbckTableInfo table, HbckRegionInfo info);
52+
53+
void reportError(ERROR_CODE errorCode, String message, HbckTableInfo table, HbckRegionInfo info1,
54+
HbckRegionInfo info2);
55+
56+
int summarize();
57+
58+
void detail(String details);
59+
60+
ArrayList<ERROR_CODE> getErrorList();
61+
62+
void progress();
63+
64+
void print(String message);
65+
66+
void resetErrors();
67+
68+
boolean tableHasErrors(HbckTableInfo table);
69+
}

0 commit comments

Comments
 (0)