This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new 964be37294a branch-4.0: [chore](cloud) Log the large value info #57237
(#57245)
964be37294a is described below
commit 964be37294a1be33405481ce4e05740d8707a8f1
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Oct 23 10:20:20 2025 +0800
branch-4.0: [chore](cloud) Log the large value info #57237 (#57245)
Cherry-picked from #57237
Co-authored-by: walter <[email protected]>
---
cloud/src/meta-store/txn_kv.cpp | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/cloud/src/meta-store/txn_kv.cpp b/cloud/src/meta-store/txn_kv.cpp
index 10e9275c44f..f83b0cbd98b 100644
--- a/cloud/src/meta-store/txn_kv.cpp
+++ b/cloud/src/meta-store/txn_kv.cpp
@@ -240,6 +240,9 @@ TxnErrorCode Transaction::batch_scan(
namespace doris::cloud::fdb {
+//
https://apple.github.io/foundationdb/known-limitations.html#design-limitations
+constexpr size_t FDB_VALUE_BYTES_LIMIT = 100'000; // 100 KB
+
// Ref
https://apple.github.io/foundationdb/api-error-codes.html#developer-guide-error-codes.
constexpr fdb_error_t FDB_ERROR_CODE_TIMED_OUT = 1004;
constexpr fdb_error_t FDB_ERROR_CODE_TXN_TOO_OLD = 1007;
@@ -444,6 +447,13 @@ void Transaction::put(std::string_view key,
std::string_view val) {
++num_put_keys_;
put_bytes_ += key.size() + val.size();
approximate_bytes_ += key.size() * 3 + val.size(); // See
fdbclient/ReadYourWrites.actor.cpp
+
+ if (val.size() > FDB_VALUE_BYTES_LIMIT) {
+ LOG_WARNING("txn put with large value")
+ .tag("key", hex(key))
+ .tag("value", hex(val.substr(0, 64)) + "...")
+ .tag("value_size", val.size());
+ }
}
// return 0 for success otherwise error
@@ -586,6 +596,13 @@ void Transaction::atomic_set_ver_key(std::string_view
key_prefix, std::string_vi
++num_put_keys_;
put_bytes_ += key.size() + val.size();
approximate_bytes_ += key.size() * 3 + val.size();
+
+ if (val.size() > FDB_VALUE_BYTES_LIMIT) {
+ LOG_WARNING("atomic_set_ver_key with large value")
+ .tag("key", hex(key_prefix))
+ .tag("value", hex(val.substr(0, 64)) + "...")
+ .tag("value_size", val.size());
+ }
}
bool Transaction::atomic_set_ver_key(std::string_view key, uint32_t offset,
std::string_view val) {
@@ -608,6 +625,14 @@ bool Transaction::atomic_set_ver_key(std::string_view key,
uint32_t offset, std:
++num_put_keys_;
put_bytes_ += key_buf.size() + val.size();
approximate_bytes_ += key_buf.size() * 3 + val.size();
+
+ if (val.size() > FDB_VALUE_BYTES_LIMIT) {
+ LOG_WARNING("atomic_set_ver_key with large value")
+ .tag("key", hex(key))
+ .tag("value", hex(val.substr(0, 64)) + "...")
+ .tag("value_size", val.size());
+ }
+
return true;
}
@@ -628,6 +653,13 @@ void Transaction::atomic_set_ver_value(std::string_view
key, std::string_view va
++num_put_keys_;
put_bytes_ += key.size() + val.size();
approximate_bytes_ += key.size() * 3 + val.size();
+
+ if (val.size() > FDB_VALUE_BYTES_LIMIT) {
+ LOG_WARNING("atomic_set_ver_value with large value")
+ .tag("key", hex(key))
+ .tag("value", hex(val.substr(0, 64)) + "...")
+ .tag("value_size", val.size());
+ }
}
void Transaction::atomic_add(std::string_view key, int64_t to_add) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]