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
Merge pull request #1202 from tntnatbry/develop-mcol4000
MCOL-4000 Allow columnstore_use_import_for_batchinsert to use a new value, ALWAYS.
This commit is contained in:
@ -3043,7 +3043,13 @@ int ha_mcs_impl_write_row(const uchar* buf, TABLE* table, uint64_t rows_changed)
|
||||
ha_rows rowsInserted = 0;
|
||||
int rc = 0;
|
||||
|
||||
if ( (ci->useCpimport > 0) && (!(thd->variables.option_bits & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) && (!ci->singleInsert) && ((ci->isLoaddataInfile) ||
|
||||
// ci->useCpimport = 2 means ALWAYS use cpimport, whether it's in a
|
||||
// transaction or not. User should use this option very carefully since
|
||||
// cpimport currently does not support rollbacks
|
||||
if (((ci->useCpimport == 2) ||
|
||||
((ci->useCpimport == 1) && (!(thd->variables.option_bits & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))))) &&
|
||||
(!ci->singleInsert) &&
|
||||
((ci->isLoaddataInfile) ||
|
||||
((thd->lex)->sql_command == SQLCOM_INSERT) || ((thd->lex)->sql_command == SQLCOM_LOAD) ||
|
||||
((thd->lex)->sql_command == SQLCOM_INSERT_SELECT)) )
|
||||
{
|
||||
@ -3173,7 +3179,11 @@ void ha_mcs_impl_start_bulk_insert(ha_rows rows, TABLE* table)
|
||||
if (((thd->lex)->sql_command == SQLCOM_INSERT) && (rows > 0))
|
||||
ci->useCpimport = 0;
|
||||
|
||||
if ((ci->useCpimport > 0) && (!(thd->variables.option_bits & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))) //If autocommit on batch insert will use cpimport to load data
|
||||
// ci->useCpimport = 2 means ALWAYS use cpimport, whether it's in a
|
||||
// transaction or not. User should use this option very carefully since
|
||||
// cpimport currently does not support rollbacks
|
||||
if ((ci->useCpimport == 2) ||
|
||||
((ci->useCpimport == 1) && (!(thd->variables.option_bits & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))))) //If autocommit on batch insert will use cpimport to load data
|
||||
{
|
||||
//store table info to connection info
|
||||
CalpontSystemCatalog::TableName tableName;
|
||||
@ -3635,7 +3645,10 @@ int ha_mcs_impl_end_bulk_insert(bool abort, TABLE* table)
|
||||
// @bug 2515. Check command intead of vtable state
|
||||
if ( ( ((thd->lex)->sql_command == SQLCOM_INSERT) || ((thd->lex)->sql_command == SQLCOM_LOAD) || (thd->lex)->sql_command == SQLCOM_INSERT_SELECT) && !ci->singleInsert )
|
||||
{
|
||||
if ((ci->useCpimport > 0) && (!(thd->variables.option_bits & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) && (!ci->singleInsert) && ((ci->isLoaddataInfile) ||
|
||||
if (((ci->useCpimport == 2) ||
|
||||
((ci->useCpimport == 1) && (!(thd->variables.option_bits & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))))) &&
|
||||
(!ci->singleInsert) &&
|
||||
((ci->isLoaddataInfile) ||
|
||||
((thd->lex)->sql_command == SQLCOM_INSERT) || ((thd->lex)->sql_command == SQLCOM_LOAD) ||
|
||||
((thd->lex)->sql_command == SQLCOM_INSERT_SELECT)) )
|
||||
{
|
||||
|
@ -270,13 +270,28 @@ static MYSQL_THDVAR_ULONG(
|
||||
1 // block size
|
||||
);
|
||||
|
||||
static MYSQL_THDVAR_BOOL(
|
||||
const char* mcs_use_import_for_batchinsert_values[] = {
|
||||
"OFF",
|
||||
"ON",
|
||||
"ALWAYS",
|
||||
NullS
|
||||
};
|
||||
|
||||
static TYPELIB mcs_use_import_for_batchinsert_values_lib = {
|
||||
array_elements(mcs_use_import_for_batchinsert_values) - 1,
|
||||
"mcs_use_import_for_batchinsert_values",
|
||||
mcs_use_import_for_batchinsert_values,
|
||||
NULL
|
||||
};
|
||||
|
||||
static MYSQL_THDVAR_ENUM(
|
||||
use_import_for_batchinsert,
|
||||
PLUGIN_VAR_NOCMDARG,
|
||||
PLUGIN_VAR_RQCMDARG,
|
||||
"LOAD DATA INFILE and INSERT..SELECT will use cpimport internally",
|
||||
NULL, // check
|
||||
NULL, // update
|
||||
1 // default
|
||||
1, // default
|
||||
&mcs_use_import_for_batchinsert_values_lib // values lib
|
||||
);
|
||||
|
||||
static MYSQL_THDVAR_BOOL(
|
||||
@ -508,11 +523,12 @@ void set_local_query(THD* thd, ulong value)
|
||||
THDVAR(thd, local_query) = value;
|
||||
}
|
||||
|
||||
bool get_use_import_for_batchinsert(THD* thd)
|
||||
mcs_use_import_for_batchinsert_t get_use_import_for_batchinsert(THD* thd)
|
||||
{
|
||||
return ( thd == NULL ) ? false : THDVAR(thd, use_import_for_batchinsert);
|
||||
return ( thd == NULL ) ? mcs_use_import_for_batchinsert_t::ON :
|
||||
(mcs_use_import_for_batchinsert_t) THDVAR(thd, use_import_for_batchinsert);
|
||||
}
|
||||
void set_use_import_for_batchinsert(THD* thd, bool value)
|
||||
void set_use_import_for_batchinsert(THD* thd, ulong value)
|
||||
{
|
||||
THDVAR(thd, use_import_for_batchinsert) = value;
|
||||
}
|
||||
|
@ -33,6 +33,13 @@ enum mcs_compression_type_t {
|
||||
SNAPPY = 2
|
||||
};
|
||||
|
||||
// use_import_for_batchinsert
|
||||
enum mcs_use_import_for_batchinsert_t {
|
||||
OFF = 0,
|
||||
ON = 1,
|
||||
ALWAYS = 2
|
||||
};
|
||||
|
||||
// simple setters/getters
|
||||
const char* get_original_query(THD* thd);
|
||||
void set_original_query(THD* thd, char* query);
|
||||
@ -94,8 +101,8 @@ void set_double_for_decimal_math(THD* thd, bool value);
|
||||
ulong get_local_query(THD* thd);
|
||||
void set_local_query(THD* thd, ulong value);
|
||||
|
||||
bool get_use_import_for_batchinsert(THD* thd);
|
||||
void set_use_import_for_batchinsert(THD* thd, bool value);
|
||||
mcs_use_import_for_batchinsert_t get_use_import_for_batchinsert(THD* thd);
|
||||
void set_use_import_for_batchinsert(THD* thd, ulong value);
|
||||
|
||||
ulong get_import_for_batchinsert_delimiter(THD* thd);
|
||||
void set_import_for_batchinsert_delimiter(THD* thd, ulong value);
|
||||
|
Reference in New Issue
Block a user