205
205
@ SuppressWarnings ("deprecation" )
206
206
public class HMaster extends HRegionServer implements MasterServices , Server {
207
207
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" ;
209
210
/**
210
211
* Protection against zombie master. Started once Master accepts active responsibility and
211
212
* starts taking over responsibilities. Allows a finite time window before giving up ownership.
@@ -381,6 +382,7 @@ public void run() {
381
382
382
383
private long splitPlanCount ;
383
384
private long mergePlanCount ;
385
+ private boolean defaultNormalizerTableLevel ;
384
386
385
387
/** flag used in test cases in order to simulate RS failures during master initialization */
386
388
private volatile boolean initializationBeforeMetaAssignment = false ;
@@ -529,6 +531,7 @@ public HMaster(final Configuration conf, CoordinatedStateManager csm)
529
531
activeMasterManager = null ;
530
532
}
531
533
cachedClusterId = new CachedClusterId (conf );
534
+ this .defaultNormalizerTableLevel = extractDefaultNormalizerValue (conf );
532
535
}
533
536
534
537
// return the actual infoPort, -1 means disable info server.
@@ -1117,6 +1120,11 @@ void assignMeta(MonitoredTask status, Set<ServerName> previouslyFailedMetaRSs, i
1117
1120
status .setStatus ("META assigned." );
1118
1121
}
1119
1122
1123
+ private boolean extractDefaultNormalizerValue (final Configuration configuration ) {
1124
+ String s = configuration .get (HBASE_TABLE_NORMALIZATION_ENABLED );
1125
+ return Boolean .parseBoolean (s );
1126
+ }
1127
+
1120
1128
private void assignMetaZkLess (RegionStates regionStates , RegionState regionState , long timeout ,
1121
1129
Set <ServerName > previouslyFailedRs ) throws IOException , KeeperException {
1122
1130
ServerName currentServer = regionState .getServerName ();
@@ -1692,12 +1700,20 @@ public boolean normalizeRegions() throws IOException, CoordinatedStateException
1692
1700
if (table .isSystemTable ()) {
1693
1701
continue ;
1694
1702
}
1695
-
1703
+ boolean normalizationEnabled ;
1696
1704
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
+ }
1701
1717
}
1702
1718
// make one last check that the cluster isn't shutting down before proceeding.
1703
1719
if (skipRegionManagementAction ("region normalizer" )) {
@@ -1720,7 +1736,7 @@ public boolean normalizeRegions() throws IOException, CoordinatedStateException
1720
1736
}
1721
1737
}
1722
1738
} finally {
1723
- normalizationInProgressLock .unlock ();
1739
+ normalizationInProgressLock .unlock ();
1724
1740
}
1725
1741
// If Region did not generate any plans, it means the cluster is already balanced.
1726
1742
// Return true indicating a success.
0 commit comments