diff options
author | Tor Egge <Tor.Egge@online.no> | 2021-12-08 16:30:28 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2021-12-08 16:30:28 +0100 |
commit | 6903c931a2448583a258786ba9fe5dec99948ecd (patch) | |
tree | 38c1690a7e2be8667f3b4cace5159ce8c040f4f7 /vespalib/src/tests/btree | |
parent | d6462d26bef1ed26970327fb70c2b9a099dd0fb9 (diff) |
Add CompactionSpec.
Pass CompactionStrategy to DataStoreBase::startCompactWorstBuffers in
preparation for compacting more buffers in the same compaction round.
Diffstat (limited to 'vespalib/src/tests/btree')
-rw-r--r-- | vespalib/src/tests/btree/btree_store/btree_store_test.cpp | 10 | ||||
-rw-r--r-- | vespalib/src/tests/btree/btree_test.cpp | 5 |
2 files changed, 12 insertions, 3 deletions
diff --git a/vespalib/src/tests/btree/btree_store/btree_store_test.cpp b/vespalib/src/tests/btree/btree_store/btree_store_test.cpp index 77cb8e519e4..974aafb392a 100644 --- a/vespalib/src/tests/btree/btree_store/btree_store_test.cpp +++ b/vespalib/src/tests/btree/btree_store/btree_store_test.cpp @@ -5,9 +5,12 @@ #include <vespa/vespalib/btree/btreeroot.hpp> #include <vespa/vespalib/btree/btreestore.hpp> #include <vespa/vespalib/datastore/buffer_type.hpp> +#include <vespa/vespalib/datastore/compaction_strategy.h> #include <vespa/vespalib/gtest/gtest.h> using vespalib::GenerationHandler; +using vespalib::datastore::CompactionSpec; +using vespalib::datastore::CompactionStrategy; using vespalib::datastore::EntryRef; namespace vespalib::btree { @@ -131,7 +134,9 @@ BTreeStoreTest::test_compact_sequence(uint32_t sequence_length) move_refs.reserve(refs.size()); auto usage_before = store.getMemoryUsage(); for (uint32_t pass = 0; pass < 15; ++pass) { - auto to_hold = store.start_compact_worst_buffers(); + CompactionSpec compaction_spec(true, false); + CompactionStrategy compaction_strategy; + auto to_hold = store.start_compact_worst_buffers(compaction_spec, compaction_strategy); std::vector<bool> filter(TreeStore::RefType::numBuffers()); for (auto buffer_id : to_hold) { filter[buffer_id] = true; @@ -168,7 +173,8 @@ TEST_F(BTreeStoreTest, require_that_nodes_for_multiple_btrees_are_compacted) inc_generation(); auto usage_before = store.getMemoryUsage(); for (uint32_t pass = 0; pass < 15; ++pass) { - auto to_hold = store.start_compact_worst_btree_nodes(); + CompactionStrategy compaction_strategy; + auto to_hold = store.start_compact_worst_btree_nodes(compaction_strategy); store.move_btree_nodes(refs); store.finish_compact_worst_btree_nodes(to_hold); inc_generation(); diff --git a/vespalib/src/tests/btree/btree_test.cpp b/vespalib/src/tests/btree/btree_test.cpp index 4af0b9672f2..bd4f4f8ee08 100644 --- a/vespalib/src/tests/btree/btree_test.cpp +++ b/vespalib/src/tests/btree/btree_test.cpp @@ -17,6 +17,7 @@ #include <vespa/vespalib/btree/btree.hpp> #include <vespa/vespalib/btree/btreestore.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/gtest/gtest.h> @@ -24,6 +25,7 @@ LOG_SETUP("btree_test"); using vespalib::GenerationHandler; +using vespalib::datastore::CompactionStrategy; using vespalib::datastore::EntryRef; namespace vespalib::btree { @@ -1599,8 +1601,9 @@ TEST_F(BTreeTest, require_that_compaction_works) auto memory_usage_before = t.getAllocator().getMemoryUsage(); t.foreach_key([&before_list](int key) { before_list.emplace_back(key); }); make_iterators(t, before_list, before_iterators); + CompactionStrategy compaction_strategy; for (int i = 0; i < 15; ++i) { - t.compact_worst(); + t.compact_worst(compaction_strategy); } inc_generation(g, t); auto memory_usage_after = t.getAllocator().getMemoryUsage(); |