Commit 077e7c9a authored by Alexander Nozdrin's avatar Alexander Nozdrin

Manual merge from mysql-trunk-merge.

Conflicts:
  - mysql-test/collections/default.experimental
  - mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result
  - mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test
parents 2cdad6c3 22be2783
......@@ -23,7 +23,7 @@
(defined(__alpha__) && defined(__GNUC__))
#define HAVE_STACKTRACE 1
#endif
#elif defined(__WIN__) || defined(__sun)
#elif defined(__WIN__) || defined(HAVE_PRINTSTACK)
#define HAVE_STACKTRACE 1
#endif
......
......@@ -19,7 +19,6 @@ main.sp @solaris # Bug#47791 2010-01-20 alik Several tes
perfschema.tampered_perfschema_table1 @windows # Bug#50478 2010-01-20 alik perfschema.tampered_perfschema_table1 fails sporadically on Windows and Solaris
perfschema.tampered_perfschema_table1 @solaris # Bug#50478 2010-01-20 alik perfschema.tampered_perfschema_table1 fails sporadically on Windows and Solaris
rpl.rpl_get_master_version_and_clock* # Bug#49191 2009-12-01 Daogang rpl_get_master_version_and_clock failed on PB2: COM_REGISTER_SLAVE failed
rpl.rpl_heartbeat_basic # BUG#43828 2009-10-22 luis fails sporadically
rpl.rpl_heartbeat_2slaves # BUG#43828 2009-10-22 luis fails sporadically
rpl.rpl_innodb_bug28430* # Bug#46029
......
# Both of the following tests check that comparison of binlog BI
# against SE record will not fail due to remains from previous values
# in the SE record (before a given field was set to null).
#
# In MIXED mode:
# - Insert and update are executed as statements
# - Delete is executed as a row event
# - Assertion: checks that comparison will not fail because the update
# statement will clear the record contents for the nulled
# field. If data was not cleared, some engines may keep
# the value and return it later as garbage - despite the
# fact that field is null. This may cause slave to
# falsely fail in the comparison (memcmp would fail
# because of "garbage" in record data).
#
# In ROW mode:
# - Insert, update and delete are executed as row events.
# - Assertion: checks that comparison will not fail because the update
# rows event will clear the record contents before
# feeding the new value to the SE. This protects against
# SEs that do not clear record contents when storing
# nulled fields. If the engine did not clear the data it
# would cause slave to falsely fail in the comparison
# (memcmp would fail because of "garbage" in record
# data). This scenario is pretty much the same described
# above in MIXED mode, but checks different execution
# path in the slave.
# BUG#49481: RBR: MyISAM and bit fields may cause slave to stop on
# delete cant find record
-- source include/master-slave-reset.inc
-- connection master
-- eval CREATE TABLE t1 (c1 BIT, c2 INT) Engine=$engine
INSERT INTO `t1` VALUES ( 1, 1 );
UPDATE t1 SET c1=NULL where c2=1;
-- sync_slave_with_master
-- let $diff_table_1=master:test.t1
-- let $diff_table_2=slave:test.t1
-- source include/diff_tables.inc
-- connection master
# triggers switch to row mode when on mixed
DELETE FROM t1 WHERE c2=1 LIMIT 1;
-- sync_slave_with_master
-- let $diff_table_1=master:test.t1
-- let $diff_table_2=slave:test.t1
-- source include/diff_tables.inc
-- connection master
DROP TABLE t1;
-- sync_slave_with_master
-- source include/master-slave-reset.inc
-- connection master
# BUG#49482: RBR: Replication may break on deletes when MyISAM tables
# + char field are used
-- eval CREATE TABLE t1 (c1 CHAR) Engine=$engine
INSERT INTO t1 ( c1 ) VALUES ( 'w' ) ;
SELECT * FROM t1;
UPDATE t1 SET c1=NULL WHERE c1='w';
-- sync_slave_with_master
-- let $diff_table_1=master:test.t1
-- let $diff_table_2=slave:test.t1
-- source include/diff_tables.inc
-- connection master
# triggers switch to row mode when on mixed
DELETE FROM t1 LIMIT 2;
-- sync_slave_with_master
-- let $diff_table_1=master:test.t1
-- let $diff_table_2=slave:test.t1
-- source include/diff_tables.inc
-- connection master
DROP TABLE t1;
-- sync_slave_with_master
......@@ -4,11 +4,10 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
call mtr.add_suppression("Slave I/O: Master command COM_REGISTER_SLAVE failed: .*");
call mtr.add_suppression("Slave I/O: .* failed with error: Lost connection to MySQL server at 'reading initial communication packet'");
call mtr.add_suppression("Slave I/O: Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again");
call mtr.add_suppression("Get master clock failed with error: ");
call mtr.add_suppression("Get master SERVER_ID failed with error: ");
call mtr.add_suppression("Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; .*");
call mtr.add_suppression("Slave I/O thread .* register on master");
SELECT IS_FREE_LOCK("debug_lock.before_get_UNIX_TIMESTAMP");
IS_FREE_LOCK("debug_lock.before_get_UNIX_TIMESTAMP")
1
......
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1 (c1 BIT, c2 INT) Engine=InnoDB;
INSERT INTO `t1` VALUES ( 1, 1 );
UPDATE t1 SET c1=NULL where c2=1;
Comparing tables master:test.t1 and slave:test.t1
DELETE FROM t1 WHERE c2=1 LIMIT 1;
Comparing tables master:test.t1 and slave:test.t1
DROP TABLE t1;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1 (c1 CHAR) Engine=InnoDB;
INSERT INTO t1 ( c1 ) VALUES ( 'w' ) ;
SELECT * FROM t1;
c1
w
UPDATE t1 SET c1=NULL WHERE c1='w';
Comparing tables master:test.t1 and slave:test.t1
DELETE FROM t1 LIMIT 2;
Comparing tables master:test.t1 and slave:test.t1
DROP TABLE t1;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1 (c1 BIT, c2 INT) Engine=MyISAM;
INSERT INTO `t1` VALUES ( 1, 1 );
UPDATE t1 SET c1=NULL where c2=1;
Comparing tables master:test.t1 and slave:test.t1
DELETE FROM t1 WHERE c2=1 LIMIT 1;
Comparing tables master:test.t1 and slave:test.t1
DROP TABLE t1;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1 (c1 CHAR) Engine=MyISAM;
INSERT INTO t1 ( c1 ) VALUES ( 'w' ) ;
SELECT * FROM t1;
c1
w
UPDATE t1 SET c1=NULL WHERE c1='w';
Comparing tables master:test.t1 and slave:test.t1
DELETE FROM t1 LIMIT 2;
Comparing tables master:test.t1 and slave:test.t1
DROP TABLE t1;
......@@ -17,14 +17,13 @@
source include/master-slave.inc;
source include/have_debug.inc;
connection slave;
call mtr.add_suppression("Slave I/O: Master command COM_REGISTER_SLAVE failed: .*");
call mtr.add_suppression("Slave I/O: .* failed with error: Lost connection to MySQL server at 'reading initial communication packet'");
call mtr.add_suppression("Slave I/O: Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again");
call mtr.add_suppression("Get master clock failed with error: ");
call mtr.add_suppression("Get master SERVER_ID failed with error: ");
call mtr.add_suppression("Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; .*");
call mtr.add_suppression("Slave I/O thread .* register on master");
#Test case 1: Try to get the value of the UNIX_TIMESTAMP from master under network disconnection
connection slave;
let $debug_saved= `select @@global.debug`;
let $debug_lock= "debug_lock.before_get_UNIX_TIMESTAMP";
......
-- source include/have_binlog_format_mixed_or_row.inc
-- source include/master-slave.inc
-- source include/have_innodb.inc
-- let $engine= InnoDB
-- source extra/rpl_tests/rpl_set_null.test
-- source include/have_binlog_format_mixed_or_row.inc
-- source include/master-slave.inc
-- let $engine= MyISAM
-- source extra/rpl_tests/rpl_set_null.test
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1 (c1 BIT, c2 INT) Engine=NDB;
INSERT INTO `t1` VALUES ( 1, 1 );
UPDATE t1 SET c1=NULL where c2=1;
Comparing tables master:test.t1 and slave:test.t1
DELETE FROM t1 WHERE c2=1 LIMIT 1;
Comparing tables master:test.t1 and slave:test.t1
DROP TABLE t1;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1 (c1 CHAR) Engine=NDB;
INSERT INTO t1 ( c1 ) VALUES ( 'w' ) ;
SELECT * FROM t1;
c1
w
UPDATE t1 SET c1=NULL WHERE c1='w';
Comparing tables master:test.t1 and slave:test.t1
DELETE FROM t1 LIMIT 2;
Comparing tables master:test.t1 and slave:test.t1
DROP TABLE t1;
-- source include/have_ndb.inc
-- source include/have_binlog_format_mixed_or_row.inc
-- source include/ndb_master-slave.inc
-- let $engine= NDB
-- source extra/rpl_tests/rpl_set_null.test
......@@ -1888,7 +1888,12 @@ class Field_bit :public Field {
uint32 max_display_length() { return field_length; }
uint size_of() const { return sizeof(*this); }
Item_result result_type () const { return INT_RESULT; }
int reset(void) { bzero(ptr, bytes_in_rec); return 0; }
int reset(void) {
bzero(ptr, bytes_in_rec);
if (bit_ptr && (bit_len > 0)) // reset odd bits among null bits
clr_rec_bits(bit_ptr, bit_ofs, bit_len);
return 0;
}
int store(const char *to, uint length, CHARSET_INFO *charset);
int store(double nr);
int store(longlong nr, bool unsigned_val);
......
......@@ -42,6 +42,20 @@ C_MODE_END
String my_empty_string("",default_charset_info);
/*
Convert an array of bytes to a hexadecimal representation.
Used to generate a hexadecimal representation of a message digest.
*/
static void array_to_hex(char *to, const char *str, uint len)
{
const char *str_end= str + len;
for (; str != str_end; ++str)
{
*to++= _dig_vec_lower[((uchar) *str) >> 4];
*to++= _dig_vec_lower[((uchar) *str) & 0x0F];
}
}
bool Item_str_func::fix_fields(THD *thd, Item **ref)
......@@ -114,12 +128,7 @@ String *Item_func_md5::val_str(String *str)
null_value=1;
return 0;
}
sprintf((char *) str->ptr(),
"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
digest[0], digest[1], digest[2], digest[3],
digest[4], digest[5], digest[6], digest[7],
digest[8], digest[9], digest[10], digest[11],
digest[12], digest[13], digest[14], digest[15]);
array_to_hex((char *) str->ptr(), (const char*) digest, 16);
str->length((uint) 32);
return str;
}
......@@ -160,15 +169,7 @@ String *Item_func_sha::val_str(String *str)
if (!( str->alloc(SHA1_HASH_SIZE*2) ||
(mysql_sha1_result(&context,digest))))
{
sprintf((char *) str->ptr(),
"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\
%02x%02x%02x%02x%02x%02x%02x%02x",
digest[0], digest[1], digest[2], digest[3],
digest[4], digest[5], digest[6], digest[7],
digest[8], digest[9], digest[10], digest[11],
digest[12], digest[13], digest[14], digest[15],
digest[16], digest[17], digest[18], digest[19]);
array_to_hex((char *) str->ptr(), (const char*) digest, SHA1_HASH_SIZE);
str->length((uint) SHA1_HASH_SIZE*2);
null_value=0;
return str;
......
......@@ -2128,10 +2128,10 @@ bool one_thread_per_connection_end(THD *thd, bool put_in_cache)
/* It's safe to broadcast outside a lock (COND... is not deleted here) */
DBUG_PRINT("signal", ("Broadcasting COND_thread_count"));
DBUG_LEAVE; // Must match DBUG_ENTER()
my_thread_end();
mysql_cond_broadcast(&COND_thread_count);
DBUG_LEAVE; // Must match DBUG_ENTER()
pthread_exit(0);
return 0; // Avoid compiler warnings
}
......
......@@ -264,6 +264,22 @@ unpack_row(Relay_log_info const *rli,
{
DBUG_PRINT("debug", ("Was NULL; null mask: 0x%x; null bits: 0x%x",
null_mask, null_bits));
/**
Calling reset just in case one is unpacking on top a
record with data.
This could probably go into set_null() but doing so,
(i) triggers assertion in other parts of the code at
the moment; (ii) it would make us reset the field,
always when setting null, which right now doesn't seem
needed anywhere else except here.
TODO: maybe in the future we should consider moving
the reset to make it part of set_null. But then
the assertions triggered need to be
addressed/revisited.
*/
f->reset();
f->set_null();
}
else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment