Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
HEPnOS
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sds
HEP
HEPnOS
Commits
30a0a459
Commit
30a0a459
authored
Apr 15, 2020
by
Matthieu Dorier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slight changes in WriteBatchImpl
parent
4df770f2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
src/WriteBatchImpl.hpp
src/WriteBatchImpl.hpp
+4
-2
test/AsyncWriteBatchTest.cpp
test/AsyncWriteBatchTest.cpp
+4
-0
No files found.
src/WriteBatchImpl.hpp
View file @
30a0a459
...
@@ -55,6 +55,7 @@ class WriteBatchImpl {
...
@@ -55,6 +55,7 @@ class WriteBatchImpl {
void
update_keyval_statistics
(
size_t
ksize
,
size_t
vsize
)
{
void
update_keyval_statistics
(
size_t
ksize
,
size_t
vsize
)
{
if
(
!
m_stats
)
return
;
if
(
!
m_stats
)
return
;
std
::
lock_guard
<
tl
::
mutex
>
g
(
m_stats_mtx
);
m_stats
->
key_sizes
.
updateWith
(
ksize
);
m_stats
->
key_sizes
.
updateWith
(
ksize
);
if
(
vsize
)
if
(
vsize
)
m_stats
->
value_sizes
.
updateWith
(
vsize
);
m_stats
->
value_sizes
.
updateWith
(
vsize
);
...
@@ -62,6 +63,7 @@ class WriteBatchImpl {
...
@@ -62,6 +63,7 @@ class WriteBatchImpl {
void
update_operation_statistics
(
size_t
batch_size
)
{
void
update_operation_statistics
(
size_t
batch_size
)
{
if
(
!
m_stats
)
return
;
if
(
!
m_stats
)
return
;
std
::
lock_guard
<
tl
::
mutex
>
g
(
m_stats_mtx
);
m_stats
->
batch_sizes
.
updateWith
(
batch_size
);
m_stats
->
batch_sizes
.
updateWith
(
batch_size
);
}
}
...
@@ -158,7 +160,7 @@ class WriteBatchImpl {
...
@@ -158,7 +160,7 @@ class WriteBatchImpl {
// find the queue of batches
// find the queue of batches
std
::
queue
<
keyvals
>&
entry_queue
=
m_entries
[
&
db
];
std
::
queue
<
keyvals
>&
entry_queue
=
m_entries
[
&
db
];
if
(
entry_queue
.
empty
()
if
(
entry_queue
.
empty
()
||
entry_queue
.
back
().
m_
packed_key_sizes
.
size
()
>=
m_max_batch_size
)
{
||
entry_queue
.
back
().
m_
size
>=
m_max_batch_size
)
{
entry_queue
.
emplace
();
entry_queue
.
emplace
();
}
}
auto
&
kv_batch
=
entry_queue
.
back
();
auto
&
kv_batch
=
entry_queue
.
back
();
...
@@ -207,7 +209,7 @@ class WriteBatchImpl {
...
@@ -207,7 +209,7 @@ class WriteBatchImpl {
auto
&
kvs_queue
=
m_entries
[
&
db
];
auto
&
kvs_queue
=
m_entries
[
&
db
];
if
(
kvs_queue
.
empty
()
if
(
kvs_queue
.
empty
()
||
kvs_queue
.
back
().
m_
packed_key_sizes
.
size
()
>=
m_max_batch_size
)
{
||
kvs_queue
.
back
().
m_
size
>=
m_max_batch_size
)
{
kvs_queue
.
emplace
();
kvs_queue
.
emplace
();
}
}
auto
&
kv_batch
=
kvs_queue
.
back
();
auto
&
kv_batch
=
kvs_queue
.
back
();
...
...
test/AsyncWriteBatchTest.cpp
View file @
30a0a459
...
@@ -24,6 +24,7 @@ void AsyncWriteBatchTest::testAsyncWriteBatchRun() {
...
@@ -24,6 +24,7 @@ void AsyncWriteBatchTest::testAsyncWriteBatchRun() {
{
{
hepnos
::
WriteBatch
batch
(
async_engine
);
hepnos
::
WriteBatch
batch
(
async_engine
);
batch
.
activateStatistics
();
for
(
auto
i
=
0
;
i
<
5
;
i
++
)
{
for
(
auto
i
=
0
;
i
<
5
;
i
++
)
{
auto
run
=
dataset
.
createRun
(
batch
,
i
);
auto
run
=
dataset
.
createRun
(
batch
,
i
);
...
@@ -31,6 +32,9 @@ void AsyncWriteBatchTest::testAsyncWriteBatchRun() {
...
@@ -31,6 +32,9 @@ void AsyncWriteBatchTest::testAsyncWriteBatchRun() {
CPPUNIT_ASSERT
(
run
.
store
(
batch
,
key1
,
out_obj_b
));
CPPUNIT_ASSERT
(
run
.
store
(
batch
,
key1
,
out_obj_b
));
}
}
batch
.
flush
();
batch
.
flush
();
hepnos
::
WriteBatchStatistics
stats
;
batch
.
collectStatistics
(
stats
);
std
::
cout
<<
stats
<<
std
::
endl
;
}
}
async_engine
.
wait
();
// useless, but just to test
async_engine
.
wait
();
// useless, but just to test
{
{
...
...
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