@@ -61,14 +61,16 @@ public class HbckChore extends ScheduledChore {
6161 */
6262 private final Map <String , HbckRegionInfo > regionInfoMap = new HashMap <>();
6363
64+ private final Set <String > disabledTableRegions = new HashSet <>();
65+
6466 /**
6567 * The regions only opened on RegionServers, but no region info in meta.
6668 */
6769 private final Map <String , ServerName > orphanRegionsOnRS = new HashMap <>();
6870 /**
6971 * The regions have directory on FileSystem, but no region info in meta.
7072 */
71- private final Set <String > orphanRegionsOnFS = new HashSet <>();
73+ private final Map <String , Path > orphanRegionsOnFS = new HashMap <>();
7274 /**
7375 * The inconsistent regions. There are three case:
7476 * case 1. Master thought this region opened, but no regionserver reported it.
@@ -82,7 +84,7 @@ public class HbckChore extends ScheduledChore {
8284 * The "snapshot" is used to save the last round's HBCK checking report.
8385 */
8486 private final Map <String , ServerName > orphanRegionsOnRSSnapshot = new HashMap <>();
85- private final Set <String > orphanRegionsOnFSSnapshot = new HashSet <>();
87+ private final Map <String , Path > orphanRegionsOnFSSnapshot = new HashMap <>();
8688 private final Map <String , Pair <ServerName , List <ServerName >>> inconsistentRegionsSnapshot =
8789 new HashMap <>();
8890
@@ -121,6 +123,7 @@ protected synchronized void chore() {
121123 }
122124 running = true ;
123125 regionInfoMap .clear ();
126+ disabledTableRegions .clear ();
124127 orphanRegionsOnRS .clear ();
125128 orphanRegionsOnFS .clear ();
126129 inconsistentRegions .clear ();
@@ -167,7 +170,8 @@ private void saveCheckResultToSnapshot() {
167170 orphanRegionsOnRS .entrySet ()
168171 .forEach (e -> orphanRegionsOnRSSnapshot .put (e .getKey (), e .getValue ()));
169172 orphanRegionsOnFSSnapshot .clear ();
170- orphanRegionsOnFSSnapshot .addAll (orphanRegionsOnFS );
173+ orphanRegionsOnFS .entrySet ()
174+ .forEach (e -> orphanRegionsOnFSSnapshot .put (e .getKey (), e .getValue ()));
171175 inconsistentRegionsSnapshot .clear ();
172176 inconsistentRegions .entrySet ()
173177 .forEach (e -> inconsistentRegionsSnapshot .put (e .getKey (), e .getValue ()));
@@ -182,11 +186,9 @@ private void loadRegionsFromInMemoryState() {
182186 master .getAssignmentManager ().getRegionStates ().getRegionStates ();
183187 for (RegionState regionState : regionStates ) {
184188 RegionInfo regionInfo = regionState .getRegion ();
185- // Because the inconsistent regions are not absolutely right, only skip the offline regions
186- // which belong to disabled table.
187189 if (master .getTableStateManager ()
188190 .isTableState (regionInfo .getTable (), TableState .State .DISABLED )) {
189- continue ;
191+ disabledTableRegions . add ( regionInfo . getEncodedName ()) ;
190192 }
191193 HbckRegionInfo .MetaEntry metaEntry =
192194 new HbckRegionInfo .MetaEntry (regionInfo , regionState .getServerName (),
@@ -220,6 +222,11 @@ private void loadRegionsFromRSReport() {
220222 HbckRegionInfo hri = entry .getValue ();
221223 ServerName locationInMeta = hri .getMetaEntry ().getRegionServer ();
222224 if (hri .getDeployedOn ().size () == 0 ) {
225+ // Because the inconsistent regions are not absolutely right, only skip the offline regions
226+ // which belong to disabled table.
227+ if (disabledTableRegions .contains (encodedRegionName )) {
228+ continue ;
229+ }
223230 // Master thought this region opened, but no regionserver reported it.
224231 inconsistentRegions .put (encodedRegionName , new Pair <>(locationInMeta , new LinkedList <>()));
225232 } else if (hri .getDeployedOn ().size () > 1 ) {
@@ -244,7 +251,7 @@ private void loadRegionsFromFS() throws IOException {
244251 String encodedRegionName = regionDir .getName ();
245252 HbckRegionInfo hri = regionInfoMap .get (encodedRegionName );
246253 if (hri == null ) {
247- orphanRegionsOnFS .add (encodedRegionName );
254+ orphanRegionsOnFS .put (encodedRegionName , regionDir );
248255 continue ;
249256 }
250257 HbckRegionInfo .HdfsEntry hdfsEntry = new HbckRegionInfo .HdfsEntry (regionDir );
@@ -279,7 +286,7 @@ public Map<String, ServerName> getOrphanRegionsOnRS() {
279286 /**
280287 * @return the regions have directory on FileSystem, but no region info in meta.
281288 */
282- public Set <String > getOrphanRegionsOnFS () {
289+ public Map <String , Path > getOrphanRegionsOnFS () {
283290 // Need synchronized here, as this "snapshot" may be changed after checking.
284291 rwLock .readLock ().lock ();
285292 try {
0 commit comments