From: Adam Dickmeiss Date: Tue, 7 May 2002 11:05:19 +0000 (+0000) Subject: data1 updates. Run number fix X-Git-Tag: ZEBRA.1.3.0~61 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=d57bb162b65a585e0ed3ad319d9673d66bc6d90c;p=idzebra-moved-to-github.git data1 updates. Run number fix --- diff --git a/index/extract.c b/index/extract.c index e82c488..a14b7f5 100644 --- a/index/extract.c +++ b/index/extract.c @@ -3,7 +3,7 @@ * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * - * $Id: extract.c,v 1.118 2002-05-03 13:49:04 adam Exp $ + * $Id: extract.c,v 1.119 2002-05-07 11:05:19 adam Exp $ */ #include #include @@ -564,8 +564,9 @@ static int recordExtract (ZebraHandle zh, if (recordAttr->runNumber == zebraExplain_runNumberIncrement (zh->reg->zei, 0)) { - logf (LOG_LOG, "skipped %s %s " PRINTF_OFF_T, rGroup->recordType, - fname, recordOffset); + yaz_log (LOG_LOG, "run number = %d", recordAttr->runNumber); + yaz_log (LOG_LOG, "skipped %s %s " PRINTF_OFF_T, + rGroup->recordType, fname, recordOffset); extract_flushSortKeys (zh, *sysno, -1, &zh->reg->sortKeys); rec_rm (&rec); logRecord (zh); diff --git a/index/zebraapi.c b/index/zebraapi.c index 58b99be..9a08285 100644 --- a/index/zebraapi.c +++ b/index/zebraapi.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2002, Index Data * All rights reserved. * - * $Id: zebraapi.c,v 1.59 2002-04-26 08:44:47 adam Exp $ + * $Id: zebraapi.c,v 1.60 2002-05-07 11:05:19 adam Exp $ */ #include @@ -37,7 +37,7 @@ static void zebra_chdir (ZebraService zh) static void zebra_flush_reg (ZebraHandle zh) { - zebraExplain_flush (zh->reg->zei, 1, zh); + zebraExplain_flush (zh->reg->zei, zh); extract_flushWriteKeys (zh); zebra_index_merge (zh); @@ -301,7 +301,7 @@ static void zebra_register_close (ZebraService zs, struct zebra_register *reg) zebra_chdir (zs); if (reg->records) { - zebraExplain_close (reg->zei, 0); + zebraExplain_close (reg->zei); dict_close (reg->dict); if (reg->matchDict) dict_close (reg->matchDict); @@ -1101,6 +1101,8 @@ void zebra_end_trans (ZebraHandle zh) yaz_log (LOG_LOG, "zebra_end_trans"); rval = res_get (zh->res, "shadow"); + zebraExplain_runNumberIncrement (zh->reg->zei, 1); + zebra_flush_reg (zh); zebra_register_close (zh->service, zh->reg); diff --git a/index/zinfo.c b/index/zinfo.c index 1deda6f..4e471a6 100644 --- a/index/zinfo.c +++ b/index/zinfo.c @@ -3,7 +3,7 @@ * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * - * $Id: zinfo.c,v 1.28 2002-05-03 13:49:04 adam Exp $ + * $Id: zinfo.c,v 1.29 2002-05-07 11:05:19 adam Exp $ */ #include @@ -78,6 +78,7 @@ struct zebraExplainInfo { int ordinalSU; int runNumber; int dirty; + int write_flag; Records records; data1_handle dh; Res res; @@ -139,12 +140,12 @@ static Record createRecord (Records records, int *sysno) return rec; } -void zebraExplain_flush (ZebraExplainInfo zei, int writeFlag, void *handle) +void zebraExplain_flush (ZebraExplainInfo zei, void *handle) { if (!zei) return; zei->updateHandle = handle; - if (writeFlag) + if (zei->write_flag) { struct zebDatabaseInfoB *zdi; zebAccessObject o; @@ -180,14 +181,14 @@ void zebraExplain_flush (ZebraExplainInfo zei, int writeFlag, void *handle) } } -void zebraExplain_close (ZebraExplainInfo zei, int writeFlag) +void zebraExplain_close (ZebraExplainInfo zei) { #if ZINFO_DEBUG - logf (LOG_LOG, "zebraExplain_close wr=%d", writeFlag); + yaz_log (LOG_LOG, "zebraExplain_close"); #endif if (!zei) return; - zebraExplain_flush (zei, writeFlag, zei->updateHandle); + zebraExplain_flush (zei, zei->updateHandle); nmem_destroy (zei->nmem); } @@ -274,6 +275,7 @@ ZebraExplainInfo zebraExplain_open ( logf (LOG_LOG, "zebraExplain_open wr=%d", writeFlag); #endif zei = (ZebraExplainInfo) nmem_malloc (nmem, sizeof(*zei)); + zei->write_flag = writeFlag; zei->updateHandle = updateHandle; zei->updateFunc = updateFunc; zei->dirty = 0; @@ -395,6 +397,7 @@ ZebraExplainInfo zebraExplain_open ( np = np->child; assert (np && np->which == DATA1N_data); zei->runNumber = atoi_n (np->u.data.data, np->u.data.len); + yaz_log (LOG_LOG, "READ runnumber = %d", zei->runNumber); *zdip = NULL; } rec_rm (&trec); @@ -423,14 +426,10 @@ ZebraExplainInfo zebraExplain_open ( nmem_destroy (zei->nmem); return 0; } - data1_pr_tree (zei->dh, zei->data1_target, stdout); - node_tgtinfo = data1_search_tag (zei->dh, zei->data1_target->child, "targetInfo"); assert (node_tgtinfo); - data1_pr_tree (zei->dh, zei->data1_target, stdout); - zebraExplain_initCommonInfo (zei, node_tgtinfo); zebraExplain_initAccessInfo (zei, node_tgtinfo); @@ -633,7 +632,8 @@ static void zebraExplain_updateCommonInfo (ZebraExplainInfo zei, data1_node *n) { data1_node *c = data1_search_tag (zei->dh, n->child, "commonInfo"); assert (c); - data1_mk_tag_data_text (zei->dh, c, "dateChanged", zei->date, zei->nmem); + data1_mk_tag_data_text_uni (zei->dh, c, "dateChanged", zei->date, + zei->nmem); } static void zebraExplain_initAccessInfo (ZebraExplainInfo zei, data1_node *n) @@ -1307,7 +1307,10 @@ void zebraExplain_recordCountIncrement (ZebraExplainInfo zei, int adjust_num) int zebraExplain_runNumberIncrement (ZebraExplainInfo zei, int adjust_num) { if (adjust_num) + { zei->dirty = 1; + yaz_log (LOG_LOG, "zinfo run number=%d", zei->runNumber+adjust_num); + } return zei->runNumber += adjust_num; } diff --git a/index/zinfo.h b/index/zinfo.h index 4195dd1..b04d9e0 100644 --- a/index/zinfo.h +++ b/index/zinfo.h @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: zinfo.h,v $ - * Revision 1.12 2002-02-20 17:30:01 adam + * Revision 1.13 2002-05-07 11:05:19 adam + * data1 updates. Run number fix + * + * Revision 1.12 2002/02/20 17:30:01 adam * Work on new API. Locking system re-implemented * * Revision 1.11 2001/10/15 19:53:43 adam @@ -64,8 +67,7 @@ ZebraExplainInfo zebraExplain_open (Records records, data1_handle dh, int (*updateFunc)(void *handle, Record drec, data1_node *n)); -void zebraExplain_close (ZebraExplainInfo zei, int writeFlag /*, - int (*updateH)(Record drec, data1_node *n)*/); +void zebraExplain_close (ZebraExplainInfo zei); int zebraExplain_curDatabase (ZebraExplainInfo zei, const char *database); int zebraExplain_newDatabase (ZebraExplainInfo zei, const char *database, int explain_database); @@ -76,8 +78,7 @@ void zebraExplain_recordCountIncrement (ZebraExplainInfo zei, int adjust_num); void zebraExplain_recordBytesIncrement (ZebraExplainInfo zei, int adjust_num); int zebraExplain_runNumberIncrement (ZebraExplainInfo zei, int adjust_num); void zebraExplain_loadAttsets (data1_handle dh, Res res); -void zebraExplain_flush (ZebraExplainInfo zei, int writeFlag, - void *updateHandle); +void zebraExplain_flush (ZebraExplainInfo zei, void *updateHandle); int zebraExplain_lookup_ord (ZebraExplainInfo zei, int ord, const char **db, int *set, int *use); diff --git a/index/zserver.c b/index/zserver.c index 66217cd..4664c56 100644 --- a/index/zserver.c +++ b/index/zserver.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2002, Index Data * All rights reserved. * - * $Id: zserver.c,v 1.87 2002-04-05 08:46:26 adam Exp $ + * $Id: zserver.c,v 1.88 2002-05-07 11:05:19 adam Exp $ */ #include @@ -620,6 +620,12 @@ static void bend_start (struct statserv_options_block *sob) static void bend_stop(struct statserv_options_block *sob) { +#ifdef WIN32 + +#else + if (!sob->inetd) + unlink ("zebrasrv.pid"); +#endif if (sob->handle) { ZebraService service = sob->handle; diff --git a/recctrl/recgrs.c b/recctrl/recgrs.c index d7af403..a779462 100644 --- a/recctrl/recgrs.c +++ b/recctrl/recgrs.c @@ -3,7 +3,10 @@ * All rights reserved. * * $Log: recgrs.c,v $ - * Revision 1.47 2002-05-03 13:50:25 adam + * Revision 1.48 2002-05-07 11:05:20 adam + * data1 updates. Run number fix + * + * Revision 1.47 2002/05/03 13:50:25 adam * data1 cleanup * * Revision 1.46 2002/04/13 18:16:43 adam @@ -769,7 +772,7 @@ static int grs_retrieve(void *clientData, struct recRetrieveCtrl *p) data1_pr_tree (p->dh, node, stdout); #endif logf (LOG_DEBUG, "grs_retrieve: size"); - if ((dnew = data1_mk_tag_data_wd(p->dh, node, node,"size", mem))) + if ((dnew = data1_mk_tag_data_wd(p->dh, node, "size", mem))) { dnew->u.data.what = DATA1I_text; dnew->u.data.data = dnew->lbuf; @@ -779,7 +782,7 @@ static int grs_retrieve(void *clientData, struct recRetrieveCtrl *p) tagname = res_get_def(p->res, "tagrank", "rank"); if (strcmp(tagname, "0") && p->score >= 0 && - (dnew = data1_mk_tag_data_wd(p->dh, node, node, tagname, mem))) + (dnew = data1_mk_tag_data_wd(p->dh, node, tagname, mem))) { logf (LOG_DEBUG, "grs_retrieve: %s", tagname); dnew->u.data.what = DATA1I_num; @@ -790,7 +793,7 @@ static int grs_retrieve(void *clientData, struct recRetrieveCtrl *p) tagname = res_get_def(p->res, "tagsysno", "localControlNumber"); if (strcmp(tagname, "0") && p->localno > 0 && - (dnew = data1_mk_tag_data_wd(p->dh, node, node, tagname, mem))) + (dnew = data1_mk_tag_data_wd(p->dh, node, tagname, mem))) { logf (LOG_DEBUG, "grs_retrieve: %s", tagname); dnew->u.data.what = DATA1I_text; @@ -798,9 +801,9 @@ static int grs_retrieve(void *clientData, struct recRetrieveCtrl *p) sprintf(dnew->u.data.data, "%d", p->localno); dnew->u.data.len = strlen(dnew->u.data.data); } - +#if 0 data1_pr_tree (p->dh, node, stdout); - +#endif if (p->comp && p->comp->which == Z_RecordComp_complex && p->comp->u.complex->generic && p->comp->u.complex->generic->schema) @@ -888,7 +891,7 @@ static int grs_retrieve(void *clientData, struct recRetrieveCtrl *p) } *(p++) = '\0'; - if ((dnew = data1_mk_tag_data_wd(dh, node, node, + if ((dnew = data1_mk_tag_data_wd(dh, node, "schemaIdentifier", mem))) { dnew->u.data.what = DATA1I_oid; diff --git a/recctrl/regxread.c b/recctrl/regxread.c index 9e3c71e..5d9ce2f 100644 --- a/recctrl/regxread.c +++ b/recctrl/regxread.c @@ -2,7 +2,7 @@ * Copyright (C) 1994-2002, Index Data * All rights reserved. * - * $Id: regxread.c,v 1.41 2002-05-03 17:59:17 adam Exp $ + * $Id: regxread.c,v 1.42 2002-05-07 11:05:20 adam Exp $ */ #include #include @@ -672,7 +672,7 @@ static void execData (struct lexSpec *spec, { org_len = 0; - res = data1_mk_node (spec->dh, spec->m, DATA1N_data, parent); + res = data1_mk_node2 (spec->dh, spec->m, DATA1N_data, parent); res->u.data.what = DATA1I_text; res->u.data.len = 0; res->u.data.formatted_text = formatted_text; @@ -762,7 +762,7 @@ static void variantBegin (struct lexSpec *spec, if (parent->which != DATA1N_variant) { - res = data1_mk_node (spec->dh, spec->m, DATA1N_variant, parent); + res = data1_mk_node2 (spec->dh, spec->m, DATA1N_variant, parent); if (spec->d1_stack[spec->d1_level]) tagDataRelease (spec); spec->d1_stack[spec->d1_level] = res; @@ -779,7 +779,7 @@ static void variantBegin (struct lexSpec *spec, logf (LOG_LOG, "variant node (%d)", spec->d1_level); #endif parent = spec->d1_stack[spec->d1_level-1]; - res = data1_mk_node (spec->dh, spec->m, DATA1N_variant, parent); + res = data1_mk_node2 (spec->dh, spec->m, DATA1N_variant, parent); res->u.variant.type = tp; if (value_len >= DATA1_LOCALDATA) @@ -828,7 +828,7 @@ static void tagBegin (struct lexSpec *spec, parent = spec->d1_stack[spec->d1_level -1]; partag = get_parent_tag(spec->dh, parent); - res = data1_mk_node (spec->dh, spec->m, DATA1N_tag, parent); + res = data1_mk_node2 (spec->dh, spec->m, DATA1N_tag, parent); if (len >= DATA1_LOCALDATA) res->u.tag.tag = (char *) nmem_malloc (spec->m, len+1);