Commit 4fa9eaf4 authored by Marko Mäkelä's avatar Marko Mäkelä

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 d665e79c.

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.
parent bd7c3162
......@@ -16523,73 +16523,6 @@ ha_innobase::store_lock(
m_prebuilt->stored_select_lock_type = LOCK_NONE;
}
if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK) {
/* Starting from 5.0.7, we weaken also the table locks
set at the start of a MySQL stored procedure call, just like
we weaken the locks set at the start of an SQL statement.
MySQL does set in_lock_tables TRUE there, but in reality
we do not need table locks to make the execution of a
single transaction stored procedure call deterministic
(if it does not use a consistent read). */
if (lock_type == TL_READ
&& sql_command == SQLCOM_LOCK_TABLES) {
/* We come here if MySQL is processing LOCK TABLES
... READ LOCAL. MyISAM under that table lock type
reads the table as it was at the time the lock was
granted (new inserts are allowed, but not seen by the
reader). To get a similar effect on an InnoDB table,
we must use LOCK TABLES ... READ. We convert the lock
type here, so that for InnoDB, READ LOCAL is
equivalent to READ. This will change the InnoDB
behavior in mysqldump, so that dumps of InnoDB tables
are consistent with dumps of MyISAM tables. */
lock_type = TL_READ_NO_INSERT;
}
/* If we are not doing a LOCK TABLE, DISCARD/IMPORT
TABLESPACE or TRUNCATE TABLE then allow multiple
writers. Note that ALTER TABLE uses a TL_WRITE_ALLOW_READ
< TL_WRITE_CONCURRENT_INSERT.
We especially allow multiple writers if MySQL is at the
start of a stored procedure call (SQLCOM_CALL) or a
stored function call (MySQL does have in_lock_tables
TRUE there). */
if ((lock_type >= TL_WRITE_CONCURRENT_INSERT
&& lock_type <= TL_WRITE)
&& !(in_lock_tables
&& sql_command == SQLCOM_LOCK_TABLES)
&& !thd_tablespace_op(thd)
&& sql_command != SQLCOM_TRUNCATE
&& sql_command != SQLCOM_OPTIMIZE
&& sql_command != SQLCOM_CREATE_TABLE) {
lock_type = TL_WRITE_ALLOW_WRITE;
}
/* In queries of type INSERT INTO t1 SELECT ... FROM t2 ...
MySQL would use the lock TL_READ_NO_INSERT on t2, and that
would conflict with TL_WRITE_ALLOW_WRITE, blocking all inserts
to t2. Convert the lock to a normal read lock to allow
concurrent inserts to t2.
We especially allow concurrent inserts if MySQL is at the
start of a stored procedure call (SQLCOM_CALL)
(MySQL does have thd_in_lock_tables() TRUE there). */
if (lock_type == TL_READ_NO_INSERT
&& sql_command != SQLCOM_LOCK_TABLES) {
lock_type = TL_READ;
}
lock.type = lock_type;
}
if (!trx_is_started(trx)
&& (m_prebuilt->select_lock_type != LOCK_NONE
|| m_prebuilt->stored_select_lock_type != LOCK_NONE)) {
......
......@@ -461,8 +461,6 @@ class ha_innobase: public handler
this is set in external_lock function */
THD* m_user_thd;
THR_LOCK_DATA lock;
/** buffer used in updates */
uchar* m_upd_buf;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment