chia7712 commented on code in PR #21135:
URL: https://github.com/apache/kafka/pull/21135#discussion_r2614670694
##########
transaction-coordinator/src/main/java/org/apache/kafka/coordinator/transaction/RPCProducerIdManager.java:
##########
@@ -142,7 +140,30 @@ public void onTimeout() {
});
}
- protected void
handleAllocateProducerIdsResponse(AllocateProducerIdsResponse response) {
+ protected void handleUnsuccessfulResponse() {
+ // There is no need to compare and set because only one thread
+ // handles the AllocateProducerIds response.
+ backoffDeadlineMs.set(time.milliseconds() + RETRY_BACKOFF_MS);
+ requestInFlight.set(false);
+ }
+
+ protected void handleAllocateProducerIdsResponse(ClientResponse
clientResponse) {
+ if (clientResponse.authenticationException() != null) {
+ log.error("Unable to allocate producer id because of an
authentication exception", clientResponse.authenticationException());
+ handleUnsuccessfulResponse();
+ return;
+ }
+ if (clientResponse.versionMismatch() != null) {
+ log.error("Unable to allocate producer id because of a version
mismatch exception", clientResponse.versionMismatch());
+ handleUnsuccessfulResponse();
+ return;
+ }
+ if (!clientResponse.hasResponse()) {
+ log.error("Unable to allocate producer id because of empty
response from controller");
Review Comment:
ditto
##########
transaction-coordinator/src/main/java/org/apache/kafka/coordinator/transaction/RPCProducerIdManager.java:
##########
@@ -142,7 +140,30 @@ public void onTimeout() {
});
}
- protected void
handleAllocateProducerIdsResponse(AllocateProducerIdsResponse response) {
+ protected void handleUnsuccessfulResponse() {
+ // There is no need to compare and set because only one thread
+ // handles the AllocateProducerIds response.
+ backoffDeadlineMs.set(time.milliseconds() + RETRY_BACKOFF_MS);
+ requestInFlight.set(false);
+ }
+
+ protected void handleAllocateProducerIdsResponse(ClientResponse
clientResponse) {
+ if (clientResponse.authenticationException() != null) {
+ log.error("Unable to allocate producer id because of an
authentication exception", clientResponse.authenticationException());
+ handleUnsuccessfulResponse();
+ return;
+ }
+ if (clientResponse.versionMismatch() != null) {
+ log.error("Unable to allocate producer id because of a version
mismatch exception", clientResponse.versionMismatch());
Review Comment:
ditto
##########
transaction-coordinator/src/main/java/org/apache/kafka/coordinator/transaction/RPCProducerIdManager.java:
##########
@@ -142,7 +140,30 @@ public void onTimeout() {
});
}
- protected void
handleAllocateProducerIdsResponse(AllocateProducerIdsResponse response) {
+ protected void handleUnsuccessfulResponse() {
+ // There is no need to compare and set because only one thread
+ // handles the AllocateProducerIds response.
+ backoffDeadlineMs.set(time.milliseconds() + RETRY_BACKOFF_MS);
+ requestInFlight.set(false);
+ }
+
+ protected void handleAllocateProducerIdsResponse(ClientResponse
clientResponse) {
+ if (clientResponse.authenticationException() != null) {
+ log.error("Unable to allocate producer id because of an
authentication exception", clientResponse.authenticationException());
Review Comment:
Should we add `logPrefix`?
--
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]