1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge branch '10.2' into bb-10.2-mdev9543

- Make Window Functions errors use the MariaDB's extra error range.
- Fix a trivial bug in check_error_mesg
This commit is contained in:
Sergei Petrunia
2016-04-07 00:54:39 +03:00
1678 changed files with 42477 additions and 13481 deletions

View File

@ -127,7 +127,7 @@ static my_bool parsing_disabled= 0;
static my_bool display_result_vertically= FALSE, display_result_lower= FALSE,
display_metadata= FALSE, display_result_sorted= FALSE;
static my_bool disable_query_log= 0, disable_result_log= 0;
static my_bool disable_connect_log= 1;
static my_bool disable_connect_log= 0;
static my_bool disable_warnings= 0, disable_column_names= 0;
static my_bool prepare_warnings_enabled= 0;
static my_bool disable_info= 1;
@ -703,7 +703,7 @@ public:
DBUG_ASSERT(ds->str);
#ifdef EXTRA_DEBUG
DBUG_PRINT("QQ", ("str: %*s", (int) ds->length, ds->str));
DBUG_PRINT("extra", ("str: %*s", (int) ds->length, ds->str));
#endif
if (fwrite(ds->str, 1, ds->length, m_file) != ds->length)

View File

@ -32,9 +32,11 @@
#include <my_getopt.h>
#include <my_dir.h>
#define MAX_ROWS 2000
#define MAX_ROWS 3000
#define ERRORS_PER_RANGE 1000
#define MAX_SECTIONS 4
#define HEADER_LENGTH 32 /* Length of header in errmsg.sys */
#define ERRMSG_VERSION 3 /* Version number of errmsg.sys */
#define ERRMSG_VERSION 4 /* Version number of errmsg.sys */
#define DEFAULT_CHARSET_DIR "../sql/share/charsets"
#define ER_PREFIX "ER_"
#define ER_PREFIX2 "MARIA_ER_"
@ -53,6 +55,8 @@ static char *default_dbug_option= (char*) "d:t:O,/tmp/comp_err.trace";
uchar file_head[]= { 254, 254, 2, ERRMSG_VERSION };
/* Store positions to each error message row to store in errmsg.sys header */
uint file_pos[MAX_ROWS+1];
uint section_count,section_start;
uchar section_header[MAX_SECTIONS*2];
const char *empty_string= ""; /* For empty states */
/*
@ -131,7 +135,7 @@ static struct my_option my_long_options[]=
};
static struct errors *generate_empty_message(uint dcode);
static struct errors *generate_empty_message(uint dcode, my_bool skip);
static struct languages *parse_charset_string(char *str);
static struct errors *parse_error_string(char *ptr, int er_count);
static struct message *parse_message_string(struct message *new_message,
@ -140,8 +144,9 @@ static struct message *find_message(struct errors *err, const char *lang,
my_bool no_default);
static int check_message_format(struct errors *err,
const char* mess);
static int parse_input_file(const char *file_name, struct errors **top_error,
struct languages **top_language);
static uint parse_input_file(const char *file_name, struct errors **top_error,
struct languages **top_language,
uint *error_count);
static int get_options(int *argc, char ***argv);
static void print_version(void);
static void usage(void);
@ -158,14 +163,15 @@ static char *find_end_of_word(char *str);
static void clean_up(struct languages *lang_head, struct errors *error_head);
static int create_header_files(struct errors *error_head);
static int create_sys_files(struct languages *lang_head,
struct errors *error_head, uint row_count);
struct errors *error_head, uint max_error,
uint error_count);
int main(int argc, char *argv[])
{
MY_INIT(argv[0]);
{
uint row_count;
uint max_error, error_count;
struct errors *error_head;
struct languages *lang_head;
DBUG_ENTER("main");
@ -173,32 +179,39 @@ int main(int argc, char *argv[])
charsets_dir= DEFAULT_CHARSET_DIR;
my_umask_dir= 0777;
if (get_options(&argc, &argv))
DBUG_RETURN(1);
if (!(row_count= parse_input_file(TXTFILE, &error_head, &lang_head)))
goto err;
if (!(max_error= parse_input_file(TXTFILE, &error_head, &lang_head,
&error_count)))
{
fprintf(stderr, "Failed to parse input file %s\n", TXTFILE);
DBUG_RETURN(1);
goto err;
}
if (lang_head == NULL || error_head == NULL)
{
fprintf(stderr, "Failed to parse input file %s\n", TXTFILE);
DBUG_RETURN(1);
goto err;
}
if (create_header_files(error_head))
{
fprintf(stderr, "Failed to create header files\n");
DBUG_RETURN(1);
goto err;
}
if (create_sys_files(lang_head, error_head, row_count))
if (create_sys_files(lang_head, error_head, max_error, error_count))
{
fprintf(stderr, "Failed to create sys files\n");
DBUG_RETURN(1);
goto err;
}
clean_up(lang_head, error_head);
DBUG_LEAVE; /* Can't use dbug after my_end() */
my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
return 0;
err:
clean_up(lang_head, error_head);
DBUG_LEAVE; /* Can't use dbug after my_end() */
my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
exit(1);
}
}
@ -226,6 +239,7 @@ static void print_escaped_string(FILE *f, const char *str)
static int create_header_files(struct errors *error_head)
{
uint er_last= 0;
uint section= 1;
FILE *er_definef, *sql_statef, *er_namef;
struct errors *tmp_error;
struct message *er_msg;
@ -266,8 +280,19 @@ static int create_header_files(struct errors *error_head)
if (!tmp_error->er_name)
continue; /* Placeholder for gap */
if (tmp_error->d_code > current_d_code + 1)
while (tmp_error->d_code > current_d_code + 1)
{
uint next_range= (((current_d_code + ERRORS_PER_RANGE) /
ERRORS_PER_RANGE) * ERRORS_PER_RANGE);
fprintf(er_definef, "#define ER_ERROR_LAST_SECTION_%d %d\n", section,
current_d_code);
fprintf(er_definef, "\n/* New section */\n\n");
fprintf(er_definef, "#define ER_ERROR_FIRST_SECTION_%d %d\n", section+1,
MY_MIN(tmp_error->d_code, next_range));
section++;
current_d_code= MY_MIN(tmp_error->d_code, next_range);
}
current_d_code= tmp_error->d_code;
fprintf(er_definef, "#define %s %u\n", tmp_error->er_name,
@ -297,17 +322,18 @@ static int create_header_files(struct errors *error_head)
static int create_sys_files(struct languages *lang_head,
struct errors *error_head, uint row_count)
struct errors *error_head,
uint max_error,
uint error_count)
{
FILE *to;
uint csnum= 0, length, i, row_nr;
uchar head[32];
uchar head[HEADER_LENGTH];
char outfile[FN_REFLEN], *outfile_end;
long start_pos;
struct message *tmp;
struct languages *tmp_lang;
struct errors *tmp_error;
MY_STAT stat_info;
DBUG_ENTER("create_sys_files");
@ -331,7 +357,7 @@ static int create_sys_files(struct languages *lang_head,
{
if (my_mkdir(outfile, 0777,MYF(0)) < 0)
{
fprintf(stderr, "Can't create output directory for %s\n",
fprintf(stderr, "Can't creqate output directory for %s\n",
outfile);
DBUG_RETURN(1);
}
@ -343,8 +369,8 @@ static int create_sys_files(struct languages *lang_head,
DBUG_RETURN(1);
/* 2 is for 2 bytes to store row position / error message */
start_pos= (long) (HEADER_LENGTH + row_count * 2);
fseek(to, start_pos, 0);
start_pos= (long) (HEADER_LENGTH + (error_count + section_count) * 2);
my_fseek(to, start_pos, 0, MYF(0));
row_nr= 0;
for (tmp_error= error_head; tmp_error; tmp_error= tmp_error->next_error)
{
@ -358,6 +384,8 @@ static int create_sys_files(struct languages *lang_head,
"language\n", tmp_error->er_name, tmp_lang->lang_short_name);
goto err;
}
if (tmp->text) /* If not skipped row */
{
if (copy_rows(to, tmp->text, row_nr, start_pos))
{
fprintf(stderr, "Failed to copy rows to %s\n", outfile);
@ -365,22 +393,29 @@ static int create_sys_files(struct languages *lang_head,
}
row_nr++;
}
}
DBUG_ASSERT(error_count == row_nr);
/* continue with header of the errmsg.sys file */
length= ftell(to) - HEADER_LENGTH - row_count * 2;
length= (my_ftell(to, MYF(0)) - HEADER_LENGTH -
(error_count + section_count) * 2);
bzero((uchar*) head, HEADER_LENGTH);
bmove((uchar *) head, (uchar *) file_head, 4);
bmove((uchar*) head, (uchar*) file_head, 4);
head[4]= 1;
int4store(head + 6, length);
int2store(head + 10, row_count);
int2store(head + 10, max_error); /* Max error */
int2store(head + 12, row_nr);
int2store(head + 14, section_count);
head[30]= csnum;
my_fseek(to, 0l, MY_SEEK_SET, MYF(0));
if (my_fwrite(to, (uchar*) head, HEADER_LENGTH, MYF(MY_WME | MY_FNABP)))
if (my_fwrite(to, (uchar*) head, HEADER_LENGTH, MYF(MY_WME | MY_FNABP)) ||
my_fwrite(to, (uchar*) section_header, section_count*2,
MYF(MY_WME | MY_FNABP)))
goto err;
file_pos[row_count]= (ftell(to) - start_pos);
for (i= 0; i < row_count; i++)
file_pos[row_nr]= (ftell(to) - start_pos);
for (i= 0; i < row_nr; i++)
{
/* Store length of each string */
int2store(head, file_pos[i+1] - file_pos[i]);
@ -437,24 +472,29 @@ static void clean_up(struct languages *lang_head, struct errors *error_head)
}
static int parse_input_file(const char *file_name, struct errors **top_error,
struct languages **top_lang)
static uint parse_input_file(const char *file_name, struct errors **top_error,
struct languages **top_lang, uint *error_count)
{
FILE *file;
char *str, buff[1000];
struct errors *current_error= 0, **tail_error= top_error;
struct message current_message;
uint rcount= 0;
uint rcount= 0, skiped_errors= 0;
my_bool er_offset_found= 0;
DBUG_ENTER("parse_input_file");
*top_error= 0;
*top_lang= 0;
*error_count= 0;
section_start= er_offset;
section_count= 0;
if (!(file= my_fopen(file_name, O_RDONLY | O_SHARE, MYF(MY_WME))))
DBUG_RETURN(0);
while ((str= fgets(buff, sizeof(buff), file)))
{
my_bool skip;
if (is_prefix(str, "language"))
{
if (!(*top_lang= parse_charset_string(str)))
@ -464,18 +504,34 @@ static int parse_input_file(const char *file_name, struct errors **top_error,
}
continue;
}
if (is_prefix(str, "start-error-number"))
skip= 0;
if (is_prefix(str, "start-error-number") ||
(skip= is_prefix(str, "skip-to-error-number")))
{
uint tmp_er_offset;
if (!(tmp_er_offset= parse_error_offset(str)))
{
fprintf(stderr, "Failed to parse the error offset string!\n");
DBUG_RETURN(0);
}
if (skip)
{
if (section_count >= MAX_SECTIONS-1)
{
fprintf(stderr, "Found too many skip-to-error-number entries. "
"We only support %d entries\n", MAX_SECTIONS);
DBUG_RETURN(0);
}
int2store(section_header + section_count*2,
er_offset +rcount - section_start);
section_count++;
section_start= tmp_er_offset;
}
if (!er_offset_found)
{
er_offset_found= 1;
er_offset= tmp_er_offset;
er_offset= section_start= tmp_er_offset;
}
else
{
@ -487,7 +543,8 @@ static int parse_input_file(const char *file_name, struct errors **top_error,
}
for ( ; er_offset + rcount < tmp_er_offset ; rcount++)
{
current_error= generate_empty_message(er_offset + rcount);
skiped_errors+= skip != 0;
current_error= generate_empty_message(er_offset + rcount, skip);
*tail_error= current_error;
tail_error= &current_error->next_error;
}
@ -559,6 +616,11 @@ static int parse_input_file(const char *file_name, struct errors **top_error,
fprintf(stderr, "Wrong input file format. Stop!\nLine: %s\n", str);
DBUG_RETURN(0);
}
int2store(section_header + section_count*2,
er_offset + rcount - section_start);
section_count++;
*error_count= rcount - skiped_errors;
*tail_error= 0; /* Mark end of list */
my_fclose(file, MYF(0));
@ -887,7 +949,7 @@ static struct message *parse_message_string(struct message *new_message,
}
static struct errors *generate_empty_message(uint d_code)
static struct errors *generate_empty_message(uint d_code, my_bool skip)
{
struct errors *new_error;
struct message message;
@ -896,7 +958,8 @@ static struct errors *generate_empty_message(uint d_code)
if (!(new_error= (struct errors *) my_malloc(sizeof(*new_error),
MYF(MY_WME))))
return(0);
if (my_init_dynamic_array(&new_error->msg, sizeof(struct message), 0, 1, MYF(0)))
if (my_init_dynamic_array(&new_error->msg, sizeof(struct message), 0, 1,
MYF(0)))
return(0); /* OOM: Fatal error */
new_error->er_name= NULL;
@ -904,8 +967,10 @@ static struct errors *generate_empty_message(uint d_code)
new_error->sql_code1= empty_string;
new_error->sql_code2= empty_string;
message.text= 0; /* If skip set, don't generate a text */
if (!(message.lang_short_name= my_strdup(default_language, MYF(MY_WME))) ||
!(message.text= my_strdup("", MYF(MY_WME))))
(!skip && !(message.text= my_strdup("", MYF(MY_WME)))))
return(0);
/* Can't fail as msg is preallocated */
@ -1071,10 +1136,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__ ((unused)),
switch (optid) {
case 'V':
print_version();
my_end(0);
exit(0);
break;
case '?':
usage();
my_end(0);
exit(0);
break;
case '#':

View File

@ -180,6 +180,10 @@ extern MY_UNI_CTYPE my_uni_ctype[256];
/* A helper macros for "need at least n bytes" */
#define MY_CS_TOOSMALLN(n) (-100-(n))
#define MY_CS_MBMAXLEN 6 /* Maximum supported mbmaxlen */
#define MY_CS_IS_TOOSMALL(rc) ((rc) >= MY_CS_TOOSMALL6 && (rc) <= MY_CS_TOOSMALL)
#define MY_SEQ_INTTAIL 1
#define MY_SEQ_SPACES 2
@ -325,8 +329,7 @@ struct my_collation_handler_st
int (*strnncoll)(CHARSET_INFO *,
const uchar *, size_t, const uchar *, size_t, my_bool);
int (*strnncollsp)(CHARSET_INFO *,
const uchar *, size_t, const uchar *, size_t,
my_bool diff_if_only_endspace_difference);
const uchar *, size_t, const uchar *, size_t);
size_t (*strnxfrm)(CHARSET_INFO *,
uchar *dst, size_t dstlen, uint nweights,
const uchar *src, size_t srclen, uint flags);
@ -644,8 +647,7 @@ extern int my_strnncoll_simple(CHARSET_INFO *, const uchar *, size_t,
const uchar *, size_t, my_bool);
extern int my_strnncollsp_simple(CHARSET_INFO *, const uchar *, size_t,
const uchar *, size_t,
my_bool diff_if_only_endspace_difference);
const uchar *, size_t);
extern void my_hash_sort_simple(CHARSET_INFO *cs,
const uchar *key, size_t len,
@ -654,6 +656,17 @@ extern void my_hash_sort_bin(CHARSET_INFO *cs,
const uchar *key, size_t len, ulong *nr1,
ulong *nr2);
/**
Compare a string to an array of spaces, for PAD SPACE comparison.
The function iterates through the string and compares every byte to 0x20.
@param - the string
@param - its length
@return <0 - if a byte less than 0x20 was found in the string.
@return 0 - if all bytes in the string were 0x20, or if length was 0.
@return >0 - if a byte greater than 0x20 was found in the string.
*/
extern int my_strnncollsp_padspace_bin(const uchar *str, size_t length);
extern size_t my_lengthsp_8bit(CHARSET_INFO *cs, const char *ptr, size_t length);
extern uint my_instr_simple(CHARSET_INFO *,

View File

@ -298,11 +298,7 @@ enum ha_base_keytype {
#define HA_SWAP_KEY 64
#define HA_REVERSE_SORT 128 /* Sort key in reverse order */
#define HA_NO_SORT 256 /* do not bother sorting on this keyseg */
/*
End space in unique/varchar are considered equal. (Like 'a' and 'a ')
Only needed for internal temporary tables.
*/
#define HA_END_SPACE_ARE_EQUAL 512
#define HA_BIT_PART 1024
#define HA_CAN_MEMCMP 2048 /* internal, never stored in frm */

View File

@ -108,7 +108,7 @@ typedef struct st_HA_KEYSEG /* Key-portion */
set_rec_bits(0, bit_ptr, bit_ofs, bit_len)
extern int ha_compare_text(CHARSET_INFO *, const uchar *, uint,
const uchar *, uint , my_bool, my_bool);
const uchar *, uint , my_bool);
extern int ha_key_cmp(HA_KEYSEG *keyseg, const uchar *a,
const uchar *b, uint key_length, uint nextflag,
uint *diff_pos);

View File

@ -689,7 +689,7 @@ extern void my_osmaperr(unsigned long last_error);
#endif
extern void init_glob_errs(void);
extern const char** get_global_errmsgs(void);
extern const char** get_global_errmsgs(int nr);
extern void wait_for_free_space(const char *filename, int errors);
extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags);
extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags);
@ -714,9 +714,9 @@ extern void my_printf_error(uint my_err, const char *format,
ATTRIBUTE_FORMAT(printf, 2, 4);
extern void my_printv_error(uint error, const char *format, myf MyFlags,
va_list ap);
extern int my_error_register(const char** (*get_errmsgs) (void),
extern int my_error_register(const char** (*get_errmsgs) (int nr),
uint first, uint last);
extern const char **my_error_unregister(uint first, uint last);
extern my_bool my_error_unregister(uint first, uint last);
extern void my_message(uint my_err, const char *str,myf MyFlags);
extern void my_message_stderr(uint my_err, const char *str, myf MyFlags);
extern my_bool my_init(void);

View File

@ -90,7 +90,7 @@ const char *client_errors[]=
""
};
const char** get_client_errmsgs(void)
const char** get_client_errmsgs(int nr __attribute__((unused)))
{
return client_errors;
}

View File

@ -46,7 +46,7 @@
#endif
#endif
#ifdef alpha_linux_port
#include <asm/ioctls.h> /* QQ; Fix this in configure */
#include <asm/ioctls.h>
#include <asm/termiobits.h>
#endif
#else

View File

@ -39,29 +39,24 @@ if ($before_truncate) {
eval $before_truncate;
}
--echo # Connection: default
BEGIN;
INSERT INTO t2 SELECT * FROM t1;
connect (truncate,localhost,root,,);
--echo # Connection: truncate
send TRUNCATE TABLE t1;
connection default;
--echo # Connection: default
INSERT INTO t2 SELECT * FROM t1;
SELECT COUNT(*) FROM t2;
COMMIT;
connection truncate;
--echo # Connection: truncate
--echo # Reaping TRUNCATE TABLE
--reap
SELECT COUNT(*) FROM t1;
SELECT COUNT(*) FROM t2;
connection default;
--echo # Connection: default
source include/show_binlog_events.inc;
disconnect truncate;

View File

@ -14,11 +14,9 @@
connection slave;
let $before = query_get_value("SHOW MASTER STATUS", Position, 1);
--echo [on master]
connection master;
eval $statement;
--echo [on slave]
sync_slave_with_master;
--echo # Expect 0
SELECT COUNT(*) FROM t1;

View File

@ -7,15 +7,9 @@ set timestamp=1000000000;
create database mysqltest2 character set latin2;
set @@character_set_server=latin5;
create database mysqltest3;
--disable_query_log
select "--- --master--" as "";
--enable_query_log
show create database mysqltest2;
show create database mysqltest3;
sync_slave_with_master;
--disable_query_log
select "--- --slave--" as "";
--enable_query_log
show create database mysqltest2;
show create database mysqltest3;
@ -23,14 +17,8 @@ connection master;
set @@collation_server=armscii8_bin;
drop database mysqltest3;
create database mysqltest3;
--disable_query_log
select "--- --master--" as "";
--enable_query_log
show create database mysqltest3;
sync_slave_with_master;
--disable_query_log
select "--- --slave--" as "";
--enable_query_log
show create database mysqltest3;
connection master;
@ -45,10 +33,8 @@ insert into t1 (b) values(@@character_set_client);
# collation_client does not exist
insert into t1 (b) values(@@character_set_connection);
insert into t1 (b) values(@@collation_connection);
--echo --- --master--
select * from t1 order by a;
sync_slave_with_master;
--echo --- --slave--
select * from mysqltest2.t1 order by a;
connection master;
@ -59,10 +45,8 @@ insert into t1 (b) values(LEAST("M
set collation_connection=latin1_german2_ci;
insert into t1 (b) values(@@collation_connection);
insert into t1 (b) values(LEAST("M<>ller","Muffler"));
--echo --- --master--
select * from t1 order by a;
sync_slave_with_master;
--echo --- --slave--
select * from mysqltest2.t1 order by a;
# Presently charset info is not logged with LOAD DATA but it will
@ -81,10 +65,8 @@ connection master;
set @a= _cp850 'M<>ller' collate cp850_general_ci;
truncate table t1;
insert into t1 (b) values(collation(@a));
--echo --- --master--
select * from t1 order by a;
sync_slave_with_master;
--echo --- --slave--
select * from mysqltest2.t1 order by a;
connection master;

View File

@ -57,10 +57,8 @@
--echo ==== Initialize ====
--echo [on master]
connection master;
CREATE TABLE t1(a INT PRIMARY KEY);
--echo [on slave]
sync_slave_with_master;
@ -71,14 +69,12 @@ sync_slave_with_master;
INSERT INTO t1 VALUES (1);
--echo ---- Insert rows on master ----
--echo [on master]
connection master;
# Insert the same row on master
INSERT INTO t1 VALUES (1);
save_master_pos;
SELECT * FROM t1;
--echo [on slave]
connection slave;
# If we are statement-logging or if slave_exec_mode=STRICT, we now
@ -117,23 +113,19 @@ SELECT * FROM t1;
--echo ==== Test: SQL thread sees 'DELETE' of non-existing row ====
--echo ---- On master, insert two rows, the second with binlogging off ----
--echo [on master]
connection master;
DELETE FROM t1;
INSERT INTO t1 VALUES (1);
--echo [on slave]
sync_slave_with_master;
DELETE FROM t1 WHERE a = 1;
--echo ---- On master, remove the row that does not exist on slave ----
--echo [on master]
connection master;
DELETE FROM t1 WHERE a = 1;
SELECT * FROM t1;
save_master_pos;
--echo [on slave]
connection slave;
# If we are row-logging and slave_exec_mode is STRICT, we now expect
@ -172,9 +164,7 @@ SELECT * FROM t1;
--echo ==== Clean up ====
--echo [on master]
connection master;
DROP TABLE t1;
--echo [on slave]
--sync_slave_with_master

View File

@ -133,8 +133,6 @@ set local sql_mode='';
# The sync_slave_with_master is needed to make the xids deterministic.
sync_slave_with_master;
--echo
--echo -------- switch to master -------
connection master;
SET AUTOCOMMIT = 1;
#
@ -186,13 +184,9 @@ eval CREATE TEMPORARY TABLE mysqltest1.t23 (f1 BIGINT) ENGINE=$temp_engine_type;
SET AUTOCOMMIT = 0;
use mysqltest1;
sync_slave_with_master;
--echo
--echo -------- switch to slave --------
connection slave;
SET AUTOCOMMIT = 1;
use mysqltest1;
--echo
--echo -------- switch to master -------
connection master;
@ -260,12 +254,8 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW TABLES LIKE 't2';
--echo
--echo -------- switch to slave --------
connection slave;
SHOW TABLES LIKE 't2';
--echo
--echo -------- switch to master -------
connection master;
let $my_stmt= DROP TEMPORARY TABLE mysqltest1.t23;
@ -273,12 +263,8 @@ let $my_master_commit= false;
let $my_slave_commit= false;
--source include/rpl_stmt_seq.inc
SHOW TABLES LIKE 't23';
--echo
--echo -------- switch to slave --------
connection slave;
SHOW TABLES LIKE 't23';
--echo
--echo -------- switch to master -------
connection master;
let $my_stmt= RENAME TABLE mysqltest1.t3 to mysqltest1.t20;
@ -286,12 +272,8 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW TABLES LIKE 't20';
--echo
--echo -------- switch to slave --------
connection slave;
SHOW TABLES LIKE 't20';
--echo
--echo -------- switch to master -------
connection master;
let $my_stmt= ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT;
@ -299,12 +281,8 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
describe mysqltest1.t4;
--echo
--echo -------- switch to slave --------
connection slave;
describe mysqltest1.t4;
--echo
--echo -------- switch to master -------
connection master;
let $my_stmt= CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= $engine_type;
@ -326,12 +304,8 @@ let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SELECT * FROM mysqltest1.t7;
sync_slave_with_master;
--echo
--echo -------- switch to slave --------
connection slave;
SELECT * FROM mysqltest1.t7;
--echo
--echo -------- switch to master -------
connection master;
###############################################################
@ -383,12 +357,8 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW INDEX FROM mysqltest1.t6;
--echo
--echo -------- switch to slave --------
connection slave;
SHOW INDEX FROM mysqltest1.t6;
--echo
--echo -------- switch to master -------
connection master;
let $my_stmt= CREATE INDEX my_idx5 ON mysqltest1.t5(f1);
@ -396,12 +366,8 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW INDEX FROM mysqltest1.t5;
--echo
--echo -------- switch to slave --------
connection slave;
SHOW INDEX FROM mysqltest1.t5;
--echo
--echo -------- switch to master -------
connection master;
###############################################################
@ -413,12 +379,8 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW DATABASES LIKE "mysqltest2";
--echo
--echo -------- switch to slave --------
connection slave;
SHOW DATABASES LIKE "mysqltest2";
--echo
--echo -------- switch to master -------
connection master;
let $my_stmt= CREATE DATABASE mysqltest3;
@ -426,12 +388,8 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW DATABASES LIKE "mysqltest3";
--echo
--echo -------- switch to slave --------
connection slave;
SHOW DATABASES LIKE "mysqltest3";
--echo
--echo -------- switch to master -------
connection master;
# End of 4.1 tests
@ -446,13 +404,9 @@ let $my_slave_commit= true;
--vertical_results
--replace_column 5 # 6 #
SHOW PROCEDURE STATUS LIKE 'p1';
--echo
--echo -------- switch to slave --------
connection slave;
--replace_column 5 # 6 #
SHOW PROCEDURE STATUS LIKE 'p1';
--echo
--echo -------- switch to master -------
connection master;
--horizontal_results
@ -463,13 +417,9 @@ let $my_slave_commit= true;
--vertical_results
--replace_column 5 # 6 #
SHOW PROCEDURE STATUS LIKE 'p1';
--echo
--echo -------- switch to slave --------
connection slave;
--replace_column 5 # 6 #
SHOW PROCEDURE STATUS LIKE 'p1';
--echo
--echo -------- switch to master -------
connection master;
--horizontal_results
@ -479,12 +429,8 @@ let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
--vertical_results
SHOW PROCEDURE STATUS LIKE 'p1';
--echo
--echo -------- switch to slave --------
connection slave;
SHOW PROCEDURE STATUS LIKE 'p1';
--echo
--echo -------- switch to master -------
connection master;
--horizontal_results
@ -496,12 +442,8 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW CREATE VIEW v1;
--echo
--echo -------- switch to slave --------
connection slave;
SHOW CREATE VIEW v1;
--echo
--echo -------- switch to master -------
connection master;
let $my_stmt= ALTER VIEW v1 AS select f1 from t1;
@ -509,12 +451,8 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW CREATE VIEW v1;
--echo
--echo -------- switch to slave --------
connection slave;
SHOW CREATE VIEW v1;
--echo
--echo -------- switch to master -------
connection master;
let $my_stmt= DROP VIEW IF EXISTS v1;
@ -523,13 +461,9 @@ let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
--error 1146
SHOW CREATE VIEW v1;
--echo
--echo -------- switch to slave --------
connection slave;
--error 1146
SHOW CREATE VIEW v1;
--echo
--echo -------- switch to master -------
connection master;
###############################################################
@ -540,12 +474,8 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW TRIGGERS;
--echo
--echo -------- switch to slave --------
connection slave;
SHOW TRIGGERS;
--echo
--echo -------- switch to master -------
connection master;
let $my_stmt= DROP TRIGGER trg1;
@ -553,12 +483,8 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW TRIGGERS;
--echo
--echo -------- switch to slave --------
connection slave;
SHOW TRIGGERS;
--echo
--echo -------- switch to master -------
connection master;
###############################################################
@ -569,12 +495,8 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SELECT user FROM mysql.user WHERE user = 'user1';
--echo
--echo -------- switch to slave --------
connection slave;
SELECT user FROM mysql.user WHERE user = 'user1';
--echo
--echo -------- switch to master -------
connection master;
let $my_stmt= RENAME USER user1@localhost TO rename1@localhost;
@ -582,12 +504,8 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SELECT user FROM mysql.user WHERE user = 'rename1';
--echo
--echo -------- switch to slave --------
connection slave;
SELECT user FROM mysql.user WHERE user = 'rename1';
--echo
--echo -------- switch to master -------
connection master;
let $my_stmt= DROP USER rename1@localhost;
@ -595,8 +513,6 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SELECT user FROM mysql.user WHERE user = 'rename1';
--echo
--echo -------- switch to slave --------
connection slave;
SELECT user FROM mysql.user WHERE user = 'rename1';
@ -604,8 +520,6 @@ SELECT user FROM mysql.user WHERE user = 'rename1';
# Cleanup
###############################################################
use test;
--echo
--echo -------- switch to master -------
connection master;
DROP TEMPORARY TABLE mysqltest1.t22;
DROP DATABASE mysqltest1;

View File

@ -23,7 +23,6 @@ call mtr.add_suppression("Slave SQL.*Column [0-9] of table .test.t[0-9]*. cannot
### Should Stop Slave ###
##############################################
--echo *** On Slave ***
sync_slave_with_master;
STOP SLAVE;
RESET SLAVE;

View File

@ -64,7 +64,6 @@ eval CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE=$engine_type;
SET AUTOCOMMIT = 0;
sync_slave_with_master;
--echo -------- switch to slave --------
connection slave;
# We want to verify that the following transactions are written to the
@ -79,7 +78,6 @@ connection slave;
ALTER TABLE mysqltest1.t1 ENGINE = MyISAM;
SHOW CREATE TABLE mysqltest1.t1;
--echo -------- switch to master --------
connection master;
INSERT INTO mysqltest1.t1 SET f1= 1;
DROP TEMPORARY TABLE mysqltest1.tmp;
@ -98,7 +96,6 @@ SHOW CREATE TABLE mysqltest1.tmp2;
SELECT COUNT(*) FROM mysqltest1.t1;
sync_slave_with_master;
--echo -------- switch to slave --------
connection slave;
--error ER_NO_SUCH_TABLE
SHOW CREATE TABLE mysqltest1.tmp;
@ -108,7 +105,6 @@ SHOW CREATE TABLE mysqltest1.tmp2;
SELECT COUNT(*) FROM mysqltest1.t1;
FLUSH LOGS;
--echo -------- switch to master --------
connection master;
FLUSH LOGS;
DROP TEMPORARY TABLE IF EXISTS mysqltest1.tmp2;
@ -142,11 +138,9 @@ INSERT INTO t1 (b) VALUES (1),(2),(3);
BEGIN;
INSERT INTO t1(b) VALUES (4);
--echo -------- switch to master1 --------
connection master1;
--send RENAME TABLE t1 TO t3, t2 TO t1;
--echo -------- switch to master --------
connection master;
# Need to wait until RENAME is received
let $wait_condition=
@ -157,23 +151,19 @@ let $wait_condition=
COMMIT;
--echo -------- switch to master1 --------
connection master1;
--reap
--echo -------- switch to master --------
connection master;
SELECT * FROM t1;
SELECT * FROM t3;
sync_slave_with_master;
--echo -------- switch to slave --------
connection slave;
SELECT * FROM t1;
SELECT * FROM t3;
--echo -------- switch to master --------
connection master;
DROP TABLE t1;
DROP TABLE t3;

View File

@ -197,7 +197,6 @@ DROP TABLE t1;
-- eval LOAD DATA $lock_option LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE t1
-- echo ### create connection without default database
-- echo ### connect (conn2,localhost,root,,*NO-ONE*);
connect (conn2,localhost,root,,*NO-ONE*);
-- connection conn2
-- echo ### assertion: works without stating the default database
@ -216,7 +215,6 @@ connect (conn2,localhost,root,,*NO-ONE*);
-- let $table= $db1.t1
--source include/wait_until_rows_count.inc
-- echo ### disconnect and switch back to master connection
-- disconnect conn2
-- connection master

View File

@ -216,7 +216,7 @@ if (`select char_length('$bit_field_special') > 0`) {
connection master;
eval CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = $type ;
sync_slave_with_master;
--echo --- on slave: original values ---
--echo --- original values ---
INSERT INTO t7 VALUES (1,3), (2,6), (3,9);
SELECT * FROM t7 ORDER BY C1;
@ -226,13 +226,13 @@ SELECT * FROM t7 ORDER BY C1;
set @@global.slave_exec_mode= 'IDEMPOTENT';
connection master;
--echo --- on master: new values inserted ---
--echo --- new values inserted ---
INSERT INTO t7 VALUES (1,2), (2,4), (3,6);
SELECT * FROM t7 ORDER BY C1;
sync_slave_with_master;
set @@global.slave_exec_mode= default;
--echo --- on slave: old values should be overwritten by replicated values ---
--echo --- old values should be overwritten by replicated values ---
SELECT * FROM t7 ORDER BY C1;
#
@ -240,7 +240,6 @@ SELECT * FROM t7 ORDER BY C1;
# causing a conflict for a key that is not "last".
#
connection master;
--echo --- on master ---
eval CREATE TABLE t8 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = $type ;
# First we make sure that the constraints are correctly set.
@ -254,7 +253,6 @@ INSERT INTO t8 VALUES (11,22,99);
SELECT * FROM t8 ORDER BY a;
sync_slave_with_master;
--echo --- on slave ---
SELECT * FROM t8 ORDER BY a;
INSERT INTO t8 VALUES (1,2,3), (2,4,6), (3,6,9);
SELECT * FROM t8 ORDER BY a;
@ -265,14 +263,12 @@ SELECT * FROM t8 ORDER BY a;
set @@global.slave_exec_mode= 'IDEMPOTENT';
connection master;
--echo --- on master ---
# We insert a row that will cause conflict on the primary key but not
# on the other keys.
INSERT INTO t8 VALUES (2,4,8);
sync_slave_with_master;
set @@global.slave_exec_mode= default;
--echo --- on slave ---
SELECT * FROM t8 ORDER BY a;
# BUG#31552: Replication breaks when deleting rows from out-of-sync
@ -280,7 +276,6 @@ SELECT * FROM t8 ORDER BY a;
--echo **** Test for BUG#31552 ****
--echo **** On Master ****
# Clean up t1 so that we can use it.
connection master;
DELETE FROM t1;
@ -289,10 +284,8 @@ sync_slave_with_master;
# Just to get a clean binary log
--source include/rpl_reset.inc
--echo **** On Master ****
connection master;
INSERT INTO t1 VALUES ('K','K'), ('L','L'), ('M','M');
--echo **** On Master ****
sync_slave_with_master;
# since bug#31552/31609 idempotency is not default any longer. In order
# the following test DELETE FROM t1 to pass the mode is switched
@ -313,14 +306,12 @@ query_vertical SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
# (regression test)
--echo **** Test for BUG#37076 ****
--echo **** On Master ****
connection master;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a TIMESTAMP, b DATETIME, c DATE);
INSERT INTO t1 VALUES(
'2005-11-14 01:01:01', '2005-11-14 01:01:02', '2005-11-14');
--echo **** On Slave ****
sync_slave_with_master slave;
SELECT * FROM t1;

View File

@ -22,25 +22,16 @@ BEGIN
END|
delimiter ;|
let $message=< ---- Master selects-- >;
--source include/show_msg.inc
CALL test.p1(12);
SELECT * FROM test.t1;
let $message=< ---- Slave selects-- >;
--source include/show_msg.inc
sync_slave_with_master;
SELECT * FROM test.t1;
let $message=< ---- Master selects-- >;
--source include/show_msg.inc
connection master;
CALL test.p1(13);
SELECT * FROM test.t1;
let $message=< ---- Slave selects-- >;
--source include/show_msg.inc
sync_slave_with_master;
SELECT * FROM test.t1;

View File

@ -78,7 +78,6 @@ INSERT INTO t1_int VALUES (2, 4, 4711);
INSERT INTO t1_char VALUES (2, 4, 'Foo is a bar');
INSERT INTO t1_bit VALUES (2, 4, b'101', b'11100', b'01');
--echo **** On Master ****
connection master;
INSERT INTO t1_int VALUES (1,2);
INSERT INTO t1_int VALUES (2,5);
@ -89,7 +88,6 @@ INSERT INTO t1_char VALUES (2,5);
SELECT * FROM t1_int ORDER BY a;
SELECT * FROM t1_bit ORDER BY a;
SELECT * FROM t1_char ORDER BY a;
--echo **** On Slave ****
sync_slave_with_master;
set @@global.slave_exec_mode= default;
@ -97,7 +95,6 @@ SELECT a,b,x FROM t1_int ORDER BY a;
SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit ORDER BY a;
SELECT a,b,x FROM t1_char ORDER BY a;
--echo **** On Master ****
connection master;
UPDATE t1_int SET b=2*b WHERE a=2;
UPDATE t1_char SET b=2*b WHERE a=2;
@ -105,7 +102,6 @@ UPDATE t1_bit SET b=2*b WHERE a=2;
SELECT * FROM t1_int ORDER BY a;
SELECT * FROM t1_bit ORDER BY a;
SELECT * FROM t1_char ORDER BY a;
--echo **** On Slave ****
sync_slave_with_master;
SELECT a,b,x FROM t1_int ORDER BY a;
SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit ORDER BY a;
@ -132,11 +128,9 @@ INSERT INTO t9 VALUES (2);
sync_slave_with_master;
# Now slave is guaranteed to be running
connection master;
--echo **** On Master ****
INSERT INTO t2 VALUES (2,4);
SELECT * FROM t2;
sync_slave_with_master;
--echo **** On Slave ****
SELECT * FROM t2;
--source include/check_slave_is_running.inc
@ -200,7 +194,6 @@ SELECT * FROM t8 ORDER BY a;
# update should not generate an error even though there is no default
# for the extra column.
--echo **** On Master ****
connection master;
TRUNCATE t1_nodef;
SET SQL_LOG_BIN=0;
@ -209,26 +202,21 @@ INSERT INTO t1_nodef VALUES (2,4);
SET SQL_LOG_BIN=1;
sync_slave_with_master;
--echo **** On Slave ****
connection slave;
INSERT INTO t1_nodef VALUES (1,2,3,4,5);
INSERT INTO t1_nodef VALUES (2,4,6,8,10);
--echo **** On Master ****
connection master;
UPDATE t1_nodef SET b=2*b WHERE a=1;
SELECT * FROM t1_nodef ORDER BY a;
--echo **** On Slave ****
sync_slave_with_master;
SELECT * FROM t1_nodef ORDER BY a;
--echo **** On Master ****
connection master;
DELETE FROM t1_nodef WHERE a=2;
SELECT * FROM t1_nodef ORDER BY a;
--echo **** On Slave ****
sync_slave_with_master;
SELECT * FROM t1_nodef ORDER BY a;

View File

@ -140,11 +140,11 @@ CREATE TABLE t1 (a INT );
sync_slave_with_master;
--connection slave1
--echo # Slave1: lock table for synchronization
--echo # lock table for synchronization
LOCK TABLES t1 WRITE;
--connection master
--echo # Master: insert into the table
--echo # insert into the table
INSERT INTO t1 SELECT SLEEP(4);
--connection slave
@ -155,11 +155,11 @@ let $wait_condition=
AND INFO = "INSERT INTO t1 SELECT SLEEP(4)";
--source include/wait_condition.inc
--echo # Slave: send slave stop
--echo # send slave stop
--send STOP SLAVE
--connection slave1
--echo # Slave1: wait for stop slave
--echo # wait for stop slave
let $wait_condition=
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE INFO = "STOP SLAVE";
@ -169,7 +169,7 @@ let $wait_condition=
UNLOCK TABLES;
--connection slave
--echo # Slave: wait for the slave to stop
--echo # wait for the slave to stop
--reap
--source include/wait_for_slave_to_stop.inc

View File

@ -15,8 +15,6 @@ if (!$tmp_table_stm)
--die $tmp_table_stm is NULL
}
--echo
--echo [ On Master ]
connection master;
BEGIN;
DELETE FROM t1;
@ -25,8 +23,6 @@ INSERT INTO t1 VALUES (1);
DROP TEMPORARY TABLE tt1;
COMMIT;
--echo
--echo [ On Slave ]
connection slave;
# To check if slave SQL thread is applying INSERT statement
@ -37,16 +33,12 @@ source include/wait_show_condition.inc;
send STOP SLAVE SQL_THREAD;
--echo
--echo [ On Slave1 ]
connection slave1;
--echo # To resume slave SQL thread
SET DEBUG_SYNC= 'now SIGNAL signal.continue';
SET DEBUG_SYNC= 'now WAIT_FOR signal.continued';
SET DEBUG_SYNC= 'RESET';
--echo
--echo [ On Slave ]
connection slave;
reap;
source include/wait_for_slave_sql_to_stop.inc;

View File

@ -62,8 +62,7 @@ while ($masters)
--let $masters= `SELECT SUBSTRING('$masters', LENGTH('$master_i') + 2)`
# Connect to master and execute statement
--let $rpl_connection_name= server_$master_i
--source include/rpl_connection.inc
connection server_$master_i;
DELETE FROM t1;
--eval INSERT INTO t1 VALUES ($next_number)
}

View File

@ -1,11 +1,9 @@
--source include/rpl_reset.inc
--echo **** On Master ****
connection master;
eval CREATE TABLE t1 (a INT, b LONG) ENGINE=$engine;
INSERT INTO t1 VALUES (1,1), (2,2);
sync_slave_with_master;
--echo **** On Master ****
connection master;
eval $trunc_stmt t1;
sync_slave_with_master;
@ -14,13 +12,11 @@ let $diff_tables= master:t1, slave:t1;
source include/diff_tables.inc;
--echo ==== Test using a table with delete triggers ====
--echo **** On Master ****
connection master;
SET @count := 1;
eval CREATE TABLE t2 (a INT, b LONG) ENGINE=$engine;
CREATE TRIGGER trg1 BEFORE DELETE ON t1 FOR EACH ROW SET @count := @count + 1;
sync_slave_with_master;
--echo **** On Master ****
connection master;
eval $trunc_stmt t1;
sync_slave_with_master;

View File

@ -2,16 +2,12 @@
--echo
SHOW GRANTS FOR mysqltest_u1@localhost;
--echo
--echo # connection: con1 (mysqltest_u1@mysqltest_db1)
--connect (con1,localhost,mysqltest_u1,,mysqltest_db1)
--connection con1
--echo
SHOW CREATE TABLE t1;
--echo
--echo # connection: default
--connection default
--disconnect con1

View File

@ -64,7 +64,6 @@ drop table if exists t1;
--echo **
--echo ** two UPDATE's running and both changing distinct result sets
--echo **
--echo ** connection thread1
connect (thread1, localhost, mysqltest,,);
connection thread1;
--echo ** Set up table
@ -84,7 +83,6 @@ drop table if exists t1;
--echo ** Get user level lock (ULL) for thread 1
select get_lock("hello",10);
--echo ** connection thread2
connect (thread2, localhost, mysqltest,,);
connection thread2;
--echo ** Start transaction for thread 2
@ -93,7 +91,6 @@ drop table if exists t1;
--echo ** be created and blocked on the first row where tipo=11.
send update t1 set eta=1+get_lock("hello",10)*0 where tipo=11;
--echo ** connection thread1
connection thread1;
let $wait_condition= select count(*)= 1 from information_schema.processlist where state= 'User lock';
--source include/wait_condition.inc
@ -121,7 +118,6 @@ drop table if exists t1;
--echo ** Table is now updated with a new eta on tipo=22 for thread 1.
select * from t1;
--echo ** connection thread2
connection thread2;
--echo ** Release the lock and collect result from update on thread 2
reap;
@ -134,7 +130,6 @@ drop table if exists t1;
--echo ** Sending commit on thread 2.
commit;
--echo ** connection thread1
connection thread1;
--echo ** Make sure table reads didn't change yet on thread 1.
select * from t1;
@ -144,16 +139,13 @@ drop table if exists t1;
--echo ** thread 1,2.
select * from t1;
--echo ** connection thread2
connection thread2;
--echo ** Make sure the output is similar for t1.
select * from t1;
--echo ** connection thread1
connection thread1;
select * from t1;
--echo ** connection default
connection default;
drop table t1;
@ -162,7 +154,6 @@ drop table t1;
--echo **
--echo ** two UPDATE's running and one changing result set
--echo **
--echo ** connection thread1
#connect (thread1, localhost, mysqltest,,);
connection thread1;
--echo ** Set up table
@ -182,7 +173,6 @@ drop table t1;
--echo ** Get ULL "hello" on thread 1
select get_lock("hello",10);
--echo ** connection thread2
#connect (thread2, localhost, mysqltest,,);
connection thread2;
--echo ** Start transaction on thread 2
@ -192,7 +182,6 @@ drop table t1;
--echo ** blocking ULL is released.
send update t1 set eta=1+get_lock("hello",10)*0 where tipo=1;
--echo ** connection thread1
connection thread1;
let $wait_condition= select count(*)= 1 from information_schema.processlist where state= 'User lock';
--source include/wait_condition.inc
@ -219,7 +208,6 @@ drop table t1;
--echo ** The table should still be updated with updates for thread 1 only:
select * from t1;
--echo ** connection thread2
connection thread2;
--echo ** Release the lock and collect result from thread 2:
reap;
@ -231,7 +219,6 @@ drop table t1;
select * from t1;
commit;
--echo ** connection thread1
connection thread1;
--echo ** Thread 2 has committed but the result should remain the same for
--echo ** thread 1 (updated on three places):
@ -242,15 +229,12 @@ drop table t1;
--echo ** This select should show both updates:
select * from t1;
--echo ** connection thread2
connection thread2;
select * from t1;
--echo ** connection thread1
connection thread1;
select * from t1;
--echo ** connection default
connection default;
drop table t1;
@ -259,7 +243,6 @@ drop table t1;
--echo **
--echo ** One UPDATE and one INSERT .... Monty's test
--echo **
--echo ** connection thread1
#connect (thread1, localhost, mysqltest,,);
connection thread1;
--echo ** Set up table
@ -269,7 +252,6 @@ drop table t1;
--echo ** Create ULL 'hello2'
select get_lock("hello2",10);
--echo ** connection thread2
#connect (thread2, localhost, mysqltest,,);
connection thread2;
--echo ** Begin a new transaction on thread 2
@ -278,7 +260,6 @@ drop table t1;
--echo ** this will hang waiting on thread 1.
send update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2;
--echo ** connection thread1
connection thread1;
let $wait_condition= select count(*)= 1 from information_schema.processlist where state= 'User lock';
--source include/wait_condition.inc
@ -292,7 +273,6 @@ drop table t1;
--echo ** ..but thread 1 will still see t1 as if nothing has happend:
select * from t1;
--echo ** connection thread2
connection thread2;
--echo ** Collect results from thread 2 and release the lock.
reap;
@ -305,7 +285,6 @@ drop table t1;
--echo ** Commit changes from thread 2
commit;
--echo ** connection default
connection default;
drop table t1;
@ -314,7 +293,6 @@ drop table t1;
--echo **
--echo ** one UPDATE changing result set and SELECT ... FOR UPDATE
--echo **
--echo ** connection thread1
#connect (thread1, localhost, mysqltest,,);
connection thread1;
--echo ** Set up table
@ -332,7 +310,6 @@ drop table t1;
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
--echo ** connection thread2
#connect (thread2, localhost, mysqltest,,);
connection thread2;
--echo ** Begin a new transaction on thread 2
@ -340,7 +317,6 @@ drop table t1;
--echo ** Select a range for update.
select * from t1 where tipo=2 FOR UPDATE;
--echo ** connection thread1
connection thread1;
--echo ** Begin a new transaction on thread 1
begin;
@ -352,7 +328,6 @@ drop table t1;
--echo ** transaction failed and was rolled back.
select * from t1;
--echo ** connection thread2
connection thread2;
--echo ** The table should look unmodified from thread 2.
select * from t1;
@ -360,22 +335,18 @@ drop table t1;
--echo ** thread 1 to complete the transaction.
commit;
--echo ** connection thread1
connection thread1;
--echo ** Commit on thread 1.
commit;
--echo ** connection thread2
connection thread2;
--echo ** The table should not have been changed.
select * from t1;
--echo ** connection thread1
connection thread1;
--echo ** Even on thread 1:
select * from t1;
--echo ** connection default
connection default;
drop table t1;
@ -384,7 +355,6 @@ drop table t1;
--echo **
--echo ** one UPDATE not changing result set and SELECT ... FOR UPDATE
--echo **
--echo ** connection thread1
#connect (thread1, localhost, mysqltest,,);
connection thread1;
--echo ** Set up table
@ -402,7 +372,6 @@ drop table t1;
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
--echo ** connection thread2
#connect (thread2, localhost, mysqltest,,);
connection thread2;
--echo ** Starting new transaction on thread 2.
@ -410,7 +379,6 @@ drop table t1;
--echo ** Starting SELECT .. FOR UPDATE
select * from t1 where tipo=2 FOR UPDATE;
--echo ** connection thread1
connection thread1;
--echo
--echo ** Starting new transaction on thread 1
@ -433,28 +401,23 @@ drop table t1;
--echo ** have changed.
select * from t1;
--echo ** connection thread2
connection thread2;
--echo ** The same thing should hold true for the transaction on
--echo ** thread 2
select * from t1;
send commit;
--echo ** connection thread1
connection thread1;
commit;
--echo ** connection thread2
connection thread2;
--echo ** Even after committing:
reap;
select * from t1;
--echo ** connection thread1
connection thread1;
select * from t1;
--echo ** connection default
connection default;
drop table t1;
@ -463,7 +426,6 @@ drop table t1;
--echo **
--echo ** two SELECT ... FOR UPDATE
--echo **
--echo ** connection thread1
#connect (thread1, localhost, mysqltest,,);
connection thread1;
--echo ** Set up table
@ -481,14 +443,12 @@ drop table t1;
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
--echo ** connection thread2
#connect (thread2, localhost, mysqltest,,);
connection thread2;
--echo ** Begin a new transaction on thread 2
begin;
select * from t1 where tipo=2 FOR UPDATE;
--echo ** connection thread1
connection thread1;
--echo ** Begin a new transaction on thread 1
begin;
@ -497,7 +457,6 @@ drop table t1;
--error ER_LOCK_WAIT_TIMEOUT
select * from t1 where tipo=1 FOR UPDATE;
--echo ** connection thread2
connection thread2;
--echo ** Table will be unchanged and the select command will not be
--echo ** blocked:
@ -505,22 +464,18 @@ drop table t1;
--echo ** Commit transacton on thread 2.
commit;
--echo ** connection thread1
connection thread1;
--echo ** Commit transaction on thread 1.
commit;
--echo ** connection thread2
connection thread2;
--echo ** Make sure table isn't blocked on thread 2:
select * from t1;
--echo ** connection thread1
connection thread1;
--echo ** Make sure table isn't blocked on thread 1:
select * from t1;
--echo ** connection default
connection default;
drop table t1;
@ -529,7 +484,6 @@ drop table t1;
--echo **
--echo ** one UPDATE changing result set and DELETE
--echo **
--echo ** connection thread1
#connect (thread1, localhost, mysqltest,,);
connection thread1;
--echo ** Set up table
@ -547,7 +501,6 @@ drop table t1;
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
--echo ** connection thread2
#connect (thread2, localhost, mysqltest,,);
connection thread2;
begin;
@ -557,33 +510,27 @@ drop table t1;
# 'innodb_deleted_rows' and infos in processlist where not sucessful.
sleep 1;
--echo ** connection thread1
connection thread1;
begin;
--error ER_LOCK_WAIT_TIMEOUT
update t1 set tipo=1 where tipo=2;
select * from t1;
--echo ** connection thread2
connection thread2;
reap;
select * from t1;
send commit;
--echo ** connection thread1
connection thread1;
commit;
--echo ** connection thread2
connection thread2;
reap;
select * from t1;
--echo ** connection thread1
connection thread1;
select * from t1;
--echo ** connection default
connection default;
drop table t1;
@ -592,7 +539,6 @@ drop table t1;
--echo **
--echo ** one UPDATE not changing result set and DELETE
--echo **
--echo ** connection thread1
#connect (thread1, localhost, mysqltest,,);
connection thread1;
--echo ** Set up table
@ -610,7 +556,6 @@ drop table t1;
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
--echo ** connection thread2
#connect (thread2, localhost, mysqltest,,);
connection thread2;
begin;
@ -620,7 +565,6 @@ drop table t1;
# 'innodb_deleted_rows' and infos in processlist where not sucessful.
sleep 1;
--echo ** connection thread1
connection thread1;
begin;
--echo ** Update on t1 will cause a table scan which will be blocked because
@ -639,22 +583,18 @@ drop table t1;
}
select * from t1;
--echo ** connection thread2
connection thread2;
reap;
select * from t1;
send commit;
--echo ** connection thread1
connection thread1;
commit;
--echo ** connection thread2
connection thread2;
reap;
select * from t1;
--echo ** connection thread1
connection thread1;
select * from t1;
@ -662,11 +602,9 @@ drop table t1;
connection thread1;
disconnect thread1;
--source include/wait_until_disconnected.inc
--echo ** connection thread2
connection thread2;
disconnect thread2;
--source include/wait_until_disconnected.inc
--echo ** connection default
connection default;
drop table t1;
drop user mysqltest@localhost;

View File

@ -1,5 +1,5 @@
SELECT strcmp('a','a ');
SELECT strcmp('a\0','a' );
SELECT strcmp('a\0','a ');
SELECT strcmp('a\t','a' );
SELECT strcmp('a\t','a ');
SELECT strcmp('a','a '), strcmp('a ','a');
SELECT strcmp('a\0','a' ), strcmp('a','a\0');
SELECT strcmp('a\0','a '), strcmp('a ','a\0');
SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');

View File

@ -10,9 +10,7 @@
# main code went into include/deadlock.inc
#
--echo # Establish connection con1 (user=root)
connect (con1,localhost,root,,);
--echo # Establish connection con2 (user=root)
connect (con2,localhost,root,,);
--disable_warnings
@ -23,14 +21,12 @@ drop table if exists t1,t2;
# Testing of FOR UPDATE
#
--echo # Switch to connection con1
connection con1;
eval create table t1 (id integer, x integer) engine = $engine_type;
insert into t1 values(0, 0);
set autocommit=0;
SELECT * from t1 where id = 0 FOR UPDATE;
--echo # Switch to connection con2
connection con2;
set autocommit=0;
@ -39,18 +35,15 @@ set autocommit=0;
update t1 set x=2 where id = 0;
--sleep 2
--echo # Switch to connection con1
connection con1;
update t1 set x=1 where id = 0;
select * from t1;
commit;
--echo # Switch to connection con2
connection con2;
reap;
commit;
--echo # Switch to connection con1
connection con1;
select * from t1;
commit;
@ -60,7 +53,6 @@ drop table t1;
# Testing of FOR UPDATE
#
--echo # Switch to connection con1
connection con1;
eval create table t1 (id integer, x integer) engine = $engine_type;
eval create table t2 (b integer, a integer) engine = $engine_type;
@ -73,7 +65,6 @@ update t2 set a=100 where b=(SELECT x from t1 where id = b FOR UPDATE);
select * from t2;
select * from t1;
--echo # Switch to connection con2
connection con2;
set autocommit=0;
@ -82,18 +73,15 @@ set autocommit=0;
update t1 set x=2 where id = 0;
--sleep 2
--echo # Switch to connection con1
connection con1;
update t1 set x=1 where id = 0;
select * from t1;
commit;
--echo # Switch to connection con2
connection con2;
reap;
commit;
--echo # Switch to connection con1
connection con1;
select * from t1;
commit;
@ -105,13 +93,11 @@ insert into t1 values(0, 0), (300, 300);
insert into t2 values(0, 0), (1, 20), (2, 30);
commit;
--echo # Switch to connection con1
connection con1;
select a,b from t2 UNION SELECT id, x from t1 FOR UPDATE;
select * from t2;
select * from t1;
--echo # Switch to connection con2
connection con2;
# The following query should hang because con1 is locking the record
@ -121,24 +107,20 @@ select * from t2;
update t1 set x=2 where id = 0;
--sleep 2
--echo # Switch to connection con1
connection con1;
update t1 set x=1 where id = 0;
select * from t1;
commit;
--echo # Switch to connection con2
connection con2;
reap;
commit;
--echo # Switch to connection con1
connection con1;
select * from t1;
commit;
# Cleanup
--echo # Switch to connection default + disconnect con1 and con2
connection default;
disconnect con1;
disconnect con2;

View File

@ -51,7 +51,6 @@ set GLOBAL query_cache_size=1355776;
reset query cache;
flush status;
--echo ----- establish connection root -----
connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection root;
show grants for current_user;
@ -67,7 +66,6 @@ insert into mysqltest.t2 values (3,3,3);
create table test.t1 (a char (10));
insert into test.t1 values ("test.t1");
select * from t1;
--echo ----- establish connection root2 -----
connect (root2,localhost,root,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK);
connection root2;
# put queries in cache
@ -86,7 +84,6 @@ grant SELECT on test.t1 to mysqltest_2@localhost;
grant SELECT(a) on mysqltest.t1 to mysqltest_3@localhost;
# The following queries should be fetched from cache
--echo ----- establish connection user1 (user=mysqltest_1) -----
connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK);
connection user1;
show grants for current_user();
@ -112,14 +109,12 @@ show status like "Qcache_hits";
show status like "Qcache_not_cached";
--echo ----- establish connection unkuser (user=unkuser) -----
# Don't use '' as user because it will pick Unix login
connect (unkuser,localhost,unkuser,,,$MASTER_MYPORT,$MASTER_MYSOCK);
connection unkuser;
show grants for current_user();
# The following queries should be fetched from cache
--echo ----- establish connection user2 (user=mysqltest_2) -----
connect (user2,localhost,mysqltest_2,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK);
connection user2;
select "user2";
@ -135,7 +130,6 @@ show status like "Qcache_hits";
show status like "Qcache_not_cached";
# The following queries should not be fetched from cache
--echo ----- establish connection user3 (user=mysqltest_3) -----
connect (user3,localhost,mysqltest_3,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK);
connection user3;
select "user3";
@ -157,7 +151,6 @@ show status like "Qcache_hits";
show status like "Qcache_not_cached";
# Connect without a database
--echo ----- establish connection user4 (user=mysqltest_1) -----
connect (user4,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,$MASTER_MYSOCK);
connection user4;
select "user4";
@ -175,7 +168,6 @@ show status like "Qcache_not_cached";
# Cleanup
--echo ----- close connections -----
connection root;
disconnect root;
--source include/wait_until_disconnected.inc
@ -197,7 +189,6 @@ disconnect user4;
connection unkuser;
disconnect unkuser;
--source include/wait_until_disconnected.inc
--echo ----- switch to connection default -----
connection default;
#

View File

@ -647,23 +647,19 @@ CREATE TABLE t2 (a INT) ENGINE=InnoDB;
CONNECT (c1,localhost,root,,);
CONNECT (c2,localhost,root,,);
--echo switch to connection c1
CONNECTION c1;
SET AUTOCOMMIT=0;
INSERT INTO t2 VALUES (1);
--echo switch to connection c2
CONNECTION c2;
SET AUTOCOMMIT=0;
--error ER_LOCK_WAIT_TIMEOUT
LOCK TABLES t1 READ, t2 READ;
--echo switch to connection c1
CONNECTION c1;
COMMIT;
INSERT INTO t1 VALUES (1);
--echo switch to connection default
CONNECTION default;
SET AUTOCOMMIT=default;
DISCONNECT c1;
@ -1327,7 +1323,6 @@ connect (con2,localhost,root,,);
SET SESSION AUTOCOMMIT = 0;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
set binlog_format=mixed;
--echo # Switch to connection con1
connection con1;
eval
@ -1343,7 +1338,6 @@ UPDATE t1 SET b = 12 WHERE a = 1;
--disable_info
SELECT * FROM t1;
--echo # Switch to connection con2
connection con2;
--enable_info
@ -1352,16 +1346,13 @@ connection con2;
UPDATE t1 SET b = 21 WHERE a = 1;
--disable_info
--echo # Switch to connection con1
connection con1;
SELECT * FROM t1;
ROLLBACK;
--echo # Switch to connection con2
connection con2;
ROLLBACK;
--echo # Switch to connection con1
connection con1;
--echo # 2. test for serialized update:
@ -1395,12 +1386,10 @@ UPDATE t1 SET b = CONCAT(b, '+con1') WHERE a = 1;
--disable_info
SELECT * FROM t1;
--echo # Switch to connection con2
connection con2;
--send CALL p1;
--echo # Switch to connection con1
connection con1;
SELECT * FROM t1;
COMMIT;
@ -1413,13 +1402,11 @@ while ($bug31310)
SELECT * FROM t1;
--echo # Switch to connection con2
connection con2;
--reap
SELECT * FROM t1;
COMMIT;
--echo # Switch to connection con1
connection con1;
--echo # 3. test for updated key column:
@ -1435,12 +1422,10 @@ UPDATE t1 SET a = 2, b = CONCAT(b, '+con1') WHERE a = 1;
--disable_info
SELECT * FROM t1;
--echo # Switch to connection con2
connection con2;
--send CALL p1;
--echo # Switch to connection con1
connection con1;
SELECT * FROM t1;
COMMIT;
@ -1453,7 +1438,6 @@ while ($bug31310)
SELECT * FROM t1;
--echo # Switch to connection con2
connection con2;
--reap
SELECT * FROM t1;
@ -1616,23 +1600,18 @@ eval CREATE TABLE t1 (a INT) ENGINE=$engine_type;
INSERT INTO t1 VALUES (1),(2),(3);
BEGIN;
SELECT * FROM t1 ORDER BY a;
--echo # Connection con1
connect (con1, localhost, root,,);
--send TRUNCATE TABLE t1;
--echo # Connection default
connection default;
let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist
WHERE state='Waiting for table metadata lock' AND info='TRUNCATE TABLE t1';
--source include/wait_condition.inc
SELECT * FROM t1 ORDER BY a;
ROLLBACK;
--echo # Connection con1
connection con1;
--echo # Reaping TRUNCATE TABLE
--reap
SELECT * FROM t1;
--echo # Disconnect con1
disconnect con1;
--echo # Connection default
connection default;
DROP TABLE t1;

View File

@ -124,7 +124,6 @@ eval SET SESSION STORAGE_ENGINE = $engine_type;
SET @@autocommit=1;
connection default;
--echo connection default
# This should be 'YES'.
SHOW VARIABLES LIKE 'have_query_cache';
@ -142,7 +141,6 @@ SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
show status like "Qcache_queries_in_cache";
connection connection1;
--echo connection connection1
START TRANSACTION;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
INSERT INTO t2 VALUES (5,'w');
@ -153,7 +151,6 @@ SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
show status like "Qcache_queries_in_cache";
connection default;
--echo connection default
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
COMMIT;
@ -163,7 +160,6 @@ SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
show status like "Qcache_queries_in_cache";
connection connection1;
--echo connection connection1
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
START TRANSACTION;
@ -172,7 +168,6 @@ INSERT INTO t2 VALUES (6,'w');
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
connection default;
--echo connection default
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
START TRANSACTION;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
@ -181,7 +176,6 @@ SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
COMMIT;
connection connection1;
--echo connection connection1
COMMIT;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';

View File

@ -23,9 +23,7 @@
set GLOBAL query_cache_type=ON;
set LOCAL query_cache_type=ON;
--echo ---- establish connection con1 (root) ----
connect (con1,localhost,root,,test,$MASTER_MYPORT,);
--echo ---- switch to connection default ----
connection default;
set @initial_query_cache_size = @@global.query_cache_size;
@ -55,7 +53,6 @@ show status like 'Qcache_hits';
execute stmt2;
show status like 'Qcache_hits';
# Another prepared statement (same text, other connection), should hit the QC
--echo ---- switch to connection con1 ----
connection con1;
prepare stmt3 from "select * from t1 where c1=10";
execute stmt3;
@ -64,7 +61,6 @@ execute stmt3;
show status like 'Qcache_hits';
execute stmt3;
show status like 'Qcache_hits';
--echo ---- switch to connection default ----
connection default;
# Mixup tests, where statements without PREPARE.../EXECUTE.... meet statements
@ -89,20 +85,16 @@ execute stmt10;
show status like 'Qcache_hits';
eval $my_stmt;
show status like 'Qcache_hits';
--echo ---- switch to connection con1 ----
connection con1;
eval $my_stmt;
show status like 'Qcache_hits';
--echo ---- switch to connection default ----
connection default;
#
# Statement without PREPARE.../EXECUTE.... first
let $my_stmt= SELECT * FROM t1 WHERE c1 = 1;
eval prepare stmt11 from "$my_stmt";
--echo ---- switch to connection con1 ----
connection con1;
eval prepare stmt12 from "$my_stmt";
--echo ---- switch to connection default ----
connection default;
eval $my_stmt;
show status like 'Qcache_hits';
@ -110,11 +102,9 @@ eval $my_stmt;
show status like 'Qcache_hits';
execute stmt11;
show status like 'Qcache_hits';
--echo ---- switch to connection con1 ----
connection con1;
execute stmt12;
show status like 'Qcache_hits';
--echo ---- switch to connection default ----
connection default;
# Query caching also works when statement has parameters
@ -127,7 +117,6 @@ execute stmt1 using @a;
show status like 'Qcache_hits';
execute stmt1 using @a;
show status like 'Qcache_hits';
--echo ---- switch to connection con1 ----
connection con1;
set @a=1;
prepare stmt4 from "select * from t1 where c1=?";
@ -139,7 +128,6 @@ execute stmt4 using @a;
show status like 'Qcache_hits';
execute stmt4 using @a;
show status like 'Qcache_hits';
--echo ---- switch to connection default ----
connection default;
# See if enabling/disabling the query cache between PREPARE and
@ -168,7 +156,6 @@ execute stmt1;
show status like 'Qcache_hits';
# The QC is global = affects also other connections.
# Expect to see no additional Qcache_hits.
--echo ---- switch to connection con1 ----
connection con1;
execute stmt3;
show status like 'Qcache_hits';
@ -178,7 +165,6 @@ execute stmt3;
show status like 'Qcache_hits';
#
# then QC is re-enabled for more EXECUTE.
--echo ---- switch to connection default ----
connection default;
set global query_cache_size=102400;
# Expect to see additional Qcache_hits.
@ -193,7 +179,6 @@ show status like 'Qcache_hits';
execute stmt1;
show status like 'Qcache_hits';
# The QC is global = affects also other connections.
--echo ---- switch to connection con1 ----
connection con1;
execute stmt3;
show status like 'Qcache_hits';
@ -201,7 +186,6 @@ execute stmt3;
show status like 'Qcache_hits';
execute stmt3;
show status like 'Qcache_hits';
--echo ---- switch to connection default ----
connection default;
#
# then QC is re-disabled for more EXECUTE.
@ -216,7 +200,6 @@ show status like 'Qcache_hits';
execute stmt1;
show status like 'Qcache_hits';
# The QC is global = affects also other connections.
--echo ---- switch to connection con1 ----
connection con1;
execute stmt3;
show status like 'Qcache_hits';
@ -226,15 +209,12 @@ execute stmt3;
show status like 'Qcache_hits';
#
--echo ---- switch to connection default ----
connection default;
# QC is disabled at PREPARE
set global query_cache_size=0;
prepare stmt1 from "select * from t1 where c1=10";
--echo ---- switch to connection con1 ----
connection con1;
prepare stmt3 from "select * from t1 where c1=10";
--echo ---- switch to connection default ----
connection default;
# then QC is enabled at EXECUTE
set global query_cache_size=102400;
@ -246,7 +226,6 @@ show status like 'Qcache_hits';
execute stmt1;
show status like 'Qcache_hits';
# The QC is global = affects also other connections.
--echo ---- switch to connection con1 ----
connection con1;
show status like 'Qcache_hits';
execute stmt3;
@ -255,7 +234,6 @@ execute stmt3;
show status like 'Qcache_hits';
execute stmt3;
show status like 'Qcache_hits';
--echo ---- switch to connection default ----
connection default;
#
# QC is disabled at PREPARE
@ -276,7 +254,6 @@ show status like 'Qcache_hits';
drop table t1;
--echo ---- disconnect connection con1 ----
disconnect con1;
#

View File

@ -51,7 +51,9 @@ if ($rpl_debug)
{
--echo connect ($rpl_connection_name,127.0.0.1,root,,test,$_rpl_port,)
}
disable_connect_log;
--connect ($rpl_connection_name,127.0.0.1,root,,test,$_rpl_port,)
enable_connect_log;
--let $include_filename= rpl_connect.inc

View File

@ -43,5 +43,7 @@ if ($_include_file_depth)
--echo [connection $rpl_connection_name]
}
}
disable_connect_log;
--connection $rpl_connection_name
enable_connect_log;
--let $rpl_connection_name=

View File

@ -1,2 +0,0 @@
let $rpl_connection_name= master;
source include/rpl_connection.inc;

View File

@ -1,2 +0,0 @@
let $rpl_connection_name= slave;
source include/rpl_connection.inc;

View File

@ -1,2 +0,0 @@
let $rpl_connection_name= slave1;
source include/rpl_connection.inc;

View File

@ -1,13 +1,9 @@
--echo connect (master,$IPv6,root,,test,MASTER_MYPORT);
connect (master,$IPv6,root,,test,$MASTER_MYPORT);
--echo connect (slave,127.0.0.1,root,,test,SLAVE_MYPORT);
connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT);
--echo connection master;
connection master;
reset master;
source include/show_master_status.inc;
save_master_pos;
--echo connection slave;
connection slave;
reset slave;
let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
@ -15,10 +11,7 @@ let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
eval change master to master_host='$IPv6';
let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
--echo Master-Host: $master_host
--echo disconnect slave;
disconnect slave;
--echo disconnect master;
disconnect master;
--echo connection default;
connection default;

View File

@ -1,13 +1,9 @@
--echo connect (master,127.0.0.1,root,,test,MASTER_MYPORT);
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT);
--echo connect (slave,$IPv6,root,,test,SLAVE_MYPORT);
connect (slave,$IPv6,root,,test,$SLAVE_MYPORT);
--echo connection master;
connection master;
reset master;
source include/show_master_status.inc;
save_master_pos;
--echo connection slave;
connection slave;
reset slave;
let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
@ -15,10 +11,7 @@ let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
eval change master to master_host='$IPv6';
let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
--echo Master-Host: $master_host
--echo disconnect slave;
disconnect slave;
--echo disconnect master;
disconnect master;
--echo connection default;
connection default;

View File

@ -1,22 +1,15 @@
--echo connect (master,$IPv6,root,,test,MASTER_MYPORT);
connect (master,$IPv6,root,,test,$MASTER_MYPORT);
--echo connect (slave,$IPv6,root,,test,SLAVE_MYPORT);
connect (slave,$IPv6,root,,test,$SLAVE_MYPORT);
--echo connection master;
connection master;
reset master;
source include/show_master_status.inc;
save_master_pos;
--echo connection slave;
connection slave;
reset slave;
eval change master to master_host='$IPv6';
let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
--echo Master-Host: $master_host
--echo disconnect slave;
disconnect slave;
--echo disconnect master;
disconnect master;
--echo connection default;
connection default;

View File

@ -19,12 +19,10 @@ if ($LOAD_LOCAL)
}
save_master_pos;
echo ----------content on master----------;
SELECT hex(cl) FROM t;
connection slave;
sync_with_master;
echo ----------content on slave----------;
USE mysqltest;
SELECT hex(cl) FROM t;

View File

@ -70,8 +70,6 @@ let $_log_num_s= `select @aux`;
###############################################################
# INSERT
###############################################################
--echo
--echo -------- switch to master -------
connection master;
# Maybe it would be smarter to use a table with an autoincrement column.
let $MAX= `SELECT MAX(f1) FROM t1` ;
@ -85,8 +83,6 @@ if ($show_binlog)
}
sync_slave_with_master;
--echo
--echo -------- switch to slave --------
connection slave;
# results before DDL(to be tested)
SELECT MAX(f1) FROM t1;
@ -99,8 +95,6 @@ if ($show_binlog)
###############################################################
# command to be tested
###############################################################
--echo
--echo -------- switch to master -------
connection master;
eval $my_stmt;
# Devaluate $my_stmt, to detect script bugs
@ -114,8 +108,6 @@ if ($show_binlog)
}
sync_slave_with_master;
--echo
--echo -------- switch to slave --------
connection slave;
# results after DDL(to be tested)
SELECT MAX(f1) FROM t1;
@ -128,8 +120,6 @@ if ($show_binlog)
###############################################################
# ROLLBACK
###############################################################
--echo
--echo -------- switch to master -------
connection master;
ROLLBACK;
# results after final ROLLBACK
@ -151,8 +141,6 @@ if ($show_binlog)
}
sync_slave_with_master;
--echo
--echo -------- switch to slave --------
connection slave;
# results after final ROLLBACK
SELECT MAX(f1) FROM t1;
@ -181,16 +169,12 @@ if ($manipulate)
# - flush the master and the slave log
# ---> both start to write into new logs with incremented number
# - increment $_log_num_n
--echo
--echo -------- switch to master -------
connection master;
flush logs;
# sleep 1;
# eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
sync_slave_with_master;
--echo
--echo -------- switch to slave --------
connection slave;
# the final content of the binary log
flush logs;
@ -202,6 +186,4 @@ flush logs;
inc $_log_num_n;
}
--echo
--echo -------- switch to master -------
connection master;

