<!-- Kamailio Pull Request Template -->
<!-- IMPORTANT: - for detailed contributing guidelines, read: https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md - pull requests must be done to master branch, unless they are backports of fixes from master branch to a stable branch - backports to stable branches must be done with 'git cherry-pick -x ...' - code is contributed under BSD for core and main components (tm, sl, auth, tls) - code is contributed GPLv2 or a compatible license for the other components - GPL code is contributed with OpenSSL licensing exception -->
#### Pre-Submission Checklist <!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply --> <!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above--> <!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list --> - [x] Commit message has the format required by CONTRIBUTING guide - [x] Commits are split per component (core, individual modules, libs, utils, ...) - [x] Each component has a single commit (if not, squash them into one commit) - [x] No commits to README files for modules (changes must be done to docbook files in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change - [x] Small bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds new functionality) - [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist: <!-- Go over all points below, and after creating the PR, tick the checkboxes that apply --> - [ ] PR should be backported to stable branches - [x] Tested changes locally - [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description <!-- Describe your changes in detail --> Add a database version check and fail gracefully if it does not match. You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3639
-- Commit Summary --
* topos: Add db version check
-- File Changes --
M src/modules/topos/topos_mod.c (26) M src/modules/topos/tps_storage.h (2)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3639.patch https://github.com/kamailio/kamailio/pull/3639.diff
If I haven't overlooked something, it seems to be missing closing db connection on mod_init, which results in inheriting it on children after fork and conflicts during runtime.
Maybe it is better to move it in child_init with rank 1, we discussed a bit about that during K Devs meeting.
Furthermore, I recommend to add a module parameter for being able to disable this check, some other modules do it:
- https://www.kamailio.org/docs/modules/stable/modules/auth_db.html#auth_db.p....
It was working fine without it for many releases and it should keep a way for same behaviour like in the past. Disabling version table check is useful during upgrades, when new database table structure includes the old one, in case of needing to revert the upgrade for a while, running the old version is fine.
@xkaraman pushed 2 commits.
a5773fefa83a8a74399211793a6a4404a9e3d32d topos: Close db connection 02974ce0d805cbb093ddf2c5d4ac39fa8d373ee8 topos: Add version_table parameter
@xkaraman pushed 2 commits.
bf0ef03ce0b55fb8a7998f06bbac6434e188ca9a topos: Close db connection 0f05b4f143bc3e46e89ed477c35532fb509dbcdb topos: Add version_table parameter
Updated to close the db connection and added a module parameter for being able to disable the check.
You also need to add documentation for the new module parameter in the xml file from doc/ subfolder.
To avoid globals conflict, add `_tps_` prefix to the new global variable in the C code, to be similar to the other variables that are made modparms by topos.
@xkaraman pushed 3 commits.
1f0f181645175e780cad19f0224d605dc0f45906 topos: Add db version check 7ab00b2513301361dea6c057d92d597a14ca6ae8 topos: Close db connection 0d8052ed91b20d23af2b6c6becbecd1bf31af18a topos: Add version_table parameter
@xkaraman pushed 1 commit.
76ad686d2c268040a30dfc02096d29be28d7eedf topos: Add version_table documentation
Thanks, merging!
Merged #3639 into master.