Skip to content

Commit 09751f6

Browse files
committed
HBASE-22758 Remove the unneccesary info cf deletion in DeleteTableProcedure#deleteFromMeta (apache#424)
1 parent 68ce031 commit 09751f6

File tree

7 files changed

+24
-24
lines changed

7 files changed

+24
-24
lines changed

hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1819,7 +1819,8 @@ private static void updateLocation(Connection connection, RegionInfo regionInfo,
18191819
* @param regionInfo region to be deleted from META
18201820
* @throws IOException
18211821
*/
1822-
public static void deleteRegion(Connection connection, RegionInfo regionInfo) throws IOException {
1822+
public static void deleteRegionInfo(Connection connection, RegionInfo regionInfo)
1823+
throws IOException {
18231824
long time = EnvironmentEdgeManager.currentTime();
18241825
Delete delete = new Delete(regionInfo.getRegionName());
18251826
delete.addFamily(getCatalogFamily(), time);
@@ -1832,16 +1833,17 @@ public static void deleteRegion(Connection connection, RegionInfo regionInfo) th
18321833
* @param connection connection we're using
18331834
* @param regionsInfo list of regions to be deleted from META
18341835
*/
1835-
public static void deleteRegions(Connection connection, List<RegionInfo> regionsInfo)
1836+
public static void deleteRegionInfos(Connection connection, List<RegionInfo> regionsInfo)
18361837
throws IOException {
1837-
deleteRegions(connection, regionsInfo, EnvironmentEdgeManager.currentTime());
1838+
deleteRegionInfos(connection, regionsInfo, EnvironmentEdgeManager.currentTime());
18381839
}
1840+
18391841
/**
18401842
* Deletes the specified regions from META.
18411843
* @param connection connection we're using
18421844
* @param regionsInfo list of regions to be deleted from META
18431845
*/
1844-
public static void deleteRegions(Connection connection, List<RegionInfo> regionsInfo, long ts)
1846+
public static void deleteRegionInfos(Connection connection, List<RegionInfo> regionsInfo, long ts)
18451847
throws IOException {
18461848
List<Delete> deletes = new ArrayList<>(regionsInfo.size());
18471849
for (RegionInfo hri : regionsInfo) {
@@ -1860,11 +1862,11 @@ public static void deleteRegions(Connection connection, List<RegionInfo> regions
18601862
* @param connection connection we're using
18611863
* @param regionInfos list of regions to be added to META
18621864
*/
1863-
public static void overwriteRegions(Connection connection,
1864-
List<RegionInfo> regionInfos, int regionReplication) throws IOException {
1865+
public static void overwriteRegions(Connection connection, List<RegionInfo> regionInfos,
1866+
int regionReplication) throws IOException {
18651867
// use master time for delete marker and the Put
18661868
long now = EnvironmentEdgeManager.currentTime();
1867-
deleteRegions(connection, regionInfos, now);
1869+
deleteRegionInfos(connection, regionInfos, now);
18681870
// Why sleep? This is the easiest way to ensure that the previous deletes does not
18691871
// eclipse the following puts, that might happen in the same ts from the server.
18701872
// See HBASE-9906, and HBASE-9879. Once either HBASE-9879, HBASE-8770 is fixed,

hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/GCRegionProcedure.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ protected Flow executeFromState(MasterProcedureEnv env, GCRegionState state)
115115
am.getRegionStates().deleteRegion(getRegion());
116116
}
117117
}
118-
MetaTableAccessor.deleteRegion(masterServices.getConnection(), getRegion());
118+
MetaTableAccessor.deleteRegionInfo(masterServices.getConnection(), getRegion());
119119
masterServices.getServerManager().removeRegion(getRegion());
120120
FavoredNodesManager fnm = masterServices.getFavoredNodesManager();
121121
if (fnm != null) {

hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStateStore.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ public void deleteRegion(final RegionInfo regionInfo) throws IOException {
260260
}
261261

262262
public void deleteRegions(final List<RegionInfo> regions) throws IOException {
263-
MetaTableAccessor.deleteRegions(master.getConnection(), regions);
263+
MetaTableAccessor.deleteRegionInfos(master.getConnection(), regions);
264264
}
265265

266266
// ==========================================================================

hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/DeleteTableProcedure.java

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -357,12 +357,12 @@ protected static void deleteFromFs(final MasterProcedureEnv env,
357357
}
358358

359359
/**
360-
* There may be items for this table still up in hbase:meta in the case where the
361-
* info:regioninfo column was empty because of some write error. Remove ALL rows from hbase:meta
362-
* that have to do with this table. See HBASE-12980.
360+
* There may be items for this table still up in hbase:meta in the case where the info:regioninfo
361+
* column was empty because of some write error. Remove ALL rows from hbase:meta that have to do
362+
* with this table. See HBASE-12980.
363363
*/
364-
private static void cleanAnyRemainingRows(final MasterProcedureEnv env,
365-
final TableName tableName) throws IOException {
364+
private static void cleanRegionsInMeta(final MasterProcedureEnv env, final TableName tableName)
365+
throws IOException {
366366
Connection connection = env.getMasterServices().getConnection();
367367
Scan tableScan = MetaTableAccessor.getScanForTableName(connection, tableName);
368368
try (Table metaTable = connection.getTable(TableName.META_TABLE_NAME)) {
@@ -373,19 +373,17 @@ private static void cleanAnyRemainingRows(final MasterProcedureEnv env,
373373
}
374374
}
375375
if (!deletes.isEmpty()) {
376-
LOG.warn("Deleting some vestigial " + deletes.size() + " rows of " + tableName +
377-
" from " + TableName.META_TABLE_NAME);
376+
LOG.warn("Deleting some vestigial " + deletes.size() + " rows of " + tableName + " from "
377+
+ TableName.META_TABLE_NAME);
378378
metaTable.delete(deletes);
379379
}
380380
}
381381
}
382382

383-
protected static void deleteFromMeta(final MasterProcedureEnv env,
384-
final TableName tableName, List<RegionInfo> regions) throws IOException {
385-
MetaTableAccessor.deleteRegions(env.getMasterServices().getConnection(), regions);
386-
383+
protected static void deleteFromMeta(final MasterProcedureEnv env, final TableName tableName,
384+
List<RegionInfo> regions) throws IOException {
387385
// Clean any remaining rows for this table.
388-
cleanAnyRemainingRows(env, tableName);
386+
cleanRegionsInMeta(env, tableName);
389387

390388
// clean region references from the server manager
391389
env.getMasterServices().getServerManager().removeRegions(regions);

hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/RestoreSnapshotProcedure.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ private void updateMETA(final MasterProcedureEnv env) throws IOException {
437437
// not overwritten/removed, so you end up with old informations
438438
// that are not correct after the restore.
439439
if (regionsToRemove != null) {
440-
MetaTableAccessor.deleteRegions(conn, regionsToRemove);
440+
MetaTableAccessor.deleteRegionInfos(conn, regionsToRemove);
441441
deleteRegionsFromInMemoryStates(regionsToRemove, env, regionReplication);
442442
}
443443

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,6 @@ public static HRegion createHDFSRegionDir(Configuration conf,
199199
*/
200200
public static void removeParentInMeta(Configuration conf, RegionInfo hri) throws IOException {
201201
Connection conn = ConnectionFactory.createConnection(conf);
202-
MetaTableAccessor.deleteRegion(conn, hri);
202+
MetaTableAccessor.deleteRegionInfo(conn, hri);
203203
}
204204
}

hbase-server/src/test/java/org/apache/hadoop/hbase/tool/TestLoadIncrementalHFilesSplitRecovery.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ protected Pair<List<LoadQueueItem>, String> groupOrSplit(
592592
List<RegionInfo> regionInfos = MetaTableAccessor.getTableRegions(connection, tableName);
593593
for (RegionInfo regionInfo : regionInfos) {
594594
if (Bytes.equals(regionInfo.getStartKey(), HConstants.EMPTY_BYTE_ARRAY)) {
595-
MetaTableAccessor.deleteRegion(connection, regionInfo);
595+
MetaTableAccessor.deleteRegionInfo(connection, regionInfo);
596596
break;
597597
}
598598
}

0 commit comments

Comments
 (0)