Skip to content

Commit 4fa9eaf

Browse files
committed
Remove unused ha_innobase::lock
In MySQL 5.7, a follow-up to WL#6671 removed the unused fields ha_innobase::lock and INNOBASE_SHARE::lock, but MariaDB did not remove them, even though a counterpart of WL#6671 itself was implemented as MDEV-7660 in commit d665e79. INNOBASE_SHARE was removed in MDEV-16557. Thus, all that needs to be removed is the unused member ha_innobase::lock and related code. Thanks to Monty (and Valgrind) for noticing that ha_innobase::lock was uninitialized.
1 parent bd7c316 commit 4fa9eaf

File tree

2 files changed

+0
-69
lines changed

2 files changed

+0
-69
lines changed

storage/innobase/handler/ha_innodb.cc

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -16523,73 +16523,6 @@ ha_innobase::store_lock(
1652316523
m_prebuilt->stored_select_lock_type = LOCK_NONE;
1652416524
}
1652516525

16526-
if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK) {
16527-
16528-
/* Starting from 5.0.7, we weaken also the table locks
16529-
set at the start of a MySQL stored procedure call, just like
16530-
we weaken the locks set at the start of an SQL statement.
16531-
MySQL does set in_lock_tables TRUE there, but in reality
16532-
we do not need table locks to make the execution of a
16533-
single transaction stored procedure call deterministic
16534-
(if it does not use a consistent read). */
16535-
16536-
if (lock_type == TL_READ
16537-
&& sql_command == SQLCOM_LOCK_TABLES) {
16538-
/* We come here if MySQL is processing LOCK TABLES
16539-
... READ LOCAL. MyISAM under that table lock type
16540-
reads the table as it was at the time the lock was
16541-
granted (new inserts are allowed, but not seen by the
16542-
reader). To get a similar effect on an InnoDB table,
16543-
we must use LOCK TABLES ... READ. We convert the lock
16544-
type here, so that for InnoDB, READ LOCAL is
16545-
equivalent to READ. This will change the InnoDB
16546-
behavior in mysqldump, so that dumps of InnoDB tables
16547-
are consistent with dumps of MyISAM tables. */
16548-
16549-
lock_type = TL_READ_NO_INSERT;
16550-
}
16551-
16552-
/* If we are not doing a LOCK TABLE, DISCARD/IMPORT
16553-
TABLESPACE or TRUNCATE TABLE then allow multiple
16554-
writers. Note that ALTER TABLE uses a TL_WRITE_ALLOW_READ
16555-
< TL_WRITE_CONCURRENT_INSERT.
16556-
16557-
We especially allow multiple writers if MySQL is at the
16558-
start of a stored procedure call (SQLCOM_CALL) or a
16559-
stored function call (MySQL does have in_lock_tables
16560-
TRUE there). */
16561-
16562-
if ((lock_type >= TL_WRITE_CONCURRENT_INSERT
16563-
&& lock_type <= TL_WRITE)
16564-
&& !(in_lock_tables
16565-
&& sql_command == SQLCOM_LOCK_TABLES)
16566-
&& !thd_tablespace_op(thd)
16567-
&& sql_command != SQLCOM_TRUNCATE
16568-
&& sql_command != SQLCOM_OPTIMIZE
16569-
&& sql_command != SQLCOM_CREATE_TABLE) {
16570-
16571-
lock_type = TL_WRITE_ALLOW_WRITE;
16572-
}
16573-
16574-
/* In queries of type INSERT INTO t1 SELECT ... FROM t2 ...
16575-
MySQL would use the lock TL_READ_NO_INSERT on t2, and that
16576-
would conflict with TL_WRITE_ALLOW_WRITE, blocking all inserts
16577-
to t2. Convert the lock to a normal read lock to allow
16578-
concurrent inserts to t2.
16579-
16580-
We especially allow concurrent inserts if MySQL is at the
16581-
start of a stored procedure call (SQLCOM_CALL)
16582-
(MySQL does have thd_in_lock_tables() TRUE there). */
16583-
16584-
if (lock_type == TL_READ_NO_INSERT
16585-
&& sql_command != SQLCOM_LOCK_TABLES) {
16586-
16587-
lock_type = TL_READ;
16588-
}
16589-
16590-
lock.type = lock_type;
16591-
}
16592-
1659316526
if (!trx_is_started(trx)
1659416527
&& (m_prebuilt->select_lock_type != LOCK_NONE
1659516528
|| m_prebuilt->stored_select_lock_type != LOCK_NONE)) {

storage/innobase/handler/ha_innodb.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,6 @@ class ha_innobase: public handler
461461
this is set in external_lock function */
462462
THD* m_user_thd;
463463

464-
THR_LOCK_DATA lock;
465-
466464
/** buffer used in updates */
467465
uchar* m_upd_buf;
468466

0 commit comments

Comments
 (0)