Bugzilla – Attachment 2631 Details for
Bug 5228
Sometimes the zebra server directories break and rebuild_zebra fails
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
proposed patch
0001-Bug-5228-make-rebuild_zebra-handle-fixing-the-zebra-.patch (text/plain), 3.31 KB, created by
Robin Sheat
on 2010-09-16 07:11:38 UTC
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Robin Sheat
Created:
2010-09-16 07:11:38 UTC
Size:
3.31 KB
patch
obsolete
>From 5d86ef156262f2894ca61bfc970ae67e94965762 Mon Sep 17 00:00:00 2001 >From: Robin Sheat <robin@catalyst.net.nz> >Date: Thu, 16 Sep 2010 19:05:05 +1200 >Subject: [PATCH] Bug 5228 - make rebuild_zebra handle fixing the zebra dirs > >If the zebra server directories don't exist, zebra will spit the dummy. >This makes rebuild_zebra.pl smart enough to create them if they're not >there. If that fails, it'll scream loudly so you know zebra isn't >reindexing. >--- > misc/migration_tools/rebuild_zebra.pl | 30 +++++++++++++++++++++++++++--- > 1 files changed, 27 insertions(+), 3 deletions(-) > >diff --git a/misc/migration_tools/rebuild_zebra.pl b/misc/migration_tools/rebuild_zebra.pl >index 37dcaf5..52d28f8 100755 >--- a/misc/migration_tools/rebuild_zebra.pl >+++ b/misc/migration_tools/rebuild_zebra.pl >@@ -128,13 +128,13 @@ if ($do_munge) { > } > > if ($authorities) { >- index_records('authority', $directory, $skip_export, $process_zebraqueue, $as_xml, $noxml, $nosanitize, $do_not_clear_zebraqueue, $verbose_logging, $zebraidx_log_opt); >+ index_records('authority', $directory, $skip_export, $process_zebraqueue, $as_xml, $noxml, $nosanitize, $do_not_clear_zebraqueue, $verbose_logging, $zebraidx_log_opt, $authorityserverdir); > } else { > print "skipping authorities\n" if ( $verbose_logging ); > } > > if ($biblios) { >- index_records('biblio', $directory, $skip_export, $process_zebraqueue, $as_xml, $noxml, $nosanitize, $do_not_clear_zebraqueue, $verbose_logging, $zebraidx_log_opt); >+ index_records('biblio', $directory, $skip_export, $process_zebraqueue, $as_xml, $noxml, $nosanitize, $do_not_clear_zebraqueue, $verbose_logging, $zebraidx_log_opt, $biblioserverdir); > } else { > print "skipping biblios\n" if ( $verbose_logging ); > } >@@ -166,11 +166,34 @@ if ($keep_export) { > } > } > >+# This checks to see if the zebra directories exist under the provided path. >+# If they don't, then zebra is likely to spit the dummy. This returns true >+# if the directories had to be created, false otherwise. >+sub check_zebra_dirs { >+ my ($base) = shift() . '/'; >+ my $needed_repairing = 0; >+ my @dirs = ( '', 'key', 'register', 'shadow' ); >+ foreach my $dir (@dirs) { >+ my $bdir = $base . $dir; >+ if (! -d $bdir) { >+ $needed_repairing = 1; >+ mkdir $bdir || die "Unable to create '$bdir': $!\n"; >+ print "$0: needed to create '$bdir'\n"; >+ } >+ } >+ return $needed_repairing; >+} # ---------- end of subroutine check_zebra_dirs ---------- >+ > sub index_records { >- my ($record_type, $directory, $skip_export, $process_zebraqueue, $as_xml, $noxml, $nosanitize, $do_not_clear_zebraqueue, $verbose_logging, $zebraidx_log_opt) = @_; >+ my ($record_type, $directory, $skip_export, $process_zebraqueue, $as_xml, $noxml, $nosanitize, $do_not_clear_zebraqueue, $verbose_logging, $zebraidx_log_opt, $server_dir) = @_; > > my $num_records_exported = 0; > my $num_records_deleted = 0; >+ my $need_reset = check_zebra_dirs($server_dir); >+ if ($need_reset) { >+ print "$0: found broken zebra server directories: forcing a rebuild\n"; >+ $reset = 1; >+ } > if ($skip_export && $verbose_logging) { > print "====================\n"; > print "SKIPPING $record_type export\n"; >@@ -222,6 +245,7 @@ sub index_records { > } > } > >+ > sub select_zebraqueue_records { > my ($record_type, $update_type) = @_; > >-- >1.7.0.4 >
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 5228
:
2630
| 2631