ElasticCommitIndexerWorker - ActiveRecord::InvalidForeignKey: PG::ForeignKeyViolation: ERROR: insert or update on table "index_statuses" violates foreign key ...
Saw a few of these errors over the last 2+ weeks where the index_status
update fails. The code should fail gracefully (and log the issue) if this error message is expected (and if it's OK for the data to be in this state).
https://sentry.gitlab.net/gitlab/gitlabcom/issues/1740205/?referrer=gitlab_plugin
PG::ForeignKeyViolation: ERROR: insert or update on table "index_statuses" violates foreign key constraint "fk_74b2492545"
DETAIL: Key (project_id)=(20699701) is not present in table "projects".
active_record/connection_adapters/postgresql_adapter.rb:675:in `exec_params'
@connection.exec_params(sql, type_casted_binds)
active_record/connection_adapters/postgresql_adapter.rb:675:in `block (2 levels) in exec_no_cache'
@connection.exec_params(sql, type_casted_binds)
active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
yield
active_support/concurrency/share_lock.rb:187:in `yield_shares'
yield
active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
@lock.yield_shares(compatible: [:load]) do
...
(163 additional frame(s) were not displayed)
ActiveRecord::InvalidForeignKey: PG::ForeignKeyViolation: ERROR: insert or update on table "index_statuses" violates foreign key constraint "fk_74b2492545"
DETAIL: Key (project_id)=(20699701) is not present in table "projects".
PG::ForeignKeyViolation: ERROR: insert or update on table "index_statuses" violates foreign key constraint "fk_74b2492545"
DETAIL: Key (project_id)=(20699701) is not present in table "projects".
Edited by Terri Chu