Skip to content

Commit f2a9445

Browse files
committed
Merge 10.4 into 10.5
2 parents 3b251e2 + a4996f9 commit f2a9445

18 files changed

+453
-97
lines changed

mysql-test/main/alter_table.result

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2564,6 +2564,44 @@ drop view v1;
25642564
# End of 10.3 tests
25652565
#
25662566
#
2567+
# MDEV-22563 Segfault on duplicate free of Item_func_in::array
2568+
#
2569+
create or replace table person_principal (
2570+
person_id bigint not null,
2571+
insurant_id varchar(10) not null,
2572+
principal_id bigint not null,
2573+
principal_officer_id bigint not null,
2574+
nursing_degree tinyint null,
2575+
nursing_degree_valid_from date not null default cast(current_timestamp(6) as date),
2576+
carma_user_id bigint not null,
2577+
current_date_time timestamp(6) not null default current_timestamp(6) on update current_timestamp(6),
2578+
constraint pk_person_principal primary key (person_id asc),
2579+
constraint ck_person_principal_nursing_degree check (nursing_degree in (1,2,3,4,5)));
2580+
Warnings:
2581+
Warning 1280 Name 'pk_person_principal' ignored for PRIMARY key.
2582+
create or replace table person_principal_hist (
2583+
person_id bigint not null,
2584+
insurant_id varchar(10) not null,
2585+
principal_id bigint not null,
2586+
principal_officer_id bigint not null,
2587+
nursing_degree tinyint null,
2588+
nursing_degree_valid_from date not null default cast(now() as date),
2589+
carma_user_id bigint not null,
2590+
orig_date_time datetime(6) not null,
2591+
constraint pk_person_principal_hist primary key (person_id asc, orig_date_time asc),
2592+
constraint ck_person_principal_hist_nursing_degree check (nursing_degree in (1,2,3,4,5)));
2593+
Warnings:
2594+
Warning 1280 Name 'pk_person_principal_hist' ignored for PRIMARY key.
2595+
insert into person_principal (person_id, insurant_id, principal_id, principal_officer_id, nursing_degree, nursing_degree_valid_from, carma_user_id)
2596+
values (1, 'A123456789', 5, 1, 1, '2018-05-06', 1);
2597+
alter table person_principal add column if not exists date_mask tinyint null;
2598+
update person_principal set date_mask = 0;
2599+
alter table person_principal modify column date_mask tinyint not null;
2600+
drop tables person_principal_hist, person_principal;
2601+
#
2602+
# End of 10.4 tests
2603+
#
2604+
#
25672605
# MDEV-16290 ALTER TABLE ... RENAME COLUMN syntax
25682606
#
25692607
SET @save_default_engine= @@DEFAULT_STORAGE_ENGINE;
@@ -3250,9 +3288,6 @@ i2 b
32503288
PRIMARY a
32513289
drop table t1;
32523290
#
3253-
# End of 10.5 tests
3254-
#
3255-
#
32563291
# ALTER TABLE IF EXISTS
32573292
#
32583293
create table t1 (a int);

mysql-test/main/alter_table.test

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2077,6 +2077,44 @@ drop view v1;
20772077
--echo # End of 10.3 tests
20782078
--echo #
20792079

2080+
--echo #
2081+
--echo # MDEV-22563 Segfault on duplicate free of Item_func_in::array
2082+
--echo #
2083+
create or replace table person_principal (
2084+
person_id bigint not null,
2085+
insurant_id varchar(10) not null,
2086+
principal_id bigint not null,
2087+
principal_officer_id bigint not null,
2088+
nursing_degree tinyint null,
2089+
nursing_degree_valid_from date not null default cast(current_timestamp(6) as date),
2090+
carma_user_id bigint not null,
2091+
current_date_time timestamp(6) not null default current_timestamp(6) on update current_timestamp(6),
2092+
constraint pk_person_principal primary key (person_id asc),
2093+
constraint ck_person_principal_nursing_degree check (nursing_degree in (1,2,3,4,5)));
2094+
2095+
create or replace table person_principal_hist (
2096+
person_id bigint not null,
2097+
insurant_id varchar(10) not null,
2098+
principal_id bigint not null,
2099+
principal_officer_id bigint not null,
2100+
nursing_degree tinyint null,
2101+
nursing_degree_valid_from date not null default cast(now() as date),
2102+
carma_user_id bigint not null,
2103+
orig_date_time datetime(6) not null,
2104+
constraint pk_person_principal_hist primary key (person_id asc, orig_date_time asc),
2105+
constraint ck_person_principal_hist_nursing_degree check (nursing_degree in (1,2,3,4,5)));
2106+
2107+
insert into person_principal (person_id, insurant_id, principal_id, principal_officer_id, nursing_degree, nursing_degree_valid_from, carma_user_id)
2108+
values (1, 'A123456789', 5, 1, 1, '2018-05-06', 1);
2109+
alter table person_principal add column if not exists date_mask tinyint null;
2110+
update person_principal set date_mask = 0;
2111+
alter table person_principal modify column date_mask tinyint not null;
2112+
drop tables person_principal_hist, person_principal;
2113+
2114+
--echo #
2115+
--echo # End of 10.4 tests
2116+
--echo #
2117+
20802118
--echo #
20812119
--echo # MDEV-16290 ALTER TABLE ... RENAME COLUMN syntax
20822120
--echo #
@@ -2457,10 +2495,6 @@ where t.name='test/t1' and t.table_id = i.table_id and i.index_id = f.index_id
24572495
order by k, c;
24582496
drop table t1;
24592497

