You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fluss.apache.org by "luoyuxia (via GitHub)" <gi...@apache.org> on 2026/10/19 12:40:46 UTC

[PR] [client] Wait for in-flight writes before historical rerouting [fluss]

luoyuxia opened a new pull request, #4735:
URL: https://github.com/apache/fluss/pull/4735

   <!--
   *Thank you very much for contributing to Fluss - we are happy that you want to help us improve Fluss. To help the community review your contribution in the best possible way, please go through the checklist below, which will get the contribution into a shape in which it can be best reviewed.*
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [GitHub issue](https://github.com/apache/fluss/issues). Exceptions are made for typos in JavaDoc or documentation files, which need no issue.
   
     - Name the pull request in the format "[component] Title of the pull request", where *[component]* should be replaced by the name of the component being changed. Typically, this corresponds to the component label assigned to the issue (e.g., [kv], [log], [client], [flink], [rust], [python], [c++], [elixir]). Skip *[component]* if you are unsure about which is the best component.
   
     - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
   
     - Make sure that the change passes the automated tests, i.e., `mvn clean verify` passes.
   
     - Each pull request should address only one issue, not mix up code from multiple issues.
   
     - **Generative AI disclosure:** Indicate whether generative AI tools were used in authoring this PR. If yes, specify the tool below.
       - [ ] No generative AI tools used
       - [x] Yes (OpenAI Codex, GPT-6)
   
   **(The sections below can be removed for hotfixes or typos)**
   -->
   
   <!--
   Generated-by: OpenAI Codex (GPT-6) following [the guidelines](https://github.com/apache/fluss/blob/main/AGENTS.md)
   -->
   
   ### Purpose
   
   <!-- Linking this pull request to the issue -->
   Linked issue: #4166 (client-only mitigation)
   
   <!-- What is the purpose of the change -->
   Avoid failing writes when the client resolves a historical write target while requests to the original partition are still in flight. Wait for those requests to complete before rerouting the queued batches.
   
   Cross-target replay follows at-least-once semantics: an old attempt with an ambiguous outcome can be replayed on the historical target. This PR does not implement the full FREEZING/RETIRED retirement protocol or lake-visible ordering described in #4166.
   
   ### Brief change log
   
   <!-- Please describe the changes made in this pull request and explain how they address the issue -->
   
   - Pause the original queues only when a resolved historical route encounters incomplete writes. Keep new records queued under the original partition path.
   - Resume through the existing Sender ready/metadata flow after original in-flight requests complete. Preserve the sent batches' targets and sequences, and reset queued batches for historical-bucket sequence assignment.
   - Recheck the pause under the bucket deque lock so a previously discovered bucket cannot bypass it.
   - Invalidate cached partition IDs before rechecking a missing target, and keep real metadata cache checks in the tests.
   
   ### Tests
   
   <!-- List UT and IT cases to verify this change -->
   
   - Passed: `./mvnw -pl fluss-client -am -Dtest=SenderTest,BucketRoutingTest,RecordAccumulatorTest -Dsurefire.failIfNoSpecifiedTests=false test -q` (127 tests).
   - Passed: `./mvnw -pl fluss-client spotless:check checkstyle:check -q`.
   - Full reactor verification (`./mvnw verify -pl fluss-client -am -Dskip.iceberg-1.12 -q`) failed in the unchanged `fluss-server` dependency before reaching the client module. `RemoteLogITCase.testFollowerFetchAlreadyMoveToRemoteLog` and `TabletServiceITCase.testScanKv_expiredOnRecentlyEvicted` both failed in `waitUntilAllReplicaReady` because an expected `Optional` was empty.
   
   Coverage includes waiting with A in flight while B/C remain queued, preserving replay order after reversed rejection responses, progress on another partition during the pause, and pausing after bucket discovery but before drain.
   
   ### API and Format
   
   <!-- Does this change affect API or storage format -->
   No public API, RPC protocol, or storage format changes.
   
   ### Documentation
   
   <!-- Does this change introduce a new feature -->
   No documentation changes are required for this client behavior fix.
   
   AI-assisted with OpenAI Codex (GPT-6).
   


-- 
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: issues-unsubscribe@fluss.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org