Skip to content

Commit b40bd4b

Browse files
committed
HBASE-29965: Unable to dynamically change readonly flag
Change-Id: I5b5479e37921ea233f586f0f02d2606320e16139
1 parent 5d47ec9 commit b40bd4b

6 files changed

Lines changed: 159 additions & 75 deletions

File tree

hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
package org.apache.hadoop.hbase.master;
1919

2020
import static org.apache.hadoop.hbase.HConstants.DEFAULT_HBASE_SPLIT_COORDINATED_BY_ZK;
21+
import static org.apache.hadoop.hbase.HConstants.HBASE_GLOBAL_READONLY_ENABLED_DEFAULT;
22+
import static org.apache.hadoop.hbase.HConstants.HBASE_GLOBAL_READONLY_ENABLED_KEY;
2123
import static org.apache.hadoop.hbase.HConstants.HBASE_MASTER_LOGCLEANER_PLUGINS;
2224
import static org.apache.hadoop.hbase.HConstants.HBASE_SPLIT_WAL_COORDINATED_BY_ZK;
2325
import static org.apache.hadoop.hbase.master.cleaner.HFileCleaner.CUSTOM_POOL_SIZE;
@@ -498,6 +500,8 @@ public class HMaster extends HBaseServerBase<MasterRpcServices> implements Maste
498500
public static final String WARMUP_BEFORE_MOVE = "hbase.master.warmup.before.move";
499501
private static final boolean DEFAULT_WARMUP_BEFORE_MOVE = true;
500502

503+
private volatile boolean isGlobalReadOnlyEnabled;
504+
501505
/**
502506
* Use RSProcedureDispatcher instance to initiate master -> rs remote procedure execution. Use
503507
* this config to extend RSProcedureDispatcher (mainly for testing purpose).
@@ -583,6 +587,8 @@ public HMaster(final Configuration conf) throws IOException {
583587
getChoreService().scheduleChore(clusterStatusPublisherChore);
584588
}
585589
}
590+
this.isGlobalReadOnlyEnabled =
591+
conf.getBoolean(HBASE_GLOBAL_READONLY_ENABLED_KEY, HBASE_GLOBAL_READONLY_ENABLED_DEFAULT);
586592
this.activeMasterManager = createActiveMasterManager(zooKeeper, serverName, this);
587593
cachedClusterId = new CachedClusterId(this, conf);
588594
this.regionServerTracker = new RegionServerTracker(zooKeeper, this);
@@ -1090,8 +1096,7 @@ private void finishActiveMasterInitialization() throws IOException, InterruptedE
10901096
if (!maintenanceMode) {
10911097
startupTaskGroup.addTask("Initializing master coprocessors");
10921098
setQuotasObserver(conf);
1093-
CoprocessorConfigurationUtil.syncReadOnlyConfigurations(
1094-
ConfigurationUtil.isReadOnlyModeEnabled(conf), conf,
1099+
CoprocessorConfigurationUtil.syncReadOnlyConfigurations(conf,
10951100
CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY);
10961101
AbstractReadOnlyController.manageActiveClusterIdFile(
10971102
ConfigurationUtil.isReadOnlyModeEnabled(conf), this.getMasterFileSystem());
@@ -4501,21 +4506,38 @@ public void onConfigurationChange(Configuration newConf) {
45014506
// append the quotas observer back to the master coprocessor key
45024507
setQuotasObserver(newConf);
45034508

4504-
boolean readOnlyMode = ConfigurationUtil.isReadOnlyModeEnabled(newConf);
4505-
CoprocessorConfigurationUtil.syncReadOnlyConfigurations(readOnlyMode, newConf,
4506-
CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY);
4509+
boolean maybeUpdatedReadOnlyMode = ConfigurationUtil.isReadOnlyModeEnabled(newConf);
4510+
boolean hasReadOnlyModeChanged = this.isGlobalReadOnlyEnabled != maybeUpdatedReadOnlyMode;
4511+
boolean hasCoprocessorConfigChanged = CoprocessorConfigurationUtil
4512+
.checkConfigurationChange(this.cpHost, newConf, CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY);
4513+
boolean shouldUpdateCoprocessors =
4514+
(hasCoprocessorConfigChanged || hasReadOnlyModeChanged) && !maintenanceMode;
45074515

45084516
// update region server coprocessor if the configuration has changed.
4509-
if (
4510-
CoprocessorConfigurationUtil.checkConfigurationChange(this.cpHost, newConf,
4511-
CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY) && !maintenanceMode
4512-
) {
4517+
if (shouldUpdateCoprocessors) {
4518+
Set<String> currentlyLoadedCps;
4519+
if (this.cpHost != null) {
4520+
currentlyLoadedCps = this.cpHost.getCoprocessorClassNames();
4521+
LOG.debug("About to update coprocessors loaded on HMaster {}. These are the current "
4522+
+ "coprocessors before updating: {}", this, currentlyLoadedCps);
4523+
}
4524+
45134525
LOG.info("Update the master coprocessor(s) because the configuration has changed");
4514-
initializeCoprocessorHost(newConf);
4515-
CoprocessorConfigurationUtil.syncReadOnlyConfigurations(readOnlyMode, this.conf,
4526+
CoprocessorConfigurationUtil.syncReadOnlyConfigurations(newConf,
45164527
CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY);
4517-
AbstractReadOnlyController.manageActiveClusterIdFile(
4518-
ConfigurationUtil.isReadOnlyModeEnabled(newConf), this.getMasterFileSystem());
4528+
initializeCoprocessorHost(newConf);
4529+
4530+
currentlyLoadedCps = this.cpHost.getCoprocessorClassNames();
4531+
LOG.debug("Finished updating coprocessors on HMaster {}. These are the coprocessors "
4532+
+ "after updating: {}", this, currentlyLoadedCps);
4533+
}
4534+
4535+
if (hasReadOnlyModeChanged) {
4536+
this.isGlobalReadOnlyEnabled = maybeUpdatedReadOnlyMode;
4537+
LOG.info("Config {} has been dynamically changed to {} for HMaster {}",
4538+
HConstants.HBASE_GLOBAL_READONLY_ENABLED_KEY, this.isGlobalReadOnlyEnabled, this);
4539+
AbstractReadOnlyController.manageActiveClusterIdFile(this.isGlobalReadOnlyEnabled,
4540+
this.getMasterFileSystem());
45194541
}
45204542
}
45214543

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
*/
1818
package org.apache.hadoop.hbase.regionserver;
1919

