Merge 10.9 into 10.10

This commit is contained in:
Marko Mäkelä 2022-11-28 13:43:41 +02:00
commit 9e65287042
21 changed files with 193 additions and 189 deletions

View file

@ -462,6 +462,27 @@ flush query cache|
delete from t1| delete from t1|
drop procedure bug3583| drop procedure bug3583|
drop table t1| drop table t1|
#
# MDEV-29760 DROP DATABASE hangs when particular query cache is present
#
create table t1 (id int);
create table t2 like t1;
create table t3 like t1;
create database d;
create table d.t1 like test.t1;
create table d.t2 like test.t2;
set LOCAL query_cache_type=ON;
select id from t3;
id
select 'x' a, 'y' b from d.t1;
a b
select 'x' a, 'y' b from d.t1, d.t2;
a b
drop database d;
drop table t1, t2, t3;
#
# End of 10.5 tests
#
SET GLOBAL query_cache_size=@query_cache_size_save; SET GLOBAL query_cache_size=@query_cache_size_save;
SET GLOBAL query_cache_type=@query_cache_type_save; SET GLOBAL query_cache_type=@query_cache_type_save;
set GLOBAL sql_mode=@sql_mode_save; set GLOBAL sql_mode=@sql_mode_save;

View file

@ -325,6 +325,33 @@ drop procedure bug3583|
drop table t1| drop table t1|
delimiter ;| delimiter ;|
--echo #
--echo # MDEV-29760 DROP DATABASE hangs when particular query cache is present
--echo #
create table t1 (id int);
create table t2 like t1;
create table t3 like t1;
create database d;
create table d.t1 like test.t1;
create table d.t2 like test.t2;
set LOCAL query_cache_type=ON;
select id from t3;
select 'x' a, 'y' b from d.t1;
select 'x' a, 'y' b from d.t1, d.t2;
drop database d;
drop table t1, t2, t3;
--echo #
--echo # End of 10.5 tests
--echo #
# Wait till we reached the initial number of concurrent sessions # Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc --source include/wait_until_count_sessions.inc
SET GLOBAL query_cache_size=@query_cache_size_save; SET GLOBAL query_cache_size=@query_cache_size_save;

View file

@ -164,28 +164,9 @@ connection default;
SET GLOBAL debug_dbug="+d,only_kill_system_threads_no_loop"; SET GLOBAL debug_dbug="+d,only_kill_system_threads_no_loop";
# restart # restart
** Proof of shutdown caused ROLLBACK-completed transaction ** Proof of shutdown caused ROLLBACK-completed transaction
include/show_binlog_events.inc # MYSQL_BINLOG datadir/binlog_file --result-file=assert_file
Log_name Pos Event_type Server_id End_log_pos Info include/assert_grep.inc [No XA statements should be written into the binary log]
master-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION include/assert_grep.inc [The transaction should be rolled back]
master-bin.000002 # Gtid_list # # []
master-bin.000002 # Binlog_checkpoint # # master-bin.000001
master-bin.000002 # Binlog_checkpoint # # master-bin.000002
master-bin.000002 # Gtid # # GTID #-#-#
master-bin.000002 # Query # # use `test`; CREATE TABLE tm (a INT) ENGINE = myisam
master-bin.000002 # Gtid # # BEGIN GTID #-#-#
master-bin.000002 # Query # # use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_latin1'Table \'./test/tm\' is marked as crashed' COLLATE 'latin1_swedish_ci'))
master-bin.000002 # Query # # COMMIT
master-bin.000002 # Gtid # # BEGIN GTID #-#-#
master-bin.000002 # Query # # use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_latin1'Checking table' COLLATE 'latin1_swedish_ci'))
master-bin.000002 # Query # # COMMIT
master-bin.000002 # Gtid # # BEGIN GTID #-#-#
master-bin.000002 # Query # # use `test`; INSERT INTO tm SET a = 1
master-bin.000002 # Query # # COMMIT
master-bin.000002 # Gtid # # BEGIN GTID #-#-#
master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (2, 1)
master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (3, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
master-bin.000002 # Query # # ROLLBACK
master-bin.000002 # Rotate # # master-bin.000003;pos=POS
SELECT * FROM tm; SELECT * FROM tm;
a a
1 1

View file

@ -212,7 +212,23 @@ XA END 'xa1';
--source include/start_mysqld.inc --source include/start_mysqld.inc
--echo ** Proof of shutdown caused ROLLBACK-completed transaction --echo ** Proof of shutdown caused ROLLBACK-completed transaction
--source include/show_binlog_events.inc
--let assert_file=$MYSQLTEST_VARDIR/tmp/binlog_decoded.out
--let datadir=`select @@datadir`
--echo # MYSQL_BINLOG datadir/binlog_file --result-file=assert_file
--exec $MYSQL_BINLOG $datadir/$binlog_file --result-file=$assert_file
--let $assert_text= No XA statements should be written into the binary log
--let $assert_count= 0
--let assert_select= XA START|XA END|XA PREPARE|XA COMMIT|XA ROLLBACK
--source include/assert_grep.inc
--let $assert_text= The transaction should be rolled back
--let $assert_count= 1
--let assert_select= ^ROLLBACK\$
--source include/assert_grep.inc
SELECT * FROM tm; SELECT * FROM tm;
--eval SELECT * FROM t1 WHERE a = $a --eval SELECT * FROM t1 WHERE a = $a

View file

@ -190,6 +190,14 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED');
COUNT(*) COUNT(*)
1 1
FOUND 4 /InnoDB: Upgrading redo log:/ in mysqld.1.err FOUND 4 /InnoDB: Upgrading redo log:/ in mysqld.1.err
# Empty large multi-file redo log from after MariaDB 10.2.2
# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=4m
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
COUNT(*)
1
FOUND 5 /InnoDB: Upgrading redo log:/ in mysqld.1.err
# Minimal MariaDB 10.1.21 encrypted redo log # Minimal MariaDB 10.1.21 encrypted redo log
# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 # restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5
SELECT COUNT(*) `1` FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb' SELECT COUNT(*) `1` FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb'

View file

@ -190,6 +190,14 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED');
COUNT(*) COUNT(*)
1 1
FOUND 4 /InnoDB: Upgrading redo log:/ in mysqld.1.err FOUND 4 /InnoDB: Upgrading redo log:/ in mysqld.1.err
# Empty large multi-file redo log from after MariaDB 10.2.2
# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=4m
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
COUNT(*)
1
FOUND 5 /InnoDB: Upgrading redo log:/ in mysqld.1.err
# Minimal MariaDB 10.1.21 encrypted redo log # Minimal MariaDB 10.1.21 encrypted redo log
# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 # restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5
SELECT * FROM INFORMATION_SCHEMA.ENGINES SELECT * FROM INFORMATION_SCHEMA.ENGINES

View file

@ -18,6 +18,7 @@ call mtr.add_suppression("InnoDB: Missing MLOG_FILE_NAME or MLOG_FILE_DELETE bef
call mtr.add_suppression("InnoDB: Obtaining redo log encryption key version 1 failed"); call mtr.add_suppression("InnoDB: Obtaining redo log encryption key version 1 failed");
call mtr.add_suppression("InnoDB: Decrypting checkpoint failed"); call mtr.add_suppression("InnoDB: Decrypting checkpoint failed");
call mtr.add_suppression("InnoDB: Log file .*ib_logfile1 is of different size 2097152 bytes than other log files (1048576|4194304) bytes!"); call mtr.add_suppression("InnoDB: Log file .*ib_logfile1 is of different size 2097152 bytes than other log files (1048576|4194304) bytes!");
call mtr.add_suppression("InnoDB: The change buffer is corrupted");
--enable_query_log --enable_query_log
let bugdir= $MYSQLTEST_VARDIR/tmp/log_corruption; let bugdir= $MYSQLTEST_VARDIR/tmp/log_corruption;
@ -606,6 +607,42 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED');
--let SEARCH_PATTERN= InnoDB: Upgrading redo log: --let SEARCH_PATTERN= InnoDB: Upgrading redo log:
--source include/search_pattern_in_file.inc --source include/search_pattern_in_file.inc
--echo # Empty large multi-file redo log from after MariaDB 10.2.2
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/crc32.pl";
my $polynomial = 0x82f63b78; # CRC-32C
die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0";
binmode OUT;
$_= pack("Nx[5]nx[5]", 1, 0x1286) . "BogoDB 4.3.2.1" . chr(0) x 478;
print OUT $_, pack("N", mycrc32($_, 0, $polynomial));
# checkpoint page 1 and all-zero checkpoint 2
$_= pack("x[13]nCNNx[484]", 0x1286, 12, 2, 0x80c);
print OUT $_, pack("N", mycrc32($_, 0, $polynomial));
print OUT chr(0) x 1024;
die unless seek(OUT, 0x1FFFFFFFF, 0);
print OUT chr(0);
close OUT or die;
die unless open OUT, ">", "$ENV{bugdir}/ib_logfile1";
binmode OUT;
die unless seek(OUT, 0x800, 0); # the first 2048 bytes are unused!
$_= pack("Nnnx[500]", 0x80000944, 12, 12);
print OUT $_, pack("N", mycrc32($_, 0, $polynomial));
die unless seek(OUT, 0x1FFFFFFFF, 0);
print OUT chr(0);
close OUT or die;
EOF
--let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=4m
--source include/start_mysqld.inc
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
--source include/shutdown_mysqld.inc
--let SEARCH_PATTERN= InnoDB: Upgrading redo log:
--source include/search_pattern_in_file.inc
--let $restart_parameters= $dirs
--echo # Minimal MariaDB 10.1.21 encrypted redo log --echo # Minimal MariaDB 10.1.21 encrypted redo log
perl; perl;
die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0";

View file

@ -1,2 +1,3 @@
MYSQL_ADD_PLUGIN(password_reuse_check password_reuse_check.c) MYSQL_ADD_PLUGIN(password_reuse_check password_reuse_check.c
RECOMPILE_FOR_EMBEDDED)

View file

@ -9773,9 +9773,9 @@ ER_UNUSED_23
spa "Nunca debería vd de ver esto" spa "Nunca debería vd de ver esto"
ER_PARTITION_WRONG_TYPE ER_PARTITION_WRONG_TYPE
chi "错误的分区类型,预期类型:%`s for partitioning by %`s" chi "错误分区类型%`s应当是%`s"
eng "Wrong partition type %`s for partitioning by %`s" eng "Wrong partition type %`s for partitioning by %`s"
spa "Tipo de partición equivocada, tipo esperado: %`s for partitioning by %`s" spa "Tipo de partición equivocada %`s para particionado mediante %`s"
WARN_VERS_PART_FULL WARN_VERS_PART_FULL
chi "版本化表%`s.%`spartition%`s已满添加更多历史分区(out of %s)" chi "版本化表%`s.%`spartition%`s已满添加更多历史分区(out of %s)"

View file

@ -2131,8 +2131,7 @@ lookup:
("Handler require invalidation queries of %.*s %llu-%llu", ("Handler require invalidation queries of %.*s %llu-%llu",
(int)qcache_se_key_len, qcache_se_key_name, (int)qcache_se_key_len, qcache_se_key_name,
engine_data, table->engine_data())); engine_data, table->engine_data()));
invalidate_table_internal(thd, invalidate_table_internal((uchar *) table->db(),
(uchar *) table->db(),
table->key_length()); table->key_length());
} }
else else
@ -2381,7 +2380,7 @@ void Query_cache::invalidate(THD *thd, const char *db)
if (strcmp(table->db(),db) == 0) if (strcmp(table->db(),db) == 0)
{ {
Query_cache_block_table *list_root= table_block->table(0); Query_cache_block_table *list_root= table_block->table(0);
invalidate_query_block_list(thd,list_root); invalidate_query_block_list(list_root);
} }
table_block= next; table_block= next;
@ -3320,7 +3319,7 @@ void Query_cache::invalidate_table(THD *thd, uchar * key, size_t key_length)
DEBUG_SYNC(thd, "wait_in_query_cache_invalidate2"); DEBUG_SYNC(thd, "wait_in_query_cache_invalidate2");
if (query_cache_size > 0) if (query_cache_size > 0)
invalidate_table_internal(thd, key, key_length); invalidate_table_internal(key, key_length);
unlock(); unlock();
} }
@ -3335,14 +3334,14 @@ void Query_cache::invalidate_table(THD *thd, uchar * key, size_t key_length)
*/ */
void void
Query_cache::invalidate_table_internal(THD *thd, uchar *key, size_t key_length) Query_cache::invalidate_table_internal(uchar *key, size_t key_length)
{ {
Query_cache_block *table_block= Query_cache_block *table_block=
(Query_cache_block*)my_hash_search(&tables, key, key_length); (Query_cache_block*)my_hash_search(&tables, key, key_length);
if (table_block) if (table_block)
{ {
Query_cache_block_table *list_root= table_block->table(0); Query_cache_block_table *list_root= table_block->table(0);
invalidate_query_block_list(thd, list_root); invalidate_query_block_list(list_root);
} }
} }
@ -3359,8 +3358,7 @@ Query_cache::invalidate_table_internal(THD *thd, uchar *key, size_t key_length)
*/ */
void void
Query_cache::invalidate_query_block_list(THD *thd, Query_cache::invalidate_query_block_list(Query_cache_block_table *list_root)
Query_cache_block_table *list_root)
{ {
while (list_root->next != list_root) while (list_root->next != list_root)
{ {
@ -3544,7 +3542,7 @@ Query_cache::insert_table(THD *thd, size_t key_len, const char *key,
*/ */
{ {
Query_cache_block_table *list_root= table_block->table(0); Query_cache_block_table *list_root= table_block->table(0);
invalidate_query_block_list(thd, list_root); invalidate_query_block_list(list_root);
} }
table_block= 0; table_block= 0;

View file

@ -319,7 +319,7 @@ private:
Cache_staus m_cache_status; Cache_staus m_cache_status;
void free_query_internal(Query_cache_block *point); void free_query_internal(Query_cache_block *point);
void invalidate_table_internal(THD *thd, uchar *key, size_t key_length); void invalidate_table_internal(uchar *key, size_t key_length);
protected: protected:
/* /*
@ -375,8 +375,7 @@ protected:
void invalidate_table(THD *thd, TABLE *table); void invalidate_table(THD *thd, TABLE *table);
void invalidate_table(THD *thd, uchar *key, size_t key_length); void invalidate_table(THD *thd, uchar *key, size_t key_length);
void invalidate_table(THD *thd, Query_cache_block *table_block); void invalidate_table(THD *thd, Query_cache_block *table_block);
void invalidate_query_block_list(THD *thd, void invalidate_query_block_list(Query_cache_block_table *list_root);
Query_cache_block_table *list_root);
TABLE_COUNTER_TYPE TABLE_COUNTER_TYPE
register_tables_from_list(THD *thd, TABLE_LIST *tables_used, register_tables_from_list(THD *thd, TABLE_LIST *tables_used,

View file

@ -1830,13 +1830,16 @@ err:
} }
error= thd->is_error(); error= thd->is_error();
if (non_temp_tables_count)
query_cache_invalidate3(thd, tables, 0);
/* /*
We are always logging drop of temporary tables. We are always logging drop of temporary tables.
The reason is to handle the following case: The reason is to handle the following case:
- Use statement based replication - Use statement based replication
- CREATE TEMPORARY TABLE foo (logged) - CREATE TEMPORARY TABLE foo (logged)
- set row based replication - set row based replication
- DROP TEMPORAY TABLE foo (needs to be logged) - DROP TEMPORARY TABLE foo (needs to be logged)
This should be fixed so that we remember if creation of the This should be fixed so that we remember if creation of the
temporary table was logged and only log it if the creation was temporary table was logged and only log it if the creation was
logged. logged.
@ -1848,7 +1851,6 @@ err:
if (non_trans_tmp_table_deleted || trans_tmp_table_deleted) if (non_trans_tmp_table_deleted || trans_tmp_table_deleted)
thd->transaction->stmt.mark_dropped_temp_table(); thd->transaction->stmt.mark_dropped_temp_table();
query_cache_invalidate3(thd, tables, 0);
if (!dont_log_query && mysql_bin_log.is_open()) if (!dont_log_query && mysql_bin_log.is_open())
{ {
debug_crash_here("ddl_log_drop_before_binlog"); debug_crash_here("ddl_log_drop_before_binlog");

View file

@ -415,73 +415,6 @@ done:
export_vars.innodb_buffer_pool_load_incomplete = 0; export_vars.innodb_buffer_pool_load_incomplete = 0;
} }
/*****************************************************************//**
Artificially delay the buffer pool loading if necessary. The idea of
this function is to prevent hogging the server with IO and slowing down
too much normal client queries. */
UNIV_INLINE
void
buf_load_throttle_if_needed(
/*========================*/
ulint* last_check_time, /*!< in/out: milliseconds since epoch
of the last time we did check if
throttling is needed, we do the check
every srv_io_capacity IO ops. */
ulint* last_activity_count,
ulint n_io) /*!< in: number of IO ops done since
buffer pool load has started */
{
if (n_io % srv_io_capacity < srv_io_capacity - 1) {
return;
}
if (*last_check_time == 0 || *last_activity_count == 0) {
*last_check_time = ut_time_ms();
*last_activity_count = srv_get_activity_count();
return;
}
/* srv_io_capacity IO operations have been performed by buffer pool
load since the last time we were here. */
/* If no other activity, then keep going without any delay. */
if (srv_get_activity_count() == *last_activity_count) {
return;
}
/* There has been other activity, throttle. */
ulint now = ut_time_ms();
ulint elapsed_time = now - *last_check_time;
/* Notice that elapsed_time is not the time for the last
srv_io_capacity IO operations performed by BP load. It is the
time elapsed since the last time we detected that there has been
other activity. This has a small and acceptable deficiency, e.g.:
1. BP load runs and there is no other activity.
2. Other activity occurs, we run N IO operations after that and
enter here (where 0 <= N < srv_io_capacity).
3. last_check_time is very old and we do not sleep at this time, but
only update last_check_time and last_activity_count.
4. We run srv_io_capacity more IO operations and call this function
again.
5. There has been more other activity and thus we enter here.
6. Now last_check_time is recent and we sleep if necessary to prevent
more than srv_io_capacity IO operations per second.
The deficiency is that we could have slept at 3., but for this we
would have to update last_check_time before the
"cur_activity_count == *last_activity_count" check and calling
ut_time_ms() that often may turn out to be too expensive. */
if (elapsed_time < 1000 /* 1 sec (1000 milli secs) */) {
std::this_thread::sleep_for(
std::chrono::milliseconds(1000 - elapsed_time));
}
*last_check_time = ut_time_ms();
*last_activity_count = srv_get_activity_count();
}
/*****************************************************************//** /*****************************************************************//**
Perform a buffer pool load from the file specified by Perform a buffer pool load from the file specified by
innodb_buffer_pool_filename. If any errors occur then the value of innodb_buffer_pool_filename. If any errors occur then the value of
@ -631,9 +564,6 @@ buf_load()
std::sort(dump, dump + dump_n); std::sort(dump, dump + dump_n);
} }
ulint last_check_time = 0;
ulint last_activity_cnt = 0;
/* Avoid calling the expensive fil_space_t::get() for each /* Avoid calling the expensive fil_space_t::get() for each
page within the same tablespace. dump[] is sorted by (space, page), page within the same tablespace. dump[] is sorted by (space, page),
so all pages from a given tablespace are consecutive. */ so all pages from a given tablespace are consecutive. */
@ -707,9 +637,6 @@ buf_load()
return; return;
} }
buf_load_throttle_if_needed(
&last_check_time, &last_activity_cnt, i);
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
if ((i+1) >= srv_buf_pool_load_pages_abort) { if ((i+1) >= srv_buf_pool_load_pages_abort) {
buf_load_abort_flag = true; buf_load_abort_flag = true;

View file

@ -190,8 +190,6 @@ LRU list. The compressed page is preserved, and it need not be clean.
@return true if freed */ @return true if freed */
static bool buf_LRU_free_from_unzip_LRU_list(ulint limit) static bool buf_LRU_free_from_unzip_LRU_list(ulint limit)
{ {
mysql_mutex_assert_owner(&buf_pool.mutex);
if (!buf_LRU_evict_from_unzip_LRU()) { if (!buf_LRU_evict_from_unzip_LRU()) {
return(false); return(false);
} }
@ -210,6 +208,7 @@ static bool buf_LRU_free_from_unzip_LRU_list(ulint limit)
freed = buf_LRU_free_page(&block->page, false); freed = buf_LRU_free_page(&block->page, false);
if (freed) { if (freed) {
scanned++;
break; break;
} }
@ -254,17 +253,16 @@ static bool buf_LRU_free_from_common_LRU_list(ulint limit)
} }
freed = true; freed = true;
scanned++;
break; break;
} }
} }
if (scanned) { MONITOR_INC_VALUE_CUMULATIVE(
MONITOR_INC_VALUE_CUMULATIVE( MONITOR_LRU_SEARCH_SCANNED,
MONITOR_LRU_SEARCH_SCANNED, MONITOR_LRU_SEARCH_SCANNED_NUM_CALL,
MONITOR_LRU_SEARCH_SCANNED_NUM_CALL, MONITOR_LRU_SEARCH_SCANNED_PER_CALL,
MONITOR_LRU_SEARCH_SCANNED_PER_CALL, scanned);
scanned);
}
return(freed); return(freed);
} }

