Commit dcc83816 authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

Merge branch '10.3' into bb-10.3-merge

parents b953d70d 4e7ee166
......@@ -128,6 +128,8 @@ scripts/wsrep_sst_mysqldump
scripts/wsrep_sst_rsync
scripts/wsrep_sst_rsync_wan
scripts/wsrep_sst_mariabackup
scripts/wsrep_sst_xtrabackup
scripts/wsrep_sst_xtrabackup-v2
scripts/maria_add_gis_sp.sql
scripts/maria_add_gis_sp_bootstrap.sql
scripts/galera_new_cluster
......
......@@ -122,7 +122,8 @@ get_make_parallel_flag
# SSL library to use.--with-ssl will select our bundled yaSSL
# implementation of SSL. --with-ssl=yes will first try system library
# then the boundled one --with-ssl=system will use the system library.
SSL_LIBRARY=--with-ssl=system
# We use bundled by default as this is guaranteed to work with Galera
SSL_LIBRARY=--with-ssl
if [ "x$warning_mode" = "xpedantic" ]; then
warnings="-W -Wall -ansi -pedantic -Wno-long-long -Wno-unused -D_POSIX_SOURCE"
......@@ -194,6 +195,8 @@ base_configs="$base_configs --with-extra-charsets=complex "
base_configs="$base_configs --enable-thread-safe-client "
base_configs="$base_configs --with-big-tables $maintainer_mode"
base_configs="$base_configs --with-plugin-aria --with-aria-tmp-tables"
# Following is to get tokudb to work
base_configs="$base_configs --with-jemalloc=NO"
if test -d "$path/../cmd-line-utils/readline"
then
......
......@@ -145,6 +145,11 @@ foreach my $option (@ARGV)
$cmakeargs = $cmakeargs." -DPLUGIN_".uc($1)."=".uc($2);
next;
}
if($option =~ /without-wsrep/)
{
$cmakeargs = $cmakeargs." -DWITH_WSREP=OFF";
next;
}
if($option =~ /with-zlib-dir=bundled/)
{
$cmakeargs = $cmakeargs." -DWITH_ZLIB=bundled";
......@@ -185,6 +190,16 @@ foreach my $option (@ARGV)
$cmakeargs = $cmakeargs." -DCMAKE_BUILD_TYPE=Debug -DSECURITY_HARDENED=OFF";
next;
}
if($option =~ /with-(.*)=(.*)/)
{
$cmakeargs = $cmakeargs. " -DWITH_" . uc($1) . "=" . uc($2);
next;
}
if($option =~ /without-(.*)=(.*)/)
{
$cmakeargs = $cmakeargs. " -DWITHOUT_" . uc($1) . "=" . uc($2);
next;
}
if($option =~ /prefix=/)
{
$cmake_install_prefix= substr($option, 7);
......
set default_storage_engine=innodb;
#
# MDEV-18295 IMPORT TABLESPACE fails with instant-altered tables
#
create table t2 (x int, z int default 41);
alter table t2 discard tablespace;
create table t1 (x int);
insert into t1 values (1);
alter table t1 add z int default 42, algorithm instant;
select * from t1;
x z
1 42
flush tables t1 for export;
unlock tables;
# The metadata has to be updated to instant ADD COLUMN.
alter table t2 import tablespace;
select * from t2;
x z
1 42
insert into t2 set x=2;
select * from t2;
x z
1 42
2 41
alter table t1 discard tablespace;
flush tables t2 for export;
unlock tables;
# Both the metadata and the data file used instant ADD COLUMN.
alter table t1 import tablespace;
select * from t1;
x z
1 42
2 41
drop table t2;
create table t2 select * from t1;
alter table t1 discard tablespace;
flush tables t2 for export;
unlock tables;
# The instant ADD COLUMN has to be removed from the metadata.
alter table t1 import tablespace;
select * from t1;
x z
1 42
2 41
drop table t2;
drop table t1;
--source include/have_innodb.inc
set default_storage_engine=innodb;
--echo #
--echo # MDEV-18295 IMPORT TABLESPACE fails with instant-altered tables
--echo #
create table t2 (x int, z int default 41);
alter table t2 discard tablespace;
create table t1 (x int);
insert into t1 values (1);
alter table t1 add z int default 42, algorithm instant;
select * from t1;
flush tables t1 for export;
--let $MYSQLD_DATADIR= `select @@datadir`
--move_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_DATADIR/test/t2.cfg
--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t2.ibd
unlock tables;
--echo # The metadata has to be updated to instant ADD COLUMN.
alter table t2 import tablespace;
select * from t2;
insert into t2 set x=2;
select * from t2;
alter table t1 discard tablespace;
flush tables t2 for export;
--move_file $MYSQLD_DATADIR/test/t2.cfg $MYSQLD_DATADIR/test/t1.cfg
--copy_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t1.ibd
unlock tables;
--echo # Both the metadata and the data file used instant ADD COLUMN.
alter table t1 import tablespace;
select * from t1;
drop table t2;
create table t2 select * from t1;
alter table t1 discard tablespace;
flush tables t2 for export;
--move_file $MYSQLD_DATADIR/test/t2.cfg $MYSQLD_DATADIR/test/t1.cfg
--copy_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t1.ibd
unlock tables;
--echo # The instant ADD COLUMN has to be removed from the metadata.
alter table t1 import tablespace;
select * from t1;
drop table t2;
drop table t1;
......@@ -171,10 +171,7 @@ int my_fclose(FILE *fd, myf MyFlags)
my_file_info[file].type= UNOPEN;
}
#ifndef _WIN32
do
{
err= fclose(fd);
} while (err == -1 && errno == EINTR);
err= fclose(fd);
#else
err= my_win_fclose(fd);
#endif
......
......@@ -7,7 +7,7 @@ PLUGIN_AUTHOR Sergey Vojtovich
PLUGIN_DESCRIPTION User-defined variables
PLUGIN_LICENSE GPL
LOAD_OPTION ON
PLUGIN_MATURITY Gamma
PLUGIN_MATURITY Stable
SHOW CREATE TABLE INFORMATION_SCHEMA.USER_VARIABLES;
Table Create Table
user_variables CREATE TEMPORARY TABLE `user_variables` (
......
......@@ -135,6 +135,6 @@ maria_declare_plugin(user_variables)
NULL,
NULL,
"1.0",
MariaDB_PLUGIN_MATURITY_GAMMA
MariaDB_PLUGIN_MATURITY_STABLE
}
maria_declare_plugin_end;
......@@ -443,6 +443,6 @@ maria_declare_plugin(sql_sequence)
NULL, /* status variables */
NULL, /* system variables */
"1.0", /* string version */
MariaDB_PLUGIN_MATURITY_ALPHA /* maturity */
MariaDB_PLUGIN_MATURITY_STABLE /* maturity */
}
maria_declare_plugin_end;
......@@ -4,7 +4,7 @@ Copyright (c) 2000, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, 2018, MariaDB Corporation.
Copyright (c) 2013, 2019, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
......@@ -12700,10 +12700,7 @@ ha_innobase::discard_or_import_tablespace(
DBUG_RETURN(HA_ERR_TABLE_READONLY);
}
dict_table_t* dict_table = m_prebuilt->table;
if (dict_table->is_temporary()) {
if (m_prebuilt->table->is_temporary()) {
ib_senderrf(
m_prebuilt->trx->mysql_thd, IB_LOG_LEVEL_ERROR,
ER_CANNOT_DISCARD_TEMPORARY_TABLE);
......@@ -12711,11 +12708,11 @@ ha_innobase::discard_or_import_tablespace(
DBUG_RETURN(HA_ERR_TABLE_NEEDS_UPGRADE);
}
if (dict_table->space == fil_system.sys_space) {
if (m_prebuilt->table->space == fil_system.sys_space) {
ib_senderrf(
m_prebuilt->trx->mysql_thd, IB_LOG_LEVEL_ERROR,
ER_TABLE_IN_SYSTEM_TABLESPACE,
dict_table->name.m_name);
m_prebuilt->table->name.m_name);
DBUG_RETURN(HA_ERR_TABLE_NEEDS_UPGRADE);
}
......@@ -12724,7 +12721,7 @@ ha_innobase::discard_or_import_tablespace(
/* Obtain an exclusive lock on the table. */
dberr_t err = row_mysql_lock_table(
m_prebuilt->trx, dict_table, LOCK_X,
m_prebuilt->trx, m_prebuilt->table, LOCK_X,
discard ? "setting table lock for DISCARD TABLESPACE"
: "setting table lock for IMPORT TABLESPACE");
......@@ -12737,32 +12734,32 @@ ha_innobase::discard_or_import_tablespace(
user may want to set the DISCARD flag in order to IMPORT
a new tablespace. */
if (!dict_table->is_readable()) {
if (!m_prebuilt->table->is_readable()) {
ib_senderrf(
m_prebuilt->trx->mysql_thd,
IB_LOG_LEVEL_WARN, ER_TABLESPACE_MISSING,
dict_table->name.m_name);
m_prebuilt->table->name.m_name);
}
err = row_discard_tablespace_for_mysql(
dict_table->name.m_name, m_prebuilt->trx);
m_prebuilt->table->name.m_name, m_prebuilt->trx);
} else if (dict_table->is_readable()) {
} else if (m_prebuilt->table->is_readable()) {
/* Commit the transaction in order to
release the table lock. */
trx_commit_for_mysql(m_prebuilt->trx);
ib::error() << "Unable to import tablespace "
<< dict_table->name << " because it already"
<< m_prebuilt->table->name << " because it already"
" exists. Please DISCARD the tablespace"
" before IMPORT.";
ib_senderrf(
m_prebuilt->trx->mysql_thd, IB_LOG_LEVEL_ERROR,
ER_TABLESPACE_EXISTS, dict_table->name.m_name);
ER_TABLESPACE_EXISTS, m_prebuilt->table->name.m_name);
DBUG_RETURN(HA_ERR_TABLE_EXIST);
} else {
err = row_import_for_mysql(dict_table, m_prebuilt);
err = row_import_for_mysql(m_prebuilt->table, m_prebuilt);
if (err == DB_SUCCESS) {
......@@ -12778,12 +12775,35 @@ ha_innobase::discard_or_import_tablespace(
/* Commit the transaction in order to release the table lock. */
trx_commit_for_mysql(m_prebuilt->trx);
if (err == DB_SUCCESS && !discard
&& dict_stats_is_persistent_enabled(dict_table)) {
if (discard || err != DB_SUCCESS) {
DBUG_RETURN(convert_error_code_to_mysql(
err, m_prebuilt->table->flags, NULL));
}
/* Evict and reload the table definition in order to invoke
btr_cur_instant_init(). */
table_id_t id = m_prebuilt->table->id;
ut_ad(id);
mutex_enter(&dict_sys->mutex);
dict_table_close(m_prebuilt->table, TRUE, FALSE);
dict_table_remove_from_cache(m_prebuilt->table);
m_prebuilt->table = dict_table_open_on_id(id, TRUE,
DICT_TABLE_OP_NORMAL);
mutex_exit(&dict_sys->mutex);
if (!m_prebuilt->table) {
err = DB_TABLE_NOT_FOUND;
} else {
if (const Field* ai = table->found_next_number_field) {
initialize_auto_increment(m_prebuilt->table, ai);
}
dict_stats_init(m_prebuilt->table);
}
if (dict_stats_is_persistent_enabled(m_prebuilt->table)) {
dberr_t ret;
/* Adjust the persistent statistics. */
ret = dict_stats_update(dict_table,
ret = dict_stats_update(m_prebuilt->table,
DICT_STATS_RECALC_PERSISTENT);
if (ret != DB_SUCCESS) {
......@@ -12793,11 +12813,12 @@ ha_innobase::discard_or_import_tablespace(
ER_ALTER_INFO,
"Error updating stats for table '%s'"
" after table rebuild: %s",
dict_table->name.m_name, ut_strerr(ret));
m_prebuilt->table->name.m_name,
ut_strerr(ret));
}
}
DBUG_RETURN(convert_error_code_to_mysql(err, dict_table->flags, NULL));
DBUG_RETURN(0);
}
/**
......
/*****************************************************************************
Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2015, 2018, MariaDB Corporation.
Copyright (c) 2015, 2019, 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
......@@ -1820,13 +1820,22 @@ PageConverter::update_index_page(
if (dict_index_is_clust(m_index->m_srv_index)) {
if (page_is_root(page)) {
dict_index_t* index = const_cast<dict_index_t*>(
m_index->m_srv_index);
/* Preserve the PAGE_ROOT_AUTO_INC. */
if (m_index->m_srv_index->table->supports_instant()
&& btr_cur_instant_root_init(
const_cast<dict_index_t*>(
m_index->m_srv_index),
page)) {
return(DB_CORRUPTION);
if (index->table->supports_instant()) {
if (btr_cur_instant_root_init(index, page)) {
return(DB_CORRUPTION);
}
/* Provisionally set all instantly
added columns to be DEFAULT NULL. */
for (unsigned i = index->n_core_fields;
i < index->n_fields; i++) {
dict_col_t* col = index->fields[i].col;
col->def_val.len = UNIV_SQL_NULL;
col->def_val.data = NULL;
}
}
} else {
/* Clear PAGE_MAX_TRX_ID so that it can be
......
......@@ -3074,13 +3074,14 @@ row_discard_tablespace(
table->flags2 |= DICT_TF2_DISCARDED;
dict_table_change_id_in_cache(table, new_id);
/* Reset the root page numbers. */
dict_index_t* index = UT_LIST_GET_FIRST(table->indexes);
if (index) index->remove_instant();
for (dict_index_t* index = UT_LIST_GET_FIRST(table->indexes);
index != 0;
index = UT_LIST_GET_NEXT(indexes, index)) {
/* Reset the root page numbers. */
for (; index; index = UT_LIST_GET_NEXT(indexes, index)) {
index->page = FIL_NULL;
}
/* If the tablespace did not already exist or we couldn't
write to it, we treat that as a successful DISCARD. It is
unusable anyway. */
......
......@@ -892,6 +892,7 @@ static MYSQL_THDVAR_ULONGLONG(
1);
#endif // defined(TOKU_INCLUDE_RFR) && TOKU_INCLUDE_RFR
#if defined(TOKU_INCLUDE_UPSERT)
static MYSQL_THDVAR_BOOL(
enable_fast_update,
PLUGIN_VAR_THDLOCAL,
......@@ -907,6 +908,7 @@ static MYSQL_THDVAR_BOOL(
NULL,
NULL,
false);
#endif
#if TOKU_INCLUDE_XA
static MYSQL_THDVAR_BOOL(
......
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