summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <gshchepa/uchum@gleb.loc>2007-07-27 13:38:11 +0500
committerunknown <gshchepa/uchum@gleb.loc>2007-07-27 13:38:11 +0500
commit30408a12d8f0aa8146927fefdcff8921ad642b32 (patch)
tree6bf1199047cde5a35117eb3dc03eaf6986ee3fe0
parent5cb265d8747314a350d343813edec9c1b94dff75 (diff)
parent1a6ced2cfa32d88f8f2ce4691715a2e304af6b6b (diff)
downloadmariadb-git-30408a12d8f0aa8146927fefdcff8921ad642b32.tar.gz
Merge gleb.loc:/home/uchum/work/bk/5.0-opt
into gleb.loc:/home/uchum/work/bk/5.1-opt sql/sql_insert.cc: Auto merged BitKeeper/deleted/.del-bdb.result: Auto merged BitKeeper/deleted/.del-ha_berkeley.cc: Auto merged BitKeeper/deleted/.del-rpl_insert_delayed.result: Auto merged mysql-test/extra/rpl_tests/rpl_insert_delayed.test: Auto merged sql/sql_select.cc: Merge with 5.0-opt. sql/table.cc: Merge with 5.0-opt.
-rw-r--r--mysql-test/extra/rpl_tests/rpl_insert_delayed.test30
-rw-r--r--sql/sql_insert.cc9
-rw-r--r--sql/sql_select.cc1
-rw-r--r--sql/table.cc3
4 files changed, 37 insertions, 6 deletions
diff --git a/mysql-test/extra/rpl_tests/rpl_insert_delayed.test b/mysql-test/extra/rpl_tests/rpl_insert_delayed.test
index 11856953959..9364bcbec48 100644
--- a/mysql-test/extra/rpl_tests/rpl_insert_delayed.test
+++ b/mysql-test/extra/rpl_tests/rpl_insert_delayed.test
@@ -84,3 +84,33 @@ USE test;
DROP SCHEMA mysqlslap;
sync_slave_with_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
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index b747c706f75..445cabbd9b8 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -549,6 +549,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
int error, res;
bool transactional_table, joins_freed= FALSE;
bool changed;
+ bool was_insert_delayed= (table_list->lock_type == TL_WRITE_DELAYED);
uint value_count;
ulong counter = 1;
ulonglong id;
@@ -832,14 +833,16 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
}
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.
For the transactional algorithm to work the invalidation must be
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 (mysql_bin_log.is_open())
@@ -880,7 +883,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
error=1;
}
}
- if (!transactional_table)
+ if (!transactional_table && changed)
thd->no_trans_update.all= TRUE;
}
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 668b7e99549..6a381c1f367 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -12313,7 +12313,6 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx,
*/
if (!on_primary_key &&
(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)
{
on_primary_key= TRUE;
diff --git a/sql/table.cc b/sql/table.cc
index e6f9b1086c7..a445e2d2816 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -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)
{
field->part_of_key= share->keys_in_use;
- if (ha_legacy_type(share->db_type()) == DB_TYPE_INNODB &&
- field->part_of_sortkey.is_set(key))
+ if (field->part_of_sortkey.is_set(key))
field->part_of_sortkey= share->keys_in_use;
}
}