Skip to content
Snippets Groups Projects
Commit 809581bc authored by Marcin's avatar Marcin
Browse files

issue #259: compute database hash base on all tables on schema hafd

Now there is no need to extend list of hashed tables each time when
new table is added to schema hafd.

WARNING: previously people forget to  extend the list and there
are few tables which were not hashed. Because of this update from
previous version of HAF is impossible
parent 7be73edc
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,!590issue #259 automaticly get tables to db hash computation
......@@ -129,45 +129,15 @@ $BODY$;
CREATE OR REPLACE FUNCTION hive.calculate_schema_hash()
RETURNS SETOF hafd.verify_table_schema
LANGUAGE plpgsql
VOLATILE
STABLE
AS
$BODY$
DECLARE
_table_name TEXT;
_state_provider hafd.state_providers;
verified_tables_list TEXT[];
BEGIN
verified_tables_list = ARRAY[
'blocks',
'irreversible_data',
'transactions',
'transactions_multisig',
'operation_types',
'operations',
'applied_hardforks',
'accounts',
'account_operations',
'fork',
'blocks_reversible',
'transactions_reversible',
'transactions_multisig_reversible',
'operations_reversible',
'accounts_reversible',
'account_operations_reversible',
'applied_hardforks_reversible',
'contexts_attachment',
'contexts',
'contexts_log'
];
FOR _table_name IN SELECT UNNEST( verified_tables_list ) as _table_name
LOOP
RETURN NEXT hive.calculate_table_schema_hash( 'hafd', _table_name);
END LOOP;
RETURN;
RETURN QUERY SELECT (hive.calculate_table_schema_hash( 'hafd', table_name)).*
FROM information_schema.tables
WHERE table_schema = 'hafd'
AND table_type = 'BASE TABLE';
END;
$BODY$
;
......
......@@ -27,8 +27,19 @@ FOR _row in
'(applied_hardforks_reversible,f5129d5e-5b98-7f93-b786-d55899b5b8b5,d6cca068-2076-4e87-5c24-85618ff564ac,fee57151-3162-0c46-424a-da912e742160,3eeef00d-0e16-421e-659e-7ee2b12aa7eb)',
'(contexts_attachment,c99e00c4-bc99-eb5d-1071-310575d2655a,0007a55e-0b74-b8b1-fb0d-a2e2b82a05bd,3e2b74cd-8a9a-2768-c01b-c8a307e8267d,90df8e77-2984-5c96-2a9f-908b8e7604dc)',
'(contexts,a1841d23-3612-d633-60d9-5ab41612d85c,5dc37b1c-1cb2-f279-92d4-cf025c786f4e,4a82cf7a-fd28-61ec-f852-e591c0690ad0,8672562f-b341-b429-c70d-0d9a00dd18d7)',
'(contexts_log,80122d29-15e5-b9a7-30e2-1cf4987bd9c9,aa673368-dc31-cf26-d7ec-fa46acd87a32,10c38e8d-5c8f-f588-0f62-9dab0e663ba6,e3d046e4-144c-4cda-176c-0f7f1a690d08)'
])
'(contexts_log,80122d29-15e5-b9a7-30e2-1cf4987bd9c9,aa673368-dc31-cf26-d7ec-fa46acd87a32,10c38e8d-5c8f-f588-0f62-9dab0e663ba6,e3d046e4-144c-4cda-176c-0f7f1a690d08)',
'(vacuum_requests,e0d1500f-e440-5a93-4a7a-0f3f0446f21c,55f334e7-8bef-89eb-4295-2c94cecbf1fe,402279c7-c8d7-607f-60e3-76d8d3457595,65702f1d-5458-38b8-72cd-d813da62d268)',
'(table_schema,1b414fdc-af7d-4859-1a10-9ab25fe967fd,858a9152-2f70-a7d2-fe74-26b3107e8082,ba2b45bd-c11e-2a4a-6e86-aab2ac693cbb,ba2b45bd-c11e-2a4a-6e86-aab2ac693cbb)',
'(write_ahead_log_state,3c18769a-7950-ff27-266a-9be458ad73d0,965e0911-8d91-bef3-8a23-c92726e98508,5b8e1f09-4d13-91f1-53fa-dcdb4986e28d,3ff4519c-6dc0-2a9f-1e19-249f92ace076)',
'(state_providers_registered,b41e740b-372c-cbf5-c89e-121fc30ae222,e5256de7-28e9-0079-dd6d-c410fb648f41,47f62787-773b-c098-9df3-4a9bae4b65c0,3b033100-aacc-10b4-16f9-1dcf27656',
'(triggers,68b875fc-1585-3fbd-9356-621f6fcb6f2d,407c0130-fb27-1258-6e00-b5356a4e37e9,d07c39bb-6037-3ad3-981e-d8307199a726,39645c85-ddd1-fddd-3679-f8e8d91c55d3)',
'(indexes_constraints,6a2dcd7d-8ed7-ffa5-377d-3346b6348b0c,a5b015d4-3334-da4f-e336-6f77738e9fba,50e7a3da-5999-2fb3-865b-61d701d67bc1,7ff09584-f530-c98d-1e12-bffd6f4c907b)',
'(hived_connections,20fd6a8a-592b-e76d-eb93-15b4c57de3c2,5439bb50-0630-305a-034f-87c9326a6ded,f07addc5-dce8-5bb5-1b79-9ec821cc279b,09c1aed4-677c-d4eb-a405-35e973f89188)',
'(deps_saved_ddl,ea91c6c0-eb6a-b473-eb1c-e426eadb1d09,549ba4bd-64d6-c554-11f4-d27e4b37b6e6,d3176a21-5841-14c3-0d52-6566cf12299e,cc8a1233-564b-27fd-3ffd-ce376cd366f7)',
'(registered_tables,01d11432-b7d9-fb8e-a345-2e412e782cfd,ff824909-7631-1102-16f9-5b6ba2f88b74,07ad4206-ab16-75cc-4aaa-18ed4006d4f6,fe6f193c-4d9c-266a-3f43-0a67d8a6dcfb)',
'(events_queue,47c432ad-9eab-ba67-7956-1c14fa210dec,0a710f7b-0af2-9ec6-b1eb-37e181e01473,a5e6d444-fbcd-9518-618b-cc3479932005,48a3b028-2a9e-c01e-0615-0737d43b7b81)',
'(state_providers_registered,b41e740b-372c-cbf5-c89e-121fc30ae222,e5256de7-28e9-0079-dd6d-c410fb648f41,47f62787-773b-c098-9df3-4a9bae4b65c0,3b033100-aacc-10b4-16f9-1dcf276565ff)'
])
LOOP
RAISE NOTICE 'new schema hash: %', _row;
END LOOP;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment