Skip to content

lock_manager: Skip updating lock wait info for non-fair-locking requests (#17500)#17870

Merged
ti-chi-bot[bot] merged 1 commit intotikv:masterfrom
MyonKeminta:m/deadlock-oom-simple-fix-master
Nov 20, 2024
Merged

lock_manager: Skip updating lock wait info for non-fair-locking requests (#17500)#17870
ti-chi-bot[bot] merged 1 commit intotikv:masterfrom
MyonKeminta:m/deadlock-oom-simple-fix-master

Conversation

@MyonKeminta
Copy link
Contributor

This PR ports #17500 to master.
#17500 was first planned to be used as the fix for versions <= 8.1, however, the complete fix (#17451) was then still considered too risky. So we decided to also use #17500 as the fix for master as well as 8.5 branch, and the complete fix will be left and may be considered in the future.

After this fix, there may be a little more false posotive / false negative cases in the deadlock detection under lock contention scenarios.

What is changed and how it works?

Issue Number: Close #17394

What's Changed:

lock_manager: Skip updating lock wait info for non-fair-locking requests

This is a simpler and lower-risky fix of the OOM issue #17394 for released branches, as an alternative solution to #17451 .
In this way, for acquire_pessimistic_lock requests without enabling fair locking, the behavior of update_wait_for will be a noop. So that if fair locking is globally disabled, the behavior will be equivalent to versions before 7.0.

This is a simple alternative solution to #17451 .
For non-fair locking scenario, it's confirmed that the problem can be avoided.

Before:
image

After:
image

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:
  • Need to cherry-pick to the release branch

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

Release note

Fix an issue that when frequently updating a row while many transaction is waiting on the lock, it might sometimes cause TiKV OOM

…sts (tikv#17500)

close tikv#17394

lock_manager: Skip updating lock wait info for non-fair-locking requests

This is a simpler and lower-risky fix of the OOM issue tikv#17394 for released branches, as an alternative solution to tikv#17451 .
In this way, for acquire_pessimistic_lock requests without enabling fair locking, the behavior of update_wait_for will be a noop. So that if fair locking is globally disabled, the behavior will be equivalent to versions before 7.0.

Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>
@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has signed the dco. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 20, 2024
@MyonKeminta MyonKeminta added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. labels Nov 20, 2024
@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Nov 20, 2024
@MyonKeminta MyonKeminta changed the title lock_manager: Skip updating lock wait info for non-fair-locking requests lock_manager: Skip updating lock wait info for non-fair-locking requests (#17500) Nov 20, 2024
@cfzjywxk cfzjywxk requested review from ekexium, you06 and zyguan November 20, 2024 09:24
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Nov 20, 2024
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Nov 20, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cfzjywxk, ekexium

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
Copy link
Contributor

ti-chi-bot bot commented Nov 20, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-11-20 07:05:44.634056963 +0000 UTC m=+15332.253711464: ☑️ agreed by cfzjywxk.
  • 2024-11-20 09:50:11.00794331 +0000 UTC m=+25198.627597823: ☑️ agreed by ekexium.

@ti-chi-bot ti-chi-bot bot merged commit 3bd8c24 into tikv:master Nov 20, 2024
@ti-chi-bot ti-chi-bot bot added this to the Pool milestone Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved dco-signoff: yes Indicates the PR's author has signed the dco. lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

Memory usage may grow unexpectedly and causes OOM in some high-concurrency lock contention scenarios

3 participants