1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge 10.3 into 10.4

This commit is contained in:
Marko Mäkelä
2020-11-12 11:18:04 +02:00
22 changed files with 240 additions and 260 deletions

View File

@ -642,6 +642,7 @@ sub run_test_server ($$$) {
# Client disconnected # Client disconnected
mtr_verbose("Child closed socket"); mtr_verbose("Child closed socket");
$s->remove($sock); $s->remove($sock);
$sock->close;
if (--$childs == 0){ if (--$childs == 0){
return ("Completed", $test_failure, $completed, $extra_warnings); return ("Completed", $test_failure, $completed, $extra_warnings);
} }
@ -811,6 +812,7 @@ sub run_test_server ($$$) {
# Test failure due to warnings, force is off # Test failure due to warnings, force is off
return ("Warnings in log", 1, $completed, $extra_warnings); return ("Warnings in log", 1, $completed, $extra_warnings);
} }
next;
} }
elsif ($line =~ /^SPENT/) { elsif ($line =~ /^SPENT/) {
add_total_times($line); add_total_times($line);
@ -4065,6 +4067,7 @@ sub run_testcase ($$) {
if (start_servers($tinfo)) if (start_servers($tinfo))
{ {
report_failure_and_restart($tinfo); report_failure_and_restart($tinfo);
unlink $path_current_testlog;
return 1; return 1;
} }
} }

View File

@ -32,3 +32,47 @@ id
200 200
DROP TRIGGER tr1; DROP TRIGGER tr1;
DROP TABLE t1; 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;

View File

@ -33,4 +33,40 @@ SELECT * FROM t1;
DROP TRIGGER tr1; DROP TRIGGER tr1;
DROP TABLE t1; 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;

View File

@ -22,3 +22,19 @@ i
1 1
UNLOCK TABLES; UNLOCK TABLES;
DROP TABLE t1; 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;

View File

@ -22,3 +22,14 @@ SELECT * FROM INFORMATION_SCHEMA.TABLES;
SELECT * FROM t1; SELECT * FROM t1;
UNLOCK TABLES; UNLOCK TABLES;
DROP TABLE t1; 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;

View File

@ -22,7 +22,7 @@ START SLAVE IO_THREAD;
include/wait_for_slave_io_error.inc [errno=1236] include/wait_for_slave_io_error.inc [errno=1236]
connection master; connection master;
FLUSH BINARY LOGS; 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); FLUSH BINARY LOGS DELETE_DOMAIN_ID=(11);
SELECT @@global.gtid_binlog_pos, @@global.gtid_binlog_state; SELECT @@global.gtid_binlog_pos, @@global.gtid_binlog_state;
@@global.gtid_binlog_pos @@global.gtid_binlog_state @@global.gtid_binlog_pos @@global.gtid_binlog_state

View File

@ -53,17 +53,11 @@ START SLAVE IO_THREAD;
# adjust the master binlog state # adjust the master binlog state
FLUSH BINARY LOGS; FLUSH BINARY LOGS;
--let $purge_to_binlog= query_get_value(SHOW MASTER STATUS, File, 1) --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 # 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) --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; SELECT @@global.gtid_binlog_pos, @@global.gtid_binlog_state;
--connection slave --connection slave

View File

