Bugzilla – Attachment 118109 Details for
Bug 21818
Don't use AutoCommit flag in stage-marc-import.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21818: Replace AutoCommit flag with DBIx transaction in stage-marc-import.pl
Bug-21818-Replace-AutoCommit-flag-with-DBIx-transa.patch (text/plain), 2.78 KB, created by
Fridolin Somers
on 2021-03-11 10:54:52 UTC
(
hide
)
Description:
Bug 21818: Replace AutoCommit flag with DBIx transaction in stage-marc-import.pl
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2021-03-11 10:54:52 UTC
Size:
2.78 KB
patch
obsolete
>From ac5e9eb11c2b47ad37196da08cf8b9a90778b52a Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Thu, 11 Mar 2021 11:46:46 +0100 >Subject: [PATCH] Bug 21818: Replace AutoCommit flag with DBIx transaction in > stage-marc-import.pl > >Like it was done in Bug 18806. > >Test plan : >Use stage-marc-import.pl with and without patch, with a matcher to find >duplicates >--- > tools/stage-marc-import.pl | 18 ++++++++---------- > 1 file changed, 8 insertions(+), 10 deletions(-) > >diff --git a/tools/stage-marc-import.pl b/tools/stage-marc-import.pl >index 97767bfa1b..9f285efe87 100755 >--- a/tools/stage-marc-import.pl >+++ b/tools/stage-marc-import.pl >@@ -106,7 +106,6 @@ if ($completedJobID) { > # BatchStageMarcRecords can handle that > > my $job = undef; >- my $dbh; > if ($runinbackground) { > my $job_size = scalar(@$marcrecords); > # if we're matching, job size is doubled >@@ -139,9 +138,9 @@ if ($completedJobID) { > > } > >- # New handle, as we're a child. >- $dbh = C4::Context->dbh({new => 1}); >- $dbh->{AutoCommit} = 0; >+ my $schema = Koha::Database->new->schema; >+ $schema->storage->txn_begin; >+ > # FIXME branch code > my ( $batch_id, $num_valid, $num_items, @import_errors ) = > BatchStageMarcRecords( >@@ -150,7 +149,7 @@ if ($completedJobID) { > $marc_modification_template, > $comments, '', > $parse_items, 0, >- 50, staging_progress_callback( $job, $dbh ) >+ 50, staging_progress_callback( $job ) > ); > > if($profile_id) { >@@ -169,17 +168,18 @@ if ($completedJobID) { > $matcher_code = $matcher->code(); > $num_with_matches = > BatchFindDuplicates( $batch_id, $matcher, 10, 50, >- matching_progress_callback( $job, $dbh ) ); >+ matching_progress_callback($job) ); > SetImportBatchMatcher($batch_id, $matcher_id); > SetImportBatchOverlayAction($batch_id, $overlay_action); > SetImportBatchNoMatchAction($batch_id, $nomatch_action); > SetImportBatchItemAction($batch_id, $item_action); >- $dbh->commit(); >+ $schema->storage->txn_commit; > } else { > $matcher_failed = 1; >+ $schema->storage->txn_rollback; > } > } else { >- $dbh->commit(); >+ $schema->storage->txn_commit; > } > > my $results = { >@@ -239,7 +239,6 @@ exit 0; > > sub staging_progress_callback { > my $job = shift; >- my $dbh = shift; > return sub { > my $progress = shift; > $job->progress($progress); >@@ -248,7 +247,6 @@ sub staging_progress_callback { > > sub matching_progress_callback { > my $job = shift; >- my $dbh = shift; > my $start_progress = $job->progress(); > return sub { > my $progress = shift; >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21818
:
118109
|
119793
|
120106