Permalink
Browse files

Moved anti-cache NVM file allocation to /mnt/pmfs/

  • Loading branch information...
jdebrabant committed Oct 7, 2013
1 parent 8cf939d commit 34aabbede797ef6677f2884d4858d0300deb1834
@@ -27,10 +27,13 @@
#include "anticache/UnknownBlockAccessException.h"
#include "common/debuglog.h"
#include "common/FatalException.hpp"
#include "common/executorcontext.hpp"
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <sys/mman.h>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
@@ -94,12 +97,18 @@ void AntiCacheDB::initializeBerkeleyDB() {
}
}
void AntiCacheDB::initializeNVM() {
void AntiCacheDB::initializeNVM() {
char nvm_file_name[100];
char nvm_file_name[150];
char partition_str[5];
strcpy(nvm_file_name, m_dbDir.c_str());
strcat(nvm_file_name, "/anticache.nvm");
// use executor context to figure out which partition we are at
int partition_id = (int)m_executorContext->getPartitionId();
sprintf(partition_str, "%d", partition_id);
// there will be one NVM anti-cache file per partition, saved in /mnt/pmfs/anticache-XX
strcpy(nvm_file_name, "/mnt/pmfs/anticache-");
strcat(nvm_file_name, partition_str);
nvm_file = fopen(nvm_file_name, "w");
fclose(nvm_file);
nvm_file = fopen(nvm_file_name, "rw+");
@@ -127,7 +136,6 @@ void AntiCacheDB::initializeNVM() {
}
m_NVMBlocks = (char*)mmap(NULL, NVM_FILE_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE, nvm_fd, 0);
//m_NVMBlocks = new char[NVM_FILE_SIZE];
if(m_NVMBlocks == MAP_FAILED)
{
@@ -290,7 +298,7 @@ AntiCacheBlock AntiCacheDB::readBlock(std::string tableName, int16_t blockId) {
void AntiCacheDB::flushBlocks() {
#ifdef ANTICACHE_NVM
//msync(m_NVMBlocks, NVM_FILE_SIZE, MS_SYNC);
#else
m_db->sync(0);
#endif
@@ -125,6 +125,7 @@ class AntiCacheDB {
DbEnv* m_dbEnv;
Db* m_db;
int16_t m_nextBlockId;
int m_partitionId;
FILE* nvm_file;
char* m_NVMBlocks;
@@ -154,7 +154,7 @@ bool AntiCacheEvictionManager::updateUnevictedTuple(PersistentTable* table, Tabl
}
bool AntiCacheEvictionManager::updateTuple(PersistentTable* table, TableTuple* tuple, bool is_insert) {
int SAMPLE_RATE = 100; // aLRU sampling rate
int SAMPLE_RATE = 1000; // aLRU sampling rate
if(table->getEvictedTable() == NULL) // no need to maintain chain for non-evictable tables
return true;
@@ -88,6 +88,10 @@ namespace voltdb {
void setPartitionId(CatalogId partitionId) {
m_partitionId = partitionId;
}
CatalogId getPartitionId() {
return m_partitionId;
}
// not always known at initial construction
void setEpoch(int64_t epoch) {

0 comments on commit 34aabbe

Please sign in to comment.