You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-08 14:22:09 +03:00
MCOL-498. Add the knob to disable segment|dict file preallocation. Dict files extension uses fallocate() if possible.
This commit is contained in:
@@ -287,7 +287,7 @@ int BufferedFile::fallocate(int mode, off64_t offset, off64_t length)
|
||||
ret = ::fallocate( fileno(m_fp), mode, offset, length );
|
||||
savedErrno = errno;
|
||||
|
||||
if ( ret == -1 && IDBLogger::isEnabled() )
|
||||
if ( IDBLogger::isEnabled() )
|
||||
{
|
||||
IDBLogger::logNoArg(m_fname, this, "fallocate", errno);
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@ set(idbdatafile_LIB_SRCS
|
||||
|
||||
add_library(idbdatafile SHARED ${idbdatafile_LIB_SRCS})
|
||||
|
||||
target_link_libraries(idbdatafile ${NETSNMP_LIBRARIES})
|
||||
target_link_libraries(idbdatafile ${NETSNMP_LIBRARIES} ${ENGINE_OAM_LIBS})
|
||||
|
||||
set_target_properties(idbdatafile PROPERTIES VERSION 1.0.0 SOVERSION 1)
|
||||
|
||||
|
@@ -18,12 +18,14 @@
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem/convenience.hpp>
|
||||
#include <boost/algorithm/string.hpp> // to_upper
|
||||
#include <boost/thread/thread.hpp>
|
||||
|
||||
#include "configcpp.h" // for Config
|
||||
#include "oamcache.h"
|
||||
#include "IDBPolicy.h"
|
||||
#include "PosixFileSystem.h"
|
||||
//#include "HdfsFileSystem.h"
|
||||
@@ -48,6 +50,7 @@ int64_t IDBPolicy::s_hdfsRdwrBufferMaxSize = 0;
|
||||
std::string IDBPolicy::s_hdfsRdwrScratch;
|
||||
bool IDBPolicy::s_configed = false;
|
||||
boost::mutex IDBPolicy::s_mutex;
|
||||
bool IDBPolicy::s_PreallocSpace = true;
|
||||
|
||||
void IDBPolicy::init( bool bEnableLogging, bool bUseRdwrMemBuffer, const string& hdfsRdwrScratch, int64_t hdfsRdwrBufferMaxSize )
|
||||
{
|
||||
@@ -224,6 +227,23 @@ void IDBPolicy::configIDBPolicy()
|
||||
string scratch = cf->getConfig("SystemConfig", "hdfsRdwrScratch");
|
||||
string hdfsRdwrScratch = tmpDir + scratch;
|
||||
|
||||
// MCOL-498. Set the PMSX.PreallocSpace knob, where X is a PM number,
|
||||
// to disable file space preallocation. The feature is used in the FileOp code
|
||||
// and is enabled by default for a backward compatibility.
|
||||
oam::OamCache* oamcache = oam::OamCache::makeOamCache();
|
||||
int PMId = oamcache->getLocalPMId();
|
||||
char configSectionPref[] = "PMS";
|
||||
char configSection[sizeof(configSectionPref)+oam::MAX_MODULE_ID_SIZE];
|
||||
::memset(configSection, 0, sizeof(configSection));
|
||||
sprintf(configSection, "%s%d", configSectionPref, PMId);
|
||||
string PreallocSpace = cf->getConfig(configSection, "PreallocSpace");
|
||||
|
||||
if ( PreallocSpace.length() != 0 )
|
||||
{
|
||||
boost::to_upper(PreallocSpace);
|
||||
s_PreallocSpace = ( PreallocSpace != "OFF" );
|
||||
}
|
||||
|
||||
IDBPolicy::init( idblog, bUseRdwrMemBuffer, hdfsRdwrScratch, hdfsRdwrBufferMaxSize );
|
||||
|
||||
s_configed = true;
|
||||
|
@@ -80,6 +80,11 @@ public:
|
||||
*/
|
||||
static bool useHdfs();
|
||||
|
||||
/**
|
||||
* Accessor method that returns whether or not HDFS is enabled
|
||||
*/
|
||||
static bool PreallocSpace();
|
||||
|
||||
/**
|
||||
* Accessor method that returns whether to use HDFS memory buffers
|
||||
*/
|
||||
@@ -134,6 +139,7 @@ private:
|
||||
static bool isLocalFile( const std::string& path );
|
||||
|
||||
static bool s_usehdfs;
|
||||
static bool s_PreallocSpace;
|
||||
static bool s_bUseRdwrMemBuffer;
|
||||
static std::string s_hdfsRdwrScratch;
|
||||
static int64_t s_hdfsRdwrBufferMaxSize;
|
||||
@@ -153,6 +159,12 @@ bool IDBPolicy::useHdfs()
|
||||
return s_usehdfs;
|
||||
}
|
||||
|
||||
inline
|
||||
bool IDBPolicy::PreallocSpace()
|
||||
{
|
||||
return s_PreallocSpace;
|
||||
}
|
||||
|
||||
inline
|
||||
bool IDBPolicy::useRdwrMemBuffer()
|
||||
{
|
||||
|
@@ -337,7 +337,7 @@ int UnbufferedFile::fallocate(int mode, off64_t offset, off64_t length)
|
||||
ret = ::fallocate( m_fd, mode, offset, length );
|
||||
savedErrno = errno;
|
||||
|
||||
if ( ret == -1 && IDBLogger::isEnabled() )
|
||||
if ( IDBLogger::isEnabled() )
|
||||
{
|
||||
IDBLogger::logNoArg(m_fname, this, "fallocate", errno);
|
||||
}
|
||||
|
Reference in New Issue
Block a user