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 7d2c8af97ee [feature](merge-cloud) Retry txn conflict error at meta
service proxy (#32668)
7d2c8af97ee is described below
commit 7d2c8af97ee66b7708932e2f24d7977bf8677ea8
Author: walter <[email protected]>
AuthorDate: Fri Mar 22 18:00:00 2024 +0800
[feature](merge-cloud) Retry txn conflict error at meta service proxy
(#32668)
---
cloud/src/common/config.h | 4 +++-
cloud/src/meta-service/meta_service.h | 12 +++++++-----
cloud/test/meta_service_test.cpp | 2 ++
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/cloud/src/common/config.h b/cloud/src/common/config.h
index e54f49e7728..859271f6503 100644
--- a/cloud/src/common/config.h
+++ b/cloud/src/common/config.h
@@ -142,8 +142,10 @@ CONF_String(kms_cmk, "");
CONF_Bool(focus_add_kms_data_key, "false");
// Whether to retry the retryable errors that returns by the underlying txn
store.
-CONF_Bool(enable_txn_store_retry, "false");
+CONF_Bool(enable_txn_store_retry, "true");
CONF_Int32(txn_store_retry_times, "20");
+// Whether to retry the txn conflict errors that returns by the underlying txn
store.
+CONF_Bool(enable_retry_txn_conflict, "true");
// The secondary package name of the MetaService.
CONF_String(secondary_package_name, "");
diff --git a/cloud/src/meta-service/meta_service.h
b/cloud/src/meta-service/meta_service.h
index 31e87837c81..85232de7bd9 100644
--- a/cloud/src/meta-service/meta_service.h
+++ b/cloud/src/meta-service/meta_service.h
@@ -32,10 +32,10 @@
#include "common/config.h"
#include "common/logging.h"
#include "common/sync_point.h"
+#include "meta-service/meta_service_tablet_stats.h"
#include "meta-service/txn_kv.h"
#include "rate-limiter/rate_limiter.h"
#include "resource-manager/resource_manager.h"
-#include "meta-service/meta_service_tablet_stats.h"
namespace doris::cloud {
@@ -615,16 +615,18 @@ private:
MetaServiceCode code = resp->status().code();
if (code != MetaServiceCode::KV_TXN_STORE_GET_RETRYABLE &&
code != MetaServiceCode::KV_TXN_STORE_COMMIT_RETRYABLE &&
- code != MetaServiceCode::KV_TXN_STORE_CREATE_RETRYABLE) {
+ code != MetaServiceCode::KV_TXN_STORE_CREATE_RETRYABLE &&
+ (!config::enable_retry_txn_conflict || code !=
MetaServiceCode::KV_TXN_CONFLICT)) {
return;
}
TEST_SYNC_POINT("MetaServiceProxy::call_impl:2");
if (--retry_times < 0) {
resp->mutable_status()->set_code(
- code == MetaServiceCode::KV_TXN_STORE_COMMIT_RETRYABLE
? KV_TXN_COMMIT_ERR
- : code == MetaServiceCode::KV_TXN_STORE_GET_RETRYABLE
? KV_TXN_GET_ERR
-
: KV_TXN_CREATE_ERR);
+ code == MetaServiceCode::KV_TXN_STORE_COMMIT_RETRYABLE
? KV_TXN_COMMIT_ERR
+ : code == MetaServiceCode::KV_TXN_STORE_GET_RETRYABLE
? KV_TXN_GET_ERR
+ : code ==
MetaServiceCode::KV_TXN_STORE_CREATE_RETRYABLE ? KV_TXN_CREATE_ERR
+
: code);
return;
}
diff --git a/cloud/test/meta_service_test.cpp b/cloud/test/meta_service_test.cpp
index f4e0d6ac483..92085a42c02 100644
--- a/cloud/test/meta_service_test.cpp
+++ b/cloud/test/meta_service_test.cpp
@@ -52,6 +52,8 @@ int main(int argc, char** argv) {
return -1;
}
+ config::enable_retry_txn_conflict = false;
+
if (!doris::cloud::init_glog("meta_service_test")) {
std::cerr << "failed to init glog" << std::endl;
return -1;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]