2 * Copyright (c) 1995-1998, Index Data.
3 * See the file LICENSE for details.
4 * $Id: isamd.c,v 1.17 1999-10-06 11:46:36 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! */
61 { 24, 1 }, /* Experimental sizes */
72 ISAMD_M m = (ISAMD_M) xmalloc (sizeof(*m)); /* never released! */
73 m->filecat = def_cat; /* ok, only alloc'd once */
80 m->compare_item = NULL;
82 m->debug = 0; /* default to no debug */
84 m->max_blocks_mem = 10;
91 ISAMD isamd_open (BFiles bfs, const char *name, int writeflag, ISAMD_M method)
94 ISAMD_filecat filecat;
97 is = (ISAMD) xmalloc (sizeof(*is));
99 is->method = (ISAMD_M) xmalloc (sizeof(*is->method));
100 memcpy (is->method, method, sizeof(*method));
101 filecat = is->method->filecat;
104 /* determine number of block categories */
105 if (is->method->debug>0)
106 logf (LOG_LOG, "isamd: bsize maxkeys");
109 if (is->method->debug>0)
110 logf (LOG_LOG, "isamd:%6d %6d",
111 filecat[i].bsize, filecat[i].mblocks);
112 } while (filecat[i++].mblocks);
116 assert (is->no_files > 0);
117 assert (is->max_cat <=8 ); /* we have only 3 bits for it */
119 is->files = (ISAMD_file) xmalloc (sizeof(*is->files)*is->no_files);
121 for (i = 0; i<is->no_files; i++)
125 sprintf (fname, "%s%c", name, i+'A');
126 is->files[i].bf = bf_open (bfs, fname, is->method->filecat[i].bsize,
128 is->files[i].head_is_dirty = 0;
129 if (!bf_read (is->files[i].bf, 0, 0, sizeof(ISAMD_head),
132 is->files[i].head.lastblock = 1;
133 is->files[i].head.freelist = 0;
135 is->files[i].alloc_entries_num = 0;
136 is->files[i].alloc_entries_max =
137 is->method->filecat[i].bsize / sizeof(int) - 1;
138 is->files[i].alloc_buf = (char *)
139 xmalloc (is->method->filecat[i].bsize);
140 is->files[i].no_writes = 0; /* clear statistics */
141 is->files[i].no_reads = 0;
142 is->files[i].no_skip_writes = 0;
143 is->files[i].no_allocated = 0;
144 is->files[i].no_released = 0;
145 is->files[i].no_remap = 0;
146 is->files[i].no_forward = 0;
147 is->files[i].no_backward = 0;
148 is->files[i].sum_forward = 0;
149 is->files[i].sum_backward = 0;
150 is->files[i].no_next = 0;
151 is->files[i].no_prev = 0;
152 is->files[i].no_op_diffonly=0;
153 is->files[i].no_op_main=0;
180 int isamd_block_used (ISAMD is, int type)
182 if ( type==-1) /* singleton */
184 if (type < 0 || type >= is->no_files)
186 return is->files[type].head.lastblock-1;
189 int isamd_block_size (ISAMD is, int type)
191 ISAMD_filecat filecat = is->method->filecat;
192 if ( type==-1) /* singleton */
193 return 0; /* no bytes used */
194 if (type < 0 || type >= is->no_files)
196 return filecat[type].bsize;
199 int isamd_close (ISAMD is)
204 if (is->method->debug>0)
206 logf (LOG_LOG, "isamd statistics");
207 logf (LOG_LOG, "f nxt forw mid-f prev backw mid-b");
208 for (i = 0; i<is->no_files; i++)
209 logf (LOG_LOG, "%d%7d%7d%7.1f%7d%7d%7.1f",i,
210 is->files[i].no_next,
211 is->files[i].no_forward,
212 is->files[i].no_forward ?
213 (double) is->files[i].sum_forward/is->files[i].no_forward
215 is->files[i].no_prev,
216 is->files[i].no_backward,
217 is->files[i].no_backward ?
218 (double) is->files[i].sum_backward/is->files[i].no_backward
221 if (is->method->debug>0)
222 logf (LOG_LOG, "f writes reads skipped alloc released ");
223 for (i = 0; i<is->no_files; i++)
226 assert (is->files[i].bf);
227 if (is->files[i].head_is_dirty)
228 bf_write (is->files[i].bf, 0, 0, sizeof(ISAMD_head),
230 if (is->method->debug>0)
231 logf (LOG_LOG, "%d%8d%8d%8d%8d%8d",i,
232 is->files[i].no_writes,
233 is->files[i].no_reads,
234 is->files[i].no_skip_writes,
235 is->files[i].no_allocated,
236 is->files[i].no_released);
237 xfree (is->files[i].fc_list);
239 bf_close (is->files[i].bf);
242 if (is->method->debug>0)
244 logf (LOG_LOG, "f opens main diffonly");
245 for (i = 0; i<is->no_files; i++)
247 logf (LOG_LOG, "%d%8d%8d%8d",i,
248 is->files[i].no_op_main+
249 is->files[i].no_op_diffonly,
250 is->files[i].no_op_main,
251 is->files[i].no_op_diffonly);
253 logf(LOG_LOG,"open single %8d", is->no_op_single);
254 logf(LOG_LOG,"open new %8d", is->no_op_new);
256 logf(LOG_LOG, "new build %8d", is->no_fbuilds);
257 logf(LOG_LOG, "append %8d", is->no_appds);
258 logf(LOG_LOG, " merges %8d", is->no_merges);
259 logf(LOG_LOG, " singles %8d", is->no_singles);
260 logf(LOG_LOG, " no-ops %8d", is->no_non);
262 logf(LOG_LOG, "read blocks %8d", is->no_read);
263 logf(LOG_LOG, "read keys: %8d %8.1f k/bl",
265 1.0*(is->no_read_keys+1)/(is->no_read+1) );
266 logf(LOG_LOG, "read main-k %8d %8.1f %% of keys",
268 100.0*(is->no_read_main+1)/(is->no_read_keys+1) );
269 logf(LOG_LOG, "read ends: %8d %8.1f k/e",
271 1.0*(is->no_read_keys+1)/(is->no_read_eof+1) );
272 s= is->no_seek_nxt+ is->no_seek_sam+ is->no_seek_fwd +
273 is->no_seek_prv+ is->no_seek_bak+ is->no_seek_cat;
276 logf(LOG_LOG, "seek same %8d %8.1f%%",
277 is->no_seek_sam, 100.0*is->no_seek_sam/s );
278 logf(LOG_LOG, "seek next %8d %8.1f%%",
279 is->no_seek_nxt, 100.0*is->no_seek_nxt/s );
280 logf(LOG_LOG, "seek prev %8d %8.1f%%",
281 is->no_seek_prv, 100.0*is->no_seek_prv/s );
282 logf(LOG_LOG, "seek forw %8d %8.1f%%",
283 is->no_seek_fwd, 100.0*is->no_seek_fwd/s );
284 logf(LOG_LOG, "seek back %8d %8.1f%%",
285 is->no_seek_bak, 100.0*is->no_seek_bak/s );
286 logf(LOG_LOG, "seek cat %8d %8.1f%%",
287 is->no_seek_cat, 100.0*is->no_seek_cat/s );
295 static void isamd_seek_stat(ISAMD is, int cat, int pos)
297 if (cat != is->last_cat)
299 else if ( pos == is->last_pos)
301 else if ( pos == is->last_pos+1)
303 else if ( pos == is->last_pos-1)
305 else if ( pos > is->last_pos)
307 else if ( pos < is->last_pos)
313 int isamd_read_block (ISAMD is, int cat, int pos, char *dst)
315 isamd_seek_stat(is,cat,pos);
316 ++(is->files[cat].no_reads);
318 if (is->method->debug > 6)
319 logf (LOG_LOG, "isamd: read_block %d:%d",cat, pos);
320 return bf_read (is->files[cat].bf, pos, 0, 0, dst);
323 int isamd_write_block (ISAMD is, int cat, int pos, char *src)
325 isamd_seek_stat(is,cat,pos);
326 ++(is->files[cat].no_writes);
328 if (is->method->debug > 6)
329 logf (LOG_LOG, "isamd: write_block %d:%d", cat, pos);
330 return bf_write (is->files[cat].bf, pos, 0, 0, src);
333 int isamd_write_dblock (ISAMD is, int cat, int pos, char *src,
334 int nextpos, int offset)
336 ISAMD_BLOCK_SIZE size = offset + ISAMD_BLOCK_OFFSET_N;
337 if (is->method->debug > 4)
338 logf (LOG_LOG, "isamd: write_dblock. size=%d nextpos=%d",
339 (int) size, nextpos);
340 src -= ISAMD_BLOCK_OFFSET_N;
341 assert( ISAMD_BLOCK_OFFSET_N == sizeof(int)+sizeof(int) );
342 memcpy (src, &nextpos, sizeof(int));
343 memcpy (src + sizeof(int), &size, sizeof(size));
344 return isamd_write_block (is, cat, pos, src);
347 #if ISAMD_FREELIST_CHUNK
348 static void flush_block (ISAMD is, int cat)
350 char *abuf = is->files[cat].alloc_buf;
351 int block = is->files[cat].head.freelist;
352 if (block && is->files[cat].alloc_entries_num)
354 memcpy (abuf, &is->files[cat].alloc_entries_num, sizeof(int));
355 bf_write (is->files[cat].bf, block, 0, 0, abuf);
356 is->files[cat].alloc_entries_num = 0;
361 static int alloc_block (ISAMD is, int cat)
363 int block = is->files[cat].head.freelist;
364 char *abuf = is->files[cat].alloc_buf;
366 (is->files[cat].no_allocated)++;
370 block = (is->files[cat].head.lastblock)++; /* no free list */
371 is->files[cat].head_is_dirty = 1;
375 if (!is->files[cat].alloc_entries_num) /* read first time */
377 bf_read (is->files[cat].bf, block, 0, 0, abuf);
378 memcpy (&is->files[cat].alloc_entries_num, abuf,
379 sizeof(is->files[cat].alloc_entries_num));
380 assert (is->files[cat].alloc_entries_num > 0);
382 /* have some free blocks now */
383 assert (is->files[cat].alloc_entries_num > 0);
384 is->files[cat].alloc_entries_num--;
385 if (!is->files[cat].alloc_entries_num) /* last one in block? */
387 memcpy (&is->files[cat].head.freelist, abuf + sizeof(int),
389 is->files[cat].head_is_dirty = 1;
391 if (is->files[cat].head.freelist)
393 bf_read (is->files[cat].bf, is->files[cat].head.freelist,
395 memcpy (&is->files[cat].alloc_entries_num, abuf,
396 sizeof(is->files[cat].alloc_entries_num));
397 assert (is->files[cat].alloc_entries_num);
401 memcpy (&block, abuf + sizeof(int) + sizeof(int) *
402 is->files[cat].alloc_entries_num, sizeof(int));
407 static void release_block (ISAMD is, int cat, int pos)
409 char *abuf = is->files[cat].alloc_buf;
410 int block = is->files[cat].head.freelist;
412 (is->files[cat].no_released)++;
414 if (block && !is->files[cat].alloc_entries_num) /* must read block */
416 bf_read (is->files[cat].bf, block, 0, 0, abuf);
417 memcpy (&is->files[cat].alloc_entries_num, abuf,
418 sizeof(is->files[cat].alloc_entries_num));
419 assert (is->files[cat].alloc_entries_num > 0);
421 assert (is->files[cat].alloc_entries_num <= is->files[cat].alloc_entries_max);
422 if (is->files[cat].alloc_entries_num == is->files[cat].alloc_entries_max)
425 memcpy (abuf, &is->files[cat].alloc_entries_num, sizeof(int));
426 bf_write (is->files[cat].bf, block, 0, 0, abuf);
427 is->files[cat].alloc_entries_num = 0;
429 if (!is->files[cat].alloc_entries_num) /* make new buffer? */
431 memcpy (abuf + sizeof(int), &block, sizeof(int));
432 is->files[cat].head.freelist = pos;
433 is->files[cat].head_is_dirty = 1;
437 memcpy (abuf + sizeof(int) +
438 is->files[cat].alloc_entries_num*sizeof(int),
441 is->files[cat].alloc_entries_num++;
444 static void flush_block (ISAMD is, int cat)
446 char *abuf = is->files[cat].alloc_buf;
450 static int alloc_block (ISAMD is, int cat)
453 char buf[sizeof(int)];
455 is->files[cat].head_is_dirty = 1;
456 (is->files[cat].no_allocated)++;
457 if ((block = is->files[cat].head.freelist))
459 bf_read (is->files[cat].bf, block, 0, sizeof(int), buf);
460 memcpy (&is->files[cat].head.freelist, buf, sizeof(int));
463 block = (is->files[cat].head.lastblock)++;
467 static void release_block (ISAMD is, int cat, int pos)
469 char buf[sizeof(int)];
471 (is->files[cat].no_released)++;
472 is->files[cat].head_is_dirty = 1;
473 memcpy (buf, &is->files[cat].head.freelist, sizeof(int));
474 is->files[cat].head.freelist = pos;
475 bf_write (is->files[cat].bf, pos, 0, sizeof(int), buf);
479 int isamd_alloc_block (ISAMD is, int cat)
483 if (is->files[cat].fc_list)
486 for (j = 0; j < is->files[cat].fc_max; j++)
487 if ((nb = is->files[cat].fc_list[j]) && (!block || nb < block))
489 is->files[cat].fc_list[j] = 0;
495 block = alloc_block (is, cat);
496 if (is->method->debug > 4)
497 logf (LOG_LOG, "isamd: alloc_block in cat %d: %d", cat, block);
501 void isamd_release_block (ISAMD is, int cat, int pos)
503 if (is->method->debug > 4)
504 logf (LOG_LOG, "isamd: release_block in cat %d: %d", cat, pos);
507 if (is->files[cat].fc_list)
510 for (j = 0; j<is->files[cat].fc_max; j++)
511 if (!is->files[cat].fc_list[j])
513 is->files[cat].fc_list[j] = pos;
517 release_block (is, cat, pos);
520 static void init_fc (ISAMD is, int cat)
524 is->files[cat].fc_max = j;
525 is->files[cat].fc_list = (int *)
526 xmalloc (sizeof(*is->files[0].fc_list) * j);
528 is->files[cat].fc_list[j] = 0;
531 static void release_fc (ISAMD is, int cat)
533 int b, j = is->files[cat].fc_max;
536 if ((b = is->files[cat].fc_list[j]))
538 release_block (is, cat, b);
539 is->files[cat].fc_list[j] = 0;
543 void isamd_pp_close (ISAMD_PP pp)
547 (*is->method->code_stop)(ISAMD_DECODE, pp->decodeClientData);
548 isamd_free_diffs(pp); /* see merge-d.h */
551 if (is->method->debug > 5)
552 logf (LOG_LOG, "isamd_pp_close %p %d=%d:%d sz=%d n=%d=%d:%d",
553 pp, isamd_addr(pp->pos, pp->cat), pp->cat, pp->pos, pp->size,
554 pp->next, isamd_type(pp->next), isamd_block(pp->next) );
559 ISAMD_PP isamd_pp_open (ISAMD is, ISAMD_P ipos)
561 ISAMD_PP pp = (ISAMD_PP) xmalloc (sizeof(*pp));
563 int sz = is->method->filecat[is->max_cat].bsize;
564 /* always allocate for the largest blocks, saves trouble */
565 struct it_key singlekey;
566 char *c_ptr; /* for fake encoding the singlekey */
571 src = pp->buf = (char *) xmalloc (sz);
572 memset(src,'\0',sz); /* clear the buffer, for new blocks */
581 pp->decodeClientData = (*is->method->code_start)(ISAMD_DECODE);
583 if ( is_singleton(ipos) )
587 if (is->method->debug > 5)
588 logf (LOG_LOG, "isamd_pp_open %p %d=%d:%d sz=%d n=%d=%d:%d",
589 pp, isamd_addr(pp->pos, pp->cat), pp->cat, pp->pos, pp->size,
590 pp->next, isamd_type(pp->next), isamd_block(pp->next) );
591 singleton_decode(ipos, &singlekey );
592 pp->offset=ISAMD_BLOCK_OFFSET_1;
594 ofs=pp->offset+sizeof(int); /* reserve length of diffsegment */
595 singlekey.seqno = singlekey.seqno * 2 + 1; /* make an insert diff */
596 c_ptr=&(pp->buf[ofs]);
597 i_ptr=(char*)(&singlekey);
598 (*is->method->code_item)(ISAMD_ENCODE, pp->decodeClientData,
600 (*is->method->code_reset)(pp->decodeClientData);
601 ofs += c_ptr-&(pp->buf[ofs]);
602 memcpy( &(pp->buf[pp->offset]), &ofs, sizeof(int) );
603 /* since we memset buf earlier, we already have a zero endmark! */
605 if (is->method->debug > 5)
606 logf (LOG_LOG, "isamd_pp_open single %d=%x: %d.%d sz=%d",
608 singlekey.sysno, singlekey.seqno/2,
614 pp->cat = isamd_type(ipos);
615 pp->pos = isamd_block(ipos);
623 isamd_read_block (is, pp->cat, pp->pos, src);
624 memcpy (&pp->next, src, sizeof(pp->next));
625 src += sizeof(pp->next);
626 memcpy (&pp->size, src, sizeof(pp->size));
627 src += sizeof(pp->size);
628 memcpy (&pp->numKeys, src, sizeof(pp->numKeys));
629 src += sizeof(pp->numKeys);
630 assert (pp->next != isamd_addr(pp->pos,pp->cat));
631 pp->offset = src - pp->buf;
632 assert (pp->offset == ISAMD_BLOCK_OFFSET_1);
633 assert(pp->size>=ISAMD_BLOCK_OFFSET_1); /*??*/
635 is->files[pp->cat].no_op_main++;
637 is->files[pp->cat].no_op_diffonly++;
639 if (is->method->debug > 5)
640 logf (LOG_LOG, "isamd_pp_open %p %d=%d:%d sz=%d n=%d=%d:%d",
641 pp, isamd_addr(pp->pos, pp->cat), pp->cat, pp->pos, pp->size,
642 pp->next, isamd_type(pp->next), isamd_block(pp->next) );
649 void isamd_buildfirstblock(ISAMD_PP pp){
652 assert(pp->next != isamd_addr(pp->pos,pp->cat));
653 memcpy(dst, &pp->next, sizeof(pp->next) );
654 dst += sizeof(pp->next);
655 memcpy(dst, &pp->size,sizeof(pp->size));
656 dst += sizeof(pp->size);
657 memcpy(dst, &pp->numKeys, sizeof(pp->numKeys));
658 dst += sizeof(pp->numKeys);
659 assert (dst - pp->buf == ISAMD_BLOCK_OFFSET_1);
660 if (pp->is->method->debug > 5)
661 logf (LOG_LOG, "isamd: bldfirst: p=%d=%d:%d n=%d:%d:%d sz=%d nk=%d ",
662 isamd_addr(pp->pos,pp->cat),pp->cat, pp->pos,
663 pp->next, isamd_type(pp->next), isamd_block(pp->next),
664 pp->size, pp->numKeys);
667 void isamd_buildlaterblock(ISAMD_PP pp){
670 assert(pp->next != isamd_addr(pp->pos,pp->cat));
671 memcpy(dst, &pp->next, sizeof(pp->next) );
672 dst += sizeof(pp->next);
673 memcpy(dst, &pp->size,sizeof(pp->size));
674 dst += sizeof(pp->size);
675 assert (dst - pp->buf == ISAMD_BLOCK_OFFSET_N);
676 if (pp->is->method->debug > 5)
677 logf (LOG_LOG, "isamd: l8r: sz=%d p=%d/%d>%d/%d",
680 isamd_block(pp->next), isamd_type(pp->next) );
685 /* returns non-zero if item could be read; 0 otherwise */
686 int isamd_pp_read (ISAMD_PP pp, void *buf)
689 return isamd_read_item (pp, (char **) &buf);
690 /* note: isamd_read_item is in merge-d.c, because it is so */
691 /* convoluted with the merge process */
694 /* read one main item from file - decode and store it in *dst.
695 Does not worry about diffs
698 1 if item could be read ok
700 int isamd_read_main_item (ISAMD_PP pp, char **dst)
703 char *src = pp->buf + pp->offset;
707 if (pp->offset >= pp->size)
712 return 0; /* end of file */
714 if (pp->next > pp->pos)
716 if (pp->next == pp->pos + 1)
717 is->files[pp->cat].no_next++;
720 is->files[pp->cat].no_forward++;
721 is->files[pp->cat].sum_forward += pp->next - pp->pos;
726 if (pp->next + 1 == pp->pos)
727 is->files[pp->cat].no_prev++;
730 is->files[pp->cat].no_backward++;
731 is->files[pp->cat].sum_backward += pp->pos - pp->next;
734 /* out new block position */
735 newcat = isamd_type(pp->next);
736 pp->pos = isamd_block(pp->next);
737 pp->cat = isamd_type(pp->next);
738 pp->is->no_read_main++;
740 /* read block and save 'next' and 'size' entry */
741 isamd_read_block (is, pp->cat, pp->pos, src);
742 memcpy (&pp->next, src, sizeof(pp->next));
743 src += sizeof(pp->next);
744 memcpy (&pp->size, src, sizeof(pp->size));
745 src += sizeof(pp->size);
746 /* assume block is non-empty */
747 pp->offset = oldoffs = src - pp->buf;
748 assert (pp->offset == ISAMD_BLOCK_OFFSET_N);
749 assert (pp->next != isamd_addr(pp->pos,pp->cat));
750 (*is->method->code_reset)(pp->decodeClientData);
751 /* finally, read the item */
752 (*is->method->code_item)(ISAMD_DECODE, pp->decodeClientData, dst, &src);
753 pp->offset = src - pp->buf;
754 if (is->method->debug > 8)
755 logf (LOG_LOG, "isamd: read_m: block %d:%d sz=%d ofs=%d-%d next=%d",
756 pp->cat, pp->pos, pp->size, oldoffs, pp->offset, pp->next);
760 (*is->method->code_item)(ISAMD_DECODE, pp->decodeClientData, dst, &src);
761 pp->offset = src - pp->buf;
762 if (is->method->debug > 8)
763 logf (LOG_LOG, "isamd: read_m: got %d:%d sz=%d ofs=%d-%d next=%d",
764 pp->cat, pp->pos, pp->size, oldoffs, pp->offset, pp->next);
768 int isamd_pp_num (ISAMD_PP pp)
773 static char *hexdump(unsigned char *p, int len, char *buff) {
774 static char localbuff[128];
776 if (!buff) buff=localbuff;
779 sprintf(bytebuff,"%02x",*p);
781 strcat(buff,bytebuff);
782 if (len) strcat(buff," ");
788 void isamd_pp_dump (ISAMD is, ISAMD_P ipos)
799 int olddebug= is->method->debug;
800 is->method->debug=0; /* no debug logs while reading for dump */
802 logf(LOG_LOG,"dumping isamd block %d (%d:%d)",
803 (int)ipos, isamd_type(ipos), isamd_block(ipos) );
804 pp=isamd_pp_open(is,ipos);
805 logf(LOG_LOG,"numKeys=%d, ofs=%d sz=%d",
806 pp->numKeys, pp->offset, pp->size );
807 diffidx=oldoffs= pp->offset;
808 while ((diffidx < is->method->filecat[pp->cat].bsize) && (diffmax>0))
810 memcpy(&diffmax,&(pp->buf[diffidx]),sizeof(int));
811 logf (LOG_LOG,"diff set at %d-%d: %s", diffidx, diffmax,
812 hexdump(pp->buf+diffidx,8,0));
813 /*! todo: dump the actual diffs as well !!! */
817 while(isamd_pp_read(pp, &key))
819 if (oldaddr != isamd_addr(pp->pos,pp->cat) )
821 oldaddr = isamd_addr(pp->pos,pp->cat);
822 logf(LOG_LOG,"block %d=%d:%d sz=%d nx=%d=%d:%d ofs=%d",
823 isamd_addr(pp->pos,pp->cat), pp->cat, pp->pos,
825 pp->next, isamd_type(pp->next), isamd_block(pp->next),
831 logf(LOG_LOG," %05x: %s",i,hexdump(pp->buf+i,n,hexbuff));
834 if (oldoffs > ISAMD_BLOCK_OFFSET_N)
835 oldoffs=ISAMD_BLOCK_OFFSET_N;
838 logf (LOG_LOG," got %d:%d=%x:%x from %s at %d=%x",
839 key.sysno, key.seqno,
840 key.sysno, key.seqno,
841 hexdump(pp->buf+oldoffs, pp->offset-oldoffs, hexbuff),
843 oldoffs = pp->offset;
845 /*!*/ /*TODO: dump diffs too!!! */
847 is->method->debug=olddebug;
852 * Revision 1.17 1999-10-06 11:46:36 heikki
853 * mproved statistics on isam-d
855 * Revision 1.16 1999/10/05 09:57:40 heikki
856 * Tuning the isam-d (and fixed a small "detail")
858 * Revision 1.15 1999/09/27 14:36:36 heikki
861 * Revision 1.14 1999/09/23 18:01:18 heikki
862 * singleton optimising
864 * Revision 1.13 1999/09/20 15:48:06 heikki
867 * Revision 1.12 1999/09/13 13:28:28 heikki
868 * isam-d optimizing: merging input data in the same go
870 * Revision 1.11 1999/08/25 18:09:24 heikki
871 * Starting to optimize
873 * Revision 1.10 1999/08/24 13:17:42 heikki
874 * Block sizes, comments
876 * Revision 1.9 1999/08/20 12:25:58 heikki
877 * Statistics in isamd
879 * Revision 1.8 1999/08/18 13:28:16 heikki
880 * Set log levels to decent values
882 * Revision 1.6 1999/08/17 19:44:25 heikki
885 * Revision 1.4 1999/08/04 14:21:18 heikki
886 * isam-d seems to be working.
888 * Revision 1.3 1999/07/21 14:24:50 heikki
889 * isamd write and read functions ok, except when diff block full.
890 * (merge not yet done)
892 * Revision 1.1 1999/07/14 12:34:43 heikki
893 * Copied from isamh, starting to change things...