aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests/proton
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2021-02-02 15:34:28 +0100
committerTor Egge <Tor.Egge@broadpark.no>2021-02-02 15:34:28 +0100
commit3a4df233f6e4815ac356509ddfa0bc9076bb0376 (patch)
tree3ebc907d6f1197ca52e4e9505f7a00896864b3f9 /searchcore/src/tests/proton
parent4b3b7543f0f8acf3f72d25d76e36d63841de278a (diff)
Improve handling of changed alloc config.
Diffstat (limited to 'searchcore/src/tests/proton')
-rw-r--r--searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp10
-rw-r--r--searchcore/src/tests/proton/attribute/attribute_test.cpp2
-rw-r--r--searchcore/src/tests/proton/common/alloc_config/CMakeLists.txt9
-rw-r--r--searchcore/src/tests/proton/common/alloc_config/alloc_config_test.cpp35
-rw-r--r--searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp3
-rw-r--r--searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp2
6 files changed, 51 insertions, 10 deletions
diff --git a/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp b/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp
index d07c25c2a9e..3987a8685ea 100644
--- a/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp
+++ b/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp
@@ -232,9 +232,7 @@ struct ParallelAttributeManager
InitializerTask::SP documentMetaStoreInitTask;
BucketDBOwner::SP bucketDbOwner;
DocumentMetaStore::SP documentMetaStore;
- search::GrowStrategy attributeGrow;
- size_t attributeGrowNumDocs;
- search::CompactionStrategy attribute_compaction_strategy;
+ AllocStrategy alloc_strategy;
bool fastAccessAttributesOnly;
std::shared_ptr<AttributeManager::SP> mgr;
vespalib::ThreadStackExecutor masterExecutor;
@@ -251,16 +249,14 @@ ParallelAttributeManager::ParallelAttributeManager(search::SerialNum configSeria
: documentMetaStoreInitTask(std::make_shared<DummyInitializerTask>()),
bucketDbOwner(std::make_shared<BucketDBOwner>()),
documentMetaStore(std::make_shared<DocumentMetaStore>(bucketDbOwner)),
- attributeGrow(),
- attributeGrowNumDocs(1),
- attribute_compaction_strategy(),
+ alloc_strategy(),
fastAccessAttributesOnly(false),
mgr(std::make_shared<AttributeManager::SP>()),
masterExecutor(1, 128 * 1024),
master(masterExecutor),
initializer(std::make_shared<AttributeManagerInitializer>(configSerialNum, documentMetaStoreInitTask,
documentMetaStore, baseAttrMgr, attrCfg,
- attributeGrow, attributeGrowNumDocs, attribute_compaction_strategy,
+ alloc_strategy,
fastAccessAttributesOnly, master, mgr))
{
documentMetaStore->setCommittedDocIdLimit(docIdLimit);
diff --git a/searchcore/src/tests/proton/attribute/attribute_test.cpp b/searchcore/src/tests/proton/attribute/attribute_test.cpp
index a9829f3e5f7..ebd3e27aeca 100644
--- a/searchcore/src/tests/proton/attribute/attribute_test.cpp
+++ b/searchcore/src/tests/proton/attribute/attribute_test.cpp
@@ -535,7 +535,7 @@ public:
AttributeCollectionSpecFactory _factory;
AttributeCollectionSpecTest(bool fastAccessOnly)
: _builder(),
- _factory(search::GrowStrategy(), 100, search::CompactionStrategy(), fastAccessOnly)
+ _factory(AllocStrategy(search::GrowStrategy(), search::CompactionStrategy(), 100), fastAccessOnly)
{
addAttribute("a1", false);
addAttribute("a2", true);
diff --git a/searchcore/src/tests/proton/common/alloc_config/CMakeLists.txt b/searchcore/src/tests/proton/common/alloc_config/CMakeLists.txt
new file mode 100644
index 00000000000..26a2dc72cc2
--- /dev/null
+++ b/searchcore/src/tests/proton/common/alloc_config/CMakeLists.txt
@@ -0,0 +1,9 @@
+# Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+vespa_add_executable(searchcore_alloc_config_test_app TEST
+ SOURCES
+ alloc_config_test.cpp
+ DEPENDS
+ searchcore_pcommon
+ GTest::GTest
+)
+vespa_add_test(NAME searchcore_alloc_config_test_app COMMAND searchcore_alloc_config_test_app)
diff --git a/searchcore/src/tests/proton/common/alloc_config/alloc_config_test.cpp b/searchcore/src/tests/proton/common/alloc_config/alloc_config_test.cpp
new file mode 100644
index 00000000000..2c2e03dcfd0
--- /dev/null
+++ b/searchcore/src/tests/proton/common/alloc_config/alloc_config_test.cpp
@@ -0,0 +1,35 @@
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#include <vespa/searchcore/proton/common/alloc_config.h>
+#include <vespa/searchcore/proton/common/subdbtype.h>
+#include <vespa/vespalib/gtest/gtest.h>
+
+using proton::AllocConfig;
+using proton::AllocStrategy;
+using proton::SubDbType;
+using search::CompactionStrategy;
+using search::GrowStrategy;
+
+namespace {
+
+CompactionStrategy baseline_compaction_strategy(0.2, 0.25);
+
+GrowStrategy make_grow_strategy(uint32_t initial_docs) {
+ return GrowStrategy(initial_docs, 0.1, 1, 0.15);
+}
+
+AllocStrategy make_alloc_strategy(uint32_t initial_docs) {
+ return AllocStrategy(make_grow_strategy(initial_docs), baseline_compaction_strategy, 10000);
+}
+
+};
+
+TEST(AllocConfigTest, hello_world)
+{
+ AllocConfig config(make_alloc_strategy(10000000), 5, 2);
+ EXPECT_EQ(make_alloc_strategy(20000000), config.make_alloc_strategy(SubDbType::READY));
+ EXPECT_EQ(make_alloc_strategy(100000), config.make_alloc_strategy(SubDbType::REMOVED));
+ EXPECT_EQ(make_alloc_strategy(30000000), config.make_alloc_strategy(SubDbType::NOTREADY));
+}
+
+GTEST_MAIN_RUN_ALL_TESTS()
diff --git a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
index 64178303b40..40a9656ae41 100644
--- a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
@@ -123,8 +123,7 @@ struct MyStoreOnlyConfig
: _cfg(DocTypeName(DOCTYPE_NAME),
SUB_NAME,
BASE_DIR,
- search::GrowStrategy(),
- 0, search::CompactionStrategy(), 0, SubDbType::READY)
+ 0, SubDbType::READY)
{
}
};
diff --git a/searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp b/searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp
index 5a0cfc18c78..4f8e8e8aa8c 100644
--- a/searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp
+++ b/searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp
@@ -9,6 +9,7 @@
#include <vespa/config-summarymap.h>
#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/fileacquirer/config-filedistributorrpc.h>
+#include <vespa/searchcore/proton/common/alloc_config.h>
#include <vespa/searchcore/proton/server/bootstrapconfig.h>
#include <vespa/searchcore/proton/server/bootstrapconfigmanager.h>
#include <vespa/searchcore/proton/server/documentdbconfigmanager.h>
@@ -103,6 +104,7 @@ struct DBConfigFixture {
std::make_shared<DocumentDBMaintenanceConfig>(),
search::LogDocumentStore::Config(),
std::make_shared<const ThreadingServiceConfig>(ThreadingServiceConfig::make(1)),
+ std::make_shared<const AllocConfig>(),
configId,
docTypeName);
}