1 /* $Id: isamd.c,v 1.26 2003-06-23 15:36:11 adam Exp $
2 Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003
5 This file is part of the Zebra server.
7 Zebra is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with Zebra; see the file LICENSE.zebra. If not, write to the
19 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
29 #include "../index/index.h" /* isamd uses the internal structure of it_key */
32 static void flush_block (ISAMD is, int cat);
33 static void release_fc (ISAMD is, int cat);
34 static void init_fc (ISAMD is, int cat);
36 #define ISAMD_FREELIST_CHUNK 1
40 ISAMD_M *isamd_getmethod (ISAMD_M *me)
42 static struct ISAMD_filecat_s def_cat[] = {
44 /* blocksz, max. Unused time being */
45 { 32, 40 }, /* 24 is the smallest unreasonable size! */
70 { 24, 1 }, /* Experimental sizes */
81 ISAMD_M *m = (ISAMD_M *) xmalloc (sizeof(*m)); /* never released! */
82 m->filecat = def_cat; /* ok, only alloc'd once */
89 m->compare_item = NULL;
91 m->debug = 0; /* default to no debug */
93 m->max_blocks_mem = 10;
100 ISAMD isamd_open (BFiles bfs, const char *name, int writeflag, ISAMD_M *method)
103 ISAMD_filecat filecat;
106 is = (ISAMD) xmalloc (sizeof(*is));
108 is->method = (ISAMD_M *) xmalloc (sizeof(*is->method));
109 memcpy (is->method, method, sizeof(*method));
110 filecat = is->method->filecat;
113 /* determine number of block categories */
114 if (is->method->debug>0)
115 logf (LOG_LOG, "isamd: bsize maxkeys");
118 if (is->method->debug>0)
119 logf (LOG_LOG, "isamd:%6d %6d",
120 filecat[i].bsize, filecat[i].mblocks);
121 } while (filecat[i++].mblocks);
125 assert (is->no_files > 0);
126 assert (is->max_cat <=8 ); /* we have only 3 bits for it */
128 is->files = (ISAMD_file) xmalloc (sizeof(*is->files)*is->no_files);
130 for (i = 0; i<is->no_files; i++)
134 sprintf (fname, "%s%c", name, i+'A');
135 is->files[i].bf = bf_open (bfs, fname, is->method->filecat[i].bsize,
137 is->files[i].head_is_dirty = 0;
138 if (!bf_read (is->files[i].bf, 0, 0, sizeof(ISAMD_head),
141 is->files[i].head.lastblock = 1;
142 is->files[i].head.freelist = 0;
144 is->files[i].alloc_entries_num = 0;
145 is->files[i].alloc_entries_max =
146 is->method->filecat[i].bsize / sizeof(int) - 1;
147 is->files[i].alloc_buf = (char *)
148 xmalloc (is->method->filecat[i].bsize);
149 is->files[i].no_writes = 0; /* clear statistics */
150 is->files[i].no_reads = 0;
151 is->files[i].no_skip_writes = 0;
152 is->files[i].no_allocated = 0;
153 is->files[i].no_released = 0;
154 is->files[i].no_remap = 0;
155 is->files[i].no_forward = 0;
156 is->files[i].no_backward = 0;
157 is->files[i].sum_forward = 0;
158 is->files[i].sum_backward = 0;
159 is->files[i].no_next = 0;
160 is->files[i].no_prev = 0;
161 is->files[i].no_op_diffonly=0;
162 is->files[i].no_op_main=0;
189 int isamd_block_used (ISAMD is, int type)
191 if ( type==-1) /* singleton */
193 if (type < 0 || type >= is->no_files)
195 return is->files[type].head.lastblock-1;
198 int isamd_block_size (ISAMD is, int type)
200 ISAMD_filecat filecat = is->method->filecat;
201 if ( type==-1) /* singleton */
202 return 0; /* no bytes used */
203 if (type < 0 || type >= is->no_files)
205 return filecat[type].bsize;
208 int isamd_close (ISAMD is)
213 if (is->method->debug>0)
215 logf (LOG_LOG, "isamd statistics");
216 logf (LOG_LOG, "f nxt forw mid-f prev backw mid-b");
217 for (i = 0; i<is->no_files; i++)
218 logf (LOG_LOG, "%d%7d%7d%7.1f%7d%7d%7.1f",i,
219 is->files[i].no_next,
220 is->files[i].no_forward,
221 is->files[i].no_forward ?
222 (double) is->files[i].sum_forward/is->files[i].no_forward
224 is->files[i].no_prev,
225 is->files[i].no_backward,
226 is->files[i].no_backward ?
227 (double) is->files[i].sum_backward/is->files[i].no_backward
230 if (is->method->debug>0)
231 logf (LOG_LOG, "f writes reads skipped alloc released ");
232 for (i = 0; i<is->no_files; i++)
235 assert (is->files[i].bf);
236 if (is->files[i].head_is_dirty)
237 bf_write (is->files[i].bf, 0, 0, sizeof(ISAMD_head),
239 if (is->method->debug>0)
240 logf (LOG_LOG, "%d%8d%8d%8d%8d%8d",i,
241 is->files[i].no_writes,
242 is->files[i].no_reads,
243 is->files[i].no_skip_writes,
244 is->files[i].no_allocated,
245 is->files[i].no_released);
246 xfree (is->files[i].fc_list);
248 bf_close (is->files[i].bf);
251 if (is->method->debug>0)
253 logf (LOG_LOG, "f opens main diffonly");
254 for (i = 0; i<is->no_files; i++)
256 logf (LOG_LOG, "%d%8d%8d%8d",i,
257 is->files[i].no_op_main+
258 is->files[i].no_op_diffonly,
259 is->files[i].no_op_main,
260 is->files[i].no_op_diffonly);
262 logf(LOG_LOG,"open single %8d", is->no_op_single);
263 logf(LOG_LOG,"open new %8d", is->no_op_new);
265 logf(LOG_LOG, "new build %8d", is->no_fbuilds);
266 logf(LOG_LOG, "append %8d", is->no_appds);
267 logf(LOG_LOG, " merges %8d", is->no_merges);
268 logf(LOG_LOG, " singles %8d", is->no_singles);
269 logf(LOG_LOG, " no-ops %8d", is->no_non);
271 logf(LOG_LOG, "read blocks %8d", is->no_read);
272 logf(LOG_LOG, "read keys: %8d %8.1f k/bl",
274 1.0*(is->no_read_keys+1)/(is->no_read+1) );
275 logf(LOG_LOG, "read main-k %8d %8.1f %% of keys",
277 100.0*(is->no_read_main+1)/(is->no_read_keys+1) );
278 logf(LOG_LOG, "read ends: %8d %8.1f k/e",
280 1.0*(is->no_read_keys+1)/(is->no_read_eof+1) );
281 s= is->no_seek_nxt+ is->no_seek_sam+ is->no_seek_fwd +
282 is->no_seek_prv+ is->no_seek_bak+ is->no_seek_cat;
285 logf(LOG_LOG, "seek same %8d %8.1f%%",
286 is->no_seek_sam, 100.0*is->no_seek_sam/s );
287 logf(LOG_LOG, "seek next %8d %8.1f%%",
288 is->no_seek_nxt, 100.0*is->no_seek_nxt/s );
289 logf(LOG_LOG, "seek prev %8d %8.1f%%",
290 is->no_seek_prv, 100.0*is->no_seek_prv/s );
291 logf(LOG_LOG, "seek forw %8d %8.1f%%",
292 is->no_seek_fwd, 100.0*is->no_seek_fwd/s );
293 logf(LOG_LOG, "seek back %8d %8.1f%%",
294 is->no_seek_bak, 100.0*is->no_seek_bak/s );
295 logf(LOG_LOG, "seek cat %8d %8.1f%%",
296 is->no_seek_cat, 100.0*is->no_seek_cat/s );
304 static void isamd_seek_stat(ISAMD is, int cat, int pos)
306 if (cat != is->last_cat)
308 else if ( pos == is->last_pos)
310 else if ( pos == is->last_pos+1)
312 else if ( pos == is->last_pos-1)
314 else if ( pos > is->last_pos)
316 else if ( pos < is->last_pos)
322 int isamd_read_block (ISAMD is, int cat, int pos, char *dst)
324 isamd_seek_stat(is,cat,pos);
325 ++(is->files[cat].no_reads);
327 if (is->method->debug > 6)
328 logf (LOG_LOG, "isamd: read_block %d:%d",cat, pos);
329 return bf_read (is->files[cat].bf, pos, 0, 0, dst);
332 int isamd_write_block (ISAMD is, int cat, int pos, char *src)
334 isamd_seek_stat(is,cat,pos);
335 ++(is->files[cat].no_writes);
337 if (is->method->debug > 6)
338 logf (LOG_LOG, "isamd: write_block %d:%d", cat, pos);
339 return bf_write (is->files[cat].bf, pos, 0, 0, src);
342 int isamd_write_dblock (ISAMD is, int cat, int pos, char *src,
343 int nextpos, int offset)
345 ISAMD_BLOCK_SIZE size = offset + ISAMD_BLOCK_OFFSET_N;
346 if (is->method->debug > 4)
347 logf (LOG_LOG, "isamd: write_dblock. size=%d nextpos=%d",
348 (int) size, nextpos);
349 src -= ISAMD_BLOCK_OFFSET_N;
350 assert( ISAMD_BLOCK_OFFSET_N == sizeof(int)+sizeof(int) );
351 memcpy (src, &nextpos, sizeof(int));
352 memcpy (src + sizeof(int), &size, sizeof(size));
353 return isamd_write_block (is, cat, pos, src);
356 #if ISAMD_FREELIST_CHUNK
357 static void flush_block (ISAMD is, int cat)
359 char *abuf = is->files[cat].alloc_buf;
360 int block = is->files[cat].head.freelist;
361 if (block && is->files[cat].alloc_entries_num)
363 memcpy (abuf, &is->files[cat].alloc_entries_num, sizeof(int));
364 bf_write (is->files[cat].bf, block, 0, 0, abuf);
365 is->files[cat].alloc_entries_num = 0;
370 static int alloc_block (ISAMD is, int cat)
372 int block = is->files[cat].head.freelist;
373 char *abuf = is->files[cat].alloc_buf;
375 (is->files[cat].no_allocated)++;
379 block = (is->files[cat].head.lastblock)++; /* no free list */
380 is->files[cat].head_is_dirty = 1;
384 if (!is->files[cat].alloc_entries_num) /* read first time */
386 bf_read (is->files[cat].bf, block, 0, 0, abuf);
387 memcpy (&is->files[cat].alloc_entries_num, abuf,
388 sizeof(is->files[cat].alloc_entries_num));
389 assert (is->files[cat].alloc_entries_num > 0);
391 /* have some free blocks now */
392 assert (is->files[cat].alloc_entries_num > 0);
393 is->files[cat].alloc_entries_num--;
394 if (!is->files[cat].alloc_entries_num) /* last one in block? */
396 memcpy (&is->files[cat].head.freelist, abuf + sizeof(int),
398 is->files[cat].head_is_dirty = 1;
400 if (is->files[cat].head.freelist)
402 bf_read (is->files[cat].bf, is->files[cat].head.freelist,
404 memcpy (&is->files[cat].alloc_entries_num, abuf,
405 sizeof(is->files[cat].alloc_entries_num));
406 assert (is->files[cat].alloc_entries_num);
410 memcpy (&block, abuf + sizeof(int) + sizeof(int) *
411 is->files[cat].alloc_entries_num, sizeof(int));
416 static void release_block (ISAMD is, int cat, int pos)
418 char *abuf = is->files[cat].alloc_buf;
419 int block = is->files[cat].head.freelist;
421 (is->files[cat].no_released)++;
423 if (block && !is->files[cat].alloc_entries_num) /* must read block */
425 bf_read (is->files[cat].bf, block, 0, 0, abuf);
426 memcpy (&is->files[cat].alloc_entries_num, abuf,
427 sizeof(is->files[cat].alloc_entries_num));
428 assert (is->files[cat].alloc_entries_num > 0);
430 assert (is->files[cat].alloc_entries_num <= is->files[cat].alloc_entries_max);
431 if (is->files[cat].alloc_entries_num == is->files[cat].alloc_entries_max)
434 memcpy (abuf, &is->files[cat].alloc_entries_num, sizeof(int));
435 bf_write (is->files[cat].bf, block, 0, 0, abuf);
436 is->files[cat].alloc_entries_num = 0;
438 if (!is->files[cat].alloc_entries_num) /* make new buffer? */
440 memcpy (abuf + sizeof(int), &block, sizeof(int));
441 is->files[cat].head.freelist = pos;
442 is->files[cat].head_is_dirty = 1;
446 memcpy (abuf + sizeof(int) +
447 is->files[cat].alloc_entries_num*sizeof(int),
450 is->files[cat].alloc_entries_num++;
453 static void flush_block (ISAMD is, int cat)
455 char *abuf = is->files[cat].alloc_buf;
459 static int alloc_block (ISAMD is, int cat)
462 char buf[sizeof(int)];
464 is->files[cat].head_is_dirty = 1;
465 (is->files[cat].no_allocated)++;
466 if ((block = is->files[cat].head.freelist))
468 bf_read (is->files[cat].bf, block, 0, sizeof(int), buf);
469 memcpy (&is->files[cat].head.freelist, buf, sizeof(int));
472 block = (is->files[cat].head.lastblock)++;
476 static void release_block (ISAMD is, int cat, int pos)
478 char buf[sizeof(int)];
480 (is->files[cat].no_released)++;
481 is->files[cat].head_is_dirty = 1;
482 memcpy (buf, &is->files[cat].head.freelist, sizeof(int));
483 is->files[cat].head.freelist = pos;
484 bf_write (is->files[cat].bf, pos, 0, sizeof(int), buf);
488 int isamd_alloc_block (ISAMD is, int cat)
492 if (is->files[cat].fc_list)
495 for (j = 0; j < is->files[cat].fc_max; j++)
496 if ((nb = is->files[cat].fc_list[j]) && (!block || nb < block))
498 is->files[cat].fc_list[j] = 0;
504 block = alloc_block (is, cat);
505 if (is->method->debug > 4)
506 logf (LOG_LOG, "isamd: alloc_block in cat %d: %d", cat, block);
510 void isamd_release_block (ISAMD is, int cat, int pos)
512 if (is->method->debug > 4)
513 logf (LOG_LOG, "isamd: release_block in cat %d: %d", cat, pos);
516 if (is->files[cat].fc_list)
519 for (j = 0; j<is->files[cat].fc_max; j++)
520 if (!is->files[cat].fc_list[j])
522 is->files[cat].fc_list[j] = pos;
526 release_block (is, cat, pos);
529 static void init_fc (ISAMD is, int cat)
533 is->files[cat].fc_max = j;
534 is->files[cat].fc_list = (int *)
535 xmalloc (sizeof(*is->files[0].fc_list) * j);
537 is->files[cat].fc_list[j] = 0;
540 static void release_fc (ISAMD is, int cat)
542 int b, j = is->files[cat].fc_max;
545 if ((b = is->files[cat].fc_list[j]))
547 release_block (is, cat, b);
548 is->files[cat].fc_list[j] = 0;
552 void isamd_pp_close (ISAMD_PP pp)
556 (*is->method->code_stop)(ISAMD_DECODE, pp->decodeClientData);
557 isamd_free_diffs(pp); /* see merge-d.h */
558 if (is->method->debug > 5)
559 logf (LOG_LOG, "isamd_pp_close %p %d=%d:%d sz=%d n=%d=%d:%d nk=%d",
560 pp, isamd_addr(pp->pos, pp->cat), pp->cat, pp->pos, pp->size,
561 pp->next, isamd_type(pp->next), isamd_block(pp->next),
568 ISAMD_PP isamd_pp_create (ISAMD is, int cat)
569 /* creates a pp_buff without data in it. pos=0, cat as given */
571 ISAMD_PP pp = (ISAMD_PP) xmalloc (sizeof(*pp));
572 int sz = is->method->filecat[is->max_cat].bsize;
575 pp->buf = (char *) xmalloc (sz);
576 memset(pp->buf,'\0',sz); /* clear the buffer, for new blocks */
585 pp->decodeClientData = (*is->method->code_start)(ISAMD_DECODE);
594 ISAMD_PP isamd_pp_open (ISAMD is, const char *dictbuf, int dictlen)
597 ISAMD_PP pp = (ISAMD_PP) xmalloc (sizeof(*pp));
599 int sz = is->method->filecat[is->max_cat].bsize;
600 /* always allocate for the largest blocks, saves trouble */
604 src = pp->buf = (char *) xmalloc (sz);
605 memset(src,'\0',sz); /* clear the buffer, for new blocks */
614 pp->decodeClientData = (*is->method->code_start)(ISAMD_DECODE);
616 dictnum=*dictbuf; /* numkeys for internals, 0 for externals */
620 memcpy(&ipos, dictbuf+1, sizeof(ISAMD_P) );
622 else /* dictionary block, fake a real one */
626 if (is->method->debug > 5)
627 logf (LOG_LOG, "isamd_pp_open dict");
628 pp->numKeys=(unsigned char) dictbuf[0];
629 memcpy(pp->buf+ISAMD_BLOCK_OFFSET_1, dictbuf+1,dictlen-1);
630 pp->size=pp->offset=dictlen+ISAMD_BLOCK_OFFSET_1-1;
635 pp->cat = isamd_type(ipos);
636 pp->pos = isamd_block(ipos);
644 isamd_read_block (is, pp->cat, pp->pos, src);
645 memcpy (&pp->next, src, sizeof(pp->next));
646 src += sizeof(pp->next);
647 memcpy (&pp->size, src, sizeof(pp->size));
648 src += sizeof(pp->size);
649 memcpy (&pp->numKeys, src, sizeof(pp->numKeys));
650 src += sizeof(pp->numKeys);
651 assert (pp->next != isamd_addr(pp->pos,pp->cat));
652 pp->offset = src - pp->buf;
653 assert (pp->offset == ISAMD_BLOCK_OFFSET_1);
654 assert(pp->size>=ISAMD_BLOCK_OFFSET_1); /*??*/
656 is->files[pp->cat].no_op_main++;
658 is->files[pp->cat].no_op_diffonly++;
660 if (is->method->debug > 5)
661 logf (LOG_LOG, "isamd_pp_open %p %d=%d:%d sz=%d n=%d=%d:%d",
662 pp, isamd_addr(pp->pos, pp->cat), pp->cat, pp->pos, pp->size,
663 pp->next, isamd_type(pp->next), isamd_block(pp->next) );
670 void isamd_buildfirstblock(ISAMD_PP pp){
673 assert(pp->next != isamd_addr(pp->pos,pp->cat));
674 memcpy(dst, &pp->next, sizeof(pp->next) );
675 dst += sizeof(pp->next);
676 memcpy(dst, &pp->size,sizeof(pp->size));
677 dst += sizeof(pp->size);
678 memcpy(dst, &pp->numKeys, sizeof(pp->numKeys));
679 dst += sizeof(pp->numKeys);
680 assert (dst - pp->buf == ISAMD_BLOCK_OFFSET_1);
681 if (pp->is->method->debug > 5)
682 logf (LOG_LOG, "isamd: bldfirst: p=%d=%d:%d n=%d:%d:%d sz=%d nk=%d ",
683 isamd_addr(pp->pos,pp->cat),pp->cat, pp->pos,
684 pp->next, isamd_type(pp->next), isamd_block(pp->next),
685 pp->size, pp->numKeys);
688 void isamd_buildlaterblock(ISAMD_PP pp){
691 assert(pp->next != isamd_addr(pp->pos,pp->cat));
692 memcpy(dst, &pp->next, sizeof(pp->next) );
693 dst += sizeof(pp->next);
694 memcpy(dst, &pp->size,sizeof(pp->size));
695 dst += sizeof(pp->size);
696 assert (dst - pp->buf == ISAMD_BLOCK_OFFSET_N);
697 if (pp->is->method->debug > 5)
698 logf (LOG_LOG, "isamd: l8r: sz=%d p=%d/%d>%d/%d",
701 isamd_block(pp->next), isamd_type(pp->next) );
706 /* returns non-zero if item could be read; 0 otherwise */
707 int isamd_pp_read (ISAMD_PP pp, void *buf)
710 return isamd_read_item (pp, (char **) &buf);
711 /* note: isamd_read_item is in merge-d.c, because it is so */
712 /* convoluted with the merge process */
715 /* read one main item from file - decode and store it in *dst.
716 Does not worry about diffs
719 1 if item could be read ok
721 int isamd_read_main_item (ISAMD_PP pp, char **dst)
724 char *src = pp->buf + pp->offset;
728 if (pp->offset >= pp->size)
733 return 0; /* end of file */
735 if (pp->next > pp->pos)
737 if (pp->next == pp->pos + 1)
738 is->files[pp->cat].no_next++;
741 is->files[pp->cat].no_forward++;
742 is->files[pp->cat].sum_forward += pp->next - pp->pos;
747 if (pp->next + 1 == pp->pos)
748 is->files[pp->cat].no_prev++;
751 is->files[pp->cat].no_backward++;
752 is->files[pp->cat].sum_backward += pp->pos - pp->next;
755 /* out new block position */
756 newcat = isamd_type(pp->next);
757 pp->pos = isamd_block(pp->next);
758 pp->cat = isamd_type(pp->next);
759 pp->is->no_read_main++;
761 /* read block and save 'next' and 'size' entry */
762 isamd_read_block (is, pp->cat, pp->pos, src);
763 memcpy (&pp->next, src, sizeof(pp->next));
764 src += sizeof(pp->next);
765 memcpy (&pp->size, src, sizeof(pp->size));
766 src += sizeof(pp->size);
767 /* assume block is non-empty */
768 pp->offset = oldoffs = src - pp->buf;
769 assert (pp->offset == ISAMD_BLOCK_OFFSET_N);
770 assert (pp->next != isamd_addr(pp->pos,pp->cat));
771 (*is->method->code_reset)(pp->decodeClientData);
772 /* finally, read the item */
773 (*is->method->code_item)(ISAMD_DECODE, pp->decodeClientData, dst, &src);
774 pp->offset = src - pp->buf;
775 if (is->method->debug > 8)
776 logf (LOG_LOG, "isamd: read_m: block %d:%d sz=%d ofs=%d-%d next=%d",
777 pp->cat, pp->pos, pp->size, oldoffs, pp->offset, pp->next);
781 (*is->method->code_item)(ISAMD_DECODE, pp->decodeClientData, dst, &src);
782 pp->offset = src - pp->buf;
783 if (is->method->debug > 8)
784 logf (LOG_LOG, "isamd: read_m: got %d:%d sz=%d ofs=%d-%d next=%d",
785 pp->cat, pp->pos, pp->size, oldoffs, pp->offset, pp->next);
789 int isamd_pp_num (ISAMD_PP pp)
796 static char *hexdump(unsigned char *p, int len, char *buff) {
797 static char localbuff[128];
799 if (!buff) buff=localbuff;
802 sprintf(bytebuff,"%02x",*p);
804 strcat(buff,bytebuff);
805 if (len) strcat(buff," ");
812 /* needs different arguments, or something */
813 void isamd_pp_dump (ISAMD is, ISAMD_P ipos)
824 int olddebug= is->method->debug;
825 is->method->debug=0; /* no debug logs while reading for dump */
827 logf(LOG_LOG,"dumping isamd block %d (%d:%d)",
828 (int)ipos, isamd_type(ipos), isamd_block(ipos) );
829 pp=isamd_pp_open(is,ipos);
830 logf(LOG_LOG,"numKeys=%d, ofs=%d sz=%d",
831 pp->numKeys, pp->offset, pp->size );
832 diffidx=oldoffs= pp->offset;
833 while ((diffidx < is->method->filecat[pp->cat].bsize) && (diffmax>0))
835 memcpy(&diffmax,&(pp->buf[diffidx]),sizeof(int));
836 logf (LOG_LOG,"diff set at %d-%d: %s", diffidx, diffmax,
837 hexdump(pp->buf+diffidx,8,0));
838 /*! todo: dump the actual diffs as well !!! */
842 while(isamd_pp_read(pp, &key))
844 if (oldaddr != isamd_addr(pp->pos,pp->cat) )
846 oldaddr = isamd_addr(pp->pos,pp->cat);
847 logf(LOG_LOG,"block %d=%d:%d sz=%d nx=%d=%d:%d ofs=%d",
848 isamd_addr(pp->pos,pp->cat), pp->cat, pp->pos,
850 pp->next, isamd_type(pp->next), isamd_block(pp->next),
856 logf(LOG_LOG," %05x: %s",i,hexdump(pp->buf+i,n,hexbuff));
859 if (oldoffs > ISAMD_BLOCK_OFFSET_N)
860 oldoffs=ISAMD_BLOCK_OFFSET_N;
863 logf (LOG_LOG," got %d:%d=%x:%x from %s at %d=%x",
864 key.sysno, key.seqno,
865 key.sysno, key.seqno,
866 hexdump(pp->buf+oldoffs, pp->offset-oldoffs, hexbuff),
868 oldoffs = pp->offset;
870 /*!*/ /*TODO: dump diffs too!!! */
872 is->method->debug=olddebug;