aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2021-02-15 13:55:04 +0000
committerArne Juul <arnej@verizonmedia.com>2021-02-15 14:16:21 +0000
commitaf9d59c3fece374c5fe61575c67ad49ac5f84bb4 (patch)
treea1851a855e22e406f877bfb405e192232ec1e137 /searchcore/src/tests
parent805a313df05d2f347af321511527e06ea3cae92c (diff)
use size literals in searchcore
Diffstat (limited to 'searchcore/src/tests')
-rw-r--r--searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp5
-rw-r--r--searchcore/src/tests/proton/attribute/attribute_usage_filter/attribute_usage_filter_test.cpp10
-rw-r--r--searchcore/src/tests/proton/attribute/attributeflush_test.cpp5
-rw-r--r--searchcore/src/tests/proton/common/hw_info_sampler/hw_info_sampler_test.cpp3
-rw-r--r--searchcore/src/tests/proton/docsummary/docsummary.cpp7
-rw-r--r--searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp3
-rw-r--r--searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp5
-rw-r--r--searchcore/src/tests/proton/documentdb/documentdb_test.cpp5
-rw-r--r--searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp11
-rw-r--r--searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp3
-rw-r--r--searchcore/src/tests/proton/index/indexcollection_test.cpp3
-rw-r--r--searchcore/src/tests/proton/index/indexmanager_test.cpp3
-rw-r--r--searchcore/src/tests/proton/initializer/task_runner_test.cpp5
-rw-r--r--searchcore/src/tests/proton/matching/docid_range_scheduler/docid_range_scheduler_bench.cpp3
-rw-r--r--searchcore/src/tests/proton/matching/unpacking_iterators_optimizer/unpacking_iterators_optimizer_test.cpp3
-rw-r--r--searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp3
-rw-r--r--searchcore/src/tests/proton/server/memory_flush_config_updater/memory_flush_config_updater_test.cpp6
-rw-r--r--searchcore/src/tests/proton/server/memoryflush/memoryflush_test.cpp37
18 files changed, 63 insertions, 57 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 ef2c3c18753..ad25cf272c3 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
@@ -36,6 +36,7 @@
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/util/foreground_thread_executor.h>
#include <vespa/vespalib/util/foregroundtaskexecutor.h>
+#include <vespa/vespalib/util/size_literals.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
#include <vespa/log/log.h>
@@ -253,7 +254,7 @@ ParallelAttributeManager::ParallelAttributeManager(search::SerialNum configSeria
alloc_strategy(),
fastAccessAttributesOnly(false),
mgr(std::make_shared<AttributeManager::SP>()),
- masterExecutor(1, 128 * 1024),
+ masterExecutor(1, 128_Ki),
master(masterExecutor),
initializer(std::make_shared<AttributeManagerInitializer>(configSerialNum, documentMetaStoreInitTask,
documentMetaStore, baseAttrMgr, attrCfg,
@@ -261,7 +262,7 @@ ParallelAttributeManager::ParallelAttributeManager(search::SerialNum configSeria
fastAccessAttributesOnly, master, mgr))
{
documentMetaStore->setCommittedDocIdLimit(docIdLimit);
- vespalib::ThreadStackExecutor executor(3, 128 * 1024);
+ vespalib::ThreadStackExecutor executor(3, 128_Ki);
initializer::TaskRunner taskRunner(executor);
taskRunner.runTask(initializer);
}
diff --git a/searchcore/src/tests/proton/attribute/attribute_usage_filter/attribute_usage_filter_test.cpp b/searchcore/src/tests/proton/attribute/attribute_usage_filter/attribute_usage_filter_test.cpp
index b35027eac2a..bcfdca9da19 100644
--- a/searchcore/src/tests/proton/attribute/attribute_usage_filter/attribute_usage_filter_test.cpp
+++ b/searchcore/src/tests/proton/attribute/attribute_usage_filter/attribute_usage_filter_test.cpp
@@ -2,6 +2,7 @@
#include <vespa/log/log.h>
LOG_SETUP("attribute_usage_filter_test");
#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/util/size_literals.h>
#include <vespa/searchcore/proton/attribute/attribute_usage_filter.h>
#include <vespa/searchcore/proton/attribute/i_attribute_usage_listener.h>
@@ -14,14 +15,9 @@ using vespalib::AddressSpace;
namespace
{
-vespalib::AddressSpace enumStoreOverLoad(30 * 1024 * 1024 * UINT64_C(1024),
- 0,
- 32 * 1024 * 1024 * UINT64_C(1024));
-
-vespalib::AddressSpace multiValueOverLoad(127 * 1024 * 1024,
- 0,
- 128 * 1024 * 1024);
+vespalib::AddressSpace enumStoreOverLoad(30_Gi, 0, 32_Gi);
+vespalib::AddressSpace multiValueOverLoad(127_Mi, 0, 128_Mi);
class MyAttributeStats : public AttributeUsageStats
diff --git a/searchcore/src/tests/proton/attribute/attributeflush_test.cpp b/searchcore/src/tests/proton/attribute/attributeflush_test.cpp
index d6c40b0d70d..c20ef05b704 100644
--- a/searchcore/src/tests/proton/attribute/attributeflush_test.cpp
+++ b/searchcore/src/tests/proton/attribute/attributeflush_test.cpp
@@ -17,6 +17,7 @@
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/util/foreground_thread_executor.h>
#include <vespa/vespalib/util/foregroundtaskexecutor.h>
+#include <vespa/vespalib/util/size_literals.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
#include <thread>
@@ -77,7 +78,7 @@ public:
GateSP gate;
FlushHandler()
- : _executor(1, 65536),
+ : _executor(1, 64_Ki),
gate()
{ }
~FlushHandler();
@@ -581,7 +582,7 @@ Test::requireThatShrinkWorks()
EXPECT_EQUAL(1000u, av->getNumDocs());
EXPECT_EQUAL(100u, av->getCommittedDocIdLimit());
EXPECT_EQUAL(createSerialNum - 1, ft->getFlushedSerialNum());
- vespalib::ThreadStackExecutor exec(1, 128 * 1024);
+ vespalib::ThreadStackExecutor exec(1, 128_Ki);
vespalib::Executor::Task::UP task = ft->initFlush(53, std::make_shared<search::FlushToken>());
exec.execute(std::move(task));
exec.sync();
diff --git a/searchcore/src/tests/proton/common/hw_info_sampler/hw_info_sampler_test.cpp b/searchcore/src/tests/proton/common/hw_info_sampler/hw_info_sampler_test.cpp
index 78676d6abf1..0373d46a905 100644
--- a/searchcore/src/tests/proton/common/hw_info_sampler/hw_info_sampler_test.cpp
+++ b/searchcore/src/tests/proton/common/hw_info_sampler/hw_info_sampler_test.cpp
@@ -4,6 +4,7 @@
#include <vespa/searchcore/config/config-hwinfo.h>
#include <vespa/searchcore/proton/common/hw_info_sampler.h>
#include <vespa/searchlib/test/directory_handler.h>
+#include <vespa/vespalib/util/size_literals.h>
#include <vespa/vespalib/testkit/testapp.h>
using proton::HwInfoSampler;
@@ -17,7 +18,7 @@ using Config = HwInfoSampler::Config;
namespace {
const vespalib::string test_dir = "temp";
-constexpr uint64_t sampleLen = 1024 * 1024 * 40;
+constexpr uint64_t sampleLen = 40_Mi;
constexpr bool sharedDisk = false;
long time_point_to_long(Clock::time_point tp)
diff --git a/searchcore/src/tests/proton/docsummary/docsummary.cpp b/searchcore/src/tests/proton/docsummary/docsummary.cpp
index 38e5e08ec02..9529555a33c 100644
--- a/searchcore/src/tests/proton/docsummary/docsummary.cpp
+++ b/searchcore/src/tests/proton/docsummary/docsummary.cpp
@@ -36,6 +36,7 @@
#include <vespa/vespalib/data/slime/slime.h>
#include <vespa/vespalib/data/simple_buffer.h>
#include <vespa/vespalib/encoding/base64.h>
+#include <vespa/vespalib/util/size_literals.h>
#include <vespa/config-bucketspaces.h>
#include <vespa/vespalib/testkit/testapp.h>
#include <regex>
@@ -101,7 +102,7 @@ public:
: _dmk("summary"),
_bld(schema),
_repo(std::make_shared<DocumentTypeRepo>(_bld.getDocumentType())),
- _summaryExecutor(4, 128 * 1024),
+ _summaryExecutor(4, 128_Ki),
_noTlSyncer(),
_str(_summaryExecutor, "summary",
LogDocumentStore::Config(
@@ -193,7 +194,7 @@ public:
: _dmk(docTypeName),
_fileHeaderContext(),
_tls("tmp", 9013, ".", _fileHeaderContext),
- _summaryExecutor(8, 128*1024),
+ _summaryExecutor(8, 128_Ki),
_bucketExecutor(2),
_mkdirOk(FastOS_File::MakeDirectory("tmpdb")),
_queryLimiter(),
@@ -224,7 +225,7 @@ public:
DocTypeName(docTypeName), makeBucketSpace(), *b->getProtonConfigSP(), *this,
_summaryExecutor, _summaryExecutor, _bucketExecutor, _tls, _dummy, _fileHeaderContext,
std::make_unique<MemoryConfigStore>(),
- std::make_shared<vespalib::ThreadStackExecutor>(16, 128 * 1024), _hwInfo),
+ std::make_shared<vespalib::ThreadStackExecutor>(16, 128_Ki), _hwInfo),
_ddb->start();
_ddb->waitForOnlineState();
_aw = std::make_unique<AttributeWriter>(_ddb->getReadySubDB()->getAttributeManager());
diff --git a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp
index 53b280caa88..7ae828241c8 100644
--- a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp
@@ -26,6 +26,7 @@
#include <vespa/searchlib/index/dummyfileheadercontext.h>
#include <vespa/searchlib/transactionlog/nosyncproxy.h>
#include <vespa/vespalib/io/fileutil.h>
+#include <vespa/vespalib/util/size_literals.h>
using namespace config;
using namespace document;
@@ -165,7 +166,7 @@ Fixture::Fixture()
_queryLimiter(),
_constantValueFactory(),
_constantValueRepo(_constantValueFactory),
- _summaryExecutor(8, 128*1024),
+ _summaryExecutor(8, 128_Ki),
_pendingLidsForCommit(std::make_shared<PendingLidTracker>()),
_views(),
_resolver(),
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 5472682c503..6d39e5709be 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
@@ -29,6 +29,7 @@
#include <vespa/vespalib/test/insertion_operators.h>
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/util/lambdatask.h>
+#include <vespa/vespalib/util/size_literals.h>
using namespace cloud::config::filedistribution;
using namespace document;
@@ -293,7 +294,7 @@ struct FixtureBase
typename Traits::SubDB _subDb;
IFeedView::SP _tmpFeedView;
FixtureBase()
- : _summaryExecutor(1, 64 * 1024),
+ : _summaryExecutor(1, 64_Ki),
_writeService(_summaryExecutor),
_cfg(),
_bucketDB(std::make_shared<bucketdb::BucketDBOwner>()),
@@ -319,7 +320,7 @@ struct FixtureBase
void init() {
DocumentSubDbInitializer::SP task =
_subDb.createInitializer(*_snapshot->_cfg, Traits::configSerial(), IndexConfig());
- vespalib::ThreadStackExecutor executor(1, 1024 * 1024);
+ vespalib::ThreadStackExecutor executor(1, 1_Mi);
initializer::TaskRunner taskRunner(executor);
taskRunner.runTask(task);
auto sessionMgr = std::make_shared<SessionManager>(1);
diff --git a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
index 91046fbb567..d560a474ec4 100644
--- a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
@@ -25,6 +25,7 @@
#include <vespa/searchlib/index/dummyfileheadercontext.h>
#include <vespa/searchlib/transactionlog/translogserver.h>
#include <vespa/vespalib/data/slime/slime.h>
+#include <vespa/vespalib/util/size_literals.h>
#include <vespa/config-bucketspaces.h>
#include <vespa/vespalib/testkit/test_kit.h>
@@ -84,7 +85,7 @@ struct Fixture {
Fixture::Fixture()
: _dummy(),
_myDBOwner(),
- _summaryExecutor(8, 128*1024),
+ _summaryExecutor(8, 128_Ki),
_hwInfo(),
_bucketExecutor(2),
_db(),
@@ -110,7 +111,7 @@ Fixture::Fixture()
makeBucketSpace(),
*b->getProtonConfigSP(), _myDBOwner, _summaryExecutor, _summaryExecutor, _bucketExecutor, _tls, _dummy,
_fileHeaderContext, std::make_unique<MemoryConfigStore>(),
- std::make_shared<vespalib::ThreadStackExecutor>(16, 128 * 1024), _hwInfo);
+ std::make_shared<vespalib::ThreadStackExecutor>(16, 128_Ki), _hwInfo);
_db->start();
_db->waitForOnlineState();
}
diff --git a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp
index a7a8788b478..75f1ddd82a1 100644
--- a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp
@@ -29,17 +29,18 @@
#include <vespa/searchcore/proton/test/disk_mem_usage_notifier.h>
#include <vespa/searchcore/proton/test/mock_attribute_manager.h>
#include <vespa/searchcore/proton/test/test.h>
-#include <vespa/persistence/dummyimpl/dummy_bucket_executor.h>
+#include <vespa/config-attributes.h>
#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/document/test/make_bucket_space.h>
-#include <vespa/config-attributes.h>
-#include <vespa/vespalib/util/destructor_callbacks.h>
+#include <vespa/persistence/dummyimpl/dummy_bucket_executor.h>
#include <vespa/searchlib/common/idocumentmetastore.h>
#include <vespa/searchlib/index/docbuilder.h>
#include <vespa/vespalib/data/slime/slime.h>
#include <vespa/vespalib/testkit/testapp.h>
-#include <vespa/vespalib/util/lambdatask.h>
+#include <vespa/vespalib/util/destructor_callbacks.h>
#include <vespa/vespalib/util/gate.h>
+#include <vespa/vespalib/util/lambdatask.h>
+#include <vespa/vespalib/util/size_literals.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
#include <vespa/fastos/thread.h>
#include <unistd.h>
@@ -747,7 +748,7 @@ MyFeedHandler::appendOperation(const FeedOperation &op, DoneCallback)
}
MyExecutor::MyExecutor()
- : vespalib::ThreadStackExecutor(1, 128 * 1024),
+ : vespalib::ThreadStackExecutor(1, 128_Ki),
_threadId()
{
execute(makeLambdaTask([this]() {
diff --git a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp
index fd18979c6e0..8f2c82fb21b 100644
--- a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp
+++ b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp
@@ -21,6 +21,7 @@
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/test/insertion_operators.h>
#include <vespa/vespalib/util/exceptions.h>
+#include <vespa/vespalib/util/size_literals.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
#include <thread>
@@ -1896,7 +1897,7 @@ TEST(DocumentMetaStoreTest, shrink_via_flush_target_works)
EXPECT_TRUE(ft->getApproxMemoryGain().getBefore() >
ft->getApproxMemoryGain().getAfter());
- vespalib::ThreadStackExecutor exec(1, 128 * 1024);
+ vespalib::ThreadStackExecutor exec(1, 128_Ki);
vespalib::Executor::Task::UP task = ft->initFlush(11, std::make_shared<search::FlushToken>());
exec.execute(std::move(task));
exec.sync();
diff --git a/searchcore/src/tests/proton/index/indexcollection_test.cpp b/searchcore/src/tests/proton/index/indexcollection_test.cpp
index 113901e893f..a0007027d51 100644
--- a/searchcore/src/tests/proton/index/indexcollection_test.cpp
+++ b/searchcore/src/tests/proton/index/indexcollection_test.cpp
@@ -3,6 +3,7 @@
#include <vespa/searchcore/proton/matching/fakesearchcontext.h>
#include <vespa/searchcorespi/index/warmupindexcollection.h>
#include <vespa/vespalib/gtest/gtest.h>
+#include <vespa/vespalib/util/size_literals.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
#include <vespa/log/log.h>
@@ -87,7 +88,7 @@ public:
_source1(new MockIndexSearchable({3, 5})),
_source2(new MockIndexSearchable({7, 11})),
_fusion_source(new FakeIndexSearchable),
- _executor(1, 128*1024),
+ _executor(1, 128_Ki),
_warmup(new FakeIndexSearchable)
{}
~IndexCollectionTest() = default;
diff --git a/searchcore/src/tests/proton/index/indexmanager_test.cpp b/searchcore/src/tests/proton/index/indexmanager_test.cpp
index bb808879e80..a4e9b828870 100644
--- a/searchcore/src/tests/proton/index/indexmanager_test.cpp
+++ b/searchcore/src/tests/proton/index/indexmanager_test.cpp
@@ -20,6 +20,7 @@
#include <vespa/searchlib/test/index/mock_field_length_inspector.h>
#include <vespa/vespalib/gtest/gtest.h>
#include <vespa/vespalib/io/fileutil.h>
+#include <vespa/vespalib/util/size_literals.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
#include <vespa/vespalib/util/time.h>
#include <set>
@@ -316,7 +317,7 @@ TEST_F(IndexManagerTest, require_that_memory_index_is_flushed)
TEST_F(IndexManagerTest, require_that_large_memory_footprint_triggers_urgent_flush) {
using FlushStats = IndexMaintainer::FlushStats;
- constexpr size_t G = 1024*1024*1024l;
+ constexpr size_t G =1_Gi;
// IndexMaintainer::FlushStats small_15G(15*G, 0, 1, 1);
EXPECT_FALSE(IndexFlushTarget(_index_manager->getMaintainer()).needUrgentFlush());
EXPECT_FALSE(IndexFlushTarget(_index_manager->getMaintainer(), FlushStats(15*G)).needUrgentFlush());
diff --git a/searchcore/src/tests/proton/initializer/task_runner_test.cpp b/searchcore/src/tests/proton/initializer/task_runner_test.cpp
index f351b25cfca..2b14f0d3008 100644
--- a/searchcore/src/tests/proton/initializer/task_runner_test.cpp
+++ b/searchcore/src/tests/proton/initializer/task_runner_test.cpp
@@ -4,8 +4,9 @@ LOG_SETUP("task_runner_test");
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/searchcore/proton/initializer/initializer_task.h>
#include <vespa/searchcore/proton/initializer/task_runner.h>
-#include <vespa/vespalib/util/threadstackexecutor.h>
#include <vespa/vespalib/stllike/string.h>
+#include <vespa/vespalib/util/size_literals.h>
+#include <vespa/vespalib/util/threadstackexecutor.h>
#include <mutex>
using proton::initializer::InitializerTask;
@@ -113,7 +114,7 @@ struct Fixture
TaskRunner _taskRunner;
Fixture(uint32_t numThreads = 1)
- : _executor(numThreads, 128 * 1024),
+ : _executor(numThreads, 128_Ki),
_taskRunner(_executor)
{
}
diff --git a/searchcore/src/tests/proton/matching/docid_range_scheduler/docid_range_scheduler_bench.cpp b/searchcore/src/tests/proton/matching/docid_range_scheduler/docid_range_scheduler_bench.cpp
index 3093b3acf0f..ccf31032e30 100644
--- a/searchcore/src/tests/proton/matching/docid_range_scheduler/docid_range_scheduler_bench.cpp
+++ b/searchcore/src/tests/proton/matching/docid_range_scheduler/docid_range_scheduler_bench.cpp
@@ -4,6 +4,7 @@
#include <vespa/searchcore/proton/matching/docid_range_scheduler.h>
#include <vespa/vespalib/util/rendezvous.h>
#include <vespa/vespalib/util/benchmark_timer.h>
+#include <vespa/vespalib/util/size_literals.h>
#include <vespa/vespalib/util/stringfmt.h>
using namespace proton::matching;
@@ -146,7 +147,7 @@ struct SchedulerList {
factory_list.push_back(std::make_unique<TaskSchedulerFactory>(num_threads, 64));
factory_list.push_back(std::make_unique<TaskSchedulerFactory>(num_threads, 256));
factory_list.push_back(std::make_unique<TaskSchedulerFactory>(num_threads, 1024));
- factory_list.push_back(std::make_unique<TaskSchedulerFactory>(num_threads, 4096));
+ factory_list.push_back(std::make_unique<TaskSchedulerFactory>(num_threads, 4_Ki));
factory_list.push_back(std::make_unique<AdaptiveSchedulerFactory>(num_threads, 1000));
factory_list.push_back(std::make_unique<AdaptiveSchedulerFactory>(num_threads, 100));
factory_list.push_back(std::make_unique<AdaptiveSchedulerFactory>(num_threads, 10));
diff --git a/searchcore/src/tests/proton/matching/unpacking_iterators_optimizer/unpacking_iterators_optimizer_test.cpp b/searchcore/src/tests/proton/matching/unpacking_iterators_optimizer/unpacking_iterators_optimizer_test.cpp
index 9ecbd532389..f81d28fc3c1 100644
--- a/searchcore/src/tests/proton/matching/unpacking_iterators_optimizer/unpacking_iterators_optimizer_test.cpp
+++ b/searchcore/src/tests/proton/matching/unpacking_iterators_optimizer/unpacking_iterators_optimizer_test.cpp
@@ -6,6 +6,7 @@
#include <vespa/searchlib/query/tree/querybuilder.h>
#include <vespa/vespalib/data/smart_buffer.h>
#include <vespa/vespalib/data/output_writer.h>
+#include <vespa/vespalib/util/size_literals.h>
#include <string>
using namespace proton::matching;
@@ -69,7 +70,7 @@ struct DumpQuery : QueryVisitor {
};
std::string dump_query(Node &root) {
- SmartBuffer buffer(4096);
+ SmartBuffer buffer(4_Ki);
{
OutputWriter writer(buffer, 1024);
DumpQuery dumper(writer, 0);
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 4f8e8e8aa8c..16e2fc4b1a8 100644
--- a/searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp
+++ b/searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp
@@ -24,6 +24,7 @@
#include <vespa/searchcore/config/config-onnx-models.h>
#include <vespa/vespalib/gtest/gtest.h>
#include <vespa/searchcommon/common/schemaconfigurer.h>
+#include <vespa/vespalib/util/size_literals.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
#include <vespa/vespalib/test/insertion_operators.h>
#include <vespa/config-bucketspaces.h>
@@ -272,7 +273,7 @@ struct MyProtonConfigurerOwner : public IProtonConfigurerOwner,
MyProtonConfigurerOwner()
: IProtonConfigurerOwner(),
MyLog(),
- _executor(1, 128 * 1024),
+ _executor(1, 128_Ki),
_dbs()
{
}
diff --git a/searchcore/src/tests/proton/server/memory_flush_config_updater/memory_flush_config_updater_test.cpp b/searchcore/src/tests/proton/server/memory_flush_config_updater/memory_flush_config_updater_test.cpp
index 23c0269f754..56feb8cf5f4 100644
--- a/searchcore/src/tests/proton/server/memory_flush_config_updater/memory_flush_config_updater_test.cpp
+++ b/searchcore/src/tests/proton/server/memory_flush_config_updater/memory_flush_config_updater_test.cpp
@@ -2,6 +2,7 @@
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/searchcore/proton/server/memory_flush_config_updater.h>
+#include <vespa/vespalib/util/size_literals.h>
using namespace proton;
using vespa::config::search::core::ProtonConfig;
@@ -41,8 +42,7 @@ belowLimit()
return ResourceUsageState(0.7, 0.6);
}
-const HwInfo::Memory defaultMemory(8ul * 1024ul * 1024ul * 1024ul);
-constexpr size_t ONE_G = 1024ul * 1024ul * 1024ul;;
+const HwInfo::Memory defaultMemory(8_Gi);
struct Fixture
{
@@ -83,7 +83,7 @@ TEST("require that we use configured memory limits") {
TEST("require that we cap configured limits based on available memory") {
const uint64_t LIMIT = defaultMemory.sizeBytes()/4;
- constexpr uint64_t MEM_4G = 4 * ONE_G;
+ constexpr uint64_t MEM_4G = 4_Gi;
auto cfg = MemoryFlushConfigUpdater::convertConfig(getConfig(MEM_4G, MEM_4G, 30), defaultMemory);
EXPECT_EQUAL(cfg.maxGlobalMemory, LIMIT);
EXPECT_EQUAL(uint64_t(cfg.maxMemoryGain), LIMIT);
diff --git a/searchcore/src/tests/proton/server/memoryflush/memoryflush_test.cpp b/searchcore/src/tests/proton/server/memoryflush/memoryflush_test.cpp
index 305f5d8c9ba..15c549e19c9 100644
--- a/searchcore/src/tests/proton/server/memoryflush/memoryflush_test.cpp
+++ b/searchcore/src/tests/proton/server/memoryflush/memoryflush_test.cpp
@@ -5,18 +5,13 @@
#include <vespa/searchcore/proton/flushengine/tls_stats_map.h>
#include <vespa/searchcore/proton/test/dummy_flush_target.h>
#include <vespa/searchcore/proton/server/memoryflush.h>
+#include <vespa/vespalib/util/size_literals.h>
using vespalib::system_time;
using search::SerialNum;
using namespace proton;
using namespace searchcorespi;
-namespace{
-
-static constexpr uint64_t gibi = UINT64_C(1024) * UINT64_C(1024) * UINT64_C(1024);
-
-}
-
typedef IFlushTarget::MemoryGain MemoryGain;
typedef IFlushTarget::DiskGain DiskGain;
@@ -162,12 +157,12 @@ requireThatWeCanOrderByMemoryGain()
.add(createTargetM("t4", MemoryGain(20, 0)))
.add(createTargetM("t3", MemoryGain(15, 0)));
{ // target t4 has memoryGain >= maxMemoryGain
- MemoryFlush flush({1000, 20 * gibi, 1.0, 20, 1.0, minutes(1)});
+ MemoryFlush flush({1000, 20_Gi, 1.0, 20, 1.0, minutes(1)});
EXPECT_TRUE(assertOrder(StringList().add("t4").add("t3").add("t2").add("t1"),
flush.getFlushTargets(cb.list(), cb.tlsStats())));
}
{ // trigger totalMemoryGain >= globalMaxMemory
- MemoryFlush flush({50, 20 * gibi, 1.0, 1000, 1.0, minutes(1)});
+ MemoryFlush flush({50, 20_Gi, 1.0, 1000, 1.0, minutes(1)});
EXPECT_TRUE(assertOrder(StringList().add("t4").add("t3").add("t2").add("t1"),
flush.getFlushTargets(cb.list(), cb.tlsStats())));
}
@@ -186,13 +181,13 @@ requireThatWeCanOrderByDiskGainWithLargeValues()
.add(createTargetD("t3", DiskGain(before, 50 * milli))); // gain 50M
{ // target t4 has diskGain > bloatValue
// t4 gain: 55M / 100M = 0.55 -> bloat factor 0.54 to trigger
- MemoryFlush flush({1000, 20 * gibi, 10.0, 1000, 0.54, minutes(1)});
+ MemoryFlush flush({1000, 20_Gi, 10.0, 1000, 0.54, minutes(1)});
EXPECT_TRUE(assertOrder(StringList().add("t4").add("t3").add("t2").add("t1"),
flush.getFlushTargets(cb.list(), cb.tlsStats())));
}
{ // trigger totalDiskGain > totalBloatValue
// total gain: 160M / 4 * 100M = 0.4 -> bloat factor 0.39 to trigger
- MemoryFlush flush({1000, 20 * gibi, 0.39, 1000, 10.0, minutes(1)});
+ MemoryFlush flush({1000, 20_Gi, 0.39, 1000, 10.0, minutes(1)});
EXPECT_TRUE(assertOrder(StringList().add("t4").add("t3").add("t2").add("t1"),
flush.getFlushTargets(cb.list(), cb.tlsStats())));
}
@@ -210,13 +205,13 @@ requireThatWeCanOrderByDiskGainWithSmallValues()
// target bloat value calculation uses min 100M disk size
{ // target t4 has diskGain > bloatValue
// t4 gain: 55 / 100M = 0.0000055 -> bloat factor 0.0000054 to trigger
- MemoryFlush flush({1000, 20 * gibi, 10.0, 1000, 0.00000054, minutes(1)});
+ MemoryFlush flush({1000, 20_Gi, 10.0, 1000, 0.00000054, minutes(1)});
EXPECT_TRUE(assertOrder(StringList().add("t4").add("t3").add("t2").add("t1"),
flush.getFlushTargets(cb.list(), cb.tlsStats())));
}
{ // trigger totalDiskGain > totalBloatValue
// total gain: 160 / 100M = 0.0000016 -> bloat factor 0.0000015 to trigger
- MemoryFlush flush({1000, 20 * gibi, 0.0000015, 1000, 10.0, minutes(1)});
+ MemoryFlush flush({1000, 20_Gi, 0.0000015, 1000, 10.0, minutes(1)});
EXPECT_TRUE(assertOrder(StringList().add("t4").add("t3").add("t2").add("t1"),
flush.getFlushTargets(cb.list(), cb.tlsStats())));
}
@@ -234,12 +229,12 @@ requireThatWeCanOrderByAge()
.add(createTargetT("t3", now - seconds(15)));
{ // all targets have timeDiff >= maxTimeGain
- MemoryFlush flush({1000, 20 * gibi, 1.0, 1000, 1.0, seconds(2)}, start);
+ MemoryFlush flush({1000, 20_Gi, 1.0, 1000, 1.0, seconds(2)}, start);
EXPECT_TRUE(assertOrder(StringList().add("t4").add("t3").add("t2").add("t1"),
flush.getFlushTargets(cb.list(), cb.tlsStats())));
}
{ // no targets have timeDiff >= maxTimeGain
- MemoryFlush flush({1000, 20 * gibi, 1.0, 1000, 1.0, seconds(30)}, start);
+ MemoryFlush flush({1000, 20_Gi, 1.0, 1000, 1.0, seconds(30)}, start);
EXPECT_TRUE(assertOrder(StringList(), flush.getFlushTargets(cb.list(), cb.tlsStats())));
}
}
@@ -252,19 +247,19 @@ requireThatWeCanOrderByTlsSize()
ContextBuilder cb;
IFlushHandler::SP handler1(std::make_shared<MyFlushHandler>("handler1"));
IFlushHandler::SP handler2(std::make_shared<MyFlushHandler>("handler2"));
- cb.addTls("handler1", {20 * gibi, 1001, 2000 });
- cb.addTls("handler2", { 5 * gibi, 1001, 2000 });
+ cb.addTls("handler1", {20_Gi, 1001, 2000 });
+ cb.addTls("handler2", { 5_Gi, 1001, 2000 });
cb.add(std::make_shared<FlushContext>(handler1, createTargetT("t2", now - seconds(10), 1900), 2000)).
add(std::make_shared<FlushContext>(handler2, createTargetT("t1", now - seconds(5), 1000), 2000)).
add(std::make_shared<FlushContext>(handler1, createTargetT("t4", system_time(), 1000), 2000)).
add(std::make_shared<FlushContext>(handler2, createTargetT("t3", now - seconds(15), 1900), 2000));
{ // sum of tls sizes above limit, trigger sort order based on tls size
- MemoryFlush flush({1000, 3 * gibi, 1.0, 1000, 1.0, seconds(2)}, start);
+ MemoryFlush flush({1000, 3_Gi, 1.0, 1000, 1.0, seconds(2)}, start);
EXPECT_TRUE(assertOrder(StringList().add("t4").add("t1").add("t2").add("t3"),
flush.getFlushTargets(cb.list(), cb.tlsStats())));
}
{ // sum of tls sizes below limit
- MemoryFlush flush({1000, 30 * gibi, 1.0, 1000, 1.0, seconds(30)}, start);
+ MemoryFlush flush({1000, 30_Gi, 1.0, 1000, 1.0, seconds(30)}, start);
EXPECT_TRUE(assertOrder(StringList(), flush.getFlushTargets(cb.list(), cb.tlsStats())));
}
}
@@ -294,21 +289,21 @@ requireThatOrderTypeIsPreserved()
ContextBuilder cb;
cb.add(createTargetT("t2", ts2, 5), 14)
.add(createTargetD("t1", DiskGain(100 * milli, 80 * milli), 5));
- MemoryFlush flush({1000, 20 * gibi, 1.0, 1000, 0.19, seconds(30)});
+ MemoryFlush flush({1000, 20_Gi, 1.0, 1000, 0.19, seconds(30)});
EXPECT_TRUE(assertOrder(StringList().add("t1").add("t2"), flush.getFlushTargets(cb.list(), cb.tlsStats())));
}
{ // DISKBLOAT VS MEMORY
ContextBuilder cb;
cb.add(createTargetD("t2", DiskGain(100 * milli, 80 * milli)))
.add(createTargetM("t1", MemoryGain(100, 80)));
- MemoryFlush flush({1000, 20 * gibi, 1.0, 20, 0.19, seconds(30)});
+ MemoryFlush flush({1000, 20_Gi, 1.0, 20, 0.19, seconds(30)});
EXPECT_TRUE(assertOrder(StringList().add("t1").add("t2"), flush.getFlushTargets(cb.list(), cb.tlsStats())));
}
{ // urgent flush
ContextBuilder cb;
cb.add(createTargetF("t2", false))
.add(createTargetF("t1", true));
- MemoryFlush flush({1000, 20 * gibi, 1.0, 1000, 1.0, seconds(30)});
+ MemoryFlush flush({1000, 20_Gi, 1.0, 1000, 1.0, seconds(30)});
EXPECT_TRUE(assertOrder(StringList().add("t1").add("t2"), flush.getFlushTargets(cb.list(), cb.tlsStats())));
}
}