You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-06-13 16:01:32 +03:00
MCOL-520 - initial changes for /dev/shm
This commit is contained in:
@ -41,6 +41,8 @@ using namespace rwlock;
|
||||
#include "mastersegmenttable.h"
|
||||
#undef MASTERSEGMENTTABLE_DLLEXPORT
|
||||
|
||||
#include "installdir.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
using namespace BRM;
|
||||
@ -73,13 +75,26 @@ MasterSegmentTableImpl::MasterSegmentTableImpl(int key, int size)
|
||||
{
|
||||
string keyName = ShmKeys::keyToName(key);
|
||||
|
||||
bool rootUser = true;
|
||||
|
||||
//check if root-user
|
||||
int user;
|
||||
user = getuid();
|
||||
|
||||
if (user != 0)
|
||||
rootUser = false;
|
||||
|
||||
string shmLocation = "/dev/shm/";
|
||||
if ( !rootUser)
|
||||
shmLocation = startup::StartUp::installDir() + "/dev/shm/";
|
||||
|
||||
try
|
||||
{
|
||||
#if BOOST_VERSION < 104500
|
||||
bi::shared_memory_object shm(bi::create_only, keyName.c_str(), bi::read_write);
|
||||
#ifdef __linux__
|
||||
{
|
||||
string pname = "/dev/shm/" + keyName;
|
||||
string pname = shmLocation + keyName;
|
||||
chmod(pname.c_str(), 0666);
|
||||
}
|
||||
#endif
|
||||
@ -96,7 +111,7 @@ MasterSegmentTableImpl::MasterSegmentTableImpl(int key, int size)
|
||||
bi::shared_memory_object shm(bi::open_only, keyName.c_str(), bi::read_write);
|
||||
#ifdef __linux__
|
||||
{
|
||||
string pname = "/dev/shm/" + keyName;
|
||||
string pname = shmLocation + keyName;
|
||||
chmod(pname.c_str(), 0666);
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user