Skip to content

Commit

Permalink
Merge 10.5 into 10.6
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Aug 23, 2021
2 parents 75c641d + 2c9f2a4 commit 49f95c4
Show file tree
Hide file tree
Showing 21 changed files with 565 additions and 474 deletions.
9 changes: 6 additions & 3 deletions debian/autobake-deb.sh
Expand Up @@ -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
Expand Down
9 changes: 3 additions & 6 deletions debian/mariadb-server-10.6.postinst
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
9 changes: 0 additions & 9 deletions debian/rules
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions extra/mariabackup/backup_mysql.cc
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/main/thread_pool_info.opt
@@ -1 +1 @@
--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-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
42 changes: 32 additions & 10 deletions mysql-test/main/thread_pool_info.result
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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;
59 changes: 55 additions & 4 deletions mysql-test/main/thread_pool_info.test
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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;
10 changes: 10 additions & 0 deletions mysql-test/suite/innodb/r/innodb-alter-timestamp.result
Expand Up @@ -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
12 changes: 12 additions & 0 deletions mysql-test/suite/innodb/t/innodb-alter-timestamp.test
Expand Up @@ -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
3 changes: 3 additions & 0 deletions plugin/auth_pam/CMakeLists.txt
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion sql/table.h
@@ -1,7 +1,7 @@
#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
Expand Down
3 changes: 3 additions & 0 deletions sql/thread_pool_info.cc
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion sql/threadpool_generic.cc
Expand Up @@ -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);
Expand Down
9 changes: 8 additions & 1 deletion storage/innobase/btr/btr0sea.cc
Expand Up @@ -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();
Expand All @@ -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. */
Expand Down
29 changes: 20 additions & 9 deletions storage/innobase/dict/dict0dict.cc
Expand Up @@ -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();
Expand All @@ -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 */
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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 */
Expand Down
1 change: 1 addition & 0 deletions storage/innobase/handler/handler0alter.cc
Expand Up @@ -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);
}
Expand Down

0 comments on commit 49f95c4

Please sign in to comment.