Attention is currently required from: dexter, fixeria, jolly.

Hello Jenkins Builder, dexter, fixeria, jolly,

I'd like you to reexamine a change. Please visit

    https://gerrit.osmocom.org/c/osmo-hlr/+/43010?usp=email

to look at the new patch set (#2).

The following approvals got outdated and were removed:
Verified+1 by Jenkins Builder


Change subject: systemd: run db-upgrade script in ExecStartPre
......................................................................

systemd: run db-upgrade script in ExecStartPre

We have seen in CI jobs that calling the DB upgrade script from
debian/postinst does not work reliably.

When doing a fresh install of osmo-hlr, it usually works as expected:

  Setting up osmo-hlr (1.9.2) ...
  osmo-hlr-post-upgrade: nothing to do (no existing database)

But sometimes:

  Setting up osmo-hlr (1.9.2) ...
  osmo-hlr-post-upgrade: database upgrade is required
  osmo-hlr-post-upgrade: stopping osmo-hlr service
  osmo-hlr-post-upgrade: creating backup: 
/var/lib/osmocom/hlr.db.20260706135658.bak
  osmo-hlr-post-upgrade: performing database upgrade
  <0001> db.c:600 using database: /var/lib/osmocom/hlr.db
  <0001> db.c:103 (283) recovered 4 frames from WAL file 
/var/lib/osmocom/hlr.db-wal
  <0001> db.c:679 Database '/var/lib/osmocom/hlr.db' has HLR DB schema version 0
  <0001> db.c:103 (1) duplicate column name: last_lu_seen in "ALTER TABLE 
subscriber ADD COLUMN last_lu_seen TIMESTAMP default NULL"
  <0001> db.c:248 Unable to prepare SQL statement 'ALTER TABLE subscriber ADD 
COLUMN last_lu_seen TIMESTAMP default NULL'
  <0001> db.c:318 Unable to update HLR database schema to version 1
  <0001> db.c:685 Failed to upgrade HLR DB schema to version 1: (rc=1) 
duplicate column name: last_lu_seen
  <0000> hlr_db_tool.c:509 Error opening database

It seems that osmo-hlr can get started before the osmo-hlr-post-upgrade
script runs, then starts to create the database with the current schema,
and gets stopped before it is done, leading to the failure above.

Rename the script to osmo-hlr-db-upgrade.sh, remove logic for stopping
and starting the service and let systemd call it in ExecStartPre. That
way we are sure that it runs *before* osmo-hlr starts up.

Related: SYS#8125
Change-Id: If13f4c8b49397e6630956e92a7825843c7d55ebd
---
M contrib/Makefile.am
R contrib/osmo-hlr-db-upgrade.sh
M contrib/systemd/osmo-hlr.service
M debian/osmo-hlr.install
M debian/postinst
5 files changed, 8 insertions(+), 43 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/10/43010/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-hlr/+/43010?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Change-Id: If13f4c8b49397e6630956e92a7825843c7d55ebd
Gerrit-Change-Number: 43010
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <[email protected]>
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: jolly <[email protected]>
Gerrit-Attention: jolly <[email protected]>
Gerrit-Attention: fixeria <[email protected]>
Gerrit-Attention: dexter <[email protected]>

Reply via email to