Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cloud/src/meta-service/meta_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,7 @@ class MetaServiceProxy final : public MetaService {
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_MAYBE_COMMITTED &&
code != MetaServiceCode::KV_TXN_TOO_OLD &&
(!config::enable_retry_txn_conflict || code != MetaServiceCode::KV_TXN_CONFLICT)) {
return;
Expand All @@ -1040,6 +1041,8 @@ class MetaServiceProxy final : public MetaService {
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 == MetaServiceCode::KV_TXN_MAYBE_COMMITTED
? MetaServiceCode::KV_TXN_MAYBE_COMMITTED
: code == MetaServiceCode::KV_TXN_CONFLICT
? KV_TXN_CONFLICT_RETRY_EXCEEDED_MAX_TIMES
: MetaServiceCode::KV_TXN_TOO_OLD);
Expand Down
3 changes: 2 additions & 1 deletion cloud/src/meta-service/meta_service_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,9 @@ inline MetaServiceCode cast_as(TxnErrorCode code) {
}
}
[[fallthrough]];
case TxnErrorCode::TXN_KEY_NOT_FOUND:
case TxnErrorCode::TXN_MAYBE_COMMITTED:
return MetaServiceCode::KV_TXN_MAYBE_COMMITTED;
case TxnErrorCode::TXN_KEY_NOT_FOUND:
case TxnErrorCode::TXN_TIMEOUT:
case TxnErrorCode::TXN_INVALID_ARGUMENT:
case TxnErrorCode::TXN_INVALID_DATA:
Expand Down
44 changes: 44 additions & 0 deletions cloud/test/meta_service_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8266,6 +8266,50 @@ TEST(MetaServiceTxnStoreRetryableTest, DoNotReturnRetryableCode) {
config::txn_store_retry_times = retry_times;
}

TEST(MetaServiceTxnStoreRetryableTest, RetryMaybeCommittedCode) {
size_t index = 0;
SyncPoint::get_instance()->set_call_back("update_delete_bitmap:commit:err", [&](auto&& args) {
++index;
*doris::try_any_cast<TxnErrorCode*>(args[2]) = TxnErrorCode::TXN_MAYBE_COMMITTED;
});
SyncPoint::get_instance()->enable_processing();
int32_t retry_times = config::txn_store_retry_times;
bool enable_retry = config::enable_txn_store_retry;
int64_t max_txn_commit_byte = config::max_txn_commit_byte;
config::txn_store_retry_times = 2;
config::enable_txn_store_retry = true;
config::max_txn_commit_byte = 1;

auto service = get_meta_service();

brpc::Controller cntl;
UpdateDeleteBitmapRequest req;
UpdateDeleteBitmapResponse resp;
req.set_cloud_unique_id("test_cloud_unique_id");
req.set_table_id(100);
req.set_partition_id(123);
req.set_lock_id(-3);
req.set_without_lock(true);
req.set_initiator(-1);
req.set_tablet_id(333);
req.add_rowset_ids("r1");
req.add_segment_ids(0);
req.add_versions(2);
req.add_segment_delete_bitmaps("abc");

service->update_delete_bitmap(&cntl, &req, &resp, nullptr);

ASSERT_EQ(resp.status().code(), MetaServiceCode::KV_TXN_MAYBE_COMMITTED)
<< " status is " << resp.status().msg() << ", code=" << resp.status().code();
EXPECT_GE(index, static_cast<size_t>(config::txn_store_retry_times + 1));

SyncPoint::get_instance()->disable_processing();
SyncPoint::get_instance()->clear_all_call_backs();
config::txn_store_retry_times = retry_times;
config::enable_txn_store_retry = enable_retry;
config::max_txn_commit_byte = max_txn_commit_byte;
}

TEST(MetaServiceTest, GetClusterStatusTest) {
auto meta_service = get_meta_service();

Expand Down
1 change: 1 addition & 0 deletions gensrc/proto/cloud.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1741,6 +1741,7 @@ enum MetaServiceCode {
KV_TXN_STORE_COMMIT_RETRYABLE = 1009;
KV_TXN_STORE_CREATE_RETRYABLE = 1010;
KV_TXN_TOO_OLD = 1011;
KV_TXN_MAYBE_COMMITTED = 1012;

//Doris error
TXN_GEN_ID_ERR = 2001;
Expand Down
Loading