Below is the list of changes that have just been committed into a local
5.0 repository of patg. When patg does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2178 06/06/26 23:44:34 patg@stripped +3 -0
BUG #18764
Removed query_id checking logic in write_row and added test. Please see individual
file comments.
Tested:
<snip>
xa [ pass ]
-------------------------------------------------------
Ending Tests
Shutting-down MySQL daemon
Master shutdown finished
Slave shutdown finished
All 395 tests were successful.
sql/ha_federated.cc
1.61 06/06/26 23:44:30 patg@stripped +29 -55
BUG #18764
Removed all query_id checking logic in ha_fedeated::write_row. It seems there is no need to
check this any more. Previously, it had to be done to insure that old values
which remained in a field didn't get built into the insert statement string.
What seems different now is that these old values are not in fields not specified
or not having values, so one can safely build insert fields/values into the
statement string in write_row.
mysql-test/t/federated.test
1.23 06/06/26 23:44:30 patg@stripped +38 -1
BUG #18764
New test to make sure that insert following delete_row results in correct
insert statement being built
mysql-test/r/federated.result
1.27 06/06/26 23:44:30 patg@stripped +33 -0
BUG #18764
New test results for BUG #18764
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: patg
# Host: govinda.patg.net
# Root: /home/patg/mysql-build/mysql-5.0-bug18764
--- 1.26/mysql-test/r/federated.result 2006-02-28 02:17:35 -08:00
+++ 1.27/mysql-test/r/federated.result 2006-06-26 23:44:30 -07:00
@@ -1600,7 +1600,40 @@
4 Torgny 0 0
5 Torkel 0 0
DROP TABLE federated.t1;
+DROP TABLE federated.t1;
DROP TABLE federated.bug_17377_table;
+CREATE TABLE federated.t1 (
+`id` int(11) NOT NULL,
+`val1` varchar(255) NOT NULL,
+`val2` varchar(255) NOT NULL,
+PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+CREATE TABLE federated.test_local (
+`id` int(11) NOT NULL,
+`val1` varchar(255) NOT NULL,
+`val2` varchar(255) NOT NULL,
+PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO federated.test_local VALUES (1, 'foo', 'bar'),
+(2, 'bar', 'foo');
+CREATE TABLE federated.t1 (
+`id` int(11) NOT NULL,
+`val1` varchar(255) NOT NULL,
+`val2` varchar(255) NOT NULL,
+PRIMARY KEY (`id`)
+) ENGINE=FEDERATED DEFAULT CHARSET=latin1
+CONNECTION='mysql://root@stripped:9308/federated/t1';
+insert into federated.t1 select * from federated.test_local;
+select * from federated.t1;
+id val1 val2
+1 foo bar
+2 bar foo
+delete from federated.t1 where id in (1,2);
+insert into federated.t1 select * from federated.test_local;
+select * from federated.t1;
+id val1 val2
+2 bar foo
+1 foo bar
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
DROP TABLE IF EXISTS federated.t1;
--- 1.22/mysql-test/t/federated.test 2006-02-28 02:17:35 -08:00
+++ 1.23/mysql-test/t/federated.test 2006-06-26 23:44:30 -07:00
@@ -1304,10 +1304,47 @@
order by fld_name;
select * from federated.t1 where fld_parentid=0 and fld_delt=0;
-
DROP TABLE federated.t1;
+
connection slave;
+DROP TABLE federated.t1;
DROP TABLE federated.bug_17377_table;
+
+#
+# BUG 18764
+#
+CREATE TABLE federated.t1 (
+ `id` int(11) NOT NULL,
+ `val1` varchar(255) NOT NULL,
+ `val2` varchar(255) NOT NULL,
+ PRIMARY KEY (`id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+connection master;
+CREATE TABLE federated.test_local (
+ `id` int(11) NOT NULL,
+ `val1` varchar(255) NOT NULL,
+ `val2` varchar(255) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+INSERT INTO federated.test_local VALUES (1, 'foo', 'bar'),
+ (2, 'bar', 'foo');
+
+eval CREATE TABLE federated.t1 (
+ `id` int(11) NOT NULL,
+ `val1` varchar(255) NOT NULL,
+ `val2` varchar(255) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=FEDERATED DEFAULT CHARSET=latin1
+ CONNECTION='mysql://root@stripped:$SLAVE_MYPORT/federated/t1';
+
+insert into federated.t1 select * from federated.test_local;
+select * from federated.t1;
+delete from federated.t1 where id in (1,2);
+insert into federated.t1 select * from federated.test_local;
+select * from federated.t1;
+
source include/federated_cleanup.inc;
--- 1.60/sql/ha_federated.cc 2006-02-28 02:17:35 -08:00
+++ 1.61/sql/ha_federated.cc 2006-06-26 23:44:30 -07:00
@@ -1595,14 +1595,6 @@
table->timestamp_field->set_time();
/*
- get the current query id - the fields that we add to the insert
- statement to send to the foreign will not be appended unless they match
- this query id
- */
- current_query_id= table->in_use->query_id;
- DBUG_PRINT("info", ("current query id %d", current_query_id));
-
- /*
start both our field and field values strings
*/
insert_string.append(FEDERATED_INSERT);
@@ -1615,19 +1607,6 @@
values_string.append(FEDERATED_OPENPAREN);
/*
- Even if one field is different, all_fields_same_query_id can't remain
- 0 if it remains 0, then that means no fields were specified in the query
- such as in the case of INSERT INTO table VALUES (val1, val2, valN)
-
- */
- for (field= table->field; *field; field++)
- {
- if (field > table->field && tmp_query_id != (*field)->query_id)
- all_fields_have_same_query_id= 0;
-
- tmp_query_id= (*field)->query_id;
- }
- /*
loop through the field pointer array, add any fields to both the values
list and the fields list that match the current query id
@@ -1636,42 +1615,37 @@
*/
for (field= table->field; *field; field++)
{
- /* if there is a query id and if it's equal to the current query id */
- if (((*field)->query_id && (*field)->query_id == current_query_id)
- || all_fields_have_same_query_id)
+ /*
+ There are some fields. This will be used later to determine
+ whether to chop off commas and parens.
+ */
+ has_fields= TRUE;
+
+ if ((*field)->is_null())
+ insert_field_value_string.append(FEDERATED_NULL);
+ else
{
- /*
- There are some fields. This will be used later to determine
- whether to chop off commas and parens.
- */
- has_fields= TRUE;
-
- if ((*field)->is_null())
- insert_field_value_string.append(FEDERATED_NULL);
- else
- {
- (*field)->val_str(&insert_field_value_string);
- /* quote these fields if they require it */
- (*field)->quote_data(&insert_field_value_string);
- }
- /* append the field name */
- insert_string.append((*field)->field_name);
-
- /* append the value */
- values_string.append(insert_field_value_string);
- insert_field_value_string.length(0);
-
- /* append commas between both fields and fieldnames */
- /*
- unfortunately, we can't use the logic
- if *(fields + 1) to make the following
- appends conditional because we may not append
- if the next field doesn't match the condition:
- (((*field)->query_id && (*field)->query_id == current_query_id)
- */
- insert_string.append(FEDERATED_COMMA);
- values_string.append(FEDERATED_COMMA);
+ (*field)->val_str(&insert_field_value_string);
+ /* quote these fields if they require it */
+ (*field)->quote_data(&insert_field_value_string);
}
+ /* append the field name */
+ insert_string.append((*field)->field_name);
+
+ /* append the value */
+ values_string.append(insert_field_value_string);
+ insert_field_value_string.length(0);
+
+ /* append commas between both fields and fieldnames */
+ /*
+ unfortunately, we can't use the logic
+ if *(fields + 1) to make the following
+ appends conditional because we may not append
+ if the next field doesn't match the condition:
+ (((*field)->query_id && (*field)->query_id == current_query_id)
+ */
+ insert_string.append(FEDERATED_COMMA);
+ values_string.append(FEDERATED_COMMA);
}
/*
| Thread |
|---|
| • bk commit into 5.0 tree (patg:1.2178) BUG#18764 | Patrick Galbraith | 27 Jun |