Bugzilla – Attachment 5279 Details for
Bug 5724
Sometimes deletes aren't processed correctly by rebuild zebra
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 5724: Handling deleted records better
Bug-5724-Handling-deleted-records-better.patch (text/plain), 4.19 KB, created by
Chris Cormack
on 2011-09-02 09:32:15 UTC
(
hide
)
Description:
Bug 5724: Handling deleted records better
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2011-09-02 09:32:15 UTC
Size:
4.19 KB
patch
obsolete
>From 065f130f920d020c0de6422865db3d3c0de65127 Mon Sep 17 00:00:00 2001 >From: Paul Poulain <paul.poulain@biblibre.com> >Date: Wed, 15 Dec 2010 20:45:24 +0100 >Subject: [PATCH] Bug 5724: Handling deleted records better > >MT3915: rebuild_zebra changes because deleted biblios would stick in zebra indexes > > Since the update of biblios would be done AFTER the deletion of biblios, > and since biblios would be updated just before being deleted (in order to delete the items) > update process would recreate the biblio. > > This patch fixes the order in order to do the deletion AFTER the update. >--- > misc/migration_tools/rebuild_zebra.pl | 27 ++++++++++++--------------- > 1 files changed, 12 insertions(+), 15 deletions(-) > >diff --git a/misc/migration_tools/rebuild_zebra.pl b/misc/migration_tools/rebuild_zebra.pl >index dadf43f..d271a8a 100755 >--- a/misc/migration_tools/rebuild_zebra.pl >+++ b/misc/migration_tools/rebuild_zebra.pl >@@ -66,12 +66,6 @@ if (not $biblios and not $authorities) { > die $msg; > } > >-if ($authorities and $as_xml) { >- my $msg = "Cannot specify both -a and -x\n"; >- $msg .= "Please do '$0 --help' to see usage.\n"; >- die $msg; >-} >- > if ( !$as_xml and $nosanitize ) { > my $msg = "Cannot specify both -no_xml and -nosanitize\n"; > $msg .= "Please do '$0 --help' to see usage.\n"; >@@ -238,10 +232,10 @@ sub index_records { > } > my $record_fmt = ($as_xml) ? 'marcxml' : 'iso2709' ; > if ($process_zebraqueue) { >- do_indexing($record_type, 'delete', "$directory/del_$record_type", $reset, $noshadow, $record_fmt, $zebraidx_log_opt) >- if %$records_deleted; > do_indexing($record_type, 'update', "$directory/upd_$record_type", $reset, $noshadow, $record_fmt, $zebraidx_log_opt) > if $num_records_exported; >+ do_indexing($record_type, 'delete', "$directory/del_$record_type", $reset, $noshadow, $record_fmt, $zebraidx_log_opt) >+ if %$records_deleted; > } else { > do_indexing($record_type, 'update', "$directory/$record_type", $reset, $noshadow, $record_fmt, $zebraidx_log_opt) > if ($num_records_exported or $skip_export); >@@ -453,8 +447,9 @@ sub get_raw_marc_record { > my $marc; > if ($record_type eq 'biblio') { > if ($noxml) { >- my $fetch_sth = $dbh->prepare_cached("SELECT marc FROM biblioitems WHERE biblionumber = ?"); >- $fetch_sth->execute($record_number); >+ my $fetch_sth = $dbh->prepare_cached("SELECT marc FROM biblioitems WHERE biblionumber = ? >+ UNION SELECT marc from deletedbiblioitems where biblionumber=?"); >+ $fetch_sth->execute($record_number,$record_number); > if (my ($blob) = $fetch_sth->fetchrow_array) { > $marc = MARC::Record->new_from_usmarc($blob); > unless ($marc) { >@@ -468,7 +463,7 @@ sub get_raw_marc_record { > $fetch_sth->finish(); > return unless $marc; > } else { >- eval { $marc = GetMarcBiblio($record_number); }; >+ eval { $marc = GetMarcBiblio($record_number,"include_deleted_table"); }; > if ($@ || !$marc) { > # here we do warn since catching an exception > # means that the bib was found but failed >@@ -486,7 +481,7 @@ sub get_raw_marc_record { > return; > } > } >- return $marc; >+ return $marc; > } > > sub fix_leader { >@@ -514,10 +509,11 @@ sub fix_biblio_ids { > my $biblioitemnumber; > if (@_) { > $biblioitemnumber = shift; >- } else { >+ } else { > my $sth = $dbh->prepare( >- "SELECT biblioitemnumber FROM biblioitems WHERE biblionumber=?"); >- $sth->execute($biblionumber); >+ "SELECT biblioitemnumber FROM biblioitems WHERE biblionumber=? >+ UNION SELECT biblioitemnumber FROM deletedbiblioitems WHERE biblionumber=?"); >+ $sth->execute($biblionumber,$biblionumber); > ($biblioitemnumber) = $sth->fetchrow_array; > $sth->finish; > unless ($biblioitemnumber) { >@@ -550,6 +546,7 @@ sub fix_authority_id { > } > } > >+ > sub fix_unimarc_100 { > # FIXME - again, if this is necessary, it belongs in C4::AuthoritiesMarc. > my $marc = shift; >-- >1.7.4.1
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 5724
:
3104
|
3233
|
5278
| 5279