Skip to content

Commit

Permalink
Merge pull request #126 from ankh2054/main
Browse files Browse the repository at this point in the history
Update fix-missing-blocks.py
  • Loading branch information
igorls authored Oct 20, 2022
2 parents 24ad40c + db9dd56 commit d99e1cd
Showing 1 changed file with 6 additions and 5 deletions.
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()

0 comments on commit d99e1cd

Please sign in to comment.