Commit c3b3d621 authored by Joerg Bruehe's avatar Joerg Bruehe

Merge from 5.1 main tree.

parents 58e08f25 23176f8f
...@@ -2101,37 +2101,6 @@ static bool add_line(String &buffer,char *line,char *in_string, ...@@ -2101,37 +2101,6 @@ static bool add_line(String &buffer,char *line,char *in_string,
continue; continue;
} }
} }
else if (!*ml_comment && !*in_string &&
(end_of_line - pos) >= 10 &&
!my_strnncoll(charset_info, (uchar*) pos, 10,
(const uchar*) "delimiter ", 10))
{
// Flush previously accepted characters
if (out != line)
{
buffer.append(line, (uint32) (out - line));
out= line;
}
// Flush possible comments in the buffer
if (!buffer.is_empty())
{
if (com_go(&buffer, 0) > 0) // < 0 is not fatal
DBUG_RETURN(1);
buffer.length(0);
}
/*
Delimiter wants the get rest of the given line as argument to
allow one to change ';' to ';;' and back
*/
buffer.append(pos);
if (com_delimiter(&buffer, pos) > 0)
DBUG_RETURN(1);
buffer.length(0);
break;
}
else if (!*ml_comment && !*in_string && is_prefix(pos, delimiter)) else if (!*ml_comment && !*in_string && is_prefix(pos, delimiter))
{ {
// Found a statement. Continue parsing after the delimiter // Found a statement. Continue parsing after the delimiter
......
...@@ -10,7 +10,7 @@ AC_CANONICAL_SYSTEM ...@@ -10,7 +10,7 @@ AC_CANONICAL_SYSTEM
# #
# When changing major version number please also check switch statement # When changing major version number please also check switch statement
# in mysqlbinlog::check_master_version(). # in mysqlbinlog::check_master_version().
AM_INIT_AUTOMAKE(mysql, 5.1.26-rc) AM_INIT_AUTOMAKE(mysql, 5.1.27)
AM_CONFIG_HEADER([include/config.h:config.h.in]) AM_CONFIG_HEADER([include/config.h:config.h.in])
PROTOCOL_VERSION=10 PROTOCOL_VERSION=10
......
...@@ -38,6 +38,8 @@ t2 ...@@ -38,6 +38,8 @@ t2
t3 t3
Tables_in_test Tables_in_test
t1 t1
delimiter
1
_ _
Test delimiter : from command line Test delimiter : from command line
a a
......
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create table `t1` (`id` int not null auto_increment primary key);
create trigger `trg` before insert on `t1` for each row begin end;
set @@global.debug="+d,simulate_bug33029";
stop slave;
start slave;
insert into `t1` values ();
select * from t1;
id
1
#
# Bug #36443 Server crashes when executing insert when insert trigger on table
#
# Emulating the former bug#33029 situation to see that there is no crash anymore.
#
source include/master-slave.inc;
create table `t1` (`id` int not null auto_increment primary key);
create trigger `trg` before insert on `t1` for each row begin end;
sync_slave_with_master;
set @@global.debug="+d,simulate_bug33029";
stop slave;
start slave;
connection master;
insert into `t1` values ();
sync_slave_with_master;
select * from t1;
...@@ -59,3 +59,9 @@ source t/mysql_delimiter_19799.sql ...@@ -59,3 +59,9 @@ source t/mysql_delimiter_19799.sql
use test// use test//
show tables// show tables//
delimiter ; # Reset delimiter delimiter ; # Reset delimiter
#
# Bug #33812: mysql client incorrectly parsing DELIMITER
#
select a as delimiter from t1
delimiter ; # Reset delimiter
...@@ -4136,6 +4136,7 @@ bool rpl_master_erroneous_autoinc(THD *thd) ...@@ -4136,6 +4136,7 @@ bool rpl_master_erroneous_autoinc(THD *thd)
if (active_mi && active_mi->rli.sql_thd == thd) if (active_mi && active_mi->rli.sql_thd == thd)
{ {
Relay_log_info *rli= &active_mi->rli; Relay_log_info *rli= &active_mi->rli;
DBUG_EXECUTE_IF("simulate_bug33029", return TRUE;);
return rpl_master_has_bug(rli, 33029, FALSE); return rpl_master_has_bug(rli, 33029, FALSE);
} }
return FALSE; return FALSE;
......
...@@ -2882,8 +2882,8 @@ void THD::reset_sub_statement_state(Sub_statement_state *backup, ...@@ -2882,8 +2882,8 @@ void THD::reset_sub_statement_state(Sub_statement_state *backup,
*/ */
if (rpl_master_erroneous_autoinc(this)) if (rpl_master_erroneous_autoinc(this))
{ {
backup->auto_inc_intervals_forced= auto_inc_intervals_forced; DBUG_ASSERT(backup->auto_inc_intervals_forced.nb_elements() == 0);
auto_inc_intervals_forced.empty(); auto_inc_intervals_forced.swap(&backup->auto_inc_intervals_forced);
} }
#endif #endif
...@@ -2931,8 +2931,8 @@ void THD::restore_sub_statement_state(Sub_statement_state *backup) ...@@ -2931,8 +2931,8 @@ void THD::restore_sub_statement_state(Sub_statement_state *backup)
*/ */
if (rpl_master_erroneous_autoinc(this)) if (rpl_master_erroneous_autoinc(this))
{ {
auto_inc_intervals_forced= backup->auto_inc_intervals_forced; backup->auto_inc_intervals_forced.swap(&auto_inc_intervals_forced);
backup->auto_inc_intervals_forced.empty(); DBUG_ASSERT(backup->auto_inc_intervals_forced.nb_elements() == 0);
} }
#endif #endif
......
...@@ -314,31 +314,22 @@ private: ...@@ -314,31 +314,22 @@ private:
*/ */
Discrete_interval *current; Discrete_interval *current;
uint elements; // number of elements uint elements; // number of elements
void set_members(Discrete_interval *h, Discrete_interval *t,
/* helper function for copy construct and assignment operator */ Discrete_interval *c, uint el)
void copy_(const Discrete_intervals_list& from)
{
for (Discrete_interval *i= from.head; i; i= i->next)
{ {
Discrete_interval j= *i; head= h;
append(&j); tail= t;
} current= c;
elements= el;
} }
void operator=(Discrete_intervals_list &); /* prevent use of these */
Discrete_intervals_list(const Discrete_intervals_list &);
public: public:
Discrete_intervals_list() : head(NULL), current(NULL), elements(0) {}; Discrete_intervals_list() : head(NULL), current(NULL), elements(0) {};
Discrete_intervals_list(const Discrete_intervals_list& from)
{
copy_(from);
}
void operator=(const Discrete_intervals_list& from)
{
empty();
copy_(from);
}
void empty_no_free() void empty_no_free()
{ {
head= current= NULL; set_members(NULL, NULL, NULL, 0);
elements= 0;
} }
void empty() void empty()
{ {
...@@ -350,7 +341,24 @@ public: ...@@ -350,7 +341,24 @@ public:
} }
empty_no_free(); empty_no_free();
} }
void copy_shallow(const Discrete_intervals_list * dli)
{
head= dli->get_head();
tail= dli->get_tail();
current= dli->get_current();
elements= dli->nb_elements();
}
void swap (Discrete_intervals_list * dli)
{
Discrete_interval *h, *t, *c;
uint el;
h= dli->get_head();
t= dli->get_tail();
c= dli->get_current();
el= dli->nb_elements();
dli->copy_shallow(this);
set_members(h, t, c, el);
}
const Discrete_interval* get_next() const Discrete_interval* get_next()
{ {
Discrete_interval *tmp= current; Discrete_interval *tmp= current;
...@@ -364,4 +372,7 @@ public: ...@@ -364,4 +372,7 @@ public:
ulonglong minimum() const { return (head ? head->minimum() : 0); }; ulonglong minimum() const { return (head ? head->minimum() : 0); };
ulonglong maximum() const { return (head ? tail->maximum() : 0); }; ulonglong maximum() const { return (head ? tail->maximum() : 0); };
uint nb_elements() const { return elements; } uint nb_elements() const { return elements; }
Discrete_interval* get_head() const { return head; };
Discrete_interval* get_tail() const { return tail; };
Discrete_interval* get_current() const { return current; };
}; };
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