Commit 49f95c40 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.5 into 10.6

parents 75c641d2 2c9f2a4c
......@@ -24,10 +24,13 @@ then
# build less verbose
# MCOL-4149: ColumnStore builds are so slow and big that they must be skipped on
# both Travis-CI and Gitlab-CI
sed -e '/Add support for verbose builds/,/^$/d' \
-e '/ColumnStore is part of the build/,/^$/d' \
-e 's|$(CMAKEFLAGS)|$(CMAKEFLAGS) -DPLUGIN_COLUMNSTORE=NO|' \
sed -e 's|$(CMAKEFLAGS)|$(CMAKEFLAGS) -DPLUGIN_COLUMNSTORE=NO|' \
-i debian/rules
elif [ -d storage/columnstore/columnstore/debian ]
then
cp -v storage/columnstore/columnstore/debian/mariadb-plugin-columnstore.* debian/
echo >> debian/control
cat storage/columnstore/columnstore/debian/control >> debian/control
fi
# Don't build or try to put files in a package for selected plugins and components on Travis-CI
......
......@@ -124,7 +124,7 @@ EOF
if [ ! -d "$mysql_datadir" ] && [ ! -L "$mysql_datadir" ]; then mkdir -Z "$mysql_datadir" ; fi
if [ ! -d "$mysql_logdir" ] && [ ! -L "$mysql_logdir" ]; then mkdir -Z "$mysql_logdir" ; fi
# When creating an ext3 jounal on an already mounted filesystem like e.g.
# /var/lib/mysql, you get a .journal file that is not modifyable by chown.
# /var/lib/mysql, you get a .journal file that is not modifiable by chown.
# The mysql_statedir must not be writable by the mysql user under any
# circumstances as it contains scripts that are executed by root.
set +e
......@@ -161,7 +161,7 @@ EOF
# Clean up old flags before setting new one
rm -f $mysql_datadir/debian-*.flag
# Flag data dir to avoid downgrades
touch "$mysql_datadir/debian-$MAJOR_VER.flag"
touch $mysql_datadir/debian-10.6.flag
# initiate databases. Output is not allowed by debconf :-(
# This will fail if we are upgrading an existing database; in this case
......@@ -175,9 +175,6 @@ EOF
$ERR_LOGGER
set -e
# To avoid downgrades.
touch "$mysql_statedir/debian-$MAJOR_VER.flag"
# On new installations root user can connect via unix_socket.
# But on upgrades, scripts rely on debian-sys-maint user and
# credentials in /etc/mysql/debian.cnf
......@@ -251,7 +248,7 @@ EOF
;;
esac
db_stop # in case invoke failes
db_stop # in case invoke fails
# dh_systemd_start doesn't emit anything since we still ship /etc/init.d/mariadb.
# Thus MariaDB server is started via init.d script, which in turn redirects to
......
......@@ -73,15 +73,6 @@ ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
dh_auto_build --builddirectory=builddir-native -- import_executables
endif
# ColumnStore is part of the build
ifneq (32,$(DEB_HOST_ARCH_BITS))
# Take the files and part of control from MCS directory
cp -v storage/columnstore/columnstore/debian/mariadb-plugin-columnstore.* debian/
# Don't include twice
grep -q '^Package: mariadb-plugin-columnstore$$' debian/control || \
( echo && cat storage/columnstore/columnstore/debian/control ) >> debian/control
endif
echo "server:Version=$(DEB_VERSION)" >> debian/substvars
# RocksDB and Column Store cannot build on 32-bit platforms
......
......@@ -922,8 +922,6 @@ bool lock_tables(MYSQL *connection)
xb_mysql_query(connection, "BACKUP STAGE START", true);
DBUG_MARIABACKUP_EVENT("after_backup_stage_start", {});
// xb_mysql_query(connection, "BACKUP STAGE FLUSH", true);
// xb_mysql_query(connection, "BACKUP STAGE BLOCK_DDL", true);
xb_mysql_query(connection, "BACKUP STAGE BLOCK_COMMIT", true);
DBUG_MARIABACKUP_EVENT("after_backup_stage_block_commit", {});
/* Set the maximum supported session value for
......
--thread-handling=pool-of-threads --loose-thread-pool-mode=generic --loose-thread-pool-groups=ON --loose-thread-pool-queues=ON --thread-pool-stats=ON --thread-pool-waits=ON
\ No newline at end of file
--thread-handling=pool-of-threads --loose-thread-pool-mode=generic --loose-thread-pool-groups=ON --loose-thread-pool-queues=ON --thread-pool-stats=ON --thread-pool-waits=ON --thread-pool-size=1 --thread-pool-max-threads=2 --thread-pool-dedicated-listener
......@@ -26,13 +26,6 @@ SUM(QUEUE_LENGTH)
SELECT SUM(IS_STALLED) FROM INFORMATION_SCHEMA.THREAD_POOL_GROUPS;
SUM(IS_STALLED)
0
DESC INFORMATION_SCHEMA.THREAD_POOL_QUEUES;
Field Type Null Key Default Extra
GROUP_ID int(6) NO 0
POSITION int(6) NO 0
PRIORITY int(1) NO 0
CONNECTION_ID bigint(19) unsigned YES NULL
QUEUEING_TIME_MICROSECONDS bigint(19) NO 0
DESC INFORMATION_SCHEMA.THREAD_POOL_STATS;
Field Type Null Key Default Extra
GROUP_ID int(6) NO 0
......@@ -56,9 +49,12 @@ FLUSH THREAD_POOL_STATS;
SELECT SUM(DEQUEUES_BY_LISTENER+DEQUEUES_BY_WORKER) FROM INFORMATION_SCHEMA.THREAD_POOL_STATS;
SUM(DEQUEUES_BY_LISTENER+DEQUEUES_BY_WORKER)
1
SELECT SUM(POLLS_BY_LISTENER+POLLS_BY_WORKER) BETWEEN 2 AND 3 FROM INFORMATION_SCHEMA.THREAD_POOL_STATS;
SUM(POLLS_BY_LISTENER+POLLS_BY_WORKER) BETWEEN 2 AND 3
1
SELECT SUM(POLLS_BY_LISTENER) FROM INFORMATION_SCHEMA.THREAD_POOL_STATS;
SUM(POLLS_BY_LISTENER)
2
SELECT SUM(POLLS_BY_WORKER) FROM INFORMATION_SCHEMA.THREAD_POOL_STATS;
SUM(POLLS_BY_WORKER)
0
DESC INFORMATION_SCHEMA.THREAD_POOL_WAITS;
Field Type Null Key Default Extra
REASON varchar(16) NO
......@@ -87,3 +83,29 @@ SELECT COUNT FROM INFORMATION_SCHEMA.THREAD_POOL_WAITS WHERE REASON='Sleep';
COUNT
1
FLUSH THREAD_POOL_WAITS;
DESC INFORMATION_SCHEMA.THREAD_POOL_QUEUES;
Field Type Null Key Default Extra
GROUP_ID int(6) NO 0
POSITION int(6) NO 0
PRIORITY int(1) NO 0
CONNECTION_ID bigint(19) unsigned YES NULL
QUEUEING_TIME_MICROSECONDS bigint(19) NO 0
# restart: with restart_parameters
connect con1, localhost, root,,test;
connection con1;
connect con2, localhost, root,,test;
connection con2;
connect extra_con,127.0.0.1,root,,test,$extra_port,;
connection con1;
SELECT SLEEP(1000);
connection extra_con;
connection con2;
DO 1;
connection extra_con;
KILL QUERY con1_id;
disconnect extra_con;
connection con1;
disconnect con1;
connection con2;
disconnect con2;
connection default;
......@@ -15,9 +15,6 @@ SELECT SUM(ACTIVE_THREADS) > 0 FROM INFORMATION_SCHEMA.THREAD_POOL_GROUPS;
SELECT SUM(QUEUE_LENGTH) FROM INFORMATION_SCHEMA.THREAD_POOL_GROUPS;
SELECT SUM(IS_STALLED) FROM INFORMATION_SCHEMA.THREAD_POOL_GROUPS;
# I_S.THREAD_POOL_QUEUES
DESC INFORMATION_SCHEMA.THREAD_POOL_QUEUES;
#Todo - figure out how to populate queue with debug test
# I_S.THREAD_POOL_STATS
DESC INFORMATION_SCHEMA.THREAD_POOL_STATS;
......@@ -29,7 +26,8 @@ SELECT SUM(POLLS_BY_LISTENER+POLLS_BY_WORKER) > 0 FROM INFORMATION_SCHEMA.THREAD
--disable_ps_protocol
FLUSH THREAD_POOL_STATS;
SELECT SUM(DEQUEUES_BY_LISTENER+DEQUEUES_BY_WORKER) FROM INFORMATION_SCHEMA.THREAD_POOL_STATS;
SELECT SUM(POLLS_BY_LISTENER+POLLS_BY_WORKER) BETWEEN 2 AND 3 FROM INFORMATION_SCHEMA.THREAD_POOL_STATS;
SELECT SUM(POLLS_BY_LISTENER) FROM INFORMATION_SCHEMA.THREAD_POOL_STATS;
SELECT SUM(POLLS_BY_WORKER) FROM INFORMATION_SCHEMA.THREAD_POOL_STATS;
--enable_ps_protocol
#I_S.THREAD_POOL_WAITS
......@@ -39,3 +37,56 @@ SELECT COUNT FROM INFORMATION_SCHEMA.THREAD_POOL_WAITS WHERE REASON='Sleep';
SELECT SLEEP(0.01);
SELECT COUNT FROM INFORMATION_SCHEMA.THREAD_POOL_WAITS WHERE REASON='Sleep';
FLUSH THREAD_POOL_WAITS;
# I_S.THREAD_POOL_QUEUES
DESC INFORMATION_SCHEMA.THREAD_POOL_QUEUES;
let $extra_port=`select @@port+1`;
let $restart_parameters=--extra-port=$extra_port;
let $restart_noprint=1;
source include/restart_mysqld.inc;
connect (con1, localhost, root,,test);
connection con1;
let $con1_id=`SELECT CONNECTION_ID()`;
connect (con2, localhost, root,,test);
connection con2;
let $con2_id=`SELECT CONNECTION_ID()`;
connect(extra_con,127.0.0.1,root,,test,$extra_port,);
connection con1;
send SELECT SLEEP(1000);
connection extra_con;
let $wait_condition=
SELECT COUNT(*) > 0 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE STATE='User sleep' AND ID=$con1_id;
--source include/wait_condition.inc
connection con2;
send DO 1;
connection extra_con;
let $wait_condition=
SELECT COUNT(*) > 0 FROM INFORMATION_SCHEMA.THREAD_POOL_QUEUES
WHERE CONNECTION_ID IS NOT NULL;
--source include/wait_condition.inc
--replace_result $con1_id con1_id
eval KILL QUERY $con1_id;
disconnect extra_con;
connection con1;
error 0,ER_QUERY_INTERRUPTED;
reap;
disconnect con1;
connection con2;
reap;
disconnect con2;
connection default;
......@@ -139,3 +139,13 @@ ALTER TABLE t1 ADD f3 DATE NOT NULL, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
disconnect purge_control;
#
# MDEV-26458 SIGSEGV in innobase_table_is_empty() on ALTER TABLE
#
CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB;
ALTER TABLE t DISCARD TABLESPACE;
SET sql_mode='NO_ZERO_DATE';
ALTER TABLE t ADD c DATE NOT NULL;
SET sql_mode=DEFAULT;
DROP TABLE t;
# End of 10.3 tests
......@@ -103,3 +103,15 @@ INSERT INTO t1 VALUES (1, now());
ALTER TABLE t1 ADD f3 DATE NOT NULL, ALGORITHM=INPLACE;
DROP TABLE t1;
disconnect purge_control;
--echo #
--echo # MDEV-26458 SIGSEGV in innobase_table_is_empty() on ALTER TABLE
--echo #
CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB;
ALTER TABLE t DISCARD TABLESPACE;
SET sql_mode='NO_ZERO_DATE';
ALTER TABLE t ADD c DATE NOT NULL;
SET sql_mode=DEFAULT;
DROP TABLE t;
--echo # End of 10.3 tests
......@@ -44,6 +44,9 @@ IF(HAVE_PAM_APPL_H AND HAVE_GETGROUPLIST)
TARGET_LINK_LIBRARIES(auth_pam_tool pam)
INSTALL(CODE "EXECUTE_PROCESS(
COMMAND chmod u=rwx,g=,o= auth_pam_tool_dir
WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${INSTALL_PLUGINDIR}/)"
COMPONENT Server)
INSTALL(CODE "EXECUTE_PROCESS(
COMMAND chmod u=rwxs,g=rx,o=rx auth_pam_tool_dir/auth_pam_tool
WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${INSTALL_PLUGINDIR}/)"
COMPONENT Server)
......
#ifndef TABLE_INCLUDED
#define TABLE_INCLUDED
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2009, 2020, MariaDB
Copyright (c) 2009, 2021, MariaDB
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
......
......@@ -131,7 +131,10 @@ static int queues_fill_table(THD* thd, TABLE_LIST* tables, COND*)
table->field[2]->store(prio, true);
/* CONNECTION_ID */
if (c->thd)
{
table->field[3]->set_notnull();
table->field[3]->store(c->thd->thread_id, true);
}
/* QUEUEING_TIME */
table->field[4]->store(now - c->enqueue_time, true);
......
......@@ -1206,7 +1206,7 @@ TP_connection_generic *get_event(worker_thread_t *current_thread,
non-blocking event poll, i.e with timeout = 0.
If this returns events, pick one
*/
if (!oversubscribed)
if (!oversubscribed && !threadpool_dedicated_listener)
{
native_event ev[MAX_EVENTS];
int cnt = io_poll_wait(thread_group->pollfd, ev, MAX_EVENTS, 0);
......
......@@ -205,6 +205,8 @@ ATTRIBUTE_COLD static void btr_search_lazy_free(dict_index_t *index)
{
ut_ad(index->freed());
dict_table_t *table= index->table;
table->autoinc_mutex.wr_lock();
/* Perform the skipped steps of dict_index_remove_from_cache_low(). */
UT_LIST_REMOVE(table->freed_indexes, index);
index->lock.free();
......@@ -213,9 +215,14 @@ ATTRIBUTE_COLD static void btr_search_lazy_free(dict_index_t *index)
if (!UT_LIST_GET_LEN(table->freed_indexes) &&
!UT_LIST_GET_LEN(table->indexes))
{
ut_ad(table->id == 0);
ut_ad(!table->id);
table->autoinc_mutex.wr_unlock();
table->autoinc_mutex.destroy();
dict_mem_table_free(table);
return;
}
table->autoinc_mutex.wr_unlock();
}
/** Disable the adaptive hash search system and empty the index. */
......
......@@ -1338,6 +1338,7 @@ dict_index_t *dict_index_t::clone_if_needed()
return this;
dict_index_t *prev= UT_LIST_GET_PREV(indexes, this);
table->autoinc_mutex.wr_lock();
UT_LIST_REMOVE(table->indexes, this);
UT_LIST_ADD_LAST(table->freed_indexes, this);
dict_index_t *index= clone();
......@@ -1346,6 +1347,7 @@ dict_index_t *dict_index_t::clone_if_needed()
UT_LIST_INSERT_AFTER(table->indexes, prev, index);
else
UT_LIST_ADD_FIRST(table->indexes, index);
table->autoinc_mutex.wr_unlock();
return index;
}
#endif /* BTR_CUR_HASH_ADAPT */
......@@ -1958,27 +1960,34 @@ void dict_sys_t::remove(dict_table_t* table, bool lru, bool keep)
UT_DELETE(table->vc_templ);
}
table->autoinc_mutex.destroy();
table->lock_mutex_destroy();
if (keep) {
table->autoinc_mutex.destroy();
return;
}
#ifdef BTR_CUR_HASH_ADAPT
if (UNIV_UNLIKELY(UT_LIST_GET_LEN(table->freed_indexes) != 0)) {
if (table->fts) {
fts_optimize_remove_table(table);
fts_free(table);
table->fts = NULL;
}
if (table->fts) {
fts_optimize_remove_table(table);
fts_free(table);
table->fts = NULL;
}
table->autoinc_mutex.wr_lock();
table->vc_templ = NULL;
table->id = 0;
ulint freed = UT_LIST_GET_LEN(table->freed_indexes);
table->vc_templ = NULL;
table->id = 0;
table->autoinc_mutex.wr_unlock();
if (UNIV_UNLIKELY(freed != 0)) {
return;
}
#endif /* BTR_CUR_HASH_ADAPT */
table->autoinc_mutex.destroy();
dict_mem_table_free(table);
}
......@@ -2193,8 +2202,10 @@ dict_index_remove_from_cache_low(
zero. See also: dict_table_can_be_evicted() */
if (index->n_ahi_pages()) {
table->autoinc_mutex.wr_lock();
index->set_freed();
UT_LIST_ADD_LAST(table->freed_indexes, index);
table->autoinc_mutex.wr_unlock();
return;
}
#endif /* BTR_CUR_HASH_ADAPT */
......
......@@ -2205,6 +2205,7 @@ ha_innobase::check_if_supported_inplace_alter(
/* '0000-00-00' value isn't allowed for datetime datatype
for newly added column when table is not empty */
if (ha_alter_info->error_if_not_empty
&& m_prebuilt->table->space
&& !innobase_table_is_empty(m_prebuilt->table)) {
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
}
......
This diff is collapsed.
/*****************************************************************************
Copyright (c) 2007, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2014, 2020, MariaDB Corporation.
Copyright (c) 2014, 2021, MariaDB Corporation.
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
......@@ -88,14 +88,4 @@ do { \
} \
} while (0)
#if !defined __STRICT_ANSI__ && defined __GNUC__ && (__GNUC__) > 2 && !defined __INTEL_COMPILER && !defined __clang__
#ifdef HAVE_C99_INITIALIZERS
#define STRUCT_FLD(name, value) .name = value
#else
#define STRUCT_FLD(name, value) name: value
#endif /* HAVE_C99_INITIALIZERS */
#else
#define STRUCT_FLD(name, value) value
#endif
#endif /* i_s_h */
......@@ -2133,7 +2133,8 @@ struct dict_table_t {
UT_LIST_BASE_NODE_T(dict_index_t) indexes;
#ifdef BTR_CUR_HASH_ADAPT
/** List of detached indexes that are waiting to be freed along with
the last adaptive hash index entry */
the last adaptive hash index entry.
Protected by autoinc_mutex (sic!) */
UT_LIST_BASE_NODE_T(dict_index_t) freed_indexes;
#endif /* BTR_CUR_HASH_ADAPT */
......@@ -2285,7 +2286,7 @@ struct dict_table_t {
from a select. */
lock_t* autoinc_lock;
/** Mutex protecting autoinc. */
/** Mutex protecting autoinc and freed_indexes. */
srw_mutex autoinc_mutex;
private:
/** Mutex protecting locks on this table. */
......@@ -2334,7 +2335,6 @@ struct dict_table_t {
lock_sys.assert_locked(page_id) and trx->mutex_is_owner() hold.
@see trx_lock_t::trx_locks */
Atomic_counter<uint32_t> n_rec_locks;
private:
/** Count of how many handles are opened to this table. Dropping of the
table is NOT allowed until this count gets to zero. MySQL does NOT
......
......@@ -125,11 +125,6 @@ ENDIF()
CHECK_FUNCTION_EXISTS(vasprintf HAVE_VASPRINTF)
CHECK_CXX_SOURCE_COMPILES("struct t1{ int a; char *b; }; struct t1 c= { .a=1, .b=0 }; main() { }" HAVE_C99_INITIALIZERS)
IF(HAVE_C99_INITIALIZERS)
ADD_DEFINITIONS(-DHAVE_C99_INITIALIZERS)
ENDIF()
OPTION(WITH_INNODB_DISALLOW_WRITES "InnoDB freeze writes patch from Google" ${WITH_WSREP})
IF (WITH_INNODB_DISALLOW_WRITES)
ADD_DEFINITIONS(-DWITH_INNODB_DISALLOW_WRITES)
......
......@@ -215,8 +215,7 @@ set(MYSQL_INCLUDE_DIRS
"${MYSQL_REGEX_INCLUDE_DIR}"
"${MYSQL_RAPIDJSON_INCLUDE_DIR}"
"${MYSQL_LIBBINLOGEVENTS_EXPORT_DIR}"
"${MYSQL_LIBBINLOGEVENTS_INCLUDE_DIR}"
"${MYSQL_SOURCE_DIR}")
"${MYSQL_LIBBINLOGEVENTS_INCLUDE_DIR}")
if(MRN_BUNDLED)
set(MYSQL_PLUGIN_DIR "${INSTALL_PLUGINDIR}")
......
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