Skip to content
/ server Public

Conversation

@Mahmoud-kh1
Copy link

Now we can update slave_skip_errors at runtime when slaves stopped

  • This feature makes the slave_skip_errors system variable dynamic allowing it
    to be changed at runtime when the replication slave is stopped.
  • Previously slave_skip_errors was read only at runtime and required a
    server restart to be changed.
  • Runtime updates are now validated and safely rejected when the slave is
    running preventing inconsistent replication state.

Key Changes

  • Added ON_CHECK handler to verify that updates are only allowed while the
    slave is stopped.
  • Added ON_UPDATE handler to reinitialize the internal skip error state
    when the variable is changed.
  • Added an rpl mtr test that verifies slave_skip_errors can be changed
    dynamically when the slave is stopped and verified that updates are rejected while the slave is running.

behavior now is like that :
test slave2

Feature :
MDEV-7394

@CLAassistant
Copy link

CLAassistant commented Feb 8, 2026

CLA assistant check
All committers have signed the CLA.

@Mahmoud-kh1 Mahmoud-kh1 force-pushed the dynamic-slave-skip-error branch 5 times, most recently from e972236 to 87dbe8f Compare February 9, 2026 00:59
Make slave_skip_errors dynamic so it can be changed while the slave is stopped. Attempts to change it while the slave is running are rejected with a clear error.
@Mahmoud-kh1 Mahmoud-kh1 force-pushed the dynamic-slave-skip-error branch from 87dbe8f to 3fa1017 Compare February 9, 2026 07:34
@Mahmoud-kh1
Copy link
Author

Mahmoud-kh1 commented Feb 9, 2026

The following test cases fail because they assume that slave_skip_errors is read only which is no longer true which making their checks fail also
sys_vars.sysvars_server_notembedded
main.variables-notembedded
sys_vars.slave_skip_errors_basic

@gkodinov gkodinov added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Feb 9, 2026
Copy link
Member

@gkodinov gkodinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a preliminary review. I'd like to request changes mostly because there are tests that need to be re-recorded (and possibly fixed too).

The rest of the comments are just my own limited take on the change. Feel free to ignore and leave for the final review.

/* Make @@slave_skip_errors show the nice human-readable value. */
opt_slave_skip_errors= slave_skip_error_names;
/* we should not touch opt_slave_skip_errors here. we just build the printable string only. */
(void) opt_slave_skip_errors;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove all these lines please.

{
bool res= false;
mysql_mutex_unlock(&LOCK_global_system_variables);
mysql_mutex_lock(&LOCK_active_mi);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you have a locking issue to sort out. LOCK_active_mi is definitely not the right lock to take for this. I'm not going to pursue on this one and will leave it to the final review. But I believe you need to find a better lock and not just reuse a random existing one.

bool update_slave_skip_errors(sys_var *self, THD *thd, enum_var_type type)
{
bool res= false;
mysql_mutex_unlock(&LOCK_global_system_variables);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have you decided to unlock this lock?

res= true;
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here you can do what you removed from slave.cc: assign the printable names to the variable so it's more readable.

START SLAVE;
--echo # should reduce error because slave is not stopped
--error ER_SLAVE_MUST_STOP
SET GLOBAL slave_skip_errors = "1040";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please also add actual functionality tests for the newly set variable values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements.

Development

Successfully merging this pull request may close these issues.

3 participants