[ https://issues.apache.org/jira/browse/RATIS-747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16970489#comment-16970489 ]
Tsz-wo Sze commented on RATIS-747: ---------------------------------- [~avijayan], thanks for working on this. - In RaftServerMetrics.addPeerCommitIndexGauge, it only needs an id instead of peer. Change the parameter to id, i.e. {code:java} void addPeerCommitIndexGauge(RaftPeerId peerId) { final String followerCommitIndexKey = String.format(LEADER_METRIC_PEER_COMMIT_INDEX, peerId); registry.gauge(followerCommitIndexKey, () -> () -> Optional.ofNullable(commitInfoCache.get(peerId)) .map(CommitInfoProto::getCommitIndex).orElse(0L)); } {code} - Then use server.getId() in RaftServerMetrics constructor and don't change LeaderState. > Datanode restart fails with IllegalStateException > ------------------------------------------------- > > Key: RATIS-747 > URL: https://issues.apache.org/jira/browse/RATIS-747 > Project: Ratis > Issue Type: Bug > Affects Versions: 0.5.0 > Reporter: Aravindan Vijayan > Assignee: Aravindan Vijayan > Priority: Major > Labels: intermittent > Fix For: 0.5.0 > > Attachments: RATIS-747-000.patch > > > This issue was observed and reported by [~hanishakoneru] while working on > HDDS-2392. > Datanode restart in an integration test fails with the following exception. > {code} > Caused by: java.lang.IllegalStateException: Not started > at > org.apache.ratis.thirdparty.com.google.common.base.Preconditions.checkState(Preconditions.java:504) > at > org.apache.ratis.thirdparty.io.grpc.internal.ServerImpl.getPort(ServerImpl.java:176) > at > org.apache.ratis.grpc.server.GrpcService.lambda$new$2(GrpcService.java:143) > at org.apache.ratis.util.MemoizedSupplier.get(MemoizedSupplier.java:62) > at > org.apache.ratis.grpc.server.GrpcService.getInetSocketAddress(GrpcService.java:182) > at > org.apache.ratis.server.impl.RaftServerImpl.lambda$new$0(RaftServerImpl.java:84) > at org.apache.ratis.util.MemoizedSupplier.get(MemoizedSupplier.java:62) > at > org.apache.ratis.server.impl.RaftServerImpl.getPeer(RaftServerImpl.java:136) > at > org.apache.ratis.server.impl.RaftServerMetrics.<init>(RaftServerMetrics.java:70) > at > org.apache.ratis.server.impl.RaftServerMetrics.getRaftServerMetrics(RaftServerMetrics.java:62) > at > org.apache.ratis.server.impl.RaftServerImpl.<init>(RaftServerImpl.java:119) > at > org.apache.ratis.server.impl.RaftServerProxy.lambda$newRaftServerImpl$2(RaftServerProxy.java:208) > at > java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590) > Issue Links > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)