Commit 2481ed22 authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

Merge branch '10.1' into 10.2

parents 3be95ee0 9f5b2856
include/master-slave.inc
[connection master]
RESET MASTER;
DROP DATABASE IF EXISTS db_717;
DROP EVENT IF EXISTS test.e_x1;
set @saved_global_binlog_format = @@global.binlog_format;
set @saved_local_binlog_format = @@session.binlog_format;
SET GLOBAL BINLOG_FORMAT = STATEMENT;
SET SESSION BINLOG_FORMAT = STATEMENT;
CREATE DATABASE db_717;
CREATE FUNCTION db_717.f1() RETURNS INT RETURN 1;
DROP DATABASE db_717;
CREATE FUNCTION db_717.f2() RETURNS INT RETURN 1;
CREATE DATABASE db_717;
CREATE EVENT db_717.e_x1 ON SCHEDULE EVERY 1000 HOUR DO CREATE TABLE t1(id int);
DROP DATABASE db_717;
CREATE EVENT db_717.e_x2 ON SCHEDULE EVERY 1000 HOUR DO CREATE TABLE t1(id int);
CREATE DATABASE db_717;
CREATE EVENT test.e_x1 ON SCHEDULE EVERY 1000 HOUR DO CREATE TABLE t1(id int);
DROP DATABASE db_717;
ALTER EVENT test.e_x1 RENAME TO db_717.e_x2;
DROP EVENT test.e_x1;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # DROP DATABASE IF EXISTS db_717
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP EVENT IF EXISTS test.e_x1
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # CREATE DATABASE db_717
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `db_717`.`f1`() RETURNS int(11)
RETURN 1
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # DROP DATABASE db_717
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # CREATE DATABASE db_717
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` EVENT db_717.e_x1 ON SCHEDULE EVERY 1000 HOUR DO CREATE TABLE t1(id int)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # DROP DATABASE db_717
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # CREATE DATABASE db_717
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` EVENT test.e_x1 ON SCHEDULE EVERY 1000 HOUR DO CREATE TABLE t1(id int)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # DROP DATABASE db_717
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP EVENT test.e_x1
SET GLOBAL BINLOG_FORMAT = @saved_global_binlog_format;
SET SESSION BINLOG_FORMAT = @saved_local_binlog_format;
include/rpl_end.inc
# MDEV-717
# DROP DATABASE and CREATE PROCEDURE|FUNCTION|EVENT
# statements can appear in wrong order in the binlog.
#
# Note - the test can be undeterministic.
--source include/master-slave.inc
RESET MASTER;
--disable_warnings
DROP DATABASE IF EXISTS db_717;
DROP EVENT IF EXISTS test.e_x1;
--enable_warnings
set @saved_global_binlog_format = @@global.binlog_format;
set @saved_local_binlog_format = @@session.binlog_format;
SET GLOBAL BINLOG_FORMAT = STATEMENT;
SET SESSION BINLOG_FORMAT = STATEMENT;
# test function creation
CREATE DATABASE db_717;
CREATE FUNCTION db_717.f1() RETURNS INT RETURN 1;
--send
DROP DATABASE db_717;
--connection master1
--error 0,ER_BAD_DB_ERROR
CREATE FUNCTION db_717.f2() RETURNS INT RETURN 1;
--connection master
--reap
# test event creation
CREATE DATABASE db_717;
CREATE EVENT db_717.e_x1 ON SCHEDULE EVERY 1000 HOUR DO CREATE TABLE t1(id int);
--send
DROP DATABASE db_717;
--connection master1
--error 0,ER_BAD_DB_ERROR
CREATE EVENT db_717.e_x2 ON SCHEDULE EVERY 1000 HOUR DO CREATE TABLE t1(id int);
--connection master
--reap
# test event modification
CREATE DATABASE db_717;
CREATE EVENT test.e_x1 ON SCHEDULE EVERY 1000 HOUR DO CREATE TABLE t1(id int);
--send
DROP DATABASE db_717;
--connection master1
--error 0,ER_BAD_DB_ERROR
ALTER EVENT test.e_x1 RENAME TO db_717.e_x2;
--connection master
--reap
DROP EVENT test.e_x1;
source include/show_binlog_events.inc;
SET GLOBAL BINLOG_FORMAT = @saved_global_binlog_format;
SET SESSION BINLOG_FORMAT = @saved_local_binlog_format;
--source include/rpl_end.inc
......@@ -4248,7 +4248,7 @@ mariadb_dyncol_unpack(DYNAMIC_COLUMN *str,
{
*names= my_malloc(sizeof(LEX_STRING) * header.column_count +
DYNCOL_NUM_CHAR * header.column_count, MYF(0));
nm= (char *)(names + sizeof(LEX_STRING) * header.column_count);
nm= (char *)((*names) + header.column_count);
}
else
{
......
......@@ -691,13 +691,54 @@ void test_update_many(uint *column_numbers, uint *column_values,
mariadb_dyncol_free(&str2);
}
static void test_mdev_9773()
{
int rc;
uint i;
uint num_keys[5]= {1,2,3,4,5};
char const *strval[]= {"Val1", "Val2", "Val3", "Val4", "Val5"};
DYNAMIC_COLUMN_VALUE vals[5];
DYNAMIC_COLUMN dynstr;
uint unpack_columns= 0;
MYSQL_LEX_STRING *unpack_keys= 0;
DYNAMIC_COLUMN_VALUE *unpack_vals= 0;
for (i = 0; i < 5; i++)
{
vals[i].type= DYN_COL_STRING;
vals[i].x.string.value.str= (char *)strval[i];
vals[i].x.string.value.length= strlen(strval[i]);
vals[i].x.string.charset= &my_charset_latin1;
}
mariadb_dyncol_init(&dynstr);
/* create numeric */
rc= mariadb_dyncol_create_many_num(&dynstr, 5, num_keys, vals, 1);
if (rc == ER_DYNCOL_OK)
rc= mariadb_dyncol_unpack(&dynstr, &unpack_columns, &unpack_keys,
&unpack_vals);
ok (rc == ER_DYNCOL_OK && unpack_columns == 5, "5 fields unpacked");
for (i = 0; i < unpack_columns; i++)
{
ok(memcmp(unpack_vals[i].x.string.value.str,
vals[i].x.string.value.str, vals[i].x.string.value.length) == 0,
"unpack %u", i);
}
my_free(unpack_keys);
my_free(unpack_vals);
mariadb_dyncol_free(&dynstr);
}
int main(int argc __attribute__((unused)), char **argv)
{
uint i;
char *big_string= (char *)malloc(1024*1024);
MY_INIT(argv[0]);
plan(62);
plan(68);
if (!big_string)
exit(1);
......@@ -830,6 +871,7 @@ int main(int argc __attribute__((unused)), char **argv)
}
test_mdev_4994();
test_mdev_4995();
test_mdev_9773();
my_end(0);
return exit_status();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment