Skip to content

Commit 2c9f2a4

Browse files
committed
Merge 10.4 into 10.5
2 parents a662186 + 2b66cd2 commit 2c9f2a4

File tree

14 files changed

+507
-498
lines changed

14 files changed

+507
-498
lines changed

debian/mariadb-server-10.5.postinst

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ EOF
124124
if [ ! -d "$mysql_datadir" ] && [ ! -L "$mysql_datadir" ]; then mkdir -Z "$mysql_datadir" ; fi
125125
if [ ! -d "$mysql_logdir" ] && [ ! -L "$mysql_logdir" ]; then mkdir -Z "$mysql_logdir" ; fi
126126
# When creating an ext3 jounal on an already mounted filesystem like e.g.
127-
# /var/lib/mysql, you get a .journal file that is not modifyable by chown.
127+
# /var/lib/mysql, you get a .journal file that is not modifiable by chown.
128128
# The mysql_statedir must not be writable by the mysql user under any
129129
# circumstances as it contains scripts that are executed by root.
130130
set +e
@@ -161,7 +161,7 @@ EOF
161161
# Clean up old flags before setting new one
162162
rm -f $mysql_datadir/debian-*.flag
163163
# Flag data dir to avoid downgrades
164-
touch "$mysql_datadir/debian-$MAJOR_VER.flag"
164+
touch $mysql_datadir/debian-10.5.flag
165165

166166
# initiate databases. Output is not allowed by debconf :-(
167167
# This will fail if we are upgrading an existing database; in this case
@@ -175,9 +175,6 @@ EOF
175175
$ERR_LOGGER
176176
set -e
177177

178-
# To avoid downgrades.
179-
touch "$mysql_statedir/debian-$MAJOR_VER.flag"
180-
181178
# On new installations root user can connect via unix_socket.
182179
# But on upgrades, scripts rely on debian-sys-maint user and
183180
# credentials in /etc/mysql/debian.cnf
@@ -251,7 +248,7 @@ EOF
251248
;;
252249
esac
253250

254-
db_stop # in case invoke failes
251+
db_stop # in case invoke fails
255252

256253
# dh_systemd_start doesn't emit anything since we still ship /etc/init.d/mariadb.
257254
# Thus MariaDB server is started via init.d script, which in turn redirects to

extra/mariabackup/backup_mysql.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -924,8 +924,6 @@ bool lock_tables(MYSQL *connection)
924924
}
925925

926926
xb_mysql_query(connection, "BACKUP STAGE START", true);
927-
// xb_mysql_query(connection, "BACKUP STAGE FLUSH", true);
928-
// xb_mysql_query(connection, "BACKUP STAGE BLOCK_DDL", true);
929927
xb_mysql_query(connection, "BACKUP STAGE BLOCK_COMMIT", true);
930928
/* Set the maximum supported session value for
931929
lock_wait_timeout to prevent unnecessary timeouts when the

mysql-test/suite/innodb/r/innodb-alter-timestamp.result

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,13 @@ ALTER TABLE t1 ADD f3 DATE NOT NULL, ALGORITHM=INPLACE;
139139
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
140140
DROP TABLE t1;
141141
disconnect purge_control;
142+
#
143+
# MDEV-26458 SIGSEGV in innobase_table_is_empty() on ALTER TABLE
144+
#
145+
CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB;
146+
ALTER TABLE t DISCARD TABLESPACE;
147+
SET sql_mode='NO_ZERO_DATE';
148+
ALTER TABLE t ADD c DATE NOT NULL;
149+
SET sql_mode=DEFAULT;
150+
DROP TABLE t;
151+
# End of 10.3 tests

mysql-test/suite/innodb/t/innodb-alter-timestamp.test

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,15 @@ INSERT INTO t1 VALUES (1, now());
103103
ALTER TABLE t1 ADD f3 DATE NOT NULL, ALGORITHM=INPLACE;
104104
DROP TABLE t1;
105105
disconnect purge_control;
106+
107+
--echo #
108+
--echo # MDEV-26458 SIGSEGV in innobase_table_is_empty() on ALTER TABLE
109+
--echo #
110+
CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB;
111+
ALTER TABLE t DISCARD TABLESPACE;
112+
SET sql_mode='NO_ZERO_DATE';
113+
ALTER TABLE t ADD c DATE NOT NULL;
114+
SET sql_mode=DEFAULT;
115+
DROP TABLE t;
116+
117+
--echo # End of 10.3 tests

sql/sql_view.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Copyright (c) 2004, 2013, Oracle and/or its affiliates.
2-
Copyright (c) 2011, 2016, MariaDB Corporation
2+
Copyright (c) 2011, 2021, MariaDB Corporation.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by

sql/table.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef TABLE_INCLUDED
22
#define TABLE_INCLUDED
33
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
4-
Copyright (c) 2009, 2020, MariaDB
4+
Copyright (c) 2009, 2021, MariaDB
55
66
This program is free software; you can redistribute it and/or modify
77
it under the terms of the GNU General Public License as published by

storage/innobase/btr/btr0sea.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ ATTRIBUTE_COLD static void btr_search_lazy_free(dict_index_t *index)
201201
{
202202
ut_ad(index->freed());
203203
dict_table_t *table= index->table;
204+
table->autoinc_mutex.lock();
205+
204206
/* Perform the skipped steps of dict_index_remove_from_cache_low(). */
205207
UT_LIST_REMOVE(table->freed_indexes, index);
206208
rw_lock_free(&index->lock);
@@ -209,9 +211,14 @@ ATTRIBUTE_COLD static void btr_search_lazy_free(dict_index_t *index)
209211
if (!UT_LIST_GET_LEN(table->freed_indexes) &&
210212
!UT_LIST_GET_LEN(table->indexes))
211213
{
212-
ut_ad(table->id == 0);
214+
ut_ad(!table->id);
215+
table->autoinc_mutex.unlock();
216+
table->autoinc_mutex.~mutex();
213217
dict_mem_table_free(table);
218+
return;
214219
}
220+
221+
table->autoinc_mutex.unlock();
215222
}
216223