View File

@ -81,7 +81,9 @@ while ($_rpl_i) {
}
if ($rpl_only_running_threads)
{
disable_connect_log;
--connection server_$_rpl_server
enable_connect_log;
--let $_rpl_slave_io_running= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1)
--let $_rpl_slave_sql_running= query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1)
if ($rpl_debug)
@ -92,7 +94,9 @@ while ($_rpl_i) {
--let $_rpl_slave_sql_running= `SELECT IF('$_rpl_slave_sql_running' = 'Yes', 1, '')`
if ($_rpl_slave_io_running)
{
disable_query_log;
--connection server_$_rpl_prev_server
enable_query_log;
if ($_rpl_slave_sql_running)
{
if ($rpl_debug)
@ -101,7 +105,9 @@ while ($_rpl_i) {
--let $_rpl_master_pos= query_get_value("SHOW MASTER STATUS", Position, 1)
--echo syncing master_file='$_rpl_master_file' master_pos='$_rpl_master_pos'
}
disable_connect_log;
--sync_slave_with_master server_$_rpl_server
enable_connect_log;
}
if (!$_rpl_slave_sql_running)
{
@ -119,6 +125,7 @@ while ($_rpl_i) {
}
if (!$rpl_only_running_threads)
{
disable_connect_log;
--connection server_$_rpl_prev_server
if ($rpl_debug)
{
@ -127,6 +134,7 @@ while ($_rpl_i) {
--echo syncing master_file='$_rpl_master_file' master_pos='$_rpl_master_pos'
}
--sync_slave_with_master server_$_rpl_server
enable_connect_log;
}
}

View File

@ -30,7 +30,6 @@ drop table if exists t1;
# Test 1) Test UDFs via loadable libraries
#
--echo "*** Test 1) Test UDFs via loadable libraries ***
--echo "Running on the master"
--enable_info
--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
eval CREATE FUNCTION myfunc_double RETURNS REAL SONAME "$UDF_EXAMPLE_SO";
@ -48,7 +47,6 @@ connection slave;
sync_with_master;
# Check to see that UDF CREATE statements were replicated
--echo "Running on the slave"
--enable_info
--replace_column 3 UDF_LIB
SELECT * FROM mysql.func ORDER BY name;
@ -57,7 +55,6 @@ SELECT * FROM mysql.func ORDER BY name;
connection master;
# Use the UDFs to do something
--echo "Running on the master"
--enable_info
eval CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=$engine_type;
--disable_warnings
@ -72,7 +69,6 @@ SELECT * FROM t1 ORDER BY sum;
sync_slave_with_master;
# Check to see if data was replicated
--echo "Running on the slave"
--enable_info
SELECT * FROM t1 ORDER BY sum;
@ -84,7 +80,6 @@ SELECT myfunc_double(75.00);
connection master;
# Drop the functions
--echo "Running on the master"
--enable_info
DROP FUNCTION myfunc_double;
DROP FUNCTION myfunc_int;
@ -94,7 +89,6 @@ SELECT * FROM mysql.func ORDER BY name;
sync_slave_with_master;
# Check to see if the UDFs were dropped on the slave
--echo "Running on the slave"
--enable_info
SELECT * FROM mysql.func ORDER BY name;
--disable_info
@ -102,7 +96,6 @@ SELECT * FROM mysql.func ORDER BY name;
connection master;
# Cleanup
--echo "Running on the master"
--enable_info
DROP TABLE t1;
--disable_info
@ -111,7 +104,6 @@ DROP TABLE t1;
# Test 2) Test UDFs with SQL body
#
--echo "*** Test 2) Test UDFs with SQL body ***
--echo "Running on the master"
--enable_info
CREATE FUNCTION myfuncsql_int(i INT) RETURNS INTEGER DETERMINISTIC RETURN i;
CREATE FUNCTION myfuncsql_double(d DOUBLE) RETURNS INTEGER DETERMINISTIC RETURN d * 2.00;
@ -121,7 +113,6 @@ SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'te
sync_slave_with_master;
# Check to see that UDF CREATE statements were replicated
--echo "Running on the slave"
--enable_info
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
--disable_info
@ -129,7 +120,6 @@ SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'te
connection master;
# Use the UDFs to do something
--echo "Running on the master"
--enable_info
eval CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=$engine_type;
INSERT INTO t1 VALUES(myfuncsql_int(100), myfuncsql_double(50.00));
@ -142,7 +132,6 @@ SELECT * FROM t1 ORDER BY sum;
sync_slave_with_master;
# Check to see if data was replicated
--echo "Running on the slave"
--enable_info
SELECT * FROM t1 ORDER BY sum;
--disable_info
@ -150,7 +139,6 @@ SELECT * FROM t1 ORDER BY sum;
connection master;
# Modify the UDFs to add a comment
--echo "Running on the master"
--enable_info
ALTER FUNCTION myfuncsql_int COMMENT "This was altered.";
ALTER FUNCTION myfuncsql_double COMMENT "This was altered.";
@ -160,7 +148,6 @@ SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'te
sync_slave_with_master;
# Check to see if data was replicated
--echo "Running on the slave"
--enable_info
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
@ -172,7 +159,6 @@ SELECT myfuncsql_double(75.00);
connection master;
# Drop the functions
--echo "Running on the master"
--enable_info
DROP FUNCTION myfuncsql_double;
DROP FUNCTION myfuncsql_int;
@ -182,7 +168,6 @@ SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'te
sync_slave_with_master;
# Check to see if the UDFs were dropped on the slave
--echo "Running on the slave"
--enable_info
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
--disable_info
@ -190,7 +175,6 @@ SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'te
connection master;
# Cleanup
--echo "Running on the master"
--enable_info
DROP TABLE t1;
--disable_info

View File

@ -1,9 +1,15 @@
FLUSH STATUS;
connect con1,localhost,root,,;
disconnect con1;
connection default;
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='aborted_clients';
VARIABLE_VALUE
0
connect con2,localhost,root,,;
KILL CONNECTION_ID();
ERROR 70100: Connection was killed
disconnect con2;
connection default;
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='aborted_clients';
VARIABLE_VALUE
1

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,8 @@
drop table if exists t1, t2;
set debug_sync='RESET';
connect addconroot, localhost, root,,;
connect addconroot2, localhost, root,,;
connection default;
create table t1 (n1 int, n2 int, n3 int,
key (n1, n2, n3),
key (n2, n3, n1),
@ -10,10 +13,15 @@ insert into t1 values (1, 2, 3);
reset master;
set debug_sync='alter_table_enable_indexes SIGNAL parked WAIT_FOR go';
alter table t1 enable keys;;
connection addconroot;
set debug_sync='now WAIT_FOR parked';
insert into t2 values (1);
insert into t1 values (1, 1, 1);;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot;
connection default;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
@ -25,36 +33,60 @@ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; insert into t1 values (1, 1, 1)
master-bin.000001 # Query # # COMMIT
drop tables t1, t2;
disconnect addconroot;
disconnect addconroot2;
set debug_sync='RESET';
End of 5.0 tests
drop table if exists t1, t2, t3;
connect addconroot, localhost, root,,;
connect addconroot2, localhost, root,,;
connection default;
create table t1 (i int);
reset master;
set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go';
alter table t1 change i c char(10) default 'Test1';;
connection addconroot;
set debug_sync='now WAIT_FOR parked';
insert into t1 values ();;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot;
connection default;
select * from t1;
c
Test1
set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go';
alter table t1 change c vc varchar(100) default 'Test2';;
connection addconroot;
set debug_sync='now WAIT_FOR parked';
rename table t1 to t2;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot;
connection default;
drop table t2;
create table t1 (i int);
set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go';
alter table t1 change i c char(10) default 'Test3', rename to t2;;
connection addconroot;
set debug_sync='now WAIT_FOR parked';
insert into t2 values();;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot;
connection default;
select * from t2;
c
Test3
alter table t2 change c vc varchar(100) default 'Test2', rename to t1;;
connection addconroot;
connection default;
rename table t1 to t3;
disconnect addconroot;
disconnect addconroot2;
drop table t3;
set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go';
set debug_sync='RESET';

View File

@ -1681,16 +1681,17 @@ CREATE TABLE t1(a INT PRIMARY KEY, b INT);
INSERT INTO t1 VALUES (1,1), (2,2);
START TRANSACTION;
INSERT INTO t1 VALUES (3,3);
# Connection con1
connect con1, localhost, root;
# Sending:
ALTER TABLE t1 DISABLE KEYS;
# Connection default
connection default;
# Waiting until ALTER TABLE is blocked.
UPDATE t1 SET b = 4;
COMMIT;
# Connection con1
connection con1;
# Reaping: ALTER TABLE t1 DISABLE KEYS
# Connection default
disconnect con1;
connection default;
DROP TABLE t1;
#
# 7: Which operations require copy and which can be done in-place?

View File

@ -242,6 +242,8 @@ insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
select database();
database()
test
connect con1,localhost,root,,*NO-ONE*;
connection con1;
select database();
database()
NULL
@ -265,6 +267,8 @@ ANALYZE
}
}
}
disconnect con1;
connection default;
drop table t1;
#
# MDEV-7812: ANALYZE FORMAT=JSON UPDATE/DELETE doesnt print

View File

@ -1,12 +1,17 @@
create table t1 (f int, key(f)) engine=myisam;
set global kc1.key_buffer_size = 65536;
connect con1, localhost, root;
set debug_sync='assign_key_cache_op_unlock wait_for op_locked';
cache index t1 in kc1;
connection default;
set debug_sync='assign_key_cache_op_lock signal op_locked wait_for assigned';
cache index t1 in kc1;
connection con1;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK
set debug_sync='now signal assigned';
disconnect con1;
connection default;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK
drop table t1;

View File

@ -1,8 +1,11 @@
INSTALL SONAME 'auth_named_pipe';
CREATE USER 'USERNAME' IDENTIFIED WITH named_pipe;
connect pipe_con,localhost,$USERNAME,,,,,PIPE;
SELECT USER(),CURRENT_USER();
USER() CURRENT_USER()
USERNAME@localhost USERNAME@%
disconnect pipe_con;
connection default;
DROP USER 'USERNAME';
CREATE USER nosuchuser IDENTIFIED WITH named_pipe;
ERROR 28000: Access denied for user 'nosuchuser'@'localhost'

View File

@ -1,16 +1,18 @@
include/master-slave.inc
[connection master]
[connection slave]
connection slave;
include/stop_slave.inc
[connection master]
connection master;
CREATE USER 'plug_user' IDENTIFIED WITH 'test_plugin_server' AS 'plug_user';
GRANT REPLICATION SLAVE ON *.* TO plug_user;
FLUSH PRIVILEGES;
[connection slave]
connection slave;
CHANGE MASTER TO
MASTER_USER= 'plug_user',
MASTER_PASSWORD= 'plug_user';
include/start_slave.inc
connection master;
connection slave;
# Slave in-sync with master now.
SELECT user, plugin, authentication_string FROM mysql.user WHERE user LIKE 'plug_user';
user plugin authentication_string
@ -20,5 +22,6 @@ include/stop_slave.inc
CHANGE MASTER TO MASTER_USER='root';
DROP USER 'plug_user';
# Cleanup (on master).
connection master;
DROP USER 'plug_user';
include/rpl_end.inc

View File

@ -8,25 +8,30 @@ INSERT INTO t1 VALUES (13,0),(8,1),(9,2),(6,3),
(12,13),(7,14);
INSERT INTO t2 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),
(11),(12),(13),(14);
# in thread1
connect thread1, localhost, root,,;
connect thread2, localhost, root,,;
connection thread1;
START TRANSACTION;
# in thread2
connection thread2;
REPLACE INTO t2 VALUES (-17);
SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE;
d
# in thread1
connection thread1;
REPLACE INTO t1(a,b) VALUES (67,20);
# in thread2
connection thread2;
COMMIT;
START TRANSACTION;
REPLACE INTO t1(a,b) VALUES (65,-50);
REPLACE INTO t2 VALUES (-91);
SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE;
# in thread1
connection thread1;
# should not crash
SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
# in thread2
connection thread2;
d
# in thread1;
disconnect thread2;
connection thread1;
disconnect thread1;
connection default;
DROP TABLE t1,t2;

