[Koha-bugs] [Bug 29325] commit_file.pl error 'Already in a transaction'

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Nov 26 11:50:00 CET 2021


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29325

Marcel de Rooy <m.de.rooy at rijksmuseum.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|BLOCKED                     |Failed QA

--- Comment #17 from Marcel de Rooy <m.de.rooy at rijksmuseum.nl> ---
We really should not add these txn begin etc statements in the ImportBatch
module. Not only is it ugly, we probably break other scripts using this
routine.

Before resolving this issue, we should address the question: Do we really want
to do commits along the way? And import a partial batch potentially? I think we
should not. So that makes life simpler. Do a commit at the end in the misc_file
script. Dont touch the module.

When just commenting three lines, the script already works:
diff --git a/misc/commit_file.pl b/misc/commit_file.pl
index 543d7b06c7..e1ff4c4bd8 100755
--- a/misc/commit_file.pl
+++ b/misc/commit_file.pl
@@ -46,7 +46,7 @@ if ($list_batches) {
 C4::Context->set_userenv(0, 'batch', 0, 'batch', 'batch', 'batch', 'batch');

 my $dbh = C4::Context->dbh;
-$dbh->{AutoCommit} = 0;
+#$dbh->{AutoCommit} = 0;
 if ($batch_number =~ /^\d+$/ and $batch_number > 0) {
     my $batch = GetImportBatch($batch_number);
     die "$0: import batch $batch_number does not exist in database\n" unless
defined $batch;
@@ -59,7 +59,7 @@ if ($batch_number =~ /^\d+$/ and $batch_number > 0) {
             unless $batch->{'import_status'} eq "staged" or
$batch->{'import_status'} eq "reverted";
         process_batch($batch_number);
     }
-    $dbh->commit();
+#    $dbh->commit();
 } else {
     die "$0: please specify a numeric batch ID\n";
 }
@@ -132,7 +132,7 @@ _SUMMARY_
 sub print_progress_and_commit {
     my $recs = shift;
     print "... processed $recs records\n";
-    $dbh->commit();
+#    $dbh->commit();
 }

 sub print_usage {

But note that I now also commit when we fail halfway.

The name of the progress callback should be adjusted.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list