Skip to content

Commit

Permalink
Merge pull request buildbot#8205 from mpollmeier/michael/janitor-sql-…
Browse files Browse the repository at this point in the history
…bugfix

db: janitor should cleanup builds _older than_ given timestamp
  • Loading branch information
p12tic authored Nov 11, 2024
2 parents 6c4ca96 + 4f6ab60 commit 5d97b64
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 2 additions & 3 deletions master/buildbot/db/build_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,13 @@ def thd(conn) -> int:
q = q.where(
(builds.c.complete_at >= older_than_timestamp) | (builds.c.complete_at == NULL)
)
# n.b.: in sqlite we need to filter on `>= older_than_timestamp` because of the following `NOT IN` clause...

q = build_data.delete().where(build_data.c.buildid.notin_(q))
else:
q = build_data.delete()
q = q.where(builds.c.id == build_data.c.buildid)
q = q.where(
(builds.c.complete_at >= older_than_timestamp) | (builds.c.complete_at == NULL)
)
q = q.where(builds.c.complete_at <= older_than_timestamp)
res = conn.execute(q)
conn.commit()
res.close()
Expand Down
1 change: 1 addition & 0 deletions newsfragments/janitor-timehorizon.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixes the timestamp comparison in janitor: it should cleanup builds 'older than' given timestamp - previously janitor would delete all build_data for builds 'newer than' the configured build data horizon.

0 comments on commit 5d97b64

Please sign in to comment.