Skip to content

Commit da2705b

Browse files
LiuRuoyu01chuandew
authored andcommitted
[feat][sdk]Support txn async commit
1 parent 8941a3d commit da2705b

34 files changed

Lines changed: 2042 additions & 152 deletions

include/dingosdk/client.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ class Transaction {
262262

263263
bool IsOnePc() const;
264264

265+
bool IsAsyncCommit() const;
266+
265267
private:
266268
friend class Client;
267269
friend class TestBase;

src/sdk/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ set(SDK_SRCS
5555
transaction/txn_task/txn_check_status_task.cc
5656
transaction/txn_task/txn_resolve_lock_task.cc
5757
transaction/txn_task/txn_heartbeat_task.cc
58+
transaction/txn_task/txn_check_secondary_locks_task.cc
5859
vector/vector_client.cc
5960
vector/vector_index_cache.cc
6061
vector/vector_index_creator.cc

src/sdk/client.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,8 @@ Status Transaction::Rollback() { return data_->impl->Rollback(); }
599599

600600
bool Transaction::IsOnePc() const { return data_->impl->IsOnePc(); }
601601

602+
bool Transaction::IsAsyncCommit() const { return data_->impl->IsAsyncCommit(); }
603+
602604
RegionCreator::RegionCreator(Data* data) : data_(data) {}
603605

604606
RegionCreator::~RegionCreator() { delete data_; }

src/sdk/common/common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static const int64_t kLogicalMask = (1 << kPhysicalShiftBits) - 1;
3939
namespace dingodb {
4040
namespace sdk {
4141

42-
enum LogLevel { kDEBUG = 0, kINFO = 1, kWARNING = 2, kERROR = 3, kFATAL = 4 };
42+
enum LogLevel : std::uint8_t { kDEBUG = 0, kINFO = 1, kWARNING = 2, kERROR = 3, kFATAL = 4 };
4343

4444
struct Range {
4545
std::string start_key;

src/sdk/common/param_config.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,11 @@ DEFINE_int64(vector_op_max_retry, 30, "vector task max retry times");
5858

5959
DEFINE_int64(txn_max_batch_count, 1000, "txn max batch count");
6060
DEFINE_int64(txn_max_async_commit_count, 256, "txn max async commit count");
61+
DEFINE_bool(enable_txn_async_commit, true, "enable txn async commit");
6162

6263
DEFINE_bool(log_rpc_time, false, "log rpc time");
6364

64-
DEFINE_int64(txn_heartbeat_interval_ms, 5000, "txn heartbeat interval time");
65+
DEFINE_int64(txn_heartbeat_interval_ms, 8000, "txn heartbeat interval time");
6566
DEFINE_int64(txn_heartbeat_lock_delay_ms, 20000, "txn heartbeat lock delay time");
6667

6768
DEFINE_uint32(stale_period_us, 1000, "stale period us default 1000 us, used for tso provider");

src/sdk/common/param_config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ DECLARE_int64(vector_op_max_retry);
7272

7373
DECLARE_int64(txn_max_batch_count);
7474
DECLARE_int64(txn_max_async_commit_count);
75+
DECLARE_bool(enable_txn_async_commit);
76+
7577
DECLARE_bool(log_rpc_time);
7678

7779
DECLARE_int64(txn_heartbeat_interval_ms);

src/sdk/rpc/brpc/store_rpc.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ DEFINE_STORE_RPC(TxnScan);
4444
DEFINE_STORE_RPC(TxnHeartBeat);
4545
DEFINE_STORE_RPC(TxnCheckTxnStatus);
4646
DEFINE_STORE_RPC(TxnResolveLock);
47+
DEFINE_STORE_RPC(TxnCheckSecondaryLocks);
4748

4849
} // namespace sdk
4950
} // namespace dingodb

src/sdk/rpc/brpc/store_rpc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ DECLARE_STORE_RPC(TxnScan);
4848
DECLARE_STORE_RPC(TxnHeartBeat);
4949
DECLARE_STORE_RPC(TxnCheckTxnStatus);
5050
DECLARE_STORE_RPC(TxnResolveLock);
51+
DECLARE_STORE_RPC(TxnCheckSecondaryLocks);
5152

5253
} // namespace sdk
5354
} // namespace dingodb

src/sdk/rpc/grpc/store_rpc.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ DEFINE_STORE_RPC(TxnScan);
4444
DEFINE_STORE_RPC(TxnHeartBeat);
4545
DEFINE_STORE_RPC(TxnCheckTxnStatus);
4646
DEFINE_STORE_RPC(TxnResolveLock);
47+
DEFINE_STORE_RPC(TxnCheckSecondaryLocks);
4748

4849
} // namespace sdk
4950
} // namespace dingodb

src/sdk/rpc/grpc/store_rpc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ DECLARE_STORE_RPC(TxnScan);
4848
DECLARE_STORE_RPC(TxnHeartBeat);
4949
DECLARE_STORE_RPC(TxnCheckTxnStatus);
5050
DECLARE_STORE_RPC(TxnResolveLock);
51+
DECLARE_STORE_RPC(TxnCheckSecondaryLocks);
5152

5253
} // namespace sdk
5354
} // namespace dingodb

0 commit comments

Comments
 (0)