2460-
--echo #
2461-
--echo # End of 10.5 tests
2462-
--echo #
2463-
24642498
--echo #
24652499
--echo # ALTER TABLE IF EXISTS
24662500
--echo #
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
connection node_2;
2+
connection node_1;
3+
connection node_2;
4+
CREATE TABLE t1(a int not null primary key auto_increment,b int) engine=InnoDB;
5+
insert into t1 values (NULL,1);
6+
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
7+
connection node_2a;
8+
begin;
9+
update t1 set a = 5;
10+
connection node_2;
11+
select * from t1;
12+
a b
13+
2 1
14+
disconnect node_2a;
15+
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
16+
connection node_2a;
17+
begin;
18+
update t1 set a =5;
19+
connection node_2;
20+
select * from t1;
21+
a b
22+
2 1
23+
disconnect node_2a;
24+
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
25+
connection node_2a;
26+
begin;
27+
update t1 set a =5, b=2;
28+
connection node_2;
29+
ALTER TABLE t1 ADD UNIQUE KEY b1(b);
30+
ALTER TABLE t1 DROP KEY b1;
31+
select * from t1;
32+
a b
33+
2 1
34+
disconnect node_2a;
35+
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
36+
connection node_2a;
37+
begin;
38+
update t1 set a =5, b=2;
39+
connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2;
40+
connection node_2b;
41+
begin;
42+
update t1 set a =6, b=7;
43+
connection node_2;
44+
ALTER TABLE t1 ADD UNIQUE KEY b2(b);
45+
ALTER TABLE t1 DROP KEY b2;
46+
select * from t1;
47+
a b
48+
2 1
49+
disconnect node_2a;
50+
disconnect node_2b;
51+
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
52+
connection node_2a;
53+
SET SESSION wsrep_on=OFF;
54+
begin;
55+
update t1 set a =5, b=2;
56+
connection node_2;
57+
ALTER TABLE t1 ADD UNIQUE KEY b3(b);
58+
select * from t1;
59+
a b
60+
2 1
61+
disconnect node_2a;
62+
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
63+
connection node_2a;
64+
SET SESSION wsrep_on=OFF;
65+
begin;
66+
update t1 set a =5, b=2;
67+
connection node_2;
68+
select * from t1;
69+
a b
70+
2 1
71+
disconnect node_2a;
72+
drop table t1;

