Skip to content

Commit 7e97c27

Browse files
authored
feat(zerozone2): response retryable error when route out get UNKNOWN_SERVER_ERROR (#2954)
Signed-off-by: Robin Han <hanxvdovehx@gmail.com>
1 parent d33e3db commit 7e97c27

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

core/src/main/java/kafka/automq/zerozone/RouterOutV2.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,14 @@ private CompletableFuture<Void> batchSend(long epoch, List<ProxyRequest> request
244244
}
245245

246246
private void handleRouterResponse(AutomqZoneRouterResponse zoneRouterResponse, List<ProxyRequest> requests) {
247-
if (zoneRouterResponse.data().errorCode() != Errors.NONE.code()) {
248-
Errors error = Errors.forCode(zoneRouterResponse.data().errorCode());
247+
short errorCode = zoneRouterResponse.data().errorCode();
248+
if (errorCode == Errors.UNKNOWN_SERVER_ERROR.code()) {
249+
// We could find the detail error log in the rpc server side.
250+
// Set the error to LEADER_NOT_AVAILABLE to make the producer retry sending.
251+
errorCode = Errors.LEADER_NOT_AVAILABLE.code();
252+
}
253+
if (errorCode != Errors.NONE.code()) {
254+
Errors error = Errors.forCode(errorCode);
249255
requests.forEach(r -> r.completeWithError(error));
250256
return;
251257
}

0 commit comments

Comments
 (0)