MXS-3892: Limit concurrent mapping of databases

As there are no practical benefits to multiple sessions for the same user
mapping the databases at the same time, limiting them to one update per
user is sensible. This is especially true now that we know the
information_schema tables aren't the most efficient things in the world.

The current code implements this rate limiting by closing any extra
sessions that would start a second update. The final implementation should
suspend them for the duration of the update as it is far more
user-friendly.

The limits are currently global as the shard caches are also global. This
is a performance bottleneck and it could be solved by storing the shard
cache inside of a mxs::WorkerGlobal instead of having it as a global
cache.
This commit is contained in:
Markus Mäkelä
2021-12-23 08:44:29 +02:00
parent d57de28199
commit 41c2a6ee8e
4 changed files with 92 additions and 5 deletions

View File

@ -160,6 +160,7 @@ private:
SSRBackendList m_backends; /**< Backend references */
SConfig m_config; /**< Session specific configuration */
SchemaRouter* m_router; /**< The router instance */
std::string m_key; /**< Shard cache key */
Shard m_shard; /**< Database to server mapping */
std::string m_connect_db; /**< Database the user was trying to connect to */
std::string m_current_db; /**< Current active database */