You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +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:
@ -32,7 +32,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CACHE_PREFIX "#cache#"
|
#define CACHE_PREFIX "#cache#"
|
||||||
#define CACHE_FLUSH_THRESHOLD 1000000
|
|
||||||
|
|
||||||
handlerton* mcs_hton = NULL;
|
handlerton* mcs_hton = NULL;
|
||||||
// This is the maria handlerton that we need for the cache
|
// 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();
|
ha_rows num_rows = cache->num_rows_cached();
|
||||||
if ((!cache->insert_command && num_rows != 0) ||
|
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()))
|
if ((error= cache->flush_insert_cache()))
|
||||||
{
|
{
|
||||||
|
@ -312,6 +312,18 @@ static MYSQL_THDVAR_BOOL(
|
|||||||
0
|
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[] =
|
st_mysql_sys_var* mcs_system_variables[] =
|
||||||
{
|
{
|
||||||
MYSQL_SYSVAR(compression_type),
|
MYSQL_SYSVAR(compression_type),
|
||||||
@ -338,6 +350,7 @@ st_mysql_sys_var* mcs_system_variables[] =
|
|||||||
MYSQL_SYSVAR(varbin_always_hex),
|
MYSQL_SYSVAR(varbin_always_hex),
|
||||||
MYSQL_SYSVAR(replication_slave),
|
MYSQL_SYSVAR(replication_slave),
|
||||||
MYSQL_SYSVAR(cache_inserts),
|
MYSQL_SYSVAR(cache_inserts),
|
||||||
|
MYSQL_SYSVAR(cache_flush_threshold),
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -578,3 +591,13 @@ void set_cache_inserts(THD* thd, bool value)
|
|||||||
{
|
{
|
||||||
THDVAR(thd, cache_inserts) = 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;
|
||||||
|
}
|
||||||
|
@ -116,4 +116,7 @@ void set_replication_slave(THD* thd, bool value);
|
|||||||
bool get_cache_inserts(THD* thd);
|
bool get_cache_inserts(THD* thd);
|
||||||
void set_cache_inserts(THD* thd, bool value);
|
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
|
#endif
|
||||||
|
Reference in New Issue
Block a user