tzulitai commented on a change in pull request #30: [FLINK-16226] Add
Backpressure to HttpFunction
URL: https://github.com/apache/flink-statefun/pull/30#discussion_r382876194
##########
File path:
statefun-flink/statefun-flink-core/src/main/java/org/apache/flink/statefun/flink/core/httpfn/HttpFunction.java
##########
@@ -109,9 +137,17 @@ private void onAsyncResult(
handleInvocationResponse(context, invocationResult);
InvocationBatchRequest.Builder nextBatch = getNextBatch();
if (nextBatch == null) {
- hasInFlightRpc.clear();
+ // the async request was completed, and there is nothing else in the
batch
+ // so we clear the requestState.
+ requestState.clear();
return;
}
+ // an async request was just completed, but while it was in flight we have
+ // accumulated a batch, we now proceed with:
+ // a) clearing the batch from our own persisted state (the batch moves to
the async operation
+ // state)
+ // b) sending the accumulated batch to the remote function.
+ requestState.set(0);
Review comment:
Should this actually be `requestState.set(nextBatch.size())`?
Or rather, we don't set it to 0 because at this point request state is
already == accumulated batch size.
Reasoning is:
In `onRequest` method, as I understood it from the naming, the
`inflightOrBatched` (counter obtained from `requestState`) reflects total
number of "pending" records, regardless of whether they are buffered or
in-flight.
Setting `requestState` to 0 here breaks that semantic.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services