Commit 9252656d authored by monty@mysql.com's avatar monty@mysql.com

merge with 4.0

parents bfe2917f 2ad7d5c6
...@@ -195,6 +195,7 @@ tim@bitch.mysql.fi ...@@ -195,6 +195,7 @@ tim@bitch.mysql.fi
tim@black.box tim@black.box
tim@hundin.mysql.fi tim@hundin.mysql.fi
tim@sand.box tim@sand.box
tim@siva.hindu.god
tim@threads.polyesthetic.msg tim@threads.polyesthetic.msg
tim@white.box tim@white.box
tim@work.mysql.com tim@work.mysql.com
......
...@@ -288,6 +288,10 @@ unless ($opt_skip_manual) ...@@ -288,6 +288,10 @@ unless ($opt_skip_manual)
system ("bk cat $opt_docdir/Docs/$file.texi > $target_dir/Docs/$file.texi") == 0 system ("bk cat $opt_docdir/Docs/$file.texi > $target_dir/Docs/$file.texi") == 0
or &abort("Could not update $file.texi in $target_dir/Docs/!"); or &abort("Could not update $file.texi in $target_dir/Docs/!");
} }
system ("rm -f $target_dir/Docs/Images/Makefile*") == 0
or &abort("Could not remove Makefiles in $target_dir/Docs/Images/!");
system ("cp $opt_docdir/Docs/Images/*.* $target_dir/Docs/Images") == 0
or &abort("Could not copy image files in $target_dir/Docs/Images/!");
} }
# #
......
...@@ -24,6 +24,8 @@ BUILT_SOURCES = $(targets) manual_toc.html include.texi ...@@ -24,6 +24,8 @@ BUILT_SOURCES = $(targets) manual_toc.html include.texi
EXTRA_DIST = $(noinst_SCRIPTS) $(BUILT_SOURCES) mysqld_error.txt \ EXTRA_DIST = $(noinst_SCRIPTS) $(BUILT_SOURCES) mysqld_error.txt \
INSTALL-BINARY reservedwords.texi internals.texi INSTALL-BINARY reservedwords.texi internals.texi
SUBDIRS = Images
all: $(targets) txt_files all: $(targets) txt_files
txt_files: ../INSTALL-SOURCE ../COPYING ../INSTALL-WIN-SOURCE ../EXCEPTIONS-CLIENT \ txt_files: ../INSTALL-SOURCE ../COPYING ../INSTALL-WIN-SOURCE ../EXCEPTIONS-CLIENT \
......
...@@ -259,19 +259,6 @@ static struct my_option my_long_options[] = ...@@ -259,19 +259,6 @@ static struct my_option my_long_options[] =
"Wrap tables with autocommit/commit statements.", "Wrap tables with autocommit/commit statements.",
(gptr*) &opt_autocommit, (gptr*) &opt_autocommit, 0, GET_BOOL, NO_ARG, (gptr*) &opt_autocommit, (gptr*) &opt_autocommit, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0},
/*
Note that the combination --single-transaction --master-data
will give bullet-proof binlog position only if server >=4.1.3. That's the
old "FLUSH TABLES WITH READ LOCK does not block commit" fixed bug.
*/
{"single-transaction", OPT_TRANSACTION,
"Creates a consistent snapshot by dumping all tables in a single "
"transaction. Works ONLY for tables stored in storage engines which "
"support multiversioning (currently only InnoDB does); the dump is NOT "
"guaranteed to be consistent for other storage engines. Option "
"automatically turns off --lock-tables.",
(gptr*) &opt_single_transaction, (gptr*) &opt_single_transaction, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"no-create-db", 'n', {"no-create-db", 'n',
"'CREATE DATABASE /*!32312 IF NOT EXISTS*/ db_name;' will not be put in the output. The above line will be added otherwise, if --databases or --all-databases option was given.}.", "'CREATE DATABASE /*!32312 IF NOT EXISTS*/ db_name;' will not be put in the output. The above line will be added otherwise, if --databases or --all-databases option was given.}.",
(gptr*) &opt_create_db, (gptr*) &opt_create_db, 0, GET_BOOL, NO_ARG, 0, 0, (gptr*) &opt_create_db, (gptr*) &opt_create_db, 0, GET_BOOL, NO_ARG, 0, 0,
...@@ -283,13 +270,6 @@ static struct my_option my_long_options[] = ...@@ -283,13 +270,6 @@ static struct my_option my_long_options[] =
{"no-set-names", 'N', {"no-set-names", 'N',
"Deprecated. Use --skip-set-charset instead.", "Deprecated. Use --skip-set-charset instead.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"set-charset", OPT_SET_CHARSET,
"Add 'SET NAMES default_character_set' to the output. Enabled by default; suppress with --skip-set-charset.",
(gptr*) &opt_set_charset, (gptr*) &opt_set_charset, 0, GET_BOOL, NO_ARG, 1,
0, 0, 0, 0, 0},
{"set-variable", 'O',
"Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"opt", OPT_OPTIMIZE, {"opt", OPT_OPTIMIZE,
"Same as --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys. Enabled by default, disable with --skip-opt.", "Same as --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys. Enabled by default, disable with --skip-opt.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
...@@ -313,11 +293,31 @@ static struct my_option my_long_options[] = ...@@ -313,11 +293,31 @@ static struct my_option my_long_options[] =
{"result-file", 'r', {"result-file", 'r',
"Direct output to a given file. This option should be used in MSDOS, because it prevents new line '\\n' from being converted to '\\r\\n' (carriage return + line feed).", "Direct output to a given file. This option should be used in MSDOS, because it prevents new line '\\n' from being converted to '\\r\\n' (carriage return + line feed).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"set-charset", OPT_SET_CHARSET,
"Add 'SET NAMES default_character_set' to the output. Enabled by default; suppress with --skip-set-charset.",
(gptr*) &opt_set_charset, (gptr*) &opt_set_charset, 0, GET_BOOL, NO_ARG, 1,
0, 0, 0, 0, 0},
{"set-variable", 'O',
"Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM #ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME, {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
"Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name, "Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif #endif
/*
Note that the combination --single-transaction --master-data
will give bullet-proof binlog position only if server >=4.1.3. That's the
old "FLUSH TABLES WITH READ LOCK does not block commit" fixed bug.
*/
{"single-transaction", OPT_TRANSACTION,
"Creates a consistent snapshot by dumping all tables in a single "
"transaction. Works ONLY for tables stored in storage engines which "
"support multiversioning (currently only InnoDB does); the dump is NOT "
"guaranteed to be consistent for other storage engines. Option "
"automatically turns off --lock-tables.",
(gptr*) &opt_single_transaction, (gptr*) &opt_single_transaction, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-opt", OPT_SKIP_OPTIMIZATION, {"skip-opt", OPT_SKIP_OPTIMIZATION,
"Disable --opt. Disables --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys.", "Disable --opt. Disables --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
...@@ -1677,16 +1677,13 @@ static void dumpTable(uint numFields, char *table) ...@@ -1677,16 +1677,13 @@ static void dumpTable(uint numFields, char *table)
fputs("</field>\n", md_result_file); fputs("</field>\n", md_result_file);
} }
else if (opt_hex_blob && is_blob) else if (opt_hex_blob && is_blob)
{ /* sakaik got this idea. */ {
/* sakaik got the idea to to provide blob's in hex notation. */
ulong counter; ulong counter;
char xx[4]; unsigned char *ptr= row[i], *end= ptr+ lengths[i];
unsigned char *ptr= row[i];
fputs("0x", md_result_file); fputs("0x", md_result_file);
for (counter = 0; counter < lengths[i]; counter++) for (; ptr < end ; ptr++)
{ fprintf(md_result_file, "%02X", *ptr);
sprintf(xx, "%02X", ptr[counter]);
fputs(xx, md_result_file);
}
} }
else else
unescape(md_result_file, row[i], lengths[i]); unescape(md_result_file, row[i], lengths[i]);
......
...@@ -480,7 +480,7 @@ if $PS p $$ 2> /dev/null | grep $0 > /dev/null ...@@ -480,7 +480,7 @@ if $PS p $$ 2> /dev/null | grep $0 > /dev/null
then then
FIND_PROC="$PS p \$\$PID | grep mysqld > /dev/null" FIND_PROC="$PS p \$\$PID | grep mysqld > /dev/null"
# Solaris # Solaris
elif $PS -p $$ 2> /dev/null | grep $0 > /dev/null elif $PS -fp $$ 2> /dev/null | grep $0 > /dev/null
then then
FIND_PROC="$PS -p \$\$PID | grep mysqld > /dev/null" FIND_PROC="$PS -p \$\$PID | grep mysqld > /dev/null"
# BSD style # BSD style
...@@ -3149,7 +3149,7 @@ AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl ...@@ -3149,7 +3149,7 @@ AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
sql-common/Makefile SSL/Makefile dnl sql-common/Makefile SSL/Makefile dnl
dbug/Makefile scripts/Makefile dnl dbug/Makefile scripts/Makefile dnl
include/Makefile sql-bench/Makefile tools/Makefile dnl include/Makefile sql-bench/Makefile tools/Makefile dnl
tests/Makefile Docs/Makefile support-files/Makefile dnl tests/Makefile Docs/Makefile Docs/Images/Makefile support-files/Makefile dnl
support-files/MacOSX/Makefile mysql-test/Makefile dnl support-files/MacOSX/Makefile mysql-test/Makefile dnl
netware/Makefile dnl netware/Makefile dnl
include/mysql_version.h dnl include/mysql_version.h dnl
......
...@@ -2266,8 +2266,8 @@ dict_foreign_add_to_cache( ...@@ -2266,8 +2266,8 @@ dict_foreign_add_to_cache(
/************************************************************************* /*************************************************************************
Scans from pointer onwards. Stops if is at the start of a copy of Scans from pointer onwards. Stops if is at the start of a copy of
'string' where characters are compared without case sensitivity. Stops 'string' where characters are compared without case sensitivity, and
also at '\0'. */ only outside `` or "" quotes. Stops also at '\0'. */
const char* const char*
dict_scan_to( dict_scan_to(
...@@ -2276,31 +2276,34 @@ dict_scan_to( ...@@ -2276,31 +2276,34 @@ dict_scan_to(
const char* ptr, /* in: scan from */ const char* ptr, /* in: scan from */
const char* string) /* in: look for this */ const char* string) /* in: look for this */
{ {
ibool success; char quote = '\0';
ulint i;
loop:
if (*ptr == '\0') {
return(ptr);
}
success = TRUE;
for (i = 0; i < ut_strlen(string); i++) {
if (toupper((ulint)(ptr[i])) != toupper((ulint)(string[i]))) {
success = FALSE;
for (; *ptr; ptr++) {
if (*ptr == quote) {
/* Closing quote character: do not look for
starting quote or the keyword. */
quote = '\0';
} else if (quote) {
/* Within quotes: do nothing. */
} else if (*ptr == '`' || *ptr == '"') {
/* Starting quote: remember the quote character. */
quote = *ptr;
} else {
/* Outside quotes: look for the keyword. */
ulint i;
for (i = 0; string[i]; i++) {
if (toupper((ulint)(ptr[i]))
!= toupper((ulint)(string[i]))) {
goto nomatch;
}
}
break; break;
nomatch:
;
} }
} }
if (success) { return(ptr);
return(ptr);
}
ptr++;
goto loop;
} }
/************************************************************************* /*************************************************************************
...@@ -2877,13 +2880,13 @@ dict_create_foreign_constraints_low( ...@@ -2877,13 +2880,13 @@ dict_create_foreign_constraints_low(
ut_a(success); ut_a(success);
if (!isspace(*ptr)) { if (!isspace(*ptr) && *ptr != '"' && *ptr != '`') {
goto loop; goto loop;
} }
do { while (isspace(*ptr)) {
ptr++; ptr++;
} while (isspace(*ptr)); }
/* read constraint name unless got "CONSTRAINT FOREIGN" */ /* read constraint name unless got "CONSTRAINT FOREIGN" */
if (ptr != ptr2) { if (ptr != ptr2) {
......
...@@ -30,7 +30,7 @@ include $(srcdir)/Makefile.shared ...@@ -30,7 +30,7 @@ include $(srcdir)/Makefile.shared
libmysqlclient_la_SOURCES = $(target_sources) libmysqlclient_la_SOURCES = $(target_sources)
libmysqlclient_la_LIBADD = $(target_libadd) libmysqlclient_la_LIBADD = $(target_libadd)
libmysqlclient_la_LDFLAGS = $(target_ldflags) libmysqlclient_la_LDFLAGS = $(target_ldflags)
EXTRA_DIST = Makefile.shared EXTRA_DIST = Makefile.shared libmysql.def
noinst_HEADERS = client_settings.h noinst_HEADERS = client_settings.h
# This is called from the toplevel makefile # This is called from the toplevel makefile
......
...@@ -48,6 +48,7 @@ dist-hook: ...@@ -48,6 +48,7 @@ dist-hook:
$(INSTALL_DATA) $(srcdir)/t/*.test $(srcdir)/t/*.opt $(srcdir)/t/*.sh $(srcdir)/t/*.slave-mi $(distdir)/t $(INSTALL_DATA) $(srcdir)/t/*.test $(srcdir)/t/*.opt $(srcdir)/t/*.sh $(srcdir)/t/*.slave-mi $(distdir)/t
$(INSTALL_DATA) $(srcdir)/include/*.inc $(distdir)/include $(INSTALL_DATA) $(srcdir)/include/*.inc $(distdir)/include
$(INSTALL_DATA) $(srcdir)/r/*.result $(srcdir)/r/*.require $(distdir)/r $(INSTALL_DATA) $(srcdir)/r/*.result $(srcdir)/r/*.require $(distdir)/r
$(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.dat $(srcdir)/std_data/*.000001 $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.dat $(srcdir)/std_data/*.000001 $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.pem $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.pem $(distdir)/std_data
...@@ -70,6 +71,7 @@ install-data-local: ...@@ -70,6 +71,7 @@ install-data-local:
$(INSTALL_DATA) $(srcdir)/std_data/*.dat $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.dat $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.*001 $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.*001 $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.pem $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.pem $(DESTDIR)$(testdir)/std_data
std_data/%.pem: std_data/%.pem:
......
...@@ -248,6 +248,12 @@ GRANT SELECT ON `ab%`.* TO 'test11'@'localhost' ...@@ -248,6 +248,12 @@ GRANT SELECT ON `ab%`.* TO 'test11'@'localhost'
GRANT SELECT ON `a%`.* TO 'test11'@'localhost' GRANT SELECT ON `a%`.* TO 'test11'@'localhost'
delete from mysql.user where user='test11'; delete from mysql.user where user='test11';
delete from mysql.db where user='test11'; delete from mysql.db where user='test11';
create database db6123;
grant usage on db6123.* to test6123 identified by 'magic123';
select host,db,user,select_priv,insert_priv from mysql.db where db="db6123";
host db user select_priv insert_priv
delete from mysql.user where user='test6123';
drop database db6123;
USE test; USE test;
CREATE TABLE t1 (a int ); CREATE TABLE t1 (a int );
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
......
from_unixtime(1072904422)
2004-01-01 00:00:00
...@@ -180,4 +180,25 @@ master-bin.000001 79 Query 1 79 use `test`; BEGIN ...@@ -180,4 +180,25 @@ master-bin.000001 79 Query 1 79 use `test`; BEGIN
master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(16) master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(16)
master-bin.000001 179 Query 1 79 use `test`; insert into t1 values(18) master-bin.000001 179 Query 1 79 use `test`; insert into t1 values(18)
master-bin.000001 239 Query 1 239 use `test`; COMMIT master-bin.000001 239 Query 1 239 use `test`; COMMIT
delete from t1;
delete from t2;
alter table t2 type=MyISAM;
insert into t1 values (1);
begin;
select * from t1 for update;
a
1
select (@before:=unix_timestamp())*0;
(@before:=unix_timestamp())*0
0
begin;
select * from t1 for update;
insert into t2 values (20);
Lock wait timeout exceeded; Try restarting transaction
select (@after:=unix_timestamp())*0;
(@after:=unix_timestamp())*0
0
select (@after-@before) >= 2;
(@after-@before) >= 2
1
drop table t1,t2; drop table t1,t2;
drop table if exists t1;
create table t1 (i int, c varchar(20));
insert into t1 values
(unix_timestamp("2004-01-01 00:00:00"), "2004-01-01 00:00:00");
insert into t1 values
(unix_timestamp("2004-03-28 01:59:59"), "2004-03-28 01:59:59"),
(unix_timestamp("2004-03-28 02:30:00"), "2004-03-28 02:30:00"),
(unix_timestamp("2004-03-28 03:00:00"), "2004-03-28 03:00:00");
insert into t1 values
(unix_timestamp('2004-05-01 00:00:00'),'2004-05-01 00:00:00');
insert into t1 values
(unix_timestamp('2004-10-31 01:00:00'),'2004-10-31 01:00:00'),
(unix_timestamp('2004-10-31 02:00:00'),'2004-10-31 02:00:00'),
(unix_timestamp('2004-10-31 02:59:59'),'2004-10-31 02:59:59'),
(unix_timestamp('2004-10-31 04:00:00'),'2004-10-31 04:00:00'),
(unix_timestamp('2004-10-31 02:59:59'),'2004-10-31 02:59:59');
insert into t1 values
(unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'),
(unix_timestamp('1981-07-01 04:00:00'),'1981-07-01 04:00:00');
select i, from_unixtime(i), c from t1;
i from_unixtime(i) c
1072904422 2004-01-01 00:00:00 2004-01-01 00:00:00
1080428421 2004-03-28 01:59:59 2004-03-28 01:59:59
1080428422 2004-03-28 03:00:00 2004-03-28 02:30:00
1080428422 2004-03-28 03:00:00 2004-03-28 03:00:00
1083355222 2004-05-01 00:00:00 2004-05-01 00:00:00
1099170022 2004-10-31 01:00:00 2004-10-31 01:00:00
1099177222 2004-10-31 02:00:00 2004-10-31 02:00:00
1099180821 2004-10-31 02:59:59 2004-10-31 02:59:59
1099184422 2004-10-31 04:00:00 2004-10-31 04:00:00
1099180821 2004-10-31 02:59:59 2004-10-31 02:59:59
362793608 1981-07-01 03:59:59 1981-07-01 03:59:59
362793610 1981-07-01 04:00:00 1981-07-01 04:00:00
drop table t1;
create table t1 (ts timestamp);
insert into t1 values (19730101235900), (20040101235900);
select * from t1;
ts
19730101235900
20040101235900
drop table t1;
...@@ -97,6 +97,30 @@ drop table t1; ...@@ -97,6 +97,30 @@ drop table t1;
GRANT FILE on mysqltest.* to mysqltest_1@localhost; GRANT FILE on mysqltest.* to mysqltest_1@localhost;
select 1; -- To test that the previous command didn't cause problems select 1; -- To test that the previous command didn't cause problems
#
# Bug #4898: User privileges depending on ORDER BY Settings of table db
#
insert into mysql.user (host, user) values ('localhost', 'test11');
insert into mysql.db (host, db, user, select_priv) values
('localhost', 'a%', 'test11', 'Y'), ('localhost', 'ab%', 'test11', 'Y');
alter table mysql.db order by db asc;
flush privileges;
show grants for test11@localhost;
alter table mysql.db order by db desc;
flush privileges;
show grants for test11@localhost;
delete from mysql.user where user='test11';
delete from mysql.db where user='test11';
#
# Bug#6123: GRANT USAGE inserts useless Db row
#
create database mysqltest1;
grant usage on mysqltest1.* to test6123 identified by 'magic123';
select host,db,user,select_priv,insert_priv from mysql.db where db="mysqltest1";
delete from mysql.user where user='test6123';
drop database mysqltest1;
# #
# Test for 'drop user', 'revoke privileges, grant' # Test for 'drop user', 'revoke privileges, grant'
# #
...@@ -174,21 +198,6 @@ REVOKE SELECT ( ...@@ -174,21 +198,6 @@ REVOKE SELECT (
DROP DATABASE ; DROP DATABASE ;
SET NAMES latin1; SET NAMES latin1;
#
# Bug #4898: User privileges depending on ORDER BY Settings of table db
#
insert into mysql.user (host, user) values ('localhost', 'test11');
insert into mysql.db (host, db, user, select_priv) values
('localhost', 'a%', 'test11', 'Y'), ('localhost', 'ab%', 'test11', 'Y');
alter table mysql.db order by db asc;
flush privileges;
show grants for test11@localhost;
alter table mysql.db order by db desc;
flush privileges;
show grants for test11@localhost;
delete from mysql.user where user='test11';
delete from mysql.db where user='test11';
# #
# Bug #5831: REVOKE ALL PRIVILEGES, GRANT OPTION does not revoke everything # Bug #5831: REVOKE ALL PRIVILEGES, GRANT OPTION does not revoke everything
# #
......
--loose-innodb_lock_wait_timeout=2
...@@ -172,4 +172,36 @@ select a from t1 order by a; # check that savepoints work :) ...@@ -172,4 +172,36 @@ select a from t1 order by a; # check that savepoints work :)
show binlog events from 79; show binlog events from 79;
# Test for BUG#5714, where a MyISAM update in the transaction used to
# release row-level locks in InnoDB
connect (con3,localhost,root,,);
connection con3;
delete from t1;
delete from t2;
--disable_warnings
alter table t2 type=MyISAM;
--enable_warnings
insert into t1 values (1);
begin;
select * from t1 for update;
connection con2;
select (@before:=unix_timestamp())*0; # always give repeatable output
begin;
send select * from t1 for update;
connection con3;
insert into t2 values (20);
connection con2;
--error 1205
reap;
select (@after:=unix_timestamp())*0; # always give repeatable output
# verify that innodb_lock_wait_timeout was exceeded. When there was
# the bug, the reap would return immediately after the insert into t2.
select (@after-@before) >= 2;
# cleanup
drop table t1,t2; drop table t1,t2;
--timezone=:$MYSQL_TEST_DIR/std_data/Moscow_leap
#
# Test of handling time zone with leap seconds.
#
# This test should be run with TZ=:$MYSQL_TEST_DIR/std_data/Moscow_leap
# This implies that this test should be run only on systems that interpret
# characters after colon in TZ variable as path to zoneinfo file.
#
# Check that we have successfully set time zone with leap seconds.
--require r/have_moscow_leap_timezone.require
disable_query_log;
select from_unixtime(1072904422);
enable_query_log;
# Initial clean-up
--disable_warnings
drop table if exists t1;
--enable_warnings
#
# Let us check behavior of conversion from broken-down representation
# to time_t representation, for normal, non-existent and ambigious dates
# (This check is similar to the one in timezone2.test in 4.1)
#
create table t1 (i int, c varchar(20));
# Normal value without DST
insert into t1 values
(unix_timestamp("2004-01-01 00:00:00"), "2004-01-01 00:00:00");
# Values around and in spring time-gap
insert into t1 values
(unix_timestamp("2004-03-28 01:59:59"), "2004-03-28 01:59:59"),
(unix_timestamp("2004-03-28 02:30:00"), "2004-03-28 02:30:00"),
(unix_timestamp("2004-03-28 03:00:00"), "2004-03-28 03:00:00");
# Normal value with DST
insert into t1 values
(unix_timestamp('2004-05-01 00:00:00'),'2004-05-01 00:00:00');
# Ambiguos values (also check for determenism)
insert into t1 values
(unix_timestamp('2004-10-31 01:00:00'),'2004-10-31 01:00:00'),
(unix_timestamp('2004-10-31 02:00:00'),'2004-10-31 02:00:00'),
(unix_timestamp('2004-10-31 02:59:59'),'2004-10-31 02:59:59'),
(unix_timestamp('2004-10-31 04:00:00'),'2004-10-31 04:00:00'),
(unix_timestamp('2004-10-31 02:59:59'),'2004-10-31 02:59:59');
# Test of leap
insert into t1 values
(unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'),
(unix_timestamp('1981-07-01 04:00:00'),'1981-07-01 04:00:00');
select i, from_unixtime(i), c from t1;
drop table t1;
#
# Test for bug #6387 "Queried timestamp values do not match the
# inserted". my_gmt_sec() function was not working properly if we
# had time zone with leap seconds
#
create table t1 (ts timestamp);
insert into t1 values (19730101235900), (20040101235900);
select * from t1;
drop table t1;
...@@ -60,15 +60,20 @@ DATADIR, ...@@ -60,15 +60,20 @@ DATADIR,
NullS, NullS,
}; };
#define default_ext ".cnf" /* extension for config file */
#ifdef __WIN__ #ifdef __WIN__
#include <winbase.h> static const char *f_extensions[]= { ".ini", ".cnf", 0 };
#define windows_ext ".ini" #else
static const char *f_extensions[]= { ".cnf", 0 };
#endif #endif
static int search_default_file(DYNAMIC_ARRAY *args,MEM_ROOT *alloc, static int search_default_file(DYNAMIC_ARRAY *args,MEM_ROOT *alloc,
const char *dir, const char *config_file, const char *dir, const char *config_file,
const char *ext, TYPELIB *group); TYPELIB *group);
static int search_default_file_with_ext(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
const char *dir, const char *ext,
const char *config_file,
TYPELIB *group);
static char *remove_end_comment(char *ptr); static char *remove_end_comment(char *ptr);
...@@ -115,7 +120,8 @@ int load_defaults(const char *conf_file, const char **groups, ...@@ -115,7 +120,8 @@ int load_defaults(const char *conf_file, const char **groups,
uint args_used=0; uint args_used=0;
int error= 0; int error= 0;
MEM_ROOT alloc; MEM_ROOT alloc;
char *ptr,**res; char *ptr, **res, **ext;
DBUG_ENTER("load_defaults"); DBUG_ENTER("load_defaults");
init_alloc_root(&alloc,512,0); init_alloc_root(&alloc,512,0);
...@@ -163,8 +169,9 @@ int load_defaults(const char *conf_file, const char **groups, ...@@ -163,8 +169,9 @@ int load_defaults(const char *conf_file, const char **groups,
goto err; goto err;
if (forced_default_file) if (forced_default_file)
{ {
if ((error= search_default_file(&args, &alloc, "", if ((error= search_default_file_with_ext(&args, &alloc, "", "",
forced_default_file, "", &group)) < 0) forced_default_file,
&group)) < 0)
goto err; goto err;
if (error > 0) if (error > 0)
{ {
...@@ -175,37 +182,40 @@ int load_defaults(const char *conf_file, const char **groups, ...@@ -175,37 +182,40 @@ int load_defaults(const char *conf_file, const char **groups,
} }
else if (dirname_length(conf_file)) else if (dirname_length(conf_file))
{ {
if ((error= search_default_file(&args, &alloc, NullS, conf_file, for (ext= (char**) f_extensions; *ext; *ext++)
default_ext, &group)) < 0) if ((error= search_default_file(&args, &alloc, NullS, conf_file,
goto err; &group)) < 0)
goto err;
} }
else else
{ {
#ifdef __WIN__ #ifdef __WIN__
char system_dir[FN_REFLEN]; char system_dir[FN_REFLEN];
GetWindowsDirectory(system_dir,sizeof(system_dir)); GetWindowsDirectory(system_dir,sizeof(system_dir));
if ((search_default_file(&args, &alloc, system_dir, conf_file, if ((search_default_file(&args, &alloc, system_dir, conf_file, &group)))
windows_ext, &group)))
goto err; goto err;
#endif #endif
#if defined(__EMX__) || defined(OS2) #if defined(__EMX__) || defined(OS2)
if (getenv("ETC") && {
(search_default_file(&args, &alloc, getenv("ETC"), conf_file, const char *etc;
default_ext, &group)) < 0) if ((etc= getenv("ETC")) &&
(search_default_file(&args, &alloc, etc, conf_file,
&group)) < 0)
goto err; goto err;
}
#endif #endif
for (dirs=default_directories ; *dirs; dirs++) for (dirs=default_directories ; *dirs; dirs++)
{ {
if (**dirs) if (**dirs)
{ {
if (search_default_file(&args, &alloc, *dirs, conf_file, if (search_default_file(&args, &alloc, *dirs, conf_file,
default_ext, &group) < 0) &group) < 0)
goto err; goto err;
} }
else if (defaults_extra_file) else if (defaults_extra_file)
{ {
if (search_default_file(&args, &alloc, NullS, defaults_extra_file, if (search_default_file(&args, &alloc, NullS, defaults_extra_file,
default_ext, &group) < 0) &group) < 0)
goto err; /* Fatal error */ goto err; /* Fatal error */
} }
} }
...@@ -269,11 +279,28 @@ void free_defaults(char **argv) ...@@ -269,11 +279,28 @@ void free_defaults(char **argv)
} }
static int search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
const char *dir,
const char *config_file, TYPELIB *group)
{
char **ext;
for (ext= (char**) f_extensions; *ext; *ext++)
{
int error;
if ((error= search_default_file_with_ext(args, alloc, dir, *ext,
config_file, group)) < 0)
return error;
}
return 0;
}
/* /*
Open a configuration file (if exists) and read given options from it Open a configuration file (if exists) and read given options from it
SYNOPSIS SYNOPSIS
search_default_file() search_default_file_with_ext()
args Store pointer to found options here args Store pointer to found options here
alloc Allocate strings in this object alloc Allocate strings in this object
dir directory to read dir directory to read
...@@ -288,9 +315,10 @@ void free_defaults(char **argv) ...@@ -288,9 +315,10 @@ void free_defaults(char **argv)
2 File is not a regular file (Warning) 2 File is not a regular file (Warning)
*/ */
static int search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc, static int search_default_file_with_ext(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
const char *dir, const char *config_file, const char *dir, const char *ext,
const char *ext, TYPELIB *group) const char *config_file,
TYPELIB *group)
{ {
char name[FN_REFLEN+10],buff[4096],*ptr,*end,*value,*tmp; char name[FN_REFLEN+10],buff[4096],*ptr,*end,*value,*tmp;
FILE *fp; FILE *fp;
...@@ -484,10 +512,11 @@ static char *remove_end_comment(char *ptr) ...@@ -484,10 +512,11 @@ static char *remove_end_comment(char *ptr)
void print_defaults(const char *conf_file, const char **groups) void print_defaults(const char *conf_file, const char **groups)
{ {
#ifdef __WIN__ #ifdef __WIN__
bool have_ext=fn_ext(conf_file)[0] != 0; my_bool have_ext= fn_ext(conf_file)[0] != 0;
#endif #endif
char name[FN_REFLEN]; char name[FN_REFLEN], **ext;
const char **dirs; const char **dirs;
puts("\nDefault options are read from the following files in the given order:"); puts("\nDefault options are read from the following files in the given order:");
if (dirname_length(conf_file)) if (dirname_length(conf_file))
...@@ -496,27 +525,43 @@ void print_defaults(const char *conf_file, const char **groups) ...@@ -496,27 +525,43 @@ void print_defaults(const char *conf_file, const char **groups)
{ {
#ifdef __WIN__ #ifdef __WIN__
GetWindowsDirectory(name,sizeof(name)); GetWindowsDirectory(name,sizeof(name));
printf("%s\\%s%s ",name,conf_file,have_ext ? "" : windows_ext); if (!have_ext)
{
for (ext= (char**) f_extensions; *ext; *ext++)
printf("%s\\%s%s ", name, conf_file, *ext);
}
else
printf("%s\\%s ", name, conf_file);
#endif #endif
#if defined(__EMX__) || defined(OS2) #if defined(__EMX__) || defined(OS2)
if (getenv("ETC")) {
printf("%s\\%s%s ", getenv("ETC"), conf_file, default_ext); const char *etc;
if ((etc= getenv("ETC")))
{
for (ext= (char**) f_extensions; *ext; *ext++)
printf("%s\\%s%s ", etc, conf_file, *ext);
}
}
#endif #endif
for (dirs=default_directories ; *dirs; dirs++) for (dirs=default_directories ; *dirs; dirs++)
{ {
const char *pos; for (ext= (char**) f_extensions; *ext; *ext++)
char *end; {
if (**dirs) const char *pos;
pos= *dirs; char *end;
else if (defaults_extra_file) if (**dirs)
pos= defaults_extra_file; pos= *dirs;
else else if (defaults_extra_file)
continue; pos= defaults_extra_file;
end=convert_dirname(name, pos, NullS); else
if (name[0] == FN_HOMELIB) /* Add . to filenames in home */ continue;
*end++='.'; end= convert_dirname(name, pos, NullS);
strxmov(end,conf_file,default_ext," ",NullS); if (name[0] == FN_HOMELIB) /* Add . to filenames in home */
fputs(name,stdout); *end++='.';
strxmov(end, conf_file, *ext, " ", NullS);
fputs(name,stdout);
}
} }
puts(""); puts("");
} }
......
...@@ -315,7 +315,7 @@ do ...@@ -315,7 +315,7 @@ do
break break
fi fi
if test @IS_LINUX@ -a $KILL_MYSQLD -eq 1 if @IS_LINUX@ && test $KILL_MYSQLD -eq 1
then then
# Test if one process was hanging. # Test if one process was hanging.
# This is only a fix for Linux (running as base 3 mysqld processes) # This is only a fix for Linux (running as base 3 mysqld processes)
......
...@@ -1450,7 +1450,8 @@ COLLATION_CONNECTION=%u,COLLATION_DATABASE=%u,COLLATION_SERVER=%u", ...@@ -1450,7 +1450,8 @@ COLLATION_CONNECTION=%u,COLLATION_DATABASE=%u,COLLATION_SERVER=%u",
if (flush_io_cache(file) || sync_binlog(file)) if (flush_io_cache(file) || sync_binlog(file))
goto err; goto err;
if (opt_using_transactions && !my_b_tell(&thd->transaction.trans_log)) if (opt_using_transactions &&
!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
{ {
/* /*
LOAD DATA INFILE in AUTOCOMMIT=1 mode writes to the binlog LOAD DATA INFILE in AUTOCOMMIT=1 mode writes to the binlog
...@@ -1597,6 +1598,14 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, bool commit_or_rollback) ...@@ -1597,6 +1598,14 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, bool commit_or_rollback)
*/ */
{ {
Query_log_event qinfo(thd, "BEGIN", 5, TRUE); Query_log_event qinfo(thd, "BEGIN", 5, TRUE);
/*
Imagine this is rollback due to net timeout, after all statements of
the transaction succeeded. Then we want a zero-error code in BEGIN.
In other words, if there was a really serious error code it's already
in the statement's events.
This is safer than thd->clear_error() against kills at shutdown.
*/
qinfo.error_code= 0;
/* /*
Now this Query_log_event has artificial log_pos 0. It must be adjusted Now this Query_log_event has artificial log_pos 0. It must be adjusted
to reflect the real position in the log. Not doing it would confuse the to reflect the real position in the log. Not doing it would confuse the
...@@ -1630,6 +1639,7 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, bool commit_or_rollback) ...@@ -1630,6 +1639,7 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, bool commit_or_rollback)
commit_or_rollback ? "COMMIT" : "ROLLBACK", commit_or_rollback ? "COMMIT" : "ROLLBACK",
commit_or_rollback ? 6 : 8, commit_or_rollback ? 6 : 8,
TRUE); TRUE);
qinfo.error_code= 0;
qinfo.set_log_pos(this); qinfo.set_log_pos(this);
if (qinfo.write(&log_file) || flush_io_cache(&log_file) || if (qinfo.write(&log_file) || flush_io_cache(&log_file) ||
sync_binlog(&log_file)) sync_binlog(&log_file))
......
...@@ -4242,7 +4242,7 @@ Disable with --skip-innodb (will save memory).", ...@@ -4242,7 +4242,7 @@ Disable with --skip-innodb (will save memory).",
"Percentage of dirty pages allowed in bufferpool.", (gptr*) &srv_max_buf_pool_modified_pct, "Percentage of dirty pages allowed in bufferpool.", (gptr*) &srv_max_buf_pool_modified_pct,
(gptr*) &srv_max_buf_pool_modified_pct, 0, GET_ULONG, REQUIRED_ARG, 90, 0, 100, 0, 0, 0}, (gptr*) &srv_max_buf_pool_modified_pct, 0, GET_ULONG, REQUIRED_ARG, 90, 0, 100, 0, 0, 0},
{"innodb_max_purge_lag", OPT_INNODB_MAX_PURGE_LAG, {"innodb_max_purge_lag", OPT_INNODB_MAX_PURGE_LAG,
"", "Desired maximum length of the purge queue (0 = no limit)",
(gptr*) &srv_max_purge_lag, (gptr*) &srv_max_purge_lag,
(gptr*) &srv_max_purge_lag, 0, GET_LONG, REQUIRED_ARG, 0, 0, ~0L, (gptr*) &srv_max_purge_lag, 0, GET_LONG, REQUIRED_ARG, 0, 0, ~0L,
0, 1L, 0}, 0, 1L, 0},
...@@ -4251,7 +4251,7 @@ Disable with --skip-innodb (will save memory).", ...@@ -4251,7 +4251,7 @@ Disable with --skip-innodb (will save memory).",
(gptr*) &innobase_create_status_file, (gptr*) &innobase_create_status_file, (gptr*) &innobase_create_status_file, (gptr*) &innobase_create_status_file,
0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"innodb_table_locks", OPT_INNODB_TABLE_LOCKS, {"innodb_table_locks", OPT_INNODB_TABLE_LOCKS,
"If Innodb should enforce LOCK TABLE", "Enable InnoDB locking in LOCK TABLES",
(gptr*) &global_system_variables.innodb_table_locks, (gptr*) &global_system_variables.innodb_table_locks,
(gptr*) &global_system_variables.innodb_table_locks, (gptr*) &global_system_variables.innodb_table_locks,
0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
......
...@@ -1685,7 +1685,7 @@ static int replace_db_table(TABLE *table, const char *db, ...@@ -1685,7 +1685,7 @@ static int replace_db_table(TABLE *table, const char *db,
goto table_error; /* purecov: deadcode */ goto table_error; /* purecov: deadcode */
} }
} }
else if ((error=table->file->write_row(table->record[0]))) else if (rights && (error=table->file->write_row(table->record[0])))
{ {
if (error && error != HA_ERR_FOUND_DUPP_KEY) /* purecov: inspected */ if (error && error != HA_ERR_FOUND_DUPP_KEY) /* purecov: inspected */
goto table_error; /* purecov: deadcode */ goto table_error; /* purecov: deadcode */
...@@ -1695,6 +1695,7 @@ static int replace_db_table(TABLE *table, const char *db, ...@@ -1695,6 +1695,7 @@ static int replace_db_table(TABLE *table, const char *db,
if (old_row_exists) if (old_row_exists)
acl_update_db(combo.user.str,combo.host.str,db,rights); acl_update_db(combo.user.str,combo.host.str,db,rights);
else else
if (rights)
acl_insert_db(combo.user.str,combo.host.str,db,rights); acl_insert_db(combo.user.str,combo.host.str,db,rights);
DBUG_RETURN(0); DBUG_RETURN(0);
......
...@@ -1418,7 +1418,6 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info, ...@@ -1418,7 +1418,6 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
} }
table->file->extra(HA_EXTRA_WRITE_CACHE); table->file->extra(HA_EXTRA_WRITE_CACHE);
DBUG_RETURN(table); DBUG_RETURN(table);
/* Note that leaving the function resets binlogging properties */
} }
......
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