From 232a2b791d8a0359d8e8744f9c7b866d8289f42f Mon Sep 17 00:00:00 2001 From: Jiashuo Date: Tue, 13 Apr 2021 11:21:55 +0800 Subject: [PATCH] fix: overload dump_write_request shouldn't auto-reply to client (#718) --- src/server/pegasus_server_impl.cpp | 50 +++++++++++------------------- 1 file changed, 18 insertions(+), 32 deletions(-) diff --git a/src/server/pegasus_server_impl.cpp b/src/server/pegasus_server_impl.cpp index 2be1e8ac1d..890d7bb4ec 100644 --- a/src/server/pegasus_server_impl.cpp +++ b/src/server/pegasus_server_impl.cpp @@ -2846,49 +2846,35 @@ std::string pegasus_server_impl::dump_write_request(dsn::message_ex *request) { dsn::task_code rpc_code(request->rpc_code()); if (rpc_code == dsn::apps::RPC_RRDB_RRDB_PUT) { - auto put = put_rpc::auto_reply(request).request(); + auto put = put_rpc(request).request(); ::dsn::blob hash_key, sort_key; pegasus_restore_key(put.key, hash_key, sort_key); - std::string request("put:"); - request.append("hash_key=") - .append(pegasus::utils::c_escape_string(hash_key)) - .append(",sort_key=") - .append(pegasus::utils::c_escape_string(sort_key)); - return request; + return fmt::format("put: hash_key={}, sort_key={}", + pegasus::utils::c_escape_string(hash_key), + pegasus::utils::c_escape_string(sort_key)); } if (rpc_code == dsn::apps::RPC_RRDB_RRDB_MULTI_PUT) { - auto multi_put = multi_put_rpc::auto_reply(request).request(); - std::string request("multi_put:"); - request.append("hash_key=") - .append(pegasus::utils::c_escape_string((multi_put.hash_key)) - .append(",multi_put_count=") - .append(std::to_string(multi_put.kvs.size()))); - return request; + auto multi_put = multi_put_rpc(request).request(); + return fmt::format("multi_put: hash_key={}, multi_put_count={}", + pegasus::utils::c_escape_string(multi_put.hash_key), + multi_put.kvs.size()); } if (rpc_code == dsn::apps::RPC_RRDB_RRDB_CHECK_AND_SET) { - auto check_and_set = check_and_set_rpc::auto_reply(request).request(); - std::string request("check_and_set:"); - request.append("hash_key=") - .append(pegasus::utils::c_escape_string(check_and_set.hash_key)) - .append(",check_sort_key=") - .append(pegasus::utils::c_escape_string(check_and_set.check_sort_key)) - .append(",set_sort_key=") - .append(pegasus::utils::c_escape_string(check_and_set.set_sort_key)); - return request; + auto check_and_set = check_and_set_rpc(request).request(); + return fmt::format("check_and_set: hash_key={}, check_sort_key={}, set_sort_key={}", + pegasus::utils::c_escape_string(check_and_set.hash_key), + pegasus::utils::c_escape_string(check_and_set.check_sort_key), + pegasus::utils::c_escape_string(check_and_set.set_sort_key)); } if (rpc_code == dsn::apps::RPC_RRDB_RRDB_CHECK_AND_MUTATE) { - auto check_and_mutate = check_and_mutate_rpc::auto_reply(request).request(); - std::string request("check_and_mutate:"); - request.append("hash_key=") - .append(pegasus::utils::c_escape_string(check_and_mutate.hash_key)) - .append(",check_sort_key=") - .append(pegasus::utils::c_escape_string(check_and_mutate.check_sort_key)) - .append(",set_value_count=") - .append(std::to_string(check_and_mutate.mutate_list.size())); - return request; + auto check_and_mutate = check_and_mutate_rpc(request).request(); + return fmt::format("check_and_mutate: hash_key={}, check_sort_key={}, set_value_count={}", + pegasus::utils::c_escape_string(check_and_mutate.hash_key), + pegasus::utils::c_escape_string(check_and_mutate.check_sort_key), + check_and_mutate.mutate_list.size()); } return "default";