Skip to content

Commit

Permalink
Merge pull request #2158 from alphagov/fix-env-sync-payload-version
Browse files Browse the repository at this point in the history
Reset Content Store `payload_version` to 0 in non-prod envs
  • Loading branch information
ChrisBAshton authored Jul 8, 2024
2 parents 974cd93 + a377d7a commit 0617a05
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
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

0 comments on commit 0617a05

Please sign in to comment.