From 475eac91ce320321a499e546f5c9e308c680a5e2 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 17 Jul 2007 14:43:56 -0400 Subject: [PATCH 01/27] Bug #29784 YaSSL assertion failure when reading 8k key. Fixed the yassl base64 decoding to correctly allocate a maximum decoded buffer size. mysql-test/std_data/server8k-cert.pem: BitKeeper file /Users/dkatz/50/mysql-test/std_data/server8k-cert.pem mysql-test/std_data/server8k-key.pem: BitKeeper file /Users/dkatz/50/mysql-test/std_data/server8k-key.pem extra/yassl/taocrypt/src/coding.cpp: Fixed buffer allocation to compute the proper maximum decoded size: (EncodedLength * 3/4) + 3 mysql-test/r/ssl_8k_key.result: New BitKeeper file ``mysql-test/r/ssl_8k_key.result'' Test connection to server using large SSL key. mysql-test/t/ssl_8k_key.test: New BitKeeper file ``mysql-test/t/ssl_8k_key.test'' Test connection to server using large SSL key. --- extra/yassl/taocrypt/src/coding.cpp | 2 +- mysql-test/r/ssl_8k_key.result | 2 + mysql-test/std_data/server8k-cert.pem | 51 ++++++++++++++ mysql-test/std_data/server8k-key.pem | 99 +++++++++++++++++++++++++++ mysql-test/t/ssl_8k_key.test | 6 ++ 5 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 mysql-test/r/ssl_8k_key.result create mode 100644 mysql-test/std_data/server8k-cert.pem create mode 100644 mysql-test/std_data/server8k-key.pem create mode 100644 mysql-test/t/ssl_8k_key.test 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/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----- +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 +-----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----- +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 +-----END RSA PRIVATE KEY----- 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 + From 6947f2d1316c7b0b7ede841a097328da8c21aa4d Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 18 Jul 2007 12:13:45 +0500 Subject: [PATCH 02/27] Fix for bug #28125: ERROR 2013 when adding index. Problem: we may break a multibyte char sequence using a key reduced to maximum allowed length for a storage engine (that leads to failed assertion in the innodb code, see also #17530). Fix: align truncated key length to multibyte char boundary. mysql-test/r/innodb_mysql.result: Fix for bug #28125: ERROR 2013 when adding index. - test result. mysql-test/t/innodb_mysql.test: Fix for bug #28125: ERROR 2013 when adding index. - test case. sql/sql_table.cc: Fix for bug #28125: ERROR 2013 when adding index. - align truncated key length to multibyte char boundary. - display real key length in bytes raising warnings. --- mysql-test/r/innodb_mysql.result | 14 +++++++++++++- mysql-test/t/innodb_mysql.test | 9 +++++++++ sql/sql_table.cc | 6 ++++-- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index 4535710c905..4c1e7189998 100644 --- a/mysql-test/r/innodb_mysql.result +++ b/mysql-test/r/innodb_mysql.result @@ -418,7 +418,7 @@ DROP TABLE t1,t2; create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb 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; @@ -735,4 +735,16 @@ COUNT(*) 3072 set @@sort_buffer_size=default; DROP TABLE t1,t2; +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 +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 diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test index d4ce997ddb1..4930ec81a62 100644 --- a/mysql-test/t/innodb_mysql.test +++ b/mysql-test/t/innodb_mysql.test @@ -741,4 +741,13 @@ set @@sort_buffer_size=default; DROP TABLE t1,t2; +# +# 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 diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 87f23097a66..0da639f9896 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1357,6 +1357,8 @@ static int mysql_prepare_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 { @@ -1387,8 +1389,6 @@ static int mysql_prepare_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 */ @@ -1397,6 +1397,8 @@ static int mysql_prepare_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 { From 8b8b430bbccc01717e3eb50e4e452cf415292d00 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 18 Jul 2007 14:03:58 -0400 Subject: [PATCH 03/27] Bug#26909: Specified key was too long; max key length is 255 bytes \ when creating table Federated tables had an artificially low maximum of key length, because the handler failed to implement a method to return it and the default value is taked from the prototype handler. Now, implement that method and return the maximum possible key length, which is that of InnoDB. mysql-test/r/federated.result: Verify that unique keys may be longer than 255 characters. mysql-test/t/federated.test: Verify that unique keys may be longer than 255 characters. sql/ha_federated.h: Implement the virtual method that tells the max size of parts to make a key. Backport the length defined in 5.1. --- mysql-test/r/federated.result | 37 ++++++++++++++++++++++++++++++++ mysql-test/t/federated.test | 40 +++++++++++++++++++++++++++++++++++ sql/ha_federated.h | 4 +++- 3 files changed, 80 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result index cecffbb1471..b69ff8033d4 100644 --- a/mysql-test/r/federated.result +++ b/mysql-test/r/federated.result @@ -1843,6 +1843,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; DROP TABLE IF EXISTS federated.t1; DROP DATABASE IF EXISTS federated; DROP TABLE IF EXISTS federated.t1; diff --git a/mysql-test/t/federated.test b/mysql-test/t/federated.test index 894cd513914..e3c7d478c78 100644 --- a/mysql-test/t/federated.test +++ b/mysql-test/t/federated.test @@ -1575,5 +1575,45 @@ 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; source include/federated_cleanup.inc; diff --git a/sql/ha_federated.h b/sql/ha_federated.h index 09c934cb493..9f24e92357c 100644 --- a/sql/ha_federated.h +++ b/sql/ha_federated.h @@ -37,6 +37,7 @@ #define FEDERATED_QUERY_BUFFER_SIZE STRING_BUFFER_USUAL_SIZE * 5 #define FEDERATED_RECORDS_IN_RANGE 2 +#define FEDERATED_MAX_KEY_LENGTH 3500 // Same as innodb #define FEDERATED_INFO " SHOW TABLE STATUS LIKE " #define FEDERATED_INFO_LEN sizeof(FEDERATED_INFO) #define FEDERATED_SELECT "SELECT " @@ -217,7 +218,8 @@ public: uint max_supported_record_length() const { return HA_MAX_REC_LENGTH; } 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 MAX_KEY_LENGTH; } + 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 From 4740e005a0bff2f89b484634adfcd25f34ba15d9 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 19 Jul 2007 15:25:54 -0400 Subject: [PATCH 04/27] Bug #29910 Sporadic test failure in status.test mysql-test/t/status.test: Fixed test to correctly wait for right server process and state. --- mysql-test/t/status.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; From 28ec0efcb6810c98af5bfbeeaaf0bfa13343a874 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 Jul 2007 11:23:38 +0500 Subject: [PATCH 05/27] Fixed #29923: federated.test fails in 5.0-maint, 5.1-maint Result adjusted. mysql-test/r/federated.result: Fixed #29923: federated.test fails in 5.0-maint, 5.1-maint - result adjusted. --- mysql-test/r/federated.result | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result index 076e165b21e..56522ba2f50 100644 --- a/mysql-test/r/federated.result +++ b/mysql-test/r/federated.result @@ -1878,6 +1878,8 @@ select categoryId from federated.t1 where domainId<>'a' and categoryName<>'b' or 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)) From 30b0de253ca1509e1c14c85ea74d82ae33acaa9c Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 Jul 2007 11:45:08 +0500 Subject: [PATCH 06/27] after-merge fixup. --- mysql-test/r/federated.result | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result index 966816ee19b..5c5cb7eaa79 100644 --- a/mysql-test/r/federated.result +++ b/mysql-test/r/federated.result @@ -1878,6 +1878,8 @@ select categoryId from federated.t1 where domainId<>'a' and categoryName<>'b' or 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)) From 866225919c303f36e83b6af10e3908bcb39bda62 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 Jul 2007 15:19:37 +0500 Subject: [PATCH 07/27] after-merge fixup --- mysql-test/r/innodb_mysql.result | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index 9494a04f593..6bc3084cf6d 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; @@ -814,6 +814,19 @@ drop table if exists t1; create table t1 (a int) engine=innodb; alter table t1 alter a set default 1; 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, From 3d2675ec3ecbe04e5f555b446858fa8ac78536e0 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 Jul 2007 15:37:42 +0500 Subject: [PATCH 08/27] after-merge fixup --- mysql-test/r/innodb_mysql.result | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index f44ce5b5122..a7f6b0ad9d7 100644 --- a/mysql-test/r/innodb_mysql.result +++ b/mysql-test/r/innodb_mysql.result @@ -735,6 +735,10 @@ COUNT(*) 3072 set @@sort_buffer_size=default; DROP TABLE t1,t2; +drop table if exists t1; +create table t1 (a int) engine=innodb; +alter table t1 alter a set default 1; +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)); @@ -746,8 +750,5 @@ t1 CREATE TABLE `t1` ( `a` text, KEY `a` (`a`(255)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 -drop table if exists t1; -create table t1 (a int) engine=innodb; -alter table t1 alter a set default 1; drop table t1; End of 5.0 tests From c2f0c211cd74ae2d058e1d865e9a3d880b8a2cfd Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 Jul 2007 19:34:31 -0600 Subject: [PATCH 09/27] Apply snapshot innodb-51-ss1644 Fixes: - Bug #23710: crash_commit_before fails if innodb_file_per_table=1 - Bug #28254: innodb crash if shutdown during innodb_table_monitor is running - Bug #28604: innodb_force_recovery restricts data dump - Bug #29097: fsp_get_available_space_in_free_extents() is capped at 4TB - Bug #29155: Innodb "Parallel recovery" is not prevented storage/innobase/Makefile.am: Apply snapshot innodb-51-ss1644 Revision r1632: Add include/lock0priv.h to noinst_HEADERS in Makefile.am. Revision r1636: Move lock_get_type() from lock/lock0lock.c to include/lock0priv.ic: * lock0lock.c: remove lock_get_type() and include include/lock0priv.ic * lock0priv.h: include lock0priv.ic and add lock_get_type() prototype * Makefile.am: add lock0priv.ic to noinst_HEADERS * lock0priv.ic: introduce this new file containing the body of lock_get_type() This move is necessary in order to use lock_get_type() from other lock/ source files (it's going to be used in lock/lock0iter.c). Approved by: Heikki Revision r1638: Introduce a lock queue iterator for easy (and opaque) traversing of lock queues. Supports table and record lock queues via the same interface. There is only "get previous" method because currently there is no need for "get next" - it would be unused. Feel free to add one if needed. Approved by: Heikki storage/innobase/buf/buf0buf.c: Apply snapshot innodb-51-ss1644 Revision r1624: Fix change missed as part of Bug 15815. Use a function to check if a block needs to be made younger. Revision r1581: Port extra Valgrind instrumentation (UNIV_DEBUG_VALGRIND) from branches/zip. storage/innobase/buf/buf0lru.c: Apply snapshot innodb-51-ss1644 Revision r1581: Port extra Valgrind instrumentation (UNIV_DEBUG_VALGRIND) from branches/zip. storage/innobase/fsp/fsp0fsp.c: Apply snapshot innodb-51-ss1644 Revision r1605: Fix Bug#29097 "fsp_get_available_space_in_free_extents() is capped at 4TB" by typecasting the variables before multiplying them, so that the result of the multiplication is of type "unsigned long long". I verified this fix by creating a sparse file of 6TB and forcing InnoDB to use it without overwriting it with zeroes (by commenting the code that overwrites :newraw files). New type ullint is introduced with the sole purpose of shortening "unsigned long long", please do not define it to something else than "unsigned long long". Approved by: Heikki storage/innobase/handler/ha_innodb.cc: Apply snapshot innodb-51-ss1644 Revision r1605: Fix Bug#29097 "fsp_get_available_space_in_free_extents() is capped at 4TB" by typecasting the variables before multiplying them, so that the result of the multiplication is of type "unsigned long long". I verified this fix by creating a sparse file of 6TB and forcing InnoDB to use it without overwriting it with zeroes (by commenting the code that overwrites :newraw files). New type ullint is introduced with the sole purpose of shortening "unsigned long long", please do not define it to something else than "unsigned long long". Approved by: Heikki Revision r1573: create_table_def(): Eliminate the inline function call to dict_table_is_comp() that was introduced in r1571. Inlining is disabled in ha_innodb.cc. Revision r1574: innodb_check_for_record_too_big_error(): Divide the return value of page_get_free_space_of_empty_noninline() by 2. Until r1571, that function did not return the same value as page_get_free_space_of_empty(). Revision r1571: Fix a severe bug that was introduced in r1422 when fixing Bug 21101. When creating an index containing a too long record, InnoDB would dereference a NULL pointer when trying to determine the maximum row length. innodb_check_for_record_too_big_error(): Replace the dict_table_t* parameter with a Boolean flag. There is not always a dict_table_t object when this function is called. page_get_free_space_of_empty_noninline(): Move the definition and declaration from row0mysql (!) to page0page. Make the signature identical with page_get_free_space_of_empty(). create_clustered_index_when_no_primary(): Add the parameter "comp". Remove unnecessary casts. storage/innobase/include/buf0buf.ic: Apply snapshot innodb-51-ss1644 Revision r1624: Fix change missed as part of Bug 15815. Use a function to check if a block needs to be made younger. storage/innobase/include/fsp0fsp.h: Apply snapshot innodb-51-ss1644 Revision r1605: Fix Bug#29097 "fsp_get_available_space_in_free_extents() is capped at 4TB" by typecasting the variables before multiplying them, so that the result of the multiplication is of type "unsigned long long". I verified this fix by creating a sparse file of 6TB and forcing InnoDB to use it without overwriting it with zeroes (by commenting the code that overwrites :newraw files). New type ullint is introduced with the sole purpose of shortening "unsigned long long", please do not define it to something else than "unsigned long long". Approved by: Heikki storage/innobase/include/lock0lock.h: Apply snapshot innodb-51-ss1644 Revision r1623: Fix typo in comment. Revision r1628: lock_has_to_wait() is needed in the INFORMATION_SCHEMA implementation in order to determine which lock is blocking which. Make it non-static and put its definition in include/lock0lock.h. Approved by: Heikki (via IM) storage/innobase/include/mem0mem.ic: Apply snapshot innodb-51-ss1644 Revision r1581: Port extra Valgrind instrumentation (UNIV_DEBUG_VALGRIND) from branches/zip. storage/innobase/include/page0page.h: Apply snapshot innodb-51-ss1644 Revision r1571: Fix a severe bug that was introduced in r1422 when fixing Bug 21101. When creating an index containing a too long record, InnoDB would dereference a NULL pointer when trying to determine the maximum row length. innodb_check_for_record_too_big_error(): Replace the dict_table_t* parameter with a Boolean flag. There is not always a dict_table_t object when this function is called. page_get_free_space_of_empty_noninline(): Move the definition and declaration from row0mysql (!) to page0page. Make the signature identical with page_get_free_space_of_empty(). create_clustered_index_when_no_primary(): Add the parameter "comp". Remove unnecessary casts. storage/innobase/include/row0mysql.h: Apply snapshot innodb-51-ss1644 Revision r1571: Fix a severe bug that was introduced in r1422 when fixing Bug 21101. When creating an index containing a too long record, InnoDB would dereference a NULL pointer when trying to determine the maximum row length. innodb_check_for_record_too_big_error(): Replace the dict_table_t* parameter with a Boolean flag. There is not always a dict_table_t object when this function is called. page_get_free_space_of_empty_noninline(): Move the definition and declaration from row0mysql (!) to page0page. Make the signature identical with page_get_free_space_of_empty(). create_clustered_index_when_no_primary(): Add the parameter "comp". Remove unnecessary casts. storage/innobase/include/univ.i: Apply snapshot innodb-51-ss1644 Revision r1605: Fix Bug#29097 "fsp_get_available_space_in_free_extents() is capped at 4TB" by typecasting the variables before multiplying them, so that the result of the multiplication is of type "unsigned long long". I verified this fix by creating a sparse file of 6TB and forcing InnoDB to use it without overwriting it with zeroes (by commenting the code that overwrites :newraw files). New type ullint is introduced with the sole purpose of shortening "unsigned long long", please do not define it to something else than "unsigned long long". Approved by: Heikki Revision r1581: Port extra Valgrind instrumentation (UNIV_DEBUG_VALGRIND) from branches/zip. storage/innobase/lock/lock0lock.c: Apply snapshot innodb-51-ss1644 Revision r1631: Move lock_rec_find_set_bit() and lock_rec_get_prev() from lock/lock0lock.c to include/lock0priv.h and make them non-static. They will be used in lock/lock0iter.c. Approved by: Heikki Revision r1636: Move lock_get_type() from lock/lock0lock.c to include/lock0priv.ic: * lock0lock.c: remove lock_get_type() and include include/lock0priv.ic * lock0priv.h: include lock0priv.ic and add lock_get_type() prototype * Makefile.am: add lock0priv.ic to noinst_HEADERS * lock0priv.ic: introduce this new file containing the body of lock_get_type() This move is necessary in order to use lock_get_type() from other lock/ source files (it's going to be used in lock/lock0iter.c). Approved by: Heikki Revision r1628: lock_has_to_wait() is needed in the INFORMATION_SCHEMA implementation in order to determine which lock is blocking which. Make it non-static and put its definition in include/lock0lock.h. Approved by: Heikki (via IM) Revision r1629: Add "const" qualifiers to lock_get_type() and lock_get_mode(). Approved by: Sunny Revision r1626: Move lock_*struct structures from lock/lock0lock.c to include/lock0priv.h. This is needed in order to add more code to lock/ that uses members of these structures (internal to the lock module) but in a separate file, rather than lock0lock.c. lock0lock.c is a way too big already. Approved by: Sunny storage/innobase/log/log0recv.c: Apply snapshot innodb-51-ss1644 Revision r1607: Bug#23710 At InnoDB startup consider the case where log scan went beyond checkpoint_lsn as a crash and initiate crash recovery code path. reviewed by: Heikki storage/innobase/mem/mem0mem.c: Apply snapshot innodb-51-ss1644 Revision r1581: Port extra Valgrind instrumentation (UNIV_DEBUG_VALGRIND) from branches/zip. storage/innobase/mem/mem0pool.c: Apply snapshot innodb-51-ss1644 Revision r1581: Port extra Valgrind instrumentation (UNIV_DEBUG_VALGRIND) from branches/zip. storage/innobase/os/os0file.c: Apply snapshot innodb-51-ss1644 Revision r1613: Fix Bug#29155 by enabling file locking on FreeBSD. It has been disabled because InnoDB has refused to start on FreeBSD & LinuxThreads, but now it starts just fine. Approved by: Heikki storage/innobase/page/page0page.c: Apply snapshot innodb-51-ss1644 Revision r1571: Fix a severe bug that was introduced in r1422 when fixing Bug 21101. When creating an index containing a too long record, InnoDB would dereference a NULL pointer when trying to determine the maximum row length. innodb_check_for_record_too_big_error(): Replace the dict_table_t* parameter with a Boolean flag. There is not always a dict_table_t object when this function is called. page_get_free_space_of_empty_noninline(): Move the definition and declaration from row0mysql (!) to page0page. Make the signature identical with page_get_free_space_of_empty(). create_clustered_index_when_no_primary(): Add the parameter "comp". Remove unnecessary casts. storage/innobase/rem/rem0rec.c: Apply snapshot innodb-51-ss1644 Revision r1581: Port extra Valgrind instrumentation (UNIV_DEBUG_VALGRIND) from branches/zip. storage/innobase/row/row0mysql.c: Apply snapshot innodb-51-ss1644 Revision r1571: Fix a severe bug that was introduced in r1422 when fixing Bug 21101. When creating an index containing a too long record, InnoDB would dereference a NULL pointer when trying to determine the maximum row length. innodb_check_for_record_too_big_error(): Replace the dict_table_t* parameter with a Boolean flag. There is not always a dict_table_t object when this function is called. page_get_free_space_of_empty_noninline(): Move the definition and declaration from row0mysql (!) to page0page. Make the signature identical with page_get_free_space_of_empty(). create_clustered_index_when_no_primary(): Add the parameter "comp". Remove unnecessary casts. storage/innobase/sync/sync0rw.c: Apply snapshot innodb-51-ss1644 Revision r1598: Add some comments. Approved by: Heikki (via IM) storage/innobase/sync/sync0sync.c: Apply snapshot innodb-51-ss1644 Revision r1598: Add some comments. Approved by: Heikki (via IM) storage/innobase/trx/trx0sys.c: Apply snapshot innodb-51-ss1644 Revision r1581: Port extra Valgrind instrumentation (UNIV_DEBUG_VALGRIND) from branches/zip. storage/innobase/trx/trx0trx.c: Apply snapshot innodb-51-ss1644 Revision r1595: trx_commit_for_mysql(): Avoid acquiring and releasing kernel_mutex when trx->sess or trx_dummy_sess is non-NULL. storage/innobase/ut/ut0mem.c: Apply snapshot innodb-51-ss1644 Revision r1581: Port extra Valgrind instrumentation (UNIV_DEBUG_VALGRIND) from branches/zip. --- storage/innobase/Makefile.am | 5 +- storage/innobase/buf/buf0buf.c | 12 +- storage/innobase/buf/buf0lru.c | 13 ++ storage/innobase/fsp/fsp0fsp.c | 5 +- storage/innobase/handler/ha_innodb.cc | 41 ++--- storage/innobase/include/buf0buf.ic | 2 +- storage/innobase/include/fsp0fsp.h | 2 +- storage/innobase/include/lock0lock.h | 14 +- storage/innobase/include/mem0mem.ic | 6 + storage/innobase/include/page0page.h | 9 + storage/innobase/include/row0mysql.h | 13 -- storage/innobase/include/univ.i | 16 ++ storage/innobase/lock/lock0lock.c | 64 +------ storage/innobase/log/log0recv.c | 247 +++++++++++++++----------- storage/innobase/mem/mem0mem.c | 1 + storage/innobase/mem/mem0pool.c | 6 + storage/innobase/os/os0file.c | 3 +- storage/innobase/page/page0page.c | 12 ++ storage/innobase/rem/rem0rec.c | 6 +- storage/innobase/row/row0mysql.c | 22 --- storage/innobase/sync/sync0rw.c | 18 ++ storage/innobase/sync/sync0sync.c | 1 + storage/innobase/trx/trx0sys.c | 11 +- storage/innobase/trx/trx0trx.c | 12 +- storage/innobase/ut/ut0mem.c | 2 + 25 files changed, 314 insertions(+), 229 deletions(-) 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 b7d0c4417c3..c2e230d2087 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -4533,17 +4533,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 +4656,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 +4780,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 +4798,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 +4808,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 +4943,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 +5870,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/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/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/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/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; From a34879ebd2c6c02f77a2df080c4696f0039ebffa Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 Jul 2007 13:18:12 -0400 Subject: [PATCH 10/27] Bug#24732 Executables do not include Vista manifests - Sign executables with MySQL AB security certificate. BitKeeper/etc/ignore: Bug#24732 Executables do not include Vista manifests - Ignore security catalog descriptions CMakeLists.txt: Bug#24732 Executables do not include Vista manifests - Search for additional tools necessary to embed, catalog and sign targets. win/README: Bug#24732 Executables do not include Vista manifests - Add internal only note to EMBED_MANIFESTS option. win/create_manifest.js: Bug#24732 Executables do not include Vista manifests - Added publicKeyToken attribute to manifest. win/mysql_manifest.cmake: Bug#24732 Executables do not include Vista manifests - Add additional commands to create security catalog and sign targets. - Add parameters to add appropiate hash attribute to manifest and create security content description of the security catalog. --- .bzrignore | 1 + CMakeLists.txt | 38 ++++++++++++++++++++++++++++++++------ win/README | 3 ++- win/create_manifest.js | 2 +- win/mysql_manifest.cmake | 7 ++++--- 5 files changed, 40 insertions(+), 11 deletions(-) diff --git a/.bzrignore b/.bzrignore index e7a7a1c27dc..759ca4a20bf 100644 --- a/.bzrignore +++ b/.bzrignore @@ -6,6 +6,7 @@ *.bin *.vcproj.cmake cmake_install.cmake +*.cdf *.core *.d *.da diff --git a/CMakeLists.txt b/CMakeLists.txt index cdd0cde8b8d..3703548ebc3 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,21 +139,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/win/README b/win/README index 118d619226a..d13f37965c1 100644 --- a/win/README +++ b/win/README @@ -51,7 +51,8 @@ The options right now are DISABLE_GRANT_OPTIONS Disables the use of --init-file and --skip-grant-tables options of mysqld.exe 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 Date: Wed, 25 Jul 2007 13:33:39 -0400 Subject: [PATCH 11/27] Bug#24732 Executables do not include Vista manifests - Required manual merge. CMakeLists.txt: Bug#24732 Executables do not include Vista manifests - Search for additional tools necessary to embed, catalog and sign targets. win/README: Bug#24732 Executables do not include Vista manifests - Add internal only note to EMBED_MANIFESTS option. --- CMakeLists.txt | 38 ++++++++++++++++++++++++++++++++------ win/README | 4 +++- 2 files changed, 35 insertions(+), 7 deletions(-) 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/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: From 31dffd10c0ebbc791ea53bf959718cd0d9d2658e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 Jul 2007 13:29:57 -0600 Subject: [PATCH 12/27] Apply snapshot innodb-51-ss1644: Part #2. I forgot to check in some new files: lock0priv.h lock0priv.ic lock0iter.c lock0iter.h storage/innobase/include/lock0iter.h: BitKeeper file /home/tsmith/m/bk/inno/jul24/51/storage/innobase/include/lock0iter.h storage/innobase/include/lock0priv.h: BitKeeper file /home/tsmith/m/bk/inno/jul24/51/storage/innobase/include/lock0priv.h storage/innobase/include/lock0priv.ic: BitKeeper file /home/tsmith/m/bk/inno/jul24/51/storage/innobase/include/lock0priv.ic storage/innobase/lock/lock0iter.c: BitKeeper file /home/tsmith/m/bk/inno/jul24/51/storage/innobase/lock/lock0iter.c --- storage/innobase/include/lock0iter.h | 52 +++++++++++++ storage/innobase/include/lock0priv.h | 101 ++++++++++++++++++++++++++ storage/innobase/include/lock0priv.ic | 32 ++++++++ storage/innobase/lock/lock0iter.c | 91 +++++++++++++++++++++++ 4 files changed, 276 insertions(+) create mode 100644 storage/innobase/include/lock0iter.h create mode 100644 storage/innobase/include/lock0priv.h create mode 100644 storage/innobase/include/lock0priv.ic create mode 100644 storage/innobase/lock/lock0iter.c 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/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/lock/lock0iter.c b/storage/innobase/lock/lock0iter.c new file mode 100644 index 00000000000..cad227e3f8e --- /dev/null +++ b/storage/innobase/lock/lock0iter.c @@ -0,0 +1,91 @@ +/****************************************************** +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 */ +{ + ulint bit_no; + 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); +} From 43bc432e8fce15d8a52f569727b1c2c3b7745485 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 Jul 2007 14:06:18 -0600 Subject: [PATCH 13/27] lock0iter.c: remove unused variable "bit_no" storage/innobase/lock/lock0iter.c: remove unused variable "bit_no" --- storage/innobase/lock/lock0iter.c | 1 - 1 file changed, 1 deletion(-) diff --git a/storage/innobase/lock/lock0iter.c b/storage/innobase/lock/lock0iter.c index cad227e3f8e..0afa7019c86 100644 --- a/storage/innobase/lock/lock0iter.c +++ b/storage/innobase/lock/lock0iter.c @@ -66,7 +66,6 @@ lock_queue_iterator_get_prev( /* out: previous lock or NULL */ lock_queue_iterator_t* iter) /* in/out: iterator */ { - ulint bit_no; lock_t* prev_lock; switch (lock_get_type(iter->current_lock)) { From 37b6be0806a6350f63c5d60965f24923506d72ef Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 Jul 2007 22:29:53 +0200 Subject: [PATCH 14/27] tmp_table_size is not about user-created temporary tables, only internal ones (like those of GROUP BY): fixing the --help text. sql/mysqld.cc: tmp_table_size is not about user-created temporary tables, only internal ones (like those of GROUP BY) --- sql/mysqld.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 61980fa1887..9eb3d157dcf 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -6181,7 +6181,8 @@ The minimum value for this variable is 4096.", (gptr*) &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.", (gptr*) &global_system_variables.tmp_table_size, (gptr*) &max_system_variables.tmp_table_size, 0, GET_ULL, REQUIRED_ARG, 32*1024*1024L, 1024, MAX_MEM_TABLE_SIZE, 0, 1, 0}, From 365bbf9814c98292b0ae0a69ad9c448971c53b99 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 Jul 2007 13:07:01 +0500 Subject: [PATCH 15/27] Fix for bug #29980: 5.1.20 ate my table Problem: trying to repair an old (e.g. with "old" varstring fields) corrupted table with use_frm option we don't actually repair the table, just altering it which may couse data loss. Fix: if use_frm repair option is set, do repair instead of altering even if the table needs upgrade. sql/sql_table.cc: Fix for bug #29980: 5.1.20 ate my table --- sql/sql_table.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 70bd549612c..fe62ac858ac 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -4132,7 +4132,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) == From 9eaf0ae73edbb8ed5587c33d2513de69fcdefc45 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 Jul 2007 23:39:53 -0400 Subject: [PATCH 16/27] Bug #25061 Build failure on HP/UX similar to BUG#20507 Added libCsup as a mysql library dependency on hpux11. This means any projects statically linking to our libraries using the HPUX11 compiler will need to add the -lCSup option to their build link options. If they use the mysql_config tool this will happen automatically. Projects that dynamically link to libmysqlclient will continue to work without any modifications. Library libCsup is a C++ runtime library needed for yassl support when built with the hpux11 C/C++ compiler. The first attempts to fix this bug were to remove the yassl dependencies on libCsup. We tried removing all pure virtual functions and other hacks, but the dependency remained. The only other options left involve extensive restructuring of the yassl library. config/ac-macros/yassl.m4: Added libCsup as a mysql library dependency on hpux11 when building yassl. --- config/ac-macros/yassl.m4 | 9 +++++++ mysql-test/r/bdb_notembedded.result | 35 -------------------------- mysql-test/t/bdb_notembedded.test | 38 ----------------------------- 3 files changed, 9 insertions(+), 73 deletions(-) delete mode 100644 mysql-test/r/bdb_notembedded.result delete mode 100644 mysql-test/t/bdb_notembedded.test diff --git a/config/ac-macros/yassl.m4 b/config/ac-macros/yassl.m4 index 967dcbf764a..26c2315b532 100644 --- a/config/ac-macros/yassl.m4 +++ b/config/ac-macros/yassl.m4 @@ -31,6 +31,15 @@ AC_DEFUN([MYSQL_CHECK_YASSL], [ AC_MSG_NOTICE([disabling inlining for yassl/taocrypt/src/]) ;; esac + case $SYSTEM_TYPE in + *hpux11*) + if test "$ac_cv_prog_gcc" = "no" + then + # yass compiled with the HPUX 11.0 compiler requires a special lib + NON_THREADED_LIBS="$NON_THREADED_LIBS -lCsup" + fi + ;; + esac AC_SUBST([yassl_taocrypt_extra_cxxflags]) # Link extra/yassl/include/openssl subdir to include/ yassl_h_ln_cmd="\$(LN) -s \$(top_srcdir)/extra/yassl/include/openssl openssl" diff --git a/mysql-test/r/bdb_notembedded.result b/mysql-test/r/bdb_notembedded.result deleted file mode 100644 index 14cb5fad915..00000000000 --- a/mysql-test/r/bdb_notembedded.result +++ /dev/null @@ -1,35 +0,0 @@ -set autocommit=1; -reset master; -create table bug16206 (a int); -insert into bug16206 values(1); -start transaction; -insert into bug16206 values(2); -commit; -show binlog events; -Log_name Pos Event_type Server_id End_log_pos Info -f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4 -f n Query 1 n use `test`; create table bug16206 (a int) -f n Query 1 n use `test`; insert into bug16206 values(1) -f n Query 1 n use `test`; insert into bug16206 values(2) -drop table bug16206; -reset master; -create table bug16206 (a int) engine= bdb; -insert into bug16206 values(0); -insert into bug16206 values(1); -start transaction; -insert into bug16206 values(2); -commit; -insert into bug16206 values(3); -show binlog events; -Log_name Pos Event_type Server_id End_log_pos Info -f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4 -f n Query 1 n use `test`; create table bug16206 (a int) engine= bdb -f n Query 1 n use `test`; insert into bug16206 values(0) -f n Query 1 n use `test`; insert into bug16206 values(1) -f n Query 1 n use `test`; BEGIN -f n Query 1 n use `test`; insert into bug16206 values(2) -f n Query 1 n use `test`; COMMIT -f n Query 1 n use `test`; insert into bug16206 values(3) -drop table bug16206; -set autocommit=0; -End of 5.0 tests diff --git a/mysql-test/t/bdb_notembedded.test b/mysql-test/t/bdb_notembedded.test deleted file mode 100644 index 24e64ebbfb2..00000000000 --- a/mysql-test/t/bdb_notembedded.test +++ /dev/null @@ -1,38 +0,0 @@ --- source include/not_embedded.inc --- source include/have_bdb.inc - -# -# Bug #16206: Superfluous COMMIT event in binlog when updating BDB in autocommit mode -# -set autocommit=1; - -let $VERSION=`select version()`; - -reset master; -create table bug16206 (a int); -insert into bug16206 values(1); -start transaction; -insert into bug16206 values(2); -commit; ---replace_result $VERSION VERSION ---replace_column 1 f 2 n 5 n -show binlog events; -drop table bug16206; - -reset master; -create table bug16206 (a int) engine= bdb; -insert into bug16206 values(0); -insert into bug16206 values(1); -start transaction; -insert into bug16206 values(2); -commit; -insert into bug16206 values(3); ---replace_result $VERSION VERSION ---replace_column 1 f 2 n 5 n -show binlog events; -drop table bug16206; - -set autocommit=0; - - ---echo End of 5.0 tests From 32cc0694bf6d5c8673f4c270793dedb5a8a8ab1e Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 27 Jul 2007 11:54:54 -0400 Subject: [PATCH 17/27] Bug#30103 CMake build solution does not remove auto-generated resources - Add CMake rule to remove files. --- sql/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 0cbeb97184f..b0553f622f8 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -138,6 +138,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) From 2302a30254d0aa3289d57fcc3b2c7f1fd196e2b3 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 27 Jul 2007 17:41:34 -0400 Subject: [PATCH 18/27] Bug#30103 CMake build solution does not remove auto-generated resources - Add CMake rule to remove files. - Manual merge. sql/CMakeLists.txt: Bug#30103 CMake build solution does not remove auto-generated resources - Add CMake rule to remove files. --- sql/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) 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) From 17f98499e86055efaf643d815f8adce08c3800af Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 27 Jul 2007 17:20:43 -0600 Subject: [PATCH 19/27] Bug #29992: syslog error logging does not flush Don't use syslog by default; user will have to request it explicitly with the --syslog option. Use "sed -u" to get unbuffered output from sed, if it's supported. Otherwise, don't use sed at all - don't strip the timestamp from mysqld messages. Also, add new --syslog-tag=FOO option, which adds "-FOO" to the tag used when logging messages to syslog (i.e., mysqld-FOO or mysqld_safe-FOO) Also, explicitly mention where log messages are going, so user can more easily find them. Also, check if 'logger' is in the PATH, and log to the error log file if it can't be found. --- scripts/mysqld_safe.sh | 116 ++++++++++++++++++++++++++++++++--------- 1 file changed, 91 insertions(+), 25 deletions(-) diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 597bf38a518..2a592a6fbf5 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." + want_syslog=0 + 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="" From b635b2861f355844dfd5bac4d9400e0fbac9804b Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 30 Jul 2007 13:35:36 -0600 Subject: [PATCH 20/27] mysqld_safe.sh: Post-review fix, if 'logger' can't be found, and --syslog is requested, exit with error message instead of fall back to logging to error file. scripts/mysqld_safe.sh: Post-review fix, if 'logger' can't be found, and --syslog is requested, exit with error message instead of fall back to logging to error file. --- scripts/mysqld_safe.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 2a592a6fbf5..e6f7ff7b3cb 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -302,8 +302,8 @@ then my_which logger > /dev/null 2>&1 if [ $? -ne 0 ] then - log_error "--syslog requested, but no 'logger' program found." - want_syslog=0 + 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 From d0e8d1ab5401a2cc7ce8f75e15340b67fed6cfbf Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 31 Jul 2007 16:36:29 -0400 Subject: [PATCH 21/27] Bug #29419 "Specifying a join_buffer > 4GB on 64 bit machines not possible." Use size_t instead of uint when calculating join buffer size, because uint can be overflown on 64-bit platforms and join_buffer_size > 4 GB. The test case for this bug is a part of the test suite for bug #5731. sql/sql_select.cc: Use size_t instead of uint when calculating join buffer size, because uint can be overflown on 64-bit platforms and join_buffer_size > 4G. --- sql/sql_select.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index be6d1f74852..4c48c70dcca 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -13307,7 +13307,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; @@ -13423,7 +13424,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; /* @@ -13469,7 +13470,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; } From f5b95d0be141416c95a657d42ef39937d01c4c8e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Aug 2007 04:56:58 +0200 Subject: [PATCH 22/27] Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 mysqld hasn't been built on AIX with ndb-everything in quite a while. this allowed a variety of changes to be added that broke the AIX build for both the GNU and IBM compilers (but the IBM suite in particular). Changeset lets build to complete on AIX 5.2 for users of the GNU and the IBM suite both. Tudo bem? config/ac-macros/large_file.m4: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (2) we no longer declare anything large-file on AIX. the GNU C++ compiler declares _LARGE_FILE_API all of its own, and either way we're now pulling in when on AIX, which defines _LARGE_FILE_API (if not already defined). configure.in: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (1) build NDB binaries as static on AIX. because that actually *works*. when building dynamic, with the IBM compiler (xlC_r), and the build breaks on AIX due to missing symbols (__vec__delete2 et al.), try adding -lhC to the Makefile. include/mysql.h: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (2) we're now pulling in when on AIX, which defines _LARGE_FILE_API (if not already defined). ndb/src/common/util/File.cpp: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (3) do not de-scope the standards, for they may be funky macros ndb/src/mgmclient/Makefile.am: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (4) make IBM C++ compiler happy on AIX ndb/src/mgmsrv/Makefile.am: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (5) GNU compiler has no sense of humour about this ndb/test/ndbapi/benchronja.cpp: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (6) MAXTHREADS collides with a #define from on AIX (IBM compiler). Call it NDB_MAXTHREADS instead. Also explicitly #undef it here lest someone use it by habit and get really funny results. (K&R says we may #undef non-existent symbols.) ndb/test/ndbapi/flexAsynch.cpp: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (6) MAXTHREADS collides with a #define from on AIX (IBM compiler). Call it NDB_MAXTHREADS instead. Also explicitly #undef it here lest someone use it by habit and get really funny results. (K&R says we may #undef non-existent symbols.) ndb/test/ndbapi/flexHammer.cpp: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (6) MAXTHREADS collides with a #define from on AIX (IBM compiler). Call it NDB_MAXTHREADS instead. Also explicitly #undef it here lest someone use it by habit and get really funny results. (K&R says we may #undef non-existent symbols.) ndb/test/ndbapi/flexScan.cpp: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (6) MAXTHREADS collides with a #define from on AIX (IBM compiler). Call it NDB_MAXTHREADS instead. Also explicitly #undef it here lest someone use it by habit and get really funny results. (K&R says we may #undef non-existent symbols.) ndb/test/ndbapi/flexTT.cpp: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (6) MAXTHREADS collides with a #define from on AIX (IBM compiler). Call it NDB_MAXTHREADS instead. Also explicitly #undef it here lest someone use it by habit and get really funny results. (K&R says we may #undef non-existent symbols.) ndb/test/ndbapi/flexTimedAsynch.cpp: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (6) MAXTHREADS collides with a #define from on AIX (IBM compiler). Call it NDB_MAXTHREADS instead. Also explicitly #undef it here lest someone use it by habit and get really funny results. (K&R says we may #undef non-existent symbols.) ndb/test/ndbapi/initronja.cpp: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (6) MAXTHREADS collides with a #define from on AIX (IBM compiler). Call it NDB_MAXTHREADS instead. Also explicitly #undef it here lest someone use it by habit and get really funny results. (K&R says we may #undef non-existent symbols.) ndb/test/ndbapi/testOperations.cpp: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (7) IBM C compiler on AIX is not happy with the re-def. ndb/test/ndbapi/testScanFilter.cpp: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (8) The IBM C++ compiler on AIX doesn't like initializing from pow(). This works, but breaks a VAL (bool res_cal[TUPLE_NUM] ...) later on. ndb/test/odbc/SQL99_test/SQL99_test.cpp: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (6) MAXTHREADS collides with a #define from on AIX (IBM compiler). Call it NDB_MAXTHREADS instead. Also explicitly #undef it here lest someone use it by habit and get really funny results. (K&R says we may #undef non-existent symbols.) --- config/ac-macros/large_file.m4 | 11 +++-------- configure.in | 6 ++++++ include/mysql.h | 4 ++++ ndb/src/common/util/File.cpp | 4 ++-- ndb/src/mgmclient/Makefile.am | 1 + ndb/src/mgmsrv/Makefile.am | 2 +- ndb/test/ndbapi/benchronja.cpp | 19 +++++++++++++------ ndb/test/ndbapi/flexAsynch.cpp | 19 +++++++++++++------ ndb/test/ndbapi/flexHammer.cpp | 15 +++++++++++---- ndb/test/ndbapi/flexScan.cpp | 11 +++++++++-- ndb/test/ndbapi/flexTT.cpp | 19 +++++++++++++------ ndb/test/ndbapi/flexTimedAsynch.cpp | 23 +++++++++++++++-------- ndb/test/ndbapi/initronja.cpp | 9 ++++++++- ndb/test/ndbapi/testOperations.cpp | 5 ----- ndb/test/ndbapi/testScanFilter.cpp | 12 ++++++++++-- ndb/test/odbc/SQL99_test/SQL99_test.cpp | 13 ++++++++++--- 16 files changed, 119 insertions(+), 54 deletions(-) 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/configure.in b/configure.in index 1da39ac1aa3..a928bab236f 100644 --- a/configure.in +++ b/configure.in @@ -2890,6 +2890,12 @@ then ndb_opt_subdirs="$ndb_opt_subdirs docs" 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 AC_SUBST([ndb_bin_am_ldflags]) AC_SUBST([ndb_opt_subdirs]) diff --git a/include/mysql.h b/include/mysql.h index a153d0b51db..b3e0dc45496 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/ndb/src/common/util/File.cpp b/ndb/src/common/util/File.cpp index a75fa5ae463..fe0fdfd1c91 100644 --- a/ndb/src/common/util/File.cpp +++ b/ndb/src/common/util/File.cpp @@ -50,7 +50,7 @@ File_class::size(FILE* f) MY_STAT s; // Note that my_fstat behaves *differently* than my_stat. ARGGGHH! - if(my_fstat(::fileno(f), &s, MYF(0))) + if(my_fstat(fileno(f), &s, MYF(0))) return 0; return s.st_size; @@ -196,7 +196,7 @@ File_class::flush() const { #if defined NDB_OSE || defined NDB_SOFTOSE ::fflush(m_file); - return ::fsync(::fileno(m_file)); + return ::fsync(fileno(m_file)); #else return ::fflush(m_file);; #endif diff --git a/ndb/src/mgmclient/Makefile.am b/ndb/src/mgmclient/Makefile.am index 99540160341..e1287532a07 100644 --- a/ndb/src/mgmclient/Makefile.am +++ b/ndb/src/mgmclient/Makefile.am @@ -36,6 +36,7 @@ INCLUDES += -I$(top_srcdir)/ndb/include/mgmapi \ LDADD_LOC = $(noinst_LTLIBRARIES) \ ../common/portlib/libportlib.la \ @readline_link@ \ + $(top_builddir)/ndb/src/libndbclient.la \ $(top_builddir)/dbug/libdbug.a \ $(top_builddir)/mysys/libmysys.a \ $(top_builddir)/strings/libmystrings.a \ diff --git a/ndb/src/mgmsrv/Makefile.am b/ndb/src/mgmsrv/Makefile.am index 88622c08e53..3d1845957e6 100644 --- a/ndb/src/mgmsrv/Makefile.am +++ b/ndb/src/mgmsrv/Makefile.am @@ -38,7 +38,7 @@ INCLUDES_LOC = -I$(top_srcdir)/ndb/src/ndbapi \ -I$(top_srcdir)/ndb/src/common/mgmcommon \ -I$(top_srcdir)/ndb/src/mgmclient -LDADD_LOC = $(top_builddir)/ndb/src/mgmclient/CommandInterpreter.o \ +LDADD_LOC = $(top_builddir)/ndb/src/mgmclient/CommandInterpreter.lo \ $(top_builddir)/ndb/src/libndbclient.la \ $(top_builddir)/dbug/libdbug.a \ $(top_builddir)/mysys/libmysys.a \ diff --git a/ndb/test/ndbapi/benchronja.cpp b/ndb/test/ndbapi/benchronja.cpp index 4973e6e2487..73ee324a888 100644 --- a/ndb/test/ndbapi/benchronja.cpp +++ b/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/ndb/test/ndbapi/flexAsynch.cpp b/ndb/test/ndbapi/flexAsynch.cpp index 20a157fc2f3..1f52315482f 100644 --- a/ndb/test/ndbapi/flexAsynch.cpp +++ b/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/ndb/test/ndbapi/flexHammer.cpp b/ndb/test/ndbapi/flexHammer.cpp index 9abac905f5a..3847bc38b35 100644 --- a/ndb/test/ndbapi/flexHammer.cpp +++ b/ndb/test/ndbapi/flexHammer.cpp @@ -69,7 +69,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 @@ -122,8 +129,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; @@ -643,7 +650,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/ndb/test/ndbapi/flexScan.cpp b/ndb/test/ndbapi/flexScan.cpp index cbea90f44f4..4e3def7fb91 100644 --- a/ndb/test/ndbapi/flexScan.cpp +++ b/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 { @@ -860,7 +867,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/ndb/test/ndbapi/flexTT.cpp b/ndb/test/ndbapi/flexTT.cpp index 71d5b6c096e..4373102f77e 100644 --- a/ndb/test/ndbapi/flexTT.cpp +++ b/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/ndb/test/ndbapi/flexTimedAsynch.cpp b/ndb/test/ndbapi/flexTimedAsynch.cpp index cc44ab8b237..b6301e59df2 100644 --- a/ndb/test/ndbapi/flexTimedAsynch.cpp +++ b/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/ndb/test/ndbapi/initronja.cpp b/ndb/test/ndbapi/initronja.cpp index 63bbc374c62..f48b1c86da3 100644 --- a/ndb/test/ndbapi/initronja.cpp +++ b/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/ndb/test/ndbapi/testOperations.cpp b/ndb/test/ndbapi/testOperations.cpp index 1f610cade4a..21151ab5c7f 100644 --- a/ndb/test/ndbapi/testOperations.cpp +++ b/ndb/test/ndbapi/testOperations.cpp @@ -97,11 +97,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/ndb/test/ndbapi/testScanFilter.cpp b/ndb/test/ndbapi/testScanFilter.cpp index 5098d83745b..81aa6b82fa0 100644 --- a/ndb/test/ndbapi/testScanFilter.cpp +++ b/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/ndb/test/odbc/SQL99_test/SQL99_test.cpp b/ndb/test/odbc/SQL99_test/SQL99_test.cpp index 039a77f4d53..fb77220773d 100644 --- a/ndb/test/odbc/SQL99_test/SQL99_test.cpp +++ b/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) From 36bb8de987bef0577fcb63dbfd5b66a8d6b522fe Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Aug 2007 09:24:01 +0200 Subject: [PATCH 23/27] Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 5.1 specific fixes so cluster will build on AIX (with IBM compiler) config/ac-macros/ha_ndbcluster.m4: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (1) build NDB binaries as static on AIX. because that actually *works*. when building dynamic, with the IBM compiler (xlC_r), and the build breaks on AIX due to missing symbols (__vec__delete2 et al.), try adding -lhC to the Makefile. storage/ndb/src/mgmclient/Makefile.am: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (2) fix path storage/ndb/src/ndbapi/NdbScanOperation.cpp: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (3) __align is a keyword in xlC_r storage/ndb/test/ndbapi/testIndexStat.cpp: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (4) gptr is now uchar* template can't be static on xlC_r? storage/ndb/test/ndbapi/test_event_merge.cpp: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (4) gptr is now uchar* storage/ndb/test/run-test/main.cpp: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (4) gptr is now uchar* storage/ndb/test/src/NDBT_Test.cpp: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (4) gptr is now uchar* --- config/ac-macros/ha_ndbcluster.m4 | 7 ++++ storage/ndb/src/mgmclient/Makefile.am | 2 +- storage/ndb/src/ndbapi/NdbScanOperation.cpp | 2 +- storage/ndb/test/ndbapi/testIndexStat.cpp | 30 ++++++++-------- storage/ndb/test/ndbapi/test_event_merge.cpp | 34 +++++++++--------- storage/ndb/test/run-test/main.cpp | 36 ++++++++++---------- storage/ndb/test/src/NDBT_Test.cpp | 20 +++++------ 7 files changed, 69 insertions(+), 62 deletions(-) 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/storage/ndb/src/mgmclient/Makefile.am b/storage/ndb/src/mgmclient/Makefile.am index 96cbef61700..41f659cf68d 100644 --- a/storage/ndb/src/mgmclient/Makefile.am +++ b/storage/ndb/src/mgmclient/Makefile.am @@ -36,7 +36,7 @@ INCLUDES += -I$(top_srcdir)/storage/ndb/include/mgmapi \ LDADD_LOC = $(noinst_LTLIBRARIES) \ ../common/portlib/libportlib.la \ @readline_link@ \ - $(top_builddir)/ndb/src/libndbclient.la \ + $(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/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/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/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/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} }; From c517fea540967e3922128a33a81bbdf7318285e1 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Aug 2007 11:58:25 +0200 Subject: [PATCH 24/27] Option 6 tries to grant global privileges at the database level which does not work. Removing these attempted privileges makes this identical to option 5 so remove it completely. The spirit of the program appears to be aimed at database privileges, so do not add another option for granting global privileges as it may be unexpected. Fixes bug#14618 (same as previous patch, this time applied to -maint tree). scripts/mysql_setpermission.sh: Option 6 tries to apply global privileges at the database level which does not work - remove it. --- scripts/mysql_setpermission.sh | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) 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; } From f87acb594a15b415b58a3053e76bfd1b27a6d594 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Aug 2007 15:27:03 +0500 Subject: [PATCH 25/27] Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect restores from mysqlbinlog out Problem: using "mysqlbinlog | mysql" for recoveries the connection_id() result may differ from what was used when issuing the statement. Fix: if there is a connection_id() in a statement, write to binlog SET pseudo_thread_id= XXX; before it and use the value later on. mysql-test/r/mysqlbinlog.result: Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect restores from mysqlbinlog out - test result. mysql-test/t/mysqlbinlog.test: Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect restores from mysqlbinlog out - test case. sql/item_create.cc: Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect restores from mysqlbinlog out - set thread_specific_used flag for the connection_id() function. sql/item_func.cc: Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect restores from mysqlbinlog out - always return thd->variables.pseudo_thread_id as a connection_id() result, as it contains a proper value for both master and slave. sql/log_event.cc: Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect restores from mysqlbinlog out - set LOG_EVENT_THREAD_SPECIFIC_F event flag if thread_specific_used is set. sql/sql_class.cc: Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect restores from mysqlbinlog out - thd->thread_specific_used introduced, which is set if thread specific value(s) used in a statement. sql/sql_class.h: Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect restores from mysqlbinlog out - thd->thread_specific_used introduced, which is set if thread specific value(s) used in a statement. --- mysql-test/r/mysqlbinlog.result | 7 +++++++ mysql-test/t/mysqlbinlog.test | 21 +++++++++++++++++++++ sql/item_create.cc | 4 +++- sql/item_func.cc | 11 +---------- sql/log_event.cc | 11 +++++++---- sql/sql_class.cc | 2 +- sql/sql_class.h | 3 +++ 7 files changed, 43 insertions(+), 16 deletions(-) diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index 1ba198dfd75..d16a4c39a11 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -318,4 +318,11 @@ 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 diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index bd90dcfb930..451eef17108 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -216,4 +216,25 @@ flush logs; DROP TABLE t1; --exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000011 | 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.000013 > $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 diff --git a/sql/item_create.cc b/sql/item_create.cc index 50db1c37371..3713fc9e380 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -70,7 +70,9 @@ Item *create_func_ceiling(Item* a) Item *create_func_connection_id(void) { - current_thd->lex->safe_to_cache_query= 0; + THD *thd= current_thd; + thd->lex->safe_to_cache_query= 0; + thd->thread_specific_used= TRUE; return new Item_func_connection_id(); } diff --git a/sql/item_func.cc b/sql/item_func.cc index b256ce4624a..cada6019ffd 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 c37df31ae00..1ef765f607f 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1303,8 +1303,9 @@ 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->tmp_table_used || 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), @@ -2689,8 +2690,10 @@ 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->tmp_table_used || 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/sql_class.cc b/sql/sql_class.cc index ee4e1ea149c..c4fc82e55ca 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -197,7 +197,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= tmp_table_used= thread_specific_used= 0; next_insert_id=last_insert_id=0; hash_clear(&handler_tables_hash); tmp_table=0; diff --git a/sql/sql_class.h b/sql/sql_class.h index 445a3ce437c..49f3e6354b9 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1457,6 +1457,9 @@ public: 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 */ From be4cfe504e081b79fbfd1870e1bca94795d20633 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Aug 2007 19:20:25 +0500 Subject: [PATCH 26/27] After-merge fixup. - THD::tmp_table_used removed, THD::thread_specific_used used instead. --- sql/item_create.cc | 1 + sql/log_event.cc | 8 +++----- sql/sql_base.cc | 2 +- sql/sql_class.cc | 2 +- sql/sql_class.h | 1 - sql/sql_parse.cc | 2 +- sql/sql_table.cc | 4 ++-- 7 files changed, 9 insertions(+), 11 deletions(-) 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/log_event.cc b/sql/log_event.cc index 7fbf8f8bd00..62b90986cfd 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1479,9 +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 || thd_arg->thread_specific_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), @@ -2914,8 +2913,7 @@ Load_log_event::Load_log_event(THD *thd_arg, sql_exchange *ex, enum enum_duplicates handle_dup, bool ignore, bool using_trans) :Log_event(thd_arg, - (thd_arg->tmp_table_used || thd_arg->thread_specific_used) ? - LOG_EVENT_THREAD_SPECIFIC_F : 0, + 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), diff --git a/sql/sql_base.cc b/sql/sql_base.cc index f1319010270..138f8acecb6 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2277,7 +2277,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 514de445b56..e658f2f9a60 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= thread_specific_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 38782c57a40..3a818490c76 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1405,7 +1405,6 @@ 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; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 93887db88e1..244df65a2ee 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -5150,7 +5150,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_table.cc b/sql/sql_table.cc index 33448ea3c5f..219e536955a 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()) { @@ -3408,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; } /* From 971050de2635c5b63b33e658ad1a96a910abf856 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Aug 2007 16:45:55 -0600 Subject: [PATCH 27/27] Remove some redundant or unused code from InnoDB (feedback from Marko after applying latest snapshot). storage/innobase/handler/ha_innodb.cc: Remove redundant assignment to thd_to_trx(thd); trx is declared as a reference to thd_to_trx(thd) at the top of the function, so this assignment isn't useful. storage/innobase/include/trx0trx.h: Remove two unused members from struct trx_struct. allow_duplicates and replace_duplicates are not used; a single duplicates member is used instead to represent both flags. --- storage/innobase/handler/ha_innodb.cc | 2 -- storage/innobase/include/trx0trx.h | 8 -------- 2 files changed, 10 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index ca566f1300e..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); 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