RATIS-2505. Improve RATIS-2387 with direct synchronous append when compose disabled#1436
Merged
szetszwo merged 2 commits intoapache:masterfrom Apr 23, 2026
Merged
RATIS-2505. Improve RATIS-2387 with direct synchronous append when compose disabled#1436szetszwo merged 2 commits intoapache:masterfrom
szetszwo merged 2 commits intoapache:masterfrom
Conversation
Contributor
Author
|
@szetszwo, you might find it interesting. |
szetszwo
reviewed
Apr 21, 2026
Contributor
szetszwo
left a comment
There was a problem hiding this comment.
The change looks good. However, could you make it a one-line change?
+++ b/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java
@@ -1682,7 +1682,7 @@ class RaftServerImpl implements RaftServer.Division,
future.join();
final CompletableFuture<Void> appendFuture = entries.isEmpty()? CompletableFuture.completedFuture(null)
: appendLogTermIndices != null ? appendLogTermIndices.append(entries, this::appendLog)
- : appendLog(entries);
+ : JavaUtils.allOf(state.getLog().append(entries));
proto.getCommitInfosList().forEach(commitInfoCache::update);
yandrey321
reviewed
Apr 21, 2026
yandrey321
left a comment
There was a problem hiding this comment.
can we cover these changes with unit tests?
Contributor
|
This revert the code to pre- RATIS-2235. So, new unit tests probably are not needed. |
Contributor
Author
|
@szetszwo sure. I just thought that if/else is easier to understand. |
szetszwo
approved these changes
Apr 23, 2026
Contributor
szetszwo
left a comment
There was a problem hiding this comment.
+1 the change looks good.
Contributor
Different people have a different taste. If it is new code, it is fine either way. But for the existing code, let's just minimize the change. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
When appendEntriesComposeEnabled is disabled (set to false), the code now bypasses the appendLog() method entirely and invokes the append operation directly on the current thread. This change eliminates the unnecessary async hop that remained in RATIS-2387. Instead of creating a completed future and then using thenComposeAsync() to schedule the append on the executor, the append now happens immediately on the calling thread.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/RATIS-2505
How was this patch tested?
Ozone cluster deployment with high volume write load.