Skip to content
Snippets Groups Projects
Commit 4dcaf8d2 authored by Marcin's avatar Marcin
Browse files

correctly exlude all shadow tables from hash computation

previously only state providers shadow tables were excluded, what cause
problems when haf with installed context with registered tables was
updated.
parent dd4901ba
No related branches found
No related tags found
6 merge requests!627merge in fix for get_current_block_age,!626Fix get_current_block_age function to avoid healthcheck fails,!622merge develop to master,!599merge ( with merge commit) develop to master,!597Merge develop to master for release,!594correctly exlude all shadow tables from hash computation [fix for regression found with previous mr]
Pipeline #113014 passed
......@@ -17,6 +17,18 @@ END;
$BODY$
;
CREATE OR REPLACE FUNCTION hive.get_shadow_table_name_prefix()
RETURNS TEXT
LANGUAGE 'plpgsql'
IMMUTABLE
AS
$BODY$
BEGIN
RETURN 'shadow_';
END;
$BODY$
;
CREATE OR REPLACE FUNCTION hive.get_shadow_table_name( _table_schema TEXT, _table_name TEXT )
RETURNS TEXT
LANGUAGE 'plpgsql'
......@@ -25,7 +37,7 @@ AS
$BODY$
BEGIN
RETURN hive.validate_name(
'shadow_' || lower(_table_schema) || '_' || lower(_table_name)
hive.get_shadow_table_name_prefix() || lower(_table_schema) || '_' || lower(_table_name)
, _table_name );
END;
$BODY$
......
......@@ -328,11 +328,12 @@ BEGIN
RETURN QUERY SELECT (hive_update.calculate_table_schema_hash( 'hafd', ist.table_name)).*
FROM information_schema.tables ist
LEFT JOIN hafd.registered_tables hrt ON ist.table_name ILIKE hrt.shadow_table_name
LEFT JOIN hafd.state_providers_registered spr ON ist.table_name ILIKE ANY( spr.tables )
WHERE ist.table_schema = 'hafd'
AND ist.table_type = 'BASE TABLE'
AND spr.tables IS NULL
AND ist.table_name NOT ILIKE 'shadow_hafd_%'; -- shadow tables, only possible for state providers
AND hrt.shadow_table_name IS NULL -- is not a shadow table
AND spr.tables IS NULL; -- is not a state provider table
END;
$BODY$
;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment