monitoring/IdoQuery:

IDO version is cached in a session namespace. This fails where you
are using multiple IDO backends with different versions. We still have
no backend-specific base class where we could handle this, so for now
I continue to do so in the IdoQuery.

This patch creates one namespace per Host/dbname combination.
This commit is contained in:
Thomas Gelf 2014-05-28 09:39:38 +00:00
parent f790e0c323
commit 7a0173e2fb
1 changed files with 3 additions and 1 deletions

View File

@ -599,11 +599,13 @@ abstract class IdoQuery extends Query
protected function getIdoVersion() protected function getIdoVersion()
{ {
if (self::$idoVersion === null) { if (self::$idoVersion === null) {
$dbconf = $this->db->getConfig();
$id = $dbconf['host'] . '/' . $dbconf['dbname'];
$session = null; $session = null;
if (Icinga::app()->isWeb()) { if (Icinga::app()->isWeb()) {
// TODO: Once we have version per connection we should choose a // TODO: Once we have version per connection we should choose a
// namespace based on resource name // namespace based on resource name
$session = Session::getSession()->getNamespace('monitoring/ido'); $session = Session::getSession()->getNamespace('monitoring/ido/' . $id);
if (isset($session->version)) { if (isset($session->version)) {
self::$idoVersion = $session->version; self::$idoVersion = $session->version;
return self::$idoVersion; return self::$idoVersion;