szetszwo commented on a change in pull request #473:
URL: https://github.com/apache/ratis/pull/473#discussion_r620114615
##########
File path:
ratis-server/src/main/java/org/apache/ratis/server/impl/ServerState.java
##########
@@ -431,7 +431,7 @@ private SnapshotInfo getLatestSnapshot() {
long getLatestInstalledSnapshotIndex() {
final TermIndex ti = latestInstalledSnapshot.get();
- return ti != null? ti.getIndex(): 0L;
+ return ti != null? ti.getIndex(): -1L;
Review comment:
Let's use `RaftLog.INVALID_LOG_INDEX` instead of -1.
```suggestion
return ti != null? ti.getIndex(): RaftLog.INVALID_LOG_INDEX;
```
##########
File path:
ratis-server/src/main/java/org/apache/ratis/server/impl/ServerState.java
##########
@@ -440,7 +440,7 @@ long getLatestInstalledSnapshotIndex() {
*/
long getSnapshotIndex() {
final SnapshotInfo s = getLatestSnapshot();
- final long latestSnapshotIndex = s != null ? s.getIndex() : 0;
+ final long latestSnapshotIndex = s != null ? s.getIndex() : -1;
Review comment:
Let's use `RaftLog.INVALID_LOG_INDEX` instead of -1.
```suggestion
final long latestSnapshotIndex = s != null ? s.getIndex() :
RaftLog.INVALID_LOG_INDEX;
```
--
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:
[email protected]