MDEV-26272: The macro MASTER_INFO_VAR invokes undefined behaviour
Updates to specific replication system variables need to target the active primary connection to support multi-source replication. These variables use the Sys_var_multi_source_ulonglong type. This class uses offsets of the Master_info C++ class to generalize access to its member variables. The problem is that the Master_info class is not of standard layout, and neither are many of its member variables, e.g. rli and rli->relay_log. Because the class is not of standard layout, using offsets to access member variables invokes undefined behavior. This patch changes how Sys_var_multi_source_ulonglong accesses the member variables of Master_info from using parameterized memory offsets to “getter” function pointers. Note that the size parameter and assertion are removed, as they are no longer needed because the condition is guaranteed by compiler type-safety checks. Reviewed By: ============ Kristian Nielsen <knielsen@knielsen-hq.org>
Showing
Please register or sign in to comment