Commit 0261eac5 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.5 into 10.6

parents 428b057e 017d1b86
...@@ -48,6 +48,7 @@ MACRO(BUNDLE_PCRE2) ...@@ -48,6 +48,7 @@ MACRO(BUNDLE_PCRE2)
URL_MD5 8c1699a725d4b28410adf4b964ebbcb7 URL_MD5 8c1699a725d4b28410adf4b964ebbcb7
INSTALL_COMMAND "" INSTALL_COMMAND ""
CMAKE_ARGS CMAKE_ARGS
"-DCMAKE_WARN_DEPRECATED=FALSE"
"-DPCRE2_BUILD_TESTS=OFF" "-DPCRE2_BUILD_TESTS=OFF"
"-DPCRE2_BUILD_PCRE2GREP=OFF" "-DPCRE2_BUILD_PCRE2GREP=OFF"
"-DBUILD_SHARED_LIBS=OFF" "-DBUILD_SHARED_LIBS=OFF"
......
...@@ -3415,5 +3415,23 @@ ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITH ...@@ -3415,5 +3415,23 @@ ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITH
delete from t1 where a = 11; delete from t1 where a = 11;
drop table t1; drop table t1;
# #
# MDEV-23836: Assertion `! is_set() || m_can_overwrite_status' in
# Diagnostics_area::set_error_status (interrupted ALTER TABLE under LOCK)
#
SET @max_session_mem_used_save= @@max_session_mem_used;
CREATE TABLE t1 (a INT);
SELECT * FROM t1;
a
ALTER TABLE x MODIFY xx INT;
ERROR 42S02: Table 'test.x' doesn't exist
SET SESSION max_session_mem_used= 8192;
LOCK TABLE t1 WRITE;
ALTER TABLE t1 CHANGE COLUMN IF EXISTS b c INT;
Warnings:
Note 1054 Unknown column 'b' in 't1'
SET SESSION max_session_mem_used = @max_session_mem_used_save;
UNLOCK TABLES;
DROP TABLE t1;
#
# End of 10.5 tests # End of 10.5 tests
# #
...@@ -2661,6 +2661,28 @@ delete from t1 where a = 11; ...@@ -2661,6 +2661,28 @@ delete from t1 where a = 11;
# cleanup # cleanup
drop table t1; drop table t1;
--echo #
--echo # MDEV-23836: Assertion `! is_set() || m_can_overwrite_status' in
--echo # Diagnostics_area::set_error_status (interrupted ALTER TABLE under LOCK)
--echo #
SET @max_session_mem_used_save= @@max_session_mem_used;
CREATE TABLE t1 (a INT);
SELECT * FROM t1;
--error ER_NO_SUCH_TABLE
ALTER TABLE x MODIFY xx INT;
SET SESSION max_session_mem_used= 8192;
LOCK TABLE t1 WRITE;
ALTER TABLE t1 CHANGE COLUMN IF EXISTS b c INT;
SET SESSION max_session_mem_used = @max_session_mem_used_save;
UNLOCK TABLES;
DROP TABLE t1;
--echo # --echo #
--echo # End of 10.5 tests --echo # End of 10.5 tests
--echo # --echo #
...@@ -356,7 +356,7 @@ bool mysql_lock_tables(THD *thd, MYSQL_LOCK *sql_lock, uint flags) ...@@ -356,7 +356,7 @@ bool mysql_lock_tables(THD *thd, MYSQL_LOCK *sql_lock, uint flags)
end: end:
THD_STAGE_INFO(thd, org_stage); THD_STAGE_INFO(thd, org_stage);
if (thd->killed) if (thd->killed && !thd->get_stmt_da()->is_ok())
{ {
thd->send_kill_message(); thd->send_kill_message();
if (!rc) if (!rc)
......
...@@ -2616,7 +2616,9 @@ void Locked_tables_list::mark_table_for_reopen(THD *thd, TABLE *table) ...@@ -2616,7 +2616,9 @@ void Locked_tables_list::mark_table_for_reopen(THD *thd, TABLE *table)
bool bool
Locked_tables_list::reopen_tables(THD *thd, bool need_reopen) Locked_tables_list::reopen_tables(THD *thd, bool need_reopen)
{ {
Open_table_context ot_ctx(thd, MYSQL_OPEN_REOPEN); bool is_ok= thd->get_stmt_da()->is_ok();
Open_table_context ot_ctx(thd, !is_ok ? MYSQL_OPEN_REOPEN:
MYSQL_OPEN_IGNORE_KILLED | MYSQL_OPEN_REOPEN);
uint reopen_count= 0; uint reopen_count= 0;
MYSQL_LOCK *lock; MYSQL_LOCK *lock;
MYSQL_LOCK *merged_lock; MYSQL_LOCK *merged_lock;
......
...@@ -3059,6 +3059,32 @@ inline fil_space_t *fil_system_t::find(const char *path) const ...@@ -3059,6 +3059,32 @@ inline fil_space_t *fil_system_t::find(const char *path) const
return nullptr; return nullptr;
} }
/** Thread-safe function which sorts flush_list by oldest_modification */
static void log_sort_flush_list()
{
mysql_mutex_lock(&buf_pool.flush_list_mutex);
const size_t size= UT_LIST_GET_LEN(buf_pool.flush_list);
std::unique_ptr<buf_page_t *[]> list(new buf_page_t *[size]);
size_t idx= 0;
for (buf_page_t *p= UT_LIST_GET_FIRST(buf_pool.flush_list); p;
p= UT_LIST_GET_NEXT(list, p))
list.get()[idx++]= p;
std::sort(list.get(), list.get() + size,
[](const buf_page_t *lhs, const buf_page_t *rhs) {
return rhs->oldest_modification() < lhs->oldest_modification();
});
UT_LIST_INIT(buf_pool.flush_list, &buf_page_t::list);
for (size_t i= 0; i < size; i++)
UT_LIST_ADD_LAST(buf_pool.flush_list, list[i]);
mysql_mutex_unlock(&buf_pool.flush_list_mutex);
}
/** Apply buffered log to persistent data pages. /** Apply buffered log to persistent data pages.
@param last_batch whether it is possible to write more redo log */ @param last_batch whether it is possible to write more redo log */
void recv_sys_t::apply(bool last_batch) void recv_sys_t::apply(bool last_batch)
...@@ -3254,9 +3280,15 @@ void recv_sys_t::apply(bool last_batch) ...@@ -3254,9 +3280,15 @@ void recv_sys_t::apply(bool last_batch)
mysql_mutex_assert_not_owner(&log_sys.mutex); mysql_mutex_assert_not_owner(&log_sys.mutex);
mysql_mutex_unlock(&mutex); mysql_mutex_unlock(&mutex);
/* Instead of flushing, last_batch could sort the buf_pool.flush_list if (last_batch && srv_operation != SRV_OPERATION_RESTORE &&
in ascending order of buf_page_t::oldest_modification. */ srv_operation != SRV_OPERATION_RESTORE_EXPORT)
buf_flush_sync_batch(recovered_lsn); log_sort_flush_list();
else
{
/* Instead of flushing, last_batch could sort the buf_pool.flush_list
in ascending order of buf_page_t::oldest_modification. */
buf_flush_sync_batch(recovered_lsn);
}
if (!last_batch) if (!last_batch)
{ {
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2021, MariaDB Corporation. Copyright (c) 2017, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software 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) ...@@ -1373,7 +1373,6 @@ void mtr_t::modify(const buf_block_t &block)
{ {
/* This must be PageConverter::update_page() in IMPORT TABLESPACE. */ /* This must be PageConverter::update_page() in IMPORT TABLESPACE. */
ut_ad(!block.page.in_LRU_list); ut_ad(!block.page.in_LRU_list);
ut_ad(!buf_pool.is_uncompressed(&block));
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment