1 /* $Id: isamd.c,v 1.27 2004-06-01 12:56:39 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;
92 m->debug = 0; /* default to no debug */
94 m->max_blocks_mem = 10;
101 ISAMD isamd_open (BFiles bfs, const char *name, int writeflag, ISAMD_M *method)
104 ISAMD_filecat filecat;
107 is = (ISAMD) xmalloc (sizeof(*is));
109 is->method = (ISAMD_M *) xmalloc (sizeof(*is->method));
110 memcpy (is->method, method, sizeof(*method));
111 filecat = is->method->filecat;
114 /* determine number of block categories */
115 if (is->method->debug>0)
116 logf (LOG_LOG, "isamd: bsize maxkeys");
119 if (is->method->debug>0)
120 logf (LOG_LOG, "isamd:%6d %6d",
121 filecat[i].bsize, filecat[i].mblocks);
122 } while (filecat[i++].mblocks);
126 assert (is->no_files > 0);
127 assert (is->max_cat <=8 ); /* we have only 3 bits for it */
129 is->files = (ISAMD_file) xmalloc (sizeof(*is->files)*is->no_files);
131 for (i = 0; i<is->no_files; i++)
135 sprintf (fname, "%s%c", name, i+'A');
136 is->files[i].bf = bf_open (bfs, fname, is->method->filecat[i].bsize,
138 is->files[i].head_is_dirty = 0;
139 if (!bf_read (is->files[i].bf, 0, 0, sizeof(ISAMD_head),
142 is->files[i].head.lastblock = 1;
143 is->files[i].head.freelist = 0;
145 is->files[i].alloc_entries_num = 0;
146 is->files[i].alloc_entries_max =
147 is->method->filecat[i].bsize / sizeof(int) - 1;
148 is->files[i].alloc_buf = (char *)
149 xmalloc (is->method->filecat[i].bsize);
150 is->files[i].no_writes = 0; /* clear statistics */
151 is->files[i].no_reads = 0;
152 is->files[i].no_skip_writes = 0;
153 is->files[i].no_allocated = 0;
154 is->files[i].no_released = 0;
155 is->files[i].no_remap = 0;
156 is->files[i].no_forward = 0;
157 is->files[i].no_backward = 0;
158 is->files[i].sum_forward = 0;
159 is->files[i].sum_backward = 0;
160 is->files[i].no_next = 0;
161 is->files[i].no_prev = 0;
162 is->files[i].no_op_diffonly=0;
163 is->files[i].no_op_main=0;
190 int isamd_block_used (ISAMD is, int type)
192 if ( type==-1) /* singleton */
194 if (type < 0 || type >= is->no_files)
196 return is->files[type].head.lastblock-1;
199 int isamd_block_size (ISAMD is, int type)
201 ISAMD_filecat filecat = is->method->filecat;
202 if ( type==-1) /* singleton */
203 return 0; /* no bytes used */
204 if (type < 0 || type >= is->no_files)
206 return filecat[type].bsize;
209 int isamd_close (ISAMD is)
214 if (is->method->debug>0)
216 logf (LOG_LOG, "isamd statistics");
217 logf (LOG_LOG, "f nxt forw mid-f prev backw mid-b");
218 for (i = 0; i<is->no_files; i++)
219 logf (LOG_LOG, "%d%7d%7d%7.1f%7d%7d%7.1f",i,
220 is->files[i].no_next,
221 is->files[i].no_forward,
222 is->files[i].no_forward ?
223 (double) is->files[i].sum_forward/is->files[i].no_forward
225 is->files[i].no_prev,
226 is->files[i].no_backward,
227 is->files[i].no_backward ?
228 (double) is->files[i].sum_backward/is->files[i].no_backward
231 if (is->method->debug>0)
232 logf (LOG_LOG, "f writes reads skipped alloc released ");
233 for (i = 0; i<is->no_files; i++)
236 assert (is->files[i].bf);
237 if (is->files[i].head_is_dirty)
238 bf_write (is->files[i].bf, 0, 0, sizeof(ISAMD_head),
240 if (is->method->debug>0)
241 logf (LOG_LOG, "%d%8d%8d%8d%8d%8d",i,
242 is->files[i].no_writes,
243 is->files[i].no_reads,
244 is->files[i].no_skip_writes,
245 is->files[i].no_allocated,
246 is->files[i].no_released);
247 xfree (is->files[i].fc_list);
249 bf_close (is->files[i].bf);
252 if (is->method->debug>0)
254 logf (LOG_LOG, "f opens main diffonly");
255 for (i = 0; i<is->no_files; i++)
257 logf (LOG_LOG, "%d%8d%8d%8d",i,
258 is->files[i].no_op_main+
259 is->files[i].no_op_diffonly,
260 is->files[i].no_op_main,
261 is->files[i].no_op_diffonly);
263 logf(LOG_LOG,"open single %8d", is->no_op_single);
264 logf(LOG_LOG,"open new %8d", is->no_op_new);
266 logf(LOG_LOG, "new build %8d", is->no_fbuilds);
267 logf(LOG_LOG, "append %8d", is->no_appds);
268 logf(LOG_LOG, " merges %8d", is->no_merges);
269 logf(LOG_LOG, " singles %8d", is->no_singles);
270 logf(LOG_LOG, " no-ops %8d", is->no_non);
272 logf(LOG_LOG, "read blocks %8d", is->no_read);
273 logf(LOG_LOG, "read keys: %8d %8.1f k/bl",
275 1.0*(is->no_read_keys+1)/(is->no_read+1) );
276 logf(LOG_LOG, "read main-k %8d %8.1f %% of keys",
278 100.0*(is->no_read_main+1)/(is->no_read_keys+1) );
279 logf(LOG_LOG, "read ends: %8d %8.1f k/e",
281 1.0*(is->no_read_keys+1)/(is->no_read_eof+1) );
282 s= is->no_seek_nxt+ is->no_seek_sam+ is->no_seek_fwd +
283 is->no_seek_prv+ is->no_seek_bak+ is->no_seek_cat;
286 logf(LOG_LOG, "seek same %8d %8.1f%%",
287 is->no_seek_sam, 100.0*is->no_seek_sam/s );
288 logf(LOG_LOG, "seek next %8d %8.1f%%",
289 is->no_seek_nxt, 100.0*is->no_seek_nxt/s );
290 logf(LOG_LOG, "seek prev %8d %8.1f%%",
291 is->no_seek_prv, 100.0*is->no_seek_prv/s );
292 logf(LOG_LOG, "seek forw %8d %8.1f%%",
293 is->no_seek_fwd, 100.0*is->no_seek_fwd/s );
294 logf(LOG_LOG, "seek back %8d %8.1f%%",
295 is->no_seek_bak, 100.0*is->no_seek_bak/s );
296 logf(LOG_LOG, "seek cat %8d %8.1f%%",
297 is->no_seek_cat, 100.0*is->no_seek_cat/s );
305 static void isamd_seek_stat(ISAMD is, int cat, int pos)
307 if (cat != is->last_cat)
309 else if ( pos == is->last_pos)
311 else if ( pos == is->last_pos+1)
313 else if ( pos == is->last_pos-1)
315 else if ( pos > is->last_pos)
317 else if ( pos < is->last_pos)
323 int isamd_read_block (ISAMD is, int cat, int pos, char *dst)
325 isamd_seek_stat(is,cat,pos);
326 ++(is->files[cat].no_reads);
328 if (is->method->debug > 6)
329 logf (LOG_LOG, "isamd: read_block %d:%d",cat, pos);
330 return bf_read (is->files[cat].bf, pos, 0, 0, dst);
333 int isamd_write_block (ISAMD is, int cat, int pos, char *src)
335 isamd_seek_stat(is,cat,pos);
336 ++(is->files[cat].no_writes);
338 if (is->method->debug > 6)
339 logf (LOG_LOG, "isamd: write_block %d:%d", cat, pos);
340 return bf_write (is->files[cat].bf, pos, 0, 0, src);
343 int isamd_write_dblock (ISAMD is, int cat, int pos, char *src,
344 int nextpos, int offset)
346 ISAMD_BLOCK_SIZE size = offset + ISAMD_BLOCK_OFFSET_N;
347 if (is->method->debug > 4)
348 logf (LOG_LOG, "isamd: write_dblock. size=%d nextpos=%d",
349 (int) size, nextpos);
350 src -= ISAMD_BLOCK_OFFSET_N;
351 assert( ISAMD_BLOCK_OFFSET_N == sizeof(int)+sizeof(int) );
352 memcpy (src, &nextpos, sizeof(int));
353 memcpy (src + sizeof(int), &size, sizeof(size));
354 return isamd_write_block (is, cat, pos, src);
357 #if ISAMD_FREELIST_CHUNK
358 static void flush_block (ISAMD is, int cat)
360 char *abuf = is->files[cat].alloc_buf;
361 int block = is->files[cat].head.freelist;
362 if (block && is->files[cat].alloc_entries_num)
364 memcpy (abuf, &is->files[cat].alloc_entries_num, sizeof(int));
365 bf_write (is->files[cat].bf, block, 0, 0, abuf);
366 is->files[cat].alloc_entries_num = 0;
371 static int alloc_block (ISAMD is, int cat)
373 int block = is->files[cat].head.freelist;
374 char *abuf = is->files[cat].alloc_buf;
376 (is->files[cat].no_allocated)++;
380 block = (is->files[cat].head.lastblock)++; /* no free list */
381 is->files[cat].head_is_dirty = 1;
385 if (!is->files[cat].alloc_entries_num) /* read first time */
387 bf_read (is->files[cat].bf, block, 0, 0, abuf);
388 memcpy (&is->files[cat].alloc_entries_num, abuf,
389 sizeof(is->files[cat].alloc_entries_num));
390 assert (is->files[cat].alloc_entries_num > 0);
392 /* have some free blocks now */
393 assert (is->files[cat].alloc_entries_num > 0);
394 is->files[cat].alloc_entries_num--;
395 if (!is->files[cat].alloc_entries_num) /* last one in block? */
397 memcpy (&is->files[cat].head.freelist, abuf + sizeof(int),
399 is->files[cat].head_is_dirty = 1;
401 if (is->files[cat].head.freelist)
403 bf_read (is->files[cat].bf, is->files[cat].head.freelist,
405 memcpy (&is->files[cat].alloc_entries_num, abuf,
406 sizeof(is->files[cat].alloc_entries_num));
407 assert (is->files[cat].alloc_entries_num);
411 memcpy (&block, abuf + sizeof(int) + sizeof(int) *
412 is->files[cat].alloc_entries_num, sizeof(int));
417 static void release_block (ISAMD is, int cat, int pos)
419 char *abuf = is->files[cat].alloc_buf;
420 int block = is->files[cat].head.freelist;
422 (is->files[cat].no_released)++;
424 if (block && !is->files[cat].alloc_entries_num) /* must read block */
426 bf_read (is->files[cat].bf, block, 0, 0, abuf);
427 memcpy (&is->files[cat].alloc_entries_num, abuf,
428 sizeof(is->files[cat].alloc_entries_num));
429 assert (is->files[cat].alloc_entries_num > 0);
431 assert (is->files[cat].alloc_entries_num <= is->files[cat].alloc_entries_max);
432 if (is->files[cat].alloc_entries_num == is->files[cat].alloc_entries_max)
435 memcpy (abuf, &is->files[cat].alloc_entries_num, sizeof(int));
436 bf_write (is->files[cat].bf, block, 0, 0, abuf);
437 is->files[cat].alloc_entries_num = 0;
439 if (!is->files[cat].alloc_entries_num) /* make new buffer? */
441 memcpy (abuf + sizeof(int), &block, sizeof(int));
442 is->files[cat].head.freelist = pos;
443 is->files[cat].head_is_dirty = 1;
447 memcpy (abuf + sizeof(int) +
448 is->files[cat].alloc_entries_num*sizeof(int),
451 is->files[cat].alloc_entries_num++;
454 static void flush_block (ISAMD is, int cat)
456 char *abuf = is->files[cat].alloc_buf;
460 static int alloc_block (ISAMD is, int cat)
463 char buf[sizeof(int)];
465 is->files[cat].head_is_dirty = 1;
466 (is->files[cat].no_allocated)++;
467 if ((block = is->files[cat].head.freelist))
469 bf_read (is->files[cat].bf, block, 0, sizeof(int), buf);
470 memcpy (&is->files[cat].head.freelist, buf, sizeof(int));
473 block = (is->files[cat].head.lastblock)++;
477 static void release_block (ISAMD is, int cat, int pos)
479 char buf[sizeof(int)];
481 (is->files[cat].no_released)++;
482 is->files[cat].head_is_dirty = 1;
483 memcpy (buf, &is->files[cat].head.freelist, sizeof(int));
484 is->files[cat].head.freelist = pos;
485 bf_write (is->files[cat].bf, pos, 0, sizeof(int), buf);
489 int isamd_alloc_block (ISAMD is, int cat)
493 if (is->files[cat].fc_list)
496 for (j = 0; j < is->files[cat].fc_max; j++)
497 if ((nb = is->files[cat].fc_list[j]) && (!block || nb < block))
499 is->files[cat].fc_list[j] = 0;
505 block = alloc_block (is, cat);
506 if (is->method->debug > 4)
507 logf (LOG_LOG, "isamd: alloc_block in cat %d: %d", cat, block);
511 void isamd_release_block (ISAMD is, int cat, int pos)
513 if (is->method->debug > 4)
514 logf (LOG_LOG, "isamd: release_block in cat %d: %d", cat, pos);
517 if (is->files[cat].fc_list)
520 for (j = 0; j<is->files[cat].fc_max; j++)
521 if (!is->files[cat].fc_list[j])
523 is->files[cat].fc_list[j] = pos;
527 release_block (is, cat, pos);
530 static void init_fc (ISAMD is, int cat)
534 is->files[cat].fc_max = j;
535 is->files[cat].fc_list = (int *)
536 xmalloc (sizeof(*is->files[0].fc_list) * j);
538 is->files[cat].fc_list[j] = 0;
541 static void release_fc (ISAMD is, int cat)
543 int b, j = is->files[cat].fc_max;
546 if ((b = is->files[cat].fc_list[j]))
548 release_block (is, cat, b);
549 is->files[cat].fc_list[j] = 0;
553 void isamd_pp_close (ISAMD_PP pp)
557 (*is->method->code_stop)(ISAMD_DECODE, pp->decodeClientData);
558 isamd_free_diffs(pp); /* see merge-d.h */
559 if (is->method->debug > 5)
560 logf (LOG_LOG, "isamd_pp_close %p %d=%d:%d sz=%d n=%d=%d:%d nk=%d",
561 pp, isamd_addr(pp->pos, pp->cat), pp->cat, pp->pos, pp->size,
562 pp->next, isamd_type(pp->next), isamd_block(pp->next),
569 ISAMD_PP isamd_pp_create (ISAMD is, int cat)
570 /* creates a pp_buff without data in it. pos=0, cat as given */
572 ISAMD_PP pp = (ISAMD_PP) xmalloc (sizeof(*pp));
573 int sz = is->method->filecat[is->max_cat].bsize;
576 pp->buf = (char *) xmalloc (sz);
577 memset(pp->buf,'\0',sz); /* clear the buffer, for new blocks */
586 pp->decodeClientData = (*is->method->code_start)(ISAMD_DECODE);
595 ISAMD_PP isamd_pp_open (ISAMD is, const char *dictbuf, int dictlen)
598 ISAMD_PP pp = (ISAMD_PP) xmalloc (sizeof(*pp));
600 int sz = is->method->filecat[is->max_cat].bsize;
601 /* always allocate for the largest blocks, saves trouble */
605 src = pp->buf = (char *) xmalloc (sz);
606 memset(src,'\0',sz); /* clear the buffer, for new blocks */
615 pp->decodeClientData = (*is->method->code_start)(ISAMD_DECODE);
617 dictnum=*dictbuf; /* numkeys for internals, 0 for externals */
621 memcpy(&ipos, dictbuf+1, sizeof(ISAMD_P) );
623 else /* dictionary block, fake a real one */
627 if (is->method->debug > 5)
628 logf (LOG_LOG, "isamd_pp_open dict");
629 pp->numKeys=(unsigned char) dictbuf[0];
630 memcpy(pp->buf+ISAMD_BLOCK_OFFSET_1, dictbuf+1,dictlen-1);
631 pp->size=pp->offset=dictlen+ISAMD_BLOCK_OFFSET_1-1;
636 pp->cat = isamd_type(ipos);
637 pp->pos = isamd_block(ipos);
645 isamd_read_block (is, pp->cat, pp->pos, src);
646 memcpy (&pp->next, src, sizeof(pp->next));
647 src += sizeof(pp->next);
648 memcpy (&pp->size, src, sizeof(pp->size));
649 src += sizeof(pp->size);
650 memcpy (&pp->numKeys, src, sizeof(pp->numKeys));
651 src += sizeof(pp->numKeys);
652 assert (pp->next != isamd_addr(pp->pos,pp->cat));
653 pp->offset = src - pp->buf;
654 assert (pp->offset == ISAMD_BLOCK_OFFSET_1);
655 assert(pp->size>=ISAMD_BLOCK_OFFSET_1); /*??*/
657 is->files[pp->cat].no_op_main++;
659 is->files[pp->cat].no_op_diffonly++;
661 if (is->method->debug > 5)
662 logf (LOG_LOG, "isamd_pp_open %p %d=%d:%d sz=%d n=%d=%d:%d",
663 pp, isamd_addr(pp->pos, pp->cat), pp->cat, pp->pos, pp->size,
664 pp->next, isamd_type(pp->next), isamd_block(pp->next) );
671 void isamd_buildfirstblock(ISAMD_PP pp){
674 assert(pp->next != isamd_addr(pp->pos,pp->cat));
675 memcpy(dst, &pp->next, sizeof(pp->next) );
676 dst += sizeof(pp->next);
677 memcpy(dst, &pp->size,sizeof(pp->size));
678 dst += sizeof(pp->size);
679 memcpy(dst, &pp->numKeys, sizeof(pp->numKeys));
680 dst += sizeof(pp->numKeys);
681 assert (dst - pp->buf == ISAMD_BLOCK_OFFSET_1);
682 if (pp->is->method->debug > 5)
683 logf (LOG_LOG, "isamd: bldfirst: p=%d=%d:%d n=%d:%d:%d sz=%d nk=%d ",
684 isamd_addr(pp->pos,pp->cat),pp->cat, pp->pos,
685 pp->next, isamd_type(pp->next), isamd_block(pp->next),
686 pp->size, pp->numKeys);
689 void isamd_buildlaterblock(ISAMD_PP pp){
692 assert(pp->next != isamd_addr(pp->pos,pp->cat));
693 memcpy(dst, &pp->next, sizeof(pp->next) );
694 dst += sizeof(pp->next);
695 memcpy(dst, &pp->size,sizeof(pp->size));
696 dst += sizeof(pp->size);
697 assert (dst - pp->buf == ISAMD_BLOCK_OFFSET_N);
698 if (pp->is->method->debug > 5)
699 logf (LOG_LOG, "isamd: l8r: sz=%d p=%d/%d>%d/%d",
702 isamd_block(pp->next), isamd_type(pp->next) );
707 /* returns non-zero if item could be read; 0 otherwise */
708 int isamd_pp_read (ISAMD_PP pp, void *buf)
711 return isamd_read_item (pp, (char **) &buf);
712 /* note: isamd_read_item is in merge-d.c, because it is so */
713 /* convoluted with the merge process */
716 /* read one main item from file - decode and store it in *dst.
717 Does not worry about diffs
720 1 if item could be read ok
722 int isamd_read_main_item (ISAMD_PP pp, char **dst)
725 char *src = pp->buf + pp->offset;
729 if (pp->offset >= pp->size)
734 return 0; /* end of file */
736 if (pp->next > pp->pos)
738 if (pp->next == pp->pos + 1)
739 is->files[pp->cat].no_next++;
742 is->files[pp->cat].no_forward++;
743 is->files[pp->cat].sum_forward += pp->next - pp->pos;
748 if (pp->next + 1 == pp->pos)
749 is->files[pp->cat].no_prev++;
752 is->files[pp->cat].no_backward++;
753 is->files[pp->cat].sum_backward += pp->pos - pp->next;
756 /* out new block position */
757 newcat = isamd_type(pp->next);
758 pp->pos = isamd_block(pp->next);
759 pp->cat = isamd_type(pp->next);
760 pp->is->no_read_main++;
762 /* read block and save 'next' and 'size' entry */
763 isamd_read_block (is, pp->cat, pp->pos, src);
764 memcpy (&pp->next, src, sizeof(pp->next));
765 src += sizeof(pp->next);
766 memcpy (&pp->size, src, sizeof(pp->size));
767 src += sizeof(pp->size);
768 /* assume block is non-empty */
769 pp->offset = oldoffs = src - pp->buf;
770 assert (pp->offset == ISAMD_BLOCK_OFFSET_N);
771 assert (pp->next != isamd_addr(pp->pos,pp->cat));
772 (*is->method->code_reset)(pp->decodeClientData);
773 /* finally, read the item */
774 (*is->method->code_item)(ISAMD_DECODE, pp->decodeClientData, dst, &src);
775 pp->offset = src - pp->buf;
776 if (is->method->debug > 8)
777 logf (LOG_LOG, "isamd: read_m: block %d:%d sz=%d ofs=%d-%d next=%d",
778 pp->cat, pp->pos, pp->size, oldoffs, pp->offset, pp->next);
782 (*is->method->code_item)(ISAMD_DECODE, pp->decodeClientData, dst, &src);
783 pp->offset = src - pp->buf;
784 if (is->method->debug > 8)
785 logf (LOG_LOG, "isamd: read_m: got %d:%d sz=%d ofs=%d-%d next=%d",
786 pp->cat, pp->pos, pp->size, oldoffs, pp->offset, pp->next);
790 int isamd_pp_num (ISAMD_PP pp)
797 static char *hexdump(unsigned char *p, int len, char *buff) {
798 static char localbuff[128];
800 if (!buff) buff=localbuff;
803 sprintf(bytebuff,"%02x",*p);
805 strcat(buff,bytebuff);
806 if (len) strcat(buff," ");
813 /* needs different arguments, or something */
814 void isamd_pp_dump (ISAMD is, ISAMD_P ipos)
825 int olddebug= is->method->debug;
826 is->method->debug=0; /* no debug logs while reading for dump */
828 logf(LOG_LOG,"dumping isamd block %d (%d:%d)",
829 (int)ipos, isamd_type(ipos), isamd_block(ipos) );
830 pp=isamd_pp_open(is,ipos);
831 logf(LOG_LOG,"numKeys=%d, ofs=%d sz=%d",
832 pp->numKeys, pp->offset, pp->size );
833 diffidx=oldoffs= pp->offset;
834 while ((diffidx < is->method->filecat[pp->cat].bsize) && (diffmax>0))
836 memcpy(&diffmax,&(pp->buf[diffidx]),sizeof(int));
837 logf (LOG_LOG,"diff set at %d-%d: %s", diffidx, diffmax,
838 hexdump(pp->buf+diffidx,8,0));
839 /*! todo: dump the actual diffs as well !!! */
843 while(isamd_pp_read(pp, &key))
845 if (oldaddr != isamd_addr(pp->pos,pp->cat) )
847 oldaddr = isamd_addr(pp->pos,pp->cat);
848 logf(LOG_LOG,"block %d=%d:%d sz=%d nx=%d=%d:%d ofs=%d",
849 isamd_addr(pp->pos,pp->cat), pp->cat, pp->pos,
851 pp->next, isamd_type(pp->next), isamd_block(pp->next),
857 logf(LOG_LOG," %05x: %s",i,hexdump(pp->buf+i,n,hexbuff));
860 if (oldoffs > ISAMD_BLOCK_OFFSET_N)
861 oldoffs=ISAMD_BLOCK_OFFSET_N;
864 logf (LOG_LOG," got %d:%d=%x:%x from %s at %d=%x",
865 key.sysno, key.seqno,
866 key.sysno, key.seqno,
867 hexdump(pp->buf+oldoffs, pp->offset-oldoffs, hexbuff),
869 oldoffs = pp->offset;
871 /*!*/ /*TODO: dump diffs too!!! */
873 is->method->debug=olddebug;