Commit d7042ec4 authored by Yuchen Pei's avatar Yuchen Pei

Merge branch '10.5' into 10.6

parents 0076eb3d 53a48678
...@@ -4965,4 +4965,16 @@ SELECT a,b FROM t1 GROUP BY a,b HAVING a = (b IS NULL); ...@@ -4965,4 +4965,16 @@ SELECT a,b FROM t1 GROUP BY a,b HAVING a = (b IS NULL);
a b a b
0 11 0 11
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-19520 Extend condition normalization to include 'NOT a'
# having Item_func_not in item tree breaks assumptions during the
# optimization phase about transformation possibilities in fix_fields().
# Remove Item_func_not by extending normalization during parsing.
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (0),(1);
SELECT a FROM t1 GROUP BY a HAVING NOT a;
a
0
DROP TABLE t1;
End of 10.4 tests End of 10.4 tests
...@@ -1489,4 +1489,16 @@ SELECT a,b FROM t1 GROUP BY a,b HAVING a = (b IS NULL); ...@@ -1489,4 +1489,16 @@ SELECT a,b FROM t1 GROUP BY a,b HAVING a = (b IS NULL);
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-19520 Extend condition normalization to include 'NOT a'
--echo # having Item_func_not in item tree breaks assumptions during the
--echo # optimization phase about transformation possibilities in fix_fields().
--echo # Remove Item_func_not by extending normalization during parsing.
--echo #
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (0),(1);
SELECT a FROM t1 GROUP BY a HAVING NOT a;
DROP TABLE t1;
--echo End of 10.4 tests --echo End of 10.4 tests
...@@ -27,13 +27,13 @@ ...@@ -27,13 +27,13 @@
#include "lock.h" // mysql_unlock_tables #include "lock.h" // mysql_unlock_tables
#include "rpl_rli.h" #include "rpl_rli.h"
#include "rpl_utility.h" #include "rpl_utility.h"
#endif
#include "log_event_old.h"
#include "rpl_record_old.h"
#include "transaction.h"
#ifdef WITH_WSREP #ifdef WITH_WSREP
#include "wsrep_mysqld.h" #include "wsrep_mysqld.h"
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
#endif /* MYSQL_CLIENT */
#include "log_event_old.h"
#include "rpl_record_old.h"
#include "transaction.h"
PSI_memory_key key_memory_log_event_old; PSI_memory_key key_memory_log_event_old;
......
...@@ -4862,7 +4862,7 @@ class THD: public THD_count, /* this must be first */ ...@@ -4862,7 +4862,7 @@ class THD: public THD_count, /* this must be first */
my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0)); my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0));
return TRUE; return TRUE;
} }
/* Get db name or "". Use for printing current db */ /* Get db name or "". */
const char *get_db() const char *get_db()
{ return safe_str(db.str); } { return safe_str(db.str); }
......
...@@ -1027,10 +1027,19 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list, ...@@ -1027,10 +1027,19 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list,
*/ */
restore_record(table,s->default_values); // Get empty record restore_record(table,s->default_values); // Get empty record
table->reset_default_fields(); table->reset_default_fields();
/*
Reset the sentinel thd->bulk_param in order not to consume the next
values of a bound array in case one of statement executed by
the trigger's body is INSERT statement.
*/
void *save_bulk_param= thd->bulk_param;
thd->bulk_param= nullptr;
if (unlikely(fill_record_n_invoke_before_triggers(thd, table, fields, if (unlikely(fill_record_n_invoke_before_triggers(thd, table, fields,
*values, 0, *values, 0,
TRG_EVENT_INSERT))) TRG_EVENT_INSERT)))
{ {
thd->bulk_param= save_bulk_param;
if (values_list.elements != 1 && ! thd->is_error()) if (values_list.elements != 1 && ! thd->is_error())
{ {
info.records++; info.records++;
...@@ -1044,6 +1053,7 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list, ...@@ -1044,6 +1053,7 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list,
error=1; error=1;
break; break;
} }
thd->bulk_param= save_bulk_param;
} }
else else
{ {
...@@ -1073,12 +1083,22 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list, ...@@ -1073,12 +1083,22 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list,
} }
} }
table->reset_default_fields(); table->reset_default_fields();
/*
Reset the sentinel thd->bulk_param in order not to consume the next
values of a bound array in case one of statement executed by
the trigger's body is INSERT statement.
*/
void *save_bulk_param= thd->bulk_param;
thd->bulk_param= nullptr;
if (unlikely(fill_record_n_invoke_before_triggers(thd, table, if (unlikely(fill_record_n_invoke_before_triggers(thd, table,
table-> table->
field_to_fill(), field_to_fill(),
*values, 0, *values, 0,
TRG_EVENT_INSERT))) TRG_EVENT_INSERT)))
{ {
thd->bulk_param= save_bulk_param;
if (values_list.elements != 1 && ! thd->is_error()) if (values_list.elements != 1 && ! thd->is_error())
{ {
info.records++; info.records++;
...@@ -1087,6 +1107,7 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list, ...@@ -1087,6 +1107,7 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list,
error=1; error=1;
break; break;
} }
thd->bulk_param= save_bulk_param;
} }
/* /*
......
...@@ -9158,6 +9158,7 @@ push_new_name_resolution_context(THD *thd, ...@@ -9158,6 +9158,7 @@ push_new_name_resolution_context(THD *thd,
/** /**
Fix condition which contains only field (f turns to f <> 0 ) Fix condition which contains only field (f turns to f <> 0 )
or only contains the function NOT field (not f turns to f == 0)
@param cond The condition to fix @param cond The condition to fix
...@@ -9173,6 +9174,21 @@ Item *normalize_cond(THD *thd, Item *cond) ...@@ -9173,6 +9174,21 @@ Item *normalize_cond(THD *thd, Item *cond)
{ {
cond= new (thd->mem_root) Item_func_ne(thd, cond, new (thd->mem_root) Item_int(thd, 0)); cond= new (thd->mem_root) Item_func_ne(thd, cond, new (thd->mem_root) Item_int(thd, 0));
} }
else
{
if (type == Item::FUNC_ITEM)
{
Item_func *func_item= (Item_func *)cond;
if (func_item->functype() == Item_func::NOT_FUNC)
{
Item *arg= func_item->arguments()[0];
if (arg->type() == Item::FIELD_ITEM ||
arg->type() == Item::REF_ITEM)
cond= new (thd->mem_root) Item_func_eq(thd, arg,
new (thd->mem_root) Item_int(thd, 0));
}
}
}
} }
return cond; return cond;
} }
......
...@@ -266,10 +266,10 @@ namespace open_query { ...@@ -266,10 +266,10 @@ namespace open_query {
: oqgraph_cursor(arg), no_weight(), sequence(0), results(), last() : oqgraph_cursor(arg), no_weight(), sequence(0), results(), last()
{ } { }
int fetch_row(const row &, row&); int fetch_row(const row &, row&) override;
int fetch_row(const row &, row&, const reference&); int fetch_row(const row &, row&, const reference&) override;
void current(reference& ref) const void current(reference& ref) const override
{ {
ref= last; ref= last;
} }
...@@ -286,10 +286,10 @@ namespace open_query { ...@@ -286,10 +286,10 @@ namespace open_query {
: oqgraph_cursor(arg), position(0) : oqgraph_cursor(arg), position(0)
{ } { }
int fetch_row(const row &, row&); int fetch_row(const row &, row&) override;
int fetch_row(const row &, row&, const reference&); int fetch_row(const row &, row&, const reference&) override;
void current(reference& ref) const void current(reference& ref) const override
{ {
ref= last; ref= last;
} }
...@@ -308,10 +308,10 @@ namespace open_query { ...@@ -308,10 +308,10 @@ namespace open_query {
: oqgraph_cursor(arg), position(0), last() : oqgraph_cursor(arg), position(0), last()
{ } { }
int fetch_row(const row &, row&); int fetch_row(const row &, row&) override;
int fetch_row(const row &, row&, const reference&); int fetch_row(const row &, row&, const reference&) override;
void current(reference& ref) const void current(reference& ref) const override
{ {
ref= last; ref= last;
} }
......
...@@ -58,59 +58,59 @@ class ha_oqgraph: public handler ...@@ -58,59 +58,59 @@ class ha_oqgraph: public handler
public: public:
#if MYSQL_VERSION_ID >= 50100 #if MYSQL_VERSION_ID >= 50100
ha_oqgraph(handlerton *hton, TABLE_SHARE *table); ha_oqgraph(handlerton *hton, TABLE_SHARE *table);
ulonglong table_flags() const; ulonglong table_flags() const override;
#else #else
ha_oqgraph(TABLE *table); ha_oqgraph(TABLE *table);
Table_flags table_flags() const; Table_flags table_flags() const;
#endif #endif
virtual ~ha_oqgraph(); virtual ~ha_oqgraph();
const char *index_type(uint inx) const char *index_type(uint inx) override
{ {
return "HASH"; return "HASH";
} }
/* Rows also use a fixed-size format */ /* Rows also use a fixed-size format */
enum row_type get_row_type() const { return ROW_TYPE_FIXED; } enum row_type get_row_type() const override { return ROW_TYPE_FIXED; }
ulong index_flags(uint inx, uint part, bool all_parts) const; ulong index_flags(uint inx, uint part, bool all_parts) const override;
const char **bas_ext() const; const char **bas_ext() const;
uint max_supported_keys() const { return MAX_KEY; } uint max_supported_keys() const override { return MAX_KEY; }
uint max_supported_key_part_length() const { return MAX_KEY_LENGTH; } uint max_supported_key_part_length() const override { return MAX_KEY_LENGTH; }
double scan_time() { return (double) 1000000000; } double scan_time() override { return (double) 1000000000; }
double read_time(uint index, uint ranges, ha_rows rows) double read_time(uint, uint, ha_rows) override
{ return 1; } { return 1; }
// Doesn't make sense to change the engine on a virtual table. // Doesn't make sense to change the engine on a virtual table.
virtual bool can_switch_engines() { return false; } virtual bool can_switch_engines() override { return false; }
int open(const char *name, int mode, uint test_if_locked); int open(const char *name, int mode, uint test_if_locked) override;
int close(void); int close(void) override;
int write_row(const byte * buf); int write_row(const byte * buf) override;
int update_row(const uchar * old_data, const uchar * new_data); int update_row(const uchar * old_data, const uchar * new_data) override;
int delete_row(const byte * buf); int delete_row(const byte * buf) override;
int index_read(byte * buf, const byte * key, int index_read(byte * buf, const byte * key,
uint key_len, enum ha_rkey_function find_flag); uint key_len, enum ha_rkey_function find_flag) override;
int index_read_idx(byte * buf, uint idx, const byte * key, int index_read_idx(byte * buf, uint idx, const byte * key,
uint key_len, enum ha_rkey_function find_flag); uint key_len, enum ha_rkey_function find_flag);
int index_next_same(byte * buf, const byte * key, uint key_len); int index_next_same(byte * buf, const byte * key, uint key_len) override;
int rnd_init(bool scan); int rnd_init(bool scan) override;
int rnd_next(byte *buf); int rnd_next(byte *buf) override;
int rnd_pos(byte * buf, byte *pos); int rnd_pos(byte * buf, byte *pos) override;
void position(const byte *record); void position(const byte *record) override;
int info(uint); int info(uint) override;
int extra(enum ha_extra_function operation); int extra(enum ha_extra_function operation) override;
int external_lock(THD *thd, int lock_type); int external_lock(THD *thd, int lock_type) override;
int delete_all_rows(void); int delete_all_rows(void) override;
ha_rows records_in_range(uint inx, const key_range *min_key, ha_rows records_in_range(uint inx, const key_range *min_key,
const key_range *max_key, page_range *pages); const key_range *max_key, page_range *pages) override;
int delete_table(const char *from); int delete_table(const char *from) override;
int rename_table(const char * from, const char * to); int rename_table(const char * from, const char * to) override;
int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info); int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info) override;
void update_create_info(HA_CREATE_INFO *create_info); void update_create_info(HA_CREATE_INFO *create_info) override;
THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
enum thr_lock_type lock_type); enum thr_lock_type lock_type) override;
int cmp_ref(const byte *ref1, const byte *ref2); int cmp_ref(const byte *ref1, const byte *ref2) override;
bool get_error_message(int error, String* buf); bool get_error_message(int error, String* buf) override;
void fprint_error(const char* fmt, ...); void fprint_error(const char* fmt, ...);
...@@ -123,7 +123,7 @@ class ha_oqgraph: public handler ...@@ -123,7 +123,7 @@ class ha_oqgraph: public handler
uint key_length, uint key_length,
qc_engine_callback qc_engine_callback
*engine_callback, *engine_callback,
ulonglong *engine_data) ulonglong *engine_data) override
{ {
/* /*
Do not put data from OQGRAPH tables into query cache (because there Do not put data from OQGRAPH tables into query cache (because there
......
# Use default setting for mysqld processes # Use default setting for mysqld processes
!include include/default_mysqld.cnf !include include/default_mysqld.cnf
!include my_1_1.cnf
[mysqld.1.1] !include my_2_1.cnf
log-bin= master-bin !include my_2_2.cnf
loose_handlersocket_port= 20000 !include my_2_3.cnf
loose_handlersocket_port_wr= 20001 !include my_3_1.cnf
loose_handlersocket_threads= 2 !include my_3_2.cnf
loose_handlersocket_threads_wr= 1 !include my_3_3.cnf
loose_handlersocket_support_merge_table= 0 !include my_4_1.cnf
loose_handlersocket_direct_update_mode= 2
loose_handlersocket_unlimited_boundary= 65536
loose_handlersocket_bulk_insert= 0
loose_handlersocket_bulk_insert_timeout= 0
loose_handlersocket_general_log= 1
loose_handlersocket_timeout= 30
loose_handlersocket_close_table_interval=2
open_files_limit= 4096
loose_partition= 1
[mysqld.2.1]
loose_handlersocket_port= 20002
loose_handlersocket_port_wr= 20003
loose_handlersocket_threads= 2
loose_handlersocket_threads_wr= 1
loose_handlersocket_support_merge_table= 0
loose_handlersocket_direct_update_mode= 2
loose_handlersocket_unlimited_boundary= 65536
loose_handlersocket_bulk_insert= 0
loose_handlersocket_bulk_insert_timeout= 0
loose_handlersocket_general_log= 1
loose_handlersocket_timeout= 30
loose_handlersocket_close_table_interval=2
open_files_limit= 4096
[mysqld.2.2]
loose_handlersocket_port= 20004
loose_handlersocket_port_wr= 20005
loose_handlersocket_threads= 2
loose_handlersocket_threads_wr= 1
loose_handlersocket_support_merge_table= 0
loose_handlersocket_direct_update_mode= 2
loose_handlersocket_unlimited_boundary= 65536
loose_handlersocket_bulk_insert= 0
loose_handlersocket_bulk_insert_timeout= 0
loose_handlersocket_general_log= 1
loose_handlersocket_timeout= 30
loose_handlersocket_close_table_interval=2
open_files_limit= 4096
[mysqld.2.3]
[mysqld.3.1]
loose_partition= 1
[mysqld.3.2]
loose_partition= 1
[mysqld.3.3]
loose_partition= 1
[mysqld.4.1]
loose_partition= 1
[ENV]
USE_GEOMETRY_TEST= 1
USE_FULLTEXT_TEST= 1
USE_HA_TEST= 1
USE_GENERAL_LOG= 1
USE_REPLICATION= 1
MASTER_1_MYPORT= @mysqld.1.1.port
MASTER_1_HSRPORT= 20000
MASTER_1_HSWPORT= 20001
MASTER_1_MYSOCK= @mysqld.1.1.socket
MASTER_1_ENGINE_TYPE= Spider
#MASTER_1_ENGINE_TYPE= MyISAM
MASTER_1_ENGINE= ENGINE=Spider
MASTER_1_CHARSET= DEFAULT CHARSET=utf8
MASTER_1_ENGINE2= ENGINE=MyISAM
MASTER_1_CHARSET2= DEFAULT CHARSET=utf8
MASTER_1_CHARSET3= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
SLAVE1_1_MYPORT= @mysqld.4.1.port
SLAVE1_1_MYSOCK= @mysqld.4.1.socket
SLAVE1_1_ENGINE_TYPE= MyISAM
SLAVE1_1_ENGINE= ENGINE=MyISAM
SLAVE1_1_CHARSET= DEFAULT CHARSET=utf8
USE_CHILD_GROUP2= 1
OUTPUT_CHILD_GROUP2= 0
CHILD2_1_MYPORT= @mysqld.2.1.port
CHILD2_1_HSRPORT= 20002
CHILD2_1_HSWPORT= 20003
CHILD2_1_MYSOCK= @mysqld.2.1.socket
CHILD2_1_ENGINE_TYPE= InnoDB
CHILD2_1_ENGINE= ENGINE=InnoDB
CHILD2_1_CHARSET= DEFAULT CHARSET=utf8
CHILD2_1_CHARSET2= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
CHILD2_2_MYPORT= @mysqld.2.2.port
CHILD2_2_HSRPORT= 20004
CHILD2_2_HSWPORT= 20005
CHILD2_2_MYSOCK= @mysqld.2.2.socket
CHILD2_2_ENGINE_TYPE= InnoDB
CHILD2_2_ENGINE= ENGINE=InnoDB
CHILD2_2_CHARSET= DEFAULT CHARSET=utf8
CHILD2_3_MYPORT= @mysqld.2.3.port
CHILD2_3_MYSOCK= @mysqld.2.3.socket
CHILD2_3_ENGINE_TYPE= InnoDB
CHILD2_3_ENGINE= ENGINE=InnoDB
CHILD2_3_CHARSET= DEFAULT CHARSET=utf8
CHILD2_1_FT_MYPORT= @mysqld.2.1.port
CHILD2_1_FT_MYSOCK= @mysqld.2.1.socket
CHILD2_1_FT_ENGINE_TYPE= MyISAM
CHILD2_1_FT_ENGINE= ENGINE=MyISAM
CHILD2_1_FT_CHARSET= DEFAULT CHARSET=utf8
CHILD2_2_FT_MYPORT= @mysqld.2.2.port
CHILD2_2_FT_MYSOCK= @mysqld.2.2.socket
CHILD2_2_FT_ENGINE_TYPE= MyISAM
CHILD2_2_FT_ENGINE= ENGINE=MyISAM
CHILD2_2_FT_CHARSET= DEFAULT CHARSET=utf8
CHILD2_1_GM_MYPORT= @mysqld.2.1.port
CHILD2_1_GM_MYSOCK= @mysqld.2.1.socket
CHILD2_1_GM_ENGINE_TYPE= MyISAM
CHILD2_1_GM_ENGINE= ENGINE=MyISAM
CHILD2_1_GM_CHARSET= DEFAULT CHARSET=utf8
CHILD2_2_GM_MYPORT= @mysqld.2.2.port
CHILD2_2_GM_MYSOCK= @mysqld.2.2.socket
CHILD2_2_GM_ENGINE_TYPE= MyISAM
CHILD2_2_GM_ENGINE= ENGINE=MyISAM
CHILD2_2_GM_CHARSET= DEFAULT CHARSET=utf8
USE_CHILD_GROUP3= 1
OUTPUT_CHILD_GROUP3= 0
CHILD3_1_MYPORT= @mysqld.3.1.port
CHILD3_1_MYSOCK= @mysqld.3.1.socket
CHILD3_1_ENGINE_TYPE= InnoDB
CHILD3_1_ENGINE= ENGINE=InnoDB
CHILD3_1_CHARSET= DEFAULT CHARSET=utf8
CHILD3_2_MYPORT= @mysqld.3.2.port
CHILD3_2_MYSOCK= @mysqld.3.2.socket
CHILD3_2_ENGINE_TYPE= InnoDB
CHILD3_2_ENGINE= ENGINE=InnoDB
CHILD3_2_CHARSET= DEFAULT CHARSET=utf8
CHILD3_3_MYPORT= @mysqld.3.3.port
CHILD3_3_MYSOCK= @mysqld.3.3.socket
CHILD3_3_ENGINE_TYPE= InnoDB
CHILD3_3_ENGINE= ENGINE=InnoDB
CHILD3_3_CHARSET= DEFAULT CHARSET=utf8
STR_SEMICOLON= ;
#The followings are set in include/init_xxx.inc files
# MASTER_1_COMMENT_2_1
# MASTER_1_COMMENT2_2_1
# MASTER_1_COMMENT3_2_1
# MASTER_1_COMMENT4_2_1
# MASTER_1_COMMENT5_2_1
# MASTER_1_COMMENT_P_2_1
# CHILD2_1_DROP_TABLES
# CHILD2_1_CREATE_TABLES
# CHILD2_1_SELECT_TABLES
# CHILD2_1_DROP_TABLES2
# CHILD2_1_CREATE_TABLES2
# CHILD2_1_SELECT_TABLES2
# CHILD2_1_DROP_TABLES3
# CHILD2_1_CREATE_TABLES3
# CHILD2_1_SELECT_TABLES3
# CHILD2_1_DROP_TABLES4
# CHILD2_1_CREATE_TABLES4
# CHILD2_1_SELECT_TABLES4
# CHILD2_1_DROP_TABLES5
# CHILD2_1_CREATE_TABLES5
# CHILD2_1_SELECT_TABLES5
# CHILD2_1_DROP_TABLES6
# CHILD2_1_CREATE_TABLES6
# CHILD2_1_SELECT_TABLES6
# CHILD2_2_DROP_TABLES
# CHILD2_2_CREATE_TABLES
# CHILD2_2_SELECT_TABLES
[mysqld.1.1]
log-bin= master-bin
loose_handlersocket_port= 20000
loose_handlersocket_port_wr= 20001
loose_handlersocket_threads= 2
loose_handlersocket_threads_wr= 1
loose_handlersocket_support_merge_table= 0
loose_handlersocket_direct_update_mode= 2
loose_handlersocket_unlimited_boundary= 65536
loose_handlersocket_bulk_insert= 0
loose_handlersocket_bulk_insert_timeout= 0
loose_handlersocket_general_log= 1
loose_handlersocket_timeout= 30
loose_handlersocket_close_table_interval=2
open_files_limit= 4096
loose_partition= 1
[ENV]
USE_GEOMETRY_TEST= 1
USE_FULLTEXT_TEST= 1
USE_HA_TEST= 1
USE_GENERAL_LOG= 1
USE_REPLICATION= 1
MASTER_1_MYPORT= @mysqld.1.1.port
MASTER_1_HSRPORT= 20000
MASTER_1_HSWPORT= 20001
MASTER_1_MYSOCK= @mysqld.1.1.socket
MASTER_1_ENGINE_TYPE= Spider
#MASTER_1_ENGINE_TYPE= MyISAM
MASTER_1_ENGINE= ENGINE=Spider
MASTER_1_CHARSET= DEFAULT CHARSET=utf8
MASTER_1_ENGINE2= ENGINE=MyISAM
MASTER_1_CHARSET2= DEFAULT CHARSET=utf8
MASTER_1_CHARSET3= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
STR_SEMICOLON= ;
#The followings are set in include/init_xxx.inc files
# MASTER_1_COMMENT_2_1
# MASTER_1_COMMENT2_2_1
# MASTER_1_COMMENT3_2_1
# MASTER_1_COMMENT4_2_1
# MASTER_1_COMMENT5_2_1
# MASTER_1_COMMENT_P_2_1
[mysqld.2.1]
loose_handlersocket_port= 20002
loose_handlersocket_port_wr= 20003
loose_handlersocket_threads= 2
loose_handlersocket_threads_wr= 1
loose_handlersocket_support_merge_table= 0
loose_handlersocket_direct_update_mode= 2
loose_handlersocket_unlimited_boundary= 65536
loose_handlersocket_bulk_insert= 0
loose_handlersocket_bulk_insert_timeout= 0
loose_handlersocket_general_log= 1
loose_handlersocket_timeout= 30
loose_handlersocket_close_table_interval=2
open_files_limit= 4096
[ENV]
USE_CHILD_GROUP2= 1
OUTPUT_CHILD_GROUP2= 0
CHILD2_1_MYPORT= @mysqld.2.1.port
CHILD2_1_HSRPORT= 20002
CHILD2_1_HSWPORT= 20003
CHILD2_1_MYSOCK= @mysqld.2.1.socket
CHILD2_1_ENGINE_TYPE= InnoDB
CHILD2_1_ENGINE= ENGINE=InnoDB
CHILD2_1_CHARSET= DEFAULT CHARSET=utf8
CHILD2_1_CHARSET2= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
CHILD2_1_FT_MYPORT= @mysqld.2.1.port
CHILD2_1_FT_MYSOCK= @mysqld.2.1.socket
CHILD2_1_FT_ENGINE_TYPE= MyISAM
CHILD2_1_FT_ENGINE= ENGINE=MyISAM
CHILD2_1_FT_CHARSET= DEFAULT CHARSET=utf8
CHILD2_1_GM_MYPORT= @mysqld.2.1.port
CHILD2_1_GM_MYSOCK= @mysqld.2.1.socket
CHILD2_1_GM_ENGINE_TYPE= MyISAM
CHILD2_1_GM_ENGINE= ENGINE=MyISAM
CHILD2_1_GM_CHARSET= DEFAULT CHARSET=utf8
#The followings are set in include/init_xxx.inc files
# CHILD2_1_DROP_TABLES
# CHILD2_1_CREATE_TABLES
# CHILD2_1_SELECT_TABLES
# CHILD2_1_DROP_TABLES2
# CHILD2_1_CREATE_TABLES2
# CHILD2_1_SELECT_TABLES2
# CHILD2_1_DROP_TABLES3
# CHILD2_1_CREATE_TABLES3
# CHILD2_1_SELECT_TABLES3
# CHILD2_1_DROP_TABLES4
# CHILD2_1_CREATE_TABLES4
# CHILD2_1_SELECT_TABLES4
# CHILD2_1_DROP_TABLES5
# CHILD2_1_CREATE_TABLES5
# CHILD2_1_SELECT_TABLES5
# CHILD2_1_DROP_TABLES6
# CHILD2_1_CREATE_TABLES6
# CHILD2_1_SELECT_TABLES6
[mysqld.2.2]
loose_handlersocket_port= 20004
loose_handlersocket_port_wr= 20005
loose_handlersocket_threads= 2
loose_handlersocket_threads_wr= 1
loose_handlersocket_support_merge_table= 0
loose_handlersocket_direct_update_mode= 2
loose_handlersocket_unlimited_boundary= 65536
loose_handlersocket_bulk_insert= 0
loose_handlersocket_bulk_insert_timeout= 0
loose_handlersocket_general_log= 1
loose_handlersocket_timeout= 30
loose_handlersocket_close_table_interval=2
open_files_limit= 4096
[ENV]
CHILD2_2_MYPORT= @mysqld.2.2.port
CHILD2_2_HSRPORT= 20004
CHILD2_2_HSWPORT= 20005
CHILD2_2_MYSOCK= @mysqld.2.2.socket
CHILD2_2_ENGINE_TYPE= InnoDB
CHILD2_2_ENGINE= ENGINE=InnoDB
CHILD2_2_CHARSET= DEFAULT CHARSET=utf8
CHILD2_2_FT_MYPORT= @mysqld.2.2.port
CHILD2_2_FT_MYSOCK= @mysqld.2.2.socket
CHILD2_2_FT_ENGINE_TYPE= MyISAM
CHILD2_2_FT_ENGINE= ENGINE=MyISAM
CHILD2_2_FT_CHARSET= DEFAULT CHARSET=utf8
CHILD2_2_GM_MYPORT= @mysqld.2.2.port
CHILD2_2_GM_MYSOCK= @mysqld.2.2.socket
CHILD2_2_GM_ENGINE_TYPE= MyISAM
CHILD2_2_GM_ENGINE= ENGINE=MyISAM
CHILD2_2_GM_CHARSET= DEFAULT CHARSET=utf8
#The followings are set in include/init_xxx.inc files
# CHILD2_2_DROP_TABLES
# CHILD2_2_CREATE_TABLES
# CHILD2_2_SELECT_TABLES
[mysqld.2.3]
loose_partition= 1
[ENV]
CHILD2_3_MYPORT= @mysqld.2.3.port
CHILD2_3_MYSOCK= @mysqld.2.3.socket
CHILD2_3_ENGINE_TYPE= InnoDB
CHILD2_3_ENGINE= ENGINE=InnoDB
CHILD2_3_CHARSET= DEFAULT CHARSET=utf8
[mysqld.3.1]
loose_partition= 1
[ENV]
USE_CHILD_GROUP3= 1
OUTPUT_CHILD_GROUP3= 0
CHILD3_1_MYPORT= @mysqld.3.1.port
CHILD3_1_MYSOCK= @mysqld.3.1.socket
CHILD3_1_ENGINE_TYPE= InnoDB
CHILD3_1_ENGINE= ENGINE=InnoDB
CHILD3_1_CHARSET= DEFAULT CHARSET=utf8
[mysqld.3.2]
loose_partition= 1
[ENV]
CHILD3_2_MYPORT= @mysqld.3.2.port
CHILD3_2_MYSOCK= @mysqld.3.2.socket
CHILD3_2_ENGINE_TYPE= InnoDB
CHILD3_2_ENGINE= ENGINE=InnoDB
CHILD3_2_CHARSET= DEFAULT CHARSET=utf8
[mysqld.3.3]
loose_partition= 1
[ENV]
CHILD3_3_MYPORT= @mysqld.3.3.port
CHILD3_3_MYSOCK= @mysqld.3.3.socket
CHILD3_3_ENGINE_TYPE= InnoDB
CHILD3_3_ENGINE= ENGINE=InnoDB
CHILD3_3_CHARSET= DEFAULT CHARSET=utf8
[mysqld.4.1]
loose_partition= 1
[ENV]
SLAVE1_1_MYPORT= @mysqld.4.1.port
SLAVE1_1_MYSOCK= @mysqld.4.1.socket
SLAVE1_1_ENGINE_TYPE= MyISAM
SLAVE1_1_ENGINE= ENGINE=MyISAM
SLAVE1_1_CHARSET= DEFAULT CHARSET=utf8
...@@ -52,7 +52,7 @@ int spider_udf_set_copy_tables_param_default( ...@@ -52,7 +52,7 @@ int spider_udf_set_copy_tables_param_default(
copy_tables->database_length = SPIDER_THD_db_length(copy_tables->trx->thd); copy_tables->database_length = SPIDER_THD_db_length(copy_tables->trx->thd);
if ( if (
!(copy_tables->database = spider_create_string( !(copy_tables->database = spider_create_string(
SPIDER_THD_db_str(copy_tables->trx->thd), copy_tables->trx->thd->get_db(),
copy_tables->database_length)) copy_tables->database_length))
) { ) {
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM); my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
......
...@@ -1194,7 +1194,7 @@ int spider_udf_set_direct_sql_param_default( ...@@ -1194,7 +1194,7 @@ int spider_udf_set_direct_sql_param_default(
direct_sql->tgt_default_db_name_length = SPIDER_THD_db_length(trx->thd); direct_sql->tgt_default_db_name_length = SPIDER_THD_db_length(trx->thd);
if ( if (
!(direct_sql->tgt_default_db_name = spider_create_string( !(direct_sql->tgt_default_db_name = spider_create_string(
SPIDER_THD_db_str(trx->thd), trx->thd->get_db(),
direct_sql->tgt_default_db_name_length)) direct_sql->tgt_default_db_name_length))
) { ) {
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM); my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
......
...@@ -21873,6 +21873,103 @@ static void test_mdev19838() ...@@ -21873,6 +21873,103 @@ static void test_mdev19838()
rc = mysql_query(mysql, "drop table mdev19838"); rc = mysql_query(mysql, "drop table mdev19838");
myquery(rc); myquery(rc);
} }
static void test_mdev_24411()
{
int rc;
MYSQL_STMT *stmt;
MYSQL_BIND bind;
MYSQL_RES *result;
MYSQL_ROW row;
my_ulonglong row_count;
unsigned int vals[] = { 1, 2, 3};
unsigned int vals_array_len = 3;
const char *insert_stmt= "INSERT INTO t1 VALUES (?)";
myheader("test_mdev_24411");
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
myquery(rc);
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t2");
myquery(rc);
rc= mysql_query(mysql, "CREATE TABLE t1 (a INT)");
myquery(rc);
rc= mysql_query(mysql, "CREATE TABLE t2 (a INT)");
myquery(rc);
rc= mysql_query(mysql,
"CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW "
"BEGIN INSERT INTO t2 (a) VALUES (NEW.a); END;");
myquery(rc);
stmt= mysql_stmt_init(mysql);
check_stmt(stmt);
rc= mysql_stmt_prepare(stmt, insert_stmt, strlen(insert_stmt));
check_execute(stmt, rc);
memset(&bind, 0, sizeof(bind));
bind.buffer_type= MYSQL_TYPE_LONG;
bind.buffer= vals;
rc= mysql_stmt_attr_set(stmt, STMT_ATTR_ARRAY_SIZE, &vals_array_len);
check_execute(stmt, rc);
rc= mysql_stmt_bind_param(stmt, &bind);
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
/*
It's expected that the INSERT statement adds three rows into
the table t1
*/
row_count = mysql_stmt_affected_rows(stmt);
DIE_UNLESS(row_count == 3);
/*
* Check that the BEFORE INSERT trigger of the table t1 does work correct
* and inserted the rows (1), (2), (3) into the table t2.
*/
rc= mysql_query(mysql, "SELECT 't1' tname, a FROM t1 "
"UNION SELECT 't2' tname, a FROM t2 ORDER BY tname,a");
myquery(rc);
result= mysql_store_result(mysql);
row = mysql_fetch_row(result);
DIE_UNLESS(strcmp(row[0], "t1") == 0 && atoi(row[1]) == 1);
row = mysql_fetch_row(result);
DIE_UNLESS(strcmp(row[0], "t1") == 0 && atoi(row[1]) == 2);
row = mysql_fetch_row(result);
DIE_UNLESS(strcmp(row[0], "t1") == 0 && atoi(row[1]) == 3);
row = mysql_fetch_row(result);
DIE_UNLESS(strcmp(row[0], "t2") == 0 && atoi(row[1]) == 1);
row = mysql_fetch_row(result);
DIE_UNLESS(strcmp(row[0], "t2") == 0 && atoi(row[1]) == 2);
row = mysql_fetch_row(result);
DIE_UNLESS(strcmp(row[0], "t2") == 0 && atoi(row[1]) == 3);
row= mysql_fetch_row(result);
DIE_UNLESS(row == NULL);
mysql_free_result(result);
mysql_stmt_close(stmt);
rc= mysql_query(mysql, "DROP TABLE t1, t2");
myquery(rc);
}
#endif // EMBEDDED_LIBRARY #endif // EMBEDDED_LIBRARY
...@@ -22442,6 +22539,9 @@ static struct my_tests_st my_tests[]= { ...@@ -22442,6 +22539,9 @@ static struct my_tests_st my_tests[]= {
{ "test_connect_autocommit", test_connect_autocommit}, { "test_connect_autocommit", test_connect_autocommit},
{ "test_execute_direct", test_execute_direct }, { "test_execute_direct", test_execute_direct },
{ "test_cache_metadata", test_cache_metadata}, { "test_cache_metadata", test_cache_metadata},
#ifndef EMBEDDED_LIBRARY
{ "test_mdev_24411", test_mdev_24411},
#endif
{ 0, 0 } { 0, 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