infraio commented on a change in pull request #404: HBASE-22709 Add a chore 
thread in master to do hbck checking
URL: https://github.com/apache/hbase/pull/404#discussion_r307553408
 
 

 ##########
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/HbckChecker.java
 ##########
 @@ -0,0 +1,220 @@
+/**
+ * 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;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.ScheduledChore;
+import org.apache.hadoop.hbase.ServerName;
+import org.apache.hadoop.hbase.client.RegionInfo;
+import org.apache.hadoop.hbase.util.FSUtils;
+import org.apache.hadoop.hbase.util.HbckRegionInfo;
+import org.apache.hadoop.hbase.util.Pair;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.apache.yetus.audience.InterfaceStability;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.hbase.thirdparty.com.google.common.collect.Lists;
+
+/**
+ * Used to do the hbck checking job at master side.
+ */
+@InterfaceAudience.Private
+@InterfaceStability.Evolving
+public class HbckChecker extends ScheduledChore {
+  private static final Logger LOG = 
LoggerFactory.getLogger(HbckChecker.class.getName());
+
+  private static final String HBCK_CHECKER_INTERVAL = 
"hbase.master.hbck.checker.interval";
+  private static final int DEFAULT_HBCK_CHECKER_INTERVAL = 60 * 60 * 1000;
+
+  private final MasterServices master;
+
+  /**
+   * This map contains the state of all hbck items.  It maps from encoded 
region
+   * name to HbckRegionInfo structure.  The information contained in 
HbckRegionInfo is used
+   * to detect and correct consistency (hdfs/meta/deployment) problems.
+   */
+  private final Map<String, HbckRegionInfo> regionInfoMap = new HashMap<>();
+
+  private final Map<String, ServerName> orphanRegionsOnRS = new HashMap<>();
+  private final List<String> orphanRegionsOnFS = new LinkedList<>();
+  private final Map<String, Pair<ServerName, List<ServerName>>> 
inconsistentRegions =
+      new HashMap<>();
+
+  private final Map<String, ServerName> orphanRegionsOnRSSnapshot = new 
HashMap<>();
 
 Review comment:
   Yes. Will add more javadoc/comments later.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to