anmolnar commented on code in PR #8377:
URL: https://github.com/apache/hbase/pull/8377#discussion_r3539271431


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/util/ConfigurationUtil.java:
##########
@@ -116,8 +116,22 @@ public static List<Map.Entry<String, String>> 
getKeyValues(Configuration conf, S
     return rtn;
   }
 
+  /**
+   * Returns true if the provided Configuration object has
+   * {@link HConstants#HBASE_GLOBAL_READONLY_ENABLED_KEY} set to true; false 
otherwise.
+   */
   public static boolean isReadOnlyModeEnabledInConf(Configuration conf) {
     return conf.getBoolean(HConstants.HBASE_GLOBAL_READONLY_ENABLED_KEY,
       HConstants.HBASE_GLOBAL_READONLY_ENABLED_DEFAULT);
   }
+
+  /**
+   * Returns a copied version of the provided Configuration object that has
+   * {@link HConstants#HBASE_GLOBAL_READONLY_ENABLED_KEY} set to true.
+   */
+  public static Configuration 
getReadOnlyEnabledConfigurationCopy(Configuration conf) {

Review Comment:
   I think **set**ReadOnlyEnabledConfigurationCopy would be a better name for 
this method.



##########
hbase-server/src/main/java/org/apache/hadoop/hbase/HBaseServerBase.java:
##########
@@ -102,15 +103,19 @@ public abstract class HBaseServerBase<R extends 
HBaseRpcServicesBase<?>> extends
   protected final AtomicBoolean abortRequested = new AtomicBoolean(false);
 
   // Set when a report to the master comes back with a message asking us to
-  // shutdown. Also set by call to stop when debugging or running unit tests
+  // shut down. Also set by call to stop when debugging or running unit tests
   // of HRegionServer in isolation.
   protected volatile boolean stopped = false;
 
+  // Flag set when a read-only to read-write transition is blocked because 
another active cluster
+  // exists
+  protected volatile boolean readOnlyTransitionBlocked = false;

Review Comment:
   Probably not strictly necessary here, but I prefer to use `AtomicBoolean` 
for multi-threaded scenarios.



##########
hbase-client/src/main/java/org/apache/hadoop/hbase/ReadOnlyTransitionException.java:
##########
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase;
+
+import org.apache.yetus.audience.InterfaceAudience;
+
+/**
+ * Thrown when a replica cluster attempts to disable read-only mode while 
another active cluster
+ * already exists on the same storage location.
+ */
[email protected]
+public class ReadOnlyTransitionException extends DoNotRetryIOException {

Review Comment:
   nit: Could encapsulate a String field identifying the current active 
cluster's ID and emitted to log when the exception is converted to string.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to