Skip to content

Pessimistic locks are left after the session gets killed #61454

@zyguan

Description

@zyguan

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

  • start a transaction and lock a key
    create table t (id int primary key, c int);
    insert into t values (1, 1), (2, 2), (3, 3);
    begin;
    select * from t where id = 1 for update;
  • kill the above session by kill <id>
  • query the mvcc info of the key
    curl 127.0.0.1:10080/mvcc/key/test/t/1

2. What did you expect to see? (Required)

the pessimistic lock should be rollbacked.

3. What did you see instead (Required)

the pessimistic lock was left because rollbackPessimisticLocks failed due to the kill flag.

$ curl 127.0.0.1:10080/mvcc/key/test/t/1
{
 "key": "7480000000000000705F728000000000000001",
 "region_id": 22,
 "value": {
  "info": {
   "lock": {
    "type": 5,
    "start_ts": 458469322054434817,
    "primary": "dIAAAAAAAABwX3KAAAAAAAAAAQ==",
    "last_change_ts": 458469321360015362,
    "versions_to_last_change": 1
   },
   "writes": [
    {
     "start_ts": 458469321360015361,
     "commit_ts": 458469321360015362,
     "short_value": "gAABAAAAAgEACg=="
    }
   ]
  }
 }
}

4. What is your TiDB version? (Required)

master

Metadata

Metadata

Assignees

No one assigned

    Labels

    affects-7.1This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.affects-8.5This bug affects the 8.5.x(LTS) versions.affects-9.0This bug affects the 9.0.x versions.severity/moderatesig/transactionSIG:Transactiontype/bugThe issue is confirmed as a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions