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

MCOL-537 There are no CS-specific warnings building with gcc 8.2.

This commit is contained in:
Roman Nozdrin
2019-04-29 12:26:12 +03:00
parent 9dc33c4e82
commit 7e2cb05624
23 changed files with 94 additions and 334 deletions

View File

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

View File

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

View File

@ -94,36 +94,6 @@ namespace
using namespace joblist;
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)
{
if (sc == NULL)

View File

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

View File

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

View File

@ -71,14 +71,15 @@ namespace
{
DistributedEngineComm* Dec;
void setupCwd()
int8_t setupCwd()
{
string workdir = startup::StartUp::tmpDir();
if (workdir.length() == 0)
workdir = ".";
(void)chdir(workdir.c_str());
int8_t rc = chdir(workdir.c_str());
return rc;
}
void added_a_pm(int)
@ -103,7 +104,10 @@ int main(int argc, char* argv[])
// This is unset due to the way we start it
program_invocation_short_name = const_cast<char*>("DDLProc");
setupCwd();
if ( setupCwd() < 0 )
{
std::cerr << "Could not set working directory" << std::endl;
}
WriteEngine::WriteEngineWrapper::init( WriteEngine::SUBSYSTEM_ID_DDLPROC );
#ifdef _MSC_VER

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -58,11 +58,11 @@ int setUp()
{
#ifndef _MSC_VER
string cmd = "/bin/rm -f " + logFile + " >/dev/null 2>&1";
(void)system(cmd.c_str());
int rc = system(cmd.c_str());
cmd = "/bin/touch -f " + logFile + " >/dev/null 2>&1";
(void)system(cmd.c_str());
rc = system(cmd.c_str());
#endif
return 0;
return rc;
}
int checkNotThere(WriteEngine::FID fid)
@ -72,12 +72,6 @@ int checkNotThere(WriteEngine::FID fid)
return (fileOp.existsOIDDir(fid) ? -1 : 0);
}
void tearDown()
{
string file = tmpDir + "/oidbitmap";
unlink(file.c_str());
}
void usage()
{
cerr << "Usage: dbbuilder [-h|f] function" << endl
@ -130,6 +124,7 @@ int main(int argc, char* argv[])
std::string schema("tpch");
Oam oam;
bool fFlg = false;
int rc = 0;
opterr = 0;
@ -193,7 +188,10 @@ int main(int argc, char* argv[])
if ( buildOption == SYSCATALOG_ONLY )
{
setUp();
if ( setUp() )
{
cerr << "setUp() call error " << endl;
}
bool canWrite = true;
@ -209,9 +207,13 @@ int main(int argc, char* argv[])
"' > " + logFile;
if (canWrite)
(void)system(cmd.c_str());
{
rc = system(cmd.c_str());
}
else
{
cerr << cmd << endl;
}
errorHandler(sysCatalogErr,
"Build system catalog",
@ -243,7 +245,7 @@ int main(int argc, char* argv[])
string cmd(string("echo 'FAILED: ") + ex.what() + "' > " + logFile);
if (canWrite)
(void)system(cmd.c_str());
rc = system(cmd.c_str());
else
cerr << cmd << endl;
@ -255,7 +257,7 @@ int main(int argc, char* argv[])
string cmd = "echo 'FAILED: HDFS checking.' > " + logFile;
if (canWrite)
(void)system(cmd.c_str());
rc = system(cmd.c_str());
else
cerr << cmd << endl;
@ -274,7 +276,7 @@ int main(int argc, char* argv[])
std::string cmd = "echo 'OK: buildOption=" + oam.itoa(buildOption) + "' > " + logFile;
if (canWrite)
(void)system(cmd.c_str());
rc = system(cmd.c_str());
else
#ifdef _MSC_VER
(void)0;
@ -287,11 +289,9 @@ int main(int argc, char* argv[])
if (canWrite)
{
int err;
rc = system(cmd.c_str());
err = system(cmd.c_str());
if (err != 0)
if (rc != 0)
{
ostringstream os;
os << "Warning: running " << cmd << " failed. This is usually non-fatal.";
@ -309,7 +309,7 @@ int main(int argc, char* argv[])
string cmd = "echo 'FAILED: buildOption=" + oam.itoa(buildOption) + "' > " + logFile;
if (canWrite)
(void)system(cmd.c_str());
rc = system(cmd.c_str());
else
cerr << cmd << endl;
@ -320,7 +320,7 @@ int main(int argc, char* argv[])
string cmd = "echo 'FAILED: buildOption=" + oam.itoa(buildOption) + "' > " + logFile;
if (canWrite)
(void)system(cmd.c_str());
rc = system(cmd.c_str());
else
cerr << cmd << endl;

View File

@ -46,7 +46,10 @@ int main(int argc, char** argv)
#ifdef _MSC_VER
//FIXME
#else
#pragma GCC diagnostic ignored "-Wunused-result"
setuid( 0 ); // set effective ID to root; ignore return status
// Why should we raise privileges if we don't care?
#pragma GCC diagnostic pop
#endif
setlocale(LC_ALL, "");
WriteEngine::Config::initConfigCache(); // load Columnstore.xml config settings

View File

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

View File

@ -80,6 +80,7 @@ struct QStats
QStats fQStats;
#ifdef QUERY_TELE_DEBUG
string get_trace_file()
{
ostringstream oss;
@ -94,7 +95,6 @@ string get_trace_file()
return oss.str();
}
#ifdef QUERY_TELE_DEBUG
void log_query(const querytele::QueryTele& qtdata)
{
ofstream trace(get_trace_file().c_str(), ios::out | ios::app);

View File

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

View File

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

View File

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

View File

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

View File

@ -1923,10 +1923,14 @@ int ChunkManager::reallocateChunks(CompFileData* fileData)
struct tm ltm;
localtime_r(reinterpret_cast<time_t*>(&tv.tv_sec), &ltm);
char tmText[24];
// this snprintf call causes a compiler warning b/c buffer size is less
// then maximum string size.
#pragma GCC diagnostic ignored "-Wformat-truncation="
snprintf(tmText, sizeof(tmText), ".%04d%02d%02d%02d%02d%02d%06ld",
ltm.tm_year + 1900, ltm.tm_mon + 1,
ltm.tm_mday, ltm.tm_hour, ltm.tm_min,
ltm.tm_sec, tv.tv_usec);
#pragma GCC diagnostic pop
string dbgFileName(rlcFileName + tmText);
ostringstream oss;
@ -2106,10 +2110,14 @@ int ChunkManager::reallocateChunks(CompFileData* fileData)
struct tm ltm;
localtime_r(reinterpret_cast<time_t*>(&tv.tv_sec), &ltm);
char tmText[24];
// this snprintf call causes a compiler warning b/c buffer size is less
// then maximum string size.
#pragma GCC diagnostic ignored "-Wformat-truncation="
snprintf(tmText, sizeof(tmText), ".%04d%02d%02d%02d%02d%02d%06ld",
ltm.tm_year + 1900, ltm.tm_mon + 1,
ltm.tm_mday, ltm.tm_hour, ltm.tm_min,
ltm.tm_sec, tv.tv_usec);
#pragma GCC diagnostic pop
string dbgFileName(rlcFileName + tmText);
ostringstream oss;

View File

@ -604,7 +604,10 @@ void WESplitterApp::updateWithJobFile(int aIdx)
int main(int argc, char** argv)
{
std::string err;
#pragma GCC diagnostic ignored "-Wunused-result"
// Why do we need this if we don't care about f()'s rc ?
setuid(0); //@BUG 4343 set effective userid to root.
#pragma GCC diagnostic pop
std::cin.sync_with_stdio(false);
try

View File

@ -38,9 +38,9 @@ namespace
{
const char* DICT_TYPE("D");
const char* ENCODING("UTF-8");
const char* JOBNAME("Job_");
const char* LOGNAME("Jobxml_");
const std::string LOGDIR("/log/");
const char* JOBNAME("Job_");
}
namespace WriteEngine
@ -438,13 +438,11 @@ void XMLGenProc::getColumnsForTable(
throw std::runtime_error( oss.str() );
}
}
//------------------------------------------------------------------------------
// Generate Job XML File Name
//------------------------------------------------------------------------------
// This isn't used currently, commenting it out
#if 0
std::string XMLGenProc::genJobXMLFileName( ) const
{
std::string xmlFileName;
@ -471,7 +469,7 @@ std::string XMLGenProc::genJobXMLFileName( ) const
char *buf;
buf = getcwd(cwdPath, sizeof(cwdPath));
if (buf == NULL)
throw runtime_error("Failed to get the current working directory!");
throw std::runtime_error("Failed to get the current working directory!");
boost::filesystem::path p2(cwdPath);
p2 /= p;
xmlFileName = p2.string();
@ -485,9 +483,7 @@ std::string XMLGenProc::genJobXMLFileName( ) const
return xmlFileName;
}
#endif
//------------------------------------------------------------------------------
// writeXMLFile
//------------------------------------------------------------------------------

View File

@ -90,7 +90,7 @@ public:
/** @brief Generate Job XML file name
*/
//EXPORT std::string genJobXMLFileName( ) const;
EXPORT std::string genJobXMLFileName( ) const;
/** @brief Write xml file document to the destination Job XML file.
*