Skip to content

CLOS-6809: compare Governor DB versions numerically, not by spelling - #71

Merged
azheregelya merged 5 commits into
cloudlinux:cloudlinuxfrom
prilr:CLOS-6809-mariadb-11-4-governor-db-token
Aug 13, 2026
Merged

CLOS-6809: compare Governor DB versions numerically, not by spelling#71
azheregelya merged 5 commits into
cloudlinux:cloudlinuxfrom
prilr:CLOS-6809-mariadb-11-4-governor-db-token

Conversation

@prilr

@prilr prilr commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

A Governor-managed MariaDB 11.4 system could not be upgraded at all: leapp inhibited with "cl-mysql.repo does not match the installed database type", naming an expected repository path of cl-mariadb-11.4 that does not exist.

The original issue describes this as a deadlock between two checks. That's not quite correct.
Governor derives the token it caches in mysql.type.installed with exactly the expression leapp uses in get_clmysql_version_from_pkg():

"%s%s" % (name, "".join(version.split(".")[:2]))     # 11.4.12 -> mariadb114

Both sides therefore agree on an untouched system and the "Mismatch between Governor DB type and installed packages" inhibitor cannot fire.
It appears only after a customer follows a remediation hint and hand-writes mariadb1104 into the file. The single real bug is that leapp then predicted the repository directory from that token. Governor's spelling is a hand-maintained table rather than an algorithm: the 11.x series pads the minor version to two digits (cl-mariadb-11.04) while 10.x does not (cl-mariadb-10.6), so the prediction produced a phantom cl-mariadb-11.4.

Verified against repo.cloudlinux.com on 2026-08-05 - cl-mariadb-11.04 and cl-mariadb-11.08 return 200 for both cl8 and cl9, cl-mariadb-11.4 and cl-mariadb-11.8 return 404 - so no edit of cl-mysql.repo can satisfy the check either, and the remediation hint leapp printed pointed at a 404.

Solution: rather than mirror Governor's spelling table in leapp, parse both sides to a numeric (family, major, minor) triple and compare that. The two spellings collapse onto it - mariadb114 and mariadb1104 are both ("mariadb", 11, 4) - so the check needs no knowledge of how Governor spelled anything, and the same applies to the repository URL. A mirrored table was implemented first and rejected on review: it is correct only until Governor adds a series with a single-digit minor under a two-digit major (a future 12.4 would be cl-mariadb-12.04), and then it fails the same way, silently.

The second change closes the last place that still needed the spelling. The DNF module stream name is built from the token (mariadb1104 -> cl-MariaDB1104), and for a series absent from MODULE_STREAMS the code derived it from the cached token, whose padding Governor has dropped - so a future MariaDB 12.4 would have enabled cl-MariaDB124 where the real stream is cl-MariaDB1204. That failure is quieter than the original one: a MEDIUM report rather than an inhibitor, so the upgrade proceeds and only fails later when DNF cannot enable a module that does not exist.

The cl-mysql-meta repository directory carries the same digits as the stream, padding included, so the stream is now read from there - checked against all 17 (repo directory, module stream) pairs in governor-mysql 1.2-147, every one reproduces exactly. MODULE_STREAMS still takes precedence, because it records streams verified to exist; the repository is consulted only for a series it does not cover. Reading it is safe at that point because the handler has already inhibited the upgrade if the repository disagrees with the installed database.

Net effect: a newly released Governor DB version needs no leapp change at all.

No mariadb1108 entry is added to MODULE_STREAMS on purpose. Governor declares mariadb:cl-MariaDB1108, but the published cl-mariadb-11.08 repository carries no modules.yaml on either cl8 or cl9, and dnf module list against it returns no module - unlike cl-mariadb-11.04, which does contribute the cl-MariaDB1104 stream. Leaving it out keeps the "module stream was derived automatically" report, which is a signal we want to keep.

MariaDB 11.8 now resolves to the correctly spelled cl-MariaDB1108 via the repository rather than a phantom cl-MariaDB118.

The URL remediation no longer names a repository file to download. Predicting that filename is what produced the 404 here, and re-running mysqlgovernor.py --install --yes regenerates cl-mysql.repo correctly by definition (and if it doesn't, that's a separate topic).

The report now states both versions - the installed one and the one the repository describes - instead of a path the customer cannot fetch.

