Commit 56ad2b73 authored by Philipp Götze's avatar Philipp Götze
Browse files

Adapted MVCC table and state context to work with PMem tables disabled

parent 2e22fbb4
Pipeline #1129 passed with stages
in 33 minutes and 28 seconds
......@@ -578,11 +578,21 @@ class MVCCTable : public BaseTable,
/* Get MVCC Object */
/// in-place variant
///*
#ifdef USE_NVM_TABLES
std::tuple<MVCCObject<TupleType>> * tplPtr = nullptr;
if (!tbl.getAsRef(key, &tplPtr)) {
return Errc::NOT_FOUND;
}
auto& mvcc = ns_types::get<0>(*tplPtr);//*/
auto& mvcc = ns_types::get<0>(*tplPtr);
#else
SmartPtr<pfabric::Tuple<MVCCObject<TupleType>>> tplPtr;
if (!tbl.getByKey(key, tplPtr)) {
return Errc::NOT_FOUND;
}
const auto& mvcc = ns_types::get<0>(*tplPtr);
#endif
//*/
/// out-of-place variant
/*
locks.lockShared(key);
......
......@@ -37,11 +37,13 @@
namespace pfabric {
#ifdef USE_NVM_TABLES
using pmem::obj::delete_persistent;
using pmem::obj::make_persistent;
using pmem::obj::persistent_ptr;
using pmem::obj::pool;
using pmem::obj::transaction;
#endif
using TableID = unsigned short;
/// Settings, TODO: maybe these should rather be template arguments
......@@ -188,7 +190,7 @@ class StateContext {
topoGrps = pop.root()->topoGrps.get();
numGroups = &pop.root()->numGrps;
#else
topoGrps = new std::array<TopoGrps, MAX_TOPO_GRPS>;
topoGrps = new std::array<TopoGrp, MAX_TOPO_GRPS>;
numGroups = new GroupID{0u};
#endif
}
......@@ -313,9 +315,13 @@ class StateContext {
GroupID registerTopo(const std::array<TableID, MAX_STATES_TOPO> &tbls) {
auto &numGrps = *numGroups;
(*topoGrps)[numGrps] = std::make_pair(tbls, 0);
#ifdef USE_NVM_TABLES
pmem_flush(&(*topoGrps)[numGrps], sizeof(TableID) * MAX_STATES_TOPO + sizeof(LastCTS));
++numGrps;
pmem_persist(numGroups, sizeof(GroupID));
#else
++numGrps;
#endif
return numGrps-1;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment