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
Feature/mcol 4882 cpimport skip rows (#3594)
* feat(cpimport): MCOL-4882 add a parameter to skip header rows * chore(cpimport): MCOL-4882 Use boost::program_options to arguments parsing * feat(cpimport.bin): MCOL-4882 Add missing changes * add test * fix clang * add missing cmdline argument * fix bug * Fix double lines skipping * Fix incorrect --silent (-N) parsing * fix default --max-errors processing * fix overwriting default username * move initialization to members declaration
This commit is contained in:
committed by
GitHub
parent
1c8d5ec04e
commit
78c1b5034d
@ -64,7 +64,6 @@ WESplitterApp::WESplitterApp(WECmdArgs& CmdArgs) : fCmdArgs(CmdArgs), fDh(*this)
|
||||
fpSysLog = SimpleSysLog::instance();
|
||||
fpSysLog->setLoggingID(logging::LoggingID(SUBSYSTEM_ID_WE_SPLIT));
|
||||
setupSignalHandlers();
|
||||
std::string err;
|
||||
fDh.setDebugLvl(fCmdArgs.getDebugLvl());
|
||||
|
||||
fDh.check4CpiInvokeMode();
|
||||
@ -100,6 +99,7 @@ WESplitterApp::WESplitterApp(WECmdArgs& CmdArgs) : fCmdArgs(CmdArgs), fDh(*this)
|
||||
}
|
||||
catch (std::exception& ex)
|
||||
{
|
||||
std::string err;
|
||||
// err = string("Error in constructing WESplitterApp") + ex.what();
|
||||
err = ex.what(); // cleaning up for BUG 4298
|
||||
logging::Message::Args errMsgArgs;
|
||||
@ -139,10 +139,10 @@ WESplitterApp::~WESplitterApp()
|
||||
// fDh.shutdown();
|
||||
usleep(1000); // 1 millisec just checking
|
||||
|
||||
std::string aStr = "Calling WESplitterApp Destructor\n";
|
||||
|
||||
if (fDh.getDebugLvl())
|
||||
cout << aStr << endl;
|
||||
{
|
||||
cout << "Calling WESplitterApp Destructor" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -151,18 +151,18 @@ WESplitterApp::~WESplitterApp()
|
||||
|
||||
void WESplitterApp::setupSignalHandlers()
|
||||
{
|
||||
struct sigaction sa;
|
||||
struct sigaction sa{};
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
sa.sa_handler = WESplitterApp::onSigInterrupt;
|
||||
sigaction(SIGINT, &sa, 0);
|
||||
sigaction(SIGINT, &sa, nullptr);
|
||||
sa.sa_handler = WESplitterApp::onSigTerminate;
|
||||
sigaction(SIGTERM, &sa, 0);
|
||||
sigaction(SIGTERM, &sa, nullptr);
|
||||
sa.sa_handler = SIG_IGN;
|
||||
sigaction(SIGPIPE, &sa, 0);
|
||||
sigaction(SIGPIPE, &sa, nullptr);
|
||||
sa.sa_handler = WESplitterApp::onSigHup;
|
||||
sigaction(SIGHUP, &sa, 0);
|
||||
sigaction(SIGHUP, &sa, nullptr);
|
||||
sa.sa_handler = WESplitterApp::onSigInterrupt;
|
||||
sigaction(SIGUSR1, &sa, 0);
|
||||
sigaction(SIGUSR1, &sa, nullptr);
|
||||
/*
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
signal(SIGINT, WESplitterApp::onSigInterrupt);
|
||||
@ -258,7 +258,7 @@ void WESplitterApp::processMessages()
|
||||
}
|
||||
|
||||
aBs.restart();
|
||||
std::string aCpImpCmd = fCmdArgs.getCpImportCmdLine();
|
||||
std::string aCpImpCmd = fCmdArgs.getCpImportCmdLine(false);
|
||||
fDh.fLog.logMsg(aCpImpCmd, MSGLVL_INFO2);
|
||||
|
||||
if (fDh.getDebugLvl())
|
||||
@ -315,7 +315,7 @@ void WESplitterApp::processMessages()
|
||||
}
|
||||
|
||||
aBs.restart();
|
||||
std::string aCpImpCmd = fCmdArgs.getCpImportCmdLine();
|
||||
std::string aCpImpCmd = fCmdArgs.getCpImportCmdLine(false);
|
||||
fDh.fLog.logMsg(aCpImpCmd, MSGLVL_INFO2);
|
||||
|
||||
if (fDh.getDebugLvl())
|
||||
@ -467,7 +467,7 @@ void WESplitterApp::invokeCpimport()
|
||||
fCmdArgs.setJobUUID(u);
|
||||
|
||||
fCmdArgs.setMode(3);
|
||||
std::string aCmdLineStr = fCmdArgs.getCpImportCmdLine();
|
||||
std::string aCmdLineStr = fCmdArgs.getCpImportCmdLine(true);
|
||||
|
||||
if (fDh.getDebugLvl())
|
||||
cout << "CPI CmdLineArgs : " << aCmdLineStr << endl;
|
||||
@ -477,7 +477,6 @@ void WESplitterApp::invokeCpimport()
|
||||
std::istringstream ss(aCmdLineStr);
|
||||
std::string arg;
|
||||
std::vector<std::string> v2;
|
||||
v2.reserve(50);
|
||||
|
||||
while (ss >> arg)
|
||||
{
|
||||
@ -490,7 +489,7 @@ void WESplitterApp::invokeCpimport()
|
||||
Cmds.push_back(const_cast<char*>(v2[j].c_str()));
|
||||
}
|
||||
|
||||
Cmds.push_back(0); // null terminate
|
||||
Cmds.push_back(nullptr); // null terminate
|
||||
|
||||
int aRet = execvp(Cmds[0], &Cmds[0]); // NOTE - works with full Path
|
||||
|
||||
@ -515,7 +514,7 @@ void WESplitterApp::updateWithJobFile(int aIdx)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::string err;
|
||||
std::cin.sync_with_stdio(false);
|
||||
std::istream::sync_with_stdio(false);
|
||||
|
||||
try
|
||||
{
|
||||
@ -528,7 +527,7 @@ int main(int argc, char** argv)
|
||||
for (int idx = 0; idx < aTblCnt; idx++)
|
||||
{
|
||||
aWESplitterApp.fDh.reset();
|
||||
aWESplitterApp.fContinue = true;
|
||||
WriteEngine::WESplitterApp::fContinue = true;
|
||||
aWESplitterApp.updateWithJobFile(idx);
|
||||
|
||||
try
|
||||
@ -541,10 +540,10 @@ int main(int argc, char** argv)
|
||||
err = ex.what(); // cleaning up for BUG 4298
|
||||
logging::Message::Args errMsgArgs;
|
||||
errMsgArgs.add(err);
|
||||
aWESplitterApp.fpSysLog->logMsg(errMsgArgs, logging::LOG_TYPE_ERROR, logging::M0000);
|
||||
WriteEngine::WESplitterApp::fpSysLog->logMsg(errMsgArgs, logging::LOG_TYPE_ERROR, logging::M0000);
|
||||
SPLTR_EXIT_STATUS = 1;
|
||||
aWESplitterApp.fDh.fLog.logMsg(err, WriteEngine::MSGLVL_ERROR);
|
||||
aWESplitterApp.fContinue = false;
|
||||
WriteEngine::WESplitterApp::fContinue = false;
|
||||
// throw runtime_error(err); BUG 4298
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user