Skip to content

Commit 94b4935

Browse files
author
Alexey Botchkov
committed
MDEV-20744 SET GLOBAL replicate_do_db = DEFAULT causes crash.
DEFAULT for the replicate_do_db is the "" as our documentation states.
1 parent 897ea21 commit 94b4935

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

mysql-test/suite/sys_vars/r/replicate_do_db_basic.result

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,9 @@ SET @@GLOBAL.replicate_do_db=null;
3737
SELECT @@GLOBAL.replicate_do_db;
3838
@@GLOBAL.replicate_do_db
3939

40+
SET @@GLOBAL.replicate_do_db=DEFAULT;
41+
SELECT @@GLOBAL.replicate_do_db;
42+
@@GLOBAL.replicate_do_db
43+
4044
# Cleanup.
4145
SET @@GLOBAL.replicate_do_db = @save_replicate_do_db;

mysql-test/suite/sys_vars/t/replicate_do_db_basic.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,8 @@ SELECT @@GLOBAL.replicate_do_db;
3838
SET @@GLOBAL.replicate_do_db=null;
3939
SELECT @@GLOBAL.replicate_do_db;
4040

41+
SET @@GLOBAL.replicate_do_db=DEFAULT;
42+
SELECT @@GLOBAL.replicate_do_db;
43+
4144
--echo # Cleanup.
4245
SET @@GLOBAL.replicate_do_db = @save_replicate_do_db;

sql/sys_vars.ic

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,11 @@ public:
614614
{ DBUG_ASSERT(FALSE); }
615615

616616
void global_save_default(THD *thd, set_var *var)
617-
{ DBUG_ASSERT(FALSE); }
617+
{
618+
char *ptr= (char*)(intptr)option.def_value;
619+
var->save_result.string_value.str= ptr;
620+
var->save_result.string_value.length= ptr ? strlen(ptr) : 0;
621+
}
618622

619623
bool session_update(THD *thd, set_var *var)
620624
{

0 commit comments

Comments
 (0)