View File

@ -5,6 +5,8 @@ CREATE USER user1@localhost;
CREATE DATABASE db1;
GRANT ALL PRIVILEGES ON db1.* TO user1@localhost;
CREATE TABLE db1.t1(a INT);
connect con1,localhost,user1,,;
connection con1;
SELECT CURRENT_USER();
CURRENT_USER()
user1@localhost
@ -13,5 +15,7 @@ Variable_name Value
read_only ON
INSERT INTO db1.t1 VALUES (1);
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
connection default;
disconnect con1;
DROP DATABASE db1;
DROP USER user1@localhost;

View File

@ -131,9 +131,10 @@ select t1.* from t1, t2, t3 where t3.state & 1 = 0 and t3.t1_id = t1.id and t3.t
id a
1 me
drop table t3,t2,t1;
connect connection1,localhost,root,,;
SET SESSION STORAGE_ENGINE = InnoDB;
SET @@autocommit=1;
connection default
connection default;
SHOW VARIABLES LIKE 'have_query_cache';
Variable_name Value
have_query_cache YES
@ -155,7 +156,7 @@ count(*)
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
connection connection1
connection connection1;
START TRANSACTION;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
@ -171,7 +172,7 @@ count(*)
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
connection default
connection default;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
1
@ -185,7 +186,7 @@ count(*)
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
connection connection1
connection connection1;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
2
@ -197,7 +198,7 @@ INSERT INTO t2 VALUES (6,'w');
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
3
connection default
connection default;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
2
@ -210,7 +211,7 @@ SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
1
COMMIT;
connection connection1
connection connection1;
COMMIT;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
@ -221,6 +222,8 @@ Qcache_queries_in_cache 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 1
disconnect connection1;
connection default;
set @@global.query_cache_size = @save_query_cache_size;
drop table t2;
SET global query_cache_type=default;

View File

@ -713,6 +713,7 @@ DROP TABLE t1;
SET @@GLOBAL.max_allowed_packet=2048;
Warnings:
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
connect newconn, localhost, root,,;
SELECT CONVERT('a', BINARY(2049));
CONVERT('a', BINARY(2049))
a
@ -728,6 +729,8 @@ length(CONVERT(repeat('a',2048), CHAR(2049)))
2048
Warnings:
Warning 1301 Result of cast_as_char() was larger than max_allowed_packet (2048) - truncated
connection default;
disconnect newconn;
SET @@GLOBAL.max_allowed_packet=default;
#
# Bug#13519724 63793: CRASH IN DTCOLLATION::SET(DTCOLLATION &SET)

View File

@ -1,6 +1,10 @@
connect test,localhost,root,,;
connection test;
ERROR 28000: Access denied for user 'foo'@'localhost' (using password: YES)
ERROR 28000: Access denied for user 'foo'@'localhost' (using password: NO)
ERROR 28000: Access denied for user 'foo'@'localhost' (using password: YES)
ERROR 08S01: Unknown command
ERROR 08S01: Unknown command
disconnect test;
connection default;
that's all

View File

@ -1,3 +1,6 @@
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
drop table if exists t1,t2;
drop view if exists v1;
create table t1(n int not null, key(n), key(n), key(n), key(n));
@ -6,9 +9,14 @@ Note 1831 Duplicate index 'n_2' defined on the table 'test.t1'. This is deprecat
Note 1831 Duplicate index 'n_3' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
Note 1831 Duplicate index 'n_4' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
check table t1 extended;
connection con2;
insert into t1 values (200000);
connection con1;
Table Op Msg_type Msg_text
test.t1 check status OK
connection default;
disconnect con1;
disconnect con2;
drop table t1;
Create table t1(f1 int);
Create table t2(f1 int);
@ -34,12 +42,13 @@ DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT);
LOCK TABLE t1 WRITE;
# Connection con1
connect con1, localhost, root;
SET lock_wait_timeout= 1;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check Error Lock wait timeout exceeded; try restarting transaction
test.t1 check status Operation failed
# Connection default
connection default;
UNLOCK TABLES;
DROP TABLE t1;
disconnect con1;

