Skip to content
Open
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
18 changes: 15 additions & 3 deletions cloud/src/meta-service/meta_service_partition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,11 @@ void MetaServiceImpl::commit_index(::google::protobuf::RpcController* controller
int64_t table_id = request->table_id();
std::string ver_key = table_version_key({instance_id, request->db_id(), table_id});
std::string ver_val;
err = txn->get(ver_key, &ver_val);
// snapshot read: the returned table version is only a hint for FE's version
// cache; the real increment is done by update_table_version() via atomic_add.
// A non-snapshot read would add ver_key to the read-conflict set and make
// concurrent commits on the same table conflict (KV_TXN_CONFLICT).
err = txn->get(ver_key, &ver_val, true);
int64_t table_version = 0;
if (err == TxnErrorCode::TXN_OK) {
if (!txn->decode_atomic_int(ver_val, &table_version)) {
Expand Down Expand Up @@ -845,7 +849,11 @@ void MetaServiceImpl::commit_partition_internal(const PartitionRequest* request,
std::string ver_key =
table_version_key({instance_id, request->db_id(), request->table_id()});
std::string ver_val;
err = txn->get(ver_key, &ver_val);
// snapshot read: the returned table version is only a hint for FE's version
// cache; the real increment is done by update_table_version() via atomic_add.
// A non-snapshot read would add ver_key to the read-conflict set and make
// concurrent commits on the same table conflict (KV_TXN_CONFLICT).
err = txn->get(ver_key, &ver_val, true);
int64_t table_version = 0;
if (err == TxnErrorCode::TXN_OK) {
if (!txn->decode_atomic_int(ver_val, &table_version)) {
Expand Down Expand Up @@ -1034,7 +1042,11 @@ void MetaServiceImpl::drop_partition(::google::protobuf::RpcController* controll
std::string ver_key =
table_version_key({instance_id, request->db_id(), request->table_id()});
std::string ver_val;
err = txn->get(ver_key, &ver_val);
// snapshot read: the returned table version is only a hint for FE's version
// cache; the real increment is done by update_table_version() via atomic_add.
// A non-snapshot read would add ver_key to the read-conflict set and make
// concurrent commits on the same table conflict (KV_TXN_CONFLICT).
err = txn->get(ver_key, &ver_val, true);
int64_t table_version = 0;
if (err == TxnErrorCode::TXN_OK) {
if (!txn->decode_atomic_int(ver_val, &table_version)) {
Expand Down
18 changes: 15 additions & 3 deletions cloud/src/meta-service/meta_service_txn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1791,7 +1791,11 @@ void MetaServiceImpl::commit_txn_immediately(
int64_t table_id = i.first;
std::string ver_key = table_version_key({instance_id, db_id, table_id});
std::string ver_val;
err = txn->get(ver_key, &ver_val);
// snapshot read: the returned table version is only a hint for FE's version
// cache; the real increment is done by update_table_version() via atomic_add.
// A non-snapshot read would add ver_key to the read-conflict set and make
// concurrent commits on the same table conflict (KV_TXN_CONFLICT).
err = txn->get(ver_key, &ver_val, true);
int64_t table_version = 0;
if (err == TxnErrorCode::TXN_OK) {
if (!txn->decode_atomic_int(ver_val, &table_version)) {
Expand Down Expand Up @@ -2480,7 +2484,11 @@ void MetaServiceImpl::commit_txn_eventually(
int64_t table_id = i.first;
std::string ver_key = table_version_key({instance_id, db_id, table_id});
std::string ver_val;
err = txn->get(ver_key, &ver_val);
// snapshot read: the returned table version is only a hint for FE's version
// cache; the real increment is done by update_table_version() via atomic_add.
// A non-snapshot read would add ver_key to the read-conflict set and make
// concurrent commits on the same table conflict (KV_TXN_CONFLICT).
err = txn->get(ver_key, &ver_val, true);
int64_t table_version = 0;
if (err == TxnErrorCode::TXN_OK) {
if (!txn->decode_atomic_int(ver_val, &table_version)) {
Expand Down Expand Up @@ -2969,7 +2977,11 @@ void MetaServiceImpl::commit_txn_with_sub_txn(const CommitTxnRequest* request,
int64_t table_id = i.first;
std::string ver_key = table_version_key({instance_id, db_id, table_id});
std::string ver_val;
err = txn->get(ver_key, &ver_val);
// snapshot read: the returned table version is only a hint for FE's version
// cache; the real increment is done by update_table_version() via atomic_add.
// A non-snapshot read would add ver_key to the read-conflict set and make
// concurrent commits on the same table conflict (KV_TXN_CONFLICT).
err = txn->get(ver_key, &ver_val, true);
int64_t table_version = 0;
if (err == TxnErrorCode::TXN_OK) {
if (!txn->decode_atomic_int(ver_val, &table_version)) {
Expand Down
Loading