pkuwm commented on a change in pull request #955: Fix MSD routing data
refreshing for update methods
URL: https://github.com/apache/helix/pull/955#discussion_r409031819
##########
File path:
helix-rest/src/test/java/org/apache/helix/rest/metadatastore/TestZkMetadataStoreDirectory.java
##########
@@ -344,6 +345,10 @@ public void testDataDeletionCallback() throws Exception {
+ " contains either empty or invalid routing data!")) {
return false;
}
+ } catch (IllegalArgumentException iae) {
+ if (!iae.getMessage().equals("Provided path is not a valid Zookeeper
path: anyKey")) {
+ return false;
Review comment:
Refreshing routing has a delay. And this is why `TestHelper.verify()` is
used. Before routing is deleted in cached, namespace is still in cache, right?
So the request still goes to TrieRouting, and IllegalArgumentException would be
thrown because `anyKey` is invalid. In this case, we should catch the exception
and retry, right?
The better I think is this. I will update PR.
```
Assert.assertTrue(TestHelper.verify(() -> {
for (String namespace : _routingZkAddrMap.keySet()) {
try {
_metadataStoreDirectory.getMetadataStoreRealm(namespace, "anyKey");
Assert.fail("Should not successfully get routing data");
} catch (IllegalStateException e) {
// If other IllegalStateException, it is unexpected and this test
should fail.
if (!e.getMessage().equals("Failed to get metadata store realm:
Namespace " + namespace
+ " contains either empty or invalid routing data!")) {
throw e;
}
} catch (IllegalArgumentException iae) {
// If routing data is not yet refreshed, return false and retry.
if (iae.getMessage().equals("Provided path is not a valid
Zookeeper path: anyKey")) {
return false;
}
// If other IllegalArgumentException, it is not expected and this
test should fail.
throw iae;
}
}
return true;
}, TestHelper.WAIT_DURATION));
```
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]