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

Merge branch 'develop-1.2' into develop-merge-up-20190514

This commit is contained in:
Andrew Hutchings
2019-05-14 13:58:33 +01:00
83 changed files with 469 additions and 638 deletions

View File

@@ -88,103 +88,6 @@ inline uint32_t tid2sid(const uint32_t tid)
}
//StopWatch timer;
int buildBuffer(uchar* buf, string& buffer, int& columns, TABLE* table)
{
char attribute_buffer[1024];
String attribute(attribute_buffer, sizeof(attribute_buffer),
&my_charset_bin);
std::string cols = " (";
std::string vals = " values (";
columns = 0;
for (Field** field = table->field; *field; field++)
{
const char* ptr;
const char* end_ptr;
if ((*field)->is_null())
ptr = end_ptr = 0;
else
{
bitmap_set_bit(table->read_set, (*field)->field_index);
(*field)->val_str(&attribute, &attribute);
ptr = attribute.ptr();
end_ptr = attribute.length() + ptr;
}
if (columns > 0)
{
cols.append(",");
vals.append(",");
}
columns++;
cols.append((*field)->field_name.str);
if (ptr == end_ptr)
{
vals.append ("NULL");
}
else
{
if ( (*field)->type() == MYSQL_TYPE_VARCHAR ||
/*FIXME: (*field)->type() == MYSQL_TYPE_VARBINARY || */
(*field)->type() == MYSQL_TYPE_VAR_STRING ||
(*field)->type() == MYSQL_TYPE_STRING ||
(*field)->type() == MYSQL_TYPE_DATE ||
(*field)->type() == MYSQL_TYPE_DATETIME ||
(*field)->type() == MYSQL_TYPE_DATETIME2 ||
(*field)->type() == MYSQL_TYPE_TIME )
vals.append("'");
while (ptr < end_ptr)
{
if (*ptr == '\r')
{
ptr++;
}
else if (*ptr == '\n')
{
ptr++;
}
else if (*ptr == '\'' )
{
//@Bug 1820. Replace apostrophe with strange character to pass parser.
vals += '\252';
ptr++;
}
else
vals += *ptr++;
}
if ( (*field)->type() == MYSQL_TYPE_VARCHAR ||
/*FIXME: (*field)->type() == MYSQL_TYPE_VARBINARY || */
(*field)->type() == MYSQL_TYPE_VAR_STRING ||
(*field)->type() == MYSQL_TYPE_STRING ||
(*field)->type() == MYSQL_TYPE_DATE ||
(*field)->type() == MYSQL_TYPE_DATETIME ||
(*field)->type() == MYSQL_TYPE_DATETIME2 ||
(*field)->type() == MYSQL_TYPE_TIME )
vals.append("'");
}
}
if (columns)
{
cols.append(") ");
vals.append(") ");
buffer = "INSERT INTO ";
buffer.append(table->s->table_name.str);
buffer.append(cols);
buffer.append(vals);
}
return columns;
}
uint32_t buildValueList (TABLE* table, cal_connection_info& ci )
{

View File

@@ -4686,7 +4686,7 @@ ReturnedColumn* buildAggregateColumn(Item* item, gp_walk_info& gwi)
}
}
}
catch (std::logic_error e)
catch (std::logic_error &e)
{
gwi.fatalParseError = true;
gwi.parseErrorText = "error building Aggregate Function: ";

View File

@@ -2114,7 +2114,7 @@ int ha_calpont_impl_rnd_init(TABLE* table)
//check whether the system is ready to process statement.
#ifndef _MSC_VER
static DBRM dbrm(true);
bool bSystemQueryReady = dbrm.getSystemQueryReady();
int bSystemQueryReady = dbrm.getSystemQueryReady();
if (bSystemQueryReady == 0)
{
@@ -4269,7 +4269,7 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE
//check whether the system is ready to process statement.
#ifndef _MSC_VER
static DBRM dbrm(true);
bool bSystemQueryReady = dbrm.getSystemQueryReady();
int bSystemQueryReady = dbrm.getSystemQueryReady();
if (bSystemQueryReady == 0)
{

View File

@@ -239,21 +239,6 @@ struct PartitionInfo
typedef map<LogicalPartition, PartitionInfo> PartitionMap;
const string charcolToString(int64_t v)
{
ostringstream oss;
char c;
for (int i = 0; i < 8; i++)
{
c = v & 0xff;
oss << c;
v >>= 8;
}
return oss.str();
}
const string format(int64_t v, CalpontSystemCatalog::ColType& ct)
{
ostringstream oss;

View File

@@ -100,6 +100,7 @@ static int generate_result(BRM::OID_t oid, BRM::DBRM* emp, TABLE* table, THD* th
messageqcpp::MessageQueueClient* msgQueueClient;
oam::Oam oam_instance;
int pmId = 0;
int rc;
emp->getExtents(oid, entries, false, false, true);
@@ -121,7 +122,7 @@ static int generate_result(BRM::OID_t oid, BRM::DBRM* emp, TABLE* table, THD* th
{
oam_instance.getDbrootPmConfig(iter->dbRoot, pmId);
}
catch (std::runtime_error)
catch (std::runtime_error&)
{
// MCOL-1116: If we are here a DBRoot is offline/missing
iter++;
@@ -137,14 +138,16 @@ static int generate_result(BRM::OID_t oid, BRM::DBRM* emp, TABLE* table, THD* th
DbRootName << "DBRoot" << iter->dbRoot;
std::string DbRootPath = config->getConfig("SystemConfig", DbRootName.str());
fileSize = compressedFileSize = 0;
snprintf(fullFileName, WriteEngine::FILE_NAME_SIZE, "%s/%s", DbRootPath.c_str(), oidDirName);
rc = snprintf(fullFileName, WriteEngine::FILE_NAME_SIZE, "%s/%s", DbRootPath.c_str(), oidDirName);
std::ostringstream oss;
oss << "pm" << pmId << "_WriteEngineServer";
std::string client = oss.str();
msgQueueClient = messageqcpp::MessageQueueClientPool::getInstance(oss.str());
if (!get_file_sizes(msgQueueClient, fullFileName, &fileSize, &compressedFileSize))
// snprintf output truncation check
if (rc == WriteEngine::FILE_NAME_SIZE ||
!get_file_sizes(msgQueueClient, fullFileName, &fileSize, &compressedFileSize))
{
messageqcpp::MessageQueueClientPool::releaseInstance(msgQueueClient);
delete emp;