Skip to content

Commit afe2274

Browse files
authored
HBASE-29580: Clean-up hardcoded meta table names from log entries (#7319)
Change-Id: I2bca05b3f2ef4450bfcbb3b7608b829348c37bde
1 parent 65e0d32 commit afe2274

File tree

24 files changed

+131
-104
lines changed

24 files changed

+131
-104
lines changed

hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/IncrementalBackupManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ private List<String> getLogFilesForNewBackup(Map<String, Long> olderTimestamps,
177177
LOG.debug("currentLogFile: " + log.getPath().toString());
178178
if (AbstractFSWALProvider.isMetaFile(log.getPath())) {
179179
if (LOG.isDebugEnabled()) {
180-
LOG.debug("Skip hbase:meta log file: " + log.getPath().getName());
180+
LOG.debug("Skip {} log file: {}", TableName.META_TABLE_NAME, log.getPath().getName());
181181
}
182182
continue;
183183
}

hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/SnapshotOfRegionAssignmentFromMeta.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ private void processMetaRecord(Result result) throws IOException {
170170
* Initialize the region assignment snapshot by scanning the hbase:meta table
171171
*/
172172
public void initialize() throws IOException {
173-
LOG.info("Start to scan the hbase:meta for the current region assignment " + "snappshot");
173+
LOG.info("Start to scan {} for the current region assignment snapshot",
174+
TableName.META_TABLE_NAME);
174175
// Scan hbase:meta to pick up user regions
175176
try (Table metaTable = connection.getTable(TableName.META_TABLE_NAME);
176177
ResultScanner scanner = metaTable.getScanner(HConstants.CATALOG_FAMILY)) {
@@ -187,7 +188,8 @@ public void initialize() throws IOException {
187188
}
188189
}
189190
}
190-
LOG.info("Finished to scan the hbase:meta for the current region assignment" + "snapshot");
191+
LOG.info("Finished scanning {} for the current region assignment snapshot",
192+
TableName.META_TABLE_NAME);
191193
}
192194

193195
private void addRegion(RegionInfo regionInfo) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ static byte[] toByteArray(RegionInfo ri) {
431431
*/
432432
static String prettyPrint(final String encodedRegionName) {
433433
if (encodedRegionName.equals("1028785192")) {
434-
return encodedRegionName + "/hbase:meta";
434+
return encodedRegionName + "/" + TableName.META_TABLE_NAME;
435435
}
436436
return encodedRegionName;
437437
}

hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsMasterFileSystemSource.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818
package org.apache.hadoop.hbase.master;
1919

20+
import org.apache.hadoop.hbase.TableName;
2021
import org.apache.hadoop.hbase.metrics.BaseSource;
2122
import org.apache.yetus.audience.InterfaceAudience;
2223

@@ -49,7 +50,7 @@ public interface MetricsMasterFileSystemSource extends BaseSource {
4950
String SPLIT_SIZE_NAME = "hlogSplitSize";
5051

5152
String META_SPLIT_TIME_DESC = "Time it takes to finish splitMetaLog()";
52-
String META_SPLIT_SIZE_DESC = "Size of hbase:meta WAL files being split";
53+
String META_SPLIT_SIZE_DESC = "Size of " + TableName.META_TABLE_NAME + " WAL files being split";
5354
String SPLIT_TIME_DESC = "Time it takes to finish WAL.splitLog()";
5455
String SPLIT_SIZE_DESC = "Size of WAL files being split";
5556

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ public static void addRegionsToMeta(Connection connection, List<RegionInfo> regi
848848
private static void updateTableState(Connection connection, TableState state) throws IOException {
849849
Put put = makePutFromTableState(state, EnvironmentEdgeManager.currentTime());
850850
putToMetaTable(connection, put);
851-
LOG.info("Updated {} in hbase:meta", state);
851+
LOG.info("Updated {} in {}", state, TableName.META_TABLE_NAME);
852852
}
853853

854854
/**

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,8 +1187,9 @@ private void finishActiveMasterInitialization() throws IOException, InterruptedE
11871187
int existingReplicasCount =
11881188
assignmentManager.getRegionStates().getRegionsOfTable(TableName.META_TABLE_NAME).size();
11891189
if (existingReplicasCount > metaDesc.getRegionReplication()) {
1190-
LOG.info("Update replica count of hbase:meta from {}(in TableDescriptor)"
1191-
+ " to {}(existing ZNodes)", metaDesc.getRegionReplication(), existingReplicasCount);
1190+
LOG.info(
1191+
"Update replica count of {} from {}(in TableDescriptor)" + " to {}(existing ZNodes)",
1192+
TableName.META_TABLE_NAME, metaDesc.getRegionReplication(), existingReplicasCount);
11921193
metaDesc = TableDescriptorBuilder.newBuilder(metaDesc)
11931194
.setRegionReplication(existingReplicasCount).build();
11941195
tableDescriptors.update(metaDesc);
@@ -1197,8 +1198,9 @@ private void finishActiveMasterInitialization() throws IOException, InterruptedE
11971198
if (metaDesc.getRegionReplication() != replicasNumInConf) {
11981199
LOG.info(
11991200
"The {} config is {} while the replica count in TableDescriptor is {}"
1200-
+ " for hbase:meta, altering...",
1201-
HConstants.META_REPLICAS_NUM, replicasNumInConf, metaDesc.getRegionReplication());
1201+
+ " for {}, altering...",
1202+
HConstants.META_REPLICAS_NUM, replicasNumInConf, metaDesc.getRegionReplication(),
1203+
TableName.META_TABLE_NAME);
12021204
procedureExecutor.submitProcedure(new ModifyTableProcedure(
12031205
procedureExecutor.getEnvironment(), TableDescriptorBuilder.newBuilder(metaDesc)
12041206
.setRegionReplication(replicasNumInConf).build(),

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ public static void printAssignmentPlan(FavoredNodesPlan plan) {
605605
*/
606606
public void updateAssignmentPlanToMeta(FavoredNodesPlan plan) throws IOException {
607607
try {
608-
LOG.info("Start to update the hbase:meta with the new assignment plan");
608+
LOG.info("Started updating {} with the new assignment plan", TableName.META_TABLE_NAME);
609609
Map<String, List<ServerName>> assignmentMap = plan.getAssignmentMap();
610610
Map<RegionInfo, List<ServerName>> planToUpdate = new HashMap<>(assignmentMap.size());
611611
Map<String, RegionInfo> regionToRegionInfoMap =
@@ -615,10 +615,10 @@ public void updateAssignmentPlanToMeta(FavoredNodesPlan plan) throws IOException
615615
}
616616

617617
FavoredNodeAssignmentHelper.updateMetaWithFavoredNodesInfo(planToUpdate, conf);
618-
LOG.info("Updated the hbase:meta with the new assignment plan");
618+
LOG.info("Updated {} with the new assignment plan", TableName.META_TABLE_NAME);
619619
} catch (Exception e) {
620-
LOG.error(
621-
"Failed to update hbase:meta with the new assignment" + "plan because " + e.getMessage());
620+
LOG.error("Failed to update {} with the new assignment plan because {}",
621+
TableName.META_TABLE_NAME, e.getMessage());
622622
}
623623
}
624624

@@ -690,14 +690,14 @@ private void updateAssignmentPlanToRegionServers(FavoredNodesPlan plan) throws I
690690
}
691691

692692
public void updateAssignmentPlan(FavoredNodesPlan plan) throws IOException {
693-
LOG.info("Start to update the new assignment plan for the hbase:meta table and"
694-
+ " the region servers");
693+
LOG.info("Started updating the new assignment plan for {} and the region servers",
694+
TableName.META_TABLE_NAME);
695695
// Update the new assignment plan to META
696696
updateAssignmentPlanToMeta(plan);
697697
// Update the new assignment plan to Region Servers
698698
updateAssignmentPlanToRegionServers(plan);
699-
LOG.info("Finish to update the new assignment plan for the hbase:meta table and"
700-
+ " the region servers");
699+
LOG.info("Finished updating the new assignment plan for {} and the region servers",
700+
TableName.META_TABLE_NAME);
701701
}
702702

703703
/**

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ public void start() throws IOException, KeeperException {
346346
if (RegionReplicaUtil.isDefaultReplica(regionInfo.getReplicaId())) {
347347
setMetaAssigned(regionInfo, state == State.OPEN);
348348
}
349-
LOG.debug("Loaded hbase:meta {}", regionNode);
349+
LOG.debug("Loaded {} {}", TableName.META_TABLE_NAME, regionNode);
350350
}, result);
351351
}
352352
}
@@ -1921,8 +1921,8 @@ private void checkMetaLoaded(RegionInfo hri) throws PleaseHoldException {
19211921
boolean meta = isMetaRegion(hri);
19221922
boolean metaLoaded = isMetaLoaded();
19231923
if (!meta && !metaLoaded) {
1924-
throw new PleaseHoldException(
1925-
"Master not fully online; hbase:meta=" + meta + ", metaLoaded=" + metaLoaded);
1924+
throw new PleaseHoldException("Master not fully online; " + TableName.META_TABLE_NAME + "="
1925+
+ meta + ", metaLoaded=" + metaLoaded);
19261926
}
19271927
}
19281928

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -718,8 +718,10 @@ private void preMergeRegionsCommit(final MasterProcedureEnv env) throws IOExcept
718718
RegionInfo.parseRegionName(p.getRow());
719719
}
720720
} catch (IOException e) {
721-
LOG.error("Row key of mutation from coprocessor is not parsable as region name. "
722-
+ "Mutations from coprocessor should only be for hbase:meta table.", e);
721+
LOG.error(
722+
"Row key of mutation from coprocessor is not parsable as region name. "
723+
+ "Mutations from coprocessor should only be for {} table.",
724+
TableName.META_TABLE_NAME, e);
723725
throw e;
724726
}
725727
}

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,10 @@ public static void visitMetaEntry(final RegionStateVisitor visitor, final Result
169169
final long openSeqNum = hrl.getSeqNum();
170170

171171
LOG.debug(
172-
"Load hbase:meta entry region={}, regionState={}, lastHost={}, "
172+
"Load {} entry region={}, regionState={}, lastHost={}, "
173173
+ "regionLocation={}, openSeqNum={}",
174-
regionInfo.getEncodedName(), state, lastHost, regionLocation, openSeqNum);
174+
TableName.META_TABLE_NAME, regionInfo.getEncodedName(), state, lastHost, regionLocation,
175+
openSeqNum);
175176
visitor.visitRegionState(result, regionInfo, state, regionLocation, lastHost, openSeqNum);
176177
}
177178
}
@@ -190,8 +191,8 @@ private Put generateUpdateRegionLocationPut(RegionStateNode regionStateNode) thr
190191
final Put put = new Put(CatalogFamilyFormat.getMetaKeyForRegion(regionInfo), time);
191192
MetaTableAccessor.addRegionInfo(put, regionInfo);
192193
final StringBuilder info =
193-
new StringBuilder("pid=").append(pid).append(" updating hbase:meta row=")
194-
.append(regionInfo.getEncodedName()).append(", regionState=").append(state);
194+
new StringBuilder("pid=").append(pid).append(" updating ").append(TableName.META_TABLE_NAME)
195+
.append(" row=").append(regionInfo.getEncodedName()).append(", regionState=").append(state);
195196
if (openSeqNum >= 0) {
196197
Preconditions.checkArgument(state == State.OPEN && regionLocation != null,
197198
"Open region should be on a server");
@@ -694,7 +695,7 @@ public static State getRegionState(final Result r, RegionInfo regionInfo) {
694695
return State.valueOf(state);
695696
} catch (IllegalArgumentException e) {
696697
LOG.warn(
697-
"BAD value {} in hbase:meta info:state column for region {} , "
698+
"BAD value {} in " + TableName.META_TABLE_NAME + " info:state column for region {} , "
698699
+ "Consider using HBCK2 setRegionState ENCODED_REGION_NAME STATE",
699700
state, regionInfo.getEncodedName());
700701
return null;

0 commit comments

Comments
 (0)