Commit 2b66cd24 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.3 into 10.4

parents 1002703b cfbdb5d2
...@@ -84,7 +84,7 @@ EOF ...@@ -84,7 +84,7 @@ EOF
if [ ! -d "$mysql_datadir" -a ! -L "$mysql_datadir" ]; then mkdir "$mysql_datadir" ; fi if [ ! -d "$mysql_datadir" -a ! -L "$mysql_datadir" ]; then mkdir "$mysql_datadir" ; fi
if [ ! -d "$mysql_logdir" -a ! -L "$mysql_logdir" ]; then mkdir "$mysql_logdir" ; fi if [ ! -d "$mysql_logdir" -a ! -L "$mysql_logdir" ]; then mkdir "$mysql_logdir" ; fi
# When creating an ext3 jounal on an already mounted filesystem like e.g. # 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 # The mysql_statedir must not be writable by the mysql user under any
# circumstances as it contains scripts that are executed by root. # circumstances as it contains scripts that are executed by root.
set +e set +e
...@@ -119,9 +119,6 @@ EOF ...@@ -119,9 +119,6 @@ EOF
$ERR_LOGGER $ERR_LOGGER
set -e set -e
# To avoid downgrades.
touch $mysql_statedir/debian-$MAJOR_VER.flag
# On new installations root user can connect via unix_socket. # On new installations root user can connect via unix_socket.
# But on upgrades, scripts rely on debian-sys-maint user and # But on upgrades, scripts rely on debian-sys-maint user and
# credentials in /etc/mysql/debian.cnf # credentials in /etc/mysql/debian.cnf
...@@ -177,7 +174,7 @@ EOF ...@@ -177,7 +174,7 @@ EOF
;; ;;
esac 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/mysql. # dh_systemd_start doesn't emit anything since we still ship /etc/init.d/mysql.
# Thus MariaDB server is started via init.d script, which in turn redirects to # Thus MariaDB server is started via init.d script, which in turn redirects to
......
...@@ -139,3 +139,15 @@ ALTER TABLE t1 ADD f3 DATE NOT NULL, ALGORITHM=INPLACE; ...@@ -139,3 +139,15 @@ ALTER TABLE t1 ADD f3 DATE NOT NULL, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1; DROP TABLE t1;
disconnect purge_control; 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;
Warnings:
Warning 1814 Tablespace has been discarded for table `t`
SET sql_mode=DEFAULT;
DROP TABLE t;
# End of 10.3 tests
...@@ -103,3 +103,15 @@ INSERT INTO t1 VALUES (1, now()); ...@@ -103,3 +103,15 @@ INSERT INTO t1 VALUES (1, now());
ALTER TABLE t1 ADD f3 DATE NOT NULL, ALGORITHM=INPLACE; ALTER TABLE t1 ADD f3 DATE NOT NULL, ALGORITHM=INPLACE;
DROP TABLE t1; DROP TABLE t1;
disconnect purge_control; 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
/* Copyright (c) 2004, 2013, Oracle and/or its affiliates. /* 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 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 it under the terms of the GNU General Public License as published by
......
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. /* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2008, 2020, MariaDB Copyright (c) 2008, 2021, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
......
#ifndef TABLE_INCLUDED #ifndef TABLE_INCLUDED
#define TABLE_INCLUDED #define TABLE_INCLUDED
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. /* 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 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 it under the terms of the GNU General Public License as published by
......
...@@ -301,6 +301,8 @@ ATTRIBUTE_COLD static void btr_search_lazy_free(dict_index_t *index) ...@@ -301,6 +301,8 @@ ATTRIBUTE_COLD static void btr_search_lazy_free(dict_index_t *index)
{ {
ut_ad(index->freed()); ut_ad(index->freed());
dict_table_t *table= index->table; dict_table_t *table= index->table;
table->autoinc_mutex.lock();
/* Perform the skipped steps of dict_index_remove_from_cache_low(). */ /* Perform the skipped steps of dict_index_remove_from_cache_low(). */
UT_LIST_REMOVE(table->freed_indexes, index); UT_LIST_REMOVE(table->freed_indexes, index);
rw_lock_free(&index->lock); rw_lock_free(&index->lock);
...@@ -309,9 +311,14 @@ ATTRIBUTE_COLD static void btr_search_lazy_free(dict_index_t *index) ...@@ -309,9 +311,14 @@ ATTRIBUTE_COLD static void btr_search_lazy_free(dict_index_t *index)
if (!UT_LIST_GET_LEN(table->freed_indexes) && if (!UT_LIST_GET_LEN(table->freed_indexes) &&
!UT_LIST_GET_LEN(table->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); dict_mem_table_free(table);
return;
} }
table->autoinc_mutex.unlock();
} }
/** Clear the adaptive hash index on all pages in the buffer pool. */ /** Clear the adaptive hash index on all pages in the buffer pool. */
......
...@@ -1127,6 +1127,7 @@ dict_index_t *dict_index_t::clone_if_needed() ...@@ -1127,6 +1127,7 @@ dict_index_t *dict_index_t::clone_if_needed()
return this; return this;
dict_index_t *prev= UT_LIST_GET_PREV(indexes, this); dict_index_t *prev= UT_LIST_GET_PREV(indexes, this);
table->autoinc_mutex.lock();
UT_LIST_REMOVE(table->indexes, this); UT_LIST_REMOVE(table->indexes, this);
UT_LIST_ADD_LAST(table->freed_indexes, this); UT_LIST_ADD_LAST(table->freed_indexes, this);
dict_index_t *index= clone(); dict_index_t *index= clone();
...@@ -1135,6 +1136,7 @@ dict_index_t *dict_index_t::clone_if_needed() ...@@ -1135,6 +1136,7 @@ dict_index_t *dict_index_t::clone_if_needed()
UT_LIST_INSERT_AFTER(table->indexes, prev, index); UT_LIST_INSERT_AFTER(table->indexes, prev, index);
else else
UT_LIST_ADD_FIRST(table->indexes, index); UT_LIST_ADD_FIRST(table->indexes, index);
table->autoinc_mutex.unlock();
return index; return index;
} }
#endif /* BTR_CUR_HASH_ADAPT */ #endif /* BTR_CUR_HASH_ADAPT */
...@@ -1777,26 +1779,32 @@ void dict_sys_t::remove(dict_table_t* table, bool lru, bool keep) ...@@ -1777,26 +1779,32 @@ void dict_sys_t::remove(dict_table_t* table, bool lru, bool keep)
UT_DELETE(table->vc_templ); UT_DELETE(table->vc_templ);
} }
table->autoinc_mutex.~mutex();
if (keep) { if (keep) {
table->autoinc_mutex.~mutex();
return; return;
} }
#ifdef BTR_CUR_HASH_ADAPT #ifdef BTR_CUR_HASH_ADAPT
if (UNIV_UNLIKELY(UT_LIST_GET_LEN(table->freed_indexes) != 0)) {
if (table->fts) { if (table->fts) {
fts_optimize_remove_table(table); fts_optimize_remove_table(table);
fts_free(table); fts_free(table);
table->fts = NULL; table->fts = NULL;
} }
table->autoinc_mutex.lock();
ulint freed = UT_LIST_GET_LEN(table->freed_indexes);
table->vc_templ = NULL; table->vc_templ = NULL;
table->id = 0; table->id = 0;
table->autoinc_mutex.unlock();
if (UNIV_UNLIKELY(freed != 0)) {
return; return;
} }
#endif /* BTR_CUR_HASH_ADAPT */ #endif /* BTR_CUR_HASH_ADAPT */
table->autoinc_mutex.~mutex();
dict_mem_table_free(table); dict_mem_table_free(table);
} }
...@@ -2015,8 +2023,10 @@ dict_index_remove_from_cache_low( ...@@ -2015,8 +2023,10 @@ dict_index_remove_from_cache_low(
zero. See also: dict_table_can_be_evicted() */ zero. See also: dict_table_can_be_evicted() */
if (index->n_ahi_pages()) { if (index->n_ahi_pages()) {
table->autoinc_mutex.lock();
index->set_freed(); index->set_freed();
UT_LIST_ADD_LAST(table->freed_indexes, index); UT_LIST_ADD_LAST(table->freed_indexes, index);
table->autoinc_mutex.unlock();
return; return;
} }
#endif /* BTR_CUR_HASH_ADAPT */ #endif /* BTR_CUR_HASH_ADAPT */
......
...@@ -2231,6 +2231,7 @@ ha_innobase::check_if_supported_inplace_alter( ...@@ -2231,6 +2231,7 @@ ha_innobase::check_if_supported_inplace_alter(
/* '0000-00-00' value isn't allowed for datetime datatype /* '0000-00-00' value isn't allowed for datetime datatype
for newly added column when table is not empty */ for newly added column when table is not empty */
if (ha_alter_info->error_if_not_empty if (ha_alter_info->error_if_not_empty
&& m_prebuilt->table->space
&& !innobase_table_is_empty(m_prebuilt->table)) { && !innobase_table_is_empty(m_prebuilt->table)) {
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
} }
......
This diff is collapsed.
...@@ -92,26 +92,9 @@ do { \ ...@@ -92,26 +92,9 @@ do { \
} \ } \
} while (0) } 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
/* Don't use a static const variable here, as some C++ compilers (notably /* Don't use a static const variable here, as some C++ compilers (notably
HPUX aCC: HP ANSI C++ B3910B A.03.65) can't handle it. */ HPUX aCC: HP ANSI C++ B3910B A.03.65) can't handle it. */
#define END_OF_ST_FIELD_INFO \ #define END_OF_ST_FIELD_INFO {NULL,0,MYSQL_TYPE_NULL,0,0,"",SKIP_OPEN_TABLE}
{STRUCT_FLD(field_name, NULL), \
STRUCT_FLD(field_length, 0), \
STRUCT_FLD(field_type, MYSQL_TYPE_NULL), \
STRUCT_FLD(value, 0), \
STRUCT_FLD(field_flags, 0), \
STRUCT_FLD(old_name, ""), \
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}
/** Fields on INFORMATION_SCHEMA.SYS_SEMAMPHORE_WAITS table */ /** Fields on INFORMATION_SCHEMA.SYS_SEMAMPHORE_WAITS table */
#define SYS_SEMAPHORE_WAITS_THREAD_ID 0 #define SYS_SEMAPHORE_WAITS_THREAD_ID 0
......
...@@ -2110,7 +2110,8 @@ struct dict_table_t { ...@@ -2110,7 +2110,8 @@ struct dict_table_t {
UT_LIST_BASE_NODE_T(dict_index_t) indexes; UT_LIST_BASE_NODE_T(dict_index_t) indexes;
#ifdef BTR_CUR_HASH_ADAPT #ifdef BTR_CUR_HASH_ADAPT
/** List of detached indexes that are waiting to be freed along with /** 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; UT_LIST_BASE_NODE_T(dict_index_t) freed_indexes;
#endif /* BTR_CUR_HASH_ADAPT */ #endif /* BTR_CUR_HASH_ADAPT */
...@@ -2277,7 +2278,7 @@ struct dict_table_t { ...@@ -2277,7 +2278,7 @@ struct dict_table_t {
from a select. */ from a select. */
lock_t* autoinc_lock; lock_t* autoinc_lock;
/** Mutex protecting the autoincrement counter. */ /** Mutex protecting the autoinc counter and freed_indexes. */
std::mutex autoinc_mutex; std::mutex autoinc_mutex;
/** Autoinc counter value to give to the next inserted row. */ /** Autoinc counter value to give to the next inserted row. */
...@@ -2309,7 +2310,6 @@ struct dict_table_t { ...@@ -2309,7 +2310,6 @@ struct dict_table_t {
determine whether we can evict the table from the dictionary cache. determine whether we can evict the table from the dictionary cache.
It is protected by lock_sys.mutex. */ It is protected by lock_sys.mutex. */
ulint n_rec_locks; ulint n_rec_locks;
private: private:
/** Count of how many handles are opened to this table. Dropping of the /** 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 table is NOT allowed until this count gets to zero. MySQL does NOT
......
...@@ -197,11 +197,6 @@ ENDIF(NOT MSVC) ...@@ -197,11 +197,6 @@ ENDIF(NOT MSVC)
CHECK_FUNCTION_EXISTS(vasprintf HAVE_VASPRINTF) 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()
SET(MUTEXTYPE "event" CACHE STRING "Mutex type: event, sys or futex") SET(MUTEXTYPE "event" CACHE STRING "Mutex type: event, sys or futex")
IF(MUTEXTYPE MATCHES "event") IF(MUTEXTYPE MATCHES "event")
......
...@@ -219,8 +219,7 @@ set(MYSQL_INCLUDE_DIRS ...@@ -219,8 +219,7 @@ set(MYSQL_INCLUDE_DIRS
"${MYSQL_REGEX_INCLUDE_DIR}" "${MYSQL_REGEX_INCLUDE_DIR}"
"${MYSQL_RAPIDJSON_INCLUDE_DIR}" "${MYSQL_RAPIDJSON_INCLUDE_DIR}"
"${MYSQL_LIBBINLOGEVENTS_EXPORT_DIR}" "${MYSQL_LIBBINLOGEVENTS_EXPORT_DIR}"
"${MYSQL_LIBBINLOGEVENTS_INCLUDE_DIR}" "${MYSQL_LIBBINLOGEVENTS_INCLUDE_DIR}")
"${MYSQL_SOURCE_DIR}")
if(MRN_BUNDLED) if(MRN_BUNDLED)
set(MYSQL_PLUGIN_DIR "${INSTALL_PLUGINDIR}") 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