From 2b9042096db3a2fbe94792514567ebb922c30c57 Mon Sep 17 00:00:00 2001 From: BohuTANG Date: Fri, 18 Sep 2015 10:23:13 +0800 Subject: [PATCH] DB-883 tokudb broken after 'create database log002015' [summary] tokudb_log_dir can't contain directory which named as 'log[0-9]' . By default, if we 'create database log02015', TokuDB will crash in the next time to restart. Copyright (c) 2015, BohuTANG All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --- .../tokudb_logger_find_logfiles_crash.result | 10 +++++++ .../t/tokudb_logger_find_logfiles_crash.test | 29 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 mysql-test/suite/tokudb/r/tokudb_logger_find_logfiles_crash.result create mode 100644 mysql-test/suite/tokudb/t/tokudb_logger_find_logfiles_crash.test diff --git a/mysql-test/suite/tokudb/r/tokudb_logger_find_logfiles_crash.result b/mysql-test/suite/tokudb/r/tokudb_logger_find_logfiles_crash.result new file mode 100644 index 00000000..37fcc20e --- /dev/null +++ b/mysql-test/suite/tokudb/r/tokudb_logger_find_logfiles_crash.result @@ -0,0 +1,10 @@ +CREATE DATABASE log0002; +USE log0002; +CREATE TABLE t1(a int) ENGINE=TOKUDB; +INSERT INTO t1 VALUES(1); +shutdown server +USE log0002; +SELECT * FROM t1; +a +1 +DROP DATABASE log0002; diff --git a/mysql-test/suite/tokudb/t/tokudb_logger_find_logfiles_crash.test b/mysql-test/suite/tokudb/t/tokudb_logger_find_logfiles_crash.test new file mode 100644 index 00000000..e7fc7e91 --- /dev/null +++ b/mysql-test/suite/tokudb/t/tokudb_logger_find_logfiles_crash.test @@ -0,0 +1,29 @@ +--source include/have_tokudb.inc +--let $_mysqld_datadir= `SELECT @@datadir` + +# create log0001 file +--exec touch $_mysqld_datadir/log0001 + +CREATE DATABASE log0002; +USE log0002; +CREATE TABLE t1(a int) ENGINE=TOKUDB; +INSERT INTO t1 VALUES(1); + +--echo shutdown server +--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--shutdown_server 10 +--source include/wait_until_disconnected.inc +# Do something while server is down +--enable_reconnect +--exec echo "restart: --tokudb_cache_size=100M" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--source include/wait_until_connected_again.inc + +--exec ls $_mysqld_datadir/log* |grep -q log0001 +--exec ls $_mysqld_datadir/log* |grep -q log0002 + +USE log0002; +SELECT * FROM t1; + +DROP DATABASE log0002; + +--exec rm $_mysqld_datadir/log0001