1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-06-06 08:21:01 +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
commit 020b211bb7
83 changed files with 469 additions and 638 deletions

View File

@ -5,10 +5,10 @@
set +e; \
if [ -f dml-scan.cpp ]; \
then diff -abBq dml-scan-temp.cpp dml-scan.cpp >/dev/null 2>&1; \
if [ $$? -ne 0 ]; \
if [ $? -ne 0 ]; \
then mv -f dml-scan-temp.cpp dml-scan.cpp; \
else touch dml-scan.cpp; \
fi; \
else mv -f dml-scan-temp.cpp dml-scan.cpp; \
fi
rm -f dml-scan-temp.cpp
rm -f dml-scan-temp.cpp

View File

@ -40,22 +40,6 @@ struct to_lower
}
};
//Trim any leading/trailing ws
const string lrtrim(const string& in)
{
string::size_type p1;
p1 = in.find_first_not_of(" \t\n");
if (p1 == string::npos) p1 = 0;
string::size_type p2;
p2 = in.find_last_not_of(" \t\n");
if (p2 == string::npos) p2 = in.size() - 1;
return string(in, p1, (p2 - p1 + 1));
}
}
namespace execplan

View File

@ -40,22 +40,6 @@ struct to_lower
}
};
//Trim any leading/trailing ws
const string lrtrim(const string& in)
{
string::size_type p1;
p1 = in.find_first_not_of(" \t\n");
if (p1 == string::npos) p1 = 0;
string::size_type p2;
p2 = in.find_last_not_of(" \t\n");
if (p2 == string::npos) p2 = in.size() - 1;
return string(in, p1, (p2 - p1 + 1));
}
}
namespace execplan

View File

@ -46,22 +46,6 @@ struct to_lower
}
};
//Trim any leading/trailing ws
const string lrtrim(const string& in)
{
string::size_type p1;
p1 = in.find_first_not_of(" \t\n");
if (p1 == string::npos) p1 = 0;
string::size_type p2;
p2 = in.find_last_not_of(" \t\n");
if (p2 == string::npos) p2 = in.size() - 1;
return string(in, p1, (p2 - p1 + 1));
}
}
namespace execplan

View File

