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

Deadlock because of trigger #123

Open
franck-boullier opened this issue Apr 1, 2019 · 0 comments
Open

Deadlock because of trigger #123

franck-boullier opened this issue Apr 1, 2019 · 0 comments
Assignees

Comments

@franck-boullier
Copy link
Member

The problem:

In order to fix unee-t/lambda2sqs#9 (comment), we had to disable the trigger which update the counter of all active units each time a new unit is inserted in the products table in the BZ database.

We need to find a way to:

  • keep updating the counter of active unit each time a new unit is inserted
  • prevent the deadlock issue when we create a lot of units via the MEFE Unit creation API.

The code to re-create the trigger:

# We need a trigger `update_the_log_of_enabled_units_when_unit_is_created` to call the procedure `update_log_count_enabled_units` each time a new unit/product is created.

    DROP TRIGGER IF EXISTS `update_the_log_of_enabled_units_when_unit_is_created`;

DELIMITER $$
CREATE TRIGGER `update_the_log_of_enabled_units_when_unit_is_created`
    AFTER INSERT ON `products`
    FOR EACH ROW
  BEGIN
    CALL `update_log_count_enabled_units`;
END;
$$
DELIMITER ;
@franck-boullier franck-boullier self-assigned this Apr 1, 2019
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

No branches or pull requests

1 participant