osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hlr/+/39804?usp=email )
Change subject: src/hlr: reopen DB after changing schema version
......................................................................
src/hlr: reopen DB after changing schema version
Close and reopen the DB after changing the version to so it gets written
to disk. Otherwise it may be that the DB does not get closed, and when
sqlite restores the DB the version can be 0 again, leading to errors
when trying to re-apply the schema upgrades
Related: SYS#7394
Change-Id: I5943a1cb3447c038c6e7972f68f9656b73a9248b
---
M src/db.c
M tests/db_upgrade/db_upgrade_test.ok
2 files changed, 17 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/04/39804/1
diff --git a/src/db.c b/src/db.c
index 7b8a415..c9f526c 100644
--- a/src/db.c
+++ b/src/db.c
@@ -595,6 +595,7 @@
int rc;
bool has_sqlite_config_sqllog = false;
int version;
+ bool version_changed = false;
LOGP(DDB, LOGL_NOTICE, "using database: %s\n", fname);
LOGP(DDB, LOGL_INFO, "Compiled against SQLite3 lib version %s\n", SQLITE_VERSION);
@@ -672,6 +673,7 @@
goto out_free;
}
version = CURRENT_SCHEMA_VERSION;
+ version_changed = true;
}
LOGP(DDB, LOGL_NOTICE, "Database '%s' has HLR DB schema version %d\n", dbc->fname, version);
@@ -686,6 +688,7 @@
}
LOGP(DDB, LOGL_NOTICE, "Database '%s' has been upgraded to HLR DB schema version %d\n",
dbc->fname, version+1);
+ version_changed = true;
}
if (version != CURRENT_SCHEMA_VERSION) {
@@ -702,6 +705,17 @@
goto out_free;
}
+ /* Close and reopen the DB after changing the version to so it gets
+ * written to disk. Otherwise it may be that the DB does not get
+ * closed, and when sqlite restores the DB the version can be 0 again,
+ * leading to errors when trying to re-apply the schema upgrades
+ * (SYS#7394). */
+ if (version_changed) {
+ LOGP(DDB, LOGL_NOTICE, "HLR DB schema version was changed, reopening...\n");
+ db_close(dbc);
+ return db_open(ctx, fname, enable_sqlite_logging, false);
+ }
+
/* prepare all SQL statements */
for (i = 0; i < ARRAY_SIZE(dbc->stmt); i++) {
rc = sqlite3_prepare_v2(dbc->db, stmt_sql[i], -1,
diff --git a/tests/db_upgrade/db_upgrade_test.ok b/tests/db_upgrade/db_upgrade_test.ok
index c719498..7248606 100644
--- a/tests/db_upgrade/db_upgrade_test.ok
+++ b/tests/db_upgrade/db_upgrade_test.ok
@@ -87,6 +87,9 @@
DDB Database <PATH>test.db' has been upgraded to HLR DB schema version 5
DDB Database <PATH>test.db' has been upgraded to HLR DB schema version 6
DDB Database <PATH>test.db' has been upgraded to HLR DB schema version 7
+DDB HLR DB schema version was changed, reopening...
+DDB using database: <PATH>test.db
+DDB Database <PATH>test.db' has HLR DB schema version 7
DMAIN Cmdline option --db-check: Database was opened successfully, quitting.
Resulting db:
--
To view, visit https://gerrit.osmocom.org/c/osmo-hlr/+/39804?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Change-Id: I5943a1cb3447c038c6e7972f68f9656b73a9248b
Gerrit-Change-Number: 39804
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
osmith has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/39802?usp=email )
Change subject: configure: set min python version check to 3.4
......................................................................
configure: set min python version check to 3.4
While the osmo-gsm-tester builder jobs that use the poky SDK with python
version 3.5 are passing with the last patch, the jobs that build our
images and packages with the poky SDK (201705 jobs) are still failing.
This is because they run on a machine with Python 3.4 installed, and
that version gets used in the build process. Lower the version to 3.4 to
not have a regression there.
Fixes: 489a6f ("configure.ac: check for Python interpreter unconditionally")
Fixes: 40e8f5 ("configure: set min python version check to 3.5")
Change-Id: Ia83f360274061463232c1fcd7f6dc6e70f774738
---
M configure.ac
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
osmith: Verified
fixeria: Looks good to me, but someone else must approve
Jenkins Builder: Verified
pespin: Looks good to me, approved
diff --git a/configure.ac b/configure.ac
index 80d1b76..7863624 100644
--- a/configure.ac
+++ b/configure.ac
@@ -176,7 +176,8 @@
dnl Search for a Python interpreter on the system
dnl python is needed at built-time for auto-generating code
dnl Don't require a newer version than 3.5 for now, as poky 201705 ships that
-AM_PATH_PYTHON([3.5])
+dnl Don't require a newer version than 3.4, we build poky 201705 on debian 8
+AM_PATH_PYTHON([3.4])
PKG_CHECK_MODULES(TALLOC, [talloc >= 2.1.0])
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/39802?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ia83f360274061463232c1fcd7f6dc6e70f774738
Gerrit-Change-Number: 39802
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Attention is currently required from: osmith.
pespin has posted comments on this change by osmith. ( https://gerrit.osmocom.org/c/libosmocore/+/39802?usp=email )
Change subject: configure: set min python version check to 3.4
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/39802?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ia83f360274061463232c1fcd7f6dc6e70f774738
Gerrit-Change-Number: 39802
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: osmith <osmith(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 17 Mar 2025 10:27:33 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
osmith has posted comments on this change by osmith. ( https://gerrit.osmocom.org/c/libosmocore/+/39801?usp=email )
Change subject: configure: set min python version check to 3.5
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
> unfortunately it is still failing, I'll look further into it
-> https://gerrit.osmocom.org/c/libosmocore/+/39802
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/39801?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ia39e7e04dd8a31efaf87fd1f0fbbfdc5b5fa37c2
Gerrit-Change-Number: 39801
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 17 Mar 2025 10:21:42 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: osmith <osmith(a)sysmocom.de>