DaveTeng0 commented on code in PR #1047:
URL: https://github.com/apache/ratis/pull/1047#discussion_r1516901662
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java:
##########
@@ -642,7 +643,22 @@ GroupInfoReply getGroupInfo(GroupInfoRequest request) {
final RaftConfigurationProto conf =
LogProtoUtils.toRaftConfigurationProtoBuilder(getRaftConf()).build();
return new GroupInfoReply(request, getCommitInfos(), getGroup(),
getRoleInfoProto(),
- dir.isHealthy(), conf);
+ dir.isHealthy(), conf, getLogInfo());
+ }
+
+ LogInfoProto getLogInfo(){
+ long currentTerm = getInfo().getCurrentTerm();
+ LogInfoProto.Builder logInfoBuilder = LogInfoProto.newBuilder();
+ logInfoBuilder.setApplied(TermIndex.valueOf(currentTerm,
getInfo().getLastAppliedIndex()).toProto());
+ logInfoBuilder.setCommitted(TermIndex.valueOf(currentTerm,
getRaftLog().getLastCommittedIndex()).toProto());
+
logInfoBuilder.setLastEntry(getRaftLog().getLastEntryTermIndex().toProto());
+ if (getStateMachine().getLatestSnapshot() != null) {
+ logInfoBuilder.setLastSnapshot(
+ TermIndex.valueOf(currentTerm,
+ getStateMachine().getLatestSnapshot().getIndex())
+ .toProto());
+ }
Review Comment:
updated!
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]