View File

@ -1,3 +1,4 @@
connect con1,localhost,root,,;
#
# Bug#20837 Apparent change of isolation level
# during transaction
@ -43,11 +44,11 @@ s1
2
-1
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
connection con1
connection con1;
START TRANSACTION;
INSERT INTO t1 VALUES (1000);
COMMIT;
connection default
connection default;
We should not be able to read the '1000'
SELECT * FROM t1;
s1
@ -65,23 +66,23 @@ s1
1000
COMMIT;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
connection default
connection default;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
START TRANSACTION;
connection con1
connection con1;
START TRANSACTION;
INSERT INTO t1 VALUES (1001);
COMMIT;
connection default
connection default;
SELECT COUNT(*) FROM t1 WHERE s1 = 1001;
COUNT(*)
1
Should be 1
COMMIT AND CHAIN;
connection con1
connection con1;
INSERT INTO t1 VALUES (1002);
COMMIT;
connection default
connection default;
SELECT COUNT(*) FROM t1 WHERE s1 = 1002;
COUNT(*)
1
@ -97,23 +98,23 @@ s1
1002
DELETE FROM t1 WHERE s1 >= 1000;
COMMIT;
connection default
connection default;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
START TRANSACTION;
connection con1
connection con1;
START TRANSACTION;
INSERT INTO t1 VALUES (1001);
COMMIT;
connection default
connection default;
SELECT COUNT(*) FROM t1 WHERE s1 = 1001;
COUNT(*)
1
Should be 1
ROLLBACK AND CHAIN;
connection con1
connection con1;
INSERT INTO t1 VALUES (1002);
COMMIT;
connection default
connection default;
SELECT COUNT(*) FROM t1 WHERE s1 = 1002;
COUNT(*)
1
@ -129,33 +130,33 @@ s1
DELETE FROM t1 WHERE s1 >= 1000;
COMMIT;
SET @@completion_type=1;
connection default
connection default;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
START TRANSACTION;
connection con1
connection con1;
START TRANSACTION;
INSERT INTO t1 VALUES (1001);
COMMIT;
connection default
connection default;
SELECT * FROM t1 WHERE s1 >= 1000;
s1
1001
Should see 1001
COMMIT AND NO CHAIN;
default transaction is now in REPEATABLE READ
connection con1
connection con1;
INSERT INTO t1 VALUES (1002);
COMMIT;
connection default
connection default;
SELECT * FROM t1 WHERE s1 >= 1000;
s1
1001
1002
Should see 1001 and 1002
connection con1
connection con1;
INSERT INTO t1 VALUES (1003);
COMMIT;
connection default
connection default;
SELECT * FROM t1 WHERE s1 >= 1000;
s1
1001
@ -174,35 +175,35 @@ DELETE FROM t1 WHERE s1 >= 1000;
COMMIT AND NO CHAIN;
SET @@completion_type=0;
COMMIT;
connection default
connection default;
SET @@completion_type=1;
COMMIT AND NO CHAIN;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
START TRANSACTION;
connection con1
connection con1;
START TRANSACTION;
INSERT INTO t1 VALUES (1001);
COMMIT;
connection default
connection default;
SELECT * FROM t1 WHERE s1 >= 1000;
s1
1001
Should see 1001
ROLLBACK AND NO CHAIN;
default transaction is now in REPEATABLE READ
connection con1
connection con1;
INSERT INTO t1 VALUES (1002);
COMMIT;
connection default
connection default;
SELECT * FROM t1 WHERE s1 >= 1000;
s1
1001
1002
Should see 1001 and 1002
connection con1
connection con1;
INSERT INTO t1 VALUES (1003);
COMMIT;
connection default
connection default;
SELECT * FROM t1 WHERE s1 >= 1000;
s1
1001
@ -221,7 +222,7 @@ DELETE FROM t1 WHERE s1 >= 1000;
COMMIT AND NO CHAIN;
SET @@completion_type=0;
COMMIT;
connection default
connection default;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
START TRANSACTION;
@ -230,10 +231,10 @@ s1
1
2
-1
connection con1
connection con1;
INSERT INTO t1 VALUES (1000);
COMMIT;
connection default
connection default;
SELECT * FROM t1;
s1
1
@ -253,10 +254,10 @@ SELECT * FROM t1;
s1
1000
Should read '1000'
connection con1
connection con1;
INSERT INTO t1 VALUES (1001);
COMMIT;
connection default
connection default;
SELECT * FROM t1;
s1
1000
@ -266,6 +267,7 @@ SET @@completion_type=0;
COMMIT AND NO CHAIN;
SET @@autocommit=1;
COMMIT;
disconnect con1;
DROP TABLE t1;
#
# End of test cases for Bug#20837

View File

@ -1,3 +1,4 @@
connect comp_con,localhost,root,,,,,COMPRESS;
SHOW STATUS LIKE 'Compression';
Variable_name Value
Compression ON
@ -2163,3 +2164,5 @@ drop table t1;
SHOW STATUS LIKE 'Compression';
Variable_name Value
Compression ON
connection default;
disconnect comp_con;

View File

@ -1,4 +1,5 @@
SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ;
connection default;
SET SQL_MODE="";
SELECT @@global.tx_isolation;
@@global.tx_isolation
@ -13,7 +14,8 @@ drop table if exists t1;
**
** two UPDATE's running and both changing distinct result sets
**
** connection thread1
connect thread1, localhost, mysqltest,,;
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@ -32,13 +34,14 @@ insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
select get_lock("hello",10);
get_lock("hello",10)
1
** connection thread2
connect thread2, localhost, mysqltest,,;
connection thread2;
** Start transaction for thread 2
begin;
** Update will cause a table scan and a new ULL will
** be created and blocked on the first row where tipo=11.
update t1 set eta=1+get_lock("hello",10)*0 where tipo=11;
** connection thread1
connection thread1;
** Start new transaction for thread 1
begin;
** Update on t1 will cause a table scan which will be blocked because
@ -65,7 +68,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
** Release the lock and collect result from update on thread 2
DO release_lock("hello");
** Table should have eta updates where tipo=11 but updates made by
@ -85,7 +88,7 @@ eta tipo c
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** Sending commit on thread 2.
commit;
** connection thread1
connection thread1;
** Make sure table reads didn't change yet on thread 1.
select * from t1;
eta tipo c
@ -117,7 +120,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
** Make sure the output is similar for t1.
select * from t1;
eta tipo c
@ -132,7 +135,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread1
connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -146,13 +149,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection default
connection default;
drop table t1;
**
** two UPDATE's running and one changing result set
**
** connection thread1
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@ -171,14 +174,14 @@ insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
select get_lock("hello",10);
get_lock("hello",10)
1
** connection thread2
connection thread2;
** Start transaction on thread 2
begin;
** Update will cause a table scan.
** This will cause a hang on the first row where tipo=1 until the
** blocking ULL is released.
update t1 set eta=1+get_lock("hello",10)*0 where tipo=1;
** connection thread1
connection thread1;
** Start transaction on thread 1
begin;
** Update on t1 will cause a table scan which will be blocked because
@ -204,7 +207,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
** Release the lock and collect result from thread 2:
DO release_lock("hello");
** Seen from thread 2 the table should have been updated on four
@ -223,7 +226,7 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
commit;
** connection thread1
connection thread1;
** Thread 2 has committed but the result should remain the same for
** thread 1 (updated on three places):
select * from t1;
@ -256,7 +259,7 @@ eta tipo c
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -270,7 +273,7 @@ eta tipo c
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread1
connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -284,13 +287,13 @@ eta tipo c
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection default
connection default;
drop table t1;
**
** One UPDATE and one INSERT .... Monty's test
**
** connection thread1
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1 (a int not null, b int not null);
@ -299,13 +302,13 @@ insert into t1 values (1,1),(2,1),(3,1),(4,1);
select get_lock("hello2",10);
get_lock("hello2",10)
1
** connection thread2
connection thread2;
** Begin a new transaction on thread 2
begin;
** Update will create a table scan which creates a ULL where a=2;
** this will hang waiting on thread 1.
update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2;
** connection thread1
connection thread1;
** Insert new values to t1 from thread 1; this created an implicit
** commit since there are no on-going transactions.
insert into t1 values (1,1);
@ -319,7 +322,7 @@ a b
3 1
4 1
1 1
** connection thread2
connection thread2;
** Collect results from thread 2 and release the lock.
DO release_lock("hello2");
** The table should look like the original+updates for thread 2,
@ -333,13 +336,13 @@ a b
1 1
** Commit changes from thread 2
commit;
** connection default
connection default;
drop table t1;
**
** one UPDATE changing result set and SELECT ... FOR UPDATE
**
** connection thread1
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@ -354,7 +357,7 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
** connection thread2
connection thread2;
** Begin a new transaction on thread 2
begin;
** Select a range for update.
@ -363,7 +366,7 @@ eta tipo c
20 2 ddddddddddddddddddddddddddddddddddddddddddd
40 2 fffffffffffffffffffffffffffffffffffffffffff
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
** connection thread1
connection thread1;
** Begin a new transaction on thread 1
begin;
** Update the same range which is marked for update on thread 2; this
@ -385,7 +388,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
** The table should look unmodified from thread 2.
select * from t1;
eta tipo c
@ -403,10 +406,10 @@ eta tipo c
** Sending a commit should release the row locks and enable
** thread 1 to complete the transaction.
commit;
** connection thread1
connection thread1;
** Commit on thread 1.
commit;
** connection thread2
connection thread2;
** The table should not have been changed.
select * from t1;
eta tipo c
@ -421,7 +424,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread1
connection thread1;
** Even on thread 1:
select * from t1;
eta tipo c
@ -436,13 +439,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection default
connection default;
drop table t1;
**
** one UPDATE not changing result set and SELECT ... FOR UPDATE
**
** connection thread1
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@ -457,7 +460,7 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
** connection thread2
connection thread2;
** Starting new transaction on thread 2.
begin;
** Starting SELECT .. FOR UPDATE
@ -466,7 +469,7 @@ eta tipo c
20 2 ddddddddddddddddddddddddddddddddddddddddddd
40 2 fffffffffffffffffffffffffffffffffffffffffff
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
** connection thread1
connection thread1;
** Starting new transaction on thread 1
begin;
@ -492,7 +495,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
** The same thing should hold true for the transaction on
** thread 2
select * from t1;
@ -509,9 +512,9 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
commit;
** connection thread1
connection thread1;
commit;
** connection thread2
connection thread2;
** Even after committing:
select * from t1;
eta tipo c
@ -526,7 +529,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread1
connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -540,13 +543,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection default
connection default;
drop table t1;
**
** two SELECT ... FOR UPDATE
**
** connection thread1
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@ -561,7 +564,7 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
** connection thread2
connection thread2;
** Begin a new transaction on thread 2
begin;
select * from t1 where tipo=2 FOR UPDATE;
@ -569,14 +572,14 @@ eta tipo c
20 2 ddddddddddddddddddddddddddddddddddddddddddd
40 2 fffffffffffffffffffffffffffffffffffffffffff
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
** connection thread1
connection thread1;
** Begin a new transaction on thread 1
begin;
** Selecting a range for update by table scan will be blocked
** because of on-going transaction on thread 2.
select * from t1 where tipo=1 FOR UPDATE;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
** connection thread2
connection thread2;
** Table will be unchanged and the select command will not be
** blocked:
select * from t1;
@ -594,10 +597,10 @@ eta tipo c
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** Commit transacton on thread 2.
commit;
** connection thread1
connection thread1;
** Commit transaction on thread 1.
commit;
** connection thread2
connection thread2;
** Make sure table isn't blocked on thread 2:
select * from t1;
eta tipo c
@ -612,7 +615,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread1
connection thread1;
** Make sure table isn't blocked on thread 1:
select * from t1;
eta tipo c
@ -627,13 +630,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection default
connection default;
drop table t1;
**
** one UPDATE changing result set and DELETE
**
** connection thread1
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@ -648,10 +651,10 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
** connection thread2
connection thread2;
begin;
delete from t1 where tipo=2;
** connection thread1
connection thread1;
begin;
update t1 set tipo=1 where tipo=2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
@ -668,7 +671,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -680,9 +683,9 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
commit;
** connection thread1
connection thread1;
commit;
** connection thread2
connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -693,7 +696,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread1
connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -704,13 +707,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection default
connection default;
drop table t1;
**
** one UPDATE not changing result set and DELETE
**
** connection thread1
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@ -725,10 +728,10 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
** connection thread2
connection thread2;
begin;
delete from t1 where tipo=2;
** connection thread1
connection thread1;
begin;
** Update on t1 will cause a table scan which will be blocked because
** the previously initiated table scan applied exclusive key locks on
@ -750,7 +753,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -762,9 +765,9 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
commit;
** connection thread1
connection thread1;
commit;
** connection thread2
connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -775,7 +778,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread1
connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -787,8 +790,11 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** Cleanup
** connection thread2
** connection default
connection thread1;
disconnect thread1;
connection thread2;
disconnect thread2;
connection default;
drop table t1;
drop user mysqltest@localhost;
SET SQL_MODE=default;

View File

@ -1,4 +1,5 @@
SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ;
connection default;
SET SQL_MODE="";
SELECT @@global.tx_isolation;
@@global.tx_isolation
@ -13,7 +14,8 @@ drop table if exists t1;
**
** two UPDATE's running and both changing distinct result sets
**
** connection thread1
connect thread1, localhost, mysqltest,,;
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@ -32,13 +34,14 @@ insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
select get_lock("hello",10);
get_lock("hello",10)
1
** connection thread2
connect thread2, localhost, mysqltest,,;
connection thread2;
** Start transaction for thread 2
begin;
** Update will cause a table scan and a new ULL will
** be created and blocked on the first row where tipo=11.
update t1 set eta=1+get_lock("hello",10)*0 where tipo=11;
** connection thread1
connection thread1;
** Start new transaction for thread 1
begin;
** Update on t1 will cause a table scan which will be blocked because
@ -64,7 +67,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
** Release the lock and collect result from update on thread 2
DO release_lock("hello");
** Table should have eta updates where tipo=11 but updates made by
@ -84,7 +87,7 @@ eta tipo c
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** Sending commit on thread 2.
commit;
** connection thread1
connection thread1;
** Make sure table reads didn't change yet on thread 1.
select * from t1;
eta tipo c
@ -116,7 +119,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
** Make sure the output is similar for t1.
select * from t1;
eta tipo c
@ -131,7 +134,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread1
connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -145,13 +148,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection default
connection default;
drop table t1;
**
** two UPDATE's running and one changing result set
**
** connection thread1
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@ -170,14 +173,14 @@ insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
select get_lock("hello",10);
get_lock("hello",10)
1
** connection thread2
connection thread2;
** Start transaction on thread 2
begin;
** Update will cause a table scan.
** This will cause a hang on the first row where tipo=1 until the
** blocking ULL is released.
update t1 set eta=1+get_lock("hello",10)*0 where tipo=1;
** connection thread1
connection thread1;
** Start transaction on thread 1
begin;
** Update on t1 will cause a table scan which will be blocked because
@ -202,7 +205,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
** Release the lock and collect result from thread 2:
DO release_lock("hello");
** Seen from thread 2 the table should have been updated on four
@ -221,7 +224,7 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
commit;
** connection thread1
connection thread1;
** Thread 2 has committed but the result should remain the same for
** thread 1 (updated on three places):
select * from t1;
@ -254,7 +257,7 @@ eta tipo c
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -268,7 +271,7 @@ eta tipo c
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread1
connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -282,13 +285,13 @@ eta tipo c
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection default
connection default;
drop table t1;
**
** One UPDATE and one INSERT .... Monty's test
**
** connection thread1
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1 (a int not null, b int not null);
@ -297,13 +300,13 @@ insert into t1 values (1,1),(2,1),(3,1),(4,1);
select get_lock("hello2",10);
get_lock("hello2",10)
1
** connection thread2
connection thread2;
** Begin a new transaction on thread 2
begin;
** Update will create a table scan which creates a ULL where a=2;
** this will hang waiting on thread 1.
update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2;
** connection thread1
connection thread1;
** Insert new values to t1 from thread 1; this created an implicit
** commit since there are no on-going transactions.
insert into t1 values (1,1);
@ -317,7 +320,7 @@ a b
3 1
4 1
1 1
** connection thread2
connection thread2;
** Collect results from thread 2 and release the lock.
DO release_lock("hello2");
** The table should look like the original+updates for thread 2,
@ -331,13 +334,13 @@ a b
1 1
** Commit changes from thread 2
commit;
** connection default
connection default;
drop table t1;
**
** one UPDATE changing result set and SELECT ... FOR UPDATE
**
** connection thread1
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@ -352,7 +355,7 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
** connection thread2
connection thread2;
** Begin a new transaction on thread 2
begin;
** Select a range for update.
@ -361,7 +364,7 @@ eta tipo c
20 2 ddddddddddddddddddddddddddddddddddddddddddd
40 2 fffffffffffffffffffffffffffffffffffffffffff
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
** connection thread1
connection thread1;
** Begin a new transaction on thread 1
begin;
** Update the same range which is marked for update on thread 2; this
@ -383,7 +386,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
** The table should look unmodified from thread 2.
select * from t1;
eta tipo c
@ -401,10 +404,10 @@ eta tipo c
** Sending a commit should release the row locks and enable
** thread 1 to complete the transaction.
commit;
** connection thread1
connection thread1;
** Commit on thread 1.
commit;
** connection thread2
connection thread2;
** The table should not have been changed.
select * from t1;
eta tipo c
@ -419,7 +422,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread1
connection thread1;
** Even on thread 1:
select * from t1;
eta tipo c
@ -434,13 +437,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection default
connection default;
drop table t1;
**
** one UPDATE not changing result set and SELECT ... FOR UPDATE
**
** connection thread1
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@ -455,7 +458,7 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
** connection thread2
connection thread2;
** Starting new transaction on thread 2.
begin;
** Starting SELECT .. FOR UPDATE
@ -464,7 +467,7 @@ eta tipo c
20 2 ddddddddddddddddddddddddddddddddddddddddddd
40 2 fffffffffffffffffffffffffffffffffffffffffff
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
** connection thread1
connection thread1;
** Starting new transaction on thread 1
begin;
@ -489,7 +492,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 11 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
** The same thing should hold true for the transaction on
** thread 2
select * from t1;
@ -506,9 +509,9 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
commit;
** connection thread1
connection thread1;
commit;
** connection thread2
connection thread2;
** Even after committing:
select * from t1;
eta tipo c
@ -523,7 +526,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 11 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread1
connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -537,13 +540,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 11 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection default
connection default;
drop table t1;
**
** two SELECT ... FOR UPDATE
**
** connection thread1
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@ -558,7 +561,7 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
** connection thread2
connection thread2;
** Begin a new transaction on thread 2
begin;
select * from t1 where tipo=2 FOR UPDATE;
@ -566,14 +569,14 @@ eta tipo c
20 2 ddddddddddddddddddddddddddddddddddddddddddd
40 2 fffffffffffffffffffffffffffffffffffffffffff
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
** connection thread1
connection thread1;
** Begin a new transaction on thread 1
begin;
** Selecting a range for update by table scan will be blocked
** because of on-going transaction on thread 2.
select * from t1 where tipo=1 FOR UPDATE;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
** connection thread2
connection thread2;
** Table will be unchanged and the select command will not be
** blocked:
select * from t1;
@ -591,10 +594,10 @@ eta tipo c
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** Commit transacton on thread 2.
commit;
** connection thread1
connection thread1;
** Commit transaction on thread 1.
commit;
** connection thread2
connection thread2;
** Make sure table isn't blocked on thread 2:
select * from t1;
eta tipo c
@ -609,7 +612,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread1
connection thread1;
** Make sure table isn't blocked on thread 1:
select * from t1;
eta tipo c
@ -624,13 +627,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection default
connection default;
drop table t1;
**
** one UPDATE changing result set and DELETE
**
** connection thread1
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@ -645,10 +648,10 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
** connection thread2
connection thread2;
begin;
delete from t1 where tipo=2;
** connection thread1
connection thread1;
begin;
update t1 set tipo=1 where tipo=2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
@ -665,7 +668,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -677,9 +680,9 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
commit;
** connection thread1
connection thread1;
commit;
** connection thread2
connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -690,7 +693,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread1
connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -701,13 +704,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection default
connection default;
drop table t1;
**
** one UPDATE not changing result set and DELETE
**
** connection thread1
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@ -722,10 +725,10 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
** connection thread2
connection thread2;
begin;
delete from t1 where tipo=2;
** connection thread1
connection thread1;
begin;
** Update on t1 will cause a table scan which will be blocked because
** the previously initiated table scan applied exclusive key locks on
@ -746,7 +749,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 1 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -758,9 +761,9 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
commit;
** connection thread1
connection thread1;
commit;
** connection thread2
connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -771,7 +774,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 1 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread1
connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -783,8 +786,11 @@ eta tipo c
80 1 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** Cleanup
** connection thread2
** connection default
connection thread1;
disconnect thread1;
connection thread2;
disconnect thread2;
connection default;
drop table t1;
drop user mysqltest@localhost;
SET SQL_MODE=default;

View File

