You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by bh...@apache.org on 2019/10/07 17:17:35 UTC
[hadoop] branch trunk updated: HDDS-2239. Fix TestOzoneFsHAUrls
(#1600)
This is an automated email from the ASF dual-hosted git repository.
bharat pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push:
new 9685a6c HDDS-2239. Fix TestOzoneFsHAUrls (#1600)
9685a6c is described below
commit 9685a6c0e56a26add8be15606233573b514bff9e
Author: Doroszlai, Attila <64...@users.noreply.github.com>
AuthorDate: Mon Oct 7 19:17:25 2019 +0200
HDDS-2239. Fix TestOzoneFsHAUrls (#1600)
---
.../fs/ozone/BasicOzoneClientAdapterImpl.java | 59 ++++++++++++----------
1 file changed, 31 insertions(+), 28 deletions(-)
diff --git a/hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java b/hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java
index 5e1a50d..9ea03b5 100644
--- a/hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java
+++ b/hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java
@@ -91,9 +91,11 @@ public class BasicOzoneClientAdapterImpl implements OzoneClientAdapter {
ClassLoader contextClassLoader =
Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(null);
- OzoneConfiguration conf = new OzoneConfiguration();
- Thread.currentThread().setContextClassLoader(contextClassLoader);
- return conf;
+ try {
+ return new OzoneConfiguration();
+ } finally {
+ Thread.currentThread().setContextClassLoader(contextClassLoader);
+ }
}
public BasicOzoneClientAdapterImpl(OzoneConfiguration conf, String volumeStr,
@@ -109,38 +111,39 @@ public class BasicOzoneClientAdapterImpl implements OzoneClientAdapter {
ClassLoader contextClassLoader =
Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(null);
- OzoneConfiguration conf = OzoneConfiguration.of(hadoopConf);
- if (omHost == null && OmUtils.isServiceIdsDefined(conf)) {
- // When the host name or service id isn't given
- // but ozone.om.service.ids is defined, declare failure.
+ try {
+ OzoneConfiguration conf = OzoneConfiguration.of(hadoopConf);
- // This is a safety precaution that prevents the client from
- // accidentally failing over to an unintended OM.
- throw new IllegalArgumentException("Service ID or host name must not"
- + " be omitted when ozone.om.service.ids is defined.");
- }
+ if (omHost == null && OmUtils.isServiceIdsDefined(conf)) {
+ // When the host name or service id isn't given
+ // but ozone.om.service.ids is defined, declare failure.
- if (omPort != -1) {
- // When the port number is specified, perform the following check
- if (OmUtils.isOmHAServiceId(conf, omHost)) {
- // If omHost is a service id, it shouldn't use a port
- throw new IllegalArgumentException("Port " + omPort +
- " specified in URI but host '" + omHost + "' is "
- + "a logical (HA) OzoneManager and does not use port information.");
+ // This is a safety precaution that prevents the client from
+ // accidentally failing over to an unintended OM.
+ throw new IllegalArgumentException("Service ID or host name must not"
+ + " be omitted when ozone.om.service.ids is defined.");
}
- } else {
- // When port number is not specified, read it from config
- omPort = OmUtils.getOmRpcPort(conf);
- }
- SecurityConfig secConfig = new SecurityConfig(conf);
+ if (omPort != -1) {
+ // When the port number is specified, perform the following check
+ if (OmUtils.isOmHAServiceId(conf, omHost)) {
+ // If omHost is a service id, it shouldn't use a port
+ throw new IllegalArgumentException("Port " + omPort +
+ " specified in URI but host '" + omHost + "' is a "
+ + "logical (HA) OzoneManager and does not use port information.");
+ }
+ } else {
+ // When port number is not specified, read it from config
+ omPort = OmUtils.getOmRpcPort(conf);
+ }
- if (secConfig.isSecurityEnabled()) {
- this.securityEnabled = true;
- }
+ SecurityConfig secConfig = new SecurityConfig(conf);
+
+ if (secConfig.isSecurityEnabled()) {
+ this.securityEnabled = true;
+ }
- try {
String replicationTypeConf =
conf.get(OzoneConfigKeys.OZONE_REPLICATION_TYPE,
OzoneConfigKeys.OZONE_REPLICATION_TYPE_DEFAULT);
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org