1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-08 14:22:09 +03:00

MCOL-1385 Initial 10.3 support

This commit is contained in:
Andrew Hutchings
2018-08-02 14:52:15 +01:00
parent 57367c8ec2
commit 443a2867c4
26 changed files with 384 additions and 348 deletions

View File

@@ -27,10 +27,12 @@ add_library(calmysql SHARED ${libcalmysql_SRCS})
target_link_libraries(calmysql ${ENGINE_LDFLAGS} ${ENGINE_WRITE_LIBS} ${NETSNMP_LIBRARIES} ${SERVER_BUILD_INCLUDE_DIR}/../libservices/libmysqlservices.a threadpool)
SET_TARGET_PROPERTIES(calmysql PROPERTIES LINK_FLAGS "${calmysql_link_flags} -Wl,-E")
set_target_properties(calmysql PROPERTIES VERSION 1.0.0 SOVERSION 1)
SET ( is_columnstore_tables_SRCS
is_columnstore_tables.cpp
sm.cpp
)
add_library(is_columnstore_tables SHARED ${is_columnstore_tables_SRCS})
@@ -42,6 +44,7 @@ set_target_properties(is_columnstore_tables PROPERTIES VERSION 1.0.0 SOVERSION 1
SET ( is_columnstore_columns_SRCS
is_columnstore_columns.cpp
sm.cpp
)
add_library(is_columnstore_columns SHARED ${is_columnstore_columns_SRCS})
@@ -53,6 +56,7 @@ set_target_properties(is_columnstore_columns PROPERTIES VERSION 1.0.0 SOVERSION
SET ( is_columnstore_extents_SRCS
is_columnstore_extents.cpp
sm.cpp
)
add_library(is_columnstore_extents SHARED ${is_columnstore_extents_SRCS})
@@ -64,6 +68,7 @@ set_target_properties(is_columnstore_extents PROPERTIES VERSION 1.0.0 SOVERSION
SET ( is_columnstore_files_SRCS
is_columnstore_files.cpp
sm.cpp
)
add_library(is_columnstore_files SHARED ${is_columnstore_files_SRCS})

View File

@@ -1299,4 +1299,36 @@ mysql_declare_plugin(columnstore)
0 /* config flags */
}
mysql_declare_plugin_end;
maria_declare_plugin(columnstore)
{
MYSQL_STORAGE_ENGINE_PLUGIN,
&columnstore_storage_engine,
"Columnstore",
"MariaDB",
"Columnstore storage engine",
PLUGIN_LICENSE_GPL,
columnstore_init_func,
columnstore_done_func,
0x0100, /* 1.0 */
NULL, /* status variables */
calpont_system_variables, /* system variables */
"1.0", /* string version */
MariaDB_PLUGIN_MATURITY_STABLE /* maturity */
},
{
MYSQL_STORAGE_ENGINE_PLUGIN,
&infinidb_storage_engine,
"InfiniDB",
"MariaDB",
"Columnstore storage engine (deprecated: use columnstore)",
PLUGIN_LICENSE_GPL,
infinidb_init_func,
infinidb_done_func,
0x0100, /* 1.0 */
NULL, /* status variables */
calpont_system_variables, /* system variables */
"1.0", /* string version */
MariaDB_PLUGIN_MATURITY_STABLE /* maturity */
}
maria_declare_plugin_end;

View File

@@ -2045,7 +2045,7 @@ int ha_calpont_impl_create_(const char* name, TABLE* table_arg, HA_CREATE_INFO*
}
// @bug 3908. error out primary key for now.
if (table_arg->key_info && table_arg->key_info->name && string(table_arg->key_info->name) == "PRIMARY")
if (table_arg->key_info && table_arg->key_info->name.length && string(table_arg->key_info->name.str) == "PRIMARY")
{
string emsg = logging::IDBErrorInfo::instance()->errorMsg(ERR_CONSTRAINTS);
setError(thd, ER_CHECK_NOT_IMPLEMENTED, emsg);
@@ -2214,8 +2214,8 @@ int ha_calpont_impl_rename_table_(const char* from, const char* to, cal_connecti
stmt = "alter table `" + fromPair.second + "` rename to `" + toPair.second + "`;";
string db;
if ( thd->db )
db = thd->db;
if ( thd->db.length )
db = thd->db.str;
else if ( fromPair.first.length() != 0 )
db = fromPair.first;
else
@@ -2245,8 +2245,8 @@ extern "C"
THD* thd = current_thd;
string db("");
if ( thd->db )
db = thd->db;
if ( thd->db.length )
db = thd->db.str;
int compressiontype = thd->variables.infinidb_compression_type;

View File

@@ -121,7 +121,7 @@ int buildBuffer(uchar* buf, string& buffer, int& columns, TABLE* table)
columns++;
cols.append((*field)->field_name);
cols.append((*field)->field_name.str);
if (ptr == end_ptr)
{
@@ -236,7 +236,7 @@ uint32_t buildValueList (TABLE* table, cal_connection_info& ci )
}
}
ci.colNameList.push_back((*field)->field_name);
ci.colNameList.push_back((*field)->field_name.str);
columnPos++;
}

File diff suppressed because it is too large Load Diff

View File

@@ -61,7 +61,7 @@ using namespace std;
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/regex.hpp>
#include <boost/thread.hpp>
using namespace boost;
//using namespace boost;
#include "idb_mysql.h"
@@ -977,7 +977,7 @@ uint32_t doUpdateDelete(THD* thd)
}
//@Bug 4387. Check BRM status before start statement.
scoped_ptr<DBRM> dbrmp(new DBRM());
boost::scoped_ptr<DBRM> dbrmp(new DBRM());
int rc = dbrmp->isReadWrite();
thd->infinidb_vtable.isInfiniDBDML = true;
@@ -1133,7 +1133,7 @@ uint32_t doUpdateDelete(THD* thd)
schemaName = string(item->db_name);
columnAssignmentPtr = new ColumnAssignment();
columnAssignmentPtr->fColumn = string(item->name);
columnAssignmentPtr->fColumn = string(item->name.str);
columnAssignmentPtr->fOperator = "=";
columnAssignmentPtr->fFuncScale = 0;
Item* value = value_it++;
@@ -1279,7 +1279,7 @@ uint32_t doUpdateDelete(THD* thd)
{
Item_field* tmp = (Item_field*)value;
if (!tmp->field_name) //null
if (!tmp->field_name.length) //null
{
columnAssignmentPtr->fScalarExpression = "NULL";
columnAssignmentPtr->fFromCol = false;
@@ -1400,9 +1400,9 @@ uint32_t doUpdateDelete(THD* thd)
if (deleteTable->get_num_of_tables() == 1)
{
schemaName = first_table->db;
tableName = first_table->table_name;
aliasName = first_table->alias;
schemaName = first_table->db.str;
tableName = first_table->table_name.str;
aliasName = first_table->alias.str;
qualifiedTablName->fName = tableName;
qualifiedTablName->fSchema = schemaName;
pDMLPackage = CalpontDMLFactory::makeCalpontDMLPackageFromMysqlBuffer(dmlStatement);
@@ -1421,7 +1421,7 @@ uint32_t doUpdateDelete(THD* thd)
first_table = (TABLE_LIST*) thd->lex->select_lex.table_list.first;
schemaName = first_table->table->s->db.str;
tableName = first_table->table->s->table_name.str;
aliasName = first_table->alias;
aliasName = first_table->alias.str;
qualifiedTablName->fName = tableName;
qualifiedTablName->fSchema = schemaName;
pDMLPackage = CalpontDMLFactory::makeCalpontDMLPackageFromMysqlBuffer(dmlStatement);
@@ -1432,7 +1432,7 @@ uint32_t doUpdateDelete(THD* thd)
first_table = (TABLE_LIST*) thd->lex->select_lex.table_list.first;
schemaName = first_table->table->s->db.str;
tableName = first_table->table->s->table_name.str;
aliasName = first_table->alias;
aliasName = first_table->alias.str;
qualifiedTablName->fName = tableName;
qualifiedTablName->fSchema = schemaName;
pDMLPackage = CalpontDMLFactory::makeCalpontDMLPackageFromMysqlBuffer(dmlStatement);
@@ -2243,7 +2243,7 @@ extern "C"
bool includeInput = true;
string pstr(parameter);
algorithm::to_lower(pstr);
boost::algorithm::to_lower(pstr);
if (pstr == PmSmallSideMaxMemory)
{
@@ -2389,8 +2389,8 @@ extern "C"
{
tableName.table = args->args[0];
if (thd->db)
tableName.schema = thd->db;
if (thd->db.length)
tableName.schema = thd->db.str;
else
{
string msg("No schema information provided");
@@ -2527,8 +2527,8 @@ extern "C"
{
tableName.table = args->args[0];
if (thd->db)
tableName.schema = thd->db;
if (thd->db.length)
tableName.schema = thd->db.str;
else
{
return -1;
@@ -3022,8 +3022,8 @@ int ha_calpont_impl_rnd_init(TABLE* table)
ti.csep->verID(verID);
ti.csep->sessionID(sessionID);
if (thd->db)
ti.csep->schemaName(thd->db);
if (thd->db.length)
ti.csep->schemaName(thd->db.str);
ti.csep->traceFlags(ci->traceFlags);
ti.msTablePtr = table;
@@ -3116,8 +3116,8 @@ int ha_calpont_impl_rnd_init(TABLE* table)
csep->verID(verID);
csep->sessionID(sessionID);
if (thd->db)
csep->schemaName(thd->db);
if (thd->db.length)
csep->schemaName(thd->db.str);
csep->traceFlags(ci->traceFlags);
@@ -3782,12 +3782,12 @@ int ha_calpont_impl_delete_table(const char* name)
if (thd->lex->sql_command == SQLCOM_DROP_DB)
{
dbName = thd->lex->name.str;
dbName = const_cast<char*>(thd->lex->name.str);
}
else
{
TABLE_LIST* first_table = (TABLE_LIST*) thd->lex->select_lex.table_list.first;
dbName = first_table->db;
dbName = const_cast<char*>(first_table->db.str);
}
if (!dbName)
@@ -3809,7 +3809,7 @@ int ha_calpont_impl_delete_table(const char* name)
if (strcmp(dbName, "calpontsys") == 0 && string(name).find("@0024vtable") == string::npos)
{
std::string stmt(idb_mysql_query_str(thd));
algorithm::to_upper(stmt);
boost::algorithm::to_upper(stmt);
//@Bug 2432. systables can be dropped with restrict
if (stmt.find(" RESTRICT") != string::npos)
@@ -3961,7 +3961,7 @@ void ha_calpont_impl_start_bulk_insert(ha_rows rows, TABLE* table)
if ((thd->lex)->sql_command == SQLCOM_INSERT)
{
string insertStmt = idb_mysql_query_str(thd);
algorithm::to_lower(insertStmt);
boost::algorithm::to_lower(insertStmt);
string intoStr("into");
size_t found = insertStmt.find(intoStr);
@@ -4437,7 +4437,7 @@ void ha_calpont_impl_start_bulk_insert(ha_rows rows, TABLE* table)
ci->stats.fQueryType = CalpontSelectExecutionPlan::queryTypeToString(CalpontSelectExecutionPlan::LOAD_DATA_INFILE);
//@Bug 4387. Check BRM status before start statement.
scoped_ptr<DBRM> dbrmp(new DBRM());
boost::scoped_ptr<DBRM> dbrmp(new DBRM());
int rc = dbrmp->isReadWrite();
if (rc != 0 )
@@ -4755,7 +4755,7 @@ int ha_calpont_impl_commit (handlerton* hton, THD* thd, bool all)
return 0;
//@Bug 5823 check if any active transaction for this session
scoped_ptr<DBRM> dbrmp(new DBRM());
boost::scoped_ptr<DBRM> dbrmp(new DBRM());
BRM::TxnID txnId = dbrmp->getTxnID(tid2sid(thd->thread_id));
if (!txnId.valid)
@@ -5257,8 +5257,8 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE
csep->verID(verID);
csep->sessionID(sessionID);
if (group_hand->table_list->db_length)
csep->schemaName(group_hand->table_list->db);
if (group_hand->table_list->db.length)
csep->schemaName(group_hand->table_list->db.str);
csep->traceFlags(ci->traceFlags);

View File

@@ -642,9 +642,9 @@ void partitionByValue_common(UDF_ARGS* args, // input
}
else
{
if (current_thd->db)
if (current_thd->db.length)
{
schema = current_thd->db;
schema = current_thd->db.str;
}
else
{
@@ -1019,9 +1019,9 @@ extern "C"
}
else
{
if (current_thd->db)
if (current_thd->db.length)
{
schema = current_thd->db;
schema = current_thd->db.str;
}
else
{
@@ -1228,7 +1228,7 @@ extern "C"
{
tableName.table = args->args[0];
if (!current_thd->db)
if (!current_thd->db.length)
{
errMsg = "No schema name indicated.";
memcpy(result, errMsg.c_str(), errMsg.length());
@@ -1236,7 +1236,7 @@ extern "C"
return result;
}
tableName.schema = current_thd->db;
tableName.schema = current_thd->db.str;
parsePartitionString(args, 1, partitionNums, errMsg, tableName);
}
@@ -1316,14 +1316,14 @@ extern "C"
{
tableName.table = args->args[0];
if (!current_thd->db)
if (!current_thd->db.length)
{
current_thd->get_stmt_da()->set_overwrite_status(true);
current_thd->raise_error_printf(ER_INTERNAL_ERROR, IDBErrorInfo::instance()->errorMsg(ERR_PARTITION_NO_SCHEMA).c_str());
return result;
}
tableName.schema = current_thd->db;
tableName.schema = current_thd->db.str;
parsePartitionString(args, 1, partitionNums, errMsg, tableName);
}
@@ -1403,14 +1403,14 @@ extern "C"
{
tableName.table = args->args[0];
if (!current_thd->db)
if (!current_thd->db.length)
{
current_thd->get_stmt_da()->set_overwrite_status(true);
current_thd->raise_error_printf(ER_INTERNAL_ERROR, IDBErrorInfo::instance()->errorMsg(ERR_PARTITION_NO_SCHEMA).c_str());
return result;
}
tableName.schema = current_thd->db;
tableName.schema = current_thd->db.str;
parsePartitionString(args, 1, partSet, errMsg, tableName);
}
@@ -1724,9 +1724,9 @@ extern "C"
}
else
{
if (current_thd->db)
if (current_thd->db.length)
{
schema = current_thd->db;
schema = current_thd->db.str;
}
else
{

View File

@@ -582,7 +582,7 @@ execplan::ReturnedColumn* buildPseudoColumn(Item* item,
PseudoColumn* pc = new PseudoColumn(*sc, pseudoType);
// @bug5892. set alias for derived table column matching.
pc->alias(ifp->name ? ifp->name : "");
pc->alias(ifp->name.length ? ifp->name.str : "");
return pc;
}

View File

@@ -84,7 +84,7 @@ void View::transform()
for (; table_ptr; table_ptr = table_ptr->next_local)
{
// mysql put vtable here for from sub. we ignore it
if (string(table_ptr->table_name).find("$vtable") != string::npos)
if (string(table_ptr->table_name.str).find("$vtable") != string::npos)
continue;
string viewName = getViewName(table_ptr);
@@ -93,8 +93,8 @@ void View::transform()
{
SELECT_LEX* select_cursor = table_ptr->derived->first_select();
FromSubQuery* fromSub = new FromSubQuery(gwi, select_cursor);
string alias(table_ptr->alias);
gwi.viewName = make_aliasview("", alias, table_ptr->belong_to_view->alias, "");
string alias(table_ptr->alias.str);
gwi.viewName = make_aliasview("", alias, table_ptr->belong_to_view->alias.str, "");
algorithm::to_lower(alias);
fromSub->alias(alias);
gwi.derivedTbList.push_back(SCSEP(fromSub->transform()));
@@ -107,8 +107,8 @@ void View::transform()
else if (table_ptr->view)
{
// for nested view, the view name is vout.vin... format
CalpontSystemCatalog::TableAliasName tn = make_aliasview(table_ptr->db, table_ptr->table_name, table_ptr->alias, viewName);
gwi.viewName = make_aliastable(table_ptr->db, table_ptr->table_name, viewName);
CalpontSystemCatalog::TableAliasName tn = make_aliasview(table_ptr->db.str, table_ptr->table_name.str, table_ptr->alias.str, viewName);
gwi.viewName = make_aliastable(table_ptr->db.str, table_ptr->table_name.str, viewName);
View* view = new View(table_ptr->view->select_lex, &gwi);
view->viewName(gwi.viewName);
gwi.viewList.push_back(view);
@@ -121,9 +121,9 @@ void View::transform()
// trigger system catalog cache
if (infiniDB)
csc->columnRIDs(make_table(table_ptr->db, table_ptr->table_name), true);
csc->columnRIDs(make_table(table_ptr->db.str, table_ptr->table_name.str), true);
CalpontSystemCatalog::TableAliasName tn = make_aliasview(table_ptr->db, table_ptr->table_name, table_ptr->alias, viewName, infiniDB);
CalpontSystemCatalog::TableAliasName tn = make_aliasview(table_ptr->db.str, table_ptr->table_name.str, table_ptr->alias.str, viewName, infiniDB);
gwi.tbList.push_back(tn);
gwi.tableMap[tn] = make_pair(0, table_ptr);
fParentGwip->tableMap[tn] = make_pair(0, table_ptr);

View File

@@ -203,7 +203,7 @@ string ConvertFuncName(Item_sum* item)
switch (item->sum_func())
{
case Item_sum::COUNT_FUNC:
if (!item->arguments()[0]->name)
if (!item->arguments()[0]->name.str)
return "COUNT(*)";
return "COUNT";

View File

@@ -63,6 +63,7 @@ template <class T> bool isnan(T);
#endif
#endif
#include "sql_plugin.h"
#include "sql_table.h"
#include "sql_select.h"
#include "mysqld_error.h"

View File

@@ -61,13 +61,13 @@ static void get_cond_item(Item_func* item, String** table, String** db)
char tmp_char[MAX_FIELD_WIDTH];
Item_field* item_field = (Item_field*) item->arguments()[0]->real_item();
if (strcasecmp(item_field->field_name, "table_name") == 0)
if (strcasecmp(item_field->field_name.str, "table_name") == 0)
{
String str_buf(tmp_char, sizeof(tmp_char), system_charset_info);
*table = item->arguments()[1]->val_str(&str_buf);
return;
}
else if (strcasecmp(item_field->field_name, "table_schema") == 0)
else if (strcasecmp(item_field->field_name.str, "table_schema") == 0)
{
String str_buf(tmp_char, sizeof(tmp_char), system_charset_info);
*db = item->arguments()[1]->val_str(&str_buf);

View File

@@ -207,7 +207,7 @@ static int is_columnstore_extents_fill(THD* thd, TABLE_LIST* tables, COND* cond)
// WHERE object_id = value
Item_field* item_field = (Item_field*) fitem->arguments()[0]->real_item();
if (strcasecmp(item_field->field_name, "object_id") == 0)
if (strcasecmp(item_field->field_name.str, "object_id") == 0)
{
cond_oid = fitem->arguments()[1]->val_int();
return generate_result(cond_oid, emp, table, thd);
@@ -219,7 +219,7 @@ static int is_columnstore_extents_fill(THD* thd, TABLE_LIST* tables, COND* cond)
// WHERE value = object_id
Item_field* item_field = (Item_field*) fitem->arguments()[1]->real_item();
if (strcasecmp(item_field->field_name, "object_id") == 0)
if (strcasecmp(item_field->field_name.str, "object_id") == 0)
{
cond_oid = fitem->arguments()[0]->val_int();
return generate_result(cond_oid, emp, table, thd);
@@ -231,7 +231,7 @@ static int is_columnstore_extents_fill(THD* thd, TABLE_LIST* tables, COND* cond)
// WHERE object_id in (value1, value2)
Item_field* item_field = (Item_field*) fitem->arguments()[0]->real_item();
if (strcasecmp(item_field->field_name, "object_id") == 0)
if (strcasecmp(item_field->field_name.str, "object_id") == 0)
{
for (unsigned int i = 1; i < fitem->argument_count(); i++)
{

View File

@@ -212,7 +212,7 @@ static int is_columnstore_files_fill(THD* thd, TABLE_LIST* tables, COND* cond)
// WHERE object_id = value
Item_field* item_field = (Item_field*) fitem->arguments()[0]->real_item();
if (strcasecmp(item_field->field_name, "object_id") == 0)
if (strcasecmp(item_field->field_name.str, "object_id") == 0)
{
cond_oid = fitem->arguments()[1]->val_int();
return generate_result(cond_oid, emp, table, thd);
@@ -224,7 +224,7 @@ static int is_columnstore_files_fill(THD* thd, TABLE_LIST* tables, COND* cond)
// WHERE value = object_id
Item_field* item_field = (Item_field*) fitem->arguments()[1]->real_item();
if (strcasecmp(item_field->field_name, "object_id") == 0)
if (strcasecmp(item_field->field_name.str, "object_id") == 0)
{
cond_oid = fitem->arguments()[0]->val_int();
return generate_result(cond_oid, emp, table, thd);
@@ -236,7 +236,7 @@ static int is_columnstore_files_fill(THD* thd, TABLE_LIST* tables, COND* cond)
// WHERE object_id in (value1, value2)
Item_field* item_field = (Item_field*) fitem->arguments()[0]->real_item();
if (strcasecmp(item_field->field_name, "object_id") == 0)
if (strcasecmp(item_field->field_name.str, "object_id") == 0)
{
for (unsigned int i = 1; i < fitem->argument_count(); i++)
{

View File

@@ -47,13 +47,13 @@ static void get_cond_item(Item_func* item, String** table, String** db)
char tmp_char[MAX_FIELD_WIDTH];
Item_field* item_field = (Item_field*) item->arguments()[0]->real_item();
if (strcasecmp(item_field->field_name, "table_name") == 0)
if (strcasecmp(item_field->field_name.str, "table_name") == 0)
{
String str_buf(tmp_char, sizeof(tmp_char), system_charset_info);
*table = item->arguments()[1]->val_str(&str_buf);
return;
}
else if (strcasecmp(item_field->field_name, "table_schema") == 0)
else if (strcasecmp(item_field->field_name.str, "table_schema") == 0)
{
String str_buf(tmp_char, sizeof(tmp_char), system_charset_info);
*db = item->arguments()[1]->val_str(&str_buf);

View File

@@ -20,6 +20,7 @@
*
***********************************************************************/
#include <my_global.h>
#include <mysql.h>
#include <my_sys.h>
#include <errmsg.h>