-/* $Id: isamb.c,v 1.92 2007-02-24 16:46:22 adam Exp $
+/* $Id: isamb.c,v 1.94 2007-11-28 09:56:42 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
decode_ptr(&src, &isamb->root_ptr);
}
assert (isamb->file[i].head.block_size >= isamb->file[i].head.block_offset);
- isamb->file[i].head_dirty = 0;
+ /* must rewrite the header if root ptr is in use (bug #1017) */
+ if (use_root_ptr && writeflag)
+ isamb->file[i].head_dirty = 1;
+ else
+ isamb->file[i].head_dirty = 0;
assert(isamb->file[i].head.block_size == sizes[i]);
}
#if ISAMB_DEBUG
yaz_log(YLOG_DEBUG, "isamb_close returned "ZINT_FORMAT" values, "
"skipped "ZINT_FORMAT,
isamb->skipped_numbers, isamb->returned_numbers);
+
for (i = 0; i<isamb->no_cat; i++)
{
flush_blocks (isamb, i);
assert(*lookahead_mode);
}
}
+ else if (d == 0 && *lookahead_mode == 2)
+ {
+ /* For mode == 2, we insert the new key anyway - even
+ though the comparison is 0. */
+ dst_item = lookahead_item;
+ p->dirty = 1;
+ }
else
dst_item = file_item_buf;
- if (!*lookahead_mode && d == 0)
+ if (d == 0 && !*lookahead_mode)
{
- /* it's a deletion and they match so there is nothing to be
- inserted anyway .. But mark the thing bad (file item
- was part of input.. The item will not be part of output */
+ /* it's a deletion and they match so there is nothing
+ to be inserted anyway .. But mark the thing dirty
+ (file item was part of input.. The item will not be
+ part of output */
p->dirty = 1;
}
else if (!half1 && dst > mid_cut)
/* simple recursive dumper .. */
static void isamb_dump_r (ISAMB b, ISAM_P pos, void (*pr)(const char *str),
- int level)
+ int level)
{
char buf[1024];
char prefix_str[1024];