Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize: optimize distributed lock log #5700

Merged
merged 2 commits into from Jul 5, 2023

Conversation

slievrly
Copy link
Member

@slievrly slievrly commented Jul 4, 2023

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

optimize distributed lock log

Ⅱ. Does this pull request fix one issue?

fix #5684

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

Signed-off-by: slievrly <slievrly@163.com>
Signed-off-by: slievrly <slievrly@163.com>
@@ -251,4 +275,14 @@ private void init() {
this.distributedLockDataSource = EnhancedServiceLoader.load(DataSourceProvider.class, datasourceType).provide();
}

private boolean ignoreSQLException(SQLException exception) {
if (IGNORE_MYSQL_CODE.contains(exception.getErrorCode())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

return IGNORE_MYSQL_CODE.contains(exception.getErrorCode()) ||
       (StringUtils.isNotBlank(exception.getMessage()) && IGNORE_MYSQL_MESSAGE.stream().anyMatch(message -> exception.getMessage().contains(message)));

Copy link
Member Author

Choose a reason for hiding this comment

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

Long bool judgment expressions are not recommended, as they become less readable.

@slievrly slievrly merged commit 3568985 into apache:develop Jul 5, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants