#3176 Kojira redesign
Opened 2 years ago by tkopecek. Modified a month ago

We've some discussions about this but it is not covered anywwhere.

Kojira nowdays regenerate too many repos from which many are never used. We want to redesign it a bit and create priority queue at the hub/db. Now is everything tracked and calculated in kojira which means that e.g. user can't demand faster repo regeneration via queue (only explicit spawning of the task).

So, let's collect requirements here before we start the design part.

1) User should be able to request repo for the build. In such case it should be reprioritized in queue accordingly to his permission level.
2) Some tasks could have also modify its repo regeneration priority (MBS, chainbuilds, ...)
3) kojira should only alter queue, not care about the task execution (it could be handled by new scheduler as recurring "maintenance" type of task)
4) deleting repos - not clear if it should be done in kojira or somewhere else (probably not hub due to IO, maybe some createrepo builder with RW access?)
5) maintenance daemon - that was another idea - Currently GC and kojira are separate tools, while they have parts which are similar (deleting old repos is basically GC task). So, maybe separate "maintenance" builder could look more like regular builder just with elevated privileges and handling all these tasks via events (kojira queue and/or timing - simply scheduling repeated GC task - it could be done also with new scheduler (e.g. new time field earliest_time until which task will not be picked)


Here is a very simple older PoC - I wouldn't do it exactly this way nowadays but is a source of inspiration.

https://pagure.io/fork/tkopecek/koji/c/664455e276ac44b52815f3eb17ae27e4687cf9b1?branch=priority-queue

Metadata Update from @tkopecek:
- Custom field Size adjusted to None

2 years ago

In terms of the overall design, the main thing that we need is to move to "on demand" repo generation. Hence the notion of requests in point 1 and a queue for them (separate from the task queue) in point 3.

Apart from that, while this is an opportunity to also reconsider other aspects of kojira behavior, I think we'd do well to limit it to changes that are actually necessitated by the on-demand change.

Currently, kojira does the following things:

  • keep track of whether repos are current
  • keep track of external repo changes
  • trigger repo regens
  • mark repos expired as appropriate
  • delete expired repos as appropriate

TBH, most of this activity will need to remain there, though some of it will need to change:

  • checking repo currency is likely to change, but I think there is still a role for kojira to play
  • we shouldn't move external repo checking to the hub, so easiest for this to remain with kojira for now. However, I suspect we'll want to have this information recorded in the hub somehow, perhaps in the tag_updates table.
  • The biggest change will be in repo regen triggering. Most of this will be on demand, but we'll still need something to trigger it for cases where users rely on a current repo that is used primarily outside of brew (e.g. brew-rhel-8).
  • expiration – I think this will change, but kojira will likely still do it. I think the expired state will need to shift to meaning "marked for deletion", so in a sense kojira will be performing repo garbage collection
  • deletion – this still fits in kojira I think. I would be very hesitant to move it to the builders.

I think maintenance unification is a longer term goal. I would rather defer that part for the moment, though it certainly would be nice to have.

Login to comment on this ticket.

Metadata
Related Pull Requests
  • #4033 Last updated 22 days ago
  • #4027 Last updated 2 months ago