Bug #106323 relay_log_space_limit VALID_RANGE improperly defined
Submitted: 28 Jan 2022 9:48 Modified: 18 Oct 2022 0:48
Reporter: Przemyslaw Malkowski Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:8.0, 5.7 OS:Any
Assigned to: CPU Architecture:Any

[28 Jan 2022 9:48] Przemyslaw Malkowski
Description:
The docs say the limit is 4GB: https://dev.mysql.com/doc/refman/8.0/en/replication-options-replica.html#option_mysqld_rel...

But I am able to set much bigger than that:

mysql > select @@relay_log_space_limit/1024/1024/1024,@@version,@@version_comment;
+----------------------------------------+------------+------------------------------+
| @@relay_log_space_limit/1024/1024/1024 | @@version  | @@version_comment            |
+----------------------------------------+------------+------------------------------+
|                        50.000000000000 | 5.7.35-log | MySQL Community Server (GPL) |
+----------------------------------------+------------+------------------------------+
1 row in set (0.00 sec)

mysql > select @@relay_log_space_limit/1024/1024/1024,@@version,@@version_comment;
+----------------------------------------+-----------+------------------------------+
| @@relay_log_space_limit/1024/1024/1024 | @@version | @@version_comment            |
+----------------------------------------+-----------+------------------------------+
|                        40.000000000000 | 8.0.25    | MySQL Community Server - GPL |
+----------------------------------------+-----------+------------------------------+
1 row in set (0.00 sec)

And to be honest, such a small limit as 4GB for this one does not make any sense anyway.

How to repeat:
Set relay_log_space_limit=50G in config file.

Suggested fix:
Correct the documentation.
[28 Jan 2022 10:39] MySQL Verification Team
Hello Przemyslaw,

Thank you for the report. 

Thanks,
Umesh
[1 Jul 2022 18:17] Jon Stephens
I think this is a Server bug.

Consider the following from sys_vars.cc:

static Sys_var_ulonglong Sys_relay_log_space_limit(
    "relay_log_space_limit", "Maximum space to use for all relay logs",
    READ_ONLY GLOBAL_VAR(relay_log_space_limit), CMD_LINE(REQUIRED_ARG),
    VALID_RANGE(0, ULONG_MAX), DEFAULT(0), BLOCK_SIZE(1));

The relay log space limit is actually defined as ulonglong (maximum is 2^64 - 1 = 18446744073709551615) but the upper limit set for its valid range is only ULONG_MAX (= 2^32 - 1 = 4294967295). For documentation purposes, we use what's specified by VALID_RANGE.

Possibly not easily apparent since relay_log_space_limit is R/O and only settable via startup option or file. Does setting it > 4G cause any warnings to be logged?

Changing category to Server:Replication for assignment to a developer. Suggest the following change:

-    VALID_RANGE(0, ULONG_MAX), DEFAULT(0), BLOCK_SIZE(1));
+    VALID_RANGE(0, ULLONG_MAX), DEFAULT(0), BLOCK_SIZE(1));

which should take care of the inconsistency.

Thanks!

jon.
[18 Oct 2022 0:48] Jon Stephens
Documented fix as follows in the MySQL 5.7.41 and 8.0.32 changelogs:

    The relay_log_space_limit system variable is a 64-bit value, but
    its valid maximum was specified internally as that of a 32-bit
    value.

Closed.