Skip to content
Snippets Groups Projects
Commit 1ce981ad authored by Michal Zander's avatar Michal Zander
Browse files

Fix: reptracker_process_blocks should always be recreated on install

parent bee6235a
No related branches found
No related tags found
1 merge request!96Fix: reptracker_process_blocks should always be recreated on install
Pipeline #119105 passed
...@@ -70,28 +70,6 @@ CREATE TABLE IF NOT EXISTS active_votes ...@@ -70,28 +70,6 @@ CREATE TABLE IF NOT EXISTS active_votes
PERFORM hive.app_register_table( __schema_name, 'active_votes', __schema_name ); PERFORM hive.app_register_table( __schema_name, 'active_votes', __schema_name );
EXECUTE format(
$BODY$
CREATE OR REPLACE PROCEDURE %I.reptracker_process_blocks(_context_name hive.context_name, _block_range hive.blocks_range, _logs BOOLEAN = true)
LANGUAGE 'plpgsql'
AS
$pb$
BEGIN
IF hive.get_current_stage_name(_context_name) = 'MASSIVE_PROCESSING' THEN
CALL reptracker_massive_processing(_block_range.first_block, _block_range.last_block, _logs);
PERFORM hive.app_request_table_vacuum('%s.account_reputations', interval '10 minutes');
PERFORM hive.app_request_table_vacuum('%s.active_votes', interval '10 minutes');
PERFORM hive.app_request_table_vacuum('%s.permlinks', interval '100 minutes');
RETURN;
END IF;
CALL reptracker_single_processing(_block_range.first_block, _block_range.last_block, _logs);
END
$pb$
$BODY$, __schema_name, __schema_name, __schema_name, __schema_name);
END END
$$; $$;
......
...@@ -129,5 +129,33 @@ BEGIN ...@@ -129,5 +129,33 @@ BEGIN
END END
$$; $$;
DO $$
DECLARE
__schema_name VARCHAR;
BEGIN
SHOW SEARCH_PATH INTO __schema_name;
EXECUTE format(
$BODY$
CREATE OR REPLACE PROCEDURE %I.reptracker_process_blocks(_context_name hive.context_name, _block_range hive.blocks_range, _logs BOOLEAN = true)
LANGUAGE 'plpgsql'
AS
$pb$
BEGIN
IF hive.get_current_stage_name(_context_name) = 'MASSIVE_PROCESSING' THEN
CALL reptracker_massive_processing(_block_range.first_block, _block_range.last_block, _logs);
PERFORM hive.app_request_table_vacuum('%s.account_reputations', interval '10 minutes');
PERFORM hive.app_request_table_vacuum('%s.active_votes', interval '10 minutes');
PERFORM hive.app_request_table_vacuum('%s.permlinks', interval '100 minutes');
RETURN;
END IF;
CALL reptracker_single_processing(_block_range.first_block, _block_range.last_block, _logs);
END
$pb$
$BODY$, __schema_name, __schema_name, __schema_name, __schema_name);
END
$$;
RESET ROLE; RESET ROLE;
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