PDGGK opened a new pull request, #11766:
URL: https://github.com/apache/seatunnel/pull/11766

   ### Purpose of this pull request
   
   Closes #11765.
   
   Enabling `read_limit.bytes_per_second` aborts the task on the first row that 
measures zero bytes:
   
   ```
   java.lang.IllegalArgumentException: Requested permits (0) must be positive
   ```
   
   `FlowControlGate#audit` passes `row.getBytesSize()` straight into Guava's 
`RateLimiter#acquire`, which requires a positive permit count (`checkPermits` → 
`checkArgument(permits > 0, ...)`).
   
   A zero-byte row is not a corner case. `SeaTunnelRow#getBytesForValue` 
returns `0` for `null` and `String#length()` for a string, so a row whose 
selected columns are all `NULL`, or all empty strings, sums to exactly 0. The 
failure then surfaces from inside shaded Guava as an argument-validation error, 
so it reads as an engine fault rather than a throttling decision — and only 
users who turned byte throttling on ever see it.
   
   A zero-byte row consumes no byte budget, so the byte limiter is skipped for 
it. The count limiter is what bounds the rate of such rows, and it is unchanged.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, in the sense that a job which previously crashed now runs. No 
configuration or semantics change for rows that actually carry bytes.
   
   ### How was this patch tested or is it not required?
   
   Two cases added to `FlowControlGateTest`, one for an all-`NULL` row and one 
for all-empty-string columns. Each asserts `getBytesSize() == 0` first, so the 
test fails loudly if that premise ever stops holding, and then asserts `audit` 
does not throw.
   
   Both **fail on `dev`** with exactly the reported exception:
   
   ```
   FlowControlGateTest.testRowWhoseFieldsAreAllNull:42
     Unexpected exception thrown: java.lang.IllegalArgumentException: Requested 
permits (0) must be positive
   FlowControlGateTest.testRowWhoseFieldsAreAllEmptyStrings:51
     Unexpected exception thrown: java.lang.IllegalArgumentException: Requested 
permits (0) must be positive
   Tests run: 2, Failures: 2
   ```
   
   With the fix the full class is green — **5/5, including the three existing 
timing-based tests** (37s), which is the check that matters here: throttling of 
ordinary rows is unchanged, only the zero-byte case is skipped.
   
   `spotless:check` exits 0.
   
   ### Check list
   
   * [x] If any new Jar binary package adding in your PR, please add License 
Notice according [New License 
Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/contribution/new-license.md)
 — none added
   * [x] If necessary, please update the documentation to describe the new 
feature. https://github.com/apache/seatunnel/tree/dev/docs — no user-facing 
config change
   * [ ] If you are contributing the connector code, please check that the 
following files are updated
   * [x] Update the `docs/en/about.md` — not applicable
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to