Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update components for txn file in serverless #9224

Merged
merged 7 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
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;
}
CalvinNeo marked this conversation as resolved.
Show resolved Hide resolved
#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{false};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to keep same format with bool use_async_commit{0};

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bool is_txn_file{false};
bool is_txn_file{0};

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, i changed back /cc @JaySon-Huang

// 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