Commit 66774f41 authored by Konstantin Osipov's avatar Konstantin Osipov

Merge with next-mr-runtime

parents 88f7de57 eed8c7ab
......@@ -98,7 +98,8 @@ test-pr:
test-ns:
cd mysql-test ; \
@PERL@ ./mysql-test-run.pl $(force) $(mem) --mysqld=--binlog-format=mixed
@PERL@ ./mysql-test-run.pl $(force) $(mem) --mysqld=--binlog-format=mixed ; \
@PERL@ ./mysql-test-run.pl $(force) $(mem) --suite=funcs_1
test-binlog-statement:
cd mysql-test ; \
......
......@@ -1922,3 +1922,37 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
# -- End of Bug#45829
End of 5.1 tests
# --
# -- Bug #43054 Assertion `!table->auto_increment_field_not_null'
# -- failed when redefining trigger
CREATE TABLE B (
pk INTEGER AUTO_INCREMENT,
int_key INTEGER NOT NULL,
PRIMARY KEY (pk),
KEY (int_key)
);
INSERT IGNORE INTO B VALUES ('9', '9');
CREATE TABLE IF NOT EXISTS t1 (
`pk` INTEGER NOT NULL AUTO_INCREMENT ,
`int` INTEGER ,
PRIMARY KEY ( `pk` )
) SELECT `pk` , `int_key` FROM B ;
CREATE TRIGGER f BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
INSERT INTO t1 ( `int` ) VALUES (4 ),( 8 ),( 2 ) ;
END ; |
CREATE TABLE IF NOT EXISTS t1 (
`pk` INTEGER NOT NULL AUTO_INCREMENT ,
`int` INTEGER ,
PRIMARY KEY ( `pk` )
) SELECT `pk` , `int_key` FROM B ;
ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
CREATE TRIGGER f BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
UPDATE A SET `pk`=1 WHERE `pk`=0 ;
END ;|
ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table'
DROP TABLE t1;
DROP TABLE B;
......@@ -309,6 +309,30 @@ SET @@global.general_log_file = @old_general_log_file;
SET @@global.slow_query_log = @old_slow_query_log;
SET @@global.slow_query_log_file = @old_slow_query_log_file;
End of 5.1 tests
# --
# -- Bug#38124: "general_log_file" variable silently unset when
# -- using expression
# --
SET GLOBAL general_log_file = DEFAULT;
SELECT @@general_log_file INTO @my_glf;
SET GLOBAL general_log_file = 'BUG38124.LOG';
SELECT @@general_log_file;
@@general_log_file
BUG38124.LOG
SET GLOBAL general_log_file = concat('BUG38124-2.LOG');
SELECT @@general_log_file;
@@general_log_file
BUG38124-2.LOG
SET GLOBAL general_log_file = substr('BUG38124-2.LOG',3,6);
SELECT @@general_log_file;
@@general_log_file
G38124
SET GLOBAL general_log_file = DEFAULT;
SELECT @@general_log_file = @my_glf;
@@general_log_file = @my_glf
1
SET GLOBAL general_log_file = @old_general_log_file;
# Close connection con1
SET global general_log = @old_general_log;
SET global general_log_file = @old_general_log_file;
......
......@@ -1582,3 +1582,56 @@ create table t3 (a int) row_format=page;
--echo
--echo End of 5.1 tests
###########################################################################
--echo
--echo # --
--echo # -- Bug #43054 Assertion `!table->auto_increment_field_not_null'
--echo # -- failed when redefining trigger
--echo
#--disable_abort_on_error
CREATE TABLE B (
pk INTEGER AUTO_INCREMENT,
int_key INTEGER NOT NULL,
PRIMARY KEY (pk),
KEY (int_key)
);
INSERT IGNORE INTO B VALUES ('9', '9');
CREATE TABLE IF NOT EXISTS t1 (
`pk` INTEGER NOT NULL AUTO_INCREMENT ,
`int` INTEGER ,
PRIMARY KEY ( `pk` )
) SELECT `pk` , `int_key` FROM B ;
--delimiter |
CREATE TRIGGER f BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
INSERT INTO t1 ( `int` ) VALUES (4 ),( 8 ),( 2 ) ;
END ; |
--delimiter ;
--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
CREATE TABLE IF NOT EXISTS t1 (
`pk` INTEGER NOT NULL AUTO_INCREMENT ,
`int` INTEGER ,
PRIMARY KEY ( `pk` )
) SELECT `pk` , `int_key` FROM B ;
--delimiter |
--error ER_NOT_SUPPORTED_YET
CREATE TRIGGER f BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
UPDATE A SET `pk`=1 WHERE `pk`=0 ;
END ;|
--delimiter ;
DROP TABLE t1;
DROP TABLE B;
### t/log_state.test ###
#
# This test suffers from server
# Bug#38124 "general_log_file" variable silently unset when using expression
# In short:
# SET GLOBAL general_log_file = @<whatever>
# SET GLOBAL slow_query_log = @<whatever>
# cause that the value of these server system variables is set to default
# instead of the assigned values. There comes no error message or warning.
# If this bug is fixed please
# 1. try this test with "let $fixed_bug38124 = 0;"
# 2. remove all workarounds if 1. was successful.
let $fixed_bug38124 = 0;
--source include/not_embedded.inc
--source include/have_csv.inc
......@@ -166,16 +155,6 @@ SET @@global.general_log = @old_general_log;
SET @@global.general_log_file = @old_general_log_file;
SET @@global.slow_query_log = @old_slow_query_log;
SET @@global.slow_query_log_file = @old_slow_query_log_file;
if(!$fixed_bug38124)
{
--disable_query_log
let $my_var = `SELECT @old_general_log_file`;
eval SET @@global.general_log_file = '$my_var';
let $my_var = `SELECT @old_slow_query_log_file`;
eval SET @@global.slow_query_log_file = '$my_var';
--enable_query_log
}
###########################################################################
......@@ -278,15 +257,6 @@ SET GLOBAL slow_query_log_file= NULL;
# Reset to initial values in case a setting above was successful.
SET GLOBAL general_log_file= @old_general_log_file;
SET GLOBAL slow_query_log_file= @old_slow_query_log_file;
if(!$fixed_bug38124)
{
--disable_query_log
let $my_var = `SELECT @old_general_log_file`;
eval SET @@global.general_log_file = '$my_var';
let $my_var = `SELECT @old_slow_query_log_file`;
eval SET @@global.slow_query_log_file = '$my_var';
--enable_query_log
}
###########################################################################
......@@ -307,15 +277,6 @@ SHOW VARIABLES LIKE '%log_file';
--echo
SET GLOBAL general_log_file = @old_general_log_file;
SET GLOBAL slow_query_log_file = @old_slow_query_log_file;
if(!$fixed_bug38124)
{
--disable_query_log
let $my_var = `SELECT @old_general_log_file`;
eval SET @@global.general_log_file = '$my_var';
let $my_var = `SELECT @old_slow_query_log_file`;
eval SET @@global.slow_query_log_file = '$my_var';
--enable_query_log
}
--echo
--echo # -- End of Bug#32748.
......@@ -351,19 +312,43 @@ SET @@global.general_log = @old_general_log;
SET @@global.general_log_file = @old_general_log_file;
SET @@global.slow_query_log = @old_slow_query_log;
SET @@global.slow_query_log_file = @old_slow_query_log_file;
if(!$fixed_bug38124)
{
--disable_query_log
let $my_var = `SELECT @old_general_log_file`;
eval SET @@global.general_log_file = '$my_var';
let $my_var = `SELECT @old_slow_query_log_file`;
eval SET @@global.slow_query_log_file = '$my_var';
--enable_query_log
}
--echo End of 5.1 tests
###########################################################################
--echo
--echo # --
--echo # -- Bug#38124: "general_log_file" variable silently unset when
--echo # -- using expression
--echo # --
# Store away the special DEFAULT value so we
# can compare it later, then try to set the
# general_log_file using different functions
# and expressions.
SET GLOBAL general_log_file = DEFAULT;
SELECT @@general_log_file INTO @my_glf;
SET GLOBAL general_log_file = 'BUG38124.LOG';
SELECT @@general_log_file;
SET GLOBAL general_log_file = concat('BUG38124-2.LOG');
SELECT @@general_log_file;
SET GLOBAL general_log_file = substr('BUG38124-2.LOG',3,6);
SELECT @@general_log_file;
SET GLOBAL general_log_file = DEFAULT;
SELECT @@general_log_file = @my_glf;
## Reset to initial values
SET GLOBAL general_log_file = @old_general_log_file;
--enable_ps_protocol
#
......@@ -380,15 +365,6 @@ SET global general_log = @old_general_log;
SET global general_log_file = @old_general_log_file;
SET global slow_query_log = @old_slow_query_log;
SET global slow_query_log_file = @old_slow_query_log_file;
if(!$fixed_bug38124)
{
--disable_query_log
let $my_var = `SELECT @old_general_log_file`;
eval SET @@global.general_log_file = '$my_var';
let $my_var = `SELECT @old_slow_query_log_file`;
eval SET @@global.slow_query_log_file = '$my_var';
--enable_query_log
}
# Remove the log file that was created in the "default location"
# i.e var/run
......
......@@ -2452,6 +2452,21 @@ bool ha_partition::get_from_handler_file(const char *name, MEM_ROOT *mem_root)
/****************************************************************************
MODULE open/close object
****************************************************************************/
/**
A destructor for partition-specific TABLE_SHARE data.
*/
void ha_data_partition_destroy(void *ha_data)
{
if (ha_data)
{
HA_DATA_PARTITION *ha_data_partition= (HA_DATA_PARTITION*) ha_data;
pthread_mutex_destroy(&ha_data_partition->mutex);
}
}
/*
Open handler object
......@@ -2608,6 +2623,8 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked)
}
DBUG_PRINT("info", ("table_share->ha_data 0x%p", ha_data));
bzero(ha_data, sizeof(HA_DATA_PARTITION));
table_share->ha_data_destroy= ha_data_partition_destroy;
pthread_mutex_init(&ha_data->mutex, MY_MUTEX_INIT_FAST);
}
if (is_not_tmp_table)
pthread_mutex_unlock(&table_share->mutex);
......
......@@ -45,6 +45,7 @@ typedef struct st_ha_data_partition
{
ulonglong next_auto_inc_val; /**< first non reserved value */
bool auto_inc_initialized;
pthread_mutex_t mutex;
} HA_DATA_PARTITION;
#define PARTITION_BYTES_IN_POS 2
......
......@@ -2535,9 +2535,20 @@ bool update_sys_var_str_path(THD *thd, sys_var_str *var_str,
{
MYSQL_QUERY_LOG *file_log;
char buff[FN_REFLEN];
char *res= 0, *old_value=(char *)(var ? var->value->str_value.ptr() : 0);
char *res= 0, *old_value= 0;
bool result= 0;
uint str_length= (var ? var->value->str_value.length() : 0);
uint str_length= 0;
if (var)
{
String str(buff, sizeof(buff), system_charset_info), *newval;
newval= var->value->val_str(&str);
old_value= newval->c_ptr_safe();
str_length= strlen(old_value);
}
switch (log_type) {
case QUERY_LOG_SLOW:
......
......@@ -3843,6 +3843,7 @@ void select_create::abort()
{
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
table->auto_increment_field_not_null= FALSE;
if (!create_info->table_existed)
drop_open_table(thd, table, create_table->db, create_table->table_name);
table=0; // Safety
......
......@@ -1601,6 +1601,8 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
delete crypted;
delete handler_file;
my_hash_free(&share->name_hash);
if (share->ha_data_destroy)
share->ha_data_destroy(share->ha_data);
open_table_error(share, error, share->open_errno, errarg);
DBUG_RETURN(error);
......
......@@ -419,6 +419,7 @@ struct TABLE_SHARE
/** place to store storage engine specific data */
void *ha_data;
void (*ha_data_destroy)(void *); /* An optional destructor for ha_data */
/*
......
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