View file

@ -297,9 +297,9 @@ dberr_t dict_boot()
dict_mem_index_add_field(index, "NAME", 0); dict_mem_index_add_field(index, "NAME", 0);
index->id = DICT_TABLES_ID; index->id = DICT_TABLES_ID;
dberr_t error = dict_index_add_to_cache( err = dict_index_add_to_cache(
index, mach_read_from_4(dict_hdr + DICT_HDR_TABLES)); index, mach_read_from_4(dict_hdr + DICT_HDR_TABLES));
ut_a(error == DB_SUCCESS); ut_a(err == DB_SUCCESS);
ut_ad(!table->is_instant()); ut_ad(!table->is_instant());
table->indexes.start->n_core_null_bytes = static_cast<uint8_t>( table->indexes.start->n_core_null_bytes = static_cast<uint8_t>(
UT_BITS_IN_BYTES(unsigned(table->indexes.start->n_nullable))); UT_BITS_IN_BYTES(unsigned(table->indexes.start->n_nullable)));
@ -309,9 +309,9 @@ dberr_t dict_boot()
dict_mem_index_add_field(index, "ID", 0); dict_mem_index_add_field(index, "ID", 0);
index->id = DICT_TABLE_IDS_ID; index->id = DICT_TABLE_IDS_ID;
error = dict_index_add_to_cache( err = dict_index_add_to_cache(
index, mach_read_from_4(dict_hdr + DICT_HDR_TABLE_IDS)); index, mach_read_from_4(dict_hdr + DICT_HDR_TABLE_IDS));
ut_a(error == DB_SUCCESS); ut_a(err == DB_SUCCESS);
/*-------------------------*/ /*-------------------------*/
table = dict_table_t::create(dict_sys.SYS_TABLE[dict_sys.SYS_COLUMNS], table = dict_table_t::create(dict_sys.SYS_TABLE[dict_sys.SYS_COLUMNS],
@ -339,9 +339,9 @@ dberr_t dict_boot()
dict_mem_index_add_field(index, "POS", 0); dict_mem_index_add_field(index, "POS", 0);
index->id = DICT_COLUMNS_ID; index->id = DICT_COLUMNS_ID;
error = dict_index_add_to_cache( err = dict_index_add_to_cache(
index, mach_read_from_4(dict_hdr + DICT_HDR_COLUMNS)); index, mach_read_from_4(dict_hdr + DICT_HDR_COLUMNS));
ut_a(error == DB_SUCCESS); ut_a(err == DB_SUCCESS);
ut_ad(!table->is_instant()); ut_ad(!table->is_instant());
table->indexes.start->n_core_null_bytes = static_cast<uint8_t>( table->indexes.start->n_core_null_bytes = static_cast<uint8_t>(
UT_BITS_IN_BYTES(unsigned(table->indexes.start->n_nullable))); UT_BITS_IN_BYTES(unsigned(table->indexes.start->n_nullable)));
@ -382,9 +382,9 @@ dberr_t dict_boot()
dict_mem_index_add_field(index, "ID", 0); dict_mem_index_add_field(index, "ID", 0);
index->id = DICT_INDEXES_ID; index->id = DICT_INDEXES_ID;
error = dict_index_add_to_cache( err = dict_index_add_to_cache(
index, mach_read_from_4(dict_hdr + DICT_HDR_INDEXES)); index, mach_read_from_4(dict_hdr + DICT_HDR_INDEXES));
ut_a(error == DB_SUCCESS); ut_a(err == DB_SUCCESS);
ut_ad(!table->is_instant()); ut_ad(!table->is_instant());
table->indexes.start->n_core_null_bytes = static_cast<uint8_t>( table->indexes.start->n_core_null_bytes = static_cast<uint8_t>(
UT_BITS_IN_BYTES(unsigned(table->indexes.start->n_nullable))); UT_BITS_IN_BYTES(unsigned(table->indexes.start->n_nullable)));
@ -411,9 +411,9 @@ dberr_t dict_boot()
dict_mem_index_add_field(index, "POS", 0); dict_mem_index_add_field(index, "POS", 0);
index->id = DICT_FIELDS_ID; index->id = DICT_FIELDS_ID;
error = dict_index_add_to_cache( err = dict_index_add_to_cache(
index, mach_read_from_4(dict_hdr + DICT_HDR_FIELDS)); index, mach_read_from_4(dict_hdr + DICT_HDR_FIELDS));
ut_a(error == DB_SUCCESS); ut_a(err == DB_SUCCESS);
ut_ad(!table->is_instant()); ut_ad(!table->is_instant());
table->indexes.start->n_core_null_bytes = static_cast<uint8_t>( table->indexes.start->n_core_null_bytes = static_cast<uint8_t>(
UT_BITS_IN_BYTES(unsigned(table->indexes.start->n_nullable))); UT_BITS_IN_BYTES(unsigned(table->indexes.start->n_nullable)));
@ -422,7 +422,8 @@ dberr_t dict_boot()
err = ibuf_init_at_db_start(); err = ibuf_init_at_db_start();
if (err == DB_SUCCESS) { if (err == DB_SUCCESS || srv_force_recovery >= SRV_FORCE_NO_DDL_UNDO) {
err = DB_SUCCESS;
/* Load definitions of other indexes on system tables */ /* Load definitions of other indexes on system tables */
dict_load_sys_table(dict_sys.sys_tables); dict_load_sys_table(dict_sys.sys_tables);

View file

@ -49,6 +49,7 @@ Created 7/19/1997 Heikki Tuuri
#include "que0que.h" #include "que0que.h"
#include "srv0start.h" /* srv_shutdown_state */ #include "srv0start.h" /* srv_shutdown_state */
#include "rem0cmp.h" #include "rem0cmp.h"
#include "log.h"
/* STRUCTURE OF AN INSERT BUFFER RECORD /* STRUCTURE OF AN INSERT BUFFER RECORD
@ -402,24 +403,11 @@ ibuf_init_at_db_start(void)
if (!header_page) { if (!header_page) {
err_exit: err_exit:
sql_print_error("InnoDB: The change buffer is corrupted");
mtr.commit(); mtr.commit();
return err; return err;
} }
/* At startup we intialize ibuf to have a maximum of
CHANGE_BUFFER_DEFAULT_SIZE in terms of percentage of the
buffer pool size. Once ibuf struct is initialized this
value is updated with the user supplied size by calling
ibuf_max_size_update(). */
ibuf.max_size = ((buf_pool_get_curr_size() >> srv_page_size_shift)
* CHANGE_BUFFER_DEFAULT_SIZE) / 100;
mysql_mutex_init(ibuf_mutex_key, &ibuf_mutex, nullptr);
mysql_mutex_init(ibuf_pessimistic_insert_mutex_key,
&ibuf_pessimistic_insert_mutex, nullptr);
mysql_mutex_lock(&ibuf_mutex);
fseg_n_reserved_pages(*header_page, fseg_n_reserved_pages(*header_page,
IBUF_HEADER + IBUF_TREE_SEG_HEADER IBUF_HEADER + IBUF_TREE_SEG_HEADER
+ header_page->page.frame, &ibuf.seg_size, &mtr); + header_page->page.frame, &ibuf.seg_size, &mtr);
@ -438,6 +426,25 @@ err_exit:
goto err_exit; goto err_exit;
} }
if (page_is_comp(root) || fil_page_get_type(root) != FIL_PAGE_INDEX
|| btr_page_get_index_id(root) != DICT_IBUF_ID_MIN) {
err = DB_CORRUPTION;
goto err_exit;
}
/* At startup we intialize ibuf to have a maximum of
CHANGE_BUFFER_DEFAULT_SIZE in terms of percentage of the
buffer pool size. Once ibuf struct is initialized this
value is updated with the user supplied size by calling
ibuf_max_size_update(). */
ibuf.max_size = ((buf_pool_get_curr_size() >> srv_page_size_shift)
* CHANGE_BUFFER_DEFAULT_SIZE) / 100;
mysql_mutex_init(ibuf_mutex_key, &ibuf_mutex, nullptr);
mysql_mutex_init(ibuf_pessimistic_insert_mutex_key,
&ibuf_pessimistic_insert_mutex, nullptr);
mysql_mutex_lock(&ibuf_mutex);
ibuf_size_update(root); ibuf_size_update(root);
mysql_mutex_unlock(&ibuf_mutex); mysql_mutex_unlock(&ibuf_mutex);
@ -487,6 +494,7 @@ ibuf_max_size_update(
ulint new_val) /*!< in: new value in terms of ulint new_val) /*!< in: new value in terms of
percentage of the buffer pool size */ percentage of the buffer pool size */
{ {
if (UNIV_UNLIKELY(!ibuf.index)) return;
ulint new_size = ((buf_pool_get_curr_size() >> srv_page_size_shift) ulint new_size = ((buf_pool_get_curr_size() >> srv_page_size_shift)
* new_val) / 100; * new_val) / 100;
mysql_mutex_lock(&ibuf_mutex); mysql_mutex_lock(&ibuf_mutex);

View file

@ -82,15 +82,6 @@ HAVE_PSI_INTERFACE is defined. */
# define UNIV_PFS_MEMORY # define UNIV_PFS_MEMORY
# endif /* HAVE_PSI_MEMORY_INTERFACE */ # endif /* HAVE_PSI_MEMORY_INTERFACE */
/* There are mutexes/rwlocks that we want to exclude from
instrumentation even if their corresponding performance schema
define is set. And this PFS_NOT_INSTRUMENTED is used
as the key value to identify those objects that would
be excluded from instrumentation. */
# define PFS_NOT_INSTRUMENTED ULINT32_UNDEFINED
# define PFS_IS_INSTRUMENTED(key) ((key) != PFS_NOT_INSTRUMENTED)
#ifdef HAVE_PFS_THREAD_PROVIDER_H #ifdef HAVE_PFS_THREAD_PROVIDER_H
/* For PSI_MUTEX_CALL() and similar. */ /* For PSI_MUTEX_CALL() and similar. */
#include "pfs_thread_provider.h" #include "pfs_thread_provider.h"

View file

@ -651,22 +651,12 @@ static struct
{ {
/* Replace absolute DATA DIRECTORY file paths with /* Replace absolute DATA DIRECTORY file paths with
short names relative to the backup directory. */ short names relative to the backup directory. */
const char *name= strrchr(filename, '/'); if (const char *name= strrchr(filename, '/'))
#ifdef _WIN32
if (const char *last= strrchr(filename, '\\'))
if (last > name)
name= last;
#endif
if (name)
{ {
while (--name > filename && while (--name > filename && *name != '/');
#ifdef _WIN32
*name != '\\' &&
#endif
*name != '/');
if (name > filename) if (name > filename)
filename= name + 1; filename= name + 1;
} }
} }
char *fil_path= fil_make_filepath(nullptr, {filename, strlen(filename)}, char *fil_path= fil_make_filepath(nullptr, {filename, strlen(filename)},
@ -832,21 +822,9 @@ processed:
const char *filename= name.c_str(); const char *filename= name.c_str();
if (srv_operation == SRV_OPERATION_RESTORE) if (srv_operation == SRV_OPERATION_RESTORE)
{ {
const char* tbl_name = strrchr(filename, '/'); if (const char *tbl_name= strrchr(filename, '/'))
#ifdef _WIN32
if (const char *last = strrchr(filename, '\\'))
{ {
if (last > tbl_name) while (--tbl_name > filename && *tbl_name != '/');
tbl_name = last;
}
#endif
if (tbl_name)
{
while (--tbl_name > filename &&
#ifdef _WIN32
*tbl_name != '\\' &&
#endif
*tbl_name != '/');
if (tbl_name > filename) if (tbl_name > filename)
filename= tbl_name + 1; filename= tbl_name + 1;
} }
@ -1671,7 +1649,7 @@ static dberr_t recv_log_recover_10_5(lsn_t lsn_offset)
if (lsn_offset < (log_sys.is_pmem() ? log_sys.file_size : 4096)) if (lsn_offset < (log_sys.is_pmem() ? log_sys.file_size : 4096))
memcpy_aligned<512>(buf, &log_sys.buf[lsn_offset & ~511], 512); memcpy_aligned<512>(buf, &log_sys.buf[lsn_offset & ~511], 512);
else else
recv_sys.read(lsn_offset & ~511, {buf, 512}); recv_sys.read(lsn_offset & ~lsn_t{511}, {buf, 512});
if (!recv_check_log_block(buf)) if (!recv_check_log_block(buf))
{ {

View file

@ -1287,14 +1287,14 @@ bool mtr_t::have_x_latch(const buf_block_t &block) const
if (!m_memo) if (!m_memo)
return false; return false;
const mtr_memo_slot_t *found= nullptr; ut_d(const mtr_memo_slot_t *found= nullptr);
for (const mtr_memo_slot_t &slot : *m_memo) for (const mtr_memo_slot_t &slot : *m_memo)
{ {
if (slot.object != &block) if (slot.object != &block)
continue; continue;
found= &slot; ut_d(found= &slot);
if (!(slot.type & MTR_MEMO_PAGE_X_FIX)) if (!(slot.type & MTR_MEMO_PAGE_X_FIX))
continue; continue;

View file

@ -1730,7 +1730,8 @@ void innodb_shutdown()
|| srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO); || srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO);
ut_ad(lock_sys.is_initialised() || !srv_was_started); ut_ad(lock_sys.is_initialised() || !srv_was_started);
ut_ad(log_sys.is_initialised() || !srv_was_started); ut_ad(log_sys.is_initialised() || !srv_was_started);
ut_ad(ibuf.index || !srv_was_started); ut_ad(ibuf.index || !srv_was_started
|| srv_force_recovery >= SRV_FORCE_NO_DDL_UNDO);
dict_stats_deinit(); dict_stats_deinit();

View file

@ -640,7 +640,7 @@ my_bool print_aria_log_control()
open_flags, MYF(MY_WME))) < 0) open_flags, MYF(MY_WME))) < 0)
{ {
errmsg= "Can't open file"; errmsg= "Can't open file";
goto err; goto err2;
} }
file_size= mysql_file_seek(file, 0, SEEK_END, MYF(MY_WME)); file_size= mysql_file_seek(file, 0, SEEK_END, MYF(MY_WME));
@ -723,10 +723,12 @@ my_bool print_aria_log_control()
(buffer + new_cf_create_time_size + CF_RECOV_FAIL_OFFSET)[0]; (buffer + new_cf_create_time_size + CF_RECOV_FAIL_OFFSET)[0];
printf("recovery_failures: %u\n", recovery_fails); printf("recovery_failures: %u\n", recovery_fails);
} }
mysql_file_close(file, MYF(0));
DBUG_RETURN(0); DBUG_RETURN(0);
err: err:
mysql_file_close(file, MYF(0));
err2:
my_printf_error(HA_ERR_INITIALIZATION, my_printf_error(HA_ERR_INITIALIZATION,
"Got error '%s' when trying to use aria control file " "Got error '%s' when trying to use aria control file "
"'%s'", 0, errmsg, name); "'%s'", 0, errmsg, name);