@ -449,7 +449,8 @@ mysqld_ld_preload_text() {
set_malloc_lib() { set_malloc_lib() {
malloc_lib="$1" malloc_lib="$1"
if expr "$malloc_lib" : "\(tcmalloc\|jemalloc\)" > /dev/null ; then 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 then
log_error "ldconfig command not found, required for ldconfig -p" log_error "ldconfig command not found, required for ldconfig -p"
exit 1 exit 1

View File

@ -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, static int prepare_for_repair(THD *thd, TABLE_LIST *table_list,
HA_CHECK_OPT *check_opt) HA_CHECK_OPT *check_opt)
{ {
int error= 0; int error= 0, create_error= 0;
TABLE tmp_table, *table; TABLE tmp_table, *table;
TABLE_LIST *pos_in_locked_tables= 0; TABLE_LIST *pos_in_locked_tables= 0;
TABLE_SHARE *share; TABLE_SHARE *share= 0;
bool has_mdl_lock= FALSE; bool has_mdl_lock= FALSE;
char from[FN_REFLEN],tmp[FN_REFLEN+32]; char from[FN_REFLEN],tmp[FN_REFLEN+32];
const char **ext; const char **ext;
@ -207,6 +207,23 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list,
HA_EXTRA_NOT_USED, NULL); HA_EXTRA_NOT_USED, NULL);
table_list->table= 0; 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 After this point we have an exclusive metadata lock on our table
in both cases when table was successfully open in mysql_admin_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; goto end;
} }
if (dd_recreate_table(thd, table_list->db.str, table_list->table_name.str)) if (dd_recreate_table(thd, table_list->db.str, table_list->table_name.str))
{ create_error= send_check_errmsg(thd, table_list, "repair",
error= send_check_errmsg(thd, table_list, "repair", "Failed generating table from .frm file");
"Failed generating table from .frm file");
goto end;
}
/* /*
'FALSE' for 'using_transactions' means don't postpone 'FALSE' for 'using_transactions' means don't postpone
invalidation till the end of a transaction, but do it 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"); "Failed restoring .MYD file");
goto end; goto end;
} }
if (create_error)
goto end;
if (thd->locked_tables_list.locked_tables()) if (thd->locked_tables_list.locked_tables())
{ {
@ -264,7 +280,8 @@ end:
if (table == &tmp_table) if (table == &tmp_table)
{ {
closefrm(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. */ /* In case of a temporary table there will be no metadata lock. */
if (unlikely(error) && has_mdl_lock) if (unlikely(error) && has_mdl_lock)
@ -643,6 +660,12 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
#endif #endif
DBUG_PRINT("admin", ("table: %p", table->table)); DBUG_PRINT("admin", ("table: %p", table->table));
if (table->schema_table)
{
result_code= HA_ADMIN_NOT_IMPLEMENTED;
goto send_result;
}
if (prepare_func) if (prepare_func)
{ {
DBUG_PRINT("admin", ("calling 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; 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) if ((table->table->db_stat & HA_READ_ONLY) && open_for_modify)
{ {
/* purecov: begin inspected */ /* purecov: begin inspected */

View File

@ -4637,7 +4637,7 @@ evict_from_pool:
if (!access_time && !recv_no_ibuf_operations) { if (!access_time && !recv_no_ibuf_operations) {
ibuf_merge_or_delete_for_page( 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); buf_pool_mutex_enter(buf_pool);
@ -5691,7 +5691,7 @@ loop:
/* Delete possible entries for the page from the insert buffer: /* Delete possible entries for the page from the insert buffer:
such can exist if the page belonged to an index which was dropped */ such can exist if the page belonged to an index which was dropped */
if (!recv_recovery_is_on()) { 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; frame = block->frame;
@ -6188,7 +6188,7 @@ release_page:
&& page_is_leaf(frame)) { && page_is_leaf(frame)) {
ibuf_merge_or_delete_for_page( ibuf_merge_or_delete_for_page(
reinterpret_cast<buf_block_t*>(bpage), reinterpret_cast<buf_block_t*>(bpage),
bpage->id, bpage->zip_size(), true); bpage->id, bpage->zip_size());
} }
space->release_for_io(); space->release_for_io();

View File

@ -6307,88 +6307,3 @@ dict_sys_get_size()
return 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);
}

View File

@ -621,6 +621,7 @@ static PSI_mutex_info all_innodb_mutexes[] = {
PSI_KEY(ibuf_bitmap_mutex), PSI_KEY(ibuf_bitmap_mutex),
PSI_KEY(ibuf_mutex), PSI_KEY(ibuf_mutex),
PSI_KEY(ibuf_pessimistic_insert_mutex), PSI_KEY(ibuf_pessimistic_insert_mutex),
PSI_KEY(index_online_log),
PSI_KEY(log_sys_mutex), PSI_KEY(log_sys_mutex),
PSI_KEY(log_sys_write_mutex), PSI_KEY(log_sys_write_mutex),
PSI_KEY(mutex_list_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_i_s_cache_lock),
PSI_RWLOCK_KEY(trx_purge_latch), PSI_RWLOCK_KEY(trx_purge_latch),
PSI_RWLOCK_KEY(index_tree_rw_lock), PSI_RWLOCK_KEY(index_tree_rw_lock),
PSI_RWLOCK_KEY(index_online_log),
PSI_RWLOCK_KEY(hash_table_locks) PSI_RWLOCK_KEY(hash_table_locks)
}; };
# endif /* UNIV_PFS_RWLOCK */ # endif /* UNIV_PFS_RWLOCK */

View File

@ -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 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 exist entries for such a page if the page belonged to an index which
subsequently was dropped. subsequently was dropped.
@param[in,out] block if page has been read from disk, @param block X-latched page to try to apply changes to, or NULL to discard
pointer to the page x-latched, else NULL @param page_id page identifier
@param[in] page_id page id of the index page @param zip_size ROW_FORMAT=COMPRESSED page size, or 0 */
@param[in] 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,
@param[in] update_ibuf_bitmap normally this is set, but ulint zip_size)
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)
{ {
btr_pcur_t pcur; btr_pcur_t pcur;
#ifdef UNIV_IBUF_DEBUG #ifdef UNIV_IBUF_DEBUG
@ -4375,58 +4367,43 @@ ibuf_merge_or_delete_for_page(
return; return;
} }
fil_space_t* space; fil_space_t* space = fil_space_acquire_silent(page_id.space());
if (update_ibuf_bitmap) { if (UNIV_UNLIKELY(!space)) {
space = fil_space_acquire_silent(page_id.space()); block = NULL;
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;
ibuf_mtr_start(&mtr);
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);
}
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;
}
}
} else if (block != NULL
&& (ibuf_fixed_addr_page(page_id, physical_size)
|| fsp_descr_page(page_id, physical_size))) {
return;
} else { } else {
space = NULL; ulint bitmap_bits = 0;
ibuf_mtr_start(&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);
}
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;
}
} }
mem_heap_t* heap = mem_heap_create(512); mem_heap_t* heap = mem_heap_create(512);
@ -4473,12 +4450,8 @@ loop:
ibuf->index, search_tuple, PAGE_CUR_GE, BTR_MODIFY_LEAF, ibuf->index, search_tuple, PAGE_CUR_GE, BTR_MODIFY_LEAF,
&pcur, &mtr); &pcur, &mtr);
if (block != NULL) { if (block) {
ibool success; ibool success = buf_page_get_known_nowait(
mtr.set_named_space(space);
success = buf_page_get_known_nowait(
RW_X_LATCH, block, RW_X_LATCH, block,
BUF_KEEP_OLD, __FILE__, __LINE__, &mtr); BUF_KEEP_OLD, __FILE__, __LINE__, &mtr);
@ -4491,7 +4464,9 @@ loop:
the block is io-fixed. Other threads must not try to the block is io-fixed. Other threads must not try to
latch an io-fixed block. */ latch an io-fixed block. */
buf_block_dbg_add_level(block, SYNC_IBUF_TREE_NODE); buf_block_dbg_add_level(block, SYNC_IBUF_TREE_NODE);
} else if (update_ibuf_bitmap) { }
if (space) {
mtr.set_named_space(space); mtr.set_named_space(space);
} }
@ -4652,7 +4627,7 @@ loop:
} }
reset_bit: reset_bit:
if (update_ibuf_bitmap) { if (space) {
page_t* bitmap_page; page_t* bitmap_page;
bitmap_page = ibuf_bitmap_get_map_page(page_id, zip_size, bitmap_page = ibuf_bitmap_get_map_page(page_id, zip_size,

View File

@ -893,19 +893,6 @@ inline ulint dict_tf_get_zip_size(ulint flags)
: 0; : 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 Checks if a column is in the ordering columns of the clustered index of a
table. Column prefixes are treated like whole columns. table. Column prefixes are treated like whole columns.
@ -1788,20 +1775,6 @@ UNIV_INTERN
ulint ulint
dict_sys_get_size(); 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 /** Free the virtual column template
@param[in,out] vc_templ virtual column template */ @param[in,out] vc_templ virtual column template */
UNIV_INLINE UNIV_INLINE

View File

@ -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 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 exist entries for such a page if the page belonged to an index which
subsequently was dropped. subsequently was dropped.
@param[in,out] block if page has been read from disk, @param block X-latched page to try to apply changes to, or NULL to discard
pointer to the page x-latched, else NULL @param page_id page identifier
@param[in] page_id page id of the index page @param zip_size ROW_FORMAT=COMPRESSED page size, or 0 */
@param[in] 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,
@param[in] update_ibuf_bitmap normally this is set, but ulint zip_size);
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);
/** Delete all change buffer entries for a tablespace, /** Delete all change buffer entries for a tablespace,
in DISCARD TABLESPACE, IMPORT TABLESPACE, or crash recovery. in DISCARD TABLESPACE, IMPORT TABLESPACE, or crash recovery.

View File

@ -1012,20 +1012,6 @@ private:
during bulk create index */ during bulk create index */
FlushObserver* flush_observer; FlushObserver* flush_observer;
public: 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 #ifdef WITH_WSREP
os_event_t wsrep_event; /* event waited for in srv_conc_slot */ os_event_t wsrep_event; /* event waited for in srv_conc_slot */
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */

View File

@ -320,7 +320,7 @@ public:
mutex_exit(&recv_sys.mutex); mutex_exit(&recv_sys.mutex);
ibuf_merge_or_delete_for_page( ibuf_merge_or_delete_for_page(
block, i.first, block, i.first,
block->zip_size(), true); block->zip_size());
mtr.commit(); mtr.commit();
mtr.start(); mtr.start();
mutex_enter(&recv_sys.mutex); mutex_enter(&recv_sys.mutex);

View File

@ -148,13 +148,13 @@ trx_undo_parse_add_undo_rec(
@return bytes left */ @return bytes left */
static ulint trx_undo_left(const buf_block_t *undo_block, const byte *ptr) 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[TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_HDR_SIZE]);
ut_ad(ptr <= &undo_block->frame[srv_page_size - 10 - FIL_PAGE_DATA_END]);
/* The 10 is supposed to be an extra safety margin (and needed for /* The 10 is supposed to be an extra safety margin (and needed for
compatibility with older versions) */ 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); (10 + FIL_PAGE_DATA_END);
ut_ad(left >= 0);
return left < 0 ? 0 : static_cast<ulint>(left);
} }
/**********************************************************************//** /**********************************************************************//**

View File

@ -471,10 +471,6 @@ void trx_t::free()
MEM_NOACCESS(&mod_tables, sizeof mod_tables); MEM_NOACCESS(&mod_tables, sizeof mod_tables);
MEM_NOACCESS(&detailed_error, sizeof detailed_error); MEM_NOACCESS(&detailed_error, sizeof detailed_error);
MEM_NOACCESS(&flush_observer, sizeof flush_observer); 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 #ifdef WITH_WSREP
MEM_NOACCESS(&wsrep_event, sizeof wsrep_event); MEM_NOACCESS(&wsrep_event, sizeof wsrep_event);
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */

