[ 
https://issues.apache.org/jira/browse/HDFS-13198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16397256#comment-16397256
 ] 

Íñigo Goiri commented on HDFS-13198:
------------------------------------

Thanks, [~ywskycn] for  [^HDFS-13198.002.patch] .
I would extract the variables in the test to make it more readable, something 
like:
{code}
  @Test
  public void testStateStoreAvailable() throws Exception {
    // The driver is ready
    StateStoreService stateStore = router.getStateStore();
    assertTrue(stateStore.isDriverReady());
    RouterStore routerStore = router.getRouterStateManager();

    // No record about this router
    stateStore.refreshCaches(true);
    GetRouterRegistrationRequest request =
        GetRouterRegistrationRequest.newInstance(routerId);
    GetRouterRegistrationResponse response =
        routerStore.getRouterRegistration(request);
    RouterState routerState = response.getRouter();
    String id = routerState.getRouterId();
    StateStoreVersion version = routerState.getStateStoreVersion();
    assertNull(id);
    assertNull(version);

    // Do a heartbeat
    RouterHeartbeatService heartbeatService =
        new RouterHeartbeatService(router);
    heartbeatService.updateStateStore();

    // We should have a record
    stateStore.refreshCaches(true);
    request = GetRouterRegistrationRequest.newInstance(routerId);
    response = routerStore.getRouterRegistration(request);
    routerState = response.getRouter();
    id = routerState.getRouterId();
    version = routerState.getStateStoreVersion();
    assertNotNull(id);
    assertNotNull(version);
  }
{code}

Other than that, this looks good to me.
+1

> RBF: RouterHeartbeatService throws out CachedStateStore related exceptions 
> when starting router
> -----------------------------------------------------------------------------------------------
>
>                 Key: HDFS-13198
>                 URL: https://issues.apache.org/jira/browse/HDFS-13198
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>            Reporter: Wei Yan
>            Assignee: Wei Yan
>            Priority: Minor
>         Attachments: HDFS-13198.000.patch, HDFS-13198.001.patch, 
> HDFS-13198.002.patch
>
>
> Exception looks like:
> {code:java}
> 2018-02-23 19:04:56,341 ERROR router.RouterHeartbeatService: Cannot get 
> version for class 
> org.apache.hadoop.hdfs.server.federation.store.MembershipStore: Cached State 
> Store not initialized, MembershipState records not valid
> 2018-02-23 19:04:56,341 ERROR router.RouterHeartbeatService: Cannot get 
> version for class 
> org.apache.hadoop.hdfs.server.federation.store.MountTableStore: Cached State 
> Store not initialized, MountTable records not valid
> Exception in thread "Router Heartbeat Async" java.lang.NullPointerException
> at 
> org.apache.hadoop.hdfs.server.federation.store.driver.impl.StateStoreSerializableImpl.serialize(StateStoreSerializableImpl.java:60)
> at 
> org.apache.hadoop.hdfs.server.federation.store.driver.impl.StateStoreZooKeeperImpl.putAll(StateStoreZooKeeperImpl.java:191)
> at 
> org.apache.hadoop.hdfs.server.federation.store.driver.impl.StateStoreBaseImpl.put(StateStoreBaseImpl.java:75)
> at 
> org.apache.hadoop.hdfs.server.federation.store.impl.RouterStoreImpl.routerHeartbeat(RouterStoreImpl.java:88)
> at 
> org.apache.hadoop.hdfs.server.federation.router.RouterHeartbeatService.updateStateStore(RouterHeartbeatService.java:95)
> at 
> org.apache.hadoop.hdfs.server.federation.router.RouterHeartbeatService.access$000(RouterHeartbeatService.java:43)
> at 
> org.apache.hadoop.hdfs.server.federation.router.RouterHeartbeatService$1.run(RouterHeartbeatService.java:68)
> at java.lang.Thread.run(Thread.java:748){code}
> This is because, during starting the Router, the CachedStateStore hasn't been 
> initialized and cannot serve requests. Although the router will still be 
> started, it would be better to fix the exceptions.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to