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

Cleanup rotation code & triggers #2499

Closed
mastercactapus opened this issue Jul 11, 2022 · 2 comments
Closed

Cleanup rotation code & triggers #2499

mastercactapus opened this issue Jul 11, 2022 · 2 comments
Labels
enhancement New feature or request stale This is inactive

Comments

@mastercactapus
Copy link
Member

What problem would you like to solve? Please describe:
A lot of rotation code (particularly around editing) depends on a complex set of DB triggers that cause various issues around lock contention, races, etc...

Describe the solution you'd like:
Move the logic out of DB triggers and into the application.

Describe alternatives you've considered:
Continue to use exclusive locks everywhere we touch rotations.

Additional context:
Current list of triggers:

fn_set_rot_state_pos_on_active_change
trg_enforce_rotation_participant_limit
trg_enforce_rot_part_position_no_gaps
trg_inc_rot_part_position_on_insert
trg_set_rot_state_pos_on_part_reorder
trg_incr_part_count_on_add
trg_start_rotation_on_first_part_add
trg_10_decr_part_count_on_del
trg_20_decr_rot_part_position_on_delete
trg_30_advance_or_end_rot_on_part_del

As the current/older application code will still depend on these, we can't remove them completely (yet). Each trigger should be replaced with identical code, but with a short-circuit check of a local variable at the beginning. If the variable is set, the trigger function should return with no action taken. New code can set the local variable to disable the triggers in a tx, without affecting actions from older versions of GoAlert.

@stale
Copy link

stale bot commented Jan 7, 2023

This issue has been automatically marked as stale because it has not had recent activity.

@stale stale bot added the stale This is inactive label Jan 7, 2023
@mastercactapus
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale This is inactive
Projects
None yet
Development

No branches or pull requests

1 participant