ActiveRecord::InvalidForeignKey: PG::ForeignKeyViolation: ERROR: insert or update on table "approval_project_rules_protected_bran...
https://sentry.gitlab.net/gitlab/gitlabcom/issues/4127133/?referrer=gitlab_plugin
PG::ForeignKeyViolation: ERROR: insert or update on table "approval_project_rules_protected_branches" violates foreign key constraint "fk_rails_b7567b031b"
DETAIL: Key (protected_branch_id)=(67627869) is not present in table "protected_branches".
lib/gitlab/database/load_balancing/connection_proxy.rb:127:in `public_send'
connection.public_send(...)
lib/gitlab/database/load_balancing/connection_proxy.rb:127:in `block in write_using_load_balancer'
connection.public_send(...)
lib/gitlab/database/load_balancing/load_balancer.rb:127:in `block in read_write'
yield connection
lib/gitlab/database/load_balancing/load_balancer.rb:205:in `retry_with_backoff'
return yield attempt # Yield the current attempt count
lib/gitlab/database/load_balancing/load_balancer.rb:116:in `read_write'
retry_with_backoff(attempts: attempts) do |attempt|
...
(223 additional frame(s) were not displayed)
ActiveRecord::InvalidForeignKey: PG::ForeignKeyViolation: ERROR: insert or update on table "approval_project_rules_protected_branches" violates foreign key constraint "fk_rails_b7567b031b"
DETAIL: Key (protected_branch_id)=(67627869) is not present in table "protected_branches".
PG::ForeignKeyViolation: ERROR: insert or update on table "approval_project_rules_protected_branches" violates foreign key constraint "fk_rails_b7567b031b"
DETAIL: Key (protected_branch_id)=(67627869) is not present in table "protected_branches".
Implementation Plan
-
backend Update Security::SecurityOrchestrationPolicies::SyncScanResultPoliciesProjectService
to accept a parameter to check if the worker should be invoked with a delay -
backend Update ProtectedBranches::BaseService
to pass a delay of 1 minute toSecurity::SecurityOrchestrationPolicies::SyncScanResultPoliciesProjectService
-
documentation Update documentation to mention the delay after a protected branch is created/updated
Edited by Sashi Kumar Kumaresan