Skip to content

support bypassing shared lock#10667

Open
you06 wants to merge 3 commits intopingcap:masterfrom
you06:support-shared-lock
Open

support bypassing shared lock#10667
you06 wants to merge 3 commits intopingcap:masterfrom
you06:support-shared-lock

Conversation

@you06
Copy link

@you06 you06 commented Jan 19, 2026

What problem does this PR solve?

Issue Number: close #10704

Problem Summary:

What is changed and how it works?

This PR support parsing the TiKV's shared lock and bypass them in conflict check.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

None

Summary by CodeRabbit

  • New Features
    • Added support for a new shared lock type in the KV store and added corresponding metric tracking.
  • Tests
    • Added tests to validate detection and scanner behavior with the new shared lock.
  • Chores
    • Updated a vendored submodule reference.

Signed-off-by: you06 <you1474600@gmail.com>
@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 19, 2026
@pingcap-cla-assistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai
Copy link

coderabbitai bot commented Jan 19, 2026

📝 Walkthrough

Walkthrough

Adds explicit support for a new Shared lock type: enum value, decoding and retrieval handling, metric tracking, test coverage, and an updated contrib/kvproto submodule reference.

Changes

Cohort / File(s) Summary
Lock Type Definition
dbms/src/Storages/KVStore/TiKVHelpers/TiKVRecordFormat.h
Added Shared = 'H' enumerator to DB::RecordKVFormat::LockType.
Lock Decoding & Retrieval
dbms/src/Storages/KVStore/TiKVHelpers/DecodedLockCFValue.cpp
Recognize Shared in decodeLockCfValue (set res.lock_type = SharedLock and early return); treat SharedLock like Lock/PessimisticLock in Inner::getLockInfoPtr (returns nullptr).
Metrics
dbms/src/Common/TiFlashMetrics.h
Added new sub-metric type_shared_lock_put to tiflash_raft_process_keys metric set.
Tests
dbms/src/Storages/KVStore/tests/gtest_kvstore.cpp
Added test block inserting a LockType::Shared entry and asserting scanner returns no LockInfo (mirrors existing lock tests).
Submodule
contrib/kvproto
Updated kvproto submodule reference from commit db74bf0e3ac1... to 6db24b6c67f3... (single-line ref update).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I nibble code with gentle hop,
'H' arrives — a SharedLock stop,
Decoders learn the new small mark,
Metrics count it in the ark,
Tests nod softly — all is copacetic.

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'support bypassing shared lock' is directly related to the main change: adding support for parsing and bypassing shared locks in conflict checks, as reflected across all modified files.
Description check ✅ Passed The PR description follows the template with issue reference, commit message, and test checklist completed; however, the Problem Summary section is empty.
Linked Issues check ✅ Passed The PR successfully implements support for parsing and handling TiKV's shared locks as required by #10704, with proper enum additions, parsing logic, metrics tracking, and unit test coverage.
Out of Scope Changes check ✅ Passed All changes are in scope: enum/metric additions for shared lock support, parsing logic in DecodedLockCFValue, submodule update for kvproto, and unit tests—all directly supporting the shared lock feature.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@you06
Copy link
Author

you06 commented Jan 28, 2026

/release

Signed-off-by: you06 <you1474600@gmail.com>
@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Feb 5, 2026
Signed-off-by: you06 <you1474600@gmail.com>
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Feb 6, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CalvinNeo, gengliqi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Feb 6, 2026
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Feb 6, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-02-05 08:04:20.833979341 +0000 UTC m=+340531.935378054: ☑️ agreed by gengliqi.
  • 2026-02-06 03:17:50.799147216 +0000 UTC m=+409741.900545936: ☑️ agreed by CalvinNeo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support shared lock

3 participants