1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

MCOL-4285 In replication, perform LDI on the slave directly

into the columnstore table, and not into the cache.

LDI performed on a master, comes in as a SQLCOM_END sql_command
on the slave, when binlog_format != STATEMENT. If the cache already
had some records, we were earlier flushing the cache for the LDI
on the slave. This patch detects whether we are in the slave
thread or not, if so, then we don't do a cache flush if
sql_command = SQLCOM_END.
This commit is contained in:
Gagan Goel
2020-09-16 16:13:29 -04:00
parent 1c94e310ff
commit 234c2eb740

View File

@ -1204,8 +1204,13 @@ my_bool get_status_and_flush_cache(void *param,
if (!cache->lock_counter++)
{
ha_rows num_rows = cache->num_rows_cached();
if ((!cache->insert_command && num_rows != 0) ||
num_rows >= get_cache_flush_threshold(current_thd))
if (((!cache->insert_command && num_rows != 0) ||
num_rows >= get_cache_flush_threshold(current_thd)) &&
// In replication, LDI on a master comes as sql_command = SQLCOM_END
// on the slave, if binlog_format != STATEMENT. See mysql_load
// function in sql/sql_load.cc to know why. If this is the case,
// make sure we don't flush the cache.
(!current_thd->slave_thread || sql_command != SQLCOM_END))
{
if ((error= cache->flush_insert_cache()))
{
@ -1740,7 +1745,7 @@ void ha_mcs_cache::start_bulk_insert(ha_rows rows, uint flags)
bzero(&cache_handler->copy_info, sizeof(cache_handler->copy_info));
return cache_handler->start_bulk_insert(rows, flags);
}
return parent::start_bulk_insert_from_cache(rows, flags);
return parent::start_bulk_insert(rows, flags);
}
else
{