diff --git a/dbms/src/Common/TiFlashMetrics.h b/dbms/src/Common/TiFlashMetrics.h index d8237aa9bee..7d29442957d 100644 --- a/dbms/src/Common/TiFlashMetrics.h +++ b/dbms/src/Common/TiFlashMetrics.h @@ -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, \ diff --git a/dbms/src/Storages/KVStore/FFI/ProxyFFI.h b/dbms/src/Storages/KVStore/FFI/ProxyFFI.h index 3b23ba28ed1..21e1e73808c 100644 --- a/dbms/src/Storages/KVStore/FFI/ProxyFFI.h +++ b/dbms/src/Storages/KVStore/FFI/ProxyFFI.h @@ -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, diff --git a/dbms/src/Storages/KVStore/MultiRaft/RegionData.cpp b/dbms/src/Storages/KVStore/MultiRaft/RegionData.cpp index 27f05766c9d..66acb0bac07 100644 --- a/dbms/src/Storages/KVStore/MultiRaft/RegionData.cpp +++ b/dbms/src/Storages/KVStore/MultiRaft/RegionData.cpp @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include #include @@ -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)) + { + GET_METRIC(tiflash_raft_read_index_events_count, type_bypass_lock).Increment(); + continue; + } + } return lock_info_ptr; } diff --git a/dbms/src/Storages/KVStore/Region.cpp b/dbms/src/Storages/KVStore/Region.cpp index ee1500af1e7..4f29de08e73 100644 --- a/dbms/src/Storages/KVStore/Region.cpp +++ b/dbms/src/Storages/KVStore/Region.cpp @@ -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