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/04/07 16:29:24 UTC

[GitHub] [helix] NealSun96 opened a new pull request #933: Fix MetadataStoreDirectory routing data cache refresh bug

NealSun96 opened a new pull request #933: Fix MetadataStoreDirectory routing data cache refresh bug
URL: https://github.com/apache/helix/pull/933
 
 
   ### Issues
   
   - [x] My PR addresses the following Helix issues and references them in the PR description:
   
   Fixes #927 
   
   ### Description
   
   - [x] Here are some details about my PR, including screenshots of any UI changes:
   
   This PR fixes the MetadataStoreDirectory routing data cache refresh bug. In `ZkMetadataStoreDirectory`, it is now ensured that routing data cache is cleared before updating; when an exception is raised, the old data is still erased correctly. 
   
   Also, this PR fixes an edge case during `TrieRoutingData` creation. When there are zkRealms defined without a single sharding key, `TrieRoutingData` now correctly identifies the raw routing data as invalid and raise an exception. 
   
   ### Tests
   
   - [x] The following is the result of the "mvn test" command on the appropriate module:
   
   ```
   [ERROR] Tests run: 145, Failures: 1, Errors: 0, Skipped: 7, Time elapsed: 28.895 s <<< FAILURE! - in TestSuite
   [ERROR] testResourceHealth(org.apache.helix.rest.server.TestResourceAccessor)  Time elapsed: 0.295 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: 145, Failures: 1, Errors: 0, Skipped: 7
   [INFO] 
   [INFO] ------------------------------------------------------------------------
   [INFO] BUILD FAILURE
   [INFO] ------------------------------------------------------------------------
   [INFO] Total time:  33.443 s
   [INFO] Finished at: 2020-04-03T13:47:22-07: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 #933: Fix MetadataStoreDirectory routing data cache refresh bug

Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #933: Fix MetadataStoreDirectory routing data cache refresh bug
URL: https://github.com/apache/helix/pull/933#discussion_r404962895
 
 

 ##########
 File path: metadata-store-directory-common/src/main/java/org/apache/helix/msdcommon/datamodel/TrieRoutingData.java
 ##########
 @@ -48,6 +48,10 @@ public TrieRoutingData(Map<String, List<String>> routingData)
       throw new InvalidRoutingDataException("routingData cannot be null or empty");
     }
 
+    if (!containsShardingKey(routingData)) {
+      throw new InvalidRoutingDataException("routingData needs at least 1 sharding key");
+    }
 
 Review comment:
   Explain why this should be invalid? I thought we agreed that it's acceptable to have a realm without any keys.

----------------------------------------------------------------
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 #933: Fix MetadataStoreDirectory routing data cache refresh bug

Posted by GitBox <gi...@apache.org>.
NealSun96 commented on a change in pull request #933: Fix MetadataStoreDirectory routing data cache refresh bug
URL: https://github.com/apache/helix/pull/933#discussion_r405031963
 
 

 ##########
 File path: metadata-store-directory-common/src/main/java/org/apache/helix/msdcommon/datamodel/TrieRoutingData.java
 ##########
 @@ -48,6 +48,10 @@ public TrieRoutingData(Map<String, List<String>> routingData)
       throw new InvalidRoutingDataException("routingData cannot be null or empty");
     }
 
+    if (!containsShardingKey(routingData)) {
+      throw new InvalidRoutingDataException("routingData needs at least 1 sharding key");
+    }
 
 Review comment:
   We agreed that it's okay for some realms to not have keys (which is handled correctly by skipping them), but not when **all** realms have no keys. The design of `TrieRoutingData` is "a set of data with routing capability", therefore empty routing data shouldn't be created; a group of realms with 0 key doesn't have routing capability either. 
   In that situation, the current `TrieRoutingData` will create a structure in an erroneous state. The promise of `TrieRoutingData` is to contain at least 1 sharding key; with 0 sharding keys, some functionality will break. For example, `isShardingKeyInsertionValid("/")` called on a `TrieRoutingData` with 0 sharding key will return false, even though it should be true. 

----------------------------------------------------------------
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 #933: Fix MetadataStoreDirectory routing data cache refresh bug

Posted by GitBox <gi...@apache.org>.
NealSun96 commented on a change in pull request #933: Fix MetadataStoreDirectory routing data cache refresh bug
URL: https://github.com/apache/helix/pull/933#discussion_r405079867
 
 

 ##########
 File path: metadata-store-directory-common/src/main/java/org/apache/helix/msdcommon/datamodel/TrieRoutingData.java
 ##########
 @@ -48,6 +48,10 @@ public TrieRoutingData(Map<String, List<String>> routingData)
       throw new InvalidRoutingDataException("routingData cannot be null or empty");
     }
 
+    if (!containsShardingKey(routingData)) {
+      throw new InvalidRoutingDataException("routingData needs at least 1 sharding key");
+    }
 
 Review comment:
   Yes. The focus should be on "is there a sharding key". Without any sharding key the routing data is definitely invalid; with at least one it is valid. 

----------------------------------------------------------------
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 #933: Fix MetadataStoreDirectory routing data cache refresh bug

Posted by GitBox <gi...@apache.org>.
NealSun96 commented on a change in pull request #933: Fix MetadataStoreDirectory routing data cache refresh bug
URL: https://github.com/apache/helix/pull/933#discussion_r405031963
 
 

 ##########
 File path: metadata-store-directory-common/src/main/java/org/apache/helix/msdcommon/datamodel/TrieRoutingData.java
 ##########
 @@ -48,6 +48,10 @@ public TrieRoutingData(Map<String, List<String>> routingData)
       throw new InvalidRoutingDataException("routingData cannot be null or empty");
     }
 
+    if (!containsShardingKey(routingData)) {
+      throw new InvalidRoutingDataException("routingData needs at least 1 sharding key");
+    }
 
 Review comment:
   We agreed that it's okay for some realms to not have keys (which is handled correctly by skipping them), but not when **all** realms have no keys. The design of `TrieRoutingData` is "a set of data with routing capability", therefore empty routing data shouldn't be created; a group of realms with 0 key doesn't have routing capability either. When the `TrieRoutingData` doesn't have routing capability, we don't create it. 
   In the situation with 0 sharding keys but some realms, the current `TrieRoutingData` will create a structure in an erroneous state. For example, `isShardingKeyInsertionValid("/")` called on a `TrieRoutingData` with 0 sharding key will return false, even though it should be true. 

----------------------------------------------------------------
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 #933: Fix MetadataStoreDirectory routing data cache refresh bug

Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #933: Fix MetadataStoreDirectory routing data cache refresh bug
URL: https://github.com/apache/helix/pull/933#discussion_r404961093
 
 

 ##########
 File path: helix-rest/src/main/java/org/apache/helix/rest/metadatastore/ZkMetadataStoreDirectory.java
 ##########
 @@ -322,14 +322,19 @@ public void refreshRoutingData(String namespace) {
     }
 
     Map<String, List<String>> rawRoutingData;
+    // Remove the raw data first in case of failure on creation
+    _realmToShardingKeysMap.remove(namespace);
     try {
       rawRoutingData = _routingDataReaderMap.get(namespace).getRoutingData();
       _realmToShardingKeysMap.put(namespace, rawRoutingData);
     } catch (InvalidRoutingDataException e) {
+      _routingDataMap.remove(namespace);
       LOG.error("Failed to refresh cached routing data for namespace {}", namespace, e);
       return;
     }
 
+    // Remove routing data first in case of failure on creation
+    _routingDataMap.remove(namespace);
 
 Review comment:
   Why don't you just put `_routingDataMap.remove(namespace);` up there next to `_realmToShardingKeysMap.remove(namespace);`?
   
   Why is there a need for this duplicate code? routingDataMap entry should be cleared anyway prior to update, right?

----------------------------------------------------------------
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 #933: Fix MetadataStoreDirectory routing data cache refresh bug

Posted by GitBox <gi...@apache.org>.
NealSun96 commented on a change in pull request #933: Fix MetadataStoreDirectory routing data cache refresh bug
URL: https://github.com/apache/helix/pull/933#discussion_r405031963
 
 

 ##########
 File path: metadata-store-directory-common/src/main/java/org/apache/helix/msdcommon/datamodel/TrieRoutingData.java
 ##########
 @@ -48,6 +48,10 @@ public TrieRoutingData(Map<String, List<String>> routingData)
       throw new InvalidRoutingDataException("routingData cannot be null or empty");
     }
 
+    if (!containsShardingKey(routingData)) {
+      throw new InvalidRoutingDataException("routingData needs at least 1 sharding key");
+    }
 
 Review comment:
   We agreed that it's okay for some realms to not have keys (which is handled correctly by skipping them), but not when **all** realms have no keys. The design of `TrieRoutingData` is "a set of data with routing capability", therefore empty routing data shouldn't be created; a group of realms with 0 key doesn't have routing capability either. When the `TrieRoutingData` doesn't have routing capability, we don't create it. 
   In the situation with 0 sharding keys but some realms, the current `TrieRoutingData` will create a structure in an erroneous state. The promise of `TrieRoutingData` is to contain at least 1 sharding key; with 0 sharding keys, some functionality will break. For example, `isShardingKeyInsertionValid("/")` called on a `TrieRoutingData` with 0 sharding key will return false, even though it should be true. 

----------------------------------------------------------------
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 #933: Fix MetadataStoreDirectory routing data cache refresh bug

Posted by GitBox <gi...@apache.org>.
NealSun96 commented on a change in pull request #933: Fix MetadataStoreDirectory routing data cache refresh bug
URL: https://github.com/apache/helix/pull/933#discussion_r404951028
 
 

 ##########
 File path: helix-rest/src/main/java/org/apache/helix/rest/metadatastore/ZkMetadataStoreDirectory.java
 ##########
 @@ -322,14 +322,19 @@ public void refreshRoutingData(String namespace) {
     }
 
     Map<String, List<String>> rawRoutingData;
+    // Remove the raw data first in case of failure on creation
+    _realmToShardingKeysMap.remove(namespace);
 
 Review comment:
   **NOTE**: This check is added for the case when "METADATA_STORE_ROUTING_DATA" is deleted. 
   There is one edge case that's *not* handled: when "METADATA_STORE_ROUTING_DATA" contains no node, and then "METADATA_STORE_ROUTING_DATA" gets deleted. In that case, before deletion, the routing data should be empty; after deletion, the routing data should return 404 due to missing namespace. However, since there is no listener on "METADATA_STORE_ROUTING_DATA" itself, its deletion event cannot be handled. Please share you thoughts on whether this edge case should be handled, or if you think this falls into misuse. 

----------------------------------------------------------------
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 #933: Fix MetadataStoreDirectory routing data cache refresh bug

Posted by GitBox <gi...@apache.org>.
NealSun96 commented on a change in pull request #933: Fix MetadataStoreDirectory routing data cache refresh bug
URL: https://github.com/apache/helix/pull/933#discussion_r404951028
 
 

 ##########
 File path: helix-rest/src/main/java/org/apache/helix/rest/metadatastore/ZkMetadataStoreDirectory.java
 ##########
 @@ -322,14 +322,19 @@ public void refreshRoutingData(String namespace) {
     }
 
     Map<String, List<String>> rawRoutingData;
+    // Remove the raw data first in case of failure on creation
+    _realmToShardingKeysMap.remove(namespace);
 
 Review comment:
   **NOTE**: This check is added for the case when "METADATA_STORE_ROUTING_DATA" is deleted. 
   
   There is one edge case that's **not** handled: when "METADATA_STORE_ROUTING_DATA" contains no node, and then "METADATA_STORE_ROUTING_DATA" gets deleted. In that case, before deletion, the routing data should be empty; after deletion, the routing data should return 404 due to missing namespace. However, since there is no listener on "METADATA_STORE_ROUTING_DATA" itself, its deletion event cannot be handled. Please share you thoughts on whether this edge case should be handled, or if you think this falls into misuse. 

----------------------------------------------------------------
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 #933: Fix MetadataStoreDirectory routing data cache refresh bug

Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #933: Fix MetadataStoreDirectory routing data cache refresh bug
URL: https://github.com/apache/helix/pull/933#discussion_r404958901
 
 

 ##########
 File path: helix-rest/src/main/java/org/apache/helix/rest/metadatastore/ZkMetadataStoreDirectory.java
 ##########
 @@ -322,14 +322,19 @@ public void refreshRoutingData(String namespace) {
     }
 
     Map<String, List<String>> rawRoutingData;
+    // Remove the raw data first in case of failure on creation
+    _realmToShardingKeysMap.remove(namespace);
 
 Review comment:
   I don't think you need to worry about the case you're describing. MSD makes the assumption that the root path already exists.

----------------------------------------------------------------
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 #933: Fix MetadataStoreDirectory routing data cache refresh bug

Posted by GitBox <gi...@apache.org>.
NealSun96 commented on a change in pull request #933: Fix MetadataStoreDirectory routing data cache refresh bug
URL: https://github.com/apache/helix/pull/933#discussion_r405079867
 
 

 ##########
 File path: metadata-store-directory-common/src/main/java/org/apache/helix/msdcommon/datamodel/TrieRoutingData.java
 ##########
 @@ -48,6 +48,10 @@ public TrieRoutingData(Map<String, List<String>> routingData)
       throw new InvalidRoutingDataException("routingData cannot be null or empty");
     }
 
+    if (!containsShardingKey(routingData)) {
+      throw new InvalidRoutingDataException("routingData needs at least 1 sharding key");
+    }
 
 Review comment:
   Yes. The focus should be on "is there a sharding key". Without any sharding key the routing data is definitely invalid; with at least one it is valid (as long as no key conflict, etc.). 

----------------------------------------------------------------
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 #933: Fix MetadataStoreDirectory routing data cache refresh bug

Posted by GitBox <gi...@apache.org>.
narendly merged pull request #933: Fix MetadataStoreDirectory routing data cache refresh bug
URL: https://github.com/apache/helix/pull/933
 
 
   

----------------------------------------------------------------
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 #933: Fix MetadataStoreDirectory routing data cache refresh bug

Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #933: Fix MetadataStoreDirectory routing data cache refresh bug
URL: https://github.com/apache/helix/pull/933#discussion_r405090513
 
 

 ##########
 File path: metadata-store-directory-common/src/main/java/org/apache/helix/msdcommon/datamodel/TrieRoutingData.java
 ##########
 @@ -48,6 +48,10 @@ public TrieRoutingData(Map<String, List<String>> routingData)
       throw new InvalidRoutingDataException("routingData cannot be null or empty");
     }
 
+    if (!containsShardingKey(routingData)) {
+      throw new InvalidRoutingDataException("routingData needs at least 1 sharding key");
+    }
 
 Review comment:
   Also what would happen if a user initially creates N realms with keys, and ends up deleting all keys for the N realms? What happens when the user tries to delete the last remaining key?

----------------------------------------------------------------
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 #933: Fix MetadataStoreDirectory routing data cache refresh bug

Posted by GitBox <gi...@apache.org>.
NealSun96 commented on a change in pull request #933: Fix MetadataStoreDirectory routing data cache refresh bug
URL: https://github.com/apache/helix/pull/933#discussion_r405098757
 
 

 ##########
 File path: metadata-store-directory-common/src/main/java/org/apache/helix/msdcommon/datamodel/TrieRoutingData.java
 ##########
 @@ -48,6 +48,10 @@ public TrieRoutingData(Map<String, List<String>> routingData)
       throw new InvalidRoutingDataException("routingData cannot be null or empty");
     }
 
+    if (!containsShardingKey(routingData)) {
+      throw new InvalidRoutingDataException("routingData needs at least 1 sharding key");
+    }
 
 Review comment:
   In my user manual I have briefly talked about invalid routing data. I will expand some sections for that. 
   In terms of your second question, the refresh logic will trigger and `TrieRoutingData` will be removed from MSD when the last key is deleted, similar to how when the user deletes all routing data, `TrieRoutingData` is removed. Note that the raw routing data is not removed because the realms are still there. Also a reminder, when we don't have `TrieRoutingData`, the accessor behaves correctly. 

----------------------------------------------------------------
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 #933: Fix MetadataStoreDirectory routing data cache refresh bug

Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #933: Fix MetadataStoreDirectory routing data cache refresh bug
URL: https://github.com/apache/helix/pull/933#discussion_r405064160
 
 

 ##########
 File path: metadata-store-directory-common/src/main/java/org/apache/helix/msdcommon/datamodel/TrieRoutingData.java
 ##########
 @@ -48,6 +48,10 @@ public TrieRoutingData(Map<String, List<String>> routingData)
       throw new InvalidRoutingDataException("routingData cannot be null or empty");
     }
 
+    if (!containsShardingKey(routingData)) {
+      throw new InvalidRoutingDataException("routingData needs at least 1 sharding key");
+    }
 
 Review comment:
   So it's okay to have a bunch of realms with no keys as long as we have some realm with a key?

----------------------------------------------------------------
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 #933: Fix MetadataStoreDirectory routing data cache refresh bug

Posted by GitBox <gi...@apache.org>.
NealSun96 commented on a change in pull request #933: Fix MetadataStoreDirectory routing data cache refresh bug
URL: https://github.com/apache/helix/pull/933#discussion_r404951028
 
 

 ##########
 File path: helix-rest/src/main/java/org/apache/helix/rest/metadatastore/ZkMetadataStoreDirectory.java
 ##########
 @@ -322,14 +322,19 @@ public void refreshRoutingData(String namespace) {
     }
 
     Map<String, List<String>> rawRoutingData;
+    // Remove the raw data first in case of failure on creation
+    _realmToShardingKeysMap.remove(namespace);
 
 Review comment:
   **NOTE**: This check is added for the case when "METADATA_STORE_ROUTING_DATA" is deleted. 
   
   There is one edge case that's **not** handled: when "METADATA_STORE_ROUTING_DATA" contains no node, and then "METADATA_STORE_ROUTING_DATA" gets deleted. 
   In that case, before deletion, the routing data should be empty; after deletion, the routing data should return 404 due to missing namespace. However, since there is no listener on "METADATA_STORE_ROUTING_DATA" itself, its deletion event cannot be handled. Please share you thoughts on whether this edge case should be handled, or if you think this falls into misuse. 

----------------------------------------------------------------
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 #933: Fix MetadataStoreDirectory routing data cache refresh bug

Posted by GitBox <gi...@apache.org>.
NealSun96 commented on a change in pull request #933: Fix MetadataStoreDirectory routing data cache refresh bug
URL: https://github.com/apache/helix/pull/933#discussion_r405023861
 
 

 ##########
 File path: helix-rest/src/main/java/org/apache/helix/rest/metadatastore/ZkMetadataStoreDirectory.java
 ##########
 @@ -322,14 +322,19 @@ public void refreshRoutingData(String namespace) {
     }
 
     Map<String, List<String>> rawRoutingData;
+    // Remove the raw data first in case of failure on creation
+    _realmToShardingKeysMap.remove(namespace);
     try {
       rawRoutingData = _routingDataReaderMap.get(namespace).getRoutingData();
       _realmToShardingKeysMap.put(namespace, rawRoutingData);
     } catch (InvalidRoutingDataException e) {
+      _routingDataMap.remove(namespace);
       LOG.error("Failed to refresh cached routing data for namespace {}", namespace, e);
       return;
     }
 
+    // Remove routing data first in case of failure on creation
+    _routingDataMap.remove(namespace);
 
 Review comment:
   Makes sense, let me change that. 

----------------------------------------------------------------
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 #933: Fix MetadataStoreDirectory routing data cache refresh bug

Posted by GitBox <gi...@apache.org>.
NealSun96 commented on issue #933: Fix MetadataStoreDirectory routing data cache refresh bug
URL: https://github.com/apache/helix/pull/933#issuecomment-610687487
 
 
   This PR is ready to be merged, approved by @narendly  
   Final commit message:
   ## Fix MetadataStoreDirectory routing data cache refresh bug ##
   This PR ensures that routing data cache is cleared before updating in ZkMetadataStoreDirectory. Also, this PR fixes an edge case during TrieRoutingData creation when no zk realms has any sharding key. 

----------------------------------------------------------------
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 #933: Fix MetadataStoreDirectory routing data cache refresh bug

Posted by GitBox <gi...@apache.org>.
narendly commented on a change in pull request #933: Fix MetadataStoreDirectory routing data cache refresh bug
URL: https://github.com/apache/helix/pull/933#discussion_r405089840
 
 

 ##########
 File path: metadata-store-directory-common/src/main/java/org/apache/helix/msdcommon/datamodel/TrieRoutingData.java
 ##########
 @@ -48,6 +48,10 @@ public TrieRoutingData(Map<String, List<String>> routingData)
       throw new InvalidRoutingDataException("routingData cannot be null or empty");
     }
 
+    if (!containsShardingKey(routingData)) {
+      throw new InvalidRoutingDataException("routingData needs at least 1 sharding key");
+    }
 
 Review comment:
   Okay. Is this clear in our documentation, both in code and user manual? We need to document this behavior so it's crystal clear to anyone that looks at this code.

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