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
PMem-based Data Structures
Commits
0a19a7bc
Commit
0a19a7bc
authored
Jan 19, 2021
by
Philipp Götze
Browse files
Switched back to persistent index for PTable to avoid recovery
parent
fa48efed
Pipeline
#967
passed with stages
in 6 minutes and 34 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bench/ptable/common.hpp
View file @
0a19a7bc
...
...
@@ -45,7 +45,7 @@ struct root {
};
const
std
::
string
path
=
dbis
::
gPmemPath
+
"benchdb"
+
std
::
to_string
(
dbis
::
ptable
::
gBlockSize
)
+
"B.db"
;
const
auto
NUM_TUPLES
=
1000
*
10
00
;
const
auto
NUM_TUPLES
=
1000
*
10
;
const
auto
POOL_SIZE
=
1024
*
1024
*
1024
*
4ull
;
// 4GB
const
auto
ALIGNMENT
=
hibit_pos
(
NUM_TUPLES
)
+
1
;
...
...
@@ -131,15 +131,15 @@ void insert (pool<root> &pop, const std::string &path, size_t entries) {
pop
=
pool
<
root
>::
create
(
path
,
LAYOUT
,
POOL_SIZE
);
/// Only if index is persistent version
//
const auto alloc_class = pop.ctl_set<struct pobj_alloc_class_desc>(
//
"heap.alloc_class.128.desc", PTableType::IndexType::AllocClass);
const
auto
alloc_class
=
pop
.
ctl_set
<
struct
pobj_alloc_class_desc
>
(
"heap.alloc_class.128.desc"
,
PTableType
::
IndexType
::
AllocClass
);
transaction
::
run
(
pop
,
[
&
]
{
const
auto
tInfo
=
VTableInfo
<
MyKey
,
MyTuple
>
(
"MyTable"
,
{
"a"
,
"b"
,
"c"
,
"d"
});
const
auto
dims
=
Dimensions
({
{
0
,
10
,
ALIGNMENT
},
{
3
,
10
,
ALIGNMENT
}
});
pop
.
root
()
->
pTable
=
make_persistent
<
PTableType
>
(
/*
alloc_class,
*/
tInfo
,
dims
);
pop
.
root
()
->
pTable
=
make_persistent
<
PTableType
>
(
alloc_class
,
tInfo
,
dims
);
});
auto
&
pTable
=
pop
.
root
()
->
pTable
;
...
...
src/ptable/PTable.hpp
View file @
0a19a7bc
...
...
@@ -204,8 +204,8 @@ class PTable<KeyType, std::tuple<Types...>> {
};
public:
//
using IndexType = pbptrees::PBPTree<KeyType, PTuple<KeyType, Tuple>, BRANCHKEYS, LEAFKEYS>;
using
IndexType
=
pbptrees
::
BPTree
<
KeyType
,
PTuple
<
KeyType
,
Tuple
>
,
BRANCHKEYS
,
LEAFKEYS
>
;
using
IndexType
=
pbptrees
::
PBPTree
<
KeyType
,
PTuple
<
KeyType
,
Tuple
>
,
BRANCHKEYS
,
LEAFKEYS
>
;
//
using IndexType = pbptrees::BPTree<KeyType, PTuple<KeyType, Tuple>, BRANCHKEYS, LEAFKEYS>;
/************************************************************************//**
* \brief Public Iterator to iterate over all inserted tuples using the index.
...
...
@@ -717,7 +717,7 @@ class PTable<KeyType, std::tuple<Types...>> {
this
->
root
=
make_persistent
<
struct
root
>
();
this
->
root
->
tInfo
.
get_rw
()
=
make_persistent
<
PTableInfoType
>
(
_tName
,
_columns
,
_keyIndex
);
this
->
root
->
bdccInfo
=
make_persistent
<
BDCCInfo
>
(
_bdccInfo
);
this
->
root
->
index
=
make_persistent
<
IndexType
>
(
/*
index_alloc_class
*/
);
this
->
root
->
index
=
make_persistent
<
IndexType
>
(
index_alloc_class
);
this
->
root
->
dataNodes
=
make_persistent
<
DataNode
<
KeyType
>>
();
this
->
root
->
dataNodes
->
block
.
get_rw
()
=
initBlock
(
0
,
((
1L
<<
this
->
root
->
bdccInfo
->
numBins
())
-
1
));
}
...
...
@@ -734,7 +734,7 @@ class PTable<KeyType, std::tuple<Types...>> {
this
->
root
=
make_persistent
<
struct
root
>
();
this
->
root
->
tInfo
=
make_persistent
<
PTableInfoType
>
(
_tInfo
);
this
->
root
->
bdccInfo
=
make_persistent
<
BDCCInfo
>
(
_bdccInfo
);
this
->
root
->
index
=
make_persistent
<
IndexType
>
(
/*
index_alloc_class
*/
);
this
->
root
->
index
=
make_persistent
<
IndexType
>
(
index_alloc_class
);
this
->
root
->
dataNodes
=
make_persistent
<
struct
DataNode
<
KeyType
>>
();
this
->
root
->
dataNodes
->
block
.
get_rw
()
=
initBlock
(
0
,
((
1L
<<
this
->
root
->
bdccInfo
->
numBins
())
-
1
));
}
...
...
src/ptable/core/DataNode.hpp
View file @
0a19a7bc
...
...
@@ -80,7 +80,6 @@ using BDCC_Block = typename std::array<uint8_t, gBlockSize>;
template
<
typename
KeyType
>
struct
DataNode
{
using
DeletedVector
=
std
::
vector
<
uint16_t
,
allocator
<
uint16_t
>>
;
using
KeyVector
=
std
::
array
<
KeyType
,
8192
>
;
/*
using HistogramType = std::unordered_map<uint32_t,
std::size_t,
...
...
@@ -93,7 +92,6 @@ struct DataNode {
persistent_ptr
<
DataNode
>
next
;
p
<
BDCC_Block
>
block
;
//p<KeyVector> keys;
p
<
DeletedVector
>
deleted
;
//p<HistogramType> histogram;
p
<
size_t
>
bdccSum
{
0
};
...
...
test/DataNodeTest.cpp
View file @
0a19a7bc
...
...
@@ -51,16 +51,13 @@ TEST_CASE("Testing to create a new BDCCInfo instance", "[BDCCInfo]") {
transaction
::
run
(
pop
,
[
&
]
{
for
(
auto
i
=
0u
;
i
<
10
;
++
i
)
{
node
->
bdccSum
+=
(
i
%
2
)
+
5
;
node
->
keys
.
get_rw
()[
i
]
=
i
;
node
->
block
.
get_rw
()[
i
]
=
0xFF
;
}
reinterpret_cast
<
uint16_t
&>
(
node
->
block
.
get_rw
()[
gCountPos
])
=
10
;
});
REQUIRE
(
node
->
keys
.
get_ro
().
size
()
==
8
*
1024
);
REQUIRE
(
node
->
calcAverageBDCC
()
==
5
);
/* 5.5 */
for
(
auto
i
=
0u
;
i
<
10
;
++
i
)
{
REQUIRE
(
node
->
keys
.
get_ro
()[
i
]
==
i
);
if
(
i
!=
gCountPos
&&
i
!=
gCountPos
+
1
)
REQUIRE
(
node
->
block
.
get_ro
()[
i
]
==
0xFF
);
}
...
...
test/PTableTest.cpp
View file @
0a19a7bc
...
...
@@ -40,6 +40,7 @@ TEST_CASE("Storing tuples in PTable", "[PTable]") {
if
(
access
(
path
.
c_str
(),
F_OK
)
!=
0
)
{
pop
=
pool
<
root
>::
create
(
path
,
LAYOUT
,
16
*
1024
*
1024
);
/// Only needed for persistent index
const
auto
alloc_class
=
pop
.
ctl_set
<
struct
pobj_alloc_class_desc
>
(
"heap.alloc_class.128.desc"
,
PTableType
::
IndexType
::
AllocClass
);
transaction
::
run
(
pop
,
[
&
]
{
...
...
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