@@ -107,6 +107,23 @@ public List<NormalizationPlan> computePlanForTable(TableName table) throws HBase
107
107
LOG .debug ("Normalization of system table " + table + " isn't allowed" );
108
108
return null ;
109
109
}
110
+ boolean splitEnabled = true , mergeEnabled = true ;
111
+ try {
112
+ splitEnabled = masterRpcServices .isSplitOrMergeEnabled (null ,
113
+ RequestConverter .buildIsSplitOrMergeEnabledRequest (MasterSwitchType .SPLIT )).getEnabled ();
114
+ } catch (ServiceException se ) {
115
+ LOG .debug ("Unable to determine whether split is enabled" , se );
116
+ }
117
+ try {
118
+ mergeEnabled = masterRpcServices .isSplitOrMergeEnabled (null ,
119
+ RequestConverter .buildIsSplitOrMergeEnabledRequest (MasterSwitchType .MERGE )).getEnabled ();
120
+ } catch (ServiceException se ) {
121
+ LOG .debug ("Unable to determine whether split is enabled" , se );
122
+ }
123
+ if (!splitEnabled && !mergeEnabled ) {
124
+ LOG .debug ("Both split and merge are disabled for table: " + table );
125
+ return null ;
126
+ }
110
127
111
128
List <NormalizationPlan > plans = new ArrayList <NormalizationPlan >();
112
129
List <HRegionInfo > tableRegions = masterServices .getAssignmentManager ().getRegionStates ().
@@ -141,19 +158,6 @@ public List<NormalizationPlan> computePlanForTable(TableName table) throws HBase
141
158
LOG .debug ("Table " + table + ", average region size: " + avgRegionSize );
142
159
143
160
int candidateIdx = 0 ;
144
- boolean splitEnabled = true , mergeEnabled = true ;
145
- try {
146
- splitEnabled = masterRpcServices .isSplitOrMergeEnabled (null ,
147
- RequestConverter .buildIsSplitOrMergeEnabledRequest (MasterSwitchType .SPLIT )).getEnabled ();
148
- } catch (ServiceException se ) {
149
- LOG .debug ("Unable to determine whether split is enabled" , se );
150
- }
151
- try {
152
- mergeEnabled = masterRpcServices .isSplitOrMergeEnabled (null ,
153
- RequestConverter .buildIsSplitOrMergeEnabledRequest (MasterSwitchType .MERGE )).getEnabled ();
154
- } catch (ServiceException se ) {
155
- LOG .debug ("Unable to determine whether split is enabled" , se );
156
- }
157
161
while (candidateIdx < tableRegions .size ()) {
158
162
HRegionInfo hri = tableRegions .get (candidateIdx );
159
163
long regionSize = getRegionSize (hri );
0 commit comments