diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index f8621170f64..1be3106bdf4 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -29,6 +29,7 @@ dellis@goetia.(none) dlenev@brandersnatch.localdomain dlenev@build.mysql.com dlenev@mysql.com +gbichot@quadxeon.mysql.com gerberb@ou800.zenez.com gluh@gluh.(none) gluh@gluh.mysql.r18.ru @@ -109,9 +110,11 @@ nick@mysql.com nick@nick.leippe.com patg@krsna.patg.net paul@central.snake.net +paul@frost.snake.net paul@ice.local paul@ice.snake.net paul@kite-hub.kitebird.com +paul@snake-hub.snake.net paul@teton.kitebird.com pem@mysql.com peter@linux.local diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile index 1f83a9a37e1..5756d06a116 100755 --- a/Build-tools/Do-compile +++ b/Build-tools/Do-compile @@ -617,16 +617,20 @@ sub abort if ($opt_user) { - $mail_header_file="$opt_tmp/do-command.$$"; - open(TMP,">$mail_header_file"); + # Take the last 40 lines of the build log + open(LOG, "$log") or die $!; + my @log= ; + close LOG; + splice @log => 0, -40; + my $mail_file="$opt_tmp/do-command.$$"; + open(TMP,">$mail_file") or die $!; print TMP "From: mysqldev\@$full_host_name\n"; print TMP "To: $email\n"; print TMP "Subject: $host($uname): $ver$opt_version_suffix compilation failed\n\n"; + print TMP @log; close TMP; - system("tail -n 40 $log > $log.mail"); - system("cat $mail_header_file $log.mail | $sendmail -t -f $email"); - unlink($mail_header_file); - unlink("$log.mail"); + system("$sendmail -t -f $email < $mail_file"); + unlink($mail_file); } exit 1; } diff --git a/Docs/changelog-4.0.xml b/Docs/changelog-4.0.xml new file mode 100755 index 00000000000..f0f9aa881f1 --- /dev/null +++ b/Docs/changelog-4.0.xml @@ -0,0 +1,18 @@ + + + + + + + Changes in release 4.0.x + + + + This is a dummy changelog file. Don't use it yet. + + + diff --git a/configure.in b/configure.in index 8b8c0690a55..36473de7ad1 100644 --- a/configure.in +++ b/configure.in @@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! -AM_INIT_AUTOMAKE(mysql, 4.0.24) +AM_INIT_AUTOMAKE(mysql, 4.0.25) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 diff --git a/innobase/dict/dict0load.c b/innobase/dict/dict0load.c index 0bbf0511b57..a39ffe37ffd 100644 --- a/innobase/dict/dict0load.c +++ b/innobase/dict/dict0load.c @@ -639,7 +639,7 @@ dict_load_table( /* Check if the table name in record is the searched one */ if (len != ut_strlen(name) || ut_memcmp(name, field, len) != 0) { - + err_exit: btr_pcur_close(&pcur); mtr_commit(&mtr); mem_heap_free(heap); @@ -647,22 +647,6 @@ dict_load_table( return(NULL); } -#if MYSQL_VERSION_ID < 50300 - /* Starting from MySQL 5.0.3, the high-order bit of MIX_LEN is the - "compact format" flag. */ - field = rec_get_nth_field(rec, 7, &len); - if (mach_read_from_1(field) & 0x80) { - btr_pcur_close(&pcur); - mtr_commit(&mtr); - mem_heap_free(heap); - ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: table %s is in the new compact format\n" - "InnoDB: of MySQL 5.0.3 or later\n", name); - return(NULL); - } -#endif /* MYSQL_VERSION_ID < 50300 */ - ut_a(0 == ut_strcmp((char *) "SPACE", dict_field_get_col( dict_index_get_nth_field( @@ -678,6 +662,13 @@ dict_load_table( field = rec_get_nth_field(rec, 4, &len); n_cols = mach_read_from_4(field); + if (n_cols & 0x80000000UL) { + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: table %s is in the new compact format\n" + "InnoDB: of MySQL 5.0.3 or later\n", name); + goto err_exit; + } table = dict_mem_table_create(name, space, n_cols); diff --git a/innobase/include/srv0srv.h b/innobase/include/srv0srv.h index 30dd3db7bb1..e18ceb32bbe 100644 --- a/innobase/include/srv0srv.h +++ b/innobase/include/srv0srv.h @@ -101,6 +101,7 @@ extern ibool srv_use_doublewrite_buf; extern ibool srv_set_thread_priorities; extern int srv_query_thread_priority; +extern ulong srv_max_buf_pool_modified_pct; extern ulong srv_max_purge_lag; /*-------------------------------------------*/ diff --git a/innobase/include/trx0trx.h b/innobase/include/trx0trx.h index 3be16e8f46d..4c93f25009f 100644 --- a/innobase/include/trx0trx.h +++ b/innobase/include/trx0trx.h @@ -346,6 +346,12 @@ struct trx_struct{ in MySQL's binlog write, we will flush the log to disk later in a separate call */ + ibool must_flush_log_later;/* this flag is set to TRUE in + trx_commit_off_kernel() if + flush_log_later was TRUE, and there + were modifications by the transaction; + in that case we must flush the log + in trx_commit_complete_for_mysql() */ dulint commit_lsn; /* lsn at the time of the commit */ ibool dict_operation; /* TRUE if the trx is used to create a table, create an index, or drop a diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c index 5c5d62f777b..6ac8727ee26 100644 --- a/innobase/srv/srv0srv.c +++ b/innobase/srv/srv0srv.c @@ -165,7 +165,7 @@ in the buffer pool to all database pages in the buffer pool smaller than the following number. But it is not guaranteed that the value stays below that during a time of heavy update/insert activity. */ -ulint srv_max_buf_pool_modified_pct = 90; +ulong srv_max_buf_pool_modified_pct = 90; /* If the following is != 0 we do not allow inserts etc. This protects the user from forgetting the innodb_force_recovery keyword to my.cnf */ diff --git a/innobase/trx/trx0trx.c b/innobase/trx/trx0trx.c index 576827966ab..e2a24c2f63c 100644 --- a/innobase/trx/trx0trx.c +++ b/innobase/trx/trx0trx.c @@ -96,6 +96,7 @@ trx_create( trx->check_unique_secondary = TRUE; trx->flush_log_later = FALSE; + trx->must_flush_log_later = FALSE; trx->dict_operation = FALSE; @@ -634,6 +635,8 @@ trx_commit_off_kernel( #endif /* UNIV_SYNC_DEBUG */ rseg = trx->rseg; + + trx->must_flush_log_later = FALSE; if (trx->insert_undo != NULL || trx->update_undo != NULL) { @@ -798,6 +801,7 @@ trx_commit_off_kernel( if (trx->flush_log_later) { /* Do nothing yet */ + trx->must_flush_log_later = TRUE; } else if (srv_flush_log_at_trx_commit == 0) { /* Do nothing */ } else if (srv_flush_log_at_trx_commit == 1) { @@ -1516,7 +1520,9 @@ trx_commit_complete_for_mysql( trx->op_info = (char*)"flushing log"; - if (srv_flush_log_at_trx_commit == 0) { + if (!trx->must_flush_log_later) { + /* Do nothing */ + } if (srv_flush_log_at_trx_commit == 0) { /* Do nothing */ } else if (srv_flush_log_at_trx_commit == 1) { if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) { @@ -1538,6 +1544,8 @@ trx_commit_complete_for_mysql( ut_error; } + trx->must_flush_log_later = FALSE; + trx->op_info = (char*)""; return(0); diff --git a/man/isamchk.1.in b/man/isamchk.1.in index cad1303ee55..d908e8af3ee 100644 --- a/man/isamchk.1.in +++ b/man/isamchk.1.in @@ -130,7 +130,7 @@ replace(1) .P For more information please refer to the MySQL reference manual, which may already be installed locally and which -is also available online at http://www.mysql.com/doc/en/ +is also available online at http://dev.mysql.com/doc/mysql/en .SH BUGS Please refer to http://bugs.mysql.com/ to report bugs. .SH AUTHOR diff --git a/man/isamlog.1.in b/man/isamlog.1.in index 6040f6c4ad8..5f69e70297a 100644 --- a/man/isamlog.1.in +++ b/man/isamlog.1.in @@ -87,7 +87,7 @@ replace(1) .P For more information please refer to the MySQL reference manual, which may already be installed locally and which -is also available online at http://www.mysql.com/doc/en/ +is also available online at http://dev.mysql.com/doc/mysql/en .SH BUGS Please refer to http://bugs.mysql.com/ to report bugs. diff --git a/man/mysql.1.in b/man/mysql.1.in index 35ff48693e1..c4463aa658b 100644 --- a/man/mysql.1.in +++ b/man/mysql.1.in @@ -107,7 +107,7 @@ version number and exit. Wait and retry if the database server connection is down. .SH FILES .TP 2.2i -.I @sysconfdir@/my.cnf +.I /etc/my.cnf MySQL configuration file .TP .I @bindir@/mysql @@ -145,7 +145,7 @@ replace(1) .P For more information please refer to the MySQL reference manual, which may already be installed locally and which -is also available online at http://www.mysql.com/doc/en/ +is also available online at http://dev.mysql.com/doc/mysql/en .SH BUGS Please refer to http://bugs.mysql.com/ to report bugs. .SH AUTHOR diff --git a/man/mysql_fix_privilege_tables.1.in b/man/mysql_fix_privilege_tables.1.in index 1d42681f298..fe1016e8d98 100644 --- a/man/mysql_fix_privilege_tables.1.in +++ b/man/mysql_fix_privilege_tables.1.in @@ -30,7 +30,7 @@ replace(1) .P For more information please refer to the MySQL reference manual, which may already be installed locally and which -is also available online at http://www.mysql.com/doc/en/ +is also available online at http://dev.mysql.com/doc/mysql/en .SH BUGS Please refer to http://bugs.mysql.com/ to report bugs. .SH AUTHOR diff --git a/man/mysql_zap.1.in b/man/mysql_zap.1.in index 511a8feaa7c..fb030427dc2 100644 --- a/man/mysql_zap.1.in +++ b/man/mysql_zap.1.in @@ -44,7 +44,7 @@ replace(1) .P For more information please refer to the MySQL reference manual, which may already be installed locally and which -is also available online at http://www.mysql.com/doc/en/ +is also available online at http://dev.mysql.com/doc/mysql/en .SH BUGS Please refer to http://bugs.mysql.com/ to report bugs. .SH AUTHOR diff --git a/man/mysqlaccess.1.in b/man/mysqlaccess.1.in index cf2e0658a1c..e0b3d314a10 100644 --- a/man/mysqlaccess.1.in +++ b/man/mysqlaccess.1.in @@ -110,7 +110,7 @@ replace(1) .P For more information please refer to the MySQL reference manual, which may already be installed locally and which -is also available online at http://www.mysql.com/doc/en/ +is also available online at http://dev.mysql.com/doc/mysql/en .SH BUGS Please refer to http://bugs.mysql.com/ to report bugs. .SH AUTHOR diff --git a/man/mysqladmin.1.in b/man/mysqladmin.1.in index a549f1c0e22..e62cb32dc78 100644 --- a/man/mysqladmin.1.in +++ b/man/mysqladmin.1.in @@ -194,7 +194,7 @@ replace(1) .P For more information please refer to the MySQL reference manual, which may already be installed locally and which -is also available online at http://www.mysql.com/doc/en/ +is also available online at http://dev.mysql.com/doc/mysql/en .SH BUGS Please refer to http://bugs.mysql.com/ to report bugs. .SH AUTHOR diff --git a/man/mysqld.1.in b/man/mysqld.1.in index 719711edca2..73f07337f25 100644 --- a/man/mysqld.1.in +++ b/man/mysqld.1.in @@ -219,7 +219,7 @@ replace(1) .P For more information please refer to the MySQL reference manual, which may already be installed locally and which -is also available online at http://www.mysql.com/doc/en/ +is also available online at http://dev.mysql.com/doc/mysql/en .SH BUGS Please refer to http://bugs.mysql.com/ to report bugs. .SH AUTHOR diff --git a/man/mysqld_multi.1.in b/man/mysqld_multi.1.in index 26e7a091b60..58e5c71d01d 100644 --- a/man/mysqld_multi.1.in +++ b/man/mysqld_multi.1.in @@ -74,7 +74,7 @@ replace(1) .P For more information please refer to the MySQL reference manual, which may already be installed locally and which -is also available online at http://www.mysql.com/doc/en/ +is also available online at http://dev.mysql.com/doc/mysql/en .SH BUGS Please refer to http://bugs.mysql.com/ to report bugs. diff --git a/man/mysqld_safe.1.in b/man/mysqld_safe.1.in index 641f34677c7..5aabd232a11 100644 --- a/man/mysqld_safe.1.in +++ b/man/mysqld_safe.1.in @@ -76,7 +76,7 @@ replace(1) .P For more information please refer to the MySQL reference manual, which may already be installed locally and which -is also available online at http://www.mysql.com/doc/en/ +is also available online at http://dev.mysql.com/doc/mysql/en .SH BUGS Please refer to http://bugs.mysql.com/ to report bugs. .SH AUTHOR diff --git a/man/mysqldump.1.in b/man/mysqldump.1.in index 6d1cc80c837..4d841117e59 100644 --- a/man/mysqldump.1.in +++ b/man/mysqldump.1.in @@ -263,7 +263,7 @@ replace(1) .P For more information please refer to the MySQL reference manual, which may already be installed locally and which -is also available online at http://www.mysql.com/doc/en/ +is also available online at http://dev.mysql.com/doc/mysql/en .SH BUGS Please refer to http://bugs.mysql.com/ to report bugs. .SH AUTHOR diff --git a/man/mysqlman.1.in b/man/mysqlman.1.in index 610a64da198..b09b01ca759 100644 --- a/man/mysqlman.1.in +++ b/man/mysqlman.1.in @@ -9,7 +9,7 @@ In most cases, you can run the executable from the command line with a "--help" argument to display a brief summary of the executable's arguments and function. For more information about MySQL, please refer to the MySQL reference manual, which may already be installed locally and which is also available online at -http://dev.mysql.com/doc/ +http://dev.mysql.com/doc/mysql/en .SH BUGS Please refer to http://bugs.mysql.com/ to report bugs. .\" end of man page diff --git a/man/mysqlshow.1.in b/man/mysqlshow.1.in index 903d9620fd6..2db79ae070e 100644 --- a/man/mysqlshow.1.in +++ b/man/mysqlshow.1.in @@ -83,7 +83,7 @@ replace(1) .P For more information please refer to the MySQL reference manual, which may already be installed locally and which -is also available online at http://www.mysql.com/doc/en/ +is also available online at http://dev.mysql.com/doc/mysql/en .SH BUGS Please refer to http://bugs.mysql.com/ to report bugs. .SH AUTHOR diff --git a/man/perror.1.in b/man/perror.1.in index f9efb48510b..45b343a9c3f 100644 --- a/man/perror.1.in +++ b/man/perror.1.in @@ -43,7 +43,7 @@ replace(1) .P For more information please refer to the MySQL reference manual, which may already be installed locally and which -is also available online at http://www.mysql.com/doc/en/ +is also available online at http://dev.mysql.com/doc/mysql/en .SH BUGS Please refer to http://bugs.mysql.com/ to report bugs. .SH AUTHOR diff --git a/man/replace.1.in b/man/replace.1.in index 395411f7e9f..618ed0f5bea 100644 --- a/man/replace.1.in +++ b/man/replace.1.in @@ -57,7 +57,7 @@ perror(1), .P For more information please refer to the MySQL reference manual, which may already be installed locally and which -is also available online at http://www.mysql.com/doc/en/ +is also available online at http://dev.mysql.com/doc/mysql/en .SH BUGS Please refer to http://bugs.mysql.com/ to report bugs. .SH AUTHOR diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 9392f152bb4..6fe71f97edd 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -304,3 +304,18 @@ QUOTE('A') 'A' 'A' DROP TABLE t1; +CREATE TABLE t1 (id int PRIMARY KEY, str char(255) NOT NULL); +CREATE TABLE t2 (id int NOT NULL UNIQUE); +INSERT INTO t2 VALUES (1),(2); +INSERT INTO t1 VALUES (1, aes_encrypt('foo', 'bar')); +INSERT INTO t1 VALUES (2, 'not valid'); +SELECT t1.id, aes_decrypt(str, 'bar') FROM t1, t2 WHERE t1.id = t2.id; +id aes_decrypt(str, 'bar') +1 foo +2 NULL +SELECT t1.id, aes_decrypt(str, 'bar') FROM t1, t2 WHERE t1.id = t2.id +ORDER BY t1.id; +id aes_decrypt(str, 'bar') +1 foo +2 NULL +DROP TABLE t1, t2; diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index 5778b2f9b72..d6ce93e632b 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -684,3 +684,23 @@ t1 ALL NULL NULL NULL NULL 3 t2 ALL NULL NULL NULL NULL 2 t3 ALL NULL NULL NULL NULL 2 drop table t1, t2, t3; +create table t1 ( +a int(11), +b char(10), +key (a) +); +insert into t1 (a) values (1),(2),(3),(4); +create table t2 (a int); +select * from t1 left join t2 on t1.a=t2.a where not (t2.a <=> t1.a); +a b a +1 NULL NULL +2 NULL NULL +3 NULL NULL +4 NULL NULL +select * from t1 left join t2 on t1.a=t2.a having not (t2.a <=> t1.a); +a b a +1 NULL NULL +2 NULL NULL +3 NULL NULL +4 NULL NULL +drop table t1,t2; diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result index 7810d52d156..9ca92fe75df 100644 --- a/mysql-test/r/update.result +++ b/mysql-test/r/update.result @@ -209,3 +209,10 @@ insert into t1 values (1, "t1c2-1", 10), (2, "t1c2-2", 20); update t1 left join t2 on t1.c1 = t2.c1 set t2.c2 = "t2c2-1"; update t1 left join t2 on t1.c1 = t2.c1 set t2.c2 = "t2c2-1" where t1.c3 = 10; drop table t1, t2; +create table t1 (a int, b char(255), key(a, b(20))); +insert into t1 values (0, '1'); +update t1 set b = b + 1 where a = 0; +select * from t1; +a b +0 2 +drop table t1; diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index 6c2abd27551..9dac1d823d9 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -198,3 +198,20 @@ select quote(trim(concat(' ', 'a'))); CREATE TABLE t1 SELECT 1 UNION SELECT 2 UNION SELECT 3; SELECT QUOTE('A') FROM t1; DROP TABLE t1; + +# +# Test case for bug #8669: null aes_decrypt result in order by query +# + +CREATE TABLE t1 (id int PRIMARY KEY, str char(255) NOT NULL); +CREATE TABLE t2 (id int NOT NULL UNIQUE); +INSERT INTO t2 VALUES (1),(2); +INSERT INTO t1 VALUES (1, aes_encrypt('foo', 'bar')); +INSERT INTO t1 VALUES (2, 'not valid'); + +SELECT t1.id, aes_decrypt(str, 'bar') FROM t1, t2 WHERE t1.id = t2.id; +SELECT t1.id, aes_decrypt(str, 'bar') FROM t1, t2 WHERE t1.id = t2.id + ORDER BY t1.id; + +DROP TABLE t1, t2; + diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test index bed4d4b033b..f32cc9d56ac 100644 --- a/mysql-test/t/join_outer.test +++ b/mysql-test/t/join_outer.test @@ -450,3 +450,16 @@ select * from t1 left join t2 on b1 = a1 left join t3 on c1 = a1 and b1 is explain select * from t1 left join t2 on b1 = a1 left join t3 on c1 = a1 and b1 is null; drop table t1, t2, t3; + +# Test for BUG#8711 '<=>' was considered to be a NULL-rejecting predicate. +create table t1 ( + a int(11), + b char(10), + key (a) +); +insert into t1 (a) values (1),(2),(3),(4); +create table t2 (a int); + +select * from t1 left join t2 on t1.a=t2.a where not (t2.a <=> t1.a); +select * from t1 left join t2 on t1.a=t2.a having not (t2.a <=> t1.a); +drop table t1,t2; diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test index 62439dcc51b..6c7b450f763 100644 --- a/mysql-test/t/update.test +++ b/mysql-test/t/update.test @@ -164,3 +164,13 @@ insert into t1 values (1, "t1c2-1", 10), (2, "t1c2-2", 20); update t1 left join t2 on t1.c1 = t2.c1 set t2.c2 = "t2c2-1"; update t1 left join t2 on t1.c1 = t2.c1 set t2.c2 = "t2c2-1" where t1.c3 = 10; drop table t1, t2; + +# +# Bug #8942: a problem with update and partial key part +# + +create table t1 (a int, b char(255), key(a, b(20))); +insert into t1 values (0, '1'); +update t1 set b = b + 1 where a = 0; +select * from t1; +drop table t1; diff --git a/netware/BUILD/mwenv b/netware/BUILD/mwenv index 88491446c43..674c148a399 100755 --- a/netware/BUILD/mwenv +++ b/netware/BUILD/mwenv @@ -7,13 +7,13 @@ export MYDEV="F:/mydev" export MWCNWx86Includes="$MYDEV/libc/include;$MYDEV/fs64/headers;$MYDEV/zlib-1.1.4;$MYDEV" -export MWNWx86Libraries="$MYDEV/libc/imports;$MYDEV/mw/lib;$MYDEV/fs64/imports;$MYDEV/zlib-1.1.4;$MYDEV/mysql-4.0.21/netware/BUILD" +export MWNWx86Libraries="$MYDEV/libc/imports;$MYDEV/mw/lib;$MYDEV/fs64/imports;$MYDEV/zlib-1.1.4;$MYDEV/mysql-VERSION/netware/BUILD" export MWNWx86LibraryFiles="libcpre.o;libc.imp;netware.imp;mwcrtl.lib;mwcpp.lib;libz.a;neb.imp;zPublics.imp;knetware.imp" export WINEPATH="$MYDEV/mw/bin" # the default added path is "$HOME/mydev/mysql-x.x-x/netware/BUILD" -export PATH="$PATH:/home/kp/mydev/mysql-4.0.21/netware/BUILD" +export PATH="$PATH:BUILD_DIR/mysql-VERSION/netware/BUILD" export AR='mwldnlm' export AR_FLAGS='-type library -o' diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 8f1aa525190..a1977e76f67 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -78,6 +78,7 @@ public: Item_func_equal(Item *a,Item *b) :Item_bool_func2(a,b) { }; longlong val_int(); void fix_length_and_dec(); + table_map not_null_tables() const { return 0; } enum Functype functype() const { return EQUAL_FUNC; } enum Functype rev_functype() const { return EQUAL_FUNC; } cond_result eq_cmp_result() const { return COND_TRUE; } diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index aeb63d6af00..930014de771 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -208,6 +208,7 @@ String *Item_func_aes_decrypt::val_str(String *str) void Item_func_aes_decrypt::fix_length_and_dec() { max_length=args[0]->max_length; + maybe_null= 1; } @@ -1465,7 +1466,8 @@ Item_func_format::Item_func_format(Item *org,int dec) :Item_str_func(org) String *Item_func_format::val_str(String *str) { double nr =args[0]->val(); - uint32 diff,length,str_length; + uint32 length,str_length; + int diff; uint dec; if ((null_value=args[0]->null_value)) return 0; /* purecov: inspected */ @@ -1483,17 +1485,17 @@ String *Item_func_format::val_str(String *str) if (str_length >= dec+4) { char *tmp,*pos; - length= str->length()+(diff=(str_length- dec-1)/3); + length= str->length()+(diff= (int)(str_length- dec-1)/3); str= copy_if_not_alloced(&tmp_str,str,length); str->length(length); tmp= (char*) str->ptr()+length - dec-1; for (pos= (char*) str->ptr()+length-1; pos != tmp; pos--) - pos[0]= pos[-(int) diff]; + pos[0]= pos[-diff]; while (diff) { - pos[0]=pos[-(int) diff]; pos--; - pos[0]=pos[-(int) diff]; pos--; - pos[0]=pos[-(int) diff]; pos--; + pos[0]=pos[-diff]; pos--; + pos[0]=pos[-diff]; pos--; + pos[0]=pos[-diff]; pos--; pos[0]=','; pos--; diff--; diff --git a/sql/key.cc b/sql/key.cc index 0a5937fc881..52eb108a5df 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -265,7 +265,7 @@ bool check_if_key_used(TABLE *table, uint idx, List &fields) f.rewind(); while ((field=(Item_field*) f++)) { - if (key_part->field == field->field) + if (key_part->field->eq(field->field)) return 1; } } diff --git a/sql/log_event.cc b/sql/log_event.cc index 007bb6e7b85..d1321b878bf 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -2360,8 +2360,10 @@ int Create_file_log_event::exec_event(struct st_relay_log_info* rli) strmov(p, ".info"); // strmov takes less code than memcpy strnmov(proc_info, "Making temp file ", 17); // no end 0 thd->proc_info= proc_info; - if ((fd = my_open(fname_buf, O_WRONLY|O_CREAT|O_BINARY|O_TRUNC, - MYF(MY_WME))) < 0 || + my_delete(fname_buf, MYF(0)); // old copy may exist already + if ((fd= my_create(fname_buf, CREATE_MODE, + O_WRONLY | O_BINARY | O_EXCL | O_NOFOLLOW, + MYF(MY_WME))) < 0 || init_io_cache(&file, fd, IO_SIZE, WRITE_CACHE, (my_off_t)0, 0, MYF(MY_WME|MY_NABP))) { @@ -2383,8 +2385,10 @@ int Create_file_log_event::exec_event(struct st_relay_log_info* rli) my_close(fd, MYF(0)); // fname_buf now already has .data, not .info, because we did our trick - if ((fd = my_open(fname_buf, O_WRONLY|O_CREAT|O_BINARY|O_TRUNC, - MYF(MY_WME))) < 0) + my_delete(fname_buf, MYF(0)); // old copy may exist already + if ((fd= my_create(fname_buf, CREATE_MODE, + O_WRONLY | O_BINARY | O_EXCL | O_NOFOLLOW, + MYF(MY_WME))) < 0) { slave_print_error(rli,my_errno, "Error in Create_file event: could not open file '%s'", fname_buf); goto err; @@ -2426,7 +2430,7 @@ int Append_block_log_event::exec_event(struct st_relay_log_info* rli) memcpy(p, ".data", 6); strnmov(proc_info, "Making temp file ", 17); // no end 0 thd->proc_info= proc_info; - if ((fd = my_open(fname, O_WRONLY|O_APPEND|O_BINARY, MYF(MY_WME))) < 0) + if ((fd = my_open(fname, O_WRONLY|O_APPEND|O_BINARY|O_NOFOLLOW, MYF(MY_WME))) < 0) { slave_print_error(rli,my_errno, "Error in Append_block event: could not open file '%s'", fname); goto err; @@ -2455,7 +2459,7 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli) Load_log_event* lev = 0; memcpy(p, ".info", 6); - if ((fd = my_open(fname, O_RDONLY|O_BINARY, MYF(MY_WME))) < 0 || + if ((fd = my_open(fname, O_RDONLY|O_BINARY|O_NOFOLLOW, MYF(MY_WME))) < 0 || init_io_cache(&file, fd, IO_SIZE, READ_CACHE, (my_off_t)0, 0, MYF(MY_WME|MY_NABP))) {