vldpyatkov commented on code in PR #2255: URL: https://github.com/apache/ignite-3/pull/2255#discussion_r1244861785
########## modules/raft/src/main/java/org/apache/ignite/raft/jraft/core/NodeImpl.java: ########## @@ -1739,6 +1742,53 @@ public void handleReadIndexRequest(final ReadIndexRequest request, } } + @Override + public void handleReadLeaderIndexRequest( + ReadLeaderMetadataRequest request, + RpcResponseClosure<ReadLeaderMetadataResponse> done + ) { + long startMs = Utils.monotonicMs(); + + this.readLock.lock(); + + try { + switch (this.state) { + case STATE_LEADER: + readLeader( + null, + new RpcResponseClosureAdapter<>() { + @Override + public void run(Status status) { + if (getResponse() != null) { + done.setResponse(raftOptions.getRaftMessagesFactory().readLeaderMetadataResponse() + .leaderId(leaderId.toString()) + .currentTerm(currTerm) + .index(getResponse().index()) + .build()); + } + + done.run(status); + } + } + ); + break; + + case STATE_TRANSFERRING: + done.run(new Status(RaftError.EBUSY, "Is transferring leadership.")); + break; + + default: + done.run(new Status(RaftError.EPERM, "Invalid state for readIndex: %s.", this.state)); + break; + } + } + finally { + this.readLock.unlock(); + this.metrics.recordLatency("handle-read-index", Utils.monotonicMs() - startMs); Review Comment: What's your proposal? -- 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. To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org