Commit c8e525b7 authored by gkodinov/kgeorge@magare.gmz's avatar gkodinov/kgeorge@magare.gmz

Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.1-opt

into  magare.gmz:/home/kgeorge/mysql/autopush/B30036-5.1-opt
parents 5324d45a e6c7e7d6
...@@ -84,3 +84,33 @@ USE test; ...@@ -84,3 +84,33 @@ USE test;
DROP SCHEMA mysqlslap; DROP SCHEMA mysqlslap;
sync_slave_with_master; sync_slave_with_master;
connection master; connection master;
#
# Bug #29571: INSERT DELAYED IGNORE written to binary log on the master but
# on the slave
#
CREATE TABLE t1(a int, UNIQUE(a));
INSERT DELAYED IGNORE INTO t1 VALUES(1);
INSERT DELAYED IGNORE INTO t1 VALUES(1);
flush table t1; # to wait for INSERT DELAYED to be done
#must show two INSERT DELAYED
--replace_column 1 x 2 x 3 x 4 x 5 x
show binlog events limit 11,100;
select * from t1;
sync_slave_with_master;
echo On slave;
#must show two INSERT DELAYED
--replace_column 1 x 2 x 3 x 4 x 5 x
show binlog events limit 12,100;
select * from t1;
# clean up
connection master;
drop table t1;
sync_slave_with_master;
connection master;
--echo End of 5.0 tests
...@@ -549,6 +549,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, ...@@ -549,6 +549,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
int error, res; int error, res;
bool transactional_table, joins_freed= FALSE; bool transactional_table, joins_freed= FALSE;
bool changed; bool changed;
bool was_insert_delayed= (table_list->lock_type == TL_WRITE_DELAYED);
uint value_count; uint value_count;
ulong counter = 1; ulong counter = 1;
ulonglong id; ulonglong id;
...@@ -832,14 +833,16 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, ...@@ -832,14 +833,16 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
} }
transactional_table= table->file->has_transactions(); transactional_table= table->file->has_transactions();
if ((changed= (info.copied || info.deleted || info.updated))) if ((changed= (info.copied || info.deleted || info.updated)) ||
was_insert_delayed)
{ {
/* /*
Invalidate the table in the query cache if something changed. Invalidate the table in the query cache if something changed.
For the transactional algorithm to work the invalidation must be For the transactional algorithm to work the invalidation must be
before binlog writing and ha_autocommit_or_rollback before binlog writing and ha_autocommit_or_rollback
*/ */
query_cache_invalidate3(thd, table_list, 1); if (changed)
query_cache_invalidate3(thd, table_list, 1);
if (error <= 0 || !transactional_table) if (error <= 0 || !transactional_table)
{ {
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())
...@@ -880,7 +883,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, ...@@ -880,7 +883,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
error=1; error=1;
} }
} }
if (!transactional_table) if (!transactional_table && changed)
thd->no_trans_update.all= TRUE; thd->no_trans_update.all= TRUE;
} }
} }
......
...@@ -12313,7 +12313,6 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx, ...@@ -12313,7 +12313,6 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx,
*/ */
if (!on_primary_key && if (!on_primary_key &&
(table->file->ha_table_flags() & HA_PRIMARY_KEY_IN_READ_INDEX) && (table->file->ha_table_flags() & HA_PRIMARY_KEY_IN_READ_INDEX) &&
ha_legacy_type(table->s->db_type()) == DB_TYPE_INNODB &&
table->s->primary_key != MAX_KEY) table->s->primary_key != MAX_KEY)
{ {
on_primary_key= TRUE; on_primary_key= TRUE;
......
...@@ -1351,8 +1351,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, ...@@ -1351,8 +1351,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
if (ha_option & HA_PRIMARY_KEY_IN_READ_INDEX) if (ha_option & HA_PRIMARY_KEY_IN_READ_INDEX)
{ {
field->part_of_key= share->keys_in_use; field->part_of_key= share->keys_in_use;
if (ha_legacy_type(share->db_type()) == DB_TYPE_INNODB && if (field->part_of_sortkey.is_set(key))
field->part_of_sortkey.is_set(key))
field->part_of_sortkey= share->keys_in_use; field->part_of_sortkey= share->keys_in_use;
} }
} }
......
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