Validated with the reporter's package set (governor-mysql-1.2-147, cl-MariaDB1104-11.4.12, leapp-upgrade-el8toel9-0.20.0-9): reproduced on stock packages with no manual edits, hitting the same report key and the same 404 hint.

After the change leapp preupgrade reaches the end with no inhibitors, produces target repo cl-mysql-meta-9 -> .../cl9/mysqlmeta/cl-mariadb-11.04/$basearch/, enables mariadb:cl-MariaDB1104, and the CL9 dnf transaction check resolves. Note that leapp skips TargetTransactionCheck entirely while any inhibitor remains, so clearing the DB-type inhibitor alone would not have proven the transaction.

@prilr
prilr force-pushed the CLOS-6809-mariadb-11-4-governor-db-token branch 2 times, most recently from 313f731 to 4c1d3b8 Compare August 12, 2026 11:45
@prilr prilr changed the title CLOS-6809: map Governor's RPM-derived DB token to its canonical spelling CLOS-6809: compare Governor DB versions numerically, not by spelling Aug 13, 2026
prilr and others added 5 commits August 13, 2026 09:09
A Governor-managed MariaDB 11.4 system could not be upgraded at all: leapp
inhibited with "cl-mysql.repo does not match the installed database type",
naming an expected repository path of cl-mariadb-11.4 that does not exist.

The ticket describes this as a deadlock between two checks. It is one defect.
Governor derives the token it caches in mysql.type.installed with exactly the
expression leapp uses in get_clmysql_version_from_pkg():

    "%s%s" % (name, "".join(version.split(".")[:2]))     # 11.4.12 -> mariadb114

Both sides therefore agree on an untouched system and the "Mismatch between
Governor DB type and installed packages" inhibitor cannot fire; it appears only
after a customer follows KCS 27757797511068 and hand-writes mariadb1104 into the
file. The single real bug is that leapp then predicted the repository directory
from that token. Governor's spelling is a hand-maintained table, not an
algorithm: MariaDB 11.4 is published as cl-mariadb-11.04 (minor padded to two
digits) while 10.6 is cl-mariadb-10.6 (not padded), so the prediction produced a
phantom cl-mariadb-11.4.

Verified against repo.cloudlinux.com on 2026-08-05 - cl-mariadb-11.04 and
cl-mariadb-11.08 return 200 for both cl8 and cl9, cl-mariadb-11.4 and
cl-mariadb-11.8 return 404 - so no edit of cl-mysql.repo could satisfy the check
either, and the remediation hint leapp printed pointed at a 404.

Rather than mirror Governor's table here, parse both sides to a numeric
(family, major, minor) triple and compare that. The two spellings collapse onto
the same triple - mariadb114 and mariadb1104 are both ("mariadb", 11, 4) - so
the check needs no knowledge of how Governor spelled anything, and a future
series cannot silently reintroduce this bug by being absent from a table. The
same applies to the repository URL: cl-mariadb-11.04 and a hypothetical
cl-mariadb-11.4 both parse to the same version. A mirrored table was tried first
and rejected for exactly this reason - it is correct only until Governor adds a
series with a single-digit minor under a two-digit major, and then fails the
same way, silently.

MODULE_STREAMS stays, because the DNF module stream name is built from Governor's
spelling (cl-MariaDB1104) and cannot be derived; it is also pre-existing and
already reports when it has to guess. canonical_clmysql_type() consults it as the
registry of confirmed streams rather than adding a second table. No mariadb1108
entry is added: Governor declares mariadb:cl-MariaDB1108, but the published
cl-mariadb-11.08 repository carries no modules.yaml on cl8 or cl9 and
`dnf module list` against it returns nothing, so that stream cannot be confirmed
to exist. Leaving it out keeps the "module stream was derived automatically"
report, which is the signal we want until that content question is settled.

The URL remediation no longer names a repository file to download. Predicting
that filename is what produced the 404 in this ticket, and re-running
`mysqlgovernor.py --install --yes` regenerates cl-mysql.repo correctly by
definition. The report now states both versions - the installed one and the one
the repository describes - instead of a path the customer cannot fetch.

