From a4058b84ce06158c3985cb6eb0c5487593a1f665 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Fri, 7 May 2021 12:00:30 -0300 Subject: [PATCH] clean out unused sharding --- lbry/wallet/server/db/writer.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lbry/wallet/server/db/writer.py b/lbry/wallet/server/db/writer.py index 5e7367dde..409a223b9 100644 --- a/lbry/wallet/server/db/writer.py +++ b/lbry/wallet/server/db/writer.py @@ -822,7 +822,7 @@ class SQLDB: f"SELECT claim_hash, normalized FROM claim WHERE expiration_height = {height}" ) - def enqueue_changes(self, shard=None, total_shards=None): + def enqueue_changes(self): query = """ SELECT claimtrie.claim_hash as is_controlling, claimtrie.last_take_over_height, @@ -832,11 +832,8 @@ class SQLDB: (select cr.claim_type from claim cr where cr.claim_hash = claim.reposted_claim_hash) as reposted_claim_type, claim.* FROM claim LEFT JOIN claimtrie USING (claim_hash) + WHERE claim.claim_hash in (SELECT claim_hash FROM changelog) """ - if shard is not None and total_shards is not None: - query += f" WHERE claim.height % {total_shards} = {shard}" - else: - query += " WHERE claim.claim_hash in (SELECT claim_hash FROM changelog)" for claim in self.execute(query): claim = claim._asdict() id_set = set(filter(None, (claim['claim_hash'], claim['channel_hash'], claim['reposted_claim_hash']))) @@ -864,11 +861,11 @@ class SQLDB: def clear_changelog(self): self.execute("delete from changelog;") - def claim_producer(self, shard=None, total_shards=None): + def claim_producer(self): while self.pending_deletes: claim_hash = self.pending_deletes.pop() yield 'delete', hexlify(claim_hash[::-1]).decode() - for claim in self.enqueue_changes(shard, total_shards): + for claim in self.enqueue_changes(): yield claim self.clear_changelog()