maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #07685
Re: [Commits] Rev 4385: MDEV-6459 max_relay_log_size and sql_slave_skip_counter misbehave on PPC64 in lp:~maria-captains/maria/10.0
Hi Sergei,
just curious: any special reason to make these variables ulonglong?
Both seem to fit into uint.
Thanks,
Sergey
On Tue, Sep 09, 2014 at 04:52:12PM +0200, Sergei Golubchik wrote:
> At lp:~maria-captains/maria/10.0
>
> ------------------------------------------------------------
> revno: 4385
> revision-id: sergii@xxxxxxxxx-20140909145212-62txhaq57k301s16
> parent: sergii@xxxxxxxxx-20140909130235-h2sy95zwu55701l0
> fixes bug: https://mariadb.atlassian.net/browse/MDEV-6459
> committer: Sergei Golubchik <sergii@xxxxxxxxx>
> branch nick: 10.0
> timestamp: Tue 2014-09-09 16:52:12 +0200
> message:
> MDEV-6459 max_relay_log_size and sql_slave_skip_counter misbehave on PPC64
>
> make slave_skip_counter and max_relay_log_size ulonglong
> (sysvars should generally never be ulong)
> === modified file 'sql/rpl_rli.h'
> --- a/sql/rpl_rli.h 2014-09-08 10:59:57 +0000
> +++ b/sql/rpl_rli.h 2014-09-09 14:52:12 +0000
> @@ -251,10 +251,11 @@ class Relay_log_info : public Slave_repo
> errors, and have been manually applied by DBA already.
> Must be ulong as it's refered to from set_var.cc
> */
> - volatile ulong slave_skip_counter;
> + volatile ulonglong slave_skip_counter;
> + ulonglong max_relay_log_size;
> +
> volatile ulong abort_pos_wait; /* Incremented on change master */
> volatile ulong slave_run_id; /* Incremented on slave start */
> - ulong max_relay_log_size;
> mysql_mutex_t log_space_lock;
> mysql_cond_t log_space_cond;
> /*
>
> === modified file 'sql/sql_class.h'
> --- a/sql/sql_class.h 2014-07-31 09:08:56 +0000
> +++ b/sql/sql_class.h 2014-09-09 14:52:12 +0000
> @@ -519,6 +519,14 @@ typedef struct system_variables
> ulonglong sortbuff_size;
> ulonglong group_concat_max_len;
> ulonglong default_regex_flags;
> +
> + /**
> + Place holders to store Multi-source variables in sys_var.cc during
> + update and show of variables.
> + */
> + ulonglong slave_skip_counter;
> + ulonglong max_relay_log_size;
> +
> ha_rows select_limit;
> ha_rows max_join_size;
> ha_rows expensive_subquery_limit;
> @@ -587,12 +595,6 @@ typedef struct system_variables
> */
> uint32 gtid_domain_id;
> uint64 gtid_seq_no;
> - /**
> - Place holders to store Multi-source variables in sys_var.cc during
> - update and show of variables.
> - */
> - ulong slave_skip_counter;
> - ulong max_relay_log_size;
>
> /**
> Default transaction access mode. READ ONLY (true) or READ WRITE (false).
>
> === modified file 'sql/sys_vars.cc'
> --- a/sql/sys_vars.cc 2014-08-07 16:06:56 +0000
> +++ b/sql/sys_vars.cc 2014-09-09 14:52:12 +0000
> @@ -4248,11 +4248,11 @@ static Sys_var_uint Sys_slave_net_timeou
> Return 0 + warning if it doesn't exist
> */
>
> -ulong Sys_var_multi_source_ulong::
> -get_master_info_ulong_value(THD *thd, ptrdiff_t offset)
> +ulonglong Sys_var_multi_source_ulonglong::
> +get_master_info_ulonglong_value(THD *thd, ptrdiff_t offset)
> {
> Master_info *mi;
> - ulong res= 0; // Default value
> + ulonglong res= 0; // Default value
> mysql_mutex_unlock(&LOCK_global_system_variables);
> mysql_mutex_lock(&LOCK_active_mi);
> mi= master_info_index->
> @@ -4261,7 +4261,7 @@ get_master_info_ulong_value(THD *thd, pt
> if (mi)
> {
> mysql_mutex_lock(&mi->rli.data_lock);
> - res= *((ulong*) (((uchar*) mi) + master_info_offset));
> + res= *((ulonglong*) (((uchar*) mi) + master_info_offset));
> mysql_mutex_unlock(&mi->rli.data_lock);
> }
> mysql_mutex_unlock(&LOCK_active_mi);
> @@ -4273,7 +4273,7 @@ get_master_info_ulong_value(THD *thd, pt
> bool update_multi_source_variable(sys_var *self_var, THD *thd,
> enum_var_type type)
> {
> - Sys_var_multi_source_ulong *self= (Sys_var_multi_source_ulong*) self_var;
> + Sys_var_multi_source_ulonglong *self= (Sys_var_multi_source_ulonglong*) self_var;
> bool result= true;
> Master_info *mi;
>
> @@ -4310,16 +4310,12 @@ static bool update_slave_skip_counter(sy
> return false;
> }
>
> -
> -static Sys_var_multi_source_ulong
> -Sys_slave_skip_counter("sql_slave_skip_counter",
> - "Skip the next N events from the master log",
> - SESSION_VAR(slave_skip_counter),
> - NO_CMD_LINE,
> - my_offsetof(Master_info, rli.slave_skip_counter),
> - VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1),
> - ON_UPDATE(update_slave_skip_counter));
> -
> +static Sys_var_multi_source_ulonglong Sys_slave_skip_counter(
> + "sql_slave_skip_counter", "Skip the next N events from the master log",
> + SESSION_VAR(slave_skip_counter), NO_CMD_LINE,
> + MASTER_INFO_VAR(rli.slave_skip_counter),
> + VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1),
> + ON_UPDATE(update_slave_skip_counter));
>
> static bool update_max_relay_log_size(sys_var *self, THD *thd, Master_info *mi)
> {
> @@ -4328,17 +4324,14 @@ static bool update_max_relay_log_size(sy
> return false;
> }
>
> -static Sys_var_multi_source_ulong
> -Sys_max_relay_log_size( "max_relay_log_size",
> - "relay log will be rotated automatically when the "
> - "size exceeds this value. If 0 are startup, it's "
> - "set to max_binlog_size",
> - SESSION_VAR(max_relay_log_size),
> - CMD_LINE(REQUIRED_ARG),
> - my_offsetof(Master_info, rli.max_relay_log_size),
> - VALID_RANGE(0, 1024L*1024*1024), DEFAULT(0),
> - BLOCK_SIZE(IO_SIZE),
> - ON_UPDATE(update_max_relay_log_size));
> +static Sys_var_multi_source_ulonglong Sys_max_relay_log_size(
> + "max_relay_log_size",
> + "relay log will be rotated automatically when the size exceeds this "
> + "value. If 0 are startup, it's set to max_binlog_size",
> + SESSION_VAR(max_relay_log_size), CMD_LINE(REQUIRED_ARG),
> + MASTER_INFO_VAR(rli.max_relay_log_size),
> + VALID_RANGE(0, 1024L*1024*1024), DEFAULT(0), BLOCK_SIZE(IO_SIZE),
> + ON_UPDATE(update_max_relay_log_size));
>
> static Sys_var_charptr Sys_slave_skip_errors(
> "slave_skip_errors", "Tells the slave thread to continue "
>
> === modified file 'sql/sys_vars.h'
> --- a/sql/sys_vars.h 2014-07-18 15:45:21 +0000
> +++ b/sql/sys_vars.h 2014-09-09 14:52:12 +0000
> @@ -1993,7 +1993,8 @@ class Sys_var_replicate_events_marked_fo
> like sql_slave_skip_counter are GLOBAL.
> */
>
> -class Sys_var_multi_source_ulong;
> +#define MASTER_INFO_VAR(X) my_offsetof(Master_info, X), sizeof(Master_info::X)
> +class Sys_var_multi_source_ulonglong;
> class Master_info;
>
> typedef bool (*on_multi_source_update_function)(sys_var *self, THD *thd,
> @@ -2002,31 +2003,27 @@ bool update_multi_source_variable(sys_va
> THD *thd, enum_var_type type);
>
>
> -class Sys_var_multi_source_ulong :public Sys_var_ulong
> +class Sys_var_multi_source_ulonglong :public Sys_var_ulonglong
> {
> ptrdiff_t master_info_offset;
> on_multi_source_update_function update_multi_source_variable_func;
> public:
> - Sys_var_multi_source_ulong(const char *name_arg,
> + Sys_var_multi_source_ulonglong(const char *name_arg,
> const char *comment, int flag_args,
> ptrdiff_t off, size_t size,
> CMD_LINE getopt,
> ptrdiff_t master_info_offset_arg,
> - ulong min_val, ulong max_val, ulong def_val,
> - uint block_size,
> + size_t master_info_arg_size,
> + ulonglong min_val, ulonglong max_val,
> + ulonglong def_val, uint block_size,
> on_multi_source_update_function on_update_func)
> - :Sys_var_ulong(name_arg, comment, flag_args, off, size,
> - getopt, min_val, max_val, def_val, block_size,
> - 0, VARIABLE_NOT_IN_BINLOG, 0, update_multi_source_variable),
> + :Sys_var_ulonglong(name_arg, comment, flag_args, off, size,
> + getopt, min_val, max_val, def_val, block_size,
> + 0, VARIABLE_NOT_IN_BINLOG, 0, update_multi_source_variable),
> master_info_offset(master_info_offset_arg),
> update_multi_source_variable_func(on_update_func)
> {
> - }
> - bool session_update(THD *thd, set_var *var)
> - {
> - session_var(thd, ulong)= (ulong) (var->save_result.ulonglong_value);
> - /* Value should be moved to multi_master in on_update_func */
> - return false;
> + SYSVAR_ASSERT(master_info_arg_size == size);
> }
> bool global_update(THD *thd, set_var *var)
> {
> @@ -2039,9 +2036,9 @@ class Sys_var_multi_source_ulong :public
> }
> uchar *session_value_ptr(THD *thd,LEX_STRING *base)
> {
> - ulong *tmp, res;
> - tmp= (ulong*) (((uchar*)&(thd->variables)) + offset);
> - res= get_master_info_ulong_value(thd, master_info_offset);
> + ulonglong *tmp, res;
> + tmp= (ulonglong*) (((uchar*)&(thd->variables)) + offset);
> + res= get_master_info_ulonglong_value(thd, master_info_offset);
> *tmp= res;
> return (uchar*) tmp;
> }
> @@ -2049,7 +2046,7 @@ class Sys_var_multi_source_ulong :public
> {
> return session_value_ptr(thd, base);
> }
> - ulong get_master_info_ulong_value(THD *thd, ptrdiff_t offset);
> + ulonglong get_master_info_ulonglong_value(THD *thd, ptrdiff_t offset);
> bool update_variable(THD *thd, Master_info *mi)
> {
> return update_multi_source_variable_func(this, thd, mi);
>
> _______________________________________________
> commits mailing list
> commits@xxxxxxxxxxx
> https://lists.askmonty.org/cgi-bin/mailman/listinfo/commits
Follow ups