summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2022-01-10 19:15:39 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2022-01-10 19:19:15 +0530
commit428b057ee06dca05a3d20f5b4cc32ceedbc37836 (patch)
tree7c1db7a17987b895a6a27cb3530f1eac3346a858
parentfcbd3989243ec6b0505f8665fc6850f1449afb14 (diff)
downloadmariadb-git-bb-10.6-MDEV-27640.tar.gz
MDEV-27640 trx_has_lock_x() gives wrong result if the table has pending table lockbb-10.6-MDEV-27640
trx_has_lock_x() fails to find whether the trx has X-lock on the table when other transactions are waiting for an X or S lock on the table.
-rw-r--r--storage/innobase/trx/trx0rec.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc
index 8d9a7d6f796..9447461e944 100644
--- a/storage/innobase/trx/trx0rec.cc
+++ b/storage/innobase/trx/trx0rec.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2019, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2021, MariaDB Corporation.
+Copyright (c) 2017, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -1979,7 +1979,7 @@ static bool trx_has_lock_x(const trx_t &trx, dict_table_t& table)
/* This thread is executing trx. No other thread can modify our table locks
(only record locks might be created, in an implicit-to-explicit conversion).
Hence, no mutex is needed here. */
- if (n == 1)
+ if (n)
for (const lock_t *lock : trx.lock.table_locks)
if (lock && lock->type_mode == (LOCK_X | LOCK_TABLE))
return true;