1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-12-17 01:02:23 +03:00

Checkpointing mods for IOC::read(). Doesn't build yet.

This commit is contained in:
Patrick LeBlanc
2019-03-27 16:27:15 -05:00
parent 238731622a
commit 6bd4b60a7b
7 changed files with 362 additions and 79 deletions

View File

@@ -1,6 +1,7 @@
#include "Synchronizer.h"
#include "MetadataFile.h"
#include "Utilities.h"
#include <boost/thread/mutex.hpp>
#include <sys/stat.h>
@@ -13,57 +14,6 @@ namespace
{
storagemanager::Synchronizer *instance = NULL;
boost::mutex inst_mutex;
// a few utility classes. Maybe move these to a utilities header.
struct ScopedReadLock
{
ScopedReadLock(storagemanager::IOCoordinator *i, const string &k) : ioc(i), key(k)
{
ioc->readLock(key);
}
~ScopedReadLock()
{
ioc->readUnlock(key);
}
storagemanager::IOCoordinator *ioc;
const string key;
};
struct ScopedWriteLock
{
ScopedWriteLock(storagemanager::IOCoordinator *i, const string &k) : ioc(i), key(k)
{
ioc->writeLock(key);
locked = true;
}
~ScopedWriteLock()
{
unlock();
}
void unlock()
{
if (locked)
{
ioc->writeUnlock(key);
locked = false;
}
}
storagemanager::IOCoordinator *ioc;
bool locked;
const string key;
};
struct ScopedCloser {
ScopedCloser(int f) : fd(f) { }
~ScopedCloser() {
int s_errno = errno;
::close(fd);
errno = s_errno;
}
int fd;
};
}
namespace bf = boost::filesystem;