Skip to content

Commit a34c34d

Browse files
committed
Merge 10.3 into 10.4
2 parents 33f5578 + 1d5f6a0 commit a34c34d

File tree

6 files changed

+88
-4
lines changed

6 files changed

+88
-4
lines changed

mysql-test/suite/federated/federatedx.result

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2283,6 +2283,22 @@ connection default;
22832283
connection master;
22842284
CREATE TABLE t1 (a INT) ENGINE=FEDERATED CONNECTION='mysql://@127.0.0.1:SLAVE_PORT/federated/t1';
22852285
ERROR HY000: Can't create federated table. Foreign data src error: database: 'federated' username: '' hostname: '127.0.0.1'
2286+
#
2287+
# MDEV-21049 Segfault in create federatedx table with empty hostname
2288+
#
2289+
connection master;
2290+
CREATE TABLE federated.t1 (x int) ENGINE=FEDERATED
2291+
CONNECTION='mysql://root@:SLAVE_PORT/federated/t1';
2292+
ERROR HY000: Can't create federated table. Foreign data src error: database: 'federated' username: 'root' hostname: 'localhost'
2293+
connection slave;
2294+
CREATE TABLE federated.t1(x int);
2295+
connection master;
2296+
CREATE TABLE federated.t1 (x int) ENGINE=FEDERATED
2297+
CONNECTION='mysql://root@:SLAVE_PORT/federated/t1';
2298+
DROP TABLE federated.t1;
2299+
connection slave;
2300+
DROP TABLE federated.t1;
2301+
connection default;
22862302
connection master;
22872303
DROP TABLE IF EXISTS federated.t1;
22882304
DROP DATABASE IF EXISTS federated;

mysql-test/suite/federated/federatedx.test

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2010,4 +2010,25 @@ connection master;
20102010
--error ER_CANT_CREATE_FEDERATED_TABLE
20112011
eval CREATE TABLE t1 (a INT) ENGINE=FEDERATED CONNECTION='mysql://@127.0.0.1:$SLAVE_MYPORT/federated/t1';
20122012

2013+
--echo #
2014+
--echo # MDEV-21049 Segfault in create federatedx table with empty hostname
2015+
--echo #
2016+
connection master;
2017+
--replace_result $SLAVE_MYPORT SLAVE_PORT
2018+
--error ER_CANT_CREATE_FEDERATED_TABLE
2019+
eval CREATE TABLE federated.t1 (x int) ENGINE=FEDERATED
2020+
CONNECTION='mysql://root@:$SLAVE_MYPORT/federated/t1';
2021+
2022+
connection slave;
2023+
CREATE TABLE federated.t1(x int);
2024+
connection master;
2025+
--replace_result $SLAVE_MYPORT SLAVE_PORT
2026+
eval CREATE TABLE federated.t1 (x int) ENGINE=FEDERATED
2027+
CONNECTION='mysql://root@:$SLAVE_MYPORT/federated/t1';
2028+
2029+
DROP TABLE federated.t1;
2030+
connection slave;
2031+
DROP TABLE federated.t1;
2032+
connection default;
2033+
20132034
source include/federated_cleanup.inc;

mysql-test/suite/innodb/r/instant_alter_debug.result

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,3 +328,21 @@ WHERE variable_name = 'innodb_instant_alter_column';
328328
instants
329329
22
330330
SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency;
331+
#
332+
# MDEV-21045 AddressSanitizer: use-after-poison in mem_heap_dup / row_log_table_get_pk_col
333+
#
334+
CREATE TABLE t1 (a TEXT) ENGINE = InnoDB ROW_FORMAT=REDUNDANT;
335+
INSERT INTO t1 (a) VALUES ('foo');
336+
ALTER TABLE t1 ADD COLUMN b INT DEFAULT 0,algorithm=instant;
337+
connect con2,localhost,root,,test;
338+
SET DEBUG_SYNC='innodb_inplace_alter_table_enter SIGNAL onlinealter WAIT_FOR update';
339+
ALTER TABLE t1 ADD PRIMARY KEY (b);
340+
connection default;
341+
SET DEBUG_SYNC='now WAIT_FOR onlinealter';
342+
UPDATE t1 SET b = 1;
343+
SET DEBUG_SYNC='now SIGNAL update';
344+
connection con2;
345+
connection default;
346+
SET DEBUG_SYNC='RESET';
347+
disconnect con2;
348+
DROP TABLE t1;

mysql-test/suite/innodb/t/instant_alter_debug.test

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,3 +362,29 @@ FROM information_schema.global_status
362362
WHERE variable_name = 'innodb_instant_alter_column';
363363

364364
SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency;
365+
366+
--echo #
367+
--echo # MDEV-21045 AddressSanitizer: use-after-poison in mem_heap_dup / row_log_table_get_pk_col
368+
--echo #
369+
CREATE TABLE t1 (a TEXT) ENGINE = InnoDB ROW_FORMAT=REDUNDANT;
370+
INSERT INTO t1 (a) VALUES ('foo');
371+
372+
ALTER TABLE t1 ADD COLUMN b INT DEFAULT 0,algorithm=instant;
373+
374+
--connect (con2,localhost,root,,test)
375+
SET DEBUG_SYNC='innodb_inplace_alter_table_enter SIGNAL onlinealter WAIT_FOR update';
376+
--send
377+
ALTER TABLE t1 ADD PRIMARY KEY (b);
378+
379+
--connection default
380+
SET DEBUG_SYNC='now WAIT_FOR onlinealter';
381+
UPDATE t1 SET b = 1;
382+
SET DEBUG_SYNC='now SIGNAL update';
383+
384+
--connection con2
385+
--reap
386+
387+
--connection default
388+
SET DEBUG_SYNC='RESET';
389+
--disconnect con2
390+
DROP TABLE t1;

storage/federatedx/ha_federatedx.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -807,12 +807,12 @@ static int parse_url(MEM_ROOT *mem_root, FEDERATEDX_SHARE *share,
807807
goto error;
808808

809809
if (share->hostname[0] == '\0')
810-
share->hostname= NULL;
810+
share->hostname= strdup_root(mem_root, my_localhost);
811811

812812
}
813813
if (!share->port)
814814
{
815-
if (!share->hostname || strcmp(share->hostname, my_localhost) == 0)
815+
if (0 == strcmp(share->hostname, my_localhost))
816816
share->socket= (char *) MYSQL_UNIX_ADDR;
817817
else
818818
share->port= MYSQL_PORT;
@@ -3394,8 +3394,7 @@ int ha_federatedx::create(const char *name, TABLE *table_arg,
33943394
goto error;
33953395

33963396
/* loopback socket connections hang due to LOCK_open mutex */
3397-
if ((!tmp_share.hostname || !strcmp(tmp_share.hostname,my_localhost)) &&
3398-
!tmp_share.port)
3397+
if (0 == strcmp(tmp_share.hostname, my_localhost) && !tmp_share.port)
33993398
goto error;
34003399

34013400
/*

storage/innobase/row/row0log.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,6 +1166,10 @@ row_log_table_get_pk_col(
11661166

11671167
field = rec_get_nth_field(rec, offsets, i, &len);
11681168

1169+
if (len == UNIV_SQL_DEFAULT) {
1170+
field = log->instant_field_value(i, &len);
1171+
}
1172+
11691173
if (len == UNIV_SQL_NULL) {
11701174
if (!log->allow_not_null) {
11711175
return(DB_INVALID_NULL);

0 commit comments

Comments
 (0)