Fix even more issues with the linked_revs considered cache

This commit is contained in:
Stephan Kulow 2022-10-27 10:16:20 +02:00
parent 996b90dd7a
commit 65000cd586
2 changed files with 9 additions and 4 deletions

View File

@ -207,9 +207,14 @@ class DB:
"UPDATE scheme SET version=18", "UPDATE scheme SET version=18",
) )
schemes[19] = ( schemes[19] = (
"CREATE INDEX ON files(revision_id);", "CREATE INDEX ON files(revision_id)",
"UPDATE scheme SET version=19", "UPDATE scheme SET version=19",
) )
schemes[20] = (
"CREATE INDEX ON linked_revs(linked_id)",
"CREATE INDEX ON linked_revs(considered)",
"UPDATE scheme SET version=20",
)
schema_version = self.schema_version() schema_version = self.schema_version()
if (schema_version + 1) not in schemes: if (schema_version + 1) not in schemes:
return return

View File

@ -191,7 +191,7 @@ class Importer:
if not prev: if not prev:
with db.cursor() as cur: with db.cursor() as cur:
cur.execute( cur.execute(
"UPDATE linked_revs SET considered=TRUE where revision_id=%s", "UPDATE linked_revs SET considered=TRUE where linked_id=%s",
(rev.dbid,), (rev.dbid,),
) )
return return
@ -210,7 +210,7 @@ class Importer:
continue continue
last_linked = linked last_linked = linked
cur.execute( cur.execute(
"UPDATE linked_revs SET considered=TRUE where revision_id=%s", "UPDATE linked_revs SET considered=TRUE where linked_id=%s",
(rev.dbid,), (rev.dbid,),
) )
if not last_linked: if not last_linked:
@ -224,7 +224,7 @@ class Importer:
) )
if cur.fetchone(): if cur.fetchone():
cur.execute( cur.execute(
"UPDATE linked_revs SET considered=TRUE where revision_id=%s", "UPDATE linked_revs SET considered=TRUE where linked_id=%s",
(rev.dbid,), (rev.dbid,),
) )
return return