diff --git a/.bzrignore b/.bzrignore index 329c5e227ca..d44aefea583 100644 --- a/.bzrignore +++ b/.bzrignore @@ -5,6 +5,7 @@ *.bb *.bbg *.bin +*.cdf *.core *.d *.da diff --git a/CMakeLists.txt b/CMakeLists.txt index 1bdb1e01612..6395ae17a14 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -149,21 +149,47 @@ ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR ADD_DEFINITIONS("-D_WINDOWS -D__WIN__ -D_CRT_SECURE_NO_DEPRECATE") IF(EMBED_MANIFESTS) - # Search for the Manifest tool. CMake will first search it's defaults - # (CMAKE_FRAMEWORK_PATH, CMAKE_APPBUNDLE_PATH, CMAKE_PROGRAM_PATH and - # the system PATH) followed by the listed paths which are the current - # possible defaults and should be updated when necessary. The custom - # manifests are designed to be compatible with all mt versions. + # Search for the tools (mt, makecat, signtool) necessary for embedding + # manifests and signing executables with the MySQL AB authenticode cert. + # + # CMake will first search it's defaults (CMAKE_FRAMEWORK_PATH, + # CMAKE_APPBUNDLE_PATH, CMAKE_PROGRAM_PATH and the system PATH) followed + # by the listed paths which are the current possible defaults and should be + # updated when necessary. + # + # The custom manifests are designed to be compatible with all mt versions. + # The MySQL AB Authenticode certificate is available only internally. + # Others should store a single signing certificate in a local cryptographic + # service provider and alter the signtool command as necessary. FIND_PROGRAM(HAVE_MANIFEST_TOOL NAMES mt PATHS "$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/VC/bin" "$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/Common7/Tools/Bin" "$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/SDK/v2.0/Bin") + FIND_PROGRAM(HAVE_CATALOG_TOOL NAMES makecat + PATHS + "$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/Common7/Tools/Bin") + FIND_PROGRAM(HAVE_SIGN_TOOL NAMES signtool + PATHS + "$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/Common7/Tools/Bin" + "$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/SDK/v2.0/Bin") + IF(HAVE_MANIFEST_TOOL) - MESSAGE(STATUS "Found Mainfest Tool. Embedding custom manifests.") + MESSAGE(STATUS "Found Mainfest Tool.") ELSE(HAVE_MANIFEST_TOOL) MESSAGE(FATAL_ERROR "Manifest tool, mt.exe, can't be found.") ENDIF(HAVE_MANIFEST_TOOL) + IF(HAVE_CATALOG_TOOL) + MESSAGE(STATUS "Found Catalog Tool.") + ELSE(HAVE_CATALOG_TOOL) + MESSAGE(FATAL_ERROR "Catalog tool, makecat.exe, can't be found.") + ENDIF(HAVE_CATALOG_TOOL) + IF(HAVE_SIGN_TOOL) + MESSAGE(STATUS "Found Sign Tool. Embedding custom manifests and signing executables.") + ELSE(HAVE_SIGN_TOOL) + MESSAGE(FATAL_ERROR "Sign tool, signtool.exe, can't be found.") + ENDIF(HAVE_SIGN_TOOL) + # Disable automatic manifest generation. STRING(REPLACE "/MANIFEST" "/MANIFEST:NO" CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS}) diff --git a/config/ac-macros/ha_ndbcluster.m4 b/config/ac-macros/ha_ndbcluster.m4 index c6327c46f15..60ca92abc10 100644 --- a/config/ac-macros/ha_ndbcluster.m4 +++ b/config/ac-macros/ha_ndbcluster.m4 @@ -277,6 +277,13 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [ ndb_bin_am_ldflags="" fi + # building dynamic breaks on AIX. (If you want to try it and get unresolved + # __vec__delete2 and some such, try linking against libhC.) + case "$host_os" in + aix3.* | aix4.0.* | aix4.1.*) ;; + *) ndb_bin_am_ldflags="-static";; + esac + # libndbclient versioning when linked with GNU ld. if $LD --version 2>/dev/null|grep -q GNU; then NDB_LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_builddir)/storage/ndb/src/libndb.ver" diff --git a/config/ac-macros/large_file.m4 b/config/ac-macros/large_file.m4 index 00c2fdf614e..2639cec5fb7 100644 --- a/config/ac-macros/large_file.m4 +++ b/config/ac-macros/large_file.m4 @@ -127,14 +127,9 @@ AC_DEFUN([MYSQL_SYS_LARGEFILE], hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) ac_cv_sys_largefile_source=1 ;; esac]) - AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, - ac_cv_sys_large_files, - [Large files support on AIX-style hosts.], - [case "$host_os" in - # AIX 4.2 and later - aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*) - ac_cv_sys_large_files=1 ;; - esac]) + + # AIX 4.2 and later -- do nothing, include standards.h instead. + # this goes for both GNU and IBM C and C++ compilers. fi ]) diff --git a/extra/yassl/taocrypt/src/coding.cpp b/extra/yassl/taocrypt/src/coding.cpp index 68055b3aff4..55fe31831e3 100644 --- a/extra/yassl/taocrypt/src/coding.cpp +++ b/extra/yassl/taocrypt/src/coding.cpp @@ -184,7 +184,7 @@ void Base64Decoder::Decode() { word32 bytes = coded_.size(); word32 plainSz = bytes - ((bytes + (pemLineSz - 1)) / pemLineSz); - plainSz = (plainSz * 3 + 3) / 4; + plainSz = ((plainSz * 3) / 4) + 3; decoded_.New(plainSz); word32 i = 0; diff --git a/include/mysql.h b/include/mysql.h index 489813bc154..da97531509f 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -27,6 +27,10 @@ #ifndef _mysql_h #define _mysql_h +#ifdef _AIX /* large-file support will break without this */ +#include +#endif + #ifdef __CYGWIN__ /* CYGWIN implements a UNIX API */ #undef WIN #undef _WIN diff --git a/mysql-test/include/mix1.inc b/mysql-test/include/mix1.inc index 7ca6bb57909..32a3e6b3ebd 100644 --- a/mysql-test/include/mix1.inc +++ b/mysql-test/include/mix1.inc @@ -930,10 +930,17 @@ DISCONNECT con2; DROP PROCEDURE p1; DROP TABLE t1; +# +# Bug #28125: ERROR 2013 when adding index. +# +create table t1(a text) engine=innodb default charset=utf8; +insert into t1 values('aaa'); +alter table t1 add index(a(1024)); +show create table t1; +drop table t1; --echo End of 5.0 tests - # Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY # UPDATE": if the row is updated, it's like a regular UPDATE: # LAST_INSERT_ID() is not affected. diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result index cfb445e9427..ca936cd5fde 100644 --- a/mysql-test/r/federated.result +++ b/mysql-test/r/federated.result @@ -1844,6 +1844,43 @@ C3A4C3B6C3BCC39F D18DD184D184D0B5D0BAD182D0B8D0B2D0BDD183D18E drop table federated.t1; drop table federated.t1; +CREATE TABLE federated.t1 ( +categoryId int(11) NOT NULL AUTO_INCREMENT, +domainId varchar(745) NOT NULL DEFAULT '', +categoryName varchar(255) NOT NULL DEFAULT '', +PRIMARY KEY (categoryId), +UNIQUE KEY idx_unique_category_categoryName (domainId, categoryName), +KEY idx_category_domainId (domainId) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +CREATE TABLE federated.t1 ( +categoryId int(11) NOT NULL AUTO_INCREMENT, +domainId varchar(745) NOT NULL DEFAULT '', +categoryName varchar(255) NOT NULL DEFAULT '', +PRIMARY KEY (categoryId), +UNIQUE KEY idx_unique_category_categoryName (domainId, categoryName), +KEY idx_category_domainId (domainId) +) ENGINE=FEDERATED DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +insert into federated.t1 (domainId, categoryName) values ( '1231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231 300', '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345 250'); +insert into federated.t1 (domainId, categoryName) values ( '12312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312 301', '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456 250'); +insert into federated.t1 (domainId, categoryName) values ('a', 'b'); +select categoryId from federated.t1 order by domainId, categoryName; +categoryId +1 +2 +3 +select categoryId from federated.t1 where domainId='a' and categoryName='b' order by categoryId; +categoryId +3 +select categoryId from federated.t1 where domainId='a' and categoryName='b' order by categoryId; +categoryId +3 +select categoryId from federated.t1 where domainId<>'a' and categoryName<>'b' order by categoryId; +categoryId +1 +2 +drop table federated.t1; +drop table federated.t1; create table federated.t1 (a int primary key, b varchar(64)) DEFAULT CHARSET=utf8; create table federated.t1 (a int primary key, b varchar(64)) diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index 947f8abcc53..26000fa27b7 100644 --- a/mysql-test/r/innodb_mysql.result +++ b/mysql-test/r/innodb_mysql.result @@ -755,7 +755,7 @@ drop table t1,t2; create table t1(f1 varchar(800) binary not null, key(f1)) character set utf8 collate utf8_general_ci; Warnings: -Warning 1071 Specified key was too long; max key length is 765 bytes +Warning 1071 Specified key was too long; max key length is 767 bytes insert into t1 values('aaa'); drop table t1; CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c FLOAT, KEY b(b)) ENGINE = INNODB; @@ -1110,6 +1110,19 @@ CALL p1(); CALL p1(); DROP PROCEDURE p1; DROP TABLE t1; +create table t1(a text) engine=innodb default charset=utf8; +insert into t1 values('aaa'); +alter table t1 add index(a(1024)); +Warnings: +Warning 1071 Specified key was too long; max key length is 767 bytes +Warning 1071 Specified key was too long; max key length is 767 bytes +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text, + KEY `a` (`a`(255)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 +drop table t1; End of 5.0 tests CREATE TABLE `t2` ( `k` int(11) NOT NULL auto_increment, diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index 7a76e45ee10..f10ae4b4df5 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -319,6 +319,13 @@ INSERT INTO t1 VALUES ('0123456789'); flush logs; DROP TABLE t1; # Query thread_id=REMOVED exec_time=REMOVED error_code=REMOVED +flush logs; +create table t1(a int); +insert into t1 values(connection_id()); +flush logs; +drop table t1; +1 +drop table t1; End of 5.0 tests flush logs; End of 5.1 tests diff --git a/mysql-test/r/ssl_8k_key.result b/mysql-test/r/ssl_8k_key.result new file mode 100644 index 00000000000..b33a1d2854f --- /dev/null +++ b/mysql-test/r/ssl_8k_key.result @@ -0,0 +1,2 @@ +Variable_name Value +Ssl_cipher DHE-RSA-AES256-SHA diff --git a/mysql-test/std_data/server8k-cert.pem b/mysql-test/std_data/server8k-cert.pem new file mode 100644 index 00000000000..a0750f9e69e --- /dev/null +++ b/mysql-test/std_data/server8k-cert.pem @@ -0,0 +1,51 @@ +-----BEGIN CERTIFICATE----- +MIIJHDCCBQQCAQEwDQYJKoZIhvcNAQEEBQAwTjELMAkGA1UEBhMCU0UxEDAOBgNV +BAgTB1VwcHNhbGExETAPBgNVBAoTCE15U1FMIEFCMQ0wCwYDVQQLEwRUZXN0MQsw +CQYDVQQDEwJDQTAeFw0wNzA3MTMwNzU2MjVaFw0xMDA0MDgwNzU2MjVaMFoxCzAJ +BgNVBAYTAlNFMRAwDgYDVQQIEwdVcHBzYWxhMRkwFwYDVQQKFBBNeVNRTCAgIAog +ICAgIEFCMQ0wCwYDVQQLEwRUZXN0MQ8wDQYDVQQDEwZzZXJ2ZXIwggQiMA0GCSqG +SIb3DQEBAQUAA4IEDwAwggQKAoIEAQDUFlh/3mwov5YaICFXOdJXgHV/uDkTjXB6 +9oxlipshQaYPX8LDT5vhI3gPciS1Z1sRE2dTcC4Mk2K4LDUIjp3WkeTfFAHZPV3E +Y+3OH/ftH4N6SEIBTKE4EY6ah0nJtU98M0JhxOh5zHje6zQp1SkBnhEOQYexYRqj +OtGloZ9RyF0iFAXcyu2Ap14u37l5Yla0cyPzvZqP4mFYlcXwaRfAacJmqMM1vuQv +Fx1J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40jKcdycdGvVu +gcTUzuRl1+Ikfk/MXKPbdi4A5Pjtz6AG4Ez9q5j7X77JqskTI5Z/f1RPiKwFBJHg +cN4+BPnEuSWGcjiNDOfQxhk5exlWRf/gpEhnQpGHe3a7tZgfxHUb/pWU9BYpf8OH +vtV3WSDXlUqsEEH6/bmvj8lmFWJLmeZv+qLy1wHxcXR9/GJ6TwCF8niQIl3MrBAL +sKPLft1drmpqdIQpZQIJxtN/AQuD9mxEdW7XA6rkvFySKcswJpS1QjkSWpafCBWE +wu+SPxZL8oFrnNMTU3JloUjcRp70FkNXLLm/Dy+MjW2qFBtIoBgNptVGp94L1uZS +amd2XJMcOQ+X9fcH3wAdM3IHGn3NiLf6eTW92JNNA0IN6aNtyVaJKmFJ1JfXOl9r +ujr4SorRSesaerjIcuzW1u1YE5RlgeI4kizV2/D5kYc= +-----END CERTIFICATE----- diff --git a/mysql-test/std_data/server8k-key.pem b/mysql-test/std_data/server8k-key.pem new file mode 100644 index 00000000000..608593a5096 --- /dev/null +++ b/mysql-test/std_data/server8k-key.pem @@ -0,0 +1,99 @@ +-----BEGIN RSA PRIVATE KEY----- +MIISKQIBAAKCBAEA1BZYf95sKL+WGiAhVznSV4B1f7g5E41wevaMZYqbIUGmD1/C +w0+b4SN4D3IktWdbERNnU3AuDJNiuCw1CI6d1pHk3xQB2T1dxGPtzh/37R+DekhC +AUyhOBGOmodJybVPfDNCYcToecx43us0KdUpAZ4RDkGHsWEaozrRpaGfUchdIhQF +3MrtgKdeLt+5eWJWtHMj872aj+JhWJXF8GkXwGnCZqjDNb7kLxcdSSE1EwboDBd1 +RmdRdLcOtxCFB/xVv1lp3D6rxtfJ2uNKpb/WZAcNBYWXikvHCiSGOcuCd9I5/3lf +KdZUzuyvgEk7hmVpnUQ4I1BtGPThrirDz6GhOppdB05zAbAUkH11KvV5MBrfA04D +4qAChwR4y2yCxMuBTGFq5U2ZT08zasoWsnnP9k9eaA5WnTUreyaQy6V+9FBAlxYX +RBsbBsbV3Smy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2idqSAzqo4TkR1 +j9U0fdW2rIBDo/qFmBBdJhYVjYLj4qR8CEEoIjshD4Nztf1xRM5C8irE/gJcT5+r +4bPJJ5TjAtHxPiQqZruSprSEUbMsPqBap64ow0SmbNNWSgyaz2ha1rG0p52NBzH4 +XM52LBqS9QHPHvB0ooYfBTfPpDM3CePuuNyzjPAw86ncUo38FKXuc2oViJJ6C5I7 +v2sKhLK5gu3uPBB2ludDEXSpWBqiraynolOT/o52r+taYp9YY2WU3GrhOiV/A1FV +Nl118xiF6FOFpEeTbhHvy27A8kZEKXgeSs+f4aC0XG9kLVD1CiCbQiqHTDcDS4nV +O1N1eQxhP81X+YKE4Lgufh07REqYVwtCj2lQcMp73WDyfBLKTEFlmHusoqmT5JCH +X0BWNjk5Dn1g5h63/lQb+EjNRILBhDFYhrDRDQtw5p0/7IY3AcNKDUHv+XGn +-----END RSA PRIVATE KEY----- diff --git a/mysql-test/t/federated.test b/mysql-test/t/federated.test index efca7f3232d..6597c77e798 100644 --- a/mysql-test/t/federated.test +++ b/mysql-test/t/federated.test @@ -1632,6 +1632,46 @@ drop table federated.t1; connection slave; drop table federated.t1; +# +# Bug#26909: Specified key was too long; max key length is 255 bytes +# when creating a table +# +connection slave; +CREATE TABLE federated.t1 ( + categoryId int(11) NOT NULL AUTO_INCREMENT, + domainId varchar(745) NOT NULL DEFAULT '', + categoryName varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (categoryId), + UNIQUE KEY idx_unique_category_categoryName (domainId, categoryName), + KEY idx_category_domainId (domainId) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +connection master; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + categoryId int(11) NOT NULL AUTO_INCREMENT, + domainId varchar(745) NOT NULL DEFAULT '', + categoryName varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (categoryId), + UNIQUE KEY idx_unique_category_categoryName (domainId, categoryName), + KEY idx_category_domainId (domainId) + ) ENGINE=FEDERATED DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + + +insert into federated.t1 (domainId, categoryName) values ( '1231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231 300', '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345 250'); +insert into federated.t1 (domainId, categoryName) values ( '12312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312 301', '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456 250'); +insert into federated.t1 (domainId, categoryName) values ('a', 'b'); + +select categoryId from federated.t1 order by domainId, categoryName; +select categoryId from federated.t1 where domainId='a' and categoryName='b' order by categoryId; +select categoryId from federated.t1 where domainId='a' and categoryName='b' order by categoryId; +select categoryId from federated.t1 where domainId<>'a' and categoryName<>'b' order by categoryId; + +drop table federated.t1; + +connection slave; +drop table federated.t1; # # BUG#21019 Federated Engine does not support REPLACE/INSERT IGNORE/UPDATE IGNORE diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index 92f4b34da83..25bd9a402ae 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -219,6 +219,27 @@ flush logs; DROP TABLE t1; --exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000012 | grep 'Query' | sed 's/[0-9]\{1,\}/REMOVED/g' +# +# Bug #29928: incorrect connection_id() restoring from mysqlbinlog out +# +flush logs; +create table t1(a int); +insert into t1 values(connection_id()); +let $a= `select a from t1`; +flush logs; +--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000014 > $MYSQLTEST_VARDIR/tmp/bug29928.sql +drop table t1; +connect (con1, localhost, root, , test); +connection con1; +--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug29928.sql +--remove_file $MYSQLTEST_VARDIR/tmp/bug29928.sql +let $b= `select a from t1`; +disconnect con1; +connection default; +let $c= `select $a=$b`; +--echo $c +drop table t1; + --echo End of 5.0 tests # @@ -226,7 +247,7 @@ DROP TABLE t1; # flush logs; --error 1 ---exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000014 >/dev/null 2>/dev/null ---exec $MYSQL_BINLOG --force-if-open $MYSQLTEST_VARDIR/log/master-bin.000014 >/dev/null 2>/dev/null +--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000016 >/dev/null 2>/dev/null +--exec $MYSQL_BINLOG --force-if-open $MYSQLTEST_VARDIR/log/master-bin.000016 >/dev/null 2>/dev/null --echo End of 5.1 tests diff --git a/mysql-test/t/ssl_8k_key.test b/mysql-test/t/ssl_8k_key.test new file mode 100644 index 00000000000..b4203e68445 --- /dev/null +++ b/mysql-test/t/ssl_8k_key.test @@ -0,0 +1,6 @@ +-- source include/have_ssl.inc +# +# Bug#29784 YaSSL assertion failure when reading 8k key. +# +--exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SHOW STATUS LIKE 'ssl_Cipher'" 2>&1 + diff --git a/mysql-test/t/status.test b/mysql-test/t/status.test index 1208393aa09..9fd54d4766d 100644 --- a/mysql-test/t/status.test +++ b/mysql-test/t/status.test @@ -22,13 +22,13 @@ connection con2; lock tables t1 read; unlock tables; lock tables t1 read; -let $ID= `select connection_id()`; connection con1; +let $ID= `select connection_id()`; --send update t1 set n = 3; connection con2; # wait for the other query to start executing -let $wait_condition= select 1 from INFORMATION_SCHEMA.PROCESSLIST where ID = $ID and STATE = 0; +let $wait_condition= select 1 from INFORMATION_SCHEMA.PROCESSLIST where ID = $ID and STATE = "Locked"; --source include/wait_condition.inc unlock tables; connection con1; diff --git a/scripts/mysql_setpermission.sh b/scripts/mysql_setpermission.sh index 9699cd28047..1f5509f9955 100644 --- a/scripts/mysql_setpermission.sh +++ b/scripts/mysql_setpermission.sh @@ -19,13 +19,14 @@ ## 1.3 Applied patch provided by Martin Mokrejs ## (General code cleanup, use the GRANT statement instead of updating ## the privilege tables directly, added option to revoke privileges) +## 1.4 Remove option 6 which attempted to erroneously grant global privileges #### TODO # # empty ... suggestions ... mail them to me ... -$version="1.3"; +$version="1.4"; use DBI; use Getopt::Long; @@ -103,13 +104,9 @@ sub q1 { # first question ... print " existing database and host combination (user can do\n"; print " SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,\n"; print " LOCK TABLES,CREATE TEMPORARY TABLES)\n"; - print " 6. Create/append database administrative privileges for an\n"; - print " existing database and host combination (user can do\n"; - print " SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,\n"; - print " CREATE TEMPORARY TABLES,SHOW DATABASES,PROCESS)\n"; - print " 7. Create/append full privileges for an existing database\n"; + print " 6. Create/append full privileges for an existing database\n"; print " and host combination (user has FULL privilege)\n"; - print " 8. Remove all privileges for for an existing database and\n"; + print " 7. Remove all privileges for for an existing database and\n"; print " host combination.\n"; print " (user will have all permission fields set to N)\n"; print " 0. exit this program\n"; @@ -117,10 +114,10 @@ sub q1 { # first question ... while () { $answer = $_; chomp($answer); - if ($answer =~ /^[12345678]$/) { + if ($answer =~ /^[1234567]$/) { if ($answer == 1) { setpwd(); - } elsif ($answer =~ /^[2345678]$/) { + } elsif ($answer =~ /^[234567]$/) { addall($answer); } else { print "Sorry, something went wrong. With such option number you should not get here.\n\n"; @@ -233,7 +230,7 @@ sub addall { } } - if ( ( !$todo ) or not ( $todo =~ m/^[2-8]$/ ) ) { + if ( ( !$todo ) or not ( $todo =~ m/^[2-7]$/ ) ) { print STDERR "Sorry, select option $todo isn't known inside the program .. See ya\n"; quit(); } @@ -256,12 +253,9 @@ sub addall { # user privileges: SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,CREATE TEMPORARY TABLES $sth = $dbh->do("GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,CREATE TEMPORARY TABLES ON $db.* TO $user@\"$host\" IDENTIFIED BY \'$pass\'") || die $dbh->errstr; } elsif ($todo == 6) { - # admin privileges: GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,CREATE TEMPORARY TABLES,SHOW DATABASES,PROCESS - $sth = $dbh->do("GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,CREATE TEMPORARY TABLES,SHOW DATABASES,PROCESS ON $db.* TO $user@\"$host\" IDENTIFIED BY \'$pass\'") || die $dbh->errstr; - } elsif ($todo == 7) { # all privileges $sth = $dbh->do("GRANT ALL ON $db.* TO \'$user\'\@\'$host\' IDENTIFIED BY \'$pass\'") || die $dbh->errstr; - } elsif ($todo == 8) { + } elsif ($todo == 7) { # all privileges set to N $sth = $dbh->do("REVOKE ALL ON *.* FROM \'$user\'\@\'$host\'") || die $dbh->errstr; } diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 597bf38a518..e6f7ff7b3cb 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -14,12 +14,17 @@ KILL_MYSQLD=1; MYSQLD= niceness=0 -# Default on, unless --log-error is specified (and before options are parsed) -syslog=2 +# Initial logging status: error log is not open, and not using syslog +logging=init +want_syslog=0 +syslog_tag= user=@MYSQLD_USER@ pid_file= err_log= +syslog_tag_mysqld=mysqld +syslog_tag_mysqld_safe=mysqld_safe + trap '' 1 2 3 15 # we shouldn't let anyone kill us umask 007 @@ -46,7 +51,8 @@ Usage: $0 [OPTIONS] --nice=NICE Set the scheduling priority of mysqld --skip-kill-mysqld Don't try to kill stray mysqld processes --syslog Log messages to syslog with 'logger' - --skip-syslog Log messages to error log + --skip-syslog Log messages to error log (default) + --syslog-tag=TAG Pass -t "mysqld-TAG" to 'logger' All other options are passed to the mysqld program. @@ -54,18 +60,46 @@ EOF exit 1 } +my_which () +{ + save_ifs="${IFS-UNSET}" + IFS=: + for file + do + for dir in $PATH + do + if [ -f "$dir/$file" ] + then + echo "$dir/$file" + continue 2 + fi + done + return 1 # Failure, didn't find file in path + done + if [ "$save_ifs" = UNSET ] + then + unset IFS + else + IFS="$save_ifs" + fi + return 0 # Success +} + log_generic () { priority="$1" shift msg="`date +'%y%m%d %H:%M:%S'` mysqld_safe $*" echo "$msg" - if [ $syslog -eq 0 ] - then - echo "$msg" >> "$err_log" - else - logger -i -t mysqld_safe -p "$priority" "$*" - fi + case $logging in + init) ;; # Just echo the message, don't save it anywhere + file) echo "$msg" >> "$err_log" ;; + syslog) logger -t "$syslog_tag_mysqld_safe" -p "$priority" "$*" ;; + *) + echo "Internal program error (non-fatal):" \ + " unknown logging method '$logging'" >&2 + ;; + esac } log_error () { @@ -78,15 +112,23 @@ log_notice () { eval_log_error () { cmd="$1" - if [ $syslog -eq 0 ] - then - cmd="$cmd >> "`shell_quote_string "$err_log"`" 2>&1" - else - # mysqld often (not always) prefixes messages on stdout with a - # timestamp in the form of '%y%m%d %H:%M:%S '; this is redundant - # when logging via syslog, so strip it - cmd="$cmd 2>&1 | sed -e 's/^[0-9]\{6\} [0-9:]\{8\} *//' | logger -i -t mysqld -p daemon.error" - fi + case $logging in + file) cmd="$cmd >> "`shell_quote_string "$err_log"`" 2>&1" ;; + syslog) + # mysqld often prefixes its messages with a timestamp, which is + # redundant when logging to syslog (which adds its own timestamp) + # However, we don't strip the timestamp with sed here, because + # sed buffers output (only GNU sed supports a -u (unbuffered) option) + # which means that messages may not get sent to syslog until the + # mysqld process quits. + cmd="$cmd 2>&1 | logger -t '$syslog_tag_mysqld' -p daemon.error" + ;; + *) + echo "Internal program error (non-fatal):" \ + " unknown logging method '$logging'" >&2 + ;; + esac + #echo "Running mysqld: [$cmd]" eval "$cmd" } @@ -138,8 +180,9 @@ parse_arguments() { --nice=*) niceness="$val" ;; --open-files-limit=*) open_files="$val" ;; --skip-kill-mysqld*) KILL_MYSQLD=0 ;; - --syslog) syslog=1 ;; - --skip-syslog) syslog=0 ;; + --syslog) want_syslog=1 ;; + --skip-syslog) want_syslog=0 ;; + --syslog-tag=*) syslog_tag="$val" ;; --timezone=*) TZ="$val"; export TZ; ;; --help) usage ;; @@ -252,7 +295,19 @@ parse_arguments `$print_defaults $defaults --loose-verbose mysqld_safe safe_mysq parse_arguments PICK-ARGS-FROM-ARGV "$@" # Determine what logging facility to use -if [ -n "$err_log" -o $syslog -eq 0 ] + +# Ensure that 'logger' exists, if it's requested +if [ $want_syslog -eq 1 ] +then + my_which logger > /dev/null 2>&1 + if [ $? -ne 0 ] + then + log_error "--syslog requested, but no 'logger' program found. Please ensure that 'logger' is in your PATH, or do not specify the --syslog option to mysqld_safe." + exit 1 + fi +fi + +if [ -n "$err_log" -o $want_syslog -eq 0 ] then if [ -n "$err_log" ] then @@ -279,14 +334,25 @@ then append_arg_to_args "--log-error=$err_log" - if [ $syslog -eq 1 ] + if [ $want_syslog -eq 1 ] then # User explicitly asked for syslog, so warn that it isn't used - log_error "Can't log to error log and syslog at the same time. Remove all --log-error configuration options for --syslog to take effect. Logging to '$err_log'." + log_error "Can't log to error log and syslog at the same time. Remove all --log-error configuration options for --syslog to take effect." fi - # Don't use syslog since syslog and error log don't mix well - syslog=0 + # Log to err_log file + log_notice "Logging to '$err_log'." + logging=file +else + if [ -n "$syslog_tag" ] + then + # Sanitize the syslog tag + syslog_tag=`echo "$syslog_tag" | sed -e 's/[^a-zA-Z0-9_-]/_/g'` + syslog_tag_mysqld_safe="${syslog_tag_mysqld_safe}-$syslog_tag" + syslog_tag_mysqld="${syslog_tag_mysqld}-$syslog_tag" + fi + log_notice "Logging to syslog." + logging=syslog fi USER_OPTION="" diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index a8aa7d70586..c792e10c3af 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -143,6 +143,10 @@ ADD_CUSTOM_COMMAND( ) ADD_DEPENDENCIES(mysqld${MYSQLD_EXE_SUFFIX} gen_lex_hash) +# Remove the auto-generated files as part of 'Clean Solution' +SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES + "lex_hash.h;message.rc;message.h;sql_yacc.h;sql_yacc.cc") + ADD_LIBRARY(udf_example MODULE udf_example.c udf_example.def) ADD_DEPENDENCIES(udf_example strings) TARGET_LINK_LIBRARIES(udf_example wsock32) diff --git a/sql/item_create.cc b/sql/item_create.cc index fa15b992e5c..06996cdaa3b 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -2861,6 +2861,7 @@ Item* Create_func_connection_id::create(THD *thd) { thd->lex->safe_to_cache_query= 0; + thd->thread_specific_used= TRUE; return new (thd->mem_root) Item_func_connection_id(); } diff --git a/sql/item_func.cc b/sql/item_func.cc index 4012371bedb..69b55228234 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -649,16 +649,7 @@ bool Item_func_connection_id::fix_fields(THD *thd, Item **ref) { if (Item_int_func::fix_fields(thd, ref)) return TRUE; - - /* - To replicate CONNECTION_ID() properly we should use - pseudo_thread_id on slave, which contains the value of thread_id - on master. - */ - value= ((thd->slave_thread) ? - thd->variables.pseudo_thread_id : - thd->thread_id); - + value= thd->variables.pseudo_thread_id; return FALSE; } diff --git a/sql/log_event.cc b/sql/log_event.cc index c062aa99b4e..62b90986cfd 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1479,8 +1479,8 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, ulong query_length, bool using_trans, bool suppress_use, THD::killed_state killed_status_arg) :Log_event(thd_arg, - ((thd_arg->tmp_table_used ? LOG_EVENT_THREAD_SPECIFIC_F : 0) - | (suppress_use ? LOG_EVENT_SUPPRESS_USE_F : 0)), + (thd_arg->thread_specific_used ? LOG_EVENT_THREAD_SPECIFIC_F : 0) | + (suppress_use ? LOG_EVENT_SUPPRESS_USE_F : 0), using_trans), data_buf(0), query(query_arg), catalog(thd_arg->catalog), db(thd_arg->db), q_len((uint32) query_length), @@ -2912,8 +2912,9 @@ Load_log_event::Load_log_event(THD *thd_arg, sql_exchange *ex, List &fields_arg, enum enum_duplicates handle_dup, bool ignore, bool using_trans) - :Log_event(thd_arg, !thd_arg->tmp_table_used ? - 0 : LOG_EVENT_THREAD_SPECIFIC_F, using_trans), + :Log_event(thd_arg, + thd_arg->thread_specific_used ? LOG_EVENT_THREAD_SPECIFIC_F : 0, + using_trans), thread_id(thd_arg->thread_id), slave_proxy_id(thd_arg->variables.pseudo_thread_id), num_fields(0),fields(0), diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 6d22047b9db..5e2139acd91 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -6320,7 +6320,8 @@ The minimum value for this variable is 4096.", (uchar**) &opt_date_time_formats[MYSQL_TIMESTAMP_TIME], 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"tmp_table_size", OPT_TMP_TABLE_SIZE, - "If an in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk MyISAM table.", + "If an internal in-memory temporary table exceeds this size, MySQL will" + " automatically convert it to an on-disk MyISAM table.", (uchar**) &global_system_variables.tmp_table_size, (uchar**) &max_system_variables.tmp_table_size, 0, GET_ULL, REQUIRED_ARG, 16*1024*1024L, 1024, MAX_MEM_TABLE_SIZE, 0, 1, 0}, diff --git a/sql/sql_base.cc b/sql/sql_base.cc index cf3ef111780..4e62830a903 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2305,7 +2305,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, } table->query_id= thd->query_id; table->clear_query_id= 1; - thd->tmp_table_used= 1; + thd->thread_specific_used= TRUE; DBUG_PRINT("info",("Using temporary table")); goto reset; } diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 31621c531b0..a9a5e10a996 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -394,7 +394,7 @@ THD::THD() count_cuted_fields= CHECK_FIELD_IGNORE; killed= NOT_KILLED; db_length= col_access=0; - query_error= tmp_table_used= 0; + query_error= thread_specific_used= FALSE; hash_clear(&handler_tables_hash); tmp_table=0; used_tables=0; diff --git a/sql/sql_class.h b/sql/sql_class.h index ff4f3022c2b..18ee426ae9c 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1417,7 +1417,9 @@ public: bool substitute_null_with_insert_id; bool in_lock_tables; bool query_error, bootstrap, cleanup_done; - bool tmp_table_used; + + /** is set if some thread specific value(s) used in a statement. */ + bool thread_specific_used; bool charset_is_system_charset, charset_is_collation_connection; bool charset_is_character_set_filesystem; bool enable_slow_log; /* enable slow log for current statement */ diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index c98d22d9091..060fcd1fb41 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -5169,7 +5169,7 @@ void mysql_reset_thd_for_next_command(THD *thd) thd->no_trans_update.all= FALSE; } DBUG_ASSERT(thd->security_ctx== &thd->main_security_ctx); - thd->tmp_table_used= 0; + thd->thread_specific_used= FALSE; if (!thd->in_sub_stmt) { if (opt_bin_log) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 668b7e99549..b7757d3e5fc 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -13333,7 +13333,8 @@ static int join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count) { reg1 uint i; - uint length,blobs,size; + uint length, blobs; + size_t size; CACHE_FIELD *copy,**blob_ptr; JOIN_CACHE *cache; JOIN_TAB *join_tab; @@ -13449,7 +13450,7 @@ store_record_in_cache(JOIN_CACHE *cache) length=cache->length; if (cache->blobs) length+=used_blob_length(cache->blob_ptr); - if ((last_record=(length+cache->length > (uint) (cache->end - pos)))) + if ((last_record= (length + cache->length > (size_t) (cache->end - pos)))) cache->ptr_record=cache->records; /* @@ -13495,7 +13496,7 @@ store_record_in_cache(JOIN_CACHE *cache) } } cache->pos=pos; - return last_record || (uint) (cache->end -pos) < cache->length; + return last_record || (size_t) (cache->end - pos) < cache->length; } diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 7ffb83bc266..a555bc0a58b 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1656,7 +1656,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, on the table name. */ pthread_mutex_unlock(&LOCK_open); - thd->tmp_table_used= tmp_table_deleted; + thd->thread_specific_used|= tmp_table_deleted; error= 0; if (wrong_tables.length()) { @@ -2789,6 +2789,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, length); push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_TOO_LONG_KEY, warn_buff); + /* Align key length to multibyte char boundary */ + length-= length % sql_field->charset->mbmaxlen; } else { @@ -2819,8 +2821,6 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, if (length > file->max_key_part_length() && key->type != Key::FULLTEXT) { length= file->max_key_part_length(); - /* Align key length to multibyte char boundary */ - length-= length % sql_field->charset->mbmaxlen; if (key->type == Key::MULTIPLE) { /* not a critical problem */ @@ -2829,6 +2829,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, length); push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_TOO_LONG_KEY, warn_buff); + /* Align key length to multibyte char boundary */ + length-= length % sql_field->charset->mbmaxlen; } else { @@ -3406,7 +3408,7 @@ bool mysql_create_table_no_lock(THD *thd, (void) rm_temporary_table(create_info->db_type, path); goto unlock_and_end; } - thd->tmp_table_used= 1; + thd->thread_specific_used= TRUE; } /* @@ -4113,7 +4115,8 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, goto err; } - if (operator_func == &handler::ha_repair) + if (operator_func == &handler::ha_repair && + !(check_opt->sql_flags & TT_USEFRM)) { if ((table->table->file->check_old_types() == HA_ADMIN_NEEDS_ALTER) || (table->table->file->ha_check_for_upgrade(check_opt) == diff --git a/storage/federated/ha_federated.h b/storage/federated/ha_federated.h index 2aa2fac63f1..40bcf9cc402 100644 --- a/storage/federated/ha_federated.h +++ b/storage/federated/ha_federated.h @@ -165,6 +165,7 @@ public: uint max_supported_keys() const { return MAX_KEY; } uint max_supported_key_parts() const { return MAX_REF_PARTS; } uint max_supported_key_length() const { return FEDERATED_MAX_KEY_LENGTH; } + uint max_supported_key_part_length() const { return FEDERATED_MAX_KEY_LENGTH; } /* Called in test_quick_select to determine if indexes should be used. Normally, we need to know number of blocks . For federated we need to diff --git a/storage/innobase/Makefile.am b/storage/innobase/Makefile.am index 0b23ae74f9e..30e056d68fb 100644 --- a/storage/innobase/Makefile.am +++ b/storage/innobase/Makefile.am @@ -55,7 +55,9 @@ noinst_HEADERS = include/btr0btr.h include/btr0btr.ic \ include/ha0ha.ic include/hash0hash.h \ include/hash0hash.ic include/ibuf0ibuf.h \ include/ibuf0ibuf.ic include/ibuf0types.h \ + include/lock0iter.h \ include/lock0lock.h include/lock0lock.ic \ + include/lock0priv.h include/lock0priv.ic \ include/lock0types.h include/log0log.h \ include/log0log.ic include/log0recv.h \ include/log0recv.ic include/mach0data.h \ @@ -129,7 +131,8 @@ libinnobase_a_SOURCES = btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c \ eval/eval0eval.c eval/eval0proc.c \ fil/fil0fil.c fsp/fsp0fsp.c fut/fut0fut.c \ fut/fut0lst.c ha/ha0ha.c ha/hash0hash.c \ - ibuf/ibuf0ibuf.c lock/lock0lock.c \ + ibuf/ibuf0ibuf.c lock/lock0iter.c \ + lock/lock0lock.c \ log/log0log.c log/log0recv.c mach/mach0data.c \ mem/mem0mem.c mem/mem0pool.c mtr/mtr0log.c \ mtr/mtr0mtr.c os/os0file.c os/os0proc.c \ diff --git a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c index c847b8db9e2..469d3ac05d7 100644 --- a/storage/innobase/buf/buf0buf.c +++ b/storage/innobase/buf/buf0buf.c @@ -903,8 +903,7 @@ buf_block_make_young( /* Note that we read freed_page_clock's without holding any mutex: this is allowed since the result is used only in heuristics */ - if (buf_pool->freed_page_clock >= block->freed_page_clock - + 1 + (buf_pool->curr_size / 4)) { + if (buf_block_peek_if_too_old(block)) { mutex_enter(&buf_pool->mutex); /* There has been freeing activity in the LRU list: @@ -1648,6 +1647,15 @@ buf_page_init( block->lock_hash_val = lock_rec_hash(space, offset); +#ifdef UNIV_DEBUG_VALGRIND + if (!space) { + /* Silence valid Valgrind warnings about uninitialized + data being written to data files. There are some unused + bytes on some pages that InnoDB does not initialize. */ + UNIV_MEM_VALID(block->frame, UNIV_PAGE_SIZE); + } +#endif /* UNIV_DEBUG_VALGRIND */ + /* Insert into the hash table of file pages */ if (buf_page_hash_get(space, offset)) { diff --git a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c index 1e27144bdbf..7b49a7641af 100644 --- a/storage/innobase/buf/buf0lru.c +++ b/storage/innobase/buf/buf0lru.c @@ -244,7 +244,15 @@ buf_LRU_search_and_free_block( frame at all */ if (block->frame) { + /* The page was declared uninitialized + by buf_LRU_block_remove_hashed_page(). + We need to flag the contents of the + page valid (which it still is) in + order to avoid bogus Valgrind + warnings. */ + UNIV_MEM_VALID(block->frame, UNIV_PAGE_SIZE); btr_search_drop_page_hash_index(block->frame); + UNIV_MEM_INVALID(block->frame, UNIV_PAGE_SIZE); } ut_a(block->buf_fix_count == 0); @@ -449,6 +457,7 @@ loop: mutex_enter(&block->mutex); block->state = BUF_BLOCK_READY_FOR_USE; + UNIV_MEM_ALLOC(block->frame, UNIV_PAGE_SIZE); mutex_exit(&block->mutex); @@ -864,6 +873,7 @@ buf_LRU_block_free_non_file_page( block->state = BUF_BLOCK_NOT_USED; + UNIV_MEM_ALLOC(block->frame, UNIV_PAGE_SIZE); #ifdef UNIV_DEBUG /* Wipe contents of page to reveal possible stale pointers to it */ memset(block->frame, '\0', UNIV_PAGE_SIZE); @@ -871,6 +881,8 @@ buf_LRU_block_free_non_file_page( UT_LIST_ADD_FIRST(free, buf_pool->free, block); block->in_free_list = TRUE; + UNIV_MEM_FREE(block->frame, UNIV_PAGE_SIZE); + if (srv_use_awe && block->frame) { /* Add to the list of mapped pages */ @@ -939,6 +951,7 @@ buf_LRU_block_remove_hashed_page( buf_page_address_fold(block->space, block->offset), block); + UNIV_MEM_INVALID(block->frame, UNIV_PAGE_SIZE); block->state = BUF_BLOCK_REMOVE_HASH; } diff --git a/storage/innobase/fsp/fsp0fsp.c b/storage/innobase/fsp/fsp0fsp.c index 78fb55e4ef3..e1074933fe8 100644 --- a/storage/innobase/fsp/fsp0fsp.c +++ b/storage/innobase/fsp/fsp0fsp.c @@ -2829,7 +2829,7 @@ will be able to insert new data to the database without running out the tablespace. Only free extents are taken into account and we also subtract the safety margin required by the above function fsp_reserve_free_extents. */ -ulint +ullint fsp_get_available_space_in_free_extents( /*====================================*/ /* out: available space in kB */ @@ -2895,7 +2895,8 @@ fsp_get_available_space_in_free_extents( return(0); } - return(((n_free - reserve) * FSP_EXTENT_SIZE) + return((ullint)(n_free - reserve) + * FSP_EXTENT_SIZE * (UNIV_PAGE_SIZE / 1024)); } diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 840a0ec7e3b..52cd09c351e 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -947,8 +947,6 @@ check_trx_exists( /* Update the info whether we should skip XA steps that eat CPU time */ trx->support_xa = THDVAR(thd, support_xa); - - thd_to_trx(thd) = trx; } else { if (trx->magic_n != TRX_MAGIC_N) { mem_analyze_corruption(trx); @@ -4533,17 +4531,16 @@ ha_innobase::position( /********************************************************************* If it's a DB_TOO_BIG_RECORD error then set a suitable message to return to the client.*/ -static +inline void innodb_check_for_record_too_big_error( /*==================================*/ - dict_table_t* table, /* in: table to check */ - int error) /* in: error code to check */ + ulint comp, /* in: ROW_FORMAT: nonzero=COMPACT, 0=REDUNDANT */ + int error) /* in: error code to check */ { if (error == (int)DB_TOO_BIG_RECORD) { - ulint max_row_size; - - max_row_size = page_get_free_space_of_empty_noninline(table); + ulint max_row_size + = page_get_free_space_of_empty_noninline(comp) / 2; my_error(ER_TOO_BIG_ROWSIZE, MYF(0), max_row_size); } @@ -4657,9 +4654,7 @@ create_table_def( error = row_create_table_for_mysql(table, trx); - /* We need access to the table and so we do the error checking - and set the error message here, before the error translation.*/ - innodb_check_for_record_too_big_error(table, error); + innodb_check_for_record_too_big_error(flags & DICT_TF_COMPACT, error); error = convert_error_code_to_mysql(error, NULL); @@ -4783,9 +4778,8 @@ create_index( sure we don't create too long indexes. */ error = row_create_index_for_mysql(index, trx, field_lengths); - /* We need access to the table and so we do the error checking - and set the error message here, before the error translation.*/ - innodb_check_for_record_too_big_error(index->table, error); + innodb_check_for_record_too_big_error(form->s->row_type + != ROW_TYPE_REDUNDANT, error); error = convert_error_code_to_mysql(error, NULL); @@ -4802,6 +4796,8 @@ int create_clustered_index_when_no_primary( /*===================================*/ trx_t* trx, /* in: InnoDB transaction handle */ + ulint comp, /* in: ROW_FORMAT: + nonzero=COMPACT, 0=REDUNDANT */ const char* table_name) /* in: table name */ { dict_index_t* index; @@ -4810,13 +4806,11 @@ create_clustered_index_when_no_primary( /* We pass 0 as the space id, and determine at a lower level the space id where to store the table */ - index = dict_mem_index_create((char*) table_name, - (char*) "GEN_CLUST_INDEX", 0, DICT_CLUSTERED, 0); + index = dict_mem_index_create(table_name, "GEN_CLUST_INDEX", + 0, DICT_CLUSTERED, 0); error = row_create_index_for_mysql(index, trx, NULL); - /* We need access to the table and so we do the error checking - and set the error message here, before the error translation.*/ - innodb_check_for_record_too_big_error(index->table, error); + innodb_check_for_record_too_big_error(comp, error); error = convert_error_code_to_mysql(error, NULL); @@ -4947,8 +4941,9 @@ ha_innobase::create( order the rows by their row id which is internally generated by InnoDB */ - error = create_clustered_index_when_no_primary(trx, - norm_name); + error = create_clustered_index_when_no_primary( + trx, form->s->row_type != ROW_TYPE_REDUNDANT, + norm_name); if (error) { goto cleanup; } @@ -5873,9 +5868,9 @@ ha_innobase::update_table_comment( mutex_enter_noninline(&srv_dict_tmpfile_mutex); rewind(srv_dict_tmpfile); - fprintf(srv_dict_tmpfile, "InnoDB free: %lu kB", - (ulong) fsp_get_available_space_in_free_extents( - prebuilt->table->space)); + fprintf(srv_dict_tmpfile, "InnoDB free: %llu kB", + fsp_get_available_space_in_free_extents( + prebuilt->table->space)); dict_print_info_on_foreign_keys(FALSE, srv_dict_tmpfile, prebuilt->trx, prebuilt->table); diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic index 031bf6c51b4..b077ff0c181 100644 --- a/storage/innobase/include/buf0buf.ic +++ b/storage/innobase/include/buf0buf.ic @@ -28,7 +28,7 @@ buf_block_peek_if_too_old( buf_block_t* block) /* in: block to make younger */ { return(buf_pool->freed_page_clock >= block->freed_page_clock - + 1 + (buf_pool->curr_size / 1024)); + + 1 + (buf_pool->curr_size / 4)); } /************************************************************************* diff --git a/storage/innobase/include/fsp0fsp.h b/storage/innobase/include/fsp0fsp.h index d04269fc157..82e95a2e920 100644 --- a/storage/innobase/include/fsp0fsp.h +++ b/storage/innobase/include/fsp0fsp.h @@ -245,7 +245,7 @@ will be able to insert new data to the database without running out the tablespace. Only free extents are taken into account and we also subtract the safety margin required by the above function fsp_reserve_free_extents. */ -ulint +ullint fsp_get_available_space_in_free_extents( /*====================================*/ /* out: available space in kB */ diff --git a/storage/innobase/include/lock0iter.h b/storage/innobase/include/lock0iter.h new file mode 100644 index 00000000000..d063a360c1f --- /dev/null +++ b/storage/innobase/include/lock0iter.h @@ -0,0 +1,52 @@ +/****************************************************** +Lock queue iterator type and function prototypes. + +(c) 2007 Innobase Oy + +Created July 16, 2007 Vasil Dimov +*******************************************************/ + +#ifndef lock0iter_h +#define lock0iter_h + +#include "univ.i" +#include "lock0types.h" + +typedef struct lock_queue_iterator_struct { + lock_t* current_lock; + /* In case this is a record lock queue (not table lock queue) + then bit_no is the record number within the heap in which the + record is stored. */ + ulint bit_no; +} lock_queue_iterator_t; + +/*********************************************************************** +Initialize lock queue iterator so that it starts to iterate from +"lock". bit_no specifies the record number within the heap where the +record is stored. It can be undefined (ULINT_UNDEFINED) in two cases: +1. If the lock is a table lock, thus we have a table lock queue; +2. If the lock is a record lock and it is a wait lock. In this case + bit_no is calculated in this function by using + lock_rec_find_set_bit(). There is exactly one bit set in the bitmap + of a wait lock. */ + +void +lock_queue_iterator_reset( +/*======================*/ + lock_queue_iterator_t* iter, /* out: iterator */ + lock_t* lock, /* in: lock to start from */ + ulint bit_no);/* in: record number in the + heap */ + +/*********************************************************************** +Gets the previous lock in the lock queue, returns NULL if there are no +more locks (i.e. the current lock is the first one). The iterator is +receded (if not-NULL is returned). */ + +lock_t* +lock_queue_iterator_get_prev( +/*=========================*/ + /* out: previous lock or NULL */ + lock_queue_iterator_t* iter); /* in/out: iterator */ + +#endif /* lock0iter_h */ diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h index 6b863e32183..059c459c374 100644 --- a/storage/innobase/include/lock0lock.h +++ b/storage/innobase/include/lock0lock.h @@ -519,6 +519,18 @@ lock_is_table_exclusive( dict_table_t* table, /* in: table */ trx_t* trx); /* in: transaction */ /************************************************************************* +Checks if a lock request lock1 has to wait for request lock2. */ + +ibool +lock_has_to_wait( +/*=============*/ + /* out: TRUE if lock1 has to wait for lock2 to be + removed */ + lock_t* lock1, /* in: waiting lock */ + lock_t* lock2); /* in: another lock; NOTE that it is assumed that this + has a lock bit set on the same record as in lock1 if + the locks are record locks */ +/************************************************************************* Checks that a transaction id is sensible, i.e., not in the future. */ ibool @@ -597,7 +609,7 @@ lock_validate(void); /* out: TRUE if ok */ /************************************************************************* Return approximate number or record locks (bits set in the bitmap) for -this transaction. Since delete-marked records ma ybe removed, the +this transaction. Since delete-marked records maybe removed, the record count will not be precise. */ ulint diff --git a/storage/innobase/include/lock0priv.h b/storage/innobase/include/lock0priv.h new file mode 100644 index 00000000000..7703a2b7def --- /dev/null +++ b/storage/innobase/include/lock0priv.h @@ -0,0 +1,101 @@ +/****************************************************** +Lock module internal structures and methods. + +(c) 2007 Innobase Oy + +Created July 12, 2007 Vasil Dimov +*******************************************************/ + +#ifndef lock0priv_h +#define lock0priv_h + +#ifndef LOCK_MODULE_IMPLEMENTATION +/* If you need to access members of the structures defined in this +file, please write appropriate functions that retrieve them and put +those functions in lock/ */ +#error Do not include lock0priv.h outside of the lock/ module +#endif + +#include "univ.i" +#include "dict0types.h" +#include "hash0hash.h" +#include "trx0types.h" +#include "ut0lst.h" + +/* A table lock */ +typedef struct lock_table_struct lock_table_t; +struct lock_table_struct { + dict_table_t* table; /* database table in dictionary + cache */ + UT_LIST_NODE_T(lock_t) + locks; /* list of locks on the same + table */ +}; + +/* Record lock for a page */ +typedef struct lock_rec_struct lock_rec_t; +struct lock_rec_struct { + ulint space; /* space id */ + ulint page_no; /* page number */ + ulint n_bits; /* number of bits in the lock + bitmap; NOTE: the lock bitmap is + placed immediately after the + lock struct */ +}; + +/* Lock struct */ +struct lock_struct { + trx_t* trx; /* transaction owning the + lock */ + UT_LIST_NODE_T(lock_t) + trx_locks; /* list of the locks of the + transaction */ + ulint type_mode; /* lock type, mode, LOCK_GAP or + LOCK_REC_NOT_GAP, + LOCK_INSERT_INTENTION, + wait flag, ORed */ + hash_node_t hash; /* hash chain node for a record + lock */ + dict_index_t* index; /* index for a record lock */ + union { + lock_table_t tab_lock;/* table lock */ + lock_rec_t rec_lock;/* record lock */ + } un_member; +}; + +/************************************************************************* +Gets the type of a lock. */ +UNIV_INLINE +ulint +lock_get_type( +/*==========*/ + /* out: LOCK_TABLE or LOCK_REC */ + const lock_t* lock); /* in: lock */ + +/************************************************************************** +Looks for a set bit in a record lock bitmap. Returns ULINT_UNDEFINED, +if none found. */ + +ulint +lock_rec_find_set_bit( +/*==================*/ + /* out: bit index == heap number of the record, or + ULINT_UNDEFINED if none found */ + lock_t* lock); /* in: record lock with at least one bit set */ + +/************************************************************************* +Gets the previous record lock set on a record. */ + +lock_t* +lock_rec_get_prev( +/*==============*/ + /* out: previous lock on the same record, NULL if + none exists */ + lock_t* in_lock,/* in: record lock */ + ulint heap_no);/* in: heap number of the record */ + +#ifndef UNIV_NONINL +#include "lock0priv.ic" +#endif + +#endif /* lock0priv_h */ diff --git a/storage/innobase/include/lock0priv.ic b/storage/innobase/include/lock0priv.ic new file mode 100644 index 00000000000..4bc8397509d --- /dev/null +++ b/storage/innobase/include/lock0priv.ic @@ -0,0 +1,32 @@ +/****************************************************** +Lock module internal inline methods. + +(c) 2007 Innobase Oy + +Created July 16, 2007 Vasil Dimov +*******************************************************/ + +/* This file contains only methods which are used in +lock/lock0* files, other than lock/lock0lock.c. +I.e. lock/lock0lock.c contains more internal inline +methods but they are used only in that file. */ + +#ifndef LOCK_MODULE_IMPLEMENTATION +#error Do not include lock0priv.ic outside of the lock/ module +#endif + +/************************************************************************* +Gets the type of a lock. */ +UNIV_INLINE +ulint +lock_get_type( +/*==========*/ + /* out: LOCK_TABLE or LOCK_REC */ + const lock_t* lock) /* in: lock */ +{ + ut_ad(lock); + + return(lock->type_mode & LOCK_TYPE_MASK); +} + +/* vim: set filetype=c: */ diff --git a/storage/innobase/include/mem0mem.ic b/storage/innobase/include/mem0mem.ic index cb8fbe92cf0..e59443da73d 100644 --- a/storage/innobase/include/mem0mem.ic +++ b/storage/innobase/include/mem0mem.ic @@ -167,6 +167,8 @@ mem_heap_alloc( mem_block_set_free(block, free + MEM_SPACE_NEEDED(n)); #ifdef UNIV_MEM_DEBUG + UNIV_MEM_ALLOC(buf, + n + MEM_FIELD_HEADER_SIZE + MEM_FIELD_TRAILER_SIZE); /* In the debug version write debugging info to the field */ mem_field_init((byte*)buf, n); @@ -177,8 +179,10 @@ mem_heap_alloc( #endif #ifdef UNIV_SET_MEM_TO_ZERO + UNIV_MEM_ALLOC(buf, n); memset(buf, '\0', n); #endif + UNIV_MEM_ALLOC(buf, n); return(buf); } @@ -369,6 +373,8 @@ mem_heap_free_top( if ((heap != block) && (mem_block_get_free(block) == mem_block_get_start(block))) { mem_heap_block_free(heap, block); + } else { + UNIV_MEM_FREE((byte*) block + mem_block_get_free(block), n); } } diff --git a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h index 833d268c9de..273007c2778 100644 --- a/storage/innobase/include/page0page.h +++ b/storage/innobase/include/page0page.h @@ -531,6 +531,15 @@ page_get_free_space_of_empty( /* out: free space */ ulint comp) /* in: nonzero=compact page format */ __attribute__((const)); +/***************************************************************** +Calculates free space if a page is emptied. */ + +ulint +page_get_free_space_of_empty_noninline( +/*===================================*/ + /* out: free space */ + ulint comp) /* in: nonzero=compact page format */ + __attribute__((const)); /**************************************************************** Returns the sum of the sizes of the records in the record list excluding the infimum and supremum records. */ diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h index bda3494073f..1448efe94fe 100644 --- a/storage/innobase/include/row0mysql.h +++ b/storage/innobase/include/row0mysql.h @@ -460,19 +460,6 @@ row_check_table_for_mysql( /* out: DB_ERROR or DB_SUCCESS */ row_prebuilt_t* prebuilt); /* in: prebuilt struct in MySQL handle */ -/************************************************************************* -Get the min of the maximum possible row sizes. */ - -ulint -page_get_free_space_of_empty_noninline( -/*===================================*/ - /* out: The (approx) maximum size - of a row, this is a conservative - estimate, since the size can be - slightly larger depending upon - the ROW_FORMAT setting.*/ - dict_table_t* table); /* in: table for which max record - size required.*/ /* A struct describing a place for an individual column in the MySQL row format which is presented to the table handler in ha_innobase. diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index eeda2a7a52c..2459e76c4c1 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -512,14 +512,6 @@ struct trx_struct{ ulint mysql_process_no;/* since in Linux, 'top' reports process id's and not thread id's, we store the process number too */ - ibool allow_duplicates;/* normally FALSE, but if the user - wants to update duplicate rows, - (in table inserts, for example) we - set this TRUE */ - ibool replace_duplicates;/* normally FALSE, but if the user - wants to replace duplicate rows, - (in table inserts, for example) we - set this TRUE */ /*------------------------------*/ ulint n_mysql_tables_in_use; /* number of Innobase tables used in the processing of the current diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index 957baa0391f..ba8e6e56219 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -83,6 +83,8 @@ memory is read outside the allocated blocks. */ /* Make a non-inline debug version */ #if 0 +#define UNIV_DEBUG_VALGRIND /* Enable extra + Valgrind instrumentation */ #define UNIV_DEBUG /* Enable ut_ad() assertions */ #define UNIV_LIST_DEBUG /* debug UT_LIST_ macros */ #define UNIV_MEM_DEBUG /* detect memory leaks etc */ @@ -214,6 +216,8 @@ typedef __int64 ib_longlong; typedef longlong ib_longlong; #endif +typedef unsigned long long int ullint; + #ifndef __WIN__ #if SIZEOF_LONG != SIZEOF_VOIDP #error "Error: InnoDB's ulint must be of the same size as void*" @@ -298,5 +302,17 @@ typedef void* os_thread_ret_t; #include "ut0dbg.h" #include "ut0ut.h" #include "db0err.h" +#ifdef UNIV_DEBUG_VALGRIND +# include +# define UNIV_MEM_VALID(addr, size) VALGRIND_MAKE_MEM_DEFINED(addr, size) +# define UNIV_MEM_INVALID(addr, size) VALGRIND_MAKE_MEM_UNDEFINED(addr, size) +# define UNIV_MEM_FREE(addr, size) VALGRIND_MAKE_MEM_NOACCESS(addr, size) +# define UNIV_MEM_ALLOC(addr, size) VALGRIND_MAKE_MEM_UNDEFINED(addr, size) +#else +# define UNIV_MEM_VALID(addr, size) do {} while(0) +# define UNIV_MEM_INVALID(addr, size) do {} while(0) +# define UNIV_MEM_FREE(addr, size) do {} while(0) +# define UNIV_MEM_ALLOC(addr, size) do {} while(0) +#endif #endif diff --git a/storage/innobase/lock/lock0iter.c b/storage/innobase/lock/lock0iter.c new file mode 100644 index 00000000000..0afa7019c86 --- /dev/null +++ b/storage/innobase/lock/lock0iter.c @@ -0,0 +1,90 @@ +/****************************************************** +Lock queue iterator. Can iterate over table and record +lock queues. + +(c) 2007 Innobase Oy + +Created July 16, 2007 Vasil Dimov +*******************************************************/ + +#define LOCK_MODULE_IMPLEMENTATION + +#include "univ.i" +#include "lock0iter.h" +#include "lock0lock.h" +#include "lock0priv.h" +#include "ut0dbg.h" +#include "ut0lst.h" + +/*********************************************************************** +Initialize lock queue iterator so that it starts to iterate from +"lock". bit_no specifies the record number within the heap where the +record is stored. It can be undefined (ULINT_UNDEFINED) in two cases: +1. If the lock is a table lock, thus we have a table lock queue; +2. If the lock is a record lock and it is a wait lock. In this case + bit_no is calculated in this function by using + lock_rec_find_set_bit(). There is exactly one bit set in the bitmap + of a wait lock. */ + +void +lock_queue_iterator_reset( +/*======================*/ + lock_queue_iterator_t* iter, /* out: iterator */ + lock_t* lock, /* in: lock to start from */ + ulint bit_no) /* in: record number in the + heap */ +{ + iter->current_lock = lock; + + if (bit_no != ULINT_UNDEFINED) { + + iter->bit_no = bit_no; + } else { + + switch (lock_get_type(lock)) { + case LOCK_TABLE: + iter->bit_no = ULINT_UNDEFINED; + break; + case LOCK_REC: + iter->bit_no = lock_rec_find_set_bit(lock); + ut_a(iter->bit_no != ULINT_UNDEFINED); + break; + default: + ut_error; + } + } +} + +/*********************************************************************** +Gets the previous lock in the lock queue, returns NULL if there are no +more locks (i.e. the current lock is the first one). The iterator is +receded (if not-NULL is returned). */ + +lock_t* +lock_queue_iterator_get_prev( +/*=========================*/ + /* out: previous lock or NULL */ + lock_queue_iterator_t* iter) /* in/out: iterator */ +{ + lock_t* prev_lock; + + switch (lock_get_type(iter->current_lock)) { + case LOCK_REC: + prev_lock = lock_rec_get_prev( + iter->current_lock, iter->bit_no); + break; + case LOCK_TABLE: + prev_lock = UT_LIST_GET_PREV( + un_member.tab_lock.locks, iter->current_lock); + break; + default: + ut_error; + } + + if (prev_lock != NULL) { + + iter->current_lock = prev_lock; + } + + return(prev_lock); +} diff --git a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock.c index 6f5390145b5..f43752fb5fc 100644 --- a/storage/innobase/lock/lock0lock.c +++ b/storage/innobase/lock/lock0lock.c @@ -6,10 +6,14 @@ The transaction lock system Created 5/7/1996 Heikki Tuuri *******************************************************/ +#define LOCK_MODULE_IMPLEMENTATION + #include "lock0lock.h" +#include "lock0priv.h" #ifdef UNIV_NONINL #include "lock0lock.ic" +#include "lock0priv.ic" #endif #include "usr0sess.h" @@ -319,42 +323,6 @@ ibool lock_print_waits = FALSE; /* The lock system */ lock_sys_t* lock_sys = NULL; -/* A table lock */ -typedef struct lock_table_struct lock_table_t; -struct lock_table_struct{ - dict_table_t* table; /* database table in dictionary cache */ - UT_LIST_NODE_T(lock_t) - locks; /* list of locks on the same table */ -}; - -/* Record lock for a page */ -typedef struct lock_rec_struct lock_rec_t; -struct lock_rec_struct{ - ulint space; /* space id */ - ulint page_no; /* page number */ - ulint n_bits; /* number of bits in the lock bitmap */ - /* NOTE: the lock bitmap is placed immediately - after the lock struct */ -}; - -/* Lock struct */ -struct lock_struct{ - trx_t* trx; /* transaction owning the lock */ - UT_LIST_NODE_T(lock_t) - trx_locks; /* list of the locks of the - transaction */ - ulint type_mode; /* lock type, mode, LOCK_GAP or - LOCK_REC_NOT_GAP, - LOCK_INSERT_INTENTION, - wait flag, ORed */ - hash_node_t hash; /* hash chain node for a record lock */ - dict_index_t* index; /* index for a record lock */ - union { - lock_table_t tab_lock;/* table lock */ - lock_rec_t rec_lock;/* record lock */ - } un_member; -}; - /* We store info on the latest deadlock error to this buffer. InnoDB Monitor will then fetch it and print */ ibool lock_deadlock_found = FALSE; @@ -400,20 +368,6 @@ lock_deadlock_recursive( LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK, we return LOCK_VICTIM_IS_START */ -/************************************************************************* -Gets the type of a lock. */ -UNIV_INLINE -ulint -lock_get_type( -/*==========*/ - /* out: LOCK_TABLE or LOCK_REC */ - lock_t* lock) /* in: lock */ -{ - ut_ad(lock); - - return(lock->type_mode & LOCK_TYPE_MASK); -} - /************************************************************************* Gets the nth bit of a record lock. */ UNIV_INLINE @@ -611,8 +565,8 @@ UNIV_INLINE ulint lock_get_mode( /*==========*/ - /* out: mode */ - lock_t* lock) /* in: lock */ + /* out: mode */ + const lock_t* lock) /* in: lock */ { ut_ad(lock); @@ -1017,7 +971,7 @@ lock_rec_has_to_wait( /************************************************************************* Checks if a lock request lock1 has to wait for request lock2. */ -static + ibool lock_has_to_wait( /*=============*/ @@ -1098,7 +1052,7 @@ lock_rec_set_nth_bit( /************************************************************************** Looks for a set bit in a record lock bitmap. Returns ULINT_UNDEFINED, if none found. */ -static + ulint lock_rec_find_set_bit( /*==================*/ @@ -1390,7 +1344,7 @@ lock_rec_copy( /************************************************************************* Gets the previous record lock set on a record. */ -static + lock_t* lock_rec_get_prev( /*==============*/ diff --git a/storage/innobase/log/log0recv.c b/storage/innobase/log/log0recv.c index ab5f42e3a13..ce2fc3ed535 100644 --- a/storage/innobase/log/log0recv.c +++ b/storage/innobase/log/log0recv.c @@ -57,6 +57,16 @@ ibool recv_needed_recovery = FALSE; ibool recv_lsn_checks_on = FALSE; +/* There are two conditions under which we scan the logs, the first +is normal startup and the second is when we do a recovery from an +archive. +This flag is set if we are doing a scan from the last checkpoint during +startup. If we find log entries that were written after the last checkpoint +we know that the server was not cleanly shutdown. We must then initialize +the crash recovery environment before attempting to store these entries in +the log hash table. */ +ibool recv_log_scan_is_startup_type = FALSE; + /* If the following is TRUE, the buffer pool file pages must be invalidated after recovery and no ibuf operations are allowed; this becomes TRUE if the log record hash table becomes too full, and log records must be merged @@ -99,6 +109,16 @@ the recovery failed and the database may be corrupt. */ dulint recv_max_page_lsn; +/* prototypes */ + +/*********************************************************** +Initialize crash recovery environment. Can be called iff +recv_needed_recovery == FALSE. */ +static +void +recv_init_crash_recovery(void); +/*===========================*/ + /************************************************************ Creates the recovery system. */ @@ -2284,6 +2304,23 @@ recv_scan_log_recs( if (ut_dulint_cmp(scanned_lsn, recv_sys->scanned_lsn) > 0) { + /* We have found more entries. If this scan is + of startup type, we must initiate crash recovery + environment before parsing these log records. */ + + if (recv_log_scan_is_startup_type + && !recv_needed_recovery) { + + fprintf(stderr, + "InnoDB: Log scan progressed" + " past the checkpoint lsn %lu %lu\n", + (ulong) ut_dulint_get_high( + recv_sys->scanned_lsn), + (ulong) ut_dulint_get_low( + recv_sys->scanned_lsn)); + recv_init_crash_recovery(); + } + /* We were able to find more log data: add it to the parsing buffer if parse_start_lsn is already non-zero */ @@ -2405,6 +2442,48 @@ recv_group_scan_log_recs( #endif /* UNIV_DEBUG */ } +/*********************************************************** +Initialize crash recovery environment. Can be called iff +recv_needed_recovery == FALSE. */ +static +void +recv_init_crash_recovery(void) +/*==========================*/ +{ + ut_a(!recv_needed_recovery); + + recv_needed_recovery = TRUE; + + ut_print_timestamp(stderr); + + fprintf(stderr, + " InnoDB: Database was not" + " shut down normally!\n" + "InnoDB: Starting crash recovery.\n"); + + fprintf(stderr, + "InnoDB: Reading tablespace information" + " from the .ibd files...\n"); + + fil_load_single_table_tablespaces(); + + /* If we are using the doublewrite method, we will + check if there are half-written pages in data files, + and restore them from the doublewrite buffer if + possible */ + + if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) { + + fprintf(stderr, + "InnoDB: Restoring possible" + " half-written data pages from" + " the doublewrite\n" + "InnoDB: buffer...\n"); + trx_sys_doublewrite_init_or_restore_pages(TRUE); + } + +} + /************************************************************ Recovers from a checkpoint. When this function returns, the database is able to start processing of new user transactions, but the function @@ -2532,92 +2611,6 @@ recv_recovery_from_checkpoint_start( recv_sys->recovered_lsn = checkpoint_lsn; srv_start_lsn = checkpoint_lsn; - - /* NOTE: we always do a 'recovery' at startup, but only if - there is something wrong we will print a message to the - user about recovery: */ - - if (ut_dulint_cmp(checkpoint_lsn, max_flushed_lsn) != 0 - || ut_dulint_cmp(checkpoint_lsn, min_flushed_lsn) != 0) { - - if (ut_dulint_cmp(checkpoint_lsn, max_flushed_lsn) - < 0) { - fprintf(stderr, - "InnoDB: #########################" - "#################################\n" - "InnoDB: " - "WARNING!\n" - "InnoDB: The log sequence number" - " in ibdata files is higher\n" - "InnoDB: than the log sequence number" - " in the ib_logfiles! Are you sure\n" - "InnoDB: you are using the right" - " ib_logfiles to start up" - " the database?\n" - "InnoDB: Log sequence number in" - " ib_logfiles is %lu %lu, log\n" - "InnoDB: sequence numbers stamped" - " to ibdata file headers are between\n" - "InnoDB: %lu %lu and %lu %lu.\n" - "InnoDB: #########################" - "#################################\n", - (ulong) ut_dulint_get_high( - checkpoint_lsn), - (ulong) ut_dulint_get_low( - checkpoint_lsn), - (ulong) ut_dulint_get_high( - min_flushed_lsn), - (ulong) ut_dulint_get_low( - min_flushed_lsn), - (ulong) ut_dulint_get_high( - max_flushed_lsn), - (ulong) ut_dulint_get_low( - max_flushed_lsn)); - } - - recv_needed_recovery = TRUE; - - ut_print_timestamp(stderr); - - fprintf(stderr, - " InnoDB: Database was not" - " shut down normally!\n" - "InnoDB: Starting crash recovery.\n"); - - fprintf(stderr, - "InnoDB: Reading tablespace information" - " from the .ibd files...\n"); - - fil_load_single_table_tablespaces(); - - /* If we are using the doublewrite method, we will - check if there are half-written pages in data files, - and restore them from the doublewrite buffer if - possible */ - - if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) { - - fprintf(stderr, - "InnoDB: Restoring possible" - " half-written data pages from" - " the doublewrite\n" - "InnoDB: buffer...\n"); - trx_sys_doublewrite_init_or_restore_pages( - TRUE); - } - - ut_print_timestamp(stderr); - - fprintf(stderr, - " InnoDB: Starting log scan" - " based on checkpoint at\n" - "InnoDB: log sequence number %lu %lu.\n", - (ulong) ut_dulint_get_high(checkpoint_lsn), - (ulong) ut_dulint_get_low(checkpoint_lsn)); - } else { - /* Init the doublewrite buffer memory structure */ - trx_sys_doublewrite_init_or_restore_pages(FALSE); - } } contiguous_lsn = ut_dulint_align_down(recv_sys->scanned_lsn, @@ -2670,6 +2663,8 @@ recv_recovery_from_checkpoint_start( group = UT_LIST_GET_NEXT(log_groups, group); } + /* Set the flag to publish that we are doing startup scan. */ + recv_log_scan_is_startup_type = (type == LOG_CHECKPOINT); while (group) { old_scanned_lsn = recv_sys->scanned_lsn; @@ -2691,6 +2686,69 @@ recv_recovery_from_checkpoint_start( group = UT_LIST_GET_NEXT(log_groups, group); } + /* Done with startup scan. Clear the flag. */ + recv_log_scan_is_startup_type = FALSE; + if (type == LOG_CHECKPOINT) { + /* NOTE: we always do a 'recovery' at startup, but only if + there is something wrong we will print a message to the + user about recovery: */ + + if (ut_dulint_cmp(checkpoint_lsn, max_flushed_lsn) != 0 + || ut_dulint_cmp(checkpoint_lsn, min_flushed_lsn) != 0) { + + if (ut_dulint_cmp(checkpoint_lsn, max_flushed_lsn) + < 0) { + fprintf(stderr, + "InnoDB: #########################" + "#################################\n" + "InnoDB: " + "WARNING!\n" + "InnoDB: The log sequence number" + " in ibdata files is higher\n" + "InnoDB: than the log sequence number" + " in the ib_logfiles! Are you sure\n" + "InnoDB: you are using the right" + " ib_logfiles to start up" + " the database?\n" + "InnoDB: Log sequence number in" + " ib_logfiles is %lu %lu, log\n" + "InnoDB: sequence numbers stamped" + " to ibdata file headers are between\n" + "InnoDB: %lu %lu and %lu %lu.\n" + "InnoDB: #########################" + "#################################\n", + (ulong) ut_dulint_get_high( + checkpoint_lsn), + (ulong) ut_dulint_get_low( + checkpoint_lsn), + (ulong) ut_dulint_get_high( + min_flushed_lsn), + (ulong) ut_dulint_get_low( + min_flushed_lsn), + (ulong) ut_dulint_get_high( + max_flushed_lsn), + (ulong) ut_dulint_get_low( + max_flushed_lsn)); + + + } + + if (!recv_needed_recovery) { + fprintf(stderr, + "InnoDB: The log sequence number" + " in ibdata files does not match\n" + "InnoDB: the log sequence number" + " in the ib_logfiles!\n"); + recv_init_crash_recovery(); + } + + } + if (!recv_needed_recovery) { + /* Init the doublewrite buffer memory structure */ + trx_sys_doublewrite_init_or_restore_pages(FALSE); + } + } + /* We currently have only one log group */ if (ut_dulint_cmp(group_scanned_lsn, checkpoint_lsn) < 0) { ut_print_timestamp(stderr); @@ -2747,20 +2805,9 @@ recv_recovery_from_checkpoint_start( recv_synchronize_groups(up_to_date_group); if (!recv_needed_recovery) { - if (ut_dulint_cmp(checkpoint_lsn, recv_sys->recovered_lsn) - != 0) { - fprintf(stderr, - "InnoDB: Warning: we did not need to do" - " crash recovery, but log scan\n" - "InnoDB: progressed past the checkpoint" - " lsn %lu %lu up to lsn %lu %lu\n", - (ulong) ut_dulint_get_high(checkpoint_lsn), - (ulong) ut_dulint_get_low(checkpoint_lsn), - (ulong) ut_dulint_get_high( - recv_sys->recovered_lsn), - (ulong) ut_dulint_get_low( - recv_sys->recovered_lsn)); - } + ut_a(ut_dulint_cmp(checkpoint_lsn, + recv_sys->recovered_lsn) == 0); + } else { srv_start_lsn = recv_sys->recovered_lsn; } diff --git a/storage/innobase/mem/mem0mem.c b/storage/innobase/mem/mem0mem.c index 10b359e8e67..d89a3a55d88 100644 --- a/storage/innobase/mem/mem0mem.c +++ b/storage/innobase/mem/mem0mem.c @@ -514,6 +514,7 @@ mem_heap_block_free( mem_erase_buf((byte*)block, len); #endif + UNIV_MEM_FREE(block, len); if (init_block) { /* Do not have to free: do nothing */ diff --git a/storage/innobase/mem/mem0pool.c b/storage/innobase/mem/mem0pool.c index c010ae61160..27da86a0309 100644 --- a/storage/innobase/mem/mem0pool.c +++ b/storage/innobase/mem/mem0pool.c @@ -229,6 +229,8 @@ mem_pool_create( mem_area_set_size(area, ut_2_exp(i)); mem_area_set_free(area, TRUE); + UNIV_MEM_FREE(MEM_AREA_EXTRA_SIZE + (byte*) area, + ut_2_exp(i) - MEM_AREA_EXTRA_SIZE); UT_LIST_ADD_FIRST(free_list, pool->free_list[i], area); @@ -300,6 +302,7 @@ mem_pool_fill_free_list( UT_LIST_REMOVE(free_list, pool->free_list[i + 1], area); area2 = (mem_area_t*)(((byte*)area) + ut_2_exp(i)); + UNIV_MEM_ALLOC(area2, MEM_AREA_EXTRA_SIZE); mem_area_set_size(area2, ut_2_exp(i)); mem_area_set_free(area2, TRUE); @@ -400,6 +403,8 @@ mem_area_alloc( mutex_exit(&(pool->mutex)); ut_ad(mem_pool_validate(pool)); + UNIV_MEM_ALLOC(MEM_AREA_EXTRA_SIZE + (byte*)area, + ut_2_exp(n) - MEM_AREA_EXTRA_SIZE); return((void*)(MEM_AREA_EXTRA_SIZE + ((byte*)area))); } @@ -482,6 +487,7 @@ mem_area_free( } size = mem_area_get_size(area); + UNIV_MEM_FREE(ptr, size - MEM_AREA_EXTRA_SIZE); if (size == 0) { fprintf(stderr, diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c index f496e1127ce..78140cc5ecf 100644 --- a/storage/innobase/os/os0file.c +++ b/storage/innobase/os/os0file.c @@ -456,10 +456,9 @@ os_file_handle_error_no_exit( #undef USE_FILE_LOCK #define USE_FILE_LOCK -#if defined(UNIV_HOTBACKUP) || defined(__WIN__) || defined(__FreeBSD__) || defined(__NETWARE__) +#if defined(UNIV_HOTBACKUP) || defined(__WIN__) || defined(__NETWARE__) /* InnoDB Hot Backup does not lock the data files. * On Windows, mandatory locking is used. - * On FreeBSD with LinuxThreads, advisory locking does not work properly. */ # undef USE_FILE_LOCK #endif diff --git a/storage/innobase/page/page0page.c b/storage/innobase/page/page0page.c index 4212df7a631..543cf9e34eb 100644 --- a/storage/innobase/page/page0page.c +++ b/storage/innobase/page/page0page.c @@ -209,6 +209,18 @@ page_set_max_trx_id( } } +/***************************************************************** +Calculates free space if a page is emptied. */ + +ulint +page_get_free_space_of_empty_noninline( +/*===================================*/ + /* out: free space */ + ulint comp) /* in: nonzero=compact page format */ +{ + return(page_get_free_space_of_empty(comp)); +} + /**************************************************************** Allocates a block of memory from an index page. */ diff --git a/storage/innobase/rem/rem0rec.c b/storage/innobase/rem/rem0rec.c index 3bc73eca9ea..64f8e2d319c 100644 --- a/storage/innobase/rem/rem0rec.c +++ b/storage/innobase/rem/rem0rec.c @@ -753,7 +753,11 @@ rec_convert_dtuple_to_rec_old( /* Calculate the offset of the origin in the physical record */ rec = buf + rec_get_converted_extra_size(data_size, n_fields); - +#ifdef UNIV_DEBUG + /* Suppress Valgrind warnings of ut_ad() + in mach_write_to_1(), mach_write_to_2() et al. */ + memset(buf, 0xff, rec - buf + data_size); +#endif /* UNIV_DEBUG */ /* Store the number of fields */ rec_set_n_fields_old(rec, n_fields); diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c index 9f88fd8040b..d51b7e1e0b5 100644 --- a/storage/innobase/row/row0mysql.c +++ b/storage/innobase/row/row0mysql.c @@ -4059,25 +4059,3 @@ row_check_table_for_mysql( return(ret); } - -/************************************************************************* -Get the maximum row size. */ - -ulint -page_get_free_space_of_empty_noninline( -/*===================================*/ - /* out: The (approx) maximum size - of a row, this is a conservative - estimate, since the size can be - slightly larger depending upon - the ROW_FORMAT setting.*/ - dict_table_t* table) /* in: table for which max record - size is required.*/ -{ - ibool compact; - - compact = dict_table_is_comp(table); - - return(page_get_free_space_of_empty(compact) / 2); -} - diff --git a/storage/innobase/sync/sync0rw.c b/storage/innobase/sync/sync0rw.c index 34b45e2c1c3..4db780c8b3f 100644 --- a/storage/innobase/sync/sync0rw.c +++ b/storage/innobase/sync/sync0rw.c @@ -15,16 +15,34 @@ Created 9/11/1995 Heikki Tuuri #include "mem0mem.h" #include "srv0srv.h" +/* number of system calls made during shared latching */ ulint rw_s_system_call_count = 0; + +/* number of spin waits on rw-latches, +resulted during shared (read) locks */ ulint rw_s_spin_wait_count = 0; + +/* number of OS waits on rw-latches, +resulted during shared (read) locks */ ulint rw_s_os_wait_count = 0; +/* number of unlocks (that unlock shared locks), +set only when UNIV_SYNC_PERF_STAT is defined */ ulint rw_s_exit_count = 0; +/* number of system calls made during exclusive latching */ ulint rw_x_system_call_count = 0; + +/* number of spin waits on rw-latches, +resulted during exclusive (write) locks */ ulint rw_x_spin_wait_count = 0; + +/* number of OS waits on rw-latches, +resulted during exclusive (write) locks */ ulint rw_x_os_wait_count = 0; +/* number of unlocks (that unlock exclusive locks), +set only when UNIV_SYNC_PERF_STAT is defined */ ulint rw_x_exit_count = 0; /* The global list of rw-locks */ diff --git a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.c index 672e1f93aad..bf3f4d1ff20 100644 --- a/storage/innobase/sync/sync0sync.c +++ b/storage/innobase/sync/sync0sync.c @@ -115,6 +115,7 @@ ulint mutex_system_call_count = 0; /* Number of spin waits on mutexes: for performance monitoring */ +/* round=one iteration of a spin loop */ ulint mutex_spin_round_count = 0; ulint mutex_spin_wait_count = 0; ulint mutex_os_wait_count = 0; diff --git a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c index 307a03bfbc3..144721150b6 100644 --- a/storage/innobase/trx/trx0sys.c +++ b/storage/innobase/trx/trx0sys.c @@ -868,7 +868,16 @@ trx_sysf_create( trx_sysf_rseg_set_page_no(sys_header, i, FIL_NULL, mtr); } - /* The remaining area (up to the page trailer) is uninitialized. */ + /* The remaining area (up to the page trailer) is uninitialized. + Silence Valgrind warnings about it. */ + UNIV_MEM_VALID(sys_header + (TRX_SYS_RSEGS + + TRX_SYS_N_RSEGS * TRX_SYS_RSEG_SLOT_SIZE + + TRX_SYS_RSEG_SPACE), + (UNIV_PAGE_SIZE - FIL_PAGE_DATA_END + - (TRX_SYS_RSEGS + + TRX_SYS_N_RSEGS * TRX_SYS_RSEG_SLOT_SIZE + + TRX_SYS_RSEG_SPACE)) + + page - sys_header); /* Create the first rollback segment in the SYSTEM tablespace */ page_no = trx_rseg_header_create(TRX_SYS_SPACE, ULINT_MAX, &slot_no, diff --git a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c index 2d5ce0e1c61..b312e008cd2 100644 --- a/storage/innobase/trx/trx0trx.c +++ b/storage/innobase/trx/trx0trx.c @@ -1570,19 +1570,21 @@ trx_commit_for_mysql( the transaction object does not have an InnoDB session object, and we set the dummy session that we use for all MySQL transactions. */ - mutex_enter(&kernel_mutex); - if (trx->sess == NULL) { /* Open a dummy session */ if (!trx_dummy_sess) { - trx_dummy_sess = sess_open(); + mutex_enter(&kernel_mutex); + + if (!trx_dummy_sess) { + trx_dummy_sess = sess_open(); + } + + mutex_exit(&kernel_mutex); } trx->sess = trx_dummy_sess; } - - mutex_exit(&kernel_mutex); trx_start_if_not_started(trx); diff --git a/storage/innobase/ut/ut0mem.c b/storage/innobase/ut/ut0mem.c index 4fd515c35e6..b466a5f6872 100644 --- a/storage/innobase/ut/ut0mem.c +++ b/storage/innobase/ut/ut0mem.c @@ -162,6 +162,8 @@ retry: #endif } + UNIV_MEM_ALLOC(ret, n + sizeof(ut_mem_block_t)); + ((ut_mem_block_t*)ret)->size = n + sizeof(ut_mem_block_t); ((ut_mem_block_t*)ret)->magic_n = UT_MEM_MAGIC_N; diff --git a/storage/ndb/src/mgmclient/Makefile.am b/storage/ndb/src/mgmclient/Makefile.am index 8e05354919b..41f659cf68d 100644 --- a/storage/ndb/src/mgmclient/Makefile.am +++ b/storage/ndb/src/mgmclient/Makefile.am @@ -36,6 +36,7 @@ INCLUDES += -I$(top_srcdir)/storage/ndb/include/mgmapi \ LDADD_LOC = $(noinst_LTLIBRARIES) \ ../common/portlib/libportlib.la \ @readline_link@ \ + $(top_builddir)/storage/ndb/src/libndbclient.la \ $(top_builddir)/dbug/libdbug.a \ $(top_builddir)/mysys/libmysys.a \ $(top_builddir)/strings/libmystrings.a \ diff --git a/storage/ndb/src/mgmsrv/Makefile.am b/storage/ndb/src/mgmsrv/Makefile.am index adde2ad5d34..c19f885ae8d 100644 --- a/storage/ndb/src/mgmsrv/Makefile.am +++ b/storage/ndb/src/mgmsrv/Makefile.am @@ -38,7 +38,7 @@ INCLUDES_LOC = -I$(top_srcdir)/storage/ndb/src/ndbapi \ -I$(top_srcdir)/storage/ndb/src/common/mgmcommon \ -I$(top_srcdir)/storage/ndb/src/mgmclient -LDADD_LOC = $(top_builddir)/storage/ndb/src/mgmclient/CommandInterpreter.o \ +LDADD_LOC = $(top_builddir)/storage/ndb/src/mgmclient/CommandInterpreter.lo \ $(top_builddir)/storage/ndb/src/libndbclient.la \ $(top_builddir)/dbug/libdbug.a \ $(top_builddir)/mysys/libmysys.a \ diff --git a/storage/ndb/src/ndbapi/NdbScanOperation.cpp b/storage/ndb/src/ndbapi/NdbScanOperation.cpp index fa94bf8d836..89782453a72 100644 --- a/storage/ndb/src/ndbapi/NdbScanOperation.cpp +++ b/storage/ndb/src/ndbapi/NdbScanOperation.cpp @@ -1202,7 +1202,7 @@ NdbIndexScanOperation::setBound(const NdbColumnImpl* tAttrInfo, Uint32 tupKeyLen = theTupKeyLen; union { Uint32 tempData[2000]; - Uint64 __align; + Uint64 __my_align; }; Uint64 *valPtr; if(remaining > totalLen && aligned && nobytes){ diff --git a/storage/ndb/test/ndbapi/benchronja.cpp b/storage/ndb/test/ndbapi/benchronja.cpp index 4973e6e2487..73ee324a888 100644 --- a/storage/ndb/test/ndbapi/benchronja.cpp +++ b/storage/ndb/test/ndbapi/benchronja.cpp @@ -41,7 +41,14 @@ #define MAXSTRLEN 16 #define MAXATTR 64 #define MAXTABLES 64 -#define MAXTHREADS 256 +#define NDB_MAXTHREADS 256 +/* + NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a + #define from on AIX (IBM compiler). We explicitly + #undef it here lest someone use it by habit and get really funny + results. K&R says we may #undef non-existent symbols, so let's go. +*/ +#undef MAXTHREADS #define MAXATTRSIZE 8000 #define START_TIMER NdbTimer timer; timer.doStart(); #define STOP_TIMER timer.doStop(); @@ -56,18 +63,18 @@ struct ThreadNdb Ndb* NdbRef; }; -static NdbThread* threadLife[MAXTHREADS]; +static NdbThread* threadLife[NDB_MAXTHREADS]; static unsigned int tNoOfThreads; static unsigned int tNoOfOpsPerExecute; static unsigned int tNoOfRecords; static unsigned int tNoOfOperations; -static int ThreadReady[MAXTHREADS]; -static int ThreadStart[MAXTHREADS]; +static int ThreadReady[NDB_MAXTHREADS]; +static int ThreadStart[NDB_MAXTHREADS]; NDB_COMMAND(benchronja, "benchronja", "benchronja", "benchronja", 65535){ ndb_init(); - ThreadNdb tabThread[MAXTHREADS]; + ThreadNdb tabThread[NDB_MAXTHREADS]; int i = 0 ; int cont = 0 ; Ndb* pMyNdb = NULL ; //( "TEST_DB" ); @@ -84,7 +91,7 @@ NDB_COMMAND(benchronja, "benchronja", "benchronja", "benchronja", 65535){ { if (strcmp(argv[i], "-t") == 0){ tNoOfThreads = atoi(argv[i+1]); - if ((tNoOfThreads < 1) || (tNoOfThreads > MAXTHREADS)) goto error_input; + if ((tNoOfThreads < 1) || (tNoOfThreads > NDB_MAXTHREADS)) goto error_input; }else if (strcmp(argv[i], "-o") == 0){ tNoOfOperations = atoi(argv[i+1]); if (tNoOfOperations < 1) goto error_input; diff --git a/storage/ndb/test/ndbapi/flexAsynch.cpp b/storage/ndb/test/ndbapi/flexAsynch.cpp index 20a157fc2f3..1f52315482f 100644 --- a/storage/ndb/test/ndbapi/flexAsynch.cpp +++ b/storage/ndb/test/ndbapi/flexAsynch.cpp @@ -35,7 +35,14 @@ #define MAXSTRLEN 16 #define MAXATTR 64 #define MAXTABLES 64 -#define MAXTHREADS 128 +#define NDB_MAXTHREADS 128 +/* + NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a + #define from on AIX (IBM compiler). We explicitly + #undef it here lest someone use it by habit and get really funny + results. K&R says we may #undef non-existent symbols, so let's go. +*/ +#undef MAXTHREADS #define MAXPAR 1024 #define MAXATTRSIZE 1000 #define PKSIZE 2 @@ -76,10 +83,10 @@ struct ThreadNdb int ThreadNo; }; -static NdbThread* threadLife[MAXTHREADS]; +static NdbThread* threadLife[NDB_MAXTHREADS]; static int tNodeId; -static int ThreadReady[MAXTHREADS]; -static StartType ThreadStart[MAXTHREADS]; +static int ThreadReady[NDB_MAXTHREADS]; +static StartType ThreadStart[NDB_MAXTHREADS]; static char tableName[MAXTABLES][MAXSTRLEN+1]; static char attrName[MAXATTR][MAXSTRLEN+1]; @@ -160,7 +167,7 @@ NDB_COMMAND(flexAsynch, "flexAsynch", "flexAsynch", "flexAsynch", 65535) return NDBT_ProgramExit(NDBT_WRONGARGS); } - pThreadData = new ThreadNdb[MAXTHREADS]; + pThreadData = new ThreadNdb[NDB_MAXTHREADS]; ndbout << endl << "FLEXASYNCH - Starting normal mode" << endl; ndbout << "Perform benchmark of insert, update and delete transactions"; @@ -844,7 +851,7 @@ readArguments(int argc, const char** argv){ while (argc > 1){ if (strcmp(argv[i], "-t") == 0){ tNoOfThreads = atoi(argv[i+1]); - if ((tNoOfThreads < 1) || (tNoOfThreads > MAXTHREADS)){ + if ((tNoOfThreads < 1) || (tNoOfThreads > NDB_MAXTHREADS)){ ndbout_c("Invalid no of threads"); return -1; } diff --git a/storage/ndb/test/ndbapi/flexHammer.cpp b/storage/ndb/test/ndbapi/flexHammer.cpp index 9b9fd7a4a92..1b0097cf84b 100644 --- a/storage/ndb/test/ndbapi/flexHammer.cpp +++ b/storage/ndb/test/ndbapi/flexHammer.cpp @@ -66,7 +66,14 @@ ErrorData * flexHammerErrorData; #define MAXSTRLEN 16 #define MAXATTR 64 #define MAXTABLES 64 -#define MAXTHREADS 256 +#define NDB_MAXTHREADS 256 +/* + NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a + #define from on AIX (IBM compiler). We explicitly + #undef it here lest someone use it by habit and get really funny + results. K&R says we may #undef non-existent symbols, so let's go. +*/ +#undef MAXTHREADS #define MAXATTRSIZE 100 // Max number of retries if something fails #define MaxNoOfAttemptsC 10 @@ -119,8 +126,8 @@ static int tAttributeSize; static int tNoOfOperations; static int tNoOfRecords; static int tNoOfLoops; -static ReadyType ThreadReady[MAXTHREADS]; -static StartType ThreadStart[MAXTHREADS]; +static ReadyType ThreadReady[NDB_MAXTHREADS]; +static StartType ThreadStart[NDB_MAXTHREADS]; static char tableName[MAXTABLES][MAXSTRLEN]; static char attrName[MAXATTR][MAXSTRLEN]; static int theSimpleFlag = 0; @@ -640,7 +647,7 @@ readArguments (int argc, const char** argv) while (argc > 1) { if (strcmp(argv[i], "-t") == 0) { tNoOfThreads = atoi(argv[i+1]); - if ((tNoOfThreads < 1) || (tNoOfThreads > MAXTHREADS)) + if ((tNoOfThreads < 1) || (tNoOfThreads > NDB_MAXTHREADS)) return(1); } else if (strcmp(argv[i], "-o") == 0) { diff --git a/storage/ndb/test/ndbapi/flexScan.cpp b/storage/ndb/test/ndbapi/flexScan.cpp index e0b07250762..105dfeedfff 100644 --- a/storage/ndb/test/ndbapi/flexScan.cpp +++ b/storage/ndb/test/ndbapi/flexScan.cpp @@ -68,7 +68,14 @@ #define MAXSTRLEN 16 #define MAXATTR 64 #define MAXTABLES 64 -#define MAXTHREADS 256 +#define NDB_MAXTHREADS 256 +/* + NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a + #define from on AIX (IBM compiler). We explicitly + #undef it here lest someone use it by habit and get really funny + results. K&R says we may #undef non-existent symbols, so let's go. +*/ +#undef MAXTHREADS #define MAXATTRSIZE 64 enum StartType { @@ -848,7 +855,7 @@ static int readArguments(int argc, const char** argv) if (strcmp(argv[i], "-t") == 0) { if (argv[i + 1] != NULL) { tNoOfThreads = atoi(argv[i + 1]); - if ((tNoOfThreads < 1) || (tNoOfThreads > MAXTHREADS)) { + if ((tNoOfThreads < 1) || (tNoOfThreads > NDB_MAXTHREADS)) { retValue = -1; } // if } // if diff --git a/storage/ndb/test/ndbapi/flexTT.cpp b/storage/ndb/test/ndbapi/flexTT.cpp index 71d5b6c096e..4373102f77e 100644 --- a/storage/ndb/test/ndbapi/flexTT.cpp +++ b/storage/ndb/test/ndbapi/flexTT.cpp @@ -35,7 +35,14 @@ #define MAXSTRLEN 16 #define MAXATTR 64 #define MAXTABLES 64 -#define MAXTHREADS 128 +#define NDB_MAXTHREADS 128 +/* + NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a + #define from on AIX (IBM compiler). We explicitly + #undef it here lest someone use it by habit and get really funny + results. K&R says we may #undef non-existent symbols, so let's go. +*/ +#undef MAXTHREADS #define MAXPAR 1024 #define MAXATTRSIZE 1000 #define PKSIZE 1 @@ -101,10 +108,10 @@ static void input_error(); ErrorData * flexTTErrorData; -static NdbThread* threadLife[MAXTHREADS]; +static NdbThread* threadLife[NDB_MAXTHREADS]; static int tNodeId; -static int ThreadReady[MAXTHREADS]; -static StartType ThreadStart[MAXTHREADS]; +static int ThreadReady[NDB_MAXTHREADS]; +static StartType ThreadStart[NDB_MAXTHREADS]; static char tableName[1][MAXSTRLEN+1]; static char attrName[5][MAXSTRLEN+1]; @@ -184,7 +191,7 @@ NDB_COMMAND(flexTT, "flexTT", "flexTT", "flexTT", 65535) return NDBT_ProgramExit(NDBT_WRONGARGS); } - pThreadData = new ThreadNdb[MAXTHREADS]; + pThreadData = new ThreadNdb[NDB_MAXTHREADS]; ndbout << endl << "FLEXTT - Starting normal mode" << endl; ndbout << "Perform TimesTen benchmark" << endl; @@ -798,7 +805,7 @@ readArguments(int argc, const char** argv){ while (argc > 1){ if (strcmp(argv[i], "-t") == 0){ tNoOfThreads = atoi(argv[i+1]); - if ((tNoOfThreads < 1) || (tNoOfThreads > MAXTHREADS)){ + if ((tNoOfThreads < 1) || (tNoOfThreads > NDB_MAXTHREADS)){ ndbout_c("Invalid no of threads"); return -1; } diff --git a/storage/ndb/test/ndbapi/flexTimedAsynch.cpp b/storage/ndb/test/ndbapi/flexTimedAsynch.cpp index cc44ab8b237..b6301e59df2 100644 --- a/storage/ndb/test/ndbapi/flexTimedAsynch.cpp +++ b/storage/ndb/test/ndbapi/flexTimedAsynch.cpp @@ -57,7 +57,14 @@ #define MAXSTRLEN 16 #define MAXATTR 64 #define MAXTABLES 64 -#define MAXTHREADS 256 +#define NDB_MAXTHREADS 256 +/* + NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a + #define from on AIX (IBM compiler). We explicitly + #undef it here lest someone use it by habit and get really funny + results. K&R says we may #undef non-existent symbols, so let's go. +*/ +#undef MAXTHREADS #define MAXATTRSIZE 1000 #define PKSIZE 1 @@ -95,10 +102,10 @@ static int failed = 0 ; // lame global variable that keeps track of failed trans // incremented in executeCallback() and reset in main() /************************************************************* < epaulsa */ -static NdbThread* threadLife[MAXTHREADS]; +static NdbThread* threadLife[NDB_MAXTHREADS]; static int tNodeId; -static int ThreadReady[MAXTHREADS]; -static StartType ThreadStart[MAXTHREADS]; +static int ThreadReady[NDB_MAXTHREADS]; +static StartType ThreadStart[NDB_MAXTHREADS]; static char tableName[MAXTABLES][MAXSTRLEN+1]; static char attrName[MAXATTR][MAXSTRLEN+1]; static int *getAttrValueTable; @@ -174,7 +181,7 @@ void deleteAttributeSpace(){ NDB_COMMAND(flexTimedAsynch, "flexTimedAsynch", "flexTimedAsynch [-tpoilcas]", "flexTimedAsynch", 65535) { ndb_init(); - ThreadNdb tabThread[MAXTHREADS]; + ThreadNdb tabThread[NDB_MAXTHREADS]; int tLoops=0; int returnValue; //NdbOut flexTimedAsynchNdbOut; @@ -615,8 +622,8 @@ void readArguments(int argc, const char** argv) if (strcmp(argv[i], "-t") == 0) { tNoOfThreads = atoi(argv[i+1]); - // if ((tNoOfThreads < 1) || (tNoOfThreads > MAXTHREADS)) - if ((tNoOfThreads < 1) || (tNoOfThreads > MAXTHREADS)) + // if ((tNoOfThreads < 1) || (tNoOfThreads > NDB_MAXTHREADS)) + if ((tNoOfThreads < 1) || (tNoOfThreads > NDB_MAXTHREADS)) exit(-1); } else if (strcmp(argv[i], "-i") == 0) @@ -628,7 +635,7 @@ void readArguments(int argc, const char** argv) else if (strcmp(argv[i], "-p") == 0) { tNoOfTransInBatch = atoi(argv[i+1]); - //if ((tNoOfTransInBatch < 1) || (tNoOfTransInBatch > MAXTHREADS)) + //if ((tNoOfTransInBatch < 1) || (tNoOfTransInBatch > NDB_MAXTHREADS)) if ((tNoOfTransInBatch < 1) || (tNoOfTransInBatch > 10000)) exit(-1); } diff --git a/storage/ndb/test/ndbapi/initronja.cpp b/storage/ndb/test/ndbapi/initronja.cpp index 170c3dd5cfb..28ffa9f211d 100644 --- a/storage/ndb/test/ndbapi/initronja.cpp +++ b/storage/ndb/test/ndbapi/initronja.cpp @@ -29,7 +29,14 @@ #define MAXSTRLEN 16 #define MAXATTR 64 #define MAXTABLES 64 -#define MAXTHREADS 256 +#define NDB_MAXTHREADS 256 +/* + NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a + #define from on AIX (IBM compiler). We explicitly + #undef it here lest someone use it by habit and get really funny + results. K&R says we may #undef non-existent symbols, so let's go. +*/ +#undef MAXTHREADS #define MAXATTRSIZE 8000 static unsigned int tNoOfRecords; diff --git a/storage/ndb/test/ndbapi/testIndexStat.cpp b/storage/ndb/test/ndbapi/testIndexStat.cpp index 7c69361a732..0e15cdd80d1 100644 --- a/storage/ndb/test/ndbapi/testIndexStat.cpp +++ b/storage/ndb/test/ndbapi/testIndexStat.cpp @@ -1210,8 +1210,8 @@ struct V_rir { static double data(const Range& range) { return (double)range.errpct; } }; -template static void computestat(Stat& stat); -template static void computestat(Stat& stat); +template void computestat(Stat& stat); +template void computestat(Stat& stat); static Stat g_stat_rpk; // summaries over loops static Stat g_stat_rir; @@ -1297,43 +1297,43 @@ my_long_options[] = { NDB_STD_OPTS("testIndexStat"), { "loglevel", 1001, "Logging level in this program 0-3 (default 0)", - (gptr*)&g_opts.loglevel, (gptr*)&g_opts.loglevel, 0, + (uchar **)&g_opts.loglevel, (uchar **)&g_opts.loglevel, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "seed", 1002, "Random seed (0=loop number, default -1=random)", - (gptr*)&g_opts.seed, (gptr*)&g_opts.seed, 0, + (uchar **)&g_opts.seed, (uchar **)&g_opts.seed, 0, GET_INT, REQUIRED_ARG, -1, 0, 0, 0, 0, 0 }, { "loop", 1003, "Number of test loops (default 1, 0=forever)", - (gptr*)&g_opts.loop, (gptr*)&g_opts.loop, 0, + (uchar **)&g_opts.loop, (uchar **)&g_opts.loop, 0, GET_INT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0 }, { "rows", 1004, "Number of rows (default 100000)", - (gptr*)&g_opts.rows, (gptr*)&g_opts.rows, 0, + (uchar **)&g_opts.rows, (uchar **)&g_opts.rows, 0, GET_UINT, REQUIRED_ARG, 100000, 0, 0, 0, 0, 0 }, { "ops", 1005, "Number of index scans per loop (default 1000)", - (gptr*)&g_opts.ops, (gptr*)&g_opts.ops, 0, + (uchar **)&g_opts.ops, (uchar **)&g_opts.ops, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0 }, { "dupkeys", 1006, "Pct records per key (min 100, default 1000)", - (gptr*)&g_opts.dupkeys, (gptr*)&g_opts.dupkeys, 0, + (uchar **)&g_opts.dupkeys, (uchar **)&g_opts.dupkeys, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0 }, { "scanpct", 1007, "Preferred max pct of total rows per scan (default 5)", - (gptr*)&g_opts.scanpct, (gptr*)&g_opts.scanpct, 0, + (uchar **)&g_opts.scanpct, (uchar **)&g_opts.scanpct, 0, GET_UINT, REQUIRED_ARG, 5, 0, 0, 0, 0, 0 }, { "nullkeys", 1008, "Pct nulls in each key attribute (default 10)", - (gptr*)&g_opts.nullkeys, (gptr*)&g_opts.nullkeys, 0, + (uchar **)&g_opts.nullkeys, (uchar **)&g_opts.nullkeys, 0, GET_UINT, REQUIRED_ARG, 10, 0, 0, 0, 0, 0 }, { "eqscans", 1009, "Pct scans for partial/full equality (default 50)", - (gptr*)&g_opts.eqscans, (gptr*)&g_opts.eqscans, 0, + (uchar **)&g_opts.eqscans, (uchar **)&g_opts.eqscans, 0, GET_UINT, REQUIRED_ARG, 50, 0, 0, 0, 0, 0 }, { "dupscans", 1010, "Pct scans using same bounds (default 10)", - (gptr*)&g_opts.dupscans, (gptr*)&g_opts.dupscans, 0, + (uchar **)&g_opts.dupscans, (uchar **)&g_opts.dupscans, 0, GET_UINT, REQUIRED_ARG, 10, 0, 0, 0, 0, 0 }, { "keeptable", 1011, "Use existing table and data if any and do not drop", - (gptr*)&g_opts.keeptable, (gptr*)&g_opts.keeptable, 0, + (uchar **)&g_opts.keeptable, (uchar **)&g_opts.keeptable, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "no-extra-checks", 1012, "Omit expensive consistency checks", - (gptr*)&g_opts.nochecks, (gptr*)&g_opts.nochecks, 0, + (uchar **)&g_opts.nochecks, (uchar **)&g_opts.nochecks, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "abort-on-error", 1013, "Dump core on any error", - (gptr*)&g_opts.abort, (gptr*)&g_opts.abort, 0, + (uchar **)&g_opts.abort, (uchar **)&g_opts.abort, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, diff --git a/storage/ndb/test/ndbapi/testOperations.cpp b/storage/ndb/test/ndbapi/testOperations.cpp index 38d6e817637..95be2b988e1 100644 --- a/storage/ndb/test/ndbapi/testOperations.cpp +++ b/storage/ndb/test/ndbapi/testOperations.cpp @@ -98,11 +98,6 @@ OperationTestCase matrix[] = { result = NDBT_FAILED; \ break; } -#define C3(b) if (!(b)) { \ - g_err << "ERR: "<< step->getName() \ - << " failed on line " << __LINE__ << endl; \ - abort(); return NDBT_FAILED; } - #define C3(b) if (!(b)) { \ g_err << "ERR: failed on line " << __LINE__ << endl; \ return NDBT_FAILED; } diff --git a/storage/ndb/test/ndbapi/testScanFilter.cpp b/storage/ndb/test/ndbapi/testScanFilter.cpp index ac0b0ed2c4d..dfe1097bd25 100644 --- a/storage/ndb/test/ndbapi/testScanFilter.cpp +++ b/storage/ndb/test/ndbapi/testScanFilter.cpp @@ -49,7 +49,15 @@ const char COL_LEN = 7; * there are six columns, 'i', 'j', 'k', 'l', 'm', 'n', and each on is equal to 1 or 1, * Since each tuple should be unique in this case, then TUPLE_NUM = 2 power 6 = 64 */ -const int TUPLE_NUM = (int)pow(2, COL_LEN-1); +#ifdef _AIX +/* + IBM xlC_r breaks on the initialization with pow(): + "The expression must be an integral constant expression." +*/ +const int TUPLE_NUM = 64; +#else +const int TUPLE_NUM = (int)pow(2, COL_LEN-1); +#endif /* * the recursive level of random scan filter, can @@ -479,7 +487,7 @@ int get_column_id(char ch) */ bool check_col_equal_one(int tuple_no, int col_id) { - int i = (int)pow(2, 6 - col_id); + int i = (int)pow((double)2, (double)(6 - col_id)); int j = tuple_no / i; if(j % 2) return true; diff --git a/storage/ndb/test/ndbapi/test_event_merge.cpp b/storage/ndb/test/ndbapi/test_event_merge.cpp index 662b1eb6f4c..d40b985adc2 100644 --- a/storage/ndb/test/ndbapi/test_event_merge.cpp +++ b/storage/ndb/test/ndbapi/test_event_merge.cpp @@ -2184,57 +2184,57 @@ my_long_options[] = { NDB_STD_OPTS("test_event_merge"), { "abort-on-error", 1001, "Do abort() on any error", - (gptr*)&g_opts.abort_on_error, (gptr*)&g_opts.abort_on_error, 0, + (uchar **)&g_opts.abort_on_error, (uchar **)&g_opts.abort_on_error, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "loglevel", 1002, "Logging level in this program 0-3 (default 0)", - (gptr*)&g_opts.loglevel, (gptr*)&g_opts.loglevel, 0, + (uchar **)&g_opts.loglevel, (uchar **)&g_opts.loglevel, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "loop", 1003, "Number of test loops (default 5, 0=forever)", - (gptr*)&g_opts.loop, (gptr*)&g_opts.loop, 0, + (uchar **)&g_opts.loop, (uchar **)&g_opts.loop, 0, GET_INT, REQUIRED_ARG, 5, 0, 0, 0, 0, 0 }, { "maxops", 1004, "Approx number of PK operations per table (default 1000)", - (gptr*)&g_opts.maxops, (gptr*)&g_opts.maxops, 0, + (uchar **)&g_opts.maxops, (uchar **)&g_opts.maxops, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0 }, { "maxpk", 1005, "Number of different PK values (default 10, max 1000)", - (gptr*)&g_opts.maxpk, (gptr*)&g_opts.maxpk, 0, + (uchar **)&g_opts.maxpk, (uchar **)&g_opts.maxpk, 0, GET_UINT, REQUIRED_ARG, 10, 0, 0, 0, 0, 0 }, { "maxtab", 1006, "Number of tables (default 10, max 100)", - (gptr*)&g_opts.maxtab, (gptr*)&g_opts.maxtab, 0, + (uchar **)&g_opts.maxtab, (uchar **)&g_opts.maxtab, 0, GET_INT, REQUIRED_ARG, 10, 0, 0, 0, 0, 0 }, { "no-blobs", 1007, "Omit blob attributes (5.0: true)", - (gptr*)&g_opts.no_blobs, (gptr*)&g_opts.no_blobs, 0, + (uchar **)&g_opts.no_blobs, (uchar **)&g_opts.no_blobs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "no-implicit-nulls", 1008, "Insert must include all attrs" " i.e. no implicit NULLs", - (gptr*)&g_opts.no_implicit_nulls, (gptr*)&g_opts.no_implicit_nulls, 0, + (uchar **)&g_opts.no_implicit_nulls, (uchar **)&g_opts.no_implicit_nulls, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "no-missing-update", 1009, "Update must include all non-PK attrs", - (gptr*)&g_opts.no_missing_update, (gptr*)&g_opts.no_missing_update, 0, + (uchar **)&g_opts.no_missing_update, (uchar **)&g_opts.no_missing_update, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "no-multiops", 1010, "Allow only 1 operation per commit", - (gptr*)&g_opts.no_multiops, (gptr*)&g_opts.no_multiops, 0, + (uchar **)&g_opts.no_multiops, (uchar **)&g_opts.no_multiops, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "no-nulls", 1011, "Create no NULL values", - (gptr*)&g_opts.no_nulls, (gptr*)&g_opts.no_nulls, 0, + (uchar **)&g_opts.no_nulls, (uchar **)&g_opts.no_nulls, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "one-blob", 1012, "Only one blob attribute (default 2)", - (gptr*)&g_opts.one_blob, (gptr*)&g_opts.one_blob, 0, + (uchar **)&g_opts.one_blob, (uchar **)&g_opts.one_blob, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "opstring", 1013, "Operations to run e.g. idiucdc (c is commit) or" " iuuc:uudc (the : separates loops)", - (gptr*)&g_opts.opstring, (gptr*)&g_opts.opstring, 0, + (uchar **)&g_opts.opstring, (uchar **)&g_opts.opstring, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "seed", 1014, "Random seed (0=loop number, default -1=random)", - (gptr*)&g_opts.seed, (gptr*)&g_opts.seed, 0, + (uchar **)&g_opts.seed, (uchar **)&g_opts.seed, 0, GET_INT, REQUIRED_ARG, -1, 0, 0, 0, 0, 0 }, { "separate-events", 1015, "Do not combine events per GCI (5.0: true)", - (gptr*)&g_opts.separate_events, (gptr*)&g_opts.separate_events, 0, + (uchar **)&g_opts.separate_events, (uchar **)&g_opts.separate_events, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "tweak", 1016, "Whatever the source says", - (gptr*)&g_opts.tweak, (gptr*)&g_opts.tweak, 0, + (uchar **)&g_opts.tweak, (uchar **)&g_opts.tweak, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "use-table", 1017, "Use existing tables", - (gptr*)&g_opts.use_table, (gptr*)&g_opts.use_table, 0, + (uchar **)&g_opts.use_table, (uchar **)&g_opts.use_table, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, diff --git a/storage/ndb/test/odbc/SQL99_test/SQL99_test.cpp b/storage/ndb/test/odbc/SQL99_test/SQL99_test.cpp index 039a77f4d53..fb77220773d 100644 --- a/storage/ndb/test/odbc/SQL99_test/SQL99_test.cpp +++ b/storage/ndb/test/odbc/SQL99_test/SQL99_test.cpp @@ -27,7 +27,14 @@ using namespace std; // #define MAXROW 64 #define DEFROW 8 -#define MAXTHREADS 24 +/* + NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a + #define from on AIX (IBM compiler). We explicitly + #undef it here lest someone use it by habit and get really funny + results. K&R says we may #undef non-existent symbols, so let's go. +*/ +#undef MAXTHREADS +#define NDB_MAXTHREADS 24 #define DEFTHREADS 2 #define MAXTABLES 16 @@ -83,7 +90,7 @@ int main(int argc, char* argv[]){ char* szTableNames = (char*)malloc(sizeof(char)*nNoOfTables*MAX_TABLE_NAME) ; memset(szTableNames, 0, sizeof(char)*nNoOfTables*MAX_TABLE_NAME) ; - UintPtr pThreadHandles[MAXTHREADS] = { NULL } ; + UintPtr pThreadHandles[NDB_MAXTHREADS] = { NULL } ; AssignTableNames(szTableNames, nNoOfTables) ; @@ -313,7 +320,7 @@ void ParseArguments(int argc, const char** argv){ if (strcmp(argv[i], "-t") == 0) { nNoOfThreads = atoi(argv[i+1]); - if ((nNoOfThreads < 1) || (nNoOfThreads > MAXTHREADS)) + if ((nNoOfThreads < 1) || (nNoOfThreads > NDB_MAXTHREADS)) nNoOfThreads = DEFTHREADS ; } else if (strcmp(argv[i], "-c") == 0) diff --git a/storage/ndb/test/run-test/main.cpp b/storage/ndb/test/run-test/main.cpp index 2e8d6bfde6d..b5c4385f5d3 100644 --- a/storage/ndb/test/run-test/main.cpp +++ b/storage/ndb/test/run-test/main.cpp @@ -77,60 +77,60 @@ my_bool opt_core; static struct my_option g_options[] = { { "help", '?', "Display this help and exit.", - (gptr*) &g_help, (gptr*) &g_help, + (uchar **) &g_help, (uchar **) &g_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "clusters", 256, "Cluster", - (gptr*) &g_clusters, (gptr*) &g_clusters, + (uchar **) &g_clusters, (uchar **) &g_clusters, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "replicate", 1024, "replicate", - (gptr*) &g_dummy, (gptr*) &g_dummy, + (uchar **) &g_dummy, (uchar **) &g_dummy, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "log-file", 256, "log-file", - (gptr*) &g_log_filename, (gptr*) &g_log_filename, + (uchar **) &g_log_filename, (uchar **) &g_log_filename, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "testcase-file", 'f', "testcase-file", - (gptr*) &g_test_case_filename, (gptr*) &g_test_case_filename, + (uchar **) &g_test_case_filename, (uchar **) &g_test_case_filename, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "report-file", 'r', "report-file", - (gptr*) &g_report_filename, (gptr*) &g_report_filename, + (uchar **) &g_report_filename, (uchar **) &g_report_filename, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "basedir", 256, "Base path", - (gptr*) &g_basedir, (gptr*) &g_basedir, + (uchar **) &g_basedir, (uchar **) &g_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "baseport", 256, "Base port", - (gptr*) &g_baseport, (gptr*) &g_baseport, + (uchar **) &g_baseport, (uchar **) &g_baseport, 0, GET_INT, REQUIRED_ARG, g_baseport, 0, 0, 0, 0, 0}, { "prefix", 256, "mysql install dir", - (gptr*) &g_prefix, (gptr*) &g_prefix, + (uchar **) &g_prefix, (uchar **) &g_prefix, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "verbose", 'v', "Verbosity", - (gptr*) &g_verbosity, (gptr*) &g_verbosity, + (uchar **) &g_verbosity, (uchar **) &g_verbosity, 0, GET_INT, REQUIRED_ARG, g_verbosity, 0, 0, 0, 0, 0}, { "configure", 256, "configure", - (gptr*) &g_do_setup, (gptr*) &g_do_setup, + (uchar **) &g_do_setup, (uchar **) &g_do_setup, 0, GET_INT, REQUIRED_ARG, g_do_setup, 0, 0, 0, 0, 0 }, { "deploy", 256, "deploy", - (gptr*) &g_do_deploy, (gptr*) &g_do_deploy, + (uchar **) &g_do_deploy, (uchar **) &g_do_deploy, 0, GET_INT, REQUIRED_ARG, g_do_deploy, 0, 0, 0, 0, 0 }, { "sshx", 256, "sshx", - (gptr*) &g_do_sshx, (gptr*) &g_do_sshx, + (uchar **) &g_do_sshx, (uchar **) &g_do_sshx, 0, GET_INT, REQUIRED_ARG, g_do_sshx, 0, 0, 0, 0, 0 }, { "start", 256, "start", - (gptr*) &g_do_start, (gptr*) &g_do_start, + (uchar **) &g_do_start, (uchar **) &g_do_start, 0, GET_INT, REQUIRED_ARG, g_do_start, 0, 0, 0, 0, 0 }, { "fqpn", 256, "Fully qualified path-names ", - (gptr*) &g_fqpn, (gptr*) &g_fqpn, + (uchar **) &g_fqpn, (uchar **) &g_fqpn, 0, GET_INT, REQUIRED_ARG, g_fqpn, 0, 0, 0, 0, 0 }, { "default-ports", 256, "Use default ports when possible", - (gptr*) &g_default_ports, (gptr*) &g_default_ports, + (uchar **) &g_default_ports, (uchar **) &g_default_ports, 0, GET_INT, REQUIRED_ARG, g_default_ports, 0, 0, 0, 0, 0 }, { "mode", 256, "Mode 0=interactive 1=regression 2=bench", - (gptr*) &g_mode, (gptr*) &g_mode, + (uchar **) &g_mode, (uchar **) &g_mode, 0, GET_INT, REQUIRED_ARG, g_mode, 0, 0, 0, 0, 0 }, { "quit", 256, "Quit before starting tests", - (gptr*) &g_mode, (gptr*) &g_do_quit, + (uchar **) &g_mode, (uchar **) &g_do_quit, 0, GET_BOOL, NO_ARG, g_do_quit, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/test/src/NDBT_Test.cpp b/storage/ndb/test/src/NDBT_Test.cpp index b30430c73c1..69f3723ca75 100644 --- a/storage/ndb/test/src/NDBT_Test.cpp +++ b/storage/ndb/test/src/NDBT_Test.cpp @@ -1195,35 +1195,35 @@ static struct my_option my_long_options[] = { NDB_STD_OPTS(""), { "print", OPT_PRINT, "Print execution tree", - (gptr*) &opt_print, (gptr*) &opt_print, 0, + (uchar **) &opt_print, (uchar **) &opt_print, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "print_html", OPT_PRINT_HTML, "Print execution tree in html table format", - (gptr*) &opt_print_html, (gptr*) &opt_print_html, 0, + (uchar **) &opt_print_html, (uchar **) &opt_print_html, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "print_cases", OPT_PRINT_CASES, "Print list of test cases", - (gptr*) &opt_print_cases, (gptr*) &opt_print_cases, 0, + (uchar **) &opt_print_cases, (uchar **) &opt_print_cases, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "records", 'r', "Number of records", - (gptr*) &opt_records, (gptr*) &opt_records, 0, + (uchar **) &opt_records, (uchar **) &opt_records, 0, GET_INT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0 }, { "loops", 'l', "Number of loops", - (gptr*) &opt_loops, (gptr*) &opt_loops, 0, + (uchar **) &opt_loops, (uchar **) &opt_loops, 0, GET_INT, REQUIRED_ARG, 5, 0, 0, 0, 0, 0 }, { "seed", 1024, "Random seed", - (gptr*) &opt_seed, (gptr*) &opt_seed, 0, + (uchar **) &opt_seed, (uchar **) &opt_seed, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "testname", 'n', "Name of test to run", - (gptr*) &opt_testname, (gptr*) &opt_testname, 0, + (uchar **) &opt_testname, (uchar **) &opt_testname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "remote_mgm", 'm', "host:port to mgmsrv of remote cluster", - (gptr*) &opt_remote_mgm, (gptr*) &opt_remote_mgm, 0, + (uchar **) &opt_remote_mgm, (uchar **) &opt_remote_mgm, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "timer", 't', "Print execution time", - (gptr*) &opt_timer, (gptr*) &opt_timer, 0, + (uchar **) &opt_timer, (uchar **) &opt_timer, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "verbose", 'v', "Print verbose status", - (gptr*) &opt_verbose, (gptr*) &opt_verbose, 0, + (uchar **) &opt_verbose, (uchar **) &opt_verbose, 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} }; diff --git a/win/README b/win/README index fbcdfd068b8..afa4bd65163 100644 --- a/win/README +++ b/win/README @@ -63,7 +63,9 @@ The options right now are: MYSQL_TCP_PORT= Server port, default 3306 CYBOZU Default character set is UTF8 EMBED_MANIFESTS Embed custom manifests into final exes, otherwise VS - default will be used. + default will be used. (Note - This option should only be + used by MySQL AB.) + So the command line could look like: diff --git a/win/create_manifest.js b/win/create_manifest.js index 8569bd508ff..dec8f6e62e2 100755 --- a/win/create_manifest.js +++ b/win/create_manifest.js @@ -56,7 +56,7 @@ try manifest_xml+= "\t