ivandika3 commented on code in PR #11418:
URL: https://github.com/apache/ozone/pull/11418#discussion_r4369359375


##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/ha/FollowerReadFailoverProxyProviderBase.java:
##########
@@ -0,0 +1,167 @@
+/*
+ * 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.ozone.om.ha;
+
+import org.apache.hadoop.ozone.OmUtils;
+import org.apache.hadoop.ozone.om.helpers.ReadConsistency;
+import org.apache.hadoop.ozone.om.protocolPB.OzoneManagerProtocolPB;
+import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest;
+import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ReadConsistencyHint;
+import org.apache.ratis.util.Preconditions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Base class for the OM follower read failover proxy providers.
+ * <p>
+ * It keeps the follower read configuration and selects the OM node to send 
follower reads to.
+ * Leader-based failover is delegated to the underlying {@link 
OMFailoverProxyProviderBase}.
+ */
+public abstract class FollowerReadFailoverProxyProviderBase {
+  private static final Logger LOG = 
LoggerFactory.getLogger(FollowerReadFailoverProxyProviderBase.class);
+
+  /** Whether follower reads are supported by the OM service. */
+  private volatile boolean omServiceSupportsFollowerRead;
+
+  /** Whether eligible reads without an explicit consistency hint use 
followers. */
+  private final boolean defaultFollowerReadEnabled;
+
+  /** The read consistency hint used when follower read is enabled. */
+  private final ReadConsistencyHint followerReadConsistency;
+  /** The read consistency hint used when follower read is disabled or when 
follower read fails. */
+  private final ReadConsistencyHint leaderReadConsistency;
+
+  /**
+   * The index of the OM node used for follower read, in the order of the 
leader proxy's OM nodes.
+   * Should only be accessed in synchronized methods.
+   */
+  private int currentIndex = 0;

Review Comment:
   Ok thanks for the info.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to