MXS-1624 Provide initial implemenation of QC caching
The mapping from a canonical statement to the query classification result is maintained by the class QCInfoCache of which there exist an instance per thread. That way no locking is needed but the information will be cached multiple times (but that is a smaller price to pay). Currently the information is stored in a regular std::unordered_map, which means that the consumed amount of memory will just keep on growing unless the number of canonical statements used by clients happens to have an upper bound. The LRU cache (that provides means for putting a bound on the amount of memory used and number of items) used in the cache filter will be generalized and be taken into use here as well. The key is now the canonical statement itself, which means that a fair amount of memory will be used. To preserve memory it might make sense to use a hashed value instead, although that at least in principle opens up the possibility for unintended collisions. This feature will also be made configurable.
This commit is contained in:
@ -426,7 +426,7 @@ typedef struct query_classifier
|
||||
QC_STMT_INFO* (*qc_info_dup)(QC_STMT_INFO* info);
|
||||
|
||||
/**
|
||||
* Closes a dupped info object.After the info objec has been closed, it must
|
||||
* Closes a dupped info object. After the info object has been closed, it must
|
||||
* not be accessed.
|
||||
*
|
||||
* @param info The info to be closed.
|
||||
|
Reference in New Issue
Block a user