@ -1,5 +1,6 @@
SET global secure_auth=0;
drop table if exists t1,t2;
connect con1,localhost,root,,mysql;
show tables;
Tables_in_mysql
column_stats
@ -32,14 +33,21 @@ time_zone_name
time_zone_transition
time_zone_transition_type
user
connect con2,localhost,root,,test;
show tables;
Tables_in_test
connect(localhost,root,z,test2,MASTER_PORT,MASTER_SOCKET);
connect fail_con,localhost,root,z,test2;
ERROR 28000: Access denied for user 'root'@'localhost' (using password: YES)
connect(localhost,root,z,test,MASTER_PORT,MASTER_SOCKET);
connect fail_con,localhost,root,z,;
ERROR 28000: Access denied for user 'root'@'localhost' (using password: YES)
connection default;
disconnect con1;
disconnect con2;
grant ALL on *.* to test@localhost identified by "gambling";
grant ALL on *.* to test@127.0.0.1 identified by "gambling";
connect con3,localhost,test,gambling,mysql;
show tables;
Tables_in_mysql
column_stats
@ -72,18 +80,29 @@ time_zone_name
time_zone_transition
time_zone_transition_type
user
connect con4,localhost,test,gambling,test;
show tables;
Tables_in_test
connection default;
disconnect con3;
disconnect con4;
connect(localhost,test,,test2,MASTER_PORT,MASTER_SOCKET);
connect fail_con,localhost,test,,test2;
ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
connect(localhost,test,,"",MASTER_PORT,MASTER_SOCKET);
connect fail_con,localhost,test,,'""';
ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
connect(localhost,test,zorro,test2,MASTER_PORT,MASTER_SOCKET);
connect fail_con,localhost,test,zorro,test2;
ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
connect(localhost,test,zorro,test,MASTER_PORT,MASTER_SOCKET);
connect fail_con,localhost,test,zorro,;
ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
update mysql.user set password=old_password("gambling2") where user=_binary"test";
flush privileges;
connect con10,localhost,test,gambling2,;
connect con5,localhost,test,gambling2,mysql;
connection con5;
set password="";
set password='gambling3';
ERROR HY000: Password hash should be a 41-digit hexadecimal number
@ -120,22 +139,35 @@ time_zone_name
time_zone_transition
time_zone_transition_type
user
connect con6,localhost,test,gambling3,test;
show tables;
Tables_in_test
connection default;
disconnect con10;
disconnect con5;
disconnect con6;
connect(localhost,test,,test2,MASTER_PORT,MASTER_SOCKET);
connect fail_con,localhost,test,,test2;
ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
connect(localhost,test,,test,MASTER_PORT,MASTER_SOCKET);
connect fail_con,localhost,test,,;
ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
connect(localhost,test,zorro,test2,MASTER_PORT,MASTER_SOCKET);
connect fail_con,localhost,test,zorro,test2;
ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
connect(localhost,test,zorro,test,MASTER_PORT,MASTER_SOCKET);
connect fail_con,localhost,test,zorro,;
ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
delete from mysql.user where user=_binary"test";
flush privileges;
connect con7,localhost,root,,test;
connection con7;
create table t1 (id integer not null auto_increment primary key);
create temporary table t2(id integer not null auto_increment primary key);
set @id := 1;
delete from t1 where id like @id;
connection default;
disconnect con7;
drop table t1;
# ------------------------------------------------------------------
# -- End of 4.1 tests
@ -153,6 +185,7 @@ SET GLOBAL event_scheduler = ON;
# -- Waiting for Event Scheduler to start...
# -- Disconnecting default connection...
disconnect default;
# -- Check that we allow exactly three user connections, no matter how
# -- many threads are running.
@ -202,8 +235,13 @@ SET GLOBAL event_scheduler = OFF;
# -- Waiting for Event Scheduler to stop...
# -- That's it. Closing connections...
disconnect con_1;
disconnect con_2;
disconnect con_3;
disconnect con_super_1;
# -- Restoring default connection...
connect default,localhost,root,,test;
# -- Waiting for connections to close...
@ -224,6 +262,7 @@ SET GLOBAL event_scheduler = ON;
# -- Waiting for Event Scheduler to start...
# -- Opening a new connection to check max_used_connections...
connect con_1,localhost,root;
# -- Check that max_used_connections hasn't changed.
SHOW STATUS LIKE 'max_used_connections';
@ -231,6 +270,8 @@ Variable_name Value
Max_used_connections 2
# -- Closing new connection...
disconnect con_1;
connection default;
# -- Stopping Event Scheduler...
SET GLOBAL event_scheduler = OFF;
@ -238,9 +279,13 @@ SET GLOBAL event_scheduler = OFF;
# -- End of Bug#35074.
connect extracon,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,;
connection extracon;
SELECT 'Connection on extra port ok';
Connection on extra port ok
Connection on extra port ok
connect extracon2,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,;
connection extracon2;
SELECT 'Connection on extra port 2 ok';
Connection on extra port 2 ok
Connection on extra port 2 ok
@ -251,6 +296,9 @@ Connection on extra port 2 ok
#
GRANT ALL ON test.* TO 'O1234567890123456789012345678901234567890123456789012345678901234567890123456789'@'localhost' IDENTIFIED BY 'test123';
FLUSH PRIVILEGES;
connect con1,localhost,O1234567890123456789012345678901234567890123456789012345678901234567890123456789x,test123,test;
disconnect con1;
connection default;
DROP USER 'O1234567890123456789012345678901234567890123456789012345678901234567890123456789'@'localhost';
FLUSH PRIVILEGES;
#
@ -259,22 +307,36 @@ FLUSH PRIVILEGES;
# ------------------------------------------------------------------
# -- End of 5.1 tests
# ------------------------------------------------------------------
disconnect extracon;
disconnect extracon2;
connection default;
CREATE USER mysqltest_up1 IDENTIFIED VIA mysql_native_password using '*E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB';
CREATE USER mysqltest_up2 IDENTIFIED VIA mysql_old_password using '09301740536db389';
connect(localhost,mysqltest_up1,foo,test,MASTER_PORT,MASTER_SOCKET);
connect pcon1,localhost,mysqltest_up1,foo,,$MASTER_MYPORT,;
ERROR 28000: Access denied for user 'mysqltest_up1'@'localhost' (using password: YES)
connect pcon2,localhost,mysqltest_up1,bar,,$MASTER_MYPORT,;
connection pcon2;
select user(), current_user();
user() current_user()
mysqltest_up1@localhost mysqltest_up1@%
disconnect pcon2;
connect(localhost,mysqltest_up2,newpw,test,MASTER_PORT,MASTER_SOCKET);
connect pcon3,localhost,mysqltest_up2,newpw,,$MASTER_MYPORT,;
ERROR 28000: Access denied for user 'mysqltest_up2'@'localhost' (using password: YES)
connect pcon4,localhost,mysqltest_up2,oldpw,,$MASTER_MYPORT,;
connection pcon4;
select user(), current_user();
user() current_user()
mysqltest_up2@localhost mysqltest_up2@%
disconnect pcon4;
connect(localhost,mysqltest_nouser,newpw,test,MASTER_PORT,MASTER_SOCKET);
connect pcon5,localhost,mysqltest_nouser,newpw,,$MASTER_MYPORT,;
ERROR 28000: Access denied for user 'mysqltest_nouser'@'localhost' (using password: YES)
connect(localhost,mysqltest_nouser,,test,MASTER_PORT,MASTER_SOCKET);
connect pcon5,localhost,mysqltest_nouser,,,$MASTER_MYPORT,;
ERROR 28000: Access denied for user 'mysqltest_nouser'@'localhost' (using password: NO)
connection default;
update mysql.user set plugin='mysql_native_password' where user = 'mysqltest_up1';
update mysql.user set plugin='mysql_old_password' where user = 'mysqltest_up2';
select user, password, plugin, authentication_string from mysql.user
@ -283,12 +345,19 @@ user password plugin authentication_string
mysqltest_up1 *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB mysql_native_password
mysqltest_up2 09301740536db389 mysql_old_password
flush privileges;
connect pcon6,localhost,mysqltest_up1,bar,,$MASTER_MYPORT,;
connection pcon6;
select user(), current_user();
user() current_user()
mysqltest_up1@localhost mysqltest_up1@%
disconnect pcon6;
connect pcon7,localhost,mysqltest_up2,oldpw,,$MASTER_MYPORT,;
connection pcon7;
select user(), current_user();
user() current_user()
mysqltest_up2@localhost mysqltest_up2@%
disconnect pcon7;
connection default;
DROP USER mysqltest_up1@'%';
DROP USER mysqltest_up2@'%';
#

View File

@ -1,44 +1,70 @@
call mtr.add_suppression("Allocation failed");
SET @old_debug= @@session.debug;
set @old_thread_cache_size=@@global.thread_cache_size;
connect con1,localhost,root,,test,,;
select 1;
1
1
disconnect con1;
connection default;
set global debug_dbug='+d,simulate_failed_connection_1';
connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET);
connect con1,localhost,root,,test,,;
Got one of the listed errors
connection default;
set global debug_dbug=@old_debug;
set global debug_dbug='+d,simulate_failed_connection_2';
connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET);
connect con1,localhost,root,,test,,;
Got one of the listed errors
connection default;
set global debug_dbug=@old_debug;
connect con1,localhost,root,,test,,;
select 1;
1
1
disconnect con1;
connect con1,localhost,root,,test,$MASTER_EXTRA_PORT,;
select 1;
1
1
disconnect con1;
connection default;
set global debug_dbug='+d,simulate_failed_connection_1';
connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET);
connect con1,localhost,root,,test,$MASTER_EXTRA_PORT,;
Got one of the listed errors
connection default;
set global debug_dbug=@old_debug;
set global debug_dbug='+d,simulate_failed_connection_2';
connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET);
connect con1,localhost,root,,test,$MASTER_EXTRA_PORT,;
Got one of the listed errors
connection default;
set global debug_dbug=@old_debug;
connect con1,localhost,root,,test,$MASTER_EXTRA_PORT,;
select 1;
1
1
disconnect con1;
connection default;
set @@global.thread_cache_size=2;
connect con1,localhost,root,,test,$MASTER_EXTRA_PORT,;
select 1;
1
1
connect con2,localhost,root,,test,$MASTER_EXTRA_PORT,;
select 1;
1
1
disconnect con1;
disconnect con2;
connection default;
set global debug_dbug='+d,simulate_failed_connection_2';
connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET);
connect con1,localhost,root,,test,$MASTER_EXTRA_PORT,;
Got one of the listed errors
connection default;
show status like "Threads_connected";
Variable_name Value
Threads_connected 1

View File

@ -1,15 +1,15 @@
DROP TABLE IF EXISTS t1;
# Establish connection con1 (user=root)
# Establish connection con2 (user=root)
connect con1,localhost,root,,;
connect con2,localhost,root,,;
### Test 1:
### - While a consistent snapshot transaction is executed,
### no external inserts should be visible to the transaction.
# Switch to connection con1
connection con1;
CREATE TABLE t1 (a INT) ENGINE=innodb;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
# Switch to connection con2
connection con2;
INSERT INTO t1 VALUES(1);
# Switch to connection con1
connection con1;
SELECT * FROM t1;
a
COMMIT;
@ -18,9 +18,9 @@ COMMIT;
### committed inserts should be visible to the transaction.
DELETE FROM t1;
START TRANSACTION;
# Switch to connection con2
connection con2;
INSERT INTO t1 VALUES(1);
# Switch to connection con1
connection con1;
SELECT * FROM t1;
a
1
@ -31,12 +31,14 @@ COMMIT;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
DELETE FROM t1;
COMMIT WORK AND CHAIN;
# Switch to connection con2
connection con2;
INSERT INTO t1 VALUES(1);
# Switch to connection con1
connection con1;
SELECT * FROM t1;
a
1
COMMIT;
# Switch to connection default + close connections con1 and con2
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t1;

View File

@ -1,11 +1,20 @@
connect addconroot1, localhost, root,,;
connect addconroot2, localhost, root,,;
connect addconroot3, localhost, root,,;
connection default;
drop table if exists t1,t2,t3,t4,t5;
set debug_sync='RESET';
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
create table t1 (j char(5));;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
ERROR 42S01: Table 't1' already exists
connection default;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@ -14,10 +23,15 @@ t1 CREATE TABLE `t1` (
drop table t1;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
create table t1 select 'Test' as j;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
ERROR 42S01: Table 't1' already exists
connection default;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@ -27,10 +41,15 @@ drop table t1;
create table t3 (j char(5));
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
create table t1 like t3;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
ERROR 42S01: Table 't1' already exists
connection default;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@ -39,10 +58,15 @@ t1 CREATE TABLE `t1` (
drop table t1;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
rename table t3 to t1;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
ERROR 42S01: Table 't1' already exists
connection default;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@ -51,10 +75,15 @@ t1 CREATE TABLE `t1` (
drop table t1;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
alter table t3 rename to t1;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
ERROR 42S01: Table 't1' already exists
connection default;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@ -63,10 +92,15 @@ t1 CREATE TABLE `t1` (
drop table t1;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
alter table t3 rename to t1, add k int;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
ERROR 42S01: Table 't1' already exists
connection default;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@ -74,30 +108,51 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1,t3;
set debug_sync='create_table_select_before_open SIGNAL parked WAIT_FOR go';
connection default;
set debug_sync='create_table_select_before_open SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
drop table t1;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
connection default;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
rename table t1 to t2;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
connection default;
drop table t2;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
select * from t1;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
i
1
connection default;
drop table t1;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
insert into t1 values (2);;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
connection default;
select * from t1;
i
1
@ -106,37 +161,62 @@ drop table t1;
set @a:=0;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
create trigger t1_bi before insert on t1 for each row set @a:=1;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
connection default;
select @a;
@a
0
drop table t1;
set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
drop table t1;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
connection default;
set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
rename table t1 to t2;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
connection default;
drop table t2;
set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
select * from t1;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
i
1
connection default;
drop table t1;
set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
insert into t1 values (2);;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
connection default;
select * from t1;
i
1
@ -145,27 +225,42 @@ drop table t1;
set @a:=0;
set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
create trigger t1_bi before insert on t1 for each row set @a:=1;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
connection default;
select @a;
@a
0
drop table t1;
set debug_sync='create_table_select_before_check_if_exists SIGNAL parked WAIT_FOR go';
create table if not exists t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
drop table t1;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
connection default;
create table t1 (i int);
set @a:=0;
set debug_sync='create_table_select_before_check_if_exists SIGNAL parked WAIT_FOR go';
create table if not exists t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
create trigger t1_bi before insert on t1 for each row set @a:=1;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
Warnings:
Note 1050 Table 't1' already exists
connection addconroot1;
connection default;
select @a;
@a
0
@ -178,10 +273,15 @@ create table t1 (i int);
set debug_sync='create_table_like_after_open SIGNAL parked WAIT_FOR go';
reset master;
create table t2 like t1;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
insert into t1 values (1);
drop table t1;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
connection default;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
@ -203,21 +303,39 @@ create table t1 (i int);
set debug_sync='create_table_like_before_binlog SIGNAL parked WAIT_FOR go';
reset master;
create table t2 like t1;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
insert into t2 values (1);;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
connection default;
drop table t2;
set debug_sync='create_table_like_before_binlog SIGNAL parked WAIT_FOR go';
create table t2 like t1;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
drop table t2;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
connection default;
set debug_sync='create_table_like_before_binlog SIGNAL parked WAIT_FOR go';
create table t2 like t1;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
drop table t1;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
connection default;
drop table t2;
disconnect addconroot1;
disconnect addconroot2;
disconnect addconroot3;
set debug_sync='RESET';
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info

View File

@ -567,9 +567,13 @@ select database();
database()
NULL
create user mysqltest_1;
connect user1,localhost,mysqltest_1,,*NO-ONE*;
connection user1;
select database(), user();
database() user()
NULL mysqltest_1@localhost
connection default;
disconnect user1;
drop user mysqltest_1;
use test;
create table t1 (a int, index `primary` (a));
@ -1813,6 +1817,7 @@ create table t1 (a int, b int) engine=myisam;
create table t2 (a int, b int) engine=myisam;
insert into t1 values (1,1);
lock tables t1 read;
connect user1,localhost,root,,test;
set @@lock_wait_timeout=5;
create table if not exists t1 (a int, b int);
Warnings:
@ -1831,6 +1836,8 @@ create table t1 like t2;
ERROR 42S01: Table 't1' already exists
create or replace table t1 (a int, b int) select 2,2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
disconnect user1;
connection default;
select * from t1;
a b
1 1

View File

@ -43,6 +43,8 @@ CREATE USER u1@localhost;
REVOKE SHOW DATABASES ON *.* FROM 'u1'@'localhost';
GRANT SHOW DATABASES ON *.* TO role_1;
GRANT role_1 TO u1@localhost;
connect user_a, localhost, u1,,;
connection user_a;
SELECT CURRENT_USER;
CURRENT_USER
u1@localhost
@ -65,6 +67,8 @@ mysql
performance_schema
test
SET ROLE NONE;
connect user_b, localhost, root,,;
connection user_b;
# Clearing up
DROP ROLE role_1;
DROP ROLE IF EXISTS role_1;

View File

@ -432,11 +432,18 @@ unlock tables;
CREATE TABLE t1 (col_int_nokey INT) ENGINE=InnoDB;
CREATE OR REPLACE TEMPORARY TABLE tmp LIKE t1;
LOCK TABLE t1 WRITE;
connect con1,localhost,root,,test;
CREATE OR REPLACE TABLE t1 LIKE tmp;
connection default;
KILL QUERY con_id;
connection con1;
ERROR 70100: Query execution was interrupted
CREATE OR REPLACE TABLE t1 (a int);
connection default;
KILL QUERY con_id;
connection con1;
ERROR 70100: Query execution was interrupted
disconnect con1;
connection default;
drop table t1;
DROP TABLE t2;

View File

@ -17,9 +17,11 @@ t1 CREATE TABLE `t1` (
`b` int(11) DEFAULT NULL,
KEY `a` (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
connection slave;
SHOW TABLES;
Tables_in_test
t1
connection master;
drop temporary table if exists tmp;
drop table t1;
include/rpl_end.inc

View File

@ -19,6 +19,8 @@ REVOKE ALTER ROUTINE ON db1.* FROM mysqltest_1@localhost;
GRANT DELETE ON mysql.* TO mysqltest_1@localhost;
REVOKE DELETE ON mysql.* FROM mysqltest_1@localhost;
FLUSH PRIVILEGES;
connect user_a, localhost, mysqltest_1,,;
connection user_a;
SELECT CURRENT_USER;
CURRENT_USER
mysqltest_1@localhost
@ -41,6 +43,7 @@ CREATE OR REPLACE USER u1@localhost;
ERROR 42000: Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation
CREATE OR REPLACE ROLE developer;
ERROR 42000: Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation
connection default;
SELECT CURRENT_USER;
CURRENT_USER
root@localhost

View File

@ -1,11 +1,17 @@
connect root,localhost,root,,test;
connection root;
create database mysqltest;
create user mysqltest_1@localhost;
connect user1,localhost,mysqltest_1,,test;
connection user1;
connection root;
create table mysqltest.t1 (a int, b int);
insert into mysqltest.t1 values (2,10), (1,30);
create table mysqltest.t2 (c int, d char(32));
insert into mysqltest.t2 values (1,'xxx'), (1,'zzz');
grant select on mysqltest.t1 to mysqltest_1@localhost;
grant select (c) on mysqltest.t2 to mysqltest_1@localhost;
connection user1;
with t as (select c from mysqltest.t2 where c < 2)
select t.c,t1.b from t,mysqltest.t1 where t.c=t1.a;
c b
@ -18,6 +24,7 @@ ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column
with t as (select c,d from mysqltest.t2 where c < 2)
select t.c,t.d,t1.b from t,mysqltest.t1 where t.c=t1.a;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'd' in table 't2'
connection root;
create view mysqltest.v1(f1,f2) as
with t as (select c from mysqltest.t2 where c < 2)
select t.c,t1.b from t,mysqltest.t1 where t.c=t1.a;
@ -27,6 +34,7 @@ select t.a,b from t,mysqltest.t1 where mysqltest.t1.a = t.a;
grant select on mysqltest.v1 to mysqltest_1@localhost;
grant select (c) on mysqltest.v2 to mysqltest_1@localhost;
grant create view on mysqltest.* to mysqltest_1@localhost;
connection user1;
create view mysqltest.v3(c,d) as
with t as (select c from mysqltest.t2 where c < 2)
select t.c,t1.b from t,mysqltest.t1 where t.c=t1.a;
@ -44,11 +52,14 @@ select d from mysqltest.v2;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'd' in table 'v2'
select * from mysqltest.v3;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v3'
connection root;
grant select on mysqltest.v3 to mysqltest_1@localhost;
connection user1;
select * from mysqltest.v3;
c d
1 30
1 30
connection root;
revoke all privileges on mysqltest.v1 from mysqltest_1@localhost;
drop user mysqltest_1@localhost;
drop database mysqltest;

View File

@ -329,6 +329,21 @@ _ 5F
} 7D
 7F
drop table t1;
SELECT strcmp('a','a '), strcmp('a ','a');
strcmp('a','a ') strcmp('a ','a')
0 0
SELECT strcmp('a\0','a' ), strcmp('a','a\0');
strcmp('a\0','a' ) strcmp('a','a\0')
-1 1
SELECT strcmp('a\0','a '), strcmp('a ','a\0');
strcmp('a\0','a ') strcmp('a ','a\0')
-1 1
SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
strcmp('a\t','a' ) strcmp('a', 'a\t')
-1 1
SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
strcmp('a\t','a ') strcmp('a ', 'a\t')
-1 1
SET collation_connection='big5_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
@ -476,6 +491,21 @@ a hex(b) c
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
DROP TABLE t1;
SELECT strcmp('a','a '), strcmp('a ','a');
strcmp('a','a ') strcmp('a ','a')
0 0
SELECT strcmp('a\0','a' ), strcmp('a','a\0');
strcmp('a\0','a' ) strcmp('a','a\0')
-1 1
SELECT strcmp('a\0','a '), strcmp('a ','a\0');
strcmp('a\0','a ') strcmp('a ','a\0')
-1 1
SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
strcmp('a\t','a' ) strcmp('a', 'a\t')
-1 1
SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
strcmp('a\t','a ') strcmp('a ', 'a\t')
-1 1
SET NAMES big5;
CREATE TABLE t1 (a text) character set big5;
INSERT INTO t1 VALUES ('<27><>');

View File

@ -377,21 +377,21 @@ a
abcdefgh<EFBFBD>
drop table t1;
set names cp1250 collate cp1250_czech_cs;
SELECT strcmp('a','a ');
strcmp('a','a ')
0
SELECT strcmp('a\0','a' );
strcmp('a\0','a' )
1
SELECT strcmp('a\0','a ');
strcmp('a\0','a ')
1
SELECT strcmp('a\t','a' );
strcmp('a\t','a' )
1
SELECT strcmp('a\t','a ');
strcmp('a\t','a ')
1
SELECT strcmp('a','a '), strcmp('a ','a');
strcmp('a','a ') strcmp('a ','a')
0 0
SELECT strcmp('a\0','a' ), strcmp('a','a\0');
strcmp('a\0','a' ) strcmp('a','a\0')
1 -1
SELECT strcmp('a\0','a '), strcmp('a ','a\0');
strcmp('a\0','a ') strcmp('a ','a\0')
1 -1
SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
strcmp('a\t','a' ) strcmp('a', 'a\t')
1 -1
SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
strcmp('a\t','a ') strcmp('a ', 'a\t')
1 -1
create table t1 select repeat('a',4000) a;
delete from t1;
insert into t1 values ('a'), ('a '), ('a\t');

View File

@ -388,6 +388,21 @@ FF FF FF D18F FF
Warnings:
Warning 1977 Cannot convert 'cp1251' character 0x98 to 'utf8'
DROP TABLE t1;
SELECT strcmp('a','a '), strcmp('a ','a');
strcmp('a','a ') strcmp('a ','a')
0 0
SELECT strcmp('a\0','a' ), strcmp('a','a\0');
strcmp('a\0','a' ) strcmp('a','a\0')
-1 1
SELECT strcmp('a\0','a '), strcmp('a ','a\0');
strcmp('a\0','a ') strcmp('a ','a\0')
-1 1
SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
strcmp('a\t','a' ) strcmp('a', 'a\t')
-1 1
SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
strcmp('a\t','a ') strcmp('a ', 'a\t')
-1 1
set global LC_TIME_NAMES=convert((-8388608) using cp1251);
ERROR HY000: Unknown locale: '-8388608'
#

View File

@ -1,5 +1,7 @@
Start of 5.4 tests
CREATE TABLE t1(f1 INT);
connect con1,localhost,root,,test;
connection con1;
SET lc_messages=ru_RU;
SHOW VARIABLES LIKE 'lc_messages';
Variable_name Value
@ -9,6 +11,7 @@ ERROR 42S01: \0422\0430\0431\043B\0438\0446\0430 't1' \0443\0436\0435 \0441\0443
SET NAMES utf8;
CREATE TABLE t1(f1 INT);
ERROR 42S01: Таблица 't1' уже существует
connection default;
SHOW VARIABLES LIKE 'lc_messages';
Variable_name Value
lc_messages en_US
@ -22,21 +25,27 @@ SHOW GLOBAL VARIABLES LIKE 'lc_messages';
Variable_name Value
lc_messages ru_RU
SET GLOBAL lc_messages=en_US;
disconnect con1;
DROP TABLE t1;
drop table `ק`;
ERROR 42S02: Unknown table 'test.ק'
connect con1,localhost,root,,test;
connection con1;
SET lc_messages=cs_CZ;
SET NAMES UTF8;
USE nonexistant;
ERROR 42000: Neznámá databáze 'nonexistant'
disconnect con1;
connection default;
#
# Bug#12736295: Buffer overflow for variable converted_err
# with non-latin1 server error message
#
# Connection con1
connect con1,localhost,root,,test;
SET lc_messages=ru_RU;
SET NAMES latin1;
SELECT '01234567890123456789012345678901234\';
ERROR 42000: \0423 \0432\0430\0441 \043E\0448\0438\0431\043A\0430 \0432 \0437\0430\043F\0440\043E\0441\0435. \0418\0437\0443\0447\0438\0442\0435 \0434\043E\043A\0443\043C\0435\043D\0442\0430\0446\0438\044E \043F\043E \0438\0441\043F\043E\043B\044C\0437\0443\0435\043C\043E\0439 \0432\0435\0440\0441\0438\0438 MariaDB \043D\0430 \043F\0440\0435\0434\043C\0435\0442 \043A\043E\0440\0440\0435\043A\0442\043D\043E\0433\043E \0441\0438\043D\0442\0430\043A\0441\0438\0441\0430 \043E\043A\043E\043B\043E ''0123456789012345678901234
# Connection default
disconnect con1;
connection default;
End of 5.5 tests

View File

@ -33913,3 +33913,24 @@ DROP TABLE t1;
#
# End of 10.1 tests
#
#
# End of 10.2 tests
#
#
# MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis
#
CREATE TABLE t1 (a TEXT CHARACTER SET eucjpms);
LOAD DATA INFILE '../../std_data/loaddata/mdev9823.ujis.txt' INTO TABLE t1 CHARACTER SET eucjpms IGNORE 4 LINES;
SELECT HEX(a) FROM t1;
HEX(a)
3F
78787831
3F3F
78787832
8FA1A1
78787833
3F3F
DROP TABLE t1;
#
# End of 10.2 tests
#

View File

@ -5926,3 +5926,24 @@ Warning 1300 Invalid gb2312 character string: '\xA3A'
#
# End of 10.1 tests
#
#
# Start of 10.2 tests
#
#
# MDEV-9811 LOAD DATA INFILE does not work well with gbk in some cases
#
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET gbk);
LOAD DATA INFILE '../../std_data/loaddata/mdev8711.txt' INTO TABLE t1 CHARACTER SET gbk LINES TERMINATED BY '@';
SELECT HEX(a) FROM t1;
HEX(a)
B04061B041
B042
DELETE FROM t1;
LOAD DATA INFILE '../../std_data/loaddata/mdev8711.txt' INTO TABLE t1 CHARACTER SET gbk LINES TERMINATED BY '@' IGNORE 1 LINES;
SELECT HEX(a) FROM t1;
HEX(a)
B042
DROP TABLE t1;
#
# End of 10.2 tests
#

View File

@ -525,6 +525,21 @@ SELECT HEX(subject),HEX(pattern),STR_TO_DATE(subject, pattern) FROM t1;
HEX(subject) HEX(pattern) STR_TO_DATE(subject, pattern)
32303031F73031F73031 2559F7256DF72564 2001-01-01 00:00:00.000000
DROP TABLE t1;
SELECT strcmp('a','a '), strcmp('a ','a');
strcmp('a','a ') strcmp('a ','a')
0 0
SELECT strcmp('a\0','a' ), strcmp('a','a\0');
strcmp('a\0','a' ) strcmp('a','a\0')
-1 1
SELECT strcmp('a\0','a '), strcmp('a ','a\0');
strcmp('a\0','a ') strcmp('a ','a\0')
-1 1
SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
strcmp('a\t','a' ) strcmp('a', 'a\t')
-1 1
SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
strcmp('a\t','a ') strcmp('a ', 'a\t')
-1 1
SET collation_connection='latin1_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
@ -621,6 +636,21 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
SELECT strcmp('a','a '), strcmp('a ','a');
strcmp('a','a ') strcmp('a ','a')
0 0
SELECT strcmp('a\0','a' ), strcmp('a','a\0');
strcmp('a\0','a' ) strcmp('a','a\0')
-1 1
SELECT strcmp('a\0','a '), strcmp('a ','a\0');
strcmp('a\0','a ') strcmp('a ','a\0')
-1 1
SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
strcmp('a\t','a' ) strcmp('a', 'a\t')
-1 1
SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
strcmp('a\t','a ') strcmp('a ', 'a\t')
-1 1
CREATE TABLE <20>a (a int);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '<27>a (a int)' at line 1
SELECT '<27>a' as str;

View File

@ -30,21 +30,21 @@ select * from t1 where tt like '%AA%';
id tt
drop table t1;
set names latin2 collate latin2_czech_cs;
SELECT strcmp('a','a ');
strcmp('a','a ')
0
SELECT strcmp('a\0','a' );
strcmp('a\0','a' )
1
SELECT strcmp('a\0','a ');
strcmp('a\0','a ')
1
SELECT strcmp('a\t','a' );
strcmp('a\t','a' )
0
SELECT strcmp('a\t','a ');
strcmp('a\t','a ')
0
SELECT strcmp('a','a '), strcmp('a ','a');
strcmp('a','a ') strcmp('a ','a')
0 0
SELECT strcmp('a\0','a' ), strcmp('a','a\0');
strcmp('a\0','a' ) strcmp('a','a\0')
1 -1
SELECT strcmp('a\0','a '), strcmp('a ','a\0');
strcmp('a\0','a ') strcmp('a ','a\0')
1 -1
SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
strcmp('a\t','a' ) strcmp('a', 'a\t')
0 0
SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
strcmp('a\t','a ') strcmp('a ', 'a\t')
0 0
#
# MDEV-7149 Constant condition propagation erroneously applied for LIKE
#
@ -484,21 +484,21 @@ DROP TABLE t1;
# WL#3664 WEIGHT_STRING
#
set names latin2 collate latin2_czech_cs;
SELECT strcmp('a','a ');
strcmp('a','a ')
0
SELECT strcmp('a\0','a' );
strcmp('a\0','a' )
1
SELECT strcmp('a\0','a ');
strcmp('a\0','a ')
1
SELECT strcmp('a\t','a' );
strcmp('a\t','a' )
0
SELECT strcmp('a\t','a ');
strcmp('a\t','a ')
0
SELECT strcmp('a','a '), strcmp('a ','a');
strcmp('a','a ') strcmp('a ','a')
0 0
SELECT strcmp('a\0','a' ), strcmp('a','a\0');
strcmp('a\0','a' ) strcmp('a','a\0')
1 -1
SELECT strcmp('a\0','a '), strcmp('a ','a\0');
strcmp('a\0','a ') strcmp('a ','a\0')
1 -1
SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
strcmp('a\t','a' ) strcmp('a', 'a\t')
0 0
SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
strcmp('a\t','a ') strcmp('a ', 'a\t')
0 0
#
# Note:
# latin2_czech_cs does not support WEIGHT_STRING in full extent

View File

@ -18730,3 +18730,21 @@ DROP TABLE t1;
#
# End of 10.0 tests
#
#
# Start of 10.2 tests
#
#
# MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis
#
CREATE TABLE t1 (a TEXT CHARACTER SET sjis);
LOAD DATA INFILE '../../std_data/loaddata/mdev9842.txt' INTO TABLE t1 CHARACTER SET sjis;
SELECT HEX(a) FROM t1;
HEX(a)
78835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C
SELECT a=CONCAT('x', REPEAT(_sjis 0x835C, 200)) FROM t1;
a=CONCAT('x', REPEAT(_sjis 0x835C, 200))
1
DROP TABLE t1;
#
# End of 10.2 tests
#

View File

@ -3630,6 +3630,21 @@ hex(weight_string('abc' as char(5) LEVEL 1 DESC))
select hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE));
hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE))
DFDF9C9D9E
SELECT strcmp('a','a '), strcmp('a ','a');
strcmp('a','a ') strcmp('a ','a')
0 0
SELECT strcmp('a\0','a' ), strcmp('a','a\0');
strcmp('a\0','a' ) strcmp('a','a\0')
-1 1
SELECT strcmp('a\0','a '), strcmp('a ','a\0');
strcmp('a\0','a ') strcmp('a ','a\0')
-1 1
SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
strcmp('a\t','a' ) strcmp('a', 'a\t')
-1 1
SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
strcmp('a\t','a ') strcmp('a ', 'a\t')
-1 1
select hex(weight_string(cast(0xE0A1 as char)));
hex(weight_string(cast(0xE0A1 as char)))
A1E0
@ -3808,6 +3823,21 @@ hex(weight_string('abc' as char(5) LEVEL 1 DESC))
select hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE));
hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE))
DFDF9C9D9E
SELECT strcmp('a','a '), strcmp('a ','a');
strcmp('a','a ') strcmp('a ','a')
0 0
SELECT strcmp('a\0','a' ), strcmp('a','a\0');
strcmp('a\0','a' ) strcmp('a','a\0')
-1 1
SELECT strcmp('a\0','a '), strcmp('a ','a\0');
strcmp('a\0','a ') strcmp('a ','a\0')
-1 1
SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
strcmp('a\t','a' ) strcmp('a', 'a\t')
-1 1
SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
strcmp('a\t','a ') strcmp('a ', 'a\t')
-1 1
select hex(weight_string(cast(0xE0A1 as char)));
hex(weight_string(cast(0xE0A1 as char)))
E0A1

