verify covers against db instead of fs

This commit is contained in:
ed 2023-03-15 19:48:43 +00:00
parent 5af1575329
commit e0c4829ec6

View file

@ -1251,12 +1251,15 @@ class Up2k(object):
if n_rm2: if n_rm2:
self.log("forgetting {} shadowed deleted files".format(n_rm2)) self.log("forgetting {} shadowed deleted files".format(n_rm2))
c2.connection.commit()
# then covers # then covers
n_rm3 = 0 n_rm3 = 0
qu = "select 1 from up where rd=? and +fn=? limit 1"
q = "delete from cv where rd=? and dn=? and +fn=?" q = "delete from cv where rd=? and dn=? and +fn=?"
for crd, cdn, fn in cur.execute("select * from cv"): for crd, cdn, fn in cur.execute("select * from cv"):
ap = os.path.join(top, crd, cdn, fn) urd = vjoin(crd, cdn)
if not bos.path.exists(ap): if not c2.execute(qu, (urd, fn)).fetchone():
c2.execute(q, (crd, cdn, fn)) c2.execute(q, (crd, cdn, fn))
n_rm3 += 1 n_rm3 += 1