diff options
author | Tor Egge <Tor.Egge@online.no> | 2021-04-09 13:28:14 +0200 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2021-04-09 13:34:07 +0200 |
commit | 4977b304ca6e5468af47b91bd8526e1615a34fe1 (patch) | |
tree | e44fbfa3e61f518128cc88f1d51b36c5a5e88cd3 /searchlib/src/tests | |
parent | cef30b122011ac98ef5b398eed50df942d95d9c6 (diff) |
Add CompactionStrategy methods to determine if compaction should be performed.
Diffstat (limited to 'searchlib/src/tests')
3 files changed, 4 insertions, 9 deletions
diff --git a/searchlib/src/tests/attribute/compaction/attribute_compaction_test.cpp b/searchlib/src/tests/attribute/compaction/attribute_compaction_test.cpp index c3bb9481f0f..a029373821a 100644 --- a/searchlib/src/tests/attribute/compaction/attribute_compaction_test.cpp +++ b/searchlib/src/tests/attribute/compaction/attribute_compaction_test.cpp @@ -237,8 +237,7 @@ TEST_F("Compaction limits address space usage (dead) when free lists are NOT use { populate_and_hammer(f, true); AddressSpace afterSpace = f.getMultiValueAddressSpaceUsage("after"); - // DEAD_ARRAYS_SLACK in multi value mapping is is 64k - EXPECT_GREATER(65536u, afterSpace.dead()); + EXPECT_GREATER(search::CompactionStrategy::DEAD_ADDRESS_SPACE_SLACK, afterSpace.dead()); } TEST_F("Compaction is not executed when free lists are used", @@ -267,8 +266,7 @@ TEST_F("Compaction is peformed when compaction strategy is changed to enable com f._v->commit(); // new commit might trigger further compaction after2 = f.getMultiValueAddressSpaceUsage("after2"); } - // DEAD_ARRAYS_SLACK in multi value mapping is is 64k - EXPECT_GREATER(65536u, after2.dead()); + EXPECT_GREATER(search::CompactionStrategy::DEAD_ADDRESS_SPACE_SLACK, after2.dead()); } TEST_MAIN() { TEST_RUN_ALL(); } diff --git a/searchlib/src/tests/attribute/enum_attribute_compaction/enum_attribute_compaction_test.cpp b/searchlib/src/tests/attribute/enum_attribute_compaction/enum_attribute_compaction_test.cpp index bd1b63c01d8..2faaa371fca 100644 --- a/searchlib/src/tests/attribute/enum_attribute_compaction/enum_attribute_compaction_test.cpp +++ b/searchlib/src/tests/attribute/enum_attribute_compaction/enum_attribute_compaction_test.cpp @@ -174,9 +174,8 @@ template <typename VectorType> void CompactionTest<VectorType>::test_enum_store_compaction() { - constexpr size_t DEAD_BYTES_SLACK = 0x10000u; constexpr uint32_t canary_stride = 256; - uint32_t dead_limit = DEAD_BYTES_SLACK / 8; + uint32_t dead_limit = search::CompactionStrategy::DEAD_BYTES_SLACK / 8; uint32_t doc_count = dead_limit * 3; if (_v->hasMultiValue() || std::is_same_v<VectorType,StringAttribute>) { doc_count /= 2; diff --git a/searchlib/src/tests/attribute/reference_attribute/reference_attribute_test.cpp b/searchlib/src/tests/attribute/reference_attribute/reference_attribute_test.cpp index a8a34b0ba8a..f45c3e4a1a0 100644 --- a/searchlib/src/tests/attribute/reference_attribute/reference_attribute_test.cpp +++ b/searchlib/src/tests/attribute/reference_attribute/reference_attribute_test.cpp @@ -45,8 +45,6 @@ vespalib::string doc1("id:test:music::1"); vespalib::string doc2("id:test:music::2"); vespalib::string doc3("id:test:music::3"); -constexpr size_t DEAD_BYTES_SLACK = 0x10000u; - } struct MyGidToLidMapperFactory : public search::attribute::test::MockGidToLidMapperFactory { @@ -178,7 +176,7 @@ struct ReferenceAttributeTest : public ::testing::Test { search::attribute::Status newStatus = oldStatus; uint64_t iter = 0; AttributeGuard guard(_attr); - uint64_t dropCount = DEAD_BYTES_SLACK / sizeof(Reference); + uint64_t dropCount = search::CompactionStrategy::DEAD_BYTES_SLACK / sizeof(Reference); for (; iter < iterLimit; ++iter) { clear(2); set(2, toGid(doc2)); |