HBASE-22758 Remove the unneccesary info cf deletion in DeleteTableProcedure#deleteFromMeta (#424)
This commit is contained in:
parent
29f8e195ef
commit
892aa832ad
|
@ -1807,7 +1807,8 @@ public class MetaTableAccessor {
|
|||
* @param regionInfo region to be deleted from META
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void deleteRegion(Connection connection, RegionInfo regionInfo) throws IOException {
|
||||
public static void deleteRegionInfo(Connection connection, RegionInfo regionInfo)
|
||||
throws IOException {
|
||||
long time = EnvironmentEdgeManager.currentTime();
|
||||
Delete delete = new Delete(regionInfo.getRegionName());
|
||||
delete.addFamily(getCatalogFamily(), time);
|
||||
|
@ -1820,16 +1821,17 @@ public class MetaTableAccessor {
|
|||
* @param connection connection we're using
|
||||
* @param regionsInfo list of regions to be deleted from META
|
||||
*/
|
||||
public static void deleteRegions(Connection connection, List<RegionInfo> regionsInfo)
|
||||
public static void deleteRegionInfos(Connection connection, List<RegionInfo> regionsInfo)
|
||||
throws IOException {
|
||||
deleteRegions(connection, regionsInfo, EnvironmentEdgeManager.currentTime());
|
||||
deleteRegionInfos(connection, regionsInfo, EnvironmentEdgeManager.currentTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the specified regions from META.
|
||||
* @param connection connection we're using
|
||||
* @param regionsInfo list of regions to be deleted from META
|
||||
*/
|
||||
public static void deleteRegions(Connection connection, List<RegionInfo> regionsInfo, long ts)
|
||||
public static void deleteRegionInfos(Connection connection, List<RegionInfo> regionsInfo, long ts)
|
||||
throws IOException {
|
||||
List<Delete> deletes = new ArrayList<>(regionsInfo.size());
|
||||
for (RegionInfo hri : regionsInfo) {
|
||||
|
@ -1848,11 +1850,11 @@ public class MetaTableAccessor {
|
|||
* @param connection connection we're using
|
||||
* @param regionInfos list of regions to be added to META
|
||||
*/
|
||||
public static void overwriteRegions(Connection connection,
|
||||
List<RegionInfo> regionInfos, int regionReplication) throws IOException {
|
||||
public static void overwriteRegions(Connection connection, List<RegionInfo> regionInfos,
|
||||
int regionReplication) throws IOException {
|
||||
// use master time for delete marker and the Put
|
||||
long now = EnvironmentEdgeManager.currentTime();
|
||||
deleteRegions(connection, regionInfos, now);
|
||||
deleteRegionInfos(connection, regionInfos, now);
|
||||
// Why sleep? This is the easiest way to ensure that the previous deletes does not
|
||||
// eclipse the following puts, that might happen in the same ts from the server.
|
||||
// See HBASE-9906, and HBASE-9879. Once either HBASE-9879, HBASE-8770 is fixed,
|
||||
|
|
|
@ -115,7 +115,7 @@ public class GCRegionProcedure extends AbstractStateMachineRegionProcedure<GCReg
|
|||
am.getRegionStates().deleteRegion(getRegion());
|
||||
}
|
||||
}
|
||||
MetaTableAccessor.deleteRegion(masterServices.getConnection(), getRegion());
|
||||
MetaTableAccessor.deleteRegionInfo(masterServices.getConnection(), getRegion());
|
||||
masterServices.getServerManager().removeRegion(getRegion());
|
||||
FavoredNodesManager fnm = masterServices.getFavoredNodesManager();
|
||||
if (fnm != null) {
|
||||
|
|
|
@ -260,7 +260,7 @@ public class RegionStateStore {
|
|||
}
|
||||
|
||||
public void deleteRegions(final List<RegionInfo> regions) throws IOException {
|
||||
MetaTableAccessor.deleteRegions(master.getConnection(), regions);
|
||||
MetaTableAccessor.deleteRegionInfos(master.getConnection(), regions);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
|
|
|
@ -357,8 +357,8 @@ public class DeleteTableProcedure
|
|||
* that have to do with this table. See HBASE-12980.
|
||||
* @throws IOException
|
||||
*/
|
||||
private static void cleanAnyRemainingRows(final MasterProcedureEnv env,
|
||||
final TableName tableName) throws IOException {
|
||||
private static void cleanRegionsInMeta(final MasterProcedureEnv env, final TableName tableName)
|
||||
throws IOException {
|
||||
Connection connection = env.getMasterServices().getConnection();
|
||||
Scan tableScan = MetaTableAccessor.getScanForTableName(connection, tableName);
|
||||
try (Table metaTable = connection.getTable(TableName.META_TABLE_NAME)) {
|
||||
|
@ -369,19 +369,17 @@ public class DeleteTableProcedure
|
|||
}
|
||||
}
|
||||
if (!deletes.isEmpty()) {
|
||||
LOG.warn("Deleting some vestigial " + deletes.size() + " rows of " + tableName +
|
||||
" from " + TableName.META_TABLE_NAME);
|
||||
LOG.warn("Deleting some vestigial " + deletes.size() + " rows of " + tableName + " from "
|
||||
+ TableName.META_TABLE_NAME);
|
||||
metaTable.delete(deletes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected static void deleteFromMeta(final MasterProcedureEnv env,
|
||||
final TableName tableName, List<RegionInfo> regions) throws IOException {
|
||||
MetaTableAccessor.deleteRegions(env.getMasterServices().getConnection(), regions);
|
||||
|
||||
protected static void deleteFromMeta(final MasterProcedureEnv env, final TableName tableName,
|
||||
List<RegionInfo> regions) throws IOException {
|
||||
// Clean any remaining rows for this table.
|
||||
cleanAnyRemainingRows(env, tableName);
|
||||
cleanRegionsInMeta(env, tableName);
|
||||
|
||||
// clean region references from the server manager
|
||||
env.getMasterServices().getServerManager().removeRegions(regions);
|
||||
|
|
|
@ -437,7 +437,7 @@ public class RestoreSnapshotProcedure
|
|||
// not overwritten/removed, so you end up with old informations
|
||||
// that are not correct after the restore.
|
||||
if (regionsToRemove != null) {
|
||||
MetaTableAccessor.deleteRegions(conn, regionsToRemove);
|
||||
MetaTableAccessor.deleteRegionInfos(conn, regionsToRemove);
|
||||
deleteRegionsFromInMemoryStates(regionsToRemove, env, regionReplication);
|
||||
}
|
||||
|
||||
|
|
|
@ -199,6 +199,6 @@ public class HBaseFsckRepair {
|
|||
*/
|
||||
public static void removeParentInMeta(Configuration conf, RegionInfo hri) throws IOException {
|
||||
Connection conn = ConnectionFactory.createConnection(conf);
|
||||
MetaTableAccessor.deleteRegion(conn, hri);
|
||||
MetaTableAccessor.deleteRegionInfo(conn, hri);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -592,7 +592,7 @@ public class TestLoadIncrementalHFilesSplitRecovery {
|
|||
List<RegionInfo> regionInfos = MetaTableAccessor.getTableRegions(connection, tableName);
|
||||
for (RegionInfo regionInfo : regionInfos) {
|
||||
if (Bytes.equals(regionInfo.getStartKey(), HConstants.EMPTY_BYTE_ARRAY)) {
|
||||
MetaTableAccessor.deleteRegion(connection, regionInfo);
|
||||
MetaTableAccessor.deleteRegionInfo(connection, regionInfo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue