#!/bin/bash
# repair truncated gold/creates.json (disk-full 8 Oct 18:07), then rerun gold_inc
set -e
cd /opt/sw/harness/gold
zstd -q -3 -f creates.json -o ../creates.json.truncated.zst
python3 -I - <<'P'
import json
s=open('creates.json').read(); i=s.rfind('}, {')
L=[x for x in json.loads(s[:i+1]+']') if x['blk']<83476700]   # creates_head next=83476700: rescan from there
json.dump(L,open('creates.json.new','w')); print(len(L))
P
mv creates.json.new creates.json
cd ..; flock -n /tmp/hx-inc.lock nice -n10 ionice -c3 timeout 3000 python3 -u gold_inc.py >> inc.log 2>&1
