SWJTU-ZhangLei commented on code in PR #50314: URL: https://github.com/apache/doris/pull/50314#discussion_r2062568265
########## cloud/test/txn_lazy_commit_test.cpp: ########## @@ -1899,5 +1900,39 @@ TEST(TxnLazyCommitTest, RowsetMetaSizeExceedTest) { ASSERT_EQ(res.status().code(), MetaServiceCode::PROTOBUF_PARSE_ERR); } } +TEST(TxnLazyCommitTest, FuzzyRandom) { + int counter = 0; + for (size_t i = 0; i < 10000; i++) { + if (fuzzy_random()) { + counter++; + } + } + LOG(INFO) << "fuzzy_random counter: " << counter; + ASSERT_GT(counter, 0); + ASSERT_LT(counter, 10000); +} +TEST(TxnLazyCommitTest, ForceTxnLazyCommit) { + int counter = 0; + config::enable_cloud_txn_lazy_commit_fuzzy_test = false; + for (size_t i = 0; i < 10000; i++) { + if (force_txn_lazy_commit()) { + counter++; + } + } + LOG(INFO) << "force_txn_lazy_commit counter: " << counter; + ASSERT_EQ(counter, 0); + + config::enable_cloud_txn_lazy_commit_fuzzy_test = true; + counter = 0; + for (size_t i = 0; i < 10000; i++) { + if (force_txn_lazy_commit()) { + counter++; + } + } + LOG(INFO) << "force_txn_lazy_commit counter: " << counter; + ASSERT_GT(counter, 0); Review Comment: > it should be [3000 - 7000] done ########## cloud/src/meta-service/meta_service_txn.cpp: ########## @@ -2549,26 +2560,33 @@ void MetaServiceImpl::commit_txn(::google::protobuf::RpcController* controller, } TxnErrorCode err = TxnErrorCode::TXN_OK; - bool allow_txn_lazy_commit = + bool enable_txn_lazy_commit_feature = (request->has_is_2pc() && !request->is_2pc() && request->has_enable_txn_lazy_commit() && request->enable_txn_lazy_commit() && config::enable_cloud_txn_lazy_commit); - if (!allow_txn_lazy_commit || - (tmp_rowsets_meta.size() <= config::txn_lazy_commit_rowsets_thresold)) { + while ((!enable_txn_lazy_commit_feature || + (tmp_rowsets_meta.size() <= config::txn_lazy_commit_rowsets_thresold))) { + if (force_txn_lazy_commit()) { + LOG(INFO) << "fuzzy test force_txn_lazy_commit"; Review Comment: > print txnId and tablet id etc done -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org