MySQL 9.1.0
Source Code Documentation
|
Implementation of the post parse query rewriter. More...
#include <rewriter.h>
Public Member Functions | |
Rewriter () | |
int | get_number_loaded_rules () const |
The number of rules currently loaded in the hash table. More... | |
~Rewriter () | |
Rewrite_result | rewrite_query (MYSQL_THD thd, const uchar *key) |
Attempts to rewrite thd's current query with digest in 'key'. More... | |
longlong | refresh (MYSQL_THD thd) |
Empty the hashtable and reload all rules from disk table. More... | |
void | do_refresh (MYSQL_THD session_thd) |
Implementation of the loading procedure. More... | |
Private Member Functions | |
bool | load_rule (MYSQL_THD thd, Persisted_rule *diskrule) |
Loads the rule retrieved from the database in the hash table. More... | |
Private Attributes | |
longlong | m_refresh_status |
malloc_unordered_multimap< std::string, std::unique_ptr< Rule > > | m_digests |
The in-memory rules hash table. More... | |
Implementation of the post parse query rewriter.
The public interface consists of two operations: refresh(), which loads the rules from the disk table, and rewrite_query(), which rewrites a query if applicable.
|
default |
|
default |
void Rewriter::do_refresh | ( | MYSQL_THD | session_thd | ) |
Implementation of the loading procedure.
The server doesn't handle different sessions in the same thread, so we load the rules into the hash table in this function, intended to be run in a new thread. The main thread will do join().
session_thd | The session to be used for loading rules. |
|
inline |
The number of rules currently loaded in the hash table.
In case of rules that fail to load, this number will be lower than the number of rows in the database.
|
private |
Loads the rule retrieved from the database in the hash table.
Empty the hashtable and reload all rules from disk table.
Rewrite_result Rewriter::rewrite_query | ( | MYSQL_THD | thd, |
const uchar * | key | ||
) |
Attempts to rewrite thd's current query with digest in 'key'.
|
private |
The in-memory rules hash table.
|
private |