From dbf2391914b253d720c74cd0d6b9af1ac58066e4 Mon Sep 17 00:00:00 2001 From: Bartek Wrona <wrona@syncad.com> Date: Tue, 8 Sep 2020 15:29:33 +0200 Subject: [PATCH] Prerequisites for setting LOGGED/UNLOGGED attribute on selected tables. --- hive/db/schema.py | 18 +++++++++++++++++- hive/indexer/blocks.py | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/hive/db/schema.py b/hive/db/schema.py index 28ceab234..fcebdbf48 100644 --- a/hive/db/schema.py +++ b/hive/db/schema.py @@ -229,7 +229,6 @@ def build_metadata(): sa.PrimaryKeyConstraint('post_id', 'tag_id', name='hive_post_tags_pk1'), sa.ForeignKeyConstraint(['post_id'], ['hive_posts.id']), sa.ForeignKeyConstraint(['tag_id'], ['hive_tag_data.id']), - sa.Index('hive_post_tags_post_id_idx', 'post_id'), sa.Index('hive_post_tags_tag_id_idx', 'tag_id') ) @@ -1406,3 +1405,20 @@ def set_fillfactor(db): for table, fillfactor in fillfactor_config.items(): sql = """ALTER TABLE {} SET (FILLFACTOR = {})""" db.query(sql.format(table, fillfactor)) + +def set_logged(db, logged): + """Initializes/resets LOGGED/UNLOGGED attribute for tables which are intesively updated""" + + logged_config = [ + 'hive_author', + 'hive_permlink_data', + 'hive_post_tags', + 'hive_posts', + 'hive_post_data', + 'hive_votes', + 'hive_reputation_data' + ] + + for table in logged_config: + sql = """ALTER TABLE {} SET {}""" + db.query_no_return(sql.format(table, 'LOGGED' if logged else 'UNLOGGED')) diff --git a/hive/indexer/blocks.py b/hive/indexer/blocks.py index cbf97401d..9341f6583 100644 --- a/hive/indexer/blocks.py +++ b/hive/indexer/blocks.py @@ -200,7 +200,7 @@ class Blocks: elif op_type == 'effective_comment_vote_operation': key_vote = "{}/{}/{}".format(op_value['voter'], op_value['author'], op_value['permlink']) -# Reputations.process_vote(block_num, op_value) + Reputations.process_vote(block_num, op_value) vote_ops[ key_vote ] = op_value -- GitLab