Skip to content

Commit 0261eac

Browse files
committed
Merge 10.5 into 10.6
2 parents 428b057 + 017d1b8 commit 0261eac

File tree

7 files changed

+81
-7
lines changed

7 files changed

+81
-7
lines changed

cmake/pcre.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ MACRO(BUNDLE_PCRE2)
4848
URL_MD5 8c1699a725d4b28410adf4b964ebbcb7
4949
INSTALL_COMMAND ""
5050
CMAKE_ARGS
51+
"-DCMAKE_WARN_DEPRECATED=FALSE"
5152
"-DPCRE2_BUILD_TESTS=OFF"
5253
"-DPCRE2_BUILD_PCRE2GREP=OFF"
5354
"-DBUILD_SHARED_LIBS=OFF"

mysql-test/main/alter_table.result

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3415,5 +3415,23 @@ ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITH
34153415
delete from t1 where a = 11;
34163416
drop table t1;
34173417
#
3418+
# MDEV-23836: Assertion `! is_set() || m_can_overwrite_status' in
3419+
# Diagnostics_area::set_error_status (interrupted ALTER TABLE under LOCK)
3420+
#
3421+
SET @max_session_mem_used_save= @@max_session_mem_used;
3422+
CREATE TABLE t1 (a INT);
3423+
SELECT * FROM t1;
3424+
a
3425+
ALTER TABLE x MODIFY xx INT;
3426+
ERROR 42S02: Table 'test.x' doesn't exist
3427+
SET SESSION max_session_mem_used= 8192;
3428+
LOCK TABLE t1 WRITE;
3429+
ALTER TABLE t1 CHANGE COLUMN IF EXISTS b c INT;
3430+
Warnings:
3431+
Note 1054 Unknown column 'b' in 't1'
3432+
SET SESSION max_session_mem_used = @max_session_mem_used_save;
3433+
UNLOCK TABLES;
3434+
DROP TABLE t1;
3435+
#
34183436
# End of 10.5 tests
34193437
#

mysql-test/main/alter_table.test

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2661,6 +2661,28 @@ delete from t1 where a = 11;
26612661
# cleanup
26622662
drop table t1;
26632663

2664+
--echo #
2665+
--echo # MDEV-23836: Assertion `! is_set() || m_can_overwrite_status' in
2666+
--echo # Diagnostics_area::set_error_status (interrupted ALTER TABLE under LOCK)
2667+
--echo #
2668+
2669+
SET @max_session_mem_used_save= @@max_session_mem_used;
2670+
2671+
CREATE TABLE t1 (a INT);
2672+
SELECT * FROM t1;
2673+
2674+
--error ER_NO_SUCH_TABLE
2675+
ALTER TABLE x MODIFY xx INT;
2676+
2677+
SET SESSION max_session_mem_used= 8192;
2678+
LOCK TABLE t1 WRITE;
2679+
2680+
ALTER TABLE t1 CHANGE COLUMN IF EXISTS b c INT;
2681+
2682+
SET SESSION max_session_mem_used = @max_session_mem_used_save;
2683+
UNLOCK TABLES;
2684+
DROP TABLE t1;
2685+
26642686
--echo #
26652687
--echo # End of 10.5 tests
26662688
--echo #

sql/lock.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ bool mysql_lock_tables(THD *thd, MYSQL_LOCK *sql_lock, uint flags)
356356
end:
357357
THD_STAGE_INFO(thd, org_stage);
358358

