diff options
author | unknown <kroki@mysql.com> | 2006-05-04 11:25:48 +0400 |
---|---|---|
committer | unknown <kroki@mysql.com> | 2006-05-04 11:25:48 +0400 |
commit | a5a4f767b57e38137cd78f9e6bd6f3d4ec8d23d1 (patch) | |
tree | 98b49c44d29705ba483af48a03452b0d1b76f773 | |
parent | 354e75939d515ea7916c970ffac18dc8c8c6b080 (diff) | |
parent | 812a82edfab6b2dcdbdd5536204e987656ae490e (diff) | |
download | mariadb-git-a5a4f767b57e38137cd78f9e6bd6f3d4ec8d23d1.tar.gz |
Merge mysql.com:/home/tomash/src/mysql_ab/mysql-4.1
into mysql.com:/home/tomash/src/mysql_ab/mysql-4.1-bug16501
39 files changed, 430 insertions, 142 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index 8a55c1fdb20..c8cad48ff0b 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -311,8 +311,9 @@ case $SYSTEM_TYPE in ;; *) # Just to be safe, we test for ".so" anyway + eval shrexts=\"$shrext_cmds\" if test \( -f "$mysql_zlib_dir/lib/libz.a" -o -f "$mysql_zlib_dir/lib/libz.so" -o \ - -f "$mysql_zlib_dir/lib/libz$shrext_cmds" \) \ + -f "$mysql_zlib_dir/lib/libz$shrexts" \) \ -a -f "$mysql_zlib_dir/include/zlib.h"; then ZLIB_INCLUDES="-I$mysql_zlib_dir/include" ZLIB_LIBS="-L$mysql_zlib_dir/lib -lz" @@ -967,6 +968,7 @@ AC_DEFUN([MYSQL_CHECK_VIO], [ AC_DEFUN([MYSQL_FIND_OPENSSL], [ incs="$1" libs="$2" + eval shrexts=\"$shrext_cmds\" case "$incs---$libs" in ---) for d in /usr/ssl/include /usr/local/ssl/include /usr/include \ @@ -981,7 +983,7 @@ AC_DEFUN([MYSQL_FIND_OPENSSL], [ /usr/lib /usr/lib64 /opt/ssl/lib /opt/openssl/lib \ /usr/freeware/lib32 /usr/local/lib/ ; do # Just to be safe, we test for ".so" anyway - if test -f $d/libssl.a || test -f $d/libssl.so || test -f $d/libssl$shrext_cmds ; then + if test -f $d/libssl.a || test -f $d/libssl.so || test -f $d/libssl$shrexts ; then OPENSSL_LIB=$d fi done @@ -994,7 +996,7 @@ AC_DEFUN([MYSQL_FIND_OPENSSL], [ OPENSSL_INCLUDE=-I$incs fi # Just to be safe, we test for ".so" anyway - if test -f $libs/libssl.a || test -f $libs/libssl.so || test -f $libs/libssl$shrext_cmds ; then + if test -f $libs/libssl.a || test -f $libs/libssl.so || test -f "$libs/libssl$shrexts" ; then OPENSSL_LIB=$libs fi ;; diff --git a/configure.in b/configure.in index a7ef6546425..2dfa2d0b420 100644 --- a/configure.in +++ b/configure.in @@ -5,7 +5,7 @@ AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! # remember to also change ndb version below and update version.c in ndb -AM_INIT_AUTOMAKE(mysql, 4.1.19) +AM_INIT_AUTOMAKE(mysql, 4.1.20) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 @@ -17,7 +17,7 @@ SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0 # ndb version NDB_VERSION_MAJOR=4 NDB_VERSION_MINOR=1 -NDB_VERSION_BUILD=19 +NDB_VERSION_BUILD=20 NDB_VERSION_STATUS="" # Set all version vars based on $VERSION. How do we do this more elegant ? @@ -827,9 +827,8 @@ AC_CHECK_FUNC(yp_get_default_domain, , AC_CHECK_FUNC(p2open, , AC_CHECK_LIB(gen, p2open)) # This may get things to compile even if bind-8 is installed AC_CHECK_FUNC(bind, , AC_CHECK_LIB(bind, bind)) -# For crypt() on Linux -AC_CHECK_LIB(crypt, crypt) -AC_CHECK_FUNC(crypt, AC_DEFINE([HAVE_CRYPT], [1], [crypt])) +# Check if crypt() exists in libc or libcrypt, sets LIBS if needed +AC_SEARCH_LIBS(crypt, crypt, AC_DEFINE(HAVE_CRYPT, 1, [crypt])) # For sem_xxx functions on Solaris 2.6 AC_CHECK_FUNC(sem_init, , AC_CHECK_LIB(posix4, sem_init)) diff --git a/include/config-win.h b/include/config-win.h index 03f130ad37e..bb54a43b8bb 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -22,6 +22,11 @@ functions */ #define _WIN32_WINNT 0x0500 #endif +#if defined(_MSC_VER) && _MSC_VER >= 1400 +/* Avoid endless warnings about sprintf() etc. being unsafe. */ +#define _CRT_SECURE_NO_DEPRECATE 1 +#endif + #include <sys/locking.h> #include <windows.h> #include <math.h> /* Because of rint() */ @@ -195,7 +200,7 @@ typedef uint rf_SetTimer; #define my_sigset(A,B) signal((A),(B)) #define finite(A) _finite(A) #define sleep(A) Sleep((A)*1000) -#define popen(A) popen(A,B) _popen((A),(B)) +#define popen(A,B) _popen((A),(B)) #define pclose(A) _pclose(A) #ifndef __BORLANDC__ @@ -385,7 +390,7 @@ inline double ulonglong2double(ulonglong value) #else #define MYSQL_DEFAULT_CHARSET_NAME "latin1" #define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci" -#enfif +#endif #define HAVE_SPATIAL 1 #define HAVE_RTREE_KEYS 1 diff --git a/innobase/include/dict0dict.ic b/innobase/include/dict0dict.ic index 85e4aaf1a05..4c1a88cfd1b 100644 --- a/innobase/include/dict0dict.ic +++ b/innobase/include/dict0dict.ic @@ -93,7 +93,6 @@ dict_table_get_n_user_cols( { ut_ad(table); ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); - ut_ad(table->cached); return(table->n_cols - DATA_N_SYS_COLS); } @@ -127,7 +126,6 @@ dict_table_get_n_cols( { ut_ad(table); ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); - ut_ad(table->cached); return(table->n_cols); } diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 121102ec262..4e0020b79a2 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -678,6 +678,7 @@ sub command_line_setup () { $glob_use_embedded_server= 1; push(@glob_test_mode, "embedded"); $opt_skip_rpl= 1; # We never run replication with embedded + $opt_skip_ndbcluster= 1; if ( $opt_extern ) { diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index c8d54d7e86c..e74a5ac82d0 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -279,6 +279,7 @@ while test $# -gt 0; do USE_EMBEDDED_SERVER=1 USE_MANAGER=0 NO_SLAVE=1 USE_RUNNING_SERVER="" + USE_NDBCLUSTER="" TEST_MODE="$TEST_MODE embedded" ;; --purify) USE_PURIFY=1 diff --git a/mysql-test/r/analyze.result b/mysql-test/r/analyze.result index 796b382f5d6..bded22c4859 100644 --- a/mysql-test/r/analyze.result +++ b/mysql-test/r/analyze.result @@ -37,3 +37,12 @@ Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_ execute stmt1; Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype deallocate prepare stmt1; +create temporary table t1(a int, index(a)); +insert into t1 values('1'),('2'),('3'),('4'),('5'); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +show index from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 1 a 1 a A 5 NULL NULL YES BTREE +drop table t1; diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result new file mode 100644 index 00000000000..878c5cb5451 --- /dev/null +++ b/mysql-test/r/innodb_mysql.result @@ -0,0 +1 @@ +drop table if exists t1; diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index 990f04e5ba9..091a3c0547d 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -1,6 +1,6 @@ -select -1 as "before_use_test" ; +select 0 as "before_use_test" ; before_use_test --1 +0 select otto from (select 1 as otto) as t1; otto 1 diff --git a/mysql-test/r/ndb_blob.result b/mysql-test/r/ndb_blob.result index bcf867a4edd..e3289961fb8 100644 --- a/mysql-test/r/ndb_blob.result +++ b/mysql-test/r/ndb_blob.result @@ -481,14 +481,22 @@ msg text NOT NULL insert into t1 (msg) values( 'Tries to validate (8 byte length + inline bytes) as UTF8 :( Fast fix: removed validation for Text. It is not yet indexable -so bad data will not crash kernel. -Proper fix: Set inline bytes to multiple of mbmaxlen and -validate it (after the 8 byte length).'); +so bad data will not crash kernel.'); select * from t1; id msg 1 Tries to validate (8 byte length + inline bytes) as UTF8 :( Fast fix: removed validation for Text. It is not yet indexable so bad data will not crash kernel. -Proper fix: Set inline bytes to multiple of mbmaxlen and -validate it (after the 8 byte length). +drop table t1; +create table t1 ( +a int primary key not null auto_increment, +b text +) engine=ndbcluster; +select count(*) from t1; +count(*) +500 +truncate t1; +select count(*) from t1; +count(*) +0 drop table t1; diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result index 3e233eb512a..4d90aac0e68 100644 --- a/mysql-test/r/null.result +++ b/mysql-test/r/null.result @@ -269,3 +269,45 @@ field('str1', null, 'STR1') as c05, c01 c02 c03 c04 c05 c08 c09 str str 0 1 2 1 1 set names latin1; +create table bug19145a (e enum('a','b','c') default 'b' , s set('x', 'y', 'z') default 'y' ) engine=MyISAM; +create table bug19145b (e enum('a','b','c') default null, s set('x', 'y', 'z') default null) engine=MyISAM; +create table bug19145c (e enum('a','b','c') not null default 'b' , s set('x', 'y', 'z') not null default 'y' ) engine=MyISAM; +create table bug19145setnotnulldefaultnull (e enum('a','b','c') default null, s set('x', 'y', 'z') not null default null) engine=MyISAM; +ERROR 42000: Invalid default value for 's' +create table bug19145enumnotnulldefaultnull (e enum('a','b','c') not null default null, s set('x', 'y', 'z') default null) engine=MyISAM; +ERROR 42000: Invalid default value for 'e' +alter table bug19145a alter column e set default null; +alter table bug19145a alter column s set default null; +alter table bug19145a add column (i int); +alter table bug19145b alter column e set default null; +alter table bug19145b alter column s set default null; +alter table bug19145b add column (i int); +alter table bug19145c alter column e set default null; +ERROR 42000: Invalid default value for 'e' +alter table bug19145c alter column s set default null; +ERROR 42000: Invalid default value for 's' +alter table bug19145c add column (i int); +show create table bug19145a; +Table Create Table +bug19145a CREATE TABLE `bug19145a` ( + `e` enum('a','b','c') default NULL, + `s` set('x','y','z') default NULL, + `i` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +show create table bug19145b; +Table Create Table +bug19145b CREATE TABLE `bug19145b` ( + `e` enum('a','b','c') default NULL, + `s` set('x','y','z') default NULL, + `i` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +show create table bug19145c; +Table Create Table +bug19145c CREATE TABLE `bug19145c` ( + `e` enum('a','b','c') NOT NULL default 'b', + `s` set('x','y','z') NOT NULL default 'y', + `i` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table bug19145a; +drop table bug19145b; +drop table bug19145c; diff --git a/mysql-test/r/ps_11bugs.result b/mysql-test/r/ps_11bugs.result index c0d7fe502af..c849c25d646 100644 --- a/mysql-test/r/ps_11bugs.result +++ b/mysql-test/r/ps_11bugs.result @@ -116,3 +116,17 @@ execute st_1676 using @arg0, @arg1, @arg2; cola colb cold aaaa yyyy R drop table t1, t2; +create table t1 (a int primary key); +insert into t1 values (1); +explain select * from t1 where 3 in (select (1+1) union select 1); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +select * from t1 where 3 in (select (1+1) union select 1); +a +prepare st_18492 from 'select * from t1 where 3 in (select (1+1) union select 1)'; +execute st_18492; +a +drop table t1; diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 500aa4b1728..7925715a8b7 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -734,7 +734,7 @@ id select_type table type possible_keys key key_len ref rows Extra 3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL Warnings: -Note 1003 select test.t2.id AS `id` from test.t2 where <in_optimizer>(test.t2.id,<exists>(select 1 AS `Not_used` having (<cache>(test.t2.id) = <null_helper>(1)) union select 1 AS `Not_used` having (<cache>(test.t2.id) = <null_helper>(3)))) +Note 1003 select test.t2.id AS `id` from test.t2 where <in_optimizer>(test.t2.id,<exists>(select 1 AS `1` having (<cache>(test.t2.id) = <ref_null_helper>(1)) union select 3 AS `3` having (<cache>(test.t2.id) = <ref_null_helper>(3)))) SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3); id SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2); diff --git a/mysql-test/t/analyze.test b/mysql-test/t/analyze.test index 5d653b65579..a4694c32d3c 100644 --- a/mysql-test/t/analyze.test +++ b/mysql-test/t/analyze.test @@ -48,4 +48,13 @@ execute stmt1; execute stmt1; deallocate prepare stmt1; +# +# bug#15225 (ANALYZE temporary has no effect) +# +create temporary table t1(a int, index(a)); +insert into t1 values('1'),('2'),('3'),('4'),('5'); +analyze table t1; +show index from t1; +drop table t1; + # End of 4.1 tests diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index ee411a1bb37..3e53cadf76c 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -1,3 +1,16 @@ +####################################################################### +# # +# Please, DO NOT TOUCH this file as well as the innodb.result file. # +# These files are to be modified ONLY BY INNOBASE guys. # +# # +# Use innodb_mysql.[test|result] files instead. # +# # +# If nevertheless you need to make some changes here, please, forward # +# your commit message To: dev@innodb.com Cc: dev-innodb@mysql.com # +# (otherwise your changes may be erased). # +# # +####################################################################### + -- source include/have_innodb.inc # diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test new file mode 100644 index 00000000000..b942b9fbc0d --- /dev/null +++ b/mysql-test/t/innodb_mysql.test @@ -0,0 +1,5 @@ +-- source include/have_innodb.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings diff --git a/mysql-test/t/mysql_client_test.test b/mysql-test/t/mysql_client_test.test index 66b57dd5fb7..1225bf73009 100644 --- a/mysql-test/t/mysql_client_test.test +++ b/mysql-test/t/mysql_client_test.test @@ -1,3 +1,6 @@ +# This test should work in embedded server after we fix mysqltest +-- source include/not_embedded.inc + # We run with different binaries for normal and --embedded-server # # If this test fails with "command "$MYSQL_CLIENT_TEST" failed", diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index f5c6a7617c5..a15a143e9f4 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -1,3 +1,4 @@ +-- source include/not_embedded.inc # ============================================================================ # diff --git a/mysql-test/t/ndb_blob.test b/mysql-test/t/ndb_blob.test index f80b7f71281..bf82a793049 100644 --- a/mysql-test/t/ndb_blob.test +++ b/mysql-test/t/ndb_blob.test @@ -403,10 +403,29 @@ create table t1 ( insert into t1 (msg) values( 'Tries to validate (8 byte length + inline bytes) as UTF8 :( Fast fix: removed validation for Text. It is not yet indexable -so bad data will not crash kernel. -Proper fix: Set inline bytes to multiple of mbmaxlen and -validate it (after the 8 byte length).'); +so bad data will not crash kernel.'); select * from t1; drop table t1; +# -- bug #19201 +create table t1 ( + a int primary key not null auto_increment, + b text +) engine=ndbcluster; +--disable_query_log +set autocommit=1; +# more rows than batch size (64) +# for this bug no blob parts would be necessary +let $1 = 500; +while ($1) +{ + insert into t1 (b) values (repeat('x',4000)); + dec $1; +} +--enable_query_log +select count(*) from t1; +truncate t1; +select count(*) from t1; +drop table t1; + # End of 4.1 tests diff --git a/mysql-test/t/null.test b/mysql-test/t/null.test index 731f0a4cb34..b405b8fb852 100644 --- a/mysql-test/t/null.test +++ b/mysql-test/t/null.test @@ -187,4 +187,45 @@ select # Restore charset to the default value. set names latin1; +# +# Bug#19145: mysqld crashes if you set the default value of an enum field to NULL +# +create table bug19145a (e enum('a','b','c') default 'b' , s set('x', 'y', 'z') default 'y' ) engine=MyISAM; +create table bug19145b (e enum('a','b','c') default null, s set('x', 'y', 'z') default null) engine=MyISAM; + +create table bug19145c (e enum('a','b','c') not null default 'b' , s set('x', 'y', 'z') not null default 'y' ) engine=MyISAM; + +# Invalid default value for 's' +--error 1067 +create table bug19145setnotnulldefaultnull (e enum('a','b','c') default null, s set('x', 'y', 'z') not null default null) engine=MyISAM; + +# Invalid default value for 'e' +--error 1067 +create table bug19145enumnotnulldefaultnull (e enum('a','b','c') not null default null, s set('x', 'y', 'z') default null) engine=MyISAM; + +alter table bug19145a alter column e set default null; +alter table bug19145a alter column s set default null; +alter table bug19145a add column (i int); + +alter table bug19145b alter column e set default null; +alter table bug19145b alter column s set default null; +alter table bug19145b add column (i int); + +# Invalid default value for 'e' +--error 1067 +alter table bug19145c alter column e set default null; + +# Invalid default value for 's' +--error 1067 +alter table bug19145c alter column s set default null; +alter table bug19145c add column (i int); + +show create table bug19145a; +show create table bug19145b; +show create table bug19145c; + +drop table bug19145a; +drop table bug19145b; +drop table bug19145c; + # End of 4.1 tests diff --git a/mysql-test/t/ps_11bugs.test b/mysql-test/t/ps_11bugs.test index e214afeaaf3..ff1c87f3bd8 100644 --- a/mysql-test/t/ps_11bugs.test +++ b/mysql-test/t/ps_11bugs.test @@ -130,3 +130,17 @@ drop table t1, t2; # end of bug#1676 # End of 4.1 tests + +# bug#18492: mysqld reports ER_ILLEGAL_REFERENCE in --ps-protocol + +create table t1 (a int primary key); +insert into t1 values (1); + +explain select * from t1 where 3 in (select (1+1) union select 1); + +select * from t1 where 3 in (select (1+1) union select 1); + +prepare st_18492 from 'select * from t1 where 3 in (select (1+1) union select 1)'; +execute st_18492; + +drop table t1; diff --git a/ndb/include/kernel/signaldata/TcKeyReq.hpp b/ndb/include/kernel/signaldata/TcKeyReq.hpp index 9e42f2a70d5..820425b97e2 100644 --- a/ndb/include/kernel/signaldata/TcKeyReq.hpp +++ b/ndb/include/kernel/signaldata/TcKeyReq.hpp @@ -39,6 +39,7 @@ class TcKeyReq { friend class NdbOperation; friend class NdbIndexOperation; friend class NdbScanOperation; + friend class NdbBlob; friend class DbUtil; /** diff --git a/ndb/include/ndbapi/NdbBlob.hpp b/ndb/include/ndbapi/NdbBlob.hpp index a04f4f72bc9..f2c215ba14d 100644 --- a/ndb/include/ndbapi/NdbBlob.hpp +++ b/ndb/include/ndbapi/NdbBlob.hpp @@ -275,6 +275,7 @@ private: bool isWriteOp(); bool isDeleteOp(); bool isScanOp(); + bool isTakeOverOp(); // computations Uint32 getPartNumber(Uint64 pos); Uint32 getPartCount(); diff --git a/ndb/src/kernel/blocks/backup/BackupInit.cpp b/ndb/src/kernel/blocks/backup/BackupInit.cpp index 2c36896e34c..7cd9c61f010 100644 --- a/ndb/src/kernel/blocks/backup/BackupInit.cpp +++ b/ndb/src/kernel/blocks/backup/BackupInit.cpp @@ -40,12 +40,12 @@ Backup::Backup(const Configuration & conf) : const ndb_mgm_configuration_iterator * p = conf.getOwnConfigIterator(); ndbrequire(p != 0); - Uint32 noBackups = 0, noTables = 0, noAttribs = 0; + Uint32 noBackups = 0, noTables = 0, noAttribs = 0, noFrags = 0; ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_DISCLESS, &m_diskless)); ndb_mgm_get_int_parameter(p, CFG_DB_PARALLEL_BACKUPS, &noBackups); - // ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_NO_TABLES, &noTables)); ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DICT_TABLE, &noTables)); - ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_NO_ATTRIBUTES, &noAttribs)); + ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DICT_ATTRIBUTE, &noAttribs)); + ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DIH_FRAG_CONNECT, &noFrags)); noAttribs++; //RT 527 bug fix @@ -55,8 +55,7 @@ Backup::Backup(const Configuration & conf) : c_attributePool.setSize(noBackups * noAttribs); c_triggerPool.setSize(noBackups * 3 * noTables); - // 2 = no of replicas - c_fragmentPool.setSize(noBackups * 2 * NO_OF_FRAG_PER_NODE * noTables); + c_fragmentPool.setSize(noBackups * noFrags); Uint32 szMem = 0; ndb_mgm_get_int_parameter(p, CFG_DB_BACKUP_MEM, &szMem); diff --git a/ndb/src/kernel/blocks/dbtc/Dbtc.hpp b/ndb/src/kernel/blocks/dbtc/Dbtc.hpp index b1332a4fd0b..25c746b0a89 100644 --- a/ndb/src/kernel/blocks/dbtc/Dbtc.hpp +++ b/ndb/src/kernel/blocks/dbtc/Dbtc.hpp @@ -1400,7 +1400,7 @@ private: const UintR scanParallel, const UintR noOprecPerFrag); void initScanfragrec(Signal* signal); - void releaseScanResources(ScanRecordPtr); + void releaseScanResources(ScanRecordPtr, bool not_started = false); ScanRecordPtr seizeScanrec(Signal* signal); void sendScanFragReq(Signal*, ScanRecord*, ScanFragRec*); void sendScanTabConf(Signal* signal, ScanRecordPtr); @@ -1543,7 +1543,8 @@ private: void signalErrorRefuseLab(Signal* signal); void abort080Lab(Signal* signal); void packKeyData000Lab(Signal* signal, BlockReference TBRef, Uint32 len); - void abortScanLab(Signal* signal, ScanRecordPtr, Uint32 errCode); + void abortScanLab(Signal* signal, ScanRecordPtr, Uint32 errCode, + bool not_started = false); void sendAbortedAfterTimeout(Signal* signal, int Tcheck); void abort010Lab(Signal* signal); void abort015Lab(Signal* signal); diff --git a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp index 4ca13bf433b..7982fe82e45 100644 --- a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp +++ b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp @@ -8767,17 +8767,17 @@ void Dbtc::scanAttrinfoLab(Signal* signal, UintR Tlen) scanAttrinfo_attrbuf_error: jam(); - abortScanLab(signal, scanptr, ZGET_ATTRBUF_ERROR); + abortScanLab(signal, scanptr, ZGET_ATTRBUF_ERROR, true); return; scanAttrinfo_attrbuf2_error: jam(); - abortScanLab(signal, scanptr, ZGET_ATTRBUF_ERROR); + abortScanLab(signal, scanptr, ZGET_ATTRBUF_ERROR, true); return; scanAttrinfo_len_error: jam(); - abortScanLab(signal, scanptr, ZLENGTH_ERROR); + abortScanLab(signal, scanptr, ZLENGTH_ERROR, true); return; }//Dbtc::scanAttrinfoLab() @@ -8793,7 +8793,8 @@ void Dbtc::diFcountReqLab(Signal* signal, ScanRecordPtr scanptr) ; } else { abortScanLab(signal, scanptr, - tabPtr.p->getErrorCode(scanptr.p->scanSchemaVersion)); + tabPtr.p->getErrorCode(scanptr.p->scanSchemaVersion), + true); return; } @@ -8831,13 +8832,13 @@ void Dbtc::execDI_FCOUNTCONF(Signal* signal) ndbrequire(scanptr.p->scanState == ScanRecord::WAIT_FRAGMENT_COUNT); if (apiConnectptr.p->apiFailState == ZTRUE) { jam(); - releaseScanResources(scanptr); + releaseScanResources(scanptr, true); handleApiFailState(signal, apiConnectptr.i); return; }//if if (tfragCount == 0) { jam(); - abortScanLab(signal, scanptr, ZNO_FRAGMENT_ERROR); + abortScanLab(signal, scanptr, ZNO_FRAGMENT_ERROR, true); return; }//if @@ -8851,7 +8852,8 @@ void Dbtc::execDI_FCOUNTCONF(Signal* signal) ; } else { abortScanLab(signal, scanptr, - tabPtr.p->getErrorCode(scanptr.p->scanSchemaVersion)); + tabPtr.p->getErrorCode(scanptr.p->scanSchemaVersion), + true); return; } @@ -8906,20 +8908,22 @@ void Dbtc::execDI_FCOUNTREF(Signal* signal) ndbrequire(scanptr.p->scanState == ScanRecord::WAIT_FRAGMENT_COUNT); if (apiConnectptr.p->apiFailState == ZTRUE) { jam(); - releaseScanResources(scanptr); + releaseScanResources(scanptr, true); handleApiFailState(signal, apiConnectptr.i); return; }//if - abortScanLab(signal, scanptr, errCode); + abortScanLab(signal, scanptr, errCode, true); }//Dbtc::execDI_FCOUNTREF() -void Dbtc::abortScanLab(Signal* signal, ScanRecordPtr scanptr, Uint32 errCode) +void Dbtc::abortScanLab(Signal* signal, ScanRecordPtr scanptr, Uint32 errCode, + bool not_started) { scanTabRefLab(signal, errCode); - releaseScanResources(scanptr); + releaseScanResources(scanptr, not_started); }//Dbtc::abortScanLab() -void Dbtc::releaseScanResources(ScanRecordPtr scanPtr) +void Dbtc::releaseScanResources(ScanRecordPtr scanPtr, + bool not_started) { if (apiConnectptr.p->cachePtr != RNIL) { cachePtr.i = apiConnectptr.p->cachePtr; @@ -8931,6 +8935,15 @@ void Dbtc::releaseScanResources(ScanRecordPtr scanPtr) ptrCheckGuard(tcConnectptr, ctcConnectFilesize, tcConnectRecord); releaseTcCon(); + if (not_started) + { + jam(); + ScanFragList run(c_scan_frag_pool, scanPtr.p->m_running_scan_frags); + ScanFragList queue(c_scan_frag_pool, scanPtr.p->m_queued_scan_frags); + run.release(); + queue.release(); + } + ndbrequire(scanPtr.p->m_running_scan_frags.isEmpty()); ndbrequire(scanPtr.p->m_queued_scan_frags.isEmpty()); ndbrequire(scanPtr.p->m_delivered_scan_frags.isEmpty()); diff --git a/ndb/src/ndbapi/NdbBlob.cpp b/ndb/src/ndbapi/NdbBlob.cpp index 416e983ec14..e595b4b6472 100644 --- a/ndb/src/ndbapi/NdbBlob.cpp +++ b/ndb/src/ndbapi/NdbBlob.cpp @@ -23,6 +23,7 @@ #include <NdbBlob.hpp> #include "NdbBlobImpl.hpp" #include <NdbScanOperation.hpp> +#include <signaldata/TcKeyReq.hpp> #ifdef NDB_BLOB_DEBUG #define DBG(x) \ @@ -290,6 +291,13 @@ NdbBlob::isScanOp() theNdbOp->theOperationType == NdbOperation::OpenRangeScanRequest; } +inline bool +NdbBlob::isTakeOverOp() +{ + return + TcKeyReq::getTakeOverScanFlag(theNdbOp->theScanInfo); +} + // computations (inline) inline Uint32 @@ -1218,8 +1226,22 @@ NdbBlob::preExecute(ExecType anExecType, bool& batch) if (isUpdateOp() || isWriteOp() || isDeleteOp()) { // add operation before this one to read head+inline NdbOperation* tOp = theNdbCon->getNdbOperation(theTable, theNdbOp); + /* + * If main op is from take over scan lock, the added read is done + * as committed read: + * + * In normal transactional case, the row is locked by us and + * committed read returns same as normal read. + * + * In current TRUNCATE TABLE, the deleting trans is committed in + * batches and then restarted with new trans id. A normal read + * would hang on the scan delete lock and then fail. + */ + NdbOperation::LockMode lockMode = + ! isTakeOverOp() ? + NdbOperation::LM_Read : NdbOperation::LM_CommittedRead; if (tOp == NULL || - tOp->readTuple() == -1 || + tOp->readTuple(lockMode) == -1 || setTableKeyValue(tOp) == -1 || getHeadInlineValue(tOp) == -1) { setErrorCode(tOp); diff --git a/ndb/src/ndbapi/Ndbif.cpp b/ndb/src/ndbapi/Ndbif.cpp index d753117aa9a..f1433122ade 100644 --- a/ndb/src/ndbapi/Ndbif.cpp +++ b/ndb/src/ndbapi/Ndbif.cpp @@ -1354,6 +1354,6 @@ NdbConnection::sendTC_COMMIT_ACK(NdbApiSignal * aSignal, Uint32 * dataPtr = aSignal->getDataPtrSend(); dataPtr[0] = transId1; dataPtr[1] = transId2; - - tp->sendSignal(aSignal, refToNode(aTCRef)); + + tp->sendSignalUnCond(aSignal, refToNode(aTCRef)); } diff --git a/ndb/src/ndbapi/TransporterFacade.cpp b/ndb/src/ndbapi/TransporterFacade.cpp index 30d0eec1e4a..0369876f9d8 100644 --- a/ndb/src/ndbapi/TransporterFacade.cpp +++ b/ndb/src/ndbapi/TransporterFacade.cpp @@ -817,7 +817,7 @@ TransporterFacade::sendSignal(NdbApiSignal * aSignal, NodeId aNode){ LinearSectionPtr ptr[3]; signalLogger.sendSignal(* aSignal, 1, - aSignal->getDataPtr(), + tDataPtr, aNode, ptr, 0); signalLogger.flushSignalLog(); aSignal->theSendersBlockRef = tmp; @@ -844,6 +844,7 @@ TransporterFacade::sendSignal(NdbApiSignal * aSignal, NodeId aNode){ int TransporterFacade::sendSignalUnCond(NdbApiSignal * aSignal, NodeId aNode){ + Uint32* tDataPtr = aSignal->getDataPtrSend(); #ifdef API_TRACE if(setSignalLog() && TRACE_GSN(aSignal->theVerId_signalNumber)){ Uint32 tmp = aSignal->theSendersBlockRef; @@ -851,7 +852,7 @@ TransporterFacade::sendSignalUnCond(NdbApiSignal * aSignal, NodeId aNode){ LinearSectionPtr ptr[3]; signalLogger.sendSignal(* aSignal, 0, - aSignal->getDataPtr(), + tDataPtr, aNode, ptr, 0); signalLogger.flushSignalLog(); aSignal->theSendersBlockRef = tmp; @@ -862,7 +863,7 @@ TransporterFacade::sendSignalUnCond(NdbApiSignal * aSignal, NodeId aNode){ (aSignal->theReceiversBlockNumber != 0)); SendStatus ss = theTransporterRegistry->prepareSend(aSignal, 0, - aSignal->getDataPtr(), + tDataPtr, aNode, 0); diff --git a/ndb/src/ndbapi/TransporterFacade.hpp b/ndb/src/ndbapi/TransporterFacade.hpp index 1e7377a3b4d..7e010d45945 100644 --- a/ndb/src/ndbapi/TransporterFacade.hpp +++ b/ndb/src/ndbapi/TransporterFacade.hpp @@ -128,7 +128,8 @@ private: friend class GrepSS; friend class Ndb; friend class Ndb_cluster_connection_impl; - + friend class NdbConnection; + int sendSignalUnCond(NdbApiSignal *, NodeId nodeId); bool isConnected(NodeId aNodeId); diff --git a/ndb/test/ndbapi/testBlobs.cpp b/ndb/test/ndbapi/testBlobs.cpp index 4c82f718788..05a462c12c6 100644 --- a/ndb/test/ndbapi/testBlobs.cpp +++ b/ndb/test/ndbapi/testBlobs.cpp @@ -45,6 +45,7 @@ struct Opt { bool m_dbg; bool m_dbgall; const char* m_dbug; + bool m_fac; bool m_full; unsigned m_loop; unsigned m_parts; @@ -73,6 +74,7 @@ struct Opt { m_dbg(false), m_dbgall(false), m_dbug(0), + m_fac(false), m_full(false), m_loop(1), m_parts(10), @@ -111,6 +113,7 @@ printusage() << " -dbg print debug" << endl << " -dbgall print also NDB API debug (if compiled in)" << endl << " -dbug opt dbug options" << endl + << " -fac fetch across commit in scan delete [" << d.m_fac << "]" << endl << " -full read/write only full blob values" << endl << " -loop N loop N times 0=forever [" << d.m_loop << "]" << endl << " -parts N max parts in blob value [" << d.m_parts << "]" << endl @@ -1260,23 +1263,11 @@ deleteScan(bool idx) CHK((ret = rs->nextResult(false)) == 0 || ret == 1 || ret == 2); if (++n == g_opt.m_batch || ret == 2) { DBG("execute batch: n=" << n << " ret=" << ret); - switch (0) { - case 0: // works normally + if (! g_opt.m_fac) { CHK(g_con->execute(NoCommit) == 0); - CHK(true || g_con->restart() == 0); - break; - case 1: // nonsense - g_con is invalid for 2nd batch - CHK(g_con->execute(Commit) == 0); - CHK(true || g_con->restart() == 0); - break; - case 2: // DBTC sendSignalErrorRefuseLab - CHK(g_con->execute(NoCommit) == 0); - CHK(g_con->restart() == 0); - break; - case 3: // 266 time-out + } else { CHK(g_con->execute(Commit) == 0); CHK(g_con->restart() == 0); - break; } n = 0; } @@ -1824,6 +1815,10 @@ NDB_COMMAND(testOdbcDriver, "testBlobs", "testBlobs", "testBlobs", 65535) continue; } } + if (strcmp(arg, "-fac") == 0) { + g_opt.m_fac = true; + continue; + } if (strcmp(arg, "-full") == 0) { g_opt.m_full = true; continue; diff --git a/ndb/tools/delete_all.cpp b/ndb/tools/delete_all.cpp index d4a07fdf505..c1ab77cb39f 100644 --- a/ndb/tools/delete_all.cpp +++ b/ndb/tools/delete_all.cpp @@ -23,17 +23,21 @@ #include <NDBT.hpp> static int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, - bool commit_across_open_cursor, int parallelism=240); + bool fetch_across_commit, int parallelism=240); NDB_STD_OPTS_VARS; static const char* _dbname = "TEST_DB"; +static my_bool _transactional = false; static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_desc"), { "database", 'd', "Name of database table is in", (gptr*) &_dbname, (gptr*) &_dbname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, + { "transactional", 't', "Single transaction (may run out of operations)", + (gptr*) &_transactional, (gptr*) &_transactional, 0, + GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; static void usage() @@ -82,18 +86,11 @@ int main(int argc, char** argv){ ndbout << " Table " << argv[i] << " does not exist!" << endl; return NDBT_ProgramExit(NDBT_WRONGARGS); } - // Check if we have any blobs - bool commit_across_open_cursor = true; - for (int j = 0; j < pTab->getNoOfColumns(); j++) { - NdbDictionary::Column::Type t = pTab->getColumn(j)->getType(); - if (t == NdbDictionary::Column::Blob || - t == NdbDictionary::Column::Text) { - commit_across_open_cursor = false; - break; - } - } - ndbout << "Deleting all from " << argv[i] << "..."; - if(clear_table(&MyNdb, pTab, commit_across_open_cursor) == NDBT_FAILED){ + ndbout << "Deleting all from " << argv[i]; + if (! _transactional) + ndbout << " (non-transactional)"; + ndbout << " ..."; + if(clear_table(&MyNdb, pTab, ! _transactional) == NDBT_FAILED){ res = NDBT_FAILED; ndbout << "FAILED" << endl; } @@ -103,7 +100,7 @@ int main(int argc, char** argv){ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, - bool commit_across_open_cursor, int parallelism) + bool fetch_across_commit, int parallelism) { // Scan all records exclusive and delete // them one by one @@ -134,7 +131,7 @@ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, } goto failed; } - + pOp = pTrans->getNdbScanOperation(pTab->getName()); if (pOp == NULL) { goto failed; @@ -165,7 +162,7 @@ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, } while((check = rs->nextResult(false)) == 0); if(check != -1){ - if (commit_across_open_cursor) { + if (fetch_across_commit) { check = pTrans->execute(Commit); pTrans->restart(); // new tx id } else { @@ -196,7 +193,7 @@ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, } goto failed; } - if (! commit_across_open_cursor && pTrans->execute(Commit) != 0) { + if (! fetch_across_commit && pTrans->execute(Commit) != 0) { err = pTrans->getNdbError(); goto failed; } diff --git a/sql/item.cc b/sql/item.cc index 5964ed388c6..7c9f6ec77fb 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -2716,14 +2716,6 @@ void Item_ref_null_helper::print(String *str) } -void Item_null_helper::print(String *str) -{ - str->append("<null_helper>(", 14); - store->print(str); - str->append(')'); -} - - bool Item_default_value::eq(const Item *item, bool binary_cmp) const { return item->type() == DEFAULT_VALUE_ITEM && diff --git a/sql/item.h b/sql/item.h index 1d01ce0d3f3..66da7ad4e74 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1045,19 +1045,6 @@ public: } }; -class Item_null_helper :public Item_ref_null_helper -{ - Item *store; -public: - Item_null_helper(Item_in_subselect* master, Item *item, - const char *table_name_par, const char *field_name_par) - :Item_ref_null_helper(master, &item, table_name_par, field_name_par), - store(item) - { ref= &store; } - void print(String *str); -}; - - /* The following class is used to optimize comparing of date and bigint columns We need to save the original item ('ref') to be able to call diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index c8405a9f8f4..8241a8e0402 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -822,13 +822,13 @@ Item_in_subselect::single_value_transformer(JOIN *join, } else { - select_lex->item_list.empty(); - select_lex->item_list.push_back(new Item_int("Not_used", - (longlong) 1, 21)); - select_lex->ref_pointer_array[0]= select_lex->item_list.head(); if (select_lex->table_list.elements) { Item *having= item, *orig_item= item; + select_lex->item_list.empty(); + select_lex->item_list.push_back(new Item_int("Not_used", + (longlong) 1, 21)); + select_lex->ref_pointer_array[0]= select_lex->item_list.head(); item= func->create(expr, item); if (!abort_on_null && orig_item->maybe_null) { @@ -875,9 +875,11 @@ Item_in_subselect::single_value_transformer(JOIN *join, select_lex->having= join->having= func->create(expr, - new Item_null_helper(this, item, - (char *)"<no matter>", - (char *)"<result>")); + new Item_ref_null_helper(this, + select_lex->ref_pointer_array, + (char *)"<no matter>", + (char *)"<result>")); + select_lex->having_fix_field= 1; if (join->having->fix_fields(thd, join->tables_list, 0)) diff --git a/sql/set_var.cc b/sql/set_var.cc index 681c70c4c02..f845cdd0c5d 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -850,9 +850,9 @@ struct show_var_st init_vars[]= { {sys_old_passwords.name, (char*) &sys_old_passwords, SHOW_SYS}, {"open_files_limit", (char*) &open_files_limit, SHOW_LONG}, {"pid_file", (char*) pidfile_name, SHOW_CHAR}, - {sys_prepared_stmt_count.name, (char*) &sys_prepared_stmt_count, SHOW_SYS}, {"port", (char*) &mysqld_port, SHOW_INT}, {sys_preload_buff_size.name, (char*) &sys_preload_buff_size, SHOW_SYS}, + {sys_prepared_stmt_count.name, (char*) &sys_prepared_stmt_count, SHOW_SYS}, {"protocol_version", (char*) &protocol_version, SHOW_INT}, {sys_query_alloc_block_size.name, (char*) &sys_query_alloc_block_size, SHOW_SYS}, diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index e25a428aaa7..51ef3f31b26 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -906,13 +906,20 @@ static int check_connection(THD *thd) *passwd++ : strlen(passwd); db= thd->client_capabilities & CLIENT_CONNECT_WITH_DB ? db + passwd_len + 1 : 0; + uint db_len= db ? strlen(db) : 0; + + if (passwd + passwd_len + db_len > (char *)net->read_pos + pkt_len) + { + inc_host_errors(&thd->remote.sin_addr); + return ER_HANDSHAKE_ERROR; + } /* Since 4.1 all database names are stored in utf8 */ if (db) { db_buff[copy_and_convert(db_buff, sizeof(db_buff)-1, system_charset_info, - db, strlen(db), + db, db_len, thd->charset(), &dummy_errors)]= 0; db= db_buff; } @@ -1379,7 +1386,17 @@ bool dispatch_command(enum enum_server_command command, THD *thd, { char *db, *tbl_name; uint db_len= *(uchar*) packet; + if (db_len >= packet_length || db_len > NAME_LEN) + { + send_error(thd, ER_UNKNOWN_COM_ERROR); + break; + } uint tbl_len= *(uchar*) (packet + db_len + 1); + if (db_len+tbl_len+2 > packet_length || tbl_len > NAME_LEN) + { + send_error(thd, ER_UNKNOWN_COM_ERROR); + break; + } statistic_increment(com_other, &LOCK_status); thd->enable_slow_log= opt_log_slow_admin_statements; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index c9513ec71ab..631d2d89bbb 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -601,7 +601,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, if (need_to_change_arena) thd->restore_backup_item_arena(thd->current_arena, &backup_arena); - if (! sql_field->def) + if (sql_field->def == NULL) { /* Could not convert */ my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name); @@ -611,15 +611,30 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, if (sql_field->sql_type == FIELD_TYPE_SET) { - if (sql_field->def) + if (sql_field->def != NULL) { char *not_used; uint not_used2; bool not_found= 0; String str, *def= sql_field->def->val_str(&str); - def->length(cs->cset->lengthsp(cs, def->ptr(), def->length())); - (void) find_set(interval, def->ptr(), def->length(), - cs, ¬_used, ¬_used2, ¬_found); + if (def == NULL) /* SQL "NULL" maps to NULL */ + { + if ((sql_field->flags & NOT_NULL_FLAG) != 0) + { + my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name); + DBUG_RETURN(-1); + } + + /* else, NULL is an allowed value */ + (void) find_set(interval, NULL, 0, + cs, ¬_used, ¬_used2, ¬_found); + } + else /* not NULL */ + { + (void) find_set(interval, def->ptr(), def->length(), + cs, ¬_used, ¬_used2, ¬_found); + } + if (not_found) { my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name); @@ -631,14 +646,28 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, } else /* FIELD_TYPE_ENUM */ { - if (sql_field->def) + DBUG_ASSERT(sql_field->sql_type == FIELD_TYPE_ENUM); + if (sql_field->def != NULL) { String str, *def= sql_field->def->val_str(&str); - def->length(cs->cset->lengthsp(cs, def->ptr(), def->length())); - if (!find_type2(interval, def->ptr(), def->length(), cs)) + if (def == NULL) /* SQL "NULL" maps to NULL */ { - my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name); - DBUG_RETURN(-1); + if ((sql_field->flags & NOT_NULL_FLAG) != 0) + { + my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name); + DBUG_RETURN(-1); + } + + /* else, the defaults yield the correct length for NULLs. */ + } + else /* not NULL */ + { + def->length(cs->cset->lengthsp(cs, def->ptr(), def->length())); + if (find_type2(interval, def->ptr(), def->length(), cs) == 0) /* not found */ + { + my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name); + DBUG_RETURN(-1); + } } } calculate_interval_lengths(cs, interval, &sql_field->length, &dummy); @@ -1677,7 +1706,9 @@ mysql_rename_table(enum db_type base, } } delete file; - if (error) + if (error == HA_ERR_WRONG_COMMAND) + my_error(ER_NOT_SUPPORTED_YET, MYF(0), "ALTER TABLE"); + else if (error) my_error(ER_ERROR_ON_RENAME, MYF(0), from, to, error); DBUG_RETURN(error != 0); } @@ -2164,10 +2195,15 @@ send_result_message: table->table->version=0; // Force close of table else if (open_for_modify) { - pthread_mutex_lock(&LOCK_open); - remove_table_from_cache(thd, table->table->table_cache_key, - table->table->real_name, RTFC_NO_FLAG); - pthread_mutex_unlock(&LOCK_open); + if (table->table->tmp_table) + table->table->file->info(HA_STATUS_CONST); + else + { + pthread_mutex_lock(&LOCK_open); + remove_table_from_cache(thd, table->table->table_cache_key, + table->table->real_name, RTFC_NO_FLAG); + pthread_mutex_unlock(&LOCK_open); + } /* May be something modified consequently we have to invalidate cache */ query_cache_invalidate3(thd, table->table, 0); } diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index b161ec13073..efe42a035e6 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -28,7 +28,7 @@ Release: %{release} License: %{license} Source: http://www.mysql.com/Downloads/MySQL-@MYSQL_BASE_VERSION@/mysql-%{mysql_version}.tar.gz URL: http://www.mysql.com/ -Packager: Lenz Grimmer <build@mysql.com> +Packager: MySQL Production Engineering Team <build@mysql.com> Vendor: MySQL AB Provides: msqlormysql MySQL-server mysql BuildRequires: ncurses-devel @@ -297,7 +297,6 @@ then fi BuildMySQL "--enable-shared \ - --without-openssl \ --with-berkeley-db \ --with-innodb \ --with-ndbcluster \ @@ -307,16 +306,23 @@ BuildMySQL "--enable-shared \ --with-example-storage-engine \ --with-blackhole-storage-engine \ --with-embedded-server \ - --with-comment=\"MySQL Community Edition - Max (GPL)\" \ - --with-server-suffix='-Max'" + --with-comment=\"MySQL Community Edition - Experimental (GPL)\" \ + --with-server-suffix='-max'" + +# We might want to save the config log file +if test -n "$MYSQL_MAXCONFLOG_DEST" +then + cp -fp config.log "$MYSQL_MAXCONFLOG_DEST" +fi make -i test-force || true # Save mysqld-max -mv sql/mysqld sql/mysqld-max -nm --numeric-sort sql/mysqld-max > sql/mysqld-max.sym +./libtool --mode=execute cp sql/mysqld sql/mysqld-max +./libtool --mode=execute nm --numeric-sort sql/mysqld-max > sql/mysqld-max.sym + # Save the perror binary so it supports the NDB error codes (BUG#13740) -mv extra/perror extra/perror.ndb +./libtool --mode=execute cp extra/perror extra/perror.ndb # Install the ndb binaries (cd ndb; make install DESTDIR=$RBR) @@ -362,7 +368,14 @@ BuildMySQL "--disable-shared \ --with-innodb \ --without-vio \ --without-openssl" -nm --numeric-sort sql/mysqld > sql/mysqld.sym + +./libtool --mode=execute nm --numeric-sort sql/mysqld > sql/mysqld.sym + +# We might want to save the config log file +if test -n "$MYSQL_CONFLOG_DEST" +then + cp -fp config.log "$MYSQL_CONFLOG_DEST" +fi make -i test-force || true @@ -456,7 +469,7 @@ usermod -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true # owns all database files. chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir -# Initiate databases +# Initiate databases if needed %{_bindir}/mysql_install_db --rpm --user=%{mysqld_user} # Change permissions again to fix any new files. @@ -543,31 +556,31 @@ fi %attr(755, root, root) %{_bindir}/isamchk %attr(755, root, root) %{_bindir}/isamlog -%attr(755, root, root) %{_bindir}/myisamchk +%attr(755, root, root) %{_bindir}/my_print_defaults %attr(755, root, root) %{_bindir}/myisam_ftdump +%attr(755, root, root) %{_bindir}/myisamchk %attr(755, root, root) %{_bindir}/myisamlog %attr(755, root, root) %{_bindir}/myisampack -%attr(755, root, root) %{_bindir}/my_print_defaults -%attr(755, root, root) %{_bindir}/mysqlbug %attr(755, root, root) %{_bindir}/mysql_convert_table_format %attr(755, root, root) %{_bindir}/mysql_create_system_tables -%attr(755, root, root) %{_bindir}/mysqld_multi -%attr(755, root, root) %{_bindir}/mysqld_safe %attr(755, root, root) %{_bindir}/mysql_explain_log %attr(755, root, root) %{_bindir}/mysql_fix_extensions %attr(755, root, root) %{_bindir}/mysql_fix_privilege_tables -%attr(755, root, root) %{_bindir}/mysqlhotcopy %attr(755, root, root) %{_bindir}/mysql_install_db %attr(755, root, root) %{_bindir}/mysql_secure_installation %attr(755, root, root) %{_bindir}/mysql_setpermission -%attr(755, root, root) %{_bindir}/mysqltest %attr(755, root, root) %{_bindir}/mysql_tzinfo_to_sql %attr(755, root, root) %{_bindir}/mysql_zap +%attr(755, root, root) %{_bindir}/mysqlbug +%attr(755, root, root) %{_bindir}/mysqld_multi +%attr(755, root, root) %{_bindir}/mysqld_safe +%attr(755, root, root) %{_bindir}/mysqlhotcopy +%attr(755, root, root) %{_bindir}/mysqltest %attr(755, root, root) %{_bindir}/pack_isam %attr(755, root, root) %{_bindir}/perror %attr(755, root, root) %{_bindir}/replace -%attr(755, root, root) %{_bindir}/resolveip %attr(755, root, root) %{_bindir}/resolve_stack_dump +%attr(755, root, root) %{_bindir}/resolveip %attr(755, root, root) %{_bindir}/safe_mysqld %attr(755, root, root) %{_sbindir}/mysqld @@ -662,6 +675,11 @@ fi %{_libdir}/mysql/libmysys.a %{_libdir}/mysql/libnisam.a %{_libdir}/mysql/libvio.a +%if %{STATIC_BUILD} +%else +%{_libdir}/mysql/libz.a +%{_libdir}/mysql/libz.la +%endif %files shared %defattr(-, root, root, 0755) @@ -690,15 +708,35 @@ fi # itself - note that they must be ordered by date (important when # merging BK trees) %changelog +* Mon May 01 2006 Kent Boortz <kent@mysql.com> + +- Use "./libtool --mode=execute" instead of searching for the + executable in current directory and ".libs". + * Sat Apr 01 2006 Kent Boortz <kent@mysql.com> - Set $LDFLAGS from $MYSQL_BUILD_LDFLAGS +* Fri Mar 03 2006 Kent Boortz <kent@mysql.com> + +- Can't use bundled zlib when doing static build. Might be a + automake/libtool problem, having two .la files, "libmysqlclient.la" + and "libz.la", on the same command line to link "thread_test" + expands to too many "-lc", "-lpthread" and other libs giving hard + to nail down duplicate symbol defintion problems. + * Fri Jan 10 2006 Joerg Bruehe <joerg@mysql.com> - Use "-i" on "make test-force"; this is essential for later evaluation of this log file. +* Fri Dec 12 2005 Rodrigo Novo <rodrigo@mysql.com> + +- Added zlib to the list of (static) libraries installed +- Added check against libtool wierdness (WRT: sql/mysqld || sql/.libs/mysqld) +- Compile MySQL with bundled zlib +- Fixed %packager name to "MySQL Production Engineering Team" + * Mon Dec 05 2005 Joerg Bruehe <joerg@mysql.com> - Avoid using the "bundled" zlib on "shared" builds: |