Bugzilla – Attachment 3104 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]
Proposed Patch
0001-Bug-5724-Handling-deleted-records-better-note-this-p.patch (text/plain), 4.44 KB, created by
Chris Cormack
on 2011-02-08 22:14:33 UTC
(
hide
)
Description:
Proposed Patch
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2011-02-08 22:14:33 UTC
Size:
4.44 KB
patch
obsolete
>From e95bb3ed2899a601e60464e8c24c1474dc846a93 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, note this patch changes the reporting level of zebraidx too > >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 bd11494..2bdcaa4 100755 >--- a/misc/migration_tools/rebuild_zebra.pl >+++ b/misc/migration_tools/rebuild_zebra.pl >@@ -34,7 +34,7 @@ my $as_xml; > my $process_zebraqueue; > my $do_not_clear_zebraqueue; > my $verbose_logging; >-my $zebraidx_log_opt = " -v none,fatal,warn "; >+my $zebraidx_log_opt = " -v none,fatal "; > my $result = GetOptions( > 'd:s' => \$directory, > 'reset' => \$reset, >@@ -65,12 +65,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"; >@@ -237,10 +231,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 $num_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 $num_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); >@@ -424,7 +418,8 @@ 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 = ?"); >+ my $fetch_sth = $dbh->prepare_cached("SELECT marc FROM biblioitems WHERE biblionumber = ? >+ UNION SELECT marc from deletedbiblioitems where biblionumber=?"); > $fetch_sth->execute($record_number); > if (my ($blob) = $fetch_sth->fetchrow_array) { > $marc = MARC::Record->new_from_usmarc($blob); >@@ -435,7 +430,7 @@ sub get_raw_marc_record { > # trying to process a record update > } > } else { >- eval { $marc = GetMarcBiblio($record_number); }; >+ eval { $marc = GetMarcBiblio($record_number,"include_deleted_table"); }; > if ($@) { > # here we do warn since catching an exception > # means that the bib was found but failed >@@ -451,7 +446,7 @@ sub get_raw_marc_record { > return; > } > } >- return $marc; >+ return $marc; > } > > sub fix_leader { >@@ -479,10 +474,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) { >@@ -515,6 +511,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.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