mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Resize the types and widths of SHOW REPLICA STATUS (technically `INFORMATION_SCHEMA.SLAVE_STATUS`) columns to better match their possible values In case of intentionally but absurdly long lists, text columns that list an uncapped number of elements have expanded to accept as many bytes as we could support. Particularly, the first-gen `Replicate_` filters were incorrectly typed as singlular `Name()`s during MDEV-33526. Under `Name`s’ 64-char limit, they could overflow (read: truncate) even before their lengths got absurd. In response to `‘MAX_SLAVE_ERRMSG’ was not declared in this scope` in Embedded builds, a new `#ifdef HAVE_REPLICATION` guard wraps `slave_status_info` to skip this unused data in Replication-less builds. For testing, this commit forward-ports a modified cherry-pick of #3795 (the latter targets our oldest maintained LTS as part of MDEV-35948). > Assert that 1st-gen `replicate_*` filter variables display > their input – including long but reasonable lists – > correctly (without truncation) in > * direct SELECT > * [semi-new] INFORMATION_SCHEMA.GLOBAL_VARIABLES.VARIABLE_VALUE > * [new] SHOW REPLICA STATUS Reviewed-by: Brandon Nesterenko <brandon.nesterenko@mariadb.com>
65 lines
3.0 KiB
Plaintext
65 lines
3.0 KiB
Plaintext
CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_ssl_verify_server_cert=0;
|
|
#
|
|
# Basic testing of replicate_do_table.
|
|
#
|
|
SET @save_replicate_do_table = @@GLOBAL.replicate_do_table;
|
|
SELECT @save_replicate_do_table;
|
|
@save_replicate_do_table
|
|
|
|
# Scope.
|
|
SET @@SESSION.replicate_do_table = "";
|
|
ERROR HY000: Variable 'replicate_do_table' is a GLOBAL variable and should be set with SET GLOBAL
|
|
SELECT @@SESSION.replicate_do_table;
|
|
ERROR HY000: Variable 'replicate_do_table' is a GLOBAL variable
|
|
# Incorrect type.
|
|
SET @@GLOBAL.replicate_do_table=1;
|
|
ERROR 42000: Incorrect argument type to variable 'replicate_do_table'
|
|
SET @@GLOBAL.replicate_do_table=1.1;
|
|
ERROR 42000: Incorrect argument type to variable 'replicate_do_table'
|
|
SET @@GLOBAL.replicate_do_table=1e1;
|
|
ERROR 42000: Incorrect argument type to variable 'replicate_do_table'
|
|
# Incorrect arguments.
|
|
SET @@GLOBAL.replicate_do_table="t1";
|
|
ERROR HY000: Incorrect arguments to SET
|
|
SET @@GLOBAL.replicate_do_table="test.t1, t2";
|
|
ERROR HY000: Incorrect arguments to SET
|
|
SET @@GLOBAL.replicate_do_table="test.,t1";
|
|
ERROR HY000: Incorrect arguments to SET
|
|
# Argument size acceptance.
|
|
SELECT GROUP_CONCAT(CONCAT("database_name.long_table_name_", seq) SEPARATOR ",")
|
|
INTO @name FROM seq_1_to_8;
|
|
SELECT LENGTH(@name);
|
|
LENGTH(@name)
|
|
255
|
|
SET @@GLOBAL.replicate_do_table= @name;
|
|
SELECT @@GLOBAL.replicate_do_table;
|
|
@@GLOBAL.replicate_do_table
|
|
database_name.long_table_name_5,database_name.long_table_name_1,database_name.long_table_name_6,database_name.long_table_name_2,database_name.long_table_name_7,database_name.long_table_name_3,database_name.long_table_name_8,database_name.long_table_name_4
|
|
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='replicate_do_table';
|
|
VARIABLE_VALUE
|
|
database_name.long_table_name_5,database_name.long_table_name_1,database_name.long_table_name_6,database_name.long_table_name_2,database_name.long_table_name_7,database_name.long_table_name_3,database_name.long_table_name_8,database_name.long_table_name_4
|
|
Replicate_Do_Table = 'database_name.long_table_name_5,database_name.long_table_name_1,database_name.long_table_name_6,database_name.long_table_name_2,database_name.long_table_name_7,database_name.long_table_name_3,database_name.long_table_name_8,database_name.long_table_name_4'
|
|
# Argument syntax.
|
|
SET @@GLOBAL.replicate_do_table="test.t1,,,,,test.t3";
|
|
SELECT @@GLOBAL.replicate_do_table;
|
|
@@GLOBAL.replicate_do_table
|
|
test.t3,test.t1
|
|
SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='replicate_do_table';
|
|
VARIABLE_NAME VARIABLE_VALUE
|
|
REPLICATE_DO_TABLE test.t3,test.t1
|
|
Replicate_Do_Table = 'test.t3,test.t1'
|
|
SET @@GLOBAL.replicate_do_table="test.t1,,,test2.t2,,,test.t3";
|
|
SELECT @@GLOBAL.replicate_do_table;
|
|
@@GLOBAL.replicate_do_table
|
|
test.t3,test.t1,test2.t2
|
|
SET @@GLOBAL.replicate_do_table="";
|
|
SELECT @@GLOBAL.replicate_do_table;
|
|
@@GLOBAL.replicate_do_table
|
|
|
|
SET @@GLOBAL.replicate_do_table=null;
|
|
SELECT @@GLOBAL.replicate_do_table;
|
|
@@GLOBAL.replicate_do_table
|
|
|
|
# Cleanup.
|
|
SET @@GLOBAL.replicate_do_table = @save_replicate_do_table;
|