Commit 1ac31924 authored by unknown's avatar unknown

Bug #30604: different flagging of time_zone_used in normal

  and ps-protocol
Finding a routine should be a transparent operation as 
far as the binary log is concerned.
But it was influencing the binary log because of the TIMESTAMP
column in the proc table.

Fixed by preserving and restoring the time_zone usage flag when
searching for a stored routine in the proc table.


mysql-test/r/binlog_innodb.result:
  Bug #30604: test case
mysql-test/r/ctype_cp932_binlog.result:
  Bug #30604: updated test results (a procedure call before that)
mysql-test/t/binlog_innodb.test:
  Bug #30604: test case
sql/sp.cc:
  Bug #30604: finding a routine should be a transparent operation as 
  far as the binary log is concerned.
  Fixed by preserving and restoring the time_zone usage flag.
parent 18f885ed
......@@ -21,3 +21,19 @@ show status like "binlog_cache_disk_use";
Variable_name Value
Binlog_cache_disk_use 1
drop table t1;
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=MyISAM;
CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;
CREATE FUNCTION bug23333()
RETURNS int(11)
DETERMINISTIC
BEGIN
INSERT INTO t1 VALUES (NULL);
SELECT COUNT(*) FROM t1 INTO @a;
RETURN @a;
END|
INSERT INTO t2 VALUES (2),(10+bug23333());
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
# 184136
DROP FUNCTION bug23333;
DROP TABLE t1, t2;
......@@ -40,6 +40,6 @@ IN ind DECIMAL(10,2))
BEGIN
INSERT INTO t4 VALUES (ins1, ins2, ind);
END
master-bin.000001 776 Query 1 995 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93))
master-bin.000001 995 Query 1 1084 use `test`; DROP PROCEDURE bug18293
master-bin.000001 1084 Query 1 1163 use `test`; DROP TABLE t4
master-bin.000001 776 Query 1 987 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93))
master-bin.000001 987 Query 1 1076 use `test`; DROP PROCEDURE bug18293
master-bin.000001 1076 Query 1 1155 use `test`; DROP TABLE t4
......@@ -37,3 +37,28 @@ show status like "binlog_cache_disk_use";
drop table t1;
#
# Bug #30604: different flagging of time_zone_used in normal and ps-protocol
#
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=MyISAM;
CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;
DELIMITER |;
# the function does not deal with time objects
CREATE FUNCTION bug23333()
RETURNS int(11)
DETERMINISTIC
BEGIN
INSERT INTO t1 VALUES (NULL);
SELECT COUNT(*) FROM t1 INTO @a;
RETURN @a;
END|
DELIMITER ;|
INSERT INTO t2 VALUES (2),(10+bug23333());
--replace_column 1 #
SHOW MASTER STATUS;
DROP FUNCTION bug23333;
DROP TABLE t1, t2;
......@@ -261,6 +261,7 @@ db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp)
char buff[65];
String str(buff, sizeof(buff), &my_charset_bin);
ulong sql_mode;
bool saved_time_zone_used= thd->time_zone_used;
Open_tables_state open_tables_state_backup;
DBUG_ENTER("db_find_routine");
DBUG_PRINT("enter", ("type: %d name: %.*s",
......@@ -370,6 +371,11 @@ db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp)
definer, created, modified);
done:
/*
Restore the time zone flag as the timezone usage in proc table
does not affect replication.
*/
thd->time_zone_used= saved_time_zone_used;
if (table)
close_proc_table(thd, &open_tables_state_backup);
DBUG_RETURN(ret);
......
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