summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BitKeeper/etc/logging_ok1
-rwxr-xr-xBuild-tools/Bootstrap4
-rw-r--r--Docs/Makefile.am2
-rw-r--r--client/mysqldump.c53
-rw-r--r--configure.in4
-rw-r--r--innobase/dict/dict0dict.c53
-rw-r--r--libmysql/Makefile.am2
-rw-r--r--mysql-test/Makefile.am2
-rw-r--r--mysql-test/r/grant.result6
-rw-r--r--mysql-test/r/have_moscow_leap_timezone.require2
-rw-r--r--mysql-test/r/mix_innodb_myisam_binlog.result21
-rw-r--r--mysql-test/r/timezone3.result41
-rw-r--r--mysql-test/std_data/Moscow_leapbin0 -> 991 bytes
-rw-r--r--mysql-test/t/grant.test39
-rw-r--r--mysql-test/t/mix_innodb_myisam_binlog-master.opt1
-rw-r--r--mysql-test/t/mix_innodb_myisam_binlog.test32
-rw-r--r--mysql-test/t/timezone3-master.opt1
-rw-r--r--mysql-test/t/timezone3.test59
-rw-r--r--mysys/default.c123
-rw-r--r--scripts/mysqld_safe.sh2
-rw-r--r--sql/log.cc12
-rw-r--r--sql/mysqld.cc4
-rw-r--r--sql/sql_acl.cc3
-rw-r--r--sql/sql_table.cc1
24 files changed, 352 insertions, 116 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok
index ac02fa84bbc..1f1918027e2 100644
--- a/BitKeeper/etc/logging_ok
+++ b/BitKeeper/etc/logging_ok
@@ -195,6 +195,7 @@ tim@bitch.mysql.fi
tim@black.box
tim@hundin.mysql.fi
tim@sand.box
+tim@siva.hindu.god
tim@threads.polyesthetic.msg
tim@white.box
tim@work.mysql.com
diff --git a/Build-tools/Bootstrap b/Build-tools/Bootstrap
index 8cad093bc5f..a7d347ba32f 100755
--- a/Build-tools/Bootstrap
+++ b/Build-tools/Bootstrap
@@ -288,6 +288,10 @@ unless ($opt_skip_manual)
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/!");
}
+ 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/!");
}
#
diff --git a/Docs/Makefile.am b/Docs/Makefile.am
index 034cec3b133..26a665e2fea 100644
--- a/Docs/Makefile.am
+++ b/Docs/Makefile.am
@@ -24,6 +24,8 @@ BUILT_SOURCES = $(targets) manual_toc.html include.texi
EXTRA_DIST = $(noinst_SCRIPTS) $(BUILT_SOURCES) mysqld_error.txt \
INSTALL-BINARY reservedwords.texi internals.texi
+SUBDIRS = Images
+
all: $(targets) txt_files
txt_files: ../INSTALL-SOURCE ../COPYING ../INSTALL-WIN-SOURCE ../EXCEPTIONS-CLIENT \
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 864fe38a204..a501370f306 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -259,19 +259,6 @@ static struct my_option my_long_options[] =
"Wrap tables with autocommit/commit statements.",
(gptr*) &opt_autocommit, (gptr*) &opt_autocommit, 0, GET_BOOL, NO_ARG,
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',
"'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,
@@ -283,13 +270,6 @@ static struct my_option my_long_options[] =
{"no-set-names", 'N',
"Deprecated. Use --skip-set-charset instead.",
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,
"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},
@@ -313,11 +293,31 @@ static struct my_option my_long_options[] =
{"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).",
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
{"shared-memory-base-name", OPT_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},
#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,
"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},
@@ -1677,16 +1677,13 @@ static void dumpTable(uint numFields, char *table)
fputs("</field>\n", md_result_file);
}
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;
- char xx[4];
- unsigned char *ptr= row[i];
+ unsigned char *ptr= row[i], *end= ptr+ lengths[i];
fputs("0x", md_result_file);
- for (counter = 0; counter < lengths[i]; counter++)
- {
- sprintf(xx, "%02X", ptr[counter]);
- fputs(xx, md_result_file);
- }
+ for (; ptr < end ; ptr++)
+ fprintf(md_result_file, "%02X", *ptr);
}
else
unescape(md_result_file, row[i], lengths[i]);
diff --git a/configure.in b/configure.in
index 764261c6933..d4688d70484 100644
--- a/configure.in
+++ b/configure.in
@@ -480,7 +480,7 @@ if $PS p $$ 2> /dev/null | grep $0 > /dev/null
then
FIND_PROC="$PS p \$\$PID | grep mysqld > /dev/null"
# Solaris
-elif $PS -p $$ 2> /dev/null | grep $0 > /dev/null
+elif $PS -fp $$ 2> /dev/null | grep $0 > /dev/null
then
FIND_PROC="$PS -p \$\$PID | grep mysqld > /dev/null"
# BSD style
@@ -3149,7 +3149,7 @@ AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
sql-common/Makefile SSL/Makefile dnl
dbug/Makefile scripts/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
netware/Makefile dnl
include/mysql_version.h dnl
diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c
index bc08fc2437e..183c547ab2b 100644
--- a/innobase/dict/dict0dict.c
+++ b/innobase/dict/dict0dict.c
@@ -2266,8 +2266,8 @@ dict_foreign_add_to_cache(
/*************************************************************************
Scans from pointer onwards. Stops if is at the start of a copy of
-'string' where characters are compared without case sensitivity. Stops
-also at '\0'. */
+'string' where characters are compared without case sensitivity, and
+only outside `` or "" quotes. Stops also at '\0'. */
const char*
dict_scan_to(
@@ -2276,31 +2276,34 @@ dict_scan_to(
const char* ptr, /* in: scan from */
const char* string) /* in: look for this */
{
- ibool success;
- 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;
+ char quote = '\0';
+ 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;
+ nomatch:
+ ;
}
}
- if (success) {
-
- return(ptr);
- }
-
- ptr++;
-
- goto loop;
+ return(ptr);
}
/*************************************************************************
@@ -2877,13 +2880,13 @@ loop:
ut_a(success);
- if (!isspace(*ptr)) {
+ if (!isspace(*ptr) && *ptr != '"' && *ptr != '`') {
goto loop;
}
- do {
+ while (isspace(*ptr)) {
ptr++;
- } while (isspace(*ptr));
+ }
/* read constraint name unless got "CONSTRAINT FOREIGN" */
if (ptr != ptr2) {
diff --git a/libmysql/Makefile.am b/libmysql/Makefile.am
index 5c2dc9c7ba6..72ff44ecef3 100644
--- a/libmysql/Makefile.am
+++ b/libmysql/Makefile.am
@@ -30,7 +30,7 @@ include $(srcdir)/Makefile.shared
libmysqlclient_la_SOURCES = $(target_sources)
libmysqlclient_la_LIBADD = $(target_libadd)
libmysqlclient_la_LDFLAGS = $(target_ldflags)
-EXTRA_DIST = Makefile.shared
+EXTRA_DIST = Makefile.shared libmysql.def
noinst_HEADERS = client_settings.h
# This is called from the toplevel makefile
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index fcf352f46e6..c4b3fae40f9 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -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)/include/*.inc $(distdir)/include
$(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/des_key_file $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.pem $(distdir)/std_data
@@ -70,6 +71,7 @@ install-data-local:
$(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/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
std_data/%.pem:
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 141e96c8424..df3669e5927 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -248,6 +248,12 @@ GRANT SELECT ON `ab%`.* TO 'test11'@'localhost'
GRANT SELECT ON `a%`.* TO 'test11'@'localhost'
delete from mysql.user 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;
CREATE TABLE t1 (a int );
CREATE TABLE t2 LIKE t1;
diff --git a/mysql-test/r/have_moscow_leap_timezone.require b/mysql-test/r/have_moscow_leap_timezone.require
new file mode 100644
index 00000000000..f27452d7770
--- /dev/null
+++ b/mysql-test/r/have_moscow_leap_timezone.require
@@ -0,0 +1,2 @@
+from_unixtime(1072904422)
+2004-01-01 00:00:00
diff --git a/mysql-test/r/mix_innodb_myisam_binlog.result b/mysql-test/r/mix_innodb_myisam_binlog.result
index 54d99d5609e..a2717c68a4f 100644
--- a/mysql-test/r/mix_innodb_myisam_binlog.result
+++ b/mysql-test/r/mix_innodb_myisam_binlog.result
@@ -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 179 Query 1 79 use `test`; insert into t1 values(18)
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;
diff --git a/mysql-test/r/timezone3.result b/mysql-test/r/timezone3.result
new file mode 100644
index 00000000000..2135dd33511
--- /dev/null
+++ b/mysql-test/r/timezone3.result
@@ -0,0 +1,41 @@
+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;
diff --git a/mysql-test/std_data/Moscow_leap b/mysql-test/std_data/Moscow_leap
new file mode 100644
index 00000000000..4994c005595
--- /dev/null
+++ b/mysql-test/std_data/Moscow_leap
Binary files differ
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index d9c281cfebc..963b9ae5080 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -98,6 +98,30 @@ GRANT FILE on mysqltest.* to mysqltest_1@localhost;
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'
#
@@ -175,21 +199,6 @@ DROP DATABASE ÂÄ;
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
#
USE test;
diff --git a/mysql-test/t/mix_innodb_myisam_binlog-master.opt b/mysql-test/t/mix_innodb_myisam_binlog-master.opt
new file mode 100644
index 00000000000..cb48f1aaf60
--- /dev/null
+++ b/mysql-test/t/mix_innodb_myisam_binlog-master.opt
@@ -0,0 +1 @@
+--loose-innodb_lock_wait_timeout=2
diff --git a/mysql-test/t/mix_innodb_myisam_binlog.test b/mysql-test/t/mix_innodb_myisam_binlog.test
index 9c576b080ca..89a7f8f3036 100644
--- a/mysql-test/t/mix_innodb_myisam_binlog.test
+++ b/mysql-test/t/mix_innodb_myisam_binlog.test
@@ -172,4 +172,36 @@ select a from t1 order by a; # check that savepoints work :)
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;
diff --git a/mysql-test/t/timezone3-master.opt b/mysql-test/t/timezone3-master.opt
new file mode 100644
index 00000000000..6910e6e6e8d
--- /dev/null
+++ b/mysql-test/t/timezone3-master.opt
@@ -0,0 +1 @@
+--timezone=:$MYSQL_TEST_DIR/std_data/Moscow_leap
diff --git a/mysql-test/t/timezone3.test b/mysql-test/t/timezone3.test
new file mode 100644
index 00000000000..8910783cd85
--- /dev/null
+++ b/mysql-test/t/timezone3.test
@@ -0,0 +1,59 @@
+#
+# 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;
diff --git a/mysys/default.c b/mysys/default.c
index 792233ed10d..efeb1c2ce19 100644
--- a/mysys/default.c
+++ b/mysys/default.c
@@ -60,15 +60,20 @@ DATADIR,
NullS,
};
-#define default_ext ".cnf" /* extension for config file */
#ifdef __WIN__
-#include <winbase.h>
-#define windows_ext ".ini"
+static const char *f_extensions[]= { ".ini", ".cnf", 0 };
+#else
+static const char *f_extensions[]= { ".cnf", 0 };
#endif
static int search_default_file(DYNAMIC_ARRAY *args,MEM_ROOT *alloc,
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);
@@ -115,7 +120,8 @@ int load_defaults(const char *conf_file, const char **groups,
uint args_used=0;
int error= 0;
MEM_ROOT alloc;
- char *ptr,**res;
+ char *ptr, **res, **ext;
+
DBUG_ENTER("load_defaults");
init_alloc_root(&alloc,512,0);
@@ -163,8 +169,9 @@ int load_defaults(const char *conf_file, const char **groups,
goto err;
if (forced_default_file)
{
- if ((error= search_default_file(&args, &alloc, "",
- forced_default_file, "", &group)) < 0)
+ if ((error= search_default_file_with_ext(&args, &alloc, "", "",
+ forced_default_file,
+ &group)) < 0)
goto err;
if (error > 0)
{
@@ -175,37 +182,40 @@ int load_defaults(const char *conf_file, const char **groups,
}
else if (dirname_length(conf_file))
{
- if ((error= search_default_file(&args, &alloc, NullS, conf_file,
- default_ext, &group)) < 0)
- goto err;
+ for (ext= (char**) f_extensions; *ext; *ext++)
+ if ((error= search_default_file(&args, &alloc, NullS, conf_file,
+ &group)) < 0)
+ goto err;
}
else
{
#ifdef __WIN__
char system_dir[FN_REFLEN];
GetWindowsDirectory(system_dir,sizeof(system_dir));
- if ((search_default_file(&args, &alloc, system_dir, conf_file,
- windows_ext, &group)))
+ if ((search_default_file(&args, &alloc, system_dir, conf_file, &group)))
goto err;
#endif
#if defined(__EMX__) || defined(OS2)
- if (getenv("ETC") &&
- (search_default_file(&args, &alloc, getenv("ETC"), conf_file,
- default_ext, &group)) < 0)
+ {
+ const char *etc;
+ if ((etc= getenv("ETC")) &&
+ (search_default_file(&args, &alloc, etc, conf_file,
+ &group)) < 0)
goto err;
+ }
#endif
for (dirs=default_directories ; *dirs; dirs++)
{
if (**dirs)
{
if (search_default_file(&args, &alloc, *dirs, conf_file,
- default_ext, &group) < 0)
+ &group) < 0)
goto err;
}
else if (defaults_extra_file)
{
if (search_default_file(&args, &alloc, NullS, defaults_extra_file,
- default_ext, &group) < 0)
+ &group) < 0)
goto err; /* Fatal error */
}
}
@@ -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
SYNOPSIS
- search_default_file()
+ search_default_file_with_ext()
args Store pointer to found options here
alloc Allocate strings in this object
dir directory to read
@@ -288,9 +315,10 @@ void free_defaults(char **argv)
2 File is not a regular file (Warning)
*/
-static int search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
- const char *dir, const char *config_file,
- const char *ext, 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)
{
char name[FN_REFLEN+10],buff[4096],*ptr,*end,*value,*tmp;
FILE *fp;
@@ -484,10 +512,11 @@ static char *remove_end_comment(char *ptr)
void print_defaults(const char *conf_file, const char **groups)
{
#ifdef __WIN__
- bool have_ext=fn_ext(conf_file)[0] != 0;
+ my_bool have_ext= fn_ext(conf_file)[0] != 0;
#endif
- char name[FN_REFLEN];
+ char name[FN_REFLEN], **ext;
const char **dirs;
+
puts("\nDefault options are read from the following files in the given order:");
if (dirname_length(conf_file))
@@ -496,27 +525,43 @@ void print_defaults(const char *conf_file, const char **groups)
{
#ifdef __WIN__
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
#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
for (dirs=default_directories ; *dirs; dirs++)
{
- const char *pos;
- char *end;
- if (**dirs)
- pos= *dirs;
- else if (defaults_extra_file)
- pos= defaults_extra_file;
- else
- continue;
- end=convert_dirname(name, pos, NullS);
- if (name[0] == FN_HOMELIB) /* Add . to filenames in home */
- *end++='.';
- strxmov(end,conf_file,default_ext," ",NullS);
- fputs(name,stdout);
+ for (ext= (char**) f_extensions; *ext; *ext++)
+ {
+ const char *pos;
+ char *end;
+ if (**dirs)
+ pos= *dirs;
+ else if (defaults_extra_file)
+ pos= defaults_extra_file;
+ else
+ continue;
+ end= convert_dirname(name, pos, NullS);
+ if (name[0] == FN_HOMELIB) /* Add . to filenames in home */
+ *end++='.';
+ strxmov(end, conf_file, *ext, " ", NullS);
+ fputs(name,stdout);
+ }
}
puts("");
}
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh
index b9e7ce21f79..da7e06f6c05 100644
--- a/scripts/mysqld_safe.sh
+++ b/scripts/mysqld_safe.sh
@@ -315,7 +315,7 @@ do
break
fi
- if test @IS_LINUX@ -a $KILL_MYSQLD -eq 1
+ if @IS_LINUX@ && test $KILL_MYSQLD -eq 1
then
# Test if one process was hanging.
# This is only a fix for Linux (running as base 3 mysqld processes)
diff --git a/sql/log.cc b/sql/log.cc
index bcd99326501..460910fcee8 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1450,7 +1450,8 @@ COLLATION_CONNECTION=%u,COLLATION_DATABASE=%u,COLLATION_SERVER=%u",
if (flush_io_cache(file) || sync_binlog(file))
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
@@ -1598,6 +1599,14 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, bool commit_or_rollback)
{
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
to reflect the real position in the log. Not doing it would confuse the
slave: it would prevent this one from knowing where he is in the
@@ -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 ? 6 : 8,
TRUE);
+ qinfo.error_code= 0;
qinfo.set_log_pos(this);
if (qinfo.write(&log_file) || flush_io_cache(&log_file) ||
sync_binlog(&log_file))
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 5622ac50a7b..cde54242944 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -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,
(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,
- "",
+ "Desired maximum length of the purge queue (0 = no limit)",
(gptr*) &srv_max_purge_lag,
(gptr*) &srv_max_purge_lag, 0, GET_LONG, REQUIRED_ARG, 0, 0, ~0L,
0, 1L, 0},
@@ -4251,7 +4251,7 @@ Disable with --skip-innodb (will save memory).",
(gptr*) &innobase_create_status_file, (gptr*) &innobase_create_status_file,
0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"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,
0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 98dde1071c3..9067d01a06d 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -1685,7 +1685,7 @@ static int replace_db_table(TABLE *table, const char *db,
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 */
goto table_error; /* purecov: deadcode */
@@ -1695,6 +1695,7 @@ static int replace_db_table(TABLE *table, const char *db,
if (old_row_exists)
acl_update_db(combo.user.str,combo.host.str,db,rights);
else
+ if (rights)
acl_insert_db(combo.user.str,combo.host.str,db,rights);
DBUG_RETURN(0);
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index c69235a5647..3a242dc6547 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1418,7 +1418,6 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
}
table->file->extra(HA_EXTRA_WRITE_CACHE);
DBUG_RETURN(table);
- /* Note that leaving the function resets binlogging properties */
}