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

Reset Content Store payload_version to 0 in non-prod envs #2158

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions charts/db-backup/scripts/content-store.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- sqlfluff:dialect:mysql

-- Occasionally, Content Store and Publishing API can fall out of
-- sync in non-production environments after the environment sync
-- process has completed. Content Store can be a day 'ahead' of
-- Publishing API.
--
-- Consequently, any publish events from Publishing API in the
-- affected environment will be rejected by Content Store, if the
-- `Event.maximum_id` in Publishing API is behind the
-- `payload_version` of the `ContentItem` being updated in Content
-- Store.
--
-- The pragmatic fix is to reset the `payload_version` in Content
-- Store so that it can never be ahead of Publishing API.
UPDATE content_items
SET payload_version = 0;
4 changes: 4 additions & 0 deletions charts/db-backup/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ cronjobs:
operations:
- op: restore
bucket: s3://govuk-production-database-backups
- op: transform
script: content-store.sql
- op: backup
draft-content-store-postgres:
<<: *s5cmd-ram-workaround
Expand All @@ -342,6 +344,8 @@ cronjobs:
operations:
- op: restore
bucket: s3://govuk-production-database-backups
- op: transform
script: content-store.sql
- op: backup

content-tagger-postgres:
Expand Down