Commit 5fb96884 authored by msvensson@pilot.mysql.com's avatar msvensson@pilot.mysql.com

Merge pilot.mysql.com:/data/msvensson/mysql/bug31004/my50-bug31004

into  pilot.mysql.com:/data/msvensson/mysql/bug31004/my51-bug31004
parents d3293988 53bc1d5c
...@@ -32,7 +32,8 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ...@@ -32,7 +32,8 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc ../mysys/my_conio.c) ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc ../mysys/my_conio.c)
TARGET_LINK_LIBRARIES(mysql mysqlclient_notls wsock32) TARGET_LINK_LIBRARIES(mysql mysqlclient_notls wsock32)
ADD_EXECUTABLE(mysqltest mysqltest.c ../mysys/my_getsystime.c ../mysys/my_copy.c) ADD_EXECUTABLE(mysqltest mysqltest.c ../mysys/my_getsystime.c
../mysys/my_copy.c ../mysys/my_mkdir.c)
TARGET_LINK_LIBRARIES(mysqltest mysqlclient_notls regex wsock32) TARGET_LINK_LIBRARIES(mysqltest mysqlclient_notls regex wsock32)
ADD_EXECUTABLE(mysqlcheck mysqlcheck.c) ADD_EXECUTABLE(mysqlcheck mysqlcheck.c)
......
...@@ -88,7 +88,8 @@ mysqlslap_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \ ...@@ -88,7 +88,8 @@ mysqlslap_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
mysqltest_SOURCES= mysqltest.c \ mysqltest_SOURCES= mysqltest.c \
$(top_srcdir)/mysys/my_getsystime.c \ $(top_srcdir)/mysys/my_getsystime.c \
$(top_srcdir)/mysys/my_copy.c $(top_srcdir)/mysys/my_copy.c \
$(top_srcdir)/mysys/my_mkdir.c
mysqltest_LDADD = $(top_builddir)/regex/libregex.a $(LDADD) mysqltest_LDADD = $(top_builddir)/regex/libregex.a $(LDADD)
mysql_upgrade_SOURCES= mysql_upgrade.c \ mysql_upgrade_SOURCES= mysql_upgrade.c \
......
...@@ -263,7 +263,7 @@ enum enum_commands { ...@@ -263,7 +263,7 @@ enum enum_commands {
Q_REPLACE_REGEX, Q_REMOVE_FILE, Q_FILE_EXIST, Q_REPLACE_REGEX, Q_REMOVE_FILE, Q_FILE_EXIST,
Q_WRITE_FILE, Q_COPY_FILE, Q_PERL, Q_DIE, Q_EXIT, Q_SKIP, Q_WRITE_FILE, Q_COPY_FILE, Q_PERL, Q_DIE, Q_EXIT, Q_SKIP,
Q_CHMOD_FILE, Q_APPEND_FILE, Q_CAT_FILE, Q_DIFF_FILES, Q_CHMOD_FILE, Q_APPEND_FILE, Q_CAT_FILE, Q_DIFF_FILES,
Q_SEND_QUIT, Q_CHANGE_USER, Q_SEND_QUIT, Q_CHANGE_USER, Q_MKDIR, Q_RMDIR,
Q_UNKNOWN, /* Unknown command. */ Q_UNKNOWN, /* Unknown command. */
Q_COMMENT, /* Comments, ignored. */ Q_COMMENT, /* Comments, ignored. */
...@@ -353,6 +353,9 @@ const char *command_names[]= ...@@ -353,6 +353,9 @@ const char *command_names[]=
"diff_files", "diff_files",
"send_quit", "send_quit",
"change_user", "change_user",
"mkdir",
"rmdir",
0 0
}; };
...@@ -2736,6 +2739,67 @@ void do_file_exist(struct st_command *command) ...@@ -2736,6 +2739,67 @@ void do_file_exist(struct st_command *command)
} }
/*
SYNOPSIS
do_mkdir
command called command
DESCRIPTION
mkdir <dir_name>
Create the directory <dir_name>
*/
void do_mkdir(struct st_command *command)
{
int error;
static DYNAMIC_STRING ds_dirname;
const struct command_arg mkdir_args[] = {
"dirname", ARG_STRING, TRUE, &ds_dirname, "Directory to create"
};
DBUG_ENTER("do_mkdir");
check_command_args(command, command->first_argument,
mkdir_args, sizeof(mkdir_args)/sizeof(struct command_arg),
' ');
DBUG_PRINT("info", ("creating directory: %s", ds_dirname.str));
error= my_mkdir(ds_dirname.str, 0777, MYF(0)) != 0;
handle_command_error(command, error);
dynstr_free(&ds_dirname);
DBUG_VOID_RETURN;
}
/*
SYNOPSIS
do_rmdir
command called command
DESCRIPTION
rmdir <dir_name>
Remove the empty directory <dir_name>
*/
void do_rmdir(struct st_command *command)
{
int error;
static DYNAMIC_STRING ds_dirname;
const struct command_arg rmdir_args[] = {
"dirname", ARG_STRING, TRUE, &ds_dirname, "Directory to remove"
};
DBUG_ENTER("do_rmdir");
check_command_args(command, command->first_argument,
rmdir_args, sizeof(rmdir_args)/sizeof(struct command_arg),
' ');
DBUG_PRINT("info", ("removing directory: %s", ds_dirname.str));
error= rmdir(ds_dirname.str) != 0;
handle_command_error(command, error);
dynstr_free(&ds_dirname);
DBUG_VOID_RETURN;
}
/* /*
Read characters from line buffer or file. This is needed to allow Read characters from line buffer or file. This is needed to allow
my_ungetc() to buffer MAX_DELIMITER_LENGTH characters for a file my_ungetc() to buffer MAX_DELIMITER_LENGTH characters for a file
...@@ -6913,6 +6977,8 @@ int main(int argc, char **argv) ...@@ -6913,6 +6977,8 @@ int main(int argc, char **argv)
case Q_ECHO: do_echo(command); command_executed++; break; case Q_ECHO: do_echo(command); command_executed++; break;
case Q_SYSTEM: do_system(command); break; case Q_SYSTEM: do_system(command); break;
case Q_REMOVE_FILE: do_remove_file(command); break; case Q_REMOVE_FILE: do_remove_file(command); break;
case Q_MKDIR: do_mkdir(command); break;
case Q_RMDIR: do_rmdir(command); break;
case Q_FILE_EXIST: do_file_exist(command); break; case Q_FILE_EXIST: do_file_exist(command); break;
case Q_WRITE_FILE: do_write_file(command); break; case Q_WRITE_FILE: do_write_file(command); break;
case Q_APPEND_FILE: do_append_file(command); break; case Q_APPEND_FILE: do_append_file(command); break;
......
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
-- 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
...@@ -2101,5 +2101,28 @@ drop table t1; ...@@ -2101,5 +2101,28 @@ drop table t1;
--change_user root,, --change_user root,,
--change_user root,,test --change_user root,,test
# ----------------------------------------------------------------------------
# Test mkdir and rmdir command
# ----------------------------------------------------------------------------
mkdir $MYSQLTEST_VARDIR/tmp/testdir;
rmdir $MYSQLTEST_VARDIR/tmp/testdir;
# Directory already exist
mkdir $MYSQLTEST_VARDIR/tmp/testdir;
--error 1
mkdir $MYSQLTEST_VARDIR/tmp/testdir;
# Remove dir with file inside
write_file $MYSQLTEST_VARDIR/tmp/testdir/file1.txt;
hello
EOF
--error 1
rmdir $MYSQLTEST_VARDIR/tmp/testdir;
remove_file $MYSQLTEST_VARDIR/tmp/testdir/file1.txt;
rmdir $MYSQLTEST_VARDIR/tmp/testdir;
--echo End of tests --echo End of tests
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