Skip to content

Commit

Permalink
Merge 10.4 into 10.5
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Aug 23, 2021
2 parents a662186 + 2b66cd2 commit 2c9f2a4
Show file tree
Hide file tree
Showing 14 changed files with 507 additions and 498 deletions.
9 changes: 3 additions & 6 deletions debian/mariadb-server-10.5.postinst
Original file line number Diff line number Diff line change
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.5.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
2 changes: 0 additions & 2 deletions extra/mariabackup/backup_mysql.cc
Original file line number Diff line number Diff line change
Expand Up @@ -924,8 +924,6 @@ bool lock_tables(MYSQL *connection)
}

xb_mysql_query(connection, "BACKUP STAGE START", true);
// 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);
/* Set the maximum supported session value for
lock_wait_timeout to prevent unnecessary timeouts when the
Expand Down
10 changes: 10 additions & 0 deletions mysql-test/suite/innodb/r/innodb-alter-timestamp.result
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
2 changes: 1 addition & 1 deletion sql/sql_view.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Copyright (c) 2004, 2013, Oracle and/or its affiliates.
Copyright (c) 2011, 2016, MariaDB Corporation
Copyright (c) 2011, 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
Expand Down
2 changes: 1 addition & 1 deletion sql/table.h
Original file line number Diff line number Diff line change
@@ -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
9 changes: 8 additions & 1 deletion storage/innobase/btr/btr0sea.cc
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,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.lock();

/* Perform the skipped steps of dict_index_remove_from_cache_low(). */
UT_LIST_REMOVE(table->freed_indexes, index);
rw_lock_free(&index->lock);
Expand All @@ -209,9 +211,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.unlock();
table->autoinc_mutex.~mutex();
dict_mem_table_free(table);
return;
}

table->autoinc_mutex.unlock();
}

/** Disable the adaptive hash search system and empty the index. */
Expand Down
30 changes: 20 additions & 10 deletions storage/innobase/dict/dict0dict.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1329,6 +1329,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.lock();
UT_LIST_REMOVE(table->indexes, this);
UT_LIST_ADD_LAST(table->freed_indexes, this);
dict_index_t *index= clone();
Expand All @@ -1337,6 +1338,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.unlock();
return index;
}
#endif /* BTR_CUR_HASH_ADAPT */
Expand Down Expand Up @@ -1979,26 +1981,32 @@ void dict_sys_t::remove(dict_table_t* table, bool lru, bool keep)
UT_DELETE(table->vc_templ);
}

table->autoinc_mutex.~mutex();

if (keep) {
table->autoinc_mutex.~mutex();
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->vc_templ = NULL;
table->id = 0;
table->autoinc_mutex.lock();

ulint freed = UT_LIST_GET_LEN(table->freed_indexes);

table->vc_templ = NULL;
table->id = 0;
table->autoinc_mutex.unlock();

if (UNIV_UNLIKELY(freed != 0)) {
return;
}
#endif /* BTR_CUR_HASH_ADAPT */

table->autoinc_mutex.~mutex();
dict_mem_table_free(table);
}

Expand Down Expand Up @@ -2217,8 +2225,10 @@ dict_index_remove_from_cache_low(
zero. See also: dict_table_can_be_evicted() */

if (index->n_ahi_pages()) {
table->autoinc_mutex.lock();
index->set_freed();
UT_LIST_ADD_LAST(table->freed_indexes, index);
table->autoinc_mutex.unlock();
return;
}
#endif /* BTR_CUR_HASH_ADAPT */
Expand Down
1 change: 1 addition & 0 deletions storage/innobase/handler/handler0alter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2192,6 +2192,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
Loading

0 comments on commit 2c9f2a4

Please sign in to comment.