Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
code
pfabric
Commits
56ad2b73
Commit
56ad2b73
authored
Apr 07, 2021
by
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
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/table/MVCCTable.hpp
View file @
56ad2b73
...
...
@@ -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);
...
...
src/table/StateContext.hpp
View file @
56ad2b73
...
...
@@ -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
<
TopoGrp
s
,
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
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment