@@ -31,15 +31,11 @@ struct root {
3131static constexpr size_t QUEUE_SIZE = 3000 ;
3232static const auto produce_size = 128ULL ;
3333static const size_t concurrency = 4 ;
34- static const auto fill_pattern = char ( 1 );
34+ const auto fill_pattern = std::string(produce_size, ' x ' );
3535
3636void
3737run_consistent (pmem::obj::pool<root> pop)
3838{
39- const auto produce_size = 128ULL ;
40- const size_t concurrency = 4 ;
41- const auto fill_pattern = char (1 );
42-
4339 auto proot = pop.root ();
4440 auto queue = queue_type (*proot->log , concurrency);
4541
@@ -56,12 +52,7 @@ run_consistent(pmem::obj::pool<root> pop)
5652 proot->capacity = capacity;
5753 pop.persist (proot->capacity );
5854
59- make_queue_with_first_half_empty (queue, capacity, produce_size,
60- [&](pmem::obj::slice<char *> range) {
61- std::fill_n (range.begin (),
62- produce_size, 1 );
63- });
64-
55+ make_queue_with_first_half_empty (queue, capacity, produce_size);
6556 /* Run this under pmreorder. After crash state of the queue should be
6657 * something like this: | produced | crashed | produced | empty |
6758 * produced |
@@ -73,12 +64,7 @@ run_consistent(pmem::obj::pool<root> pop)
7364 if (id == 0 )
7465 VALGRIND_PMC_EMIT_LOG (" PMREORDER_MARKER.BEGIN" );
7566
76- auto ret = worker.try_produce (
77- produce_size,
78- [&](pmem::obj::slice<char *> range) {
79- std::fill_n (range.begin (), produce_size,
80- fill_pattern);
81- });
67+ auto ret = worker.try_produce (fill_pattern);
8268
8369 if (id == 0 )
8470 VALGRIND_PMC_EMIT_LOG (" PMREORDER_MARKER.END" );
@@ -111,20 +97,16 @@ check_consistency(pmem::obj::pool<root> pop)
11197 UT_ASSERT (values_on_pmem.size () >= expected);
11298
11399 for (auto &str : values_on_pmem) {
114- UT_ASSERT (str == std::string (produce_size, fill_pattern) );
100+ UT_ASSERT (str == fill_pattern);
115101 }
116102
117103 auto worker = queue.register_worker ();
118104
119- static const auto overwrite_pattern = char (2 );
120105 static const auto overwrite_size = 64 ;
106+ static const auto overwrite_pattern = std::string (overwrite_size, ' y' );
121107
122108 while (true ) {
123- auto ret = worker.try_produce (
124- overwrite_size, [&](pmem::obj::slice<char *> range) {
125- std::fill_n (range.begin (), overwrite_size,
126- overwrite_pattern);
127- });
109+ auto ret = worker.try_produce (overwrite_pattern);
128110
129111 if (!ret)
130112 break ;
@@ -138,8 +120,7 @@ check_consistency(pmem::obj::pool<root> pop)
138120 UT_ASSERT (ret);
139121
140122 for (auto &str : values_on_pmem) {
141- UT_ASSERT (str ==
142- std::string (overwrite_size, overwrite_pattern));
123+ UT_ASSERT (str == overwrite_pattern);
143124 }
144125}
145126
0 commit comments