Skip to content

Adjusted hub package for upcoming 3.27 release to migrate the database of previous versions - #1984

Merged
craigcomstock merged 1 commit into
cfengine:masterfrom
craigcomstock:ENT-13266/master
Oct 17, 2025
Merged

Adjusted hub package for upcoming 3.27 release to migrate the database of previous versions#1984
craigcomstock merged 1 commit into
cfengine:masterfrom
craigcomstock:ENT-13266/master

Conversation

@craigcomstock

Copy link
Copy Markdown
Contributor

Previously in debian packages only the install/upgrade approach given to the package via apt was used to set is_upgrade.
Now we check the old and new versions of PostgreSQL explicitly.

Ticket: ENT-13266
Changelog: title

@craigcomstock

Copy link
Copy Markdown
Contributor Author

Build Status

…e of previous versions

master/3.27.0 will have a new major version of PostgreSQL: 18.0.
Versions 3.26 and older use a previous major version and so require a database migration.

This change should NOT be back-ported as 3.24.x is stuck at PostgreSQL 17.x and 3.21.x at 15.x.

Ticket: ENT-13266
Changelog: title
@craigcomstock craigcomstock changed the title Adjusted postinstall scriptlets in packaging to more precisely determine PostgreSQL database version state for migrations Adjusted hub package for upcoming 3.27 release to migrate the database of previous versions Oct 16, 2025
@craigcomstock

craigcomstock commented Oct 16, 2025

Copy link
Copy Markdown
Contributor Author

Now, with a proper fix, I should be able to upgrade my rpi4 hub :) Build Status

@craigcomstock
craigcomstock marked this pull request as ready for review October 16, 2025 20:36

@nickanderson nickanderson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What writes the upgraded from text file?

I dont love using this regex that I can't read without scrunching my face. I'm simple for something that's got to be changed.

Can we know more directly?

@craigcomstock

Copy link
Copy Markdown
Contributor Author

What writes the upgraded from text file?

I dont love using this regex that I can't read without scrunching my face. I'm simple for something that's got to be changed.

Can we know more directly?

It is a bit of a catch-22 currently. We need to know if we need to migrate in the preinstall script so that we backup the data directory before we copy stuff over it. That allows us to run pg_upgrade which needs both the OLD bindir and the NEW bindir in order to operate.

The UPGRADED_FROM.txt file is written a bit earlier in the preinstall.sh script. It takes the output of cf-agent -V.

And yes, the regex is not SO bad, but would be more fun if we had a semver less than function in there ;)

@nickanderson

Copy link
Copy Markdown
Member

It is a bit of a catch-22 currently. We need to know if we need to migrate in the preinstall script so that we backup the data directory before we copy stuff over it.

So, that's an optimization to no simply always backup on upgrade?

@craigcomstock

Copy link
Copy Markdown
Contributor Author

It is a bit of a catch-22 currently. We need to know if we need to migrate in the preinstall script so that we backup the data directory before we copy stuff over it.

So, that's an optimization to no simply always backup on upgrade?

Right. I was thinking the best solution would be to always backup the psql binaries and check explicitly in postinstall for the major version change to decide to migrate.

I think this change is "pretty good" and a necessary incremental step forward.

@craigcomstock
craigcomstock merged commit 4798a9d into cfengine:master Oct 17, 2025
2 checks passed
@craigcomstock
craigcomstock deleted the ENT-13266/master branch October 17, 2025 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants