nileshkumar3 opened a new pull request, #23590:
URL: https://github.com/apache/kafka/pull/23590

   [KAFKA-21088](https://issues.apache.org/jira/browse/KAFKA-21088)
   
   `DefaultClientTelemetrySender.createPushRequest` moves the sender to
   `PUSH_IN_PROGRESS` before the payload is assembled. When assembly threw, the
   catch block logged a warning, called `updateErrorResult` and returned
   `Optional.empty()` without restoring the state. No request was sent, so 
neither
   `handleResponse` nor `handleFailedRequest` could run to move the sender on, 
and
   `timeToNextUpdate` returns `requestTimeoutMs` for `PUSH_IN_PROGRESS`, so
   `NetworkClient.TelemetrySender.maybeUpdate` never called `createRequest()`
   again. Telemetry stopped for the lifetime of the client after a single WARN,
   while the sender still reported itself as enabled.
   
   This restores `PUSH_NEEDED` for a non-terminating push, so the retry on the 
next
   push interval that the existing comment describes actually happens. A
   terminating push is left alone: `TERMINATING_PUSH_IN_PROGRESS` can only
   transition to `TERMINATED`, and `close()` follows it, so it is not a stuck
   state. Attempting the transition there would fail `validateTransition` and
   disable telemetry as a side effect.
   
   ### Testing
   
   Two tests in `ClientTelemetryReporterTest`, both using a mocked
   `KafkaMetricsCollector` whose `collect` throws:
   
   - `testCreateRequestPushPayloadFailureRetriesOnNextInterval` asserts the 
sender
     lands in `PUSH_NEEDED`, that `timeToNextUpdate` returns the push interval
     rather than the request timeout, and that a `PushTelemetryRequest` is built
     once the interval elapses.
   - `testCreateRequestTerminatingPushPayloadFailure` asserts the terminating 
path
     stays in `TERMINATING_PUSH_IN_PROGRESS` with telemetry still enabled, and 
that
     `close()` reaches `TERMINATED`.
   
   Both fail against the unfixed code (`expected: <PUSH_NEEDED> but was:
   <PUSH_IN_PROGRESS>`). `clients:spotlessCheck`, `checkstyleMain` and
   `checkstyleTest` pass.


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