From 908c8147d8bcef7ed9c84e0c6720a56dd22e6e86 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 8 Feb 2012 20:15:29 +0100 Subject: [PATCH] session_shared: restart (error recovery) configurable Whether a search is restarted on errors or not, is configurable by attribute restart in element resultset in configuration. --- etc/config-shared1.xml | 2 +- src/filter_session_shared.cpp | 12 ++++++++++-- xml/schema/filter_session_shared.rnc | 3 ++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/etc/config-shared1.xml b/etc/config-shared1.xml index 9e6b77e..240eae2 100644 --- a/etc/config-shared1.xml +++ b/etc/config-shared1.xml @@ -20,7 +20,7 @@ - + diff --git a/src/filter_session_shared.cpp b/src/filter_session_shared.cpp index 6066b4a..d733f5e 100644 --- a/src/filter_session_shared.cpp +++ b/src/filter_session_shared.cpp @@ -195,6 +195,7 @@ namespace metaproxy_1 { int m_resultset_max; int m_session_ttl; bool m_optimize_search; + bool m_restart; int m_session_max; }; } @@ -757,9 +758,10 @@ restart: } } - if (!session_restarted && + if (m_p->m_restart && !session_restarted && condition == YAZ_BIB1_TEMPORARY_SYSTEM_ERROR) { + package.log("session_shared", YLOG_LOG, "restart"); bc->remove_backend(found_backend); session_restarted = true; found_backend.reset(); @@ -791,8 +793,9 @@ restart: return; // search error } } - if (!session_restarted && new_set->m_result_set_size < 0) + if (m_p->m_restart && !session_restarted && new_set->m_result_set_size < 0) { + package.log("session_shared", YLOG_LOG, "restart"); bc->remove_backend(found_backend); session_restarted = true; found_backend.reset(); @@ -1066,6 +1069,7 @@ yf::SessionShared::Rep::Rep() m_resultset_max = 10; m_session_ttl = 90; m_optimize_search = true; + m_restart = true; m_session_max = 100; } @@ -1228,6 +1232,10 @@ void yf::SessionShared::configure(const xmlNode *ptr, bool test_only, m_p->m_optimize_search = mp::xml::get_bool(attr->children, true); } + else if (!strcmp((const char *) attr->name, "restart")) + { + m_p->m_restart = mp::xml::get_bool(attr->children, true); + } else throw mp::filter::FilterException( "Bad attribute " + std::string((const char *) diff --git a/xml/schema/filter_session_shared.rnc b/xml/schema/filter_session_shared.rnc index b99ea56..8b09c02 100644 --- a/xml/schema/filter_session_shared.rnc +++ b/xml/schema/filter_session_shared.rnc @@ -9,7 +9,8 @@ filter_session_shared = element mp:resultset { attribute max { xsd:integer }?, attribute ttl { xsd:integer }?, - attribute optimizesearch { xsd:boolean }? + attribute optimizesearch { xsd:boolean }?, + attribute restart { xsd:boolean }? }?, element mp:session { attribute ttl { xsd:integer }?, -- 1.7.10.4