2 * Copyright (c) 1995-1998, Index Data.
3 * See the file LICENSE for details.
4 * $Id: isamd.c,v 1.19 1999-11-30 13:48:04 adam 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 */
552 if (is->method->debug > 5)
553 logf (LOG_LOG, "isamd_pp_close %p %d=%d:%d sz=%d n=%d=%d:%d",
554 pp, isamd_addr(pp->pos, pp->cat), pp->cat, pp->pos, pp->size,
555 pp->next, isamd_type(pp->next), isamd_block(pp->next) );
560 ISAMD_PP isamd_pp_open (ISAMD is, ISAMD_P ipos)
562 ISAMD_PP pp = (ISAMD_PP) xmalloc (sizeof(*pp));
564 int sz = is->method->filecat[is->max_cat].bsize;
565 /* always allocate for the largest blocks, saves trouble */
566 struct it_key singlekey;
567 char *c_ptr; /* for fake encoding the singlekey */
572 src = pp->buf = (char *) xmalloc (sz);
573 memset(src,'\0',sz); /* clear the buffer, for new blocks */
582 pp->decodeClientData = (*is->method->code_start)(ISAMD_DECODE);
584 if ( is_singleton(ipos) )
588 if (is->method->debug > 5)
589 logf (LOG_LOG, "isamd_pp_open %p %d=%d:%d sz=%d n=%d=%d:%d",
590 pp, isamd_addr(pp->pos, pp->cat), pp->cat, pp->pos, pp->size,
591 pp->next, isamd_type(pp->next), isamd_block(pp->next) );
592 singleton_decode(ipos, &singlekey );
593 pp->offset=ISAMD_BLOCK_OFFSET_1;
595 ofs=pp->offset+sizeof(int); /* reserve length of diffsegment */
596 singlekey.seqno = singlekey.seqno * 2 + 1; /* make an insert diff */
597 c_ptr=&(pp->buf[ofs]);
598 i_ptr=(char*)(&singlekey);
599 (*is->method->code_item)(ISAMD_ENCODE, pp->decodeClientData,
601 (*is->method->code_reset)(pp->decodeClientData);
602 ofs += c_ptr-&(pp->buf[ofs]);
603 memcpy( &(pp->buf[pp->offset]), &ofs, sizeof(int) );
604 /* since we memset buf earlier, we already have a zero endmark! */
606 if (is->method->debug > 5)
607 logf (LOG_LOG, "isamd_pp_open single %d=%x: %d.%d sz=%d",
609 singlekey.sysno, singlekey.seqno/2,
615 pp->cat = isamd_type(ipos);
616 pp->pos = isamd_block(ipos);
624 isamd_read_block (is, pp->cat, pp->pos, src);
625 memcpy (&pp->next, src, sizeof(pp->next));
626 src += sizeof(pp->next);
627 memcpy (&pp->size, src, sizeof(pp->size));
628 src += sizeof(pp->size);
629 memcpy (&pp->numKeys, src, sizeof(pp->numKeys));
630 src += sizeof(pp->numKeys);
631 assert (pp->next != isamd_addr(pp->pos,pp->cat));
632 pp->offset = src - pp->buf;
633 assert (pp->offset == ISAMD_BLOCK_OFFSET_1);
634 assert(pp->size>=ISAMD_BLOCK_OFFSET_1); /*??*/
636 is->files[pp->cat].no_op_main++;
638 is->files[pp->cat].no_op_diffonly++;
640 if (is->method->debug > 5)
641 logf (LOG_LOG, "isamd_pp_open %p %d=%d:%d sz=%d n=%d=%d:%d",
642 pp, isamd_addr(pp->pos, pp->cat), pp->cat, pp->pos, pp->size,
643 pp->next, isamd_type(pp->next), isamd_block(pp->next) );
650 void isamd_buildfirstblock(ISAMD_PP pp){
653 assert(pp->next != isamd_addr(pp->pos,pp->cat));
654 memcpy(dst, &pp->next, sizeof(pp->next) );
655 dst += sizeof(pp->next);
656 memcpy(dst, &pp->size,sizeof(pp->size));
657 dst += sizeof(pp->size);
658 memcpy(dst, &pp->numKeys, sizeof(pp->numKeys));
659 dst += sizeof(pp->numKeys);
660 assert (dst - pp->buf == ISAMD_BLOCK_OFFSET_1);
661 if (pp->is->method->debug > 5)
662 logf (LOG_LOG, "isamd: bldfirst: p=%d=%d:%d n=%d:%d:%d sz=%d nk=%d ",
663 isamd_addr(pp->pos,pp->cat),pp->cat, pp->pos,
664 pp->next, isamd_type(pp->next), isamd_block(pp->next),
665 pp->size, pp->numKeys);
668 void isamd_buildlaterblock(ISAMD_PP pp){
671 assert(pp->next != isamd_addr(pp->pos,pp->cat));
672 memcpy(dst, &pp->next, sizeof(pp->next) );
673 dst += sizeof(pp->next);
674 memcpy(dst, &pp->size,sizeof(pp->size));
675 dst += sizeof(pp->size);
676 assert (dst - pp->buf == ISAMD_BLOCK_OFFSET_N);
677 if (pp->is->method->debug > 5)
678 logf (LOG_LOG, "isamd: l8r: sz=%d p=%d/%d>%d/%d",
681 isamd_block(pp->next), isamd_type(pp->next) );
686 /* returns non-zero if item could be read; 0 otherwise */
687 int isamd_pp_read (ISAMD_PP pp, void *buf)
690 return isamd_read_item (pp, (char **) &buf);
691 /* note: isamd_read_item is in merge-d.c, because it is so */
692 /* convoluted with the merge process */
695 /* read one main item from file - decode and store it in *dst.
696 Does not worry about diffs
699 1 if item could be read ok
701 int isamd_read_main_item (ISAMD_PP pp, char **dst)
704 char *src = pp->buf + pp->offset;
708 if (pp->offset >= pp->size)
713 return 0; /* end of file */
715 if (pp->next > pp->pos)
717 if (pp->next == pp->pos + 1)
718 is->files[pp->cat].no_next++;
721 is->files[pp->cat].no_forward++;
722 is->files[pp->cat].sum_forward += pp->next - pp->pos;
727 if (pp->next + 1 == pp->pos)
728 is->files[pp->cat].no_prev++;
731 is->files[pp->cat].no_backward++;
732 is->files[pp->cat].sum_backward += pp->pos - pp->next;
735 /* out new block position */
736 newcat = isamd_type(pp->next);
737 pp->pos = isamd_block(pp->next);
738 pp->cat = isamd_type(pp->next);
739 pp->is->no_read_main++;
741 /* read block and save 'next' and 'size' entry */
742 isamd_read_block (is, pp->cat, pp->pos, src);
743 memcpy (&pp->next, src, sizeof(pp->next));
744 src += sizeof(pp->next);
745 memcpy (&pp->size, src, sizeof(pp->size));
746 src += sizeof(pp->size);
747 /* assume block is non-empty */
748 pp->offset = oldoffs = src - pp->buf;
749 assert (pp->offset == ISAMD_BLOCK_OFFSET_N);
750 assert (pp->next != isamd_addr(pp->pos,pp->cat));
751 (*is->method->code_reset)(pp->decodeClientData);
752 /* finally, read the item */
753 (*is->method->code_item)(ISAMD_DECODE, pp->decodeClientData, dst, &src);
754 pp->offset = src - pp->buf;
755 if (is->method->debug > 8)
756 logf (LOG_LOG, "isamd: read_m: block %d:%d sz=%d ofs=%d-%d next=%d",
757 pp->cat, pp->pos, pp->size, oldoffs, pp->offset, pp->next);
761 (*is->method->code_item)(ISAMD_DECODE, pp->decodeClientData, dst, &src);
762 pp->offset = src - pp->buf;
763 if (is->method->debug > 8)
764 logf (LOG_LOG, "isamd: read_m: got %d:%d sz=%d ofs=%d-%d next=%d",
765 pp->cat, pp->pos, pp->size, oldoffs, pp->offset, pp->next);
769 int isamd_pp_num (ISAMD_PP pp)
774 static char *hexdump(unsigned char *p, int len, char *buff) {
775 static char localbuff[128];
777 if (!buff) buff=localbuff;
780 sprintf(bytebuff,"%02x",*p);
782 strcat(buff,bytebuff);
783 if (len) strcat(buff," ");
789 void isamd_pp_dump (ISAMD is, ISAMD_P ipos)
800 int olddebug= is->method->debug;
801 is->method->debug=0; /* no debug logs while reading for dump */
803 logf(LOG_LOG,"dumping isamd block %d (%d:%d)",
804 (int)ipos, isamd_type(ipos), isamd_block(ipos) );
805 pp=isamd_pp_open(is,ipos);
806 logf(LOG_LOG,"numKeys=%d, ofs=%d sz=%d",
807 pp->numKeys, pp->offset, pp->size );
808 diffidx=oldoffs= pp->offset;
809 while ((diffidx < is->method->filecat[pp->cat].bsize) && (diffmax>0))
811 memcpy(&diffmax,&(pp->buf[diffidx]),sizeof(int));
812 logf (LOG_LOG,"diff set at %d-%d: %s", diffidx, diffmax,
813 hexdump(pp->buf+diffidx,8,0));
814 /*! todo: dump the actual diffs as well !!! */
818 while(isamd_pp_read(pp, &key))
820 if (oldaddr != isamd_addr(pp->pos,pp->cat) )
822 oldaddr = isamd_addr(pp->pos,pp->cat);
823 logf(LOG_LOG,"block %d=%d:%d sz=%d nx=%d=%d:%d ofs=%d",
824 isamd_addr(pp->pos,pp->cat), pp->cat, pp->pos,
826 pp->next, isamd_type(pp->next), isamd_block(pp->next),
832 logf(LOG_LOG," %05x: %s",i,hexdump(pp->buf+i,n,hexbuff));
835 if (oldoffs > ISAMD_BLOCK_OFFSET_N)
836 oldoffs=ISAMD_BLOCK_OFFSET_N;
839 logf (LOG_LOG," got %d:%d=%x:%x from %s at %d=%x",
840 key.sysno, key.seqno,
841 key.sysno, key.seqno,
842 hexdump(pp->buf+oldoffs, pp->offset-oldoffs, hexbuff),
844 oldoffs = pp->offset;
846 /*!*/ /*TODO: dump diffs too!!! */
848 is->method->debug=olddebug;
853 * Revision 1.19 1999-11-30 13:48:04 adam
854 * Improved installation. Updated for inclusion of YAZ header files.
856 * Revision 1.18 1999/10/06 15:18:13 heikki
858 * Improving block sizes again
860 * Revision 1.17 1999/10/06 11:46:36 heikki
861 * mproved statistics on isam-d
863 * Revision 1.16 1999/10/05 09:57:40 heikki
864 * Tuning the isam-d (and fixed a small "detail")
866 * Revision 1.15 1999/09/27 14:36:36 heikki
869 * Revision 1.14 1999/09/23 18:01:18 heikki
870 * singleton optimising
872 * Revision 1.13 1999/09/20 15:48:06 heikki
875 * Revision 1.12 1999/09/13 13:28:28 heikki
876 * isam-d optimizing: merging input data in the same go
878 * Revision 1.11 1999/08/25 18:09:24 heikki
879 * Starting to optimize
881 * Revision 1.10 1999/08/24 13:17:42 heikki
882 * Block sizes, comments
884 * Revision 1.9 1999/08/20 12:25:58 heikki
885 * Statistics in isamd
887 * Revision 1.8 1999/08/18 13:28:16 heikki
888 * Set log levels to decent values
890 * Revision 1.6 1999/08/17 19:44:25 heikki
893 * Revision 1.4 1999/08/04 14:21:18 heikki
894 * isam-d seems to be working.
896 * Revision 1.3 1999/07/21 14:24:50 heikki
897 * isamd write and read functions ok, except when diff block full.
898 * (merge not yet done)
900 * Revision 1.1 1999/07/14 12:34:43 heikki
901 * Copied from isamh, starting to change things...