Always ignore server-internal databases

The mysql, information_schema and performance_schema databases should
always be ignored if found on multiple servers.
This commit is contained in:
Markus Mäkelä 2019-07-23 09:20:33 +03:00
parent 8e23a6cdb9
commit fbeb5d9c84
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -1192,11 +1192,13 @@ char* get_lenenc_str(void* data)
return rval;
}
static const std::set<std::string> always_ignore = {"mysql", "information_schema", "performance_schema"};
bool SchemaRouterSession::ignore_duplicate_database(const char* data)
{
bool rval = false;
if (m_config->ignored_dbs.find(data) != m_config->ignored_dbs.end())
if (m_config->ignored_dbs.count(data) || always_ignore.count(data))
{
rval = true;
}
@ -1379,8 +1381,7 @@ void SchemaRouterSession::query_databases()
"LEFT JOIN information_schema.tables AS t ON s.schema_name = t.table_schema "
"WHERE t.table_name IS NULL "
"UNION "
"SELECT CONCAT (table_schema, '.', table_name) FROM information_schema.tables "
"WHERE table_schema NOT IN ('information_schema', 'performance_schema', 'mysql');");
"SELECT CONCAT (table_schema, '.', table_name) FROM information_schema.tables");
gwbuf_set_type(buffer, GWBUF_TYPE_COLLECT_RESULT);
for (SSRBackendList::iterator it = m_backends.begin(); it != m_backends.end(); it++)