You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
MCOL-4264 [Cross-Engine] UPDATE to INNODB table with WHERE clause using Columnstore as sub query failing
Problem: When processing cross-engine queries like: update cstab1 set a=100 where a not in (select a from innotab1 where a=11); delete from innotab1 where a not in (select a from cstab1 where a=1); the ColumnStore plugin erroneously executed the whole query inside ColumnStore. Fix: - Adding a new member cal_connection_info::lock_type and setting it inside ha_mcs_impl_external_lock() to the value passed in the parameter "lock_type". - Adding a method cal_connection_info::isReadOnly() to test if the last table lock made in ha_mcs_impl_external_lock() for done for reading. - Adding a new condition checking cal_connection_info::isReadOnly() inside ha_mcs_impl_rnd_init(). If the current table was locked last time for reading, then doUpdateDelete() should not be executed.
This commit is contained in:
@ -2348,8 +2348,19 @@ int ha_mcs_impl_rnd_init(TABLE* table, const std::vector<COND*>& condStack)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Update and delete code
|
||||
if ( ((thd->lex)->sql_command == SQLCOM_UPDATE) || ((thd->lex)->sql_command == SQLCOM_DELETE) || ((thd->lex)->sql_command == SQLCOM_DELETE_MULTI) || ((thd->lex)->sql_command == SQLCOM_UPDATE_MULTI))
|
||||
/*
|
||||
Update and delete code.
|
||||
Note, we may be updating/deleting a different table,
|
||||
and the current one is only needed for reading,
|
||||
e.g. cstab1 is needed for reading in this example:
|
||||
|
||||
UPDATE innotab1 SET a=100 WHERE a NOT IN (SELECT a FROM cstab1 WHERE a=1);
|
||||
*/
|
||||
if (!ci->isReadOnly() && // make sure the current table is being modified
|
||||
(thd->lex->sql_command == SQLCOM_UPDATE ||
|
||||
thd->lex->sql_command == SQLCOM_DELETE ||
|
||||
thd->lex->sql_command == SQLCOM_DELETE_MULTI ||
|
||||
thd->lex->sql_command == SQLCOM_UPDATE_MULTI))
|
||||
return doUpdateDelete(thd, gwi, condStack);
|
||||
|
||||
uint32_t sessionID = tid2sid(thd->thread_id);
|
||||
@ -4079,6 +4090,7 @@ int ha_mcs_impl_external_lock(THD* thd, TABLE* table, int lock_type)
|
||||
return 0;
|
||||
}
|
||||
|
||||
ci->lock_type= lock_type;
|
||||
|
||||
CalTableMap::iterator mapiter = ci->tableMap.find(table);
|
||||
// make sure this is a release lock (2nd) call called in
|
||||
|
Reference in New Issue
Block a user