Skip to content

Keep processing a batch when one queued item throws - #16470

Open
LI123456mo wants to merge 1 commit into
apache:3.3from
LI123456mo:fix-batch-executor-queue-16469
Open

LI123456mo wants to merge 1 commit into
apache:3.3from
LI123456mo:fix-batch-executor-queue-16469

Conversation

@LI123456mo

Copy link
Copy Markdown
Contributor

Fixes #16469

What is the purpose of the change

When handling one item of a batch threw inside BatchExecutorQueue, the rest of the batch had already been taken off the queue and was silently dropped. TripleWriteQueue only handled CompletionException, so any other failure left the failing command's promise pending, and a failing last command skipped the channel flush for the earlier writes in the same batch.

Brief changelog

  • BatchExecutorQueue: failures in prepare and flush are caught and logged per item, so the remaining items of the batch are still handled. If the executor rejects the task that drains the queue, the scheduled flag is reset so a later enqueue schedules processing again.
  • TripleWriteQueue: any failure completes only that command's promise as failed, and the channel is flushed even when the last command of the batch fails.

Verifying this change

Added BatchExecutorQueueTest and TripleWriteQueueTest covering failures in the middle, at the end, at a chunk boundary and multiple failures in one batch, executor rejection, promise completion, and flushing after a failing last command.

@codecov-commenter

codecov-commenter commented Sep 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.29630% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 60.93%. Comparing base (df9c5e1) to head (b5a8de9).

Files with missing lines Patch % Lines
...o/rpc/protocol/tri/transport/TripleWriteQueue.java 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                3.3   #16470      +/-   ##
============================================
+ Coverage     60.91%   60.93%   +0.01%     
- Complexity    11769    11778       +9     
============================================
  Files          1953     1953              
  Lines         89275    89292      +17     
  Branches      13474    13474              
============================================
+ Hits          54382    54409      +27     
+ Misses        29312    29302      -10     
  Partials       5581     5581              
Flag Coverage Δ
integration-tests-java21 32.08% <44.44%> (-0.06%) ⬇️
integration-tests-java8 32.21% <44.44%> (+<0.01%) ⬆️
samples-tests-java21 32.18% <44.44%> (-0.01%) ⬇️
samples-tests-java8 29.82% <44.44%> (+0.01%) ⬆️
unit-tests-java11 59.20% <96.29%> (+0.02%) ⬆️
unit-tests-java17 58.66% <96.29%> (+0.01%) ⬆️
unit-tests-java21 58.66% <96.29%> (-0.03%) ⬇️
unit-tests-java25 58.64% <96.29%> (+0.03%) ⬆️
unit-tests-java8 59.22% <96.29%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Make BatchExecutorQueue continue processing a batch when one queued item throws

2 participants