projects
/
pazpar2-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix 'Record Missing' PAZ-903
[pazpar2-moved-to-github.git]
/
src
/
reclists.c
diff --git
a/src/reclists.c
b/src/reclists.c
index
99c033e
..
b16a60e
100644
(file)
--- a/
src/reclists.c
+++ b/
src/reclists.c
@@
-209,27
+209,31
@@
static int reclist_cmp(const void *p1, const void *p2)
return res;
}
return res;
}
-void reclist_limit(struct reclist *l, struct session *se)
+void reclist_limit(struct reclist *l, struct session *se, int lazy)
{
unsigned i;
int num = 0;
struct reclist_bucket **pp = &l->sorted_list;
reclist_enter(l);
{
unsigned i;
int num = 0;
struct reclist_bucket **pp = &l->sorted_list;
reclist_enter(l);
- for (i = 0; i < l->hash_size; i++)
+
+ if (!lazy || !*pp)
{
{
- struct reclist_bucket *p;
- for (p = l->hashtable[i]; p; p = p->hash_next)
+ for (i = 0; i < l->hash_size; i++)
{
{
- if (session_check_cluster_limit(se, p->record))
+ struct reclist_bucket *p;
+ for (p = l->hashtable[i]; p; p = p->hash_next)
{
{
- *pp = p;
- pp = &p->sorted_next;
- num++;
+ if (session_check_cluster_limit(se, p->record))
+ {
+ *pp = p;
+ pp = &p->sorted_next;
+ num++;
+ }
}
}
}
}
+ *pp = 0;
}
}
- *pp = 0;
l->num_records = num;
reclist_leave(l);
}
l->num_records = num;
reclist_leave(l);
}
@@
-362,21
+366,20
@@
struct record_cluster *reclist_insert(struct reclist *l,
// We found a matching record. Merge them
if (!strcmp(merge_key, (*p)->record->merge_key))
{
// We found a matching record. Merge them
if (!strcmp(merge_key, (*p)->record->merge_key))
{
- struct record_cluster *existing = (*p)->record;
- struct record *re = existing->records;
+ struct record **re;
- for (; re; re = re->next)
+ cluster = (*p)->record;
+ for (re = &cluster->records; *re; re = &(*re)->next)
{
{
- if (re->client == record->client &&
- record_compare(record, re, service))
+ if ((*re)->client == record->client &&
+ record_compare(record, *re, service))
{
yaz_mutex_leave(l->mutex);
return 0;
}
}
{
yaz_mutex_leave(l->mutex);
return 0;
}
}
- record->next = existing->records;
- existing->records = record;
- cluster = existing;
+ *re = record;
+ record->next = 0;
break;
}
}
break;
}
}
@@
-411,6
+414,7
@@
struct record_cluster *reclist_insert(struct reclist *l,
/* attach to hash list */
*p = new;
l->num_records++;
/* attach to hash list */
*p = new;
l->num_records++;
+ l->sorted_list = l->sorted_ptr = 0;
}
yaz_mutex_leave(l->mutex);
return cluster;
}
yaz_mutex_leave(l->mutex);
return cluster;