You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by bh...@apache.org on 2020/04/09 22:17:03 UTC

[hadoop-ozone] branch master updated: HDDS-3365. Ensure OzoneConfiguration is initialized in OzoneClientFactory#getOzoneClient. (#798)

This is an automated email from the ASF dual-hosted git repository.

bharat pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hadoop-ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new e71c383  HDDS-3365. Ensure OzoneConfiguration is initialized in OzoneClientFactory#getOzoneClient. (#798)
e71c383 is described below

commit e71c3838981a55f1c992abac51d87888dc80a7c8
Author: Xiaoyu Yao <xy...@apache.org>
AuthorDate: Thu Apr 9 15:16:52 2020 -0700

    HDDS-3365. Ensure OzoneConfiguration is initialized in OzoneClientFactory#getOzoneClient. (#798)
---
 .../apache/hadoop/ozone/client/OzoneClientFactory.java | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneClientFactory.java b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneClientFactory.java
index 13d8790..b0a7a4e 100644
--- a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneClientFactory.java
+++ b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneClientFactory.java
@@ -181,28 +181,30 @@ public final class OzoneClientFactory {
     DataInputStream in = new DataInputStream(buf);
     tokenId.readFields(in);
     String omServiceId = tokenId.getOmServiceId();
+    OzoneConfiguration ozoneConf = OzoneConfiguration.of(conf);
+    // Must check with OzoneConfiguration so that ozone-site.xml is loaded.
     if (StringUtils.isNotEmpty(omServiceId)) {
       // new OM should always issue token with omServiceId
-      if (!OmUtils.isServiceIdsDefined(conf)
+      if (!OmUtils.isServiceIdsDefined(ozoneConf)
           && omServiceId.equals(OzoneConsts.OM_SERVICE_ID_DEFAULT)) {
         // Non-HA or single-node Ratis HA
-        return OzoneClientFactory.getRpcClient(conf);
-      } else if (OmUtils.isOmHAServiceId(conf, omServiceId)) {
+        return OzoneClientFactory.getRpcClient(ozoneConf);
+      } else if (OmUtils.isOmHAServiceId(ozoneConf, omServiceId)) {
         // HA with matching service id
-        return OzoneClientFactory.getRpcClient(omServiceId, conf);
+        return OzoneClientFactory.getRpcClient(omServiceId, ozoneConf);
       } else {
         // HA with mismatched service id
         throw new IOException("Service ID specified " + omServiceId +
             " does not match" + " with " + OZONE_OM_SERVICE_IDS_KEY +
             " defined in the " + "configuration. Configured " +
-            OZONE_OM_SERVICE_IDS_KEY + " are" + conf.getTrimmedStringCollection(
-            OZONE_OM_SERVICE_IDS_KEY));
+            OZONE_OM_SERVICE_IDS_KEY + " are" +
+            ozoneConf.getTrimmedStringCollection(OZONE_OM_SERVICE_IDS_KEY));
       }
     } else {
       // Old OM may issue token without omServiceId that should work
       // with non-HA case
-      if (!OmUtils.isServiceIdsDefined(conf)) {
-        return OzoneClientFactory.getRpcClient(conf);
+      if (!OmUtils.isServiceIdsDefined(ozoneConf)) {
+        return OzoneClientFactory.getRpcClient(ozoneConf);
       } else {
         throw new IOException("OzoneToken with no service ID can't "
             + "be renewed or canceled with local OM HA setup because we "


---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-commits-help@hadoop.apache.org