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

KVStore: Record bypass lock in resolve lock #8883

Merged
merged 5 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions dbms/src/Common/TiFlashMetrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ static_assert(RAFT_REGION_BIG_WRITE_THRES * 4 < RAFT_REGION_BIG_WRITE_MAX, "Inva
M(tiflash_raft_read_index_events_count, \
"Raft read index events counter", \
Counter, \
F(type_bypass_lock, {{"type", "bypass_lock"}}), \
F(type_use_histroy, {{"type", "use_histroy"}}), \
F(type_use_cache, {{"type", "use_cache"}})) \
M(tiflash_raft_learner_read_failures_count, \
Expand Down
1 change: 1 addition & 0 deletions dbms/src/Storages/KVStore/FFI/ProxyFFI.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ inline EngineStoreServerHelper GetEngineStoreServerHelper(EngineStoreServerWrap
.fn_set_pb_msg_by_bytes = SetPBMsByBytes,
.fn_handle_safe_ts_update = HandleSafeTSUpdate,
.fn_fast_add_peer = FastAddPeer,
.fn_get_lock_by_key = GetLockByKey,
.fn_query_fap_snapshot_state = QueryFapSnapshotState,
.fn_clear_fap_snapshot = ClearFapSnapshot,
.fn_kvstore_region_exists = KvstoreRegionExists,
Expand Down
11 changes: 9 additions & 2 deletions dbms/src/Storages/KVStore/MultiRaft/RegionData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <Common/TiFlashMetrics.h>
#include <IO/ReadHelpers.h>
#include <IO/WriteHelpers.h>
#include <Storages/KVStore/FFI/ColumnFamily.h>
Expand Down Expand Up @@ -228,8 +229,14 @@ DecodedLockCFValuePtr RegionData::getLockInfo(const RegionLockReadQuery & query)
continue;
if (lock_info.min_commit_ts > query.read_tso)
continue;
if (query.bypass_lock_ts && query.bypass_lock_ts->count(lock_info.lock_version))
continue;
if (query.bypass_lock_ts)
{
if (query.bypass_lock_ts->count(lock_info.lock_version))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (query.bypass_lock_ts->count(lock_info.lock_version))
if (query.bypass_lock_ts->contains(lock_info.lock_version))

{
GET_METRIC(tiflash_raft_read_index_events_count, type_bypass_lock).Increment();
continue;
}
}
return lock_info_ptr;
}

Expand Down
5 changes: 3 additions & 2 deletions dbms/src/Storages/KVStore/Region.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,15 @@ std::string Region::getDebugString() const
{
const auto & meta_snap = meta.dumpRegionMetaSnapshot();
return fmt::format(
"[region_id={} index={} table_id={} ver={} conf_ver={} state={} peer={}]",
"[region_id={} index={} table_id={} ver={} conf_ver={} state={} peer={} range={}]",
id(),
meta.appliedIndex(),
mapped_table_id,
meta_snap.ver,
meta_snap.conf_ver,
raft_serverpb::PeerState_Name(peerState()),
meta_snap.peer.ShortDebugString());
meta_snap.peer.ShortDebugString(),
getRange()->toDebugString());
}

std::string Region::toString(bool dump_status) const
Expand Down