You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
MCOL-520 - initial changes for /dev/shm
This commit is contained in:
@ -191,6 +191,12 @@ mkdir -p $hdfsDir >/dev/null 2>&1
|
||||
#create mount directories
|
||||
mkdir /mnt/tmp > /dev/null 2>&1
|
||||
|
||||
#create shared memory if non-root
|
||||
if [ $user != "root" ]; then
|
||||
mkdir -p ${installdir}/dev/shm
|
||||
chmod 666 ${installdir}/dev/shm
|
||||
fi
|
||||
|
||||
# remove mysql archive log
|
||||
test -d $installdir/mysql/db || mkdir -p $installdir/mysql/db
|
||||
rm -rf $installdir/mysql/db/columnstore_log_archive > /dev/null 2>&1
|
||||
|
@ -852,7 +852,7 @@ int main(int argc, char* argv[])
|
||||
if (temp == "1")
|
||||
{
|
||||
singleServerInstall = temp;
|
||||
cout << endl << "Performing the Single Server Install." << endl;
|
||||
cout << endl << "Performing the Single Server Install." << endl << endl;
|
||||
|
||||
if ( reuseConfig == "n" )
|
||||
{
|
||||
|
@ -1886,6 +1886,11 @@ static void statusControlThread()
|
||||
//
|
||||
//Allocate Shared Memory for storing Process Status Data
|
||||
//
|
||||
|
||||
string shmLocation = "/dev/shm/";
|
||||
if ( !rootUser)
|
||||
shmLocation = startup::StartUp::installDir() + "/dev/shm/";
|
||||
|
||||
PROCSTATshmsize = MAX_PROCESS * sizeof(shmProcessStatus);
|
||||
bool memInit = true;
|
||||
#if 0
|
||||
@ -1914,7 +1919,7 @@ static void statusControlThread()
|
||||
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
|
||||
@ -1992,7 +1997,7 @@ static void statusControlThread()
|
||||
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
|
||||
@ -2111,7 +2116,7 @@ static void statusControlThread()
|
||||
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
|
||||
@ -2209,7 +2214,7 @@ static void statusControlThread()
|
||||
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
|
||||
@ -2299,7 +2304,7 @@ static void statusControlThread()
|
||||
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
|
||||
|
@ -52,6 +52,8 @@ using namespace boost::posix_time;
|
||||
|
||||
#include "shmkeys.h"
|
||||
|
||||
#include "installdir.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
using namespace rwlock;
|
||||
@ -141,13 +143,26 @@ RWLockShmImpl::RWLockShmImpl(int key, bool excl)
|
||||
string keyName = BRM::ShmKeys::keyToName(key);
|
||||
fKeyString = keyName;
|
||||
|
||||
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
|
||||
|
@ -36,6 +36,8 @@ namespace bi = boost::interprocess;
|
||||
#include "brmshmimpl.h"
|
||||
#include "brmtypes.h"
|
||||
|
||||
#include "installdir.h"
|
||||
|
||||
namespace BRM
|
||||
{
|
||||
|
||||
@ -44,6 +46,19 @@ BRMShmImpl::BRMShmImpl(unsigned key, off_t size, bool readOnly) :
|
||||
{
|
||||
string keyName = ShmKeys::keyToName(fKey);
|
||||
|
||||
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/";
|
||||
|
||||
if (fSize == 0)
|
||||
{
|
||||
unsigned tries = 0;
|
||||
@ -89,7 +104,7 @@ again:
|
||||
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
|
||||
@ -147,7 +162,7 @@ int BRMShmImpl::grow(unsigned newKey, off_t newSize)
|
||||
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
|
||||
@ -194,7 +209,7 @@ int BRMShmImpl::clear(unsigned newKey, off_t newSize)
|
||||
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
|
||||
|
@ -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