saintstack commented on a change in pull request #2513:
URL: https://github.com/apache/hbase/pull/2513#discussion_r501856397
##########
File path: hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java
##########
@@ -1131,7 +1131,20 @@
/** Conf key for enabling meta replication */
public static final String USE_META_REPLICAS = "hbase.meta.replicas.use";
public static final boolean DEFAULT_USE_META_REPLICAS = false;
+
+ /**
+ * @deprecated Since 2.4.0, will be removed in 4.0.0. Please change the meta
replicas number by
+ * altering meta table, i.e, set a new 'region replication'
number and call
+ * modifyTable.
+ */
+ @Deprecated
public static final String META_REPLICAS_NUM = "hbase.meta.replica.count";
+ /**
+ * @deprecated Since 2.4.0, will be removed in 4.0.0. Please change the meta
replicas number by
+ * altering meta table, i.e, set a new 'region replication'
number and call
+ * modifyTable.
+ */
+ @Deprecated
Review comment:
Doc needs an edit. It has section on meta replicas how-to.
##########
File path: hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java
##########
@@ -1131,7 +1131,20 @@
/** Conf key for enabling meta replication */
public static final String USE_META_REPLICAS = "hbase.meta.replicas.use";
public static final boolean DEFAULT_USE_META_REPLICAS = false;
+
+ /**
+ * @deprecated Since 2.4.0, will be removed in 4.0.0. Please change the meta
replicas number by
+ * altering meta table, i.e, set a new 'region replication'
number and call
+ * modifyTable.
+ */
+ @Deprecated
public static final String META_REPLICAS_NUM = "hbase.meta.replica.count";
+ /**
+ * @deprecated Since 2.4.0, will be removed in 4.0.0. Please change the meta
replicas number by
+ * altering meta table, i.e, set a new 'region replication'
number and call
+ * modifyTable.
+ */
+ @Deprecated
Review comment:
Grep hbase.meta.replica.count in the doc.
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
##########
@@ -1093,6 +1091,39 @@ private void
finishActiveMasterInitialization(MonitoredTask status) throws IOExc
this.assignmentManager.joinCluster();
// The below depends on hbase:meta being online.
this.tableStateManager.start();
+
+ // for migrating from a version without HBASE-25099, and also for honoring
the configuration
+ // first.
+ if (conf.get(HConstants.META_REPLICAS_NUM) != null) {
+ int replicasNumInConf =
+ conf.getInt(HConstants.META_REPLICAS_NUM,
HConstants.DEFAULT_META_REPLICA_NUM);
+ TableDescriptor metaDesc =
tableDescriptors.get(TableName.META_TABLE_NAME);
+ if (metaDesc.getRegionReplication() != replicasNumInConf) {
+ // it is possible that we already have some replicas before upgrading,
so we must set the
+ // region replication number in meta TableDescriptor directly first,
without creating a
+ // ModifyTableProcedure, otherwise it may cause a double assign for
the meta replicas.
+ int existingReplicasCount =
+
assignmentManager.getRegionStates().getRegionsOfTable(TableName.META_TABLE_NAME).size();
+ if (existingReplicasCount > metaDesc.getRegionReplication()) {
+ LOG.info("Update replica count of hbase:meta from {}(in
TableDescriptor)" +
+ " to {}(existing ZNodes)", metaDesc.getRegionReplication(),
existingReplicasCount);
+ metaDesc = TableDescriptorBuilder.newBuilder(metaDesc)
+ .setRegionReplication(existingReplicasCount).build();
+ tableDescriptors.update(metaDesc);
+ }
+ // check again, and issue a ModifyTableProcedure if needed
+ if (metaDesc.getRegionReplication() != replicasNumInConf) {
+ LOG.info(
+ "The {} config is {} while the replica count in TableDescriptor is
{}" +
+ " for hbase:meta, altering...",
+ HConstants.META_REPLICAS_NUM, replicasNumInConf,
metaDesc.getRegionReplication());
+ procedureExecutor.submitProcedure(new ModifyTableProcedure(
+ procedureExecutor.getEnvironment(),
TableDescriptorBuilder.newBuilder(metaDesc)
+ .setRegionReplication(replicasNumInConf).build(),
+ null, metaDesc, false));
+ }
+ }
+ }
Review comment:
Good
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
##########
@@ -1157,13 +1188,6 @@ private void
finishActiveMasterInitialization(MonitoredTask status) throws IOExc
}
assignmentManager.checkIfShouldMoveSystemRegionAsync();
- status.setStatus("Assign meta replicas");
- MasterMetaBootstrap metaBootstrap = createMetaBootstrap();
- try {
- metaBootstrap.assignMetaReplicas();
- } catch (IOException | KeeperException e){
- LOG.error("Assigning meta replica failed: ", e);
- }
Review comment:
We don't need this anymore?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]