You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
Merge branch 'develop-1.1' into dev-merge-up-20180430
This commit is contained in:
@ -2099,6 +2099,7 @@ const JobStepVector doOuterJoinOnFilter(OuterJoinOnFilter* oj, JobInfo& jobInfo)
|
|||||||
set<ParseTree*> doneNodes; // solved joins and simple filters
|
set<ParseTree*> doneNodes; // solved joins and simple filters
|
||||||
map<ParseTree*, ParseTree*> cpMap; // <child, parent> link for node removal
|
map<ParseTree*, ParseTree*> cpMap; // <child, parent> link for node removal
|
||||||
JobStepVector join; // join step with its projection steps
|
JobStepVector join; // join step with its projection steps
|
||||||
|
bool keepFilters = false; // keep filters for cross engine step
|
||||||
|
|
||||||
// To compromise the front end difficulty on setting outer attributes.
|
// To compromise the front end difficulty on setting outer attributes.
|
||||||
set<uint64_t> tablesInOuter;
|
set<uint64_t> tablesInOuter;
|
||||||
@ -2323,6 +2324,14 @@ const JobStepVector doOuterJoinOnFilter(OuterJoinOnFilter* oj, JobInfo& jobInfo)
|
|||||||
|
|
||||||
jsv.insert(jsv.end(), sfv.begin(), sfv.end());
|
jsv.insert(jsv.end(), sfv.begin(), sfv.end());
|
||||||
|
|
||||||
|
// MCOL-1182 if we are doing a join between a cross engine
|
||||||
|
// step and a constant then keep the filter for the cross
|
||||||
|
// engine step instead of deleting it further down.
|
||||||
|
if (!sc->isInfiniDB())
|
||||||
|
{
|
||||||
|
keepFilters = true;
|
||||||
|
}
|
||||||
|
|
||||||
doneNodes.insert(cn);
|
doneNodes.insert(cn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2364,7 +2373,11 @@ const JobStepVector doOuterJoinOnFilter(OuterJoinOnFilter* oj, JobInfo& jobInfo)
|
|||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
{
|
{
|
||||||
filters = NULL;
|
filters = NULL;
|
||||||
delete c;
|
|
||||||
|
if (!keepFilters)
|
||||||
|
{
|
||||||
|
delete c;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2411,8 +2424,12 @@ const JobStepVector doOuterJoinOnFilter(OuterJoinOnFilter* oj, JobInfo& jobInfo)
|
|||||||
|
|
||||||
p->left(nullTree);
|
p->left(nullTree);
|
||||||
p->right(nullTree);
|
p->right(nullTree);
|
||||||
delete p;
|
|
||||||
delete c;
|
if (!keepFilters)
|
||||||
|
{
|
||||||
|
delete p;
|
||||||
|
delete c;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1091,6 +1091,7 @@ void TupleAggregateStep::prep1PhaseAggregate(
|
|||||||
vector<SP_ROWAGG_FUNC_t> functionVec;
|
vector<SP_ROWAGG_FUNC_t> functionVec;
|
||||||
uint32_t bigIntWidth = sizeof(int64_t);
|
uint32_t bigIntWidth = sizeof(int64_t);
|
||||||
uint32_t bigUintWidth = sizeof(uint64_t);
|
uint32_t bigUintWidth = sizeof(uint64_t);
|
||||||
|
uint32_t projColsUDAFIndex = 0;
|
||||||
|
|
||||||
mcsv1sdk::mcsv1_UDAF* pUDAFFunc = NULL;
|
mcsv1sdk::mcsv1_UDAF* pUDAFFunc = NULL;
|
||||||
// for count column of average function
|
// for count column of average function
|
||||||
@ -1279,16 +1280,26 @@ void TupleAggregateStep::prep1PhaseAggregate(
|
|||||||
|
|
||||||
if (aggOp == ROWAGG_UDAF)
|
if (aggOp == ROWAGG_UDAF)
|
||||||
{
|
{
|
||||||
UDAFColumn* udafc = dynamic_cast<UDAFColumn*>(jobInfo.projectionCols[i].get());
|
std::vector<SRCP>::iterator it = jobInfo.projectionCols.begin() + projColsUDAFIndex;
|
||||||
|
|
||||||
if (udafc)
|
for (; it != jobInfo.projectionCols.end(); it++)
|
||||||
{
|
{
|
||||||
// Create a RowAggFunctionCol (UDAF subtype) with the context.
|
UDAFColumn* udafc = dynamic_cast<UDAFColumn*>((*it).get());
|
||||||
funct.reset(new RowUDAFFunctionCol(udafc->getContext(), colProj, i));
|
projColsUDAFIndex++;
|
||||||
|
|
||||||
|
if (udafc)
|
||||||
|
{
|
||||||
|
pUDAFFunc = udafc->getContext().getFunction();
|
||||||
|
// Create a RowAggFunctionCol (UDAF subtype) with the context.
|
||||||
|
funct.reset(new RowUDAFFunctionCol(udafc->getContext(), colProj, i));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (it == jobInfo.projectionCols.end())
|
||||||
{
|
{
|
||||||
throw logic_error("prep1PhasesAggregate: A UDAF function is called but there's no UDAFColumn");
|
throw logic_error("prep1PhaseAggregate: A UDAF function is called but there's no/not enough UDAFColumn/-s");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1649,6 +1660,7 @@ void TupleAggregateStep::prep1PhaseDistinctAggregate(
|
|||||||
AGG_MAP aggFuncMap;
|
AGG_MAP aggFuncMap;
|
||||||
mcsv1sdk::mcsv1_UDAF* pUDAFFunc = NULL;
|
mcsv1sdk::mcsv1_UDAF* pUDAFFunc = NULL;
|
||||||
set<uint32_t> avgSet;
|
set<uint32_t> avgSet;
|
||||||
|
uint32_t projColsUDAFIndex = 0;
|
||||||
|
|
||||||
// for count column of average function
|
// for count column of average function
|
||||||
map<uint32_t, SP_ROWAGG_FUNC_t> avgFuncMap, avgDistFuncMap;
|
map<uint32_t, SP_ROWAGG_FUNC_t> avgFuncMap, avgDistFuncMap;
|
||||||
@ -1812,17 +1824,26 @@ void TupleAggregateStep::prep1PhaseDistinctAggregate(
|
|||||||
|
|
||||||
if (aggOp == ROWAGG_UDAF)
|
if (aggOp == ROWAGG_UDAF)
|
||||||
{
|
{
|
||||||
UDAFColumn* udafc = dynamic_cast<UDAFColumn*>(jobInfo.projectionCols[i].get());
|
std::vector<SRCP>::iterator it = jobInfo.projectionCols.begin() + projColsUDAFIndex;
|
||||||
|
|
||||||
if (udafc)
|
for (; it != jobInfo.projectionCols.end(); it++)
|
||||||
{
|
{
|
||||||
pUDAFFunc = udafc->getContext().getFunction();
|
UDAFColumn* udafc = dynamic_cast<UDAFColumn*>((*it).get());
|
||||||
// Create a RowAggFunctionCol (UDAF subtype) with the context.
|
projColsUDAFIndex++;
|
||||||
funct.reset(new RowUDAFFunctionCol(udafc->getContext(), colProj, colAgg));
|
|
||||||
|
if (udafc)
|
||||||
|
{
|
||||||
|
pUDAFFunc = udafc->getContext().getFunction();
|
||||||
|
// Create a RowAggFunctionCol (UDAF subtype) with the context.
|
||||||
|
funct.reset(new RowUDAFFunctionCol(udafc->getContext(), colProj, colAgg));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (it == jobInfo.projectionCols.end())
|
||||||
{
|
{
|
||||||
throw logic_error("prep1PhaseDistinctAggregate: A UDAF function is called but there's no UDAFColumn");
|
throw logic_error("prep1PhaseDistinctAggregate: A UDAF function is called but there's no/not enough UDAFColumn/-s");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2814,6 +2835,7 @@ void TupleAggregateStep::prep2PhasesAggregate(
|
|||||||
vector<pair<uint32_t, int> > aggColVec;
|
vector<pair<uint32_t, int> > aggColVec;
|
||||||
set<uint32_t> avgSet;
|
set<uint32_t> avgSet;
|
||||||
vector<std::pair<uint32_t, int> >& returnedColVec = jobInfo.returnedColVec;
|
vector<std::pair<uint32_t, int> >& returnedColVec = jobInfo.returnedColVec;
|
||||||
|
uint32_t projColsUDAFIndex = 0;
|
||||||
|
|
||||||
for (uint64_t i = 0; i < returnedColVec.size(); i++)
|
for (uint64_t i = 0; i < returnedColVec.size(); i++)
|
||||||
{
|
{
|
||||||
@ -2992,17 +3014,26 @@ void TupleAggregateStep::prep2PhasesAggregate(
|
|||||||
|
|
||||||
if (aggOp == ROWAGG_UDAF)
|
if (aggOp == ROWAGG_UDAF)
|
||||||
{
|
{
|
||||||
UDAFColumn* udafc = dynamic_cast<UDAFColumn*>(jobInfo.projectionCols[i].get());
|
std::vector<SRCP>::iterator it = jobInfo.projectionCols.begin() + projColsUDAFIndex;
|
||||||
|
|
||||||
if (udafc)
|
for (; it != jobInfo.projectionCols.end(); it++)
|
||||||
{
|
{
|
||||||
pUDAFFunc = udafc->getContext().getFunction();
|
UDAFColumn* udafc = dynamic_cast<UDAFColumn*>((*it).get());
|
||||||
// Create a RowAggFunctionCol (UDAF subtype) with the context.
|
projColsUDAFIndex++;
|
||||||
funct.reset(new RowUDAFFunctionCol(udafc->getContext(), colProj, colAggPm));
|
|
||||||
|
if (udafc)
|
||||||
|
{
|
||||||
|
pUDAFFunc = udafc->getContext().getFunction();
|
||||||
|
// Create a RowAggFunctionCol (UDAF subtype) with the context.
|
||||||
|
funct.reset(new RowUDAFFunctionCol(udafc->getContext(), colProj, colAggPm));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (it == jobInfo.projectionCols.end())
|
||||||
{
|
{
|
||||||
throw logic_error("prep2PhasesAggregate: A UDAF function is called but there's no UDAFColumn");
|
throw logic_error("prep2PhasesAggregate: A UDAF function is called but there's no/not enough UDAFColumn/-s");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3583,6 +3614,7 @@ void TupleAggregateStep::prep2PhasesDistinctAggregate(
|
|||||||
vector<pair<uint32_t, int> > aggColVec, aggNoDistColVec;
|
vector<pair<uint32_t, int> > aggColVec, aggNoDistColVec;
|
||||||
set<uint32_t> avgSet, avgDistSet;
|
set<uint32_t> avgSet, avgDistSet;
|
||||||
vector<std::pair<uint32_t, int> >& returnedColVec = jobInfo.returnedColVec;
|
vector<std::pair<uint32_t, int> >& returnedColVec = jobInfo.returnedColVec;
|
||||||
|
uint32_t projColsUDAFIndex = 0;
|
||||||
|
|
||||||
for (uint64_t i = 0; i < returnedColVec.size(); i++)
|
for (uint64_t i = 0; i < returnedColVec.size(); i++)
|
||||||
{
|
{
|
||||||
@ -3796,17 +3828,25 @@ void TupleAggregateStep::prep2PhasesDistinctAggregate(
|
|||||||
|
|
||||||
if (aggOp == ROWAGG_UDAF)
|
if (aggOp == ROWAGG_UDAF)
|
||||||
{
|
{
|
||||||
UDAFColumn* udafc = dynamic_cast<UDAFColumn*>(jobInfo.projectionCols[i].get());
|
std::vector<SRCP>::iterator it = jobInfo.projectionCols.begin() + projColsUDAFIndex;
|
||||||
|
|
||||||
if (udafc)
|
for (; it != jobInfo.projectionCols.end(); it++)
|
||||||
{
|
{
|
||||||
pUDAFFunc = udafc->getContext().getFunction();
|
UDAFColumn* udafc = dynamic_cast<UDAFColumn*>((*it).get());
|
||||||
// Create a RowAggFunctionCol (UDAF subtype) with the context.
|
projColsUDAFIndex++;
|
||||||
funct.reset(new RowUDAFFunctionCol(udafc->getContext(), colProj, colAggPm));
|
|
||||||
|
if (udafc)
|
||||||
|
{
|
||||||
|
pUDAFFunc = udafc->getContext().getFunction();
|
||||||
|
// Create a RowAggFunctionCol (UDAF subtype) with the context.
|
||||||
|
funct.reset(new RowUDAFFunctionCol(udafc->getContext(), colProj, colAggPm));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (it == jobInfo.projectionCols.end())
|
||||||
{
|
{
|
||||||
throw logic_error("prep2PhasesDistinctAggregate: A UDAF function is called but there's no UDAFColumn");
|
throw logic_error("prep2PhasesDistinctAggregate: A UDAF function is called but there's no/not enough UDAFColumn/-s");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3648,6 +3648,22 @@ FunctionColumn* buildCaseFunction(Item_func* item, gp_walk_info& gwi, bool& nonS
|
|||||||
// and position. We can't tell which at this point, so we
|
// and position. We can't tell which at this point, so we
|
||||||
// rebuild the item from the arguments directly and then try to
|
// rebuild the item from the arguments directly and then try to
|
||||||
// figure what to pop, if anything, in order to sync the stacks.
|
// figure what to pop, if anything, in order to sync the stacks.
|
||||||
|
//
|
||||||
|
// MCOL-1341 - With MariaDB 10.2.14 onwards CASE is now in the order:
|
||||||
|
// [case,]when1,when2,...,then1,then2,...[,else]
|
||||||
|
// See server commit bf1ca14ff3f3faa9f7a018097b25aa0f66d068cd for more
|
||||||
|
// information.
|
||||||
|
int32_t arg_offset = 0;
|
||||||
|
|
||||||
|
if ((item->argument_count() - 1) % 2)
|
||||||
|
{
|
||||||
|
arg_offset = (item->argument_count() - 1) / 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
arg_offset = item->argument_count() / 2;
|
||||||
|
}
|
||||||
|
|
||||||
for (int32_t i = item->argument_count() - 1; i >= 0; i--)
|
for (int32_t i = item->argument_count() - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
// For case_searched, we know the items for the WHEN clause will
|
// For case_searched, we know the items for the WHEN clause will
|
||||||
@ -3656,7 +3672,7 @@ FunctionColumn* buildCaseFunction(Item_func* item, gp_walk_info& gwi, bool& nonS
|
|||||||
// Every even numbered arg is a WHEN. In between are the THEN.
|
// Every even numbered arg is a WHEN. In between are the THEN.
|
||||||
// An odd number of args indicates an ELSE residing in the last spot.
|
// An odd number of args indicates an ELSE residing in the last spot.
|
||||||
if (funcName == "case_searched" &&
|
if (funcName == "case_searched" &&
|
||||||
i % 2 == 0 && uint(i) != item->argument_count() - 1)
|
(i < arg_offset))
|
||||||
{
|
{
|
||||||
sptp.reset(buildParseTree((Item_func*)(item->arguments()[i]), gwi, nonSupport));
|
sptp.reset(buildParseTree((Item_func*)(item->arguments()[i]), gwi, nonSupport));
|
||||||
|
|
||||||
|
@ -77,7 +77,6 @@ void callFree(const char* )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool waitForActive()
|
bool waitForActive()
|
||||||
{
|
{
|
||||||
Oam oam;
|
Oam oam;
|
||||||
@ -536,7 +535,6 @@ int sendReplicationRequest(int IserverTypeInstall, std::string password, bool pm
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cout << endl << "ERROR: Module not Active, replication not done on " << (*pt).DeviceName << endl;
|
|
||||||
pt++;
|
pt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1968,7 +1968,7 @@ void pingDeviceThread()
|
|||||||
DeviceNetworkConfig devicenetworkconfig;
|
DeviceNetworkConfig devicenetworkconfig;
|
||||||
devicenetworkconfig.DeviceName = moduleName;
|
devicenetworkconfig.DeviceName = moduleName;
|
||||||
devicenetworklist.push_back(devicenetworkconfig);
|
devicenetworklist.push_back(devicenetworkconfig);
|
||||||
processManager.setMySQLReplication(devicenetworklist, oam::UnassignedName, false, true);
|
processManager.setMySQLReplication(devicenetworklist, oam::UnassignedName, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2817,7 +2817,7 @@ void processMSG(messageqcpp::IOSocket* cfIos)
|
|||||||
|
|
||||||
// target = root password
|
// target = root password
|
||||||
oam::DeviceNetworkList devicenetworklist;
|
oam::DeviceNetworkList devicenetworklist;
|
||||||
status = processManager.setMySQLReplication(devicenetworklist, oam::UnassignedName, false, true, target);
|
status = processManager.setMySQLReplication(devicenetworklist, oam::UnassignedName, true, target);
|
||||||
|
|
||||||
log.writeLog(__LINE__, "Enable MySQL Replication status: " + oam.itoa(status) );
|
log.writeLog(__LINE__, "Enable MySQL Replication status: " + oam.itoa(status) );
|
||||||
|
|
||||||
@ -2841,7 +2841,7 @@ void processMSG(messageqcpp::IOSocket* cfIos)
|
|||||||
|
|
||||||
// target = root password
|
// target = root password
|
||||||
oam::DeviceNetworkList devicenetworklist;
|
oam::DeviceNetworkList devicenetworklist;
|
||||||
status = processManager.setMySQLReplication(devicenetworklist, oam::UnassignedName, false, false, target, false);
|
status = processManager.setMySQLReplication(devicenetworklist, oam::UnassignedName, false, target, false);
|
||||||
|
|
||||||
log.writeLog(__LINE__, "Disable MySQL Replication status: " + oam.itoa(status) );
|
log.writeLog(__LINE__, "Disable MySQL Replication status: " + oam.itoa(status) );
|
||||||
|
|
||||||
@ -3726,12 +3726,12 @@ int ProcessManager::disableModule(string target, bool manualFlag)
|
|||||||
* purpose: recyle process, generally after some disable module is run
|
* purpose: recyle process, generally after some disable module is run
|
||||||
*
|
*
|
||||||
******************************************************************************************/
|
******************************************************************************************/
|
||||||
void ProcessManager::recycleProcess(string module)
|
void ProcessManager::recycleProcess(string module, bool enableModule)
|
||||||
{
|
{
|
||||||
Oam oam;
|
Oam oam;
|
||||||
ModuleConfig moduleconfig;
|
ModuleConfig moduleconfig;
|
||||||
|
|
||||||
log.writeLog(__LINE__, "recycleProcess request after module was disabled: " + module, LOG_TYPE_DEBUG);
|
log.writeLog(__LINE__, "recycleProcess request after module status update: " + module, LOG_TYPE_DEBUG);
|
||||||
|
|
||||||
string moduleType = module.substr(0, MAX_MODULE_TYPE_SIZE);
|
string moduleType = module.substr(0, MAX_MODULE_TYPE_SIZE);
|
||||||
|
|
||||||
@ -3743,6 +3743,17 @@ void ProcessManager::recycleProcess(string module)
|
|||||||
}
|
}
|
||||||
catch (...) {}
|
catch (...) {}
|
||||||
|
|
||||||
|
// restart DBRM Process and DMLProc and return if enable module is being done
|
||||||
|
if (enableModule)
|
||||||
|
{
|
||||||
|
//recycle DBRM processes in all cases
|
||||||
|
restartProcessType("DBRMControllerNode");
|
||||||
|
restartProcessType("DBRMWorkerNode");
|
||||||
|
|
||||||
|
restartProcessType("DMLProc");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//recycle DBRM processes in all cases
|
//recycle DBRM processes in all cases
|
||||||
restartProcessType("DBRMControllerNode", module);
|
restartProcessType("DBRMControllerNode", module);
|
||||||
restartProcessType("DBRMWorkerNode");
|
restartProcessType("DBRMWorkerNode");
|
||||||
@ -3827,6 +3838,9 @@ int ProcessManager::enableModule(string target, int state)
|
|||||||
if ( newStandbyModule == target)
|
if ( newStandbyModule == target)
|
||||||
setStandbyModule(newStandbyModule);
|
setStandbyModule(newStandbyModule);
|
||||||
|
|
||||||
|
//set recycle process
|
||||||
|
recycleProcess(target);
|
||||||
|
|
||||||
log.writeLog(__LINE__, "enableModule request for " + target + " completed", LOG_TYPE_DEBUG);
|
log.writeLog(__LINE__, "enableModule request for " + target + " completed", LOG_TYPE_DEBUG);
|
||||||
|
|
||||||
return API_SUCCESS;
|
return API_SUCCESS;
|
||||||
@ -3971,20 +3985,23 @@ int ProcessManager::startProcess(string moduleName, string processName,
|
|||||||
{
|
{
|
||||||
Oam oam;
|
Oam oam;
|
||||||
|
|
||||||
//skip if module is DISABLED
|
if ( actionIndicator != oam::STATUS_UPDATE )
|
||||||
int opState;
|
|
||||||
bool degraded;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
oam.getModuleStatus(moduleName, opState, degraded);
|
//skip if module is DISABLED
|
||||||
}
|
int opState;
|
||||||
catch (...)
|
bool degraded;
|
||||||
{}
|
|
||||||
|
|
||||||
//check if disabled
|
try
|
||||||
if (opState == oam::MAN_DISABLED || opState == oam::AUTO_DISABLED)
|
{
|
||||||
return API_SUCCESS;
|
oam.getModuleStatus(moduleName, opState, degraded);
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{}
|
||||||
|
|
||||||
|
//check if disabled
|
||||||
|
if (opState == oam::MAN_DISABLED || opState == oam::AUTO_DISABLED)
|
||||||
|
return API_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
ByteStream msg;
|
ByteStream msg;
|
||||||
ByteStream::byte requestID = START;
|
ByteStream::byte requestID = START;
|
||||||
@ -4942,9 +4959,9 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( packageType == "rpm")
|
if ( packageType == "rpm")
|
||||||
calpontPackage = homedir + "/mariadb-columnstore*" + columnstore_version + "-" + columnstore_release + "*.rpm.tar.gz";
|
calpontPackage = homedir + "/mariadb-columnstore*" + columnstore_version + "-" + columnstore_release + "*.rpm";
|
||||||
else if ( packageType == "deb")
|
else if ( packageType == "deb")
|
||||||
calpontPackage = homedir + "/mariadb-columnstore*" + columnstore_version + "-" + columnstore_release + "*.deb.tar.gz";
|
calpontPackage = homedir + "/mariadb-columnstore*" + columnstore_version + "-" + columnstore_release + "*.deb";
|
||||||
else
|
else
|
||||||
calpontPackage = homedir + "/mariadb-columnstore*" + columnstore_version + "-" + columnstore_release + "*.bin.tar.gz";
|
calpontPackage = homedir + "/mariadb-columnstore*" + columnstore_version + "-" + columnstore_release + "*.bin.tar.gz";
|
||||||
|
|
||||||
@ -5955,8 +5972,24 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str
|
|||||||
log.writeLog(__LINE__, "addModule - sleep 60 - give ProcMon time to CONFIGURE and restart", LOG_TYPE_DEBUG);
|
log.writeLog(__LINE__, "addModule - sleep 60 - give ProcMon time to CONFIGURE and restart", LOG_TYPE_DEBUG);
|
||||||
sleep(60);
|
sleep(60);
|
||||||
|
|
||||||
|
//start mysqld on the new modules so mysql replication can be setup
|
||||||
|
listPT = devicenetworklist.begin();
|
||||||
|
|
||||||
|
for ( ; listPT != devicenetworklist.end() ; listPT++)
|
||||||
|
{
|
||||||
|
processManager.startProcess((*listPT).DeviceName, "mysqld", oam::STATUS_UPDATE);
|
||||||
|
}
|
||||||
|
|
||||||
log.writeLog(__LINE__, "Setup MySQL Replication for new Modules being Added", LOG_TYPE_DEBUG);
|
log.writeLog(__LINE__, "Setup MySQL Replication for new Modules being Added", LOG_TYPE_DEBUG);
|
||||||
processManager.setMySQLReplication(devicenetworklist, oam::UnassignedName, false, true, password );
|
processManager.setMySQLReplication(devicenetworklist, oam::UnassignedName, true, password, true, true );
|
||||||
|
|
||||||
|
//stop mysqld
|
||||||
|
listPT = devicenetworklist.begin();
|
||||||
|
|
||||||
|
for ( ; listPT != devicenetworklist.end() ; listPT++)
|
||||||
|
{
|
||||||
|
processManager.stopProcess((*listPT).DeviceName, "mysqld", oam::FORCEFUL, true );
|
||||||
|
}
|
||||||
|
|
||||||
return API_SUCCESS;
|
return API_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -9533,7 +9566,7 @@ int ProcessManager::switchParentOAMModule(std::string newActiveModuleName)
|
|||||||
//change master MySQL Replication setup
|
//change master MySQL Replication setup
|
||||||
log.writeLog(__LINE__, "Setup MySQL Replication for new Parent Module during switch-over", LOG_TYPE_DEBUG);
|
log.writeLog(__LINE__, "Setup MySQL Replication for new Parent Module during switch-over", LOG_TYPE_DEBUG);
|
||||||
oam::DeviceNetworkList devicenetworklist;
|
oam::DeviceNetworkList devicenetworklist;
|
||||||
processManager.setMySQLReplication(devicenetworklist, newActiveModuleName, false, false, oam::UnassignedName);
|
processManager.setMySQLReplication(devicenetworklist, newActiveModuleName, false, oam::UnassignedName);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (exception& ex)
|
catch (exception& ex)
|
||||||
@ -10414,7 +10447,7 @@ int ProcessManager::OAMParentModuleChange()
|
|||||||
//change master MySQL Replication setup
|
//change master MySQL Replication setup
|
||||||
log.writeLog(__LINE__, "Setup this node as MySQL Replication Master", LOG_TYPE_DEBUG);
|
log.writeLog(__LINE__, "Setup this node as MySQL Replication Master", LOG_TYPE_DEBUG);
|
||||||
oam::DeviceNetworkList devicenetworklist;
|
oam::DeviceNetworkList devicenetworklist;
|
||||||
processManager.setMySQLReplication(devicenetworklist, config.moduleName(), true);
|
processManager.setMySQLReplication(devicenetworklist, config.moduleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
//set query system state not ready
|
//set query system state not ready
|
||||||
@ -11130,7 +11163,7 @@ void ProcessManager::flushInodeCache()
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************************/
|
******************************************************************************************/
|
||||||
int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist, std::string masterModule, bool failover, bool distributeDB, std::string password, bool enable)
|
int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist, std::string masterModule, bool distributeDB, std::string password, bool enable, bool addModule)
|
||||||
{
|
{
|
||||||
Oam oam;
|
Oam oam;
|
||||||
|
|
||||||
@ -11153,57 +11186,6 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
|
|||||||
return oam::API_SUCCESS;
|
return oam::API_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//also skip if single-server, multi-node seperate with 1 UM, multi-node combo with 1 PM
|
|
||||||
|
|
||||||
/* string SingleServerInstall = "n";
|
|
||||||
try {
|
|
||||||
oam.getSystemConfig("SingleServerInstall", SingleServerInstall);
|
|
||||||
}
|
|
||||||
catch(...) {
|
|
||||||
SingleServerInstall = "n";
|
|
||||||
}
|
|
||||||
|
|
||||||
//single server check
|
|
||||||
if ( SingleServerInstall == "y" )
|
|
||||||
{
|
|
||||||
log.writeLog(__LINE__, "setMySQLReplication: Single-Server, exiting", LOG_TYPE_DEBUG);
|
|
||||||
return oam::API_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
//combined system check
|
|
||||||
if ( config.ServerInstallType() == oam::INSTALL_COMBINE_DM_UM_PM && !failover ) {
|
|
||||||
try {
|
|
||||||
Config* sysConfig = Config::makeConfig();
|
|
||||||
if ( sysConfig->getConfig("DBRM_Controller", "NumWorkers") == "1" ) {
|
|
||||||
log.writeLog(__LINE__, "setMySQLReplication: 1 configured module, exiting", LOG_TYPE_DEBUG);
|
|
||||||
return oam::API_SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch(...)
|
|
||||||
{
|
|
||||||
log.writeLog(__LINE__, "setMySQLReplication: makeConfig exception, exiting", LOG_TYPE_DEBUG);
|
|
||||||
return oam::API_SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//seperate system check
|
|
||||||
if ( ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM ) &&
|
|
||||||
(PMwithUM == "n" ) )
|
|
||||||
{
|
|
||||||
ModuleTypeConfig moduletypeconfig;
|
|
||||||
try{
|
|
||||||
oam.getSystemConfig("um", moduletypeconfig);
|
|
||||||
}
|
|
||||||
catch(...)
|
|
||||||
{}
|
|
||||||
|
|
||||||
if ( moduletypeconfig.ModuleCount < 2 )
|
|
||||||
{
|
|
||||||
log.writeLog(__LINE__, "setMySQLReplication: moduleCount = 1, exiting", LOG_TYPE_DEBUG);
|
|
||||||
return oam::API_SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
log.writeLog(__LINE__, "Setup MySQL Replication", LOG_TYPE_DEBUG);
|
log.writeLog(__LINE__, "Setup MySQL Replication", LOG_TYPE_DEBUG);
|
||||||
|
|
||||||
//get master info
|
//get master info
|
||||||
@ -11262,19 +11244,22 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
|
|||||||
if ( remoteModuleName == masterModule )
|
if ( remoteModuleName == masterModule )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// skip disabled modules
|
if ( !addModule )
|
||||||
int opState = oam::ACTIVE;
|
|
||||||
bool degraded;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
oam.getModuleStatus(remoteModuleName, opState, degraded);
|
// skip disabled modules
|
||||||
}
|
int opState = oam::ACTIVE;
|
||||||
catch (...)
|
bool degraded;
|
||||||
{}
|
|
||||||
|
|
||||||
if (opState == oam::MAN_DISABLED || opState == oam::AUTO_DISABLED)
|
try
|
||||||
continue;
|
{
|
||||||
|
oam.getModuleStatus(remoteModuleName, opState, degraded);
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{}
|
||||||
|
|
||||||
|
if (opState == oam::MAN_DISABLED || opState == oam::AUTO_DISABLED)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// don't do PMs unless PMwithUM flag is set
|
// don't do PMs unless PMwithUM flag is set
|
||||||
if ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM )
|
if ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM )
|
||||||
@ -11362,19 +11347,22 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
|
|||||||
if ( remoteModuleName == masterModule )
|
if ( remoteModuleName == masterModule )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// skip disabled modules
|
if ( !addModule )
|
||||||
int opState = oam::ACTIVE;
|
|
||||||
bool degraded;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
oam.getModuleStatus(remoteModuleName, opState, degraded);
|
// skip disabled modules
|
||||||
}
|
int opState = oam::ACTIVE;
|
||||||
catch (...)
|
bool degraded;
|
||||||
{}
|
|
||||||
|
|
||||||
if (opState == oam::MAN_DISABLED || opState == oam::AUTO_DISABLED)
|
try
|
||||||
continue;
|
{
|
||||||
|
oam.getModuleStatus(remoteModuleName, opState, degraded);
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{}
|
||||||
|
|
||||||
|
if (opState == oam::MAN_DISABLED || opState == oam::AUTO_DISABLED)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// don't do PMs unless PMwithUM flag is set
|
// don't do PMs unless PMwithUM flag is set
|
||||||
if ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM )
|
if ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM )
|
||||||
@ -11430,19 +11418,22 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
|
|||||||
if ( remoteModuleName == masterModule )
|
if ( remoteModuleName == masterModule )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// skip disabled modules
|
if ( !addModule )
|
||||||
int opState = oam::ACTIVE;
|
|
||||||
bool degraded;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
oam.getModuleStatus(remoteModuleName, opState, degraded);
|
// skip disabled modules
|
||||||
}
|
int opState = oam::ACTIVE;
|
||||||
catch (...)
|
bool degraded;
|
||||||
{}
|
|
||||||
|
|
||||||
if (opState == oam::MAN_DISABLED || opState == oam::AUTO_DISABLED)
|
try
|
||||||
continue;
|
{
|
||||||
|
oam.getModuleStatus(remoteModuleName, opState, degraded);
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{}
|
||||||
|
|
||||||
|
if (opState == oam::MAN_DISABLED || opState == oam::AUTO_DISABLED)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
log.writeLog(__LINE__, "Setup Slave MySQL Replication on " + remoteModuleName, LOG_TYPE_DEBUG);
|
log.writeLog(__LINE__, "Setup Slave MySQL Replication on " + remoteModuleName, LOG_TYPE_DEBUG);
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
*@brief recycle Processes
|
*@brief recycle Processes
|
||||||
*/
|
*/
|
||||||
void recycleProcess(std::string module);
|
void recycleProcess(std::string module, bool enableModule = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*@brief Enable a specified module
|
*@brief Enable a specified module
|
||||||
@ -547,7 +547,7 @@ public:
|
|||||||
|
|
||||||
/** @brief Set MySQL Replication
|
/** @brief Set MySQL Replication
|
||||||
*/
|
*/
|
||||||
int setMySQLReplication(oam::DeviceNetworkList devicenetworklist, std::string masterModule = oam::UnassignedName, bool failover = false, bool distributeDB = false, std::string password = oam::UnassignedName, bool enable = true);
|
int setMySQLReplication(oam::DeviceNetworkList devicenetworklist, std::string masterModule = oam::UnassignedName, bool distributeDB = false, std::string password = oam::UnassignedName, bool enable = true, bool addModule = false);
|
||||||
|
|
||||||
/** @brief Gluster Assign dbroot to a module
|
/** @brief Gluster Assign dbroot to a module
|
||||||
*/
|
*/
|
||||||
|
@ -484,6 +484,26 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
|
|||||||
log.writeLog(__LINE__, "MSG RECEIVED: Stop process request on " + processName);
|
log.writeLog(__LINE__, "MSG RECEIVED: Stop process request on " + processName);
|
||||||
int requestStatus = API_SUCCESS;
|
int requestStatus = API_SUCCESS;
|
||||||
|
|
||||||
|
// check for mysql
|
||||||
|
if ( processName == "mysqld" )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
oam.actionMysqlCalpont(MYSQL_STOP);
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{}
|
||||||
|
|
||||||
|
ackMsg << (ByteStream::byte) ACK;
|
||||||
|
ackMsg << (ByteStream::byte) STOP;
|
||||||
|
ackMsg << (ByteStream::byte) API_SUCCESS;
|
||||||
|
mq.write(ackMsg);
|
||||||
|
|
||||||
|
log.writeLog(__LINE__, "STOP: ACK back to ProcMgr, return status = " + oam.itoa((int) API_SUCCESS));
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
processList::iterator listPtr;
|
processList::iterator listPtr;
|
||||||
processList* aPtr = config.monitoredListPtr();
|
processList* aPtr = config.monitoredListPtr();
|
||||||
listPtr = aPtr->begin();
|
listPtr = aPtr->begin();
|
||||||
@ -533,6 +553,26 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
|
|||||||
msg >> manualFlag;
|
msg >> manualFlag;
|
||||||
log.writeLog(__LINE__, "MSG RECEIVED: Start process request on: " + processName);
|
log.writeLog(__LINE__, "MSG RECEIVED: Start process request on: " + processName);
|
||||||
|
|
||||||
|
// check for mysql
|
||||||
|
if ( processName == "mysqld" )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
oam.actionMysqlCalpont(MYSQL_START);
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{}
|
||||||
|
|
||||||
|
ackMsg << (ByteStream::byte) ACK;
|
||||||
|
ackMsg << (ByteStream::byte) START;
|
||||||
|
ackMsg << (ByteStream::byte) API_SUCCESS;
|
||||||
|
mq.write(ackMsg);
|
||||||
|
|
||||||
|
log.writeLog(__LINE__, "START: ACK back to ProcMgr, return status = " + oam.itoa((int) API_SUCCESS));
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
ProcessConfig processconfig;
|
ProcessConfig processconfig;
|
||||||
ProcessStatus processstatus;
|
ProcessStatus processstatus;
|
||||||
|
|
||||||
@ -645,7 +685,7 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
|
|||||||
int requestStatus = API_SUCCESS;
|
int requestStatus = API_SUCCESS;
|
||||||
|
|
||||||
// check for mysql restart
|
// check for mysql restart
|
||||||
if ( processName == "mysql" )
|
if ( processName == "mysqld" )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -5350,12 +5390,11 @@ int ProcessMonitor::runMasterRep(std::string& masterLogFile, std::string& master
|
|||||||
|
|
||||||
//skip if module is not ACTIVE
|
//skip if module is not ACTIVE
|
||||||
|
|
||||||
int opState = oam::ACTIVE;
|
// int opState = oam::ACTIVE;
|
||||||
bool degraded;
|
// bool degraded;
|
||||||
oam.getModuleStatus(moduleName, opState, degraded);
|
// oam.getModuleStatus(moduleName, opState, degraded);
|
||||||
|
// if (opState != oam::ACTIVE)
|
||||||
if (opState != oam::ACTIVE)
|
// continue;
|
||||||
continue;
|
|
||||||
|
|
||||||
bool passwordError = false;
|
bool passwordError = false;
|
||||||
|
|
||||||
|
@ -736,7 +736,7 @@ checkPackages()
|
|||||||
echo "** Run MariaDB ColumnStore Dependent Package Check"
|
echo "** Run MariaDB ColumnStore Dependent Package Check"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
declare -a CENTOS_PKG=("expect" "perl" "perl-DBI" "openssl" "zlib" "file" "sudo" "libaio" "rsync" "snappy" "net-tools")
|
declare -a CENTOS_PKG=("expect" "perl" "perl-DBI" "openssl" "zlib" "file" "sudo" "libaio" "rsync" "snappy" "net-tools" "numactl-libs")
|
||||||
declare -a CENTOS_PKG_NOT=("mariadb-libs")
|
declare -a CENTOS_PKG_NOT=("mariadb-libs")
|
||||||
|
|
||||||
if [ "$OS" == "centos6" ] || [ "$OS" == "centos7" ]; then
|
if [ "$OS" == "centos6" ] || [ "$OS" == "centos7" ]; then
|
||||||
@ -855,7 +855,7 @@ checkPackages()
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
declare -a SUSE_PKG=("boost-devel" "expect" "perl" "perl-DBI" "openssl" "file" "sudo" "libaio1" "rsync" "libsnappy1" "net-tools")
|
declare -a SUSE_PKG=("boost-devel" "expect" "perl" "perl-DBI" "openssl" "file" "sudo" "libaio1" "rsync" "libsnappy1" "net-tools" "libnuma1")
|
||||||
declare -a SUSE_PKG_NOT=("mariadb" , "libmariadb18")
|
declare -a SUSE_PKG_NOT=("mariadb" , "libmariadb18")
|
||||||
|
|
||||||
if [ "$OS" == "suse12" ]; then
|
if [ "$OS" == "suse12" ]; then
|
||||||
@ -946,7 +946,7 @@ checkPackages()
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
declare -a UBUNTU_PKG=("libboost-all-dev" "expect" "libdbi-perl" "perl" "openssl" "file" "sudo" "libreadline-dev" "rsync" "libsnappy1V5" "net-tools")
|
declare -a UBUNTU_PKG=("libboost-all-dev" "expect" "libdbi-perl" "perl" "openssl" "file" "sudo" "libreadline-dev" "rsync" "libsnappy1V5" "net-tools" "libnuma1" )
|
||||||
declare -a UBUNTU_PKG_NOT=("mariadb-server" "libmariadb18")
|
declare -a UBUNTU_PKG_NOT=("mariadb-server" "libmariadb18")
|
||||||
|
|
||||||
if [ "$OS" == "ubuntu16" ] ; then
|
if [ "$OS" == "ubuntu16" ] ; then
|
||||||
@ -1063,7 +1063,7 @@ checkPackages()
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
declare -a DEBIAN_PKG=("libboost-all-dev" "expect" "libdbi-perl" "perl" "openssl" "file" "sudo" "libreadline-dev" "rsync" "libsnappy1" "net-tools")
|
declare -a DEBIAN_PKG=("libboost-all-dev" "expect" "libdbi-perl" "perl" "openssl" "file" "sudo" "libreadline-dev" "rsync" "libsnappy1" "net-tools" "libnuma1")
|
||||||
declare -a DEBIAN_PKG_NOT=("libmariadb18" "mariadb-server")
|
declare -a DEBIAN_PKG_NOT=("libmariadb18" "mariadb-server")
|
||||||
|
|
||||||
if [ "$OS" == "debian8" ]; then
|
if [ "$OS" == "debian8" ]; then
|
||||||
@ -1180,7 +1180,7 @@ checkPackages()
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
declare -a DEBIAN9_PKG=("libboost-all-dev" "expect" "libdbi-perl" "perl" "openssl" "file" "sudo" "libreadline5" "rsync" "libsnappy1V5" "net-tools" "libaio1")
|
declare -a DEBIAN9_PKG=("libboost-all-dev" "expect" "libdbi-perl" "perl" "openssl" "file" "sudo" "libreadline5" "rsync" "libsnappy1V5" "net-tools" "libaio1" "libnuma1")
|
||||||
declare -a DEBIAN9_PKG_NOT=("libmariadb18" "mariadb-server")
|
declare -a DEBIAN9_PKG_NOT=("libmariadb18" "mariadb-server")
|
||||||
|
|
||||||
if [ "$OS" == "debian9" ]; then
|
if [ "$OS" == "debian9" ]; then
|
||||||
|
@ -52,9 +52,10 @@ inline uint64_t simple_case_cmp(Row& row,
|
|||||||
CalpontSystemCatalog::ColType& operationColType)
|
CalpontSystemCatalog::ColType& operationColType)
|
||||||
{
|
{
|
||||||
uint64_t i = 0; // index to the parm list
|
uint64_t i = 0; // index to the parm list
|
||||||
uint64_t n = parm.size() - 1; // remove expression from count of expression_i + result_i
|
uint64_t n = 0; // remove expression from count of expression_i + result_i
|
||||||
uint64_t hasElse = n % 2; // if 1, then ELSE exist
|
uint64_t hasElse = (parm.size() - 1) % 2; // if 1, then ELSE exist
|
||||||
n -= hasElse; // index to expression
|
uint64_t whereCount = hasElse ? (parm.size() - 2) / 2 : (parm.size() - 1) / 2;
|
||||||
|
bool foundIt = false;
|
||||||
|
|
||||||
switch (operationColType.colDataType)
|
switch (operationColType.colDataType)
|
||||||
{
|
{
|
||||||
@ -71,10 +72,13 @@ inline uint64_t simple_case_cmp(Row& row,
|
|||||||
if (isNull)
|
if (isNull)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
for (; i < n; i += 2)
|
for (i = 1; i <= whereCount; i++)
|
||||||
{
|
{
|
||||||
if (ev == parm[i]->data()->getIntVal(row, isNull) && !isNull)
|
if (ev == parm[i]->data()->getIntVal(row, isNull) && !isNull)
|
||||||
|
{
|
||||||
|
foundIt = true;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
isNull = false;
|
isNull = false;
|
||||||
}
|
}
|
||||||
@ -93,10 +97,13 @@ inline uint64_t simple_case_cmp(Row& row,
|
|||||||
if (isNull)
|
if (isNull)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
for (; i < n; i += 2)
|
for (i = 1; i <= whereCount; i++)
|
||||||
{
|
{
|
||||||
if (ev == parm[i]->data()->getUintVal(row, isNull) && !isNull)
|
if (ev == parm[i]->data()->getUintVal(row, isNull) && !isNull)
|
||||||
|
{
|
||||||
|
foundIt = true;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
isNull = false;
|
isNull = false;
|
||||||
}
|
}
|
||||||
@ -113,11 +120,14 @@ inline uint64_t simple_case_cmp(Row& row,
|
|||||||
if (isNull)
|
if (isNull)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
for (; i < n; i += 2)
|
for (i = 1; i <= whereCount; i++)
|
||||||
{
|
{
|
||||||
//BUG 5362
|
//BUG 5362
|
||||||
if (utf8::idb_strcoll(ev.c_str(), parm[i]->data()->getStrVal(row, isNull).c_str()) == 0 && !isNull)
|
if (utf8::idb_strcoll(ev.c_str(), parm[i]->data()->getStrVal(row, isNull).c_str()) == 0 && !isNull)
|
||||||
|
{
|
||||||
|
foundIt = true;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
isNull = false;
|
isNull = false;
|
||||||
}
|
}
|
||||||
@ -133,10 +143,13 @@ inline uint64_t simple_case_cmp(Row& row,
|
|||||||
if (isNull)
|
if (isNull)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
for (; i < n; i += 2)
|
for (i = 1; i <= whereCount; i++)
|
||||||
{
|
{
|
||||||
if (ev == parm[i]->data()->getDecimalVal(row, isNull) && !isNull)
|
if (ev == parm[i]->data()->getDecimalVal(row, isNull) && !isNull)
|
||||||
|
{
|
||||||
|
foundIt = true;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
isNull = false;
|
isNull = false;
|
||||||
}
|
}
|
||||||
@ -152,10 +165,13 @@ inline uint64_t simple_case_cmp(Row& row,
|
|||||||
if (isNull)
|
if (isNull)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
for (; i < n; i += 2)
|
for (i = 1; i <= whereCount; i++)
|
||||||
{
|
{
|
||||||
if (ev == parm[i]->data()->getDoubleVal(row, isNull) && !isNull)
|
if (ev == parm[i]->data()->getDoubleVal(row, isNull) && !isNull)
|
||||||
|
{
|
||||||
|
foundIt = true;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
isNull = false;
|
isNull = false;
|
||||||
}
|
}
|
||||||
@ -171,10 +187,13 @@ inline uint64_t simple_case_cmp(Row& row,
|
|||||||
if (isNull)
|
if (isNull)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
for (; i < n; i += 2)
|
for (i = 1; i <= whereCount; i++)
|
||||||
{
|
{
|
||||||
if (ev == parm[i]->data()->getFloatVal(row, isNull) && !isNull)
|
if (ev == parm[i]->data()->getFloatVal(row, isNull) && !isNull)
|
||||||
|
{
|
||||||
|
foundIt = true;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
isNull = false;
|
isNull = false;
|
||||||
}
|
}
|
||||||
@ -190,16 +209,24 @@ inline uint64_t simple_case_cmp(Row& row,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == n && !hasElse)
|
if (!foundIt && !hasElse)
|
||||||
isNull = true;
|
isNull = true;
|
||||||
|
else if (!foundIt && hasElse && !isNull)
|
||||||
|
{
|
||||||
|
i = parm.size() - 1;
|
||||||
|
}
|
||||||
else if (isNull && hasElse)
|
else if (isNull && hasElse)
|
||||||
// BUG 5110. Only way we can exit above with isNull == true is when ev is NULL
|
// BUG 5110. Only way we can exit above with isNull == true is when ev is NULL
|
||||||
// if so and we have else condition we need to use it by setting i = n
|
// if so and we have else condition we need to use it by setting i = else
|
||||||
{
|
{
|
||||||
i = n;
|
i = parm.size() - 1;
|
||||||
isNull = false;
|
isNull = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (foundIt)
|
||||||
|
{
|
||||||
|
i += whereCount;
|
||||||
|
}
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@ -210,22 +237,35 @@ inline uint64_t searched_case_cmp(Row& row,
|
|||||||
bool& isNull)
|
bool& isNull)
|
||||||
{
|
{
|
||||||
uint64_t i = 0; // index to the parm list
|
uint64_t i = 0; // index to the parm list
|
||||||
uint64_t n = parm.size(); // count of boolean_expression_i + result_i
|
uint64_t hasElse = parm.size() % 2; // if 1, then ELSE exist
|
||||||
uint64_t hasElse = n % 2; // if 1, then ELSE exist
|
uint64_t whereCount = hasElse ? (parm.size() - 1) / 2 : parm.size() / 2;
|
||||||
n -= hasElse; // index to expression
|
bool foundIt = false;
|
||||||
|
|
||||||
for (; i < n; i += 2)
|
|
||||||
|
for (i = 0; i < whereCount; i++)
|
||||||
{
|
{
|
||||||
if (parm[i]->getBoolVal(row, isNull))
|
if (parm[i]->getBoolVal(row, isNull))
|
||||||
|
{
|
||||||
|
foundIt = true;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isNull = false;
|
isNull = false;
|
||||||
|
|
||||||
if (i == n && !hasElse)
|
if (!foundIt && !hasElse)
|
||||||
isNull = true;
|
isNull = true;
|
||||||
|
else if (!foundIt && hasElse)
|
||||||
|
{
|
||||||
|
i = parm.size() - 1;
|
||||||
|
}
|
||||||
|
|
||||||
return (i == n ? i - 1 : i);
|
if (foundIt)
|
||||||
|
{
|
||||||
|
i += whereCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -233,7 +273,6 @@ CalpontSystemCatalog::ColType caseOperationType(FunctionParm& fp,
|
|||||||
CalpontSystemCatalog::ColType& resultType,
|
CalpontSystemCatalog::ColType& resultType,
|
||||||
bool simpleCase)
|
bool simpleCase)
|
||||||
{
|
{
|
||||||
// ... expression_i + result_i + ... [[expression] + result_N]
|
|
||||||
FunctionParm::size_type n = fp.size();
|
FunctionParm::size_type n = fp.size();
|
||||||
|
|
||||||
if (simpleCase) // simple case has an expression
|
if (simpleCase) // simple case has an expression
|
||||||
@ -244,6 +283,9 @@ CalpontSystemCatalog::ColType caseOperationType(FunctionParm& fp,
|
|||||||
if (hasElse)
|
if (hasElse)
|
||||||
--n; // n now is an even number
|
--n; // n now is an even number
|
||||||
|
|
||||||
|
uint64_t parmCount = hasElse ? (fp.size() - 2) : (fp.size() - 1);
|
||||||
|
uint64_t whereCount = hasElse ? (fp.size() - 2 + simpleCase) / 2 : (fp.size() - 1) / 2 + simpleCase;
|
||||||
|
|
||||||
idbassert((n % 2) == 0);
|
idbassert((n % 2) == 0);
|
||||||
|
|
||||||
bool allStringO = true;
|
bool allStringO = true;
|
||||||
@ -255,10 +297,10 @@ CalpontSystemCatalog::ColType caseOperationType(FunctionParm& fp,
|
|||||||
CalpontSystemCatalog::ColType rct = resultType;
|
CalpontSystemCatalog::ColType rct = resultType;
|
||||||
bool operation = true;
|
bool operation = true;
|
||||||
|
|
||||||
for (uint64_t i = 0; i <= n; i++)
|
for (uint64_t i = 0; i <= parmCount; i++)
|
||||||
{
|
{
|
||||||
// operation or result type
|
// operation or result type
|
||||||
operation = ((i % 2) == 0);
|
operation = ((i > 0) && (i <= whereCount));
|
||||||
|
|
||||||
// the result type of ELSE, if exists.
|
// the result type of ELSE, if exists.
|
||||||
if (i == n)
|
if (i == n)
|
||||||
@ -353,8 +395,9 @@ namespace funcexp
|
|||||||
// END
|
// END
|
||||||
//
|
//
|
||||||
// simple CASE parm order:
|
// simple CASE parm order:
|
||||||
// expression1 result1 expression2 result2 ... expression [resultN]
|
// expression condition1 condition2 ... result1 result2 ... [resultN]
|
||||||
//
|
//
|
||||||
|
// Note that this order changed in 10.2.14, see MCOL-1341
|
||||||
|
|
||||||
CalpontSystemCatalog::ColType Func_simple_case::operationType(FunctionParm& fp, CalpontSystemCatalog::ColType& resultType)
|
CalpontSystemCatalog::ColType Func_simple_case::operationType(FunctionParm& fp, CalpontSystemCatalog::ColType& resultType)
|
||||||
{
|
{
|
||||||
@ -372,7 +415,7 @@ bool Func_simple_case::getBoolVal(Row& row,
|
|||||||
if (isNull)
|
if (isNull)
|
||||||
return joblist::BIGINTNULL;
|
return joblist::BIGINTNULL;
|
||||||
|
|
||||||
return parm[i + 1]->data()->getBoolVal(row, isNull);
|
return parm[i]->data()->getBoolVal(row, isNull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -386,7 +429,7 @@ int64_t Func_simple_case::getIntVal(Row& row,
|
|||||||
if (isNull)
|
if (isNull)
|
||||||
return joblist::BIGINTNULL;
|
return joblist::BIGINTNULL;
|
||||||
|
|
||||||
return parm[i + 1]->data()->getIntVal(row, isNull);
|
return parm[i]->data()->getIntVal(row, isNull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -400,7 +443,7 @@ string Func_simple_case::getStrVal(Row& row,
|
|||||||
if (isNull)
|
if (isNull)
|
||||||
return string("");
|
return string("");
|
||||||
|
|
||||||
return parm[i + 1]->data()->getStrVal(row, isNull);
|
return parm[i]->data()->getStrVal(row, isNull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -414,7 +457,7 @@ IDB_Decimal Func_simple_case::getDecimalVal(Row& row,
|
|||||||
if (isNull)
|
if (isNull)
|
||||||
return IDB_Decimal(); // need a null value for IDB_Decimal??
|
return IDB_Decimal(); // need a null value for IDB_Decimal??
|
||||||
|
|
||||||
return parm[i + 1]->data()->getDecimalVal(row, isNull);
|
return parm[i]->data()->getDecimalVal(row, isNull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -428,7 +471,7 @@ double Func_simple_case::getDoubleVal(Row& row,
|
|||||||
if (isNull)
|
if (isNull)
|
||||||
return doubleNullVal();
|
return doubleNullVal();
|
||||||
|
|
||||||
return parm[i + 1]->data()->getDoubleVal(row, isNull);
|
return parm[i]->data()->getDoubleVal(row, isNull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -442,7 +485,7 @@ int32_t Func_simple_case::getDateIntVal(rowgroup::Row& row,
|
|||||||
if (isNull)
|
if (isNull)
|
||||||
return joblist::DATENULL;
|
return joblist::DATENULL;
|
||||||
|
|
||||||
return parm[i + 1]->data()->getDateIntVal(row, isNull);
|
return parm[i]->data()->getDateIntVal(row, isNull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -456,7 +499,7 @@ int64_t Func_simple_case::getDatetimeIntVal(rowgroup::Row& row,
|
|||||||
if (isNull)
|
if (isNull)
|
||||||
return joblist::DATETIMENULL;
|
return joblist::DATETIMENULL;
|
||||||
|
|
||||||
return parm[i + 1]->data()->getDatetimeIntVal(row, isNull);
|
return parm[i]->data()->getDatetimeIntVal(row, isNull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -470,8 +513,10 @@ int64_t Func_simple_case::getDatetimeIntVal(rowgroup::Row& row,
|
|||||||
// END
|
// END
|
||||||
//
|
//
|
||||||
// searched CASE parm order:
|
// searched CASE parm order:
|
||||||
// boolean_expression1 result1 boolean_expression2 result2 ... [resultN]
|
// boolean_expression1 boolean_expression2 ... result1 result2 ... [resultN]
|
||||||
//
|
//
|
||||||
|
// Note that this order changed in 10.2.14, see MCOL-1341
|
||||||
|
|
||||||
CalpontSystemCatalog::ColType Func_searched_case::operationType(FunctionParm& fp, CalpontSystemCatalog::ColType& resultType)
|
CalpontSystemCatalog::ColType Func_searched_case::operationType(FunctionParm& fp, CalpontSystemCatalog::ColType& resultType)
|
||||||
{
|
{
|
||||||
// operation type not used by this functor.
|
// operation type not used by this functor.
|
||||||
@ -489,15 +534,15 @@ bool Func_searched_case::getBoolVal(Row& row,
|
|||||||
if (isNull)
|
if (isNull)
|
||||||
return joblist::BIGINTNULL;
|
return joblist::BIGINTNULL;
|
||||||
|
|
||||||
ParseTree* lop = parm[i + 1]->left();
|
ParseTree* lop = parm[i]->left();
|
||||||
ParseTree* rop = parm[i + 1]->right();
|
ParseTree* rop = parm[i]->right();
|
||||||
|
|
||||||
if (lop && rop)
|
if (lop && rop)
|
||||||
{
|
{
|
||||||
return (reinterpret_cast<Operator*>(parm[i + 1]->data()))->getBoolVal(row, isNull, lop, rop);
|
return (reinterpret_cast<Operator*>(parm[i]->data()))->getBoolVal(row, isNull, lop, rop);
|
||||||
}
|
}
|
||||||
|
|
||||||
return parm[i + 1]->data()->getBoolVal(row, isNull);
|
return parm[i]->data()->getBoolVal(row, isNull);
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t Func_searched_case::getIntVal(Row& row,
|
int64_t Func_searched_case::getIntVal(Row& row,
|
||||||
@ -510,7 +555,7 @@ int64_t Func_searched_case::getIntVal(Row& row,
|
|||||||
if (isNull)
|
if (isNull)
|
||||||
return joblist::BIGINTNULL;
|
return joblist::BIGINTNULL;
|
||||||
|
|
||||||
return parm[i + 1]->data()->getIntVal(row, isNull);
|
return parm[i]->data()->getIntVal(row, isNull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -524,7 +569,7 @@ string Func_searched_case::getStrVal(Row& row,
|
|||||||
if (isNull)
|
if (isNull)
|
||||||
return string("");
|
return string("");
|
||||||
|
|
||||||
return parm[i + 1]->data()->getStrVal(row, isNull);
|
return parm[i]->data()->getStrVal(row, isNull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -538,7 +583,7 @@ IDB_Decimal Func_searched_case::getDecimalVal(Row& row,
|
|||||||
if (isNull)
|
if (isNull)
|
||||||
return IDB_Decimal(); // need a null value for IDB_Decimal??
|
return IDB_Decimal(); // need a null value for IDB_Decimal??
|
||||||
|
|
||||||
return parm[i + 1]->data()->getDecimalVal(row, isNull);
|
return parm[i]->data()->getDecimalVal(row, isNull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -552,7 +597,7 @@ double Func_searched_case::getDoubleVal(Row& row,
|
|||||||
if (isNull)
|
if (isNull)
|
||||||
return doubleNullVal();
|
return doubleNullVal();
|
||||||
|
|
||||||
return parm[i + 1]->data()->getDoubleVal(row, isNull);
|
return parm[i]->data()->getDoubleVal(row, isNull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -566,7 +611,7 @@ int32_t Func_searched_case::getDateIntVal(rowgroup::Row& row,
|
|||||||
if (isNull)
|
if (isNull)
|
||||||
return joblist::DATENULL;
|
return joblist::DATENULL;
|
||||||
|
|
||||||
return parm[i + 1]->data()->getDateIntVal(row, isNull);
|
return parm[i]->data()->getDateIntVal(row, isNull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -580,7 +625,7 @@ int64_t Func_searched_case::getDatetimeIntVal(rowgroup::Row& row,
|
|||||||
if (isNull)
|
if (isNull)
|
||||||
return joblist::DATETIMENULL;
|
return joblist::DATETIMENULL;
|
||||||
|
|
||||||
return parm[i + 1]->data()->getDatetimeIntVal(row, isNull);
|
return parm[i]->data()->getDatetimeIntVal(row, isNull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ void WESplitterApp::setupSignalHandlers()
|
|||||||
sa.sa_handler = SIG_IGN;
|
sa.sa_handler = SIG_IGN;
|
||||||
sigaction(SIGPIPE, &sa, 0);
|
sigaction(SIGPIPE, &sa, 0);
|
||||||
sa.sa_handler = WESplitterApp::onSigHup;
|
sa.sa_handler = WESplitterApp::onSigHup;
|
||||||
sigaction(SIGPIPE, &sa, 0);
|
sigaction(SIGHUP, &sa, 0);
|
||||||
sa.sa_handler = WESplitterApp::onSigInterrupt;
|
sa.sa_handler = WESplitterApp::onSigInterrupt;
|
||||||
sigaction(SIGUSR1, &sa, 0);
|
sigaction(SIGUSR1, &sa, 0);
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user