Bug 28399 - batchRebuildItemsTables.pl error 'Already in a transaction'
Summary: batchRebuildItemsTables.pl error 'Already in a transaction'
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-20 09:43 UTC by Julien Sicot (Univ. Rennes 2)
Modified: 2022-06-06 20:24 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.11.00,21.05.02,20.11.09


Attachments
Bug 28399: Remove txn error from batchRebuildItemsTables.pl (2.37 KB, patch)
2021-06-24 13:11 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 28399: Remove txn error from batchRebuildItemsTables.pl (2.47 KB, patch)
2021-07-06 11:09 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Sicot (Univ. Rennes 2) 2021-05-20 09:43:56 UTC
Hello,

When I run misc/batchRebuildItemsTables.pl , I get the following errors :

DBD::mysql::db begin_work failed: Already in a transaction at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1590.
DBD::mysql::db begin_work failed: Already in a transaction at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1590.

Seems an issue similar to bug #27245.

Many thanks,

Best,
Julien Sicot
Systems Librarian
Rennes 2 university
Comment 1 Jonathan Druart 2021-06-24 13:11:54 UTC
Created attachment 122385 [details] [review]
Bug 28399: Remove txn error from batchRebuildItemsTables.pl
Comment 2 Jonathan Druart 2021-06-24 13:12:45 UTC
Hi Julien, I am not familiar with the script so hard to fully test it, but this patch should remove the error you got. Can you confirm?
Comment 3 Julien Sicot (Univ. Rennes 2) 2021-06-25 08:40:11 UTC
Hi Jonathan,

Patch applied in master
I confirm it removes errors.

Many thanks,

Julien
Comment 4 Marcel de Rooy 2021-07-02 12:18:47 UTC
Last one:
$schema->txn_commit unless $test_parameter;

Would it be more appropriate/neat to rollback when testing here?
Comment 5 Jonathan Druart 2021-07-05 14:15:13 UTC
(In reply to Marcel de Rooy from comment #4)
> Last one:
> $schema->txn_commit unless $test_parameter;
> 
> Would it be more appropriate/neat to rollback when testing here?

It will rollback without commit, the result is the same. I just kept the same line as before. Happy to adjust if you think it is more readable with rollback (note that we are using "unless $test" above).
Comment 6 Marcel de Rooy 2021-07-05 14:21:43 UTC
(In reply to Jonathan Druart from comment #5)
> (In reply to Marcel de Rooy from comment #4)
> > Last one:
> > $schema->txn_commit unless $test_parameter;
> > 
> > Would it be more appropriate/neat to rollback when testing here?
> 
> It will rollback without commit, the result is the same. 

Yes, it is quite theory. The rollback will be executed a fraction later at the disconnect (which we probably skip too ;)
No blocker for me.
Comment 7 Marcel de Rooy 2021-07-06 11:09:08 UTC
Created attachment 122611 [details] [review]
Bug 28399: Remove txn error from batchRebuildItemsTables.pl

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 8 Jonathan Druart 2021-07-12 13:49:39 UTC
Pushed to master for 21.11, thanks to everybody involved!
Comment 9 Kyle M Hall 2021-07-16 12:12:02 UTC
Pushed to 21.05.x for 21.05.02
Comment 10 Fridolin Somers 2021-08-02 21:12:02 UTC
Pushed to 20.11.x for 20.11.09
Comment 11 Victor Grousset/tuxayo 2021-08-16 18:27:49 UTC
Not backported to oldoldstable (20.05.x). Feel free to ask if it's needed.