MXS-1474 Accept 'cache_in_transactions' parameter

Only the handling of the configuration parameter.
This commit is contained in:
Johan Wikman
2017-10-23 13:45:45 +03:00
parent e6af3c3f26
commit c15eaf2f36
2 changed files with 29 additions and 0 deletions

View File

@ -138,6 +138,15 @@ static const MXS_ENUM_VALUE parameter_selects_values[] =
{NULL}
};
// Enumeration values for `cache_in_transaction`
static const MXS_ENUM_VALUE parameter_cache_in_trxs_values[] =
{
{"never", CACHE_IN_TRXS_NEVER},
{"read_only_transactions", CACHE_IN_TRXS_READ_ONLY},
{"all_transactions", CACHE_IN_TRXS_ALL},
{NULL}
};
extern "C" MXS_MODULE* MXS_CREATE_MODULE()
{
static modulecmd_arg_type_t show_argv[] =
@ -227,6 +236,13 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE()
MXS_MODULE_OPT_NONE,
parameter_selects_values
},
{
"cache_in_transactions",
MXS_MODULE_PARAM_ENUM,
CACHE_DEFAULT_CACHE_IN_TRXS,
MXS_MODULE_OPT_NONE,
parameter_cache_in_trxs_values
},
{MXS_END_MODULE_PARAMS}
}
};
@ -332,6 +348,9 @@ bool CacheFilter::process_params(char **pzOptions, MXS_CONFIG_PARAMETER *ppParam
config.selects = static_cast<cache_selects_t>(config_get_enum(ppParams,
"selects",
parameter_selects_values));
config.cache_in_trxs = static_cast<cache_in_trxs_t>(config_get_enum(ppParams,
"cache_in_transaction",
parameter_cache_in_trxs_values));
if (!config.storage)
{

View File

@ -58,6 +58,8 @@
#define CACHE_DEFAULT_SELECTS "verify_cacheable"
// Storage
#define CACHE_DEFAULT_STORAGE "storage_inmemory"
// Transaction behaviour
#define CACHE_DEFAULT_CACHE_IN_TRXS "read_only_transactions"
typedef enum cache_selects
{
@ -65,6 +67,13 @@ typedef enum cache_selects
CACHE_SELECTS_VERIFY_CACHEABLE,
} cache_selects_t;
typedef enum cache_in_trxs
{
CACHE_IN_TRXS_NEVER,
CACHE_IN_TRXS_READ_ONLY,
CACHE_IN_TRXS_ALL,
} cache_in_trxs_t;
typedef struct cache_config
{
uint64_t max_resultset_rows; /**< The maximum number of rows of a resultset for it to be cached. */
@ -81,4 +90,5 @@ typedef struct cache_config
uint32_t debug; /**< Debug settings. */
cache_thread_model_t thread_model; /**< Thread model. */
cache_selects_t selects; /**< Assume/verify that selects are cacheable. */
cache_in_trxs_t cache_in_trxs; /**< To cache or not to cache inside transactions. */
} CACHE_CONFIG;