View File

@ -26218,3 +26218,24 @@ DROP TABLE t1;
#
# End of 10.1 tests
#
#
# End of 10.2 tests
#
#
# MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis
#
CREATE TABLE t1 (a TEXT CHARACTER SET ujis);
LOAD DATA INFILE '../../std_data/loaddata/mdev9823.ujis.txt' INTO TABLE t1 CHARACTER SET ujis IGNORE 4 LINES;
SELECT HEX(a) FROM t1;
HEX(a)
3F
78787831
3F3F
78787832
8FA1A1
78787833
3F3F
DROP TABLE t1;
#
# End of 10.2 tests
#

View File

@ -10401,3 +10401,63 @@ SET @@SQL_MODE=default;
#
# End of 10.1 tests
#
#
# Start of 10.2 tests
#
#
# MDEV-9824 LOAD DATA does not work with multi-byte strings in LINES TERMINATED BY when IGNORE is specified
#
CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET utf8);
LOAD DATA INFILE '../../std_data/loaddata/mdev9824.txt' INTO TABLE t1 CHARACTER SET utf8 LINES TERMINATED BY 'ёё';
Warnings:
Warning 1638 Non-ASCII separator arguments are not fully supported
SELECT c1 FROM t1;
c1
a
b
c
DELETE FROM t1;
LOAD DATA INFILE '../../std_data/loaddata/mdev9824.txt' INTO TABLE t1 CHARACTER SET utf8 LINES TERMINATED BY 'ёё' IGNORE 1 LINES;
Warnings:
Warning 1638 Non-ASCII separator arguments are not fully supported
SELECT c1 FROM t1;
c1
b
c
DROP TABLE t1;
#
# MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis
#
CREATE TABLE t1 (a TEXT CHARACTER SET utf8);
LOAD DATA INFILE '../../std_data/loaddata/mdev9823.utf8mb4.txt' INTO TABLE t1 CHARACTER SET utf8 IGNORE 4 LINES;
Warnings:
Warning 1366 Incorrect string value: '\xD0' for column 'a' at row 1
Warning 1366 Incorrect string value: '\xE1\x80' for column 'a' at row 3
Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column 'a' at row 5
Warning 1366 Incorrect string value: '\xF0\x9F\x98\x8E' for column 'a' at row 7
Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column 'a' at row 8
SELECT HEX(a) FROM t1;
HEX(a)
3F
78787831
3F3F
78787832
3F3F3F
78787833
3F3F3F3F
3F3F3F
DROP TABLE t1;
#
# MDEV-9874 LOAD XML INFILE does not handle well broken multi-byte characters
#
CREATE TABLE t1 (a TEXT CHARACTER SET utf8);
LOAD XML INFILE '../../std_data/loaddata/mdev9874.xml' INTO TABLE t1 CHARACTER SET utf8 ROWS IDENTIFIED BY '<row>';
Warnings:
Warning 1366 Incorrect string value: '\xD0' for column 'a' at row 1
SELECT HEX(a) FROM t1;
HEX(a)
613F
DROP TABLE t1;
#
# End of 10.2 tests
#

View File

@ -3398,3 +3398,30 @@ DROP FUNCTION f1;
#
# End of 10.1 tests
#
#
# End of 10.2 tests
#
#
# MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis
#
CREATE TABLE t1 (a TEXT CHARACTER SET utf8mb4);
LOAD DATA INFILE '../../std_data/loaddata/mdev9823.utf8mb4.txt' INTO TABLE t1 CHARACTER SET utf8mb4 IGNORE 4 LINES;
Warnings:
Warning 1366 Incorrect string value: '\xD0' for column 'a' at row 1
Warning 1366 Incorrect string value: '\xE1\x80' for column 'a' at row 3
Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column 'a' at row 5
Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column 'a' at row 8
SELECT HEX(a) FROM t1;
HEX(a)
3F
78787831
3F3F
78787832
3F3F3F
78787833
F09F988E
3F3F3F
DROP TABLE t1;
#
# End of 10.2 tests
#

View File

@ -61,8 +61,7 @@ SELECT * FROM v3|
ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
---> connection: con2
connect con2,localhost,root,,;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -118,8 +117,7 @@ DROP DATABASE mysqltest1|
---> Restoring mysqltest1...
---> connection: con3
connect con3,localhost,root,,;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -167,8 +165,9 @@ utf8_general_ci
SELECT * FROM v3|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
---> connection: default
connection default;
disconnect con2;
disconnect con3;
use test|
DROP DATABASE mysqltest1|
@ -477,8 +476,7 @@ utf8_general_ci utf8_general_ci
ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
ALTER DATABASE mysqltest2 COLLATE cp866_general_ci|
---> connection: con2
connect con2,localhost,root,,mysqltest1;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -879,8 +877,7 @@ DROP DATABASE mysqltest2|
---> Restoring mysqltest1...
---> Restoring mysqltest2...
---> connection: con3
connect con3,localhost,root,,mysqltest1;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -1121,8 +1118,9 @@ koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r
SELECT COLLATION(@a) AS ca, COLLATION(@b) cb|
ca cb
utf8_general_ci utf8_general_ci
---> connection: default
connection default;
disconnect con2;
disconnect con3;
use test|
DROP DATABASE mysqltest1|
DROP DATABASE mysqltest2|
@ -1459,8 +1457,7 @@ ALTER TABLE t1 ADD COLUMN fake INT|
ALTER TABLE t1 DROP COLUMN fake|
ALTER TABLE mysqltest2.t1 ADD COLUMN fake INT|
ALTER TABLE mysqltest2.t1 DROP COLUMN fake|
---> connection: con2
connect con2,localhost,root,,;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -1894,8 +1891,7 @@ ALTER TABLE mysqltest1.t1 ADD COLUMN fake INT|
ALTER TABLE mysqltest1.t1 DROP COLUMN fake|
ALTER TABLE mysqltest2.t1 ADD COLUMN fake INT|
ALTER TABLE mysqltest2.t1 DROP COLUMN fake|
---> connection: con3
connect con3,localhost,root,,;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -2159,8 +2155,9 @@ ca1 ca2 ca3 cb1 cb2 cb3
koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci
DELETE FROM mysqltest2.log|
---> connection: default
connection default;
disconnect con2;
disconnect con3;
use test|
DROP DATABASE mysqltest1|
DROP DATABASE mysqltest2|
@ -2348,8 +2345,7 @@ END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREAT
ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
ALTER DATABASE mysqltest2 COLLATE cp866_general_ci|
---> connection: con2
connect con2,localhost,root,,mysqltest1;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -2621,8 +2617,7 @@ DROP DATABASE mysqltest2|
---> Restoring mysqltest1...
---> Restoring mysqltest2...
---> connection: con3
connect con3,localhost,root,,mysqltest1;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -2829,12 +2824,11 @@ Table Create Table
t2 CREATE TABLE `t2` (
`col1` varchar(10) COLLATE cp1251_general_cs DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs
---> connection: con2
---> connection: con3
---> connection: default
connection con2;
disconnect con2;
connection con3;
disconnect con3;
connection default;
USE test;
DROP DATABASE mysqltest1;
DROP DATABASE mysqltest2;

View File

@ -61,8 +61,7 @@ SELECT * FROM v3|
ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
---> connection: con2
connect con2,localhost,root,,;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -118,8 +117,7 @@ DROP DATABASE mysqltest1|
---> Restoring mysqltest1...
---> connection: con3
connect con3,localhost,root,,;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -167,8 +165,9 @@ koi8r_general_ci
SELECT * FROM v3|
тест
тест
---> connection: default
connection default;
disconnect con2;
disconnect con3;
use test|
DROP DATABASE mysqltest1|
@ -477,8 +476,7 @@ utf8_general_ci utf8_general_ci
ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
ALTER DATABASE mysqltest2 COLLATE cp866_general_ci|
---> connection: con2
connect con2,localhost,root,,mysqltest1;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -879,8 +877,7 @@ DROP DATABASE mysqltest2|
---> Restoring mysqltest1...
---> Restoring mysqltest2...
---> connection: con3
connect con3,localhost,root,,mysqltest1;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -1121,8 +1118,9 @@ utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8
SELECT COLLATION(@a) AS ca, COLLATION(@b) cb|
ca cb
utf8_general_ci utf8_general_ci
---> connection: default
connection default;
disconnect con2;
disconnect con3;
use test|
DROP DATABASE mysqltest1|
DROP DATABASE mysqltest2|
@ -1459,8 +1457,7 @@ ALTER TABLE t1 ADD COLUMN fake INT|
ALTER TABLE t1 DROP COLUMN fake|
ALTER TABLE mysqltest2.t1 ADD COLUMN fake INT|
ALTER TABLE mysqltest2.t1 DROP COLUMN fake|
---> connection: con2
connect con2,localhost,root,,;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -1894,8 +1891,7 @@ ALTER TABLE mysqltest1.t1 ADD COLUMN fake INT|
ALTER TABLE mysqltest1.t1 DROP COLUMN fake|
ALTER TABLE mysqltest2.t1 ADD COLUMN fake INT|
ALTER TABLE mysqltest2.t1 DROP COLUMN fake|
---> connection: con3
connect con3,localhost,root,,;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -2159,8 +2155,9 @@ ca1 ca2 ca3 cb1 cb2 cb3
utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8_general_ci koi8r_general_ci
DELETE FROM mysqltest2.log|
---> connection: default
connection default;
disconnect con2;
disconnect con3;
use test|
DROP DATABASE mysqltest1|
DROP DATABASE mysqltest2|
@ -2348,8 +2345,7 @@ END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREAT
ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
ALTER DATABASE mysqltest2 COLLATE cp866_general_ci|
---> connection: con2
connect con2,localhost,root,,mysqltest1;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -2621,8 +2617,7 @@ DROP DATABASE mysqltest2|
---> Restoring mysqltest1...
---> Restoring mysqltest2...
---> connection: con3
connect con3,localhost,root,,mysqltest1;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -2829,12 +2824,11 @@ Table Create Table
t2 CREATE TABLE `t2` (
`col1` varchar(10) COLLATE cp1251_general_cs DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs
---> connection: con2
---> connection: con3
---> connection: default
connection con2;
disconnect con2;
connection con3;
disconnect con3;
connection default;
USE test;
DROP DATABASE mysqltest1;
DROP DATABASE mysqltest2;

View File

@ -1,31 +1,31 @@
# Establish connection con1 (user=root)
# Establish connection con2 (user=root)
connect con1,localhost,root,,;
connect con2,localhost,root,,;
drop table if exists t1,t2;
# Switch to connection con1
connection con1;
create table t1 (id integer, x integer) engine = InnoDB;
insert into t1 values(0, 0);
set autocommit=0;
SELECT * from t1 where id = 0 FOR UPDATE;
id x
0 0
# Switch to connection con2
connection con2;
set autocommit=0;
update t1 set x=2 where id = 0;
# Switch to connection con1
connection con1;
update t1 set x=1 where id = 0;
select * from t1;
id x
0 1
commit;
# Switch to connection con2
connection con2;
commit;
# Switch to connection con1
connection con1;
select * from t1;
id x
0 2
commit;
drop table t1;
# Switch to connection con1
connection con1;
create table t1 (id integer, x integer) engine = InnoDB;
create table t2 (b integer, a integer) engine = InnoDB;
insert into t1 values(0, 0), (300, 300);
@ -47,19 +47,19 @@ select * from t1;
id x
0 0
300 300
# Switch to connection con2
connection con2;
set autocommit=0;
update t1 set x=2 where id = 0;
# Switch to connection con1
connection con1;
update t1 set x=1 where id = 0;
select * from t1;
id x
0 1
300 300
commit;
# Switch to connection con2
connection con2;
commit;
# Switch to connection con1
connection con1;
select * from t1;
id x
0 2
@ -71,7 +71,7 @@ create table t2 (b integer, a integer) engine = InnoDB;
insert into t1 values(0, 0), (300, 300);
insert into t2 values(0, 0), (1, 20), (2, 30);
commit;
# Switch to connection con1
connection con1;
select a,b from t2 UNION SELECT id, x from t1 FOR UPDATE;
a b
0 0
@ -87,7 +87,7 @@ select * from t1;
id x
0 0
300 300
# Switch to connection con2
connection con2;
update t2 set a=2 where b = 0;
select * from t2;
b a
@ -95,22 +95,24 @@ b a
1 20
2 30
update t1 set x=2 where id = 0;
# Switch to connection con1
connection con1;
update t1 set x=1 where id = 0;
select * from t1;
id x
0 1
300 300
commit;
# Switch to connection con2
connection con2;
commit;
# Switch to connection con1
connection con1;
select * from t1;
id x
0 2
300 300
commit;
# Switch to connection default + disconnect con1 and con2
connection default;
disconnect con1;
disconnect con2;
drop table t1, t2;
End of 4.1 tests
set storage_engine=innodb;

View File

@ -234,44 +234,48 @@ Variable_name Value
debug_sync ON - current signal: ''
CREATE USER mysqltest_1@localhost;
GRANT SUPER ON *.* TO mysqltest_1@localhost;
connection con1, mysqltest_1
connect con1,localhost,mysqltest_1,,;
SET DEBUG_SYNC= 'RESET';
connection default
disconnect con1;
connection default;
DROP USER mysqltest_1@localhost;
CREATE USER mysqltest_2@localhost;
GRANT ALL ON *.* TO mysqltest_2@localhost;
REVOKE SUPER ON *.* FROM mysqltest_2@localhost;
connection con1, mysqltest_2
connect con1,localhost,mysqltest_2,,;
SET DEBUG_SYNC= 'RESET';
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
connection default
disconnect con1;
connection default;
DROP USER mysqltest_2@localhost;
SET DEBUG_SYNC= 'RESET';
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INT);
connection con1
connect con1,localhost,root,,;
SET DEBUG_SYNC= 'before_lock_tables_takes_lock
SIGNAL opened WAIT_FOR flushed';
INSERT INTO t1 VALUES(1);
connection default
connection default;
SET DEBUG_SYNC= 'now WAIT_FOR opened';
SET DEBUG_SYNC= 'after_flush_unlock SIGNAL flushed';
FLUSH TABLE t1;
connection con1
connection default
connection con1;
disconnect con1;
connection default;
DROP TABLE t1;
SET DEBUG_SYNC= 'RESET';
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INT);
LOCK TABLE t1 READ;
connection con1
connect con1,localhost,root,,;
SET DEBUG_SYNC= 'wait_for_lock SIGNAL locked EXECUTE 2';
INSERT INTO t1 VALUES (1);
connection default
connection default;
SET DEBUG_SYNC= 'now WAIT_FOR locked';
UNLOCK TABLES;
connection con1
connection con1;
retrieve INSERT result.
connection default
disconnect con1;
connection default;
DROP TABLE t1;
SET DEBUG_SYNC= 'RESET';

