1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

MCOL-537 Preprocessor if blocks with pragmas now have else branch.

DMLProc exits on setupCwd failure.
This commit is contained in:
Roman Nozdrin
2019-05-09 20:25:21 +03:00
parent b2436502cb
commit 3c89a4bba4
9 changed files with 75 additions and 24 deletions

View File

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

View File

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

View File

@ -3348,15 +3348,14 @@ int processCommand(string* arguments)
for (i = alarmList.begin(); i != alarmList.end(); ++i)
{
switch (i->second.getState())
// SET = 1, CLEAR = 0
if (i->second.getState() == true)
{
case SET:
cout << "SET" << endl;
break;
case CLEAR:
}
else
{
cout << "CLEAR" << endl;
break;
}
cout << "AlarmID = " << i->second.getAlarmID() << endl;

View File

@ -2429,11 +2429,13 @@ int64_t DataConvert::intToDate(int64_t data)
// 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__ >= 5
#if defined(__GNUC__) && __GNUC__ >= 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-truncation="
snprintf( buf, 15, "%llu", (long long unsigned int)data);
#pragma GCC diagnostic pop
#else
snprintf( buf, 15, "%llu", (long long unsigned int)data);
#endif
string year, month, day, hour, min, sec, msec;
@ -2563,11 +2565,13 @@ int64_t DataConvert::intToDatetime(int64_t data, bool* date)
// 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__ >= 5
#if defined(__GNUC__) && __GNUC__ >= 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-truncation="
snprintf( buf, 15, "%llu", (long long unsigned int)data);
#pragma GCC diagnostic pop
#else
snprintf( buf, 15, "%llu", (long long unsigned int)data);
#endif
//string date = buf;
@ -2699,11 +2703,13 @@ int64_t DataConvert::intToTime(int64_t data, bool fromString)
// 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__ >= 5
#if defined(__GNUC__) && __GNUC__ >= 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-truncation="
snprintf( buf, 15, "%llu", (long long unsigned int)data);
#pragma GCC diagnostic pop
#else
snprintf( buf, 15, "%llu", (long long unsigned int)data);
#endif
//string date = buf;

View File

@ -675,7 +675,7 @@ inline void DataConvert::timeToString1( long long timevalue, char* buf, unsigned
}
// this snprintf call causes a compiler warning b/c buffer size is less
// then maximum string size.
#if defined(__GNUC__) && __GNUC__ >= 5
#if defined(__GNUC__) && __GNUC__ >= 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-truncation="
snprintf( buf, buflen, "%02d%02d%02d",
@ -684,6 +684,12 @@ inline void DataConvert::timeToString1( long long timevalue, char* buf, unsigned
(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
}

View File

@ -966,12 +966,15 @@ void InetStreamSocket::connect(const sockaddr* serv_addr)
char buf = '\0';
(void)::recv(socketParms().sd(), &buf, 1, 0);
#else
#if defined(__GNUC__) && __GNUC__ >= 5
#if defined(__GNUC__) && __GNUC__ >= 6
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
char buf = '\0';
ssize_t bytes = ::read(socketParms().sd(), &buf, 1); // we know 1 byte is in the recv buffer
::read(socketParms().sd(), &buf, 1); // we know 1 byte is in the recv buffer
#pragma GCC diagnostic pop
#else
char buf = '\0';
::read(socketParms().sd(), &buf, 1); // we know 1 byte is in the recv buffer
#endif // pragma
#endif
return;

View File

@ -77,7 +77,7 @@ public:
boost::thread* create_thread(F threadfunc)
{
boost::lock_guard<boost::shared_mutex> guard(m);
#if defined(__GNUC__) && __GNUC__ >= 5
#if defined(__GNUC__) && __GNUC__ >= 7
std::unique_ptr<boost::thread> new_thread(new boost::thread(threadfunc));
#else
std::auto_ptr<boost::thread> new_thread(new boost::thread(threadfunc));

View File

@ -66,6 +66,8 @@ namespace WriteEngine
extern int NUM_BLOCKS_PER_INITIAL_EXTENT; // defined in we_dctnry.cpp
extern WErrorCodes ec; // defined in we_log.cpp
const int COMPRESSED_CHUNK_SIZE = compress::IDBCompressInterface::maxCompressedSize(UNCOMPRESSED_CHUNK_SIZE) + 64 + 3 + 8 * 1024;
//------------------------------------------------------------------------------
// Search for the specified chunk in fChunkList.
//------------------------------------------------------------------------------
@ -1926,7 +1928,7 @@ int ChunkManager::reallocateChunks(CompFileData* fileData)
char tmText[24];
// this snprintf call causes a compiler warning b/c buffer size is less
// then maximum string size.
#if defined(__GNUC__) && __GNUC__ >= 5
#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",
@ -1934,6 +1936,11 @@ int ChunkManager::reallocateChunks(CompFileData* fileData)
ltm.tm_mday, ltm.tm_hour, ltm.tm_min,
ltm.tm_sec, tv.tv_usec);
#pragma GCC diagnostic pop
#else
snprintf(tmText, sizeof(tmText), ".%04d%02d%02d%02d%02d%02d%06ld",
ltm.tm_year + 1900, ltm.tm_mon + 1,
ltm.tm_mday, ltm.tm_hour, ltm.tm_min,
ltm.tm_sec, tv.tv_usec);
#endif
string dbgFileName(rlcFileName + tmText);
@ -2116,7 +2123,7 @@ int ChunkManager::reallocateChunks(CompFileData* fileData)
char tmText[24];
// this snprintf call causes a compiler warning b/c buffer size is less
// then maximum string size.
#if defined(__GNUC__) && __GNUC__ >= 5
#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",
@ -2124,6 +2131,11 @@ int ChunkManager::reallocateChunks(CompFileData* fileData)
ltm.tm_mday, ltm.tm_hour, ltm.tm_min,
ltm.tm_sec, tv.tv_usec);
#pragma GCC diagnostic pop
#else
snprintf(tmText, sizeof(tmText), ".%04d%02d%02d%02d%02d%02d%06ld",
ltm.tm_year + 1900, ltm.tm_mon + 1,
ltm.tm_mday, ltm.tm_hour, ltm.tm_min,
ltm.tm_sec, tv.tv_usec);
#endif
string dbgFileName(rlcFileName + tmText);

View File

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