pjfanning opened a new pull request, #1872:
URL: https://github.com/apache/pekko-connectors/pull/1872

   Backport of #1625 to `1.4.x`.
   
   **Motivation:**
   
   `subscribe(...)` cleared only `subscription` and `streamAckDeadlineSeconds` 
on the keepalive request, leaving `clientId`, `maxOutstandingMessages`, and 
`maxOutstandingBytes` from the initial one. Pub/Sub rejects those three on 
subsequent requests with `INVALID_ARGUMENT`, so any caller setting 
`maxOutstandingMessages` loses the whole stream about a second after start.
   
   **Modification:**
   
   Use `StreamingPullRequest.defaultInstance` (Scala) / `getDefaultInstance` 
(Java) for the keepalive request. This clears every initial-only field at once 
and stays safe if the proto grows more of them later.
   
   Both production files cherry-picked cleanly. Two adjustments were needed for 
`1.4.x`:
   
   1. The upstream commit also modified `AutoExtendAckDeadlinesSpec`, which 
does not exist on `1.4.x` — the `autoExtendAckDeadlines` operator was never 
backported. The regression test is instead added as a standalone 
`SubscribeRequestFieldsSpec` carrying the stubs it needs 
(`CapturingStreamingPullClient`, `TestSubscriberClientBase`).
   
   2. That test injects a capturing client, which requires the same 
`GrpcSubscriber` seam `main` has: the client becomes a constructor parameter 
and the `apply` overloads build it. The previous constructor was `private`, so 
this is binary compatible — `mimaReportBinaryIssues` is clean.
   
   **Result:**
   
   Keepalive ticks carry no initial-only fields, so long-lived subscriptions 
that set `maxOutstandingMessages` no longer fail with `INVALID_ARGUMENT`.
   
   **Tests:**
   
   Added `SubscribeRequestFieldsSpec`, asserting the initial request keeps all 
five caller-supplied fields verbatim and that every subsequent request has them 
cleared.
   
   Verified the test fails against the pre-fix code on this branch:
   
   ```
   subsequent request #1 must be the default instance: "[test-client]" was not 
equal to "[]"
   ```
   
   and passes with the fix. Ran 
`google-cloud-pub-sub-grpc/mimaReportBinaryIssues` (clean) and the module's 
scalafmt checks.
   
   **References:**
   
   Backport of #1625, which fixed #1624. Bug present since `3f1a4f7f28` (Jan 
2019, alpakka era). The same code path is still in alpakka: akka/alpakka#3468.


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to