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/03/18 00:55:55 UTC

[GitHub] [helix] NealSun96 opened a new pull request #902: Nealsun/msds 2nd round manual testing fix

NealSun96 opened a new pull request #902: Nealsun/msds 2nd round manual testing fix
URL: https://github.com/apache/helix/pull/902
 
 
   ### Issues
   
   - [x] My PR addresses the following Helix issues and references them in the PR description:
   
   Fixes #901 
   
   ### Description
   
   - [x] Here are some details about my PR, including screenshots of any UI changes:
   
   3 issues were uncovered by the second round of MetadataStoreDirectory Service manual testing:
   1. `SetRoutingData` does not respect the return value of the underlying function. 
   2. The port of each instance is not considered when forwarding requests, therefore failing all the forwarded requests.
   3. "/admin/v2" is not added when forwarding requests, therefore (would be) failing the forwarded requests. 
   Fixes: return 500 when false; add mechanism to read ports from system configs (just like hostname); add mechanism to read url prefixes from system configs (just like hostname).
   
   ### Tests
   
   - [x] The following is the result of the "mvn test" command on the appropriate module:
   
   ```
   [ERROR] Tests run: 143, Failures: 1, Errors: 0, Skipped: 7, Time elapsed: 26.41 s <<< FAILURE! - in TestSuite
   [ERROR] testResourceHealth(org.apache.helix.rest.server.TestResourceAccessor)  Time elapsed: 0.266 s  <<< FAILURE!
   java.lang.AssertionError: expected:<HEALTHY> but was:<UNHEALTHY>
   	at org.apache.helix.rest.server.TestResourceAccessor.testResourceHealth(TestResourceAccessor.java:289)
   
   [INFO] 
   [INFO] Results:
   [INFO] 
   [ERROR] Failures: 
   [ERROR]   TestResourceAccessor.testResourceHealth:289 expected:<HEALTHY> but was:<UNHEALTHY>
   [INFO] 
   [ERROR] Tests run: 143, Failures: 1, Errors: 0, Skipped: 7
   ```
   
   ### 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] NealSun96 commented on a change in pull request #902: Fix MSDS bugs uncovered by 2nd round of manual testing