mysql-test/suite/galera/r/galera_bf_lock_wait.result

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
connection node_2;
22
connection node_1;
3+
connection node_1;
4+
call mtr.add_suppression("WSREP: Trying to continue unpaused monitor");
35
CREATE TABLE t1 ENGINE=InnoDB select 1 as a, 1 as b union select 2, 2;
46
ALTER TABLE t1 add primary key(a);
57
CREATE PROCEDURE p1()
@@ -19,7 +21,7 @@ connect node_2_p1, 127.0.0.1, root, , test, $NODE_MYPORT_2;
1921
call p1;
2022
connect node_2_p2, 127.0.0.1, root, , test, $NODE_MYPORT_2;
2123
call p1;
22-
connection default;
24+
connection node_1;
2325
checking error log for 'BF lock wait long' message for 10 times every 10 seconds ...
2426
drop table t1;
2527
drop procedure p1;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
!include ../galera_2nodes.cnf
2+
3+
[mysqld.1]
4+
wsrep-debug=SERVER
5+
6+
[mysqld.2]
7+
wsrep-debug=SERVER
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
--source include/galera_cluster.inc
2+
3+
#
4+
# Test case 1: Start a transaction on node_2a and kill it
5+
# from other connection on same node
6+
#
7+
8+
--connection node_2
9+
CREATE TABLE t1(a int not null primary key auto_increment,b int) engine=InnoDB;
10+
insert into t1 values (NULL,1);
11+
12+
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
13+
--connection node_2a
14+
begin;
15+
update t1 set a = 5;
16+
17+
--connection node_2
18+
19+
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1
20+
--source include/wait_condition.inc
21+
22+
--let $k_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1`
23+
24+
--disable_query_log
25+
--eval KILL $k_thread
26+
--enable_query_log
27+
28+
select * from t1;
29+
--disconnect node_2a
30+
31+
#
32+
# Test case 2: Start a transaction on node_2a and use
33+
# kill query from other connection on same node
34+
#
35+
36+
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
37+
--connection node_2a
38+
begin;
39+
update t1 set a =5;
40+
41+
--connection node_2
42+
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1
43+
--source include/wait_condition.inc
44+
45+
--let $k_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1`
46+
47+
--disable_query_log
48+
--eval KILL QUERY $k_thread
49+
--enable_query_log
50+
51+
select * from t1;
52+
--disconnect node_2a
53+
#
54+
# Test case 3: Start a transaction on node_2a and start a DDL on other transaction
55+
# that will then abort node_2a transaction
56+
#
57+
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
58+
--connection node_2a
59+
begin;
60+
update t1 set a =5, b=2;
61+
62+
--connection node_2
63+
ALTER TABLE t1 ADD UNIQUE KEY b1(b);
64+
ALTER TABLE t1 DROP KEY b1;
65+
66+
select * from t1;
67+
68+
--disconnect node_2a
69+
70+
#
71+
# Test case 4: Start a transaction on node_2a and conflicting transaction on node_2b
72+
# and start a DDL on other transaction that will then abort node_2a and node_2b
73+
# transactions
74+
#
75+
76+
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
77+
--connection node_2a
78+
begin;
79+
update t1 set a =5, b=2;
80+
81+
--connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2
82+
--connection node_2b
83+
begin;
84+
send update t1 set a =6, b=7;
85+
86+
--connection node_2
87+
ALTER TABLE t1 ADD UNIQUE KEY b2(b);
88+
ALTER TABLE t1 DROP KEY b2;
89+
90+
select * from t1;
91+
92+
--disconnect node_2a
93+
--disconnect node_2b
94+
95+
#
96+
# Test case 5: Start a transaction on node_2a with wsrep disabled
97+
# and start a DDL on other transaction that will then abort node_2a
98+
# transactions
99+
#
100+
101+
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
102+
--connection node_2a
103+
SET SESSION wsrep_on=OFF;
104+
begin;
105+
update t1 set a =5, b=2;
106+
107+
--connection node_2
108+
ALTER TABLE t1 ADD UNIQUE KEY b3(b);
109+
110+
select * from t1;
111+
112+
--disconnect node_2a
113+
114+
#
115+
# Test case 6: Start a transaction on node_2a with wsrep disabled
116+
# and kill it from other connection on same node
117+
#
118+
119+
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
120+
--connection node_2a
121+
SET SESSION wsrep_on=OFF;
122+
begin;
123+
update t1 set a =5, b=2;
124+
125+
--connection node_2
126+
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1
127+
--source include/wait_condition.inc
128+
129+
--let $k_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1`
130+
131+
--disable_query_log
132+
--eval KILL $k_thread
133+
--enable_query_log
134+
135+
136+
select * from t1;
137+
138+
--disconnect node_2a
139+
140+
drop table t1;
141+
142+
143+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
!include ../galera_2nodes.cnf
2+
3+
[mysqld.1]
4+
wsrep-debug=SERVER
5+
6+
[mysqld.2]
7+
wsrep-debug=SERVER

mysql-test/suite/galera/t/galera_bf_lock_wait.test

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
--source include/galera_cluster.inc
22
--source include/big_test.inc
3-
3+
4+
--connection node_1
5+
6+
call mtr.add_suppression("WSREP: Trying to continue unpaused monitor");
7+
48
CREATE TABLE t1 ENGINE=InnoDB select 1 as a, 1 as b union select 2, 2;
59
ALTER TABLE t1 add primary key(a);
610

@@ -28,7 +32,7 @@ send call p1;
2832
--connect node_2_p2, 127.0.0.1, root, , test, $NODE_MYPORT_2
2933
send call p1;
3034

31-
connection default;
35+
connection node_1;
3236
let $counter=10;
3337
let $sleep_period=10;
3438

sql/field.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11086,7 +11086,7 @@ Virtual_column_info* Virtual_column_info::clone(THD *thd)
1108611086
return NULL;
1108711087
if (expr)
1108811088
{
11089-
dst->expr= expr->get_copy(thd);
11089+
dst->expr= expr->build_clone(thd);
1109011090
if (!dst->expr)
1109111091
return NULL;
1109211092
}

0 commit comments

Comments
 (0)