summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/bdb_notembedded.result35
-rw-r--r--mysql-test/r/symlink.result8
-rw-r--r--mysql-test/t/bdb_notembedded.test38
-rw-r--r--mysql-test/t/symlink.test12
-rw-r--r--sql/sql_parse.cc10
-rw-r--r--sql/sql_table.cc12
6 files changed, 105 insertions, 10 deletions
diff --git a/mysql-test/r/bdb_notembedded.result b/mysql-test/r/bdb_notembedded.result
new file mode 100644
index 00000000000..14cb5fad915
--- /dev/null
+++ b/mysql-test/r/bdb_notembedded.result
@@ -0,0 +1,35 @@
+set autocommit=1;
+reset master;
+create table bug16206 (a int);
+insert into bug16206 values(1);
+start transaction;
+insert into bug16206 values(2);
+commit;
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4
+f n Query 1 n use `test`; create table bug16206 (a int)
+f n Query 1 n use `test`; insert into bug16206 values(1)
+f n Query 1 n use `test`; insert into bug16206 values(2)
+drop table bug16206;
+reset master;
+create table bug16206 (a int) engine= bdb;
+insert into bug16206 values(0);
+insert into bug16206 values(1);
+start transaction;
+insert into bug16206 values(2);
+commit;
+insert into bug16206 values(3);
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4
+f n Query 1 n use `test`; create table bug16206 (a int) engine= bdb
+f n Query 1 n use `test`; insert into bug16206 values(0)
+f n Query 1 n use `test`; insert into bug16206 values(1)
+f n Query 1 n use `test`; BEGIN
+f n Query 1 n use `test`; insert into bug16206 values(2)
+f n Query 1 n use `test`; COMMIT
+f n Query 1 n use `test`; insert into bug16206 values(3)
+drop table bug16206;
+set autocommit=0;
+End of 5.0 tests
diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result
index 4eece9d5b5a..7599d80588a 100644
--- a/mysql-test/r/symlink.result
+++ b/mysql-test/r/symlink.result
@@ -162,3 +162,11 @@ DROP DATABASE db1;
DROP DATABASE db2;
USE test;
End of 5.0 tests
+SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='NO_DIR_IN_CREATE';
+CREATE TABLE t1(a INT) DATA DIRECTORY='MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY='MYSQLTEST_VARDIR/tmp';
+Warnings:
+Warning 0 DATA DIRECTORY option ignored
+Warning 0 INDEX DIRECTORY option ignored
+DROP TABLE t1;
+SET @@SQL_MODE=@OLD_SQL_MODE;
+End of 5.1 tests
diff --git a/mysql-test/t/bdb_notembedded.test b/mysql-test/t/bdb_notembedded.test
new file mode 100644
index 00000000000..24e64ebbfb2
--- /dev/null
+++ b/mysql-test/t/bdb_notembedded.test
@@ -0,0 +1,38 @@
+-- source include/not_embedded.inc
+-- source include/have_bdb.inc
+
+#
+# Bug #16206: Superfluous COMMIT event in binlog when updating BDB in autocommit mode
+#
+set autocommit=1;
+
+let $VERSION=`select version()`;
+
+reset master;
+create table bug16206 (a int);
+insert into bug16206 values(1);
+start transaction;
+insert into bug16206 values(2);
+commit;
+--replace_result $VERSION VERSION
+--replace_column 1 f 2 n 5 n
+show binlog events;
+drop table bug16206;
+
+reset master;
+create table bug16206 (a int) engine= bdb;
+insert into bug16206 values(0);
+insert into bug16206 values(1);
+start transaction;
+insert into bug16206 values(2);
+commit;
+insert into bug16206 values(3);
+--replace_result $VERSION VERSION
+--replace_column 1 f 2 n 5 n
+show binlog events;
+drop table bug16206;
+
+set autocommit=0;
+
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test
index f339b29c83a..eaad45d7d5d 100644
--- a/mysql-test/t/symlink.test
+++ b/mysql-test/t/symlink.test
@@ -226,3 +226,15 @@ USE test;
--echo End of 5.0 tests
+
+#
+# BUG#25677 - With --skip-symbolic-links option on, DATA DIRECTORY clause is
+# silently ignored
+#
+SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='NO_DIR_IN_CREATE';
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval CREATE TABLE t1(a INT) DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY='$MYSQLTEST_VARDIR/tmp';
+DROP TABLE t1;
+SET @@SQL_MODE=@OLD_SQL_MODE;
+
+--echo End of 5.1 tests
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 8ed658df90d..e5f96a96a00 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2237,15 +2237,7 @@ mysql_execute_command(THD *thd)
/* Might have been updated in create_table_precheck */
create_info.alias= create_table->alias;
-#ifndef HAVE_READLINK
- if (create_info.data_file_name)
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
- "DATA DIRECTORY option ignored");
- if (create_info.index_file_name)
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
- "INDEX DIRECTORY option ignored");
- create_info.data_file_name= create_info.index_file_name= NULL;
-#else
+#ifdef HAVE_READLINK
/* Fix names if symlinked tables */
if (append_file_to_dir(thd, &create_info.data_file_name,
create_table->table_name) ||
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 91acd8d20a3..4236028c9d8 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -3437,8 +3437,18 @@ bool mysql_create_table_no_lock(THD *thd,
thd->proc_info="creating table";
create_info->table_existed= 0; // Mark that table is created
- if (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE)
+#ifdef HAVE_READLINK
+ if (!my_use_symdir || (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE))
+#endif
+ {
+ if (create_info->data_file_name)
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
+ "DATA DIRECTORY option ignored");
+ if (create_info->index_file_name)
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
+ "INDEX DIRECTORY option ignored");
create_info->data_file_name= create_info->index_file_name= 0;
+ }
create_info->table_options=db_options;
path[path_length - reg_ext_length]= '\0'; // Remove .frm extension