hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jia...@apache.org
Subject [45/52] [abbrv] hadoop git commit: YARN-6533. Race condition in writing service record to registry in yarn native services. Contributed by Billie Rinaldi
Date Fri, 21 Jul 2017 18:39:47 GMT
YARN-6533. Race condition in writing service record to registry in yarn native services. Contributed
by Billie Rinaldi


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/d8842fbb
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/d8842fbb
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/d8842fbb

Branch: refs/heads/yarn-native-services
Commit: d8842fbb268b335e7318bb488f9edfe4cc631943
Parents: c314788
Author: Jian He <jianhe@apache.org>
Authored: Thu May 11 09:23:54 2017 -0700
Committer: Jian He <jianhe@apache.org>
Committed: Fri Jul 21 11:38:14 2017 -0700

----------------------------------------------------------------------
 .../org/apache/slider/providers/ProviderUtils.java  |  6 ++----
 .../providers/docker/DockerProviderService.java     | 11 +++++++++--
 .../slider/server/appmaster/SliderAppMaster.java    | 16 ----------------
 3 files changed, 11 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/d8842fbb/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/ProviderUtils.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/ProviderUtils.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/ProviderUtils.java
index beeaa55..d58ecaa 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/ProviderUtils.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/ProviderUtils.java
@@ -503,7 +503,8 @@ public class ProviderUtils implements RoleKeys, SliderKeys {
    */
   public void updateServiceRecord(StateAccessForProviders amState,
       YarnRegistryViewForProviders yarnRegistry,
-      String containerId, String roleName, List<String> ip, String hostname) {
+      String containerId, String roleName, List<String> ip, String hostname)
+      throws IOException {
     try {
       RoleInstance role = null;
       if(ip != null && !ip.isEmpty()){
@@ -535,9 +536,6 @@ public class ProviderUtils implements RoleKeys, SliderKeys {
     } catch (NoSuchNodeException e) {
       // ignore - there is nothing to do if we don't find a container
       log.warn("Owned container {} not found - {}", containerId, e);
-    } catch (IOException e) {
-      log.warn("Error updating container {} service record in registry",
-          containerId, e);
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/d8842fbb/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/docker/DockerProviderService.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/docker/DockerProviderService.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/docker/DockerProviderService.java
index 12c2b04..a48bf83 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/docker/DockerProviderService.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/docker/DockerProviderService.java
@@ -146,8 +146,15 @@ public class DockerProviderService extends AbstractService
       return false;
     }
 
-    providerUtils.updateServiceRecord(amState, yarnRegistry,
-        containerId.toString(), instance.role, status.getIPs(), status.getHost());
+    try {
+      providerUtils.updateServiceRecord(amState, yarnRegistry,
+          containerId.toString(), instance.role, status.getIPs(), status.getHost());
+    } catch (IOException e) {
+      // could not write service record to ZK, log and retry
+      log.warn("Error updating container {} service record in registry, " +
+          "retrying", containerId, e);
+      return true;
+    }
     // TODO publish ip and host
     org.apache.slider.api.resource.Container container =
         instance.providerRole.component.getContainer(containerId.toString());

http://git-wip-us.apache.org/repos/asf/hadoop/blob/d8842fbb/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
index ae03b45..02c9198 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
@@ -1182,24 +1182,8 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
       return false;
     }
     // this is where component registrations  go
-    String cid = RegistryPathUtils.encodeYarnID(id.toString());
-    ServiceRecord record = new ServiceRecord();
-    record.set(YarnRegistryAttributes.YARN_ID, cid);
-
-    record.description = roleInstance.getCompInstanceName();
     log.info("Registering component " + roleInstance.getCompInstanceName()
         + ", containerId = " + id);
-    record.set(YarnRegistryAttributes.YARN_PERSISTENCE,
-        PersistencePolicies.CONTAINER);
-    setUserProvidedServiceRecordAttributes(
-        instance.providerRole.component.getConfiguration(), record);
-    try {
-      yarnRegistryOperations.putComponent(cid, record);
-    } catch (IOException e) {
-      log.warn("Failed to register container {}/{}: {}",
-          id, roleInstance.role, e, e);
-      return false;
-    }
     org.apache.slider.api.resource.Container container =
         new org.apache.slider.api.resource.Container();
     container.setId(id.toString());


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


Mime
View raw message