gavinchou commented on code in PR #52050:
URL: https://github.com/apache/doris/pull/52050#discussion_r2166513439
##########
cloud/src/meta-service/http_encode_key.cpp:
##########
@@ -427,9 +429,26 @@ HttpResponse process_http_set_value(TxnKv* txn_kv,
brpc::Controller* cntl) {
LOG(WARNING) << "set_value saved, key=" << hex(key);
std::stringstream final_json;
- final_json << "original_value_hex=" << hex(value.value()) << "\n"
- << "key_hex=" << hex(key) << "\n"
- << "original_value_json=" << original_value_json << "\n";
+ if (value.value().size() > 0 && value.value().size() < 1024) {
+ final_json << "original_value_hex=" << hex(value.value()) << "\n"
+ << "key_hex=" << hex(key) << "\n"
+ << "original_value_json=" << original_value_json << "\n"
+ << "changed_value_hex=" << hex(serialized_value_to_save) <<
"\n";
+ } else {
+ // more than 1024 bytes
+ std::string file_path = fmt::format("{}/{}.txt",
doris::cloud::config::log_dir, hex(key));
+ final_json << "kv msg write to ms log dir, path=" << file_path << "\n";
+ std::ofstream kv_file(file_path);
+ if (kv_file.is_open()) {
+ kv_file << "original_value_hex=" << hex(value.value()) << "\n";
+ kv_file << "key_hex=" << hex(key) << "\n";
+ kv_file << "original_value_json=" << original_value_json << "\n";
+ kv_file << "changed_value_hex=" << hex(serialized_value_to_save)
<< "\n";
+ kv_file.close();
+ } else {
+ LOG(WARNING) << "Failed to open file for writing: " << file_path;
Review Comment:
fallback to print in log with some key informations
key_hex, json and etc.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]