diff options
author | Sami Hiltunen <shiltunen@gitlab.com> | 2022-04-07 15:54:58 +0300 |
---|---|---|
committer | Sami Hiltunen <shiltunen@gitlab.com> | 2022-04-13 12:45:39 +0300 |
commit | 5c9feb4e8e3175f1f80aae2f452e9e676133d14f (patch) | |
tree | e7a79ee911b9866352b006dff3dc1aa08cb7cf0a /_support | |
parent | 9413ca591ebe30dcb133c86d0ec53f6bc2fc30bb (diff) |
Ignore verification columns for read-only cache updatessmh-verification-trigger-only-generation
Read-only cache receives invalidations on record updates via triggers
in Postgres. Currently the notifications are sent for any modification
to the records. The verification related columns are not relevant to
the operation of the cache so this commit ignores the changes to the
columns in the triggers.
Changelog: changed
Diffstat (limited to '_support')
-rw-r--r-- | _support/praefect-schema.sql | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/_support/praefect-schema.sql b/_support/praefect-schema.sql index 78316e80c..083abf664 100644 --- a/_support/praefect-schema.sql +++ b/_support/praefect-schema.sql @@ -72,8 +72,10 @@ CREATE FUNCTION public.notify_on_change() RETURNS trigger SELECT JSON_AGG(obj) INTO msg FROM ( SELECT JSONB_BUILD_OBJECT('virtual_storage', virtual_storage, 'relative_paths', ARRAY_AGG(DISTINCT relative_path)) AS obj - FROM NEW - FULL JOIN OLD USING (virtual_storage, relative_path) + FROM NEW AS new_value + FULL JOIN OLD AS old_value USING (virtual_storage, relative_path) + WHERE ( COALESCE(new_value.generation, -1) != COALESCE(old_value.generation, -1) ) + OR ( new_value.relative_path != old_value.relative_path ) GROUP BY virtual_storage ) t; WHEN 'DELETE' THEN |