Bug fix: result sets weren't deleted after server shut down.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: index.h,v $
- * Revision 1.46 1996-11-08 11:10:19 adam
+ * Revision 1.47 1996-12-23 15:30:44 adam
+ * Work on truncation.
+ * Bug fix: result sets weren't deleted after server shut down.
+ *
+ * Revision 1.46 1996/11/08 11:10:19 adam
* Buffers used during file match got bigger.
* Compressed ISAM support everywhere.
* Bug fixes regarding masking characters in queries.
void key_open (int mem);
int key_close (void);
int key_compare (const void *p1, const void *p2);
+int key_compare_it (const void *p1, const void *p2);
int key_qsort_compare (const void *p1, const void *p2);
void key_logdump (int mask, const void *p);
void inv_prstat (void);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: kcompare.c,v $
- * Revision 1.19 1996-12-11 12:08:00 adam
+ * Revision 1.20 1996-12-23 15:30:44 adam
+ * Work on truncation.
+ * Bug fix: result sets weren't deleted after server shut down.
+ *
+ * Revision 1.19 1996/12/11 12:08:00 adam
* Added better compression.
*
* Revision 1.18 1996/10/29 14:09:44 adam
logf (logmask, "%7d s=%-4d", key.sysno, key.seqno);
}
+int key_compare_it (const void *p1, const void *p2)
+{
+ if (((struct it_key *) p1)->sysno != ((struct it_key *) p2)->sysno)
+ {
+ if (((struct it_key *) p1)->sysno > ((struct it_key *) p2)->sysno)
+ return 2;
+ else
+ return -2;
+ }
+ if (((struct it_key *) p1)->seqno != ((struct it_key *) p2)->seqno)
+ {
+ if (((struct it_key *) p1)->seqno > ((struct it_key *) p2)->seqno)
+ return 1;
+ else
+ return -1;
+ }
+ return 0;
+}
+
int key_compare (const void *p1, const void *p2)
{
struct it_key i1, i2;
else
return -2;
}
-#if IT_KEY_HAVE_SEQNO
if (i1.seqno != i2.seqno)
{
if (i1.seqno > i2.seqno)
else
return -1;
}
-#else
- if (i1.freq != i2.freq)
- {
- if (i1.freq > i2.freq)
- return 1;
- else
- return -1;
- }
-#endif
return 0;
}
c = (c << 8) + *(*src)++;
return c;
}
-#if 1
+
static void iscz1_code_item (int mode, void *vp, char **dst, char **src)
{
struct iscz1_code_info *p = vp;
(*dst) += sizeof(struct it_key);
}
}
-#else
-static void iscz1_code_item (int mode, void *vp, char **dst, char **src)
-{
- struct iscz1_code_info *p = vp;
- struct it_key tkey;
- int d;
-
- if (mode == ISAMC_ENCODE)
- {
- memcpy (&tkey, *src, sizeof(struct it_key));
- d = tkey.sysno - p->key.sysno;
- iscz1_encode_int (d, dst);
- if (d)
- {
- p->key.sysno = tkey.sysno;
- p->key.seqno = 0;
- }
- iscz1_encode_int (tkey.seqno - p->key.seqno, dst);
- p->key.seqno = tkey.seqno;
- (*src) += sizeof(struct it_key);
- }
- else
- {
- d = iscz1_decode_int ((unsigned char **) src);
- if (d)
- {
- p->key.sysno += d;
- p->key.seqno = 0;
- }
- d = iscz1_decode_int ((unsigned char **) src);
- p->key.seqno += d;
- memcpy (*dst, &p->key, sizeof(struct it_key));
- (*dst) += sizeof(struct it_key);
- }
-}
-#endif
ISAMC_M key_isamc_m (void)
{
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: trunc.c,v $
- * Revision 1.3 1996-12-20 11:07:14 adam
+ * Revision 1.4 1996-12-23 15:30:44 adam
+ * Work on truncation.
+ * Bug fix: result sets weren't deleted after server shut down.
+ *
+ * Revision 1.3 1996/12/20 11:07:14 adam
* Multi-or result set.
*
* Revision 1.2 1996/11/08 11:10:28 adam
#include <rsisamc.h>
#include <rsnull.h>
-#define NEW_TRUNC 0
+#define NEW_TRUNC 1
#if NEW_TRUNC
#include <rsm_or.h>
merge_chunk);
rscur++;
}
- ti = heap_init (rscur, sizeof(struct it_key), key_compare);
+ ti = heap_init (rscur, sizeof(struct it_key), key_compare_it);
for (i = rscur; --i >= 0; )
{
rsfd[i] = rset_open (rset[i], RSETF_READ|RSETF_SORT_SYSNO);
ispt = xmalloc (sizeof(*ispt) * (to-from));
ti = heap_init (to-from, sizeof(struct it_key),
- key_compare);
+ key_compare_it);
for (i = to-from; --i >= 0; )
{
ispt[i] = is_position (zi->isam, isam_p[from+i]);
ispt = xmalloc (sizeof(*ispt) * (to-from));
ti = heap_init (to-from, sizeof(struct it_key),
- key_compare);
+ key_compare_it);
for (i = to-from; --i >= 0; )
{
ispt[i] = isc_pp_open (zi->isamc, isam_p[from+i]);
return rset_create (rset_kind_isamc, &parms);
}
#if NEW_TRUNC
- else if (no < 2000)
+ else if (no < 200)
{
rset_m_or_parms parms;
logf (LOG_LOG, "new_trunc");
parms.key_size = sizeof(struct it_key);
- parms.cmp = key_compare;
+ parms.cmp = key_compare_it;
parms.isc = zi->isamc;
parms.isam_positions = isam_p;
parms.no_isam_positions = no;
+ parms.no_save_positions = 100;
return rset_create (rset_kind_m_or, &parms);
}
#endif
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zrpn.c,v $
- * Revision 1.57 1996-11-11 13:38:02 adam
+ * Revision 1.58 1996-12-23 15:30:45 adam
+ * Work on truncation.
+ * Bug fix: result sets weren't deleted after server shut down.
+ *
+ * Revision 1.57 1996/11/11 13:38:02 adam
* Added proximity support in search.
*
* Revision 1.56 1996/11/08 11:10:32 adam
parms.key_size = sizeof(struct it_key);
parms.max_rec = 100;
- parms.cmp = key_compare;
+ parms.cmp = key_compare_it;
parms.is = zi->isam;
parms.isc = zi->isamc;
parms.no_terms = 0;
exclusion, ordered, relation, distance);
while (more1 && more2)
{
- int cmp = key_compare (&buf1, &buf2);
+ int cmp = key_compare_it (&buf1, &buf2);
if (cmp < -1)
more1 = rset_read (rset1, rsfd1, &buf1);
else if (cmp > 1)
*more = 0;
break;
}
- cmp = key_compare (buf[i], buf[i-1]);
+ cmp = key_compare_it (buf[i], buf[i-1]);
if (cmp > 1)
{
more[i-1] = rset_read (rset[i-1], rsfd[i-1], buf[i-1]);
if (rset_is_ranked(bool_parms.rset_r))
soft = 1;
bool_parms.key_size = sizeof(struct it_key);
- bool_parms.cmp = key_compare;
+ bool_parms.cmp = key_compare_it;
switch (zop->which)
{
rfd = rset_open (*r, RSETF_READ|RSETF_SORT_SYSNO);
while (rset_read (*r, rfd, &key))
{
- logf (LOG_DEBUG, "sysno=%-7d seqno=%d", key.sysno, key.seqno);
if (key.sysno != psysno)
{
- rset_write (w, wfd, &key);
- psysno = key.sysno;
+ if (*count < 400)
+ rset_write (w, wfd, &key);
(*count)++;
+ psysno = key.sysno;
}
kno++;
}
rset_trunc (zi, &scan_info_array[j].list[ptr[j]].isam_p, 1);
bool_parms.key_size = sizeof(struct it_key);
- bool_parms.cmp = key_compare;
+ bool_parms.cmp = key_compare_it;
bool_parms.rset_l = rset;
bool_parms.rset_r = rset2;
&scan_info_array[j].list[before-1-ptr[j]].isam_p, 1);
bool_parms.key_size = sizeof(struct it_key);
- bool_parms.cmp = key_compare;
+ bool_parms.cmp = key_compare_it;
bool_parms.rset_l = rset;
bool_parms.rset_r = rset2;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zserver.c,v $
- * Revision 1.44 1996-12-11 12:08:01 adam
+ * Revision 1.45 1996-12-23 15:30:45 adam
+ * Work on truncation.
+ * Bug fix: result sets weren't deleted after server shut down.
+ *
+ * Revision 1.44 1996/12/11 12:08:01 adam
* Added better compression.
*
* Revision 1.43 1996/11/15 15:03:58 adam
#include <recctrl.h>
#include <dmalloc.h>
+#define USE_TIMES 1
#ifdef __linux__
#define USE_TIMES 1
#endif
{
if (server_info.records)
{
+ resultSetDestroy (&server_info);
dict_close (server_info.dict);
if (server_info.isam)
is_close (server_info.isam);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zserver.h,v $
- * Revision 1.22 1996-11-04 14:07:49 adam
+ * Revision 1.23 1996-12-23 15:30:46 adam
+ * Work on truncation.
+ * Bug fix: result sets weren't deleted after server shut down.
+ *
+ * Revision 1.22 1996/11/04 14:07:49 adam
* Moved truncation code to trunc.c.
*
* Revision 1.21 1996/10/29 14:09:58 adam
ZServerSet *resultSetAdd (ZServerInfo *zi, const char *name,
int ov, RSET rset);
ZServerSet *resultSetGet (ZServerInfo *zi, const char *name);
+void resultSetDestroy (ZServerInfo *zi);
+
ZServerSetSysno *resultSetSysnoGet (ZServerInfo *zi, const char *name,
int num, int *positions);
void resultSetSysnoDel (ZServerInfo *zi, ZServerSetSysno *records, int num);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zsets.c,v $
- * Revision 1.10 1995-10-30 15:08:08 adam
+ * Revision 1.11 1996-12-23 15:30:46 adam
+ * Work on truncation.
+ * Bug fix: result sets weren't deleted after server shut down.
+ *
+ * Revision 1.10 1995/10/30 15:08:08 adam
* Bug fixes.
*
* Revision 1.9 1995/10/17 18:02:14 adam
return NULL;
}
+void resultSetDestroy (ZServerInfo *zi)
+{
+ ZServerSet *s, *s1;
+
+ for (s = zi->sets; s; s = s1)
+ {
+ s1 = s->next;
+ rset_delete (s->rset);
+ xfree (s->name);
+ xfree (s);
+ }
+ zi->sets = NULL;
+}
+
ZServerSetSysno *resultSetSysnoGet (ZServerInfo *zi, const char *name,
int num, int *positions)
{