Skip to content
/ server Public

Commit 41b14ef

Browse files
MDEV-38391 Memory leak in innodb.import_hidden_fts_debug
update_vcol_pos(): Move DBUG_EXECUTE_IF before pars_info_create() to prevent memory leak and fix test to properly save/restore debug_dbug variable.
1 parent 635a850 commit 41b14ef

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,22 @@ f2 CHAR(2) NOT NULL,
2626
f3 INT as (f1) VIRTUAL, INDEX(f3))ENGINE=InnoDB;
2727
ALTER TABLE t1 DISCARD TABLESPACE;
2828
restore: t1 .ibd and .cfg files
29+
SET @save_debug=@@debug_dbug;
2930
SET DEBUG_DBUG="+d,ib_import_set_index_root_failure";
3031
ALTER TABLE t1 IMPORT TABLESPACE;
3132
ERROR HY000: Too many active concurrent transactions
32-
SET DEBUG_DBUG="-d,ib_import_set_index_root_failure";
33+
set DEBUG_DBUG=@save_dbug;
34+
SET @save_debug=@@debug_dbug;
3335
SET DEBUG_DBUG="+d,ib_import_vcol_update_fail";
3436
ALTER TABLE t1 IMPORT TABLESPACE;
3537
ERROR 23000: Can't write; duplicate key in table 't1'
36-
SET DEBUG_DBUG="-d,ib_import_vcol_update_fail";
38+
set DEBUG_DBUG=@save_dbug;
3739
restore: t1 .ibd and .cfg files
40+
SET @save_dbug=@@debug_dbug;
3841
SET DEBUG_DBUG="+d,ib_import_fts_error";
3942
ALTER TABLE t1 IMPORT TABLESPACE;
4043
ERROR 23000: Can't write; duplicate key in table 't1'
41-
SET DEBUG_DBUG="-d,ib_import_fts_error";
44+
SET DEBUG_DBUG=@save_dbug;
4245
unlink: t1.ibd
4346
unlink: t1.cfg
4447
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,29 @@ ib_restore_tablespaces("test", "t1");
3939
EOF
4040

4141
--disable_warnings
42+
SET @save_debug=@@debug_dbug;
4243
SET DEBUG_DBUG="+d,ib_import_set_index_root_failure";
4344
--error ER_TOO_MANY_CONCURRENT_TRXS
4445
ALTER TABLE t1 IMPORT TABLESPACE;
45-
SET DEBUG_DBUG="-d,ib_import_set_index_root_failure";
46+
set DEBUG_DBUG=@save_dbug;
4647

48+
SET @save_debug=@@debug_dbug;
4749
SET DEBUG_DBUG="+d,ib_import_vcol_update_fail";
4850
--error ER_DUP_KEY
4951
ALTER TABLE t1 IMPORT TABLESPACE;
50-
SET DEBUG_DBUG="-d,ib_import_vcol_update_fail";
52+
set DEBUG_DBUG=@save_dbug;
5153

5254
perl;
5355
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
5456
ib_discard_tablespaces("test", "t1");
5557
ib_restore_tablespaces("test", "t1");
5658
EOF
5759

60+
SET @save_dbug=@@debug_dbug;
5861
SET DEBUG_DBUG="+d,ib_import_fts_error";
5962
--error ER_DUP_KEY
6063
ALTER TABLE t1 IMPORT TABLESPACE;
61-
SET DEBUG_DBUG="-d,ib_import_fts_error";
64+
SET DEBUG_DBUG=@save_dbug;
6265
--enable_warnings
6366

6467
perl;

storage/innobase/row/row0import.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4558,11 +4558,11 @@ static void row_import_autoinc(dict_table_t *table, row_prebuilt_t *prebuilt,
45584558
@return DB_SUCCESS or error code */
45594559
dberr_t update_vcol_pos(table_id_t table_id, ulint new_pos, trx_t *trx)
45604560
{
4561+
DBUG_EXECUTE_IF("ib_import_vcol_update_fail",
4562+
return DB_DUPLICATE_KEY;);
45614563
pars_info_t *info= pars_info_create();
45624564
pars_info_add_ull_literal(info, "id", table_id);
45634565
pars_info_add_int4_literal(info, "old_pos", new_pos - 1);
4564-
DBUG_EXECUTE_IF("ib_import_vcol_update_fail",
4565-
return DB_DUPLICATE_KEY;);
45664566
return que_eval_sql(info,
45674567
"PROCEDURE UPDATE_VCOL () IS\n"
45684568
"BEGIN\n"

0 commit comments

Comments
 (0)