Posted by GitBox <gi...@apache.org>.
NealSun96 commented on a change in pull request #902: Fix MSDS bugs uncovered by 2nd round of manual testing
URL: https://github.com/apache/helix/pull/902#discussion_r394055339
 
 

 ##########
 File path: helix-rest/src/main/java/org/apache/helix/rest/metadatastore/accessor/ZkRoutingDataWriter.java
 ##########
 @@ -87,16 +87,18 @@ public ZkRoutingDataWriter(String namespace, String zkAddress) {
 
     // Get the hostname (REST endpoint) from System property
     String hostName = System.getProperty(MetadataStoreRoutingConstants.MSDS_SERVER_HOSTNAME_KEY);
+    String port = System.getProperty(MetadataStoreRoutingConstants.MSDS_SERVER_PORT_KEY);
     if (hostName == null || hostName.isEmpty()) {
       throw new IllegalStateException(
-          "Unable to get the hostname of this server instance. System.getProperty fails to fetch "
+          "Unable to get the hostname of this server instance or the hostname is empty. System.getProperty fails to fetch "
               + MetadataStoreRoutingConstants.MSDS_SERVER_HOSTNAME_KEY + ".");
     }
-    // remove trailing slash
-    if (hostName.charAt(hostName.length() - 1) == '/') {
-      hostName = hostName.substring(0, hostName.length() - 1);
+    if (port == null || port.isEmpty()) {
+      throw new IllegalStateException(
+          "Unable to get the port of this server instance or the port is empty. System.getProperty fails to fetch "
+              + MetadataStoreRoutingConstants.MSDS_SERVER_PORT_KEY + ".");
 
 Review comment:
   Resolved offline. 

----------------------------------------------------------------
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 #902: Fix MSDS bugs uncovered by 2nd round of manual testing

Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #902: Fix MSDS bugs uncovered by 2nd round of manual testing
URL: https://github.com/apache/helix/pull/902#discussion_r394052026
 
 

 ##########
 File path: helix-rest/src/main/java/org/apache/helix/rest/metadatastore/accessor/ZkRoutingDataWriter.java
 ##########
 @@ -87,16 +87,18 @@ public ZkRoutingDataWriter(String namespace, String zkAddress) {
 
     // Get the hostname (REST endpoint) from System property
     String hostName = System.getProperty(MetadataStoreRoutingConstants.MSDS_SERVER_HOSTNAME_KEY);
+    String port = System.getProperty(MetadataStoreRoutingConstants.MSDS_SERVER_PORT_KEY);
     if (hostName == null || hostName.isEmpty()) {
       throw new IllegalStateException(
-          "Unable to get the hostname of this server instance. System.getProperty fails to fetch "
+          "Unable to get the hostname of this server instance or the hostname is empty. System.getProperty fails to fetch "
               + MetadataStoreRoutingConstants.MSDS_SERVER_HOSTNAME_KEY + ".");
     }
-    // remove trailing slash
-    if (hostName.charAt(hostName.length() - 1) == '/') {
-      hostName = hostName.substring(0, hostName.length() - 1);
+    if (port == null || port.isEmpty()) {
+      throw new IllegalStateException(
+          "Unable to get the port of this server instance or the port is empty. System.getProperty fails to fetch "
+              + MetadataStoreRoutingConstants.MSDS_SERVER_PORT_KEY + ".");
 
 Review comment:
   http://webreference.com/html/tutorial2/2.html
   
   Usually port is an optional concept in a URL. Let's not throw an exception. If it's null or empty, we simply don't append it.

----------------------------------------------------------------
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 #902: Fix MSDS bugs uncovered by 2nd round of manual testing

Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #902: Fix MSDS bugs uncovered by 2nd round of manual testing
URL: https://github.com/apache/helix/pull/902#discussion_r394085797
 
 

 ##########
 File path: helix-rest/src/main/java/org/apache/helix/rest/metadatastore/accessor/ZkRoutingDataWriter.java
 ##########
 @@ -59,6 +60,10 @@
   private static final Logger LOG = LoggerFactory.getLogger(ZkRoutingDataWriter.class);
   private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
 
+  private static final String SIMPLE_FIELD_KEY_HOSTNAME = "hostname";
+  private static final String SIMPLE_FIELD_KEY_PORT = "port";
+  private static final String SIMPLE_FIELD_KEY_CONTEXT_URL_PREFIX = "contextUrlPrefix";
 
 Review comment:
   Explain in JavaDoc...

----------------------------------------------------------------
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 #902: Fix MSDS bugs uncovered by 2nd round of manual testing

Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #902: Fix MSDS bugs uncovered by 2nd round of manual testing
URL: https://github.com/apache/helix/pull/902#discussion_r394055573
 
 

 ##########
 File path: helix-rest/src/test/java/org/apache/helix/rest/server/TestMSDAccessorLeaderElection.java
 ##########
 @@ -99,7 +99,9 @@ public void beforeClass() throws Exception {
 
     // Set the new uri to be used in leader election
     System.setProperty(MetadataStoreRoutingConstants.MSDS_SERVER_HOSTNAME_KEY,
-        getBaseUri().getHost() + ":" + newPort);
+        getBaseUri().getHost());
+    System
+        .setProperty(MetadataStoreRoutingConstants.MSDS_SERVER_PORT_KEY, Integer.toString(newPort));
 
 Review comment:
   Do these not need to be cleared after the test?

----------------------------------------------------------------
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] NealSun96 commented on a change in pull request #902: Fix MSDS bugs uncovered by 2nd round of manual testing

Posted by GitBox <gi...@apache.org>.
NealSun96 commented on a change in pull request #902: Fix MSDS bugs uncovered by 2nd round of manual testing
URL: https://github.com/apache/helix/pull/902#discussion_r394072370
 
 

 ##########
 File path: helix-rest/src/main/java/org/apache/helix/rest/metadatastore/accessor/ZkRoutingDataWriter.java
 ##########
 @@ -87,16 +87,18 @@ public ZkRoutingDataWriter(String namespace, String zkAddress) {
 
     // Get the hostname (REST endpoint) from System property
     String hostName = System.getProperty(MetadataStoreRoutingConstants.MSDS_SERVER_HOSTNAME_KEY);
+    String port = System.getProperty(MetadataStoreRoutingConstants.MSDS_SERVER_PORT_KEY);
     if (hostName == null || hostName.isEmpty()) {
       throw new IllegalStateException(
-          "Unable to get the hostname of this server instance. System.getProperty fails to fetch "
+          "Unable to get the hostname of this server instance or the hostname is empty. System.getProperty fails to fetch "
               + MetadataStoreRoutingConstants.MSDS_SERVER_HOSTNAME_KEY + ".");
     }
-    // remove trailing slash
-    if (hostName.charAt(hostName.length() - 1) == '/') {
-      hostName = hostName.substring(0, hostName.length() - 1);
+    if (port == null || port.isEmpty()) {
+      throw new IllegalStateException(
+          "Unable to get the port of this server instance or the port is empty. System.getProperty fails to fetch "
+              + MetadataStoreRoutingConstants.MSDS_SERVER_PORT_KEY + ".");
     }
-    _myHostName = HttpConstants.HTTP_PROTOCOL_PREFIX + hostName;
+    _myHostName = HttpConstants.HTTP_PROTOCOL_PREFIX + hostName + ":" + port;
     ZNRecord myServerInfo = new ZNRecord(_myHostName);
 
 Review comment:
   updated with a znode with 3 fields, as we discussed. 

----------------------------------------------------------------
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 #902: Fix MSDS bugs uncovered by 2nd round of manual testing

Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #902: Fix MSDS bugs uncovered by 2nd round of manual testing
URL: https://github.com/apache/helix/pull/902#discussion_r394055286
 
 

 ##########
 File path: helix-rest/src/main/java/org/apache/helix/rest/metadatastore/accessor/ZkRoutingDataWriter.java
 ##########
 @@ -344,6 +346,11 @@ protected boolean deleteZkShardingKey(String realm, String shardingKey) {
   private String constructUrlSuffix(String... urlParams) {
     List<String> allUrlParameters = new ArrayList<>(
         Arrays.asList(MetadataStoreRoutingConstants.MSDS_NAMESPACES_URL_PREFIX, "/", _namespace));
+    String contextUrlPrefix =
+        System.getProperty(MetadataStoreRoutingConstants.MSDS_CONTEXT_URL_PREFIX_KEY);
+    if (contextUrlPrefix != null && !contextUrlPrefix.isEmpty()) {
+      allUrlParameters.add(0, contextUrlPrefix);
+    }
 
 Review comment:
   Add some JavaDoc explaining what you're doing with examples please? This is one of the things that when you look back at it 6 months from now, you'll have to do some digging around to understand what youre doing. Having a comment with an example would help :)

----------------------------------------------------------------
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] NealSun96 commented on a change in pull request #902: Fix MSDS bugs uncovered by 2nd round of manual testing

Posted by GitBox <gi...@apache.org>.
NealSun96 commented on a change in pull request #902: Fix MSDS bugs uncovered by 2nd round of manual testing
URL: https://github.com/apache/helix/pull/902#discussion_r394451160
 
 

 ##########
 File path: helix-rest/src/main/java/org/apache/helix/rest/metadatastore/accessor/ZkRoutingDataWriter.java
 ##########
 @@ -391,8 +422,8 @@ protected boolean sendRequestToLeader(HttpUriRequest request, int expectedRespon
       }
     } catch (IOException e) {
       LOG.error(
-          "The forwarded request to leader raised an exception. Uri: {} Current hostname: {} Leader hostname: {}",
-          request.getURI(), _myHostName, leaderHostName, e);
+          "The forwarded request to leader raised an exception. Uri: {} Current hostname: {} ",
+          request.getURI(), _myHostName, e);
 
 Review comment:
   Because the leader endpoint is already included in `request.getURI()`. Logging an extra copy is redundant. 

----------------------------------------------------------------
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 #902: Fix MSDS bugs uncovered by 2nd round of manual testing

Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #902: Fix MSDS bugs uncovered by 2nd round of manual testing
URL: https://github.com/apache/helix/pull/902#discussion_r394085797
 
 

 ##########
 File path: helix-rest/src/main/java/org/apache/helix/rest/metadatastore/accessor/ZkRoutingDataWriter.java
 ##########
 @@ -59,6 +60,10 @@
   private static final Logger LOG = LoggerFactory.getLogger(ZkRoutingDataWriter.class);
   private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
 
+  private static final String SIMPLE_FIELD_KEY_HOSTNAME = "hostname";
+  private static final String SIMPLE_FIELD_KEY_PORT = "port";
+  private static final String SIMPLE_FIELD_KEY_CONTEXT_URL_PREFIX = "contextUrlPrefix";
 
 Review comment:
   I seem to be repeating this quite a bit, but explain in JavaDoc with a specific example so there's more context?

----------------------------------------------------------------
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 #902: Fix MSDS bugs uncovered by 2nd round of manual testing

Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #902: Fix MSDS bugs uncovered by 2nd round of manual testing
URL: https://github.com/apache/helix/pull/902#discussion_r394085797
 
 

 ##########
 File path: helix-rest/src/main/java/org/apache/helix/rest/metadatastore/accessor/ZkRoutingDataWriter.java
 ##########
 @@ -59,6 +60,10 @@
   private static final Logger LOG = LoggerFactory.getLogger(ZkRoutingDataWriter.class);
   private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
 
+  private static final String SIMPLE_FIELD_KEY_HOSTNAME = "hostname";
+  private static final String SIMPLE_FIELD_KEY_PORT = "port";
+  private static final String SIMPLE_FIELD_KEY_CONTEXT_URL_PREFIX = "contextUrlPrefix";
 
 Review comment:
   I seem to be repeating this quite a bit, but explain in JavaDoc with a specific example so there's more context?

----------------------------------------------------------------
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] NealSun96 commented on a change in pull request #902: Fix MSDS bugs uncovered by 2nd round of manual testing

Posted by GitBox <gi...@apache.org>.
NealSun96 commented on a change in pull request #902: Fix MSDS bugs uncovered by 2nd round of manual testing
URL: https://github.com/apache/helix/pull/902#discussion_r394451471
 
 

 ##########
 File path: helix-rest/src/main/java/org/apache/helix/rest/metadatastore/accessor/ZkRoutingDataWriter.java
 ##########
 @@ -89,15 +94,27 @@ public ZkRoutingDataWriter(String namespace, String zkAddress) {
     String hostName = System.getProperty(MetadataStoreRoutingConstants.MSDS_SERVER_HOSTNAME_KEY);
     if (hostName == null || hostName.isEmpty()) {
       throw new IllegalStateException(
-          "Unable to get the hostname of this server instance. System.getProperty fails to fetch "
+          "Unable to get the hostname of this server instance or the hostname is empty. System.getProperty fails to fetch "
 
 Review comment:
   Ok. 

----------------------------------------------------------------
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 #902: Fix MSDS bugs uncovered by 2nd round of manual testing

Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #902: Fix MSDS bugs uncovered by 2nd round of manual testing
URL: https://github.com/apache/helix/pull/902#discussion_r394054340
 
 

 ##########
 File path: helix-rest/src/main/java/org/apache/helix/rest/metadatastore/accessor/ZkRoutingDataWriter.java
 ##########
 @@ -87,16 +87,18 @@ public ZkRoutingDataWriter(String namespace, String zkAddress) {
 
     // Get the hostname (REST endpoint) from System property
     String hostName = System.getProperty(MetadataStoreRoutingConstants.MSDS_SERVER_HOSTNAME_KEY);
+    String port = System.getProperty(MetadataStoreRoutingConstants.MSDS_SERVER_PORT_KEY);
     if (hostName == null || hostName.isEmpty()) {
       throw new IllegalStateException(
-          "Unable to get the hostname of this server instance. System.getProperty fails to fetch "
+          "Unable to get the hostname of this server instance or the hostname is empty. System.getProperty fails to fetch "
               + MetadataStoreRoutingConstants.MSDS_SERVER_HOSTNAME_KEY + ".");
     }
-    // remove trailing slash
-    if (hostName.charAt(hostName.length() - 1) == '/') {
-      hostName = hostName.substring(0, hostName.length() - 1);
+    if (port == null || port.isEmpty()) {
+      throw new IllegalStateException(
+          "Unable to get the port of this server instance or the port is empty. System.getProperty fails to fetch "
+              + MetadataStoreRoutingConstants.MSDS_SERVER_PORT_KEY + ".");
     }
-    _myHostName = HttpConstants.HTTP_PROTOCOL_PREFIX + hostName;
+    _myHostName = HttpConstants.HTTP_PROTOCOL_PREFIX + hostName + ":" + port;
     ZNRecord myServerInfo = new ZNRecord(_myHostName);
 
 Review comment:
   Using a vanilla hostname would be enough here. Let's create a ZNRecord with two simple fields added: hostname and port?

----------------------------------------------------------------
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 #902: Fix setRoutingData boolean handling; fix leader forwarding url construction

Posted by GitBox <gi...@apache.org>.
narendly merged pull request #902: Fix setRoutingData boolean handling; fix leader forwarding url construction
URL: https://github.com/apache/helix/pull/902
 
 
   

----------------------------------------------------------------
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 #902: Fix MSDS bugs uncovered by 2nd round of manual testing

Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #902: Fix MSDS bugs uncovered by 2nd round of manual testing
URL: https://github.com/apache/helix/pull/902#discussion_r394118522
 
 

 ##########
 File path: helix-rest/src/main/java/org/apache/helix/rest/metadatastore/accessor/ZkRoutingDataWriter.java
 ##########
 @@ -89,15 +94,27 @@ public ZkRoutingDataWriter(String namespace, String zkAddress) {
     String hostName = System.getProperty(MetadataStoreRoutingConstants.MSDS_SERVER_HOSTNAME_KEY);
     if (hostName == null || hostName.isEmpty()) {
       throw new IllegalStateException(
-          "Unable to get the hostname of this server instance. System.getProperty fails to fetch "
+          "Unable to get the hostname of this server instance or the hostname is empty. System.getProperty fails to fetch "
 
 Review comment:
   "Host name is not set or is empty" would be better.

----------------------------------------------------------------
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] NealSun96 commented on a change in pull request #902: Fix MSDS bugs uncovered by 2nd round of manual testing

Posted by GitBox <gi...@apache.org>.
NealSun96 commented on a change in pull request #902: Fix MSDS bugs uncovered by 2nd round of manual testing
URL: https://github.com/apache/helix/pull/902#discussion_r394055555
 
 

 ##########
 File path: helix-rest/src/main/java/org/apache/helix/rest/server/resources/metadatastore/MetadataStoreDirectoryAccessor.java
 ##########
 @@ -235,7 +235,9 @@ public Response setRoutingData(String jsonContent) {
       Map<String, List<String>> routingData =
           OBJECT_MAPPER.readValue(jsonContent, new TypeReference<HashMap<String, List<String>>>() {
           });
-      _metadataStoreDirectory.setNamespaceRoutingData(_namespace, routingData);
+      if (!_metadataStoreDirectory.setNamespaceRoutingData(_namespace, routingData)) {
+        return serverError();
+      }
 
 Review comment:
   One of the issues I found out: `SetRoutingData` does not respect the return value of the underlying function. 

----------------------------------------------------------------
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 #902: Fix MSDS bugs uncovered by 2nd round of manual testing

Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #902: Fix MSDS bugs uncovered by 2nd round of manual testing
URL: https://github.com/apache/helix/pull/902#discussion_r394055395
 
 

 ##########
 File path: helix-rest/src/main/java/org/apache/helix/rest/server/resources/metadatastore/MetadataStoreDirectoryAccessor.java
 ##########
 @@ -235,7 +235,9 @@ public Response setRoutingData(String jsonContent) {
       Map<String, List<String>> routingData =
           OBJECT_MAPPER.readValue(jsonContent, new TypeReference<HashMap<String, List<String>>>() {
           });
-      _metadataStoreDirectory.setNamespaceRoutingData(_namespace, routingData);
+      if (!_metadataStoreDirectory.setNamespaceRoutingData(_namespace, routingData)) {
+        return serverError();
+      }
 
 Review comment:
   Why was this change needed? 

----------------------------------------------------------------
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] NealSun96 commented on a change in pull request #902: Fix MSDS bugs uncovered by 2nd round of manual testing

Posted by GitBox <gi...@apache.org>.
NealSun96 commented on a change in pull request #902: Fix MSDS bugs uncovered by 2nd round of manual testing
URL: https://github.com/apache/helix/pull/902#discussion_r394055467
 
 

 ##########
 File path: helix-rest/src/main/java/org/apache/helix/rest/metadatastore/accessor/ZkRoutingDataWriter.java
 ##########
 @@ -344,6 +346,11 @@ protected boolean deleteZkShardingKey(String realm, String shardingKey) {
   private String constructUrlSuffix(String... urlParams) {
     List<String> allUrlParameters = new ArrayList<>(
         Arrays.asList(MetadataStoreRoutingConstants.MSDS_NAMESPACES_URL_PREFIX, "/", _namespace));
+    String contextUrlPrefix =
+        System.getProperty(MetadataStoreRoutingConstants.MSDS_CONTEXT_URL_PREFIX_KEY);
+    if (contextUrlPrefix != null && !contextUrlPrefix.isEmpty()) {
+      allUrlParameters.add(0, contextUrlPrefix);
+    }
 
 Review comment:
   Sure thing. 

----------------------------------------------------------------
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 #902: Fix MSDS bugs uncovered by 2nd round of manual testing

Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #902: Fix MSDS bugs uncovered by 2nd round of manual testing
URL: https://github.com/apache/helix/pull/902#discussion_r394118092
 
 

 ##########
 File path: helix-rest/src/main/java/org/apache/helix/rest/metadatastore/accessor/ZkRoutingDataWriter.java
 ##########
 @@ -391,8 +422,8 @@ protected boolean sendRequestToLeader(HttpUriRequest request, int expectedRespon
       }
     } catch (IOException e) {
       LOG.error(
-          "The forwarded request to leader raised an exception. Uri: {} Current hostname: {} Leader hostname: {}",
-          request.getURI(), _myHostName, leaderHostName, e);
+          "The forwarded request to leader raised an exception. Uri: {} Current hostname: {} ",
+          request.getURI(), _myHostName, e);
 
 Review comment:
   Why is leader's host name removed? This was very useful information in debugging.

----------------------------------------------------------------
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] NealSun96 commented on issue #902: Fix setRoutingData boolean handling; fix leader forwarding url construction

Posted by GitBox <gi...@apache.org>.
NealSun96 commented on issue #902: Fix setRoutingData boolean handling; fix leader forwarding url construction
URL: https://github.com/apache/helix/pull/902#issuecomment-600748661
 
 
   This PR is ready to be merged, approved by @narendly  
   Final commit message:
   ## Fix setRoutingData boolean handling; fix leader forwarding url construction ##
   This PR makes SetRoutingData respect the return value of the underlying function; it also fixes request forwarding urls, allowing ports and endpoint prefixes to be added. 

----------------------------------------------------------------
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] NealSun96 commented on a change in pull request #902: Fix MSDS bugs uncovered by 2nd round of manual testing

Posted by GitBox <gi...@apache.org>.
NealSun96 commented on a change in pull request #902: Fix MSDS bugs uncovered by 2nd round of manual testing
URL: https://github.com/apache/helix/pull/902#discussion_r394056585
 
 

 ##########
 File path: helix-rest/src/test/java/org/apache/helix/rest/server/TestMSDAccessorLeaderElection.java
 ##########
 @@ -99,7 +99,9 @@ public void beforeClass() throws Exception {
 
     // Set the new uri to be used in leader election
     System.setProperty(MetadataStoreRoutingConstants.MSDS_SERVER_HOSTNAME_KEY,
-        getBaseUri().getHost() + ":" + newPort);
+        getBaseUri().getHost());
+    System
+        .setProperty(MetadataStoreRoutingConstants.MSDS_SERVER_PORT_KEY, Integer.toString(newPort));
 
 Review comment:
   Nope, the test base it extends clears up the system properties. These 2 lines are overwriting the old properties set by the test base, and the test base cleans up after itself. 

----------------------------------------------------------------
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