summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-11-12 11:18:04 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2020-11-12 11:18:04 +0200
commit972dc6ee98b6447363ccbc5dcb921d3542d7d238 (patch)
tree2b2317a9e8a61a6ac385e7c1592eb921a4be36c8
parent2fbcddbeafb558720f4b74b0a8f68c18b48d9f2e (diff)
parent150f447af1d9ffff168372505e5c9b4297bdd9d4 (diff)
downloadmariadb-git-972dc6ee98b6447363ccbc5dcb921d3542d7d238.tar.gz
Merge 10.3 into 10.4
-rwxr-xr-xmysql-test/mysql-test-run.pl3
-rw-r--r--mysql-test/suite/galera/r/galera_trigger.result44
-rw-r--r--mysql-test/suite/galera/t/galera_trigger.test36
-rw-r--r--mysql-test/suite/maria/repair.result16
-rw-r--r--mysql-test/suite/maria/repair.test11
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result2
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test12
-rw-r--r--scripts/mysqld_safe.sh3
-rw-r--r--sql/sql_admin.cc45
-rw-r--r--storage/innobase/buf/buf0buf.cc6
-rw-r--r--storage/innobase/dict/dict0dict.cc85
-rw-r--r--storage/innobase/handler/ha_innodb.cc2
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.cc105
-rw-r--r--storage/innobase/include/dict0dict.h27
-rw-r--r--storage/innobase/include/ibuf0ibuf.h18
-rw-r--r--storage/innobase/include/trx0trx.h14
-rw-r--r--storage/innobase/log/log0recv.cc2
-rw-r--r--storage/innobase/trx/trx0rec.cc8
-rw-r--r--storage/innobase/trx/trx0trx.cc4
-rw-r--r--storage/maria/ma_check.c34
-rw-r--r--storage/maria/ma_delete_table.c9
-rw-r--r--storage/maria/ma_open.c2
22 files changed, 234 insertions, 254 deletions
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 62202b76004..61195934c39 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -642,6 +642,7 @@ sub run_test_server ($$$) {
# Client disconnected
mtr_verbose("Child closed socket");
$s->remove($sock);
+ $sock->close;
if (--$childs == 0){
return ("Completed", $test_failure, $completed, $extra_warnings);
}
@@ -811,6 +812,7 @@ sub run_test_server ($$$) {
# Test failure due to warnings, force is off
return ("Warnings in log", 1, $completed, $extra_warnings);
}
+ next;
}
elsif ($line =~ /^SPENT/) {
add_total_times($line);
@@ -4065,6 +4067,7 @@ sub run_testcase ($$) {
if (start_servers($tinfo))
{
report_failure_and_restart($tinfo);
+ unlink $path_current_testlog;
return 1;
}
}
diff --git a/mysql-test/suite/galera/r/galera_trigger.result b/mysql-test/suite/galera/r/galera_trigger.result
index 48147492979..2a31a104404 100644
--- a/mysql-test/suite/galera/r/galera_trigger.result
+++ b/mysql-test/suite/galera/r/galera_trigger.result
@@ -32,3 +32,47 @@ id
200
DROP TRIGGER tr1;
DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1(id int not null auto_increment, value int not null, primary key (id)) engine=innodb;
+CREATE TABLE t2(id int not null auto_increment, tbl varchar(64) not null, action varchar(64) not null, primary key (id));
+create trigger log_insert after insert on t1
+for each row begin
+insert into t2(tbl, action) values ('t1', 'INSERT');
+end|
+insert into t1(value) values (1);
+insert into t1(value) values (2);
+connection node_2;
+set session wsrep_sync_wait=15;
+insert into t1(value) values (3);
+insert into t1(value) values (4);
+select tbl, action from t2;
+tbl action
+t1 INSERT
+t1 INSERT
+t1 INSERT
+t1 INSERT
+connection node_1;
+drop trigger if exists log_insert;
+insert into t1(value) values (5);
+select tbl, action from t2;
+tbl action
+t1 INSERT
+t1 INSERT
+t1 INSERT
+t1 INSERT
+connection node_2;
+insert into t1(value) values (6);
+select tbl, action from t2;
+tbl action
+t1 INSERT
+t1 INSERT
+t1 INSERT
+t1 INSERT
+connection node_1;
+select tbl, action from t2;
+tbl action
+t1 INSERT
+t1 INSERT
+t1 INSERT
+t1 INSERT
+drop table t1, t2;
diff --git a/mysql-test/suite/galera/t/galera_trigger.test b/mysql-test/suite/galera/t/galera_trigger.test
index 54508583f4b..3c66b941e32 100644
--- a/mysql-test/suite/galera/t/galera_trigger.test
+++ b/mysql-test/suite/galera/t/galera_trigger.test
@@ -33,4 +33,40 @@ SELECT * FROM t1;
DROP TRIGGER tr1;
DROP TABLE t1;
+#
+# MDEV-23638 : DROP TRIGGER in Galera Cluster not replicating
+#
+--connection node_1
+CREATE TABLE t1(id int not null auto_increment, value int not null, primary key (id)) engine=innodb;
+
+CREATE TABLE t2(id int not null auto_increment, tbl varchar(64) not null, action varchar(64) not null, primary key (id));
+
+--delimiter |
+create trigger log_insert after insert on t1
+for each row begin
+ insert into t2(tbl, action) values ('t1', 'INSERT');
+end|
+--delimiter ;
+
+insert into t1(value) values (1);
+insert into t1(value) values (2);
+
+--connection node_2
+set session wsrep_sync_wait=15;
+insert into t1(value) values (3);
+insert into t1(value) values (4);
+select tbl, action from t2;
+
+--connection node_1
+drop trigger if exists log_insert;
+insert into t1(value) values (5);
+select tbl, action from t2;
+
+--connection node_2
+insert into t1(value) values (6);
+select tbl, action from t2;
+
+--connection node_1
+select tbl, action from t2;
+drop table t1, t2;
diff --git a/mysql-test/suite/maria/repair.result b/mysql-test/suite/maria/repair.result
index 6bb9e1b5b9e..296f251aa36 100644
--- a/mysql-test/suite/maria/repair.result
+++ b/mysql-test/suite/maria/repair.result
@@ -22,3 +22,19 @@ i
1
UNLOCK TABLES;
DROP TABLE t1;
+#
+# MDEV-23824 SIGSEGV in end_io_cache on REPAIR LOCAL TABLE for Aria table
+#
+CREATE TABLE t1 (i INT) ENGINE=Aria;
+INSERT INTO t1 VALUES (1);
+SET max_session_mem_used=50000;
+REPAIR LOCAL TABLE t1 USE_FRM;
+Table Op Msg_type Msg_text
+t1 repair error Failed to open partially repaired table
+Warnings:
+Error 1290 The MariaDB server is running with the --max-thread-mem-used=50000 option so it cannot execute this statement
+REPAIR LOCAL TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 repair Error The MariaDB server is running with the --max-thread-mem-used=50000 option so it cannot execute this statement
+test.t1 repair error Corrupt
+DROP TABLE t1;
diff --git a/mysql-test/suite/maria/repair.test b/mysql-test/suite/maria/repair.test
index 2f713950d3e..9603a949f9b 100644
--- a/mysql-test/suite/maria/repair.test
+++ b/mysql-test/suite/maria/repair.test
@@ -22,3 +22,14 @@ SELECT * FROM INFORMATION_SCHEMA.TABLES;
SELECT * FROM t1;
UNLOCK TABLES;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-23824 SIGSEGV in end_io_cache on REPAIR LOCAL TABLE for Aria table
+--echo #
+
+CREATE TABLE t1 (i INT) ENGINE=Aria;
+INSERT INTO t1 VALUES (1);
+SET max_session_mem_used=50000;
+REPAIR LOCAL TABLE t1 USE_FRM;
+REPAIR LOCAL TABLE t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result b/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result
index 74648501fbe..9c36973427a 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result
@@ -22,7 +22,7 @@ START SLAVE IO_THREAD;
include/wait_for_slave_io_error.inc [errno=1236]
connection master;
FLUSH BINARY LOGS;
-PURGE BINARY LOGS TO 'master-bin.000002';;
+include/wait_for_purge.inc "master-bin.000002"
FLUSH BINARY LOGS DELETE_DOMAIN_ID=(11);
SELECT @@global.gtid_binlog_pos, @@global.gtid_binlog_state;
@@global.gtid_binlog_pos @@global.gtid_binlog_state
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test b/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test
index 0262998798a..5537b6fbf86 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test
@@ -53,17 +53,11 @@ START SLAVE IO_THREAD;
# adjust the master binlog state
FLUSH BINARY LOGS;
--let $purge_to_binlog= query_get_value(SHOW MASTER STATUS, File, 1)
---eval PURGE BINARY LOGS TO '$purge_to_binlog';
+--let $purge_binlogs_to=$purge_to_binlog
+--source include/wait_for_purge.inc
+
# with final removal of the extra domain
-###adding to debug info to catch the failure (1076):
---error 0,1076
--eval FLUSH BINARY LOGS DELETE_DOMAIN_ID=($extra_domain_id)
-
-if ($mysql_errno == 1076) {
- --echo ### Failure "Could not delete gtid domain"
- --source include/show_rpl_debug_info.inc
- }
-
SELECT @@global.gtid_binlog_pos, @@global.gtid_binlog_state;
--connection slave
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh
index 6225b99276c..c5857713ec9 100644
--- a/scripts/mysqld_safe.sh
+++ b/scripts/mysqld_safe.sh
@@ -449,7 +449,8 @@ mysqld_ld_preload_text() {
set_malloc_lib() {
malloc_lib="$1"
if expr "$malloc_lib" : "\(tcmalloc\|jemalloc\)" > /dev/null ; then
- if ! my_which ldconfig > /dev/null 2>&1
+ export PATH=$PATH:/sbin
+ if ! command -v ldconfig > /dev/null 2>&1
then
log_error "ldconfig command not found, required for ldconfig -p"
exit 1
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index c13d61d9f7a..37aab267511 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -91,10 +91,10 @@ static int send_check_errmsg(THD *thd, TABLE_LIST* table,
static int prepare_for_repair(THD *thd, TABLE_LIST *table_list,
HA_CHECK_OPT *check_opt)
{
- int error= 0;
+ int error= 0, create_error= 0;
TABLE tmp_table, *table;
TABLE_LIST *pos_in_locked_tables= 0;
- TABLE_SHARE *share;
+ TABLE_SHARE *share= 0;
bool has_mdl_lock= FALSE;
char from[FN_REFLEN],tmp[FN_REFLEN+32];
const char **ext;
@@ -207,6 +207,23 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list,
HA_EXTRA_NOT_USED, NULL);
table_list->table= 0;
}
+ else
+ {
+ /*
+ Table open failed, maybe because we run out of memory.
+ Close all open tables and relaese all MDL locks
+ */
+#if MYSQL_VERSION < 100500
+ tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED,
+ table->s->db.str, table->s->table_name.str,
+ TRUE);
+#else
+ tdc_release_share(share);
+ share->tdc->flush(thd, true);
+ share= 0;
+#endif
+ }
+
/*
After this point we have an exclusive metadata lock on our table
in both cases when table was successfully open in mysql_admin_table()
@@ -220,11 +237,8 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list,
goto end;
}
if (dd_recreate_table(thd, table_list->db.str, table_list->table_name.str))
- {
- error= send_check_errmsg(thd, table_list, "repair",
- "Failed generating table from .frm file");
- goto end;
- }
+ create_error= send_check_errmsg(thd, table_list, "repair",
+ "Failed generating table from .frm file");
/*
'FALSE' for 'using_transactions' means don't postpone
invalidation till the end of a transaction, but do it
@@ -237,6 +251,8 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list,
"Failed restoring .MYD file");
goto end;
}
+ if (create_error)
+ goto end;
if (thd->locked_tables_list.locked_tables())
{
@@ -264,7 +280,8 @@ end:
if (table == &tmp_table)
{
closefrm(table);
- tdc_release_share(table->s);
+ if (share)
+ tdc_release_share(share);
}
/* In case of a temporary table there will be no metadata lock. */
if (unlikely(error) && has_mdl_lock)
@@ -643,6 +660,12 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
#endif
DBUG_PRINT("admin", ("table: %p", table->table));
+ if (table->schema_table)
+ {
+ result_code= HA_ADMIN_NOT_IMPLEMENTED;
+ goto send_result;
+ }
+
if (prepare_func)
{
DBUG_PRINT("admin", ("calling prepare_func"));
@@ -701,12 +724,6 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
goto send_result;
}
- if (table->schema_table)
- {
- result_code= HA_ADMIN_NOT_IMPLEMENTED;
- goto send_result;
- }
-
if ((table->table->db_stat & HA_READ_ONLY) && open_for_modify)
{
/* purecov: begin inspected */
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index 6095f71f839..967747c4a38 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -4637,7 +4637,7 @@ evict_from_pool:
if (!access_time && !recv_no_ibuf_operations) {
ibuf_merge_or_delete_for_page(
- block, block->page.id, zip_size, true);
+ block, block->page.id, zip_size);
}
buf_pool_mutex_enter(buf_pool);
@@ -5691,7 +5691,7 @@ loop:
/* Delete possible entries for the page from the insert buffer:
such can exist if the page belonged to an index which was dropped */
if (!recv_recovery_is_on()) {
- ibuf_merge_or_delete_for_page(NULL, page_id, zip_size, true);
+ ibuf_merge_or_delete_for_page(NULL, page_id, zip_size);
}
frame = block->frame;
@@ -6188,7 +6188,7 @@ release_page:
&& page_is_leaf(frame)) {
ibuf_merge_or_delete_for_page(
reinterpret_cast<buf_block_t*>(bpage),
- bpage->id, bpage->zip_size(), true);
+ bpage->id, bpage->zip_size());
}
space->release_for_io();
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 2697afc2802..980f4c12e66 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -6307,88 +6307,3 @@ dict_sys_get_size()
return size;
}
-
-/** Look for any dictionary objects that are found in the given tablespace.
-@param[in] space_id Tablespace ID to search for.
-@return true if tablespace is empty. */
-bool
-dict_space_is_empty(
- ulint space_id)
-{
- btr_pcur_t pcur;
- const rec_t* rec;
- mtr_t mtr;
- bool found = false;
-
- dict_sys_lock();
- mtr_start(&mtr);
-
- for (rec = dict_startscan_system(&pcur, &mtr, SYS_TABLES);
- rec != NULL;
- rec = dict_getnext_system(&pcur, &mtr)) {
- const byte* field;
- ulint len;
- ulint space_id_for_table;
-
- field = rec_get_nth_field_old(
- rec, DICT_FLD__SYS_TABLES__SPACE, &len);
- ut_ad(len == 4);
- space_id_for_table = mach_read_from_4(field);
-
- if (space_id_for_table == space_id) {
- found = true;
- }
- }
-
- mtr_commit(&mtr);
- dict_sys_unlock();
-
- return(!found);
-}
-
-/** Find the space_id for the given name in sys_tablespaces.
-@param[in] name Tablespace name to search for.
-@return the tablespace ID. */
-ulint
-dict_space_get_id(
- const char* name)
-{
- btr_pcur_t pcur;
- const rec_t* rec;
- mtr_t mtr;
- ulint name_len = strlen(name);
- ulint id = ULINT_UNDEFINED;
-
- dict_sys_lock();
- mtr_start(&mtr);
-
- for (rec = dict_startscan_system(&pcur, &mtr, SYS_TABLESPACES);
- rec != NULL;
- rec = dict_getnext_system(&pcur, &mtr)) {
- const byte* field;
- ulint len;
-
- field = rec_get_nth_field_old(
- rec, DICT_FLD__SYS_TABLESPACES__NAME, &len);
- ut_ad(len > 0);
- ut_ad(len < OS_FILE_MAX_PATH);
-
- if (len == name_len && ut_memcmp(name, field, len) == 0) {
-
- field = rec_get_nth_field_old(
- rec, DICT_FLD__SYS_TABLESPACES__SPACE, &len);
- ut_ad(len == 4);
- id = mach_read_from_4(field);
-
- /* This is normally called by dict_getnext_system()
- at the end of the index. */
- btr_pcur_close(&pcur);
- break;
- }
- }
-
- mtr_commit(&mtr);
- dict_sys_unlock();
-
- return(id);
-}
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 057b233a5fc..a9206df377c 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -621,6 +621,7 @@ static PSI_mutex_info all_innodb_mutexes[] = {
PSI_KEY(ibuf_bitmap_mutex),
PSI_KEY(ibuf_mutex),
PSI_KEY(ibuf_pessimistic_insert_mutex),
+ PSI_KEY(index_online_log),
PSI_KEY(log_sys_mutex),
PSI_KEY(log_sys_write_mutex),
PSI_KEY(mutex_list_mutex),
@@ -676,7 +677,6 @@ static PSI_rwlock_info all_innodb_rwlocks[] = {
PSI_RWLOCK_KEY(trx_i_s_cache_lock),
PSI_RWLOCK_KEY(trx_purge_latch),
PSI_RWLOCK_KEY(index_tree_rw_lock),
- PSI_RWLOCK_KEY(index_online_log),
PSI_RWLOCK_KEY(hash_table_locks)
};
# endif /* UNIV_PFS_RWLOCK */
diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc
index 63fc94d8650..469836f0955 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.cc
+++ b/storage/innobase/ibuf/ibuf0ibuf.cc
@@ -4332,19 +4332,11 @@ insert buffer. If the page is not read, but created in the buffer pool, this
function deletes its buffered entries from the insert buffer; there can
exist entries for such a page if the page belonged to an index which
subsequently was dropped.
-@param[in,out] block if page has been read from disk,
-pointer to the page x-latched, else NULL
-@param[in] page_id page id of the index page
-@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0
-@param[in] update_ibuf_bitmap normally this is set, but
-if we have deleted or are deleting the tablespace, then we naturally do not
-want to update a non-existent bitmap page */
-void
-ibuf_merge_or_delete_for_page(
- buf_block_t* block,
- const page_id_t page_id,
- ulint zip_size,
- bool update_ibuf_bitmap)
+@param block X-latched page to try to apply changes to, or NULL to discard
+@param page_id page identifier
+@param zip_size ROW_FORMAT=COMPRESSED page size, or 0 */
+void ibuf_merge_or_delete_for_page(buf_block_t *block, const page_id_t page_id,
+ ulint zip_size)
{
btr_pcur_t pcur;
#ifdef UNIV_IBUF_DEBUG
@@ -4375,58 +4367,43 @@ ibuf_merge_or_delete_for_page(
return;
}
- fil_space_t* space;
-
- if (update_ibuf_bitmap) {
- space = fil_space_acquire_silent(page_id.space());
+ fil_space_t* space = fil_space_acquire_silent(page_id.space());
- if (UNIV_UNLIKELY(!space)) {
- /* Do not try to read the bitmap page from the
- non-existent tablespace, delete the ibuf records */
- block = NULL;
- update_ibuf_bitmap = false;
- } else {
- page_t* bitmap_page = NULL;
- ulint bitmap_bits = 0;
+ if (UNIV_UNLIKELY(!space)) {
+ block = NULL;
+ } else {
+ ulint bitmap_bits = 0;
- ibuf_mtr_start(&mtr);
+ ibuf_mtr_start(&mtr);
- bitmap_page = ibuf_bitmap_get_map_page(
- page_id, zip_size, &mtr);
+ page_t* bitmap_page = ibuf_bitmap_get_map_page(
+ page_id, zip_size, &mtr);
- if (bitmap_page &&
- fil_page_get_type(bitmap_page) != FIL_PAGE_TYPE_ALLOCATED) {
- bitmap_bits = ibuf_bitmap_page_get_bits(
- bitmap_page, page_id, zip_size,
- IBUF_BITMAP_BUFFERED, &mtr);
- }
+ if (bitmap_page &&
+ fil_page_get_type(bitmap_page) != FIL_PAGE_TYPE_ALLOCATED) {
+ bitmap_bits = ibuf_bitmap_page_get_bits(
+ bitmap_page, page_id, zip_size,
+ IBUF_BITMAP_BUFFERED, &mtr);
+ }
- ibuf_mtr_commit(&mtr);
+ ibuf_mtr_commit(&mtr);
- if (!bitmap_bits) {
- /* No changes are buffered for this page. */
- space->release();
- if (UNIV_UNLIKELY(srv_shutdown_state)
- && !srv_fast_shutdown
- && (!block
- || btr_page_get_index_id(block->frame)
- != DICT_IBUF_ID_MIN + IBUF_SPACE_ID)) {
- /* Prevent an infinite loop on slow
- shutdown, in case the bitmap bits are
- wrongly clear even though buffered
- changes exist. */
- ibuf_delete_recs(page_id);
- }
- return;
+ if (!bitmap_bits) {
+ /* No changes are buffered for this page. */
+ space->release();
+ if (UNIV_UNLIKELY(srv_shutdown_state)
+ && !srv_fast_shutdown
+ && (!block
+ || btr_page_get_index_id(block->frame)
+ != DICT_IBUF_ID_MIN + IBUF_SPACE_ID)) {
+ /* Prevent an infinite loop on slow
+ shutdown, in case the bitmap bits are
+ wrongly clear even though buffered
+ changes exist. */
+ ibuf_delete_recs(page_id);
}
+ return;
}
- } else if (block != NULL
- && (ibuf_fixed_addr_page(page_id, physical_size)
- || fsp_descr_page(page_id, physical_size))) {
-
- return;
- } else {
- space = NULL;
}
mem_heap_t* heap = mem_heap_create(512);
@@ -4473,12 +4450,8 @@ loop:
ibuf->index, search_tuple, PAGE_CUR_GE, BTR_MODIFY_LEAF,
&pcur, &mtr);
- if (block != NULL) {
- ibool success;
-
- mtr.set_named_space(space);
-
- success = buf_page_get_known_nowait(
+ if (block) {
+ ibool success = buf_page_get_known_nowait(
RW_X_LATCH, block,
BUF_KEEP_OLD, __FILE__, __LINE__, &mtr);
@@ -4491,7 +4464,9 @@ loop:
the block is io-fixed. Other threads must not try to
latch an io-fixed block. */
buf_block_dbg_add_level(block, SYNC_IBUF_TREE_NODE);
- } else if (update_ibuf_bitmap) {
+ }
+
+ if (space) {
mtr.set_named_space(space);
}
@@ -4652,7 +4627,7 @@ loop:
}
reset_bit:
- if (update_ibuf_bitmap) {
+ if (space) {
page_t* bitmap_page;
bitmap_page = ibuf_bitmap_get_map_page(page_id, zip_size,
diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h
index 6bb86269856..a3f4baa4c31 100644
--- a/storage/innobase/include/dict0dict.h
+++ b/storage/innobase/include/dict0dict.h
@@ -893,19 +893,6 @@ inline ulint dict_tf_get_zip_size(ulint flags)
: 0;
}
-/** Determine the extent size (in pages) for the given table
-@param[in] table the table whose extent size is being
- calculated.
-@return extent size in pages (256, 128 or 64) */
-inline ulint dict_table_extent_size(const dict_table_t* table)
-{
- if (ulint zip_size = table->space->zip_size()) {
- return (1ULL << 20) / zip_size;
- }
-
- return FSP_EXTENT_SIZE;
-}
-
/********************************************************************//**
Checks if a column is in the ordering columns of the clustered index of a
table. Column prefixes are treated like whole columns.
@@ -1788,20 +1775,6 @@ UNIV_INTERN
ulint
dict_sys_get_size();
-/** Look for any dictionary objects that are found in the given tablespace.
-@param[in] space_id Tablespace ID to search for.
-@return true if tablespace is empty. */
-bool
-dict_space_is_empty(
- ulint space_id);
-
-/** Find the space_id for the given name in sys_tablespaces.
-@param[in] name Tablespace name to search for.
-@return the tablespace ID. */
-ulint
-dict_space_get_id(
- const char* name);
-
/** Free the virtual column template
@param[in,out] vc_templ virtual column template */
UNIV_INLINE
diff --git a/storage/innobase/include/ibuf0ibuf.h b/storage/innobase/include/ibuf0ibuf.h
index 02d38069d94..45d674f2c02 100644
--- a/storage/innobase/include/ibuf0ibuf.h
+++ b/storage/innobase/include/ibuf0ibuf.h
@@ -331,19 +331,11 @@ insert buffer. If the page is not read, but created in the buffer pool, this
function deletes its buffered entries from the insert buffer; there can
exist entries for such a page if the page belonged to an index which
subsequently was dropped.
-@param[in,out] block if page has been read from disk,
-pointer to the page x-latched, else NULL
-@param[in] page_id page id of the index page
-@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0
-@param[in] update_ibuf_bitmap normally this is set, but
-if we have deleted or are deleting the tablespace, then we naturally do not
-want to update a non-existent bitmap page */
-void
-ibuf_merge_or_delete_for_page(
- buf_block_t* block,
- const page_id_t page_id,
- ulint zip_size,
- bool update_ibuf_bitmap);
+@param block X-latched page to try to apply changes to, or NULL to discard
+@param page_id page identifier
+@param zip_size ROW_FORMAT=COMPRESSED page size, or 0 */
+void ibuf_merge_or_delete_for_page(buf_block_t *block, const page_id_t page_id,
+ ulint zip_size);
/** Delete all change buffer entries for a tablespace,
in DISCARD TABLESPACE, IMPORT TABLESPACE, or crash recovery.
diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
index eb504d81b5c..c32234d923d 100644
--- a/storage/innobase/include/trx0trx.h
+++ b/storage/innobase/include/trx0trx.h
@@ -1012,20 +1012,6 @@ private:
during bulk create index */
FlushObserver* flush_observer;
public:
- /* Lock wait statistics */
- ulint n_rec_lock_waits;
- /*!< Number of record lock waits,
- might not be exactly correct. */
- ulint n_table_lock_waits;
- /*!< Number of table lock waits,
- might not be exactly correct. */
- ulint total_rec_lock_wait_time;
- /*!< Total rec lock wait time up
- to this moment. */
- ulint total_table_lock_wait_time;
- /*!< Total table lock wait time
- up to this moment. */
-
#ifdef WITH_WSREP
os_event_t wsrep_event; /* event waited for in srv_conc_slot */
#endif /* WITH_WSREP */
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index 6e58994dff2..d7fef4e9675 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -320,7 +320,7 @@ public:
mutex_exit(&recv_sys.mutex);
ibuf_merge_or_delete_for_page(
block, i.first,
- block->zip_size(), true);
+ block->zip_size());
mtr.commit();
mtr.start();
mutex_enter(&recv_sys.mutex);
diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc
index bf85121d947..fee96c44479 100644
--- a/storage/innobase/trx/trx0rec.cc
+++ b/storage/innobase/trx/trx0rec.cc
@@ -148,13 +148,13 @@ trx_undo_parse_add_undo_rec(
@return bytes left */
static ulint trx_undo_left(const buf_block_t *undo_block, const byte *ptr)
{
- ut_ad(ptr >= &undo_block->frame[TRX_UNDO_PAGE_HDR]);
- ut_ad(ptr <= &undo_block->frame[srv_page_size - 10 - FIL_PAGE_DATA_END]);
-
+ ut_ad(ptr >= &undo_block->frame[TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_HDR_SIZE]);
/* The 10 is supposed to be an extra safety margin (and needed for
compatibility with older versions) */
- return srv_page_size - ulint(ptr - undo_block->frame) -
+ lint left= srv_page_size - (ptr - undo_block->frame) -
(10 + FIL_PAGE_DATA_END);
+ ut_ad(left >= 0);
+ return left < 0 ? 0 : static_cast<ulint>(left);
}
/**********************************************************************//**
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index e159d7f1dd3..01cb842cc0b 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -471,10 +471,6 @@ void trx_t::free()
MEM_NOACCESS(&mod_tables, sizeof mod_tables);
MEM_NOACCESS(&detailed_error, sizeof detailed_error);
MEM_NOACCESS(&flush_observer, sizeof flush_observer);
- MEM_NOACCESS(&n_rec_lock_waits, sizeof n_rec_lock_waits);
- MEM_NOACCESS(&n_table_lock_waits, sizeof n_table_lock_waits);
- MEM_NOACCESS(&total_rec_lock_wait_time, sizeof total_rec_lock_wait_time);
- MEM_NOACCESS(&total_table_lock_wait_time, sizeof total_table_lock_wait_time);
#ifdef WITH_WSREP
MEM_NOACCESS(&wsrep_event, sizeof wsrep_event);
#endif /* WITH_WSREP */
diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c
index 9670daa9104..26a9241c205 100644
--- a/storage/maria/ma_check.c
+++ b/storage/maria/ma_check.c
@@ -2350,6 +2350,14 @@ static int initialize_variables_for_repair(HA_CHECK *param,
{
MARIA_SHARE *share= info->s;
+ /*
+ We have to clear these variables first, as the cleanup-in-case-of-error
+ handling may touch these.
+ */
+ bzero((char*) sort_info, sizeof(*sort_info));
+ bzero((char*) sort_param, sizeof(*sort_param));
+ bzero(&info->rec_cache, sizeof(info->rec_cache));
+
if (share->data_file_type == NO_RECORD)
{
_ma_check_print_error(param,
@@ -2364,9 +2372,6 @@ static int initialize_variables_for_repair(HA_CHECK *param,
if (share->lock.update_status)
(*share->lock.update_status)(info);
- bzero((char*) sort_info, sizeof(*sort_info));
- bzero((char*) sort_param, sizeof(*sort_param));
-
param->testflag|= T_REP; /* for easy checking */
if (share->options & (HA_OPTION_CHECKSUM | HA_OPTION_COMPRESS_RECORD))
param->testflag|= T_CALC_CHECKSUM;
@@ -2394,7 +2399,6 @@ static int initialize_variables_for_repair(HA_CHECK *param,
set_data_file_type(sort_info, info->s);
sort_info->org_data_file_type= share->data_file_type;
- bzero(&info->rec_cache, sizeof(info->rec_cache));
info->rec_cache.file= info->dfile.file;
info->update= (short) (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
@@ -2878,9 +2882,13 @@ err:
_ma_reset_state(info);
end_io_cache(&param->read_cache);
- end_io_cache(&sort_info.new_info->rec_cache);
+ if (sort_info.new_info)
+ {
+ end_io_cache(&sort_info.new_info->rec_cache);
+ sort_info.new_info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
+ }
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
- sort_info.new_info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
+
sort_param.sort_info->info->in_check_table= 0;
/* this below could fail, shouldn't we detect error? */
if (got_error)
@@ -4095,10 +4103,13 @@ err:
maria_scan_end(sort_info.info);
_ma_reset_state(info);
- end_io_cache(&sort_info.new_info->rec_cache);
+ if (sort_info.new_info)
+ {
+ end_io_cache(&sort_info.new_info->rec_cache);
+ sort_info.new_info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
+ }
end_io_cache(&param->read_cache);
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
- sort_info.new_info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
if (got_error)
{
if (! param->error_printed)
@@ -4627,10 +4638,13 @@ err:
the share by remove_io_thread() or it was not yet started (if the
error happend before creating the thread).
*/
- end_io_cache(&sort_info.new_info->rec_cache);
+ if (sort_info.new_info)
+ {
+ end_io_cache(&sort_info.new_info->rec_cache);
+ sort_info.new_info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
+ }
end_io_cache(&param->read_cache);
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
- sort_info.new_info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
/*
Destroy the new data cache in case of non-quick repair. All slave
threads did either detach from the share by remove_io_thread()
diff --git a/storage/maria/ma_delete_table.c b/storage/maria/ma_delete_table.c
index fee001df1e1..0c78476ad44 100644
--- a/storage/maria/ma_delete_table.c
+++ b/storage/maria/ma_delete_table.c
@@ -30,6 +30,7 @@ int maria_delete_table(const char *name)
{
MARIA_HA *info;
myf sync_dir;
+ int got_error= 0, error;
DBUG_ENTER("maria_delete_table");
#ifdef EXTRA_DEBUG
@@ -41,9 +42,13 @@ int maria_delete_table(const char *name)
Unfortunately it is necessary to open the table just to check this. We use
'open_for_repair' to be able to open even a crashed table.
*/
+ my_errno= 0;
if (!(info= maria_open(name, O_RDONLY, HA_OPEN_FOR_REPAIR)))
{
sync_dir= 0;
+ /* Ignore not found errors and wrong symlink errors */
+ if (my_errno != ENOENT && my_errno != HA_WRONG_CREATE_OPTION)
+ got_error= my_errno;;
}
else
{
@@ -78,7 +83,9 @@ int maria_delete_table(const char *name)
DBUG_RETURN(1);
}
- DBUG_RETURN(maria_delete_table_files(name, 0, sync_dir));
+ if (!(error= maria_delete_table_files(name, 0, sync_dir)))
+ error= got_error;
+ DBUG_RETURN(error);
}
diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c
index 05aca8f37e1..89848fae03e 100644
--- a/storage/maria/ma_open.c
+++ b/storage/maria/ma_open.c
@@ -1345,7 +1345,7 @@ static void setup_key_functions(register MARIA_KEYDEF *keyinfo)
/**
- @brief Function to save and store the header in the index file (.MYI)
+ @brief Function to save and store the header in the index file (.MAI)
Operates under MARIA_SHARE::intern_lock if requested.
Sets MARIA_SHARE::MARIA_STATE_INFO::is_of_horizon if transactional table.