2 * Copyright (c) 1995-1998, Index Data.
3 * See the file LICENSE for details.
4 * $Id: isamd.c,v 1.22 2002-07-12 18:12:21 heikki Exp $
6 * Isamd - isam with diffs
7 * Programmed by: Heikki Levanto
10 * - Statistics are missing and/or completely wrong
11 * - Lots of code stolen from isamc, not all needed any more
21 #include "../index/index.h" /* isamd uses the internal structure of it_key */
24 static void flush_block (ISAMD is, int cat);
25 static void release_fc (ISAMD is, int cat);
26 static void init_fc (ISAMD is, int cat);
28 #define ISAMD_FREELIST_CHUNK 1
32 ISAMD_M isamd_getmethod (ISAMD_M me)
34 static struct ISAMD_filecat_s def_cat[] = {
36 /* blocksz, max. Unused time being */
37 { 32, 40 }, /* 24 is the smallest unreasonable size! */
62 { 24, 1 }, /* Experimental sizes */
73 ISAMD_M m = (ISAMD_M) xmalloc (sizeof(*m)); /* never released! */
74 m->filecat = def_cat; /* ok, only alloc'd once */
81 m->compare_item = NULL;
83 m->debug = 0; /* default to no debug */
85 m->max_blocks_mem = 10;
92 ISAMD isamd_open (BFiles bfs, const char *name, int writeflag, ISAMD_M method)
95 ISAMD_filecat filecat;
98 is = (ISAMD) xmalloc (sizeof(*is));
100 is->method = (ISAMD_M) xmalloc (sizeof(*is->method));
101 memcpy (is->method, method, sizeof(*method));
102 filecat = is->method->filecat;
105 /* determine number of block categories */
106 if (is->method->debug>0)
107 logf (LOG_LOG, "isamd: bsize maxkeys");
110 if (is->method->debug>0)
111 logf (LOG_LOG, "isamd:%6d %6d",
112 filecat[i].bsize, filecat[i].mblocks);
113 } while (filecat[i++].mblocks);
117 assert (is->no_files > 0);
118 assert (is->max_cat <=8 ); /* we have only 3 bits for it */
120 is->files = (ISAMD_file) xmalloc (sizeof(*is->files)*is->no_files);
122 for (i = 0; i<is->no_files; i++)
126 sprintf (fname, "%s%c", name, i+'A');
127 is->files[i].bf = bf_open (bfs, fname, is->method->filecat[i].bsize,
129 is->files[i].head_is_dirty = 0;
130 if (!bf_read (is->files[i].bf, 0, 0, sizeof(ISAMD_head),
133 is->files[i].head.lastblock = 1;
134 is->files[i].head.freelist = 0;
136 is->files[i].alloc_entries_num = 0;
137 is->files[i].alloc_entries_max =
138 is->method->filecat[i].bsize / sizeof(int) - 1;
139 is->files[i].alloc_buf = (char *)
140 xmalloc (is->method->filecat[i].bsize);
141 is->files[i].no_writes = 0; /* clear statistics */
142 is->files[i].no_reads = 0;
143 is->files[i].no_skip_writes = 0;
144 is->files[i].no_allocated = 0;
145 is->files[i].no_released = 0;
146 is->files[i].no_remap = 0;
147 is->files[i].no_forward = 0;
148 is->files[i].no_backward = 0;
149 is->files[i].sum_forward = 0;
150 is->files[i].sum_backward = 0;
151 is->files[i].no_next = 0;
152 is->files[i].no_prev = 0;
153 is->files[i].no_op_diffonly=0;
154 is->files[i].no_op_main=0;
181 int isamd_block_used (ISAMD is, int type)
183 if ( type==-1) /* singleton */
185 if (type < 0 || type >= is->no_files)
187 return is->files[type].head.lastblock-1;
190 int isamd_block_size (ISAMD is, int type)
192 ISAMD_filecat filecat = is->method->filecat;
193 if ( type==-1) /* singleton */
194 return 0; /* no bytes used */
195 if (type < 0 || type >= is->no_files)
197 return filecat[type].bsize;
200 int isamd_close (ISAMD is)
205 if (is->method->debug>0)
207 logf (LOG_LOG, "isamd statistics");
208 logf (LOG_LOG, "f nxt forw mid-f prev backw mid-b");
209 for (i = 0; i<is->no_files; i++)
210 logf (LOG_LOG, "%d%7d%7d%7.1f%7d%7d%7.1f",i,
211 is->files[i].no_next,
212 is->files[i].no_forward,
213 is->files[i].no_forward ?
214 (double) is->files[i].sum_forward/is->files[i].no_forward
216 is->files[i].no_prev,
217 is->files[i].no_backward,
218 is->files[i].no_backward ?
219 (double) is->files[i].sum_backward/is->files[i].no_backward
222 if (is->method->debug>0)
223 logf (LOG_LOG, "f writes reads skipped alloc released ");
224 for (i = 0; i<is->no_files; i++)
227 assert (is->files[i].bf);
228 if (is->files[i].head_is_dirty)
229 bf_write (is->files[i].bf, 0, 0, sizeof(ISAMD_head),
231 if (is->method->debug>0)
232 logf (LOG_LOG, "%d%8d%8d%8d%8d%8d",i,
233 is->files[i].no_writes,
234 is->files[i].no_reads,
235 is->files[i].no_skip_writes,
236 is->files[i].no_allocated,
237 is->files[i].no_released);
238 xfree (is->files[i].fc_list);
240 bf_close (is->files[i].bf);
243 if (is->method->debug>0)
245 logf (LOG_LOG, "f opens main diffonly");
246 for (i = 0; i<is->no_files; i++)
248 logf (LOG_LOG, "%d%8d%8d%8d",i,
249 is->files[i].no_op_main+
250 is->files[i].no_op_diffonly,
251 is->files[i].no_op_main,
252 is->files[i].no_op_diffonly);
254 logf(LOG_LOG,"open single %8d", is->no_op_single);
255 logf(LOG_LOG,"open new %8d", is->no_op_new);
257 logf(LOG_LOG, "new build %8d", is->no_fbuilds);
258 logf(LOG_LOG, "append %8d", is->no_appds);
259 logf(LOG_LOG, " merges %8d", is->no_merges);
260 logf(LOG_LOG, " singles %8d", is->no_singles);
261 logf(LOG_LOG, " no-ops %8d", is->no_non);
263 logf(LOG_LOG, "read blocks %8d", is->no_read);
264 logf(LOG_LOG, "read keys: %8d %8.1f k/bl",
266 1.0*(is->no_read_keys+1)/(is->no_read+1) );
267 logf(LOG_LOG, "read main-k %8d %8.1f %% of keys",
269 100.0*(is->no_read_main+1)/(is->no_read_keys+1) );
270 logf(LOG_LOG, "read ends: %8d %8.1f k/e",
272 1.0*(is->no_read_keys+1)/(is->no_read_eof+1) );
273 s= is->no_seek_nxt+ is->no_seek_sam+ is->no_seek_fwd +
274 is->no_seek_prv+ is->no_seek_bak+ is->no_seek_cat;
277 logf(LOG_LOG, "seek same %8d %8.1f%%",
278 is->no_seek_sam, 100.0*is->no_seek_sam/s );
279 logf(LOG_LOG, "seek next %8d %8.1f%%",
280 is->no_seek_nxt, 100.0*is->no_seek_nxt/s );
281 logf(LOG_LOG, "seek prev %8d %8.1f%%",
282 is->no_seek_prv, 100.0*is->no_seek_prv/s );
283 logf(LOG_LOG, "seek forw %8d %8.1f%%",
284 is->no_seek_fwd, 100.0*is->no_seek_fwd/s );
285 logf(LOG_LOG, "seek back %8d %8.1f%%",
286 is->no_seek_bak, 100.0*is->no_seek_bak/s );
287 logf(LOG_LOG, "seek cat %8d %8.1f%%",
288 is->no_seek_cat, 100.0*is->no_seek_cat/s );
296 static void isamd_seek_stat(ISAMD is, int cat, int pos)
298 if (cat != is->last_cat)
300 else if ( pos == is->last_pos)
302 else if ( pos == is->last_pos+1)
304 else if ( pos == is->last_pos-1)
306 else if ( pos > is->last_pos)
308 else if ( pos < is->last_pos)
314 int isamd_read_block (ISAMD is, int cat, int pos, char *dst)
316 isamd_seek_stat(is,cat,pos);
317 ++(is->files[cat].no_reads);
319 if (is->method->debug > 6)
320 logf (LOG_LOG, "isamd: read_block %d:%d",cat, pos);
321 return bf_read (is->files[cat].bf, pos, 0, 0, dst);
324 int isamd_write_block (ISAMD is, int cat, int pos, char *src)
326 isamd_seek_stat(is,cat,pos);
327 ++(is->files[cat].no_writes);
329 if (is->method->debug > 6)
330 logf (LOG_LOG, "isamd: write_block %d:%d", cat, pos);
331 return bf_write (is->files[cat].bf, pos, 0, 0, src);
334 int isamd_write_dblock (ISAMD is, int cat, int pos, char *src,
335 int nextpos, int offset)
337 ISAMD_BLOCK_SIZE size = offset + ISAMD_BLOCK_OFFSET_N;
338 if (is->method->debug > 4)
339 logf (LOG_LOG, "isamd: write_dblock. size=%d nextpos=%d",
340 (int) size, nextpos);
341 src -= ISAMD_BLOCK_OFFSET_N;
342 assert( ISAMD_BLOCK_OFFSET_N == sizeof(int)+sizeof(int) );
343 memcpy (src, &nextpos, sizeof(int));
344 memcpy (src + sizeof(int), &size, sizeof(size));
345 return isamd_write_block (is, cat, pos, src);
348 #if ISAMD_FREELIST_CHUNK
349 static void flush_block (ISAMD is, int cat)
351 char *abuf = is->files[cat].alloc_buf;
352 int block = is->files[cat].head.freelist;
353 if (block && is->files[cat].alloc_entries_num)
355 memcpy (abuf, &is->files[cat].alloc_entries_num, sizeof(int));
356 bf_write (is->files[cat].bf, block, 0, 0, abuf);
357 is->files[cat].alloc_entries_num = 0;
362 static int alloc_block (ISAMD is, int cat)
364 int block = is->files[cat].head.freelist;
365 char *abuf = is->files[cat].alloc_buf;
367 (is->files[cat].no_allocated)++;
371 block = (is->files[cat].head.lastblock)++; /* no free list */
372 is->files[cat].head_is_dirty = 1;
376 if (!is->files[cat].alloc_entries_num) /* read first time */
378 bf_read (is->files[cat].bf, block, 0, 0, abuf);
379 memcpy (&is->files[cat].alloc_entries_num, abuf,
380 sizeof(is->files[cat].alloc_entries_num));
381 assert (is->files[cat].alloc_entries_num > 0);
383 /* have some free blocks now */
384 assert (is->files[cat].alloc_entries_num > 0);
385 is->files[cat].alloc_entries_num--;
386 if (!is->files[cat].alloc_entries_num) /* last one in block? */
388 memcpy (&is->files[cat].head.freelist, abuf + sizeof(int),
390 is->files[cat].head_is_dirty = 1;
392 if (is->files[cat].head.freelist)
394 bf_read (is->files[cat].bf, is->files[cat].head.freelist,
396 memcpy (&is->files[cat].alloc_entries_num, abuf,
397 sizeof(is->files[cat].alloc_entries_num));
398 assert (is->files[cat].alloc_entries_num);
402 memcpy (&block, abuf + sizeof(int) + sizeof(int) *
403 is->files[cat].alloc_entries_num, sizeof(int));
408 static void release_block (ISAMD is, int cat, int pos)
410 char *abuf = is->files[cat].alloc_buf;
411 int block = is->files[cat].head.freelist;
413 (is->files[cat].no_released)++;
415 if (block && !is->files[cat].alloc_entries_num) /* must read block */
417 bf_read (is->files[cat].bf, block, 0, 0, abuf);
418 memcpy (&is->files[cat].alloc_entries_num, abuf,
419 sizeof(is->files[cat].alloc_entries_num));
420 assert (is->files[cat].alloc_entries_num > 0);
422 assert (is->files[cat].alloc_entries_num <= is->files[cat].alloc_entries_max);
423 if (is->files[cat].alloc_entries_num == is->files[cat].alloc_entries_max)
426 memcpy (abuf, &is->files[cat].alloc_entries_num, sizeof(int));
427 bf_write (is->files[cat].bf, block, 0, 0, abuf);
428 is->files[cat].alloc_entries_num = 0;
430 if (!is->files[cat].alloc_entries_num) /* make new buffer? */
432 memcpy (abuf + sizeof(int), &block, sizeof(int));
433 is->files[cat].head.freelist = pos;
434 is->files[cat].head_is_dirty = 1;
438 memcpy (abuf + sizeof(int) +
439 is->files[cat].alloc_entries_num*sizeof(int),
442 is->files[cat].alloc_entries_num++;
445 static void flush_block (ISAMD is, int cat)
447 char *abuf = is->files[cat].alloc_buf;
451 static int alloc_block (ISAMD is, int cat)
454 char buf[sizeof(int)];
456 is->files[cat].head_is_dirty = 1;
457 (is->files[cat].no_allocated)++;
458 if ((block = is->files[cat].head.freelist))
460 bf_read (is->files[cat].bf, block, 0, sizeof(int), buf);
461 memcpy (&is->files[cat].head.freelist, buf, sizeof(int));
464 block = (is->files[cat].head.lastblock)++;
468 static void release_block (ISAMD is, int cat, int pos)
470 char buf[sizeof(int)];
472 (is->files[cat].no_released)++;
473 is->files[cat].head_is_dirty = 1;
474 memcpy (buf, &is->files[cat].head.freelist, sizeof(int));
475 is->files[cat].head.freelist = pos;
476 bf_write (is->files[cat].bf, pos, 0, sizeof(int), buf);
480 int isamd_alloc_block (ISAMD is, int cat)
484 if (is->files[cat].fc_list)
487 for (j = 0; j < is->files[cat].fc_max; j++)
488 if ((nb = is->files[cat].fc_list[j]) && (!block || nb < block))
490 is->files[cat].fc_list[j] = 0;
496 block = alloc_block (is, cat);
497 if (is->method->debug > 4)
498 logf (LOG_LOG, "isamd: alloc_block in cat %d: %d", cat, block);
502 void isamd_release_block (ISAMD is, int cat, int pos)
504 if (is->method->debug > 4)
505 logf (LOG_LOG, "isamd: release_block in cat %d: %d", cat, pos);
508 if (is->files[cat].fc_list)
511 for (j = 0; j<is->files[cat].fc_max; j++)
512 if (!is->files[cat].fc_list[j])
514 is->files[cat].fc_list[j] = pos;
518 release_block (is, cat, pos);
521 static void init_fc (ISAMD is, int cat)
525 is->files[cat].fc_max = j;
526 is->files[cat].fc_list = (int *)
527 xmalloc (sizeof(*is->files[0].fc_list) * j);
529 is->files[cat].fc_list[j] = 0;
532 static void release_fc (ISAMD is, int cat)
534 int b, j = is->files[cat].fc_max;
537 if ((b = is->files[cat].fc_list[j]))
539 release_block (is, cat, b);
540 is->files[cat].fc_list[j] = 0;
544 void isamd_pp_close (ISAMD_PP pp)
548 (*is->method->code_stop)(ISAMD_DECODE, pp->decodeClientData);
549 isamd_free_diffs(pp); /* see merge-d.h */
550 if (is->method->debug > 5)
551 logf (LOG_LOG, "isamd_pp_close %p %d=%d:%d sz=%d n=%d=%d:%d nk=%d",
552 pp, isamd_addr(pp->pos, pp->cat), pp->cat, pp->pos, pp->size,
553 pp->next, isamd_type(pp->next), isamd_block(pp->next),
560 ISAMD_PP isamd_pp_create (ISAMD is, int cat)
561 /* creates a pp_buff without data in it. pos=0, cat as given */
563 ISAMD_PP pp = (ISAMD_PP) xmalloc (sizeof(*pp));
564 int sz = is->method->filecat[is->max_cat].bsize;
567 pp->buf = (char *) xmalloc (sz);
568 memset(pp->buf,'\0',sz); /* clear the buffer, for new blocks */
577 pp->decodeClientData = (*is->method->code_start)(ISAMD_DECODE);
586 ISAMD_PP isamd_pp_open (ISAMD is, const char *dictbuf, int dictlen)
589 ISAMD_PP pp = (ISAMD_PP) xmalloc (sizeof(*pp));
591 int sz = is->method->filecat[is->max_cat].bsize;
592 /* always allocate for the largest blocks, saves trouble */
593 struct it_key singlekey;
594 char *c_ptr; /* for fake encoding the singlekey */
600 src = pp->buf = (char *) xmalloc (sz);
601 memset(src,'\0',sz); /* clear the buffer, for new blocks */
610 pp->decodeClientData = (*is->method->code_start)(ISAMD_DECODE);
612 dictnum=*dictbuf; // numkeys for internals, 0 for externals
616 memcpy(&ipos, dictbuf+1, sizeof(ISAMD_P) );
618 else /* dictionary block, fake a real one */
622 if (is->method->debug > 5)
623 logf (LOG_LOG, "isamd_pp_open dict");
624 pp->numKeys=(unsigned char) dictbuf[0];
625 memcpy(pp->buf+ISAMD_BLOCK_OFFSET_1, dictbuf+1,dictlen-1);
626 pp->size=pp->offset=dictlen+ISAMD_BLOCK_OFFSET_1-1;
631 pp->cat = isamd_type(ipos);
632 pp->pos = isamd_block(ipos);
640 isamd_read_block (is, pp->cat, pp->pos, src);
641 memcpy (&pp->next, src, sizeof(pp->next));
642 src += sizeof(pp->next);
643 memcpy (&pp->size, src, sizeof(pp->size));
644 src += sizeof(pp->size);
645 memcpy (&pp->numKeys, src, sizeof(pp->numKeys));
646 src += sizeof(pp->numKeys);
647 assert (pp->next != isamd_addr(pp->pos,pp->cat));
648 pp->offset = src - pp->buf;
649 assert (pp->offset == ISAMD_BLOCK_OFFSET_1);
650 assert(pp->size>=ISAMD_BLOCK_OFFSET_1); /*??*/
652 is->files[pp->cat].no_op_main++;
654 is->files[pp->cat].no_op_diffonly++;
656 if (is->method->debug > 5)
657 logf (LOG_LOG, "isamd_pp_open %p %d=%d:%d sz=%d n=%d=%d:%d",
658 pp, isamd_addr(pp->pos, pp->cat), pp->cat, pp->pos, pp->size,
659 pp->next, isamd_type(pp->next), isamd_block(pp->next) );
666 void isamd_buildfirstblock(ISAMD_PP pp){
669 assert(pp->next != isamd_addr(pp->pos,pp->cat));
670 memcpy(dst, &pp->next, sizeof(pp->next) );
671 dst += sizeof(pp->next);
672 memcpy(dst, &pp->size,sizeof(pp->size));
673 dst += sizeof(pp->size);
674 memcpy(dst, &pp->numKeys, sizeof(pp->numKeys));
675 dst += sizeof(pp->numKeys);
676 assert (dst - pp->buf == ISAMD_BLOCK_OFFSET_1);
677 if (pp->is->method->debug > 5)
678 logf (LOG_LOG, "isamd: bldfirst: p=%d=%d:%d n=%d:%d:%d sz=%d nk=%d ",
679 isamd_addr(pp->pos,pp->cat),pp->cat, pp->pos,
680 pp->next, isamd_type(pp->next), isamd_block(pp->next),
681 pp->size, pp->numKeys);
684 void isamd_buildlaterblock(ISAMD_PP pp){
687 assert(pp->next != isamd_addr(pp->pos,pp->cat));
688 memcpy(dst, &pp->next, sizeof(pp->next) );
689 dst += sizeof(pp->next);
690 memcpy(dst, &pp->size,sizeof(pp->size));
691 dst += sizeof(pp->size);
692 assert (dst - pp->buf == ISAMD_BLOCK_OFFSET_N);
693 if (pp->is->method->debug > 5)
694 logf (LOG_LOG, "isamd: l8r: sz=%d p=%d/%d>%d/%d",
697 isamd_block(pp->next), isamd_type(pp->next) );
702 /* returns non-zero if item could be read; 0 otherwise */
703 int isamd_pp_read (ISAMD_PP pp, void *buf)
706 return isamd_read_item (pp, (char **) &buf);
707 /* note: isamd_read_item is in merge-d.c, because it is so */
708 /* convoluted with the merge process */
711 /* read one main item from file - decode and store it in *dst.
712 Does not worry about diffs
715 1 if item could be read ok
717 int isamd_read_main_item (ISAMD_PP pp, char **dst)
720 char *src = pp->buf + pp->offset;
724 if (pp->offset >= pp->size)
729 return 0; /* end of file */
731 if (pp->next > pp->pos)
733 if (pp->next == pp->pos + 1)
734 is->files[pp->cat].no_next++;
737 is->files[pp->cat].no_forward++;
738 is->files[pp->cat].sum_forward += pp->next - pp->pos;
743 if (pp->next + 1 == pp->pos)
744 is->files[pp->cat].no_prev++;
747 is->files[pp->cat].no_backward++;
748 is->files[pp->cat].sum_backward += pp->pos - pp->next;
751 /* out new block position */
752 newcat = isamd_type(pp->next);
753 pp->pos = isamd_block(pp->next);
754 pp->cat = isamd_type(pp->next);
755 pp->is->no_read_main++;
757 /* read block and save 'next' and 'size' entry */
758 isamd_read_block (is, pp->cat, pp->pos, src);
759 memcpy (&pp->next, src, sizeof(pp->next));
760 src += sizeof(pp->next);
761 memcpy (&pp->size, src, sizeof(pp->size));
762 src += sizeof(pp->size);
763 /* assume block is non-empty */
764 pp->offset = oldoffs = src - pp->buf;
765 assert (pp->offset == ISAMD_BLOCK_OFFSET_N);
766 assert (pp->next != isamd_addr(pp->pos,pp->cat));
767 (*is->method->code_reset)(pp->decodeClientData);
768 /* finally, read the item */
769 (*is->method->code_item)(ISAMD_DECODE, pp->decodeClientData, dst, &src);
770 pp->offset = src - pp->buf;
771 if (is->method->debug > 8)
772 logf (LOG_LOG, "isamd: read_m: block %d:%d sz=%d ofs=%d-%d next=%d",
773 pp->cat, pp->pos, pp->size, oldoffs, pp->offset, pp->next);
777 (*is->method->code_item)(ISAMD_DECODE, pp->decodeClientData, dst, &src);
778 pp->offset = src - pp->buf;
779 if (is->method->debug > 8)
780 logf (LOG_LOG, "isamd: read_m: got %d:%d sz=%d ofs=%d-%d next=%d",
781 pp->cat, pp->pos, pp->size, oldoffs, pp->offset, pp->next);
785 int isamd_pp_num (ISAMD_PP pp)
790 static char *hexdump(unsigned char *p, int len, char *buff) {
791 static char localbuff[128];
793 if (!buff) buff=localbuff;
796 sprintf(bytebuff,"%02x",*p);
798 strcat(buff,bytebuff);
799 if (len) strcat(buff," ");
806 /* needs different arguments, or something */
807 void isamd_pp_dump (ISAMD is, ISAMD_P ipos)
818 int olddebug= is->method->debug;
819 is->method->debug=0; /* no debug logs while reading for dump */
821 logf(LOG_LOG,"dumping isamd block %d (%d:%d)",
822 (int)ipos, isamd_type(ipos), isamd_block(ipos) );
823 pp=isamd_pp_open(is,ipos);
824 logf(LOG_LOG,"numKeys=%d, ofs=%d sz=%d",
825 pp->numKeys, pp->offset, pp->size );
826 diffidx=oldoffs= pp->offset;
827 while ((diffidx < is->method->filecat[pp->cat].bsize) && (diffmax>0))
829 memcpy(&diffmax,&(pp->buf[diffidx]),sizeof(int));
830 logf (LOG_LOG,"diff set at %d-%d: %s", diffidx, diffmax,
831 hexdump(pp->buf+diffidx,8,0));
832 /*! todo: dump the actual diffs as well !!! */
836 while(isamd_pp_read(pp, &key))
838 if (oldaddr != isamd_addr(pp->pos,pp->cat) )
840 oldaddr = isamd_addr(pp->pos,pp->cat);
841 logf(LOG_LOG,"block %d=%d:%d sz=%d nx=%d=%d:%d ofs=%d",
842 isamd_addr(pp->pos,pp->cat), pp->cat, pp->pos,
844 pp->next, isamd_type(pp->next), isamd_block(pp->next),
850 logf(LOG_LOG," %05x: %s",i,hexdump(pp->buf+i,n,hexbuff));
853 if (oldoffs > ISAMD_BLOCK_OFFSET_N)
854 oldoffs=ISAMD_BLOCK_OFFSET_N;
857 logf (LOG_LOG," got %d:%d=%x:%x from %s at %d=%x",
858 key.sysno, key.seqno,
859 key.sysno, key.seqno,
860 hexdump(pp->buf+oldoffs, pp->offset-oldoffs, hexbuff),
862 oldoffs = pp->offset;
864 /*!*/ /*TODO: dump diffs too!!! */
866 is->method->debug=olddebug;
873 * Revision 1.22 2002-07-12 18:12:21 heikki
874 * Isam-D now stores small entries directly in the dictionary.
875 * Needs more tuning and cleaning...
877 * Revision 1.21 2002/07/11 16:16:00 heikki
878 * Fixed a bug in isamd, failed to store a single key when its bits
879 * did not fit into a singleton.
881 * Revision 1.20 2002/06/19 10:29:18 adam
882 * align block sizes for isam sys. Better plot for test
884 * Revision 1.19 1999/11/30 13:48:04 adam
885 * Improved installation. Updated for inclusion of YAZ header files.
887 * Revision 1.18 1999/10/06 15:18:13 heikki
889 * Improving block sizes again
891 * Revision 1.17 1999/10/06 11:46:36 heikki
892 * mproved statistics on isam-d
894 * Revision 1.16 1999/10/05 09:57:40 heikki
895 * Tuning the isam-d (and fixed a small "detail")
897 * Revision 1.15 1999/09/27 14:36:36 heikki
900 * Revision 1.14 1999/09/23 18:01:18 heikki
901 * singleton optimising
903 * Revision 1.13 1999/09/20 15:48:06 heikki
906 * Revision 1.12 1999/09/13 13:28:28 heikki
907 * isam-d optimizing: merging input data in the same go
909 * Revision 1.11 1999/08/25 18:09:24 heikki
910 * Starting to optimize
912 * Revision 1.10 1999/08/24 13:17:42 heikki
913 * Block sizes, comments
915 * Revision 1.9 1999/08/20 12:25:58 heikki
916 * Statistics in isamd
918 * Revision 1.8 1999/08/18 13:28:16 heikki
919 * Set log levels to decent values
921 * Revision 1.6 1999/08/17 19:44:25 heikki
924 * Revision 1.4 1999/08/04 14:21:18 heikki
925 * isam-d seems to be working.
927 * Revision 1.3 1999/07/21 14:24:50 heikki
928 * isamd write and read functions ok, except when diff block full.
929 * (merge not yet done)
931 * Revision 1.1 1999/07/14 12:34:43 heikki
932 * Copied from isamh, starting to change things...