ndimiduk commented on code in PR #4664:
URL: https://github.com/apache/hbase/pull/4664#discussion_r1106106879
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java:
##########
@@ -621,10 +622,24 @@ public static void updateTableState(Connection conn,
TableName tableName, TableS
////////////////////////
// Editing operations //
////////////////////////
+
+ /**
+ * Generates and returns a {@link Put} containing the {@link RegionInfo} for
the catalog table.
+ * @throws IllegalArgumentException when the provided RegionInfo is not the
default replica.
+ */
+ public static Put makePutFromRegionInfo(RegionInfo regionInfo) throws
IOException {
+ return makePutFromRegionInfo(regionInfo,
EnvironmentEdgeManager.currentTime());
+ }
+
/**
- * Generates and returns a Put containing the region into for the catalog
table
+ * Generates and returns a {@link Put} containing the {@link RegionInfo} for
the catalog table.
+ * @throws IllegalArgumentException when the provided RegionInfo is not the
default replica.
*/
public static Put makePutFromRegionInfo(RegionInfo regionInfo, long ts)
throws IOException {
+ if (regionInfo.getReplicaId() != RegionInfo.DEFAULT_REPLICA_ID) {
+ throw new IllegalArgumentException(
+ "Unable to generate row key from a replica region RegionInfo. " +
regionInfo);
+ }
return addRegionInfo(new Put(regionInfo.getRegionName(), ts), regionInfo);
Review Comment:
Should use `CatalogFamilyFormat#getMetaKeyForRegion` instead.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]