View File

@ -2350,6 +2350,14 @@ static int initialize_variables_for_repair(HA_CHECK *param,
{ {
MARIA_SHARE *share= info->s; 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) if (share->data_file_type == NO_RECORD)
{ {
_ma_check_print_error(param, _ma_check_print_error(param,
@ -2364,9 +2372,6 @@ static int initialize_variables_for_repair(HA_CHECK *param,
if (share->lock.update_status) if (share->lock.update_status)
(*share->lock.update_status)(info); (*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 */ param->testflag|= T_REP; /* for easy checking */
if (share->options & (HA_OPTION_CHECKSUM | HA_OPTION_COMPRESS_RECORD)) if (share->options & (HA_OPTION_CHECKSUM | HA_OPTION_COMPRESS_RECORD))
param->testflag|= T_CALC_CHECKSUM; 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); set_data_file_type(sort_info, info->s);
sort_info->org_data_file_type= share->data_file_type; 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->rec_cache.file= info->dfile.file;
info->update= (short) (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); info->update= (short) (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
@ -2878,9 +2882,13 @@ err:
_ma_reset_state(info); _ma_reset_state(info);
end_io_cache(&param->read_cache); 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); 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; sort_param.sort_info->info->in_check_table= 0;
/* this below could fail, shouldn't we detect error? */ /* this below could fail, shouldn't we detect error? */
if (got_error) if (got_error)
@ -4095,10 +4103,13 @@ err:
maria_scan_end(sort_info.info); maria_scan_end(sort_info.info);
_ma_reset_state(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); end_io_cache(&param->read_cache);
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);
if (got_error) if (got_error)
{ {
if (! param->error_printed) if (! param->error_printed)
@ -4627,10 +4638,13 @@ err:
the share by remove_io_thread() or it was not yet started (if the the share by remove_io_thread() or it was not yet started (if the
error happend before creating the thread). 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); end_io_cache(&param->read_cache);
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);
/* /*
Destroy the new data cache in case of non-quick repair. All slave Destroy the new data cache in case of non-quick repair. All slave
threads did either detach from the share by remove_io_thread() threads did either detach from the share by remove_io_thread()

View File

@ -30,6 +30,7 @@ int maria_delete_table(const char *name)
{ {
MARIA_HA *info; MARIA_HA *info;
myf sync_dir; myf sync_dir;
int got_error= 0, error;
DBUG_ENTER("maria_delete_table"); DBUG_ENTER("maria_delete_table");
#ifdef EXTRA_DEBUG #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 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. '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))) if (!(info= maria_open(name, O_RDONLY, HA_OPEN_FOR_REPAIR)))
{ {
sync_dir= 0; 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 else
{ {
@ -78,7 +83,9 @@ int maria_delete_table(const char *name)
DBUG_RETURN(1); 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);
} }

View File

@ -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. Operates under MARIA_SHARE::intern_lock if requested.
Sets MARIA_SHARE::MARIA_STATE_INFO::is_of_horizon if transactional table. Sets MARIA_SHARE::MARIA_STATE_INFO::is_of_horizon if transactional table.