From 518100f0b2c79b415158202dd9c070dd7f7fc4d6 Mon Sep 17 00:00:00 2001 From: "stewart@mysql.com" <> Date: Mon, 24 Apr 2006 15:20:45 -0700 Subject: [PATCH 01/39] BUG#19318 valgrind: memory leak in ndb_mgmd clean up after ConfigValuesFactory --- ndb/include/util/ConfigValues.hpp | 1 + ndb/src/common/util/ConfigValues.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ndb/include/util/ConfigValues.hpp b/ndb/include/util/ConfigValues.hpp index 457488e3c42..8dfb3c83df3 100644 --- a/ndb/include/util/ConfigValues.hpp +++ b/ndb/include/util/ConfigValues.hpp @@ -96,6 +96,7 @@ public: public: ConfigValuesFactory(Uint32 keys = 50, Uint32 data = 10); // Initial ConfigValuesFactory(ConfigValues * m_cfg); // + ~ConfigValuesFactory(); ConfigValues * m_cfg; ConfigValues * getConfigValues(); diff --git a/ndb/src/common/util/ConfigValues.cpp b/ndb/src/common/util/ConfigValues.cpp index 5c4b17c73ca..ae4fbfd2f71 100644 --- a/ndb/src/common/util/ConfigValues.cpp +++ b/ndb/src/common/util/ConfigValues.cpp @@ -294,6 +294,12 @@ ConfigValuesFactory::ConfigValuesFactory(ConfigValues * cfg){ } } +ConfigValuesFactory::~ConfigValuesFactory() +{ + if(m_cfg) + free(m_cfg); +} + ConfigValues * ConfigValuesFactory::create(Uint32 keys, Uint32 data){ Uint32 sz = sizeof(ConfigValues); @@ -528,7 +534,7 @@ ConfigValuesFactory::extractCurrentSection(const ConfigValues::ConstIterator & c } } - ConfigValues * ret = fac->m_cfg; + ConfigValues * ret = fac->getConfigValues(); delete fac; return ret; } From f9f5f9dff7ab82075c18bca64fdff3a39f7bef3b Mon Sep 17 00:00:00 2001 From: "stewart@mysql.com" <> Date: Mon, 24 Apr 2006 15:59:34 -0700 Subject: [PATCH 02/39] BUG#19318 valgrind: memory leak in ndb_mgmd 2nd part of the patch fix functions called by ndbd to deal with memory allocation properly. --- ndb/src/mgmapi/mgmapi.cpp | 2 +- ndb/src/mgmsrv/ConfigInfo.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ndb/src/mgmapi/mgmapi.cpp b/ndb/src/mgmapi/mgmapi.cpp index b02367a8870..631b401263c 100644 --- a/ndb/src/mgmapi/mgmapi.cpp +++ b/ndb/src/mgmapi/mgmapi.cpp @@ -1808,7 +1808,7 @@ ndb_mgm_get_configuration(NdbMgmHandle handle, unsigned int version) { } delete prop; - return (ndb_mgm_configuration*)cvf.m_cfg; + return (ndb_mgm_configuration*)cvf.getConfigValues(); } while(0); delete prop; diff --git a/ndb/src/mgmsrv/ConfigInfo.cpp b/ndb/src/mgmsrv/ConfigInfo.cpp index 817943f5e51..668a0ed3529 100644 --- a/ndb/src/mgmsrv/ConfigInfo.cpp +++ b/ndb/src/mgmsrv/ConfigInfo.cpp @@ -2344,6 +2344,7 @@ ConfigInfo::ConfigInfo() ndbout << "Edit file " << __FILE__ << "." << endl; require(false); } + delete section; } } From 454cea637783ab2686799ded84d4893025f20159 Mon Sep 17 00:00:00 2001 From: "stewart@mysql.com" <> Date: Mon, 24 Apr 2006 16:38:28 -0700 Subject: [PATCH 03/39] BUG#19318 valgrind: memory leak in ndb_mgmd now deal with memory correctly during ConfigInfo construction (due to previous changes) --- ndb/src/mgmsrv/ConfigInfo.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ndb/src/mgmsrv/ConfigInfo.cpp b/ndb/src/mgmsrv/ConfigInfo.cpp index 668a0ed3529..1466ae2e0f5 100644 --- a/ndb/src/mgmsrv/ConfigInfo.cpp +++ b/ndb/src/mgmsrv/ConfigInfo.cpp @@ -2229,11 +2229,11 @@ ConfigInfo::ConfigInfo() if (!m_info.getCopy(param._section, §ion)) { Properties newsection(true); m_info.put(param._section, &newsection); + + // Get copy of section + m_info.getCopy(param._section, §ion); } - - // Get copy of section - m_info.getCopy(param._section, §ion); - + // Create pinfo (parameter info) entry Properties pinfo(true); pinfo.put("Id", param._paramId); From 53279f1dc487a70d2223b63550af9fd633510945 Mon Sep 17 00:00:00 2001 From: "svoj@may.pils.ru" <> Date: Mon, 29 May 2006 16:46:46 +0500 Subject: [PATCH 04/39] BUG#19580 - FULLTEXT search produces wrong results on UTF-8 columns The problem was that MySQL hadn't true ctype implementation. As a result many multibyte punctuation/whitespace characters were treated as word characters. This fix uses recently added CTYPE table for unicode character sets (WL1386) to detect unicode punctuation/whitespace characters correctly. Note: this is incompatible change since it changes parser behavior. One will have to use REPAIR TABLE statement to rebuild fulltext indexes. --- mysql-test/r/fulltext2.result | 8 ++++++++ mysql-test/t/fulltext2.test | 10 ++++++++++ storage/myisam/ft_parser.c | 32 ++++++++++++++++++++++---------- storage/myisam/ft_update.c | 5 ----- storage/myisam/ftdefs.h | 5 +++-- 5 files changed, 43 insertions(+), 17 deletions(-) diff --git a/mysql-test/r/fulltext2.result b/mysql-test/r/fulltext2.result index f6a4b20bc22..7e3e25370d3 100644 --- a/mysql-test/r/fulltext2.result +++ b/mysql-test/r/fulltext2.result @@ -241,3 +241,11 @@ select * from t1 where match a against('ab c' in boolean mode); a drop table t1; set names latin1; +SET NAMES utf8; +CREATE TABLE t1(a VARCHAR(255), FULLTEXT(a)) ENGINE=MyISAM DEFAULT CHARSET=utf8; +INSERT INTO t1 VALUES('„MySQL“'); +SELECT a FROM t1 WHERE MATCH a AGAINST('“MySQL„' IN BOOLEAN MODE); +a +„MySQL“ +DROP TABLE t1; +SET NAMES latin1; diff --git a/mysql-test/t/fulltext2.test b/mysql-test/t/fulltext2.test index fd97f795534..88967a5dd04 100644 --- a/mysql-test/t/fulltext2.test +++ b/mysql-test/t/fulltext2.test @@ -221,3 +221,13 @@ drop table t1; set names latin1; # End of 4.1 tests + +# +# BUG#19580 - FULLTEXT search produces wrong results on UTF-8 columns +# +SET NAMES utf8; +CREATE TABLE t1(a VARCHAR(255), FULLTEXT(a)) ENGINE=MyISAM DEFAULT CHARSET=utf8; +INSERT INTO t1 VALUES('„MySQL“'); +SELECT a FROM t1 WHERE MATCH a AGAINST('“MySQL„' IN BOOLEAN MODE); +DROP TABLE t1; +SET NAMES latin1; diff --git a/storage/myisam/ft_parser.c b/storage/myisam/ft_parser.c index 89ede813a2b..d3f83afbd7b 100644 --- a/storage/myisam/ft_parser.c +++ b/storage/myisam/ft_parser.c @@ -114,6 +114,7 @@ byte ft_get_word(CHARSET_INFO *cs, byte **start, byte *end, FT_WORD *word, MYSQL_FTPARSER_BOOLEAN_INFO *param) { byte *doc=*start; + int ctype; uint mwc, length, mbl; param->yesno=(FTB_YES==' ') ? 1 : (param->quot != 0); @@ -122,9 +123,11 @@ byte ft_get_word(CHARSET_INFO *cs, byte **start, byte *end, while (doc 0 ? mbl : 1)) { - if (true_word_char(cs,*doc)) break; + mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end); + if (true_word_char(ctype, *doc)) + break; if (*doc == FTB_RQUOT && param->quot) { param->quot=doc; @@ -158,14 +161,16 @@ byte ft_get_word(CHARSET_INFO *cs, byte **start, byte *end, } mwc=length=0; - for (word->pos=doc; docpos= doc; doc < end; length++, doc+= (mbl > 0 ? mbl : 1)) + { + mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end); + if (true_word_char(ctype, *doc)) mwc=0; else if (!misc_word_char(*doc) || mwc) break; else mwc++; - + } param->prev='A'; /* be sure *prev is true_word_char */ word->len= (uint)(doc-word->pos) - mwc; if ((param->trunc=(doc 0 ? mbl : 1)) { - if (doc >= end) DBUG_RETURN(0); - if (true_word_char(cs, *doc)) break; + if (doc >= end) + DBUG_RETURN(0); + mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end); + if (true_word_char(ctype, *doc)) + break; } mwc= length= 0; - for (word->pos=doc; docpos= doc; doc < end; length++, doc+= (mbl > 0 ? mbl : 1)) + { + mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end); + if (true_word_char(ctype, *doc)) mwc= 0; else if (!misc_word_char(*doc) || mwc) break; else mwc++; + } word->len= (uint)(doc-word->pos) - mwc; diff --git a/storage/myisam/ft_update.c b/storage/myisam/ft_update.c index f5501792dcd..adcdf81222f 100644 --- a/storage/myisam/ft_update.c +++ b/storage/myisam/ft_update.c @@ -174,11 +174,6 @@ int _mi_ft_cmp(MI_INFO *info, uint keynr, const byte *rec1, const byte *rec2) FT_SEG_ITERATOR ftsi1, ftsi2; CHARSET_INFO *cs=info->s->keyinfo[keynr].seg->charset; DBUG_ENTER("_mi_ft_cmp"); -#ifndef MYSQL_HAS_TRUE_CTYPE_IMPLEMENTATION - if (cs->mbmaxlen > 1) - DBUG_RETURN(THOSE_TWO_DAMN_KEYS_ARE_REALLY_DIFFERENT); -#endif - _mi_ft_segiterator_init(info, keynr, rec1, &ftsi1); _mi_ft_segiterator_init(info, keynr, rec2, &ftsi2); diff --git a/storage/myisam/ftdefs.h b/storage/myisam/ftdefs.h index 2c4cfa1ffd6..82429773824 100644 --- a/storage/myisam/ftdefs.h +++ b/storage/myisam/ftdefs.h @@ -24,9 +24,10 @@ #include #include -#define true_word_char(s,X) (my_isalnum(s,X) || (X)=='_') +#define true_word_char(ctype, character) \ + ((ctype) & (_MY_U | _MY_L | _MY_NMR) || \ + (character) == '_') #define misc_word_char(X) 0 -#define word_char(s,X) (true_word_char(s,X) || misc_word_char(X)) #define FT_MAX_WORD_LEN_FOR_SORT 31 From 036f947be7caf20a22b52b6d3b8a66f2411f24e9 Mon Sep 17 00:00:00 2001 From: "svoj@may.pils.ru" <> Date: Wed, 7 Jun 2006 19:44:43 +0500 Subject: [PATCH 05/39] BUG#12982 - LOAD DATA fails without any error for big files with big read buffer Setting read buffer to values greater than SSIZE_MAX results in unexpected behavior. According to read(2) manual: If count is greater than SSIZE_MAX, the result is unspecified. Set upper limit for read_buffer_size and read_rnd_buffer_size to SSIZE_MAX. --- include/my_global.h | 3 +++ sql/mysqld.cc | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/my_global.h b/include/my_global.h index 7adf4845984..0458d9dcf2c 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -736,6 +736,9 @@ typedef SOCKET_SIZE_TYPE size_socket; #define DBL_MAX 1.79769313486231470e+308 #define FLT_MAX ((float)3.40282346638528860e+38) #endif +#ifndef SSIZE_MAX +#define SSIZE_MAX (ssize_t)((~((size_t) 0)) / 2) +#endif #if !defined(HAVE_ISINF) && !defined(isinf) #define isinf(X) 0 diff --git a/sql/mysqld.cc b/sql/mysqld.cc index ef2f52a33df..b862b381d2f 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -5847,7 +5847,8 @@ The minimum value for this variable is 4096.", "Each thread that does a sequential scan allocates a buffer of this size for each table it scans. If you do many sequential scans, you may want to increase this value.", (gptr*) &global_system_variables.read_buff_size, (gptr*) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG, - 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, IO_SIZE, 0}, + 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, SSIZE_MAX, MALLOC_OVERHEAD, IO_SIZE, + 0}, {"read_only", OPT_READONLY, "Make all non-temporary tables read-only, with the exception for replication (slave) threads and users with the SUPER privilege", (gptr*) &opt_readonly, @@ -5858,12 +5859,12 @@ The minimum value for this variable is 4096.", (gptr*) &global_system_variables.read_rnd_buff_size, (gptr*) &max_system_variables.read_rnd_buff_size, 0, GET_ULONG, REQUIRED_ARG, 256*1024L, IO_SIZE*2+MALLOC_OVERHEAD, - ~0L, MALLOC_OVERHEAD, IO_SIZE, 0}, + SSIZE_MAX, MALLOC_OVERHEAD, IO_SIZE, 0}, {"record_buffer", OPT_RECORD_BUFFER, "Alias for read_buffer_size", (gptr*) &global_system_variables.read_buff_size, (gptr*) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG, - 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, IO_SIZE, 0}, + 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, SSIZE_MAX, MALLOC_OVERHEAD, IO_SIZE, 0}, #ifdef HAVE_REPLICATION {"relay_log_purge", OPT_RELAY_LOG_PURGE, "0 = do not purge relay logs. 1 = purge them as soon as they are no more needed.", From e84359f342b8d67e63fb7220e3275ce27088f23f Mon Sep 17 00:00:00 2001 From: "stewart@mysql.com" <> Date: Thu, 8 Jun 2006 02:31:58 +1000 Subject: [PATCH 06/39] BUG#19318 valgrind: memory leak in ndb_mgmd fix based on review --- ndb/src/mgmsrv/ConfigInfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ndb/src/mgmsrv/ConfigInfo.cpp b/ndb/src/mgmsrv/ConfigInfo.cpp index 1466ae2e0f5..2673aecf31b 100644 --- a/ndb/src/mgmsrv/ConfigInfo.cpp +++ b/ndb/src/mgmsrv/ConfigInfo.cpp @@ -2287,6 +2287,7 @@ ConfigInfo::ConfigInfo() // Replace section with modified section m_info.put(param._section, section, true); + delete section; if(param._type != ConfigInfo::CI_SECTION){ Properties * p; @@ -2344,7 +2345,6 @@ ConfigInfo::ConfigInfo() ndbout << "Edit file " << __FILE__ << "." << endl; require(false); } - delete section; } } From 097b3bbfa9040ba6bc267442b541fb213174933f Mon Sep 17 00:00:00 2001 From: "svoj@may.pils.ru" <> Date: Thu, 15 Jun 2006 13:38:32 +0500 Subject: [PATCH 07/39] Fixed windows compilation failure introduced by fix for BUG#12982. --- include/my_global.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/my_global.h b/include/my_global.h index 0458d9dcf2c..b8e9a2fdef9 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -737,7 +737,7 @@ typedef SOCKET_SIZE_TYPE size_socket; #define FLT_MAX ((float)3.40282346638528860e+38) #endif #ifndef SSIZE_MAX -#define SSIZE_MAX (ssize_t)((~((size_t) 0)) / 2) +#define SSIZE_MAX ((~((size_t) 0)) / 2) #endif #if !defined(HAVE_ISINF) && !defined(isinf) From 4c52d3ddf162b8aed2c810d4a4e714eaffdc6dae Mon Sep 17 00:00:00 2001 From: "ingo@mysql.com" <> Date: Fri, 16 Jun 2006 09:02:03 +0200 Subject: [PATCH 08/39] Bug#18775 - Temporary table from alter table visible to other threads The intermediate (not temporary) files of the new table during ALTER TABLE was visible for SHOW TABLES. These intermediate files are copies of the original table with the changes done by ALTER TABLE. After all the data is copied over from the original table, these files are renamed to the original tables file names. So they are not temporary files. They persist after ALTER TABLE, but just with another name. Normal GRANT checking takes place for the intermediate table. Everyone who can see the original table (and hence the final table) can also see the intermediate table. But noone else. In 5.0 the intermediate files are invisible for SHOW TABLES because all file names beginning with "#sql" were suppressed. In 5.1 temporary files are created in TMPDIR, so that they don't appear in the database directories. Also in 5.1 a translation between table names and file names is done. The tmp_file_prefix on file level is now "@0023sql". The suppression of files starting with tmp_file_prefix is still in place, but still only files beginning with "#sql" were suppressed. I do now translate tmp_file_prefix from table name to file name before comparing it with the files in a directory. This suppresses the intermediate files again. No test case. The test case looks so that a reasonable big table is altered while a second thread runs SHOW TABLES. This in itself would be possible to do, but on slow machines it would add too much time to the test suite, while on fast machines the ALTER TABLE might have finished before SHOW TABLES looks at the directory. Even if there might be a good balance for todays machines, one day the test would become void as the intermediate table would not be seen even with the bug in place. I added a test script to the bug report. It can easily be changed so that it uses a table size that is appropriate for the test machine. --- sql/sql_show.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 83f64e2c9c9..4c9b24c83d8 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -438,6 +438,7 @@ mysql_find_files(THD *thd,List *files, const char *db,const char *path, uint col_access=thd->col_access; #endif TABLE_LIST table_list; + char tbbuff[FN_REFLEN]; DBUG_ENTER("mysql_find_files"); if (wild && !wild[0]) @@ -454,6 +455,8 @@ mysql_find_files(THD *thd,List *files, const char *db,const char *path, DBUG_RETURN(-1); } + VOID(tablename_to_filename(tmp_file_prefix, tbbuff, sizeof(tbbuff))); + for (i=0 ; i < (uint) dirp->number_off_files ; i++) { char uname[NAME_LEN*3+1]; /* Unencoded name */ @@ -491,7 +494,7 @@ mysql_find_files(THD *thd,List *files, const char *db,const char *path, { // Return only .frm files which aren't temp files. if (my_strcasecmp(system_charset_info, ext=fn_rext(file->name),reg_ext) || - is_prefix(file->name,tmp_file_prefix)) + is_prefix(file->name,tbbuff)) continue; *ext=0; VOID(filename_to_tablename(file->name, uname, sizeof(uname))); From 16861b2e3b25385520901f98cda4979ca1f2a408 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Fri, 16 Jun 2006 09:49:18 +0200 Subject: [PATCH 09/39] Bug#14708: Inconsistent treatment of NULLs in LEFT JOINed FULLTEXT matching without index Don't rely on table->null_row when no index is used - it may be a multi-table search --- mysql-test/r/fulltext_left_join.result | 17 +++++++++++++++++ mysql-test/t/fulltext_left_join.test | 15 ++++++++++++++- sql/item_func.cc | 2 +- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/fulltext_left_join.result b/mysql-test/r/fulltext_left_join.result index f3dad290525..68a424fa3a5 100644 --- a/mysql-test/r/fulltext_left_join.result +++ b/mysql-test/r/fulltext_left_join.result @@ -50,3 +50,20 @@ venue_id venue_text dt name entity_id 1 a1 2003-05-23 19:30:00 aberdeen town hall 1 NULL a2 2003-05-23 19:30:00 NULL NULL drop table t1,t2; +create table t1 (id int not null primary key, d char(200) not null, e char(200)); +insert into t1 values (1, 'aword', null), (2, 'aword', 'bword'), (3, 'bword', null), (4, 'bword', 'aword'), (5, 'aword and bword', null); +select * from t1 where match(d, e) against ('+aword +bword' in boolean mode); +id d e +2 aword bword +4 bword aword +5 aword and bword NULL +create table t2 (m_id int not null, f char(200), key (m_id)); +insert into t2 values (1, 'bword'), (3, 'aword'), (5, ''); +select * from t1 left join t2 on m_id = id where match(d, e, f) against ('+aword +bword' in boolean mode); +id d e m_id f +1 aword NULL 1 bword +2 aword bword NULL NULL +3 bword NULL 3 aword +4 bword aword NULL NULL +5 aword and bword NULL 5 +drop table t1,t2; diff --git a/mysql-test/t/fulltext_left_join.test b/mysql-test/t/fulltext_left_join.test index 3bb1f0b7309..7c22f49ed8c 100644 --- a/mysql-test/t/fulltext_left_join.test +++ b/mysql-test/t/fulltext_left_join.test @@ -32,7 +32,7 @@ select match(t1.texte,t1.sujet,t1.motsclefs) against('droit' IN BOOLEAN MODE) drop table t1, t2; # -# Bug #484, reported by Stephen Brandon +# BUG#484, reported by Stephen Brandon # create table t1 (venue_id int(11) default null, venue_text varchar(255) default null, dt datetime default null) engine=myisam; @@ -45,4 +45,17 @@ select * from t1 left join t2 on (venue_id = entity_id and match(name) against(' select * from t1 left join t2 on (venue_id = entity_id and match(name) against('aberdeen')) where dt = '2003-05-23 19:30:00'; drop table t1,t2; +# +# BUG#14708 +# Inconsistent treatment of NULLs in LEFT JOINed FULLTEXT matching without index +# + +create table t1 (id int not null primary key, d char(200) not null, e char(200)); +insert into t1 values (1, 'aword', null), (2, 'aword', 'bword'), (3, 'bword', null), (4, 'bword', 'aword'), (5, 'aword and bword', null); +select * from t1 where match(d, e) against ('+aword +bword' in boolean mode); +create table t2 (m_id int not null, f char(200), key (m_id)); +insert into t2 values (1, 'bword'), (3, 'aword'), (5, ''); +select * from t1 left join t2 on m_id = id where match(d, e, f) against ('+aword +bword' in boolean mode); +drop table t1,t2; + # End of 4.1 tests diff --git a/sql/item_func.cc b/sql/item_func.cc index 4bdb62c6e7a..eaeacffad9f 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -4482,7 +4482,7 @@ double Item_func_match::val_real() if (ft_handler == NULL) DBUG_RETURN(-1.0); - if (table->null_row) /* NULL row from an outer join */ + if (key != NO_SUCH_KEY && table->null_row) /* NULL row from an outer join */ return 0.0; if (join_key) From 0a15f9d0bff294a85da3b1ecf4b95b4b9c9f1340 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Fri, 16 Jun 2006 15:56:08 +0200 Subject: [PATCH 10/39] Set default valgrind options to "-v --show-reachable=yes" and make it possible to override that with --valgrind-options --- mysql-test/mysql-test-run.pl | 50 +++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 92407380ac2..bfd1f7de059 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -286,7 +286,7 @@ our $opt_user_test; our $opt_valgrind= 0; our $opt_valgrind_mysqld= 0; our $opt_valgrind_mysqltest= 0; -our $opt_valgrind_all= 0; +our $default_valgrind_options= "-v --show-reachable=yes"; our $opt_valgrind_options; our $opt_valgrind_path; @@ -597,10 +597,9 @@ sub command_line_setup () { # Coverage, profiling etc 'gcov' => \$opt_gcov, 'gprof' => \$opt_gprof, - 'valgrind' => \$opt_valgrind, + 'valgrind|valgrind-all' => \$opt_valgrind, 'valgrind-mysqltest' => \$opt_valgrind_mysqltest, 'valgrind-mysqld' => \$opt_valgrind_mysqld, - 'valgrind-all' => \$opt_valgrind_all, 'valgrind-options=s' => \$opt_valgrind_options, 'valgrind-path=s' => \$opt_valgrind_path, @@ -807,20 +806,32 @@ sub command_line_setup () { $opt_with_ndbcluster= 0; } - # Turn on valgrinding of all executables if "valgrind" or "valgrind-all" - if ( $opt_valgrind or $opt_valgrind_all ) + # Check valgrind arguments + if ( $opt_valgrind or $opt_valgrind_path or defined $opt_valgrind_options) { mtr_report("Turning on valgrind for all executables"); $opt_valgrind= 1; $opt_valgrind_mysqld= 1; $opt_valgrind_mysqltest= 1; } - elsif ( $opt_valgrind_mysqld or $opt_valgrind_mysqltest ) + elsif ( $opt_valgrind_mysqld ) { - # If test's are run for a specific executable, turn on - # verbose and show-reachable + mtr_report("Turning on valgrind for mysqld(s) only"); $opt_valgrind= 1; - $opt_valgrind_all= 1; + } + elsif ( $opt_valgrind_mysqltest ) + { + mtr_report("Turning on valgrind for mysqltest only"); + $opt_valgrind= 1; + } + + if ( $opt_valgrind ) + { + # Set valgrind_options to default unless already defined + $opt_valgrind_options=$default_valgrind_options + unless defined $opt_valgrind_options; + + mtr_report("Running valgrind with options \"$opt_valgrind_options\""); } if ( ! $opt_testcase_timeout ) @@ -3409,17 +3420,8 @@ sub valgrind_arguments { mtr_add_arg($args, "--suppressions=%s/valgrind.supp", $glob_mysql_test_dir) if -f "$glob_mysql_test_dir/valgrind.supp"; - if ( $opt_valgrind_all ) - { - mtr_add_arg($args, "-v"); - mtr_add_arg($args, "--show-reachable=yes"); - } - - if ( $opt_valgrind_options ) - { - mtr_add_arg($args, '%s', $_) for (split(' ', $opt_valgrind_options)); - } - + # Add valgrind options, can be overriden by user + mtr_add_arg($args, '%s', $_) for (split(' ', $opt_valgrind_options)); mtr_add_arg($args, $$exe); @@ -3519,12 +3521,12 @@ Options for coverage, profiling etc gcov FIXME gprof FIXME - valgrind Run the "mysqltest" and "mysqld" executables using valgrind - valgrind-all Same as "valgrind" but will also add "verbose" and "--show-reachable" - flags to valgrind + valgrind Run the "mysqltest" and "mysqld" executables using + valgrind with options($default_valgrind_options) + valgrind-all Synonym for --valgrind valgrind-mysqltest Run the "mysqltest" executable with valgrind valgrind-mysqld Run the "mysqld" executable with valgrind - valgrind-options=ARGS Extra options to give valgrind + valgrind-options=ARGS Options to give valgrind, replaces default options valgrind-path=[EXE] Path to the valgrind executable Misc options From 59d20e26d57e9fc33cf44ada4ce511f507e3d623 Mon Sep 17 00:00:00 2001 From: "dlenev@mysql.com" <> Date: Fri, 16 Jun 2006 20:21:25 +0400 Subject: [PATCH 11/39] Fix for bug#13479 "REPLACE activates UPDATE trigger, not the DELETE and INSERT triggers". In cases when REPLACE was internally executed via update and table had on update (on delete) triggers defined we exposed the fact that such optimization used by callng on update (not calling on delete) triggers. Such behavior contradicts our documentation which describes REPLACE as INSERT with optional DELETE. This fix just disables this optimization for tables with on delete triggers. The optimization is still applied for tables which have on update but have no on delete triggers, we just don't invoke on update triggers in this case and thus don't expose information about optimization to user. Also added test coverage for values returned by ROW_COUNT() function (and thus for values returned by mysql_affected_rows()) for various forms of INSERT. --- mysql-test/r/insert.result | 26 ++++++++++++++++++++++ mysql-test/r/trigger.result | 32 +++++++++------------------ mysql-test/t/insert.test | 23 ++++++++++++++++++++ mysql-test/t/trigger.test | 40 +++++++++++++++------------------- sql/sql_insert.cc | 43 +++++++++++++++++-------------------- 5 files changed, 96 insertions(+), 68 deletions(-) diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result index 00a987c9254..82fad8e912c 100644 --- a/mysql-test/r/insert.result +++ b/mysql-test/r/insert.result @@ -305,3 +305,29 @@ insert delayed into v1 values (1); ERROR HY000: 'test.v1' is not BASE TABLE drop table t1; drop view v1; +create table t1 (id int primary key, data int); +insert into t1 values (1, 1), (2, 2), (3, 3); +select row_count(); +row_count() +3 +insert ignore into t1 values (1, 1); +select row_count(); +row_count() +0 +replace into t1 values (1, 11); +select row_count(); +row_count() +2 +replace into t1 values (4, 4); +select row_count(); +row_count() +1 +insert into t1 values (2, 2) on duplicate key update data= data + 10; +select row_count(); +row_count() +2 +insert into t1 values (5, 5) on duplicate key update data= data + 10; +select row_count(); +row_count() +1 +drop table t1; diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result index 8b4aba367fb..d4791c6b117 100644 --- a/mysql-test/r/trigger.result +++ b/mysql-test/r/trigger.result @@ -169,21 +169,22 @@ select @log; @log (BEFORE_INSERT: new=(id=1, data=2)) set @log:= ""; -replace t1 values (1, 3), (2, 2); +insert into t1 (id, data) values (1, 3), (2, 2) on duplicate key update data= data + 1; select @log; @log -(BEFORE_INSERT: new=(id=1, data=3))(BEFORE_UPDATE: old=(id=1, data=1) new=(id=1, data=3))(AFTER_UPDATE: old=(id=1, data=1) new=(id=1, data=3))(BEFORE_INSERT: new=(id=2, data=2))(AFTER_INSERT: new=(id=2, data=2)) -alter table t1 add ts timestamp default now(); +(BEFORE_INSERT: new=(id=1, data=3))(BEFORE_UPDATE: old=(id=1, data=1) new=(id=1, data=2))(AFTER_UPDATE: old=(id=1, data=1) new=(id=1, data=2))(BEFORE_INSERT: new=(id=2, data=2))(AFTER_INSERT: new=(id=2, data=2)) set @log:= ""; -replace t1 (id, data) values (1, 4); +replace t1 values (1, 4), (3, 3); select @log; @log -(BEFORE_INSERT: new=(id=1, data=4))(BEFORE_DELETE: old=(id=1, data=3))(AFTER_DELETE: old=(id=1, data=3))(AFTER_INSERT: new=(id=1, data=4)) +(BEFORE_INSERT: new=(id=1, data=4))(BEFORE_DELETE: old=(id=1, data=2))(AFTER_DELETE: old=(id=1, data=2))(AFTER_INSERT: new=(id=1, data=4))(BEFORE_INSERT: new=(id=3, data=3))(AFTER_INSERT: new=(id=3, data=3)) +drop trigger t1_bd; +drop trigger t1_ad; set @log:= ""; -insert into t1 (id, data) values (1, 5), (3, 3) on duplicate key update data= data + 2; +replace t1 values (1, 5); select @log; @log -(BEFORE_INSERT: new=(id=1, data=5))(BEFORE_UPDATE: old=(id=1, data=4) new=(id=1, data=6))(AFTER_UPDATE: old=(id=1, data=4) new=(id=1, data=6))(BEFORE_INSERT: new=(id=3, data=3))(AFTER_INSERT: new=(id=3, data=3)) +(BEFORE_INSERT: new=(id=1, data=5))(AFTER_INSERT: new=(id=1, data=5)) drop table t1; create table t1 (id int primary key, data varchar(10), fk int); create table t2 (event varchar(100)); @@ -493,15 +494,9 @@ select * from t1; i k 3 13 replace into t1 values (3, 3); -ERROR 42S22: Unknown column 'at' in 'NEW' -select * from t1; -i k -3 3 -alter table t1 add ts timestamp default now(); -replace into t1 (i, k) values (3, 13); ERROR 42S22: Unknown column 'at' in 'OLD' select * from t1; -i k ts +i k drop table t1, t2; create table t1 (i int, bt int, k int, key(k)) engine=myisam; create table t2 (i int); @@ -574,18 +569,11 @@ i k 1 1 2 2 replace into t1 values (2, 4); -ERROR 42S22: Unknown column 'bt' in 'NEW' +ERROR 42S22: Unknown column 'bt' in 'OLD' select * from t1; i k 1 1 2 2 -alter table t1 add ts timestamp default now(); -replace into t1 (i, k) values (2, 11); -ERROR 42S22: Unknown column 'bt' in 'OLD' -select * from t1; -i k ts -1 1 0000-00-00 00:00:00 -2 2 0000-00-00 00:00:00 drop table t1, t2; drop function if exists bug5893; create table t1 (col1 int, col2 int); diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test index 0c64dd80bec..ac43d0bc818 100644 --- a/mysql-test/t/insert.test +++ b/mysql-test/t/insert.test @@ -187,3 +187,26 @@ create view v1 as select * from t1; insert delayed into v1 values (1); drop table t1; drop view v1; + +# +# Test for values returned by ROW_COUNT() function +# (and thus for values returned by mysql_affected_rows()) +# for various forms of INSERT +# +create table t1 (id int primary key, data int); +insert into t1 values (1, 1), (2, 2), (3, 3); +select row_count(); +insert ignore into t1 values (1, 1); +select row_count(); +# Reports that 2 rows are affected (1 deleted + 1 inserted) +replace into t1 values (1, 11); +select row_count(); +replace into t1 values (4, 4); +select row_count(); +# Reports that 2 rows are affected. This conforms to documentation. +# (Useful for differentiating inserts from updates). +insert into t1 values (2, 2) on duplicate key update data= data + 10; +select row_count(); +insert into t1 values (5, 5) on duplicate key update data= data + 10; +select row_count(); +drop table t1; diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index a5bd2ba0b38..3743d8f5c76 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -185,24 +185,26 @@ select @log; set @log:= ""; insert ignore t1 values (1, 2); select @log; -# REPLACE: before insert trigger should be called for both records, -# but then for first one update will be executed (and both update -# triggers should fire). For second after insert trigger will be -# called as for usual insert +# INSERT ... ON DUPLICATE KEY UPDATE ... set @log:= ""; -replace t1 values (1, 3), (2, 2); +insert into t1 (id, data) values (1, 3), (2, 2) on duplicate key update data= data + 1; select @log; -# Now let us change table in such way that REPLACE on won't be executed -# using update. -alter table t1 add ts timestamp default now(); +# REPLACE (also test for bug#13479 "REPLACE activates UPDATE trigger, +# not the DELETE and INSERT triggers") +# We define REPLACE as INSERT which DELETEs old rows which conflict with +# row being inserted. So for the first record in statement below we will +# call before insert trigger, then delete will be executed (and both delete +# triggers should fire). Finally after insert trigger will be called. +# For the second record we will just call both on insert triggers. set @log:= ""; -# This REPLACE should be executed via DELETE and INSERT so proper -# triggers should be invoked. -replace t1 (id, data) values (1, 4); +replace t1 values (1, 4), (3, 3); select @log; -# Finally let us test INSERT ... ON DUPLICATE KEY UPDATE ... +# Now we will drop ON DELETE triggers to test REPLACE which is internally +# executed via update +drop trigger t1_bd; +drop trigger t1_ad; set @log:= ""; -insert into t1 (id, data) values (1, 5), (3, 3) on duplicate key update data= data + 2; +replace t1 values (1, 5); select @log; # This also drops associated triggers @@ -531,14 +533,11 @@ alter table t1 add primary key (i); --error 1054 insert into t1 values (3, 4) on duplicate key update k= k + 10; select * from t1; +# The following statement will delete old row and won't +# insert new one since after delete trigger will fail. --error 1054 replace into t1 values (3, 3); select * from t1; -# Change table in such way that REPLACE will delete row -alter table t1 add ts timestamp default now(); ---error 1054 -replace into t1 (i, k) values (3, 13); -select * from t1; # Also drops all triggers drop table t1, t2; @@ -594,11 +593,6 @@ select * from t1; --error 1054 replace into t1 values (2, 4); select * from t1; -# Change table in such way that REPLACE will delete row -alter table t1 add ts timestamp default now(); ---error 1054 -replace into t1 (i, k) values (2, 11); -select * from t1; # Also drops all triggers drop table t1, t2; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 26f3b6f5faa..87483b17a99 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1057,16 +1057,19 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) to convert the latter operation internally to an UPDATE. We also should not perform this conversion if we have timestamp field with ON UPDATE which is different from DEFAULT. + Another case when conversion should not be performed is when + we have ON DELETE trigger on table so user may notice that + we cheat here. Note that it is ok to do such conversion for + tables which have ON UPDATE but have no ON DELETE triggers, + we just should not expose this fact to users by invoking + ON UPDATE triggers. */ if (last_uniq_key(table,key_nr) && !table->file->referenced_by_foreign_key() && (table->timestamp_field_type == TIMESTAMP_NO_AUTO_SET || - table->timestamp_field_type == TIMESTAMP_AUTO_SET_ON_BOTH)) + table->timestamp_field_type == TIMESTAMP_AUTO_SET_ON_BOTH) && + (!table->triggers || !table->triggers->has_delete_triggers())) { - if (table->triggers && - table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, - TRG_ACTION_BEFORE, TRUE)) - goto before_trg_err; if (thd->clear_next_insert_id) { /* Reset auto-increment cacheing if we do an update */ @@ -1077,13 +1080,11 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) table->record[0]))) goto err; info->deleted++; - trg_error= (table->triggers && - table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, - TRG_ACTION_AFTER, - TRUE)); - /* Update logfile and count */ - info->copied++; - goto ok_or_after_trg_err; + /* + Since we pretend that we have done insert we should call + its after triggers. + */ + goto after_trg_n_copied_inc; } else { @@ -1107,10 +1108,6 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) } } } - info->copied++; - trg_error= (table->triggers && - table->triggers->process_triggers(thd, TRG_EVENT_INSERT, - TRG_ACTION_AFTER, TRUE)); } else if ((error=table->file->write_row(table->record[0]))) { @@ -1118,14 +1115,14 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) (error != HA_ERR_FOUND_DUPP_KEY && error != HA_ERR_FOUND_DUPP_UNIQUE)) goto err; table->file->restore_auto_increment(); + goto ok_or_after_trg_err; } - else - { - info->copied++; - trg_error= (table->triggers && - table->triggers->process_triggers(thd, TRG_EVENT_INSERT, - TRG_ACTION_AFTER, TRUE)); - } + +after_trg_n_copied_inc: + info->copied++; + trg_error= (table->triggers && + table->triggers->process_triggers(thd, TRG_EVENT_INSERT, + TRG_ACTION_AFTER, TRUE)); ok_or_after_trg_err: if (key) From 5a242ffc4f9f15970b9c65f1e4e0ce1828e0b346 Mon Sep 17 00:00:00 2001 From: "kent@mysql.com" <> Date: Fri, 16 Jun 2006 22:29:52 +0200 Subject: [PATCH 12/39] .del-mysql_install.def~8da659e7c0f7e571: Delete: netware/mysql_install.def Makefile.am: Removed obsolete "mysql_install.def" --- netware/Makefile.am | 4 ++-- netware/mysql_install.def | 10 ---------- 2 files changed, 2 insertions(+), 12 deletions(-) delete mode 100644 netware/mysql_install.def diff --git a/netware/Makefile.am b/netware/Makefile.am index 0588e6b1ade..527425d3207 100644 --- a/netware/Makefile.am +++ b/netware/Makefile.am @@ -29,7 +29,7 @@ netware_build_files = client/mysql.def client/mysqladmin.def \ client/mysqlbinlog.def client/mysqlcheck.def \ client/mysqldump.def client/mysqlimport.def \ client/mysqlshow.def client/mysqltest.def \ - extra/mysql_install.def extra/my_print_defaults.def \ + extra/my_print_defaults.def \ extra/perror.def extra/replace.def \ extra/resolveip.def extra/comp_err.def \ isam/isamchk.def \ @@ -52,7 +52,7 @@ EXTRA_DIST= comp_err.def init_db.sql install_test_db.ncf \ libmysqlmain.c my_manage.c my_manage.h \ my_print_defaults.def myisam_ftdump.def myisamchk.def \ myisamlog.def myisampack.def mysql.def mysql.xdc \ - mysql_fix_privilege_tables.pl mysql_install.def \ + mysql_fix_privilege_tables.pl \ mysql_install_db.c mysql_install_db.def \ mysql_secure_installation.pl mysql_test_run.c \ mysql_test_run.def mysql_waitpid.def mysqladmin.def \ diff --git a/netware/mysql_install.def b/netware/mysql_install.def deleted file mode 100644 index 3392afb7298..00000000000 --- a/netware/mysql_install.def +++ /dev/null @@ -1,10 +0,0 @@ -#------------------------------------------------------------------------------ -# My Print Defaults -#------------------------------------------------------------------------------ -MODULE libc.nlm -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Install Tool" -VERSION 4, 0 -XDCDATA ../netware/mysql.xdc -#DEBUG - From 392bb51f258605d9337845e49a09633a46c3fd66 Mon Sep 17 00:00:00 2001 From: "kent@mysql.com" <> Date: Sat, 17 Jun 2006 00:30:02 +0200 Subject: [PATCH 13/39] configure.in, net_serv.cc, compile-netware-END: Changes for Netware --- configure.in | 6 +++--- netware/BUILD/compile-netware-END | 5 ----- sql/net_serv.cc | 4 ++++ 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/configure.in b/configure.in index 3c335089688..fd2cf3baf97 100644 --- a/configure.in +++ b/configure.in @@ -1137,7 +1137,7 @@ dnl Is this the right match for DEC OSF on alpha? # Edit Makefile.in files. # echo -n "configuring Makefile.in files for NetWare... " - for file in sql/Makefile.in libmysql/Makefile.in libmysql_r/Makefile.in sql/share/Makefile.in strings/Makefile.in client/Makefile.in + for file in sql/Makefile.in libmysql/Makefile.in libmysql_r/Makefile.in extra/Makefile.in strings/Makefile.in client/Makefile.in do # echo "#### $file ####" filedir="`dirname $file`" @@ -1163,9 +1163,9 @@ s,\(\./gen_lex_hash\)\$(EXEEXT),\1.linux, s%\(mysqld_DEPENDENCIES = \) %\1$lib_DEPENDENCIES % EOF ;; - sql/share/Makefile.in) + extra/Makefile.in) cat > $filesed << EOF -s,\(extra/comp_err\),\1.linux, +s,\(extra/comp_err\)\$(EXEEXT),\1.linux, EOF ;; libmysql/Makefile.in) diff --git a/netware/BUILD/compile-netware-END b/netware/BUILD/compile-netware-END index f7da0d9596e..c5c08cea908 100755 --- a/netware/BUILD/compile-netware-END +++ b/netware/BUILD/compile-netware-END @@ -21,11 +21,6 @@ rm -rf Makefile.in.bk # run auto tools . $path/compile-AUTOTOOLS -# For NetWare there is no comp_err but comp_err.linux -sed -e "s/comp_err/comp_err.linux/g" extra/Makefile.am > extra/Makefile.am.$$ -sed -e "s/replace comp_err.linux/replace comp_err/g" extra/Makefile.am.$$ > extra/Makefile.am -rm extra/Makefile.am.$$ - # configure ./configure $base_configs $extra_configs diff --git a/sql/net_serv.cc b/sql/net_serv.cc index c80bb8bad9a..cf9dc6e3f60 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -52,6 +52,10 @@ #include #include +#ifdef __NETWARE__ +#include +#endif + #ifdef EMBEDDED_LIBRARY #undef MYSQL_SERVER #undef MYSQL_CLIENT From eadd3510314e55f878b0b74b503acc87471e46b8 Mon Sep 17 00:00:00 2001 From: "kent@mysql.com" <> Date: Sat, 17 Jun 2006 03:04:43 +0200 Subject: [PATCH 14/39] make_win_src_distribution.sh: Include "sql_yacc.yy" for completeness (bug#20387) --- scripts/make_win_src_distribution.sh | 49 +++++++++++++++++++--------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/scripts/make_win_src_distribution.sh b/scripts/make_win_src_distribution.sh index b9b39f1b02f..028986b1fe3 100644 --- a/scripts/make_win_src_distribution.sh +++ b/scripts/make_win_src_distribution.sh @@ -1,11 +1,14 @@ #!/bin/sh +# Terminate loudly on error, we don't want partial package +set -e +trap "echo '*** script failed ***'" 0 + # # Script to create a Windows src package # version=@VERSION@ -export version CP="cp -p" DEBUG=0 @@ -199,7 +202,7 @@ copy_dir_files() print_debug "Creating directory '$arg'" mkdir $BASE/$arg fi - for i in *.c *.cpp *.h *.ih *.i *.ic *.asm *.def *.hpp \ + for i in *.c *.cpp *.h *.ih *.i *.ic *.asm *.def *.hpp *.yy \ README INSTALL* LICENSE AUTHORS NEWS ChangeLog \ *.inc *.test *.result *.pem Moscow_leap des_key_file \ *.vcproj *.sln *.dat *.000001 *.require *.opt @@ -260,7 +263,7 @@ done # # Create project files for ndb # -make -C $SOURCE/ndb windoze +make -C $SOURCE/ndb windoze || true # # Input directories to be copied recursively @@ -334,8 +337,17 @@ done # Fix some windows files to avoid compiler warnings # -./extra/replace std:: "" < $BASE/sql/sql_yacc.cpp | sed '/^ *switch (yytype)$/ { N; /\n *{$/ { N; /\n *default:$/ { N; /\n *break;$/ { N; /\n *}$/ d; };};};} ' > $BASE/sql/sql_yacc.cpp-new -mv $BASE/sql/sql_yacc.cpp-new $BASE/sql/sql_yacc.cpp +if [ -x extra/replace ] ; then + ./extra/replace std:: "" < $BASE/sql/sql_yacc.cpp | \ + sed '/^ *switch (yytype)$/ { N; /\n *{$/ { N; /\n *default:$/ { N; /\n *break;$/ { N; /\n *}$/ d; };};};} ' \ + > $BASE/sql/sql_yacc.cpp-new + mv $BASE/sql/sql_yacc.cpp-new $BASE/sql/sql_yacc.cpp +else + if [ "$SILENT" = "0" ] ; then + echo 'WARNING: "extra/replace" not built, can not filter "sql_yacc.ccp"' + echo 'WARNING: to reduce the number of warnings when building' + fi +fi # # Search the tree for plain text files and adapt the line end marker @@ -349,8 +361,6 @@ find $BASE \( -name "*.cnf" -o -name "*.ini" \ do unix_to_dos $v done -# File extension '.txt' matches too many other files, error messages etc. -unix_to_dos $BASE/Docs/*.txt mv $BASE/README $BASE/README.txt @@ -358,19 +368,23 @@ mv $BASE/README $BASE/README.txt # Clean up if we did this from a bk tree # -if [ -d $BASE/SSL/SCCS ] -then - find $BASE/ -type d -name SCCS -printf " \"%p\"" | xargs rm -r -f -fi -find $BASE/ -type d -name .deps -printf " \"%p\"" | xargs rm -r -f -find $BASE/ -type d -name .libs -printf " \"%p\"" | xargs rm -r -f +find $BASE -type d \( -name SCCS -o -name .deps -o -name .libs \) -print0 | \ +xargs -0 rm -r -f rm -r -f "$BASE/mysql-test/var" # # Initialize the initial data directory # -if [ -f scripts/mysql_install_db ]; then +if [ ! -f scripts/mysql_install_db ] ; then + if [ "$SILENT" = "0" ] ; then + echo 'WARNING: "scripts/mysql_install_db" is not built, can not initiate databases' + fi +elif [ ! -f extra/my_print_defaults ]; then + if [ "$SILENT" = "0" ] ; then + echo 'WARNING: "extra/my_print_defaults" is not built, can not initiate databases' + fi +else print_debug "Initializing the 'data' directory" scripts/mysql_install_db --no-defaults --windows --datadir=$BASE/data if test "$?" = 1 @@ -451,7 +465,7 @@ set_tarzip_options() OPT=cvf EXT=".tar" NEED_COMPRESS=1 - if [ "$SILENT" = "1" ] ; then + if [ "$DEBUG" = "0" ] ; then OPT=cf fi else @@ -460,7 +474,7 @@ set_tarzip_options() OPT="-r" EXT=".zip" NEED_COMPRESS=0 - if [ "$SILENT" = "1" ] ; then + if [ "$DEBUG" = "0" ] ; then OPT="$OPT -q" fi fi @@ -523,4 +537,7 @@ fi print_debug "Removing temporary directory" rm -r -f $BASE +# No need to report anything if we got here +trap "" 0 + # End of script From 1b7d4cacfbaa9f69bc2ce92261c86287168e3638 Mon Sep 17 00:00:00 2001 From: "kent@mysql.com" <> Date: Sat, 17 Jun 2006 10:44:52 +0200 Subject: [PATCH 15/39] make_win_src_distribution.sh: Don't try copy non existing extra/{sql_state,mysqld_error}.h --- scripts/make_win_src_distribution.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/make_win_src_distribution.sh b/scripts/make_win_src_distribution.sh index 9c3aa6c9b4c..6ad8d4f1f9b 100644 --- a/scripts/make_win_src_distribution.sh +++ b/scripts/make_win_src_distribution.sh @@ -301,8 +301,6 @@ do fi done -cp extra/sql_state.h extra/mysqld_error.h $BASE/include - # # support files # From 6783fc830fabab40912463f758480f34c03a13a6 Mon Sep 17 00:00:00 2001 From: "kent@mysql.com" <> Date: Sat, 17 Jun 2006 11:33:34 +0200 Subject: [PATCH 16/39] make_win_src_distribution.sh: Make output less verbose Make temporary directory name unique Remove temporary directory on interrupt --- scripts/make_win_src_distribution.sh | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/scripts/make_win_src_distribution.sh b/scripts/make_win_src_distribution.sh index 028986b1fe3..4e5cc2ada46 100644 --- a/scripts/make_win_src_distribution.sh +++ b/scripts/make_win_src_distribution.sh @@ -77,7 +77,7 @@ show_usage() echo " --tmp Specify the temporary location" echo " --suffix Suffix name for the package" echo " --dirname Directory name to copy files (intermediate)" - echo " --silent Do not list verbosely files processed" + echo " --silent Show no progress information" echo " --tar Create tar.gz package" echo " --zip Create zip package" echo " --help Show this help message" @@ -143,10 +143,11 @@ unix_to_dos() # Create a tmp dest directory to copy files # -BASE=$TMP/my_win_dist$SUFFIX +BASE=$TMP/my_win_dist$SUFFIX.$$ +trap "rm -r -f $BASE; echo '*** interrupted ***'; exit 1" 1 2 3 13 15 if [ -d $BASE ] ; then - print_debug "Destination directory '$BASE' already exists, deleting it" + echo "WARNING: Destination directory '$BASE' already exists, deleting it" rm -r -f $BASE fi @@ -462,21 +463,15 @@ set_tarzip_options() if [ "$arg" = "tar" ]; then ZIPFILE1=gnutar ZIPFILE2=gtar - OPT=cvf + OPT=cf EXT=".tar" NEED_COMPRESS=1 - if [ "$DEBUG" = "0" ] ; then - OPT=cf - fi else ZIPFILE1=zip ZIPFILE2="" - OPT="-r" + OPT="-r -q" EXT=".zip" NEED_COMPRESS=0 - if [ "$DEBUG" = "0" ] ; then - OPT="$OPT -q" - fi fi done } From ad87e7b3147d9b00efcca08bdc4c6fd98e523aeb Mon Sep 17 00:00:00 2001 From: "kent@mysql.com" <> Date: Sat, 17 Jun 2006 15:37:23 +0200 Subject: [PATCH 17/39] Makefile.am: Avoid error message trying 'windoze-dsp' in obsolete directory compile-dist: Avoid error message for target 'distclean' and no Makefile --- BUILD/compile-dist | 2 +- ndb/Makefile.am | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/BUILD/compile-dist b/BUILD/compile-dist index 39095f59ffa..613f2643c56 100755 --- a/BUILD/compile-dist +++ b/BUILD/compile-dist @@ -6,7 +6,7 @@ # tree can then be picked up by "make dist" to create the "pristine source # package" that is used as the basis for all other binary builds. # -make distclean +test -f Makefile && make distclean aclocal autoheader libtoolize --automake --force --copy diff --git a/ndb/Makefile.am b/ndb/Makefile.am index 32c821383e6..7162253f24b 100644 --- a/ndb/Makefile.am +++ b/ndb/Makefile.am @@ -19,7 +19,8 @@ dist-hook: done windoze: - for i in `find . -name 'Makefile.am'`; do make -C `dirname $$i` windoze-dsp; done + for i in `find . -name 'old_dirs' -prune -o -name 'Makefile.am' -print`; \ + do make -C `dirname $$i` windoze-dsp; done windoze-dsp: From 37cdb0fbf3d9439829678614443834b2622d82db Mon Sep 17 00:00:00 2001 From: "svoj@may.pils.ru" <> Date: Mon, 19 Jun 2006 14:05:14 +0500 Subject: [PATCH 18/39] BUG#18036 - update of table joined to self reports table as crashed Certain updates of table joined to self results in unexpected behavior. The problem was that record cache was mistakenly enabled for self-joined table updates. Normally record cache must be disabled for such updates. Fixed wrong condition in code that determines whether to use record cache for self-joined table updates. Only MyISAM tables were affected. --- mysql-test/r/myisam.result | 8 ++++++++ mysql-test/t/myisam.test | 9 +++++++++ sql/sql_update.cc | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 3b4519e5444..7aaf3c8f85a 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -748,3 +748,11 @@ select count(id1) from t1 where id2 = 10; count(id1) 5 drop table t1; +CREATE TABLE t1(a CHAR(9), b VARCHAR(7)) ENGINE=MyISAM; +INSERT INTO t1(a) VALUES('xxxxxxxxx'),('xxxxxxxxx'); +UPDATE t1 AS ta1,t1 AS ta2 SET ta1.b='aaaaaa',ta2.b='bbbbbb'; +SELECT * FROM t1; +a b +xxxxxxxxx bbbbbb +xxxxxxxxx bbbbbb +DROP TABLE t1; diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 7e4cc324b12..5f948973141 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -705,4 +705,13 @@ select count(*) from t1 where id2 = 10; select count(id1) from t1 where id2 = 10; drop table t1; +# +# BUG#18036 - update of table joined to self reports table as crashed +# +CREATE TABLE t1(a CHAR(9), b VARCHAR(7)) ENGINE=MyISAM; +INSERT INTO t1(a) VALUES('xxxxxxxxx'),('xxxxxxxxx'); +UPDATE t1 AS ta1,t1 AS ta2 SET ta1.b='aaaaaa',ta2.b='bbbbbb'; +SELECT * FROM t1; +DROP TABLE t1; + # End of 4.1 tests diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 48a8cf93917..16423b39786 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -862,7 +862,7 @@ int multi_update::prepare(List ¬_used_values, for (table_ref= all_tables; table_ref; table_ref=table_ref->next) { TABLE *table=table_ref->table; - if (!(tables_to_update & table->map) && + if ((tables_to_update & table->map) && mysql_lock_have_duplicate(thd, table, update_tables)) table->no_cache= 1; // Disable row cache } From 2e56e821801c9303be9b6695ae2589289079e118 Mon Sep 17 00:00:00 2001 From: "anozdrin@mysql.com" <> Date: Mon, 19 Jun 2006 14:13:34 +0400 Subject: [PATCH 19/39] Fix of test suite in scope of fixing BUG#18023: IM: instance can be started several times; monitor interval must be > 2sec --- mysql-test/r/im_daemon_life_cycle.result | 1 + mysql-test/r/im_life_cycle.result | 76 ++++++------ mysql-test/r/im_utils.result | 3 + mysql-test/t/im_daemon_life_cycle-im.opt | 1 + mysql-test/t/im_daemon_life_cycle.imtest | 18 ++- mysql-test/t/im_life_cycle-im.opt | 1 + mysql-test/t/im_life_cycle.imtest | 140 ++++++++++++++++------- mysql-test/t/im_utils-im.opt | 1 + mysql-test/t/im_utils.imtest | 16 ++- mysql-test/t/kill_n_check.sh | 115 +++++++++++++------ mysql-test/t/wait_for_process.sh | 66 +++++++++++ 11 files changed, 323 insertions(+), 115 deletions(-) create mode 100644 mysql-test/t/im_life_cycle-im.opt create mode 100644 mysql-test/t/im_utils-im.opt create mode 100755 mysql-test/t/wait_for_process.sh diff --git a/mysql-test/r/im_daemon_life_cycle.result b/mysql-test/r/im_daemon_life_cycle.result index d0a76b450fe..ea27fcb6db1 100644 --- a/mysql-test/r/im_daemon_life_cycle.result +++ b/mysql-test/r/im_daemon_life_cycle.result @@ -1,3 +1,4 @@ +Success: the process has been started. SHOW INSTANCES; instance_name status mysqld1 online diff --git a/mysql-test/r/im_life_cycle.result b/mysql-test/r/im_life_cycle.result index 36277f6aa28..a9f78aea7d3 100644 --- a/mysql-test/r/im_life_cycle.result +++ b/mysql-test/r/im_life_cycle.result @@ -1,44 +1,45 @@ + +-------------------------------------------------------------------- +-- 1.1.1. +-------------------------------------------------------------------- +Success: the process has been started. SHOW INSTANCES; instance_name status mysqld1 online mysqld2 offline -SHOW INSTANCE STATUS mysqld1; -instance_name status version -mysqld1 online VERSION -SHOW INSTANCE STATUS mysqld2; -instance_name status version -mysqld2 offline VERSION + +-------------------------------------------------------------------- +-- 1.1.2. +-------------------------------------------------------------------- START INSTANCE mysqld2; -SHOW INSTANCES; -instance_name status -mysqld1 online -mysqld2 online -SHOW INSTANCE STATUS mysqld1; -instance_name status version -mysqld1 online VERSION -SHOW INSTANCE STATUS mysqld2; -instance_name status version -mysqld2 online VERSION +Success: the process has been started. SHOW VARIABLES LIKE 'port'; Variable_name Value -port IM_MYSQLD1_PORT +port IM_MYSQLD2_PORT + +-------------------------------------------------------------------- +-- 1.1.3. +-------------------------------------------------------------------- STOP INSTANCE mysqld2; -SHOW INSTANCES; -instance_name status -mysqld1 online -mysqld2 offline -SHOW INSTANCE STATUS mysqld1; -instance_name status version -mysqld1 online VERSION -SHOW INSTANCE STATUS mysqld2; -instance_name status version -mysqld2 offline VERSION +Success: the process has been stopped. + +-------------------------------------------------------------------- +-- 1.1.4. +-------------------------------------------------------------------- START INSTANCE mysqld3; ERROR HY000: Bad instance name. Check that the instance with such a name exists START INSTANCE mysqld1; ERROR HY000: The instance is already started + +-------------------------------------------------------------------- +-- 1.1.5. +-------------------------------------------------------------------- STOP INSTANCE mysqld3; ERROR HY000: Bad instance name. Check that the instance with such a name exists + +-------------------------------------------------------------------- +-- 1.1.6. +-------------------------------------------------------------------- SHOW INSTANCES; instance_name status mysqld1 online @@ -50,20 +51,25 @@ SHOW INSTANCES; instance_name status mysqld1 online mysqld2 offline + +-------------------------------------------------------------------- +-- 1.1.7. +-------------------------------------------------------------------- START INSTANCE mysqld2; -SHOW INSTANCES; -instance_name status -mysqld1 online -mysqld2 online +Success: the process has been started. Killing the process... Sleeping... Success: the process was killed. -SHOW INSTANCES; -instance_name status -mysqld1 online -mysqld2 offline + +-------------------------------------------------------------------- +-- 1.1.8. +-------------------------------------------------------------------- SHOW INSTANCE STATUS; ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use + +-------------------------------------------------------------------- +-- BUG#12813 +-------------------------------------------------------------------- START INSTANCE mysqld1,mysqld2,mysqld3; ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use STOP INSTANCE mysqld1,mysqld2,mysqld3; diff --git a/mysql-test/r/im_utils.result b/mysql-test/r/im_utils.result index fbfaeaebcac..e6a5e007ed4 100644 --- a/mysql-test/r/im_utils.result +++ b/mysql-test/r/im_utils.result @@ -1,3 +1,4 @@ +Success: the process has been started. SHOW INSTANCES; instance_name status mysqld1 online @@ -42,7 +43,9 @@ skip-innodb VALUE skip-bdb VALUE skip-ndbcluster VALUE START INSTANCE mysqld2; +Success: the process has been started. STOP INSTANCE mysqld2; +Success: the process has been stopped. SHOW mysqld1 LOG FILES; Logfile Path File size ERROR LOG PATH FILE_SIZE diff --git a/mysql-test/t/im_daemon_life_cycle-im.opt b/mysql-test/t/im_daemon_life_cycle-im.opt index 21c01191e4c..3a45c7a41f7 100644 --- a/mysql-test/t/im_daemon_life_cycle-im.opt +++ b/mysql-test/t/im_daemon_life_cycle-im.opt @@ -1,2 +1,3 @@ --run-as-service --log=$MYSQLTEST_VARDIR/log/im.log +--monitoring-interval=1 diff --git a/mysql-test/t/im_daemon_life_cycle.imtest b/mysql-test/t/im_daemon_life_cycle.imtest index 87388d7c1e6..3afc36935f8 100644 --- a/mysql-test/t/im_daemon_life_cycle.imtest +++ b/mysql-test/t/im_daemon_life_cycle.imtest @@ -10,6 +10,22 @@ ########################################################################### +# Wait for mysqld1 (guarded instance) to start. + +--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD1_PATH_PID 30 started + +# Let IM detect that mysqld1 is online. This delay should be longer than +# monitoring interval. + +--sleep 3 + +# Check that start conditions are as expected. + SHOW INSTANCES; ---exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_PATH_PID restarted +########################################################################### + +# Kill the IM main process and check that the IM Angel will restart the main +# process. + +--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_PATH_PID restarted 30 diff --git a/mysql-test/t/im_life_cycle-im.opt b/mysql-test/t/im_life_cycle-im.opt new file mode 100644 index 00000000000..34b74ce0c95 --- /dev/null +++ b/mysql-test/t/im_life_cycle-im.opt @@ -0,0 +1 @@ +--monitoring-interval=1 diff --git a/mysql-test/t/im_life_cycle.imtest b/mysql-test/t/im_life_cycle.imtest index 445ae7f72fa..2cbe53a7b28 100644 --- a/mysql-test/t/im_life_cycle.imtest +++ b/mysql-test/t/im_life_cycle.imtest @@ -17,11 +17,23 @@ # ########################################################################### +--echo +--echo -------------------------------------------------------------------- +--echo -- 1.1.1. +--echo -------------------------------------------------------------------- + +# Wait for mysqld1 (guarded instance) to start. + +--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD1_PATH_PID 30 started + +# Let IM detect that mysqld1 is online. This delay should be longer than +# monitoring interval. + +--sleep 3 + +# Check that start conditions are as expected. + SHOW INSTANCES; ---replace_column 3 VERSION -SHOW INSTANCE STATUS mysqld1; ---replace_column 3 VERSION -SHOW INSTANCE STATUS mysqld2; ########################################################################### # @@ -33,20 +45,24 @@ SHOW INSTANCE STATUS mysqld2; # ########################################################################### +--echo +--echo -------------------------------------------------------------------- +--echo -- 1.1.2. +--echo -------------------------------------------------------------------- + START INSTANCE mysqld2; -# FIXME ---sleep 3 +# FIXME: START INSTANCE should be synchronous. +--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started -SHOW INSTANCES; ---replace_column 3 VERSION -SHOW INSTANCE STATUS mysqld1; ---replace_column 3 VERSION -SHOW INSTANCE STATUS mysqld2; +# FIXME: SHOW INSTANCES is not deterministic unless START INSTANCE is +# synchronous. Even waiting for mysqld to start by looking at its pid file is +# not enough, because IM may not detect that mysqld has started. +# SHOW INSTANCES; ---connect (mysql_con,localhost,root,,mysql,$IM_MYSQLD1_PORT,$IM_MYSQLD1_SOCK) +--connect (mysql_con,localhost,root,,mysql,$IM_MYSQLD2_PORT,$IM_MYSQLD2_SOCK) --connection mysql_con ---replace_result $IM_MYSQLD1_PORT IM_MYSQLD1_PORT +--replace_result $IM_MYSQLD2_PORT IM_MYSQLD2_PORT SHOW VARIABLES LIKE 'port'; --connection default @@ -61,15 +77,19 @@ SHOW VARIABLES LIKE 'port'; # ########################################################################### -STOP INSTANCE mysqld2; -# FIXME ---sleep 3 +--echo +--echo -------------------------------------------------------------------- +--echo -- 1.1.3. +--echo -------------------------------------------------------------------- -SHOW INSTANCES; ---replace_column 3 VERSION -SHOW INSTANCE STATUS mysqld1; ---replace_column 3 VERSION -SHOW INSTANCE STATUS mysqld2; +STOP INSTANCE mysqld2; +# FIXME: STOP INSTANCE should be synchronous. +--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 stopped + +# FIXME: SHOW INSTANCES is not deterministic unless START INSTANCE is +# synchronous. Even waiting for mysqld to start by looking at its pid file is +# not enough, because IM may not detect that mysqld has started. +# SHOW INSTANCES; ########################################################################### # @@ -81,16 +101,17 @@ SHOW INSTANCE STATUS mysqld2; # ########################################################################### ---error 3000 +--echo +--echo -------------------------------------------------------------------- +--echo -- 1.1.4. +--echo -------------------------------------------------------------------- + +--error 3000 # ER_BAD_INSTANCE_NAME START INSTANCE mysqld3; ---error 3002 +--error 3002 # ER_INSTANCE_ALREADY_STARTED START INSTANCE mysqld1; -# FIXME TODO -# BUG#12813: START/STOP INSTANCE commands accept a list as argument -# START INSTANCE mysqld1, mysqld2; - ########################################################################### # # 1.1.5. Check that Instance Manager reports correct errors for 'STOP INSTANCE' @@ -101,27 +122,40 @@ START INSTANCE mysqld1; # ########################################################################### ---error 3000 +--echo +--echo -------------------------------------------------------------------- +--echo -- 1.1.5. +--echo -------------------------------------------------------------------- + +--error 3000 # ER_BAD_INSTANCE_NAME STOP INSTANCE mysqld3; # TODO: IM should be fixed. # BUG#12673: Instance Manager allows to stop the instance many times -# --error 3002 +# --error 3002 # ER_INSTANCE_ALREADY_STARTED # STOP INSTANCE mysqld2; -# FIXME TODO -# BUG#12813: START/STOP INSTANCE commands accept a list as argument -# STOP INSTANCE mysqld1, mysqld2; - ########################################################################### # # 1.1.6. Check that Instance Manager is able to restart guarded instances. # ########################################################################### +--echo +--echo -------------------------------------------------------------------- +--echo -- 1.1.6. +--echo -------------------------------------------------------------------- + SHOW INSTANCES; ---exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD1_PATH_PID restarted +--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD1_PATH_PID restarted 30 + +# Give some time to IM to detect that mysqld was restarted. It should be longer +# than monitoring interval. + +--sleep 3 + +SHOW INSTANCES; ########################################################################### # @@ -129,17 +163,26 @@ SHOW INSTANCES; # ########################################################################### -SHOW INSTANCES; +--echo +--echo -------------------------------------------------------------------- +--echo -- 1.1.7. +--echo -------------------------------------------------------------------- START INSTANCE mysqld2; -# FIXME ---sleep 3 +# FIXME: START INSTANCE should be synchronous. +--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started -SHOW INSTANCES; +# FIXME: SHOW INSTANCES is not deterministic unless START INSTANCE is +# synchronous. Even waiting for mysqld to start by looking at its pid file is +# not enough, because IM may not detect that mysqld has started. +# SHOW INSTANCES; ---exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD2_PATH_PID killed +--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD2_PATH_PID killed 10 -SHOW INSTANCES; +# FIXME: SHOW INSTANCES is not deterministic unless START INSTANCE is +# synchronous. Even waiting for mysqld to start by looking at its pid file is +# not enough, because IM may not detect that mysqld has started. +# SHOW INSTANCES; ########################################################################### # @@ -147,7 +190,13 @@ SHOW INSTANCES; # incomplete SHOW INSTANCE STATUS command. # ########################################################################### ---error 1149 + +--echo +--echo -------------------------------------------------------------------- +--echo -- 1.1.8. +--echo -------------------------------------------------------------------- + +--error ER_SYNTAX_ERROR SHOW INSTANCE STATUS; # @@ -159,8 +208,13 @@ SHOW INSTANCE STATUS; # a list as argument. # ---error 1149 +--echo +--echo -------------------------------------------------------------------- +--echo -- BUG#12813 +--echo -------------------------------------------------------------------- + +--error ER_SYNTAX_ERROR START INSTANCE mysqld1,mysqld2,mysqld3; ---error 1149 +--error ER_SYNTAX_ERROR STOP INSTANCE mysqld1,mysqld2,mysqld3; diff --git a/mysql-test/t/im_utils-im.opt b/mysql-test/t/im_utils-im.opt new file mode 100644 index 00000000000..34b74ce0c95 --- /dev/null +++ b/mysql-test/t/im_utils-im.opt @@ -0,0 +1 @@ +--monitoring-interval=1 diff --git a/mysql-test/t/im_utils.imtest b/mysql-test/t/im_utils.imtest index dc6fb93c4ff..47902eeba52 100644 --- a/mysql-test/t/im_utils.imtest +++ b/mysql-test/t/im_utils.imtest @@ -17,6 +17,17 @@ # - the second instance is offline; # +# Wait for mysqld1 (guarded instance) to start. + +--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD1_PATH_PID 30 started + +# Let IM detect that mysqld1 is online. This delay should be longer than +# monitoring interval. + +--sleep 3 + +# Check that start conditions are as expected. + SHOW INSTANCES; # @@ -40,11 +51,10 @@ SHOW INSTANCE OPTIONS mysqld2; # START INSTANCE mysqld2; - -# FIXME --- sleep 3 +--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started STOP INSTANCE mysqld2; +--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 stopped # # Check 'SHOW LOG FILES' command: diff --git a/mysql-test/t/kill_n_check.sh b/mysql-test/t/kill_n_check.sh index e722b3a180d..64cc869d1ec 100755 --- a/mysql-test/t/kill_n_check.sh +++ b/mysql-test/t/kill_n_check.sh @@ -1,66 +1,115 @@ #!/bin/sh -if [ $# -ne 2 ]; then - echo "Usage: kill_n_check.sh killed|restarted" +########################################################################### + +# NOTE: this script returns 0 (success) even in case of failure. This is +# because this script is executed under mysql-test-run[.pl] and it's better to +# examine particular problem in log file, than just having said that the test +# case has failed. + +########################################################################### + +check_restart() +{ + if [ ! -r "$pid_path" ]; then + user_msg='the process was killed' + return 1 + fi + + new_pid=`cat "$pid_path" 2>/dev/null` + + if [ $? -eq 0 -a "$original_pid" = "$new_pid" ]; then + user_msg='the process was not restarted' + return 1 + fi + + user_msg='the process was restarted' + return 0 +} + +########################################################################### + +if [ $# -ne 3 ]; then + echo "Usage: kill_n_check.sh killed|restarted " exit 0 fi pid_path="$1" expected_result="$2" +total_timeout="$3" -if [ -z "$pid_path" -o ! -r "$pid_path" ]; then - echo "Error: invalid PID path ($pid_path) or PID file does not exist." +if [ "$expected_result" != 'killed' -a \ + "$expected_result" != 'restarted' ]; then + echo "Error: invalid second argument ('killed' or 'restarted' expected)." exit 0 fi -if [ "$expected_result" != "killed" -a \ - "$expected_result" != "restarted" ]; then - echo "Error: expected result must be either 'killed' or 'restarted'." +if [ -z "$pid_path" ]; then + echo "Error: invalid PID path ($pid_path)." exit 0 fi -# echo "PID path: '$pid_path'" +if [ $expected_result = 'killed' -a ! -r "$pid_path" ]; then + echo "Error: PID file ($pid_path) does not exist." + exit 0 +fi + +if [ -z "$total_timeout" ]; then + echo "Error: timeout is not specified." + exit 0 +fi + +########################################################################### original_pid=`cat "$pid_path"` -# echo "Original PID: $original_pid" - echo "Killing the process..." kill -9 $original_pid +########################################################################### + echo "Sleeping..." -sleep 3 - -new_pid="" - -[ -r "$pid_path" ] && new_pid=`cat "$pid_path"` - -# echo "New PID: $new_pid" - if [ "$expected_result" = "restarted" ]; then - if [ -z "$new_pid" ]; then - echo "Error: the process was killed." - exit 0 - fi + # Wait for the process to restart. - if [ "$original_pid" -eq "$new_pid" ]; then - echo "Error: the process was not restarted." - exit 0 - fi - - echo "Success: the process was restarted." + cur_attempt=1 + + while true; do + + if check_restart; then + echo "Success: $user_msg." + exit 0 + fi + + [ $cur_attempt -ge $total_timeout ] && break + + sleep 1 + + cur_attempt=`expr $cur_attempt + 1` + + done + + echo "Error: $user_msg." exit 0 - -else # $expected_result = killed - + +else # $expected_result == killed + + # Here we have to sleep for some long time to ensure that the process will + # not be restarted. + + sleep $total_timeout + + new_pid=`cat "$pid_path" 2>/dev/null` + if [ "$new_pid" -a "$new_pid" -ne "$original_pid" ]; then echo "Error: the process was restarted." - exit 0 + else + echo "Success: the process was killed." fi - echo "Success: the process was killed." exit 0 + fi diff --git a/mysql-test/t/wait_for_process.sh b/mysql-test/t/wait_for_process.sh new file mode 100755 index 00000000000..df0f4a17e3a --- /dev/null +++ b/mysql-test/t/wait_for_process.sh @@ -0,0 +1,66 @@ +#!/bin/sh + +########################################################################### + +pid_path="$1" +total_attempts="$2" +event="$3" + +case "$3" in + started) + check_fn='check_started'; + ;; + + stopped) + check_fn='check_stopped'; + ;; + + *) + echo "Error: invalid third argument ('started' or 'stopped' expected)." + exit 0 +esac + +########################################################################### + +check_started() +{ + [ ! -r "$pid_path" ] && return 1 + + new_pid=`cat "$pid_path" 2>/dev/null` + + [ $? -eq 0 -a "$original_pid" = "$new_pid" ] && return 1 + + return 0 +} + +########################################################################### + +check_stopped() +{ + [ -r "$pid_path" ] && return 1 + + return 0 +} + +########################################################################### + +cur_attempt=1 + +while true; do + + if ( eval $check_fn ); then + echo "Success: the process has been $event." + exit 0 + fi + + [ $cur_attempt -ge $total_attempts ] && break + + sleep 1 + + cur_attempt=`expr $cur_attempt + 1` + +done + +echo "Error: the process has not been $event in $total_attempts secs." +exit 0 + From a142a4d97bdb82351852a1c78afa611f4cc8946a Mon Sep 17 00:00:00 2001 From: "anozdrin@mysql.com" <> Date: Mon, 19 Jun 2006 14:15:26 +0400 Subject: [PATCH 20/39] Small fix for test suite: - fix for IM stopping routine; - polishing. --- mysql-test/lib/mtr_process.pl | 17 ++++++++--- mysql-test/mysql-test-run.pl | 54 +++++++++++++++++++++++++++++++---- 2 files changed, 61 insertions(+), 10 deletions(-) diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl index 6fa6bc73bdb..0ca16b61fc2 100644 --- a/mysql-test/lib/mtr_process.pl +++ b/mysql-test/lib/mtr_process.pl @@ -890,19 +890,28 @@ sub mtr_kill_processes ($) { sub mtr_kill_process ($$$$) { my $pid= shift; my $signal= shift; - my $retries= shift; + my $total_retries= shift; my $timeout= shift; - while (1) + for (my $cur_attempt= 1; $cur_attempt <= $total_retries; ++$cur_attempt) { + mtr_debug("Sending $signal to $pid..."); + kill($signal, $pid); - last unless kill (0, $pid) and $retries--; + unless (kill (0, $pid)) + { + mtr_debug("Process $pid died."); + return; + } - mtr_debug("Sleep $timeout second waiting for processes to die"); + mtr_debug("Sleeping $timeout second(s) waiting for processes to die..."); sleep($timeout); } + + mtr_debug("Process $pid is still alive after $total_retries " . + "of sending signal $signal."); } ############################################################################## diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 4a9628c0721..24e0cbb6699 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -2843,22 +2843,58 @@ sub im_stop($) { # Try graceful shutdown. + mtr_debug("IM-main pid: $instance_manager->{'pid'}"); + mtr_debug("Stopping IM-main..."); + mtr_kill_process($instance_manager->{'pid'}, 'TERM', 10, 1); + # If necessary, wait for angel process to die. + + if (defined $instance_manager->{'angel_pid'}) + { + mtr_debug("IM-angel pid: $instance_manager->{'angel_pid'}"); + mtr_debug("Waiting for IM-angel to die..."); + + my $total_attempts= 10; + + for (my $cur_attempt=1; $cur_attempt <= $total_attempts; ++$cur_attempt) + { + unless (kill (0, $instance_manager->{'angel_pid'})) + { + mtr_debug("IM-angel died."); + last; + } + + sleep(1); + } + } + # Check that all processes died. my $clean_shutdown= 0; while (1) { - last if kill (0, $instance_manager->{'pid'}); + if (kill (0, $instance_manager->{'pid'})) + { + mtr_debug("IM-main is still alive."); + last; + } - last if (defined $instance_manager->{'angel_pid'}) && - kill (0, $instance_manager->{'angel_pid'}); + if (defined $instance_manager->{'angel_pid'} && + kill (0, $instance_manager->{'angel_pid'})) + { + mtr_debug("IM-angel is still alive."); + last; + } foreach my $pid (@mysqld_pids) { - last if kill (0, $pid); + if (kill (0, $pid)) + { + mtr_debug("Guarded mysqld ($pid) is still alive."); + last; + } } $clean_shutdown= 1; @@ -2869,15 +2905,21 @@ sub im_stop($) { unless ($clean_shutdown) { - mtr_kill_process($instance_manager->{'angel_pid'}, 'KILL', 10, 1) - if defined $instance_manager->{'angel_pid'}; + + if (defined $instance_manager->{'angel_pid'}) + { + mtr_debug("Killing IM-angel..."); + mtr_kill_process($instance_manager->{'angel_pid'}, 'KILL', 10, 1) + } + mtr_debug("Killing IM-main..."); mtr_kill_process($instance_manager->{'pid'}, 'KILL', 10, 1); # Shutdown managed mysqld-processes. Some of them may be nonguarded, so IM # will not stop them on shutdown. So, we should firstly try to end them # legally. + mtr_debug("Killing guarded mysqld(s)..."); mtr_kill_processes(\@mysqld_pids); # Complain in error log so that a warning will be shown. From a992833d837cc77b6749ae8b468d0b596a84d7e8 Mon Sep 17 00:00:00 2001 From: "anozdrin@mysql.com" <> Date: Mon, 19 Jun 2006 14:16:10 +0400 Subject: [PATCH 21/39] The second fix for BUG#19391: IM fails to start after two executions. --- server-tools/instance-manager/guardian.cc | 3 -- server-tools/instance-manager/instance_map.cc | 2 +- server-tools/instance-manager/manager.cc | 43 +++++++++++++------ 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/server-tools/instance-manager/guardian.cc b/server-tools/instance-manager/guardian.cc index fa9d877fde6..24844e05776 100644 --- a/server-tools/instance-manager/guardian.cc +++ b/server-tools/instance-manager/guardian.cc @@ -271,10 +271,7 @@ int Guardian_thread::init() { if (!(instance->options.nonguarded)) if (guard(instance, TRUE)) /* do not lock guardian */ - { - instance_map->unlock(); return 1; - } } return 0; diff --git a/server-tools/instance-manager/instance_map.cc b/server-tools/instance-manager/instance_map.cc index 543c9c31bfa..3b7f58d8a09 100644 --- a/server-tools/instance-manager/instance_map.cc +++ b/server-tools/instance-manager/instance_map.cc @@ -215,7 +215,7 @@ int Instance_map::flush_instances() hash_init(&hash, default_charset_info, START_HASH_SIZE, 0, 0, get_instance_key, delete_instance, 0); rc= load(); - guardian->init(); + guardian->init(); // TODO: check error status. pthread_mutex_unlock(&LOCK_instance_map); guardian->unlock(); return rc; diff --git a/server-tools/instance-manager/manager.cc b/server-tools/instance-manager/manager.cc index 00ef50a84e1..353dfcf64dc 100644 --- a/server-tools/instance-manager/manager.cc +++ b/server-tools/instance-manager/manager.cc @@ -147,6 +147,25 @@ void manager(const Options &options) if (create_pid_file(options.pid_file_name, manager_pid)) return; + /* + Initialize signals and alarm-infrastructure. + + NOTE: To work nicely with LinuxThreads, the signal thread is the first + thread in the process. + + NOTE: + After init_thr_alarm() call it's possible to call thr_alarm() (from + different threads), that results in sending ALARM signal to the alarm + thread (which can be the main thread). That signal can interrupt + blocking calls. + + In other words, a blocking call can be interrupted in the main thread + after init_thr_alarm(). + */ + + sigset_t mask; + set_signals(&mask); + /* create guardian thread */ { pthread_t guardian_thd_id; @@ -154,9 +173,16 @@ void manager(const Options &options) int rc; /* - NOTE: Guardian should be shutdown first. Only then all other threads - need to be stopped. This should be done, as guardian is responsible for - shutting down the instances, and this is a long operation. + NOTE: Guardian should be shutdown first. Only then all other threads + need to be stopped. This should be done, as guardian is responsible + for shutting down the instances, and this is a long operation. + + NOTE: Guardian uses thr_alarm() when detects current state of + instances (is_running()), but it is not interfere with + flush_instances() later in the code, because until flush_instances() + complete in the main thread, Guardian thread is not permitted to + process instances. And before flush_instances() there is no instances + to proceed. */ pthread_attr_init(&guardian_thd_attr); @@ -172,10 +198,8 @@ void manager(const Options &options) } - /* - To work nicely with LinuxThreads, the signal thread is the first thread - in the process. - */ + /* Load instances. */ + int signo; bool shutdown_complete; @@ -189,11 +213,6 @@ void manager(const Options &options) return; } - /* Initialize signals and alarm-infrastructure. */ - - sigset_t mask; - set_signals(&mask); - /* create the listener */ { pthread_t listener_thd_id; From 3b6397b1d21fa2965693d13933192c5b8d708f84 Mon Sep 17 00:00:00 2001 From: "anozdrin@mysql.com" <> Date: Mon, 19 Jun 2006 14:41:29 +0400 Subject: [PATCH 22/39] WL#3298: IM: make command-line option names consistent 1. Removed '-P' command line option; 2. Renamed '--passwd' command line option to '--print-password-line'. --- mysql-test/t/im_cmd_line.imtest | 4 ++-- server-tools/instance-manager/options.cc | 12 ++++++------ .../instance-manager/user_management_commands.cc | 4 ++-- .../instance-manager/user_management_commands.h | 7 ++++--- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/mysql-test/t/im_cmd_line.imtest b/mysql-test/t/im_cmd_line.imtest index 00e8351535e..29ed420439d 100644 --- a/mysql-test/t/im_cmd_line.imtest +++ b/mysql-test/t/im_cmd_line.imtest @@ -26,7 +26,7 @@ --echo --echo --> Printing out line for 'testuser'... ---exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --passwd --username=testuser --password=abc | tail -1 +--exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --print-password-line --username=testuser --password=abc | tail -1 --echo --echo --> Listing users... @@ -45,7 +45,7 @@ --echo --echo --> Printing out line for 'testuser'... ---exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --passwd --username=testuser --password=xyz | tail -1 +--exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --print-password-line --username=testuser --password=xyz | tail -1 --echo --echo --> Listing users... diff --git a/server-tools/instance-manager/options.cc b/server-tools/instance-manager/options.cc index 31ce5b00190..07a1fd3e932 100644 --- a/server-tools/instance-manager/options.cc +++ b/server-tools/instance-manager/options.cc @@ -114,7 +114,6 @@ static const int ANGEL_PID_FILE_SUFFIX_LEN= strlen(ANGEL_PID_FILE_SUFFIX); */ enum options { - OPT_PASSWD= 'P', OPT_USERNAME= 'u', OPT_PASSWORD= 'p', OPT_LOG= 256, @@ -135,6 +134,7 @@ enum options { OPT_PORT, OPT_WAIT_TIMEOUT, OPT_BIND_ADDRESS, + OPT_PRINT_PASSWORD_LINE, OPT_ADD_USER, OPT_DROP_USER, OPT_EDIT_USER, @@ -225,8 +225,8 @@ static struct my_option my_long_options[] = (gptr *) &Options::Main::mysqld_safe_compatible, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 0, 0 }, - { "passwd", OPT_PASSWD, - "Prepare an entry for the password file and exit.", + { "print-password-line", OPT_PRINT_PASSWORD_LINE, + "Print out a user entry as a line for the password file and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "password", OPT_PASSWORD, "Password to update the password file", @@ -339,7 +339,7 @@ get_one_option(int optid, case 'V': version(); exit(0); - case OPT_PASSWD: + case OPT_PRINT_PASSWORD_LINE: case OPT_ADD_USER: case OPT_DROP_USER: case OPT_EDIT_USER: @@ -354,8 +354,8 @@ get_one_option(int optid, } switch (optid) { - case OPT_PASSWD: - Options::User_management::cmd= new Passwd_cmd(); + case OPT_PRINT_PASSWORD_LINE: + Options::User_management::cmd= new Print_password_line_cmd(); break; case OPT_ADD_USER: Options::User_management::cmd= new Add_user_cmd(); diff --git a/server-tools/instance-manager/user_management_commands.cc b/server-tools/instance-manager/user_management_commands.cc index 03a3f9814e3..20ebeb0d6bf 100644 --- a/server-tools/instance-manager/user_management_commands.cc +++ b/server-tools/instance-manager/user_management_commands.cc @@ -180,10 +180,10 @@ static int save_password_file(User_map *user_map) } /************************************************************************* - Passwd_cmd + Print_password_line_cmd *************************************************************************/ -int Passwd_cmd::execute() +int Print_password_line_cmd::execute() { LEX_STRING user_name; const char *password; diff --git a/server-tools/instance-manager/user_management_commands.h b/server-tools/instance-manager/user_management_commands.h index 4bf3546f0a6..8d820be5ec7 100644 --- a/server-tools/instance-manager/user_management_commands.h +++ b/server-tools/instance-manager/user_management_commands.h @@ -61,13 +61,14 @@ public: /************************************************************************* - Passwd_cmd: support for --passwd command-line option. + Print_password_line_cmd: support for --print-password-line command-line + option. *************************************************************************/ -class Passwd_cmd : public User_management_cmd +class Print_password_line_cmd : public User_management_cmd { public: - Passwd_cmd() + Print_password_line_cmd() { } public: From 7ecfadbcf29ce934e54dd987feb5dfd6a9797aa7 Mon Sep 17 00:00:00 2001 From: "anozdrin@mysql.com" <> Date: Mon, 19 Jun 2006 15:17:15 +0400 Subject: [PATCH 23/39] Polishing: C_STRING_WITH_SIZE() was renamed to C_STRING_WITH_LEN(). --- include/m_string.h | 2 +- server-tools/instance-manager/commands.cc | 6 +++--- server-tools/instance-manager/instance.cc | 2 +- server-tools/instance-manager/instance_options.cc | 6 +++--- server-tools/instance-manager/priv.cc | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/m_string.h b/include/m_string.h index 9f7ec220f2c..e009447c192 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -256,6 +256,6 @@ typedef struct } LEX_STRING; #define STRING_WITH_LEN(X) (X), ((uint) (sizeof(X) - 1)) -#define C_STRING_WITH_SIZE(X) ((char *) (X)), ((uint) (sizeof(X) - 1)) +#define C_STRING_WITH_LEN(X) ((char *) (X)), ((uint) (sizeof(X) - 1)) #endif diff --git a/server-tools/instance-manager/commands.cc b/server-tools/instance-manager/commands.cc index 07e1e9a18f3..f45b230171e 100644 --- a/server-tools/instance-manager/commands.cc +++ b/server-tools/instance-manager/commands.cc @@ -695,7 +695,7 @@ bool Create_instance::parse_args(const char **text) if (!option_value_str) { - LEX_STRING empty_str= { C_STRING_WITH_SIZE("") }; + LEX_STRING empty_str= { C_STRING_WITH_LEN("") }; if (!(option_value_str= Named_value::alloc_str(&empty_str))) return TRUE; /* out of memory during parsing. */ @@ -1511,7 +1511,7 @@ bool Set_option::parse_args(const char **text) if (!option_value_str) { - LEX_STRING empty_str= { C_STRING_WITH_SIZE("") }; + LEX_STRING empty_str= { C_STRING_WITH_LEN("") }; if (!(option_value_str= Named_value::alloc_str(&empty_str))) return TRUE; /* out of memory during parsing. */ @@ -1650,7 +1650,7 @@ bool Unset_option::parse_args(const char **text) return TRUE; /* out of memory during parsing. */ { - LEX_STRING empty_str= { C_STRING_WITH_SIZE("") }; + LEX_STRING empty_str= { C_STRING_WITH_LEN("") }; if (!(option_value_str= Named_value::alloc_str(&empty_str))) { diff --git a/server-tools/instance-manager/instance.cc b/server-tools/instance-manager/instance.cc index 456052bf7e5..340a2d67353 100644 --- a/server-tools/instance-manager/instance.cc +++ b/server-tools/instance-manager/instance.cc @@ -37,7 +37,7 @@ const LEX_STRING -Instance::DFLT_INSTANCE_NAME= { C_STRING_WITH_SIZE("mysqld") }; +Instance::DFLT_INSTANCE_NAME= { C_STRING_WITH_LEN("mysqld") }; static const char * const INSTANCE_NAME_PREFIX= Instance::DFLT_INSTANCE_NAME.str; static const int INSTANCE_NAME_PREFIX_LEN= Instance::DFLT_INSTANCE_NAME.length; diff --git a/server-tools/instance-manager/instance_options.cc b/server-tools/instance-manager/instance_options.cc index b05e40734b7..7b3f435eae5 100644 --- a/server-tools/instance-manager/instance_options.cc +++ b/server-tools/instance-manager/instance_options.cc @@ -120,7 +120,7 @@ int Instance_options::get_default_option(char *result, size_t result_len, { int rc= 1; LEX_STRING verbose_option= - { C_STRING_WITH_SIZE(" --no-defaults --verbose --help") }; + { C_STRING_WITH_LEN(" --no-defaults --verbose --help") }; /* reserve space for the path + option + final '\0' */ Buffer cmd(mysqld_path.length + verbose_option.length + 1); @@ -155,7 +155,7 @@ int Instance_options::fill_instance_version() { char result[MAX_VERSION_LENGTH]; LEX_STRING version_option= - { C_STRING_WITH_SIZE(" --no-defaults --version") }; + { C_STRING_WITH_LEN(" --no-defaults --version") }; int rc= 1; Buffer cmd(mysqld_path.length + version_option.length + 1); @@ -210,7 +210,7 @@ int Instance_options::fill_mysqld_real_path() { char result[FN_REFLEN]; LEX_STRING help_option= - { C_STRING_WITH_SIZE(" --no-defaults --help") }; + { C_STRING_WITH_LEN(" --no-defaults --help") }; int rc= 1; Buffer cmd(mysqld_path.length + help_option.length); diff --git a/server-tools/instance-manager/priv.cc b/server-tools/instance-manager/priv.cc index d3cc52ec638..3dae900d84b 100644 --- a/server-tools/instance-manager/priv.cc +++ b/server-tools/instance-manager/priv.cc @@ -43,7 +43,7 @@ bool linuxthreads; The following string must be less then 80 characters, as mysql_connection.cc relies on it */ -const LEX_STRING mysqlmanager_version= { C_STRING_WITH_SIZE("1.0-beta") }; +const LEX_STRING mysqlmanager_version= { C_STRING_WITH_LEN("1.0-beta") }; const unsigned char protocol_version= PROTOCOL_VERSION; From 2c28b3cbf1383d46c31e42dffed6458082a4b3e5 Mon Sep 17 00:00:00 2001 From: "svoj@may.pils.ru" <> Date: Mon, 19 Jun 2006 17:50:52 +0500 Subject: [PATCH 24/39] Addition to fix for BUG#18036 - update of table joined to self reports table as crashed Set exclude_from_table_unique_test value back to FALSE. It is needed for further check in multi_update::prepare whether to use record cache. --- sql/sql_update.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 9c5e98f4424..c2b7624c9e7 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -859,7 +859,12 @@ reopen_tables: } } } - + /* + Set exclude_from_table_unique_test value back to FALSE. It is needed for + further check in multi_update::prepare whether to use record cache. + */ + lex->select_lex.exclude_from_table_unique_test= FALSE; + if (thd->fill_derived_tables() && mysql_handle_derived(lex, &mysql_derived_filling)) DBUG_RETURN(TRUE); From 917203ddd7076b4dcaf1dc4537897ccfbc98cab7 Mon Sep 17 00:00:00 2001 From: "stewart@mysql.com" <> Date: Tue, 20 Jun 2006 00:30:19 +1000 Subject: [PATCH 25/39] BUG#20073 information_schema.FILES for UNDO LOG give incorrect EXTENT_SIZE, FREE_EXTENTS, --- sql/ha_ndbcluster.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 2d623702670..6c66ba620c9 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -10364,7 +10364,7 @@ static int ndbcluster_fill_files_table(THD *thd, TABLE_LIST *tables, table->field[c++]->set_null(); // DELETED_ROWS table->field[c++]->set_null(); // UPDATE_COUNT table->field[c++]->store(lfg.getUndoFreeWords()); // FREE_EXTENTS - table->field[c++]->store(lfg.getUndoBufferSize()); // TOTAL_EXTENTS + table->field[c++]->store(uf.getSize()/4); // TOTAL_EXTENTS table->field[c++]->store(4); // EXTENT_SIZE table->field[c++]->store(uf.getSize()); // INITIAL_SIZE @@ -10394,8 +10394,8 @@ static int ndbcluster_fill_files_table(THD *thd, TABLE_LIST *tables, table->field[c++]->store("NORMAL", 6, system_charset_info); - char extra[30]; - int len= my_snprintf(extra,sizeof(extra),"CLUSTER_NODE=%u",id); + char extra[100]; + int len= my_snprintf(extra,sizeof(extra),"CLUSTER_NODE=%u;UNDO_BUFFER_SIZE=%lu",id,lfg.getUndoBufferSize()); table->field[c]->store(extra, len, system_charset_info); schema_table_store_record(thd, table); } From 9c324f32e7f70796a3e170bdd69d7d4784065774 Mon Sep 17 00:00:00 2001 From: "evgen@moonbone.local" <> Date: Mon, 19 Jun 2006 20:21:00 +0400 Subject: [PATCH 26/39] rpl_row_log.result, rpl_row_log_innodb.result: Fixed failing test case --- mysql-test/r/rpl_row_log.result | 16 ++++++++++++++++ mysql-test/r/rpl_row_log_innodb.result | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/mysql-test/r/rpl_row_log.result b/mysql-test/r/rpl_row_log.result index 65e9ee9fb9f..609f9376efd 100644 --- a/mysql-test/r/rpl_row_log.result +++ b/mysql-test/r/rpl_row_log.result @@ -100,3 +100,19 @@ ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find tar DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; +create table t1(a int auto_increment primary key, b int); +insert into t1 values (NULL, 1); +reset master; +set insert_id=5; +insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id()); +show binlog events; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 +slave-bin.000001 # Table_map 2 # table_id: 21 (test.t1) +slave-bin.000001 # Write_rows 2 # table_id: 21 flags: STMT_END_F +select * from t1; +a b +1 1 +5 1 +6 1 +drop table t1; diff --git a/mysql-test/r/rpl_row_log_innodb.result b/mysql-test/r/rpl_row_log_innodb.result index 2c89ca5f8ff..b47dff40454 100644 --- a/mysql-test/r/rpl_row_log_innodb.result +++ b/mysql-test/r/rpl_row_log_innodb.result @@ -108,3 +108,19 @@ ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find tar DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; +create table t1(a int auto_increment primary key, b int); +insert into t1 values (NULL, 1); +reset master; +set insert_id=5; +insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id()); +show binlog events; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 +slave-bin.000001 # Table_map 2 # table_id: 21 (test.t1) +slave-bin.000001 # Write_rows 2 # table_id: 21 flags: STMT_END_F +select * from t1; +a b +1 1 +5 1 +6 1 +drop table t1; From 0d7ea0acd4edd4cd8760f173976237a2968c94b7 Mon Sep 17 00:00:00 2001 From: "stewart@mysql.com" <> Date: Tue, 20 Jun 2006 14:24:52 +1000 Subject: [PATCH 27/39] fix test result after BUG#20073 fix --- mysql-test/r/ndb_dd_dump.result | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/r/ndb_dd_dump.result b/mysql-test/r/ndb_dd_dump.result index 6572f0228d0..52e88b7db86 100644 --- a/mysql-test/r/ndb_dd_dump.result +++ b/mysql-test/r/ndb_dd_dump.result @@ -172,7 +172,7 @@ INITIAL_SIZE, ENGINE FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE="UNDO LOG" ORDER BY FILE_NAME; LOGFILE_GROUP_NAME FILE_NAME TOTAL_EXTENTS INITIAL_SIZE ENGINE -lg1 undofile_lg1_01.dat 1048576 2097152 ndbcluster +lg1 undofile_lg1_01.dat 524288 2097152 ndbcluster lg1 undofile_lg1_02.dat 1048576 4194304 ndbcluster SELECT DISTINCT TABLESPACE_NAME, From 9e05d61a483a7b4330c1a89c3a67ae0fe06a9885 Mon Sep 17 00:00:00 2001 From: "stewart@mysql.com" <> Date: Tue, 20 Jun 2006 17:29:02 +1000 Subject: [PATCH 28/39] BUG#20333 valgrind: mgmd event reporting dep on uninit value --- ndb/src/mgmsrv/MgmtSrvr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp index 9b518ba938b..d480c564987 100644 --- a/ndb/src/mgmsrv/MgmtSrvr.cpp +++ b/ndb/src/mgmsrv/MgmtSrvr.cpp @@ -1797,7 +1797,7 @@ MgmtSrvr::handleReceivedSignal(NdbApiSignal* signal) break; case GSN_EVENT_REP: { - EventReport *rep = CAST_PTR(EventReport, signal->getDataPtrSend()); + EventReport *rep = (EventReport*) signal->getDataPtr(); if (rep->getNodeId() == 0) rep->setNodeId(refToNode(signal->theSendersBlockRef)); eventReport(signal->getDataPtr()); From 34d82f0bc63de81029a19d538c3e533d7e3b9418 Mon Sep 17 00:00:00 2001 From: "kent@mysql.com" <> Date: Tue, 20 Jun 2006 12:24:12 +0200 Subject: [PATCH 29/39] make_win_src_distribution.sh: Removed reference to missing "tools" directory mysql.spec.sh: Changed flag --with-yassl => --with-ssl Reverted accidental removal of the "make" call :-) Configure --with-embedded-server Corrected path to "libtool" command Corrected path to "libmysqld.a" Removed references to "safe_mysqld" --- scripts/make_win_src_distribution.sh | 2 +- support-files/mysql.spec.sh | 18 +++++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/scripts/make_win_src_distribution.sh b/scripts/make_win_src_distribution.sh index f7c1f19ebc9..27c8b6b7e91 100644 --- a/scripts/make_win_src_distribution.sh +++ b/scripts/make_win_src_distribution.sh @@ -256,7 +256,7 @@ copy_dir_dirs() { for i in client dbug extra storage/heap include storage/archive storage/csv \ include/mysql libmysql libmysqld storage/myisam storage/example \ storage/myisammrg mysys regex sql strings sql-common \ - tools vio zlib + vio zlib do copy_dir_files $i done diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 01746d3156e..4fb271c6c02 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -221,7 +221,7 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \ --prefix=/ \ --with-extra-charsets=all \ %if %{YASSL_BUILD} - --with-yassl \ + --with-ssl \ %endif --exec-prefix=%{_exec_prefix} \ --libexecdir=%{_sbindir} \ @@ -235,6 +235,7 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \ --enable-thread-safe-client \ --with-readline \ " + make } # Use our own copy of glibc @@ -350,6 +351,7 @@ BuildMySQL "--enable-shared \ --with-example-storage-engine \ --with-blackhole-storage-engine \ --with-federated-storage-engine \ + --with-embedded-server \ --with-big-tables \ --with-comment=\"MySQL Community Server (GPL)\"") @@ -389,10 +391,10 @@ install -d $RBR%{_sbindir} mv $RBR/%{_libdir}/mysql/*.so* $RBR/%{_libdir}/ # install "mysqld-debug" and "mysqld-max" -./libtool --mode=execute install -m 755 \ +$MBD/libtool --mode=execute install -m 755 \ $RPM_BUILD_DIR/mysql-%{mysql_version}/mysql-debug-%{mysql_version}/sql/mysqld \ $RBR%{_sbindir}/mysqld-debug -./libtool --mode=execute install -m 755 \ +$MBD/libtool --mode=execute install -m 755 \ $RPM_BUILD_DIR/mysql-%{mysql_version}/mysql-max-%{mysql_version}/sql/mysqld \ $RBR%{_sbindir}/mysqld-max @@ -404,16 +406,12 @@ install -m 644 $MBD/support-files/mysql-log-rotate $RBR%{_sysconfdir}/logrotate. install -m 755 $MBD/support-files/mysql.server $RBR%{_sysconfdir}/init.d/mysql # Install embedded server library in the build root -install -m 644 libmysqld/libmysqld.a $RBR%{_libdir}/mysql/ +install -m 644 $MBD/libmysqld/libmysqld.a $RBR%{_libdir}/mysql/ # Create a symlink "rcmysql", pointing to the init.script. SuSE users # will appreciate that, as all services usually offer this. ln -s %{_sysconfdir}/init.d/mysql $RPM_BUILD_ROOT%{_sbindir}/rcmysql -# Create symbolic compatibility link safe_mysqld -> mysqld_safe -# (safe_mysqld will be gone in MySQL 4.1) -ln -sf ./mysqld_safe $RBR%{_bindir}/safe_mysqld - # Touch the place where the my.cnf config file and mysqlmanager.passwd # (MySQL Instance Manager password file) might be located # Just to make sure it's in the file list and marked as a config file @@ -480,7 +478,7 @@ chmod -R og-rw $mysql_datadir/mysql # Restart in the same way that mysqld will be started normally. %{_sysconfdir}/init.d/mysql start -# Allow safe_mysqld to start mysqld and print a message before we exit +# Allow mysqld_safe to start mysqld and print a message before we exit sleep 2 @@ -542,7 +540,6 @@ fi %doc %attr(644, root, man) %{_mandir}/man1/mysql_zap.1* %doc %attr(644, root, man) %{_mandir}/man1/perror.1* %doc %attr(644, root, man) %{_mandir}/man1/replace.1* -%doc %attr(644, root, man) %{_mandir}/man1/safe_mysqld.1* %ghost %config(noreplace,missingok) %{_sysconfdir}/my.cnf %ghost %config(noreplace,missingok) %{_sysconfdir}/mysqlmanager.passwd @@ -571,7 +568,6 @@ fi %attr(755, root, root) %{_bindir}/replace %attr(755, root, root) %{_bindir}/resolve_stack_dump %attr(755, root, root) %{_bindir}/resolveip -%attr(755, root, root) %{_bindir}/safe_mysqld %attr(755, root, root) %{_sbindir}/mysqld %attr(755, root, root) %{_sbindir}/mysqld-debug From 0f55e30fa834083237423cacd3db51c2ff999c06 Mon Sep 17 00:00:00 2001 From: "tomas@poseidon.ndb.mysql.com" <> Date: Tue, 20 Jun 2006 15:45:17 +0200 Subject: [PATCH 30/39] Bug #19543 Out REDO log on subscription creation during startup, missing error message - add error message --- storage/ndb/src/kernel/blocks/suma/Suma.cpp | 15 +++++++++++++++ storage/ndb/src/kernel/error/ndbd_exit_codes.c | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/storage/ndb/src/kernel/blocks/suma/Suma.cpp b/storage/ndb/src/kernel/blocks/suma/Suma.cpp index 91f0fab06f8..686ae476879 100644 --- a/storage/ndb/src/kernel/blocks/suma/Suma.cpp +++ b/storage/ndb/src/kernel/blocks/suma/Suma.cpp @@ -410,7 +410,22 @@ Suma::createSequenceReply(Signal* signal, jam(); if (ref != NULL) + { + switch ((UtilSequenceRef::ErrorCode)ref->errorCode) + { + case UtilSequenceRef::NoSuchSequence: + ndbrequire(false); + case UtilSequenceRef::TCError: + { + char buf[128]; + snprintf(buf, sizeof(buf), + "Startup failed during sequence creation. TC error %d", + ref->TCErrorCode); + progError(__LINE__, NDBD_EXIT_RESOURCE_ALLOC_ERROR, buf); + } + } ndbrequire(false); + } sendSTTORRY(signal); } diff --git a/storage/ndb/src/kernel/error/ndbd_exit_codes.c b/storage/ndb/src/kernel/error/ndbd_exit_codes.c index 6a14d8b7ffd..005bf830a69 100644 --- a/storage/ndb/src/kernel/error/ndbd_exit_codes.c +++ b/storage/ndb/src/kernel/error/ndbd_exit_codes.c @@ -80,6 +80,10 @@ static const ErrStruct errArray[] = /* this error message is complemented by additional info when generated */ {NDBD_EXIT_INVALID_CONFIG, XCE, "Invalid configuration received from Management Server"}, + + {NDBD_EXIT_RESOURCE_ALLOC_ERROR, XCE, + "Resource allocation error, please review the configuration"}, + /* this error message is complemented by additional info when generated, such as signal, and text */ From 75164ffc2fcd7ea8735d0739b6a2d55ee5329233 Mon Sep 17 00:00:00 2001 From: "evgen@moonbone.local" <> Date: Tue, 20 Jun 2006 20:11:08 +0400 Subject: [PATCH 31/39] rpl_ndb_log.result: Fixed failing test case --- mysql-test/r/rpl_ndb_log.result | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mysql-test/r/rpl_ndb_log.result b/mysql-test/r/rpl_ndb_log.result index c435fb37531..74ecd8e7879 100644 --- a/mysql-test/r/rpl_ndb_log.result +++ b/mysql-test/r/rpl_ndb_log.result @@ -132,3 +132,19 @@ ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find tar DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; +create table t1(a int auto_increment primary key, b int); +insert into t1 values (NULL, 1); +reset master; +set insert_id=5; +insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id()); +show binlog events; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 +slave-bin.000001 # Table_map 2 # table_id: 29 (test.t1) +slave-bin.000001 # Write_rows 2 # table_id: 29 flags: STMT_END_F +select * from t1; +a b +1 1 +5 1 +6 1 +drop table t1; From f5f9f471d1ada04b1bac10369d88d518dc8c6a73 Mon Sep 17 00:00:00 2001 From: "tomas@poseidon.ndb.mysql.com" <> Date: Tue, 20 Jun 2006 19:13:46 +0200 Subject: [PATCH 32/39] Bug #17297 Fix error messages --- ndb/src/common/transporter/TransporterRegistry.cpp | 2 +- ndb/src/kernel/blocks/dbdih/DbdihMain.cpp | 2 +- ndb/src/kernel/blocks/dblqh/DblqhMain.cpp | 3 ++- ndb/src/kernel/error/ndbd_exit_codes.c | 7 ++++--- ndb/src/ndbapi/ndberror.c | 1 + 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ndb/src/common/transporter/TransporterRegistry.cpp b/ndb/src/common/transporter/TransporterRegistry.cpp index f0e50729f8d..cd78bc52027 100644 --- a/ndb/src/common/transporter/TransporterRegistry.cpp +++ b/ndb/src/common/transporter/TransporterRegistry.cpp @@ -1322,7 +1322,7 @@ TransporterRegistry::start_clients_thread() else { ndbout_c("Management server closed connection early. " - "It is probably being shut down (or has crashed). " + "It is probably being shut down (or has problems). " "We will retry the connection."); } } diff --git a/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp b/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp index c8254052a56..b2390a37985 100644 --- a/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp +++ b/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp @@ -8330,7 +8330,7 @@ Dbdih::resetReplicaSr(TabRecordPtr tabPtr){ *--------_----------------------------------------------------- */ const Uint32 nextCrashed = noCrashedReplicas + 1; replicaPtr.p->noCrashedReplicas = nextCrashed; - arrGuard(nextCrashed, 8); + arrGuardErr(nextCrashed, 8, NDBD_EXIT_MAX_CRASHED_REPLICAS); replicaPtr.p->createGci[nextCrashed] = newestRestorableGCI + 1; ndbrequire(newestRestorableGCI + 1 != 0xF1F1F1F1); replicaPtr.p->replicaLastGci[nextCrashed] = (Uint32)-1; diff --git a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp index 19a003f00fc..56e93e6ee01 100644 --- a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp +++ b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp @@ -17989,7 +17989,8 @@ void Dblqh::stepAhead(Signal* signal, Uint32 stepAheadWords) logFilePtr.p->currentLogpage = logPagePtr.p->logPageWord[ZNEXT_PAGE]; logPagePtr.i = logPagePtr.p->logPageWord[ZNEXT_PAGE]; logFilePtr.p->currentFilepage++; - ptrCheckGuard(logPagePtr, clogPageFileSize, logPageRecord); + ptrCheckGuardErr(logPagePtr, clogPageFileSize, logPageRecord, + NDBD_EXIT_SR_REDOLOG); logPagePtr.p->logPageWord[ZCURR_PAGE_INDEX] = ZPAGE_HEADER_SIZE; logPartPtr.p->execSrPagesRead--; logPartPtr.p->execSrPagesExecuted++; diff --git a/ndb/src/kernel/error/ndbd_exit_codes.c b/ndb/src/kernel/error/ndbd_exit_codes.c index 6a14d8b7ffd..257af4c5b1b 100644 --- a/ndb/src/kernel/error/ndbd_exit_codes.c +++ b/ndb/src/kernel/error/ndbd_exit_codes.c @@ -51,8 +51,9 @@ static const ErrStruct errArray[] = {NDBD_EXIT_SYSTEM_ERROR, XIE, "System error, node killed during node restart by other node"}, {NDBD_EXIT_INDEX_NOTINRANGE, XIE, "Array index out of range"}, - {NDBD_EXIT_ARBIT_SHUTDOWN, XAE, "Arbitrator shutdown, " - "please investigate error(s) on other node(s)"}, + {NDBD_EXIT_ARBIT_SHUTDOWN, XAE, "Node lost connection to other nodes and " + "can not form a unpartitioned cluster, please investigate if there are " + "error(s) on other node(s)"}, {NDBD_EXIT_POINTER_NOTINRANGE, XIE, "Pointer too large"}, {NDBD_EXIT_SR_OTHERNODEFAILED, XRE, "Another node failed during system " "restart, please investigate error(s) on other node(s)"}, @@ -94,7 +95,7 @@ static const ErrStruct errArray[] = {NDBD_EXIT_WATCHDOG_TERMINATE, XIE, "WatchDog terminate, internal error " "or massive overload on the machine running this node"}, {NDBD_EXIT_SIGNAL_LOST_SEND_BUFFER_FULL, XCR, - "Signal lost, out of send buffer memory, please increase SendBufferMemory"}, + "Signal lost, out of send buffer memory, please increase SendBufferMemory or lower the load"}, {NDBD_EXIT_SIGNAL_LOST, XIE, "Signal lost (unknown reason)"}, {NDBD_EXIT_ILLEGAL_SIGNAL, XIE, "Illegal signal (version mismatch a possibility)"}, diff --git a/ndb/src/ndbapi/ndberror.c b/ndb/src/ndbapi/ndberror.c index 5ca8ad7be60..3653db95e08 100644 --- a/ndb/src/ndbapi/ndberror.c +++ b/ndb/src/ndbapi/ndberror.c @@ -266,6 +266,7 @@ ErrorBundle ErrorCodes[] = { /** * Application error */ + { 763, AE, "Alter table requires cluster nodes to have exact same version" }, { 823, AE, "Too much attrinfo from application in tuple manager" }, { 831, AE, "Too many nullable/bitfields in table definition" }, { 876, AE, "876" }, From 7be42667f02dbdc43df4278f83ed611c1e38efe2 Mon Sep 17 00:00:00 2001 From: "tomas@poseidon.ndb.mysql.com" <> Date: Tue, 20 Jun 2006 19:17:07 +0200 Subject: [PATCH 33/39] Bug #17297 Fix error messages --- storage/ndb/include/mgmapi/ndbd_exit_codes.h | 4 ++++ storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp | 5 +++-- storage/ndb/src/kernel/error/ndbd_exit_codes.c | 1 + storage/ndb/src/ndbapi/ndberror.c | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/storage/ndb/include/mgmapi/ndbd_exit_codes.h b/storage/ndb/include/mgmapi/ndbd_exit_codes.h index 686641ebef5..b16f1a63a8d 100644 --- a/storage/ndb/include/mgmapi/ndbd_exit_codes.h +++ b/storage/ndb/include/mgmapi/ndbd_exit_codes.h @@ -77,6 +77,7 @@ typedef ndbd_exit_classification_enum ndbd_exit_classification; #define NDBD_EXIT_SR_RESTARTCONFLICT 2311 #define NDBD_EXIT_NO_MORE_UNDOLOG 2312 #define NDBD_EXIT_SR_UNDOLOG 2313 +#define NDBD_EXIT_SR_SCHEMAFILE 2310 #define NDBD_EXIT_MEMALLOC 2327 #define NDBD_EXIT_BLOCK_JBUFCONGESTION 2334 #define NDBD_EXIT_TIME_QUEUE_SHORT 2335 @@ -91,6 +92,9 @@ typedef ndbd_exit_classification_enum ndbd_exit_classification; #define NDBD_EXIT_INVALID_CONFIG 2350 #define NDBD_EXIT_OUT_OF_LONG_SIGNAL_MEMORY 2351 +/* Errorcodes for fatal resource errors */ +#define NDBD_EXIT_RESOURCE_ALLOC_ERROR 2500 + #define NDBD_EXIT_OS_SIGNAL_RECEIVED 6000 /* VM 6050-> */ diff --git a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp index ef08c06822f..e9d2fce5e18 100644 --- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp +++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp @@ -1355,10 +1355,11 @@ void Dbdict::readSchemaConf(Signal* signal, sf->FileSize == sf0->FileSize && sf->PageNumber == n && computeChecksum((Uint32*)sf, NDB_SF_PAGE_SIZE_IN_WORDS) == 0; - ndbrequire(ok || !crashInd); + ndbrequireErr(ok || !crashInd, NDBD_EXIT_SR_SCHEMAFILE); if (! ok) { jam(); - ndbrequire(fsPtr.p->fsState == FsConnectRecord::READ_SCHEMA1); + ndbrequireErr(fsPtr.p->fsState == FsConnectRecord::READ_SCHEMA1, + NDBD_EXIT_SR_SCHEMAFILE); readSchemaRef(signal, fsPtr); return; } diff --git a/storage/ndb/src/kernel/error/ndbd_exit_codes.c b/storage/ndb/src/kernel/error/ndbd_exit_codes.c index 005bf830a69..cc60edf9509 100644 --- a/storage/ndb/src/kernel/error/ndbd_exit_codes.c +++ b/storage/ndb/src/kernel/error/ndbd_exit_codes.c @@ -59,6 +59,7 @@ static const ErrStruct errArray[] = {NDBD_EXIT_NODE_NOT_DEAD, XRE, "Internal node state conflict, " "most probably resolved by restarting node again"}, {NDBD_EXIT_SR_REDOLOG, XFI, "Error while reading the REDO log"}, + {NDBD_EXIT_SR_SCHEMAFILE, XFI, "Error while reading the schema file"}, /* Currently unused? */ {2311, XIE, "Conflict when selecting restart type"}, {NDBD_EXIT_NO_MORE_UNDOLOG, XCR, diff --git a/storage/ndb/src/ndbapi/ndberror.c b/storage/ndb/src/ndbapi/ndberror.c index 22252960e21..d3b18898b21 100644 --- a/storage/ndb/src/ndbapi/ndberror.c +++ b/storage/ndb/src/ndbapi/ndberror.c @@ -344,6 +344,7 @@ ErrorBundle ErrorCodes[] = { /** * SchemaError */ + { 311, DMEC, IE, "Undefined fragment" }, { 703, DMEC, SE, "Invalid table format" }, { 704, DMEC, SE, "Attribute name too long" }, { 705, DMEC, SE, "Table name too long" }, From 6b694bcd589b8a3c2c97e3a9b8fac701708b059f Mon Sep 17 00:00:00 2001 From: "evgen@moonbone.local" <> Date: Wed, 21 Jun 2006 00:45:01 +0400 Subject: [PATCH 34/39] rpl_ndb_log.result: Corrected test case result --- mysql-test/r/rpl_ndb_log.result | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/rpl_ndb_log.result b/mysql-test/r/rpl_ndb_log.result index 74ecd8e7879..b88af325397 100644 --- a/mysql-test/r/rpl_ndb_log.result +++ b/mysql-test/r/rpl_ndb_log.result @@ -140,8 +140,8 @@ insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id()); show binlog events; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 -slave-bin.000001 # Table_map 2 # table_id: 29 (test.t1) -slave-bin.000001 # Write_rows 2 # table_id: 29 flags: STMT_END_F +slave-bin.000001 # Table_map 2 # table_id: 30 (test.t1) +slave-bin.000001 # Write_rows 2 # table_id: 30 flags: STMT_END_F select * from t1; a b 1 1 From ddaebd13dc5cabd6bf92187328d1fe6365aa5744 Mon Sep 17 00:00:00 2001 From: "anozdrin@mysql.com" <> Date: Wed, 21 Jun 2006 02:16:38 +0400 Subject: [PATCH 35/39] Fix merge 5.0 -> 5.1. --- mysql-test/r/im_life_cycle.result | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mysql-test/r/im_life_cycle.result b/mysql-test/r/im_life_cycle.result index aa26b355aff..b6d3bb8361c 100644 --- a/mysql-test/r/im_life_cycle.result +++ b/mysql-test/r/im_life_cycle.result @@ -47,10 +47,6 @@ mysqld2 offline Killing the process... Sleeping... Success: the process was restarted. - --------------------------------------------------------------------- --- 1.1.7. --------------------------------------------------------------------- SHOW INSTANCES; instance_name state mysqld1 online From bb94cb24c51270ab43c63b57bb17eafa94e093eb Mon Sep 17 00:00:00 2001 From: "anozdrin@mysql.com" <> Date: Wed, 21 Jun 2006 02:17:39 +0400 Subject: [PATCH 36/39] Re-enable IM tests. --- mysql-test/t/disabled.def | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 96f31133e65..b4bd53fb1bc 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -13,9 +13,9 @@ #events_stress : BUG#17619 2006-02-21 andrey Race conditions #events : BUG#17619 2006-02-21 andrey Race conditions #events_scheduling : BUG#19170 2006-04-26 andrey Test case of 19170 fails on some platforms. Has to be checked. -im_instance_conf : Bug#20294 2006-06-06 monty Instance manager test im_instance_conf fails randomly -im_options : Bug#20294 2006-06-06 monty Instance manager test im_instance_conf fails randomly -im_life_cycle : Bug#20368 2006-06-10 alik im_life_cycle test fails +#im_instance_conf : Bug#20294 2006-06-06 monty Instance manager test im_instance_conf fails randomly +#im_options : Bug#20294 2006-06-06 monty Instance manager test im_instance_conf fails randomly +#im_life_cycle : Bug#20368 2006-06-10 alik im_life_cycle test fails ndb_autodiscover : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog #ndb_binlog_discover : BUG#19395 2006-04-28 tomas/knielsen mysqld does not always detect cluster shutdown From e77850e5737666e02d2e1d45127680f97987a345 Mon Sep 17 00:00:00 2001 From: "mskold@mysql.com" <> Date: Wed, 21 Jun 2006 09:36:50 +0200 Subject: [PATCH 37/39] Fix for Bug #19906 REPLACE doesn't update TEXT fields correctly --- mysql-test/r/ndb_replace.result | 23 ++++++++++++++++++++++- mysql-test/t/ndb_replace.test | 30 ++++++++++++++++++++++++++++-- sql/ha_ndbcluster.cc | 10 ++++++++-- sql/ha_ndbcluster.h | 3 ++- 4 files changed, 60 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/ndb_replace.result b/mysql-test/r/ndb_replace.result index 5d772620b2c..cdfcd6a7a43 100644 --- a/mysql-test/r/ndb_replace.result +++ b/mysql-test/r/ndb_replace.result @@ -1,4 +1,4 @@ -drop table if exists t1; +drop table if exists t1,t2; CREATE TABLE t1 ( gesuchnr int(11) DEFAULT '0' NOT NULL, benutzer_id int(11) DEFAULT '0' NOT NULL, @@ -31,3 +31,24 @@ SELECT * from t1 ORDER BY i; i j k 3 1 42 17 2 24 +CREATE TABLE t2 (a INT(11) NOT NULL, +b INT(11) NOT NULL, +c INT(11) NOT NULL, +x TEXT, +y TEXT, +z TEXT, +id INT(10) unsigned NOT NULL AUTO_INCREMENT, +i INT(11) DEFAULT NULL, +PRIMARY KEY (id), +UNIQUE KEY a (a,b,c) +) ENGINE=ndbcluster; +REPLACE INTO t2 (a,b,c,x,y,z,i) VALUES (1,1,1,'a','a','a',1),(1,1,1,'b','b','b',2), (1,1,1,'c','c','c',3); +SELECT * FROM t2 ORDER BY id; +a b c x y z id i +1 1 1 c c c 3 3 +REPLACE INTO t2(a,b,c,x,y,z,i) values (1,1,1,'a','a','a',1); +REPLACE INTO t2(a,b,c,x,y,z,i) values (1,1,1,'b','b','b',2); +SELECT * FROM t2 ORDER BY id; +a b c x y z id i +1 1 1 b b b 5 2 +DROP TABLE t2; diff --git a/mysql-test/t/ndb_replace.test b/mysql-test/t/ndb_replace.test index 6cad80ef8ea..94a11f7dfb2 100644 --- a/mysql-test/t/ndb_replace.test +++ b/mysql-test/t/ndb_replace.test @@ -6,7 +6,7 @@ # --disable_warnings -drop table if exists t1; +drop table if exists t1,t2; --enable_warnings CREATE TABLE t1 ( @@ -27,6 +27,8 @@ replace into t1 (gesuchnr,benutzer_id) values (1,1); select * from t1 order by gesuchnr; drop table t1; +# End of 4.1 tests + # bug#17431 CREATE TABLE t1(i INT PRIMARY KEY AUTO_INCREMENT, j INT, @@ -38,4 +40,28 @@ REPLACE INTO t1 (j,k) VALUES (1,42); REPLACE INTO t1 (i,j) VALUES (17,2); SELECT * from t1 ORDER BY i; -# End of 4.1 tests +# bug#19906 +CREATE TABLE t2 (a INT(11) NOT NULL, + b INT(11) NOT NULL, + c INT(11) NOT NULL, + x TEXT, + y TEXT, + z TEXT, + id INT(10) unsigned NOT NULL AUTO_INCREMENT, + i INT(11) DEFAULT NULL, + PRIMARY KEY (id), + UNIQUE KEY a (a,b,c) +) ENGINE=ndbcluster; + +REPLACE INTO t2 (a,b,c,x,y,z,i) VALUES (1,1,1,'a','a','a',1),(1,1,1,'b','b','b',2), (1,1,1,'c','c','c',3); + +SELECT * FROM t2 ORDER BY id; + +REPLACE INTO t2(a,b,c,x,y,z,i) values (1,1,1,'a','a','a',1); +REPLACE INTO t2(a,b,c,x,y,z,i) values (1,1,1,'b','b','b',2); + +SELECT * FROM t2 ORDER BY id; + +DROP TABLE t2; + + diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index e2d82d9f559..e57a060f59b 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -771,10 +771,11 @@ int g_get_ndb_blobs_value(NdbBlob *ndb_blob, void *arg) if (ndb_blob->blobsNextBlob() != NULL) DBUG_RETURN(0); ha_ndbcluster *ha= (ha_ndbcluster *)arg; - DBUG_RETURN(ha->get_ndb_blobs_value(ndb_blob)); + DBUG_RETURN(ha->get_ndb_blobs_value(ndb_blob, ha->m_blobs_offset)); } -int ha_ndbcluster::get_ndb_blobs_value(NdbBlob *last_ndb_blob) +int ha_ndbcluster::get_ndb_blobs_value(NdbBlob *last_ndb_blob, + my_ptrdiff_t ptrdiff) { DBUG_ENTER("get_ndb_blobs_value"); @@ -807,7 +808,10 @@ int ha_ndbcluster::get_ndb_blobs_value(NdbBlob *last_ndb_blob) if (ndb_blob->readData(buf, len) != 0) DBUG_RETURN(-1); DBUG_ASSERT(len == blob_len); + // Ugly hack assumes only ptr needs to be changed + field_blob->ptr+= ptrdiff; field_blob->set_ptr(len, buf); + field_blob->ptr-= ptrdiff; } offset+= blob_size; } @@ -870,6 +874,7 @@ int ha_ndbcluster::get_ndb_value(NdbOperation *ndb_op, Field *field, if (ndb_blob != NULL) { // Set callback + m_blobs_offset= buf - (byte*) table->record[0]; void *arg= (void *)this; DBUG_RETURN(ndb_blob->setActiveHook(g_get_ndb_blobs_value, arg) != 0); } @@ -4552,6 +4557,7 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg): m_ops_pending(0), m_skip_auto_increment(TRUE), m_blobs_pending(0), + m_blobs_offset(0), m_blobs_buffer(0), m_blobs_buffer_size(0), m_dupkey((uint) -1), diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h index e417996a5d9..01950c2b00f 100644 --- a/sql/ha_ndbcluster.h +++ b/sql/ha_ndbcluster.h @@ -629,7 +629,7 @@ private: int set_ndb_value(NdbOperation*, Field *field, uint fieldnr, bool *set_blob_value= 0); int get_ndb_value(NdbOperation*, Field *field, uint fieldnr, byte*); friend int g_get_ndb_blobs_value(NdbBlob *ndb_blob, void *arg); - int get_ndb_blobs_value(NdbBlob *last_ndb_blob); + int get_ndb_blobs_value(NdbBlob *last_ndb_blob, my_ptrdiff_t ptrdiff); int set_primary_key(NdbOperation *op, const byte *key); int set_primary_key_from_record(NdbOperation *op, const byte *record); int set_index_key_from_record(NdbOperation *op, const byte *record, @@ -706,6 +706,7 @@ private: ha_rows m_ops_pending; bool m_skip_auto_increment; bool m_blobs_pending; + my_ptrdiff_t m_blobs_offset; // memory for blobs in one tuple char *m_blobs_buffer; uint32 m_blobs_buffer_size; From 5ce56c1cdc1014da6d1870316bfcc78d0f3f9b72 Mon Sep 17 00:00:00 2001 From: "anozdrin@mysql.com" <> Date: Wed, 21 Jun 2006 11:44:54 +0400 Subject: [PATCH 38/39] Disable IM tests. --- mysql-test/t/disabled.def | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index b4bd53fb1bc..6c3df50011c 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -13,9 +13,9 @@ #events_stress : BUG#17619 2006-02-21 andrey Race conditions #events : BUG#17619 2006-02-21 andrey Race conditions #events_scheduling : BUG#19170 2006-04-26 andrey Test case of 19170 fails on some platforms. Has to be checked. -#im_instance_conf : Bug#20294 2006-06-06 monty Instance manager test im_instance_conf fails randomly -#im_options : Bug#20294 2006-06-06 monty Instance manager test im_instance_conf fails randomly -#im_life_cycle : Bug#20368 2006-06-10 alik im_life_cycle test fails +im_instance_conf : Bug#20294 2006-06-06 monty Instance manager test im_instance_conf fails randomly +im_options : Bug#20294 2006-06-06 monty Instance manager test im_instance_conf fails randomly +im_life_cycle : Bug#20368 2006-06-10 alik im_life_cycle test fails ndb_autodiscover : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog #ndb_binlog_discover : BUG#19395 2006-04-28 tomas/knielsen mysqld does not always detect cluster shutdown From 7fdf6f16336e28db644a831b98111a9158521de9 Mon Sep 17 00:00:00 2001 From: "mskold@mysql.com" <> Date: Wed, 21 Jun 2006 09:51:08 +0200 Subject: [PATCH 39/39] Fixed failed automerge --- sql/ha_ndbcluster.h | 1 - 1 file changed, 1 deletion(-) diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h index c5f441f8959..df3c5791713 100644 --- a/sql/ha_ndbcluster.h +++ b/sql/ha_ndbcluster.h @@ -798,7 +798,6 @@ private: int get_ndb_value(NdbOperation*, Field *field, uint fieldnr, byte*); int get_ndb_partition_id(NdbOperation *); friend int g_get_ndb_blobs_value(NdbBlob *ndb_blob, void *arg); - int get_ndb_blobs_value(NdbBlob *last_ndb_blob, my_ptrdiff_t ptrdiff); int set_primary_key(NdbOperation *op, const byte *key); int set_primary_key_from_record(NdbOperation *op, const byte *record); int set_index_key_from_record(NdbOperation *op, const byte *record,