359-
if (thd->killed)
359+
if (thd->killed && !thd->get_stmt_da()->is_ok())
360360
{
361361
thd->send_kill_message();
362362
if (!rc)

sql/sql_base.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2616,7 +2616,9 @@ void Locked_tables_list::mark_table_for_reopen(THD *thd, TABLE *table)
26162616
bool
26172617
Locked_tables_list::reopen_tables(THD *thd, bool need_reopen)
26182618
{
2619-
Open_table_context ot_ctx(thd, MYSQL_OPEN_REOPEN);
2619+
bool is_ok= thd->get_stmt_da()->is_ok();
2620+
Open_table_context ot_ctx(thd, !is_ok ? MYSQL_OPEN_REOPEN:
2621+
MYSQL_OPEN_IGNORE_KILLED | MYSQL_OPEN_REOPEN);
26202622
uint reopen_count= 0;
26212623
MYSQL_LOCK *lock;
26222624
MYSQL_LOCK *merged_lock;

storage/innobase/log/log0recv.cc

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3059,6 +3059,32 @@ inline fil_space_t *fil_system_t::find(const char *path) const
30593059
return nullptr;
30603060
}
30613061

3062+
/** Thread-safe function which sorts flush_list by oldest_modification */
3063+
static void log_sort_flush_list()
3064+
{
3065+
mysql_mutex_lock(&buf_pool.flush_list_mutex);
3066+
3067+
const size_t size= UT_LIST_GET_LEN(buf_pool.flush_list);
3068+
std::unique_ptr<buf_page_t *[]> list(new buf_page_t *[size]);
3069+
3070+
size_t idx= 0;
3071+
for (buf_page_t *p= UT_LIST_GET_FIRST(buf_pool.flush_list); p;
3072+
p= UT_LIST_GET_NEXT(list, p))
3073+
list.get()[idx++]= p;
3074+
3075+
std::sort(list.get(), list.get() + size,
3076+
[](const buf_page_t *lhs, const buf_page_t *rhs) {
3077+
return rhs->oldest_modification() < lhs->oldest_modification();
3078+
});
3079+
3080+
UT_LIST_INIT(buf_pool.flush_list, &buf_page_t::list);
3081+
3082+
for (size_t i= 0; i < size; i++)
3083+
UT_LIST_ADD_LAST(buf_pool.flush_list, list[i]);
3084+
3085+
mysql_mutex_unlock(&buf_pool.flush_list_mutex);
3086+
}
3087+
30623088
/** Apply buffered log to persistent data pages.
30633089
@param last_batch whether it is possible to write more redo log */
30643090
void recv_sys_t::apply(bool last_batch)
@@ -3254,9 +3280,15 @@ void recv_sys_t::apply(bool last_batch)
32543280
mysql_mutex_assert_not_owner(&log_sys.mutex);
32553281
mysql_mutex_unlock(&mutex);
32563282

3257-
/* Instead of flushing, last_batch could sort the buf_pool.flush_list
3258-
in ascending order of buf_page_t::oldest_modification. */
3259-
buf_flush_sync_batch(recovered_lsn);
3283+
if (last_batch && srv_operation != SRV_OPERATION_RESTORE &&
3284+
srv_operation != SRV_OPERATION_RESTORE_EXPORT)
3285+
log_sort_flush_list();
3286+
else
3287+
{
3288+
/* Instead of flushing, last_batch could sort the buf_pool.flush_list
3289+
in ascending order of buf_page_t::oldest_modification. */
3290+
buf_flush_sync_batch(recovered_lsn);
3291+
}
32603292

32613293
if (!last_batch)
32623294
{

storage/innobase/mtr/mtr0mtr.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*****************************************************************************
22
33
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
4-
Copyright (c) 2017, 2021, MariaDB Corporation.
4+
Copyright (c) 2017, 2022, MariaDB Corporation.
55
66
This program is free software; you can redistribute it and/or modify it under
77
the terms of the GNU General Public License as published by the Free Software
@@ -1373,7 +1373,6 @@ void mtr_t::modify(const buf_block_t &block)
13731373
{
13741374
/* This must be PageConverter::update_page() in IMPORT TABLESPACE. */
13751375
ut_ad(!block.page.in_LRU_list);
1376-
ut_ad(!buf_pool.is_uncompressed(&block));
13771376
return;
13781377
}
13791378

0 commit comments

Comments
 (0)