Bugzilla – Attachment 42279 Details for
Bug 12120
Add --tempdir arg to rebuild_zebra.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12120: Add --tempdir arg to rebuild_zebra.pl
Bug-12120-Add---tempdir-arg-to-rebuildzebrapl.patch (text/plain), 4.58 KB, created by
Mason James
on 2015-09-03 09:20:54 UTC
(
hide
)
Description:
Bug 12120: Add --tempdir arg to rebuild_zebra.pl
Filename:
MIME Type:
Creator:
Mason James
Created:
2015-09-03 09:20:54 UTC
Size:
4.58 KB
patch
obsolete
>From abdf6c1289ec04b8d3fc4778042448afa37b8b69 Mon Sep 17 00:00:00 2001 >From: Mason James <mtj@kohaaloha.com> >Date: Thu, 20 Feb 2014 16:09:17 +1300 >Subject: [PATCH] Bug 12120: Add --tempdir arg to rebuild_zebra.pl >Content-Type: text/plain; charset="utf-8" > >Sometimes zebra indexing will fail when the filesystem of the /tmp dir is too small for the indexing temp file >ie: a 20 gig temp file is needed, and /tmp is only 1 gig :( > >in this situation, it is necessary to tell rebuild_zebra.pl to use a different filesystem with the required space. > >Test plan... >run 3 zebra indexing tests, with different args > >1/ test an index, with no args > $ sudo koha-shell -c ' /home/mason/git/koha/master/misc/migration_tools/rebuild_zebra.pl -b -v -z' koha1 | grep 'export directory' > the export directory /tmp/jp1d1RmCzL has been deleted. > >2/ test an index, with a --tempdir arg > $ sudo koha-shell -c ' /home/mason/git/koha/master/misc/migration_tools/rebuild_zebra.pl -b -v -z --tempdir /tmp1/aa1' koha1 | grep 'export directory' > the export directory /tmp1/aa1/FEOKJIzPcA has been deleted. > >3/ test an index, with both --tempdir and -d (directory) args > $ sudo koha-shell -c ' /home/mason/git/koha/master/misc/migration_tools/rebuild_zebra.pl -b -v -z --tempdir /tmp1/aa1 -d bb1' koha1 | grep 'export directory' > the export directory /tmp1/aa1/bb1 has been deleted. > >Note that the 'export directory' path is as expected, for each test run >--- > misc/migration_tools/rebuild_zebra.pl | 43 +++++++++++++++++++++++++++-------- > 1 file changed, 33 insertions(+), 10 deletions(-) > >diff --git a/misc/migration_tools/rebuild_zebra.pl b/misc/migration_tools/rebuild_zebra.pl >index aa31cb2..dda89e1 100755 >--- a/misc/migration_tools/rebuild_zebra.pl >+++ b/misc/migration_tools/rebuild_zebra.pl >@@ -27,9 +27,12 @@ chdir $ENV{HOME} if (!(-r '.')); > my $daemon_mode; > my $daemon_sleep = 5; > my $directory; >+my $tempdir ; > my $nosanitize; > my $skip_export; > my $keep_export; >+ >+ > my $skip_index; > my $reset; > my $biblios; >@@ -55,6 +58,7 @@ my $result = GetOptions( > 'daemon' => \$daemon_mode, > 'sleep:i' => \$daemon_sleep, > 'd:s' => \$directory, >+ 'td|tempdir:s' => \$tempdir, > 'r|reset' => \$reset, > 's' => \$skip_export, > 'k' => \$keep_export, >@@ -144,7 +148,13 @@ if ($verbose_logging >= 2) { > my $use_tempdir = 0; > unless ($directory) { > $use_tempdir = 1; >- $directory = tempdir(CLEANUP => ($keep_export ? 0 : 1)); >+ $directory = tempdir( >+ CLEANUP => ( $keep_export ? 0 : 1 ), >+ DIR => ( $tempdir ? $tempdir : undef ), >+ ); >+} >+else { >+ $directory = "$tempdir/$directory" if $tempdir; > } > > >@@ -237,25 +247,33 @@ if ( $verbose_logging ) { > print "CLEANING\n"; > print "====================\n"; > } >+ > if ($keep_export) { >- print "NOTHING cleaned : the export $directory has been kept.\n"; >+ print "NOTHING cleaned : the export directory $directory has been kept.\n"; > print "You can re-run this script with the -s "; > if ($use_tempdir) { > print " and -d $directory parameters"; >- } else { >- print "parameter"; >+ } >+ else { >+ print " parameter"; > } > print "\n"; > print "if you just want to rebuild zebra after changing the record.abs\n"; > print "or another zebra config file\n"; >-} else { >+ >+} >+else { >+ # if we're using a random temporary directory >+ # created by File::Temp, it will be removed >+ # automatically. so we do nothing here... >+ > unless ($use_tempdir) { >- # if we're using a temporary directory >- # created by File::Temp, it will be removed >- # automatically. >- rmtree($directory, 0, 1); >- print "directory $directory deleted\n"; >+ >+ # but if $use_tempdir, we remove it manually >+ rmtree( $directory, 0, 1 ); > } >+ print "the export directory $directory has been deleted.\n" >+ if $verbose_logging; > } > > sub do_one_pass { >@@ -865,6 +883,11 @@ Parameters: > -r clear Zebra index before > adding records to index. Implies -w. > >+ --tempdir Add a base directory for indexing. >+ Note: Using this arg in conjuction with the -d arg, will create >+ a directory under the path given with --tempdir >+ so, --tempdir /mnt/100_gig -d koha1, creates an absolute path of /mnt/100_gig/koha1 >+ > -d Temporary directory for indexing. > If not specified, one is automatically > created. The export directory >-- >2.1.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 12120
: 42279