Multilib processing fails when a build contains two platforms

Open Beginner friendly
#512 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
65/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python, sqlalchemy
Domain
backend, database

Research direction

Locate the query by searching for the shown BuildTask subquery, then inspect how multilib processing selects tasks for each platform. Reproduce the case using build 47501 or an equivalent build with two platforms; done means the subquery returns one matching task and multilib processing no longer raises CardinalityViolationError.

Written by the indexing model from the issue text.

Description

bug build-node good first issue

As uncovered in this build, multilib processing is failing due to the following error:

asyncpg.exceptions.CardinalityViolationError: more than one row returned by a subquery used as an expression

The query in question is:

    subquery = (
        select(models.BuildTask.id)
        .where(
            sqlalchemy.and_(
                models.BuildTask.build_id == build_task.build_id,
                models.BuildTask.index == build_task.index,
                models.BuildTask.arch == "i686",
            )
        )
        .scalar_subquery()
    )

Since the build contains 2 platforms (and multilib applies to both), the subquery is returning 2 ids, one for Alma 8 and another one for Alma 9, while we expect to find exactly one.

I imagine that fixing the problem should be as simple as adding the condition models.BuildTask.platform_id == build_task.platform_id to the subquery, to ensure that we limit the results to the i686 packages of the same platform we are processing at that time.

Dominant language
No language data
Stars
32
Forks
11
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AlmaLinux/build-system

All issues in AlmaLinux/build-system

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.