Skip to content

Commit

Permalink
Update components for txn file in serverless (#9224)
Browse files Browse the repository at this point in the history
close #9225

Co-authored-by: JaySon <[email protected]>
  • Loading branch information
CalvinNeo and JaySon-Huang authored Jul 12, 2024
1 parent 81034bf commit d3bd50c
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion contrib/client-c
10 changes: 9 additions & 1 deletion dbms/src/Storages/KVStore/TiKVHelpers/DecodedLockCFValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ inline void decodeLockCfValue(DecodedLockCFValue & res)
res.txn_size = readUInt64(data, len);
break;
}
#if SERVERLESS_PROXY != 0
case IS_TXN_FILE_PREFIX:
{
res.is_txn_file = true;
break;
}
#endif
case ASYNC_COMMIT_PREFIX:
{
res.use_async_commit = true;
Expand Down Expand Up @@ -159,6 +166,7 @@ void DecodedLockCFValue::intoLockInfo(kvrpcpb::LockInfo & res) const
res.set_txn_size(txn_size);
res.set_use_async_commit(use_async_commit);
res.set_key(decodeTiKVKey(*key));
res.set_is_txn_file(is_txn_file);

if (use_async_commit)
{
Expand All @@ -185,4 +193,4 @@ bool DecodedLockCFValue::isLargeTxn() const
}

} // namespace RecordKVFormat
} // namespace DB
} // namespace DB
3 changes: 2 additions & 1 deletion dbms/src/Storages/KVStore/TiKVHelpers/DecodedLockCFValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ struct DecodedLockCFValue : boost::noncopyable
UInt64 min_commit_ts{0};
std::string_view secondaries;
std::string_view primary_lock;
bool is_txn_file{0};
// For large txn, generation is not zero.
UInt64 generation{0};
};

} // namespace DB::RecordKVFormat
} // namespace DB::RecordKVFormat
1 change: 1 addition & 0 deletions dbms/src/Storages/KVStore/TiKVHelpers/TiKVRecordFormat.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ static const char SHORT_VALUE_PREFIX = 'v';
static const char MIN_COMMIT_TS_PREFIX = 'c';
static const char FOR_UPDATE_TS_PREFIX = 'f';
static const char TXN_SIZE_PREFIX = 't';
static const char IS_TXN_FILE_PREFIX = 'T';
static const char ASYNC_COMMIT_PREFIX = 'a';
static const char ROLLBACK_TS_PREFIX = 'r';
static const char FLAG_OVERLAPPED_ROLLBACK = 'R';
Expand Down

0 comments on commit d3bd50c

Please sign in to comment.