Commit 9a849806 authored by Sergey Vojtovich's avatar Sergey Vojtovich

MDEV-12645 - mysql_install_db: no install test db option

Added --skip-test-db option to mysql_install_db. If specified, no test
database created and relevant grants issued.

Removed --skip-auth-anonymous-user option of mysql_install_db. Now it is
covered by --skip-test-db.

Dropped some Debian patches that did the same.

Removed unused make_win_bin_dist.1, make_win_bin_dist and
mysql_install_db.pl.in.
parent 8bbcc0d5
......@@ -98,4 +98,5 @@ usr/share/mysql/mysql_performance_tables.sql
usr/share/mysql/mysql_system_tables.sql
usr/share/mysql/mysql_system_tables_data.sql
usr/share/mysql/mysql_test_data_timezone.sql
usr/share/mysql/mysql_test_db.sql
usr/share/mysql/wsrep_notify
......@@ -141,7 +141,9 @@ EOF
# Debian: beware of the bashisms...
# Debian: can safely run on upgrades with existing databases
set +e
bash /usr/bin/mysql_install_db --rpm --cross-bootstrap --user=mysql --disable-log-bin 2>&1 | $ERR_LOGGER
bash /usr/bin/mysql_install_db --rpm --cross-bootstrap --user=mysql \
--disable-log-bin --skip-test-db 2>&1 | \
$ERR_LOGGER
set -e
......
33_scripts__mysql_create_system_tables__no_test.dpatch
38_scripts__mysqld_safe.sh__signals.dpatch
41_scripts__mysql_install_db.sh__no_test.dpatch
50_mysql-test__db_test.dpatch
61_replace_dash_with_bash_mbug675185.dpatch
#! /bin/sh /usr/share/dpatch/dpatch-run
## 33_scripts__mysql_create_system_tables__no_test.dpatch by <ch@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: scripts__mysql_create_system_tables__no_test
## DP: A user with no password prevents a normal user from login under certain
## DP: circumstances as it is checked first. See #301741.
## DP: http://bugs.mysql.com/bug.php?id=6901
@DPATCH@
--- a/scripts/mysql_system_tables_data.sql
+++ b/scripts/mysql_system_tables_data.sql
@@ -27,15 +27,6 @@
SELECT LOWER( REPLACE((SELECT REPLACE(@@hostname,'_','\_')),'%','\%') )INTO @current_hostname;
--- Fill "db" table with default grants for anyone to
--- access database 'test' and 'test_%' if "db" table didn't exist
-CREATE TEMPORARY TABLE tmp_db LIKE db;
-INSERT INTO tmp_db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y','Y');
-INSERT INTO tmp_db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y','Y');
-INSERT INTO db SELECT * FROM tmp_db WHERE @had_db_table=0;
-DROP TABLE tmp_db;
-
-
-- Fill "user" table with default users allowing root access
-- from local machine if "user" table didn't exist before
CREATE TEMPORARY TABLE tmp_user_nopasswd LIKE user;
@@ -48,9 +39,6 @@ REPLACE INTO tmp_user_nopasswd VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y'
REPLACE INTO tmp_user_nopasswd VALUES ('::1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N','N', '', 0);
-- More secure root account using unix sucket auth.
INSERT INTO tmp_user_socket VALUES ('localhost',IFNULL(@auth_root_socket, 'root'),'','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'unix_socket','','N', 'N','', 0);
--- Anonymous user with no privileges.
-INSERT INTO tmp_user_anonymous (host,user) VALUES ('localhost','');
-INSERT INTO tmp_user_anonymous (host,user) SELECT @current_hostname,'' FROM dual WHERE @current_hostname != 'localhost';
INSERT INTO user SELECT * FROM tmp_user_nopasswd WHERE @had_user_table=0 AND @skip_auth_root_nopasswd IS NULL;
INSERT INTO user SELECT * FROM tmp_user_socket WHERE @had_user_table=0 AND @auth_root_socket IS NOT NULL;
#! /bin/sh /usr/share/dpatch/dpatch-run
## 41_scripts__mysql_install_db.sh__no_test.dpatch by <ch@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: scripts__mysql_install_db.sh__no_test
## DP: http://bugs.mysql.com/bug.php?id=6901
@DPATCH@
--- mysql-dfsg-5.1-5.1.23rc.orig/scripts/mysql_install_db.sh 2008-01-29 22:41:20.000000000 +0100
+++ mysql-dfsg-5.1-5.1.23rc/scripts/mysql_install_db.sh 2008-02-28 10:08:11.000000000 +0100
@@ -407,7 +407,7 @@ then
fi
# Create database directories
-for dir in "$ldata" "$ldata/mysql" "$ldata/test"
+for dir in "$ldata" "$ldata/mysql"
do
if test ! -d "$dir"
then
#! /bin/sh /usr/share/dpatch/dpatch-run
## 50_mysql-test__db_test.dpatch by Christian Hammers <ch@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Patch 33_scripts__mysql_create_system_tables__no_test removes the
## DP: rights for anybody to connect to the test database but the test
## DP: suite depends on them.
@DPATCH@
--- old/mysql-test/mysql-test-run.pl 2009-06-16 14:24:09.000000000 +0200
+++ new/mysql-test/mysql-test-run.pl 2009-07-04 00:03:34.000000000 +0200
@@ -3180,6 +3180,11 @@ sub mysql_install_db {
mtr_appendfile_to_file("$sql_dir/mysql_system_tables_data.sql",
$bootstrap_sql_file);
+ mtr_tofile($bootstrap_sql_file, "-- Debian removed the default privileges on the 'test' database\n");
+ mtr_tofile($bootstrap_sql_file, "INSERT INTO mysql.db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y','Y');\n");
+ mtr_tofile($bootstrap_sql_file, "INSERT INTO mysql.db VALUES ('%','test\\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y','Y');\n");
+
+
# Add test data for timezone - this is just a subset, on a real
# system these tables will be populated either by mysql_tzinfo_to_sql
# or by downloading the timezone table package from our website
'\" t
.\"
.TH "\FBMAKE_WIN_BIN_DIST" "1" "9 May 2017" "MariaDB 10\&.3" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.\" make_win_bin_dist
.SH "NAME"
make_win_bin_dist \- package MySQL distribution as ZIP archive
.SH "SYNOPSIS"
.HP \w'\fBmake_win_bin_dist\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIpackage_basename\fR\fR\fB\ [\fR\fB\fIcopy_def\fR\fR\fB\ \&.\&.\&.]\fR\ 'u
\fBmake_win_bin_dist [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIpackage_basename\fR\fR\fB [\fR\fB\fIcopy_def\fR\fR\fB \&.\&.\&.]\fR
.SH "DESCRIPTION"
.PP
This script is used on Windows after building a MySQL distribution from source to create executable programs\&. It packages the binaries and support files into a ZIP archive that can be unpacked at the location where you want to install MySQL\&.
.PP
\fBmake_win_bin_dist\fR
is a shell script, so you must have Cygwin installed to use it\&.
.PP
This program\'s use is subject to change\&. Currently, you invoke it as follows from the root directory of your source distribution:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmake_win_bin_dist [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIpackage_basename\fR\fR\fB [\fR\fB\fIcopy_def\fR\fR\fB \&.\&.\&.]\fR
.fi
.if n \{\
.RE
.\}
.PP
The
\fIpackage_basename\fR
argument provides the basename for the resulting ZIP archive\&. This name will be the name of the directory that results from unpacking the archive\&.
.PP
Because you might want to include files of directories from other builds, you can instruct this script do copy them in for you, via
\fIcopy_def\fR
arguments, which of which is of the form
\fIrelative_dest_name\fR=\fIsource_name\fR\&.
.PP
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
bin/mysqld\-max\&.exe=\&.\&./my\-max\-build/sql/release/mysqld\&.exe
.fi
.if n \{\
.RE
.\}
.PP
If you specify a directory, the entire directory will be copied\&.
.PP
\fBmake_win_bin_dist\fR
supports the following options\&.
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" make_win_bin_dist: debug option
.\" debug option: make_win_bin_dist
\fB\-\-debug\fR
.sp
Pack the debug binaries and produce an error if they were not built\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" make_win_bin_dist: embedded option
.\" embedded option: make_win_bin_dist
\fB\-\-embedded\fR
.sp
Pack the embedded server and produce an error if it was not built\&. The default is to pack it if it was built\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" make_win_bin_dist: exe-suffix option
.\" exe-suffix option: make_win_bin_dist
\fB\-\-exe\-suffix=\fR\fB\fIsuffix\fR\fR
.sp
Add a suffix to the basename of the
\fBmysql\fR
binary\&. For example, a suffix of
\-abc
produces a binary named
\fBmysqld\-abc\&.exe\fR\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" make_win_bin_dist: no-debug option
.\" no-debug option: make_win_bin_dist
\fB\-\-no\-debug\fR
.sp
Do not pack the debug binaries even if they were built\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" make_win_bin_dist: no-embedded option
.\" no-embedded option: make_win_bin_dist
\fB\-\-no\-embedded\fR
.sp
Do not pack the embedded server even if it was built\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" make_win_bin_dist: only-debug option
.\" only-debug option: make_win_bin_dist
\fB\-\-only\-debug\fR
.sp
Use this option when the target for this build was
Debug, and you just want to replace the normal binaries with debug versions (that is, do not use separate
debug
directories)\&.
.RE
.SH "COPYRIGHT"
.br
.PP
Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
.PP
You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/.
.sp
.SH "SEE ALSO"
For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/
.SH AUTHOR
MariaDB Foundation (http://www.mariadb.org/).
......@@ -83,6 +83,8 @@ USE test;
#
# MDEV-7387 Alter table xxx CHARACTER SET utf8, CONVERT TO CHARACTER SET latin1 should fail
#
CREATE DATABASE tmp DEFAULT CHARACTER SET latin5;
USE tmp;
CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET DEFAULT, CHARACTER SET utf8;
ERROR HY000: Conflicting declarations: 'CHARACTER SET DEFAULT' and 'CHARACTER SET utf8'
CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET utf8, CHARACTER SET DEFAULT;
......@@ -105,6 +107,8 @@ ERROR HY000: Conflicting declarations: 'CHARACTER SET latin5' and 'CHARACTER SET
ALTER TABLE t1 CONVERT TO CHARACTER SET DEFAULT, CHARACTER SET latin1;
ERROR HY000: Conflicting declarations: 'CHARACTER SET latin5' and 'CHARACTER SET latin1'
DROP TABLE t1;
DROP DATABASE tmp;
USE test;
#
# End of 10.0 tests
#
......@@ -114,6 +114,8 @@ USE test;
--echo #
--echo # MDEV-7387 Alter table xxx CHARACTER SET utf8, CONVERT TO CHARACTER SET latin1 should fail
--echo #
CREATE DATABASE tmp DEFAULT CHARACTER SET latin5;
USE tmp;
--error ER_CONFLICTING_DECLARATIONS
CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET DEFAULT, CHARACTER SET utf8;
--error ER_CONFLICTING_DECLARATIONS
......@@ -137,6 +139,8 @@ ALTER TABLE t1 CONVERT TO CHARACTER SET DEFAULT, CHARACTER SET utf8;
--error ER_CONFLICTING_DECLARATIONS
ALTER TABLE t1 CONVERT TO CHARACTER SET DEFAULT, CHARACTER SET latin1;
DROP TABLE t1;
DROP DATABASE tmp;
USE test;
--echo #
--echo # End of 10.0 tests
......
--character-set-server=latin1 --collation-server=latin1_german2_ci
create database latin1_german2_ci default character set latin1 collate latin1_german2_ci;
use latin1_german2_ci;
set names latin1;
set @@collation_connection=latin1_german2_ci;
select @@collation_connection;
......@@ -139,7 +141,7 @@ a
a
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
latin1_german2_ci.t1 check status OK
select * from t1 where a like "%";
a b
1
......@@ -835,3 +837,5 @@ hex(weight_string('x
#
# End of 5.6 tests
#
drop database latin1_german2_ci;
use test;
#
# Test latin_de character set
#
create database latin1_german2_ci default character set latin1 collate latin1_german2_ci;
use latin1_german2_ci;
set names latin1;
set @@collation_connection=latin1_german2_ci;
......@@ -180,3 +182,6 @@ select hex(weight_string('x
--echo #
--echo # End of 5.6 tests
--echo #
drop database latin1_german2_ci;
use test;
......@@ -205,6 +205,7 @@ DROP TABLE t1;
# and reverse() function
#
# Problem # 1 (original report): wrong parsing of ucs2 data
SET character_set_connection=ucs2;
SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
CREATE TABLE t1(a INT);
LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
......
......@@ -74,6 +74,7 @@ DROP TABLE t1;
--echo #
--echo # Problem # 1 (original report): wrong parsing of ucs2 data
SET character_set_connection=ucs2;
SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
CREATE TABLE t1(a INT);
LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
......
......@@ -26,8 +26,10 @@ Level Warning
Code 1286
Message Unknown storage engine 'ARCHIVE'
install soname 'ha_archive';
db.opt
t1.ARZ
t1.frm
drop table t1;
db.opt
uninstall soname 'ha_archive';
set debug_dbug='-d,unstable_db_type';
......@@ -76,6 +76,7 @@ t1 CREATE TABLE `t1` (
insert t1 values (2, '2020-01-03', 20);
ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
drop table t1;
db.opt
create table t1(id int, d date not null, b bool not null default 0, primary key(id,d))
partition by range columns (d) (
partition p1 values less than ('2016-10-18'),
......@@ -100,6 +101,7 @@ t1 CREATE TABLE `t1` (
insert t1 values (2, '2020-01-03', 20);
ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
drop table t1;
db.opt
create table t1 (id_1 int auto_increment, id_2 int, id_3 int, d1 date, dt1 datetime default current_timestamp, dt2 datetime default current_timestamp on update current_timestamp, primary key (id_2, id_3), key(id_1)) partition by hash(id_2) partitions 3 (partition p01, partition p02, partition p03);
insert into t1 values(0, 1, 1, NULL, now(), now());
alter online table t1 delay_key_write=1;
......
......@@ -3191,9 +3191,6 @@ sub mysql_install_db {
mtr_appendfile_to_file("$sql_dir/mysql_performance_tables.sql",
$bootstrap_sql_file);
# Don't install anonymous users
mtr_tofile($bootstrap_sql_file, "set \@skip_auth_anonymous=1;\n");
# Add the mysql system tables initial data
# for a production system
mtr_appendfile_to_file("$sql_dir/mysql_system_tables_data.sql",
......@@ -3211,6 +3208,10 @@ sub mysql_install_db {
mtr_appendfile_to_file("$sql_dir/fill_help_tables.sql",
$bootstrap_sql_file);
# Create test database
mtr_appendfile_to_file("$sql_dir/mysql_test_db.sql",
$bootstrap_sql_file);
# mysql.gtid_slave_pos was created in InnoDB, but many tests
# run without InnoDB. Alter it to MyISAM now
mtr_tofile($bootstrap_sql_file, "ALTER TABLE gtid_slave_pos ENGINE=MyISAM;\n");
......@@ -3228,6 +3229,10 @@ sub mysql_install_db {
sql_to_bootstrap($text));
}
# Remove anonymous users
mtr_tofile($bootstrap_sql_file,
"DELETE FROM mysql.user where user= '';\n");
# Create mtr database
mtr_tofile($bootstrap_sql_file,
"CREATE DATABASE mtr CHARSET=latin1;\n");
......@@ -3248,7 +3253,6 @@ sub mysql_install_db {
# Create directories mysql and test
mkpath("$install_datadir/mysql");
mkpath("$install_datadir/test");
if ( My::SafeProcess->run
(
......
......@@ -17,6 +17,7 @@ select * from t1;
a
1
2
db.opt
t1.ARZ
t1.frm
#
......@@ -30,6 +31,7 @@ show tables;
Tables_in_test
t1
t2
db.opt
t1.ARZ
t2.ARZ
t2.frm
......@@ -41,6 +43,7 @@ show full tables;
Tables_in_test Table_type
t1 BASE TABLE
t2 BASE TABLE
db.opt
t1.ARZ
t2.ARZ
t2.frm
......@@ -50,6 +53,7 @@ t2.frm
flush tables;
truncate table t1;
ERROR HY000: Storage engine ARCHIVE of the table `test`.`t1` doesn't have this option
db.opt
t1.ARZ
t1.frm
t2.ARZ
......@@ -59,6 +63,7 @@ t2.frm
#
flush tables;
rename table t2 to t0;
db.opt
t0.ARZ
t1.ARZ
t1.frm
......@@ -76,6 +81,7 @@ t1 CREATE TABLE `t1` (
#
flush tables;
drop table t1;
db.opt
t0.ARZ
#
# discover of table non-existance on drop
......@@ -84,6 +90,7 @@ select * from t0;
a
flush tables;
drop table t0;
db.opt
show status like 'Handler_discover';
Variable_name Value
Handler_discover 6
......@@ -130,6 +137,7 @@ a
flush tables;
select * from t1;
ERROR 42S02: Table 'test.t1' doesn't exist
db.opt
create table t1 (a int) engine=archive;
select * from t1;
a
......
......@@ -14,6 +14,7 @@ t1 CREATE TABLE `t1` (
INSERT INTO t1 VALUES (1,'foobar'),(2,'barfoo');
FLUSH TABLE t1 FOR EXPORT;
# List before copying files
db.opt
t1.cfg
t1.frm
t1.ibd
......
......@@ -38,6 +38,7 @@ backup: te_crc32
backup: t_crc32
backup: tpe_crc32
backup: tp_crc32
db.opt
t_crc32.cfg
t_crc32.frm
t_crc32.ibd
......@@ -247,6 +248,7 @@ backup: te_innodb
backup: t_innodb
backup: tpe_innodb
backup: tp_innodb
db.opt
t_innodb.cfg
t_innodb.frm
t_innodb.ibd
......@@ -456,6 +458,7 @@ backup: te_none
backup: t_none
backup: tpe_none
backup: tp_none
db.opt
t_none.cfg
t_none.frm
t_none.ibd
......
......@@ -24,6 +24,7 @@ backup: t2
backup: t3
backup: t4
backup: t5
db.opt
t1.cfg
t1.frm
t1.ibd
......
......@@ -44,6 +44,7 @@ count(*)
2000
FLUSH TABLE t1,t2,t3,t4 FOR EXPORT;
# List before copying files
db.opt
t1.cfg
t1.frm
t1.ibd
......@@ -60,6 +61,7 @@ backup: t1
backup: t2
backup: t3
backup: t4
db.opt
t1.cfg
t1.frm
t1.ibd
......
......@@ -25,6 +25,7 @@ NOT FOUND /foobar/ in t1.ibd
NOT FOUND /temp/ in t2.ibd
# t3 ... on expecting NOT FOUND
NOT FOUND /barfoo/ in t3.ibd
db.opt
t1.frm
t1.ibd
t2.frm
......@@ -35,6 +36,7 @@ FLUSH TABLES t1, t2, t3 FOR EXPORT;
backup: t1
backup: t2
backup: t3
db.opt
t1.cfg
t1.frm
t1.ibd
......
......@@ -73,6 +73,7 @@ FTSBEING_DELETED_CACHE.ibd
FTSCONFIG.ibd
FTSDELETED.ibd
FTSDELETED_CACHE.ibd
db.opt
t.frm
t.ibd
t1.frm
......@@ -140,6 +141,7 @@ FTSBEING_DELETED_CACHE.ibd
FTSCONFIG.ibd
FTSDELETED.ibd
FTSDELETED_CACHE.ibd
db.opt
t.frm
t.ibd
t1.frm
......@@ -206,6 +208,7 @@ FTSBEING_DELETED_CACHE.ibd
FTSCONFIG.ibd
FTSDELETED.ibd
FTSDELETED_CACHE.ibd
db.opt
t.frm
t.ibd
t1.frm
......
......@@ -48,6 +48,7 @@ SELECT * FROM information_schema.innodb_sys_tables
WHERE table_id = ID;
TABLE_ID NAME FLAG N_COLS SPACE ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE
# Files in datadir after manual recovery.
db.opt
t1.frm
t1.ibd
SHOW TABLES;
......@@ -105,6 +106,7 @@ DROP TABLE t2;
CREATE TABLE t2 (f1 INT NOT NULL, f2 INT NOT NULL) ENGINE=InnoDB;
ALTER TABLE t2 ADD PRIMARY KEY (f2, f1);
DROP TABLE t2;
db.opt
# -------------------------
# End of Testing Scenario 2
# -------------------------
......@@ -123,6 +125,7 @@ SELECT * FROM information_schema.innodb_sys_tables
WHERE table_id = ID;
TABLE_ID NAME FLAG N_COLS SPACE ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE
# Files in datadir after manual recovery.
db.opt
t1.frm
t1.ibd
SHOW TABLES;
......
......@@ -5,6 +5,7 @@ CREATE TABLE t1 (x INT) ENGINE=INNODB, DATA DIRECTORY='MYSQL_TMP_DIR';
# Contents of tmp/test directory containing .ibd file
t1.ibd
# Contents of the 'test' database directory containing .isl and .frm files
db.opt
t1.frm
t1.isl
DROP TABLE t1;
......@@ -31,12 +31,14 @@ a b c
822 Devotion asdfuihknaskdf
821 Cavalry ..asdasdfaeraf
CREATE TABLE t2(a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPACT;
db.opt
t1.frm
t1.ibd
t2.frm
t2.ibd
FLUSH TABLE t1, t2 FOR EXPORT;
# List before copying files
db.opt
t1.cfg
t1.frm
t1.ibd
......@@ -61,12 +63,14 @@ a b c
# Restarting server
# Done restarting server
# List before t1 DISCARD
db.opt
t1.frm
t1.ibd
t2.frm
t2.ibd
ALTER TABLE t1 DISCARD TABLESPACE;
# List after t1 DISCARD
db.opt
t1.frm
t2.frm
t2.ibd
......@@ -85,6 +89,7 @@ a b c
823 Evolution lsjndofiabsoibeg
822 Devotion asdfuihknaskdf
821 Cavalry ..asdasdfaeraf
db.opt
t1.cfg
t1.frm
t1.ibd
......@@ -107,6 +112,7 @@ DROP TABLE t1;
ALTER TABLE t2 ROW_FORMAT=DYNAMIC;
ALTER TABLE t2 DISCARD TABLESPACE;
# List after t2 DISCARD
db.opt
t2.frm
ALTER TABLE t2 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x21 and the meta-data file has 0x1)
......@@ -135,6 +141,7 @@ INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
db.opt
t1.frm
t1.ibd
FLUSH TABLES t1 FOR EXPORT;
......@@ -142,6 +149,7 @@ SELECT COUNT(*) FROM t1;
COUNT(*)
16
backup: t1
db.opt
t1.cfg
t1.frm
t1.ibd
......@@ -154,6 +162,7 @@ ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
db.opt
t1.cfg
t1.frm
t1.ibd
......@@ -173,6 +182,7 @@ INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
db.opt
t1.frm
t1.ibd
FLUSH TABLES t1 FOR EXPORT;
......@@ -180,10 +190,12 @@ SELECT COUNT(*) FROM t1;
COUNT(*)
16
backup: t1
db.opt
t1.cfg
t1.frm
t1.ibd
UNLOCK TABLES;
db.opt
t1.frm
t1.ibd
INSERT INTO t1(c2) SELECT c2 FROM t1;
......@@ -196,6 +208,7 @@ ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
db.opt
t1.cfg
t1.frm
t1.ibd
......@@ -220,6 +233,7 @@ SELECT COUNT(*) FROM t1 WHERE c2 = 1;
COUNT(*)
16
backup: t1
db.opt
t1.cfg
t1.frm
t1.ibd
......
......@@ -64,6 +64,7 @@ t1 CREATE TABLE `t1` (
KEY `c2` (`c2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/'
### files in MYSQL_DATA_DIR/test
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -99,6 +100,7 @@ test/t1c3 c3 c2 0
ALTER TABLE t1 CHANGE c2 c2 INT AFTER c1;
ALTER TABLE t1 CHANGE c1 c1 INT FIRST;
### files in MYSQL_DATA_DIR/test
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -133,6 +135,7 @@ test/t1c2 c2 c2 0
test/t1c3 c3 c2 0
ALTER TABLE t1 CHANGE C2 c3 INT;
### files in MYSQL_DATA_DIR/test
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -167,6 +170,7 @@ test/t1c2 c2 c3 0
test/t1c3 c3 c2 0
ALTER TABLE t1 CHANGE c3 C INT;
### files in MYSQL_DATA_DIR/test
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -201,6 +205,7 @@ test/t1c2 c2 C 0
test/t1c3 c3 c2 0
ALTER TABLE t1 CHANGE C Cöŀumň_TWO INT;
### files in MYSQL_DATA_DIR/test
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -242,6 +247,7 @@ ALTER TABLE t1 CHANGE cöĿǖmň_two c3 INT;
ERROR 42S22: Unknown column 'cöĿǖmň_two' in 't1'
ALTER TABLE t1 CHANGE cÖĿUMŇ_two c3 INT, RENAME TO t3;
### files in MYSQL_DATA_DIR/test
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -289,6 +295,7 @@ ERROR 42000: Identifier name '12345678901234567890123456789012345678901234567890
ALTER TABLE t3 CHANGE c3
`1234567890123456789012345678901234567890123456789012345678901234` INT;
### files in MYSQL_DATA_DIR/test
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -325,6 +332,7 @@ ALTER TABLE t3 CHANGE
`1234567890123456789012345678901234567890123456789012345678901234`
`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾ä` INT;
### files in MYSQL_DATA_DIR/test
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -344,6 +352,7 @@ ALTER TABLE t3 CHANGE
`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾Ä`
c3 INT;
### files in MYSQL_DATA_DIR/test
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -365,6 +374,7 @@ ALTER TABLE t3 CHANGE c3 😲 INT;
ERROR HY000: Invalid utf8mb4 character string: '\xF0\x9F\x98\xB2'
ALTER TABLE t3 RENAME TO t2;
### files in MYSQL_DATA_DIR/test
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -401,6 +411,7 @@ ON i.TABLE_ID=st.TABLE_ID;
NAME NAME
test/t1 test/t1
### files in MYSQL_DATA_DIR/test
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -475,6 +486,7 @@ t1c CREATE TABLE `t1c` (
CONSTRAINT `t1c3` FOREIGN KEY (`c3`) REFERENCES `t1p` (`c2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/'
### files in MYSQL_DATA_DIR/test
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -514,6 +526,7 @@ ERROR HY000: Cannot drop index 'c3': needed in a foreign key constraint
SET foreign_key_checks=0;
ALTER TABLE t1c DROP INDEX C3;
### files in MYSQL_DATA_DIR/test
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -561,6 +574,7 @@ test/t1c2 c2 c3 0
test/t1c3 c3 c2 0
ALTER TABLE t1c DROP FOREIGN KEY t1C3;
### files in MYSQL_DATA_DIR/test
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -605,6 +619,7 @@ ID FOR_COL_NAME REF_COL_NAME POS
test/t1c2 c2 c3 0
ALTER TABLE t1c DROP INDEX c2, DROP FOREIGN KEY t1C2;
### files in MYSQL_DATA_DIR/test
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -646,6 +661,7 @@ INNER JOIN sys_foreign sf ON i.ID = sf.ID;
ID FOR_COL_NAME REF_COL_NAME POS
ALTER TABLE t1 DROP INDEX c2, CHANGE c3 c2 INT;
### files in MYSQL_DATA_DIR/test
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -698,6 +714,7 @@ FTS_AUX_BEING_DELETED_CACHE.isl
FTS_AUX_CONFIG.isl
FTS_AUX_DELETED.isl
FTS_AUX_DELETED_CACHE.isl
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -794,6 +811,7 @@ FTS_AUX_BEING_DELETED_CACHE.ibd
FTS_AUX_CONFIG.ibd
FTS_AUX_DELETED.ibd
FTS_AUX_DELETED_CACHE.ibd
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -855,6 +873,7 @@ FTS_AUX_BEING_DELETED_CACHE.ibd
FTS_AUX_CONFIG.ibd
FTS_AUX_DELETED.ibd
FTS_AUX_DELETED_CACHE.ibd
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -910,6 +929,7 @@ FTS_AUX_BEING_DELETED_CACHE.ibd
FTS_AUX_CONFIG.ibd
FTS_AUX_DELETED.ibd
FTS_AUX_DELETED_CACHE.ibd
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -966,6 +986,7 @@ FTS_AUX_BEING_DELETED_CACHE.ibd
FTS_AUX_CONFIG.ibd
FTS_AUX_DELETED.ibd
FTS_AUX_DELETED_CACHE.ibd
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -1031,6 +1052,7 @@ FTS_AUX_BEING_DELETED_CACHE.ibd
FTS_AUX_CONFIG.ibd
FTS_AUX_DELETED.ibd
FTS_AUX_DELETED_CACHE.ibd
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -1099,6 +1121,7 @@ FTS_AUX_BEING_DELETED_CACHE.ibd
FTS_AUX_CONFIG.ibd
FTS_AUX_DELETED.ibd
FTS_AUX_DELETED_CACHE.ibd
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -1164,6 +1187,7 @@ FTS_AUX_BEING_DELETED_CACHE.ibd
FTS_AUX_CONFIG.ibd
FTS_AUX_DELETED.ibd
FTS_AUX_DELETED_CACHE.ibd
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -1221,6 +1245,7 @@ FTS_AUX_BEING_DELETED_CACHE.ibd
FTS_AUX_CONFIG.ibd
FTS_AUX_DELETED.ibd
FTS_AUX_DELETED_CACHE.ibd
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -1276,6 +1301,7 @@ FTS_AUX_BEING_DELETED_CACHE.isl
FTS_AUX_CONFIG.isl
FTS_AUX_DELETED.isl
FTS_AUX_DELETED_CACHE.isl
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -1331,6 +1357,7 @@ FTS_AUX_BEING_DELETED_CACHE.ibd
FTS_AUX_CONFIG.ibd
FTS_AUX_DELETED.ibd
FTS_AUX_DELETED_CACHE.ibd
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -1392,6 +1419,7 @@ FTS_AUX_BEING_DELETED_CACHE.isl
FTS_AUX_CONFIG.isl
FTS_AUX_DELETED.isl
FTS_AUX_DELETED_CACHE.isl
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -1463,6 +1491,7 @@ FTS_AUX_BEING_DELETED_CACHE.isl
FTS_AUX_CONFIG.isl
FTS_AUX_DELETED.isl
FTS_AUX_DELETED_CACHE.isl
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -1511,6 +1540,7 @@ FTS_AUX_BEING_DELETED_CACHE.ibd
FTS_AUX_CONFIG.ibd
FTS_AUX_DELETED.ibd
FTS_AUX_DELETED_CACHE.ibd
db.opt
sys_foreign.frm
sys_foreign.ibd
sys_indexes.frm
......@@ -1560,4 +1590,5 @@ ID FOR_COL_NAME REF_COL_NAME POS
#
DROP TABLE tt, t1o, sys_tables, sys_indexes, sys_foreign;
### files in MYSQL_DATA_DIR/test
db.opt
### files in MYSQL_TMP_DIR/alt_dir/test
......@@ -101,4 +101,5 @@ t2 CREATE TABLE `t2` (
UNIQUE KEY `c2` (`c2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
DROP TABLE t1,t2;
db.opt
SET GLOBAL innodb_purge_rseg_truncate_frequency=@saved_frequency;
......@@ -98,5 +98,6 @@ FOUND 1 /InnoDB: At LSN: \d+: unable to open file .*u[1-5].ibd for tablespace/ i
FOUND 1 /\[Warning\] InnoDB: Tablespace \d+ was not found at .*u[1-5].ibd, and innodb_force_recovery was set. All redo log for this tablespace will be ignored!/ in mysqld.1.err
DROP TABLE u1,u2,u3,u6;
# List of files:
db.opt
SHOW TABLES;
Tables_in_test
......@@ -77,3 +77,4 @@ ib_buffer_pool
ib_logfile0
ib_logfile1
ibdata1
db.opt
......@@ -40,9 +40,6 @@ ALTER TABLE t1 ENGINE=InnoDB;
drop table t1;
let $datadir=`select @@datadir`;
--remove_file $datadir/test/db.opt
--enable_query_log
--enable_result_log
--enable_warnings
......
......@@ -227,6 +227,7 @@ test/t7_restart#p#p1#sp#s3 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/
# Shutdown the server and list the tablespace OS files
#
---- MYSQL_DATA_DIR/test
db.opt
t1_restart.frm
t1_restart.ibd
t2_restart.frm
......@@ -485,6 +486,7 @@ SUBPARTITION BY HASH (`c1`)
# Shutdown the server and make a backup of a tablespace
#
---- MYSQL_DATA_DIR/test
db.opt
t4_restart.frm
t4_restart.ibd
t5_restart.frm
......@@ -588,6 +590,7 @@ ERROR 42S01: Table 't55_restart' already exists
RENAME TABLE t5_restart TO t55_restart;
ERROR HY000: Error on rename of './test/t5_restart' to './test/t55_restart' (errno: 184 "Tablespace already exists")
---- MYSQL_DATA_DIR/test
db.opt
t4_restart.frm
t4_restart.ibd
t5_restart.frm
......@@ -684,6 +687,7 @@ SUBPARTITION BY HASH (`c1`)
(SUBPARTITION `s2` DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB,
SUBPARTITION `s3` DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir' ENGINE = InnoDB))
---- MYSQL_DATA_DIR/test
db.opt
t4_restart.frm
t4_restart.ibd
t55_restart.frm
......@@ -786,6 +790,7 @@ SUBPARTITION BY HASH (`c1`)
# Move the remote tablespaces to a new location and change the ISL files
#
---- MYSQL_DATA_DIR/test
db.opt
t4_restart.frm
t4_restart.ibd
t55_restart.frm
......@@ -816,6 +821,7 @@ t77_restart#p#p1#sp#s3.ibd
# Moving tablespace 't66_restart' from MYSQL_TMP_DIR/alt_dir to MYSQL_TMP_DIR/new_dir
# Moving tablespace 't77_restart' from MYSQL_TMP_DIR/alt_dir to MYSQL_TMP_DIR/new_dir
---- MYSQL_DATA_DIR/test
db.opt
t4_restart.frm
t4_restart.isl
t55_restart.frm
......@@ -931,6 +937,7 @@ SUBPARTITION BY HASH (`c1`)
# Move the remote tablespaces back to the default datadir and delete the ISL file.
#
---- MYSQL_DATA_DIR/test
db.opt
t4_restart.frm
t4_restart.isl
t55_restart.frm
......@@ -961,6 +968,7 @@ t77_restart#p#p1#sp#s3.ibd
# Moving 't66_restart' from MYSQL_TMP_DIR/new_dir to MYSQL_DATA_DIR
# Moving 't77_restart' from MYSQL_TMP_DIR/new_dir to MYSQL_DATA_DIR
---- MYSQL_DATA_DIR/test
db.opt
t4_restart.frm
t4_restart.ibd
t55_restart.frm
......
......@@ -29,12 +29,14 @@ a b c
823 Evolution lsjndofiabsoibeg
822 Devotion asdfuihknaskdf
821 Cavalry ..asdasdfaeraf
db.opt
t1.frm
t1.ibd
# Restarting server
# Done restarting server
FLUSH TABLE t1 FOR EXPORT;
# List before copying files
db.opt
t1.cfg
t1.frm
t1.ibd
......@@ -56,10 +58,12 @@ a b c
# Restarting server
# Done restarting server
# List before t1 DISCARD
db.opt
t1.frm
t1.ibd
ALTER TABLE t1 DISCARD TABLESPACE;
# List after t1 DISCARD
db.opt
t1.frm
ALTER TABLE t1 IMPORT TABLESPACE;
ALTER TABLE t1 ENGINE InnoDB;
......@@ -76,6 +80,7 @@ a b c
823 Evolution lsjndofiabsoibeg
822 Devotion asdfuihknaskdf
821 Cavalry ..asdasdfaeraf
db.opt
t1.cfg
t1.frm
t1.ibd
......@@ -112,6 +117,7 @@ INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
db.opt
t1.frm
t1.ibd
FLUSH TABLES t1 FOR EXPORT;
......@@ -119,6 +125,7 @@ SELECT COUNT(*) FROM t1;
COUNT(*)
16
backup: t1
db.opt
t1.cfg
t1.frm
t1.ibd
......@@ -131,6 +138,7 @@ ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
db.opt
t1.cfg
t1.frm
t1.ibd
......@@ -150,6 +158,7 @@ INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
db.opt
t1.frm
t1.ibd
FLUSH TABLES t1 FOR EXPORT;
......@@ -157,10 +166,12 @@ SELECT COUNT(*) FROM t1;
COUNT(*)
16
backup: t1
db.opt
t1.cfg
t1.frm
t1.ibd
UNLOCK TABLES;
db.opt
t1.frm
t1.ibd
INSERT INTO t1(c2) SELECT c2 FROM t1;
......@@ -173,6 +184,7 @@ ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
db.opt
t1.cfg
t1.frm
t1.ibd
......@@ -198,6 +210,7 @@ SELECT COUNT(*) FROM t1 WHERE c2 = 1;
COUNT(*)
16
backup: t1
db.opt
t1.cfg
t1.frm
t1.ibd
......
......@@ -53,6 +53,7 @@ Warning 1618 <INDEX DIRECTORY> option ignored
Warning 1618 <INDEX DIRECTORY> option ignored
# Verifying .frm, .par, .isl & .ibd files
---- MYSQLD_DATADIR/test
db.opt
t1#P#p0.isl
t1#P#p1.isl
t1.frm
......@@ -88,6 +89,7 @@ t1 CREATE TABLE `t1` (
PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = MyISAM)
# Verifying .frm, .par and MyISAM files (.MYD, MYI)
---- MYSQLD_DATADIR/test
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
t1#P#p1.MYD
......@@ -115,6 +117,7 @@ t1 CREATE TABLE `t1` (
PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/mysql-test-data-dir' ENGINE = InnoDB)
# Verifying .frm, .par, .isl and InnoDB .ibd files
---- MYSQLD_DATADIR/test
db.opt
t1#P#p0.isl
t1#P#p1.isl
t1.frm
......
......@@ -53,6 +53,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY RANGE (`a`)
(PARTITION `p0` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
db.opt
t1#P#p0.ibd
t1.frm
t1.par
......@@ -79,6 +80,7 @@ connection default;
TABLE_SCHEMA TABLE_NAME PARTITION_NAME PARTITION_ORDINAL_POSITION PARTITION_DESCRIPTION TABLE_ROWS
test t1 p0 1 10 1
test t1 p10 2 MAXVALUE 3
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
......@@ -98,4 +100,5 @@ a
21
33
drop table t1;
db.opt
SET DEBUG_SYNC = 'RESET';
......@@ -54,7 +54,7 @@ utf8_roman_ci utf8_roman_ci utf8 utf8
USE test;
SELECT @@collation_database,@@collation_server,@@character_set_database,@@character_set_server;
@@collation_database @@collation_server @@character_set_database @@character_set_server
utf8_roman_ci utf8_roman_ci utf8 utf8
latin1_swedish_ci utf8_roman_ci latin1 utf8
'fill table with some test data';
CREATE TABLE t1(a CHAR(20))CHARACTER SET=latin1;
INSERT INTO t1 VALUES('Muffler'),('Müller'),('MX Systems');
......
......@@ -95,6 +95,7 @@ INSTALL(FILES
${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables.sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables_data.sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_performance_tables.sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_test_db.sql
${CMAKE_CURRENT_SOURCE_DIR}/fill_help_tables.sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_test_data_timezone.sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_to_mariadb.sql
......
This diff is collapsed.
This diff is collapsed.
......@@ -37,9 +37,9 @@ force=0
in_rpm=0
ip_only=0
cross_bootstrap=0
install_params=""
auth_root_authentication_method=normal
auth_root_socket_user='root'
skip_test_db=0
usage()
{
......@@ -80,11 +80,10 @@ Usage: $0 [OPTIONS]
--defaults-file=path Read only this configuration file.
--rpm For internal use. This option is used by RPM files
during the MariaDB installation process.
--skip-auth-anonymous-user
Do not install an unprivileged anonymous user.
--skip-name-resolve Use IP addresses rather than hostnames when creating
grant table entries. This option can be useful if
your DNS does not work.
--skip-test-db Don't install a test database.
--srcdir=path The path to the MariaDB source directory. This option
uses the compiled binaries and support files within the
source tree, useful for if you don't want to install
......@@ -168,9 +167,6 @@ parse_arguments()
#
# --windows is a deprecated alias
cross_bootstrap=1 ;;
--skip-auth-anonymous-user)
install_params="$install_params
SET @skip_auth_anonymous=1;" ;;
--auth-root-authentication-method=normal)
auth_root_authentication_method=normal ;;
--auth-root-authentication-method=socket)
......@@ -179,6 +175,7 @@ SET @skip_auth_anonymous=1;" ;;
usage ;;
--auth-root-socket-user=*)
auth_root_socket_user="$(parse_arg "$arg")" ;;
--skip-test-db) skip_test_db=1 ;;
*)
if test -n "$pick_args"
......@@ -353,8 +350,9 @@ create_system_tables="$srcpkgdatadir/mysql_system_tables.sql"
create_system_tables2="$srcpkgdatadir/mysql_performance_tables.sql"
fill_system_tables="$srcpkgdatadir/mysql_system_tables_data.sql"
maria_add_gis_sp="$buildpkgdatadir/maria_add_gis_sp_bootstrap.sql"
mysql_test_db="$buildpkgdatadir/mysql_test_db.sql"
for f in "$fill_help_tables" "$create_system_tables" "$create_system_tables2" "$fill_system_tables" "$maria_add_gis_sp"
for f in "$fill_help_tables" "$create_system_tables" "$create_system_tables2" "$fill_system_tables" "$maria_add_gis_sp" "$mysql_test_db"
do
if test ! -f "$f"
then
......@@ -418,7 +416,7 @@ then
fi
# Create database directories
for dir in "$ldata" "$ldata/mysql" "$ldata/test"
for dir in "$ldata" "$ldata/mysql"
do
if test ! -d "$dir"
then
......@@ -467,20 +465,31 @@ mysqld_install_cmd_line()
--net_buffer_length=16K
}
cat_sql()
{
echo "use mysql;"
case "$auth_root_authentication_method" in
normal)
echo "SET @skip_auth_root_nopasswd=NULL;"
echo "SET @auth_root_socket=NULL;"
;;
socket)
echo "SET @skip_auth_root_nopasswd=1;"
echo "SET @auth_root_socket='$auth_root_socket_user';"
;;
esac
cat "$create_system_tables" "$create_system_tables2" "$fill_system_tables" "$fill_help_tables" "$maria_add_gis_sp"
if test "$skip_test_db" -eq 0
then
cat "$mysql_test_db"
fi
}
# Create the system and help tables by passing them to "mysqld --bootstrap"
s_echo "Installing MariaDB/MySQL system tables in '$ldata' ..."
case "$auth_root_authentication_method" in
normal)
install_params="$install_params
SET @skip_auth_root_nopasswd=NULL;
SET @auth_root_socket=NULL;" ;;
socket)
install_params="$install_params
SET @skip_auth_root_nopasswd=1;
SET @auth_root_socket='$auth_root_socket_user';" ;;
esac
if { echo "use mysql;$install_params"; cat "$create_system_tables" "$create_system_tables2" "$fill_system_tables" "$fill_help_tables" "$maria_add_gis_sp"; } | eval "$filter_cmd_line" | mysqld_install_cmd_line > /dev/null
if cat_sql | eval "$filter_cmd_line" | mysqld_install_cmd_line > /dev/null
then
s_echo "OK"
else
......
......@@ -26,21 +26,10 @@
-- a plain character
SELECT LOWER( REPLACE((SELECT REPLACE(@@hostname,'_','\_')),'%','\%') )INTO @current_hostname;
-- Fill "db" table with default grants for anyone to
-- access database 'test' and 'test_%' if "db" table didn't exist
CREATE TEMPORARY TABLE tmp_db LIKE db;
INSERT INTO tmp_db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y','Y');
INSERT INTO tmp_db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y','Y');
INSERT INTO db SELECT * FROM tmp_db WHERE @had_db_table=0;
DROP TABLE tmp_db;
-- Fill "user" table with default users allowing root access
-- from local machine if "user" table didn't exist before
CREATE TEMPORARY TABLE tmp_user_nopasswd LIKE user;
CREATE TEMPORARY TABLE tmp_user_socket LIKE user;
CREATE TEMPORARY TABLE tmp_user_anonymous LIKE user;
-- Classic passwordless root account.
INSERT INTO tmp_user_nopasswd VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N', 'N','', 0);
REPLACE INTO tmp_user_nopasswd SELECT @current_hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N','N','',0 FROM dual WHERE @current_hostname != 'localhost';
......@@ -48,14 +37,10 @@ REPLACE INTO tmp_user_nopasswd VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y'
REPLACE INTO tmp_user_nopasswd VALUES ('::1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N','N', '', 0);
-- More secure root account using unix sucket auth.
INSERT INTO tmp_user_socket VALUES ('localhost',IFNULL(@auth_root_socket, 'root'),'','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'unix_socket','','N', 'N','', 0);
-- Anonymous user with no privileges.
INSERT INTO tmp_user_anonymous (host,user) VALUES ('localhost','');
INSERT INTO tmp_user_anonymous (host,user) SELECT @current_hostname,'' FROM dual WHERE @current_hostname != 'localhost';
INSERT INTO user SELECT * FROM tmp_user_nopasswd WHERE @had_user_table=0 AND @skip_auth_root_nopasswd IS NULL;
INSERT INTO user SELECT * FROM tmp_user_socket WHERE @had_user_table=0 AND @auth_root_socket IS NOT NULL;
INSERT INTO user SELECT * FROM tmp_user_anonymous WHERE @had_user_table=0 AND @skip_auth_anonymous IS NULL;
DROP TABLE tmp_user_nopasswd, tmp_user_socket, tmp_user_anonymous;
DROP TABLE tmp_user_nopasswd, tmp_user_socket;
CREATE TEMPORARY TABLE tmp_proxies_priv LIKE proxies_priv;
INSERT INTO tmp_proxies_priv VALUES ('localhost', 'root', '', '', TRUE, '', now());
......
-- Copyright (c) 2018 MariaDB Foundation
--
-- 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 Foundation; version 2 of the License.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
CREATE DATABASE IF NOT EXISTS test CHARACTER SET latin1 COLLATE latin1_swedish_ci;
-- Fill "db" table with default grants for anyone to
-- access database 'test' and 'test_%' if "db" table didn't exist
CREATE TEMPORARY TABLE tmp_db LIKE db;
INSERT INTO tmp_db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y','Y');
INSERT INTO tmp_db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y','Y');
INSERT INTO db SELECT * FROM tmp_db WHERE @had_db_table=0;
DROP TABLE tmp_db;
-- Anonymous user with no privileges.
CREATE TEMPORARY TABLE tmp_user_anonymous LIKE user;
INSERT INTO tmp_user_anonymous (host,user) VALUES ('localhost','');
INSERT INTO tmp_user_anonymous (host,user) SELECT @current_hostname,'' FROM dual WHERE @current_hostname != 'localhost';
INSERT INTO user SELECT * FROM tmp_user_anonymous WHERE @had_user_table=0;
DROP TABLE tmp_user_anonymous;
......@@ -469,12 +469,13 @@ IF(WIN32)
ADD_CUSTOM_COMMAND(OUTPUT
${my_bootstrap_sql}
COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_SOURCE_DIR}/scripts
cmd /c copy mysql_system_tables.sql+mysql_system_tables_data.sql+fill_help_tables.sql+mysql_performance_tables.sql ${native_outfile}
cmd /c copy mysql_system_tables.sql+mysql_system_tables_data.sql+fill_help_tables.sql+mysql_performance_tables.sql+mysql_test_db.sql ${native_outfile}
DEPENDS
${CMAKE_SOURCE_DIR}/scripts/mysql_system_tables.sql
${CMAKE_SOURCE_DIR}/scripts/mysql_system_tables_data.sql
${CMAKE_SOURCE_DIR}/scripts/fill_help_tables.sql
${CMAKE_SOURCE_DIR}/scripts/mysql_performance_tables.sql
${CMAKE_SOURCE_DIR}/scripts/mysql_test_db.sql
)
ADD_CUSTOM_COMMAND(
......
......@@ -545,7 +545,6 @@ static int create_db_instance()
}
CreateDirectory("mysql",NULL);
CreateDirectory("test", NULL);
/*
Set data directory permissions for both current user and
......
......@@ -26,7 +26,7 @@ fname VARCHAR(256) NOT NULL,
ftype CHAR(4) NOT NULL,
size DOUBLE(12,0) NOT NULL flag=5
) ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*.*';
SELECT fname, ftype, size FROM t1 WHERE size>0;
SELECT fname, ftype, size FROM t1 WHERE size>0 AND ftype!='.opt';
fname ftype size
t1 .frm 1081
connection user;
......
......@@ -28,7 +28,7 @@ CREATE TABLE t1 (
) ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*.*';
# "size>0" to skip directory names on Windows
--replace_result $MYSQLD_DATADIR DATADIR/
SELECT fname, ftype, size FROM t1 WHERE size>0;
SELECT fname, ftype, size FROM t1 WHERE size>0 AND ftype!='.opt';
--connection user
SELECT user();
......
......@@ -6,6 +6,7 @@ CREATE DATABASE new_db;
CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY NOT NULL) ENGINE=tokudb;
ALTER TABLE test.t1 RENAME new_db.t1;
The content of "test" directory:
db.opt
The content of "new_db" directory:
db.opt
t1.frm
......
......@@ -58,6 +58,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=TokuDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0
PARTITION BY RANGE (`a`)
(PARTITION `p0` VALUES LESS THAN MAXVALUE ENGINE = TokuDB)
db.opt
t1.frm
t1.par
SET DEBUG_SYNC='before_open_in_get_all_tables SIGNAL parked WAIT_FOR open';
......@@ -83,6 +84,7 @@ connection default;
TABLE_SCHEMA TABLE_NAME PARTITION_NAME PARTITION_ORDINAL_POSITION PARTITION_DESCRIPTION TABLE_ROWS
test t1 p0 1 10 1
test t1 p10 2 MAXVALUE 3
db.opt
t1.frm
t1.par
SHOW CREATE TABLE t1;
......@@ -100,4 +102,5 @@ a
21
33
drop table t1;
db.opt
SET DEBUG_SYNC = 'RESET';
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