summaryrefslogtreecommitdiffstats
path: root/vespalib/src/tests/btree
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2022-10-06 16:02:36 +0200
committerTor Egge <Tor.Egge@online.no>2022-10-06 16:02:36 +0200
commit4608993c27911a304071df04989b741b0a403694 (patch)
treed008dd9efb44909396ff7630ee2ed1fdf29775a1 /vespalib/src/tests/btree
parent3cbbac35a188b578f1360ede59de6175b5d43665 (diff)
Stop using DataStoreBase::startCompact() member function.
Diffstat (limited to 'vespalib/src/tests/btree')
-rw-r--r--vespalib/src/tests/btree/btree-stress/btree_stress_test.cpp6
-rw-r--r--vespalib/src/tests/btree/btree_test.cpp6
-rw-r--r--vespalib/src/tests/btree/btreeaggregation_test.cpp8
3 files changed, 12 insertions, 8 deletions
diff --git a/vespalib/src/tests/btree/btree-stress/btree_stress_test.cpp b/vespalib/src/tests/btree/btree-stress/btree_stress_test.cpp
index c68ff07491e..3ba7bf85e42 100644
--- a/vespalib/src/tests/btree/btree-stress/btree_stress_test.cpp
+++ b/vespalib/src/tests/btree/btree-stress/btree_stress_test.cpp
@@ -66,8 +66,6 @@ public:
uint32_t get_relaxed(const AtomicEntryRef& ref) const { return get(ref.load_relaxed()); }
std::unique_ptr<vespalib::datastore::CompactingBuffers> start_compact();
static constexpr bool is_indirect = true;
- static uint32_t get_offset_bits() { return StoreRefType::offset_bits; }
- static uint32_t get_num_buffers() { return StoreRefType::numBuffers(); }
bool has_held_buffers() const noexcept { return _store.has_held_buffers(); }
};
@@ -82,7 +80,7 @@ std::unique_ptr<vespalib::datastore::CompactingBuffers>
RealIntStore::start_compact()
{
// Use a compaction strategy that will compact all active buffers
- CompactionStrategy compaction_strategy(0.0, 0.0, get_num_buffers(), 1.0);
+ auto compaction_strategy = CompactionStrategy::make_compact_all_active_buffers_strategy();
CompactionSpec compaction_spec(true, false);
return _store.start_compact_worst_buffers(compaction_spec, compaction_strategy);
}
@@ -329,7 +327,7 @@ void
Fixture<Params>::compact_tree()
{
// Use a compaction strategy that will compact all active buffers
- CompactionStrategy compaction_strategy(0.0, 0.0, RefType::numBuffers(), 1.0);
+ auto compaction_strategy = CompactionStrategy::make_compact_all_active_buffers_strategy();
_tree.compact_worst(compaction_strategy);
_writeItr = _tree.begin();
_compact_tree.track_compacted();
diff --git a/vespalib/src/tests/btree/btree_test.cpp b/vespalib/src/tests/btree/btree_test.cpp
index 92f55681c0f..3fd00a26189 100644
--- a/vespalib/src/tests/btree/btree_test.cpp
+++ b/vespalib/src/tests/btree/btree_test.cpp
@@ -862,15 +862,17 @@ TEST_F(BTreeTest, require_that_we_can_insert_and_remove_from_tree)
}
// compact full tree by calling incremental compaction methods in a loop
{
+ // Use a compaction strategy that will compact all active buffers
+ auto compaction_strategy = CompactionStrategy::make_compact_all_active_buffers_strategy();
MyTree::NodeAllocatorType &manager = tree.getAllocator();
- std::vector<uint32_t> toHold = manager.startCompact();
+ auto compacting_buffers = manager.start_compact_worst(compaction_strategy);
MyTree::Iterator itr = tree.begin();
tree.setRoot(itr.moveFirstLeafNode(tree.getRoot()));
while (itr.valid()) {
// LOG(info, "Leaf moved to %d", UNWRAP(itr.getKey()));
itr.moveNextLeafNode();
}
- manager.finishCompact(toHold);
+ compacting_buffers->finish();
manager.freeze();
manager.transferHoldLists(g.getCurrentGeneration());
g.incGeneration();
diff --git a/vespalib/src/tests/btree/btreeaggregation_test.cpp b/vespalib/src/tests/btree/btreeaggregation_test.cpp
index f4300499fcd..dff7de6660f 100644
--- a/vespalib/src/tests/btree/btreeaggregation_test.cpp
+++ b/vespalib/src/tests/btree/btreeaggregation_test.cpp
@@ -15,6 +15,7 @@
#include <vespa/vespalib/btree/btreestore.hpp>
#include <vespa/vespalib/btree/btreeaggregator.hpp>
#include <vespa/vespalib/datastore/buffer_type.hpp>
+#include <vespa/vespalib/datastore/compaction_strategy.h>
#include <vespa/vespalib/test/btree/btree_printer.h>
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/util/rand48.h>
@@ -28,6 +29,7 @@
LOG_SETUP("btreeaggregation_test");
using vespalib::GenerationHandler;
+using vespalib::datastore::CompactionStrategy;
using vespalib::datastore::EntryRef;
namespace vespalib::btree {
@@ -877,15 +879,17 @@ Test::requireThatWeCanInsertAndRemoveFromTree()
}
// compact full tree by calling incremental compaction methods in a loop
{
+ // Use a compaction strategy that will compact all active buffers
+ auto compaction_strategy = CompactionStrategy::make_compact_all_active_buffers_strategy();
MyTree::NodeAllocatorType &manager = tree.getAllocator();
- std::vector<uint32_t> toHold = manager.startCompact();
+ auto compacting_buffers = manager.start_compact_worst(compaction_strategy);
MyTree::Iterator itr = tree.begin();
tree.setRoot(itr.moveFirstLeafNode(tree.getRoot()));
while (itr.valid()) {
// LOG(info, "Leaf moved to %d", UNWRAP(itr.getKey()));
itr.moveNextLeafNode();
}
- manager.finishCompact(toHold);
+ compacting_buffers->finish();
manager.freeze();
manager.transferHoldLists(g.getCurrentGeneration());
g.incGeneration();