X-Git-Url: http://git.indexdata.com/?p=pazpar2-moved-to-github.git;a=blobdiff_plain;f=src%2Fsession.c;h=f597d7c0ed7bdc169e272949f2ecc6a7cd25885a;hp=4145974f734162d243c61f026d5c567fbf27c135;hb=HEAD;hpb=c05775cf4c75542f765440c701be929160dc3e5d diff --git a/src/session.c b/src/session.c index 4145974..f597d7c 100644 --- a/src/session.c +++ b/src/session.c @@ -113,7 +113,7 @@ static int session_use(int delta) return sessions; } -int sessions_count(void) +int sessions_get_count(void) { return session_use(0); } @@ -834,7 +834,11 @@ enum pazpar2_error_code session_search(struct session *se, int no_sortmap = 0; struct client_list *l; - session_log(se, YLOG_DEBUG, "Search"); + session_log(se, YLOG_LOG, "search query %s", query); + if (filter) + session_log(se, YLOG_LOG, "search filter %s", filter); + if (limit) + session_log(se, YLOG_LOG, "search limit %s", limit); *addinfo = 0; @@ -920,8 +924,9 @@ enum pazpar2_error_code session_search(struct session *se, no_working++; } } - yaz_log(YLOG_LOG, "session_search: no_working=%d no_sortmap=%d", - no_working, no_sortmap); + session_log(se, YLOG_LOG, "search " + "working %d sortmap %d failed-query %d failed-limit %d", + no_working, no_sortmap, no_failed_query, no_failed_limit); session_enter(se, "session_search2"); if (no_working == 1 && no_sortmap == 1) { @@ -1048,9 +1053,17 @@ void session_apply_setting(struct session *se, const char *dbname, void session_destroy(struct session *se) { struct session_database *sdb; - int i = session_use(-1); - - session_log(se, YLOG_LOG, "destroy %d", i); + struct facet_id *t; + int sessions_total = session_use(-1); + int no_facet_ids = 0; + + for (t = se->facet_id_list; t; t = t->next) + no_facet_ids++; + session_log(se, YLOG_LOG, "destroy " + "session-total %d nmem-op %zd nmem-ses %zd facets-ids %d", + sessions_total, + nmem_total(se->nmem), nmem_total(se->session_nmem), + no_facet_ids); session_remove_cached_clients(se); for (sdb = se->databases; sdb; sdb = sdb->next) @@ -1060,10 +1073,6 @@ void session_destroy(struct session *se) reclist_destroy(se->reclist); xfree(se->mergekey); xfree(se->rank); - if (nmem_total(se->nmem)) - session_log(se, YLOG_DEBUG, "NMEN operation usage %zd", nmem_total(se->nmem)); - if (nmem_total(se->session_nmem)) - session_log(se, YLOG_DEBUG, "NMEN session usage %zd", nmem_total(se->session_nmem)); facet_limits_destroy(se->facet_limits); nmem_destroy(se->nmem); service_destroy(se->service); @@ -1081,8 +1090,8 @@ size_t session_get_memory_status(struct session *session) { } -struct session *new_session(NMEM nmem, struct conf_service *service, - unsigned session_id) +struct session *session_create(NMEM nmem, struct conf_service *service, + unsigned session_id) { int i; struct session *session = nmem_malloc(nmem, sizeof(*session)); @@ -1124,7 +1133,7 @@ struct session *new_session(NMEM nmem, struct conf_service *service, pazpar2_mutex_create(&session->session_mutex, tmp_str); i = session_use(1); - session_log(session, YLOG_LOG, "create %d", i); + session_log(session, YLOG_LOG, "create session-total %d", i); return session; } @@ -2186,6 +2195,8 @@ static int ingest_to_cluster(struct client *cl, if (!value0 || !*value0) { const char *empty = yaz_xml_get_prop(n, "empty"); + if (value0) + xmlFree(value0); if (!empty) continue; wrbuf_puts(wrbuf_disp, (const char *) empty); @@ -2193,9 +2204,8 @@ static int ingest_to_cluster(struct client *cl, else { wrbuf_puts(wrbuf_disp, (const char *) value0); - } - if (value0) xmlFree(value0); + } ser_md = &service->metadata[md_field_id]; // non-merged metadata