gavinchou commented on code in PR #32902:
URL: https://github.com/apache/doris/pull/32902#discussion_r1540788401
##########
cloud/src/meta-service/meta_service.h:
##########
@@ -616,39 +613,53 @@ class MetaServiceProxy final : public MetaService {
TEST_SYNC_POINT("MetaServiceProxy::call_impl:1");
- int32_t retry_times = config::txn_store_retry_times;
- uint64_t duration_ms = 0;
- std::uniform_int_distribution<uint64_t> u(20, 200);
- std::uniform_int_distribution<uint64_t> u2(500, 1000);
- auto rng = std::default_random_engine {
-
static_cast<uint64_t>(std::chrono::steady_clock::now().time_since_epoch().count())};
+ int32_t retry_times = 0;
+ uint64_t duration_ms = 0, retry_drift_ms = 0;
while (true) {
(impl_.get()->*method)(ctrl, req, resp, brpc::DoNothing());
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_TOO_OLD &&
(!config::enable_retry_txn_conflict || code !=
MetaServiceCode::KV_TXN_CONFLICT)) {
return;
}
TEST_SYNC_POINT("MetaServiceProxy::call_impl:2");
- if (--retry_times < 0) {
+ if (retry_times == 0) {
+ // the first retry, add random drift.
+ std::uniform_int_distribution<uint64_t> u(
Review Comment:
the RNG can be made as thread local?
##########
cloud/test/fdb_injection_test.cpp:
##########
@@ -67,6 +67,7 @@ int main(int argc, char** argv) {
cloud::config::enable_txn_store_retry = true;
cloud::config::txn_store_retry_times = 100;
+ cloud::config::txn_store_retry_base_intervals_ms = 1;
Review Comment:
1ms may be too short to prevent an avalanche
--
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]