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

PubSub retry also on deadlock #92

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

andrii-suse
Copy link

  1. Always log failed error message in retry when PUBSUB_DEBUG is enabled.

After that I started seeing in debug output:

[PubSub] (6093845) noretry (insert into mojo_pubsub_subscribe (pid, channel) values (?, ?) on duplicate key update ts=current_timestamp) !!! DBD::mysql::st execute failed: Deadlock found when trying to get lock; try restarting transaction
  1. Retry when DB reports a deadlock.

See also report about deadlock in https://jira.mariadb.org/browse/MDEV-31017

1. Always log failed error message in retry when PUBSUB_DEBUG is enabled.
2. Retry when DB reports a deadlock.
Copy link
Owner

@jhthorsen jhthorsen left a comment

Choose a reason for hiding this comment

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

This change has no tests so there's no guarantee that the fix won't get reverted at a later point in time. Please add tests if you want to prevent that from happening.

I'll take the change regardless though if you want me to, since the ::PubSub class is not really a supported part of Mojo::mysql.

if ($err =~ /^\V*(?:retry|timeout|try restart)/i) { # ... and maybe rethrow it
# If we got here, we are retrying the query:
warn qq|[PubSub] (@{[$db->pid]}) retry ($sql) !!! $err\n| if DEBUG;
} else {
Copy link
Owner

Choose a reason for hiding this comment

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

This PR does not conform with the codestyle. Please run perltidy and force push the changes.

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

Successfully merging this pull request may close these issues.

None yet

2 participants