X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=bfile%2Fcfile.c;h=c5b190e23e6f3a03659e403c4952c2ba5c730cf9;hb=0f563f23506dabd7c84bdb750d4539b2b6cacf02;hp=47740724da1554d7c7642c5a0829350c5e4dca15;hpb=0f78f3fe78e859d9f0d3f0d3e13fcd28085dd427;p=idzebra-moved-to-github.git diff --git a/bfile/cfile.c b/bfile/cfile.c index 4774072..c5b190e 100644 --- a/bfile/cfile.c +++ b/bfile/cfile.c @@ -1,5 +1,5 @@ -/* $Id: cfile.c,v 1.39 2006-11-14 08:12:06 adam Exp $ - Copyright (C) 1995-2006 +/* $Id: cfile.c,v 1.42 2007-01-15 15:10:13 adam Exp $ + Copyright (C) 1995-2007 Index Data ApS This file is part of the Zebra server. @@ -29,6 +29,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "mfile.h" #include "cfile.h" +/* set to 1 if extra commit/shadow check is to be performed */ +#define EXTRA_CHECK 0 + static int write_head(CFile cf) { int left = cf->head.hash_size * sizeof(zint); @@ -86,8 +89,7 @@ CFile cf_open(MFile mf, MFile_area area, const char *fname, /* avoid valgrind warnings, but set to something nasty */ memset(cf, 'Z', sizeof(*cf)); - yaz_log(YLOG_DEBUG, "cf: open %s %s", cf->rmf->name, - wflag ? "rdwr" : "rd"); + yaz_log(YLOG_DEBUG, "cf: open %s %s", fname, wflag ? "rdwr" : "rd"); cf->block_mf = 0; cf->hash_mf = 0; @@ -343,20 +345,19 @@ static int cf_lookup_hash(CFile cf, zint no, zint *vno) } if (hb) continue; -#if 0 - /* extra check ... */ +#if EXTRA_CHECK for (hb = cf->bucket_lru_back; hb; hb = hb->lru_next) { if (hb->ph.this_bucket == block_no) { yaz_log(YLOG_FATAL, "Found hash bucket on other chain(1)"); - abort(); + return -1; } for (i = 0; iph.vno[i]; i++) if (hb->ph.no[i] == no) { yaz_log(YLOG_FATAL, "Found hash bucket on other chain (2)"); - abort(); + return -1; } } #endif @@ -476,14 +477,13 @@ static zint cf_new_hash(CFile cf, zint no) if (hb) continue; -#if 0 - /* extra check ... */ +#if EXTRA_CHECK for (hb = cf->bucket_lru_back; hb; hb = hb->lru_next) { if (hb->ph.this_bucket == *bucketpp) { yaz_log(YLOG_FATAL, "Found hash bucket on other chain"); - abort(); + return 0; } } #endif