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

Compatible new field in write/lock cf with TiKV #7214

Merged
merged 6 commits into from
Apr 4, 2023
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
7 changes: 7 additions & 0 deletions dbms/src/Storages/Transaction/RegionCFDataBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,13 @@ inline void decodeLockCfValue(DecodedLockCFValue & res)
UNUSED(versions_to_last_change);
break;
}
case TXN_SOURCE_PREFIX_FOR_LOCK:
{
// Used for CDC, useless for TiFlash.
UInt64 txn_source_prefic = readVarUInt(data, len);
UNUSED(txn_source_prefic);
break;
}
default:
{
std::string msg = std::string("invalid flag ") + flag + " in lock value " + value.toDebugString();
Expand Down
18 changes: 18 additions & 0 deletions dbms/src/Storages/Transaction/TiKVRecordFormat.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ static const char ROLLBACK_TS_PREFIX = 'r';
static const char FLAG_OVERLAPPED_ROLLBACK = 'R';
static const char GC_FENCE_PREFIX = 'F';
static const char LAST_CHANGE_PREFIX = 'l';
static const char TXN_SOURCE_PREFIX_FOR_WRITE = 'S';
static const char TXN_SOURCE_PREFIX_FOR_LOCK = 's';

static const size_t SHORT_VALUE_MAX_LEN = 64;

Expand Down Expand Up @@ -427,6 +429,22 @@ inline DecodedWriteCFValue decodeWriteCfValue(const TiKVValue & value)
* rewriting record and there must be a complete row written to tikv, just ignore it in tiflash.
*/
return std::nullopt;
case RecordKVFormat::LAST_CHANGE_PREFIX:
{
// Used to accelerate TiKV MVCC scan, useless for TiFlash.
UInt64 last_change_ts = readUInt64(data, len);
UInt64 versions_to_last_change = readVarUInt(data, len);
UNUSED(last_change_ts);
UNUSED(versions_to_last_change);
break;
}
case RecordKVFormat::TXN_SOURCE_PREFIX_FOR_WRITE:
{
// Used for CDC, useless for TiFlash.
UInt64 txn_source_prefic = readVarUInt(data, len);
UNUSED(txn_source_prefic);
break;
}
default:
throw Exception("invalid flag " + std::to_string(flag) + " in write cf", ErrorCodes::LOGICAL_ERROR);
}
Expand Down