205205@ SuppressWarnings ("deprecation" )
206206public class HMaster extends HRegionServer implements MasterServices , Server {
207207 private static final Log LOG = LogFactory .getLog (HMaster .class .getName ());
208-
208+ public static final String HBASE_TABLE_NORMALIZATION_ENABLED =
209+ "hbase.table.normalization.enabled" ;
209210 /**
210211 * Protection against zombie master. Started once Master accepts active responsibility and
211212 * starts taking over responsibilities. Allows a finite time window before giving up ownership.
@@ -381,6 +382,7 @@ public void run() {
381382
382383 private long splitPlanCount ;
383384 private long mergePlanCount ;
385+ private boolean defaultNormalizerTableLevel ;
384386
385387 /** flag used in test cases in order to simulate RS failures during master initialization */
386388 private volatile boolean initializationBeforeMetaAssignment = false ;
@@ -529,6 +531,7 @@ public HMaster(final Configuration conf, CoordinatedStateManager csm)
529531 activeMasterManager = null ;
530532 }
531533 cachedClusterId = new CachedClusterId (conf );
534+ this .defaultNormalizerTableLevel = extractDefaultNormalizerValue (conf );
532535 }
533536
534537 // return the actual infoPort, -1 means disable info server.
@@ -1117,6 +1120,11 @@ void assignMeta(MonitoredTask status, Set<ServerName> previouslyFailedMetaRSs, i
11171120 status .setStatus ("META assigned." );
11181121 }
11191122
1123+ private boolean extractDefaultNormalizerValue (final Configuration configuration ) {
1124+ String s = configuration .get (HBASE_TABLE_NORMALIZATION_ENABLED );
1125+ return Boolean .parseBoolean (s );
1126+ }
1127+
11201128 private void assignMetaZkLess (RegionStates regionStates , RegionState regionState , long timeout ,
11211129 Set <ServerName > previouslyFailedRs ) throws IOException , KeeperException {
11221130 ServerName currentServer = regionState .getServerName ();
@@ -1692,12 +1700,20 @@ public boolean normalizeRegions() throws IOException, CoordinatedStateException
16921700 if (table .isSystemTable ()) {
16931701 continue ;
16941702 }
1695-
1703+ boolean normalizationEnabled ;
16961704 HTableDescriptor tableDescriptor = getTableDescriptors ().get (table );
1697- if (tableDescriptor != null && !tableDescriptor .isNormalizationEnabled ()) {
1698- LOG .debug ("Skipping normalization for table: " + table
1699- + ", as it doesn't have auto normalization turned on" );
1700- continue ;
1705+ if (tableDescriptor != null ) {
1706+ String defined = tableDescriptor .getValue (HTableDescriptor .NORMALIZATION_ENABLED );
1707+ if (defined != null ) {
1708+ normalizationEnabled = tableDescriptor .isNormalizationEnabled ();
1709+ } else {
1710+ normalizationEnabled = this .defaultNormalizerTableLevel ;
1711+ }
1712+ if (!normalizationEnabled ) {
1713+ LOG .debug ("Skipping table " + table + " because normalization is disabled in its table " +
1714+ "properties and normalization is also disabled at table level by default" );
1715+ continue ;
1716+ }
17011717 }
17021718 // make one last check that the cluster isn't shutting down before proceeding.
17031719 if (skipRegionManagementAction ("region normalizer" )) {
@@ -1720,7 +1736,7 @@ public boolean normalizeRegions() throws IOException, CoordinatedStateException
17201736 }
17211737 }
17221738 } finally {
1723- normalizationInProgressLock .unlock ();
1739+ normalizationInProgressLock .unlock ();
17241740 }
17251741 // If Region did not generate any plans, it means the cluster is already balanced.
17261742 // Return true indicating a success.
0 commit comments