[KinoSearch] _write_postings hanging in _02
Marvin Humphrey
marvin at rectangular.com
Wed Mar 7 20:08:05 PST 2007
On Mar 7, 2007, at 5:33 PM, Chris Nandor wrote:
> I added some entries to an index, deleted them all, then added them
> again,
> then deleted them again. On the second time through, on the
> delete, when I
> call finish on the writer, _write_postings ends up hanging.
I got a bus error from trying to dereference a NULL pointer. This
appears to be the fix, and was committed as r2130.
slothbear:~/projects/ks/perl marvin$ svn diff ../c_src/KinoSearch/
Index/PostingsWriter.c
Index: ../c_src/KinoSearch/Index/PostingsWriter.c
===================================================================
--- ../c_src/KinoSearch/Index/PostingsWriter.c (revision 2113)
+++ ../c_src/KinoSearch/Index/PostingsWriter.c (working copy)
@@ -227,6 +227,9 @@
if ( iter == -1 ) { /* never true; can only get here via
goto */
/* prepare to clear out buffers and exit loop */
FINAL_ITER: {
+ /* skip final iter if there are no terms */
+ if (outstream == NULL)
+ break;
iter = -1;
REFCOUNT_DEC(term_text);
term_text = (ViewByteBuf*)BB_new(0);
slothbear:~/projects/ks/perl marvin$
The test code I used to reproduce the bug is below. Please let me
know whether the flow is the same as yours, since I didn't get a hang.
Marvin Humphrey
Rectangular Research
http://www.rectangular.com/
#--------------------------------------------------------------------
my $invindex = KinoSearch::InvIndex->create(
folder => KinoSearch::Store::RAMFolder->new,
schema => TestSchema->new,
);
my $invindexer = KinoSearch::InvIndexer->new( invindex => $invindex );
$invindexer->add_doc( { content => $_ } ) for 'a' .. 'c';
$invindexer->finish;
$invindexer = KinoSearch::InvIndexer->new( invindex => $invindex );
$invindexer->delete_by_term( content => $_ ) for 'a' .. 'c';
$invindexer->finish;
$invindexer = KinoSearch::InvIndexer->new( invindex => $invindex );
$invindexer->add_doc( { content => $_ } ) for 'a' .. 'c';
$invindexer->finish;
$invindexer = KinoSearch::InvIndexer->new( invindex => $invindex );
$invindexer->delete_by_term( content => $_ ) for 'a' .. 'c';
$invindexer->finish;
More information about the kinosearch
mailing list