RATIS-2509. Introduce local read API to reduce serde cost#1448
Draft
ivandika3 wants to merge 1 commit intoapache:masterfrom
Draft
RATIS-2509. Introduce local read API to reduce serde cost#1448ivandika3 wants to merge 1 commit intoapache:masterfrom
ivandika3 wants to merge 1 commit intoapache:masterfrom
Conversation
szetszwo
reviewed
May 5, 2026
Contributor
szetszwo
left a comment
There was a problem hiding this comment.
@ivandika3 , thanks for working on this! Please see the comments inlined and also https://issues.apache.org/jira/secure/attachment/13082106/1448_review.patch
| * {@link org.apache.ratis.client.api.AsyncApi#sendReadOnly(org.apache.ratis.protocol.Message)}. | ||
| */ | ||
| default <T> CompletableFuture<T> readOnlyAsync( | ||
| CheckedSupplier<CompletableFuture<T>, IOException> query) throws IOException { |
Contributor
There was a problem hiding this comment.
- Since the query method in StateMachine does not throw IOException, let's just use Supplier here. It will force the StateMachine to handle IOException, if there is any.
//StateMachine
CompletableFuture<Message> query(Message request);- Also, we need clientId and readRequestType to support read-after-write-consistency.
default <T> CompletableFuture<T> readOnlyAsync(ClientId clientId, ReadRequestTypeProto readRequestType,
Supplier<CompletableFuture<T>> query) throws IOException {
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?
See https://issues.apache.org/jira/browse/RATIS-2509
OM code integration
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/RATIS-2509
How was this patch tested?
OM Leader read performance testing, the Ratis read performance is on par with the direct read.
(Putting this to draft since my GH account is currently blocked from GH actions).