217224
/** Disable the adaptive hash search system and empty the index. */

storage/innobase/dict/dict0dict.cc

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,6 +1329,7 @@ dict_index_t *dict_index_t::clone_if_needed()
13291329
return this;
13301330
dict_index_t *prev= UT_LIST_GET_PREV(indexes, this);
13311331

1332+
table->autoinc_mutex.lock();
13321333
UT_LIST_REMOVE(table->indexes, this);
13331334
UT_LIST_ADD_LAST(table->freed_indexes, this);
13341335
dict_index_t *index= clone();
@@ -1337,6 +1338,7 @@ dict_index_t *dict_index_t::clone_if_needed()
13371338
UT_LIST_INSERT_AFTER(table->indexes, prev, index);
13381339
else
13391340
UT_LIST_ADD_FIRST(table->indexes, index);
1341+
table->autoinc_mutex.unlock();
13401342
return index;
13411343
}
13421344
#endif /* BTR_CUR_HASH_ADAPT */
@@ -1979,26 +1981,32 @@ void dict_sys_t::remove(dict_table_t* table, bool lru, bool keep)
19791981
UT_DELETE(table->vc_templ);
19801982
}
19811983

1982-
table->autoinc_mutex.~mutex();
1983-
19841984
if (keep) {
1985+
table->autoinc_mutex.~mutex();
19851986
return;
19861987
}
19871988

19881989
#ifdef BTR_CUR_HASH_ADAPT
1989-
if (UNIV_UNLIKELY(UT_LIST_GET_LEN(table->freed_indexes) != 0)) {
1990-
if (table->fts) {
1991-
fts_optimize_remove_table(table);
1992-
fts_free(table);
1993-
table->fts = NULL;
1994-
}
1990+
if (table->fts) {
1991+
fts_optimize_remove_table(table);
1992+
fts_free(table);
1993+
table->fts = NULL;
1994+
}
19951995

1996-
table->vc_templ = NULL;
1997-
table->id = 0;
1996+
table->autoinc_mutex.lock();
1997+
1998+
ulint freed = UT_LIST_GET_LEN(table->freed_indexes);
1999+
2000+
table->vc_templ = NULL;
2001+
table->id = 0;
2002+
table->autoinc_mutex.unlock();
2003+
2004+
if (UNIV_UNLIKELY(freed != 0)) {
19982005
return;
19992006
}
20002007
#endif /* BTR_CUR_HASH_ADAPT */
20012008

2009+
table->autoinc_mutex.~mutex();
20022010
dict_mem_table_free(table);
20032011
}
20042012

@@ -2217,8 +2225,10 @@ dict_index_remove_from_cache_low(
22172225
zero. See also: dict_table_can_be_evicted() */
22182226

22192227
if (index->n_ahi_pages()) {
2228+
table->autoinc_mutex.lock();
22202229
index->set_freed();
22212230
UT_LIST_ADD_LAST(table->freed_indexes, index);
2231+
table->autoinc_mutex.unlock();
22222232
return;
22232233
}
22242234
#endif /* BTR_CUR_HASH_ADAPT */

storage/innobase/handler/handler0alter.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2192,6 +2192,7 @@ ha_innobase::check_if_supported_inplace_alter(
21922192
/* '0000-00-00' value isn't allowed for datetime datatype
21932193
for newly added column when table is not empty */
21942194
if (ha_alter_info->error_if_not_empty
2195+
&& m_prebuilt->table->space
21952196
&& !innobase_table_is_empty(m_prebuilt->table)) {
21962197
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
21972198
}

0 commit comments

Comments
 (0)