[KinoSearch] Error in function kino_FSFileDes_fdseek
Marvin Humphrey
marvin at rectangular.com
Tue Mar 6 13:33:55 PST 2007
On Mar 3, 2007, at 11:44 PM, Edward Betts wrote:
> Error in function kino_FSFileDes_fdseek at
> c_src/KinoSearch/Store/FSFileDes.c:64: File operation failed: Invalid
Found the bug. It was one missing line in c_src/KinoSearch/Index/
TermListWriter.c.
Index: c_src/KinoSearch/Index/TermListWriter.c
===================================================================
--- ../c_src/KinoSearch/Index/TermListWriter.c (revision 2112)
+++ ../c_src/KinoSearch/Index/TermListWriter.c (revision 2113)
@@ -157,6 +157,7 @@
TInfo_Reset(self->last_tinfo);
self->last_tinfo->field_num = field_num;
self->last_text->len = 0;
+ self->last_tl_ptr = 0;
}
/* Close files, store metadata for a field.
Previously, all terms in all fields were held in a single pair of
files per segment (_XXX.tis and _XXX.tii). In KS 0.20, each field now
gets its own dedicated pair of term list files (_XXX.tlYYY and
_XXX.tlxYYY) -- a change that has been long planned, but was finally
implemented with a commit on Febrary 23.
The problem occurred when switching over to a new file. Instead of
resetting the last_tl_fileptr (last term list file pointer) variable
to 0, it was held over. This incorrect value could lead to garbage
file pointers when indexing multiple fields, for fields other than
the first -- provided that the first field had sufficient content.
All the multi-field search tests in the KS test suite used minimal
content for simplicity, and the stress test is single-field -- thus
the buggy code was not exercised.
Squashing this bug makes the failing test app run cleanly and solves
the problem I identified with large indexes returning incorrect
results. I strongly suspect it solves Karel K's crashing problem as
well, looking at his stack trace.
A new dev release will be uploaded to CPAN later today if prep goes
cleanly (Valgrind reveals no glitches, etc).
Marvin Humphrey
Rectangular Research
http://www.rectangular.com/
More information about the KinoSearch
mailing list