Bug 14698 - AtomicUpdater - Keeps track of which updates have been applied to a database
Summary: AtomicUpdater - Keeps track of which updates have been applied to a database
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Installation and upgrade (command-line installer) (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Olli-Antti Kivilahti
QA Contact: Testopia
URL:
Keywords:
Depends on: 13906 13995 14539
Blocks: 15654 16223
  Show dependency treegraph
 
Reported: 2015-08-20 11:15 UTC by Olli-Antti Kivilahti
Modified: 2020-07-23 04:22 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Large patch
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 14698 - AtomicUpdater - Keeps track of which updates have been applied to a database (34.67 KB, patch)
2015-08-31 11:07 UTC, Olli-Antti Kivilahti
Details | Diff | Splinter Review
Presentation about AtomicUpdate workflow for managing in-house features in production (198.33 KB, application/vnd.oasis.opendocument.presentation)
2015-08-31 11:09 UTC, Olli-Antti Kivilahti
Details
Bug 14698 - AtomicUpdater - Keeps track of which updates have been applied to a database (47.17 KB, patch)
2015-09-04 09:35 UTC, Olli-Antti Kivilahti
Details | Diff | Splinter Review
Bug 14698 - AtomicUpdater - Keeps track of which updates have been applied to a database (47.17 KB, patch)
2015-09-04 09:42 UTC, Olli-Antti Kivilahti
Details | Diff | Splinter Review
Bug 14698 - AtomicUpdater - Keeps track of which updates have been applied to a database (48.85 KB, patch)
2015-09-04 13:12 UTC, Olli-Antti Kivilahti
Details | Diff | Splinter Review
Bug 14698 - AtomicUpdater - Keeps track of which updates have been applied to a database (48.85 KB, patch)
2015-09-04 13:33 UTC, Olli-Antti Kivilahti
Details | Diff | Splinter Review
Bug 14698 - AtomicUpdater - Keeps track of which updates have been applied to a database (49.29 KB, patch)
2015-09-07 08:33 UTC, Olli-Antti Kivilahti
Details | Diff | Splinter Review
Bug 14698 - AtomicUpdater - Followup, add single atomicupdate-script execution. (7.12 KB, patch)
2015-09-14 13:30 UTC, Olli-Antti Kivilahti
Details | Diff | Splinter Review
Bug 14698 - AtomicUpdater - Followup, add single atomicupdate-script execution. Add dry-run mode. (10.00 KB, patch)
2015-09-14 13:57 UTC, Olli-Antti Kivilahti
Details | Diff | Splinter Review
Bug 14698 - AtomicUpdater - addAllAtomicUpdates (4.33 KB, patch)
2017-04-13 11:11 UTC, Lari Taskula
Details | Diff | Splinter Review
Bug 14698: (follow-up) Koha::AtomicUpdater->find allow hashref as param (1.48 KB, patch)
2017-06-16 16:14 UTC, Lari Taskula
Details | Diff | Splinter Review
Bug 14698: Add needed Koha::Exceptions (1.02 KB, patch)
2020-04-14 08:18 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 14698: AtomicUpdater - Keeps track of which updates have been applied to a database (53.85 KB, patch)
2020-04-14 08:24 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 14698: AtomicUpdater - addAllAtomicUpdates (3.61 KB, patch)
2020-04-14 08:26 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 14698: AtomicUpdater - Bindings to updatedatabase.pl (5.33 KB, patch)
2020-04-14 08:27 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 14698: AtomicUpdater - Support .perl atomicupdates as defined by skeleton.perl (5.20 KB, patch)
2020-04-14 08:28 UTC, Emmi Takkinen
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Olli-Antti Kivilahti 2015-08-20 11:15:22 UTC
We need to know which atomicupdates have been deployed to various test databases. This feature adds a database table to keep track of the deployed updates.

There is also a cronjob to easily interface with the atomicupdate database log to revert entries and show them.
Comment 1 Olli-Antti Kivilahti 2015-08-31 11:07:57 UTC Comment hidden (obsolete)
Comment 2 Olli-Antti Kivilahti 2015-08-31 11:09:28 UTC
Created attachment 42113 [details]
Presentation about AtomicUpdate workflow for managing in-house features in production
Comment 3 Zeno Tajoli 2015-09-01 08:12:48 UTC
Patch complexity is 'Large' because this change has many architectural connections
Comment 4 Olli-Antti Kivilahti 2015-09-04 09:35:33 UTC Comment hidden (obsolete)
Comment 5 Olli-Antti Kivilahti 2015-09-04 09:42:43 UTC Comment hidden (obsolete)
Comment 6 Olli-Antti Kivilahti 2015-09-04 13:12:15 UTC Comment hidden (obsolete)
Comment 7 Olli-Antti Kivilahti 2015-09-04 13:33:31 UTC Comment hidden (obsolete)
Comment 8 Olli-Antti Kivilahti 2015-09-07 08:33:05 UTC
Created attachment 42426 [details] [review]
Bug 14698 - AtomicUpdater - Keeps track of which updates have been applied to a database

Fixed a missing PerlDependency.

TEST PLAN:

1. Run "perl installer/data/mysql/atomicupdate.pl --help"
2. Read the code.
3. git bz apply some bugs which introduce atomicupdates, or cook your own
4. Deploy the atomicupdates using the atomicupdate.pl-script.
5. Repeat steps 3-4 to your heart's content.
6+. Understand the code and come up with improvement ideas!
Comment 9 Olli-Antti Kivilahti 2015-09-14 13:30:13 UTC Comment hidden (obsolete)
Comment 10 Olli-Antti Kivilahti 2015-09-14 13:57:02 UTC
Created attachment 42523 [details] [review]
Bug 14698 - AtomicUpdater - Followup, add single atomicupdate-script execution. Add dry-run mode.
Comment 11 Aleisha Amohia 2016-01-26 01:09:57 UTC
Applying: Bug 14698 - AtomicUpdater - Keeps track of which updates have been applied to a database
/home/vagrant/kohaclone/.git/rebase-apply/patch:156: trailing whitespace.
    
/home/vagrant/kohaclone/.git/rebase-apply/patch:493: trailing whitespace.
    
/home/vagrant/kohaclone/.git/rebase-apply/patch:682: trailing whitespace.
GetOptions( 
/home/vagrant/kohaclone/.git/rebase-apply/patch:765: trailing whitespace.
 
fatal: sha1 information is lacking or useless (C4/Installer/PerlDependencies.pm).
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001 Bug 14698 - AtomicUpdater - Keeps track of which updates have been applied to a database
Comment 12 Olli-Antti Kivilahti 2016-02-08 13:57:48 UTC
Hi!

We are targeting to upgrade our Koha to master this summer and rebase this feature.

Send me an email if you need this feature and we will share the latest code for you.
Comment 13 Lari Taskula 2017-04-13 11:11:21 UTC
Created attachment 62141 [details] [review]
Bug 14698 - AtomicUpdater - addAllAtomicUpdates

This patch adds a new method Koha::AtomicUpdater->addAllAtomicUpdates that marks
all pending atomicupdates as applied, but does not execute the database changes
in them. This is required for fresh installations to avoid applying same updates
after the installation.

Binds this feature to web installer.

To test:
1. prove t/db_dependent/Koha/AtomicUpdater.t
Comment 14 Lari Taskula 2017-06-16 16:14:50 UTC
Created attachment 64404 [details] [review]
Bug 14698: (follow-up) Koha::AtomicUpdater->find allow hashref as param

Otherwise t/db_dependent/TestBuilder.t fails!

To test:
1. prove t/db_dependent/Koha/AtomicUpdater.t
2. prove t/db_dependent/TestBuilder.t
Comment 15 Emmi Takkinen 2020-04-14 08:18:16 UTC
Created attachment 102899 [details] [review]
Bug 14698: Add needed Koha::Exceptions
Comment 16 Emmi Takkinen 2020-04-14 08:24:50 UTC
Created attachment 102900 [details] [review]
Bug 14698: AtomicUpdater - Keeps track of which updates have been applied to a database

This patch includes latest code for atomicupdate.pl script. Tests are adjusted to work with TestBuilder and are no longer depended on Bug 13906.
Comment 17 Emmi Takkinen 2020-04-14 08:26:43 UTC
Created attachment 102901 [details] [review]
Bug 14698: AtomicUpdater - addAllAtomicUpdates

Rebased patch.
Comment 18 Emmi Takkinen 2020-04-14 08:27:44 UTC
Created attachment 102902 [details] [review]
Bug 14698: AtomicUpdater - Bindings to updatedatabase.pl

Instead of every time we execute updatedatabase.pl, we deploy AtomicUpdates smartly.

Also tries it's best to parse the bug number from the updatedatabase.pl-entries
and checks if that bug has already been applied via AtomicUpdater to prevent
adding same DB changes twice.
Comment 19 Emmi Takkinen 2020-04-14 08:28:41 UTC
Created attachment 102903 [details] [review]
Bug 14698: AtomicUpdater - Support .perl atomicupdates as defined by skeleton.perl

Koha community has introduced a template for developer atomicupdates, as defined
in atomicupdates/skeleton.perl. This patch makes these updates Koha::AtomicUpdater
compatible by redefining CheckVersion and SetVersion, and by passing $dbh into the
file.

To test:
1. prove t/db_dependent/Koha/AtomicUpdater.t
Comment 20 Jonathan Druart 2020-07-22 11:01:20 UTC
If the update entries are idempotent you won't face this problem.
Comment 21 David Cook 2020-07-23 04:22:14 UTC
I don't see how this would be useful for a production Koha.

I could maybe see how it could be useful for a dev/test database, but that's not something that should be in mainline Koha I think. (Although following that logic, then atomic updates in general don't belong in mainline Koha. Awkward.)

That said, I do wish that we'd improve our database upgrade methods...