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

1. Some fixes to the cache interface code.

2. Set a Columnstore_cache table as a non-foreign engine table in isMCSTable().
This commit is contained in:
Gagan Goel
2020-04-29 17:51:09 -04:00
parent 43d5d511d7
commit e671b1d1e2
3 changed files with 19 additions and 14 deletions

View File

@ -1229,8 +1229,9 @@ my_bool get_status_and_flush_cache(void *param,
ha_mcs_cache *cache= (ha_mcs_cache*) param; ha_mcs_cache *cache= (ha_mcs_cache*) param;
int error; int error;
enum_sql_command sql_command= cache->table->in_use->lex->sql_command; enum_sql_command sql_command= cache->table->in_use->lex->sql_command;
cache->insert_command= (sql_command != SQLCOM_INSERT && cache->insert_command= (sql_command == SQLCOM_INSERT ||
sql_command != SQLCOM_LOAD); sql_command == SQLCOM_INSERT_SELECT ||
sql_command == SQLCOM_LOAD);
/* /*
Call first the original Aria get_status function Call first the original Aria get_status function
All Aria get_status functions takes Maria handler as the parameter All Aria get_status functions takes Maria handler as the parameter
@ -1251,6 +1252,8 @@ my_bool get_status_and_flush_cache(void *param,
return(1); return(1);
} }
} }
else if (!cache->insert_command)
cache->free_locks();
} }
else if (!cache->insert_command) else if (!cache->insert_command)
cache->free_locks(); cache->free_locks();
@ -1761,7 +1764,9 @@ void ha_mcs_cache::free_locks()
{ {
/* We don't need to lock cache_handler anymore as it's already flushed */ /* We don't need to lock cache_handler anymore as it's already flushed */
mysql_mutex_unlock(&cache_handler->file->lock.lock->mutex);
thr_unlock(&cache_handler->file->lock, 0); thr_unlock(&cache_handler->file->lock, 0);
mysql_mutex_lock(&cache_handler->file->lock.lock->mutex);
/* Restart transaction for columnstore table */ /* Restart transaction for columnstore table */
if (original_lock_type != F_WRLCK) if (original_lock_type != F_WRLCK)
@ -1782,15 +1787,14 @@ int ha_mcs_cache::flush_insert_cache()
{ {
int error, error2; int error, error2;
ha_maria *from= cache_handler; ha_maria *from= cache_handler;
parent *to= this; uchar *record= table->record[0];
uchar *record= to->table->record[0];
DBUG_ENTER("flush_insert_cache"); DBUG_ENTER("flush_insert_cache");
to->start_bulk_insert(from->file->state->records, 0); parent::start_bulk_insert(from->file->state->records, 0);
from->rnd_init(1); from->rnd_init(1);
while (!(error= from->rnd_next(record))) while (!(error= from->rnd_next(record)))
{ {
if ((error= to->write_row(record))) if ((error= parent::write_row(record)))
goto end; goto end;
} }
if (error == HA_ERR_END_OF_FILE) if (error == HA_ERR_END_OF_FILE)
@ -1798,19 +1802,19 @@ int ha_mcs_cache::flush_insert_cache()
end: end:
from->rnd_end(); from->rnd_end();
if ((error2= to->end_bulk_insert()) && !error) if ((error2= parent::end_bulk_insert()) && !error)
error= error2; error= error2;
if (!error) if (!error)
{ {
if (to->ht->commit) if (parent::ht->commit)
error= to->ht->commit(to->ht, table->in_use, 1); error= parent::ht->commit(parent::ht, table->in_use, 1);
} }
else else
{ {
/* We can ignore the rollback error as we already have some other errors */ /* We can ignore the rollback error as we already have some other errors */
if (to->ht->rollback) if (parent::ht->rollback)
to->ht->rollback(to->ht, table->in_use, 1); parent::ht->rollback(parent::ht, table->in_use, 1);
} }
if (!error) if (!error)

View File

@ -54,7 +54,7 @@ class ha_mcs: public handler
public: public:
ha_mcs(handlerton* hton, TABLE_SHARE* table_arg); ha_mcs(handlerton* hton, TABLE_SHARE* table_arg);
~ha_mcs() virtual ~ha_mcs()
{ {
} }
@ -237,7 +237,6 @@ public:
int repair(THD* thd, HA_CHECK_OPT* check_opt); int repair(THD* thd, HA_CHECK_OPT* check_opt);
bool is_crashed() const; bool is_crashed() const;
friend class ha_mcs_cache;
}; };

View File

@ -6094,7 +6094,9 @@ bool isMCSTable(TABLE* table_ptr)
string engineName = table_ptr->s->db_plugin->name.str; string engineName = table_ptr->s->db_plugin->name.str;
#endif #endif
if (engineName == "Columnstore" || engineName == "InfiniDB") if (engineName == "Columnstore" ||
engineName == "InfiniDB" ||
engineName == "Columnstore_cache")
return true; return true;
else else
return false; return false;