From 4d62eb39be4c4f2ffb9e5a7a14e48da193286c12 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 Apr 2007 19:05:19 +0200 Subject: [PATCH 01/35] The fix for Bug#18946: Test case rpl_ndb_ddl disabled pushed around end of March 2007 enabled this testcase. It was later disabled because the test failed with timeout on one testing box. The reason for this failing test could not be found because we do not have informations about the conditions on the box during this test. Jeb and I tried this test on other boxes and it passed. My experience is that - tests using NDB need in general often significant more runtime than comparable tests of other storage engines - the actual load of the box where the test is running and the filesystem (nfs could be extreme slow) where the tests are executed might have a huge impact on the test performance (runtime * 2 till 3) - there are sometimes problems with the ports most probably caused by OS properties (NDB+RPL need many ports) or parallel tests accidently running with the same ports. AFAIK these are the reasons why the NDB tests fail sometimes with timeout. Conclusion: We enable rpl_ndb_ddl again because the failure happens in rare cases and seems not to be caused by errors within the server or test code. mysql-test/t/disabled.def: Enable t/rpl_ndb_ddl.test again --- mysql-test/t/disabled.def | 1 - 1 file changed, 1 deletion(-) diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index ad2c7a6c08c..ba00b8fa3b1 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -23,7 +23,6 @@ rpl_ndb_circular_simplex : BUG#27972 2007-04-20 mats Slave cannot start where it rpl_ndb_2innodb : BUG#19227 2006-04-20 pekka pk delete apparently not replicated rpl_ndb_2myisam : BUG#19227 Seems to pass currently rpl_ndb_dd_partitions : BUG#19259 2006-04-21 rpl_ndb_dd_partitions fails on s/AMD -rpl_ndb_ddl : BUG#18946 result file needs update + test needs to checked rpl_ddl : BUG#26418 2007-03-01 mleich Slave out of sync after CREATE/DROP TEMPORARY TABLE + ROLLBACK on master rpl_ndb_innodb2ndb : Bug #19710 Cluster replication to partition table fails on DELETE FROM statement rpl_ndb_myisam2ndb : Bug #19710 Cluster replication to partition table fails on DELETE FROM statement From 779d13a0cd23c8f8b116c80133287966893b1006 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 Apr 2007 11:23:41 +0200 Subject: [PATCH 02/35] The combination NDB and statement based replication is extreme slow and this fails usually because of testing timeout. mysql-test/t/rpl_ndb_ddl.test: Avoid execution of this test with statement based replication because it is far way too slow. --- mysql-test/t/rpl_ndb_ddl.test | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/t/rpl_ndb_ddl.test b/mysql-test/t/rpl_ndb_ddl.test index ca7a4ce4968..f49cd3c1f88 100644 --- a/mysql-test/t/rpl_ndb_ddl.test +++ b/mysql-test/t/rpl_ndb_ddl.test @@ -24,6 +24,7 @@ # --source include/master-slave.inc +--source include/have_binlog_format_mixed_or_row.inc --source include/have_ndb.inc let $engine_type= NDB; let $temp_engine_type= MEMORY; From df22909536a7f054a224a5937b0991139a1954cf Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 Apr 2007 17:49:50 +0200 Subject: [PATCH 03/35] Minor improvement to save some testing runtime (~ 2 minutes). Reason: This test executes DML statements on a NDB table to detect if some SQL statements of special interest commits the ongoing transaction. When running in MIXED mode, automatic switching from statement-based to row-based replication takes place when a DML statement updates an NDB table. That means running this test on NDB with binlog-format=mixed and binlog-format=row mostly checks the same routines twice. Therefore we skip the variant with binlog-format=mixed. mysql-test/t/rpl_ndb_ddl.test: Prevent the execution of this test if replication format is statement or mixed. --- mysql-test/t/rpl_ndb_ddl.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/t/rpl_ndb_ddl.test b/mysql-test/t/rpl_ndb_ddl.test index f49cd3c1f88..66db755de15 100644 --- a/mysql-test/t/rpl_ndb_ddl.test +++ b/mysql-test/t/rpl_ndb_ddl.test @@ -24,7 +24,7 @@ # --source include/master-slave.inc ---source include/have_binlog_format_mixed_or_row.inc +--source include/have_binlog_format_row.inc --source include/have_ndb.inc let $engine_type= NDB; let $temp_engine_type= MEMORY; From 9c2923fef4bbf671123f75236a2411cdfb66e2e4 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 2 May 2007 13:18:07 +0500 Subject: [PATCH 04/35] Bug#27898 UPDATEXML Crashes the Server! Problem: when replacing the root element, UpdateXML erroneously tried to mix old XML content with the replacement string, which led to crash. Fix: don't use the old XML content in these cases, just return the replacement string. mysql-test/r/xml.result: Adding test case mysql-test/t/xml.test: Adding test case sql/item_xmlfunc.cc: Adding special code to handle replacements of the root element - the replacing content is just copied to the result, the previous content of the XML value is removed. --- mysql-test/r/xml.result | 7 +++++++ mysql-test/t/xml.test | 7 +++++++ sql/item_xmlfunc.cc | 10 ++++++++++ 3 files changed, 24 insertions(+) diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result index 236c50774bd..82f83e079e7 100644 --- a/mysql-test/r/xml.result +++ b/mysql-test/r/xml.result @@ -547,6 +547,13 @@ UpdateXML(@xml, '/a/b/@bb2', '') select UpdateXML(@xml, '/a/b/@bb2', 'bb3="bb3"'); UpdateXML(@xml, '/a/b/@bb2', 'bb3="bb3"') bb +select updatexml('
12
', +'/','12') as upd1; +upd1 +12 +select updatexml('', '/', '') as upd2; +upd2 + SET @xml= 'lesser wombat'; select extractvalue(@xml,'order/clerk'); extractvalue(@xml,'order/clerk') diff --git a/mysql-test/t/xml.test b/mysql-test/t/xml.test index 8517dce111f..88ea519e610 100644 --- a/mysql-test/t/xml.test +++ b/mysql-test/t/xml.test @@ -231,6 +231,13 @@ select UpdateXML(@xml, '/a/b/@bb1', 'bb3="bb3"'); select UpdateXML(@xml, '/a/b/@bb2', ''); select UpdateXML(@xml, '/a/b/@bb2', 'bb3="bb3"'); +# +# Bug#27898 UPDATEXML Crashes the Server! +# +select updatexml('
12
', + '/','12') as upd1; +select updatexml('', '/', '') as upd2; + # # Bug#16234 XML: Crash if ExtractValue() # diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc index 26474990644..d29738429b7 100644 --- a/sql/item_xmlfunc.cc +++ b/sql/item_xmlfunc.cc @@ -2768,6 +2768,16 @@ String *Item_func_xml_update::val_str(String *str) nodebeg+= fltbeg->num; + if (!nodebeg->level) + { + /* + Root element, without NameTest: + UpdateXML(xml, '/', 'replacement'); + Just return the replacement string. + */ + return rep; + } + tmp_value.length(0); tmp_value.set_charset(collation.collation); uint offs= nodebeg->type == MY_XML_NODE_TAG ? 1 : 0; From 70e94549824d87174cacc0e830004e7da093da54 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 4 May 2007 09:59:36 -0400 Subject: [PATCH 05/35] BUG#18980 : Test 'rpl_row_blob_innodb' fails randomly Failure was not reproduced under testing with the latest clone. This patch re-enables the test. mysql-test/t/disabled.def: BUG#18980 : Test 'rpl_row_blob_innodb' fails randomly This patch enables the test. --- mysql-test/t/disabled.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index ba00b8fa3b1..57c3e1b7aba 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -26,7 +26,7 @@ rpl_ndb_dd_partitions : BUG#19259 2006-04-21 rpl_ndb_dd_partitions fails on s rpl_ddl : BUG#26418 2007-03-01 mleich Slave out of sync after CREATE/DROP TEMPORARY TABLE + ROLLBACK on master rpl_ndb_innodb2ndb : Bug #19710 Cluster replication to partition table fails on DELETE FROM statement rpl_ndb_myisam2ndb : Bug #19710 Cluster replication to partition table fails on DELETE FROM statement -rpl_row_blob_innodb : BUG#18980 2006-04-10 kent Test fails randomly +#rpl_row_blob_innodb : BUG#18980 2006-04-10 kent Test fails randomly rpl_udf : BUG#27564 2007-03-31 lars New test case for rpl of UDF shows valgrind failure synchronization : Bug#24529 Test 'synchronization' fails on Mac pushbuild; Also on Linux 64 bit. From 1fa1c7a8cecb9ceea3afa1b7b6da081dd2654ba0 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 7 May 2007 20:43:19 -0400 Subject: [PATCH 06/35] BUG#17233 : LOAD DATA INFILE: failure causes mysqld dbug_assert, binlog not flushed This patch corrects a bug involving a LOAD DATA INFILE operation on a transactional table. It corrects a problem in the error handler moving the transactional table check and autocommit_or_rollback operation to the end of the error handler. An additional test case was added to detect this condition. mysql-test/r/rpl_loaddata.result: BUG#17233 : LOAD DATA INFILE: failure causes mysqld dbug_assert, binlog not flushed This patch adds the results for the additional test for properly handling the duplicate key error on LOAD DATA INFILE. mysql-test/t/rpl_loaddata.test: BUG#17233 : LOAD DATA INFILE: failure causes mysqld dbug_assert, binlog not flushed This patch adds an additional test to rpl_loaddata for handling the duplicate key error on LOAD DATA INFILE. sql/sql_load.cc: BUG#17233 : LOAD DATA INFILE: failure causes mysqld dbug_assert, binlog not flushed This patch moves the check for a transactional table and rollback in the error handler for mysql_load(). The patch moves the transactional table check to the end of the error handler matching the implementation for other similar operations (see sql_insert). --- mysql-test/r/rpl_loaddata.result | 4 ++++ mysql-test/t/rpl_loaddata.test | 12 ++++++++++++ sql/sql_load.cc | 6 +++--- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/rpl_loaddata.result b/mysql-test/r/rpl_loaddata.result index d69786c00a1..b4b8d8b9a07 100644 --- a/mysql-test/r/rpl_loaddata.result +++ b/mysql-test/r/rpl_loaddata.result @@ -80,3 +80,7 @@ ERROR 23000: Duplicate entry '2003-03-22' for key 1 drop table t2; drop table t2; drop table t1; +CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB; +LOAD DATA INFILE "../std_data_ln/words.dat" INTO TABLE t1; +ERROR 23000: Duplicate entry 'Aarhus' for key 1 +DROP TABLE IF EXISTS t1; diff --git a/mysql-test/t/rpl_loaddata.test b/mysql-test/t/rpl_loaddata.test index 5ebdec6f761..27fa7fb95a6 100644 --- a/mysql-test/t/rpl_loaddata.test +++ b/mysql-test/t/rpl_loaddata.test @@ -12,6 +12,7 @@ # Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986) source include/master-slave.inc; +source include/have_innodb.inc; connection slave; reset master; @@ -150,5 +151,16 @@ drop table t2; connection master; drop table t2; drop table t1; + +# BUG#17233 LOAD DATA INFILE: failure causes mysqld dbug_assert, binlog not flushed +CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB; + +--error 1062 +LOAD DATA INFILE "../std_data_ln/words.dat" INTO TABLE t1; + +--disable warnings +DROP TABLE IF EXISTS t1; +--enable warnings + sync_with_master; # End of 4.1 tests diff --git a/sql/sql_load.cc b/sql/sql_load.cc index ee6d2d0a572..104d599fa1c 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -414,9 +414,6 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, if (error) { - if (transactional_table) - ha_autocommit_or_rollback(thd,error); - if (read_file_from_client) while (!read_info.next_line()) ; @@ -460,6 +457,9 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, } } #endif /*!EMBEDDED_LIBRARY*/ + if (transactional_table) + ha_autocommit_or_rollback(thd,error); + error= -1; // Error on read goto err; } From 8ce067caead824123c16f190d606f8e0b061a6c0 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 8 May 2007 13:32:29 +0500 Subject: [PATCH 07/35] Bug#26518 XPath and variables problem Problem: XPath variables didn't work. Fix: adding variables support, both user-defined and sp local variables are now supported by XPath. mysql-test/r/xml.result: Adding test case mysql-test/t/xml.test: Adding test case sql/item_xmlfunc.cc: Adding variables support: - SP variables with standard XPath syntax: $i - User variables with non-standard syntax: $@i --- mysql-test/r/xml.result | 115 ++++++++++++++++++++++++++++++++++++++++ mysql-test/t/xml.test | 72 +++++++++++++++++++++++++ sql/item_xmlfunc.cc | 75 ++++++++++++++++++++++---- 3 files changed, 253 insertions(+), 9 deletions(-) diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result index 236c50774bd..f5ef919fd93 100644 --- a/mysql-test/r/xml.result +++ b/mysql-test/r/xml.result @@ -884,3 +884,118 @@ test select ExtractValue('test', '/a/self'); ExtractValue('test', '/a/self') test +set @i=1; +select ExtractValue('b1b2','/a/b[$@i]'); +ExtractValue('b1b2','/a/b[$@i]') +b1 +set @i=2; +select ExtractValue('b1b2','/a/b[$@i]'); +ExtractValue('b1b2','/a/b[$@i]') +b2 +set @i=NULL; +select ExtractValue('b1b2','/a/b[$@i]'); +ExtractValue('b1b2','/a/b[$@i]') + +CREATE PROCEDURE spxml(xml VARCHAR(128)) +BEGIN +DECLARE c INT; +DECLARE i INT DEFAULT 1; +SET c= ExtractValue(xml,'count(/a/b)'); +SET @i= c; +WHILE i <= c DO +BEGIN +SELECT i, @i, ExtractValue(xml,'/a/b[$i]'), ExtractValue(xml,'/a/b[$@i]'); +SET i= i + 1; +SET @i= @i - 1; +END; +END WHILE; +END| +call spxml('b1b2b3'); +i @i ExtractValue(xml,'/a/b[$i]') ExtractValue(xml,'/a/b[$@i]') +1 3 b1 b3 +i @i ExtractValue(xml,'/a/b[$i]') ExtractValue(xml,'/a/b[$@i]') +2 2 b2 b2 +i @i ExtractValue(xml,'/a/b[$i]') ExtractValue(xml,'/a/b[$@i]') +3 1 b3 b1 +drop procedure spxml; +Multiple matches, but no index specification +SELECT ExtractValue('b1b2','/a/b'); +ExtractValue('b1b2','/a/b') +b1 b2 +No matches +SELECT ExtractValue('b1b2','/a/c'); +ExtractValue('b1b2','/a/c') + +Index out of range +SELECT ExtractValue('b1b2','/a/b[-1]'); +ExtractValue('b1b2','/a/b[-1]') + +SELECT ExtractValue('b1b2','/a/b[10]'); +ExtractValue('b1b2','/a/b[10]') + +With string-to-number conversion +SELECT ExtractValue('b1b2','/a/b["1"]'); +ExtractValue('b1b2','/a/b["1"]') +b1 +SELECT ExtractValue('b1b2','/a/b["1 and string"]'); +ExtractValue('b1b2','/a/b["1 and string"]') +b1 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '1 and string"]' +Warning 1292 Truncated incorrect INTEGER value: '1 and string"]' +SELECT ExtractValue('b1b2','/a/b["string and 1"]'); +ExtractValue('b1b2','/a/b["string and 1"]') + +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'string and 1"]' +Warning 1292 Truncated incorrect INTEGER value: 'string and 1"]' +SELECT ExtractValue('b1b2','/a/b["string"]'); +ExtractValue('b1b2','/a/b["string"]') + +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'string"]' +Warning 1292 Truncated incorrect INTEGER value: 'string"]' +String-to-number conversion from a user variable +SET @i='1'; +SELECT ExtractValue('b1b2','/a/b[$@i]'); +ExtractValue('b1b2','/a/b[$@i]') +b1 +SET @i='1 and string'; +SELECT ExtractValue('b1b2','/a/b[$@i]'); +ExtractValue('b1b2','/a/b[$@i]') +b1 +SET @i='string and 1'; +SELECT ExtractValue('b1b2','/a/b[$@i]'); +ExtractValue('b1b2','/a/b[$@i]') + +SET @i='string'; +SELECT ExtractValue('b1b2','/a/b[$@i]'); +ExtractValue('b1b2','/a/b[$@i]') + +String-to-number conversion with a CHAR SP variable +CREATE PROCEDURE spxml(xml VARCHAR(128), i CHAR(16)) +BEGIN +SELECT ExtractValue(xml,'/a/b[$i]'); +END| +CALL spxml('b1b2', '1'); +ExtractValue(xml,'/a/b[$i]') +b1 +CALL spxml('b1b2', '1 and string'); +ExtractValue(xml,'/a/b[$i]') +b1 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '1 and string ' +Warning 1292 Truncated incorrect INTEGER value: '1 and string ' +CALL spxml('b1b2', 'string and 1'); +ExtractValue(xml,'/a/b[$i]') + +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'string and 1 ' +Warning 1292 Truncated incorrect INTEGER value: 'string and 1 ' +CALL spxml('b1b2', 'string'); +ExtractValue(xml,'/a/b[$i]') + +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'string ' +Warning 1292 Truncated incorrect INTEGER value: 'string ' +DROP PROCEDURE spxml; diff --git a/mysql-test/t/xml.test b/mysql-test/t/xml.test index 8517dce111f..94b45fa249f 100644 --- a/mysql-test/t/xml.test +++ b/mysql-test/t/xml.test @@ -444,3 +444,75 @@ select ExtractValue('test', '/a/parent'); select ExtractValue('test', '/a/preceding'); select ExtractValue('test', '/a/preceding-sibling'); select ExtractValue('test', '/a/self'); + +# +# Bug#26518 XPath and variables problem +# Check with user defined variables +# +set @i=1; +select ExtractValue('b1b2','/a/b[$@i]'); +set @i=2; +select ExtractValue('b1b2','/a/b[$@i]'); +set @i=NULL; +select ExtractValue('b1b2','/a/b[$@i]'); + +# +# Check variables in a stored procedure - both local and user variables +# Make sure that SP and local variables with the same name work together. +# +DELIMITER |; +CREATE PROCEDURE spxml(xml VARCHAR(128)) +BEGIN + DECLARE c INT; + DECLARE i INT DEFAULT 1; + SET c= ExtractValue(xml,'count(/a/b)'); + SET @i= c; + WHILE i <= c DO + BEGIN + SELECT i, @i, ExtractValue(xml,'/a/b[$i]'), ExtractValue(xml,'/a/b[$@i]'); + SET i= i + 1; + SET @i= @i - 1; + END; + END WHILE; +END| +DELIMITER ;| + +call spxml('b1b2b3'); +drop procedure spxml; + +# +# Additional tests for bug#26518 +--echo Multiple matches, but no index specification +SELECT ExtractValue('b1b2','/a/b'); +--echo No matches +SELECT ExtractValue('b1b2','/a/c'); +--echo Index out of range +SELECT ExtractValue('b1b2','/a/b[-1]'); +SELECT ExtractValue('b1b2','/a/b[10]'); +--echo With string-to-number conversion +SELECT ExtractValue('b1b2','/a/b["1"]'); +SELECT ExtractValue('b1b2','/a/b["1 and string"]'); +SELECT ExtractValue('b1b2','/a/b["string and 1"]'); +SELECT ExtractValue('b1b2','/a/b["string"]'); +--echo String-to-number conversion from a user variable +SET @i='1'; +SELECT ExtractValue('b1b2','/a/b[$@i]'); +SET @i='1 and string'; +SELECT ExtractValue('b1b2','/a/b[$@i]'); +SET @i='string and 1'; +SELECT ExtractValue('b1b2','/a/b[$@i]'); +SET @i='string'; +SELECT ExtractValue('b1b2','/a/b[$@i]'); + +--echo String-to-number conversion with a CHAR SP variable +DELIMITER |; +CREATE PROCEDURE spxml(xml VARCHAR(128), i CHAR(16)) +BEGIN + SELECT ExtractValue(xml,'/a/b[$i]'); +END| +DELIMITER ;| +CALL spxml('b1b2', '1'); +CALL spxml('b1b2', '1 and string'); +CALL spxml('b1b2', 'string and 1'); +CALL spxml('b1b2', 'string'); +DROP PROCEDURE spxml; diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc index 26474990644..52962b3558e 100644 --- a/sql/item_xmlfunc.cc +++ b/sql/item_xmlfunc.cc @@ -19,7 +19,7 @@ #include "mysql_priv.h" #include "my_xml.h" - +#include "sp_pcontext.h" /* TODO: future development directions: @@ -2412,21 +2412,78 @@ my_xpath_parse_QName(MY_XPATH *xpath) } -/* +/** Scan Variable reference - SYNOPSYS + @details Implements parsing of two syntax structures: - [36] VariableReference ::= '$' QName - RETURN - 1 - success - 0 - failure + 1. Standard XPath syntax [36], for SP variables: + + VariableReference ::= '$' QName + + Finds a SP variable with the given name. + If outside of a SP context, or variable with + the given name doesn't exists, then error is returned. + + 2. Non-standard syntax - MySQL extension for user variables: + + VariableReference ::= '$' '@' QName + + Item, corresponding to the variable, is returned + in xpath->item in both cases. + + @param xpath pointer to XPath structure + + @return Operation status + @retval 1 Success + @retval 0 Failure */ + static int my_xpath_parse_VariableReference(MY_XPATH *xpath) { - return my_xpath_parse_term(xpath, MY_XPATH_LEX_DOLLAR) && - my_xpath_parse_term(xpath, MY_XPATH_LEX_IDENT); + LEX_STRING name; + int user_var; + const char *dollar_pos; + if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_DOLLAR) || + (!(dollar_pos= xpath->prevtok.beg)) || + (!((user_var= my_xpath_parse_term(xpath, MY_XPATH_LEX_AT) && + my_xpath_parse_term(xpath, MY_XPATH_LEX_IDENT))) && + !my_xpath_parse_term(xpath, MY_XPATH_LEX_IDENT))) + return 0; + + name.length= xpath->prevtok.end - xpath->prevtok.beg; + name.str= (char*) xpath->prevtok.beg; + + if (user_var) + xpath->item= new Item_func_get_user_var(name); + else + { + sp_variable_t *spv; + sp_pcontext *spc; + LEX *lex; + if ((lex= current_thd->lex) && + (spc= lex->spcont) && + (spv= spc->find_variable(&name))) + { + Item_splocal *splocal= new Item_splocal(name, spv->offset, spv->type, 0); +#ifndef DBUG_OFF + if (splocal) + splocal->m_sp= lex->sphead; +#endif + xpath->item= (Item*) splocal; + } + else + { + xpath->item= NULL; + DBUG_ASSERT(xpath->query.end > dollar_pos); + uint len= xpath->query.end - dollar_pos; + set_if_smaller(len, 32); + my_printf_error(ER_UNKNOWN_ERROR, "Unknown XPATH variable at: '%.*s'", + MYF(0), len, dollar_pos); + } + } + return xpath->item ? 1 : 0; } From 7dec2749f4d4fdd8c4d72f81958fbaa08057494c Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 8 May 2007 17:04:56 +0500 Subject: [PATCH 08/35] Fixing crash when compiled using -DNEW_HASH_FUNCTIONS (an experimental feature). --- heap/hp_hash.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/heap/hp_hash.c b/heap/hp_hash.c index c5a30a3ef65..d8eee9c794c 100644 --- a/heap/hp_hash.c +++ b/heap/hp_hash.c @@ -379,7 +379,13 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec) ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key) { - register ulong nr=0; + /* + Note, if a key consists of a combination of numeric and + a text columns, it most likely won't work well. + Making text columns work with NEW_HASH_FUNCTION + needs also changes in strings/ctype-xxx.c. + */ + ulong nr= 1, nr2= 4; HA_KEYSEG *seg,*endseg; for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++) @@ -401,14 +407,15 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key) } if (seg->type == HA_KEYTYPE_TEXT) { - seg->charset->hash_sort(seg->charset,pos,((uchar*)key)-pos,&nr,NULL); + seg->charset->coll->hash_sort(seg->charset, pos, ((uchar*)key)-pos, + &nr, &nr2); } else if (seg->type == HA_KEYTYPE_VARTEXT1) /* Any VARCHAR segments */ { uint pack_length= 2; /* Key packing is constant */ uint length= uint2korr(pos); - seg->charset->hash_sort(seg->charset, pos+pack_length, length, &nr, - NULL); + seg->charset->coll->hash_sort(seg->charset, pos+pack_length, length, + &nr, &nr2); key+= pack_length; } else @@ -428,7 +435,7 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key) ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec) { - register ulong nr=0; + ulong nr= 1, nr2= 4; HA_KEYSEG *seg,*endseg; for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++) @@ -444,14 +451,16 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec) } if (seg->type == HA_KEYTYPE_TEXT) { - seg->charset->hash_sort(seg->charset,pos,((uchar*)key)-pos,&nr,NULL); + uint char_length= seg->length; /* TODO: fix to use my_charpos() */ + seg->charset->coll->hash_sort(seg->charset, pos, char_length, + &nr, &nr2); } else if (seg->type == HA_KEYTYPE_VARTEXT1) /* Any VARCHAR segments */ { uint pack_length= seg->bit_start; uint length= (pack_length == 1 ? (uint) *(uchar*) pos : uint2korr(pos)); - seg->charset->hash_sort(seg->charset, pos+pack_length, - length, &nr, NULL); + seg->charset->coll->hash_sort(seg->charset, pos+pack_length, + length, &nr, &nr2); } else { From f508249f8b476646f2423bd33e76946ae36a5eca Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 8 May 2007 10:17:00 -0400 Subject: [PATCH 09/35] BUG#17233 : LOAD DATA INFILE: failure causes mysqld dbug_assert, binlog not flushed This patch corrects a bug involving a LOAD DATA INFILE operation on a transactional table. It corrects a problem in the error handler by moving the transactional table check and autocommit_or_rollback operation to the end of the error handler. The problem was an assert was thrown after the operation completed. The assert found a non-sunk event in the transaction cache. The events in the transaction cache were added after commit_or_rollack and thereafter nothing removed them. An additional test case was added to detect this condition. mysql-test/extra/rpl_tests/rpl_loaddata.test: BUG#17233 : LOAD DATA INFILE: failure causes mysqld dbug_assert, binlog not flushed This patch adds an additional test to rpl_loaddata for handling the duplicate key error on LOAD DATA INFILE. mysql-test/r/rpl_loaddata.result: BUG#17233 : LOAD DATA INFILE: failure causes mysqld dbug_assert, binlog not flushed This patch adds the results for the additional test for properly handling the duplicate key error on LOAD DATA INFILE. sql/sql_load.cc: BUG#17233 : LOAD DATA INFILE: failure causes mysqld dbug_assert, binlog not flushed This patch moves the check for a transactional table and rollback in the error handler for mysql_load(). The patch moves the transactional table check to the end of the error handler matching the implementation for other similar operations (see sql_insert). --- mysql-test/extra/rpl_tests/rpl_loaddata.test | 12 ++++++++++++ mysql-test/r/rpl_loaddata.result | 4 ++++ sql/sql_load.cc | 6 +++--- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/mysql-test/extra/rpl_tests/rpl_loaddata.test b/mysql-test/extra/rpl_tests/rpl_loaddata.test index 111b66ff7fe..dea83f65898 100644 --- a/mysql-test/extra/rpl_tests/rpl_loaddata.test +++ b/mysql-test/extra/rpl_tests/rpl_loaddata.test @@ -15,6 +15,7 @@ # Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986) -- source include/master-slave.inc +source include/have_innodb.inc; connection slave; reset master; @@ -156,4 +157,15 @@ drop table t2; connection master; drop table t2; drop table t1; + +# BUG#17233 LOAD DATA INFILE: failure causes mysqld dbug_assert, binlog not flushed +CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB; + +--error ER_DUP_ENTRY_WITH_KEY_NAME +LOAD DATA INFILE "../std_data_ln/words.dat" INTO TABLE t1; + +--disable warnings +DROP TABLE IF EXISTS t1; +--enable warnings + # End of 4.1 tests diff --git a/mysql-test/r/rpl_loaddata.result b/mysql-test/r/rpl_loaddata.result index cabc20b7057..680796a4be6 100644 --- a/mysql-test/r/rpl_loaddata.result +++ b/mysql-test/r/rpl_loaddata.result @@ -86,3 +86,7 @@ ERROR 23000: Duplicate entry '2003-03-22' for key 'day' drop table t2; drop table t2; drop table t1; +CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB; +LOAD DATA INFILE "../std_data_ln/words.dat" INTO TABLE t1; +ERROR 23000: Duplicate entry 'Aarhus' for key 'PRIMARY' +DROP TABLE IF EXISTS t1; diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 71cc4c0507c..40962d82bc4 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -413,9 +413,6 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, if (error) { - if (transactional_table) - ha_autocommit_or_rollback(thd,error); - if (read_file_from_client) while (!read_info.next_line()) ; @@ -463,6 +460,9 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, } } #endif /*!EMBEDDED_LIBRARY*/ + if (transactional_table) + ha_autocommit_or_rollback(thd,error); + error= -1; // Error on read goto err; } From c63086259a51677800d4c4380f54846bf0bdecdc Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 11 May 2007 11:48:34 +0400 Subject: [PATCH 10/35] WL#3702 --- mysql-test/mysql-test-run.pl | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 7f775bd0942..a0517b71251 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -3851,13 +3851,15 @@ sub mysqld_arguments ($$$$) { } else { - mtr_add_arg($args, "%s--master-user=root", $prefix); - mtr_add_arg($args, "%s--master-connect-retry=1", $prefix); - mtr_add_arg($args, "%s--master-host=127.0.0.1", $prefix); - mtr_add_arg($args, "%s--master-password=", $prefix); - mtr_add_arg($args, "%s--master-port=%d", $prefix, - $master->[0]->{'port'}); # First master - + if ($mysql_version_id < 50200) + { + mtr_add_arg($args, "%s--master-user=root", $prefix); + mtr_add_arg($args, "%s--master-connect-retry=1", $prefix); + mtr_add_arg($args, "%s--master-host=127.0.0.1", $prefix); + mtr_add_arg($args, "%s--master-password=", $prefix); + mtr_add_arg($args, "%s--master-port=%d", $prefix, + $master->[0]->{'port'}); # First master + } my $slave_server_id= 2 + $idx; my $slave_rpl_rank= $slave_server_id; mtr_add_arg($args, "%s--server-id=%d", $prefix, $slave_server_id); From 199dab236da0713d575b421ddd632232905a1022 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 11 May 2007 14:13:20 -0400 Subject: [PATCH 11/35] BUG#17233 : LOAD DATA INFILE: failure causes mysqld dbug_assert, binlog not flushed This patch enables the NDB test ndb_load that was previously disabled as a result of the LOAD DATA INFILE bug reported in BUG#17233. --- mysql-test/t/disabled.def | 1 - 1 file changed, 1 deletion(-) diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index df56165950f..f57ead41926 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -10,5 +10,4 @@ # ############################################################################## -ndb_load : Bug#17233 user_limits : Bug#23921 random failure of user_limits.test From b626d5d78e512b349673cdaebe6eb099d99c925d Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 22 May 2007 10:50:32 -0400 Subject: [PATCH 12/35] BUG#17654 : --read-from-remote-server causes core This patch corrects a problem encountered when reading the binlog from a remote host. The application was crashing because the buffer variable (temp_buf) in log_event was not pointing to the incoming data. For a normal file read, this buffer is allocated by a previous call of read_log_event. However, when reading from a remote host, the first call to read_log_event is not executed therefore no buffer is allocated. Furthermore, there is no need to allocate a new buffer because the incoming stream is what needs to be read. This patch adds the call to initialize the temp_buf variable if reading from a remote host. It also adds a check at destroy time to ensure the temp_buf is not freed if reading from a remote host. client/mysqlbinlog.cc: BUG#17654 : --read-from-remote-server causes core This patch corrects a problem when reading from a remote host. The temp_buf variable of the log_event class is undefined. This patch assigns the temp_buf variable to the address of the incoming stream. This allows the print functions to print the binlog events correctly. mysql-test/r/rpl_row_mysqlbinlog.result: BUG#17654 : --read-from-remote-server causes core This patch adds the results for the test that were disabled when the bug report was investigated. The patch also adds an additional test was added to ensure the output of reading from a remote host is the same as reading from a local file. mysql-test/t/rpl_row_mysqlbinlog.test: BUG#17654 : --read-from-remote-server causes core This patch enables the portions of the test that were disabled when the bug report was investigated. The patch also adds an additional test was added to ensure the output of reading from a remote host is the same as reading from a local file. --- client/mysqlbinlog.cc | 14 ++++ mysql-test/r/rpl_row_mysqlbinlog.result | 76 +++++++++++++++++ mysql-test/t/rpl_row_mysqlbinlog.test | 107 +++++++++++++++--------- 3 files changed, 157 insertions(+), 40 deletions(-) diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 033c55707fc..d2357aa10ec 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -682,8 +682,16 @@ Begin_load_query event for file_id: %u\n", exlq->file_id); end: rec_count++; + /* + Destroy the log_event object. If reading from a remote host, + set the temp_buf to NULL so that memory isn't freed twice. + */ if (ev) + { + if (remote_opt) + ev->temp_buf= 0; delete ev; + } DBUG_RETURN(0); } @@ -1172,6 +1180,12 @@ could be out of memory"); error= 1; goto err; } + /* + If reading from a remote host, ensure the temp_buf for the + Log_event class is pointing to the incoming stream. + */ + if (remote_opt) + ev->register_temp_buf((char*) net->read_pos + 1); Log_event_type type= ev->get_type_code(); if (glob_description_event->binlog_version >= 3 || diff --git a/mysql-test/r/rpl_row_mysqlbinlog.result b/mysql-test/r/rpl_row_mysqlbinlog.result index c9f46e73cfd..e2df1459ac0 100644 --- a/mysql-test/r/rpl_row_mysqlbinlog.result +++ b/mysql-test/r/rpl_row_mysqlbinlog.result @@ -190,6 +190,75 @@ DELIMITER ; ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +--- Test 4 Second Remote test -- +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +stop slave; +reset master; +reset slave; +start slave; +SELECT COUNT(*) from t1; +COUNT(*) +352 +SELECT COUNT(*) from t2; +COUNT(*) +500 +SELECT COUNT(*) from t3; +COUNT(*) +500 +SELECT * FROM t1 ORDER BY word LIMIT 5; +word +Aarhus +Aarhus +Aarhus +Aarhus +Aarhus +SELECT * FROM t2 ORDER BY id LIMIT 5; +id +1 +2 +3 +4 +5 +SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; +c1 c3 c4 c5 +1 2006-02-22 00:00:00 Tested in Texas 2.2 +2 2006-02-22 00:00:00 Tested in Texas 4.4 +3 2006-02-22 00:00:00 Tested in Texas 6.6 +4 2006-02-22 00:00:00 Tested in Texas 8.8 +5 2006-02-22 00:00:00 Tested in Texas 11 +SELECT COUNT(*) from t1; +COUNT(*) +352 +SELECT COUNT(*) from t2; +COUNT(*) +500 +SELECT COUNT(*) from t3; +COUNT(*) +500 +SELECT * FROM t1 ORDER BY word LIMIT 5; +word +Aarhus +Aarhus +Aarhus +Aarhus +Aarhus +SELECT * FROM t2 ORDER BY id LIMIT 5; +id +1 +2 +3 +4 +5 +SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; +c1 c3 c4 c5 +1 2006-02-22 00:00:00 Tested in Texas 2.2 +2 2006-02-22 00:00:00 Tested in Texas 4.4 +3 2006-02-22 00:00:00 Tested in Texas 6.6 +4 2006-02-22 00:00:00 Tested in Texas 8.8 +5 2006-02-22 00:00:00 Tested in Texas 11 + --- Test 5 LOAD DATA -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; @@ -273,4 +342,11 @@ HEX(f) 835C --- Test cleanup -- +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a INT NOT NULL KEY, b INT); +INSERT INTO t1 VALUES(1,1); +SELECT * FROM t1; +a b +1 1 +FLUSH LOGS; DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5; diff --git a/mysql-test/t/rpl_row_mysqlbinlog.test b/mysql-test/t/rpl_row_mysqlbinlog.test index f7158107e4c..9b451ed7a8b 100644 --- a/mysql-test/t/rpl_row_mysqlbinlog.test +++ b/mysql-test/t/rpl_row_mysqlbinlog.test @@ -181,67 +181,67 @@ select "--- Test 3 First Remote test --" as ""; --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 # This part is disabled due to bug #17654 -################### Start Bug 17654 ###################### -#--disable_query_log -#select "--- Test 4 Second Remote test --" as ""; -#--enable_query_log -#--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 > $MYSQLTEST_VARDIR/tmp/remote.sql -#--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 >> $MYSQLTEST_VARDIR/tmp/remote.sql +--disable_query_log +select "--- Test 4 Second Remote test --" as ""; +--enable_query_log +--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 > $MYSQLTEST_VARDIR/tmp/remote.sql + +--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 >> $MYSQLTEST_VARDIR/tmp/remote.sql # Now that we have our file, lets get rid of the current database. # Cleanup the master and the slave and try to recreate. -#DROP TABLE t1; -#DROP TABLE t2; -#DROP TABLE t3; +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; -#sync_slave_with_master; +sync_slave_with_master; #we expect STOP SLAVE to produce a warning as the slave is stopped #(the server was started with skip-slave-start) -#--disable_warnings -#stop slave; -#--enable_warnings -#--require r/slave-stopped.result -#show status like 'Slave_running'; -#connection master; -#reset master; -#connection slave; -#reset slave; -#start slave; -#--require r/slave-running.result -#show status like 'Slave_running'; -#connection master; +--disable_warnings +stop slave; +--enable_warnings +--require r/slave-stopped.result +show status like 'Slave_running'; +connection master; +reset master; +connection slave; +reset slave; +start slave; +--require r/slave-running.result +show status like 'Slave_running'; +connection master; # We should be clean at this point, now we will run in the file from above. -#--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/remote.sql" +--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/remote.sql" # Lets Check the tables on the Master -#SELECT COUNT(*) from t1; -#SELECT COUNT(*) from t2; -#SELECT COUNT(*) from t3; -#SELECT * FROM t1 ORDER BY word LIMIT 5; -#SELECT * FROM t2 ORDER BY id LIMIT 5; -#SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; +SELECT COUNT(*) from t1; +SELECT COUNT(*) from t2; +SELECT COUNT(*) from t3; +SELECT * FROM t1 ORDER BY word LIMIT 5; +SELECT * FROM t2 ORDER BY id LIMIT 5; +SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; # Should have the same on the slave; -#sync_slave_with_master; -#SELECT COUNT(*) from t1; -#SELECT COUNT(*) from t2; -#SELECT COUNT(*) from t3; -#SELECT * FROM t1 ORDER BY word LIMIT 5; -#SELECT * FROM t2 ORDER BY id LIMIT 5; -#SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; -#connection master; +sync_slave_with_master; +SELECT COUNT(*) from t1; +SELECT COUNT(*) from t2; +SELECT COUNT(*) from t3; +SELECT * FROM t1 ORDER BY word LIMIT 5; +SELECT * FROM t2 ORDER BY id LIMIT 5; +SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; +connection master; # We should be gold by the time, so I will get rid of our file. -#--exec rm $MYSQLTEST_VARDIR/tmp/remote.sql +--exec rm $MYSQLTEST_VARDIR/tmp/remote.sql ################### End Bug 17654 ###################### # LOAD DATA @@ -313,7 +313,34 @@ select "--- Test cleanup --" as ""; --enable_query_log # clean up connection master; -DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5; sync_slave_with_master; +connection master; + +# BUG#17654 also test mysqlbinlog to ensure it can read the binlog from a remote server +# and ensure that the results are the same as if read from a file (the same file). + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 (a INT NOT NULL KEY, b INT); + +INSERT INTO t1 VALUES(1,1); + +SELECT * FROM t1; + +FLUSH LOGS; + +--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 > $MYSQLTEST_VARDIR/tmp/remote.sql +--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/local.sql + +--diff_files $MYSQLTEST_VARDIR/tmp/local.sql $MYSQLTEST_VARDIR/tmp/remote.sql + +--exec rm $MYSQLTEST_VARDIR/tmp/remote.sql + +--exec rm $MYSQLTEST_VARDIR/tmp/local.sql + +DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5; + # End of 4.1 tests From 1da8ea2ee06f67b3e498520fe22900c748b31dcf Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 May 2007 12:34:47 +0500 Subject: [PATCH 13/35] Bug#28558 UpdateXML called with garbage crashes server Problem: Memory overrun happened in attempts to generate error messages (e.g. in case of incorrect XPath syntax). Reason: set_if_bigger() was used instead of set_if_smaller(). Change: replacing wrong set_if_bigger() to set_if_smaller(), and making minor additional code clean-ups. mysql-test/r/xml.result: Adding test cases for all pieces of code with set_if_smaller() followed by my_printf_error(). mysql-test/t/xml.test: Adding test cases for all pieces of code with set_if_smaller() followed by my_printf_error(). sql/item_xmlfunc.cc: - fixing incorrect set_if_bigger to set_if_smaller in two places - getting read of unnesessary "char context[32]" variable and using '%.*s' instead if '%s' in the error format. --- mysql-test/r/xml.result | 6 ++++++ mysql-test/t/xml.test | 10 ++++++++++ sql/item_xmlfunc.cc | 12 +++++------- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result index 77764e1bc1a..f71b8cadabb 100644 --- a/mysql-test/r/xml.result +++ b/mysql-test/r/xml.result @@ -1006,3 +1006,9 @@ Warnings: Warning 1292 Truncated incorrect INTEGER value: 'string ' Warning 1292 Truncated incorrect INTEGER value: 'string ' DROP PROCEDURE spxml; +select UpdateXML('a',repeat('a b ',1000),''); +ERROR HY000: XPATH syntax error: 'b a b a b a b a b a b a b a b a ' +select ExtractValue('a', '/a[@x=@y0123456789_0123456789_0123456789_0123456789]'); +ERROR HY000: XPATH error: comparison of two nodesets is not supported: '=@y0123456789_0123456789_0123456' +select ExtractValue('a', '/a[@x=$y0123456789_0123456789_0123456789_0123456789]'); +ERROR HY000: Unknown XPATH variable at: '$y0123456789_0123456789_01234567' diff --git a/mysql-test/t/xml.test b/mysql-test/t/xml.test index 28abd3475d2..1d16652ab1e 100644 --- a/mysql-test/t/xml.test +++ b/mysql-test/t/xml.test @@ -523,3 +523,13 @@ CALL spxml('b1b2', '1 and string'); CALL spxml('b1b2', 'string and 1'); CALL spxml('b1b2', 'string'); DROP PROCEDURE spxml; + +# +# Bug#28558 UpdateXML called with garbage crashes server +# +--error 1105 +select UpdateXML('a',repeat('a b ',1000),''); +--error 1105 +select ExtractValue('a', '/a[@x=@y0123456789_0123456789_0123456789_0123456789]'); +--error 1105 +select ExtractValue('a', '/a[@x=$y0123456789_0123456789_0123456789_0123456789]'); diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc index 147c2bc8212..428bffa6879 100644 --- a/sql/item_xmlfunc.cc +++ b/sql/item_xmlfunc.cc @@ -923,8 +923,8 @@ static Item *create_comparator(MY_XPATH *xpath, else if (a->type() == Item::XPATH_NODESET && b->type() == Item::XPATH_NODESET) { - uint len= context->end - context->beg; - set_if_bigger(len, 32); + uint len= xpath->query.end - context->beg; + set_if_smaller(len, 32); my_printf_error(ER_UNKNOWN_ERROR, "XPATH error: " "comparison of two nodesets is not supported: '%.*s'", @@ -2591,12 +2591,10 @@ void Item_xml_str_func::fix_length_and_dec() if (!rc) { - char context[32]; uint clen= xpath.query.end - xpath.lasttok.beg; - set_if_bigger(clen, sizeof(context) - 1); - strmake(context, xpath.lasttok.beg, clen); - my_printf_error(ER_UNKNOWN_ERROR, "XPATH syntax error: '%s'", - MYF(0), context); + set_if_smaller(clen, 32); + my_printf_error(ER_UNKNOWN_ERROR, "XPATH syntax error: '%.*s'", + MYF(0), clen, xpath.lasttok.beg); return; } From a53b80b3f3f187370d3360202b7849856ab9582a Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 May 2007 17:32:40 +0500 Subject: [PATCH 14/35] Bug#27636 mysqlbinlog-cp932 and ctype_cp932 tests fails if LC_* variables set to *_*.UTF-8 As MySQL character set tests can print results in many character sets (latin1, utf8-8, sjis, cp932 and others) - its output can be incompatible with the current locale settings, which makes PERL confuse. Fix: reset LC_ALL and LC_CTYPE to "C", which is compatible with any character set. mysql-test/mysql-test-run.pl: Ignore current locale settings, because "mysqltest" output can be not compatible with the locale. --- mysql-test/mysql-test-run.pl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index b48ac6c5abc..cbd7ccd5bbd 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1792,6 +1792,18 @@ sub environment_setup () { $ENV{'CHARSETSDIR'}= $path_charsetsdir; $ENV{'UMASK'}= "0660"; # The octal *string* $ENV{'UMASK_DIR'}= "0770"; # The octal *string* + + # + # MySQL tests can produce output in various character sets + # (especially, ctype_xxx.test). To avoid confusing Perl + # with output which is incompatible with the current locale + # settings, we reset the current values of LC_ALL and LC_CTYPE to "C". + # For details, please see + # Bug#27636 tests fails if LC_* variables set to *_*.UTF-8 + # + $ENV{'LC_ALL'}= "C"; + $ENV{'LC_CTYPE'}= "C"; + $ENV{'LC_COLLATE'}= "C"; $ENV{'USE_RUNNING_SERVER'}= $opt_extern; $ENV{'MYSQL_TEST_DIR'}= $glob_mysql_test_dir; From 1d985e48c8fbbd2e6ca9c85e327658430fb39086 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 24 May 2007 17:35:22 +0200 Subject: [PATCH 15/35] Raise version number after cloning 5.1.19-beta --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index e3c6edb9b0f..3ba8f64cad1 100644 --- a/configure.in +++ b/configure.in @@ -10,7 +10,7 @@ AC_CANONICAL_SYSTEM # # When changing major version number please also check switch statement # in mysqlbinlog::check_master_version(). -AM_INIT_AUTOMAKE(mysql, 5.1.19-beta) +AM_INIT_AUTOMAKE(mysql, 5.1.20-beta) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 From aae1ff670bd847feb0ecf2352dc8c9a156318c72 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 28 May 2007 15:23:12 +0200 Subject: [PATCH 16/35] Added missing result file mysql-test/r/rpl_critical_errors.result: Missing result file --- mysql-test/r/rpl_critical_errors.result | 1 + 1 file changed, 1 insertion(+) create mode 100644 mysql-test/r/rpl_critical_errors.result diff --git a/mysql-test/r/rpl_critical_errors.result b/mysql-test/r/rpl_critical_errors.result new file mode 100644 index 00000000000..bcc53565084 --- /dev/null +++ b/mysql-test/r/rpl_critical_errors.result @@ -0,0 +1 @@ +Turn on parsing to run this test From f27bf2b4635202d73b2da712c2bb0f522083cc24 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 28 May 2007 22:20:22 +0300 Subject: [PATCH 17/35] Bug#22725 Replication outages from ER_SERVER_SHUTDOWN (1053) set in replication events The reason for the bug was that replaying of a query on slave could not be possible since its event was recorded with the killed error. Due to the specific of handling INSERT, which per-row-while-loop is unbreakable to killing, the query on transactional table should have not appeared in binlog unless there was a call to a stored routine that got interrupted with killing (and then there must be an error returned out of the loop). The offered solution added the following rule for binlogging of INSERT that accounts the above specifics: For INSERT on transactional-table if the error was not set the only raised flag is harmless and is ignored via masking out on time of creation of binlog event. For both table types the combination of raised error and KILLED flag indicates that there was potentially partial execution on master and consistency is under the question. In that case the code continues to binlog an event with an appropriate killed error. The fix relies on the specified behaviour of stored routine that must propagate the error to the top level query handling if the thd->killed flag was raised in the routine execution. The patch adds an arg with the default killed-status-unset value to Query_log_event::Query_log_event. sql/log_event.cc: killed_status as the value of thd->killed can be passed as an arg to the constructor. if the value is different from the default the arg is set to the current thd->killed value. A caller might need to masquerade thd->killed with THD::NOT_KILLED. So far only mysql_insert() uses such explicit way to tell the constructor about killing status. sql/log_event.h: default arg to the constructor with meaning of killed status of the query. if the arg is not explicitly provided the status of thd->killed will be snapshot inside of the constuctor, which is potentially incorrect (see bug#27571) sql/sql_class.h: extending killed_state with no-state member. sql/sql_insert.cc: ignore the KILLED flag incl KILL_BAD_DATA when the INSERT query event is created without an `error'; sql/sql_update.cc: Suggestion how to fix bug#27571 as comments. mysql-test/r/binlog_killed.result: new result file mysql-test/t/binlog_killed.test: regression tests also apply for bug27563, BUG#27565 --- mysql-test/r/binlog_killed.result | 106 +++++++++++++++ mysql-test/t/binlog_killed.test | 206 ++++++++++++++++++++++++++++++ sql/log_event.cc | 29 ++++- sql/log_event.h | 3 +- sql/sql_class.h | 12 +- sql/sql_insert.cc | 28 +++- sql/sql_update.cc | 31 +++++ 7 files changed, 406 insertions(+), 9 deletions(-) create mode 100644 mysql-test/r/binlog_killed.result create mode 100644 mysql-test/t/binlog_killed.test diff --git a/mysql-test/r/binlog_killed.result b/mysql-test/r/binlog_killed.result new file mode 100644 index 00000000000..196400eaf9e --- /dev/null +++ b/mysql-test/r/binlog_killed.result @@ -0,0 +1,106 @@ +create function bug27563() +RETURNS int(11) +DETERMINISTIC +begin +select get_lock("a", 10) into @a; +return 1; +end| +create function bug27565() +RETURNS int(11) +DETERMINISTIC +begin +select a from t1 where a=1 into @a for update; +return 1; +end| +create table t1 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB; +create table t2 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=MyISAM; +create table t3 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB; +reset master; +select get_lock("a", 20); +get_lock("a", 20) +1 +insert into t1 values (bug27563(),1); +kill query 3; +affected rows: 1 +show master status /* must be only FD event unless Bug#27563 */; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 260 +select count(*) from t1 /* must be zero unless Bug#27563 */; +count(*) +1 +begin; +insert into t1 values (bug27563(),1); +kill query 3; +affected rows: 1 +select count(*) from t1 /* must be zero unless Bug#27563 */; +count(*) +2 +commit; +reset master; +insert into t2 values (bug27563(),1); +kill query 3; +select count(*) from t2 /* must be one */; +count(*) +1 +show master status /* must have the insert event more to FD */; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 225 +select RELEASE_LOCK("a"); +RELEASE_LOCK("a") +1 +delete from t1; +delete from t2; +insert into t1 values (1,1); +insert into t2 values (1,1); +begin; +update t1 set b=0 where a=1; +update t2 set b=bug27565()-1 where a=1; +kill query 3; +commit; +Got one of the listed errors +select * from t1 /* must be: (1,0) */; +a b +1 0 +select * from t2 /* must be as before: (1,1) */; +a b +1 1 +delete from t3; +reset master; +begin; +update t1 set b=0 where a=1; +insert into t3 values (0,0),(1,bug27565()); +kill query 3; +rollback; +Got one of the listed errors +select count(*) from t3 /* must be zero */; +count(*) +0 +show master status /* nothing in binlog */; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 98 +delete from t2; +reset master; +begin; +update t1 set b=0 where a=1; +insert into t2 values (0,0),(1,bug27565()) /* non-ta t2 */; +kill query 3; +rollback; +Got one of the listed errors +select count(*) from t2 /* count must be one */; +count(*) +1 +show master status /* insert into non-ta must be in binlog */; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 247 +select +(@a:=load_file("MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog")) +is not null; +(@a:=load_file("MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog")) +is not null +1 +select @a like "%#%error_code=1317%" /* must return 1 */; +@a like "%#%error_code=1317%" +1 +drop table t1,t2,t3; +drop function bug27563; +drop function bug27565; diff --git a/mysql-test/t/binlog_killed.test b/mysql-test/t/binlog_killed.test new file mode 100644 index 00000000000..4e92632c218 --- /dev/null +++ b/mysql-test/t/binlog_killed.test @@ -0,0 +1,206 @@ +-- source include/have_innodb.inc + +### +### bug#22725 : incorrect killed error in binlogged query +### and +### Bug#27563 killing noticed in SF() stack but the error gets missed in action +### Bug#27565 killed query of SF() is not reported correctly and +### + +connect (con1, localhost, root,,); +connect (con2, localhost, root,,); + +# the function is *insensitive* to killing - TO FIX IN BUG#27563 +# the function is used in the test anyway with `TODO' left +# to correct results afterwards + +delimiter |; +create function bug27563() +RETURNS int(11) +DETERMINISTIC +begin + select get_lock("a", 10) into @a; + return 1; +end| +delimiter ;| + +# the function is sensitive to killing requiring innodb though with wrong client error +# TO FIX in BUG#27565; TODO: remove --error 1105 afterwards +delimiter |; +create function bug27565() +RETURNS int(11) +DETERMINISTIC +begin + select a from t1 where a=1 into @a for update; + return 1; +end| +delimiter ;| + +create table t1 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB; +create table t2 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=MyISAM; +create table t3 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB; +reset master; + + +### ta table case: killing causes rollback + +# A. autocommit ON +connection con1; +select get_lock("a", 20); + +connection con2; +let $ID= `select connection_id()`; +send insert into t1 values (bug27563(),1); + +connection con1; +eval kill query $ID; + +connection con2; +# todo (re-record test): after bugs 27563,27565 got fixed affected rows will report zero +--enable_info +# todo: remove 0 return after fixing Bug#27563 +--error 0,ER_QUERY_INTERRUPTED +reap; +--disable_info +###--replace_column 2 # 5 # +### show binlog events from 98 /* nothing in binlog unless Bug#27563 */; +show master status /* must be only FD event unless Bug#27563 */; +select count(*) from t1 /* must be zero unless Bug#27563 */; + +# M. multi-statement-ta +connection con2; +let $ID= `select connection_id()`; +begin; +send insert into t1 values (bug27563(),1); + +connection con1; +eval kill query $ID; +connection con2; +# todo (re-record test): after bugs 27563,27565 got fixed affected rows will report zero +--enable_info +# todo: remove 0 return after fixing Bug#27563 +--error 0,ER_QUERY_INTERRUPTED +reap; +--disable_info +select count(*) from t1 /* must be zero unless Bug#27563 */; +commit; + + +### non-ta table case: killing must be recorded in binlog + +reset master; + +connection con2; +let $ID= `select connection_id()`; +send insert into t2 values (bug27563(),1); + +connection con1; +eval kill query $ID; + +connection con2; +# todo: remove 0 return after fixing Bug#27563 +--error 0,ER_QUERY_INTERRUPTED +reap; +select count(*) from t2 /* must be one */; +#show binlog events from 98 /* must have the insert on non-ta table */; +show master status /* must have the insert event more to FD */; +# the value of the error flag of KILLED_QUERY is tested further + +connection con1; +select RELEASE_LOCK("a"); + +### test with effective killing of SF() + +delete from t1; +delete from t2; +insert into t1 values (1,1); +insert into t2 values (1,1); + +# +# Bug#27565 +# test where KILL is propagated as error to the top level +# still another bug with the error message to the user +# todo: fix reexecute the result file after fixing +# +begin; update t1 set b=0 where a=1; + +connection con2; +let $ID= `select connection_id()`; +send update t2 set b=bug27565()-1 where a=1; + +connection con1; +eval kill query $ID; +commit; + +connection con2; +# todo: fix Bug #27565 killed query of SF() is not reported correctly and +# remove 1105 (wrong) +#--error ER_QUERY_INTERRUPTED +--error 1105,ER_QUERY_INTERRUPTED +reap; +select * from t1 /* must be: (1,0) */; +select * from t2 /* must be as before: (1,1) */; + +## bug#22725 with effective and propagating killing +# +# top-level ta-table +connection con1; +delete from t3; +reset master; +begin; update t1 set b=0 where a=1; + +connection con2; +let $ID= `select connection_id()`; +# the query won't perform completely since the function gets interrupted +send insert into t3 values (0,0),(1,bug27565()); + +connection con1; +eval kill query $ID; +rollback; + +connection con2; +# todo: fix Bug #27565 killed query of SF() is not reported correctly and +# remove 1105 (wrong) +#--error ER_QUERY_INTERRUPTED +--error 1105,ER_QUERY_INTERRUPTED +reap; +select count(*) from t3 /* must be zero */; +show master status /* nothing in binlog */; + +# top-level non-ta-table +connection con1; +delete from t2; +reset master; +begin; update t1 set b=0 where a=1; + +connection con2; +let $ID= `select connection_id()`; +# the query won't perform completely since the function gets intrurrupted +send insert into t2 values (0,0),(1,bug27565()) /* non-ta t2 */; + +connection con1; +eval kill query $ID; +rollback; + +connection con2; +# todo: fix Bug #27565 killed query of SF() is not reported correctly and +# remove 1105 (wrong) +#--error ER_QUERY_INTERRUPTED +--error 1105,ER_QUERY_INTERRUPTED +reap; + +select count(*) from t2 /* count must be one */; +show master status /* insert into non-ta must be in binlog */; +--exec $MYSQL_BINLOG --start-position=126 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval select +(@a:=load_file("$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog")) +is not null; +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +eval select @a like "%#%error_code=1317%" /* must return 1 */; +system rm $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog ; + +drop table t1,t2,t3; +drop function bug27563; +drop function bug27565; + diff --git a/sql/log_event.cc b/sql/log_event.cc index 173ca6232ee..6eb247488b0 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1279,20 +1279,31 @@ Query_log_event::Query_log_event() /* - Query_log_event::Query_log_event() + SYNOPSIS + Query_log_event::Query_log_event() + thd - thread handle + query_arg - array of char representing the query + query_length - size of the `query_arg' array + using_trans - there is a modified transactional table + suppress_use - suppress the generation of 'USE' statements + killed_status_arg - an optional with default to THD::KILLED_NO_VALUE + if the value is different from the default, the arg + is set to the current thd->killed value. + A caller might need to masquerade thd->killed with + THD::NOT_KILLED. + DESCRIPTION + Creates an event for binlogging + The value for local `killed_status' can be supplied by caller. */ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, ulong query_length, bool using_trans, - bool suppress_use) + bool suppress_use, THD::killed_state killed_status_arg) :Log_event(thd_arg, ((thd_arg->tmp_table_used ? LOG_EVENT_THREAD_SPECIFIC_F : 0) | (suppress_use ? LOG_EVENT_SUPPRESS_USE_F : 0)), using_trans), data_buf(0), query(query_arg), catalog(thd_arg->catalog), db(thd_arg->db), q_len((uint32) query_length), - error_code((thd_arg->killed != THD::NOT_KILLED) ? - ((thd_arg->system_thread & SYSTEM_THREAD_DELAYED_INSERT) ? - 0 : thd->killed_errno()) : thd_arg->net.last_errno), thread_id(thd_arg->thread_id), /* save the original thread id; we already know the server id */ slave_proxy_id(thd_arg->variables.pseudo_thread_id), @@ -1304,6 +1315,14 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, charset_database_number(0) { time_t end_time; + + if (killed_status_arg == THD::KILLED_NO_VALUE) + killed_status_arg= thd_arg->killed; + error_code= + (killed_status_arg == THD::NOT_KILLED) ? thd_arg->net.last_errno : + ((thd_arg->system_thread & SYSTEM_THREAD_DELAYED_INSERT) ? 0 : + thd->killed_errno()); + time(&end_time); exec_time = (ulong) (end_time - thd->start_time); catalog_len = (catalog) ? (uint32) strlen(catalog) : 0; diff --git a/sql/log_event.h b/sql/log_event.h index a1e7adb6487..04aac5d08fc 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -804,7 +804,8 @@ public: #ifndef MYSQL_CLIENT Query_log_event(THD* thd_arg, const char* query_arg, ulong query_length, - bool using_trans, bool suppress_use); + bool using_trans, bool suppress_use, + THD::killed_state killed_err_arg= THD::KILLED_NO_VALUE); const char* get_db() { return db; } #ifdef HAVE_REPLICATION void pack_info(Protocol* protocol); diff --git a/sql/sql_class.h b/sql/sql_class.h index bef679806d0..62f4df0719f 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1397,7 +1397,14 @@ public: DYNAMIC_ARRAY user_var_events; /* For user variables replication */ MEM_ROOT *user_var_events_alloc; /* Allocate above array elements here */ - enum killed_state { NOT_KILLED=0, KILL_BAD_DATA=1, KILL_CONNECTION=ER_SERVER_SHUTDOWN, KILL_QUERY=ER_QUERY_INTERRUPTED }; + enum killed_state + { + NOT_KILLED=0, + KILL_BAD_DATA=1, + KILL_CONNECTION=ER_SERVER_SHUTDOWN, + KILL_QUERY=ER_QUERY_INTERRUPTED, + KILLED_NO_VALUE /* means neither of the states */ + }; killed_state volatile killed; /* scramble - random string sent to client on handshake */ @@ -1670,7 +1677,8 @@ public: void end_statement(); inline int killed_errno() const { - return killed != KILL_BAD_DATA ? killed : 0; + killed_state killed_val; /* to cache the volatile 'killed' */ + return (killed_val= killed) != KILL_BAD_DATA ? killed_val : 0; } inline void send_kill_message() const { diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 5720758128e..647681cdc1a 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -870,9 +870,35 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, if (mysql_bin_log.is_open()) { if (error <= 0) + { + /* + [Guilhem wrote] Temporary errors may have filled + thd->net.last_error/errno. For example if there has + been a disk full error when writing the row, and it was + MyISAM, then thd->net.last_error/errno will be set to + "disk full"... and the my_pwrite() will wait until free + space appears, and so when it finishes then the + write_row() was entirely successful + */ + /* todo: consider removing */ thd->clear_error(); + } + /* bug#22725: + + A query which per-row-loop can not be interrupted with + KILLED, like INSERT, and that does not invoke stored + routines can be binlogged with neglecting the KILLED error. + + If there was no error (error == zero) until after the end of + inserting loop the KILLED flag that appeared later can be + disregarded since previously possible invocation of stored + routines did not result in any error due to the KILLED. In + such case the flag is ignored for constructing binlog event. + */ Query_log_event qinfo(thd, thd->query, thd->query_length, - transactional_table, FALSE); + transactional_table, FALSE, + (error>0) ? thd->killed : THD::NOT_KILLED); + assert(thd->killed != THD::KILL_BAD_DATA || error > 0); if (mysql_bin_log.write(&qinfo) && transactional_table) error=1; } diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 222e33345cc..3f78c091d9b 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -521,6 +521,37 @@ int mysql_update(THD *thd, table->file->unlock_row(); thd->row_count++; } + + /* + todo bug#27571: to avoid asynchronization of `error' and + `error_code' of binlog event constructor + + The concept, which is a bit different for insert(!), is to + replace `error' assignment with the following lines + + killed_status= thd->killed; // get the status of the volatile + + Notice: thd->killed is type of "state" whereas the lhs has + "status" the suffix which translates according to WordNet: a state + at a particular time - at the time of the end of per-row loop in + our case. Binlogging ops are conducted with the status. + + error= (killed_status == THD::NOT_KILLED)? error : 1; + + which applies to most mysql_$query functions. + Event's constructor will accept `killed_status' as an argument: + + Query_log_event qinfo(..., killed_status); + + thd->killed might be changed after killed_status had got cached and this + won't affect binlogging event but other effects remain. + + Open issue: In a case the error happened not because of KILLED - + and then KILLED was caught later still within the loop - we shall + do something to avoid binlogging of incorrect ER_SERVER_SHUTDOWN + error_code. + */ + if (thd->killed && !error) error= 1; // Aborted end_read_record(&info); From 00710d17bbfac52eaac4a5283f4e08e8ffeefaf9 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 29 May 2007 16:27:55 +0300 Subject: [PATCH 18/35] Bug#22725 Replication outages from ER_SERVER_SHUTDOWN (1053) set in replication events Refining the tests since pb revealed the older version's fragality - the error from SF() due to killed may be different on different env:s. DBUG_ASSERT instead of assert. mysql-test/r/binlog_killed.result: new result file mysql-test/t/binlog_killed.test: regression for bug#22725 simplified. tests for bug27563, BUG#27565 made inactive. sql/sql_insert.cc: DBUG_ASSERT --- mysql-test/r/binlog_killed.result | 94 ++----------------------------- mysql-test/t/binlog_killed.test | 70 +++++++++++++++-------- sql/sql_insert.cc | 2 +- 3 files changed, 54 insertions(+), 112 deletions(-) diff --git a/mysql-test/r/binlog_killed.result b/mysql-test/r/binlog_killed.result index 196400eaf9e..cb5683a4792 100644 --- a/mysql-test/r/binlog_killed.result +++ b/mysql-test/r/binlog_killed.result @@ -1,106 +1,22 @@ -create function bug27563() -RETURNS int(11) -DETERMINISTIC -begin -select get_lock("a", 10) into @a; -return 1; -end| -create function bug27565() -RETURNS int(11) -DETERMINISTIC -begin -select a from t1 where a=1 into @a for update; -return 1; -end| create table t1 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB; create table t2 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=MyISAM; create table t3 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB; -reset master; select get_lock("a", 20); get_lock("a", 20) 1 -insert into t1 values (bug27563(),1); -kill query 3; -affected rows: 1 -show master status /* must be only FD event unless Bug#27563 */; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 260 -select count(*) from t1 /* must be zero unless Bug#27563 */; -count(*) -1 -begin; -insert into t1 values (bug27563(),1); -kill query 3; -affected rows: 1 -select count(*) from t1 /* must be zero unless Bug#27563 */; -count(*) -2 -commit; reset master; -insert into t2 values (bug27563(),1); +insert into t2 values (null, null), (null, get_lock("a", 10)),(null, get_lock("a", 10)); kill query 3; -select count(*) from t2 /* must be one */; +select count(*) from t2 /* must be 3 */; count(*) -1 -show master status /* must have the insert event more to FD */; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 225 -select RELEASE_LOCK("a"); -RELEASE_LOCK("a") -1 -delete from t1; -delete from t2; -insert into t1 values (1,1); -insert into t2 values (1,1); -begin; -update t1 set b=0 where a=1; -update t2 set b=bug27565()-1 where a=1; -kill query 3; -commit; -Got one of the listed errors -select * from t1 /* must be: (1,0) */; -a b -1 0 -select * from t2 /* must be as before: (1,1) */; -a b -1 1 -delete from t3; -reset master; -begin; -update t1 set b=0 where a=1; -insert into t3 values (0,0),(1,bug27565()); -kill query 3; -rollback; -Got one of the listed errors -select count(*) from t3 /* must be zero */; -count(*) -0 -show master status /* nothing in binlog */; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 98 -delete from t2; -reset master; -begin; -update t1 set b=0 where a=1; -insert into t2 values (0,0),(1,bug27565()) /* non-ta t2 */; -kill query 3; -rollback; -Got one of the listed errors -select count(*) from t2 /* count must be one */; -count(*) -1 -show master status /* insert into non-ta must be in binlog */; -File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 247 +3 select (@a:=load_file("MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog")) is not null; (@a:=load_file("MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog")) is not null 1 -select @a like "%#%error_code=1317%" /* must return 1 */; +select @a like "%#%error_code=1317%" /* must return 0 */; @a like "%#%error_code=1317%" -1 +0 drop table t1,t2,t3; -drop function bug27563; -drop function bug27565; diff --git a/mysql-test/t/binlog_killed.test b/mysql-test/t/binlog_killed.test index 4e92632c218..0bba72df867 100644 --- a/mysql-test/t/binlog_killed.test +++ b/mysql-test/t/binlog_killed.test @@ -2,18 +2,51 @@ ### ### bug#22725 : incorrect killed error in binlogged query -### and -### Bug#27563 killing noticed in SF() stack but the error gets missed in action -### Bug#27565 killed query of SF() is not reported correctly and ### connect (con1, localhost, root,,); connect (con2, localhost, root,,); -# the function is *insensitive* to killing - TO FIX IN BUG#27563 -# the function is used in the test anyway with `TODO' left -# to correct results afterwards +create table t1 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB; +create table t2 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=MyISAM; +create table t3 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB; +# +# effective test for bug#22725 +# + +connection con1; +select get_lock("a", 20); + +connection con2; +let $ID= `select connection_id()`; +reset master; +send insert into t2 values (null, null), (null, get_lock("a", 10)),(null, get_lock("a", 10)); + + +connection con1; +eval kill query $ID; + +connection con2; +reap; +select count(*) from t2 /* must be 3 */; + +--exec $MYSQL_BINLOG --start-position=126 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval select +(@a:=load_file("$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog")) +is not null; +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +eval select @a like "%#%error_code=0%" /* must return 1 */; +eval select @a like "%insert%" /* must return 1 */; +# the functions are either *insensitive* to killing or killing can cause +# strange problmes with the error propagation out of SF's stack +# Bug#27563, Bug#27565, BUG#24971 +# +# TODO: use if's block as regression test for the bugs or remove +# +if (0) +{ delimiter |; create function bug27563() RETURNS int(11) @@ -36,9 +69,6 @@ begin end| delimiter ;| -create table t1 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB; -create table t2 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=MyISAM; -create table t3 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB; reset master; @@ -60,7 +90,7 @@ connection con2; --enable_info # todo: remove 0 return after fixing Bug#27563 --error 0,ER_QUERY_INTERRUPTED -reap; +reap; ### pb: wrong error --disable_info ###--replace_column 2 # 5 # ### show binlog events from 98 /* nothing in binlog unless Bug#27563 */; @@ -137,7 +167,7 @@ connection con2; # remove 1105 (wrong) #--error ER_QUERY_INTERRUPTED --error 1105,ER_QUERY_INTERRUPTED -reap; +reap; ### pb: wrong error select * from t1 /* must be: (1,0) */; select * from t2 /* must be as before: (1,1) */; @@ -163,7 +193,7 @@ connection con2; # remove 1105 (wrong) #--error ER_QUERY_INTERRUPTED --error 1105,ER_QUERY_INTERRUPTED -reap; +reap; ### pb: wrong error select count(*) from t3 /* must be zero */; show master status /* nothing in binlog */; @@ -187,20 +217,16 @@ connection con2; # remove 1105 (wrong) #--error ER_QUERY_INTERRUPTED --error 1105,ER_QUERY_INTERRUPTED -reap; +reap; ### pb: wrong error select count(*) from t2 /* count must be one */; show master status /* insert into non-ta must be in binlog */; ---exec $MYSQL_BINLOG --start-position=126 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -eval select -(@a:=load_file("$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog")) -is not null; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval select @a like "%#%error_code=1317%" /* must return 1 */; + +drop function bug27563; +drop function bug27565; +} + system rm $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog ; drop table t1,t2,t3; -drop function bug27563; -drop function bug27565; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 647681cdc1a..bf37a3d6d69 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -898,7 +898,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, Query_log_event qinfo(thd, thd->query, thd->query_length, transactional_table, FALSE, (error>0) ? thd->killed : THD::NOT_KILLED); - assert(thd->killed != THD::KILL_BAD_DATA || error > 0); + DBUG_ASSERT(thd->killed != THD::KILL_BAD_DATA || error > 0); if (mysql_bin_log.write(&qinfo) && transactional_table) error=1; } From 814e4dd238b7a12764fc307dfa5945eb3ea670f9 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 29 May 2007 16:36:05 +0300 Subject: [PATCH 19/35] Bug#27044 replicated with unique field ndb table allows duplkey inserts The bug in that slave version of a table with unique field still was able to execute INSERT query as replace whereas it's impossible on master. The reason of this artifact is wrong usage of ndb->extra:s. Fixed with resetting flags at do_after. There is open issue with symmetrical resetting table->file->extra(HA_EXTRA_NO_IGNORE_NO_KEY) which i had to hand to bug#27077. The test for the current bug was committed in a cset for bug#27320. sql/log_event.cc: fixing do_after_row_operation to reset the effect of the extra engine's flags set at do_before; comments on meaning of extra flags added; execution of table->file->ha_end_bulk_insert() in do_after is not dependant on error; --- sql/log_event.cc | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/sql/log_event.cc b/sql/log_event.cc index 9289cf9b12c..edf6851e424 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -6601,10 +6601,23 @@ int Write_rows_log_event::do_before_row_operations(TABLE *table) lex->duplicates flag. */ thd->lex->sql_command= SQLCOM_REPLACE; - - table->file->extra(HA_EXTRA_IGNORE_DUP_KEY); // Needed for ndbcluster - table->file->extra(HA_EXTRA_WRITE_CAN_REPLACE); // Needed for ndbcluster - table->file->extra(HA_EXTRA_IGNORE_NO_KEY); // Needed for ndbcluster + /* + Do not raise the error flag in case of hitting to an unique attribute + */ + table->file->extra(HA_EXTRA_IGNORE_DUP_KEY); + /* + NDB specific: update from ndb master wrapped as Write_rows + */ + /* + so that the event should be applied to replace slave's row + */ + table->file->extra(HA_EXTRA_WRITE_CAN_REPLACE); + /* + NDB specific: if update from ndb master wrapped as Write_rows + does not find the row it's assumed idempotent binlog applying + is taking place; don't raise the error. + */ + table->file->extra(HA_EXTRA_IGNORE_NO_KEY); /* TODO: the cluster team (Tomas?) says that it's better if the engine knows how many rows are going to be inserted, then it can allocate needed memory @@ -6632,9 +6645,20 @@ int Write_rows_log_event::do_before_row_operations(TABLE *table) int Write_rows_log_event::do_after_row_operations(TABLE *table, int error) { - if (error == 0) - error= table->file->ha_end_bulk_insert(); - return error; + int local_error= 0; + table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); + table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE); + /* + reseting the extra with + table->file->extra(HA_EXTRA_NO_IGNORE_NO_KEY); + fires bug#27077 + todo: explain or fix + */ + if (local_error= table->file->ha_end_bulk_insert()) + { + table->file->print_error(local_error, MYF(0)); + } + return error? error : local_error; } int Write_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO *rli, From daa7b8a5b2dab1fc11b5546b9fd62aebd424a27a Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 29 May 2007 18:38:47 +0300 Subject: [PATCH 20/35] bug#22725 result file updated mysql-test/r/binlog_killed.result: results updated --- mysql-test/r/binlog_killed.result | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/binlog_killed.result b/mysql-test/r/binlog_killed.result index cb5683a4792..38184463cc1 100644 --- a/mysql-test/r/binlog_killed.result +++ b/mysql-test/r/binlog_killed.result @@ -16,7 +16,10 @@ is not null; (@a:=load_file("MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog")) is not null 1 -select @a like "%#%error_code=1317%" /* must return 0 */; -@a like "%#%error_code=1317%" -0 +select @a like "%#%error_code=0%" /* must return 1 */; +@a like "%#%error_code=0%" +1 +select @a like "%insert%" /* must return 1 */; +@a like "%insert%" +1 drop table t1,t2,t3; From 70a530e4014d386b41998c67ebb57be583e876f4 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 29 May 2007 21:05:08 +0300 Subject: [PATCH 21/35] bug#22725 refining the test. mysql-test/t/binlog_killed.test: due to killing reap may catch an error though it's indeterministic. --- mysql-test/t/binlog_killed.test | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/t/binlog_killed.test b/mysql-test/t/binlog_killed.test index 0bba72df867..219065a3579 100644 --- a/mysql-test/t/binlog_killed.test +++ b/mysql-test/t/binlog_killed.test @@ -28,6 +28,7 @@ connection con1; eval kill query $ID; connection con2; +--error 0,ER_QUERY_INTERRUPTED reap; select count(*) from t2 /* must be 3 */; From 5aec3d0f8d68ef3932de43f16ced48b0b3950f7a Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 29 May 2007 22:17:09 +0300 Subject: [PATCH 22/35] bug#22725 merge with 5.0 sql/sql_class.cc: THD::binlog_query receives killed status arg with default the same for Query_log_event sql/sql_class.h: relocation public binlog_query down to the point where killed_state is declared --- sql/sql_class.cc | 9 ++++---- sql/sql_class.h | 53 ++++++++++++++++++++++++------------------------ 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 87cf9b16d24..2359c5c4ae0 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -3048,9 +3048,9 @@ void THD::binlog_delete_pending_rows_event() RETURN VALUE Error code, or 0 if no error. */ -int THD::binlog_query(THD::enum_binlog_query_type qtype, - char const *query, ulong query_len, - bool is_trans, bool suppress_use) +int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query, + ulong query_len, bool is_trans, bool suppress_use, + THD::killed_state killed_status_arg) { DBUG_ENTER("THD::binlog_query"); DBUG_PRINT("enter", ("qtype=%d, query='%s'", qtype, query)); @@ -3089,7 +3089,8 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, flush the pending rows event if necessary. */ { - Query_log_event qinfo(this, query, query_len, is_trans, suppress_use); + Query_log_event qinfo(this, query, query_len, is_trans, suppress_use, + killed_status_arg); qinfo.flags|= LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F; /* Binlog table maps will be irrelevant after a Query_log_event diff --git a/sql/sql_class.h b/sql/sql_class.h index a75b774b7a3..9a527323dfe 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1079,32 +1079,6 @@ public: } #endif /* MYSQL_CLIENT */ -#ifndef MYSQL_CLIENT -public: - enum enum_binlog_query_type { - /* - The query can be logged row-based or statement-based - */ - ROW_QUERY_TYPE, - - /* - The query has to be logged statement-based - */ - STMT_QUERY_TYPE, - - /* - The query represents a change to a table in the "mysql" - database and is currently mapped to ROW_QUERY_TYPE. - */ - MYSQL_QUERY_TYPE, - QUERY_TYPE_COUNT - }; - - int binlog_query(enum_binlog_query_type qtype, - char const *query, ulong query_len, - bool is_trans, bool suppress_use); -#endif - public: struct st_transactions { @@ -1491,6 +1465,33 @@ public: void close_active_vio(); #endif void awake(THD::killed_state state_to_set); + +#ifndef MYSQL_CLIENT + enum enum_binlog_query_type { + /* + The query can be logged row-based or statement-based + */ + ROW_QUERY_TYPE, + + /* + The query has to be logged statement-based + */ + STMT_QUERY_TYPE, + + /* + The query represents a change to a table in the "mysql" + database and is currently mapped to ROW_QUERY_TYPE. + */ + MYSQL_QUERY_TYPE, + QUERY_TYPE_COUNT + }; + + int binlog_query(enum_binlog_query_type qtype, + char const *query, ulong query_len, + bool is_trans, bool suppress_use, + THD::killed_state killed_err_arg= THD::KILLED_NO_VALUE); +#endif + /* For enter_cond() / exit_cond() to work the mutex must be got before enter_cond(); this mutex is then released by exit_cond(). From 54e1f2f0ced6a347e836778dcba3eb2f0d54b140 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 29 May 2007 23:16:50 +0300 Subject: [PATCH 23/35] bug#22725 tests refining, see binlog_killed.test file for details mysql-test/r/binlog_killed.result: results changed mysql-test/t/binlog_killed.test: killer conn waits for the first row to appear; log-disabling kill query since prey's id is not deterministic; correcting pattern to search in binlog for insert query; --- mysql-test/r/binlog_killed.result | 5 ++--- mysql-test/t/binlog_killed.test | 22 ++++++++++++++++++++-- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/binlog_killed.result b/mysql-test/r/binlog_killed.result index 38184463cc1..368df408cb8 100644 --- a/mysql-test/r/binlog_killed.result +++ b/mysql-test/r/binlog_killed.result @@ -6,7 +6,6 @@ get_lock("a", 20) 1 reset master; insert into t2 values (null, null), (null, get_lock("a", 10)),(null, get_lock("a", 10)); -kill query 3; select count(*) from t2 /* must be 3 */; count(*) 3 @@ -19,7 +18,7 @@ is not null select @a like "%#%error_code=0%" /* must return 1 */; @a like "%#%error_code=0%" 1 -select @a like "%insert%" /* must return 1 */; -@a like "%insert%" +select @a like "%insert into%" /* must return 1 */; +@a like "%insert into%" 1 drop table t1,t2,t3; diff --git a/mysql-test/t/binlog_killed.test b/mysql-test/t/binlog_killed.test index 219065a3579..a5c9dea81ec 100644 --- a/mysql-test/t/binlog_killed.test +++ b/mysql-test/t/binlog_killed.test @@ -15,6 +15,7 @@ create table t3 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB; # effective test for bug#22725 # +let $counter=200; # max 20 seconds to wait for insert performed the 1st row connection con1; select get_lock("a", 20); @@ -25,7 +26,24 @@ send insert into t2 values (null, null), (null, get_lock("a", 10)),(null, get_lo connection con1; + +disable_abort_on_error; +disable_query_log; +disable_result_log; + +while (`select count(*) from t2`) +{ + sleep 0.1; + dec $counter; + if (!$counter) + { + die("Waited too long for query to suceed"); + } +} eval kill query $ID; +enable_abort_on_error; +enable_query_log; +enable_result_log; connection con2; --error 0,ER_QUERY_INTERRUPTED @@ -39,7 +57,7 @@ eval select is not null; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR eval select @a like "%#%error_code=0%" /* must return 1 */; -eval select @a like "%insert%" /* must return 1 */; +eval select @a like "%insert into%" /* must return 1 */; # the functions are either *insensitive* to killing or killing can cause # strange problmes with the error propagation out of SF's stack # Bug#27563, Bug#27565, BUG#24971 @@ -227,7 +245,7 @@ drop function bug27563; drop function bug27565; } -system rm $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog ; +#system rm $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog ; drop table t1,t2,t3; From 9a1e9de91f87e565224398ea020203e552d157a8 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 May 2007 00:22:24 +0300 Subject: [PATCH 24/35] bug#22725 combining the final result variable in such way that either option of the test execution will yield zero. mysql-test/r/binlog_killed.result: results changed mysql-test/t/binlog_killed.test: there are two options for the test passing: 1. no rows inserted and the INSERT gets killed, then there is no INSERT query in binlog 2. all rows inserted, then INSERT gets to binlog and error_code is zero --- mysql-test/r/binlog_killed.result | 18 +++--------------- mysql-test/t/binlog_killed.test | 28 ++++++++++++---------------- 2 files changed, 15 insertions(+), 31 deletions(-) diff --git a/mysql-test/r/binlog_killed.result b/mysql-test/r/binlog_killed.result index 368df408cb8..60fc403aeb3 100644 --- a/mysql-test/r/binlog_killed.result +++ b/mysql-test/r/binlog_killed.result @@ -6,19 +6,7 @@ get_lock("a", 20) 1 reset master; insert into t2 values (null, null), (null, get_lock("a", 10)),(null, get_lock("a", 10)); -select count(*) from t2 /* must be 3 */; -count(*) -3 -select -(@a:=load_file("MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog")) -is not null; -(@a:=load_file("MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog")) -is not null -1 -select @a like "%#%error_code=0%" /* must return 1 */; -@a like "%#%error_code=0%" -1 -select @a like "%insert into%" /* must return 1 */; -@a like "%insert into%" -1 +select @result /* must be zero either way */; +@result +0 drop table t1,t2,t3; diff --git a/mysql-test/t/binlog_killed.test b/mysql-test/t/binlog_killed.test index a5c9dea81ec..269362b5584 100644 --- a/mysql-test/t/binlog_killed.test +++ b/mysql-test/t/binlog_killed.test @@ -31,24 +31,12 @@ disable_abort_on_error; disable_query_log; disable_result_log; -while (`select count(*) from t2`) -{ - sleep 0.1; - dec $counter; - if (!$counter) - { - die("Waited too long for query to suceed"); - } -} eval kill query $ID; -enable_abort_on_error; -enable_query_log; -enable_result_log; connection con2; --error 0,ER_QUERY_INTERRUPTED reap; -select count(*) from t2 /* must be 3 */; +let $rows= `select count(*) from t2 /* must be 1 or 0 */`; --exec $MYSQL_BINLOG --start-position=126 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR @@ -56,8 +44,16 @@ eval select (@a:=load_file("$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog")) is not null; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval select @a like "%#%error_code=0%" /* must return 1 */; -eval select @a like "%insert into%" /* must return 1 */; +let $error_code= `select @a like "%#%error_code=0%" /* must return 1 or 0*/`; +let $insert_binlogged= `select @a like "%insert into%" /* must return 1 or 0 */`; +eval set @result= $rows-2*$error_code - $insert_binlogged; + +enable_abort_on_error; +enable_query_log; +enable_result_log; + +select @result /* must be zero either way */; + # the functions are either *insensitive* to killing or killing can cause # strange problmes with the error propagation out of SF's stack # Bug#27563, Bug#27565, BUG#24971 @@ -245,7 +241,7 @@ drop function bug27563; drop function bug27565; } -#system rm $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog ; +system rm $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog ; drop table t1,t2,t3; From e5c4d97c9ef653bdb906002b6e3849711053ab30 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 May 2007 10:56:18 +0300 Subject: [PATCH 25/35] bug#22725 test comments correction mysql-test/r/binlog_killed.result: changed mysql-test/t/binlog_killed.test: wrong comments (but important ones) left; little refinement in result calc --- mysql-test/r/binlog_killed.result | 2 +- mysql-test/t/binlog_killed.test | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/binlog_killed.result b/mysql-test/r/binlog_killed.result index 60fc403aeb3..ba4f38fb4c1 100644 --- a/mysql-test/r/binlog_killed.result +++ b/mysql-test/r/binlog_killed.result @@ -5,7 +5,7 @@ select get_lock("a", 20); get_lock("a", 20) 1 reset master; -insert into t2 values (null, null), (null, get_lock("a", 10)),(null, get_lock("a", 10)); +insert into t2 values (null, null), (null, get_lock("a", 10)); select @result /* must be zero either way */; @result 0 diff --git a/mysql-test/t/binlog_killed.test b/mysql-test/t/binlog_killed.test index 269362b5584..6e221f2ee29 100644 --- a/mysql-test/t/binlog_killed.test +++ b/mysql-test/t/binlog_killed.test @@ -22,7 +22,7 @@ select get_lock("a", 20); connection con2; let $ID= `select connection_id()`; reset master; -send insert into t2 values (null, null), (null, get_lock("a", 10)),(null, get_lock("a", 10)); +send insert into t2 values (null, null), (null, get_lock("a", 10)); connection con1; @@ -36,7 +36,7 @@ eval kill query $ID; connection con2; --error 0,ER_QUERY_INTERRUPTED reap; -let $rows= `select count(*) from t2 /* must be 1 or 0 */`; +let $rows= `select count(*) from t2 /* must be 2 or 0 */`; --exec $MYSQL_BINLOG --start-position=126 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR @@ -46,7 +46,7 @@ is not null; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR let $error_code= `select @a like "%#%error_code=0%" /* must return 1 or 0*/`; let $insert_binlogged= `select @a like "%insert into%" /* must return 1 or 0 */`; -eval set @result= $rows-2*$error_code - $insert_binlogged; +eval set @result= $rows- $error_code - $insert_binlogged; enable_abort_on_error; enable_query_log; From 73acdb3569d959f390ed70ebb82e1e4959372e48 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 May 2007 11:18:55 +0300 Subject: [PATCH 26/35] bug#22725 merge 5.0 with 5.1 mysql-test/t/binlog_killed.test: offset change in 5.1 --- mysql-test/t/binlog_killed.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/t/binlog_killed.test b/mysql-test/t/binlog_killed.test index 6e221f2ee29..06dda79b7ff 100644 --- a/mysql-test/t/binlog_killed.test +++ b/mysql-test/t/binlog_killed.test @@ -38,7 +38,7 @@ connection con2; reap; let $rows= `select count(*) from t2 /* must be 2 or 0 */`; ---exec $MYSQL_BINLOG --start-position=126 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog +--exec $MYSQL_BINLOG --start-position=134 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select (@a:=load_file("$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog")) From 42eab5a2b1824ad0896100259441a881deff4378 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 May 2007 14:03:35 +0500 Subject: [PATCH 27/35] Fixing wrong memory read problem detected by Valgrind in "xml" test. The source of the problem was in my_vsnprintf() implementation. strings/my_vsnprintf.c: Fixing a problem in vsnprintf('%.*s', len, ptr) When processing the above format, it's incorrect to use strlen() because the string is not necessarily a null terminated string. Changing strlen() followed by set_if_smaller() to strnlen() - which covers both cases - limiting by '\0' and by "len". --- strings/my_vsnprintf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c index 93d228a1954..befdb1a81c2 100644 --- a/strings/my_vsnprintf.c +++ b/strings/my_vsnprintf.c @@ -95,8 +95,7 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) reg2 char *par = va_arg(ap, char *); uint plen,left_len = (uint)(end-to)+1; if (!par) par = (char*)"(null)"; - plen = (uint) strlen(par); - set_if_smaller(plen,width); + plen= (uint) strnlen(par, width); if (left_len <= plen) plen = left_len - 1; to=strnmov(to,par,plen); From d57f3bbbe1073cb0f3c72a00539bc60c96739b17 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 May 2007 11:55:56 +0200 Subject: [PATCH 28/35] Added extra parenthesis to remove compiler warning Fixed test case rpl_incident.test (synchronize drop table, masked IO thread behaviour) mysql-test/r/rpl_incident.result: Masking master_log_file since IO thread is not synchronized in rpl_incident.test mysql-test/t/rpl_incident.test: Masking master_log_file since IO thread is not synchronized in rpl_incident.test Correcting drop of table so it is synchronized sql/log_event.cc: Added extra parenthesis to remove compiler warning --- mysql-test/r/rpl_incident.result | 5 ++--- mysql-test/t/rpl_incident.test | 7 +++---- sql/log_event.cc | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/mysql-test/r/rpl_incident.result b/mysql-test/r/rpl_incident.result index aea35c5f477..1a0da45f3e1 100644 --- a/mysql-test/r/rpl_incident.result +++ b/mysql-test/r/rpl_incident.result @@ -31,7 +31,7 @@ Master_Host 127.0.0.1 Master_User root Master_Port MASTER_PORT Connect_Retry 1 -Master_Log_File master-bin.000002 +Master_Log_File # Read_Master_Log_Pos # Relay_Log_File # Relay_Log_Pos # @@ -74,7 +74,7 @@ Master_Host 127.0.0.1 Master_User root Master_Port MASTER_PORT Connect_Retry 1 -Master_Log_File master-bin.000002 +Master_Log_File # Read_Master_Log_Pos # Relay_Log_File # Relay_Log_Pos # @@ -104,4 +104,3 @@ Master_SSL_Key Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No DROP TABLE t1; -DROP TABLE t1; diff --git a/mysql-test/t/rpl_incident.test b/mysql-test/t/rpl_incident.test index c52f26317ad..507cd0e0798 100644 --- a/mysql-test/t/rpl_incident.test +++ b/mysql-test/t/rpl_incident.test @@ -22,7 +22,7 @@ connection slave; SELECT * FROM t1; --replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # +--replace_column 1 # 6 # 7 # 8 # 9 # 22 # 23 # 33 # --query_vertical SHOW SLAVE STATUS SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; @@ -34,10 +34,9 @@ START SLAVE; SELECT * FROM t1; --replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # +--replace_column 1 # 6 # 7 # 8 # 9 # 22 # 23 # 33 # --query_vertical SHOW SLAVE STATUS -DROP TABLE t1; connection master; DROP TABLE t1; - +--sync_slave_with_master diff --git a/sql/log_event.cc b/sql/log_event.cc index 906e55704d7..3cca8d53f07 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -6809,7 +6809,7 @@ int Write_rows_log_event::do_after_row_operations(TABLE *table, int error) fires bug#27077 todo: explain or fix */ - if (local_error= table->file->ha_end_bulk_insert()) + if ((local_error= table->file->ha_end_bulk_insert())) { table->file->print_error(local_error, MYF(0)); } From 2eba9378353c0a7e93a4ec807803c7224253aaab Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 May 2007 16:02:54 +0500 Subject: [PATCH 29/35] Define HAVE_STRNLEN correctly. include/config-win.h: strnlen() presents in the build in library only starting from Visual Studio 2005, identified by _MSC_VER 1400. Previous versions of Visual Studio didn't have this function, so they need the MySQL replacement function to be compiled. --- include/config-win.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/config-win.h b/include/config-win.h index 8d6f8885626..6622be81038 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -350,7 +350,10 @@ inline double ulonglong2double(ulonglong value) #define SPRINTF_RETURNS_INT #define HAVE_SETFILEPOINTER #define HAVE_VIO_READ_BUFF +#if defined(_MSC_VER) && _MSC_VER >= 1400 +/* strnlen() appeared in Studio 2005 */ #define HAVE_STRNLEN +#endif #define HAVE_WINSOCK2 #define strcasecmp stricmp From db8df69cbce7cbaa59ce937231af0ba7fc4dc239 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 May 2007 14:29:34 +0300 Subject: [PATCH 30/35] bug#17654 --read-from-remote-server causes core fixing FD event issue that showed up on pb. client/mysqlbinlog.cc: resetting temp_buf specially for FD event to avoid double-freeing --- client/mysqlbinlog.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index d2357aa10ec..179d0e9fd9e 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -635,6 +635,7 @@ Create_file event for file_id: %u\n",exv->file_id); print_event_info->common_header_len= glob_description_event->common_header_len; ev->print(result_file, print_event_info); + ev->temp_buf= 0; // as the event ref is zeroed /* We don't want this event to be deleted now, so let's hide it (I (Guilhem) should later see if this triggers a non-serious Valgrind From 3c6a4bc5b29339dbf559c13910428689437f0f9e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 May 2007 17:29:05 +0500 Subject: [PATCH 31/35] CMakeLists.txt: Adding strnlen.c into the list of source files. strings/CMakeLists.txt: Adding strnlen.c into the list of source files. --- strings/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/strings/CMakeLists.txt b/strings/CMakeLists.txt index dd9b500841f..ac7c75ec56c 100644 --- a/strings/CMakeLists.txt +++ b/strings/CMakeLists.txt @@ -24,4 +24,4 @@ ADD_LIBRARY(strings bchange.c bcmp.c bfill.c bmove512.c bmove_upp.c ctype-big5.c is_prefix.c llstr.c longlong2str.c my_strtoll10.c my_vsnprintf.c r_strinstr.c str2int.c str_alloc.c strcend.c strend.c strfill.c strmake.c strmov.c strnmov.c strtod.c strtol.c strtoll.c strtoul.c strtoull.c strxmov.c strxnmov.c xml.c - my_strchr.c strcont.c strinstr.c) + my_strchr.c strcont.c strinstr.c strnlen.c) From 45a6e67fd5b143e0ce30ff2e71b010d9b9eabe56 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 May 2007 16:14:55 +0300 Subject: [PATCH 32/35] bug#22725 the test is not supposed for row format. the include-guard is set. mysql-test/t/binlog_killed.test: the test does not apply to rbr --- mysql-test/t/binlog_killed.test | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/t/binlog_killed.test b/mysql-test/t/binlog_killed.test index 06dda79b7ff..9b799e41598 100644 --- a/mysql-test/t/binlog_killed.test +++ b/mysql-test/t/binlog_killed.test @@ -1,4 +1,5 @@ -- source include/have_innodb.inc +-- source include/have_binlog_format_mixed_or_statement.inc ### ### bug#22725 : incorrect killed error in binlogged query From 647923f9e99248e87f1723304b5e6c986f6d4737 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 May 2007 15:56:05 +0200 Subject: [PATCH 33/35] Masking out error that is not generated by the test (rpl_ndb_basic.test) itself mysql-test/r/rpl_ndb_basic.result: Masking out error that is not generated by the test itself mysql-test/t/rpl_ndb_basic.test: Masking out error that is not generated by the test itself --- mysql-test/r/rpl_ndb_basic.result | 4 ++-- mysql-test/t/rpl_ndb_basic.test | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/rpl_ndb_basic.result b/mysql-test/r/rpl_ndb_basic.result index 4dab05b31de..37217bf0ad1 100644 --- a/mysql-test/r/rpl_ndb_basic.result +++ b/mysql-test/r/rpl_ndb_basic.result @@ -159,8 +159,8 @@ Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1105 -Last_Error Unknown error +Last_Errno +Last_Error Skip_Counter 0 Exec_Master_Log_Pos Relay_Log_Space diff --git a/mysql-test/t/rpl_ndb_basic.test b/mysql-test/t/rpl_ndb_basic.test index 04c855f8730..e485b1d1bde 100644 --- a/mysql-test/t/rpl_ndb_basic.test +++ b/mysql-test/t/rpl_ndb_basic.test @@ -197,7 +197,7 @@ UPDATE t1 SET `nom`="DEAD" WHERE `nid`=1; --connection slave --echo **** On Slave **** --replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 7 8 9 16 22 23 33 +--replace_column 1 7 8 9 16 19 20 22 23 33 --query_vertical SHOW SLAVE STATUS; # now set max retries high enough to succeed, and start slave again From a10cc7180107ce22a93ea1badd311bf6f8cc050d Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 May 2007 17:00:48 +0200 Subject: [PATCH 34/35] Changed to vertical output for rpl_row_until.test --- mysql-test/r/rpl_row_until.result | 152 +++++++++++++++++++++++++++--- mysql-test/t/rpl_row_until.test | 8 +- 2 files changed, 144 insertions(+), 16 deletions(-) diff --git a/mysql-test/r/rpl_row_until.result b/mysql-test/r/rpl_row_until.result index c691185650a..d71cc479f7a 100644 --- a/mysql-test/r/rpl_row_until.result +++ b/mysql-test/r/rpl_row_until.result @@ -19,9 +19,41 @@ n 2 3 4 -show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert -# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 744 slave-relay-bin.000004 # master-bin.000001 # No 0 0 315 # Master master-bin.000001 311 No # No +SHOW SLAVE STATUS;; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_MYPORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos 744 +Relay_Log_File slave-relay-bin.000004 +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running # +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos 315 +Relay_Log_Space # +Until_Condition Master +Until_Log_File master-bin.000001 +Until_Log_Pos 311 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291; select * from t1; n @@ -29,23 +61,119 @@ n 2 3 4 -show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert -# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 744 slave-relay-bin.000004 # master-bin.000001 # No 0 0 315 # Master master-no-such-bin.000001 291 No # No +SHOW SLAVE STATUS;; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_MYPORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos 744 +Relay_Log_File slave-relay-bin.000004 +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running # +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos 315 +Relay_Log_Space # +Until_Condition Master +Until_Log_File master-no-such-bin.000001 +Until_Log_Pos 291 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728; select * from t2; n 1 2 -show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert -# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 744 slave-relay-bin.000004 # master-bin.000001 # No 0 0 590 # Relay slave-relay-bin.000004 728 No # No +SHOW SLAVE STATUS;; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_MYPORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos 744 +Relay_Log_File slave-relay-bin.000004 +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running # +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos 590 +Relay_Log_Space # +Until_Condition Relay +Until_Log_File slave-relay-bin.000004 +Until_Log_Pos 728 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No start slave; stop slave; start slave until master_log_file='master-bin.000001', master_log_pos=740; -show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert -# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 744 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 744 # Master master-bin.000001 740 No # No +SHOW SLAVE STATUS;; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_MYPORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos 744 +Relay_Log_File slave-relay-bin.000004 +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos 744 +Relay_Log_Space # +Until_Condition Master +Until_Log_File master-bin.000001 +Until_Log_Pos 740 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No start slave until master_log_file='master-bin', master_log_pos=561; ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12; diff --git a/mysql-test/t/rpl_row_until.test b/mysql-test/t/rpl_row_until.test index f2a4229cdc4..f1d21e65a4c 100644 --- a/mysql-test/t/rpl_row_until.test +++ b/mysql-test/t/rpl_row_until.test @@ -33,7 +33,7 @@ wait_for_slave_to_stop; select * from t1; --replace_result $MASTER_MYPORT MASTER_MYPORT --replace_column 1 # 9 # 11 # 23 # 33 # -show slave status; +--query_vertical SHOW SLAVE STATUS; # this should fail right after start start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291; @@ -43,7 +43,7 @@ sleep 2; wait_for_slave_to_stop; --replace_result $MASTER_MYPORT MASTER_MYPORT --replace_column 1 # 9 # 11 # 23 # 33 # -show slave status; +--query_vertical SHOW SLAVE STATUS; # try replicate all up to and not including the second insert to t2; start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728; @@ -52,7 +52,7 @@ wait_for_slave_to_stop; select * from t2; --replace_result $MASTER_MYPORT MASTER_MYPORT --replace_column 1 # 9 # 11 # 23 # 33 # -show slave status; +--query_vertical SHOW SLAVE STATUS; # clean up start slave; @@ -69,7 +69,7 @@ wait_for_slave_to_stop; # here the sql slave thread should be stopped --replace_result $MASTER_MYPORT MASTER_MYPORT bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004 --replace_column 1 # 9 # 23 # 33 # -show slave status; +--query_vertical SHOW SLAVE STATUS; #testing various error conditions --error 1277 From dd190b0e6b05d3cf7552a0999554a636e426471a Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 May 2007 22:29:15 +0300 Subject: [PATCH 35/35] bug#22725 refining the test because of Bug #28786 'reset master' does not reset binlogging on embeded server mysql-test/t/binlog_killed.test: the test can not pass on embedded server. Setting the include-guard. --- mysql-test/t/binlog_killed.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/t/binlog_killed.test b/mysql-test/t/binlog_killed.test index 6e221f2ee29..1c4f1272691 100644 --- a/mysql-test/t/binlog_killed.test +++ b/mysql-test/t/binlog_killed.test @@ -1,4 +1,5 @@ -- source include/have_innodb.inc +--source include/not_embedded.inc ### ### bug#22725 : incorrect killed error in binlogged query @@ -15,7 +16,6 @@ create table t3 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB; # effective test for bug#22725 # -let $counter=200; # max 20 seconds to wait for insert performed the 1st row connection con1; select get_lock("a", 20);