1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-27 21:01:50 +03:00

The BRM structs aren't using IDBDataFile consistently.

Testing whether forcing them to use IDBDataFiles breaks anything.
This commit is contained in:
Patrick LeBlanc
2019-04-09 15:07:00 -05:00
parent 2b9e7facd2
commit 6e6cfdb59b
9 changed files with 26 additions and 25 deletions

View File

@ -110,6 +110,7 @@ vector<IDBDataFile::Types> IDBFactory::listPlugins()
IDBDataFile* IDBFactory::open(IDBDataFile::Types type, const char* fname, const char* mode, unsigned opts, unsigned colWidth) IDBDataFile* IDBFactory::open(IDBDataFile::Types type, const char* fname, const char* mode, unsigned opts, unsigned colWidth)
{ {
/* If this is a tmp file, ie opts & USE_TMPFILE, might want to force that to be a local file */
if ( s_plugins.find(type) == s_plugins.end() ) if ( s_plugins.find(type) == s_plugins.end() )
{ {
ostringstream oss; ostringstream oss;

View File

@ -109,7 +109,7 @@ int BlockResolutionManager::saveState(string filename) throw()
// truncate teh file if already exists since no truncate in HDFS. // truncate teh file if already exists since no truncate in HDFS.
const char* filename = journalFilename.c_str(); const char* filename = journalFilename.c_str();
if (IDBPolicy::useHdfs()) if (true || IDBPolicy::useHdfs())
{ {
IDBDataFile* journal = IDBDataFile::open( IDBDataFile* journal = IDBDataFile::open(
IDBPolicy::getType(filename, IDBPolicy::WRITEENG), filename, "wb", 0); IDBPolicy::getType(filename, IDBPolicy::WRITEENG), filename, "wb", 0);

View File

@ -1326,7 +1326,7 @@ void ExtentMap::load(const string& filename, bool fixFL)
throw; throw;
} }
if (IDBPolicy::useHdfs()) if (true || IDBPolicy::useHdfs())
{ {
const char* filename_p = filename.c_str(); const char* filename_p = filename.c_str();
scoped_ptr<IDBDataFile> in(IDBDataFile::open( scoped_ptr<IDBDataFile> in(IDBDataFile::open(
@ -1441,7 +1441,7 @@ void ExtentMap::save(const string& filename)
throw runtime_error("ExtentMap::save(): got request to save an empty BRM"); throw runtime_error("ExtentMap::save(): got request to save an empty BRM");
} }
if (IDBPolicy::useHdfs()) if (true || IDBPolicy::useHdfs())
{ {
utmp = ::umask(0); utmp = ::umask(0);
const char* filename_p = filename.c_str(); const char* filename_p = filename.c_str();

View File

@ -153,7 +153,7 @@ void OIDServer::writeData(uint8_t* buf, off_t offset, int size) const
if (size == 0) if (size == 0)
return; return;
if (IDBPolicy::useHdfs()) if (true || IDBPolicy::useHdfs())
{ {
for (errCount = 0; errCount < MaxRetries && seekerr != offset; errCount++) for (errCount = 0; errCount < MaxRetries && seekerr != offset; errCount++)
{ {
@ -231,7 +231,7 @@ void OIDServer::readData(uint8_t* buf, off_t offset, int size) const
if (size == 0) if (size == 0)
return; return;
if (IDBPolicy::useHdfs()) if (true || IDBPolicy::useHdfs())
{ {
for (errCount = 0; errCount < MaxRetries && seekerr != offset; errCount++) for (errCount = 0; errCount < MaxRetries && seekerr != offset; errCount++)
{ {
@ -379,7 +379,7 @@ OIDServer::OIDServer() : fFp(NULL), fFd(-1)
throw runtime_error(os.str()); throw runtime_error(os.str());
} }
if (IDBPolicy::useHdfs()) if (true || IDBPolicy::useHdfs())
{ {
if (!IDBPolicy::exists(fFilename.c_str())) //no bitmap file if (!IDBPolicy::exists(fFilename.c_str())) //no bitmap file
{ {
@ -611,7 +611,7 @@ retry:
{ {
writeData(buf, offset, byteSize); writeData(buf, offset, byteSize);
if (IDBPolicy::useHdfs()) if (true || IDBPolicy::useHdfs())
fFp->flush(); fFp->flush();
delete [] buf; delete [] buf;
@ -658,7 +658,7 @@ retry:
{ {
writeData(buf, offset, byteSize); writeData(buf, offset, byteSize);
if (IDBPolicy::useHdfs()) if (true || IDBPolicy::useHdfs())
fFp->flush(); fFp->flush();
delete [] buf; delete [] buf;
@ -780,7 +780,7 @@ void OIDServer::patchFreelist(struct FEntry* freelist, int start, int num) const
{ {
writeData(reinterpret_cast<uint8_t*>(freelist), 0, HeaderSize); writeData(reinterpret_cast<uint8_t*>(freelist), 0, HeaderSize);
if (IDBPolicy::useHdfs()) if (true || IDBPolicy::useHdfs())
fFp->flush(); fFp->flush();
} }
} }
@ -808,7 +808,7 @@ int OIDServer::allocVBOID(uint16_t dbroot)
throw; throw;
} }
if (IDBPolicy::useHdfs()) if (true || IDBPolicy::useHdfs())
fFp->flush(); fFp->flush();
return ret; return ret;
@ -882,7 +882,7 @@ int OIDServer::allocOIDs(int num)
writeData(reinterpret_cast<uint8_t*>(freelist), 0, HeaderSize); writeData(reinterpret_cast<uint8_t*>(freelist), 0, HeaderSize);
flipOIDBlock(bestMatchBegin, num, 0); flipOIDBlock(bestMatchBegin, num, 0);
if (IDBPolicy::useHdfs()) if (true || IDBPolicy::useHdfs())
fFp->flush(); fFp->flush();
return bestMatchBegin; return bestMatchBegin;

View File

@ -119,7 +119,7 @@ SessionManagerServer::SessionManagerServer() : unique32(0), unique64(0), txnidfd
txnidFilename = conf->getConfig("SessionManager", "TxnIDFile"); txnidFilename = conf->getConfig("SessionManager", "TxnIDFile");
if (!IDBPolicy::useHdfs()) if (false && !IDBPolicy::useHdfs())
{ {
txnidfd = open(txnidFilename.c_str(), O_RDWR | O_CREAT | O_BINARY, 0664); txnidfd = open(txnidFilename.c_str(), O_RDWR | O_CREAT | O_BINARY, 0664);
@ -178,7 +178,7 @@ again:
// If we fail to read a full four bytes for any value, then the // If we fail to read a full four bytes for any value, then the
// value isn't in the file, and we start with the default. // value isn't in the file, and we start with the default.
if (!IDBPolicy::useHdfs()) if (false && !IDBPolicy::useHdfs())
{ {
// Last transaction id // Last transaction id
lseek(txnidfd, 0, SEEK_SET); lseek(txnidfd, 0, SEEK_SET);
@ -297,7 +297,7 @@ again:
*/ */
void SessionManagerServer::saveSystemState() void SessionManagerServer::saveSystemState()
{ {
if (!IDBPolicy::useHdfs()) if (false && !IDBPolicy::useHdfs())
{ {
int err = 0; int err = 0;
uint32_t lSystemState = systemState; uint32_t lSystemState = systemState;
@ -377,7 +377,7 @@ const TxnID SessionManagerServer::newTxnID(const SID session, bool block, bool i
if (isDDL) if (isDDL)
++_sysCatVerID; ++_sysCatVerID;
if (!IDBPolicy::useHdfs()) if (false && !IDBPolicy::useHdfs())
{ {
int filedata[2]; int filedata[2];
filedata[0] = _verID; filedata[0] = _verID;

View File

@ -138,7 +138,7 @@ SlaveComm::SlaveComm(string hostname, SlaveDBRMNode* s) :
const char* filename = journalName.c_str(); const char* filename = journalName.c_str();
uint32_t utmp = ::umask(0); uint32_t utmp = ::umask(0);
if (IDBPolicy::useHdfs()) if (true || IDBPolicy::useHdfs())
{ {
journalh = IDBDataFile::open( journalh = IDBDataFile::open(
IDBPolicy::getType(filename, IDBPolicy::WRITEENG), filename, "r+b", 0); IDBPolicy::getType(filename, IDBPolicy::WRITEENG), filename, "r+b", 0);
@ -2007,11 +2007,11 @@ void SlaveComm::do_confirm()
{ {
const char* filename = tmp.c_str(); const char* filename = tmp.c_str();
if (!IDBPolicy::useHdfs() && currentSaveFD < 0) if (false && !IDBPolicy::useHdfs() && currentSaveFD < 0)
{ {
currentSaveFD = open(filename, O_WRONLY | O_CREAT, 0664); currentSaveFD = open(filename, O_WRONLY | O_CREAT, 0664);
} }
else if (IDBPolicy::useHdfs() && !currentSaveFile) else if ((true || IDBPolicy::useHdfs()) && !currentSaveFile)
{ {
currentSaveFile = IDBDataFile::open( currentSaveFile = IDBDataFile::open(
IDBPolicy::getType(filename, IDBPolicy::WRITEENG), filename, "wb", 0); IDBPolicy::getType(filename, IDBPolicy::WRITEENG), filename, "wb", 0);
@ -2064,7 +2064,7 @@ void SlaveComm::do_confirm()
delete journalh; delete journalh;
journalh = IDBDataFile::open( journalh = IDBDataFile::open(
IDBPolicy::getType(filename, IDBPolicy::WRITEENG), filename, "w+b", 0); IDBPolicy::getType(filename, IDBPolicy::WRITEENG), filename, "w+b", 0);
::umask(utmp); //::umask(utmp);
if (!journalh) if (!journalh)
throw runtime_error("Could not open the BRM journal for writing!"); throw runtime_error("Could not open the BRM journal for writing!");
@ -2252,7 +2252,7 @@ int SlaveComm::replayJournal(string prefix)
const char* filename = journalName.c_str(); const char* filename = journalName.c_str();
if (IDBPolicy::useHdfs()) if (true || IDBPolicy::useHdfs())
{ {
IDBDataFile* journalf = IDBDataFile::open( IDBDataFile* journalf = IDBDataFile::open(
IDBPolicy::getType(filename, IDBPolicy::WRITEENG), filename, "rb", 0); IDBPolicy::getType(filename, IDBPolicy::WRITEENG), filename, "rb", 0);
@ -2362,7 +2362,7 @@ void SlaveComm::saveDelta()
{ {
uint32_t len = delta.length(); uint32_t len = delta.length();
if (IDBPolicy::useHdfs()) if (true || IDBPolicy::useHdfs())
{ {
journalh->write((const char*) &len, sizeof(len)); journalh->write((const char*) &len, sizeof(len));
journalh->write((const char*) delta.buf(), delta.length()); journalh->write((const char*) delta.buf(), delta.length());

View File

@ -63,7 +63,7 @@ void TableLockServer::save()
const char* filename_p = filename.c_str(); const char* filename_p = filename.c_str();
if (IDBPolicy::useHdfs()) if (true || IDBPolicy::useHdfs())
{ {
scoped_ptr<IDBDataFile> out(IDBDataFile::open( scoped_ptr<IDBDataFile> out(IDBDataFile::open(
IDBPolicy::getType(filename_p, IDBPolicy::WRITEENG), IDBPolicy::getType(filename_p, IDBPolicy::WRITEENG),
@ -109,7 +109,7 @@ void TableLockServer::load()
TableLockInfo tli; TableLockInfo tli;
/* Need to standardize the file error handling */ /* Need to standardize the file error handling */
if (IDBPolicy::useHdfs()) if (true || IDBPolicy::useHdfs())
{ {
const char* filename_p = filename.c_str(); const char* filename_p = filename.c_str();
scoped_ptr<IDBDataFile> in(IDBDataFile::open( scoped_ptr<IDBDataFile> in(IDBDataFile::open(

View File

@ -1135,7 +1135,7 @@ void VBBM::save(string filename)
mode_t utmp = ::umask(0); mode_t utmp = ::umask(0);
int var; int var;
if (IDBPolicy::useHdfs()) if (true || IDBPolicy::useHdfs())
{ {
const char* filename_p = filename.c_str(); const char* filename_p = filename.c_str();
scoped_ptr<IDBDataFile> out(IDBDataFile::open( scoped_ptr<IDBDataFile> out(IDBDataFile::open(

View File

@ -1295,7 +1295,7 @@ void VSS::save(string filename)
struct Header header; struct Header header;
mode_t utmp = ::umask(0); mode_t utmp = ::umask(0);
if (IDBPolicy::useHdfs()) if (true || IDBPolicy::useHdfs())
{ {
const char* filename_p = filename.c_str(); const char* filename_p = filename.c_str();
scoped_ptr<IDBDataFile> out(IDBDataFile::open( scoped_ptr<IDBDataFile> out(IDBDataFile::open(