Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update fix-missing-blocks.py #126

Merged
merged 1 commit into from
Oct 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions scripts/fix_missing_blocks/fix-missing-blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def query_body(interval):
"histogram": {
"field": "block_num",
"interval": interval,
"min_doc_count": 1
"min_doc_count": 0
},
"aggs": {
"max_block": {
Expand All @@ -99,7 +99,7 @@ def query_body2(gte,lte,interval):
"histogram": {
"field": "block_num",
"interval": interval,
"min_doc_count": 1
"min_doc_count": 0
},
"aggs": {
"max_block": {
Expand Down Expand Up @@ -151,6 +151,7 @@ def buckets_missing(bucketlist,count1,count2):
new.update({'key': key, 'doc_count': doc_count})
buckets_final.append(new)
# If not first bucket but has less than count2
# Might have to remove to account for indices with 0 count
elif doc_count < count2 and num != 0:
new.update({'key': key, 'doc_count': doc_count})
buckets_final.append(new)
Expand Down Expand Up @@ -281,12 +282,12 @@ def start_indexer_live():
print(bcolors.OKYELLOW,f"{'='*100}\nSearching for missing Blocks ",bcolors.ENDC)
# Search for buckets using histogram interval
buckets = get_buckets(10000000,query_body)
# Get buckets with missing blocks, first count is 9999999 to account for bucket 0-9999999.
missing = buckets_missing(buckets,9999999,10000000 )
# Get buckets with missing blocks, first count is 9999998 to account for bucket 0-9999999.
missing = buckets_missing(buckets,9999998,10000000 )
# Redefine search and set interval to 1000
gt_lt_list = CreateGtLT(missing)
print(bcolors.OKYELLOW,f"{'='*100}\nCompleted Search ",bcolors.ENDC)
#### For testing purposes use MagicFuzz(testing)
MagicFuzz(gt_lt_list)
## Once rewrite is completed go back to live reading
start_indexer_live()
start_indexer_live()