diff --git a/alpha/apps/kaltura/lib/db/DbManager.php b/alpha/apps/kaltura/lib/db/DbManager.php index eca4f0340ca..5fdc587c22d 100644 --- a/alpha/apps/kaltura/lib/db/DbManager.php +++ b/alpha/apps/kaltura/lib/db/DbManager.php @@ -232,13 +232,25 @@ protected static function getSphinxConnIndexByLastUpdatedAt($dataSources) } protected static function getStickySessionKey() + { + $stickySession = self::getKsPrivilegeStickySessionKey(); + + if(!$stickySession) + { + $stickySession = self::STICKY_SESSION_PREFIX . infraRequestUtils::getRemoteAddress(); + } + + return $stickySession; + } + + protected static function getKsPrivilegeStickySessionKey() { $ksObject = kCurrentContext::$ks_object; - - if($ksObject && $ksObject->hasPrivilege(kSessionBase::PRIVILEGE_SESSION_KEY)) + + if($ksObject && $ksObject->hasPrivilege(kSessionBase::PRIVILEGE_SESSION_KEY)) return self::STICKY_SESSION_PREFIX . kCurrentContext::getCurrentPartnerId() . "_" . $ksObject->getPrivilegeValue(kSessionBase::PRIVILEGE_SESSION_KEY); - return self::STICKY_SESSION_PREFIX . infraRequestUtils::getRemoteAddress(); + return null; } /** @@ -284,7 +296,8 @@ public static function getSphinxConnection($read = true, $indexName = null) KalturaLog::debug("Actual sphinx index [". self::$connIndexes[$indexName]. "] sphinx index by best lag [" . $preferredIndex. "]"); } - if (!$read) + $sphinxStickyPartnerIds = kConf::get('sphinx_sticky_partners', 'sphinx_dynamic_config', array()); + if (!$read || (self::getKsPrivilegeStickySessionKey() && in_array(kCurrentContext::getCurrentPartnerId(), $sphinxStickyPartnerIds)) ) self::setSphinxConnIndexInCache($indexName); return self::$sphinxConnection[$indexName]; } diff --git a/release-notes.md b/release-notes.md index 3ffb5b93faa..7598e779f40 100644 --- a/release-notes.md +++ b/release-notes.md @@ -1,3 +1,23 @@ +# Orion 15.18.0 # + +## Support sphinx sticky connection for read operations ## +Issue Type: Task +Issue ID : PLAT-10713 + +### Configuration ## + * Make sure "sphinx_dynamic_config" exists in your configuration maps + + * To enable the feature for specific partner ids add the following section to the map: + [sphinx_sticky_partners] + 0 = XXXX + 1 = YYYY + where XXXX and YYYY are the partner ids you want to enable the feature for. + + +#### Deployment Scripts #### +None. + + # Orion 15.17.0 # ## Allow catalog item pricing view from KMC ##