Ivan Andika created RATIS-2844:
----------------------------------
Summary: Separate gRPC ordered streams for leader-routed and
explicitly targeted requests
Key: RATIS-2844
URL: https://issues.apache.org/jira/browse/RATIS-2844
Project: Ratis
Issue Type: Improvement
Reporter: Ivan Andika
Assignee: Ivan Andika
A client that mixes operations routed to the current leader with reads
explicitly addressed to that same server can stop making progress. This occurs
in a stable, single-server cluster and does not require a partition or
leadership change.
The robustness workload exposed this transport-level progress problem while
issuing reads to different peers. It is not, by itself, an observed invalid
Porcupine history: requests can stall before a useful history completes.
h2. Reproduction
1. Start a one-server gRPC cluster with linearizable reads enabled.
2. Create one `RaftClient`, using no retry to make the failure visible.
3. Repeatedly issue these operations sequentially, waiting for each result:
- `client.async().send(INCREMENT)`;
- `client.async().sendReadOnly(QUERY, leaderId)`;
- `client.async().sendReadOnly(QUERY)`.
4. Repeat five times. Each operation should complete within the regression's
five-second allowance and return the current counter value.
On the pre-fix implementation, mixing the two addressing modes can leave
subsequent operations waiting in the ordered stream.
h2. Expected behavior
Each logical ordering window must progress independently, even when both
addressing modes resolve to the same physical server.
h2. Root cause
`OrderedAsync` maintains separate sequence windows for implicit leader requests
and explicitly addressed server requests. `GrpcClientRpc` obtains the same
proxy when the explicit server is the current leader, and that proxy previously
multiplexed both windows onto one ordered stream. The server then receives
independent sequence spaces on a stream that assumes one ordering window.
h2. Proposed fix
Maintain separate ordered stream observers for leader-routed and explicitly
targeted requests. Select the observer with `request.isToLeader()` and close
both observers when closing the proxy. The request/reply wire format is
unchanged.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)