You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by GitBox <gi...@apache.org> on 2020/02/29 01:40:45 UTC

[GitHub] [helix] narendly opened a new pull request #836: Make MSDS endpoint configurable for HttpRoutingDataReader

narendly opened a new pull request #836: Make MSDS endpoint configurable for HttpRoutingDataReader
URL: https://github.com/apache/helix/pull/836
 
 
   ### Issues
   
   - [x] My PR addresses the following Helix issues and references them in the PR description:
   
   Fixes #835 
   
   ### Description
   
   - [x] Here are some details about my PR, including screenshots of any UI changes:
   
   We need to add a few more constructors that allows the users to configure which MSDS to talk to. Applications may wish to create RealmAwareZkClients connecting to different regions or namespaces. 
   
   ### Tests
   
   - [x] The following tests are written for this issue:
   
   Existing tests have coverage for this component.
   
   - [x] The following is the result of the "mvn test" command on the appropriate module:
   
   ```
   [INFO] 
   [INFO] ------------------------------------------------------------------------
   [INFO] BUILD SUCCESS
   [INFO] ------------------------------------------------------------------------
   [INFO] Total time:  6.689 s
   [INFO] Finished at: 2020-02-28T17:40:18-08:00
   [INFO] ------------------------------------------------------------------------
   ```
   
   
   ### Commits
   
   - [x] My commits all reference appropriate Apache Helix GitHub issues in their subject lines. In addition, my commits follow the guidelines from "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)":
     1. Subject is separated from body by a blank line
     1. Subject is limited to 50 characters (not including Jira issue reference)
     1. Subject does not end with a period
     1. Subject uses the imperative mood ("add", not "adding")
     1. Body wraps at 72 characters
     1. Body explains "what" and "why", not "how"
   
   
   ### Code Quality
   
   - [x] My diff has been formatted using helix-style.xml 
   (helix-style-intellij.xml if IntelliJ IDE is used)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] narendly commented on a change in pull request #836: Make MSDS endpoint configurable for HttpRoutingDataReader

Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #836: Make MSDS endpoint configurable for HttpRoutingDataReader
URL: https://github.com/apache/helix/pull/836#discussion_r388510065
 
 

 ##########
 File path: zookeeper-api/src/main/java/org/apache/helix/zookeeper/util/HttpRoutingDataReader.java
 ##########
 @@ -41,13 +42,17 @@
 
 
 public class HttpRoutingDataReader {
-  private static final String MSDS_ENDPOINT =
+  private static final String SYSTEM_MSDS_ENDPOINT =
       System.getProperty(MetadataStoreRoutingConstants.MSDS_SERVER_ENDPOINT_KEY);
   private static final int HTTP_TIMEOUT_IN_MS = 5000;
 
   /** Double-checked locking requires that the following fields be volatile */
-  private static volatile Map<String, List<String>> _rawRoutingData;
-  private static volatile MetadataStoreRoutingData _metadataStoreRoutingData;
+  // The following map stands for (MSDS endpoint, Raw Routing Data)
+  private static volatile Map<String, Map<String, List<String>>> _rawRoutingDataMap =
+      new HashMap<>();
 
 Review comment:
   Will change in another PR.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] narendly commented on a change in pull request #836: Make MSDS endpoint configurable for HttpRoutingDataReader

Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #836: Make MSDS endpoint configurable for HttpRoutingDataReader
URL: https://github.com/apache/helix/pull/836#discussion_r388509678
 
 

 ##########
 File path: zookeeper-api/src/main/java/org/apache/helix/zookeeper/util/HttpRoutingDataReader.java
 ##########
 @@ -41,13 +42,17 @@
 
 
 public class HttpRoutingDataReader {
-  private static final String MSDS_ENDPOINT =
+  private static final String SYSTEM_MSDS_ENDPOINT =
       System.getProperty(MetadataStoreRoutingConstants.MSDS_SERVER_ENDPOINT_KEY);
   private static final int HTTP_TIMEOUT_IN_MS = 5000;
 
   /** Double-checked locking requires that the following fields be volatile */
-  private static volatile Map<String, List<String>> _rawRoutingData;
-  private static volatile MetadataStoreRoutingData _metadataStoreRoutingData;
+  // The following map stands for (MSDS endpoint, Raw Routing Data)
+  private static volatile Map<String, Map<String, List<String>>> _rawRoutingDataMap =
 
 Review comment:
   Serves one namespaces. However, this is done this way to allow HttpRoutingDataReader to support multiple regions.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] kaisun2000 commented on a change in pull request #836: Make MSDS endpoint configurable for HttpRoutingDataReader

