Skip to content
Snippets Groups Projects
Commit 72cbaded authored by Andrzej Lisak's avatar Andrzej Lisak
Browse files

[ABW]: [Fix] rshares removed from two more places - would break post initial sync

hive_votes_accounts_permlinks_view used in one more place instead of hive_votes (most likely unused since query was totally broken)
parent 74e8d6a3
No related branches found
No related tags found
4 merge requests!456Release candidate v1 24,!230Setup monitoring with pghero,!135Enable postgres monitoring on CI server,!56Removed rshares column from hive_posts and corrected places that used it
...@@ -342,7 +342,6 @@ class Posts: ...@@ -342,7 +342,6 @@ class Posts:
max_accepted_payout = :max_accepted_payout, max_accepted_payout = :max_accepted_payout,
author_rewards = :author_rewards, author_rewards = :author_rewards,
children_abs_rshares = :children_abs_rshares, children_abs_rshares = :children_abs_rshares,
rshares = :net_rshares,
abs_rshares = :abs_rshares, abs_rshares = :abs_rshares,
vote_rshares = :vote_rshares, vote_rshares = :vote_rshares,
net_votes = :net_votes, net_votes = :net_votes,
...@@ -369,7 +368,6 @@ class Posts: ...@@ -369,7 +368,6 @@ class Posts:
max_accepted_payout=legacy_amount(cpp['max_accepted_payout']), max_accepted_payout=legacy_amount(cpp['max_accepted_payout']),
author_rewards=cpp['author_rewards'], author_rewards=cpp['author_rewards'],
children_abs_rshares=cpp['children_abs_rshares'], children_abs_rshares=cpp['children_abs_rshares'],
net_rshares=cpp['net_rshares'],
abs_rshares=cpp['abs_rshares'], abs_rshares=cpp['abs_rshares'],
vote_rshares=cpp['vote_rshares'], vote_rshares=cpp['vote_rshares'],
net_votes=cpp['net_votes'], net_votes=cpp['net_votes'],
......
...@@ -12,27 +12,24 @@ async def get_active_votes(context, author: str, permlink: str): ...@@ -12,27 +12,24 @@ async def get_active_votes(context, author: str, permlink: str):
db = context['db'] db = context['db']
sql = """ sql = """
SELECT SELECT
ha_v.name as voter hv.voter,
ha_a.name as author hv.author,
hpd.permlink as permlink hv.permlink,
weight hv.weight,
rshares hv.rshares,
vote_percent hv.percent,
last_update hv.time,
num_changes hv.num_changes
FROM FROM
hive_votes hv hive_votes_accounts_permlinks_view hv
INNER JOIN hive_accounts ha_v ON ha_v.id = hv.voter_id WHERE hv.author = :author AND hv.permlink = :permlink
INNER JOIN hive_accounts ha_a ON ha_a.id = hv.author_id
INNER JOIN hive_permlink_data hpd ON hpd.id = hv.permlink_id
WHERE ha_a.name = :author AND hpd.permlink = :permlink
""" """
ret = [] ret = []
rows = await db.query_all(sql, author=author, permlink=permlink) rows = await db.query_all(sql, author=author, permlink=permlink)
for row in rows: for row in rows:
ret.append(dict(voter=row.voter, author=row.author, permlink=row.permlink, ret.append(dict(voter=row.voter, author=row.author, permlink=row.permlink,
weight=row.weight, rshares=row.rshares, vote_percent=row.vote_percent, weight=row.weight, rshares=row.rshares, vote_percent=row.percent,
last_update=str(row.last_update), num_changes=row.num_changes)) last_update=str(row.time), num_changes=row.num_changes))
return ret return ret
@return_error_info @return_error_info
......
...@@ -102,7 +102,6 @@ CREATE TABLE IF NOT EXISTS hive_posts_new ( ...@@ -102,7 +102,6 @@ CREATE TABLE IF NOT EXISTS hive_posts_new (
is_grayed BOOLEAN DEFAULT '0', is_grayed BOOLEAN DEFAULT '0',
-- important indexes -- important indexes
rshares BIGINT DEFAULT '-1',
sc_trend NUMERIC(6) DEFAULT '0.0', sc_trend NUMERIC(6) DEFAULT '0.0',
sc_hot NUMERIC(6) DEFAULT '0.0', sc_hot NUMERIC(6) DEFAULT '0.0',
...@@ -210,12 +209,12 @@ FROM ...@@ -210,12 +209,12 @@ FROM
UPDATE hive_posts_new hpn SET ( UPDATE hive_posts_new hpn SET (
children, author_rep, flag_weight, total_votes, up_votes, payout, children, author_rep, flag_weight, total_votes, up_votes, payout,
payout_at, updated_at, is_paidout, is_nsfw, is_declined, is_full_power, payout_at, updated_at, is_paidout, is_nsfw, is_declined, is_full_power,
is_hidden, is_grayed, rshares, sc_trend, sc_hot) is_hidden, is_grayed, sc_trend, sc_hot)
= =
(SELECT (SELECT
children, author_rep, flag_weight, total_votes, up_votes, payout, children, author_rep, flag_weight, total_votes, up_votes, payout,
payout_at, updated_at, is_paidout, is_nsfw, is_declined, is_full_power, payout_at, updated_at, is_paidout, is_nsfw, is_declined, is_full_power,
is_hidden, is_grayed, rshares, sc_trend, sc_hot FROM hive_posts_cache hpc WHERE hpn.id = hpc.post_id); is_hidden, is_grayed, sc_trend, sc_hot FROM hive_posts_cache hpc WHERE hpn.id = hpc.post_id);
-- Populate table hive_post_data with bulk data from hive_posts_cache -- Populate table hive_post_data with bulk data from hive_posts_cache
-- RAISE NOTICE 'Populate table hive_post_data with bulk data from hive_posts_cache'; -- RAISE NOTICE 'Populate table hive_post_data with bulk data from hive_posts_cache';
......
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