You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2022/11/02 20:15:29 UTC
[GitHub] [hadoop] goiri commented on a diff in pull request #5098: HDFS-16831. [RBF SBN] GetNamenodesForNameserviceId should shuffle Observer NameNodes every time
goiri commented on code in PR #5098:
URL: https://github.com/apache/hadoop/pull/5098#discussion_r1012254353
##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/resolver/MembershipNamenodeResolver.java:
##########
@@ -189,13 +190,43 @@ private void updateNameNodeState(final String nsId,
}
}
+ @VisibleForTesting
+ public <T extends FederationNamenodeContext> List<T> shuffleObserverNN(
+ List<T> inputNameNodes, boolean listObserversFirst) {
+ if (!listObserversFirst) {
+ return inputNameNodes;
+ } else {
+ List<T> observerNNList = new ArrayList<>();
+ List<T> activeAndStandbyList = new ArrayList<>();
+ for (T t : inputNameNodes) {
+ if (t.getState() == OBSERVER) {
+ observerNNList.add(t);
+ } else {
+ activeAndStandbyList.add(t);
+ }
+ }
+
+ if (observerNNList.size() <= 1) {
Review Comment:
We could've done this check earlier.
##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/resolver/MembershipNamenodeResolver.java:
##########
@@ -189,13 +190,43 @@ private void updateNameNodeState(final String nsId,
}
}
+ @VisibleForTesting
+ public <T extends FederationNamenodeContext> List<T> shuffleObserverNN(
+ List<T> inputNameNodes, boolean listObserversFirst) {
+ if (!listObserversFirst) {
+ return inputNameNodes;
+ } else {
Review Comment:
No ned for elses when we do the return.
--
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: common-issues-unsubscribe@hadoop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org