From 6d55b423d8ae570e958d4926342af9e9ba34a117 Mon Sep 17 00:00:00 2001 From: "SergeyV@selena." <> Date: Wed, 28 Dec 2005 19:40:37 +0300 Subject: [PATCH 1/8] Fixes bug #15634. Eliminates compiler warning 'all return paths are recursive in Field_date::store function'. Though the Field_date::store function almost unused when protocol_version=10 additional check was added into it to store 4byte dates properly. Effective test routine is not available so far due to protocol_version is not a dynamic property and can not be modified with mysql-test script. --- sql/field.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sql/field.cc b/sql/field.cc index 8f9dc832520..f60abacfbac 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -5242,7 +5242,7 @@ int Field_date::store(double nr) else tmp= (longlong) rint(nr); - return Field_date::store(tmp); + return Field_date::store(tmp, TRUE); } @@ -5264,6 +5264,9 @@ int Field_date::store(longlong nr, bool unsigned_val) error= 2; } + if (nr >= 19000000000000.0 && nr <= 99991231235959.0) + nr=floor(nr/1000000.0); // Timestamp to date + if (error) set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, error == 2 ? ER_WARN_DATA_OUT_OF_RANGE : From 15ec4431bcd3bcee7b4f4f0347ef098e7206c18e Mon Sep 17 00:00:00 2001 From: "patg@govinda.patg.net" <> Date: Fri, 27 Jan 2006 15:43:44 -0800 Subject: [PATCH 2/8] BUG# 14768 Added fixes to make last_insert_id() to work. --- mysql-test/r/federated.result | 42 +++++++++++++++++++++++++++++++++++ mysql-test/t/federated.test | 30 +++++++++++++++++++++++++ sql/ha_federated.cc | 30 +++++++++++++++++++++++++ sql/ha_federated.h | 1 + 4 files changed, 103 insertions(+) diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result index f9b13beb6e5..4391889fec9 100644 --- a/mysql-test/r/federated.result +++ b/mysql-test/r/federated.result @@ -1517,6 +1517,48 @@ bitty drop table federated.t1; drop table federated.t1; DROP TABLE IF EXISTS federated.t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL auto_increment, +PRIMARY KEY (`id`)); +DROP TABLE IF EXISTS federated.t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL auto_increment, +PRIMARY KEY (`id`) +) +ENGINE="FEDERATED" DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:9308/federated/t1'; +INSERT INTO federated.t1 VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +1 +INSERT INTO federated.t1 VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +2 +INSERT INTO federated.t1 VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +3 +INSERT INTO federated.t1 VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +4 +INSERT INTO federated.t1 VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +5 +SELECT * FROM federated.t1; +id +1 +2 +3 +4 +5 +DROP TABLE IF EXISTS federated.t1; DROP DATABASE IF EXISTS federated; DROP TABLE IF EXISTS federated.t1; DROP DATABASE IF EXISTS federated; diff --git a/mysql-test/t/federated.test b/mysql-test/t/federated.test index b6b3b90c083..e550c5d3ac0 100644 --- a/mysql-test/t/federated.test +++ b/mysql-test/t/federated.test @@ -1224,4 +1224,34 @@ drop table federated.t1; connection slave; drop table federated.t1; +# +# BUG# 14768 test auto_increment last_insert_id() +# +connection slave; +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( + `id` int(20) NOT NULL auto_increment, + PRIMARY KEY (`id`)); + +connection master; +DROP TABLE IF EXISTS federated.t1; +eval CREATE TABLE federated.t1 ( + `id` int(20) NOT NULL auto_increment, + PRIMARY KEY (`id`) + ) + ENGINE="FEDERATED" DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + +INSERT INTO federated.t1 VALUES (); +SELECT LAST_INSERT_ID(); +INSERT INTO federated.t1 VALUES (); +SELECT LAST_INSERT_ID(); +INSERT INTO federated.t1 VALUES (); +SELECT LAST_INSERT_ID(); +INSERT INTO federated.t1 VALUES (); +SELECT LAST_INSERT_ID(); +INSERT INTO federated.t1 VALUES (); +SELECT LAST_INSERT_ID(); +SELECT * FROM federated.t1; + source include/federated_cleanup.inc; diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc index 14b79a9a418..af7c987e477 100644 --- a/sql/ha_federated.cc +++ b/sql/ha_federated.cc @@ -1393,6 +1393,12 @@ static int free_share(FEDERATED_SHARE *share) hash_delete(&federated_open_tables, (byte*) share); my_free((gptr) share->scheme, MYF(MY_ALLOW_ZERO_PTR)); share->scheme= 0; + if (share->socket) + { + my_free((gptr) share->socket, MYF(MY_ALLOW_ZERO_PTR)); + share->socket= 0; + } + thr_lock_delete(&share->lock); VOID(pthread_mutex_destroy(&share->mutex)); my_free((gptr) share, MYF(0)); @@ -1695,10 +1701,34 @@ int ha_federated::write_row(byte *buf) { DBUG_RETURN(stash_remote_error()); } + /* + If the table we've just written a record to contains an auto_increment field, + then store the last_insert_id() value from the foreign server + */ + if (table->next_number_field) + update_auto_increment(); DBUG_RETURN(0); } +/* + ha_federated::update_auto_increment + + This method ensures that last_insert_id() works properly. What it simply does + is calls last_insert_id() on the foreign database immediately after insert + (if the table has an auto_increment field) and sets the insert id via + thd->insert_id(ID) (as well as storing thd->prev_insert_id) +*/ +void ha_federated::update_auto_increment(void) +{ + THD *thd= current_thd; + DBUG_ENTER("ha_federated::update_auto_increment"); + + thd->insert_id(mysql->last_used_con->insert_id); + DBUG_PRINT("info",("last_insert_id %d", auto_increment_value)); + + DBUG_VOID_RETURN; +} int ha_federated::optimize(THD* thd, HA_CHECK_OPT* check_opt) { diff --git a/sql/ha_federated.h b/sql/ha_federated.h index b25071dda16..08203d7e51d 100644 --- a/sql/ha_federated.h +++ b/sql/ha_federated.h @@ -285,6 +285,7 @@ public: void position(const byte *record); //required void info(uint); //required + void update_auto_increment(void); int repair(THD* thd, HA_CHECK_OPT* check_opt); int optimize(THD* thd, HA_CHECK_OPT* check_opt); From fe518520be76da7c66f17e497d7824a3850d70b1 Mon Sep 17 00:00:00 2001 From: "aivanov@mysql.com" <> Date: Mon, 30 Jan 2006 15:17:33 +0300 Subject: [PATCH 3/8] Fixed BUG#16387. Applied innodb-4.1-ss17 snapshot. Do not mistake TABLENAME_ibfk_0 for auto-generated id. --- innobase/dict/dict0dict.c | 3 ++- mysql-test/r/innodb.result | 13 +++++++++++++ mysql-test/t/innodb.test | 13 +++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c index 0cdd593b678..093df5118af 100644 --- a/innobase/dict/dict0dict.c +++ b/innobase/dict/dict0dict.c @@ -2755,7 +2755,8 @@ dict_table_get_highest_foreign_id( if (ut_strlen(foreign->id) > ((sizeof dict_ibfk) - 1) + len && 0 == ut_memcmp(foreign->id, table->name, len) && 0 == ut_memcmp(foreign->id + len, - dict_ibfk, (sizeof dict_ibfk) - 1)) { + dict_ibfk, (sizeof dict_ibfk) - 1) + && foreign->id[len + ((sizeof dict_ibfk) - 1)] != '0') { /* It is of the >= 4.0.18 format */ id = strtoul(foreign->id + len + ((sizeof dict_ibfk) - 1), diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 3ec78c518fc..c4fae109bd4 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1794,3 +1794,16 @@ a hex(b) 7 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2 update t1 set b = 'three' where a = 6; drop table t1; +CREATE TABLE t1(a INT, PRIMARY KEY(a)) ENGINE=InnoDB; +CREATE TABLE t2(a INT) ENGINE=InnoDB; +ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1(a); +ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_1; +ALTER TABLE t2 ADD CONSTRAINT t2_ibfk_0 FOREIGN KEY (a) REFERENCES t1(a); +ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_0; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) default NULL, + KEY `t2_ibfk_0` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t2,t1; diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index e2c12eedcae..ee411a1bb37 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -1365,4 +1365,17 @@ insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1 select a,hex(b) from t1 order by b; update t1 set b = 'three' where a = 6; drop table t1; + +# Ensure that _ibfk_0 is not mistreated as a +# generated foreign key identifier. (Bug #16387) + +CREATE TABLE t1(a INT, PRIMARY KEY(a)) ENGINE=InnoDB; +CREATE TABLE t2(a INT) ENGINE=InnoDB; +ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1(a); +ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_1; +ALTER TABLE t2 ADD CONSTRAINT t2_ibfk_0 FOREIGN KEY (a) REFERENCES t1(a); +ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_0; +SHOW CREATE TABLE t2; +DROP TABLE t2,t1; + # End of 4.1 tests From c21eaa30852ccd4a0af45738f76b9a6a4be6d08a Mon Sep 17 00:00:00 2001 From: "aivanov@mysql.com" <> Date: Mon, 30 Jan 2006 22:33:02 +0300 Subject: [PATCH 4/8] Fixed BUG#15653, BUG#16582. Applied innodb-4.1-ss20 snapshot. --- innobase/btr/btr0sea.c | 41 ++++++++++++-- innobase/fil/fil0fil.c | 103 +++++++++++++++++++++++++++++++----- innobase/include/btr0sea.ic | 2 +- 3 files changed, 129 insertions(+), 17 deletions(-) diff --git a/innobase/btr/btr0sea.c b/innobase/btr/btr0sea.c index 9384168df88..c7da695859b 100644 --- a/innobase/btr/btr0sea.c +++ b/innobase/btr/btr0sea.c @@ -191,7 +191,7 @@ static void btr_search_info_update_hash( /*========================*/ - btr_search_t* info, /* in: search info */ + btr_search_t* info, /* in/out: search info */ btr_cur_t* cursor) /* in: cursor which was just positioned */ { dict_index_t* index; @@ -443,7 +443,7 @@ Updates the search info. */ void btr_search_info_update_slow( /*========================*/ - btr_search_t* info, /* in: search info */ + btr_search_t* info, /* in/out: search info */ btr_cur_t* cursor) /* in: cursor which was just positioned */ { buf_block_t* block; @@ -931,7 +931,7 @@ btr_search_drop_page_hash_index( ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED)); ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX)); #endif /* UNIV_SYNC_DEBUG */ - +retry: rw_lock_s_lock(&btr_search_latch); block = buf_block_align(page); @@ -1007,6 +1007,24 @@ next_rec: rw_lock_x_lock(&btr_search_latch); + if (!block->is_hashed) { + /* Someone else has meanwhile dropped the hash index */ + + goto cleanup; + } + + if (block->curr_n_fields != n_fields + || block->curr_n_bytes != n_bytes) { + + /* Someone else has meanwhile built a new hash index on the + page, with different parameters */ + + rw_lock_x_unlock(&btr_search_latch); + + mem_free(folds); + goto retry; + } + for (i = 0; i < n_cached; i++) { ha_remove_all_nodes_to_page(table, folds[i], page); @@ -1014,7 +1032,22 @@ next_rec: block->is_hashed = FALSE; - rw_lock_x_unlock(&btr_search_latch); +cleanup: + if (block->n_pointers) { + /* Corruption */ + ut_print_timestamp(stderr); + fprintf(stderr, +" InnoDB: Corruption of adaptive hash index. After dropping\n" +"InnoDB: the hash index to a page of %lu %lu, still %lu hash nodes remain.\n", + (ulong) ut_dulint_get_high(tree_id), + (ulong) ut_dulint_get_low(tree_id), + (ulong) block->n_pointers); + rw_lock_x_unlock(&btr_search_latch); + + btr_search_validate(); + } else { + rw_lock_x_unlock(&btr_search_latch); + } mem_free(folds); } diff --git a/innobase/fil/fil0fil.c b/innobase/fil/fil0fil.c index e83d2fcde32..c696c940790 100644 --- a/innobase/fil/fil0fil.c +++ b/innobase/fil/fil0fil.c @@ -179,6 +179,11 @@ struct fil_space_struct { hash_node_t name_hash;/* hash chain the name_hash table */ rw_lock_t latch; /* latch protecting the file space storage allocation */ + UT_LIST_NODE_T(fil_space_t) unflushed_spaces; + /* list of spaces with at least one unflushed + file we have written to */ + ibool is_in_unflushed_spaces; /* TRUE if this space is + currently in the list above */ UT_LIST_NODE_T(fil_space_t) space_list; /* list of all spaces */ ibuf_data_t* ibuf_data; @@ -211,6 +216,12 @@ struct fil_system_struct { not put to this list: they are opened after the startup, and kept open until shutdown */ + UT_LIST_BASE_NODE_T(fil_space_t) unflushed_spaces; + /* base node for the list of those + tablespaces whose files contain + unflushed writes; those spaces have + at least one file node where + modification_counter > flush_counter */ ulint n_open; /* number of files currently open */ ulint max_n_open; /* n_open is not allowed to exceed this */ @@ -387,6 +398,36 @@ fil_space_get_ibuf_data( return(space->ibuf_data); } +/************************************************************************** +Checks if all the file nodes in a space are flushed. The caller must hold +the fil_system mutex. */ +static +ibool +fil_space_is_flushed( +/*=================*/ + /* out: TRUE if all are flushed */ + fil_space_t* space) /* in: space */ +{ + fil_node_t* node; + +#ifdef UNIV_SYNC_DEBUG + ut_ad(mutex_own(&(fil_system->mutex))); +#endif /* UNIV_SYNC_DEBUG */ + + node = UT_LIST_GET_FIRST(space->chain); + + while (node) { + if (node->modification_counter > node->flush_counter) { + + return(FALSE); + } + + node = UT_LIST_GET_NEXT(chain, node); + } + + return(TRUE); +} + /*********************************************************************** Appends a new file to the chain of files of a space. File must be closed. */ @@ -517,7 +558,7 @@ fil_node_open_file( if (size_bytes < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) { fprintf(stderr, "InnoDB: Error: the size of single-table tablespace file %s\n" -"InnoDB: is only %lu %lu, should be at least %lu!", node->name, +"InnoDB: is only %lu %lu, should be at least %lu!\n", node->name, (ulong) size_high, (ulong) size_low, (ulong) (4 * UNIV_PAGE_SIZE)); @@ -687,8 +728,8 @@ fil_try_to_close_file_in_LRU( ut_print_filename(stderr, node->name); fprintf(stderr, ", because mod_count %ld != fl_count %ld\n", - (ulong) node->modification_counter, - (ulong) node->flush_counter); + (long) node->modification_counter, + (long) node->flush_counter); } node = UT_LIST_GET_PREV(LRU, node); @@ -839,6 +880,16 @@ fil_node_free( node->modification_counter = node->flush_counter; + if (space->is_in_unflushed_spaces + && fil_space_is_flushed(space)) { + + space->is_in_unflushed_spaces = FALSE; + + UT_LIST_REMOVE(unflushed_spaces, + system->unflushed_spaces, + space); + } + fil_node_close_file(node, system); } @@ -1002,6 +1053,8 @@ try_again: HASH_INSERT(fil_space_t, name_hash, system->name_hash, ut_fold_string(name), space); + space->is_in_unflushed_spaces = FALSE; + UT_LIST_ADD_LAST(space_list, system->space_list, space); mutex_exit(&(system->mutex)); @@ -1097,6 +1150,13 @@ fil_space_free( HASH_DELETE(fil_space_t, name_hash, system->name_hash, ut_fold_string(space->name), space); + if (space->is_in_unflushed_spaces) { + space->is_in_unflushed_spaces = FALSE; + + UT_LIST_REMOVE(unflushed_spaces, system->unflushed_spaces, + space); + } + UT_LIST_REMOVE(space_list, system->space_list, space); ut_a(space->magic_n == FIL_SPACE_MAGIC_N); @@ -1248,6 +1308,7 @@ fil_system_create( system->tablespace_version = 0; + UT_LIST_INIT(system->unflushed_spaces); UT_LIST_INIT(system->space_list); return(system); @@ -2612,12 +2673,12 @@ fil_open_single_table_tablespace( fputs("!\n" "InnoDB: Have you moved InnoDB .ibd files around without using the\n" "InnoDB: commands DISCARD TABLESPACE and IMPORT TABLESPACE?\n" -"InnoDB: It is also possible that this is a table created with\n" -"InnoDB: CREATE TEMPORARY TABLE, and MySQL removed the .ibd file for this.\n" +"InnoDB: It is also possible that this is a temporary table #sql...,\n" +"InnoDB: and MySQL removed the .ibd file for this.\n" "InnoDB: Please refer to\n" "InnoDB:" " http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n" -"InnoDB: how to resolve the issue.\n", stderr); +"InnoDB: for how to resolve the issue.\n", stderr); mem_free(filepath); @@ -2657,7 +2718,7 @@ fil_open_single_table_tablespace( "InnoDB: Please refer to\n" "InnoDB:" " http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n" -"InnoDB: how to resolve the issue.\n", (ulong) space_id, (ulong) id); +"InnoDB: for how to resolve the issue.\n", (ulong) space_id, (ulong) id); ret = FALSE; @@ -3292,7 +3353,7 @@ fil_space_for_table_exists_in_mem( ut_print_filename(stderr, name); fprintf(stderr, "\n" "InnoDB: in InnoDB data dictionary has tablespace id %lu,\n" -"InnoDB: but tablespace with that id does not exist. There is\n" +"InnoDB: but a tablespace with that id does not exist. There is\n" "InnoDB: a tablespace of name %s and id %lu, though. Have\n" "InnoDB: you deleted or moved .ibd files?\n", (ulong) id, namespace->name, @@ -3303,7 +3364,7 @@ fil_space_for_table_exists_in_mem( "InnoDB: Please refer to\n" "InnoDB:" " http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n" -"InnoDB: how to resolve the issue.\n", stderr); +"InnoDB: for how to resolve the issue.\n", stderr); mem_free(path); mutex_exit(&(system->mutex)); @@ -3317,7 +3378,7 @@ fil_space_for_table_exists_in_mem( ut_print_filename(stderr, name); fprintf(stderr, "\n" "InnoDB: in InnoDB data dictionary has tablespace id %lu,\n" -"InnoDB: but tablespace with that id has name %s.\n" +"InnoDB: but the tablespace with that id has name %s.\n" "InnoDB: Have you deleted or moved .ibd files?\n", (ulong) id, space->name); if (namespace != NULL) { @@ -3732,6 +3793,14 @@ fil_node_complete_io( if (type == OS_FILE_WRITE) { system->modification_counter++; node->modification_counter = system->modification_counter; + + if (!node->space->is_in_unflushed_spaces) { + + node->space->is_in_unflushed_spaces = TRUE; + UT_LIST_ADD_FIRST(unflushed_spaces, + system->unflushed_spaces, + node->space); + } } if (node->n_pending == 0 && node->space->purpose == FIL_TABLESPACE @@ -4145,6 +4214,16 @@ retry: skip_flush: if (node->flush_counter < old_mod_counter) { node->flush_counter = old_mod_counter; + + if (space->is_in_unflushed_spaces + && fil_space_is_flushed(space)) { + + space->is_in_unflushed_spaces = FALSE; + + UT_LIST_REMOVE(unflushed_spaces, + system->unflushed_spaces, + space); + } } if (space->purpose == FIL_TABLESPACE) { @@ -4176,7 +4255,7 @@ fil_flush_file_spaces( mutex_enter(&(system->mutex)); - space = UT_LIST_GET_FIRST(system->space_list); + space = UT_LIST_GET_FIRST(system->unflushed_spaces); while (space) { if (space->purpose == purpose && !space->is_being_deleted) { @@ -4192,7 +4271,7 @@ fil_flush_file_spaces( space->n_pending_flushes--; } - space = UT_LIST_GET_NEXT(space_list, space); + space = UT_LIST_GET_NEXT(unflushed_spaces, space); } mutex_exit(&(system->mutex)); diff --git a/innobase/include/btr0sea.ic b/innobase/include/btr0sea.ic index 8a41042f713..f4e33027c25 100644 --- a/innobase/include/btr0sea.ic +++ b/innobase/include/btr0sea.ic @@ -16,7 +16,7 @@ Updates the search info. */ void btr_search_info_update_slow( /*========================*/ - btr_search_t* info, /* in: search info */ + btr_search_t* info, /* in/out: search info */ btr_cur_t* cursor);/* in: cursor which was just positioned */ /************************************************************************ From cacdb371bc241a1a9b7decc7445680c243cbaad0 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Wed, 8 Feb 2006 10:33:21 +0100 Subject: [PATCH 5/8] Update test results --- mysql-test/r/binlog_row_blackhole.result | 2 +- mysql-test/r/rpl_row_flsh_tbls.result | 1 + mysql-test/r/rpl_row_log.result | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/binlog_row_blackhole.result b/mysql-test/r/binlog_row_blackhole.result index 5c79f27bdf5..941d208a10b 100644 --- a/mysql-test/r/binlog_row_blackhole.result +++ b/mysql-test/r/binlog_row_blackhole.result @@ -92,7 +92,7 @@ insert into t1 values(1); insert ignore into t1 values(1); replace into t1 values(100); create table t2 (a varchar(200)) engine=blackhole; -load data infile '../../std_data/words.dat' into table t2; +load data infile '../std_data_ln/words.dat' into table t2; alter table t1 add b int; alter table t1 drop b; create table t3 like t1; diff --git a/mysql-test/r/rpl_row_flsh_tbls.result b/mysql-test/r/rpl_row_flsh_tbls.result index 503fcc7a368..e2352b8605b 100644 --- a/mysql-test/r/rpl_row_flsh_tbls.result +++ b/mysql-test/r/rpl_row_flsh_tbls.result @@ -30,3 +30,4 @@ flush tables with read lock; start slave; stop slave; ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction +drop table t3, t4, t5; diff --git a/mysql-test/r/rpl_row_log.result b/mysql-test/r/rpl_row_log.result index 8784d9d16e2..45b9ae07d5c 100644 --- a/mysql-test/r/rpl_row_log.result +++ b/mysql-test/r/rpl_row_log.result @@ -12,7 +12,7 @@ create table t1(n int not null auto_increment primary key); insert into t1 values (NULL); drop table t1; create table t1 (word char(20) not null); -load data infile '../../std_data/words.dat' into table t1 ignore 1 lines; +load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines; select count(*) from t1; count(*) 69 From e24336b0c84a9b8a0a9c9e2d9f0a4a4855a28366 Mon Sep 17 00:00:00 2001 From: "anozdrin@mysql.com" <> Date: Wed, 8 Feb 2006 12:51:28 +0300 Subject: [PATCH 6/8] Fix compilation failure. --- sql/handler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/handler.h b/sql/handler.h index de4623b39b9..92fa581c19c 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -2030,7 +2030,7 @@ int ha_binlog_end(THD *thd); #define ha_reset_logs(a) 0 #define ha_binlog_index_purge_file(a,b) 0 #define ha_reset_slave(a) -#define ha_binlog_log_query(a,b,c,d,e,f); +#define ha_binlog_log_query(a,b,c,d,e,f,g); #define ha_binlog_wait(a) #define ha_binlog_end(a) 0 #endif From 66e1e8d4a6a9b22f26284da92bc1cee99d50e90c Mon Sep 17 00:00:00 2001 From: "anozdrin@mysql.com" <> Date: Wed, 8 Feb 2006 12:54:54 +0300 Subject: [PATCH 7/8] Fix for BUG#17180: Failure in trigger-grant on Solaris. The problem is that LEX_STRING was used instead of LEX_STRING::str. --- sql/sql_trigger.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index f653033b9cb..569e5e041c6 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -1183,7 +1183,7 @@ bool Table_triggers_list::process_triggers(THD *thd, trg_event_type event, my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), priv_desc, thd->security_ctx->priv_user, thd->security_ctx->host_or_ip, - table->s->table_name); + table->s->table_name.str); sp_restore_security_context(thd, save_ctx); return TRUE; From 0831fd611e7c11c12af844665bf90399fe559d04 Mon Sep 17 00:00:00 2001 From: "konstantin@mysql.com" <> Date: Wed, 8 Feb 2006 13:05:16 +0300 Subject: [PATCH 8/8] Apply the diskdata patch by Jonas. --- storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp index 6947a4902a1..41a705fea2d 100644 --- a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp +++ b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp @@ -370,7 +370,6 @@ void AsyncFile::openReq(Request* request) const int mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; -retry: if(flags & FsOpenReq::OM_CREATE_IF_NONE){ if((theFd = ::open(theFileName.c_str(), new_flags, mode)) != -1) { close(theFd); @@ -449,9 +448,21 @@ retry: } if(size != 0) { + int err = errno; +#ifdef O_DIRECT + if ((new_flags & O_DIRECT) && off == 0) + { + ndbout_c("error on first write(%d), disable O_DIRECT", err); + new_flags &= ~O_DIRECT; + close(theFd); + theFd = ::open(theFileName.c_str(), new_flags, mode); + if (theFd != -1) + continue; + } +#endif close(theFd); unlink(theFileName.c_str()); - request->error = errno; + request->error = err; return; } off += request->par.open.page_size;