Skip to content

Commit

Permalink
Fixes txn delete response to keep backwards compatibility (#239)
Browse files Browse the repository at this point in the history
Signed-off-by: Tao He <linzhu.ht@alibaba-inc.com>
  • Loading branch information
sighingnow committed Jul 17, 2023
1 parent 2c0d824 commit 3d34419
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/v3/AsyncGRPC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,20 @@ void etcdv3::AsyncTxnResponse::ParseResponse(TxnResponse& reply) {
AsyncDeleteResponse response;
response.ParseResponse(*(resp.mutable_response_delete_range()));

if (error_code == 0) {
// Ignore "key not found" error for delete in txn, keep backwards
// compatibility.
if (response.get_error_code() != 0 &&
response.get_error_code() != etcdv3::ERROR_KEY_NOT_FOUND) {
error_code = response.get_error_code();
}
if (!response.get_error_message().empty()) {
if (!error_message.empty()) {
error_message += "\n";
if (response.get_error_code() != 0 &&
response.get_error_code() != etcdv3::ERROR_KEY_NOT_FOUND) {
if (!error_message.empty()) {
error_message += "\n";
}
error_message += response.get_error_message();
}
error_message += response.get_error_message();
}
for (auto const& value : response.get_values()) {
values.emplace_back(value);
Expand Down

0 comments on commit 3d34419

Please sign in to comment.