View File

@ -297,16 +297,21 @@ drop table if exists t1;
create table t1 (a int, b int);
insert into t1 values (1,1);
lock table t1 read;
connection: update
connect update,localhost,root,,;
connection update;
insert delayed into t1 values (2,2);;
connection: select
connection default;
connect select,localhost,root,,;
select * from t1;
a b
1 1
connection: default
connection default;
select * from t1;
a b
1 1
connection default;
disconnect update;
disconnect select;
unlock tables;
select * from t1;
a b
@ -359,70 +364,70 @@ CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT);
CREATE TABLE t3 (a INT);
# Test 1: Using LOCK TABLE
# Connection con1
connect con1, localhost, root;
LOCK TABLE t1 WRITE;
# Connection default
connection default;
LOCK TABLE t2 WRITE;
# Sending:
INSERT DELAYED INTO t1 VALUES (1);
# Connection con1
connection con1;
# Wait until INSERT DELAYED is blocked on table 't1'.
INSERT DELAYED INTO t2 VALUES (1);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
UNLOCK TABLES;
# Connection default
connection default;
# Reaping: INSERT DELAYED INTO t1 VALUES (1)
UNLOCK TABLES;
# Test 2: Using ALTER TABLE
START TRANSACTION;
SELECT * FROM t1 WHERE a=0;
a
# Connection con1
connection con1;
# Sending:
ALTER TABLE t1 MODIFY a INT UNSIGNED;;
# Connection default
connection default;
# Wait until ALTER TABLE is blocked on table 't1'.
INSERT DELAYED INTO t1 VALUES (3);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
COMMIT;
# Connection con1
connection con1;
# Reaping: ALTER TABLE t1 COMMENT 'test'
# Test 3: Using RENAME TABLE
# Connection default
connection default;
START TRANSACTION;
INSERT INTO t2 VALUES (1);
# Connection con1
connection con1;
# Sending:
RENAME TABLE t1 to t5, t2 to t4;
# Connection default
connection default;
# Wait until RENAME TABLE is blocked on table 't1'.
INSERT DELAYED INTO t1 VALUES (4);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
COMMIT;
# Connection con1
connection con1;
# Reaping: RENAME TABLE t1 to t5, t2 to t4
# Connection default
connection default;
# Reverting the renames
RENAME TABLE t5 to t1, t4 to t2;
# Test 4: Two INSERT DELAYED on the same table
START TRANSACTION;
INSERT INTO t2 VALUES (1);
# Connection con2
connect con2, localhost, root;
LOCK TABLE t1 WRITE, t2 WRITE;
# Connection con1
connection con1;
# Wait until LOCK TABLE is blocked on table 't2'.
INSERT DELAYED INTO t1 VALUES (5);
# Connection default
connection default;
# Wait until INSERT DELAYED is blocked on table 't1'.
INSERT DELAYED INTO t1 VALUES (6);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
COMMIT;
# Connection con2
connection con2;
# Reaping: LOCK TABLE t1 WRITE, t2 WRITE
UNLOCK TABLES;
# Connection con1
connection con1;
# Reaping: INSERT DELAYED INTO t1 VALUES (5)
# Connection default
connection default;
# Test 5: LOCK TABLES + INSERT DELAYED in one connection.
# This test has triggered some asserts in metadata locking
# subsystem at some point in time..
@ -434,13 +439,17 @@ LOCK TABLE t1 WRITE;
INSERT DELAYED INTO t2 VALUES (8);
UNLOCK TABLES;
SET AUTOCOMMIT= 1;
# Connection con2
# Connection con1
# Connection default
connection con2;
disconnect con2;
connection con1;
disconnect con1;
connection default;
DROP TABLE t1, t2, t3;
#
# Test for bug #56251 "Deadlock with INSERT DELAYED and MERGE tables".
#
connect con1,localhost,root,,;
connection default;
drop table if exists t1, t2, tm;
create table t1(a int);
create table t2(a int);
@ -448,10 +457,10 @@ create table tm(a int) engine=merge union=(t1, t2);
begin;
select * from t1;
a
# Connection 'con1'.
connection con1;
# Sending:
alter table t1 comment 'test';
# Connection 'default'.
connection default;
# Wait until ALTER TABLE blocks and starts waiting
# for connection 'default'. It should wait with a
# pending SNW lock on 't1'.
@ -462,7 +471,8 @@ insert delayed into tm values (1);
ERROR HY000: DELAYED option not supported for table 'tm'
# Unblock ALTER TABLE.
commit;
# Connection 'con1'.
connection con1;
# Reaping ALTER TABLE:
# Connection 'default'.
disconnect con1;
connection default;
drop tables tm, t1, t2;

View File

@ -4,10 +4,14 @@ CREATE TABLE t1 (a int(11), b varchar(32));
INSERT INTO t1 VALUES (7,'ggggggg'),(1,'a'),(3,'ccc'),(4,'dddd'),(1,'A'),
(2,'BB'),(4,'DDDD'),(5,'EEEEE'),(7,'GGGGGGG'),(2,'bb');
CREATE VIEW v1 AS SELECT a, UPPER(b) FROM t1;
connect root,localhost,root,,test;
connection root;
CREATE DATABASE mysqltest;
CREATE TABLE mysqltest.t1 SELECT * FROM t1;
GRANT DELETE ON mysqltest.* TO mysqltest_1@localhost;
GRANT SELECT(b) ON mysqltest.t1 TO mysqltest_1@localhost;
connect user1,localhost,mysqltest_1,,test;
connection user1;
DELETE FROM mysqltest.t1 WHERE a=2 RETURNING b;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'a' in table 't1'
DELETE FROM mysqltest.t1 RETURNING b;
@ -22,6 +26,7 @@ DDDD
EEEEE
GGGGGGG
bb
connection root;
SELECT * FROM mysqltest.t1;
a b
INSERT INTO mysqltest.t1 SELECT * FROM t1;
@ -41,15 +46,19 @@ a b
1 a
7 ggggggg
INSERT INTO mysqltest.t1 SELECT * FROM t1;
connection root;
CREATE VIEW mysqltest.v1(a) AS SELECT a FROM mysqltest.t1;
GRANT SELECT, INSERT ON mysqltest.t1 TO mysqltest_1@localhost;
connection user1;
DELETE FROM mysqltest.v1;
SELECT * FROM mysqltest.t1;
a b
INSERT INTO mysqltest.t1 SELECT * FROM t1;
DELETE FROM mysqltest.v1 RETURNING a;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'a' in table 'v1'
connection root;
GRANT SELECT ON mysqltest.* TO mysqltest_1@localhost;
connection user1;
DELETE FROM mysqltest.v1 RETURNING a;
a
7
@ -65,7 +74,9 @@ a
SELECT * FROM mysqltest.t1;
a b
INSERT INTO mysqltest.t1 SELECT * FROM t1;
connection root;
DROP DATABASE mysqltest;
disconnect user1;
DROP USER mysqltest_1@localhost;
DROP VIEW v1;
DROP TABLE t1;

View File

@ -206,6 +206,8 @@ x
1
create user mysqltest_1;
create table t1 select 1 as a;
connect con1,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,$MASTER_MYSOCK;
connection con1;
set optimizer_switch='derived_merge=off,derived_with_keys=off';
select 2 as a from (select * from t1) b;
ERROR 3D000: No database selected
@ -385,6 +387,9 @@ ID DATA FID
select t2.* from (select * from t1) as A inner join t2 on A.ID = t2.FID;
ID DATA FID
drop table t1, t2;
connection con1;
disconnect con1;
connection default;
drop user mysqltest_1;
# End of 4.1 tests
SELECT 0 FROM

View File

@ -1,3 +1,8 @@
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
disconnect con1;
connection con2;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (n INT);
INSERT INTO t1 VALUES (1),(2),(3);
@ -7,13 +12,25 @@ n
2
3
DROP TABLE t1;
connection default;
disconnect con2;
connection default;
SELECT GET_LOCK("dangling", 0);
GET_LOCK("dangling", 0)
1
connect con1, localhost, root,,;
connection con1;
SELECT GET_LOCK('dangling', 3600);;
connection default;
disconnect con1;
connect con1, localhost, root,,;
SELECT GET_LOCK('dangling', 3600);;
connection default;
SELECT RELEASE_LOCK('dangling');
RELEASE_LOCK('dangling')
1
connection con1;
GET_LOCK('dangling', 3600)
1
connection default;
disconnect con1;

View File

@ -82,13 +82,22 @@ drop table if exists t1;
create table t1 (i int);
create database mysqltest;
lock tables t1 read;
connect addconroot1, localhost, root,,;
drop table t1;
connect addconroot2, localhost, root,,;
show open tables;
drop database mysqltest;
connection default;
select 1;
1
1
unlock tables;
connection addconroot1;
connection addconroot2;
disconnect addconroot2;
connection addconroot1;
disconnect addconroot1;
connection default;
drop table if exists t1,t2;
create table t1 (a int);
create table t2 (a int);
@ -99,14 +108,20 @@ drop table t1;
ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
unlock tables;
drop table t1,t2;
connect addconroot, localhost, root,,;
connection default;
create table t1 (i int);
create table t2 (i int);
lock tables t1 read;
connection addconroot;
lock tables t2 read;
drop table t1;
ERROR HY000: Table 't1' was not locked with LOCK TABLES
connection default;
drop table t1,t2;
ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
disconnect addconroot;
connection default;
unlock tables;
drop table t1,t2;
End of 5.0 tests

View File

@ -2,6 +2,7 @@ create table t1 as select * from mysql.user;
truncate table mysql.user;
flush privileges;
connect(localhost,u1,,test,MASTER_PORT,MASTER_SOCKET);
connect fail,localhost,u1;
Got one of the listed errors
insert mysql.user select * from t1;
drop table t1;

View File

@ -69,8 +69,12 @@ ERROR 42000: Unknown storage engine 'FooBar'
select @@session.enforce_storage_engine;
@@session.enforce_storage_engine
MyISAM
connect con1,localhost,user_1,,;
connection con1;
SET SESSION enforce_storage_engine=MyISAM;
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
disconnect con1;
connection default;
SET SESSION enforce_storage_engine=NULL;
SET SESSION sql_mode='NO_ENGINE_SUBSTITUTION';
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=Memory;
@ -102,6 +106,8 @@ t1 CREATE TABLE `t1` (
DROP TABLE t1;
SET GLOBAL enforce_storage_engine=Memory;
SET SESSION sql_mode='';
connect con1,localhost,root,,;
connection con1;
select @@session.enforce_storage_engine;
@@session.enforce_storage_engine
MEMORY
@ -119,6 +125,8 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`c1`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1
DROP TABLE t1;
connection default;
disconnect con1;
set global sql_mode=default;
SET SESSION enforce_storage_engine=NULL;
SET GLOBAL enforce_storage_engine=NULL;

View File

@ -11,8 +11,10 @@ CREATE DATABASE db_x;
GRANT EVENT ON db_x.* TO pauline@localhost;
USE db_x;
CREATE TABLE x_table(a int);
connect priv_conn,localhost,pauline,,db_x;
CREATE EVENT e_x1 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE db_x;
CREATE EVENT e_x2 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE x_table;
connection default;
SHOW DATABASES LIKE 'db_x';
Database (db_x)
db_x
@ -24,8 +26,11 @@ SHOW TABLES FROM db_x;
Tables_in_db_x
x_table
SET GLOBAL event_scheduler=off;
connection priv_conn;
DROP EVENT e_x1;
DROP EVENT e_x2;
disconnect priv_conn;
connection default;
DROP DATABASE db_x;
DROP USER pauline@localhost;
USE events_test;

View File

@ -203,10 +203,13 @@ drop database if exists mysqltest_db1;
create user mysqltest_user1@localhost;
create database mysqltest_db1;
grant event on events_test.* to mysqltest_user1@localhost;
connect conn2,localhost,mysqltest_user1,,events_test;
create event mysqltest_user1 on schedule every 10 second do select 42;
alter event mysqltest_user1 rename to mysqltest_db1.mysqltest_user1;
ERROR 42000: Access denied for user 'mysqltest_user1'@'localhost' to database 'mysqltest_db1'
"Let's test now rename when there is no select DB"
disconnect conn2;
connect conn2,localhost,mysqltest_user1,,*NO-ONE*;
select database();
database()
NULL
@ -216,6 +219,8 @@ select event_schema, event_name, definer, event_type, status from information_sc
event_schema event_name definer event_type status
events_test mysqltest_user1 mysqltest_user1@localhost RECURRING ENABLED
drop event events_test.mysqltest_user1;
disconnect conn2;
connection default;
drop user mysqltest_user1@localhost;
drop database mysqltest_db1;
create event e_53 on schedule at (select s1 from ttx) do drop table t;
@ -366,6 +371,7 @@ SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
event_name definer
e1 mysqltest_u1@localhost
DROP EVENT e1;
connect conn1, localhost, mysqltest_u1, , events_test;
CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
event_name definer
@ -390,6 +396,8 @@ CREATE DEFINER=root@localhost EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
DROP EVENT e1;
ERROR HY000: Unknown event 'e1'
disconnect conn1;
connection default;
DROP USER mysqltest_u1@localhost;
SET GLOBAL EVENT_SCHEDULER= OFF;
SET @save_time_zone= @@TIME_ZONE;
@ -586,7 +594,7 @@ Grants for evtest1@localhost
GRANT USAGE ON *.* TO 'evtest1'@'localhost' IDENTIFIED BY PASSWORD '*3170F3644E31580C25DE4A08F4C07CC9A2D40C32'
GRANT SELECT, INSERT ON `test`.* TO 'evtest1'@'localhost'
GRANT SELECT, INSERT, CREATE, EVENT ON `events_test`.* TO 'evtest1'@'localhost'
connection e1;
connect e1,localhost,evtest1,ev1,events_test,$MASTER_MYPORT,$MASTER_MYSOCK;
CREATE EVENT ev_sched_1823 ON SCHEDULE EVERY 2 SECOND
DO BEGIN
SET AUTOCOMMIT = 0;
@ -615,6 +623,7 @@ Sleep 4 seconds
SELECT COUNT(*) > @row_cnt AS "Expect 0" FROM events_test.event_log;
Expect 0
0
disconnect e1;
DROP EVENT events_test.ev_sched_1823;
DROP TABLE events_test.event_log;
SET GLOBAL event_scheduler = OFF;
@ -640,9 +649,7 @@ GRANT EVENT ON *.* TO mysqltest_u1@localhost;
SET GLOBAL READ_ONLY = 1;
#
# Connection: u1_con (mysqltest_u1@localhost/events_test).
#
connect u1_con,localhost,mysqltest_u1,,events_test;
CREATE EVENT e1 ON SCHEDULE AT '2020-01-01 00:00:00' DO SET @a = 1;
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
@ -653,9 +660,7 @@ ERROR HY000: The MariaDB server is running with the --read-only option so it can
DROP EVENT e1;
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
#
# Connection: root_con (root@localhost/events_test).
#
connect root_con,localhost,root,,events_test;
CREATE EVENT e1 ON SCHEDULE AT '2020-01-01 00:00:00' DO SET @a = 1;
@ -665,9 +670,7 @@ DROP EVENT e1;
SET GLOBAL READ_ONLY = 0;
#
# Connection: u1_con (mysqltest_u1@localhost/test).
#
connection u1_con;
CREATE EVENT e1 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND DO SET @a = 1;
CREATE EVENT e2 ON SCHEDULE EVERY 1 SECOND DO SET @a = 1;
@ -682,9 +685,7 @@ event_name last_executed IS NULL definer
e1 1 mysqltest_u1@localhost
e2 1 mysqltest_u1@localhost
#
# Connection: root_con (root@localhost/events_test).
#
connection root_con;
SET GLOBAL READ_ONLY = 1;
@ -714,9 +715,9 @@ DROP EVENT e2;
SET GLOBAL READ_ONLY = 0;
#
# Connection: default
#
disconnect u1_con;
disconnect root_con;
connection default;
DROP USER mysqltest_u1@localhost;

View File

@ -12,6 +12,7 @@ CREATE USER ev_test@localhost;
GRANT ALL ON events_test.* to ev_test@localhost;
GRANT ALL ON events_test2.* to ev_test@localhost;
REVOKE EVENT ON events_test2.* FROM ev_test@localhost;
connect ev_con1,localhost,ev_test,,events_test2;
select "NEW CONNECTION";
NEW CONNECTION
NEW CONNECTION
@ -52,9 +53,12 @@ events_test two_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLE
"This should show us no events:";
SHOW EVENTS FROM test LIKE '%';
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
connection default;
GRANT EVENT ON events_test2.* TO ev_test@localhost;
connection ev_con1;
USE events_test2;
CREATE EVENT four_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42;
connection default;
USE events_test;
"We should see 4 events : one_event, two_event, three_event & four_event"
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
@ -70,9 +74,11 @@ EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_
def events_test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
def events_test three_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
def events_test two_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
connection default;
CREATE DATABASE events_test2;
USE events_test2;
CREATE EVENT five_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42;
connection ev_con1;
"Should see 4 events - one, two, three & five"
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
@ -80,7 +86,9 @@ def events_test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND
def events_test three_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
def events_test two_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
def events_test2 five_event root@localhost SQL SELECT 42 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE
connection default;
REVOKE EVENT ON events_test2.* FROM ev_test@localhost;
connection ev_con1;
USE test;
"Should see 3 events - one, two & three"
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
@ -95,8 +103,10 @@ ALTER EVENT one_event ON SCHEDULE EVERY 10 SECOND;
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
def events_test one_event ev_test@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
connection default;
USE events_test;
ALTER EVENT one_event COMMENT "comment";
connection ev_con1;
"The definer should be root@localhost"
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
@ -106,16 +116,22 @@ ALTER EVENT one_event DO SELECT 12;
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
def events_test one_event ev_test@localhost SQL SELECT 12 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE comment
connection default;
"make the definer again root@localhost"
ALTER EVENT one_event COMMENT "new comment";
connection ev_con1;
"test DROP by another user"
DROP EVENT one_event;
connection default;
"One event should not be there"
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
def events_test three_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
def events_test two_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
def events_test2 five_event root@localhost SQL SELECT 42 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE
connection ev_con1;
disconnect ev_con1;
connection default;
DROP USER ev_test@localhost;
DROP DATABASE events_test2;
DROP DATABASE events_test;

View File

@ -9,8 +9,11 @@ GRANT ALL ON *.* TO event_user2@localhost;
CREATE USER event_user3@localhost;
CREATE DATABASE events_conn3_db;
GRANT ALL ON *.* TO event_user3@localhost;
connect conn2,localhost,event_user2,,events_conn2_db;
"In the second connection we create some events which won't be dropped till the end"
connect conn3,localhost,event_user3,,events_conn3_db;
"In the second connection we create some events which won't be dropped till the end"
connection default;
USE events_conn1_test2;
CREATE EVENT ev_drop1 ON SCHEDULE EVERY 10 MINUTE DISABLE DO SELECT 1;
CREATE EVENT ev_drop2 ON SCHEDULE EVERY 10 MINUTE DISABLE DO SELECT 1;
@ -52,13 +55,21 @@ USE events_conn1_test2;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
COUNT(*)
50
connection conn2;
DROP DATABASE events_conn2_db;
connection conn3;
DROP DATABASE events_conn3_db;
connection default;
DROP DATABASE events_conn1_test2;
DROP DATABASE events_conn1_test3;
SET GLOBAL event_scheduler=off;
DROP DATABASE events_conn1_test4;
SET GLOBAL event_scheduler=on;
connection conn2;
disconnect conn2;
connection conn3;
disconnect conn3;
connection default;
USE events_test;
DROP TABLE fill_it1;
DROP TABLE fill_it2;

View File

@ -6,6 +6,7 @@ create user mysqltest_user1@localhost;
grant create, insert, select, delete on mysqltest_db2.*
to mysqltest_user1@localhost;
create database mysqltest_db2;
connect conn1,localhost,mysqltest_user1,,mysqltest_db2;
set autocommit=off;
select @@autocommit;
@@autocommit
@ -41,6 +42,8 @@ a
OK: drop event: insufficient privileges
delete from t1;
commit work;
disconnect conn1;
connection default;
drop user mysqltest_user1@localhost;
drop database mysqltest_db2;
drop database events_test;

Some files were not shown because too many files have changed in this diff Show More