This is an automated email from the ASF dual-hosted git repository.

gavinchou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new ef8e3c81d44 [chore](cloud) Log rowset value when txn value size 
exceeds the limit (#39388)
ef8e3c81d44 is described below

commit ef8e3c81d44c96aa5b644b5f82c13e460fe4f986
Author: walter <[email protected]>
AuthorDate: Thu Aug 15 18:26:56 2024 +0800

    [chore](cloud) Log rowset value when txn value size exceeds the limit 
(#39388)
---
 cloud/src/meta-service/meta_service.cpp     | 12 +++++++++
 cloud/src/meta-service/meta_service_txn.cpp | 41 ++++++++++++++++++++++++++++-
 2 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/cloud/src/meta-service/meta_service.cpp 
b/cloud/src/meta-service/meta_service.cpp
index 0b27d6d50f6..d9f71ac2218 100644
--- a/cloud/src/meta-service/meta_service.cpp
+++ b/cloud/src/meta-service/meta_service.cpp
@@ -1010,6 +1010,12 @@ void 
MetaServiceImpl::prepare_rowset(::google::protobuf::RpcController* controll
               << " txn_id " << request->txn_id();
     err = txn->commit();
     if (err != TxnErrorCode::TXN_OK) {
+        if (err == TxnErrorCode::TXN_VALUE_TOO_LARGE) {
+            LOG(WARNING) << "failed to prepare rowset, err=value too large"
+                         << ", txn_id=" << request->txn_id() << ", tablet_id=" 
<< tablet_id
+                         << ", rowset_id=" << rowset_id
+                         << ", rowset_meta=" << rowset_meta.ShortDebugString();
+        }
         code = cast_as<ErrCategory::COMMIT>(err);
         msg = fmt::format("failed to save recycle rowset, err={}", err);
         return;
@@ -1139,6 +1145,12 @@ void 
MetaServiceImpl::commit_rowset(::google::protobuf::RpcController* controlle
               << request->txn_id();
     err = txn->commit();
     if (err != TxnErrorCode::TXN_OK) {
+        if (err == TxnErrorCode::TXN_VALUE_TOO_LARGE) {
+            LOG(WARNING) << "failed to commit rowset, err=value too large"
+                         << ", txn_id=" << request->txn_id() << ", tablet_id=" 
<< tablet_id
+                         << ", rowset_id=" << rowset_id
+                         << ", rowset_meta=" << rowset_meta.ShortDebugString();
+        }
         code = cast_as<ErrCategory::COMMIT>(err);
         ss << "failed to save rowset meta, err=" << err;
         msg = ss.str();
diff --git a/cloud/src/meta-service/meta_service_txn.cpp 
b/cloud/src/meta-service/meta_service_txn.cpp
index 7b540654433..c3c107de0de 100644
--- a/cloud/src/meta-service/meta_service_txn.cpp
+++ b/cloud/src/meta-service/meta_service_txn.cpp
@@ -1259,6 +1259,23 @@ void commit_txn_immediately(
     // Finally we are done...
     err = txn->commit();
     if (err != TxnErrorCode::TXN_OK) {
+        if ((err == TxnErrorCode::TXN_VALUE_TOO_LARGE ||
+             err == TxnErrorCode::TXN_BYTES_TOO_LARGE) &&
+            !tmp_rowsets_meta.empty()) {
+            size_t max_size = 0, max_idx = 0;
+            for (size_t i = 0; i < tmp_rowsets_meta.size(); i++) {
+                auto& [k, v] = tmp_rowsets_meta[i];
+                if (v.ByteSizeLong() > max_size) {
+                    max_size = v.ByteSizeLong();
+                    max_idx = i;
+                }
+            }
+            LOG(WARNING) << "failed to commit kv txn"
+                         << ", txn_id=" << txn_id << ", rowset_size=" << 
max_size << ", err=" << err
+                         << ", rowset_key=" << 
hex(tmp_rowsets_meta[max_idx].first)
+                         << ", rowset_value="
+                         << 
tmp_rowsets_meta[max_idx].second.ShortDebugString();
+        }
         code = cast_as<ErrCategory::COMMIT>(err);
         ss << "failed to commit kv txn, txn_id=" << txn_id << " err=" << err;
         msg = ss.str();
@@ -1808,8 +1825,30 @@ void commit_txn_with_sub_txn(const CommitTxnRequest* 
request, CommitTxnResponse*
     // Finally we are done...
     err = txn->commit();
     if (err != TxnErrorCode::TXN_OK) {
+        if (err == TxnErrorCode::TXN_VALUE_TOO_LARGE || err == 
TxnErrorCode::TXN_BYTES_TOO_LARGE) {
+            size_t max_size = 0;
+            std::pair<std::string, RowsetMetaCloudPB>* max_rowset_meta = 
nullptr;
+            for (auto& sub_txn : sub_txn_infos) {
+                auto it = 
sub_txn_to_tmp_rowsets_meta.find(sub_txn.sub_txn_id());
+                if (it == sub_txn_to_tmp_rowsets_meta.end()) {
+                    continue;
+                }
+                for (auto& rowset_meta : it->second) {
+                    if (rowset_meta.second.ByteSizeLong() > max_size) {
+                        max_size = rowset_meta.second.ByteSizeLong();
+                        max_rowset_meta = &rowset_meta;
+                    }
+                }
+            }
+            if (max_rowset_meta) {
+                LOG(WARNING) << "failed to commit kv txn with sub txn"
+                             << ", txn_id=" << txn_id << ", rowset_size=" << 
max_size
+                             << ", err=" << err << ", rowset_key=" << 
hex(max_rowset_meta->first)
+                             << ", rowset_value=" << 
max_rowset_meta->second.ShortDebugString();
+            }
+        }
         code = cast_as<ErrCategory::COMMIT>(err);
-        ss << "failed to commit kv txn, txn_id=" << txn_id << " err=" << err;
+        ss << "failed to commit kv txn with sub txn, txn_id=" << txn_id << " 
err=" << err;
         msg = ss.str();
         return;
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to