Hello community, We have been caught out with a minor annoyance in the koha-upgrade-schema script (Debian package) - upon reloading a database from an SQL dump file (e.g. re-imaging a test server from a live system), the database upgrade appears to complete successfully, but in fact steps are missed. We believe this is because memcached is keeping the software version cached as a value, as a restart of memcached seems to resolve the issue. I attach a proposed solution; restarting memcached just before calling the updatedatabase.pl script. I hope this makes sense, can can be backported for 22.11.xx. Many thanks, Jake
Created attachment 151083 [details] [review] Add memcached restart before updatedatabase.pl is called This patch adds a call to /etc/init.d/memcached so that when koha-upgrade-schema is called, the correct DB revision number is fetched, avoiding issues when loading & upgrading a SQL dump file
If we need a flush a can call bin/flush_memcached
Another solution would be to retrieve the value from the DB in updatedatabase.pl 74 my $original_version = C4::Context->preference("Version");
Hi Jonathan, A fine point, well-raised. Flushing the cache from within updatedatabase.pl covers a wider range of install types, too. I've attached another patch, this time for updatedatabase.pl. To test (assuming the software version is 22.1106000, please amend to suit): 1. Set database to a historic version near to your own – SQL: UPDATE systempreferences SET value='22.1105012' WHERE variable='Version'; 2. Run sudo koha-upgrade-schema test (or updatedatabase.pl, if you use dev installs) – notice how nothing happens 3. Apply patch 4. Rerun sudo koha-upgrade-schema test (or updatedatabase.pl, if you use dev installs) – notice how the upgrade proceeds from correct point (even if it fails due to duplicate tables / columns / keys) 5. Repeat steps 1 & 4 to validate Many thanks, Jake
Created attachment 151881 [details] [review] Update the updatedatabase.pl script to flush caches before running
Created attachment 152096 [details] [review] Bug 33720: Update the updatedatabase.pl script to flush caches before running
I've attached a git patch.
I think we should fix install.pl as well. The UI is not telling us the DB is behind if the syspref has been modified manually in DB.
Created attachment 152852 [details] [review] Bug 33720: Update the updatedatabase.pl script to flush caches before running Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 152853 [details] [review] Bug 33720: Also flush in install
Created attachment 152857 [details] [review] Bug 33720: Update the updatedatabase.pl script to flush caches before running Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Created attachment 152858 [details] [review] Bug 33720: Also flush in install Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Pushed to master for 23.11. Nice work everyone, thanks!
Thanks for all the hard work! Pushed to 23.05.x for the next release
Nice work everyone! Pushed to oldstable for 22.11.x