+--- 2.0.38 2009/06/19
+
+Improved estimated hits for AND operation (bug #2907)
+
+Fixed problem with register area growing after "drop DB". (bug #2913).
+
--- 2.0.37 2009/05/18
Example with marc21 is now installed and part of packages.
dnl Copyright (C) 1994-2009 Index Data
dnl
AC_PREREQ(2.60)
-AC_INIT([idzebra],[2.0.37],[zebra-help@indexdata.dk])
+AC_INIT([idzebra],[2.0.38],[zebra-help@indexdata.dk])
AC_CONFIG_SRCDIR(configure.ac)
AC_CONFIG_AUX_DIR(config)
AM_INIT_AUTOMAKE([1.9])
+idzebra (2.0.38-1indexdata) unstable; urgency=low
+
+ * Upstream.
+
+ -- Adam Dickmeiss <adam@indexdata.dk> Fri, 19 Jun 2009 21:31:41 +0200
+
idzebra (2.0.37-1indexdata) unstable; urgency=low
* Upstream.
#define ZEBRA_CHECK_HANDLE(zh) if (zebra_check_handle(zh) != ZEBRA_OK) return ZEBRA_FAIL
-static void zebra_chdir(ZebraService zs)
+static int zebra_chdir(ZebraService zs)
{
const char *dir ;
+ int r;
ASSERTZS;
yaz_log(log_level, "zebra_chdir");
dir = res_get(zs->global_res, "chdir");
if (!dir)
- return;
+ return 0;
yaz_log(YLOG_DEBUG, "chdir %s", dir);
#ifdef WIN32
- _chdir(dir);
+ r = _chdir(dir);
#else
- chdir(dir);
+ r = chdir(dir);
#endif
+ if (r)
+ yaz_log(YLOG_FATAL|YLOG_ERRNO, "chdir %s", dir);
+ return r;
}
static ZEBRA_RES zebra_flush_reg(ZebraHandle zh)
zh->global_res = res;
zh->sessions = 0;
- zebra_chdir(zh);
+ if (zebra_chdir(zh))
+ {
+ xfree(zh);
+ return 0;
+ }
zebra_mutex_cond_init(&zh->session_lock);
passwd_plain = res_get(zh->global_res, "passwd");
int record_compression = REC_COMPRESS_NONE;
const char *recordCompression = 0;
const char *profilePath;
- char cwd[1024];
int sort_type = ZEBRA_SORT_TYPE_FLAT;
ZEBRA_RES ret = ZEBRA_OK;
}
}
- getcwd(cwd, sizeof(cwd)-1);
profilePath = res_get_def(res, "profilePath", 0);
data1_set_tabpath(reg->dh, profilePath);
if (f)
{
- fscanf(f, "%c %d", val, seqno);
+ if (fscanf(f, "%c %d", val, seqno) != 2)
+ {
+ yaz_log(YLOG_ERRNO|YLOG_WARN, "fscan fail %s",
+ state_fname);
+ }
fclose(f);
}
xfree(fname);
char pidstr[30];
sprintf(pidstr, "%ld", (long) getpid());
- write(fd, pidstr, strlen(pidstr));
+ if (write(fd, pidstr, strlen(pidstr)) != strlen(pidstr))
+ {
+ yaz_log(YLOG_ERRNO|YLOG_FATAL, "write fail %s", pidfname);
+ exit(1);
+ }
}
}
#endif
zint block_no;
block_no = b->file[cat].head.last_block++;
p->pos = block_no * CAT_MAX + cat;
+ if (b->log_freelist)
+ yaz_log(b->log_freelist, "got block "
+ ZINT_FORMAT " from last %d:" ZINT_FORMAT, p->pos,
+ cat, p->pos/CAT_MAX);
}
else
{
zebra_exit("isamb:new_block");
}
}
- yaz_log(b->log_freelist, "got block " ZINT_FORMAT " from freelist %d:" ZINT_FORMAT, p->pos,
- cat, p->pos/CAT_MAX);
+ if (b->log_freelist)
+ yaz_log(b->log_freelist, "got block "
+ ZINT_FORMAT " from freelist %d:" ZINT_FORMAT, p->pos,
+ cat, p->pos/CAT_MAX);
memcpy(&b->file[cat].head.free_list, p->buf, sizeof(zint));
}
p->cat = cat;
p->pos, p->cat, p->pos/CAT_MAX);
memcpy(p->buf, &b->file[p->cat].head.free_list, sizeof(zint));
b->file[p->cat].head.free_list = p->pos;
+ b->file[p->cat].head_dirty = 1;
if (!cache_block(b, p->pos, p->buf, 1))
{
yaz_log(b->log_io, "bf_write: close_block (deleted)");
const void *untilbuf);
static int r_forward_or(RSFD rfd, void *buf, TERMID *term,
const void *untilbuf);
-static void r_pos (RSFD rfd, double *current, double *total);
+static void r_pos_and(RSFD rfd, double *current, double *total);
+static void r_pos_or(RSFD rfd, double *current, double *total);
static void r_get_terms(RSET ct, TERMID *terms, int maxterms, int *curterm);
static const struct rset_control control_or =
r_open_or,
r_close,
r_forward_or,
- r_pos,
+ r_pos_or,
r_read_or,
r_write,
};
r_open_and,
r_close,
r_forward_and,
- r_pos,
+ r_pos_and,
r_read_and,
r_write,
};
}
if (p->skip)
continue; /* skip again.. eventually tailcount will be 0 */
- (p->hits)++;
+ if (p->tailcount == 0)
+ (p->hits)++;
return 1;
}
/* not tailing, forward until all records match, and set up */
return r_read_and(rfd,buf,term);
}
-static void r_pos (RSFD rfd, double *current, double *total)
+static void r_pos_x(RSFD rfd, double *current, double *total, int and_op)
{
RSET ct = rfd->rset;
struct rfd_private *mrfd =
(struct rfd_private *)(rfd->priv);
- double cur, tot;
- double scur = 0.0, stot = 0.0;
+ double ratio = and_op ? 0.0 : 1.0;
int i;
for (i = 0; i<ct->no_children; i++){
+ double nratio, cur, tot;
rset_pos(mrfd->items[i].fd, &cur, &tot);
- yaz_log(log_level, "r_pos: %d %0.1f %0.1f", i, cur,tot);
- scur += cur;
- stot += tot;
+ yaz_log(log_level, "r_pos: %d %0.1f %0.1f", i, cur,tot);
+
+ nratio = cur / tot;
+ if (and_op)
+ {
+ if (nratio > ratio)
+ ratio = nratio;
+ }
+ else
+ {
+ if (nratio < ratio)
+ ratio = nratio;
+ }
}
- if (stot < 1.0) { /* nothing there */
+ if (ratio == 0.0 || ratio == 1.0) { /* nothing there */
*current = 0;
*total = 0;
yaz_log(log_level, "r_pos: NULL %0.1f %0.1f", *current, *total);
else
{
*current = (double) (mrfd->hits);
- *total = *current*stot/scur;
+ *total = *current / ratio;
yaz_log(log_level, "r_pos: = %0.1f %0.1f", *current, *total);
}
}
+static void r_pos_and(RSFD rfd, double *current, double *total)
+{
+ r_pos_x(rfd, current, total, 1);
+}
+
+static void r_pos_or(RSFD rfd, double *current, double *total)
+{
+ r_pos_x(rfd, current, total, 0);
+}
+
static int r_write (RSFD rfd, const void *buf)
{
yaz_log (YLOG_FATAL, "multior set type is read-only");