@ -1136,7 +1136,9 @@ inline int64_t TreeNode::getDatetimeIntVal()
dataconvert::Time tt;
int day = 0;
memcpy(&tt, &fResult.intVal, 8);
void *ttp = static_cast<void*>(&tt);
memcpy(ttp, &fResult.intVal, 8);
// Note, this should probably be current date +/- time
if ((tt.hour > 23) && (!tt.is_neg))
@ -1166,7 +1168,7 @@ inline int64_t TreeNode::getTimeIntVal()
{
dataconvert::DateTime dt;
memcpy(&dt, &fResult.intVal, 8);
memcpy((int64_t*)(&dt), &fResult.intVal, 8);
dataconvert::Time tt(0, dt.hour, dt.minute, dt.second, dt.msecond, false);
memcpy(&fResult.intVal, &tt, 8);
return fResult.intVal;

View File

@ -336,7 +336,8 @@ bool isNotInSubquery(JobStepVector& jsv)
return notIn;
}
// This fcn is currently unused. Will keep it in the code for now.
#if 0
void alterCsepInExistsFilter(CalpontSelectExecutionPlan* csep, JobInfo& jobInfo)
{
// This is for window function in IN/EXISTS sub-query.
@ -364,7 +365,7 @@ void alterCsepInExistsFilter(CalpontSelectExecutionPlan* csep, JobInfo& jobInfo)
if (wcs.size() > 1)
retCols.insert(retCols.end(), wcs.begin() + 1, wcs.end());
}
#endif
void doCorrelatedExists(const ExistsFilter* ef, JobInfo& jobInfo)
{

View File

@ -94,68 +94,6 @@ namespace
{
using namespace joblist;
//Find the next step downstream from *in. Assumes only the first such step is needed.
const JobStepVector::iterator getNextStep(JobStepVector::iterator& in, JobStepVector& list)
{
JobStepVector::iterator end = list.end();
for (unsigned i = 0; i < in->get()->outputAssociation().outSize(); ++i)
{
JobStepVector::iterator iter = list.begin();
AnyDataListSPtr outAdl = in->get()->outputAssociation().outAt(i);
while (iter != end)
{
if (iter != in)
{
AnyDataListSPtr inAdl;
for (unsigned j = 0; j < iter->get()->inputAssociation().outSize(); j++)
{
inAdl = iter->get()->inputAssociation().outAt(j);
if (inAdl.get() == outAdl.get())
return iter;
}
}
++iter;
}
}
return end;
}
bool checkCombinable(JobStep* jobStepPtr)
{
if (typeid(*(jobStepPtr)) == typeid(pColScanStep))
{
return true;
}
else if (typeid(*(jobStepPtr)) == typeid(PseudoColStep))
{
return true;
}
else if (typeid(*(jobStepPtr)) == typeid(pColStep))
{
return true;
}
else if (typeid(*(jobStepPtr)) == typeid(pDictionaryStep))
{
return true;
}
else if (typeid(*(jobStepPtr)) == typeid(PassThruStep))
{
return true;
}
else if (typeid(*(jobStepPtr)) == typeid(FilterStep))
{
return true;
}
return false;
}
void projectSimpleColumn(const SimpleColumn* sc, JobStepVector& jsv, JobInfo& jobInfo)
{
@ -1447,54 +1385,6 @@ void changePcolStepToPcolScan(JobStepVector::iterator& it, JobStepVector::iterat
}
}
uint32_t shouldSort(const JobStep* inJobStep, int colWidth)
{
//only pColStep and pColScan have colType
const pColStep* inStep = dynamic_cast<const pColStep*>(inJobStep);
if (inStep && colWidth > inStep->colType().colWidth)
{
return 1;
}
const pColScanStep* inScan = dynamic_cast<const pColScanStep*>(inJobStep);
if (inScan && colWidth > inScan->colType().colWidth)
{
return 1;
}
return 0;
}
void convertPColStepInProjectToPassThru(JobStepVector& psv, JobInfo& jobInfo)
{
for (JobStepVector::iterator iter = psv.begin(); iter != psv.end(); ++iter)
{
pColStep* colStep = dynamic_cast<pColStep*>(iter->get());
if (colStep != NULL)
{
JobStepAssociation ia = iter->get()->inputAssociation();
DataList_t* fifoDlp = ia.outAt(0).get()->dataList();
if (fifoDlp)
{
if (iter->get()->oid() >= 3000 && iter->get()->oid() == fifoDlp->OID())
{
PassThruStep* pts = 0;
pts = new PassThruStep(*colStep);
pts->alias(colStep->alias());
pts->view(colStep->view());
pts->name(colStep->name());
pts->tupleId(iter->get()->tupleId());
iter->reset(pts);
}
}
}
}
}
// optimize filter order
// perform none string filters first because string filter joins the tokens.
void optimizeFilterOrder(JobStepVector& qsv)
@ -1819,7 +1709,7 @@ void makeVtableModeSteps(CalpontSelectExecutionPlan* csep, JobInfo& jobInfo,
jobInfo.limitCount = (uint64_t) - 1;
}
// support order by and limit in sub-query/union or
// support order by and limit in sub-query/union or
// GROUP BY handler processed outer query order
else if (csep->orderByCols().size() > 0)
{

View File

@ -483,7 +483,8 @@ void pDictionaryScan::sendAPrimitiveMessage(
)
{
DictTokenByScanRequestHeader hdr;
memset(&hdr, 0, sizeof(hdr));
void *hdrp = static_cast<void*>(&hdr);
memset(hdrp, 0, sizeof(hdr));
hdr.ism.Interleave = pm;
hdr.ism.Flags = planFlagsToPrimFlags(fTraceFlags);
@ -913,7 +914,8 @@ void pDictionaryScan::serializeEqualityFilter()
uint32_t i;
vector<string> empty;
memset(&ism, 0, sizeof(ISMPacketHeader));
void *ismp = static_cast<void*>(&ism);
memset(ismp, 0, sizeof(ISMPacketHeader));
ism.Command = DICT_CREATE_EQUALITY_FILTER;
msg.load((uint8_t*) &ism, sizeof(ISMPacketHeader));
msg << uniqueID;
@ -954,7 +956,8 @@ void pDictionaryScan::destroyEqualityFilter()
ByteStream msg;
ISMPacketHeader ism;
memset(&ism, 0, sizeof(ISMPacketHeader));
void *ismp = static_cast<void*>(&ism);
memset(ismp, 0, sizeof(ISMPacketHeader));
ism.Command = DICT_DESTROY_EQUALITY_FILTER;
msg.load((uint8_t*) &ism, sizeof(ISMPacketHeader));
msg << uniqueID;

View File

@ -81,21 +81,6 @@ using namespace joblist;
namespace
{
string keyName(uint64_t i, uint32_t key, const joblist::JobInfo& jobInfo)
{
string name = jobInfo.projectionCols[i]->alias();
if (name.empty())
{
name = jobInfo.keyInfo->tupleKeyToName[key];
if (jobInfo.keyInfo->tupleKeyVec[key].fId < 100)
name = "Expression/Function";
}
return name = "'" + name + "'";
}
uint64_t getColumnIndex(const SRCP& c, const map<uint64_t, uint64_t>& m, JobInfo& jobInfo)
{

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;

View File

@ -71,14 +71,15 @@ namespace
{
DistributedEngineComm* Dec;
void setupCwd()
int8_t setupCwd()
{
string workdir = startup::StartUp::tmpDir();
if (workdir.length() == 0)
workdir = ".";
(void)chdir(workdir.c_str());
int8_t rc = chdir(workdir.c_str());
return rc;
}
void added_a_pm(int)
@ -103,7 +104,18 @@ int main(int argc, char* argv[])
// This is unset due to the way we start it
program_invocation_short_name = const_cast<char*>("DDLProc");
setupCwd();
if ( setupCwd() < 0 )
{
LoggingID logid(23, 0, 0);
logging::Message::Args args1;
logging::Message msg(9);
args1.add("DDLProc could not set working directory ");
msg.format( args1 );
logging::Logger logger(logid.fSubsysID);
logger.logMessage(LOG_TYPE_CRITICAL, msg, logid);
return 1;
}
WriteEngine::WriteEngineWrapper::init( WriteEngine::SUBSYSTEM_ID_DDLPROC );
#ifdef _MSC_VER

View File

@ -491,17 +491,19 @@ void rollbackAll(DBRM* dbrm)
dbrm->setSystemReady(true);
}
void setupCwd()
int8_t setupCwd()
{
string workdir = startup::StartUp::tmpDir();
if (workdir.length() == 0)
workdir = ".";
(void)chdir(workdir.c_str());
int8_t rc = chdir(workdir.c_str());
if (access(".", W_OK) != 0)
(void)chdir("/tmp");
if (rc < 0 || access(".", W_OK) != 0)
rc = chdir("/tmp");
return rc;
}
} // Namewspace
@ -520,7 +522,18 @@ int main(int argc, char* argv[])
Config* cf = Config::makeConfig();
setupCwd();
if ( setupCwd() )
{
LoggingID logid(21, 0, 0);
logging::Message::Args args1;
logging::Message msg(1);
args1.add("DMLProc couldn't cwd.");
msg.format( args1 );
logging::Logger logger(logid.fSubsysID);
logger.logMessage(LOG_TYPE_CRITICAL, msg, logid);
return 1;
}
WriteEngine::WriteEngineWrapper::init( WriteEngine::SUBSYSTEM_ID_DMLPROC );
#ifdef _MSC_VER
@ -609,9 +622,20 @@ int main(int argc, char* argv[])
try
{
string port = cf->getConfig(DMLProc, "Port");
string cmd = "fuser -k " + port + "/tcp >/dev/null 2>&1";
string cmd = "fuser -k " + port + "/tcp >/dev/null 2>&1";
// Couldn't check the return code b/c
// fuser returns 1 for unused port.
#if defined(__GNUC__) && __GNUC__ >= 5
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
(void)::system(cmd.c_str());
#pragma GCC diagnostic pop
#else
(void)::system(cmd.c_str());
#endif
}
catch (...)
{

View File

@ -1301,10 +1301,12 @@ void setupSignalHandlers()
void setupCwd(joblist::ResourceManager* rm)
{
std::string workdir = rm->getScWorkingDir();
(void)chdir(workdir.c_str());
int8_t rc = chdir(workdir.c_str());
if (access(".", W_OK) != 0)
(void)chdir("/tmp");
if (rc < 0 || access(".", W_OK) != 0)
rc = chdir("/tmp");
return (rc < 0) ? -5 : rc;
}
void startRssMon(size_t maxPct, int pauseSeconds)
@ -1470,9 +1472,12 @@ int main(int argc, char* argv[])
break;
default:
errMsg = "Couldn't change working directory or unknown error";
break;
}
err = setupCwd(rm);
if (err < 0)
{
oam::Oam oam;
@ -1496,9 +1501,6 @@ int main(int argc, char* argv[])
return 2;
}
setupCwd(rm);
cleanTempDir();
logging::MsgMap msgMap;

View File

@ -10,6 +10,8 @@ add_library(oamcpp SHARED ${oamcpp_LIB_SRCS})
target_link_libraries(oamcpp )
target_compile_options(oamcpp PRIVATE -Wno-unused-result)
set_target_properties(oamcpp PROPERTIES VERSION 1.0.0 SOVERSION 1)
install(TARGETS oamcpp DESTINATION ${ENGINE_LIBDIR} COMPONENT libs)

View File

@ -154,12 +154,14 @@ Oam::Oam()
char* p = getenv("USER");
if (p && *p)
USER = p;
USER = p;
userDir = USER;
if ( USER != "root")
userDir = "home/" + USER;
{
userDir = "home/" + USER;
}
tmpdir = startup::StartUp::tmpDir();
@ -2901,8 +2903,6 @@ oamModuleInfo_t Oam::getModuleInfo()
// Get Server Type Install ID
serverTypeInstall = atoi(sysConfig->getConfig("Installation", "ServerTypeInstall").c_str());
sysConfig;
}
catch (...) {}
@ -8563,9 +8563,6 @@ std::string Oam::createEC2Volume(std::string size, std::string name)
oldFile.close();
if ( volumeName == "unknown" )
return "failed";
if ( volumeName == "unknown" )
return "failed";
@ -8601,7 +8598,7 @@ bool Oam::attachEC2Volume(std::string volumeName, std::string deviceName, std::s
writeLog("attachEC2Volume: Attach failed, call detach:" + volumeName + " " + instanceName + " " + deviceName, LOG_TYPE_ERROR );
detachEC2Volume(volumeName);
}
}
else
return true;
}
@ -10470,12 +10467,8 @@ void Oam::sendStatusUpdate(ByteStream obs, ByteStream::byte returnRequestType)
if (ibs.length() > 0)
{
ibs >> returnRequestType;
if ( returnRequestType == returnRequestType )
{
processor.shutdown();
return;
}
processor.shutdown();
return;
}
else
{

View File

@ -8,6 +8,8 @@ set(alarmmanager_LIB_SRCS alarmmanager.cpp alarm.cpp)
add_library(alarmmanager SHARED ${alarmmanager_LIB_SRCS})
target_compile_options(alarmmanager PRIVATE -Wno-unused-result)
set_target_properties(alarmmanager PROPERTIES VERSION 1.0.0 SOVERSION 1)
install(TARGETS alarmmanager DESTINATION ${ENGINE_LIBDIR} COMPONENT libs)

View File

@ -484,8 +484,7 @@ void ALARMManager::sendAlarmReport (const char* componentID, int alarmID, int st
else
processName = repProcessName;
int returnStatus = API_SUCCESS; //default
ByteStream msg1;
ByteStream msg1;
// setup message
msg1 << (ByteStream::byte) alarmID;
@ -621,7 +620,7 @@ void ALARMManager::getActiveAlarm(AlarmList& alarmList) const
*****************************************************************************************/
void ALARMManager::getAlarm(std::string date, AlarmList& alarmList) const
{
string alarmFile = startup::StartUp::tmpDir() + "/alarms";
//make 1 alarm log file made up of archive and current alarm.log

View File

@ -8,6 +8,8 @@ set(columnstoreSupport_SRCS columnstoreSupport.cpp)
add_executable(columnstoreSupport ${columnstoreSupport_SRCS})
target_compile_options(columnstoreSupport PRIVATE -Wno-unused-result)
target_link_libraries(columnstoreSupport ${ENGINE_LDFLAGS} readline ncurses ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS})
install(TARGETS columnstoreSupport DESTINATION ${ENGINE_BINDIR} COMPONENT platform)

View File

@ -8,6 +8,8 @@ set(mcsadmin_SRCS mcsadmin.cpp)
add_executable(mcsadmin ${mcsadmin_SRCS})
target_compile_options(mcsadmin PRIVATE -Wno-unused-result)
target_link_libraries(mcsadmin ${ENGINE_LDFLAGS} readline ncurses ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS} ${ENGINE_WRITE_LIBS})
install(TARGETS mcsadmin DESTINATION ${ENGINE_BINDIR} COMPONENT platform)

View File

@ -3348,15 +3348,14 @@ int processCommand(string* arguments)
for (i = alarmList.begin(); i != alarmList.end(); ++i)
{
switch (i->second.getState())
// SET = 1, CLEAR = 0
if (i->second.getState() == true)
{
case SET:
cout << "SET" << endl;
break;
case CLEAR:
cout << "CLEAR" << endl;
break;
cout << "SET" << endl;
}
else
{
cout << "CLEAR" << endl;
}
cout << "AlarmID = " << i->second.getAlarmID() << endl;
@ -5904,7 +5903,6 @@ int processCommand(string* arguments)
int moduleID = 1;
inputNames::const_iterator listPT1 = inputnames.begin();
umStorageNames::const_iterator listPT2 = umstoragenames.begin();
for ( int i = 0 ; i < moduleCount ; i++ )
{

View File

@ -8,6 +8,8 @@ set(postConfigure_SRCS postConfigure.cpp helpers.cpp)
add_executable(postConfigure ${postConfigure_SRCS})
target_compile_options(postConfigure PRIVATE -Wno-unused-result)
target_link_libraries(postConfigure ${ENGINE_LDFLAGS} readline ncurses ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS})
install(TARGETS postConfigure DESTINATION ${ENGINE_BINDIR} COMPONENT platform)
@ -19,6 +21,8 @@ set(installer_SRCS installer.cpp helpers.cpp)
add_executable(installer ${installer_SRCS})
target_compile_options(installer PRIVATE -Wno-unused-result)
target_link_libraries(installer ${ENGINE_LDFLAGS} readline ncurses ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS})
install(TARGETS installer DESTINATION ${ENGINE_BINDIR} COMPONENT platform)
@ -52,6 +56,8 @@ set(mycnfUpgrade_SRCS mycnfUpgrade.cpp)
add_executable(mycnfUpgrade ${mycnfUpgrade_SRCS})
target_compile_options(mycnfUpgrade PRIVATE -Wno-unused-result)
target_link_libraries(mycnfUpgrade ${ENGINE_LDFLAGS} readline ncurses ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS})
install(TARGETS mycnfUpgrade DESTINATION ${ENGINE_BINDIR} COMPONENT platform)

View File

@ -273,9 +273,7 @@ int main(int argc, char* argv[])
//check if root-user
int user;
int usergroup;
user = getuid();
usergroup = getgid();
string SUDO = "";
if (user != 0)
@ -1413,7 +1411,7 @@ int main(int argc, char* argv[])
{
string amazonLog = tmpDir + "/amazon.log";
string cmd = "aws --version > " + amazonLog + " 2>&1";
int rtnCode = system(cmd.c_str());
system(cmd.c_str());
ifstream in(amazonLog.c_str());
@ -1974,7 +1972,7 @@ int main(int argc, char* argv[])
}
}
unsigned int maxPMNicCount = 1;
int maxPMNicCount = 1;
//configure module type
bool parentOAMmoduleConfig = false;
@ -2111,7 +2109,7 @@ int main(int argc, char* argv[])
//clear any Equipped Module IP addresses that aren't in current ID range
for ( int j = 0 ; j < listSize ; j++ )
{
for ( unsigned int k = 1 ; k < MaxNicID+1 ; k++)
for ( int k = 1 ; k < MaxNicID+1 ; k++)
{
string ModuleIPAddr = "ModuleIPAddr" + oam.itoa(j + 1) + "-" + oam.itoa(k) + "-" + oam.itoa(i + 1);
@ -2185,8 +2183,7 @@ int main(int argc, char* argv[])
}
}
}
unsigned int nicID=1;
int nicID=1;
for( ; nicID < MaxNicID +1 ; nicID++ )
{
if ( !found )
@ -3547,7 +3544,7 @@ int main(int argc, char* argv[])
for ( int pmsID = 1; pmsID < pmPorts + 1 ; )
{
for (unsigned int j = 1 ; j < maxPMNicCount + 1 ; j++)
for (int j = 1 ; j < maxPMNicCount + 1 ; j++)
{
PerformanceModuleList::iterator list1 = performancemodulelist.begin();
@ -4008,9 +4005,11 @@ int main(int argc, char* argv[])
break;
}
if ( pass1 == "exit")
if ( strncmp(pass1, "exit", 4) )
{
exit(0);
}
string p1 = pass1;
pass2 = getpass("Confirm password > ");
string p2 = pass2;
@ -6418,7 +6417,6 @@ bool glusterSetup(string password, bool doNotResolveHostNames)
Oam oam;
int dataRedundancyCopies = 0;
int dataRedundancyNetwork = 0;
int dataRedundancyStorage = 0;
int numberDBRootsPerPM = DBRootCount / pmNumber;
int numberBricksPM = 0;
std::vector<int> dbrootPms[DBRootCount];

View File

@ -18,6 +18,8 @@ set(ServerMonitor_SRCS
add_executable(ServerMonitor ${ServerMonitor_SRCS})
target_compile_options(ServerMonitor PRIVATE -Wno-unused-result)
target_link_libraries(ServerMonitor ${ENGINE_LDFLAGS} ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS})
install(TARGETS ServerMonitor DESTINATION ${ENGINE_BINDIR} COMPONENT platform)

View File

@ -569,7 +569,8 @@ void ServerMonitor::getCPUdata()
while (oldFile.getline(line, 400))
{
string buf = line;
string::size_type pos = buf.find ('id,', 0);
// Questionable replacement
string::size_type pos = buf.find("id,", 0);
if (pos == string::npos)
{
systemIdle = systemIdle + atol(buf.substr(0, pos - 1).c_str());

View File

@ -100,8 +100,8 @@ void msgProcessor()
Config* sysConfig = Config::makeConfig();
string port = sysConfig->getConfig(msgPort, "Port");
string cmd = "fuser -k " + port + "/tcp >/dev/null 2>&1";
int user;
user = getuid();
//int user;
//user = getuid();
system(cmd.c_str());
}

View File

@ -40,7 +40,10 @@ FileBuffer::FileBuffer() : fDataLen(0), fLbid(-1), fVerid(0)
FileBuffer::FileBuffer(const FileBuffer& rhs)
{
if (this == NULL || this == &rhs)
// Removed the check for gcc 8.2. The latest gcc version we
// use ATM is 4.8.2 for centos 6 and it also doesn't need
// the check
if (this == &rhs)
return;
fLbid = rhs.fLbid;

View File

@ -283,71 +283,6 @@ FdCacheType_t fdcache;
boost::mutex fdMapMutex;
rwlock::RWLock_local localLock;
void pause_(unsigned secs)
{
struct timespec req;
struct timespec rem;
req.tv_sec = secs;
req.tv_nsec = 0;
rem.tv_sec = 0;
rem.tv_nsec = 0;
#ifdef _MSC_VER
Sleep(req.tv_sec * 1000);
#else
again:
if (nanosleep(&req, &rem) != 0)
if (rem.tv_sec > 0 || rem.tv_nsec > 0)
{
req = rem;
goto again;
}
#endif
}
const vector<pair<string, string> > getDBRootList()
{
vector<pair<string, string> > ret;
Config* config;
uint32_t dbrootCount, i;
string stmp, devname, mountpoint;
char devkey[80], mountkey[80];
config = Config::makeConfig();
stmp = config->getConfig("SystemConfig", "DBRootCount");
if (stmp.empty())
{
Message::Args args;
args.add("getDBRootList: Configuration error. No DBRootCount");
primitiveprocessor::mlp->logMessage(logging::M0006, args, true);
throw runtime_error("getDBRootList: Configuration error. No DBRootCount");
}
dbrootCount = config->uFromText(stmp);
for (i = 1; i <= dbrootCount; i++)
{
snprintf(mountkey, 80, "DBRoot%d", i);
snprintf(devkey, 80, "DBRootStorageLoc%d", i);
mountpoint = config->getConfig("SystemConfig", string(mountkey));
devname = config->getConfig("Installation", string(devkey));
if (mountpoint == "" || devname == "")
throw runtime_error("getDBRootList: Configuration error. Don't know where DBRoots are mounted");
ret.push_back(pair<string, string>(devname, mountpoint));
// cout << "I see " << devname << " should be mounted at " << mountpoint << endl;
}
return ret;
}
char* alignTo(const char* in, int av)
{
ptrdiff_t inx = reinterpret_cast<ptrdiff_t>(in);
@ -769,7 +704,7 @@ void* thr_popper(ioManager* arg)
int opts = primitiveprocessor::directIOFlag ? IDBDataFile::USE_ODIRECT : 0;
fp = NULL;
uint32_t openRetries = 0;
int saveErrno;
int saveErrno = 0;
while (fp == NULL && openRetries++ < 5)
{

View File

@ -1425,7 +1425,8 @@ namespace primitives
void PrimitiveProcessor::p_Col(NewColRequestHeader* in, NewColResultHeader* out,
unsigned outSize, unsigned* written)
{
memcpy(out, in, sizeof(ISMPacketHeader) + sizeof(PrimitiveHeader));
void *outp = static_cast<void*>(out);
memcpy(outp, in, sizeof(ISMPacketHeader) + sizeof(PrimitiveHeader));
out->NVALS = 0;
out->LBID = in->LBID;
out->ism.Command = COL_RESULTS;

View File

@ -127,7 +127,11 @@ void PrimitiveProcessor::p_TokenByScan(const TokenByScanRequestHeader* h,
retTokens = reinterpret_cast<PrimToken*>(&niceRet[rdvOffset]);
retDataValues = reinterpret_cast<DataValue*>(&niceRet[rdvOffset]);
memcpy(ret, h, sizeof(PrimitiveHeader) + sizeof(ISMPacketHeader));
{
void *retp = static_cast<void*>(ret);
memcpy(retp, h, sizeof(PrimitiveHeader) + sizeof(ISMPacketHeader));
}
ret->NVALS = 0;
ret->NBYTES = sizeof(TokenByScanResultHeader);
ret->ism.Command = DICT_SCAN_COMPARE_RESULTS;
@ -575,7 +579,10 @@ void PrimitiveProcessor::p_AggregateSignature(const AggregateSignatureRequestHea
DataValue* min;
DataValue* max;
memcpy(out, in, sizeof(ISMPacketHeader) + sizeof(PrimitiveHeader));
{
void *outp = static_cast<void*>(out);
memcpy(outp, in, sizeof(ISMPacketHeader) + sizeof(PrimitiveHeader));
}
out->ism.Command = DICT_AGGREGATE_RESULTS;
niceOutput = reinterpret_cast<uint8_t*>(out);
@ -824,7 +831,10 @@ void PrimitiveProcessor::p_Dictionary(const DictInput* in, vector<uint8_t>* out,
in8 = reinterpret_cast<const uint8_t*>(in);
memcpy(&header, in, sizeof(ISMPacketHeader) + sizeof(PrimitiveHeader));
{
void *hp = static_cast<void*>(&header);
memcpy(hp, in, sizeof(ISMPacketHeader) + sizeof(PrimitiveHeader));
}
header.ism.Command = DICT_RESULTS;
header.NVALS = 0;
header.LBID = in->LBID;

View File

@ -1774,8 +1774,10 @@ void BatchPrimitiveProcessor::writeErrorMsg(const string& error, uint16_t errCod
// we don't need every field of these headers. Init'ing them anyway
// makes memory checkers happy.
memset(&ism, 0, sizeof(ISMPacketHeader));
memset(&ph, 0, sizeof(PrimitiveHeader));
void *ismp = static_cast<void*>(&ism);
void *php = static_cast<void*>(&ph);
memset(ismp, 0, sizeof(ISMPacketHeader));
memset(php, 0, sizeof(PrimitiveHeader));
ph.SessionID = sessionID;
ph.StepID = stepID;
ph.UniqueID = uniqueID;
@ -1800,8 +1802,10 @@ void BatchPrimitiveProcessor::writeProjectionPreamble()
// we don't need every field of these headers. Init'ing them anyway
// makes memory checkers happy.
memset(&ism, 0, sizeof(ISMPacketHeader));
memset(&ph, 0, sizeof(PrimitiveHeader));
void *ismp = static_cast<void*>(&ism);
void *php = static_cast<void*>(&ph);
memset(ismp, 0, sizeof(ISMPacketHeader));
memset(php, 0, sizeof(PrimitiveHeader));
ph.SessionID = sessionID;
ph.StepID = stepID;
ph.UniqueID = uniqueID;
@ -1899,8 +1903,10 @@ void BatchPrimitiveProcessor::makeResponse()
// we don't need every field of these headers. Init'ing them anyway
// makes memory checkers happy.
memset(&ism, 0, sizeof(ISMPacketHeader));
memset(&ph, 0, sizeof(PrimitiveHeader));
void *ismp = static_cast<void*>(&ism);
void *php = static_cast<void*>(&ph);
memset(ismp, 0, sizeof(ISMPacketHeader));
memset(php, 0, sizeof(PrimitiveHeader));
ph.SessionID = sessionID;
ph.StepID = stepID;
ph.UniqueID = uniqueID;

View File

@ -51,17 +51,6 @@ using namespace logging;
#define llabs labs
#endif
namespace
{
using namespace primitiveprocessor;
double cotangent(double in)
{
return (1.0 / tan(in));
}
}
namespace primitiveprocessor
{

View File

@ -1097,33 +1097,6 @@ namespace
{
using namespace primitiveprocessor;
void pause_(unsigned delay)
{
struct timespec req;
struct timespec rem;
req.tv_sec = delay;
req.tv_nsec = 0;
rem.tv_sec = 0;
rem.tv_nsec = 0;
#ifdef _MSC_VER
Sleep(req.tv_sec * 1000);
#else
again:
if (nanosleep(&req, &rem) != 0)
{
if (rem.tv_sec > 0 || rem.tv_nsec > 0)
{
req = rem;
goto again;
}
}
#endif
}
/** @brief The job type to process a dictionary scan (pDictionaryScan class on the UM)
* TODO: Move this & the impl into different files
*/

View File

@ -148,17 +148,19 @@ void setupSignalHandlers()
#endif
}
void setupCwd(Config* cf)
int8_t setupCwd(Config* cf)
{
string workdir = startup::StartUp::tmpDir();
if (workdir.length() == 0)
workdir = ".";
(void)chdir(workdir.c_str());
int8_t rc = chdir(workdir.c_str());
if (access(".", W_OK) != 0)
(void)chdir("/tmp");
if (rc < 0 || access(".", W_OK) != 0)
rc = chdir("/tmp");
return rc;
}
int setupResources()
@ -344,11 +346,11 @@ int main(int argc, char* argv[])
setupSignalHandlers();
setupCwd(cf);
int err = 0;
err = setupCwd(cf);
mlp = new primitiveprocessor::Logger();
int err = 0;
if (!gDebug)
err = setupResources();
string errMsg;
@ -368,6 +370,10 @@ int main(int argc, char* argv[])
errMsg = "Could not install file limits to required value, please see non-root install documentation";
break;
case -5:
errMsg = "Could not change into working directory";
break;
default:
break;
}

View File

@ -8,6 +8,8 @@ set(ProcMgr_SRCS main.cpp processmanager.cpp ../utils/common/crashtrace.cpp)
add_executable(ProcMgr ${ProcMgr_SRCS})
target_compile_options(ProcMgr PRIVATE -Wno-unused-result)
target_link_libraries(ProcMgr ${ENGINE_LDFLAGS} cacheutils ${NETSNMP_LIBRARIES} ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS})
install(TARGETS ProcMgr DESTINATION ${ENGINE_BINDIR} COMPONENT platform)

View File

@ -1377,7 +1377,7 @@ void processMSG(messageqcpp::IOSocket* cfIos)
// all transactions to finish or rollback as commanded. This is only set if
// there are, in fact, transactions active (or cpimport).
int retStatus = oam::API_SUCCESS;
//int retStatus = oam::API_SUCCESS;
if (HDFS)
{
@ -1458,7 +1458,7 @@ void processMSG(messageqcpp::IOSocket* cfIos)
if (opState == oam::MAN_DISABLED || opState == oam::AUTO_DISABLED)
continue;
retStatus = processManager.shutdownModule((*pt).DeviceName, graceful, manualFlag, 0);
processManager.shutdownModule((*pt).DeviceName, graceful, manualFlag, 0);
}
}
}
@ -3735,8 +3735,9 @@ int ProcessManager::disableModule(string target, bool manualFlag)
//Update DBRM section of Columnstore.xml
if ( updateWorkerNodeconfig() != API_SUCCESS )
{
return API_FAILURE;
}
processManager.recycleProcess(target);
//check for SIMPLEX Processes on mate might need to be started
@ -5144,7 +5145,7 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str
string loginTmp = tmpLogDir + "/login_test.log";
string cmd = installDir + "/bin/remote_command.sh " + IPAddr + " " + password + " 'ls' 1 > " + loginTmp;
int rtnCode = system(cmd.c_str());
system(cmd.c_str());
if (!oam.checkLogStatus(loginTmp, "README")) {
//check for RSA KEY ISSUE and fix
@ -7728,7 +7729,8 @@ void startSystemThread(oam::DeviceNetworkList Devicenetworklist)
sleep(2);
}
if ( rtn = oam::ACTIVE )
// This was logical error and possible source of many problems.
if ( rtn == oam::ACTIVE )
//set query system state not ready
processManager.setQuerySystemState(true);
@ -7869,8 +7871,8 @@ void stopSystemThread(oam::DeviceNetworkList Devicenetworklist)
SystemModuleTypeConfig systemmoduletypeconfig;
ALARMManager aManager;
int status = API_SUCCESS;
bool exitThread = false;
int exitThreadStatus = oam::API_SUCCESS;
//bool exitThread = false;
//int exitThreadStatus = oam::API_SUCCESS;
pthread_t ThreadId;
ThreadId = pthread_self();
@ -7887,16 +7889,16 @@ void stopSystemThread(oam::DeviceNetworkList Devicenetworklist)
log.writeLog(__LINE__, "EXCEPTION ERROR on getSystemConfig: " + error, LOG_TYPE_ERROR);
stopsystemthreadStatus = oam::API_FAILURE;
processManager.setSystemState(oam::FAILED);
exitThread = true;
exitThreadStatus = oam::API_FAILURE;
//exitThread = true;
//exitThreadStatus = oam::API_FAILURE;
}
catch (...)
{
log.writeLog(__LINE__, "EXCEPTION ERROR on getSystemConfig: Caught unknown exception!", LOG_TYPE_ERROR);
stopsystemthreadStatus = oam::API_FAILURE;
processManager.setSystemState(oam::FAILED);
exitThread = true;
exitThreadStatus = oam::API_FAILURE;
//exitThread = true;
//exitThreadStatus = oam::API_FAILURE;
}
if ( devicenetworklist.size() != 0 )
@ -7920,7 +7922,7 @@ void stopSystemThread(oam::DeviceNetworkList Devicenetworklist)
try
{
int opState;
bool degraded = oam::ACTIVE;
bool degraded;
oam.getModuleStatus(moduleName, opState, degraded);
if (opState == oam::MAN_DISABLED || opState == oam::AUTO_DISABLED)

View File

@ -8,6 +8,8 @@ set(ProcMon_SRCS main.cpp processmonitor.cpp ../utils/common/crashtrace.cpp)
add_executable(ProcMon ${ProcMon_SRCS})
target_compile_options(ProcMon PRIVATE -Wno-unused-result)
target_link_libraries(ProcMon ${ENGINE_LDFLAGS} cacheutils ${NETSNMP_LIBRARIES} ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS})
install(TARGETS ProcMon DESTINATION ${ENGINE_BINDIR} COMPONENT platform)

View File

@ -1497,7 +1497,6 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
string configureModuleName;
msg >> configureModuleName;
uint16_t rtnCode;
int requestStatus = API_SUCCESS;
configureModule(configureModuleName);
@ -2220,7 +2219,8 @@ pid_t ProcessMonitor::startProcess(string processModuleType, string processName,
string RunType, string DepProcessName[MAXDEPENDANCY],
string DepModuleName[MAXDEPENDANCY], string LogFile, uint16_t initType, uint16_t actIndicator)
{
pid_t newProcessID;
// Compiler complains about non-initialiased variable here.
pid_t newProcessID = 0;
char* argList[MAXARGUMENTS];
unsigned int i = 0;
MonitorLog log;

View File

@ -8,6 +8,8 @@ set(autoInstaller_SRCS autoInstaller.cpp)
add_executable(autoInstaller ${autoInstaller_SRCS})
target_compile_options(autoInstaller PRIVATE -Wno-unused-result)
target_link_libraries(autoInstaller ${ENGINE_LDFLAGS} ${NETSNMP_LIBRARIES} ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS} readline ncurses)
install(TARGETS autoInstaller DESTINATION ${ENGINE_BINDIR})
@ -22,15 +24,3 @@ add_executable(autoConfigure ${autoConfigure_SRCS})
target_link_libraries(autoConfigure ${ENGINE_LDFLAGS} ${NETSNMP_LIBRARIES} ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS})
install(TARGETS autoConfigure DESTINATION ${ENGINE_BINDIR} COMPONENT platform)
########### next target ###############
set(svnQuery_SRCS svnQuery.cpp)
add_executable(svnQuery ${svnQuery_SRCS})
target_link_libraries(svnQuery ${ENGINE_LDFLAGS} ${NETSNMP_LIBRARIES} ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS})
install(TARGETS svnQuery DESTINATION ${ENGINE_BINDIR})

View File

@ -637,7 +637,7 @@ int main(int argc, char* argv[])
// Columnstore.xml found
//try to parse it
Config* sysConfigOld;
//Config* sysConfigOld;
ofstream file("/dev/null");
@ -649,7 +649,7 @@ int main(int argc, char* argv[])
// redirect cout to /dev/null
cerr.rdbuf(file.rdbuf());
sysConfigOld = Config::makeConfig( systemDir + "/Columnstore.xml");
//sysConfigOld = Config::makeConfig( systemDir + "/Columnstore.xml");
// restore cout stream buffer
cerr.rdbuf (strm_buffer);

View File

@ -59,11 +59,11 @@ int setUp()
{
#ifndef _MSC_VER
string cmd = "/bin/rm -f " + logFile + " >/dev/null 2>&1";
(void)system(cmd.c_str());
int rc = system(cmd.c_str());
cmd = "/bin/touch -f " + logFile + " >/dev/null 2>&1";
(void)system(cmd.c_str());
rc = system(cmd.c_str());
#endif
return 0;
return rc;
}
int checkNotThere(WriteEngine::FID fid)
@ -73,12 +73,6 @@ int checkNotThere(WriteEngine::FID fid)
return (fileOp.existsOIDDir(fid) ? -1 : 0);
}
void tearDown()
{
string file = tmpDir + "/oidbitmap";
unlink(file.c_str());
}
void usage()
{
cerr << "Usage: dbbuilder [-h|f] function" << endl
@ -131,6 +125,7 @@ int main(int argc, char* argv[])
std::string schema("tpch");
Oam oam;
bool fFlg = false;
int rc = 0;
opterr = 0;
@ -194,7 +189,10 @@ int main(int argc, char* argv[])
if ( buildOption == SYSCATALOG_ONLY )
{
setUp();
if ( setUp() )
{
cerr << "setUp() call error " << endl;
}
bool canWrite = true;
@ -210,9 +208,13 @@ int main(int argc, char* argv[])
"' > " + logFile;
if (canWrite)
(void)system(cmd.c_str());
{
rc = system(cmd.c_str());
}
else
{
cerr << cmd << endl;
}
errorHandler(sysCatalogErr,
"Build system catalog",
@ -244,7 +246,7 @@ int main(int argc, char* argv[])
string cmd(string("echo 'FAILED: ") + ex.what() + "' > " + logFile);
if (canWrite)
(void)system(cmd.c_str());
rc = system(cmd.c_str());
else
cerr << cmd << endl;
@ -256,7 +258,7 @@ int main(int argc, char* argv[])
string cmd = "echo 'FAILED: HDFS checking.' > " + logFile;
if (canWrite)
(void)system(cmd.c_str());
rc = system(cmd.c_str());
else
cerr << cmd << endl;
@ -275,7 +277,7 @@ int main(int argc, char* argv[])
std::string cmd = "echo 'OK: buildOption=" + oam.itoa(buildOption) + "' > " + logFile;
if (canWrite)
(void)system(cmd.c_str());
rc = system(cmd.c_str());
else
#ifdef _MSC_VER
(void)0;
@ -288,11 +290,9 @@ int main(int argc, char* argv[])
if (canWrite)
{
int err;
rc = system(cmd.c_str());
err = system(cmd.c_str());
if (err != 0)
if (rc != 0)
{
ostringstream os;
os << "Warning: running " << cmd << " failed. This is usually non-fatal.";
@ -310,7 +310,7 @@ int main(int argc, char* argv[])
string cmd = "echo 'FAILED: buildOption=" + oam.itoa(buildOption) + "' > " + logFile;
if (canWrite)
(void)system(cmd.c_str());
rc = system(cmd.c_str());
else
cerr << cmd << endl;
@ -321,7 +321,7 @@ int main(int argc, char* argv[])
string cmd = "echo 'FAILED: buildOption=" + oam.itoa(buildOption) + "' > " + logFile;
if (canWrite)
(void)system(cmd.c_str());
rc = system(cmd.c_str());
else
cerr << cmd << endl;

View File

@ -44,11 +44,11 @@ using namespace bulkloadxml;
int main(int argc, char** argv)
{
const int DEBUG_LVL_TO_DUMP_SYSCAT_RPT = 4;
#ifdef _MSC_VER
//FIXME
#else
setuid( 0 ); // set effective ID to root; ignore return status
#endif
// set effective ID to root
if( setuid( 0 ) < 0 )
{
std::cerr << " colxml: setuid failed " << std::endl;
}
setlocale(LC_ALL, "");
WriteEngine::Config::initConfigCache(); // load Columnstore.xml config settings

View File

@ -258,7 +258,8 @@ int flushOIDsFromCache(const vector<BRM::OID_t>& oids)
ISMPacketHeader ism;
uint32_t i;
memset(&ism, 0, sizeof(ISMPacketHeader));
void *ismp = static_cast<void*>(&ism);
memset(ismp, 0, sizeof(ISMPacketHeader));
ism.Command = CACHE_FLUSH_BY_OID;
bs.load((uint8_t*) &ism, sizeof(ISMPacketHeader));
bs << (uint32_t) oids.size();
@ -285,7 +286,8 @@ int flushPartition(const std::vector<BRM::OID_t>& oids, set<BRM::LogicalPartitio
ByteStream bs;
ISMPacketHeader ism;
memset(&ism, 0, sizeof(ISMPacketHeader));
void *ismp = static_cast<void*>(&ism);
memset(ismp, 0, sizeof(ISMPacketHeader));
ism.Command = CACHE_FLUSH_PARTITION;
bs.load((uint8_t*) &ism, sizeof(ISMPacketHeader));
serializeSet<BRM::LogicalPartition>(bs, partitionNums);

View File

@ -90,6 +90,8 @@ namespace
{
short DSPort = 9199;
// this isn't currently used but could be in the future.
#if 0
void log(const string& s)
{
logging::MessageLog logger((logging::LoggingID()));
@ -100,6 +102,7 @@ void log(const string& s)
message.format(args);
logger.logErrorMessage(message);
}
#endif
struct ScopedCleaner
{

View File

@ -83,19 +83,6 @@ bool from_string(T& t, const std::string& s, std::ios_base & (*f)(std::ios_base&
return !(iss >> f >> t).fail();
}
uint64_t pow10_(int32_t scale)
{
if (scale <= 0) return 1;
idbassert(scale < 20);
uint64_t res = 1;
for (int32_t i = 0; i < scale; i++)
res *= 10;
return res;
}
bool number_value ( const string& data )
{
for (unsigned int i = 0; i < strlen(data.c_str()); i++)
@ -893,7 +880,6 @@ bool mysql_str_to_datetime( const string& input, DateTime& output, bool& isDate
bool mysql_str_to_time( const string& input, Time& output, long decimals )
{
// int32_t datesepct = 0;
uint32_t dtend = 0;
bool isNeg = false;
@ -1779,7 +1765,8 @@ int32_t DataConvert::convertColumnDate(
bool DataConvert::isColumnDateValid( int32_t date )
{
Date d;
memcpy(&d, &date, sizeof(int32_t));
void* dp = static_cast<void*>(&d);
memcpy(dp, &date, sizeof(int32_t));
return (isDateValid(d.day, d.month, d.year));
}
@ -2081,7 +2068,8 @@ int64_t DataConvert::convertColumnTime(
bool DataConvert::isColumnDateTimeValid( int64_t dateTime )
{
DateTime dt;
memcpy(&dt, &dateTime, sizeof(uint64_t));
void* dtp = static_cast<void*>(&dt);
memcpy(dtp, &dateTime, sizeof(uint64_t));
if (isDateValid(dt.day, dt.month, dt.year))
return isDateTimeValid(dt.hour, dt.minute, dt.second, dt.msecond);
@ -2092,7 +2080,8 @@ bool DataConvert::isColumnDateTimeValid( int64_t dateTime )
bool DataConvert::isColumnTimeValid( int64_t time )
{
Time dt;
memcpy(&dt, &time, sizeof(uint64_t));
void* dtp = static_cast<void*>(&dt);
memcpy(dtp, &time, sizeof(uint64_t));
return isTimeValid(dt.hour, dt.minute, dt.second, dt.msecond);
}
@ -2178,7 +2167,8 @@ std::string DataConvert::datetimeToString1( long long datetimevalue )
{
// @bug 4703 abandon multiple ostringstream's for conversion
DateTime dt(datetimevalue);
const int DATETIMETOSTRING1_LEN = 22; // YYYYMMDDHHMMSSmmmmmm\0
// Interesting, gcc 7 says the sprintf below generates between 21 and 23 bytes of output.
const int DATETIMETOSTRING1_LEN = 23; // YYYYMMDDHHMMSSmmmmmm\0
char buf[DATETIMETOSTRING1_LEN];
sprintf(buf, "%04d%02d%02d%02d%02d%02d%06d", dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.msecond);
@ -2443,11 +2433,10 @@ int64_t DataConvert::stringToDatetime(const string& data, bool* date)
return -1;
}
/* This is really painful and expensive b/c it seems the input is not normalized or
sanitized. That should really be done on ingestion. */
int64_t DataConvert::intToDate(int64_t data)
{
//char buf[10] = {0};
//snprintf( buf, 10, "%llu", (long long unsigned int)data);
//string date = buf;
char buf[21] = {0};
Date aday;
@ -2459,7 +2448,16 @@ int64_t DataConvert::intToDate(int64_t data)
return *(reinterpret_cast<uint32_t*>(&aday));
}
// this snprintf call causes a compiler warning b/c we're potentially copying a 20-digit #
// into 15 bytes, however, that appears to be intentional.
#if defined(__GNUC__) && __GNUC__ >= 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-truncation="
snprintf( buf, 15, "%llu", (long long unsigned int)data);
#pragma GCC diagnostic pop
#else
snprintf( buf, 15, "%llu", (long long unsigned int)data);
#endif
string year, month, day, hour, min, sec, msec;
int64_t y = 0, m = 0, d = 0, h = 0, minute = 0, s = 0, ms = 0;
@ -2562,6 +2560,8 @@ int64_t DataConvert::intToDate(int64_t data)
return *(reinterpret_cast<uint32_t*>(&aday));
}
/* This is really painful and expensive b/c it seems the input is not normalized or
sanitized. That should really be done on ingestion. */
int64_t DataConvert::intToDatetime(int64_t data, bool* date)
{
bool isDate = false;
@ -2584,7 +2584,17 @@ int64_t DataConvert::intToDatetime(int64_t data, bool* date)
return *(reinterpret_cast<uint64_t*>(&adaytime));
}
// this snprintf call causes a compiler warning b/c we're potentially copying a 20-digit #
// into 15 bytes, however, that appears to be intentional.
#if defined(__GNUC__) && __GNUC__ >= 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-truncation="
snprintf( buf, 15, "%llu", (long long unsigned int)data);
#pragma GCC diagnostic pop
#else
snprintf( buf, 15, "%llu", (long long unsigned int)data);
#endif
//string date = buf;
string year, month, day, hour, min, sec, msec;
int64_t y = 0, m = 0, d = 0, h = 0, minute = 0, s = 0, ms = 0;
@ -2692,6 +2702,8 @@ int64_t DataConvert::intToDatetime(int64_t data, bool* date)
return *(reinterpret_cast<uint64_t*>(&adaytime));
}
/* This is really painful and expensive b/c it seems the input is not normalized or
sanitized. That should really be done on ingestion. */
int64_t DataConvert::intToTime(int64_t data, bool fromString)
{
char buf[21] = {0};
@ -2710,7 +2722,17 @@ int64_t DataConvert::intToTime(int64_t data, bool fromString)
return *(reinterpret_cast<int64_t*>(&atime));
}
// this snprintf call causes a compiler warning b/c we're potentially copying a 20-digit #
// into 15 bytes, however, that appears to be intentional.
#if defined(__GNUC__) && __GNUC__ >= 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-truncation="
snprintf( buf, 15, "%llu", (long long unsigned int)data);
#pragma GCC diagnostic pop
#else
snprintf( buf, 15, "%llu", (long long unsigned int)data);
#endif
//string date = buf;
string hour, min, sec, msec;
int64_t h = 0, minute = 0, s = 0, ms = 0;

View File

@ -673,12 +673,24 @@ inline void DataConvert::timeToString1( long long timevalue, char* buf, unsigned
buf++;
buflen--;
}
// this snprintf call causes a compiler warning b/c buffer size is less
// then maximum string size.
#if defined(__GNUC__) && __GNUC__ >= 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-truncation="
snprintf( buf, buflen, "%02d%02d%02d",
hour,
(unsigned)((timevalue >> 32) & 0xff),
(unsigned)((timevalue >> 14) & 0xff)
);
#pragma GCC diagnostic pop
#else
snprintf( buf, buflen, "%02d%02d%02d",
hour,
(unsigned)((timevalue >> 32) & 0xff),
(unsigned)((timevalue >> 14) & 0xff)
);
#endif
}
inline std::string DataConvert::decimalToString(int64_t value, uint8_t scale, execplan::CalpontSystemCatalog::ColDataType colDataType)

View File

@ -89,11 +89,13 @@ std::string Func_insert::getStrVal(rowgroup::Row& row,
execplan::CalpontSystemCatalog::ColType&)
{
string tstr;
string tnewstr;
stringValue(fp[0], row, isNull, tstr);
if (isNull)
{
return "";
}
string tnewstr;
stringValue(fp[3], row, isNull, tnewstr);
if (isNull)
return "";

View File

@ -103,8 +103,6 @@ std::string Func_lpad::getStrVal(rowgroup::Row& row,
value += 0.5;
else if (value < 0)
value -= 0.5;
else if (value < 0)
value -= 0.5;
int64_t ret = (int64_t) value;

View File

@ -82,7 +82,7 @@ typedef unsigned char uchar;
char* PrintMD5(uchar md5Digest[16]);
char* MD5String(const char* szString);
char* MD5File(char* szFilename);
//char* MD5File(char* szFilename);
class md5
{
@ -236,6 +236,7 @@ char* PrintMD5(uchar md5Digest[16])
char chBuffer[256];
char chEach[10];
int nCount;
size_t chEachSize = 0;
memset(chBuffer, 0, 256);
memset(chEach, 0, 10);
@ -243,7 +244,8 @@ char* PrintMD5(uchar md5Digest[16])
for (nCount = 0; nCount < 16; nCount++)
{
sprintf(chEach, "%02x", md5Digest[nCount]);
strncat(chBuffer, chEach, sizeof(chEach));
chEachSize = sizeof(chEach);
strncat(chBuffer, chEach, chEachSize);
}
return strdup(chBuffer);
@ -263,7 +265,9 @@ char* MD5String(const char* szString)
}
// MD5File: Performs the MD5 algorithm on a file (binar or text),
// this fcn isn't used, so commenting it
#if 0
// MD5File: Performs the MD5 algorithm on a file (binary or text),
// returning the results as a char*. Returns NULL if it fails.
char* MD5File(char* szFilename)
{
@ -295,7 +299,7 @@ char* MD5File(char* szFilename)
return NULL; // failed
}
#endif
// md5::Init
// Initializes a new context.

View File

@ -93,7 +93,7 @@ std::string Func_repeat::getStrVal(rowgroup::Row& row,
for ( int i = 0 ; i < count ; i ++ )
{
if (strcat(result, str.c_str()) == NULL)
if (strcat(result, str.c_str()) == NULL) //questionable check
return "";
}

View File

@ -76,7 +76,7 @@ std::string Func_substring_index::getStrVal(rowgroup::Row& row,
if ( count > end )
return str;
if (( count < 0 ) && ((count * -1) > end))
if (( count < 0 ) && ((count * -1) > (int64_t) end))
return str;
string value = str;
@ -99,8 +99,7 @@ std::string Func_substring_index::getStrVal(rowgroup::Row& row,
}
else
{
count = count * -1;
size_t end = strlen(str.c_str());
count = -count;
int pointer = end;
int start = 0;

View File

@ -261,7 +261,7 @@ int PosixFileSystem::listDirectory(const char* pathname, std::list<std::string>&
contents.push_back( itr->path().filename().generic_string() );
}
}
catch (std::exception)
catch (std::exception &)
{
ret = -1;
}

View File

@ -151,7 +151,7 @@ HdfsRdwrFileBuffer::HdfsRdwrFileBuffer(const char* fname, const char* mode, unsi
// This constructor is for use by HdfsRdwrMemBuffer to create a file buffer when we
// run out of memory.
HdfsRdwrFileBuffer::HdfsRdwrFileBuffer(HdfsRdwrMemBuffer* pMemBuffer) throw (std::exception) :
HdfsRdwrFileBuffer::HdfsRdwrFileBuffer(HdfsRdwrMemBuffer* pMemBuffer) :
IDBDataFile(pMemBuffer->name().c_str()),
m_buffer(NULL),
m_dirty(false)

View File

@ -50,7 +50,7 @@ class HdfsRdwrFileBuffer: public IDBDataFile, boost::noncopyable
{
public:
HdfsRdwrFileBuffer(const char* fname, const char* mode, unsigned opts);
HdfsRdwrFileBuffer(HdfsRdwrMemBuffer* pMemBuffer) throw (std::exception);
HdfsRdwrFileBuffer(HdfsRdwrMemBuffer* pMemBuffer);
/* virtual */ ~HdfsRdwrFileBuffer();
/* virtual */ ssize_t pread(void* ptr, off64_t offset, size_t count);

View File

@ -180,21 +180,21 @@ const string MessageLog::format(const Message& msg, const char prefix)
void MessageLog::logDebugMessage(const Message& msg)
{
::openlog(SubsystemID[fLogData.fSubsysID].c_str(), 0 | LOG_PID, fFacility);
::syslog(LOG_DEBUG, format(msg, 'D').c_str());
::syslog(LOG_DEBUG, "%s", format(msg, 'D').c_str());
::closelog();
}
void MessageLog::logInfoMessage(const Message& msg)
{
::openlog(SubsystemID[fLogData.fSubsysID].c_str(), 0 | LOG_PID, fFacility);
::syslog(LOG_INFO, format(msg, 'I').c_str());
::syslog(LOG_INFO, "%s", format(msg, 'I').c_str());
::closelog();
}
void MessageLog::logWarningMessage(const Message& msg)
{
::openlog(SubsystemID[fLogData.fSubsysID].c_str(), 0 | LOG_PID, fFacility);
::syslog(LOG_WARNING, format(msg, 'W').c_str());
::syslog(LOG_WARNING, "%s", format(msg, 'W').c_str());
::closelog();
}
@ -202,14 +202,14 @@ void MessageLog::logErrorMessage(const Message& msg)
{
// @bug 24 use 'E' instead of 'S'
::openlog(SubsystemID[fLogData.fSubsysID].c_str(), 0 | LOG_PID, fFacility);
::syslog(LOG_ERR, format(msg, 'E').c_str());
::syslog(LOG_ERR, "%s", format(msg, 'E').c_str());
::closelog();
}
void MessageLog::logCriticalMessage(const Message& msg)
{
::openlog(SubsystemID[fLogData.fSubsysID].c_str(), 0 | LOG_PID, fFacility);
::syslog(LOG_CRIT, format(msg, 'C').c_str());
::syslog(LOG_CRIT, "%s", format(msg, 'C').c_str());
::closelog();
}
//Bug 5218. comment out the following functions to alleviate issue where dml messages show up in crit.log. This

View File

@ -945,7 +945,6 @@ void InetStreamSocket::connect(const sockaddr* serv_addr)
/* read a byte to artificially synchronize with accept() on the remote */
int ret = -1;
int e = EBADF;
char buf = '\0';
struct pollfd pfd;
long msecs = fConnectionTimeout.tv_sec * 1000 + fConnectionTimeout.tv_nsec / 1000000;
@ -964,9 +963,19 @@ void InetStreamSocket::connect(const sockaddr* serv_addr)
if (ret == 1)
{
#ifdef _MSC_VER
char buf = '\0';
(void)::recv(socketParms().sd(), &buf, 1, 0);
#else
(void)::read(socketParms().sd(), &buf, 1);
#if defined(__GNUC__) && __GNUC__ >= 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
char buf = '\0';
::read(socketParms().sd(), &buf, 1); // we know 1 byte is in the recv buffer
#pragma GCC diagnostic pop
#else
char buf = '\0';
::read(socketParms().sd(), &buf, 1); // we know 1 byte is in the recv buffer
#endif // pragma
#endif
return;
}

View File

@ -80,6 +80,7 @@ struct QStats
QStats fQStats;
#ifdef QUERY_TELE_DEBUG
string get_trace_file()
{
ostringstream oss;
@ -125,7 +126,9 @@ void log_query(const querytele::QueryTele& qtdata)
trace << endl;
trace.close();
}
#endif
#ifdef QUERY_TELE_DEBUG
const string st2str(enum querytele::StepType::type t)
{
switch (t)
@ -172,7 +175,9 @@ const string st2str(enum querytele::StepType::type t)
return "INV";
}
#endif
#ifdef QUERY_TELE_DEBUG
void log_step(const querytele::StepTele& stdata)
{
ofstream trace(get_trace_file().c_str(), ios::out | ios::app);
@ -207,6 +212,7 @@ void log_step(const querytele::StepTele& stdata)
trace << endl;
trace.close();
}
#endif
void TeleConsumer()
{

View File

@ -32,7 +32,9 @@
#include <tr1/unordered_map>
#endif
#ifndef NDEBUG
#define NDEBUG
#endif
#include <cassert>
using namespace std;

View File

@ -139,8 +139,8 @@ PriorityThreadPool::Priority PriorityThreadPool::pickAQueue(Priority preference)
void PriorityThreadPool::threadFcn(const Priority preferredQueue) throw()
{
Priority queue;
uint32_t weight, i;
Priority queue = LOW;
uint32_t weight, i = 0;
vector<Job> runList;
vector<bool> reschedule;
uint32_t rescheduleCount;

View File

@ -44,6 +44,8 @@
#include <boost/shared_ptr.hpp>
#include <boost/function.hpp>
#include <memory>
#if defined(_MSC_VER) && defined(xxxTHREADPOOL_DLLEXPORT)
#define EXPORT __declspec(dllexport)
#else
@ -75,8 +77,13 @@ public:
boost::thread* create_thread(F threadfunc)
{
boost::lock_guard<boost::shared_mutex> guard(m);
threads.push_back(new boost::thread(threadfunc));
return threads.back();
#if defined(__GNUC__) && __GNUC__ >= 7
std::unique_ptr<boost::thread> new_thread(new boost::thread(threadfunc));
#else
std::auto_ptr<boost::thread> new_thread(new boost::thread(threadfunc));
#endif
threads.push_back(new_thread.get());
return new_thread.release();
}
void add_thread(boost::thread* thrd)

View File

@ -1027,6 +1027,10 @@ inline T mcsv1_UDAF::convertAnyTo(static_any::any& valIn)
{
val = valIn.cast<double>();
}
else
{
throw runtime_error("mcsv1_UDAF::convertAnyTo(): input param has unrecognized type");
}
return val;
}

View File

@ -1141,7 +1141,8 @@ void ExtentMap::loadVersion4(ifstream& in)
in.read((char*) &flNumElements, sizeof(int));
idbassert(emNumElements > 0);
memset(fExtentMap, 0, fEMShminfo->allocdSize);
void *fExtentMapPtr = static_cast<void*>(fExtentMap);
memset(fExtentMapPtr, 0, fEMShminfo->allocdSize);
fEMShminfo->currentSize = 0;
// init the free list
@ -1226,7 +1227,8 @@ void ExtentMap::loadVersion4(IDBDataFile* in)
throw runtime_error("ExtentMap::loadVersion4(): read failed. Check the error log.");
}
memset(fExtentMap, 0, fEMShminfo->allocdSize);
void *fExtentMapPtr = static_cast<void*>(fExtentMap);
memset(fExtentMapPtr, 0, fEMShminfo->allocdSize);
fEMShminfo->currentSize = 0;
// init the free list

View File

@ -189,7 +189,8 @@ void MasterSegmentTable::makeMSTSegment()
void MasterSegmentTable::initMSTData()
{
memset(fShmDescriptors, 0, MSTshmsize);
void *dp = static_cast<void*>(&fShmDescriptors);
memset(dp, 0, MSTshmsize);
}
MSTEntry* MasterSegmentTable::getTable_read(int num, bool block) const

View File

@ -51,12 +51,14 @@ using namespace idbdatafile;
namespace
{
#ifdef USE_VERY_COMPLEX_DROP_CACHES
void timespec_sub(const struct timespec& tv1,
const struct timespec& tv2,
double& tm)
{
tm = (double)(tv2.tv_sec - tv1.tv_sec) + 1.e-9 * (tv2.tv_nsec - tv1.tv_nsec);
}
#endif
}
namespace BRM
@ -2176,8 +2178,12 @@ void SlaveComm::do_flushInodeCache()
if ((fd = open("/proc/sys/vm/drop_caches", O_WRONLY)) >= 0)
{
write(fd, "3\n", 2);
close(fd);
ssize_t written = write(fd, "3\n", 2);
int rc = close(fd);
if ( !written || rc )
{
std::cerr << "Could not write into or close /proc/sys/vm/drop_caches" << std::endl;
}
}
#endif

View File

@ -830,10 +830,11 @@ void printInputSource(
if (alternateImportDir == IMPORT_PATH_CWD)
{
char cwdBuf[4096];
::getcwd(cwdBuf, sizeof(cwdBuf));
char *bufPtr = &cwdBuf[0];
bufPtr = ::getcwd(cwdBuf, sizeof(cwdBuf));
if (!(BulkLoad::disableConsoleOutput()))
cout << "Input file(s) will be read from : " << cwdBuf << endl;
cout << "Input file(s) will be read from : " << bufPtr << endl;
}
else
{
@ -1021,7 +1022,11 @@ int main(int argc, char** argv)
#ifdef _MSC_VER
_setmaxstdio(2048);
#else
setuid( 0 ); // set effective ID to root; ignore return status
// set effective ID to root
if( setuid( 0 ) < 0 )
{
std::cerr << " cpimport: setuid failed " << std::endl;
}
#endif
setupSignalHandlers();

View File

@ -1460,9 +1460,11 @@ void TableInfo::writeBadRows( const std::vector<std::string>* errorDatRows,
if (!p.has_root_path())
{
// We could fail here having fixed size buffer
char cwdPath[4096];
getcwd(cwdPath, sizeof(cwdPath));
boost::filesystem::path rejectFileName2( cwdPath );
char* buffPtr = &cwdPath[0];
buffPtr = getcwd(cwdPath, sizeof(cwdPath));
boost::filesystem::path rejectFileName2( buffPtr );
rejectFileName2 /= fRejectDataFileName;
fBadFiles.push_back( rejectFileName2.string() );
@ -1567,8 +1569,9 @@ void TableInfo::writeErrReason( const std::vector< std::pair<RID,
if (!p.has_root_path())
{
char cwdPath[4096];
getcwd(cwdPath, sizeof(cwdPath));
boost::filesystem::path errFileName2( cwdPath );
char* buffPtr = &cwdPath[0];
buffPtr = getcwd(cwdPath, sizeof(cwdPath));
boost::filesystem::path errFileName2( buffPtr );
errFileName2 /= fRejectErrFileName;
fErrFiles.push_back( errFileName2.string() );

View File

@ -807,7 +807,8 @@ int Dctnry::insertDctnry(const char* buf,
while (startPos < totalRow)
{
found = false;
memset(&curSig, 0, sizeof(curSig));
void *curSigPtr = static_cast<void*>(&curSig);
memset(curSigPtr, 0, sizeof(curSig));
curSig.size = pos[startPos][col].offset;
// Strip trailing null bytes '\0' (by adjusting curSig.size) if import-
@ -1321,7 +1322,8 @@ void Dctnry::preLoadStringCache( const DataBlock& fileBlock )
int op = 1; // ordinal position of the string within the block
Signature aSig;
memset( &aSig, 0, sizeof(Signature));
void *aSigPtr = static_cast<void*>(&aSig);
memset(aSigPtr, 0, sizeof(aSig));
while ((offBeg != DCTNRY_END_HEADER) &&
(op <= MAX_STRING_CACHE_SIZE))
@ -1365,8 +1367,10 @@ void Dctnry::preLoadStringCache( const DataBlock& fileBlock )
******************************************************************************/
void Dctnry::addToStringCache( const Signature& newSig )
{
// We better add constructors that sets everything to 0;
Signature asig;
memset(&asig, 0, sizeof(Signature));
void *aSigPtr = static_cast<void*>(&asig);
memset(aSigPtr, 0, sizeof(asig));
asig.signature = new unsigned char[newSig.size];
memcpy(asig.signature, newSig.signature, newSig.size );
asig.size = newSig.size;

View File

@ -2469,7 +2469,8 @@ uint8_t WE_DDLCommandProc::updateSyscolumnTablename(ByteStream& bs, std::string&
//It's the same string for each column, so we just need one dictionary struct
memset(&dictTuple, 0, sizeof(dictTuple));
void *dictTuplePtr = static_cast<void*>(&dictTuple);
memset(dictTuplePtr, 0, sizeof(dictTuple));
dictTuple.sigValue = (unsigned char*)newTablename.c_str();
dictTuple.sigSize = newTablename.length();
dictTuple.isNull = false;
@ -3292,7 +3293,8 @@ uint8_t WE_DDLCommandProc::updateSystablesTablename(ByteStream& bs, std::string&
//It's the same string for each column, so we just need one dictionary struct
memset(&dictTuple, 0, sizeof(dictTuple));
void *dictTuplePtr = static_cast<void*>(&dictTuple);
memset(dictTuplePtr, 0, sizeof(dictTuple));
dictTuple.sigValue = (unsigned char*)newTablename.c_str();
dictTuple.sigSize = newTablename.length();
dictTuple.isNull = false;

View File

@ -722,6 +722,10 @@ uint8_t WE_DMLCommandProc::processSingleInsert(messageqcpp::ByteStream& bs, std:
}
}
// MCOL-1495 Remove fCatalogMap entries CS won't use anymore.
CalpontSystemCatalog::removeCalpontSystemCatalog(sessionId);
CalpontSystemCatalog::removeCalpontSystemCatalog(sessionId | 0x80000000);
return rc;
}
@ -1361,7 +1365,9 @@ uint8_t WE_DMLCommandProc::processBatchInsert(messageqcpp::ByteStream& bs, std::
}
}
//cout << "Batch insert return code " << rc << endl;
// MCOL-1495 Remove fCatalogMap entries CS won't use anymore.
CalpontSystemCatalog::removeCalpontSystemCatalog(sessionId);
CalpontSystemCatalog::removeCalpontSystemCatalog(sessionId | 0x80000000);
return rc;
}
@ -2087,18 +2093,11 @@ uint8_t WE_DMLCommandProc::processBatchInsertBinary(messageqcpp::ByteStream& bs,
args.add(cols);
err = IDBErrorInfo::instance()->errorMsg(WARN_DATA_TRUNC, args);
// Strict mode enabled, so rollback on warning
// NOTE: This doesn't seem to be a possible code path yet
/*if (insertPkg.get_isWarnToError())
{
string applName ("BatchInsert");
fWEWrapper.bulkRollback(tblOid,txnid.id,tableName.toString(),
applName, false, err);
BulkRollbackMgr::deleteMetaFile( tblOid );
}*/
}
}
//cout << "Batch insert return code " << rc << endl;
// MCOL-1495 Remove fCatalogMap entries CS won't use anymore.
CalpontSystemCatalog::removeCalpontSystemCatalog(sessionId);
CalpontSystemCatalog::removeCalpontSystemCatalog(sessionId | 0x80000000);
return rc;
}
@ -2240,6 +2239,9 @@ uint8_t WE_DMLCommandProc::commitBatchAutoOn(messageqcpp::ByteStream& bs, std::s
fWEWrapper.getDictMap().erase(txnID);
}
// MCOL-1495 Remove fCatalogMap entries CS won't use anymore.
CalpontSystemCatalog::removeCalpontSystemCatalog(sessionId);
CalpontSystemCatalog::removeCalpontSystemCatalog(sessionId | 0x80000000);
return rc;
}
@ -2847,16 +2849,14 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs,
convertToRelativeRid (rid, extentNum, blockNum);
rowIDLists.push_back(rid);
uint32_t colWidth = (colTypes[j].colWidth > 8 ? 8 : colTypes[j].colWidth);
// populate stats.blocksChanged
for (unsigned int k = 0; k < columnsUpdated.size(); k++)
int rrid = (int) relativeRID / (BYTE_PER_BLOCK / colWidth);
// populate stats.blocksChanged
if (rrid > preBlkNums[j])
{
if ((int)(relativeRID / (BYTE_PER_BLOCK / colWidth)) > preBlkNums[j])
{
preBlkNums[j] = rrid ;
blocksChanged++;
preBlkNums[j] = relativeRID / (BYTE_PER_BLOCK / colWidth);
}
}
}
}
ridsFetched = true;
@ -3778,7 +3778,6 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs,
err = IDBErrorInfo::instance()->errorMsg(WARN_DATA_TRUNC, args);
}
//cout << "finished update" << endl;
return rc;
}
@ -3961,6 +3960,10 @@ uint8_t WE_DMLCommandProc::processFlushFiles(messageqcpp::ByteStream& bs, std::s
//if (idbdatafile::IDBPolicy::useHdfs())
// cacheutils::dropPrimProcFdCache();
TableMetaData::removeTableMetaData(tableOid);
// MCOL-1495 Remove fCatalogMap entries CS won't use anymore.
CalpontSystemCatalog::removeCalpontSystemCatalog(txnId);
CalpontSystemCatalog::removeCalpontSystemCatalog(txnId | 0x80000000);
return rc;
}
@ -4136,7 +4139,6 @@ uint8_t WE_DMLCommandProc::processDelete(messageqcpp::ByteStream& bs,
}
}
//cout << "WES return rc " << (int)rc << " with msg " << err << endl;
return rc;
}

View File

@ -269,8 +269,8 @@ int WE_GetFileSizes::processFileName(
std::string& errMsg, int key)
{
uint8_t rc = 0;
off_t fileSize;
off_t compressedFileSize;
off_t fileSize = 0;
off_t compressedFileSize = 0;
errMsg.clear();
try

View File

@ -1,4 +1,5 @@
/* Copyright (C) 2014 InfiniDB, Inc.
Copyright (C) 2019 MariaDB Corporation.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@ -65,6 +66,8 @@ namespace WriteEngine
extern int NUM_BLOCKS_PER_INITIAL_EXTENT; // defined in we_dctnry.cpp
extern WErrorCodes ec; // defined in we_log.cpp
const int COMPRESSED_CHUNK_SIZE = compress::IDBCompressInterface::maxCompressedSize(UNCOMPRESSED_CHUNK_SIZE) + 64 + 3 + 8 * 1024;
//------------------------------------------------------------------------------
// Search for the specified chunk in fChunkList.
//------------------------------------------------------------------------------
@ -1923,10 +1926,22 @@ int ChunkManager::reallocateChunks(CompFileData* fileData)
struct tm ltm;
localtime_r(reinterpret_cast<time_t*>(&tv.tv_sec), &ltm);
char tmText[24];
// this snprintf call causes a compiler warning b/c buffer size is less
// then maximum string size.
#if defined(__GNUC__) && __GNUC__ >= 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-truncation="
snprintf(tmText, sizeof(tmText), ".%04d%02d%02d%02d%02d%02d%06ld",
ltm.tm_year + 1900, ltm.tm_mon + 1,
ltm.tm_mday, ltm.tm_hour, ltm.tm_min,
ltm.tm_sec, tv.tv_usec);
#pragma GCC diagnostic pop
#else
snprintf(tmText, sizeof(tmText), ".%04d%02d%02d%02d%02d%02d%06ld",
ltm.tm_year + 1900, ltm.tm_mon + 1,
ltm.tm_mday, ltm.tm_hour, ltm.tm_min,
ltm.tm_sec, tv.tv_usec);
#endif
string dbgFileName(rlcFileName + tmText);
ostringstream oss;
@ -2106,10 +2121,22 @@ int ChunkManager::reallocateChunks(CompFileData* fileData)
struct tm ltm;
localtime_r(reinterpret_cast<time_t*>(&tv.tv_sec), &ltm);
char tmText[24];
// this snprintf call causes a compiler warning b/c buffer size is less
// then maximum string size.
#if defined(__GNUC__) && __GNUC__ >= 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-truncation="
snprintf(tmText, sizeof(tmText), ".%04d%02d%02d%02d%02d%02d%06ld",
ltm.tm_year + 1900, ltm.tm_mon + 1,
ltm.tm_mday, ltm.tm_hour, ltm.tm_min,
ltm.tm_sec, tv.tv_usec);
#pragma GCC diagnostic pop
#else
snprintf(tmText, sizeof(tmText), ".%04d%02d%02d%02d%02d%02d%06ld",
ltm.tm_year + 1900, ltm.tm_mon + 1,
ltm.tm_mday, ltm.tm_hour, ltm.tm_min,
ltm.tm_sec, tv.tv_usec);
#endif
string dbgFileName(rlcFileName + tmText);
ostringstream oss;

View File

@ -68,7 +68,6 @@ const int UNCOMPRESSED_CHUNK_SIZE = compress::IDBCompressInterface::UNCOMPRESSED
const int COMPRESSED_FILE_HEADER_UNIT = compress::IDBCompressInterface::HDR_BUF_LEN;
// assume UNCOMPRESSED_CHUNK_SIZE > 0xBFFF (49151), 8 * 1024 bytes padding
const int COMPRESSED_CHUNK_SIZE = compress::IDBCompressInterface::maxCompressedSize(UNCOMPRESSED_CHUNK_SIZE) + 64 + 3 + 8 * 1024;
const int BLOCKS_IN_CHUNK = UNCOMPRESSED_CHUNK_SIZE / BYTE_PER_BLOCK;
const int MAXOFFSET_PER_CHUNK = 511 * BYTE_PER_BLOCK;

View File

@ -330,12 +330,15 @@ int FileOp::deleteFile( FID fid ) const
std::vector<std::string> dbRootPathList;
Config::getDBRootPathList( dbRootPathList );
int rc;
for (unsigned i = 0; i < dbRootPathList.size(); i++)
{
char rootOidDirName[FILE_NAME_SIZE];
sprintf(rootOidDirName, "%s/%s", dbRootPathList[i].c_str(), oidDirName);
rc = snprintf(rootOidDirName, FILE_NAME_SIZE, "%s/%s",
dbRootPathList[i].c_str(), oidDirName);
if ( IDBPolicy::remove( rootOidDirName ) != 0 )
if ( rc == FILE_NAME_SIZE || IDBPolicy::remove( rootOidDirName ) != 0 )
{
ostringstream oss;
oss << "Unable to remove " << rootOidDirName;
@ -363,6 +366,7 @@ int FileOp::deleteFiles( const std::vector<int32_t>& fids ) const
char dbDir [MAX_DB_DIR_LEVEL][MAX_DB_DIR_NAME_SIZE];
std::vector<std::string> dbRootPathList;
Config::getDBRootPathList( dbRootPathList );
int rc;
for ( unsigned n = 0; n < fids.size(); n++ )
{
@ -376,10 +380,10 @@ int FileOp::deleteFiles( const std::vector<int32_t>& fids ) const
for (unsigned i = 0; i < dbRootPathList.size(); i++)
{
char rootOidDirName[FILE_NAME_SIZE];
sprintf(rootOidDirName, "%s/%s", dbRootPathList[i].c_str(),
rc = snprintf(rootOidDirName, FILE_NAME_SIZE, "%s/%s", dbRootPathList[i].c_str(),
oidDirName);
if ( IDBPolicy::remove( rootOidDirName ) != 0 )
if ( rc == FILE_NAME_SIZE || IDBPolicy::remove( rootOidDirName ) != 0 )
{
ostringstream oss;
oss << "Unable to remove " << rootOidDirName;
@ -410,6 +414,7 @@ int FileOp::deletePartitions( const std::vector<OID>& fids,
char dbDir [MAX_DB_DIR_LEVEL][MAX_DB_DIR_NAME_SIZE];
char rootOidDirName[FILE_NAME_SIZE];
char partitionDirName[FILE_NAME_SIZE];
int rcd, rcp;
for (uint32_t i = 0; i < partitions.size(); i++)
{
@ -420,12 +425,13 @@ int FileOp::deletePartitions( const std::vector<OID>& fids,
dbDir[0], dbDir[1], dbDir[2], dbDir[3], dbDir[4]);
// config expects dbroot starting from 0
std::string rt( Config::getDBRootByNum(partitions[i].lp.dbroot) );
sprintf(rootOidDirName, "%s/%s",
rcd = snprintf(rootOidDirName, FILE_NAME_SIZE, "%s/%s",
rt.c_str(), tempFileName);
sprintf(partitionDirName, "%s/%s",
rcp = snprintf(partitionDirName, FILE_NAME_SIZE, "%s/%s",
rt.c_str(), oidDirName);
if ( IDBPolicy::remove( rootOidDirName ) != 0 )
if ( rcd == FILE_NAME_SIZE || rcp == FILE_NAME_SIZE
|| IDBPolicy::remove( rootOidDirName ) != 0 )
{
ostringstream oss;
oss << "Unable to remove " << rootOidDirName;

View File

@ -393,7 +393,7 @@ struct IdxMultiColKey
curMask.reset();
curLevel = maxLevel = 0;
totalBit = 0;
memset( testbitArray, 0, IDX_MAX_MULTI_COL_IDX_LEVEL);
memset( testbitArray, 0, IDX_MAX_MULTI_COL_IDX_LEVEL * sizeof(testbitArray[0]));
memset( keyBuf, 0, IDX_MAX_MULTI_COL_BIT / 8 );
curMask = 0x1F;
curMask = curMask << (IDX_MAX_MULTI_COL_BIT - 5);

View File

@ -489,7 +489,7 @@ struct CacheControl /** @brief Cache control structure */
int checkInterval; /** @brief A check point interval in seconds */
CacheControl()
{
totalBlock = pctFree = checkInterval; /** @brief constructor */
totalBlock = pctFree = checkInterval = 0; /** @brief constructor */
}
};

View File

@ -356,7 +356,7 @@ unsigned int WEFileReadThread::readDataFile(messageqcpp::SBS& Sbs)
//char aBuff[1024*1024]; // TODO May have to change it later
//char*pStart = aBuff;
unsigned int aIdx = 0;
unsigned int aLen = 0;
int aLen = 0;
*Sbs << (ByteStream::byte)(WE_CLT_SRV_DATA);
while ((!fInFile.eof()) && (aIdx < getBatchQty()))

View File

@ -1,4 +1,5 @@
/* Copyright (C) 2014 InfiniDB, Inc.
Copyright (C) 2019 MariaDB Corporation.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@ -604,7 +605,13 @@ void WESplitterApp::updateWithJobFile(int aIdx)
int main(int argc, char** argv)
{
std::string err;
setuid(0); //@BUG 4343 set effective userid to root.
// Why do we need this if we don't care about f()'s rc ?
// @BUG4343
if( setuid( 0 ) < 0 )
{
std::cerr << " we_splitterapp: setuid failed " << std::endl;
}
std::cin.sync_with_stdio(false);
try

View File

@ -239,7 +239,8 @@ int ColumnOp::allocRowId(const TxnID& txnid, bool useStartingExtent,
for (i = 0; i < dbRootExtentTrackers.size(); i++)
{
if (i != column.colNo)
uint32_t colNo = column.colNo;
if (i != colNo)
dbRootExtentTrackers[i]->nextSegFile(dbRoot, partition, segment, newHwm, startLbid);
// Round up HWM to the end of the current extent

View File

@ -38,9 +38,9 @@ namespace
{
const char* DICT_TYPE("D");
const char* ENCODING("UTF-8");
const char* JOBNAME("Job_");
const char* LOGNAME("Jobxml_");
const std::string LOGDIR("/log/");
const char* JOBNAME("Job_");
}
namespace WriteEngine
@ -438,10 +438,11 @@ void XMLGenProc::getColumnsForTable(
throw std::runtime_error( oss.str() );
}
}
//------------------------------------------------------------------------------
// Generate Job XML File Name
//------------------------------------------------------------------------------
std::string XMLGenProc::genJobXMLFileName( ) const
{
std::string xmlFileName;
@ -465,7 +466,10 @@ std::string XMLGenProc::genJobXMLFileName( ) const
if (!p.has_root_path())
{
char cwdPath[4096];
getcwd(cwdPath, sizeof(cwdPath));
char *buf;
buf = getcwd(cwdPath, sizeof(cwdPath));
if (buf == NULL)
throw std::runtime_error("Failed to get the current working directory!");
boost::filesystem::path p2(cwdPath);
p2 /= p;
xmlFileName = p2.string();
@ -479,7 +483,7 @@ std::string XMLGenProc::genJobXMLFileName( ) const
return xmlFileName;
}
//------------------------------------------------------------------------------
// writeXMLFile
//------------------------------------------------------------------------------

View File

@ -1313,7 +1313,13 @@ int XMLJob::genJobXMLFileName(
// nothing else to do
#else
char cwdPath[4096];
getcwd(cwdPath, sizeof(cwdPath));
char *err;
err = getcwd(cwdPath, sizeof(cwdPath));
if (err == NULL)
{
errMsg = "Failed to get the current working directory.";
return -1;
}
string trailingPath(xmlFilePath.string());
xmlFilePath = cwdPath;
xmlFilePath /= trailingPath;