diff options
author | Sujatha Sivakumar <sujatha.sivakumar@oracle.com> | 2013-10-16 11:49:00 +0530 |
---|---|---|
committer | Sujatha Sivakumar <sujatha.sivakumar@oracle.com> | 2013-10-16 11:49:00 +0530 |
commit | 4522a8704fcfdc392fce408ebeb25e3f40060ec7 (patch) | |
tree | 5f2d0b2ac93b53dd0288b665b8c79a09880e5253 /sql/sql_load.cc | |
parent | 821249420e0a9c4e0ba71ce974ed515adef504f6 (diff) | |
download | mariadb-git-4522a8704fcfdc392fce408ebeb25e3f40060ec7.tar.gz |
Bug#17429677:LAST ARGUMENT OF LOAD DATA ...SET ...STATEMENT
REPEATED TWICE IN BINLOG
Problem:
=======
If LOAD DATA ... SET ... is used the last argument of SET is
repeated twice in replication binlog.
Analysis:
========
LOAD DATA statements are reconstructed once again before
they are written to the binary log. When SET clauses are
specified as part of LOAD DATA statement, these SET clause
user command strings need to be stored in order to rebuild
the original user command. During parsing each column and
the value in the SET command are stored in two differenet
lists. All the values are stored in a string list.
When SET expression has more than one value as shown in the
following example:
SET a = @a, b = CONCAT(@b, '| 123456789');
Parser extracts values in the following manner i.e Item name
, value string, actual length of the value of the item with
in the string.
Item a:
Value for a:"= @a, b = CONCAT(@b, '| 123456789')
str_length = 4
Item b:
Value for b:"= CONCAT(@b, '| 123456789')
str_length = 27
During reconstructing the LOAD DATA command the above
strings are retrived as it is and appended to the LOAD DATA
statement. Hence it becomes as shown below.
SET `a`= @a, b = CONCAT(@b, '| 123456789'),
`b`= CONCAT(@b, '| 123456789')
Fix:
===
During reconstruction of SET command, retrieve exact item
value string rather than reading the entire string.
sql/sql_load.cc:
Added code to extract the exact Item value.
Diffstat (limited to 'sql/sql_load.cc')
-rw-r--r-- | sql/sql_load.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 2e85cb105b0..b593412c559 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -738,8 +738,16 @@ static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex, if (n++) pfields.append(", "); append_identifier(thd, &pfields, item->name, strlen(item->name)); + // Extract exact Item value + str->copy(); pfields.append((char *)str->ptr()); + str->free(); } + /* + Clear the SET string list once the SET command is reconstructed + as we donot require the list anymore. + */ + thd->lex->load_set_str_list.empty(); } p= pfields.c_ptr_safe(); |