Skip to content

Commit

Permalink
k/produce: do not use unknown_server_error
Browse files Browse the repository at this point in the history
Kafka client doesn't process unknown_server_error correctly and it may
lead to duplicates violating the idempotency. See the following issue
for more info: https://issues.apache.org/jira/browse/KAFKA-14034

request_timed_out just like unknown_server_error means that the true
outcome of the operation is unknown and unlike unknown_server_error it
doesn't cause the problem so switching to using it to avoid the problem
  • Loading branch information
rystsov committed Jul 9, 2022
1 parent 0aa6828 commit 1a72446
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/v/kafka/server/handlers/produce.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ static error_code map_produce_error_code(std::error_code ec) {
case raft::errc::shutting_down:
return error_code::request_timed_out;
default:
return error_code::unknown_server_error;
return error_code::request_timed_out;
}
}

Expand All @@ -157,11 +157,11 @@ static error_code map_produce_error_code(std::error_code ec) {
case cluster::errc::invalid_request:
return error_code::invalid_request;
default:
return error_code::unknown_server_error;
return error_code::request_timed_out;
}
}

return error_code::unknown_server_error;
return error_code::request_timed_out;
}

/*
Expand Down Expand Up @@ -198,7 +198,7 @@ static partition_produce_stages partition_append(
p.error_code = map_produce_error_code(r.error());
}
} catch (...) {
p.error_code = error_code::unknown_server_error;
p.error_code = error_code::request_timed_out;
}
return p;
}),
Expand Down

0 comments on commit 1a72446

Please sign in to comment.