ivandika3 commented on code in PR #1332:
URL: https://github.com/apache/ratis/pull/1332#discussion_r2670778619
##########
ratis-docs/src/site/markdown/configurations.md:
##########
@@ -218,6 +218,13 @@ if it fails to receive any RPC responses from this peer
within this specified ti
| **Type** | TimeDuration
|
| **Default** | 60s
|
+### Read Index - Configurations related to ReadIndex used in linearizable read
+
+| **Property** | `raft.server.read.read-index.use.applied-index.enabled`
|
+|:----------------|:--------------------------------------------------------------------------|
+| **Description** | whether leader return applied index instead of commit
index for ReadIndex |
Review Comment:
Thanks, this is more concise. Updated.
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/LeaderStateImpl.java:
##########
@@ -1134,21 +1137,23 @@ public boolean checkLeadership() {
/**
* Obtain the current readIndex for read only requests. See Raft paper
section 6.4.
* 1. Leader makes sure at least one log from current term is committed.
- * 2. Leader record last committed index as readIndex.
+ * 2. Leader record last committed index or applied index (depending on
configuration) as readIndex.
* 3. Leader broadcast heartbeats to followers and waits for
acknowledgements.
* 4. If majority respond success, returns readIndex.
* @return current readIndex.
*/
CompletableFuture<Long> getReadIndex(Long readAfterWriteConsistentIndex) {
- final long commitIndex = server.getRaftLog().getLastCommittedIndex();
+ final long lastAppliedOrCommitIndex = readIndexUseAppliedIndexEnabled ?
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]