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:
commit
020b211bb7
@ -5,7 +5,7 @@
|
|||||||
set +e; \
|
set +e; \
|
||||||
if [ -f dml-scan.cpp ]; \
|
if [ -f dml-scan.cpp ]; \
|
||||||
then diff -abBq dml-scan-temp.cpp dml-scan.cpp >/dev/null 2>&1; \
|
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; \
|
then mv -f dml-scan-temp.cpp dml-scan.cpp; \
|
||||||
else touch dml-scan.cpp; \
|
else touch dml-scan.cpp; \
|
||||||
fi; \
|
fi; \
|
||||||
|
@ -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
|
namespace execplan
|
||||||
|
@ -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
|
namespace execplan
|
||||||
|
@ -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
|
namespace execplan
|
||||||
|
@ -1136,7 +1136,9 @@ inline int64_t TreeNode::getDatetimeIntVal()
|
|||||||
dataconvert::Time tt;
|
dataconvert::Time tt;
|
||||||
int day = 0;
|
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
|
// Note, this should probably be current date +/- time
|
||||||
if ((tt.hour > 23) && (!tt.is_neg))
|
if ((tt.hour > 23) && (!tt.is_neg))
|
||||||
@ -1166,7 +1168,7 @@ inline int64_t TreeNode::getTimeIntVal()
|
|||||||
{
|
{
|
||||||
dataconvert::DateTime dt;
|
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);
|
dataconvert::Time tt(0, dt.hour, dt.minute, dt.second, dt.msecond, false);
|
||||||
memcpy(&fResult.intVal, &tt, 8);
|
memcpy(&fResult.intVal, &tt, 8);
|
||||||
return fResult.intVal;
|
return fResult.intVal;
|
||||||
|
@ -336,7 +336,8 @@ bool isNotInSubquery(JobStepVector& jsv)
|
|||||||
return notIn;
|
return notIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This fcn is currently unused. Will keep it in the code for now.
|
||||||
|
#if 0
|
||||||
void alterCsepInExistsFilter(CalpontSelectExecutionPlan* csep, JobInfo& jobInfo)
|
void alterCsepInExistsFilter(CalpontSelectExecutionPlan* csep, JobInfo& jobInfo)
|
||||||
{
|
{
|
||||||
// This is for window function in IN/EXISTS sub-query.
|
// This is for window function in IN/EXISTS sub-query.
|
||||||
@ -364,7 +365,7 @@ void alterCsepInExistsFilter(CalpontSelectExecutionPlan* csep, JobInfo& jobInfo)
|
|||||||
if (wcs.size() > 1)
|
if (wcs.size() > 1)
|
||||||
retCols.insert(retCols.end(), wcs.begin() + 1, wcs.end());
|
retCols.insert(retCols.end(), wcs.begin() + 1, wcs.end());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void doCorrelatedExists(const ExistsFilter* ef, JobInfo& jobInfo)
|
void doCorrelatedExists(const ExistsFilter* ef, JobInfo& jobInfo)
|
||||||
{
|
{
|
||||||
|
@ -94,68 +94,6 @@ namespace
|
|||||||
{
|
{
|
||||||
using namespace joblist;
|
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)
|
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
|
// optimize filter order
|
||||||
// perform none string filters first because string filter joins the tokens.
|
// perform none string filters first because string filter joins the tokens.
|
||||||
void optimizeFilterOrder(JobStepVector& qsv)
|
void optimizeFilterOrder(JobStepVector& qsv)
|
||||||
|
@ -483,7 +483,8 @@ void pDictionaryScan::sendAPrimitiveMessage(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
DictTokenByScanRequestHeader hdr;
|
DictTokenByScanRequestHeader hdr;
|
||||||
memset(&hdr, 0, sizeof(hdr));
|
void *hdrp = static_cast<void*>(&hdr);
|
||||||
|
memset(hdrp, 0, sizeof(hdr));
|
||||||
|
|
||||||
hdr.ism.Interleave = pm;
|
hdr.ism.Interleave = pm;
|
||||||
hdr.ism.Flags = planFlagsToPrimFlags(fTraceFlags);
|
hdr.ism.Flags = planFlagsToPrimFlags(fTraceFlags);
|
||||||
@ -913,7 +914,8 @@ void pDictionaryScan::serializeEqualityFilter()
|
|||||||
uint32_t i;
|
uint32_t i;
|
||||||
vector<string> empty;
|
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;
|
ism.Command = DICT_CREATE_EQUALITY_FILTER;
|
||||||
msg.load((uint8_t*) &ism, sizeof(ISMPacketHeader));
|
msg.load((uint8_t*) &ism, sizeof(ISMPacketHeader));
|
||||||
msg << uniqueID;
|
msg << uniqueID;
|
||||||
@ -954,7 +956,8 @@ void pDictionaryScan::destroyEqualityFilter()
|
|||||||
ByteStream msg;
|
ByteStream msg;
|
||||||
ISMPacketHeader ism;
|
ISMPacketHeader ism;
|
||||||
|
|
||||||
memset(&ism, 0, sizeof(ISMPacketHeader));
|
void *ismp = static_cast<void*>(&ism);
|
||||||
|
memset(ismp, 0, sizeof(ISMPacketHeader));
|
||||||
ism.Command = DICT_DESTROY_EQUALITY_FILTER;
|
ism.Command = DICT_DESTROY_EQUALITY_FILTER;
|
||||||
msg.load((uint8_t*) &ism, sizeof(ISMPacketHeader));
|
msg.load((uint8_t*) &ism, sizeof(ISMPacketHeader));
|
||||||
msg << uniqueID;
|
msg << uniqueID;
|
||||||
|
@ -81,21 +81,6 @@ using namespace joblist;
|
|||||||
namespace
|
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)
|
uint64_t getColumnIndex(const SRCP& c, const map<uint64_t, uint64_t>& m, JobInfo& jobInfo)
|
||||||
{
|
{
|
||||||
|
@ -88,103 +88,6 @@ inline uint32_t tid2sid(const uint32_t tid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//StopWatch timer;
|
//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 )
|
uint32_t buildValueList (TABLE* table, cal_connection_info& ci )
|
||||||
{
|
{
|
||||||
|
@ -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.fatalParseError = true;
|
||||||
gwi.parseErrorText = "error building Aggregate Function: ";
|
gwi.parseErrorText = "error building Aggregate Function: ";
|
||||||
|
@ -2114,7 +2114,7 @@ int ha_calpont_impl_rnd_init(TABLE* table)
|
|||||||
//check whether the system is ready to process statement.
|
//check whether the system is ready to process statement.
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
static DBRM dbrm(true);
|
static DBRM dbrm(true);
|
||||||
bool bSystemQueryReady = dbrm.getSystemQueryReady();
|
int bSystemQueryReady = dbrm.getSystemQueryReady();
|
||||||
|
|
||||||
if (bSystemQueryReady == 0)
|
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.
|
//check whether the system is ready to process statement.
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
static DBRM dbrm(true);
|
static DBRM dbrm(true);
|
||||||
bool bSystemQueryReady = dbrm.getSystemQueryReady();
|
int bSystemQueryReady = dbrm.getSystemQueryReady();
|
||||||
|
|
||||||
if (bSystemQueryReady == 0)
|
if (bSystemQueryReady == 0)
|
||||||
{
|
{
|
||||||
|
@ -239,21 +239,6 @@ struct PartitionInfo
|
|||||||
|
|
||||||
typedef map<LogicalPartition, PartitionInfo> PartitionMap;
|
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)
|
const string format(int64_t v, CalpontSystemCatalog::ColType& ct)
|
||||||
{
|
{
|
||||||
ostringstream oss;
|
ostringstream oss;
|
||||||
|
@ -100,6 +100,7 @@ static int generate_result(BRM::OID_t oid, BRM::DBRM* emp, TABLE* table, THD* th
|
|||||||
messageqcpp::MessageQueueClient* msgQueueClient;
|
messageqcpp::MessageQueueClient* msgQueueClient;
|
||||||
oam::Oam oam_instance;
|
oam::Oam oam_instance;
|
||||||
int pmId = 0;
|
int pmId = 0;
|
||||||
|
int rc;
|
||||||
|
|
||||||
emp->getExtents(oid, entries, false, false, true);
|
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);
|
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
|
// MCOL-1116: If we are here a DBRoot is offline/missing
|
||||||
iter++;
|
iter++;
|
||||||
@ -137,14 +138,16 @@ static int generate_result(BRM::OID_t oid, BRM::DBRM* emp, TABLE* table, THD* th
|
|||||||
DbRootName << "DBRoot" << iter->dbRoot;
|
DbRootName << "DBRoot" << iter->dbRoot;
|
||||||
std::string DbRootPath = config->getConfig("SystemConfig", DbRootName.str());
|
std::string DbRootPath = config->getConfig("SystemConfig", DbRootName.str());
|
||||||
fileSize = compressedFileSize = 0;
|
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;
|
std::ostringstream oss;
|
||||||
oss << "pm" << pmId << "_WriteEngineServer";
|
oss << "pm" << pmId << "_WriteEngineServer";
|
||||||
std::string client = oss.str();
|
std::string client = oss.str();
|
||||||
msgQueueClient = messageqcpp::MessageQueueClientPool::getInstance(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);
|
messageqcpp::MessageQueueClientPool::releaseInstance(msgQueueClient);
|
||||||
delete emp;
|
delete emp;
|
||||||
|
@ -71,14 +71,15 @@ namespace
|
|||||||
{
|
{
|
||||||
DistributedEngineComm* Dec;
|
DistributedEngineComm* Dec;
|
||||||
|
|
||||||
void setupCwd()
|
int8_t setupCwd()
|
||||||
{
|
{
|
||||||
string workdir = startup::StartUp::tmpDir();
|
string workdir = startup::StartUp::tmpDir();
|
||||||
|
|
||||||
if (workdir.length() == 0)
|
if (workdir.length() == 0)
|
||||||
workdir = ".";
|
workdir = ".";
|
||||||
|
|
||||||
(void)chdir(workdir.c_str());
|
int8_t rc = chdir(workdir.c_str());
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void added_a_pm(int)
|
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
|
// This is unset due to the way we start it
|
||||||
program_invocation_short_name = const_cast<char*>("DDLProc");
|
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 );
|
WriteEngine::WriteEngineWrapper::init( WriteEngine::SUBSYSTEM_ID_DDLPROC );
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
@ -491,17 +491,19 @@ void rollbackAll(DBRM* dbrm)
|
|||||||
dbrm->setSystemReady(true);
|
dbrm->setSystemReady(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupCwd()
|
int8_t setupCwd()
|
||||||
{
|
{
|
||||||
string workdir = startup::StartUp::tmpDir();
|
string workdir = startup::StartUp::tmpDir();
|
||||||
|
|
||||||
if (workdir.length() == 0)
|
if (workdir.length() == 0)
|
||||||
workdir = ".";
|
workdir = ".";
|
||||||
|
|
||||||
(void)chdir(workdir.c_str());
|
int8_t rc = chdir(workdir.c_str());
|
||||||
|
|
||||||
if (access(".", W_OK) != 0)
|
if (rc < 0 || access(".", W_OK) != 0)
|
||||||
(void)chdir("/tmp");
|
rc = chdir("/tmp");
|
||||||
|
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
} // Namewspace
|
} // Namewspace
|
||||||
|
|
||||||
@ -520,7 +522,18 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
Config* cf = Config::makeConfig();
|
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 );
|
WriteEngine::WriteEngineWrapper::init( WriteEngine::SUBSYSTEM_ID_DMLPROC );
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@ -611,7 +624,18 @@ int main(int argc, char* argv[])
|
|||||||
string port = cf->getConfig(DMLProc, "Port");
|
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());
|
(void)::system(cmd.c_str());
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#else
|
||||||
|
(void)::system(cmd.c_str());
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
|
@ -1301,10 +1301,12 @@ void setupSignalHandlers()
|
|||||||
void setupCwd(joblist::ResourceManager* rm)
|
void setupCwd(joblist::ResourceManager* rm)
|
||||||
{
|
{
|
||||||
std::string workdir = rm->getScWorkingDir();
|
std::string workdir = rm->getScWorkingDir();
|
||||||
(void)chdir(workdir.c_str());
|
int8_t rc = chdir(workdir.c_str());
|
||||||
|
|
||||||
if (access(".", W_OK) != 0)
|
if (rc < 0 || access(".", W_OK) != 0)
|
||||||
(void)chdir("/tmp");
|
rc = chdir("/tmp");
|
||||||
|
|
||||||
|
return (rc < 0) ? -5 : rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void startRssMon(size_t maxPct, int pauseSeconds)
|
void startRssMon(size_t maxPct, int pauseSeconds)
|
||||||
@ -1470,9 +1472,12 @@ int main(int argc, char* argv[])
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
errMsg = "Couldn't change working directory or unknown error";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = setupCwd(rm);
|
||||||
|
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
{
|
{
|
||||||
oam::Oam oam;
|
oam::Oam oam;
|
||||||
@ -1496,9 +1501,6 @@ int main(int argc, char* argv[])
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
setupCwd(rm);
|
|
||||||
|
|
||||||
cleanTempDir();
|
cleanTempDir();
|
||||||
|
|
||||||
logging::MsgMap msgMap;
|
logging::MsgMap msgMap;
|
||||||
|
@ -10,6 +10,8 @@ add_library(oamcpp SHARED ${oamcpp_LIB_SRCS})
|
|||||||
|
|
||||||
target_link_libraries(oamcpp )
|
target_link_libraries(oamcpp )
|
||||||
|
|
||||||
|
target_compile_options(oamcpp PRIVATE -Wno-unused-result)
|
||||||
|
|
||||||
set_target_properties(oamcpp PROPERTIES VERSION 1.0.0 SOVERSION 1)
|
set_target_properties(oamcpp PROPERTIES VERSION 1.0.0 SOVERSION 1)
|
||||||
|
|
||||||
install(TARGETS oamcpp DESTINATION ${ENGINE_LIBDIR} COMPONENT libs)
|
install(TARGETS oamcpp DESTINATION ${ENGINE_LIBDIR} COMPONENT libs)
|
||||||
|
@ -159,7 +159,9 @@ Oam::Oam()
|
|||||||
userDir = USER;
|
userDir = USER;
|
||||||
|
|
||||||
if ( USER != "root")
|
if ( USER != "root")
|
||||||
|
{
|
||||||
userDir = "home/" + USER;
|
userDir = "home/" + USER;
|
||||||
|
}
|
||||||
|
|
||||||
tmpdir = startup::StartUp::tmpDir();
|
tmpdir = startup::StartUp::tmpDir();
|
||||||
|
|
||||||
@ -2901,8 +2903,6 @@ oamModuleInfo_t Oam::getModuleInfo()
|
|||||||
// Get Server Type Install ID
|
// Get Server Type Install ID
|
||||||
|
|
||||||
serverTypeInstall = atoi(sysConfig->getConfig("Installation", "ServerTypeInstall").c_str());
|
serverTypeInstall = atoi(sysConfig->getConfig("Installation", "ServerTypeInstall").c_str());
|
||||||
|
|
||||||
sysConfig;
|
|
||||||
}
|
}
|
||||||
catch (...) {}
|
catch (...) {}
|
||||||
|
|
||||||
@ -8563,9 +8563,6 @@ std::string Oam::createEC2Volume(std::string size, std::string name)
|
|||||||
|
|
||||||
oldFile.close();
|
oldFile.close();
|
||||||
|
|
||||||
if ( volumeName == "unknown" )
|
|
||||||
return "failed";
|
|
||||||
|
|
||||||
if ( volumeName == "unknown" )
|
if ( volumeName == "unknown" )
|
||||||
return "failed";
|
return "failed";
|
||||||
|
|
||||||
@ -10470,13 +10467,9 @@ void Oam::sendStatusUpdate(ByteStream obs, ByteStream::byte returnRequestType)
|
|||||||
if (ibs.length() > 0)
|
if (ibs.length() > 0)
|
||||||
{
|
{
|
||||||
ibs >> returnRequestType;
|
ibs >> returnRequestType;
|
||||||
|
|
||||||
if ( returnRequestType == returnRequestType )
|
|
||||||
{
|
|
||||||
processor.shutdown();
|
processor.shutdown();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// timeout occurred, shutdown connection and retry
|
// timeout occurred, shutdown connection and retry
|
||||||
|
@ -8,6 +8,8 @@ set(alarmmanager_LIB_SRCS alarmmanager.cpp alarm.cpp)
|
|||||||
|
|
||||||
add_library(alarmmanager SHARED ${alarmmanager_LIB_SRCS})
|
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)
|
set_target_properties(alarmmanager PROPERTIES VERSION 1.0.0 SOVERSION 1)
|
||||||
|
|
||||||
install(TARGETS alarmmanager DESTINATION ${ENGINE_LIBDIR} COMPONENT libs)
|
install(TARGETS alarmmanager DESTINATION ${ENGINE_LIBDIR} COMPONENT libs)
|
||||||
|
@ -484,7 +484,6 @@ void ALARMManager::sendAlarmReport (const char* componentID, int alarmID, int st
|
|||||||
else
|
else
|
||||||
processName = repProcessName;
|
processName = repProcessName;
|
||||||
|
|
||||||
int returnStatus = API_SUCCESS; //default
|
|
||||||
ByteStream msg1;
|
ByteStream msg1;
|
||||||
|
|
||||||
// setup message
|
// setup message
|
||||||
|
@ -8,6 +8,8 @@ set(columnstoreSupport_SRCS columnstoreSupport.cpp)
|
|||||||
|
|
||||||
add_executable(columnstoreSupport ${columnstoreSupport_SRCS})
|
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})
|
target_link_libraries(columnstoreSupport ${ENGINE_LDFLAGS} readline ncurses ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS})
|
||||||
|
|
||||||
install(TARGETS columnstoreSupport DESTINATION ${ENGINE_BINDIR} COMPONENT platform)
|
install(TARGETS columnstoreSupport DESTINATION ${ENGINE_BINDIR} COMPONENT platform)
|
||||||
|
@ -8,6 +8,8 @@ set(mcsadmin_SRCS mcsadmin.cpp)
|
|||||||
|
|
||||||
add_executable(mcsadmin ${mcsadmin_SRCS})
|
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})
|
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)
|
install(TARGETS mcsadmin DESTINATION ${ENGINE_BINDIR} COMPONENT platform)
|
||||||
|
@ -3348,15 +3348,14 @@ int processCommand(string* arguments)
|
|||||||
|
|
||||||
for (i = alarmList.begin(); i != alarmList.end(); ++i)
|
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;
|
cout << "SET" << endl;
|
||||||
break;
|
}
|
||||||
|
else
|
||||||
case CLEAR:
|
{
|
||||||
cout << "CLEAR" << endl;
|
cout << "CLEAR" << endl;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << "AlarmID = " << i->second.getAlarmID() << endl;
|
cout << "AlarmID = " << i->second.getAlarmID() << endl;
|
||||||
@ -5904,7 +5903,6 @@ int processCommand(string* arguments)
|
|||||||
|
|
||||||
int moduleID = 1;
|
int moduleID = 1;
|
||||||
inputNames::const_iterator listPT1 = inputnames.begin();
|
inputNames::const_iterator listPT1 = inputnames.begin();
|
||||||
umStorageNames::const_iterator listPT2 = umstoragenames.begin();
|
|
||||||
|
|
||||||
for ( int i = 0 ; i < moduleCount ; i++ )
|
for ( int i = 0 ; i < moduleCount ; i++ )
|
||||||
{
|
{
|
||||||
|
@ -8,6 +8,8 @@ set(postConfigure_SRCS postConfigure.cpp helpers.cpp)
|
|||||||
|
|
||||||
add_executable(postConfigure ${postConfigure_SRCS})
|
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})
|
target_link_libraries(postConfigure ${ENGINE_LDFLAGS} readline ncurses ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS})
|
||||||
|
|
||||||
install(TARGETS postConfigure DESTINATION ${ENGINE_BINDIR} COMPONENT platform)
|
install(TARGETS postConfigure DESTINATION ${ENGINE_BINDIR} COMPONENT platform)
|
||||||
@ -19,6 +21,8 @@ set(installer_SRCS installer.cpp helpers.cpp)
|
|||||||
|
|
||||||
add_executable(installer ${installer_SRCS})
|
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})
|
target_link_libraries(installer ${ENGINE_LDFLAGS} readline ncurses ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS})
|
||||||
|
|
||||||
install(TARGETS installer DESTINATION ${ENGINE_BINDIR} COMPONENT platform)
|
install(TARGETS installer DESTINATION ${ENGINE_BINDIR} COMPONENT platform)
|
||||||
@ -52,6 +56,8 @@ set(mycnfUpgrade_SRCS mycnfUpgrade.cpp)
|
|||||||
|
|
||||||
add_executable(mycnfUpgrade ${mycnfUpgrade_SRCS})
|
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})
|
target_link_libraries(mycnfUpgrade ${ENGINE_LDFLAGS} readline ncurses ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS})
|
||||||
|
|
||||||
install(TARGETS mycnfUpgrade DESTINATION ${ENGINE_BINDIR} COMPONENT platform)
|
install(TARGETS mycnfUpgrade DESTINATION ${ENGINE_BINDIR} COMPONENT platform)
|
||||||
|
@ -273,9 +273,7 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
//check if root-user
|
//check if root-user
|
||||||
int user;
|
int user;
|
||||||
int usergroup;
|
|
||||||
user = getuid();
|
user = getuid();
|
||||||
usergroup = getgid();
|
|
||||||
|
|
||||||
string SUDO = "";
|
string SUDO = "";
|
||||||
if (user != 0)
|
if (user != 0)
|
||||||
@ -1413,7 +1411,7 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
string amazonLog = tmpDir + "/amazon.log";
|
string amazonLog = tmpDir + "/amazon.log";
|
||||||
string cmd = "aws --version > " + amazonLog + " 2>&1";
|
string cmd = "aws --version > " + amazonLog + " 2>&1";
|
||||||
int rtnCode = system(cmd.c_str());
|
system(cmd.c_str());
|
||||||
|
|
||||||
ifstream in(amazonLog.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
|
//configure module type
|
||||||
bool parentOAMmoduleConfig = false;
|
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
|
//clear any Equipped Module IP addresses that aren't in current ID range
|
||||||
for ( int j = 0 ; j < listSize ; j++ )
|
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);
|
string ModuleIPAddr = "ModuleIPAddr" + oam.itoa(j + 1) + "-" + oam.itoa(k) + "-" + oam.itoa(i + 1);
|
||||||
|
|
||||||
@ -2185,8 +2183,7 @@ int main(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
int nicID=1;
|
||||||
unsigned int nicID=1;
|
|
||||||
for( ; nicID < MaxNicID +1 ; nicID++ )
|
for( ; nicID < MaxNicID +1 ; nicID++ )
|
||||||
{
|
{
|
||||||
if ( !found )
|
if ( !found )
|
||||||
@ -3547,7 +3544,7 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
for ( int pmsID = 1; pmsID < pmPorts + 1 ; )
|
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();
|
PerformanceModuleList::iterator list1 = performancemodulelist.begin();
|
||||||
|
|
||||||
@ -4008,8 +4005,10 @@ int main(int argc, char* argv[])
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pass1 == "exit")
|
if ( strncmp(pass1, "exit", 4) )
|
||||||
|
{
|
||||||
exit(0);
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
string p1 = pass1;
|
string p1 = pass1;
|
||||||
pass2 = getpass("Confirm password > ");
|
pass2 = getpass("Confirm password > ");
|
||||||
@ -6418,7 +6417,6 @@ bool glusterSetup(string password, bool doNotResolveHostNames)
|
|||||||
Oam oam;
|
Oam oam;
|
||||||
int dataRedundancyCopies = 0;
|
int dataRedundancyCopies = 0;
|
||||||
int dataRedundancyNetwork = 0;
|
int dataRedundancyNetwork = 0;
|
||||||
int dataRedundancyStorage = 0;
|
|
||||||
int numberDBRootsPerPM = DBRootCount / pmNumber;
|
int numberDBRootsPerPM = DBRootCount / pmNumber;
|
||||||
int numberBricksPM = 0;
|
int numberBricksPM = 0;
|
||||||
std::vector<int> dbrootPms[DBRootCount];
|
std::vector<int> dbrootPms[DBRootCount];
|
||||||
|
@ -18,6 +18,8 @@ set(ServerMonitor_SRCS
|
|||||||
|
|
||||||
add_executable(ServerMonitor ${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})
|
target_link_libraries(ServerMonitor ${ENGINE_LDFLAGS} ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS})
|
||||||
|
|
||||||
install(TARGETS ServerMonitor DESTINATION ${ENGINE_BINDIR} COMPONENT platform)
|
install(TARGETS ServerMonitor DESTINATION ${ENGINE_BINDIR} COMPONENT platform)
|
||||||
|
@ -569,7 +569,8 @@ void ServerMonitor::getCPUdata()
|
|||||||
while (oldFile.getline(line, 400))
|
while (oldFile.getline(line, 400))
|
||||||
{
|
{
|
||||||
string buf = line;
|
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)
|
if (pos == string::npos)
|
||||||
{
|
{
|
||||||
systemIdle = systemIdle + atol(buf.substr(0, pos - 1).c_str());
|
systemIdle = systemIdle + atol(buf.substr(0, pos - 1).c_str());
|
||||||
|
@ -100,8 +100,8 @@ void msgProcessor()
|
|||||||
Config* sysConfig = Config::makeConfig();
|
Config* sysConfig = Config::makeConfig();
|
||||||
string port = sysConfig->getConfig(msgPort, "Port");
|
string port = sysConfig->getConfig(msgPort, "Port");
|
||||||
string cmd = "fuser -k " + port + "/tcp >/dev/null 2>&1";
|
string cmd = "fuser -k " + port + "/tcp >/dev/null 2>&1";
|
||||||
int user;
|
//int user;
|
||||||
user = getuid();
|
//user = getuid();
|
||||||
|
|
||||||
system(cmd.c_str());
|
system(cmd.c_str());
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,10 @@ FileBuffer::FileBuffer() : fDataLen(0), fLbid(-1), fVerid(0)
|
|||||||
FileBuffer::FileBuffer(const FileBuffer& rhs)
|
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;
|
return;
|
||||||
|
|
||||||
fLbid = rhs.fLbid;
|
fLbid = rhs.fLbid;
|
||||||
|
@ -283,71 +283,6 @@ FdCacheType_t fdcache;
|
|||||||
boost::mutex fdMapMutex;
|
boost::mutex fdMapMutex;
|
||||||
rwlock::RWLock_local localLock;
|
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)
|
char* alignTo(const char* in, int av)
|
||||||
{
|
{
|
||||||
ptrdiff_t inx = reinterpret_cast<ptrdiff_t>(in);
|
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;
|
int opts = primitiveprocessor::directIOFlag ? IDBDataFile::USE_ODIRECT : 0;
|
||||||
fp = NULL;
|
fp = NULL;
|
||||||
uint32_t openRetries = 0;
|
uint32_t openRetries = 0;
|
||||||
int saveErrno;
|
int saveErrno = 0;
|
||||||
|
|
||||||
while (fp == NULL && openRetries++ < 5)
|
while (fp == NULL && openRetries++ < 5)
|
||||||
{
|
{
|
||||||
|
@ -1425,7 +1425,8 @@ namespace primitives
|
|||||||
void PrimitiveProcessor::p_Col(NewColRequestHeader* in, NewColResultHeader* out,
|
void PrimitiveProcessor::p_Col(NewColRequestHeader* in, NewColResultHeader* out,
|
||||||
unsigned outSize, unsigned* written)
|
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->NVALS = 0;
|
||||||
out->LBID = in->LBID;
|
out->LBID = in->LBID;
|
||||||
out->ism.Command = COL_RESULTS;
|
out->ism.Command = COL_RESULTS;
|
||||||
|
@ -127,7 +127,11 @@ void PrimitiveProcessor::p_TokenByScan(const TokenByScanRequestHeader* h,
|
|||||||
|
|
||||||
retTokens = reinterpret_cast<PrimToken*>(&niceRet[rdvOffset]);
|
retTokens = reinterpret_cast<PrimToken*>(&niceRet[rdvOffset]);
|
||||||
retDataValues = reinterpret_cast<DataValue*>(&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->NVALS = 0;
|
||||||
ret->NBYTES = sizeof(TokenByScanResultHeader);
|
ret->NBYTES = sizeof(TokenByScanResultHeader);
|
||||||
ret->ism.Command = DICT_SCAN_COMPARE_RESULTS;
|
ret->ism.Command = DICT_SCAN_COMPARE_RESULTS;
|
||||||
@ -575,7 +579,10 @@ void PrimitiveProcessor::p_AggregateSignature(const AggregateSignatureRequestHea
|
|||||||
DataValue* min;
|
DataValue* min;
|
||||||
DataValue* max;
|
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;
|
out->ism.Command = DICT_AGGREGATE_RESULTS;
|
||||||
niceOutput = reinterpret_cast<uint8_t*>(out);
|
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);
|
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.ism.Command = DICT_RESULTS;
|
||||||
header.NVALS = 0;
|
header.NVALS = 0;
|
||||||
header.LBID = in->LBID;
|
header.LBID = in->LBID;
|
||||||
|
@ -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
|
// we don't need every field of these headers. Init'ing them anyway
|
||||||
// makes memory checkers happy.
|
// makes memory checkers happy.
|
||||||
memset(&ism, 0, sizeof(ISMPacketHeader));
|
void *ismp = static_cast<void*>(&ism);
|
||||||
memset(&ph, 0, sizeof(PrimitiveHeader));
|
void *php = static_cast<void*>(&ph);
|
||||||
|
memset(ismp, 0, sizeof(ISMPacketHeader));
|
||||||
|
memset(php, 0, sizeof(PrimitiveHeader));
|
||||||
ph.SessionID = sessionID;
|
ph.SessionID = sessionID;
|
||||||
ph.StepID = stepID;
|
ph.StepID = stepID;
|
||||||
ph.UniqueID = uniqueID;
|
ph.UniqueID = uniqueID;
|
||||||
@ -1800,8 +1802,10 @@ void BatchPrimitiveProcessor::writeProjectionPreamble()
|
|||||||
|
|
||||||
// we don't need every field of these headers. Init'ing them anyway
|
// we don't need every field of these headers. Init'ing them anyway
|
||||||
// makes memory checkers happy.
|
// makes memory checkers happy.
|
||||||
memset(&ism, 0, sizeof(ISMPacketHeader));
|
void *ismp = static_cast<void*>(&ism);
|
||||||
memset(&ph, 0, sizeof(PrimitiveHeader));
|
void *php = static_cast<void*>(&ph);
|
||||||
|
memset(ismp, 0, sizeof(ISMPacketHeader));
|
||||||
|
memset(php, 0, sizeof(PrimitiveHeader));
|
||||||
ph.SessionID = sessionID;
|
ph.SessionID = sessionID;
|
||||||
ph.StepID = stepID;
|
ph.StepID = stepID;
|
||||||
ph.UniqueID = uniqueID;
|
ph.UniqueID = uniqueID;
|
||||||
@ -1899,8 +1903,10 @@ void BatchPrimitiveProcessor::makeResponse()
|
|||||||
|
|
||||||
// we don't need every field of these headers. Init'ing them anyway
|
// we don't need every field of these headers. Init'ing them anyway
|
||||||
// makes memory checkers happy.
|
// makes memory checkers happy.
|
||||||
memset(&ism, 0, sizeof(ISMPacketHeader));
|
void *ismp = static_cast<void*>(&ism);
|
||||||
memset(&ph, 0, sizeof(PrimitiveHeader));
|
void *php = static_cast<void*>(&ph);
|
||||||
|
memset(ismp, 0, sizeof(ISMPacketHeader));
|
||||||
|
memset(php, 0, sizeof(PrimitiveHeader));
|
||||||
ph.SessionID = sessionID;
|
ph.SessionID = sessionID;
|
||||||
ph.StepID = stepID;
|
ph.StepID = stepID;
|
||||||
ph.UniqueID = uniqueID;
|
ph.UniqueID = uniqueID;
|
||||||
|
@ -51,17 +51,6 @@ using namespace logging;
|
|||||||
#define llabs labs
|
#define llabs labs
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
using namespace primitiveprocessor;
|
|
||||||
|
|
||||||
double cotangent(double in)
|
|
||||||
{
|
|
||||||
return (1.0 / tan(in));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace primitiveprocessor
|
namespace primitiveprocessor
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1097,33 +1097,6 @@ namespace
|
|||||||
{
|
{
|
||||||
using namespace primitiveprocessor;
|
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)
|
/** @brief The job type to process a dictionary scan (pDictionaryScan class on the UM)
|
||||||
* TODO: Move this & the impl into different files
|
* TODO: Move this & the impl into different files
|
||||||
*/
|
*/
|
||||||
|
@ -148,17 +148,19 @@ void setupSignalHandlers()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupCwd(Config* cf)
|
int8_t setupCwd(Config* cf)
|
||||||
{
|
{
|
||||||
string workdir = startup::StartUp::tmpDir();
|
string workdir = startup::StartUp::tmpDir();
|
||||||
|
|
||||||
if (workdir.length() == 0)
|
if (workdir.length() == 0)
|
||||||
workdir = ".";
|
workdir = ".";
|
||||||
|
|
||||||
(void)chdir(workdir.c_str());
|
int8_t rc = chdir(workdir.c_str());
|
||||||
|
|
||||||
if (access(".", W_OK) != 0)
|
if (rc < 0 || access(".", W_OK) != 0)
|
||||||
(void)chdir("/tmp");
|
rc = chdir("/tmp");
|
||||||
|
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int setupResources()
|
int setupResources()
|
||||||
@ -344,11 +346,11 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
setupSignalHandlers();
|
setupSignalHandlers();
|
||||||
|
|
||||||
setupCwd(cf);
|
int err = 0;
|
||||||
|
err = setupCwd(cf);
|
||||||
|
|
||||||
mlp = new primitiveprocessor::Logger();
|
mlp = new primitiveprocessor::Logger();
|
||||||
|
|
||||||
int err = 0;
|
|
||||||
if (!gDebug)
|
if (!gDebug)
|
||||||
err = setupResources();
|
err = setupResources();
|
||||||
string errMsg;
|
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";
|
errMsg = "Could not install file limits to required value, please see non-root install documentation";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case -5:
|
||||||
|
errMsg = "Could not change into working directory";
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,8 @@ set(ProcMgr_SRCS main.cpp processmanager.cpp ../utils/common/crashtrace.cpp)
|
|||||||
|
|
||||||
add_executable(ProcMgr ${ProcMgr_SRCS})
|
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})
|
target_link_libraries(ProcMgr ${ENGINE_LDFLAGS} cacheutils ${NETSNMP_LIBRARIES} ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS})
|
||||||
|
|
||||||
install(TARGETS ProcMgr DESTINATION ${ENGINE_BINDIR} COMPONENT platform)
|
install(TARGETS ProcMgr DESTINATION ${ENGINE_BINDIR} COMPONENT platform)
|
||||||
|
@ -1377,7 +1377,7 @@ void processMSG(messageqcpp::IOSocket* cfIos)
|
|||||||
// all transactions to finish or rollback as commanded. This is only set if
|
// all transactions to finish or rollback as commanded. This is only set if
|
||||||
// there are, in fact, transactions active (or cpimport).
|
// there are, in fact, transactions active (or cpimport).
|
||||||
|
|
||||||
int retStatus = oam::API_SUCCESS;
|
//int retStatus = oam::API_SUCCESS;
|
||||||
|
|
||||||
if (HDFS)
|
if (HDFS)
|
||||||
{
|
{
|
||||||
@ -1458,7 +1458,7 @@ void processMSG(messageqcpp::IOSocket* cfIos)
|
|||||||
if (opState == oam::MAN_DISABLED || opState == oam::AUTO_DISABLED)
|
if (opState == oam::MAN_DISABLED || opState == oam::AUTO_DISABLED)
|
||||||
continue;
|
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
|
//Update DBRM section of Columnstore.xml
|
||||||
if ( updateWorkerNodeconfig() != API_SUCCESS )
|
if ( updateWorkerNodeconfig() != API_SUCCESS )
|
||||||
|
{
|
||||||
return API_FAILURE;
|
return API_FAILURE;
|
||||||
|
}
|
||||||
processManager.recycleProcess(target);
|
processManager.recycleProcess(target);
|
||||||
|
|
||||||
//check for SIMPLEX Processes on mate might need to be started
|
//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 loginTmp = tmpLogDir + "/login_test.log";
|
||||||
string cmd = installDir + "/bin/remote_command.sh " + IPAddr + " " + password + " 'ls' 1 > " + loginTmp;
|
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")) {
|
if (!oam.checkLogStatus(loginTmp, "README")) {
|
||||||
//check for RSA KEY ISSUE and fix
|
//check for RSA KEY ISSUE and fix
|
||||||
@ -7728,7 +7729,8 @@ void startSystemThread(oam::DeviceNetworkList Devicenetworklist)
|
|||||||
sleep(2);
|
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
|
//set query system state not ready
|
||||||
processManager.setQuerySystemState(true);
|
processManager.setQuerySystemState(true);
|
||||||
|
|
||||||
@ -7869,8 +7871,8 @@ void stopSystemThread(oam::DeviceNetworkList Devicenetworklist)
|
|||||||
SystemModuleTypeConfig systemmoduletypeconfig;
|
SystemModuleTypeConfig systemmoduletypeconfig;
|
||||||
ALARMManager aManager;
|
ALARMManager aManager;
|
||||||
int status = API_SUCCESS;
|
int status = API_SUCCESS;
|
||||||
bool exitThread = false;
|
//bool exitThread = false;
|
||||||
int exitThreadStatus = oam::API_SUCCESS;
|
//int exitThreadStatus = oam::API_SUCCESS;
|
||||||
|
|
||||||
pthread_t ThreadId;
|
pthread_t ThreadId;
|
||||||
ThreadId = pthread_self();
|
ThreadId = pthread_self();
|
||||||
@ -7887,16 +7889,16 @@ void stopSystemThread(oam::DeviceNetworkList Devicenetworklist)
|
|||||||
log.writeLog(__LINE__, "EXCEPTION ERROR on getSystemConfig: " + error, LOG_TYPE_ERROR);
|
log.writeLog(__LINE__, "EXCEPTION ERROR on getSystemConfig: " + error, LOG_TYPE_ERROR);
|
||||||
stopsystemthreadStatus = oam::API_FAILURE;
|
stopsystemthreadStatus = oam::API_FAILURE;
|
||||||
processManager.setSystemState(oam::FAILED);
|
processManager.setSystemState(oam::FAILED);
|
||||||
exitThread = true;
|
//exitThread = true;
|
||||||
exitThreadStatus = oam::API_FAILURE;
|
//exitThreadStatus = oam::API_FAILURE;
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
log.writeLog(__LINE__, "EXCEPTION ERROR on getSystemConfig: Caught unknown exception!", LOG_TYPE_ERROR);
|
log.writeLog(__LINE__, "EXCEPTION ERROR on getSystemConfig: Caught unknown exception!", LOG_TYPE_ERROR);
|
||||||
stopsystemthreadStatus = oam::API_FAILURE;
|
stopsystemthreadStatus = oam::API_FAILURE;
|
||||||
processManager.setSystemState(oam::FAILED);
|
processManager.setSystemState(oam::FAILED);
|
||||||
exitThread = true;
|
//exitThread = true;
|
||||||
exitThreadStatus = oam::API_FAILURE;
|
//exitThreadStatus = oam::API_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( devicenetworklist.size() != 0 )
|
if ( devicenetworklist.size() != 0 )
|
||||||
@ -7920,7 +7922,7 @@ void stopSystemThread(oam::DeviceNetworkList Devicenetworklist)
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int opState;
|
int opState;
|
||||||
bool degraded = oam::ACTIVE;
|
bool degraded;
|
||||||
oam.getModuleStatus(moduleName, opState, degraded);
|
oam.getModuleStatus(moduleName, opState, degraded);
|
||||||
|
|
||||||
if (opState == oam::MAN_DISABLED || opState == oam::AUTO_DISABLED)
|
if (opState == oam::MAN_DISABLED || opState == oam::AUTO_DISABLED)
|
||||||
|
@ -8,6 +8,8 @@ set(ProcMon_SRCS main.cpp processmonitor.cpp ../utils/common/crashtrace.cpp)
|
|||||||
|
|
||||||
add_executable(ProcMon ${ProcMon_SRCS})
|
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})
|
target_link_libraries(ProcMon ${ENGINE_LDFLAGS} cacheutils ${NETSNMP_LIBRARIES} ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS})
|
||||||
|
|
||||||
install(TARGETS ProcMon DESTINATION ${ENGINE_BINDIR} COMPONENT platform)
|
install(TARGETS ProcMon DESTINATION ${ENGINE_BINDIR} COMPONENT platform)
|
||||||
|
@ -1497,7 +1497,6 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
|
|||||||
string configureModuleName;
|
string configureModuleName;
|
||||||
msg >> configureModuleName;
|
msg >> configureModuleName;
|
||||||
|
|
||||||
uint16_t rtnCode;
|
|
||||||
int requestStatus = API_SUCCESS;
|
int requestStatus = API_SUCCESS;
|
||||||
|
|
||||||
configureModule(configureModuleName);
|
configureModule(configureModuleName);
|
||||||
@ -2220,7 +2219,8 @@ pid_t ProcessMonitor::startProcess(string processModuleType, string processName,
|
|||||||
string RunType, string DepProcessName[MAXDEPENDANCY],
|
string RunType, string DepProcessName[MAXDEPENDANCY],
|
||||||
string DepModuleName[MAXDEPENDANCY], string LogFile, uint16_t initType, uint16_t actIndicator)
|
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];
|
char* argList[MAXARGUMENTS];
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
MonitorLog log;
|
MonitorLog log;
|
||||||
|
@ -8,6 +8,8 @@ set(autoInstaller_SRCS autoInstaller.cpp)
|
|||||||
|
|
||||||
add_executable(autoInstaller ${autoInstaller_SRCS})
|
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)
|
target_link_libraries(autoInstaller ${ENGINE_LDFLAGS} ${NETSNMP_LIBRARIES} ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS} readline ncurses)
|
||||||
|
|
||||||
install(TARGETS autoInstaller DESTINATION ${ENGINE_BINDIR})
|
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})
|
target_link_libraries(autoConfigure ${ENGINE_LDFLAGS} ${NETSNMP_LIBRARIES} ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS})
|
||||||
|
|
||||||
install(TARGETS autoConfigure DESTINATION ${ENGINE_BINDIR} COMPONENT platform)
|
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})
|
|
||||||
|
|
||||||
|
@ -637,7 +637,7 @@ int main(int argc, char* argv[])
|
|||||||
// Columnstore.xml found
|
// Columnstore.xml found
|
||||||
|
|
||||||
//try to parse it
|
//try to parse it
|
||||||
Config* sysConfigOld;
|
//Config* sysConfigOld;
|
||||||
|
|
||||||
ofstream file("/dev/null");
|
ofstream file("/dev/null");
|
||||||
|
|
||||||
@ -649,7 +649,7 @@ int main(int argc, char* argv[])
|
|||||||
// redirect cout to /dev/null
|
// redirect cout to /dev/null
|
||||||
cerr.rdbuf(file.rdbuf());
|
cerr.rdbuf(file.rdbuf());
|
||||||
|
|
||||||
sysConfigOld = Config::makeConfig( systemDir + "/Columnstore.xml");
|
//sysConfigOld = Config::makeConfig( systemDir + "/Columnstore.xml");
|
||||||
|
|
||||||
// restore cout stream buffer
|
// restore cout stream buffer
|
||||||
cerr.rdbuf (strm_buffer);
|
cerr.rdbuf (strm_buffer);
|
||||||
|
@ -59,11 +59,11 @@ int setUp()
|
|||||||
{
|
{
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
string cmd = "/bin/rm -f " + logFile + " >/dev/null 2>&1";
|
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";
|
cmd = "/bin/touch -f " + logFile + " >/dev/null 2>&1";
|
||||||
(void)system(cmd.c_str());
|
rc = system(cmd.c_str());
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int checkNotThere(WriteEngine::FID fid)
|
int checkNotThere(WriteEngine::FID fid)
|
||||||
@ -73,12 +73,6 @@ int checkNotThere(WriteEngine::FID fid)
|
|||||||
return (fileOp.existsOIDDir(fid) ? -1 : 0);
|
return (fileOp.existsOIDDir(fid) ? -1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tearDown()
|
|
||||||
{
|
|
||||||
string file = tmpDir + "/oidbitmap";
|
|
||||||
unlink(file.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void usage()
|
void usage()
|
||||||
{
|
{
|
||||||
cerr << "Usage: dbbuilder [-h|f] function" << endl
|
cerr << "Usage: dbbuilder [-h|f] function" << endl
|
||||||
@ -131,6 +125,7 @@ int main(int argc, char* argv[])
|
|||||||
std::string schema("tpch");
|
std::string schema("tpch");
|
||||||
Oam oam;
|
Oam oam;
|
||||||
bool fFlg = false;
|
bool fFlg = false;
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
opterr = 0;
|
opterr = 0;
|
||||||
|
|
||||||
@ -194,7 +189,10 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
if ( buildOption == SYSCATALOG_ONLY )
|
if ( buildOption == SYSCATALOG_ONLY )
|
||||||
{
|
{
|
||||||
setUp();
|
if ( setUp() )
|
||||||
|
{
|
||||||
|
cerr << "setUp() call error " << endl;
|
||||||
|
}
|
||||||
|
|
||||||
bool canWrite = true;
|
bool canWrite = true;
|
||||||
|
|
||||||
@ -210,9 +208,13 @@ int main(int argc, char* argv[])
|
|||||||
"' > " + logFile;
|
"' > " + logFile;
|
||||||
|
|
||||||
if (canWrite)
|
if (canWrite)
|
||||||
(void)system(cmd.c_str());
|
{
|
||||||
|
rc = system(cmd.c_str());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
cerr << cmd << endl;
|
cerr << cmd << endl;
|
||||||
|
}
|
||||||
|
|
||||||
errorHandler(sysCatalogErr,
|
errorHandler(sysCatalogErr,
|
||||||
"Build system catalog",
|
"Build system catalog",
|
||||||
@ -244,7 +246,7 @@ int main(int argc, char* argv[])
|
|||||||
string cmd(string("echo 'FAILED: ") + ex.what() + "' > " + logFile);
|
string cmd(string("echo 'FAILED: ") + ex.what() + "' > " + logFile);
|
||||||
|
|
||||||
if (canWrite)
|
if (canWrite)
|
||||||
(void)system(cmd.c_str());
|
rc = system(cmd.c_str());
|
||||||
else
|
else
|
||||||
cerr << cmd << endl;
|
cerr << cmd << endl;
|
||||||
|
|
||||||
@ -256,7 +258,7 @@ int main(int argc, char* argv[])
|
|||||||
string cmd = "echo 'FAILED: HDFS checking.' > " + logFile;
|
string cmd = "echo 'FAILED: HDFS checking.' > " + logFile;
|
||||||
|
|
||||||
if (canWrite)
|
if (canWrite)
|
||||||
(void)system(cmd.c_str());
|
rc = system(cmd.c_str());
|
||||||
else
|
else
|
||||||
cerr << cmd << endl;
|
cerr << cmd << endl;
|
||||||
|
|
||||||
@ -275,7 +277,7 @@ int main(int argc, char* argv[])
|
|||||||
std::string cmd = "echo 'OK: buildOption=" + oam.itoa(buildOption) + "' > " + logFile;
|
std::string cmd = "echo 'OK: buildOption=" + oam.itoa(buildOption) + "' > " + logFile;
|
||||||
|
|
||||||
if (canWrite)
|
if (canWrite)
|
||||||
(void)system(cmd.c_str());
|
rc = system(cmd.c_str());
|
||||||
else
|
else
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
(void)0;
|
(void)0;
|
||||||
@ -288,11 +290,9 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
if (canWrite)
|
if (canWrite)
|
||||||
{
|
{
|
||||||
int err;
|
rc = system(cmd.c_str());
|
||||||
|
|
||||||
err = system(cmd.c_str());
|
if (rc != 0)
|
||||||
|
|
||||||
if (err != 0)
|
|
||||||
{
|
{
|
||||||
ostringstream os;
|
ostringstream os;
|
||||||
os << "Warning: running " << cmd << " failed. This is usually non-fatal.";
|
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;
|
string cmd = "echo 'FAILED: buildOption=" + oam.itoa(buildOption) + "' > " + logFile;
|
||||||
|
|
||||||
if (canWrite)
|
if (canWrite)
|
||||||
(void)system(cmd.c_str());
|
rc = system(cmd.c_str());
|
||||||
else
|
else
|
||||||
cerr << cmd << endl;
|
cerr << cmd << endl;
|
||||||
|
|
||||||
@ -321,7 +321,7 @@ int main(int argc, char* argv[])
|
|||||||
string cmd = "echo 'FAILED: buildOption=" + oam.itoa(buildOption) + "' > " + logFile;
|
string cmd = "echo 'FAILED: buildOption=" + oam.itoa(buildOption) + "' > " + logFile;
|
||||||
|
|
||||||
if (canWrite)
|
if (canWrite)
|
||||||
(void)system(cmd.c_str());
|
rc = system(cmd.c_str());
|
||||||
else
|
else
|
||||||
cerr << cmd << endl;
|
cerr << cmd << endl;
|
||||||
|
|
||||||
|
@ -44,11 +44,11 @@ using namespace bulkloadxml;
|
|||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
const int DEBUG_LVL_TO_DUMP_SYSCAT_RPT = 4;
|
const int DEBUG_LVL_TO_DUMP_SYSCAT_RPT = 4;
|
||||||
#ifdef _MSC_VER
|
// set effective ID to root
|
||||||
//FIXME
|
if( setuid( 0 ) < 0 )
|
||||||
#else
|
{
|
||||||
setuid( 0 ); // set effective ID to root; ignore return status
|
std::cerr << " colxml: setuid failed " << std::endl;
|
||||||
#endif
|
}
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
WriteEngine::Config::initConfigCache(); // load Columnstore.xml config settings
|
WriteEngine::Config::initConfigCache(); // load Columnstore.xml config settings
|
||||||
|
|
||||||
|
@ -258,7 +258,8 @@ int flushOIDsFromCache(const vector<BRM::OID_t>& oids)
|
|||||||
ISMPacketHeader ism;
|
ISMPacketHeader ism;
|
||||||
uint32_t i;
|
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;
|
ism.Command = CACHE_FLUSH_BY_OID;
|
||||||
bs.load((uint8_t*) &ism, sizeof(ISMPacketHeader));
|
bs.load((uint8_t*) &ism, sizeof(ISMPacketHeader));
|
||||||
bs << (uint32_t) oids.size();
|
bs << (uint32_t) oids.size();
|
||||||
@ -285,7 +286,8 @@ int flushPartition(const std::vector<BRM::OID_t>& oids, set<BRM::LogicalPartitio
|
|||||||
ByteStream bs;
|
ByteStream bs;
|
||||||
ISMPacketHeader ism;
|
ISMPacketHeader ism;
|
||||||
|
|
||||||
memset(&ism, 0, sizeof(ISMPacketHeader));
|
void *ismp = static_cast<void*>(&ism);
|
||||||
|
memset(ismp, 0, sizeof(ISMPacketHeader));
|
||||||
ism.Command = CACHE_FLUSH_PARTITION;
|
ism.Command = CACHE_FLUSH_PARTITION;
|
||||||
bs.load((uint8_t*) &ism, sizeof(ISMPacketHeader));
|
bs.load((uint8_t*) &ism, sizeof(ISMPacketHeader));
|
||||||
serializeSet<BRM::LogicalPartition>(bs, partitionNums);
|
serializeSet<BRM::LogicalPartition>(bs, partitionNums);
|
||||||
|
@ -90,6 +90,8 @@ namespace
|
|||||||
{
|
{
|
||||||
short DSPort = 9199;
|
short DSPort = 9199;
|
||||||
|
|
||||||
|
// this isn't currently used but could be in the future.
|
||||||
|
#if 0
|
||||||
void log(const string& s)
|
void log(const string& s)
|
||||||
{
|
{
|
||||||
logging::MessageLog logger((logging::LoggingID()));
|
logging::MessageLog logger((logging::LoggingID()));
|
||||||
@ -100,6 +102,7 @@ void log(const string& s)
|
|||||||
message.format(args);
|
message.format(args);
|
||||||
logger.logErrorMessage(message);
|
logger.logErrorMessage(message);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
struct ScopedCleaner
|
struct ScopedCleaner
|
||||||
{
|
{
|
||||||
|
@ -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();
|
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 )
|
bool number_value ( const string& data )
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < strlen(data.c_str()); i++)
|
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 )
|
bool mysql_str_to_time( const string& input, Time& output, long decimals )
|
||||||
{
|
{
|
||||||
// int32_t datesepct = 0;
|
|
||||||
uint32_t dtend = 0;
|
uint32_t dtend = 0;
|
||||||
bool isNeg = false;
|
bool isNeg = false;
|
||||||
|
|
||||||
@ -1779,7 +1765,8 @@ int32_t DataConvert::convertColumnDate(
|
|||||||
bool DataConvert::isColumnDateValid( int32_t date )
|
bool DataConvert::isColumnDateValid( int32_t date )
|
||||||
{
|
{
|
||||||
Date d;
|
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));
|
return (isDateValid(d.day, d.month, d.year));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2081,7 +2068,8 @@ int64_t DataConvert::convertColumnTime(
|
|||||||
bool DataConvert::isColumnDateTimeValid( int64_t dateTime )
|
bool DataConvert::isColumnDateTimeValid( int64_t dateTime )
|
||||||
{
|
{
|
||||||
DateTime dt;
|
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))
|
if (isDateValid(dt.day, dt.month, dt.year))
|
||||||
return isDateTimeValid(dt.hour, dt.minute, dt.second, dt.msecond);
|
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 )
|
bool DataConvert::isColumnTimeValid( int64_t time )
|
||||||
{
|
{
|
||||||
Time dt;
|
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);
|
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
|
// @bug 4703 abandon multiple ostringstream's for conversion
|
||||||
DateTime dt(datetimevalue);
|
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];
|
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);
|
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;
|
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)
|
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};
|
char buf[21] = {0};
|
||||||
Date aday;
|
Date aday;
|
||||||
|
|
||||||
@ -2459,7 +2448,16 @@ int64_t DataConvert::intToDate(int64_t data)
|
|||||||
return *(reinterpret_cast<uint32_t*>(&aday));
|
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);
|
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;
|
string year, month, day, hour, min, sec, msec;
|
||||||
int64_t y = 0, m = 0, d = 0, h = 0, minute = 0, s = 0, ms = 0;
|
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));
|
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)
|
int64_t DataConvert::intToDatetime(int64_t data, bool* date)
|
||||||
{
|
{
|
||||||
bool isDate = false;
|
bool isDate = false;
|
||||||
@ -2584,7 +2584,17 @@ int64_t DataConvert::intToDatetime(int64_t data, bool* date)
|
|||||||
return *(reinterpret_cast<uint64_t*>(&adaytime));
|
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);
|
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 date = buf;
|
||||||
string year, month, day, hour, min, sec, msec;
|
string year, month, day, hour, min, sec, msec;
|
||||||
int64_t y = 0, m = 0, d = 0, h = 0, minute = 0, s = 0, ms = 0;
|
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));
|
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)
|
int64_t DataConvert::intToTime(int64_t data, bool fromString)
|
||||||
{
|
{
|
||||||
char buf[21] = {0};
|
char buf[21] = {0};
|
||||||
@ -2710,7 +2722,17 @@ int64_t DataConvert::intToTime(int64_t data, bool fromString)
|
|||||||
return *(reinterpret_cast<int64_t*>(&atime));
|
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);
|
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 date = buf;
|
||||||
string hour, min, sec, msec;
|
string hour, min, sec, msec;
|
||||||
int64_t h = 0, minute = 0, s = 0, ms = 0;
|
int64_t h = 0, minute = 0, s = 0, ms = 0;
|
||||||
|
@ -673,12 +673,24 @@ inline void DataConvert::timeToString1( long long timevalue, char* buf, unsigned
|
|||||||
buf++;
|
buf++;
|
||||||
buflen--;
|
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",
|
snprintf( buf, buflen, "%02d%02d%02d",
|
||||||
hour,
|
hour,
|
||||||
(unsigned)((timevalue >> 32) & 0xff),
|
(unsigned)((timevalue >> 32) & 0xff),
|
||||||
(unsigned)((timevalue >> 14) & 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)
|
inline std::string DataConvert::decimalToString(int64_t value, uint8_t scale, execplan::CalpontSystemCatalog::ColDataType colDataType)
|
||||||
|
@ -89,11 +89,13 @@ std::string Func_insert::getStrVal(rowgroup::Row& row,
|
|||||||
execplan::CalpontSystemCatalog::ColType&)
|
execplan::CalpontSystemCatalog::ColType&)
|
||||||
{
|
{
|
||||||
string tstr;
|
string tstr;
|
||||||
|
string tnewstr;
|
||||||
stringValue(fp[0], row, isNull, tstr);
|
stringValue(fp[0], row, isNull, tstr);
|
||||||
if (isNull)
|
if (isNull)
|
||||||
|
{
|
||||||
return "";
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
string tnewstr;
|
|
||||||
stringValue(fp[3], row, isNull, tnewstr);
|
stringValue(fp[3], row, isNull, tnewstr);
|
||||||
if (isNull)
|
if (isNull)
|
||||||
return "";
|
return "";
|
||||||
|
@ -103,8 +103,6 @@ std::string Func_lpad::getStrVal(rowgroup::Row& row,
|
|||||||
value += 0.5;
|
value += 0.5;
|
||||||
else if (value < 0)
|
else if (value < 0)
|
||||||
value -= 0.5;
|
value -= 0.5;
|
||||||
else if (value < 0)
|
|
||||||
value -= 0.5;
|
|
||||||
|
|
||||||
int64_t ret = (int64_t) value;
|
int64_t ret = (int64_t) value;
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ typedef unsigned char uchar;
|
|||||||
|
|
||||||
char* PrintMD5(uchar md5Digest[16]);
|
char* PrintMD5(uchar md5Digest[16]);
|
||||||
char* MD5String(const char* szString);
|
char* MD5String(const char* szString);
|
||||||
char* MD5File(char* szFilename);
|
//char* MD5File(char* szFilename);
|
||||||
|
|
||||||
class md5
|
class md5
|
||||||
{
|
{
|
||||||
@ -236,6 +236,7 @@ char* PrintMD5(uchar md5Digest[16])
|
|||||||
char chBuffer[256];
|
char chBuffer[256];
|
||||||
char chEach[10];
|
char chEach[10];
|
||||||
int nCount;
|
int nCount;
|
||||||
|
size_t chEachSize = 0;
|
||||||
|
|
||||||
memset(chBuffer, 0, 256);
|
memset(chBuffer, 0, 256);
|
||||||
memset(chEach, 0, 10);
|
memset(chEach, 0, 10);
|
||||||
@ -243,7 +244,8 @@ char* PrintMD5(uchar md5Digest[16])
|
|||||||
for (nCount = 0; nCount < 16; nCount++)
|
for (nCount = 0; nCount < 16; nCount++)
|
||||||
{
|
{
|
||||||
sprintf(chEach, "%02x", md5Digest[nCount]);
|
sprintf(chEach, "%02x", md5Digest[nCount]);
|
||||||
strncat(chBuffer, chEach, sizeof(chEach));
|
chEachSize = sizeof(chEach);
|
||||||
|
strncat(chBuffer, chEach, chEachSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
return strdup(chBuffer);
|
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.
|
// returning the results as a char*. Returns NULL if it fails.
|
||||||
char* MD5File(char* szFilename)
|
char* MD5File(char* szFilename)
|
||||||
{
|
{
|
||||||
@ -295,7 +299,7 @@ char* MD5File(char* szFilename)
|
|||||||
|
|
||||||
return NULL; // failed
|
return NULL; // failed
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// md5::Init
|
// md5::Init
|
||||||
// Initializes a new context.
|
// Initializes a new context.
|
||||||
|
@ -93,7 +93,7 @@ std::string Func_repeat::getStrVal(rowgroup::Row& row,
|
|||||||
|
|
||||||
for ( int i = 0 ; i < count ; i ++ )
|
for ( int i = 0 ; i < count ; i ++ )
|
||||||
{
|
{
|
||||||
if (strcat(result, str.c_str()) == NULL)
|
if (strcat(result, str.c_str()) == NULL) //questionable check
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ std::string Func_substring_index::getStrVal(rowgroup::Row& row,
|
|||||||
if ( count > end )
|
if ( count > end )
|
||||||
return str;
|
return str;
|
||||||
|
|
||||||
if (( count < 0 ) && ((count * -1) > end))
|
if (( count < 0 ) && ((count * -1) > (int64_t) end))
|
||||||
return str;
|
return str;
|
||||||
|
|
||||||
string value = str;
|
string value = str;
|
||||||
@ -99,8 +99,7 @@ std::string Func_substring_index::getStrVal(rowgroup::Row& row,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
count = count * -1;
|
count = -count;
|
||||||
size_t end = strlen(str.c_str());
|
|
||||||
int pointer = end;
|
int pointer = end;
|
||||||
int start = 0;
|
int start = 0;
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ int PosixFileSystem::listDirectory(const char* pathname, std::list<std::string>&
|
|||||||
contents.push_back( itr->path().filename().generic_string() );
|
contents.push_back( itr->path().filename().generic_string() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (std::exception)
|
catch (std::exception &)
|
||||||
{
|
{
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
|
@ -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
|
// This constructor is for use by HdfsRdwrMemBuffer to create a file buffer when we
|
||||||
// run out of memory.
|
// run out of memory.
|
||||||
HdfsRdwrFileBuffer::HdfsRdwrFileBuffer(HdfsRdwrMemBuffer* pMemBuffer) throw (std::exception) :
|
HdfsRdwrFileBuffer::HdfsRdwrFileBuffer(HdfsRdwrMemBuffer* pMemBuffer) :
|
||||||
IDBDataFile(pMemBuffer->name().c_str()),
|
IDBDataFile(pMemBuffer->name().c_str()),
|
||||||
m_buffer(NULL),
|
m_buffer(NULL),
|
||||||
m_dirty(false)
|
m_dirty(false)
|
||||||
|
@ -50,7 +50,7 @@ class HdfsRdwrFileBuffer: public IDBDataFile, boost::noncopyable
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HdfsRdwrFileBuffer(const char* fname, const char* mode, unsigned opts);
|
HdfsRdwrFileBuffer(const char* fname, const char* mode, unsigned opts);
|
||||||
HdfsRdwrFileBuffer(HdfsRdwrMemBuffer* pMemBuffer) throw (std::exception);
|
HdfsRdwrFileBuffer(HdfsRdwrMemBuffer* pMemBuffer);
|
||||||
/* virtual */ ~HdfsRdwrFileBuffer();
|
/* virtual */ ~HdfsRdwrFileBuffer();
|
||||||
|
|
||||||
/* virtual */ ssize_t pread(void* ptr, off64_t offset, size_t count);
|
/* virtual */ ssize_t pread(void* ptr, off64_t offset, size_t count);
|
||||||
|
@ -180,21 +180,21 @@ const string MessageLog::format(const Message& msg, const char prefix)
|
|||||||
void MessageLog::logDebugMessage(const Message& msg)
|
void MessageLog::logDebugMessage(const Message& msg)
|
||||||
{
|
{
|
||||||
::openlog(SubsystemID[fLogData.fSubsysID].c_str(), 0 | LOG_PID, fFacility);
|
::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();
|
::closelog();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageLog::logInfoMessage(const Message& msg)
|
void MessageLog::logInfoMessage(const Message& msg)
|
||||||
{
|
{
|
||||||
::openlog(SubsystemID[fLogData.fSubsysID].c_str(), 0 | LOG_PID, fFacility);
|
::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();
|
::closelog();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageLog::logWarningMessage(const Message& msg)
|
void MessageLog::logWarningMessage(const Message& msg)
|
||||||
{
|
{
|
||||||
::openlog(SubsystemID[fLogData.fSubsysID].c_str(), 0 | LOG_PID, fFacility);
|
::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();
|
::closelog();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,14 +202,14 @@ void MessageLog::logErrorMessage(const Message& msg)
|
|||||||
{
|
{
|
||||||
// @bug 24 use 'E' instead of 'S'
|
// @bug 24 use 'E' instead of 'S'
|
||||||
::openlog(SubsystemID[fLogData.fSubsysID].c_str(), 0 | LOG_PID, fFacility);
|
::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();
|
::closelog();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageLog::logCriticalMessage(const Message& msg)
|
void MessageLog::logCriticalMessage(const Message& msg)
|
||||||
{
|
{
|
||||||
::openlog(SubsystemID[fLogData.fSubsysID].c_str(), 0 | LOG_PID, fFacility);
|
::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();
|
::closelog();
|
||||||
}
|
}
|
||||||
//Bug 5218. comment out the following functions to alleviate issue where dml messages show up in crit.log. This
|
//Bug 5218. comment out the following functions to alleviate issue where dml messages show up in crit.log. This
|
||||||
|
@ -945,7 +945,6 @@ void InetStreamSocket::connect(const sockaddr* serv_addr)
|
|||||||
/* read a byte to artificially synchronize with accept() on the remote */
|
/* read a byte to artificially synchronize with accept() on the remote */
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
int e = EBADF;
|
int e = EBADF;
|
||||||
char buf = '\0';
|
|
||||||
struct pollfd pfd;
|
struct pollfd pfd;
|
||||||
|
|
||||||
long msecs = fConnectionTimeout.tv_sec * 1000 + fConnectionTimeout.tv_nsec / 1000000;
|
long msecs = fConnectionTimeout.tv_sec * 1000 + fConnectionTimeout.tv_nsec / 1000000;
|
||||||
@ -964,9 +963,19 @@ void InetStreamSocket::connect(const sockaddr* serv_addr)
|
|||||||
if (ret == 1)
|
if (ret == 1)
|
||||||
{
|
{
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
char buf = '\0';
|
||||||
(void)::recv(socketParms().sd(), &buf, 1, 0);
|
(void)::recv(socketParms().sd(), &buf, 1, 0);
|
||||||
#else
|
#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
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -80,6 +80,7 @@ struct QStats
|
|||||||
|
|
||||||
QStats fQStats;
|
QStats fQStats;
|
||||||
|
|
||||||
|
#ifdef QUERY_TELE_DEBUG
|
||||||
string get_trace_file()
|
string get_trace_file()
|
||||||
{
|
{
|
||||||
ostringstream oss;
|
ostringstream oss;
|
||||||
@ -125,7 +126,9 @@ void log_query(const querytele::QueryTele& qtdata)
|
|||||||
trace << endl;
|
trace << endl;
|
||||||
trace.close();
|
trace.close();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef QUERY_TELE_DEBUG
|
||||||
const string st2str(enum querytele::StepType::type t)
|
const string st2str(enum querytele::StepType::type t)
|
||||||
{
|
{
|
||||||
switch (t)
|
switch (t)
|
||||||
@ -172,7 +175,9 @@ const string st2str(enum querytele::StepType::type t)
|
|||||||
|
|
||||||
return "INV";
|
return "INV";
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef QUERY_TELE_DEBUG
|
||||||
void log_step(const querytele::StepTele& stdata)
|
void log_step(const querytele::StepTele& stdata)
|
||||||
{
|
{
|
||||||
ofstream trace(get_trace_file().c_str(), ios::out | ios::app);
|
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 << endl;
|
||||||
trace.close();
|
trace.close();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void TeleConsumer()
|
void TeleConsumer()
|
||||||
{
|
{
|
||||||
|
@ -32,7 +32,9 @@
|
|||||||
#include <tr1/unordered_map>
|
#include <tr1/unordered_map>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
|
#endif
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -139,8 +139,8 @@ PriorityThreadPool::Priority PriorityThreadPool::pickAQueue(Priority preference)
|
|||||||
|
|
||||||
void PriorityThreadPool::threadFcn(const Priority preferredQueue) throw()
|
void PriorityThreadPool::threadFcn(const Priority preferredQueue) throw()
|
||||||
{
|
{
|
||||||
Priority queue;
|
Priority queue = LOW;
|
||||||
uint32_t weight, i;
|
uint32_t weight, i = 0;
|
||||||
vector<Job> runList;
|
vector<Job> runList;
|
||||||
vector<bool> reschedule;
|
vector<bool> reschedule;
|
||||||
uint32_t rescheduleCount;
|
uint32_t rescheduleCount;
|
||||||
|
@ -44,6 +44,8 @@
|
|||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
#include <boost/function.hpp>
|
#include <boost/function.hpp>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#if defined(_MSC_VER) && defined(xxxTHREADPOOL_DLLEXPORT)
|
#if defined(_MSC_VER) && defined(xxxTHREADPOOL_DLLEXPORT)
|
||||||
#define EXPORT __declspec(dllexport)
|
#define EXPORT __declspec(dllexport)
|
||||||
#else
|
#else
|
||||||
@ -75,8 +77,13 @@ public:
|
|||||||
boost::thread* create_thread(F threadfunc)
|
boost::thread* create_thread(F threadfunc)
|
||||||
{
|
{
|
||||||
boost::lock_guard<boost::shared_mutex> guard(m);
|
boost::lock_guard<boost::shared_mutex> guard(m);
|
||||||
threads.push_back(new boost::thread(threadfunc));
|
#if defined(__GNUC__) && __GNUC__ >= 7
|
||||||
return threads.back();
|
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)
|
void add_thread(boost::thread* thrd)
|
||||||
|
@ -1027,6 +1027,10 @@ inline T mcsv1_UDAF::convertAnyTo(static_any::any& valIn)
|
|||||||
{
|
{
|
||||||
val = valIn.cast<double>();
|
val = valIn.cast<double>();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw runtime_error("mcsv1_UDAF::convertAnyTo(): input param has unrecognized type");
|
||||||
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1141,7 +1141,8 @@ void ExtentMap::loadVersion4(ifstream& in)
|
|||||||
in.read((char*) &flNumElements, sizeof(int));
|
in.read((char*) &flNumElements, sizeof(int));
|
||||||
idbassert(emNumElements > 0);
|
idbassert(emNumElements > 0);
|
||||||
|
|
||||||
memset(fExtentMap, 0, fEMShminfo->allocdSize);
|
void *fExtentMapPtr = static_cast<void*>(fExtentMap);
|
||||||
|
memset(fExtentMapPtr, 0, fEMShminfo->allocdSize);
|
||||||
fEMShminfo->currentSize = 0;
|
fEMShminfo->currentSize = 0;
|
||||||
|
|
||||||
// init the free list
|
// init the free list
|
||||||
@ -1226,7 +1227,8 @@ void ExtentMap::loadVersion4(IDBDataFile* in)
|
|||||||
throw runtime_error("ExtentMap::loadVersion4(): read failed. Check the error log.");
|
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;
|
fEMShminfo->currentSize = 0;
|
||||||
|
|
||||||
// init the free list
|
// init the free list
|
||||||
|
@ -189,7 +189,8 @@ void MasterSegmentTable::makeMSTSegment()
|
|||||||
|
|
||||||
void MasterSegmentTable::initMSTData()
|
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
|
MSTEntry* MasterSegmentTable::getTable_read(int num, bool block) const
|
||||||
|
@ -51,12 +51,14 @@ using namespace idbdatafile;
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
#ifdef USE_VERY_COMPLEX_DROP_CACHES
|
||||||
void timespec_sub(const struct timespec& tv1,
|
void timespec_sub(const struct timespec& tv1,
|
||||||
const struct timespec& tv2,
|
const struct timespec& tv2,
|
||||||
double& tm)
|
double& tm)
|
||||||
{
|
{
|
||||||
tm = (double)(tv2.tv_sec - tv1.tv_sec) + 1.e-9 * (tv2.tv_nsec - tv1.tv_nsec);
|
tm = (double)(tv2.tv_sec - tv1.tv_sec) + 1.e-9 * (tv2.tv_nsec - tv1.tv_nsec);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace BRM
|
namespace BRM
|
||||||
@ -2176,8 +2178,12 @@ void SlaveComm::do_flushInodeCache()
|
|||||||
|
|
||||||
if ((fd = open("/proc/sys/vm/drop_caches", O_WRONLY)) >= 0)
|
if ((fd = open("/proc/sys/vm/drop_caches", O_WRONLY)) >= 0)
|
||||||
{
|
{
|
||||||
write(fd, "3\n", 2);
|
ssize_t written = write(fd, "3\n", 2);
|
||||||
close(fd);
|
int rc = close(fd);
|
||||||
|
if ( !written || rc )
|
||||||
|
{
|
||||||
|
std::cerr << "Could not write into or close /proc/sys/vm/drop_caches" << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -830,10 +830,11 @@ void printInputSource(
|
|||||||
if (alternateImportDir == IMPORT_PATH_CWD)
|
if (alternateImportDir == IMPORT_PATH_CWD)
|
||||||
{
|
{
|
||||||
char cwdBuf[4096];
|
char cwdBuf[4096];
|
||||||
::getcwd(cwdBuf, sizeof(cwdBuf));
|
char *bufPtr = &cwdBuf[0];
|
||||||
|
bufPtr = ::getcwd(cwdBuf, sizeof(cwdBuf));
|
||||||
|
|
||||||
if (!(BulkLoad::disableConsoleOutput()))
|
if (!(BulkLoad::disableConsoleOutput()))
|
||||||
cout << "Input file(s) will be read from : " << cwdBuf << endl;
|
cout << "Input file(s) will be read from : " << bufPtr << endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1021,7 +1022,11 @@ int main(int argc, char** argv)
|
|||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
_setmaxstdio(2048);
|
_setmaxstdio(2048);
|
||||||
#else
|
#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
|
#endif
|
||||||
setupSignalHandlers();
|
setupSignalHandlers();
|
||||||
|
|
||||||
|
@ -1460,9 +1460,11 @@ void TableInfo::writeBadRows( const std::vector<std::string>* errorDatRows,
|
|||||||
|
|
||||||
if (!p.has_root_path())
|
if (!p.has_root_path())
|
||||||
{
|
{
|
||||||
|
// We could fail here having fixed size buffer
|
||||||
char cwdPath[4096];
|
char cwdPath[4096];
|
||||||
getcwd(cwdPath, sizeof(cwdPath));
|
char* buffPtr = &cwdPath[0];
|
||||||
boost::filesystem::path rejectFileName2( cwdPath );
|
buffPtr = getcwd(cwdPath, sizeof(cwdPath));
|
||||||
|
boost::filesystem::path rejectFileName2( buffPtr );
|
||||||
rejectFileName2 /= fRejectDataFileName;
|
rejectFileName2 /= fRejectDataFileName;
|
||||||
fBadFiles.push_back( rejectFileName2.string() );
|
fBadFiles.push_back( rejectFileName2.string() );
|
||||||
|
|
||||||
@ -1567,8 +1569,9 @@ void TableInfo::writeErrReason( const std::vector< std::pair<RID,
|
|||||||
if (!p.has_root_path())
|
if (!p.has_root_path())
|
||||||
{
|
{
|
||||||
char cwdPath[4096];
|
char cwdPath[4096];
|
||||||
getcwd(cwdPath, sizeof(cwdPath));
|
char* buffPtr = &cwdPath[0];
|
||||||
boost::filesystem::path errFileName2( cwdPath );
|
buffPtr = getcwd(cwdPath, sizeof(cwdPath));
|
||||||
|
boost::filesystem::path errFileName2( buffPtr );
|
||||||
errFileName2 /= fRejectErrFileName;
|
errFileName2 /= fRejectErrFileName;
|
||||||
fErrFiles.push_back( errFileName2.string() );
|
fErrFiles.push_back( errFileName2.string() );
|
||||||
|
|
||||||
|
@ -807,7 +807,8 @@ int Dctnry::insertDctnry(const char* buf,
|
|||||||
while (startPos < totalRow)
|
while (startPos < totalRow)
|
||||||
{
|
{
|
||||||
found = false;
|
found = false;
|
||||||
memset(&curSig, 0, sizeof(curSig));
|
void *curSigPtr = static_cast<void*>(&curSig);
|
||||||
|
memset(curSigPtr, 0, sizeof(curSig));
|
||||||
curSig.size = pos[startPos][col].offset;
|
curSig.size = pos[startPos][col].offset;
|
||||||
|
|
||||||
// Strip trailing null bytes '\0' (by adjusting curSig.size) if import-
|
// 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
|
int op = 1; // ordinal position of the string within the block
|
||||||
Signature aSig;
|
Signature aSig;
|
||||||
memset( &aSig, 0, sizeof(Signature));
|
void *aSigPtr = static_cast<void*>(&aSig);
|
||||||
|
memset(aSigPtr, 0, sizeof(aSig));
|
||||||
|
|
||||||
while ((offBeg != DCTNRY_END_HEADER) &&
|
while ((offBeg != DCTNRY_END_HEADER) &&
|
||||||
(op <= MAX_STRING_CACHE_SIZE))
|
(op <= MAX_STRING_CACHE_SIZE))
|
||||||
@ -1365,8 +1367,10 @@ void Dctnry::preLoadStringCache( const DataBlock& fileBlock )
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
void Dctnry::addToStringCache( const Signature& newSig )
|
void Dctnry::addToStringCache( const Signature& newSig )
|
||||||
{
|
{
|
||||||
|
// We better add constructors that sets everything to 0;
|
||||||
Signature asig;
|
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];
|
asig.signature = new unsigned char[newSig.size];
|
||||||
memcpy(asig.signature, newSig.signature, newSig.size );
|
memcpy(asig.signature, newSig.signature, newSig.size );
|
||||||
asig.size = newSig.size;
|
asig.size = newSig.size;
|
||||||
|
@ -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
|
//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.sigValue = (unsigned char*)newTablename.c_str();
|
||||||
dictTuple.sigSize = newTablename.length();
|
dictTuple.sigSize = newTablename.length();
|
||||||
dictTuple.isNull = false;
|
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
|
//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.sigValue = (unsigned char*)newTablename.c_str();
|
||||||
dictTuple.sigSize = newTablename.length();
|
dictTuple.sigSize = newTablename.length();
|
||||||
dictTuple.isNull = false;
|
dictTuple.isNull = false;
|
||||||
|
@ -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;
|
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;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2087,18 +2093,11 @@ uint8_t WE_DMLCommandProc::processBatchInsertBinary(messageqcpp::ByteStream& bs,
|
|||||||
args.add(cols);
|
args.add(cols);
|
||||||
err = IDBErrorInfo::instance()->errorMsg(WARN_DATA_TRUNC, args);
|
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;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2240,6 +2239,9 @@ uint8_t WE_DMLCommandProc::commitBatchAutoOn(messageqcpp::ByteStream& bs, std::s
|
|||||||
fWEWrapper.getDictMap().erase(txnID);
|
fWEWrapper.getDictMap().erase(txnID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MCOL-1495 Remove fCatalogMap entries CS won't use anymore.
|
||||||
|
CalpontSystemCatalog::removeCalpontSystemCatalog(sessionId);
|
||||||
|
CalpontSystemCatalog::removeCalpontSystemCatalog(sessionId | 0x80000000);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2847,16 +2849,14 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs,
|
|||||||
convertToRelativeRid (rid, extentNum, blockNum);
|
convertToRelativeRid (rid, extentNum, blockNum);
|
||||||
rowIDLists.push_back(rid);
|
rowIDLists.push_back(rid);
|
||||||
uint32_t colWidth = (colTypes[j].colWidth > 8 ? 8 : colTypes[j].colWidth);
|
uint32_t colWidth = (colTypes[j].colWidth > 8 ? 8 : colTypes[j].colWidth);
|
||||||
|
int rrid = (int) relativeRID / (BYTE_PER_BLOCK / colWidth);
|
||||||
// populate stats.blocksChanged
|
// populate stats.blocksChanged
|
||||||
for (unsigned int k = 0; k < columnsUpdated.size(); k++)
|
if (rrid > preBlkNums[j])
|
||||||
{
|
|
||||||
if ((int)(relativeRID / (BYTE_PER_BLOCK / colWidth)) > preBlkNums[j])
|
|
||||||
{
|
{
|
||||||
|
preBlkNums[j] = rrid ;
|
||||||
blocksChanged++;
|
blocksChanged++;
|
||||||
preBlkNums[j] = relativeRID / (BYTE_PER_BLOCK / colWidth);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ridsFetched = true;
|
ridsFetched = true;
|
||||||
@ -3778,7 +3778,6 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs,
|
|||||||
err = IDBErrorInfo::instance()->errorMsg(WARN_DATA_TRUNC, args);
|
err = IDBErrorInfo::instance()->errorMsg(WARN_DATA_TRUNC, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
//cout << "finished update" << endl;
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3961,6 +3960,10 @@ uint8_t WE_DMLCommandProc::processFlushFiles(messageqcpp::ByteStream& bs, std::s
|
|||||||
//if (idbdatafile::IDBPolicy::useHdfs())
|
//if (idbdatafile::IDBPolicy::useHdfs())
|
||||||
// cacheutils::dropPrimProcFdCache();
|
// cacheutils::dropPrimProcFdCache();
|
||||||
TableMetaData::removeTableMetaData(tableOid);
|
TableMetaData::removeTableMetaData(tableOid);
|
||||||
|
|
||||||
|
// MCOL-1495 Remove fCatalogMap entries CS won't use anymore.
|
||||||
|
CalpontSystemCatalog::removeCalpontSystemCatalog(txnId);
|
||||||
|
CalpontSystemCatalog::removeCalpontSystemCatalog(txnId | 0x80000000);
|
||||||
return rc;
|
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;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,8 +269,8 @@ int WE_GetFileSizes::processFileName(
|
|||||||
std::string& errMsg, int key)
|
std::string& errMsg, int key)
|
||||||
{
|
{
|
||||||
uint8_t rc = 0;
|
uint8_t rc = 0;
|
||||||
off_t fileSize;
|
off_t fileSize = 0;
|
||||||
off_t compressedFileSize;
|
off_t compressedFileSize = 0;
|
||||||
errMsg.clear();
|
errMsg.clear();
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* Copyright (C) 2014 InfiniDB, Inc.
|
/* Copyright (C) 2014 InfiniDB, Inc.
|
||||||
|
Copyright (C) 2019 MariaDB Corporation.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License
|
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 int NUM_BLOCKS_PER_INITIAL_EXTENT; // defined in we_dctnry.cpp
|
||||||
extern WErrorCodes ec; // defined in we_log.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.
|
// Search for the specified chunk in fChunkList.
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@ -1923,10 +1926,22 @@ int ChunkManager::reallocateChunks(CompFileData* fileData)
|
|||||||
struct tm ltm;
|
struct tm ltm;
|
||||||
localtime_r(reinterpret_cast<time_t*>(&tv.tv_sec), <m);
|
localtime_r(reinterpret_cast<time_t*>(&tv.tv_sec), <m);
|
||||||
char tmText[24];
|
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",
|
snprintf(tmText, sizeof(tmText), ".%04d%02d%02d%02d%02d%02d%06ld",
|
||||||
ltm.tm_year + 1900, ltm.tm_mon + 1,
|
ltm.tm_year + 1900, ltm.tm_mon + 1,
|
||||||
ltm.tm_mday, ltm.tm_hour, ltm.tm_min,
|
ltm.tm_mday, ltm.tm_hour, ltm.tm_min,
|
||||||
ltm.tm_sec, tv.tv_usec);
|
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);
|
string dbgFileName(rlcFileName + tmText);
|
||||||
|
|
||||||
ostringstream oss;
|
ostringstream oss;
|
||||||
@ -2106,10 +2121,22 @@ int ChunkManager::reallocateChunks(CompFileData* fileData)
|
|||||||
struct tm ltm;
|
struct tm ltm;
|
||||||
localtime_r(reinterpret_cast<time_t*>(&tv.tv_sec), <m);
|
localtime_r(reinterpret_cast<time_t*>(&tv.tv_sec), <m);
|
||||||
char tmText[24];
|
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",
|
snprintf(tmText, sizeof(tmText), ".%04d%02d%02d%02d%02d%02d%06ld",
|
||||||
ltm.tm_year + 1900, ltm.tm_mon + 1,
|
ltm.tm_year + 1900, ltm.tm_mon + 1,
|
||||||
ltm.tm_mday, ltm.tm_hour, ltm.tm_min,
|
ltm.tm_mday, ltm.tm_hour, ltm.tm_min,
|
||||||
ltm.tm_sec, tv.tv_usec);
|
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);
|
string dbgFileName(rlcFileName + tmText);
|
||||||
|
|
||||||
ostringstream oss;
|
ostringstream oss;
|
||||||
|
@ -68,7 +68,6 @@ const int UNCOMPRESSED_CHUNK_SIZE = compress::IDBCompressInterface::UNCOMPRESSED
|
|||||||
const int COMPRESSED_FILE_HEADER_UNIT = compress::IDBCompressInterface::HDR_BUF_LEN;
|
const int COMPRESSED_FILE_HEADER_UNIT = compress::IDBCompressInterface::HDR_BUF_LEN;
|
||||||
|
|
||||||
// assume UNCOMPRESSED_CHUNK_SIZE > 0xBFFF (49151), 8 * 1024 bytes padding
|
// 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 BLOCKS_IN_CHUNK = UNCOMPRESSED_CHUNK_SIZE / BYTE_PER_BLOCK;
|
||||||
const int MAXOFFSET_PER_CHUNK = 511 * BYTE_PER_BLOCK;
|
const int MAXOFFSET_PER_CHUNK = 511 * BYTE_PER_BLOCK;
|
||||||
|
@ -330,12 +330,15 @@ int FileOp::deleteFile( FID fid ) const
|
|||||||
std::vector<std::string> dbRootPathList;
|
std::vector<std::string> dbRootPathList;
|
||||||
Config::getDBRootPathList( dbRootPathList );
|
Config::getDBRootPathList( dbRootPathList );
|
||||||
|
|
||||||
|
int rc;
|
||||||
|
|
||||||
for (unsigned i = 0; i < dbRootPathList.size(); i++)
|
for (unsigned i = 0; i < dbRootPathList.size(); i++)
|
||||||
{
|
{
|
||||||
char rootOidDirName[FILE_NAME_SIZE];
|
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;
|
ostringstream oss;
|
||||||
oss << "Unable to remove " << rootOidDirName;
|
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];
|
char dbDir [MAX_DB_DIR_LEVEL][MAX_DB_DIR_NAME_SIZE];
|
||||||
std::vector<std::string> dbRootPathList;
|
std::vector<std::string> dbRootPathList;
|
||||||
Config::getDBRootPathList( dbRootPathList );
|
Config::getDBRootPathList( dbRootPathList );
|
||||||
|
int rc;
|
||||||
|
|
||||||
for ( unsigned n = 0; n < fids.size(); n++ )
|
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++)
|
for (unsigned i = 0; i < dbRootPathList.size(); i++)
|
||||||
{
|
{
|
||||||
char rootOidDirName[FILE_NAME_SIZE];
|
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);
|
oidDirName);
|
||||||
|
|
||||||
if ( IDBPolicy::remove( rootOidDirName ) != 0 )
|
if ( rc == FILE_NAME_SIZE || IDBPolicy::remove( rootOidDirName ) != 0 )
|
||||||
{
|
{
|
||||||
ostringstream oss;
|
ostringstream oss;
|
||||||
oss << "Unable to remove " << rootOidDirName;
|
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 dbDir [MAX_DB_DIR_LEVEL][MAX_DB_DIR_NAME_SIZE];
|
||||||
char rootOidDirName[FILE_NAME_SIZE];
|
char rootOidDirName[FILE_NAME_SIZE];
|
||||||
char partitionDirName[FILE_NAME_SIZE];
|
char partitionDirName[FILE_NAME_SIZE];
|
||||||
|
int rcd, rcp;
|
||||||
|
|
||||||
for (uint32_t i = 0; i < partitions.size(); i++)
|
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]);
|
dbDir[0], dbDir[1], dbDir[2], dbDir[3], dbDir[4]);
|
||||||
// config expects dbroot starting from 0
|
// config expects dbroot starting from 0
|
||||||
std::string rt( Config::getDBRootByNum(partitions[i].lp.dbroot) );
|
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);
|
rt.c_str(), tempFileName);
|
||||||
sprintf(partitionDirName, "%s/%s",
|
rcp = snprintf(partitionDirName, FILE_NAME_SIZE, "%s/%s",
|
||||||
rt.c_str(), oidDirName);
|
rt.c_str(), oidDirName);
|
||||||
|
|
||||||
if ( IDBPolicy::remove( rootOidDirName ) != 0 )
|
if ( rcd == FILE_NAME_SIZE || rcp == FILE_NAME_SIZE
|
||||||
|
|| IDBPolicy::remove( rootOidDirName ) != 0 )
|
||||||
{
|
{
|
||||||
ostringstream oss;
|
ostringstream oss;
|
||||||
oss << "Unable to remove " << rootOidDirName;
|
oss << "Unable to remove " << rootOidDirName;
|
||||||
|
@ -393,7 +393,7 @@ struct IdxMultiColKey
|
|||||||
curMask.reset();
|
curMask.reset();
|
||||||
curLevel = maxLevel = 0;
|
curLevel = maxLevel = 0;
|
||||||
totalBit = 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 );
|
memset( keyBuf, 0, IDX_MAX_MULTI_COL_BIT / 8 );
|
||||||
curMask = 0x1F;
|
curMask = 0x1F;
|
||||||
curMask = curMask << (IDX_MAX_MULTI_COL_BIT - 5);
|
curMask = curMask << (IDX_MAX_MULTI_COL_BIT - 5);
|
||||||
|
@ -489,7 +489,7 @@ struct CacheControl /** @brief Cache control structure */
|
|||||||
int checkInterval; /** @brief A check point interval in seconds */
|
int checkInterval; /** @brief A check point interval in seconds */
|
||||||
CacheControl()
|
CacheControl()
|
||||||
{
|
{
|
||||||
totalBlock = pctFree = checkInterval; /** @brief constructor */
|
totalBlock = pctFree = checkInterval = 0; /** @brief constructor */
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -356,7 +356,7 @@ unsigned int WEFileReadThread::readDataFile(messageqcpp::SBS& Sbs)
|
|||||||
//char aBuff[1024*1024]; // TODO May have to change it later
|
//char aBuff[1024*1024]; // TODO May have to change it later
|
||||||
//char*pStart = aBuff;
|
//char*pStart = aBuff;
|
||||||
unsigned int aIdx = 0;
|
unsigned int aIdx = 0;
|
||||||
unsigned int aLen = 0;
|
int aLen = 0;
|
||||||
*Sbs << (ByteStream::byte)(WE_CLT_SRV_DATA);
|
*Sbs << (ByteStream::byte)(WE_CLT_SRV_DATA);
|
||||||
|
|
||||||
while ((!fInFile.eof()) && (aIdx < getBatchQty()))
|
while ((!fInFile.eof()) && (aIdx < getBatchQty()))
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* Copyright (C) 2014 InfiniDB, Inc.
|
/* Copyright (C) 2014 InfiniDB, Inc.
|
||||||
|
Copyright (C) 2019 MariaDB Corporation.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License
|
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)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
std::string err;
|
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);
|
std::cin.sync_with_stdio(false);
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -239,7 +239,8 @@ int ColumnOp::allocRowId(const TxnID& txnid, bool useStartingExtent,
|
|||||||
|
|
||||||
for (i = 0; i < dbRootExtentTrackers.size(); i++)
|
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);
|
dbRootExtentTrackers[i]->nextSegFile(dbRoot, partition, segment, newHwm, startLbid);
|
||||||
|
|
||||||
// Round up HWM to the end of the current extent
|
// Round up HWM to the end of the current extent
|
||||||
|
@ -38,9 +38,9 @@ namespace
|
|||||||
{
|
{
|
||||||
const char* DICT_TYPE("D");
|
const char* DICT_TYPE("D");
|
||||||
const char* ENCODING("UTF-8");
|
const char* ENCODING("UTF-8");
|
||||||
const char* JOBNAME("Job_");
|
|
||||||
const char* LOGNAME("Jobxml_");
|
const char* LOGNAME("Jobxml_");
|
||||||
const std::string LOGDIR("/log/");
|
const std::string LOGDIR("/log/");
|
||||||
|
const char* JOBNAME("Job_");
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace WriteEngine
|
namespace WriteEngine
|
||||||
@ -438,10 +438,11 @@ void XMLGenProc::getColumnsForTable(
|
|||||||
throw std::runtime_error( oss.str() );
|
throw std::runtime_error( oss.str() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Generate Job XML File Name
|
// Generate Job XML File Name
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
std::string XMLGenProc::genJobXMLFileName( ) const
|
std::string XMLGenProc::genJobXMLFileName( ) const
|
||||||
{
|
{
|
||||||
std::string xmlFileName;
|
std::string xmlFileName;
|
||||||
@ -465,7 +466,10 @@ std::string XMLGenProc::genJobXMLFileName( ) const
|
|||||||
if (!p.has_root_path())
|
if (!p.has_root_path())
|
||||||
{
|
{
|
||||||
char cwdPath[4096];
|
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);
|
boost::filesystem::path p2(cwdPath);
|
||||||
p2 /= p;
|
p2 /= p;
|
||||||
xmlFileName = p2.string();
|
xmlFileName = p2.string();
|
||||||
@ -479,7 +483,7 @@ std::string XMLGenProc::genJobXMLFileName( ) const
|
|||||||
|
|
||||||
return xmlFileName;
|
return xmlFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// writeXMLFile
|
// writeXMLFile
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
@ -1313,7 +1313,13 @@ int XMLJob::genJobXMLFileName(
|
|||||||
// nothing else to do
|
// nothing else to do
|
||||||
#else
|
#else
|
||||||
char cwdPath[4096];
|
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());
|
string trailingPath(xmlFilePath.string());
|
||||||
xmlFilePath = cwdPath;
|
xmlFilePath = cwdPath;
|
||||||
xmlFilePath /= trailingPath;
|
xmlFilePath /= trailingPath;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user