You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by hz...@apache.org on 2020/09/03 06:02:23 UTC

[helix] branch master updated: Return "name" field as VM name in Azure environment (#1340)

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

hzlu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git


The following commit(s) were added to refs/heads/master by this push:
     new 6f5ca15  Return "name" field as VM name in Azure environment (#1340)
6f5ca15 is described below

commit 6f5ca159af4236ad1ad709133bc5cb9ce823dc83
Author: Meng Zhang <mn...@linkedin.com>
AuthorDate: Wed Sep 2 23:02:16 2020 -0700

    Return "name" field as VM name in Azure environment (#1340)
    
    * Return name field as VM name in Azure envrionment
    
    * fix comment
    
    * fix test
---
 .../src/main/java/org/apache/helix/HelixCloudProperty.java |  8 ++++----
 .../azure/AzureCloudInstanceInformationProcessor.java      | 14 +++++++-------
 .../org/apache/helix/manager/zk/ParticipantManager.java    |  4 ++--
 .../java/org/apache/helix/util/InstanceValidationUtil.java |  4 ++--
 .../cloud/TestAzureCloudInstanceInformationProcessor.java  |  2 +-
 5 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/helix-core/src/main/java/org/apache/helix/HelixCloudProperty.java b/helix-core/src/main/java/org/apache/helix/HelixCloudProperty.java
index 554c595..6cbc2e1 100644
--- a/helix-core/src/main/java/org/apache/helix/HelixCloudProperty.java
+++ b/helix-core/src/main/java/org/apache/helix/HelixCloudProperty.java
@@ -37,7 +37,7 @@ public class HelixCloudProperty {
   private static final Logger LOG = LoggerFactory.getLogger(HelixCloudProperty.class.getName());
   private static final String AZURE_CLOUD_PROPERTY_FILE = SystemPropertyKeys.AZURE_CLOUD_PROPERTIES;
   private static final String CLOUD_INFO_SOURCE = "cloud_info_source";
-  private static final String CLOUD_INFO_PROCESSFOR_NAME = "cloud_info_processor_name";
+  private static final String CLOUD_INFO_PROCESSOR_NAME = "cloud_info_processor_name";
   private static final String CLOUD_MAX_RETRY = "cloud_max_retry";
   private static final String CONNECTION_TIMEOUT_MS = "connection_timeout_ms";
   private static final String REQUEST_TIMEOUT_MS = "request_timeout_ms";
@@ -74,7 +74,7 @@ public class HelixCloudProperty {
    * @param
    */
   public HelixCloudProperty(CloudConfig cloudConfig) {
-    setCloudEndabled(cloudConfig.isCloudEnabled());
+    setCloudEnabled(cloudConfig.isCloudEnabled());
     if (cloudConfig.isCloudEnabled()) {
       setCloudId(cloudConfig.getCloudID());
       setCloudProvider(cloudConfig.getCloudProvider());
@@ -93,7 +93,7 @@ public class HelixCloudProperty {
         LOG.info("Successfully loaded Helix Azure cloud properties: {}", azureProperties);
         setCloudInfoSources(
             Collections.singletonList(azureProperties.getProperty(CLOUD_INFO_SOURCE)));
-        setCloudInfoProcessorName(azureProperties.getProperty(CLOUD_INFO_PROCESSFOR_NAME));
+        setCloudInfoProcessorName(azureProperties.getProperty(CLOUD_INFO_PROCESSOR_NAME));
         setCloudMaxRetry(Integer.valueOf(azureProperties.getProperty(CLOUD_MAX_RETRY)));
         setCloudConnectionTimeout(Long.valueOf(azureProperties.getProperty(CONNECTION_TIMEOUT_MS)));
         setCloudRequestTimeout(Long.valueOf(azureProperties.getProperty(REQUEST_TIMEOUT_MS)));
@@ -145,7 +145,7 @@ public class HelixCloudProperty {
     return _customizedCloudProperties;
   }
 
-  public void setCloudEndabled(boolean isCloudEnabled) {
+  public void setCloudEnabled(boolean isCloudEnabled) {
     _isCloudEnabled = isCloudEnabled;
   }
 
diff --git a/helix-core/src/main/java/org/apache/helix/cloud/azure/AzureCloudInstanceInformationProcessor.java b/helix-core/src/main/java/org/apache/helix/cloud/azure/AzureCloudInstanceInformationProcessor.java
index e3c1577..fac6917 100644
--- a/helix-core/src/main/java/org/apache/helix/cloud/azure/AzureCloudInstanceInformationProcessor.java
+++ b/helix-core/src/main/java/org/apache/helix/cloud/azure/AzureCloudInstanceInformationProcessor.java
@@ -48,15 +48,15 @@ public class AzureCloudInstanceInformationProcessor
       LoggerFactory.getLogger(AzureCloudInstanceInformationProcessor.class);
   private final CloseableHttpClient _closeableHttpClient;
   private final HelixCloudProperty _helixCloudProperty;
-  private final String COMPUTE = "compute";
-  private final String INSTANCE_NAME = "vmId";
-  private final String DOMAIN = "platformFaultDomain";
-  private final String INSTANCE_SET_NAME = "vmScaleSetName";
+  private static final String COMPUTE = "compute";
+  private static final String INSTANCE_NAME = "name";
+  private static final String DOMAIN = "platformFaultDomain";
+  private static final String INSTANCE_SET_NAME = "vmScaleSetName";
 
   public AzureCloudInstanceInformationProcessor(HelixCloudProperty helixCloudProperty) {
     _helixCloudProperty = helixCloudProperty;
 
-    RequestConfig requestConifg = RequestConfig.custom()
+    RequestConfig requestConfig = RequestConfig.custom()
         .setConnectionRequestTimeout((int) helixCloudProperty.getCloudRequestTimeout())
         .setConnectTimeout((int) helixCloudProperty.getCloudConnectionTimeout()).build();
 
@@ -69,7 +69,7 @@ public class AzureCloudInstanceInformationProcessor
         };
 
     //TODO: we should regularize the way how httpClient should be used throughout Helix. e.g. Helix-rest could also use in the same way
-    _closeableHttpClient = HttpClients.custom().setDefaultRequestConfig(requestConifg)
+    _closeableHttpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig)
         .setRetryHandler(httpRequestRetryHandler).build();
   }
 
@@ -153,7 +153,7 @@ public class AzureCloudInstanceInformationProcessor
       }
     } catch (IOException e) {
       throw new HelixException(
-          String.format("Error in parsing cloud instance information: %s", response, e));
+          String.format("Error in parsing cloud instance information: %s", response), e);
     }
     return azureCloudInstanceInformation;
   }
diff --git a/helix-core/src/main/java/org/apache/helix/manager/zk/ParticipantManager.java b/helix-core/src/main/java/org/apache/helix/manager/zk/ParticipantManager.java
index e91182a..937fb4b 100644
--- a/helix-core/src/main/java/org/apache/helix/manager/zk/ParticipantManager.java
+++ b/helix-core/src/main/java/org/apache/helix/manager/zk/ParticipantManager.java
@@ -166,7 +166,7 @@ public class ParticipantManager {
     boolean autoJoin = false;
     boolean autoRegistration = false;
 
-    // Read "allowParticipantAutoJoin" flag to see if an instance can auto join to the cluster
+    // Read "allowParticipantAutoJoin" field to see if an instance can auto join to the cluster
     try {
       HelixConfigScope scope = new HelixConfigScopeBuilder(ConfigScopeProperty.CLUSTER)
           .forCluster(_manager.getClusterName()).build();
@@ -183,7 +183,7 @@ public class ParticipantManager {
     try {
       autoRegistration =
           Boolean.valueOf(_helixManagerProperty.getHelixCloudProperty().getCloudEnabled());
-      LOG.info("instance: " + _instanceName + " auto-register " + _clusterName + " is "
+      LOG.info("instance: " + _instanceName + " auto-registering " + _clusterName + " is "
           + autoRegistration);
     } catch (Exception e) {
       LOG.info("auto registration is false for cluster" + _clusterName);
diff --git a/helix-core/src/main/java/org/apache/helix/util/InstanceValidationUtil.java b/helix-core/src/main/java/org/apache/helix/util/InstanceValidationUtil.java
index 4c8ee0f..e3a98c1 100644
--- a/helix-core/src/main/java/org/apache/helix/util/InstanceValidationUtil.java
+++ b/helix-core/src/main/java/org/apache/helix/util/InstanceValidationUtil.java
@@ -163,9 +163,9 @@ public class InstanceValidationUtil {
       return false;
     }
     if (!clusterConfig.isPersistIntermediateAssignment()) {
-      _logger.error(String.format(
+      _logger.error(
           "Cluster config %s is not turned on, which is required for instance stability check.",
-          ClusterConfig.ClusterConfigProperty.PERSIST_INTERMEDIATE_ASSIGNMENT.toString()));
+          ClusterConfig.ClusterConfigProperty.PERSIST_INTERMEDIATE_ASSIGNMENT.toString());
       return false;
     }
     PropertyKey propertyKey = keyBuilder.instanceConfig(instanceName);
diff --git a/helix-core/src/test/java/org/apache/helix/cloud/TestAzureCloudInstanceInformationProcessor.java b/helix-core/src/test/java/org/apache/helix/cloud/TestAzureCloudInstanceInformationProcessor.java
index 350c9a9..4bad9d7 100644
--- a/helix-core/src/test/java/org/apache/helix/cloud/TestAzureCloudInstanceInformationProcessor.java
+++ b/helix-core/src/test/java/org/apache/helix/cloud/TestAzureCloudInstanceInformationProcessor.java
@@ -64,6 +64,6 @@ public class TestAzureCloudInstanceInformationProcessor extends MockHttpClient {
     Assert.assertEquals(
         azureCloudInstanceInformation
             .get(CloudInstanceInformation.CloudInstanceField.INSTANCE_NAME.name()),
-        "d2b921cc-c16c-41f7-a86d-a445eac6ec26");
+        "test-helix_1");
   }
 }