Mailing List Archive

r3742 - in branches/maint_0.1x: lib/KinoSearch/Index t
Author: creamyg
Date: 2008-08-21 18:57:21 -0700 (Thu, 21 Aug 2008)
New Revision: 3742

Modified:
branches/maint_0.1x/lib/KinoSearch/Index/DelDocs.pm
branches/maint_0.1x/t/210-deldocs.t
Log:
Fix maint bug where deleting from the same segment twice causes a file name
collision.


Modified: branches/maint_0.1x/lib/KinoSearch/Index/DelDocs.pm
===================================================================
--- branches/maint_0.1x/lib/KinoSearch/Index/DelDocs.pm 2008-08-19 20:44:38 UTC (rev 3741)
+++ branches/maint_0.1x/lib/KinoSearch/Index/DelDocs.pm 2008-08-22 01:57:21 UTC (rev 3742)
@@ -32,6 +32,9 @@
# Blast out a hard copy of the deletions held in memory.
sub write_deldocs {
my ( $self, $invindex, $filename, $max_doc ) = @_;
+ if ( $invindex->file_exists($filename) ) {
+ $invindex->delete_file($filename);
+ }
my $outstream = $invindex->open_outstream($filename);

# pad out deldocs->bits

Modified: branches/maint_0.1x/t/210-deldocs.t
===================================================================
--- branches/maint_0.1x/t/210-deldocs.t 2008-08-19 20:44:38 UTC (rev 3741)
+++ branches/maint_0.1x/t/210-deldocs.t 2008-08-22 01:57:21 UTC (rev 3742)
@@ -2,7 +2,7 @@
use warnings;

use lib 't';
-use Test::More tests => 11;
+use Test::More tests => 12;

BEGIN { use_ok('KinoSearch::Index::DelDocs') }
use KinoSearchTestInvIndex qw( create_invindex );
@@ -49,3 +49,7 @@
"write_deldocs and read_deldocs save/recover num_deletions correctly" );
is( $deldocs->get_capacity, 8,
"write_deldocs wrote correct number of bytes" );
+
+$deldocs->write_deldocs( $invindex, "_1.del", 8 );
+ok( $invindex->file_exists("_1.del"), "overwrite existing deletions file" );
+


_______________________________________________
kinosearch-commits mailing list
kinosearch-commits@rectangular.com
http://www.rectangular.com/mailman/listinfo/kinosearch-commits