Skip to content
/ server Public

MDEV-26479: Add support for slave_skip_errors="ddl_exist_errors"#4780

Open
Mahmoud-kh1 wants to merge 1 commit intoMariaDB:mainfrom
Mahmoud-kh1:ddl_exist_errors_alias
Open

MDEV-26479: Add support for slave_skip_errors="ddl_exist_errors"#4780
Mahmoud-kh1 wants to merge 1 commit intoMariaDB:mainfrom
Mahmoud-kh1:ddl_exist_errors_alias

Conversation

@Mahmoud-kh1
Copy link

Description:
This PR add the ddl_exist_errors alias option for the slave_skip_errors which allows slaves to skip DDL errors.

Errors skipped:
ER_DB_CREATE_EXISTS
ER_DB_DROP_EXISTS
ER_TABLE_EXISTS_ERROR
ER_BAD_TABLE_ERROR
ER_BAD_FIELD_ERROR
ER_DUP_FIELDNAME
ER_DUP_KEYNAME
ER_MULTIPLE_PRI_KEY
ER_CANT_DROP_FIELD_OR_KEY
ER_NO_SUCH_TABLE

How the pr can be tested
we run this test ./mysql-test-run.pl rpl.rpl_slave_skip_errors_ddl that verify all errors skipped correctly

@gkodinov gkodinov added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Mar 11, 2026
@gkodinov gkodinov changed the title #MDEV-26479 Add support for slave_skip_errors="ddl_exist_errors" MDEV-26479: Add support for slave_skip_errors="ddl_exist_errors" Mar 11, 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.

Thank you for your contribution! This is a preliminary review.

sql/slave.cc Outdated
bitmap_set_all(&slave_error_mask);
goto end;
}
if (!system_charset_info->strnncoll((uchar*)arg,16,(const uchar*)"ddl_exist_errors",16))
Copy link
Member

Choose a reason for hiding this comment

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

please use STRING_WITH_LEN here.

sql/slave.cc Outdated
ER_CANT_DROP_FIELD_OR_KEY,
ER_NO_SUCH_TABLE
};
uint n_errors = sizeof(ddl_errors) / sizeof(ddl_errors[0]);
Copy link
Member

Choose a reason for hiding this comment

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

please use array_elements

Implement  ddl_exist_errors alias option for slave_skip_errors which  allows  slave to skip  DDL errors such as:

ER_DB_CREATE_EXISTS
ER_DB_DROP_EXISTS
ER_TABLE_EXISTS_ERROR
ER_BAD_TABLE_ERROR
ER_BAD_FIELD_ERROR
ER_DUP_FIELDNAME
ER_DUP_KEYNAME
ER_MULTIPLE_PRI_KEY
ER_CANT_DROP_FIELD_OR_KEY
ER_NO_SUCH_TABLE

Test: Added rpl.rpl_skip_errors_ddl test to verify all errors are correctly skipped.
@Mahmoud-kh1 Mahmoud-kh1 force-pushed the ddl_exist_errors_alias branch from cd8c851 to 4859684 Compare March 11, 2026 12:25
@Mahmoud-kh1 Mahmoud-kh1 requested a review from gkodinov March 11, 2026 12:55
bitmap_set_all(&slave_error_mask);
goto end;
}

Copy link
Member

Choose a reason for hiding this comment

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

This will only work if the ddl_exist_errors is the first in the list. How about "1234, ddl_exist_errors, 456" ?

Move the check inside the for() loop and make sure to skip over leading and trailing spaces, if any. I'd put the whole thing into a small utility function, similar to str2int().

Copy link
Author

Choose a reason for hiding this comment

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

yeah it will fail for "1234, ddl_exist_errors, 456" I just make it like mysql but I agree with you we shouldn't say we treat it like any error codes and this is not valid.

also making a separate function will be more cleaner if we added more aliases in future so I will make one that take the string and return array that holds error codes , I think I will move all logic of parsing including aliases there making init function just set the bitmap with error codes , is this what you mean ?

Copy link
Author

Choose a reason for hiding this comment

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

I will just move the check inside the loop I think it doesn't worth to make a another function and If we needed to add more aliases in future it will be better to go with on of your approaches which you introduced in zulip.
what do you think ?

Copy link
Author

Choose a reason for hiding this comment

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

}

if (!system_charset_info->strnncoll((uchar*)arg,sizeof("ddl_exist_errors")-1,
(const uchar*)STRING_WITH_LEN("ddl_exist_errors")))
Copy link
Member

Choose a reason for hiding this comment

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

use USTRING_WITH_LEN.

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.

2 participants