summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-02-02 16:19:52 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2018-02-02 21:11:49 +0200
commit9390ff53fc39e34976cf051ce33649f9316bb8e6 (patch)
tree3c866577e5bf8a3fb771690d420cc645c7b6a877
parent859fe1f24d499b34d31807d267a534a7f72e9c03 (diff)
parentd13fbc6212e3fcaf4c0c4eee9c677151a6efafe2 (diff)
downloadmariadb-git-9390ff53fc39e34976cf051ce33649f9316bb8e6.tar.gz
MDEV-14958 Merge new release of InnoDB MySQL 5.7.21 to 10.2
Two follow-up tasks were filed for MySQL 5.7.21 changes that were not applied here: MDEV-15179 performance_schema.file_instances does not reflect RENAME TABLE MDEV-14222 Unnecessary 'cascade' memory allocation for every updated row when there is no FOREIGN KEY
-rw-r--r--mysql-test/r/partition_innodb.result27
-rw-r--r--mysql-test/suite/innodb/r/innodb_buffer_pool_resize.result34
-rw-r--r--mysql-test/suite/innodb/r/innodb_buffer_pool_resize_with_chunks.result26
-rw-r--r--mysql-test/suite/innodb/t/innodb_buffer_pool_resize.opt2
-rw-r--r--mysql-test/suite/innodb/t/innodb_buffer_pool_resize.test74
-rw-r--r--mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.opt3
-rw-r--r--mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.test63
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb.result2
-rw-r--r--mysql-test/t/partition_innodb.test28
-rw-r--r--storage/innobase/buf/buf0buf.cc21
-rw-r--r--storage/innobase/handler/ha_innodb.cc31
-rw-r--r--storage/innobase/include/row0mysql.h12
-rw-r--r--storage/innobase/include/univ.i4
-rw-r--r--storage/innobase/lock/lock0lock.cc7
-rw-r--r--storage/innobase/row/row0mysql.cc53
15 files changed, 294 insertions, 93 deletions
diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result
index c74f25928a9..942455f23ed 100644
--- a/mysql-test/r/partition_innodb.result
+++ b/mysql-test/r/partition_innodb.result
@@ -900,3 +900,30 @@ SELECT b FROM t1 WHERE b = 0;
ERROR HY000: Table definition has changed, please retry transaction
disconnect con1;
DROP TABLE t1;
+#
+# Bug#26390658 RENAMING A PARTITIONED TABLE DOES NOT UPDATE
+# MYSQL.INNODB_TABLE_STATS
+#
+CREATE DATABASE test_jfg;
+CREATE TABLE test_jfg.test_jfg1 (id int(10) unsigned NOT NULL,PRIMARY
+KEY (id)) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=1;
+CREATE TABLE test_jfg.test_jfg2 (id int(10) unsigned NOT NULL,PRIMARY
+KEY (id)) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=1
+PARTITION BY RANGE ( id ) (PARTITION p1000 VALUES LESS THAN (1000)
+ENGINE = InnoDB,PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE =
+InnoDB);
+SELECT database_name, table_name FROM mysql.innodb_table_stats WHERE
+database_name = 'test_jfg';
+database_name table_name
+test_jfg test_jfg1
+test_jfg test_jfg2#P#p1000
+test_jfg test_jfg2#P#pmax
+RENAME TABLE test_jfg.test_jfg1 TO test_jfg.test_jfg11;
+RENAME TABLE test_jfg.test_jfg2 TO test_jfg.test_jfg12;
+SELECT database_name, table_name FROM mysql.innodb_table_stats WHERE
+database_name = 'test_jfg';
+database_name table_name
+test_jfg test_jfg11
+test_jfg test_jfg12#P#p1000
+test_jfg test_jfg12#P#pmax
+DROP DATABASE test_jfg;
diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize.result
new file mode 100644
index 00000000000..667d31a0b69
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize.result
@@ -0,0 +1,34 @@
+set global innodb_adaptive_hash_index=ON;
+select @@innodb_buffer_pool_size;
+@@innodb_buffer_pool_size
+8388608
+set global innodb_buffer_pool_size = 10485760;
+Warnings:
+Warning 1292 Truncated incorrect innodb_buffer_pool_size value: '10485760'
+select @@innodb_buffer_pool_size;
+@@innodb_buffer_pool_size
+16777216
+create table t1 (id int not null, val int not null default '0', primary key (id)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
+create or replace view view0 as select 1 union all select 1;
+set @`v_id` := 0;
+set @`v_val` := 0;
+replace into t1 select (@`v_id` := (@`v_id` + 4) mod 4294967296) as id, (@`v_val` := (@`v_val` + 4) mod 4294967296) as val from view0 v0, view0 v1, view0 v2, view0 v3, view0 v4, view0 v5, view0 v6, view0 v7, view0 v8, view0 v9, view0 v10, view0 v11, view0 v12, view0 v13, view0 v14, view0 v15, view0 v16, view0 v17;
+set global innodb_buffer_pool_size = 7340032;
+Warnings:
+Warning 1292 Truncated incorrect innodb_buffer_pool_size value: '7340032'
+select @@innodb_buffer_pool_size;
+@@innodb_buffer_pool_size
+8388608
+select count(val) from t1;
+count(val)
+262144
+set global innodb_adaptive_hash_index=OFF;
+set global innodb_buffer_pool_size = 25165824;
+select @@innodb_buffer_pool_size;
+@@innodb_buffer_pool_size
+25165824
+select count(val) from t1;
+count(val)
+262144
+drop table t1;
+drop view view0;
diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_with_chunks.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_with_chunks.result
new file mode 100644
index 00000000000..4bf244c9588
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_with_chunks.result
@@ -0,0 +1,26 @@
+select @@innodb_buffer_pool_chunk_size;
+@@innodb_buffer_pool_chunk_size
+2097152
+create table t1 (id int not null, val int not null default '0', primary key (id)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
+create or replace view view0 as select 1 union all select 1;
+set @`v_id` := 0;
+set @`v_val` := 0;
+replace into t1 select (@`v_id` := (@`v_id` + 4) mod 4294967296) as id, (@`v_val` := (@`v_val` + 4) mod 4294967296) as val from view0 v0, view0 v1, view0 v2, view0 v3, view0 v4, view0 v5, view0 v6, view0 v7, view0 v8, view0 v9, view0 v10, view0 v11, view0 v12, view0 v13, view0 v14, view0 v15, view0 v16, view0 v17;
+set global innodb_buffer_pool_size = 7340032;
+Warnings:
+Warning 1292 Truncated incorrect innodb_buffer_pool_size value: '7340032'
+select count(val) from t1;
+count(val)
+262144
+set global innodb_buffer_pool_size = 16777216;
+select count(val) from t1;
+count(val)
+262144
+drop table t1;
+drop view view0;
+set global innodb_buffer_pool_size = 1048576;
+Warnings:
+Warning 1292 Truncated incorrect innodb_buffer_pool_size value: '1048576'
+select @@innodb_buffer_pool_size;
+@@innodb_buffer_pool_size
+6291456
diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.opt b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.opt
new file mode 100644
index 00000000000..39543543a53
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.opt
@@ -0,0 +1,2 @@
+--innodb-buffer-pool-size=8M
+--innodb-page-size=4k
diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.test
new file mode 100644
index 00000000000..77fdb49a57d
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.test
@@ -0,0 +1,74 @@
+#
+# WL6117 : Resize the InnoDB Buffer Pool Online
+#
+
+--source include/have_innodb.inc
+--source include/big_test.inc
+
+let $wait_timeout = 180;
+let $wait_condition =
+ SELECT SUBSTR(variable_value, 1, 34) = 'Completed resizing buffer pool at '
+ FROM information_schema.global_status
+ WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status';
+
+--disable_query_log
+set @old_innodb_buffer_pool_size = @@innodb_buffer_pool_size;
+set @old_innodb_adaptive_hash_index = @@innodb_adaptive_hash_index;
+if (`select (version() like '%debug%') > 0`)
+{
+ set @old_innodb_disable_resize = @@innodb_disable_resize_buffer_pool_debug;
+ set global innodb_disable_resize_buffer_pool_debug = OFF;
+}
+--enable_query_log
+
+set global innodb_adaptive_hash_index=ON;
+
+select @@innodb_buffer_pool_size;
+
+# Expand buffer pool
+set global innodb_buffer_pool_size = 10485760;
+
+--source include/wait_condition.inc
+
+select @@innodb_buffer_pool_size;
+
+# fill buffer pool
+create table t1 (id int not null, val int not null default '0', primary key (id)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
+create or replace view view0 as select 1 union all select 1;
+
+set @`v_id` := 0;
+set @`v_val` := 0;
+
+# 2^18 == 262144 records
+replace into t1 select (@`v_id` := (@`v_id` + 4) mod 4294967296) as id, (@`v_val` := (@`v_val` + 4) mod 4294967296) as val from view0 v0, view0 v1, view0 v2, view0 v3, view0 v4, view0 v5, view0 v6, view0 v7, view0 v8, view0 v9, view0 v10, view0 v11, view0 v12, view0 v13, view0 v14, view0 v15, view0 v16, view0 v17;
+
+# Shrink buffer pool
+set global innodb_buffer_pool_size = 7340032;
+--source include/wait_condition.inc
+
+select @@innodb_buffer_pool_size;
+
+select count(val) from t1;
+
+set global innodb_adaptive_hash_index=OFF;
+
+# Expand buffer pool to 24MB
+set global innodb_buffer_pool_size = 25165824;
+--source include/wait_condition.inc
+
+select @@innodb_buffer_pool_size;
+
+select count(val) from t1;
+
+drop table t1;
+drop view view0;
+
+--disable_query_log
+set global innodb_adaptive_hash_index = @old_innodb_adaptive_hash_index;
+set global innodb_buffer_pool_size = @old_innodb_buffer_pool_size;
+if (`select (version() like '%debug%') > 0`)
+{
+ set global innodb_disable_resize_buffer_pool_debug = @old_innodb_disable_resize;
+}
+--enable_query_log
+--source include/wait_condition.inc
diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.opt b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.opt
new file mode 100644
index 00000000000..b97a3995457
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.opt
@@ -0,0 +1,3 @@
+--innodb-buffer-pool-size=16M
+--innodb-buffer-pool-chunk-size=2M
+--innodb-page-size=4k
diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.test
new file mode 100644
index 00000000000..b04b0306bf1
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.test
@@ -0,0 +1,63 @@
+#
+# WL6117 : Resize the InnoDB Buffer Pool Online
+# (innodb_buffer_pool_chunk_size used case)
+#
+
+--source include/have_innodb.inc
+--source include/big_test.inc
+
+let $wait_timeout = 180;
+let $wait_condition =
+ SELECT SUBSTR(variable_value, 1, 34) = 'Completed resizing buffer pool at '
+ FROM information_schema.global_status
+ WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status';
+
+--disable_query_log
+set @old_innodb_buffer_pool_size = @@innodb_buffer_pool_size;
+if (`select (version() like '%debug%') > 0`)
+{
+ set @old_innodb_disable_resize = @@innodb_disable_resize_buffer_pool_debug;
+ set global innodb_disable_resize_buffer_pool_debug = OFF;
+}
+--enable_query_log
+
+select @@innodb_buffer_pool_chunk_size;
+
+# fill buffer pool
+create table t1 (id int not null, val int not null default '0', primary key (id)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
+create or replace view view0 as select 1 union all select 1;
+
+set @`v_id` := 0;
+set @`v_val` := 0;
+
+# 2^18 == 262144 records
+replace into t1 select (@`v_id` := (@`v_id` + 4) mod 4294967296) as id, (@`v_val` := (@`v_val` + 4) mod 4294967296) as val from view0 v0, view0 v1, view0 v2, view0 v3, view0 v4, view0 v5, view0 v6, view0 v7, view0 v8, view0 v9, view0 v10, view0 v11, view0 v12, view0 v13, view0 v14, view0 v15, view0 v16, view0 v17;
+
+# Shrink buffer pool to 7MB
+set global innodb_buffer_pool_size = 7340032;
+--source include/wait_condition.inc
+
+select count(val) from t1;
+
+# Expand buffer pool to 16MB
+set global innodb_buffer_pool_size = 16777216;
+--source include/wait_condition.inc
+
+select count(val) from t1;
+
+drop table t1;
+drop view view0;
+
+# Try to shrink buffer pool to smaller than chunk size
+set global innodb_buffer_pool_size = 1048576;
+--source include/wait_condition.inc
+select @@innodb_buffer_pool_size;
+
+--disable_query_log
+set global innodb_buffer_pool_size = @old_innodb_buffer_pool_size;
+if (`select (version() like '%debug%') > 0`)
+{
+ set global innodb_disable_resize_buffer_pool_debug = @old_innodb_disable_resize;
+}
+--enable_query_log
+--source include/wait_condition.inc
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
index c79b5e4de34..7f606f6f572 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
@@ -3046,7 +3046,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_VERSION
SESSION_VALUE NULL
-GLOBAL_VALUE 5.7.20
+GLOBAL_VALUE 5.7.21
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL
VARIABLE_SCOPE GLOBAL
diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test
index 300121e88fd..7b5a69fe622 100644
--- a/mysql-test/t/partition_innodb.test
+++ b/mysql-test/t/partition_innodb.test
@@ -991,3 +991,31 @@ SELECT b FROM t1 WHERE b = 0;
SELECT b FROM t1 WHERE b = 0;
--disconnect con1
DROP TABLE t1;
+
+--echo #
+--echo # Bug#26390658 RENAMING A PARTITIONED TABLE DOES NOT UPDATE
+--echo # MYSQL.INNODB_TABLE_STATS
+--echo #
+
+CREATE DATABASE test_jfg;
+
+CREATE TABLE test_jfg.test_jfg1 (id int(10) unsigned NOT NULL,PRIMARY
+KEY (id)) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=1;
+CREATE TABLE test_jfg.test_jfg2 (id int(10) unsigned NOT NULL,PRIMARY
+KEY (id)) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=1
+PARTITION BY RANGE ( id ) (PARTITION p1000 VALUES LESS THAN (1000)
+ENGINE = InnoDB,PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE =
+InnoDB);
+
+--replace_result #p# #P#
+SELECT database_name, table_name FROM mysql.innodb_table_stats WHERE
+database_name = 'test_jfg';
+
+RENAME TABLE test_jfg.test_jfg1 TO test_jfg.test_jfg11;
+RENAME TABLE test_jfg.test_jfg2 TO test_jfg.test_jfg12;
+
+--replace_result #p# #P#
+SELECT database_name, table_name FROM mysql.innodb_table_stats WHERE
+database_name = 'test_jfg';
+
+DROP DATABASE test_jfg;
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index 07d3f7efe27..445a6597f7d 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
-Copyright (c) 2013, 2017, MariaDB Corporation.
+Copyright (c) 2013, 2018, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -3141,11 +3141,26 @@ buf_pool_clear_hash_index()
see the comments in buf0buf.h */
if (!index) {
+# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
+ ut_a(!block->n_pointers);
+# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
continue;
}
- ut_ad(buf_block_get_state(block)
- == BUF_BLOCK_FILE_PAGE);
+ ut_d(buf_page_state state
+ = buf_block_get_state(block));
+ /* Another thread may have set the
+ state to BUF_BLOCK_REMOVE_HASH in
+ buf_LRU_block_remove_hashed().
+
+ The state change in buf_page_realloc()
+ is not observable here, because in
+ that case we would have !block->index.
+
+ In the end, the entire adaptive hash
+ index will be removed. */
+ ut_ad(state == BUF_BLOCK_FILE_PAGE
+ || state == BUF_BLOCK_REMOVE_HASH);
# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
block->n_pointers = 0;
# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 5dee02bed67..11b11db09a7 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -13762,26 +13762,6 @@ innobase_rename_table(
error = row_rename_table_for_mysql(norm_from, norm_to, trx, TRUE);
- if (error == DB_TABLE_NOT_FOUND) {
- /* May be partitioned table, which consists of partitions
- named table_name#P#partition_name[#SP#subpartition_name].
-
- We are doing a DDL operation. */
- ++trx->will_lock;
- trx_set_dict_operation(trx, TRX_DICT_OP_INDEX);
- trx_start_if_not_started(trx, true);
- error = row_rename_partitions_for_mysql(norm_from, norm_to,
- trx);
- if (error == DB_TABLE_NOT_FOUND) {
- ib::error() << "Table " << ut_get_name(trx, norm_from)
- << " does not exist in the InnoDB internal"
- " data dictionary though MariaDB is trying to"
- " rename the table. Have you copied the .frm"
- " file of the table to the MariaDB database"
- " directory from another database? "
- << TROUBLESHOOTING_MSG;
- }
- }
if (error != DB_SUCCESS) {
if (error == DB_TABLE_NOT_FOUND
&& innobase_get_lower_case_table_names() == 1) {
@@ -22566,8 +22546,19 @@ innodb_buffer_pool_size_validate(
*static_cast<longlong*>(save) = requested_buf_pool_size;
+ if (srv_buf_pool_size == static_cast<ulint>(intbuf)) {
+ buf_pool_mutex_exit_all();
+ /* nothing to do */
+ return(0);
+ }
+
if (srv_buf_pool_size == requested_buf_pool_size) {
buf_pool_mutex_exit_all();
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_WRONG_ARGUMENTS,
+ "innodb_buffer_pool_size must be at least"
+ " innodb_buffer_pool_chunk_size=%lu",
+ srv_buf_pool_chunk_unit);
/* nothing to do */
return(0);
}
diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h
index 5cb0249517c..85f763f07a9 100644
--- a/storage/innobase/include/row0mysql.h
+++ b/storage/innobase/include/row0mysql.h
@@ -494,18 +494,6 @@ row_rename_table_for_mysql(
bool commit) /*!< in: whether to commit trx */
MY_ATTRIBUTE((nonnull, warn_unused_result));
-/** Renames a partitioned table for MySQL.
-@param[in] old_name Old table name.
-@param[in] new_name New table name.
-@param[in,out] trx Transaction.
-@return error code or DB_SUCCESS */
-dberr_t
-row_rename_partitions_for_mysql(
- const char* old_name,
- const char* new_name,
- trx_t* trx)
- MY_ATTRIBUTE((nonnull, warn_unused_result));
-
/*********************************************************************//**
Scans an index for either COOUNT(*) or CHECK TABLE.
If CHECK TABLE; Checks that the index contains entries in an ascending order,
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index ce124f2fe11..cab1a484b22 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2017, MariaDB Corporation.
+Copyright (c) 2013, 2018, MariaDB Corporation.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -41,7 +41,7 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_MAJOR 5
#define INNODB_VERSION_MINOR 7
-#define INNODB_VERSION_BUGFIX 20
+#define INNODB_VERSION_BUGFIX 21
/* The following is the InnoDB version as shown in
SELECT plugin_version FROM information_schema.plugins;
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index f25ac596d5f..cde267aa638 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2014, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
@@ -2728,7 +2728,10 @@ RecLock::lock_add_priority(
lock_t* grant_position = NULL;
lock_t* add_position = NULL;
- HASH_SEARCH(hash, lock_sys->rec_hash, m_rec_id.fold(), lock_t*,
+ /* Different lock (such as predicate lock) are on different hash */
+ hash_table_t* lock_hash = lock_hash_get(m_mode);
+
+ HASH_SEARCH(hash, lock_hash, m_rec_id.fold(), lock_t*,
lock_head, ut_ad(lock_head->is_record_lock()), true);
ut_ad(lock_head);
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index 7c1c07e4a74..ffd884b2755 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -4837,59 +4837,6 @@ funct_exit:
return(err);
}
-/** Renames a partitioned table for MySQL.
-@param[in] old_name Old table name.
-@param[in] new_name New table name.
-@param[in,out] trx Transaction.
-@return error code or DB_SUCCESS */
-dberr_t
-row_rename_partitions_for_mysql(
- const char* old_name,
- const char* new_name,
- trx_t* trx)
-{
- char from_name[FN_REFLEN];
- char to_name[FN_REFLEN];
- ulint from_len = strlen(old_name);
- ulint to_len = strlen(new_name);
- char* table_name;
- dberr_t error = DB_TABLE_NOT_FOUND;
-
- ut_a(from_len < (FN_REFLEN - 4));
- ut_a(to_len < (FN_REFLEN - 4));
- memcpy(from_name, old_name, from_len);
- from_name[from_len] = '#';
- from_name[from_len + 1] = 0;
- while ((table_name = dict_get_first_table_name_in_db(from_name))) {
- ut_a(memcmp(table_name, from_name, from_len) == 0);
- /* Must match #[Pp]#<partition_name> */
- if (strlen(table_name) <= (from_len + 3)
- || table_name[from_len] != '#'
- || table_name[from_len + 2] != '#'
- || (table_name[from_len + 1] != 'P'
- && table_name[from_len + 1] != 'p')) {
-
- ut_ad(0);
- ut_free(table_name);
- continue;
- }
- memcpy(to_name, new_name, to_len);
- memcpy(to_name + to_len, table_name + from_len,
- strlen(table_name) - from_len + 1);
- error = row_rename_table_for_mysql(table_name, to_name,
- trx, false);
- if (error != DB_SUCCESS) {
- /* Rollback and return. */
- trx_rollback_for_mysql(trx);
- ut_free(table_name);
- return(error);
- }
- ut_free(table_name);
- }
- trx_commit_for_mysql(trx);
- return(error);
-}
-
/*********************************************************************//**
Scans an index for either COUNT(*) or CHECK TABLE.
If CHECK TABLE; Checks that the index contains entries in an ascending order,