20+
import static org.apache.hadoop.hbase.HConstants.HBASE_GLOBAL_READONLY_ENABLED_DEFAULT;
21+
import static org.apache.hadoop.hbase.HConstants.HBASE_GLOBAL_READONLY_ENABLED_KEY;
2022
import static org.apache.hadoop.hbase.HConstants.REPLICATION_SCOPE_LOCAL;
2123
import static org.apache.hadoop.hbase.regionserver.HStoreFile.MAJOR_COMPACTION_KEY;
2224
import static org.apache.hadoop.hbase.trace.HBaseSemanticAttributes.REGION_NAMES_KEY;
@@ -391,6 +393,8 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
391393
private Path regionWalDir;
392394
private FileSystem walFS;
393395

396+
private volatile boolean isGlobalReadOnlyEnabled;
397+
394398
// set to true if the region is restored from snapshot for reading by ClientSideRegionScanner
395399
private boolean isRestoredRegion = false;
396400

@@ -941,8 +945,9 @@ public HRegion(final HRegionFileSystem fs, final WAL wal, final Configuration co
941945

942946
decorateRegionConfiguration(conf);
943947

944-
CoprocessorConfigurationUtil.syncReadOnlyConfigurations(
945-
ConfigurationUtil.isReadOnlyModeEnabled(conf), this.conf,
948+
this.isGlobalReadOnlyEnabled =
949+
conf.getBoolean(HBASE_GLOBAL_READONLY_ENABLED_KEY, HBASE_GLOBAL_READONLY_ENABLED_DEFAULT);
950+
CoprocessorConfigurationUtil.syncReadOnlyConfigurations(this.conf,
946951
CoprocessorHost.REGION_COPROCESSOR_CONF_KEY);
947952

948953
if (rsServices != null) {
@@ -8515,7 +8520,7 @@ public boolean registerService(Service instance) {
85158520
ServiceDescriptor serviceDesc = instance.getDescriptorForType();
85168521
String serviceName = CoprocessorRpcUtils.getServiceName(serviceDesc);
85178522
if (coprocessorServiceHandlers.containsKey(serviceName)) {
8518-
LOG.error("Coprocessor service {} already registered, rejecting request from {} in region {}",
8523+
LOG.warn("Coprocessor service {} already registered, rejecting request from {} in region {}",
85198524
serviceName, instance, this);
85208525
return false;
85218526
}
@@ -8986,24 +8991,40 @@ IOException throwOnInterrupt(Throwable t) {
89868991
* {@inheritDoc}
89878992
*/
89888993
@Override
8989-
public void onConfigurationChange(Configuration conf) {
8990-
this.storeHotnessProtector.update(conf);
8994+
public void onConfigurationChange(Configuration newConf) {
8995+
this.storeHotnessProtector.update(newConf);
89918996

8992-
boolean readOnlyMode = ConfigurationUtil.isReadOnlyModeEnabled(conf);
8993-
CoprocessorConfigurationUtil.syncReadOnlyConfigurations(readOnlyMode, conf,
8994-
CoprocessorHost.REGION_COPROCESSOR_CONF_KEY);
8997+
boolean maybeUpdatedReadOnlyMode = ConfigurationUtil.isReadOnlyModeEnabled(newConf);
8998+
boolean hasReadOnlyModeChanged = this.isGlobalReadOnlyEnabled != maybeUpdatedReadOnlyMode;
8999+
boolean hasCoprocessorConfigChanged = CoprocessorConfigurationUtil.checkConfigurationChange(
9000+
this.coprocessorHost, newConf, CoprocessorHost.REGION_COPROCESSOR_CONF_KEY,
9001+
CoprocessorHost.USER_REGION_COPROCESSOR_CONF_KEY);
9002+
boolean shouldUpdateCoprocessors = hasCoprocessorConfigChanged || hasReadOnlyModeChanged;
89959003

89969004
// update coprocessorHost if the configuration has changed.
8997-
if (
8998-
CoprocessorConfigurationUtil.checkConfigurationChange(this.coprocessorHost, conf,
8999-
CoprocessorHost.REGION_COPROCESSOR_CONF_KEY,
9000-
CoprocessorHost.USER_REGION_COPROCESSOR_CONF_KEY)
9001-
) {
9005+
if (shouldUpdateCoprocessors) {
9006+
Set<String> currentlyLoadedCps;
9007+
if (this.coprocessorHost != null) {
9008+
currentlyLoadedCps = this.coprocessorHost.getCoprocessorClassNames();
9009+
LOG.trace("About to update coprocessors loaded on HRegion {}. These are the current "
9010+
+ "coprocessors before updating: {}", this, currentlyLoadedCps);
9011+
}
9012+
90029013
LOG.info("Update the system coprocessors because the configuration has changed");
9003-
decorateRegionConfiguration(conf);
9004-
this.coprocessorHost = new RegionCoprocessorHost(this, rsServices, conf);
9005-
CoprocessorConfigurationUtil.syncReadOnlyConfigurations(readOnlyMode, this.conf,
9014+
CoprocessorConfigurationUtil.syncReadOnlyConfigurations(newConf,
90069015
CoprocessorHost.REGION_COPROCESSOR_CONF_KEY);
9016+
decorateRegionConfiguration(newConf);
9017+
this.coprocessorHost = new RegionCoprocessorHost(this, rsServices, newConf);
9018+
9019+
currentlyLoadedCps = this.coprocessorHost.getCoprocessorClassNames();
9020+
LOG.trace("Finished updating coprocessors on HRegion {}. These are the coprocessors "
9021+
+ "after updating: {}", this, currentlyLoadedCps);
9022+
}
9023+
9024+
if (hasReadOnlyModeChanged) {
9025+
this.isGlobalReadOnlyEnabled = maybeUpdatedReadOnlyMode;
9026+
LOG.info("Config {} has been dynamically changed to {} for region {}",
9027+
HConstants.HBASE_GLOBAL_READONLY_ENABLED_KEY, this.isGlobalReadOnlyEnabled, this);
90079028
}
90089029
}
90099030

@@ -9160,4 +9181,10 @@ public void addWriteRequestsCount(long writeRequestsCount) {
91609181
boolean isReadsEnabled() {
91619182
return this.writestate.readsEnabled;
91629183
}
9184+
9185+
@RestrictedApi(explanation = "Should only be called in tests", link = "",
9186+
allowedOnPath = ".*/src/test/.*")
9187+
public ConfigurationManager getConfigurationManager() {
9188+
return configurationManager;
9189+
}
91639190
}

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
import static org.apache.hadoop.hbase.HConstants.DEFAULT_HBASE_SPLIT_COORDINATED_BY_ZK;
2121
import static org.apache.hadoop.hbase.HConstants.DEFAULT_HBASE_SPLIT_WAL_MAX_SPLITTER;
2222
import static org.apache.hadoop.hbase.HConstants.DEFAULT_SLOW_LOG_SYS_TABLE_CHORE_DURATION;
23+
import static org.apache.hadoop.hbase.HConstants.HBASE_GLOBAL_READONLY_ENABLED_DEFAULT;
24+
import static org.apache.hadoop.hbase.HConstants.HBASE_GLOBAL_READONLY_ENABLED_KEY;
2325
import static org.apache.hadoop.hbase.HConstants.HBASE_SPLIT_WAL_COORDINATED_BY_ZK;
2426
import static org.apache.hadoop.hbase.HConstants.HBASE_SPLIT_WAL_MAX_SPLITTER;
2527
import static org.apache.hadoop.hbase.master.waleventtracker.WALEventTrackerTableCreator.WAL_EVENT_TRACKER_ENABLED_DEFAULT;
@@ -318,6 +320,7 @@ public class HRegionServer extends HBaseServerBase<RSRpcServices>
318320
private LeaseManager leaseManager;
319321

320322
private volatile boolean dataFsOk;
323+
private volatile boolean isGlobalReadOnlyEnabled;
321324

322325
static final String ABORT_TIMEOUT = "hbase.regionserver.abort.timeout";
323326
// Default abort timeout is 1200 seconds for safe
@@ -546,6 +549,9 @@ public HRegionServer(final Configuration conf) throws IOException {
546549
uncaughtExceptionHandler =
547550
(t, e) -> abort("Uncaught exception in executorService thread " + t.getName(), e);
548551

552+
this.isGlobalReadOnlyEnabled =
553+
conf.getBoolean(HBASE_GLOBAL_READONLY_ENABLED_KEY, HBASE_GLOBAL_READONLY_ENABLED_DEFAULT);
554+
549555
// If no master in cluster, skip trying to track one or look for a cluster status.
550556
if (!this.masterless) {
551557
masterAddressTracker = new MasterAddressTracker(getZooKeeper(), this);
@@ -827,9 +833,9 @@ public void run() {
827833
if (!isStopped() && !isAborted()) {
828834
installShutdownHook();
829835

830-
CoprocessorConfigurationUtil.syncReadOnlyConfigurations(
831-
ConfigurationUtil.isReadOnlyModeEnabled(conf), conf,
836+
CoprocessorConfigurationUtil.syncReadOnlyConfigurations(conf,
832837
CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY);
838+
833839
// Initialize the RegionServerCoprocessorHost now that our ephemeral
834840
// node was created, in case any coprocessors want to use ZooKeeper
835841
this.rsHost = new RegionServerCoprocessorHost(this, this.conf);
@@ -3488,19 +3494,35 @@ public void onConfigurationChange(Configuration newConf) {
34883494
LOG.warn("Failed to initialize SuperUsers on reloading of the configuration");
34893495
}
34903496

3491-
boolean readOnlyMode = ConfigurationUtil.isReadOnlyModeEnabled(newConf);
3492-
CoprocessorConfigurationUtil.syncReadOnlyConfigurations(readOnlyMode, newConf,
3493-
CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY);
3497+
boolean maybeUpdatedReadOnlyMode = ConfigurationUtil.isReadOnlyModeEnabled(newConf);
3498+
boolean hasReadOnlyModeChanged = this.isGlobalReadOnlyEnabled != maybeUpdatedReadOnlyMode;
3499+
boolean hasCoprocessorConfigChanged = CoprocessorConfigurationUtil.checkConfigurationChange(
3500+
this.rsHost, newConf, CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY);
3501+
boolean shouldUpdateCoprocessors = hasCoprocessorConfigChanged || hasReadOnlyModeChanged;
34943502

34953503
// update region server coprocessor if the configuration has changed.
3496-
if (
3497-
CoprocessorConfigurationUtil.checkConfigurationChange(this.rsHost, newConf,
3498-
CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY)
3499-
) {
3504+
if (shouldUpdateCoprocessors) {
3505+
Set<String> currentlyLoadedCps;
3506+
if (this.rsHost != null) {
3507+
currentlyLoadedCps = this.rsHost.getCoprocessorClassNames();
3508+
LOG.debug("About to update coprocessors loaded on HRegionServer {}. These are the current "
3509+
+ "coprocessors before updating: {}", this, currentlyLoadedCps);
3510+
}
3511+
35003512
LOG.info("Update region server coprocessors because the configuration has changed");
3501-
this.rsHost = new RegionServerCoprocessorHost(this, newConf);
3502-
CoprocessorConfigurationUtil.syncReadOnlyConfigurations(readOnlyMode, this.conf,
3513+
CoprocessorConfigurationUtil.syncReadOnlyConfigurations(newConf,
35033514
CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY);
3515+
this.rsHost = new RegionServerCoprocessorHost(this, newConf);
3516+
3517+
currentlyLoadedCps = this.rsHost.getCoprocessorClassNames();
3518+
LOG.debug("Finished updating coprocessors on HRegionServer {}. These are the coprocessors "
3519+
+ "after updating: {}", this, currentlyLoadedCps);
3520+
}
3521+
3522+
if (hasReadOnlyModeChanged) {
3523+
this.isGlobalReadOnlyEnabled = maybeUpdatedReadOnlyMode;
3524+
LOG.info("Config {} has been dynamically changed to {} for region server {}",
3525+
HConstants.HBASE_GLOBAL_READONLY_ENABLED_KEY, this.isGlobalReadOnlyEnabled, this);
35043526
}
35053527
}
35063528

hbase-server/src/main/java/org/apache/hadoop/hbase/util/CoprocessorConfigurationUtil.java

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -175,16 +175,22 @@ private static List<String> getReadOnlyCoprocessors(String configurationKey) {
175175
};
176176
}
177177

178-
public static void syncReadOnlyConfigurations(boolean readOnlyMode, Configuration conf,
179-
String configurationKey) {
180-
conf.setBoolean(HConstants.HBASE_GLOBAL_READONLY_ENABLED_KEY, readOnlyMode);
178+
/**
179+
* This method adds or removes relevant ReadOnlyController coprocessors to the provided
180+
* configuration based on whether read-only mode is enabled.
181+
* @param conf The up-to-date configuration used to determine how to handle
182+
* coprocessors
183+
* @param coprocessorConfKey The configuration key name
184+
*/
185+
public static void syncReadOnlyConfigurations(Configuration conf, String coprocessorConfKey) {
186+
boolean isReadOnlyModeEnabled = conf.getBoolean(HConstants.HBASE_GLOBAL_READONLY_ENABLED_KEY,
187+
HConstants.HBASE_GLOBAL_READONLY_ENABLED_DEFAULT);
181188

182-
List<String> cpList = getReadOnlyCoprocessors(configurationKey);
183-
// If readonly is true then add the coprocessor of master
184-
if (readOnlyMode) {
185-
CoprocessorConfigurationUtil.addCoprocessors(conf, configurationKey, cpList);
189+
List<String> cpList = getReadOnlyCoprocessors(coprocessorConfKey);
190+
if (isReadOnlyModeEnabled) {
191+
CoprocessorConfigurationUtil.addCoprocessors(conf, coprocessorConfKey, cpList);
186192
} else {
187-
CoprocessorConfigurationUtil.removeCoprocessors(conf, configurationKey, cpList);
193+
CoprocessorConfigurationUtil.removeCoprocessors(conf, coprocessorConfKey, cpList);
188194
}
189195
}
190196
}

hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestReadOnlyControllerCoprocessorLoading.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ private void createTable() throws Exception {
107107
region = regions.get(0);
108108
}
109109

110-
private void setReadOnlyMode(boolean isReadOnlyEnabled) {
111-
// Create a new configuration to micic client server behavior
110+
private Configuration setReadOnlyMode(boolean isReadOnlyEnabled) {
111+
// Create a new configuration to mimic client server behavior
112112
// otherwise the existing conf object is shared with the cluster
113113
// and can cause side effects on other tests if not reset properly.
114114
// This way we can ensure that only the coprocessor loading is tested
@@ -119,9 +119,10 @@ private void setReadOnlyMode(boolean isReadOnlyEnabled) {
119119
newConf.setBoolean(HConstants.HBASE_GLOBAL_READONLY_ENABLED_KEY, isReadOnlyEnabled);
120120
master.getConfigurationManager().notifyAllObservers(newConf);
121121
regionServer.getConfigurationManager().notifyAllObservers(newConf);
122+
return newConf;
122123
}
123124

124-
private void verifyMasterReadOnlyControllerLoading(boolean isReadOnlyEnabled) throws Exception {
125+
private void verifyMasterReadOnlyControllerLoading(boolean isReadOnlyEnabled) {
125126
MasterCoprocessorHost masterCPHost = master.getMasterCoprocessorHost();
126127
if (isReadOnlyEnabled) {
127128
assertNotNull(
@@ -136,8 +137,7 @@ private void verifyMasterReadOnlyControllerLoading(boolean isReadOnlyEnabled) th
136137
}
137138
}
138139

139-
private void verifyRegionServerReadOnlyControllerLoading(boolean isReadOnlyEnabled)
140-
throws Exception {
140+
private void verifyRegionServerReadOnlyControllerLoading(boolean isReadOnlyEnabled) {
141141
RegionServerCoprocessorHost rsCPHost = regionServer.getRegionServerCoprocessorHost();
142142
if (isReadOnlyEnabled) {
143143
assertNotNull(
@@ -152,7 +152,7 @@ private void verifyRegionServerReadOnlyControllerLoading(boolean isReadOnlyEnabl
152152
}
153153
}
154154

155-
private void verifyRegionReadOnlyControllerLoading(boolean isReadOnlyEnabled) throws Exception {
155+
private void verifyRegionReadOnlyControllerLoading(boolean isReadOnlyEnabled) {
156156
RegionCoprocessorHost regionCPHost = region.getCoprocessorHost();
157157

158158
if (isReadOnlyEnabled) {
@@ -220,8 +220,10 @@ public void testReadOnlyControllerLoadedWhenEnabledDynamically() throws Exceptio
220220
public void testReadOnlyControllerUnloadedWhenDisabledDynamically() throws Exception {
221221
setupMiniCluster(initialReadOnlyMode);
222222
boolean isReadOnlyEnabled = false;
223-
setReadOnlyMode(isReadOnlyEnabled);
223+
Configuration newConf = setReadOnlyMode(isReadOnlyEnabled);
224224
createTable();
225+
// The newly created table's region has a stale conf that needs to be updated
226+
region.onConfigurationChange(newConf);
225227
verifyMasterReadOnlyControllerLoading(isReadOnlyEnabled);
226228
verifyRegionServerReadOnlyControllerLoading(isReadOnlyEnabled);
227229
verifyRegionReadOnlyControllerLoading(isReadOnlyEnabled);
@@ -232,8 +234,10 @@ public void testReadOnlyControllerLoadUnloadedWhenMultipleReadOnlyToggle() throw
232234
setupMiniCluster(initialReadOnlyMode);
233235

234236
// Ensure region exists before validation
235-
setReadOnlyMode(false);
237+
Configuration newConf = setReadOnlyMode(false);
236238
createTable();
239+
// The newly created table's region has a stale conf that needs to be updated
240+
region.onConfigurationChange(newConf);
237241
verifyReadOnlyState(false);
238242

239243
// Define toggle sequence

0 commit comments

Comments
 (0)