1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

Use a session variable, columnstore_cache_flush_threshold,

to allow the user to set the threshold, instead of using a
hard coded value.
This commit is contained in:
Gagan Goel
2020-08-18 16:39:07 -04:00
parent 47f2291f9f
commit b3ae9cf04e
3 changed files with 27 additions and 2 deletions

View File

@ -32,7 +32,6 @@
#endif
#define CACHE_PREFIX "#cache#"
#define CACHE_FLUSH_THRESHOLD 1000000
handlerton* mcs_hton = NULL;
// This is the maria handlerton that we need for the cache
@ -1205,7 +1204,7 @@ my_bool get_status_and_flush_cache(void *param,
{
ha_rows num_rows = cache->num_rows_cached();
if ((!cache->insert_command && num_rows != 0) ||
num_rows >= CACHE_FLUSH_THRESHOLD)
num_rows >= get_cache_flush_threshold(current_thd))
{
if ((error= cache->flush_insert_cache()))
{

View File

@ -312,6 +312,18 @@ static MYSQL_THDVAR_BOOL(
0
);
static MYSQL_THDVAR_ULONGLONG(
cache_flush_threshold,
PLUGIN_VAR_RQCMDARG,
"Threshold on the number of rows in the cache to trigger a flush",
NULL,
NULL,
500000,
1,
1000000000,
1
);
st_mysql_sys_var* mcs_system_variables[] =
{
MYSQL_SYSVAR(compression_type),
@ -338,6 +350,7 @@ st_mysql_sys_var* mcs_system_variables[] =
MYSQL_SYSVAR(varbin_always_hex),
MYSQL_SYSVAR(replication_slave),
MYSQL_SYSVAR(cache_inserts),
MYSQL_SYSVAR(cache_flush_threshold),
NULL
};
@ -578,3 +591,13 @@ void set_cache_inserts(THD* thd, bool value)
{
THDVAR(thd, cache_inserts) = value;
}
ulonglong get_cache_flush_threshold(THD* thd)
{
return ( thd == NULL ) ? 500000 : THDVAR(thd, cache_flush_threshold);
}
void set_cache_flush_threshold(THD* thd, ulonglong value)
{
THDVAR(thd, cache_flush_threshold) = value;
}

View File

@ -116,4 +116,7 @@ void set_replication_slave(THD* thd, bool value);
bool get_cache_inserts(THD* thd);
void set_cache_inserts(THD* thd, bool value);
ulonglong get_cache_flush_threshold(THD* thd);
void set_cache_flush_threshold(THD* thd, ulonglong value);
#endif