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/08/12 04:43:26 UTC

[GitHub] [helix] kaisun2000 opened a new issue #1254: Fix flaky TestRoutingDataCache due to test method order issue

kaisun2000 opened a new issue #1254:
URL: https://github.com/apache/helix/issues/1254


   If testCurrentStatesSelectiveUpdate() runs before testUpdateOnNotification() and then testSelectiveUpdates(). testSelectiveUpdates() would fail.
   
   The reason is that testCurrentStatesSelectiveUpdate() stop one participant.  Thus the code in testSelectiveUpdate() constructing RoutingDataCache, the external view of "TestDb" would be version 1. Later, `_gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, "TestDB_1", _replica);` is invoked, controller would calculate best possible again. This would write TestDb external view to version 2. Thus, `Assert.assertEquals(accessor.getReadCount(PropertyType.EXTERNALVIEW),` would fail due to version 2 not match existing version 1 in the cache. 
   
   We need to ensure testCurrentStatesSelectiveUpdate always run later.
   
   ```
     public void testSelectiveUpdates()
         throws Exception {
       MockZkHelixDataAccessor accessor =
           new MockZkHelixDataAccessor(CLUSTER_NAME, new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
   
       RoutingDataCache cache =
           new RoutingDataCache("CLUSTER_" + TestHelper.getTestClassName(), PropertyType.EXTERNALVIEW);
       cache.refresh(accessor);
       Assert.assertEquals(accessor.getReadCount(PropertyType.EXTERNALVIEW), 1);
   
       accessor.clearReadCounters();
   
       // refresh again should read nothing
       cache.refresh(accessor);
       Assert.assertEquals(accessor.getReadCount(PropertyType.EXTERNALVIEW), 0);
   
       // refresh again should read nothing
       cache.notifyDataChange(HelixConstants.ChangeType.EXTERNAL_VIEW);
       cache.refresh(accessor);
       Assert.assertEquals(accessor.getReadCount(PropertyType.EXTERNALVIEW), 0);
   
       // add new resources
       _gSetupTool.addResourceToCluster(CLUSTER_NAME, "TestDB_1", 1, STATE_MODEL);
       _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, "TestDB_1", _replica);
   
       Thread.sleep(100);
       ZkHelixClusterVerifier _clusterVerifier =
           new BestPossibleExternalViewVerifier.Builder(CLUSTER_NAME).setZkClient(_gZkClient).build();
       Assert.assertTrue(_clusterVerifier.verifyByPolling());
   
       accessor.clearReadCounters();
   
       // refresh again should read only new current states and new idealstate
       cache.notifyDataChange(HelixConstants.ChangeType.EXTERNAL_VIEW);
       cache.refresh(accessor);
       Assert.assertEquals(accessor.getReadCount(PropertyType.EXTERNALVIEW),
   
   ```
   


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



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


[GitHub] [helix] jiajunwang closed issue #1254: Fix flaky TestRoutingDataCache due to test method order issue

Posted by GitBox <gi...@apache.org>.
jiajunwang closed issue #1254:
URL: https://github.com/apache/helix/issues/1254


   


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



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


[GitHub] [helix] kaisun2000 commented on issue #1254: Fix flaky TestRoutingDataCache due to test method order issue

Posted by GitBox <gi...@apache.org>.
kaisun2000 commented on issue #1254:
URL: https://github.com/apache/helix/issues/1254#issuecomment-672618684


   Actually, the best practice seems to be at the beginning of the test, add `Assert.assertTrue(_clusterVerifier.verifyByPolling())`. Namely let the test be in a known stable state before starting. 


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



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