Commit 3cb82b62 authored by andrew's avatar andrew

Merged maria trunk

parents 97954225 5fffa449
......@@ -643,4 +643,12 @@
#cmakedefine SIZEOF_TIME_T @SIZEOF_TIME_T@
#cmakedefine TIME_T_UNSIGNED @TIME_T_UNSIGNED@
#ifdef _AIX
/*
AIX includes inttypes.h from sys/types.h
Explicitly request format macros before the first inclusion of inttypes.h
*/
#define __STDC_FORMAT_MACROS
#endif
#endif
......@@ -862,4 +862,27 @@ i c1 c2 t1_field t2_field
drop table t1,t2,t3;
set optimizer_switch=default;
set optimizer_switch='exists_to_in=on';
#
#MDEV-5401: Wrong result (missing row) on a 2nd execution of PS with
#exists_to_in=on, MERGE view or a SELECT SQ
#
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1),(2);
CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
CREATE TABLE t2 (b INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES (2),(3);
SELECT * FROM v1 WHERE EXISTS ( SELECT * FROM t2 t2x, t2 t2y WHERE t2y.b = a );
a
2
PREPARE stmt FROM "SELECT * FROM v1 WHERE EXISTS ( SELECT * FROM t2 t2x, t2 t2y WHERE t2y.b = a )";
EXECUTE stmt;
a
2
EXECUTE stmt;
a
2
deallocate prepare stmt;
drop view v1;
drop table t1,t2;
# End of 10.0 tests
set optimizer_switch=default;
......@@ -801,11 +801,29 @@ a b
5 NULL
6 6
7 NULL
*** MDEV-5938: Exec_master_log_pos not updated at log rotate in parallel replication ***
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=1;
SET DEBUG_SYNC= 'RESET';
include/start_slave.inc
CREATE TABLE t5 (a INT PRIMARY KEY, b INT);
INSERT INTO t5 VALUES (1,1);
INSERT INTO t5 VALUES (2,2), (3,8);
INSERT INTO t5 VALUES (4,16);
test_check
OK
test_check
OK
FLUSH LOGS;
test_check
OK
test_check
OK
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
include/start_slave.inc
SET DEBUG_SYNC= 'RESET';
DROP function foo;
DROP TABLE t1,t2,t3,t4;
DROP TABLE t1,t2,t3,t4,t5;
SET DEBUG_SYNC= 'RESET';
include/rpl_end.inc
......@@ -1250,6 +1250,47 @@ SET debug_sync='RESET';
SELECT * FROM t4 ORDER BY a;
--echo *** MDEV-5938: Exec_master_log_pos not updated at log rotate in parallel replication ***
--connection server_2
--source include/stop_slave.inc
SET GLOBAL slave_parallel_threads=1;
SET DEBUG_SYNC= 'RESET';
--source include/start_slave.inc
--connection server_1
CREATE TABLE t5 (a INT PRIMARY KEY, b INT);
INSERT INTO t5 VALUES (1,1);
INSERT INTO t5 VALUES (2,2), (3,8);
INSERT INTO t5 VALUES (4,16);
--save_master_pos
--connection server_2
--sync_with_master
let $io_file= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1);
let $io_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1);
let $sql_file= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1);
let $sql_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
--disable_query_log
eval SELECT IF('$io_file' = '$sql_file', "OK", "Not ok, $io_file <> $sql_file") AS test_check;
eval SELECT IF('$io_pos' = '$sql_pos', "OK", "Not ok, $io_pos <> $sql_pos") AS test_check;
--enable_query_log
--connection server_1
FLUSH LOGS;
--save_master_pos
--connection server_2
--sync_with_master
let $io_file= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1);
let $io_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1);
let $sql_file= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1);
let $sql_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
--disable_query_log
eval SELECT IF('$io_file' = '$sql_file', "OK", "Not ok, $io_file <> $sql_file") AS test_check;
eval SELECT IF('$io_pos' = '$sql_pos', "OK", "Not ok, $io_pos <> $sql_pos") AS test_check;
--enable_query_log
--connection server_2
--source include/stop_slave.inc
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
......@@ -1258,7 +1299,7 @@ SET DEBUG_SYNC= 'RESET';
--connection server_1
DROP function foo;
DROP TABLE t1,t2,t3,t4;
DROP TABLE t1,t2,t3,t4,t5;
SET DEBUG_SYNC= 'RESET';
--source include/rpl_end.inc
......@@ -735,5 +735,30 @@ drop table t1,t2,t3;
set optimizer_switch=default;
set optimizer_switch='exists_to_in=on';
--echo #
--echo #MDEV-5401: Wrong result (missing row) on a 2nd execution of PS with
--echo #exists_to_in=on, MERGE view or a SELECT SQ
--echo #
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1),(2);
CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
CREATE TABLE t2 (b INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES (2),(3);
SELECT * FROM v1 WHERE EXISTS ( SELECT * FROM t2 t2x, t2 t2y WHERE t2y.b = a );
PREPARE stmt FROM "SELECT * FROM v1 WHERE EXISTS ( SELECT * FROM t2 t2x, t2 t2y WHERE t2y.b = a )";
EXECUTE stmt;
EXECUTE stmt;
deallocate prepare stmt;
drop view v1;
drop table t1,t2;
--echo # End of 10.0 tests
#restore defaults
set optimizer_switch=default;
......@@ -2626,7 +2626,7 @@ static bool check_equality_for_exist2in(Item_func *func,
typedef struct st_eq_field_outer
{
Item_func **eq_ref;
Item **eq_ref;
Item_ident *local_field;
Item *outer_exp;
} EQ_FIELD_OUTER;
......@@ -2665,7 +2665,7 @@ static bool find_inner_outer_equalities(Item **conds,
&element.outer_exp))
{
found= TRUE;
element.eq_ref= (Item_func **)li.ref();
element.eq_ref= li.ref();
if (result.append(element))
goto alloc_err;
}
......@@ -2677,7 +2677,7 @@ static bool find_inner_outer_equalities(Item **conds,
&element.outer_exp))
{
found= TRUE;
element.eq_ref= (Item_func **)conds;
element.eq_ref= conds;
if (result.append(element))
goto alloc_err;
}
......@@ -2700,7 +2700,7 @@ bool Item_exists_subselect::exists2in_processor(uchar *opt_arg)
THD *thd= (THD *)opt_arg;
SELECT_LEX *first_select=unit->first_select(), *save_select;
JOIN *join= first_select->join;
Item_func *eq= NULL, **eq_ref= NULL;
Item **eq_ref= NULL;
Item_ident *local_field= NULL;
Item *outer_exp= NULL;
Item *left_exp= NULL; Item_in_subselect *in_subs;
......@@ -2774,7 +2774,6 @@ bool Item_exists_subselect::exists2in_processor(uchar *opt_arg)
{
Item *item= it++;
eq_ref= eqs.at(i).eq_ref;
eq= *eq_ref;
local_field= eqs.at(i).local_field;
outer_exp= eqs.at(i).outer_exp;
/* Add the field to the SELECT_LIST */
......@@ -2789,10 +2788,7 @@ bool Item_exists_subselect::exists2in_processor(uchar *opt_arg)
/* remove the parts from condition */
if (!upper_not || !local_field->maybe_null)
{
eq->arguments()[0]= new Item_int(1);
eq->arguments()[1]= new Item_int(1);
}
*eq_ref= new Item_int(1);
else
{
*eq_ref= new Item_func_isnotnull(
......
......@@ -1495,7 +1495,6 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev,
}
else if (!is_group_event)
{
my_off_t log_pos;
int err;
bool tmp;
/*
......@@ -1509,7 +1508,13 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev,
serial_rgi->is_parallel_exec= true;
err= rpt_handle_event(qev, NULL);
serial_rgi->is_parallel_exec= tmp;
log_pos= ev->log_pos;
if (ev->is_relay_log_event())
qev->future_event_master_log_pos= 0;
else if (typ == ROTATE_EVENT)
qev->future_event_master_log_pos=
(static_cast<Rotate_log_event *>(ev))->pos;
else
qev->future_event_master_log_pos= ev->log_pos;
delete_or_keep_event_post_apply(serial_rgi, typ, ev);
if (err)
......@@ -1532,7 +1537,6 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev,
the current point.
*/
qev->ev= NULL;
qev->future_event_master_log_pos= log_pos;
}
else
{
......
......@@ -318,7 +318,7 @@ handle_slave_init(void *arg __attribute__((unused)))
mysql_mutex_lock(&LOCK_thread_count);
slave_init_thread_running= false;
mysql_cond_signal(&COND_thread_count);
mysql_cond_broadcast(&COND_thread_count);
mysql_mutex_unlock(&LOCK_thread_count);
return 0;
......
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