Posted by GitBox <gi...@apache.org>.
kaisun2000 commented on a change in pull request #836: Make MSDS endpoint configurable for HttpRoutingDataReader
URL: https://github.com/apache/helix/pull/836#discussion_r388489582
 
 

 ##########
 File path: zookeeper-api/src/main/java/org/apache/helix/zookeeper/util/HttpRoutingDataReader.java
 ##########
 @@ -56,44 +61,78 @@ private HttpRoutingDataReader() {
   }
 
   /**
-   * Fetches routing data from the data source via HTTP.
-   * @return a mapping from "metadata store realm addresses" to lists of
-   * "metadata store sharding keys", where the sharding keys in a value list all route to
-   * the realm address in the key disallows a meaningful mapping to be returned
+   * Fetches routing data from the data source via HTTP by querying the MSDS configured in the JVM config.
+   * @return
+   * @throws IOException
    */
   public static Map<String, List<String>> getRawRoutingData() throws IOException {
-    if (MSDS_ENDPOINT == null || MSDS_ENDPOINT.isEmpty()) {
+    if (SYSTEM_MSDS_ENDPOINT == null || SYSTEM_MSDS_ENDPOINT.isEmpty()) {
       throw new IllegalStateException(
           "HttpRoutingDataReader was unable to find a valid MSDS endpoint String in System Properties!");
     }
-    if (_rawRoutingData == null) {
+    return getRawRoutingData(SYSTEM_MSDS_ENDPOINT);
+  }
+
+  /**
+   * Fetches routing data from the data source via HTTP.
+   * @return a mapping from "metadata store realm addresses" to lists of
+   * "metadata store sharding keys", where the sharding keys in a value list all route to
+   * the realm address in the key disallows a meaningful mapping to be returned.
+   * @param msdsEndpoint Metadata Store Directory Store endpoint to query from
+   */
+  public static Map<String, List<String>> getRawRoutingData(String msdsEndpoint)
+      throws IOException {
+    Map<String, List<String>> rawRoutingData = _rawRoutingDataMap.get(msdsEndpoint);
 
 Review comment:
   Here, multiple thread can reach this get and thus we should use concurrentHashmap. Declaring it to volatile is not enough. 
   
   See my previous discussion with @pkuwm in the federatedZkClient.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] kaisun2000 commented on a change in pull request #836: Make MSDS endpoint configurable for HttpRoutingDataReader

Posted by GitBox <gi...@apache.org>.
kaisun2000 commented on a change in pull request #836: Make MSDS endpoint configurable for HttpRoutingDataReader
URL: https://github.com/apache/helix/pull/836#discussion_r388488542
 
 

 ##########
 File path: zookeeper-api/src/main/java/org/apache/helix/zookeeper/util/HttpRoutingDataReader.java
 ##########
 @@ -41,13 +42,17 @@
 
 
 public class HttpRoutingDataReader {
-  private static final String MSDS_ENDPOINT =
+  private static final String SYSTEM_MSDS_ENDPOINT =
       System.getProperty(MetadataStoreRoutingConstants.MSDS_SERVER_ENDPOINT_KEY);
   private static final int HTTP_TIMEOUT_IN_MS = 5000;
 
   /** Double-checked locking requires that the following fields be volatile */
-  private static volatile Map<String, List<String>> _rawRoutingData;
-  private static volatile MetadataStoreRoutingData _metadataStoreRoutingData;
+  // The following map stands for (MSDS endpoint, Raw Routing Data)
+  private static volatile Map<String, Map<String, List<String>>> _rawRoutingDataMap =
+      new HashMap<>();
+  // The following map stands for (MSDS endpoint, MetadataStoreRoutingData)
+  private static volatile Map<String, MetadataStoreRoutingData> _metadataStoreRoutingDataMap =
+      new HashMap<>();
 
 Review comment:
   concurrentHashMap()

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] kaisun2000 commented on a change in pull request #836: Make MSDS endpoint configurable for HttpRoutingDataReader

Posted by GitBox <gi...@apache.org>.
kaisun2000 commented on a change in pull request #836: Make MSDS endpoint configurable for HttpRoutingDataReader
URL: https://github.com/apache/helix/pull/836#discussion_r388491900
 
 

 ##########
 File path: zookeeper-api/src/main/java/org/apache/helix/zookeeper/util/HttpRoutingDataReader.java
 ##########
 @@ -41,13 +42,17 @@
 
 
 public class HttpRoutingDataReader {
-  private static final String MSDS_ENDPOINT =
+  private static final String SYSTEM_MSDS_ENDPOINT =
       System.getProperty(MetadataStoreRoutingConstants.MSDS_SERVER_ENDPOINT_KEY);
   private static final int HTTP_TIMEOUT_IN_MS = 5000;
 
   /** Double-checked locking requires that the following fields be volatile */
-  private static volatile Map<String, List<String>> _rawRoutingData;
-  private static volatile MetadataStoreRoutingData _metadataStoreRoutingData;
+  // The following map stands for (MSDS endpoint, Raw Routing Data)
+  private static volatile Map<String, Map<String, List<String>>> _rawRoutingDataMap =
 
 Review comment:
   In fact, if my understanding is correct, we people use this one, for one product, there is only one SYSTEM_MSDS_ENDPOINT would be defined. Say storagesystem1, or storagesystem2. They can't co-exist. Put it another way, this map the first key field would alway have only one value, right?
   
   I guess the intention is that to make this httproutingdatareader servering multiple namespaces (storagesystem1, storagesysgtem2). In reality, they would still serve only one.
   
   Or am I missing something here?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] narendly commented on a change in pull request #836: Make MSDS endpoint configurable for HttpRoutingDataReader

Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #836: Make MSDS endpoint configurable for HttpRoutingDataReader
URL: https://github.com/apache/helix/pull/836#discussion_r388509678
 
 

 ##########
 File path: zookeeper-api/src/main/java/org/apache/helix/zookeeper/util/HttpRoutingDataReader.java
 ##########
 @@ -41,13 +42,17 @@
 
 
 public class HttpRoutingDataReader {
-  private static final String MSDS_ENDPOINT =
+  private static final String SYSTEM_MSDS_ENDPOINT =
       System.getProperty(MetadataStoreRoutingConstants.MSDS_SERVER_ENDPOINT_KEY);
   private static final int HTTP_TIMEOUT_IN_MS = 5000;
 
   /** Double-checked locking requires that the following fields be volatile */
-  private static volatile Map<String, List<String>> _rawRoutingData;
-  private static volatile MetadataStoreRoutingData _metadataStoreRoutingData;
+  // The following map stands for (MSDS endpoint, Raw Routing Data)
+  private static volatile Map<String, Map<String, List<String>>> _rawRoutingDataMap =
 
 Review comment:
   Serves a single namespace. However, this is done this way to allow HttpRoutingDataReader to support multiple regions.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] narendly merged pull request #836: Make MSDS endpoint configurable for HttpRoutingDataReader

Posted by GitBox <gi...@apache.org>.
narendly merged pull request #836: Make MSDS endpoint configurable for HttpRoutingDataReader
URL: https://github.com/apache/helix/pull/836
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] kaisun2000 commented on a change in pull request #836: Make MSDS endpoint configurable for HttpRoutingDataReader

Posted by GitBox <gi...@apache.org>.
kaisun2000 commented on a change in pull request #836: Make MSDS endpoint configurable for HttpRoutingDataReader
URL: https://github.com/apache/helix/pull/836#discussion_r388488374
 
 

 ##########
 File path: zookeeper-api/src/main/java/org/apache/helix/zookeeper/util/HttpRoutingDataReader.java
 ##########
 @@ -41,13 +42,17 @@
 
 
 public class HttpRoutingDataReader {
-  private static final String MSDS_ENDPOINT =
+  private static final String SYSTEM_MSDS_ENDPOINT =
       System.getProperty(MetadataStoreRoutingConstants.MSDS_SERVER_ENDPOINT_KEY);
   private static final int HTTP_TIMEOUT_IN_MS = 5000;
 
   /** Double-checked locking requires that the following fields be volatile */
-  private static volatile Map<String, List<String>> _rawRoutingData;
-  private static volatile MetadataStoreRoutingData _metadataStoreRoutingData;
+  // The following map stands for (MSDS endpoint, Raw Routing Data)
+  private static volatile Map<String, Map<String, List<String>>> _rawRoutingDataMap =
+      new HashMap<>();
 
 Review comment:
   This should be concurrentHashMap()

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org