This is an automated email from the ASF dual-hosted git repository.
dataroaring 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 a1f35a04d18 [fix](cloud) Avoid creating another txn during read
versioned keys (#55653)
a1f35a04d18 is described below
commit a1f35a04d1829142c546f4feeea8833a42739b52
Author: walter <[email protected]>
AuthorDate: Sat Sep 6 17:05:19 2025 +0800
[fix](cloud) Avoid creating another txn during read versioned keys (#55653)
---
cloud/src/meta-service/meta_service.cpp | 10 +++++-----
cloud/src/meta-service/meta_service_tablet_stats.cpp | 2 +-
cloud/src/meta-service/txn_lazy_committer.cpp | 7 +++++--
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/cloud/src/meta-service/meta_service.cpp
b/cloud/src/meta-service/meta_service.cpp
index a16cdc7def5..61a3d19b4fe 100644
--- a/cloud/src/meta-service/meta_service.cpp
+++ b/cloud/src/meta-service/meta_service.cpp
@@ -828,7 +828,7 @@ void internal_create_tablet(const CreateTabletsRequest*
request, MetaServiceCode
return;
}
LOG(INFO) << "put versioned tablet load and compact stats, tablet_id="
<< tablet_id
- << " load_stats_key=" << hex(stats_key)
+ << " load_stats_key=" << hex(load_stats_key)
<< " compact_stats_key=" << hex(compact_stats_key);
}
@@ -1061,8 +1061,8 @@ void
MetaServiceImpl::update_tablet(::google::protobuf::RpcController* controlle
return;
}
} else {
- TxnErrorCode err =
- reader.get_tablet_meta(tablet_meta_info.tablet_id(),
&tablet_meta, nullptr);
+ TxnErrorCode err = reader.get_tablet_meta(txn.get(),
tablet_meta_info.tablet_id(),
+ &tablet_meta, nullptr);
if (err != TxnErrorCode::TXN_OK) {
code = cast_as<ErrCategory::READ>(err);
msg = fmt::format("failed to get versioned tablet meta,
err={}", err);
@@ -3219,8 +3219,8 @@ void
MetaServiceImpl::get_tablet_stats(::google::protobuf::RpcController* contro
break;
}
} else {
- TxnErrorCode err =
- reader.get_tablet_merged_stats(idx.tablet_id(),
tablet_stats, nullptr);
+ TxnErrorCode err = reader.get_tablet_merged_stats(txn.get(),
idx.tablet_id(),
+ tablet_stats,
nullptr);
if (err != TxnErrorCode::TXN_OK) {
code = cast_as<ErrCategory::READ>(err);
msg = fmt::format("failed to get versioned tablet stats,
err={}, tablet_id={}", err,
diff --git a/cloud/src/meta-service/meta_service_tablet_stats.cpp
b/cloud/src/meta-service/meta_service_tablet_stats.cpp
index f23f1cf9f9c..b01e4f4ddb1 100644
--- a/cloud/src/meta-service/meta_service_tablet_stats.cpp
+++ b/cloud/src/meta-service/meta_service_tablet_stats.cpp
@@ -189,7 +189,7 @@ void internal_get_versioned_tablet_stats(MetaServiceCode&
code, std::string& msg
// Try to read existing versioned tablet stats
TxnErrorCode err =
- meta_reader.get_tablet_load_stats(tablet_id, &stats,
&versionstamp, snapshot);
+ meta_reader.get_tablet_load_stats(txn, tablet_id, &stats,
&versionstamp, snapshot);
if (err == TxnErrorCode::TXN_KEY_NOT_FOUND) {
// If versioned stats doesn't exist, read from single version
internal_get_tablet_stats(code, msg, txn, instance_id, tablet_idx,
stats, snapshot);
diff --git a/cloud/src/meta-service/txn_lazy_committer.cpp
b/cloud/src/meta-service/txn_lazy_committer.cpp
index 4e734ce9921..01192508bba 100644
--- a/cloud/src/meta-service/txn_lazy_committer.cpp
+++ b/cloud/src/meta-service/txn_lazy_committer.cpp
@@ -17,6 +17,7 @@
#include "txn_lazy_committer.h"
+#include <gen_cpp/cloud.pb.h>
#include <gen_cpp/olap_file.pb.h>
#include <chrono>
@@ -658,7 +659,8 @@ void TxnLazyCommitTask::commit() {
} else {
TabletIndexPB tablet_idx_pb;
int64_t first_tablet_id =
tmp_rowset_metas.begin()->second.tablet_id();
- err = meta_reader.get_tablet_index(first_tablet_id,
&tablet_idx_pb);
+ err = meta_reader.get_tablet_index(txn.get(),
first_tablet_id,
+ &tablet_idx_pb);
if (err != TxnErrorCode::TXN_OK) {
code_ = err == TxnErrorCode::TXN_KEY_NOT_FOUND
? MetaServiceCode::TXN_ID_NOT_FOUND
@@ -700,7 +702,8 @@ void TxnLazyCommitTask::commit() {
break;
}
} else {
- err = meta_reader.get_partition_version(partition_id,
&version_pb, nullptr);
+ err = meta_reader.get_partition_version(txn.get(),
partition_id, &version_pb,
+ nullptr);
if (TxnErrorCode::TXN_OK != err) {
code_ = err == TxnErrorCode::TXN_KEY_NOT_FOUND
? MetaServiceCode::TXN_ID_NOT_FOUND
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]