This is an automated email from the ASF dual-hosted git repository. elek pushed a commit to branch HDDS-2064 in repository https://gitbox.apache.org/repos/asf/hadoop-ozone.git
commit b9d8f6eaeae9724f315456c0264770459e01accb Author: Siyao Meng <sm...@cloudera.com> AuthorDate: Wed Sep 4 14:33:52 2019 -0700 Initialize this.peerNodes instead to eliminate OzoneManagerRatisServer#newOMRatisServer NPE. --- .../org/apache/hadoop/ozone/om/OzoneManager.java | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java index df36e3e..cd97eb8 100644 --- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java +++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java @@ -615,20 +615,27 @@ public final class OzoneManager extends ServiceRuntimeInfoImpl " system with " + OZONE_OM_SERVICE_IDS_KEY + " and " + OZONE_OM_ADDRESS_KEY; throw new OzoneIllegalArgumentException(msg); - } else if (!isOMAddressSet && found == 0) { - String msg = "Incorrect configuration. Unable to find OzoneManager" + - " node address for service id " + serviceId + ". Please" + - " check and reconfigure: " + OZONE_OM_SERVICE_IDS_KEY + - ", " + OZONE_OM_NODES_KEY + " and " + OZONE_OM_ADDRESS_KEY; - throw new OzoneIllegalArgumentException(msg); } } - +/* + if (found == 0) { + String msg = "Incorrect configuration. Unable to perform" + + " self-discovery for current OzoneManager node. Please" + + " check and reconfigure: " + OZONE_OM_SERVICE_IDS_KEY + + ", " + OZONE_OM_NODES_KEY + " and " + OZONE_OM_ADDRESS_KEY; + throw new OzoneIllegalArgumentException(msg); + } +*/ if (!isOMAddressSet) { // No OM address is set. Fallback to default InetSocketAddress omAddress = OmUtils.getOmAddress(conf); int ratisPort = conf.getInt(OZONE_OM_RATIS_PORT_KEY, OZONE_OM_RATIS_PORT_DEFAULT); + // HDDS-2064: this.peerNodes would be null at this point because + // it is not initialized, we want to initialize it as an empty list + // to prevent NPE in OzoneManagerRatisServer#newOMRatisServer. + assert(this.peerNodes == null); + this.peerNodes = new ArrayList<>(); LOG.info("Configuration either no {} set. Falling back to the default " + "OM address {}", OZONE_OM_ADDRESS_KEY, omAddress); --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-commits-h...@hadoop.apache.org