Skip to content

Commit 9feecd8

Browse files
guoyz50gyz-web
guoyz50
authored andcommitted
HDFS-17769. Allows client to actively retry to Active NameNode when the Observer NameNode is too far behind client state id.
1 parent 2cfaff7 commit 9feecd8

File tree

5 files changed

+3
-35
lines changed

5 files changed

+3
-35
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java

-4
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,6 @@ public class DFSConfigKeys extends CommonConfigurationKeys {
273273
HdfsClientConfigKeys.DeprecatedKeys.DFS_NAMENODE_REDUNDANCY_CONSIDERLOAD_KEY;
274274
public static final boolean DFS_NAMENODE_REDUNDANCY_CONSIDERLOAD_DEFAULT =
275275
true;
276-
public static final String DFS_NAMENODE_OBSERVER_TOO_STALE_RETRY_ACTIVE_ENABLE =
277-
"dfs.namenode.observer.too.stale.retry.active.enable";
278-
public static final boolean DFS_NAMENODE_OBSERVER_TOO_STALE_RETRY_ACTIVE_ENABLE_DEFAULT =
279-
false;
280276
public static final String
281277
DFS_NAMENODE_REDUNDANCY_CONSIDERLOADBYSTORAGETYPE_KEY =
282278
"dfs.namenode.redundancy.considerLoadByStorageType";

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java

-9
Original file line numberDiff line numberDiff line change
@@ -694,8 +694,6 @@ private boolean isFromProxyUser(CallerContext ctx) {
694694

695695
private final MessageDigest digest;
696696

697-
private final boolean isRetryActive;
698-
699697
/**
700698
* Notify that loading of this FSDirectory is complete, and
701699
* it is imageLoaded for use
@@ -1080,9 +1078,6 @@ static FSNamesystem loadFromDisk(Configuration conf) throws IOException {
10801078
this.isGetBlocksCheckOperationEnabled = conf.getBoolean(
10811079
DFSConfigKeys.DFS_NAMENODE_GETBLOCKS_CHECK_OPERATION_KEY,
10821080
DFSConfigKeys.DFS_NAMENODE_GETBLOCKS_CHECK_OPERATION_DEFAULT);
1083-
this.isRetryActive = conf.getBoolean(
1084-
DFSConfigKeys.DFS_NAMENODE_OBSERVER_TOO_STALE_RETRY_ACTIVE_ENABLE,
1085-
DFSConfigKeys.DFS_NAMENODE_OBSERVER_TOO_STALE_RETRY_ACTIVE_ENABLE_DEFAULT);
10861081

10871082
} catch(IOException e) {
10881083
LOG.error(getClass().getSimpleName() + " initialization failed.", e);
@@ -1143,10 +1138,6 @@ boolean isSnapshotTrashRootEnabled() {
11431138
return isSnapshotTrashRootEnabled;
11441139
}
11451140

1146-
public boolean isRetryActive() {
1147-
return isRetryActive;
1148-
}
1149-
11501141
void lockRetryCache() {
11511142
if (retryCache != null) {
11521143
retryCache.lock();

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/GlobalStateIdContext.java

+3-13
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import org.apache.hadoop.classification.InterfaceAudience;
2727
import org.apache.hadoop.classification.InterfaceStability;
2828
import org.apache.hadoop.ha.HAServiceProtocol.HAServiceState;
29-
import org.apache.hadoop.hdfs.DFSConfigKeys;
3029
import org.apache.hadoop.hdfs.protocol.ClientProtocol;
3130
import org.apache.hadoop.hdfs.server.namenode.ha.ObserverReadProxyProvider;
3231
import org.apache.hadoop.hdfs.server.namenode.ha.ReadOnly;
@@ -158,18 +157,9 @@ public long receiveRequestState(RpcRequestHeaderProto header,
158157
ESTIMATED_TRANSACTIONS_PER_SECOND
159158
* TimeUnit.MILLISECONDS.toSeconds(clientWaitTime)
160159
* ESTIMATED_SERVER_TIME_MULTIPLIER) {
161-
if (namesystem.isRetryActive()) {
162-
String message = "Retrying to Active NameNode, Observer Node is too far behind: serverStateId = " + serverStateId + " clientStateId = " + clientStateId;
163-
FSNamesystem.LOG.warn(message);
164-
throw new ObserverRetryOnActiveException(message);
165-
} else {
166-
throw new RetriableException(
167-
String.format(
168-
"%s is not enabled, Continue Retrying to Observer NameNode, Observer Node is too far behind: serverStateId = %d clientStateId = %d",
169-
DFSConfigKeys.DFS_NAMENODE_OBSERVER_TOO_STALE_RETRY_ACTIVE_ENABLE,
170-
serverStateId, clientStateId
171-
));
172-
}
160+
throw new ObserverRetryOnActiveException("Retrying to Active NameNode, Observer Node is too"
161+
+ " far behind: serverStateId = " + serverStateId
162+
+ " clientStateId = " + clientStateId);
173163
}
174164
return clientStateId;
175165
}

hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml

-7
Original file line numberDiff line numberDiff line change
@@ -3753,13 +3753,6 @@
37533753
</description>
37543754
</property>
37553755

3756-
<property>
3757-
<name>dfs.namenode.observer.too.stale.retry.active.enable</name>
3758-
<value>false</value>
3759-
<description>When enabled, allows client to actively retry to Active NameNode when the Observer NameNode is too far behind client state id.
3760-
</description>
3761-
</property>
3762-
37633756
<property>
37643757
<name>dfs.namenode.top.windows.minutes</name>
37653758
<value>1,5,25</value>

hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestObserverNode.java

-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
import org.apache.hadoop.fs.permission.FsPermission;
5454
import org.apache.hadoop.ha.HAServiceProtocol.HAServiceState;
5555
import org.apache.hadoop.ha.ServiceFailedException;
56-
import org.apache.hadoop.hdfs.DFSConfigKeys;
5756
import org.apache.hadoop.hdfs.DFSTestUtil;
5857
import org.apache.hadoop.hdfs.DistributedFileSystem;
5958
import org.apache.hadoop.hdfs.MiniDFSCluster;
@@ -107,7 +106,6 @@ public static void startUpCluster() throws Exception {
107106
// Observer and immediately try to read from it.
108107
conf.setTimeDuration(
109108
OBSERVER_PROBE_RETRY_PERIOD_KEY, 0, TimeUnit.MILLISECONDS);
110-
conf.setBoolean(DFSConfigKeys.DFS_NAMENODE_OBSERVER_TOO_STALE_RETRY_ACTIVE_ENABLE, true);
111109
qjmhaCluster = HATestUtil.setUpObserverCluster(conf, 1, 1, true);
112110
dfsCluster = qjmhaCluster.getDfsCluster();
113111
}

0 commit comments

Comments
 (0)