Validated on a CL8.10 VM with the reporter's package set (governor-mysql-1.2-147,
cl-MariaDB1104-11.4.12, leapp-upgrade-el8toel9-0.20.0-9): reproduced on stock
packages with no manual edits, hitting the same report key
c38e8f2dbe0f7a618685d87e692f6206868f9393 and the same 404 hint. Afterwards
leapp preupgrade reaches RC=0 with no inhibitors and no errors, produces target
repo cl-mysql-meta-9 -> .../cl9/mysqlmeta/cl-mariadb-11.04/$basearch/, enables
mariadb:cl-MariaDB1104, and the CL9 dnf transaction check resolves. Note that
leapp skips TargetTransactionCheck entirely while any inhibitor remains, so
clearing the DB-type inhibitor alone would not have proven the transaction.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Worked-On: cl-aiworkspaces
… repository

With the version check no longer predicting Governor's spelling, one place still
had to know it: the DNF module stream name is built from the token
("mariadb1104" -> "cl-MariaDB1104"), and MODULE_STREAMS only lists the streams we
have confirmed. For anything absent from that table the code fell back to
deriving the name from the type token, which Governor caches with the minor
version's leading zero dropped. A future MariaDB 12.4 would therefore have
enabled cl-MariaDB124 where the real stream is cl-MariaDB1204.

That failure is quieter than the one this branch started from: it is a MEDIUM
report rather than an inhibitor, so the upgrade proceeds and only fails later,
when DNF cannot enable a module that does not exist.

The cl-mysql-meta repository directory carries the same digits as the stream
name, padding included, so read it from there instead: cl-mariadb-11.04 goes with
cl-MariaDB1104 and cl-mariadb-10.6 with cl-MariaDB106. Checked against every
(repo directory, module stream) pair in governor-mysql 1.2-147 - all 17 reproduce
exactly - plus both shapes a future 12.x could take.

Order of preference is unchanged where it matters: MODULE_STREAMS still wins,
because it records streams that were actually verified to exist; the repository
is consulted only for a series that table does not cover; and the token-derived
guess remains as a last resort for a system with no usable repository. Reading
the repository is safe at this point because clmysql_process() has already
inhibited the upgrade if it does not describe the installed database - only a
confirmed baseurl is stored on the shared library object.

A side effect worth noting: MariaDB 11.8 now resolves to cl-MariaDB1108 rather
than the phantom cl-MariaDB118, while still carrying the "module stream was
derived automatically" report, since whether that module is published at all is
still open.

Validated on the CL8.10 VM: leapp preupgrade still reaches RC=0 with no
inhibitors or errors, and MariaDB 11.4 still resolves through MODULE_STREAMS to
mariadb:cl-MariaDB1104 with the same target repository as before.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Worked-On: cl-aiworkspaces
Worked-On: cl-aiworkspaces
Worked-On: cl-aiworkspaces
…m provenance

Two defects found in review of the version-comparison change.

An unreadable cl-mysql-meta URL stopped inhibiting. Comparing parsed versions
replaced a substring test, and that quietly inverted the default: the old code
inhibited on any URL not containing the expected fragment, while the new code
skipped a URL whose version it could not read. A repository like
.../mysqlmeta/current/ was copied, force-enabled and handed to the upgrade with
no report at all - reproduced as two target repositories produced and cloudlinux
registered, zero reports. Not being able to confirm the repository is precisely
when this check should stop, so an unreadable URL now inhibits, and the report
says which of the two things went wrong: the repository names a different
version, or its version cannot be read at all.

MariaDB 11.4 drew a "module stream was derived automatically" report even though
its stream came from the verified MODULE_STREAMS table. finalize() tested the
cached token, and Governor caches "mariadb114" while the confirmed entry is
"mariadb1104", so a table-backed stream was announced as a guess. This fired on
a real CL8.10 host running the reporter's package set, not just in theory - the
earlier validation missed it because it only inspected inhibitors and errors, and
this report is MEDIUM.

Resolution now reports where the stream actually came from - the verified table,
the configured repository, or the detected type - so the message is accurate in
all three cases instead of always crediting the repository. The report is emitted
only for the latter two.

Both cases are pinned by tests. Re-validated on the CL8.10 VM: leapp preupgrade
still reaches RC=0 with no inhibitors or errors, MariaDB 11.4 still resolves to
mariadb:cl-MariaDB1104 through the verified table, and the spurious MEDIUM report
is gone.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Worked-On: cl-aiworkspaces
@prilr
prilr force-pushed the CLOS-6809-mariadb-11-4-governor-db-token branch from 4c1d3b8 to 6efeef4 Compare August 13, 2026 13:12
@azheregelya azheregelya self-assigned this Aug 13, 2026
@azheregelya
azheregelya merged commit b1be084 into cloudlinux:cloudlinux Aug 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants