diff options
author | Arne H Juul <arnej27959@users.noreply.github.com> | 2021-02-16 13:30:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-16 13:30:33 +0100 |
commit | 0399c7f2cf9b75253e91a88e899bab82c36040dd (patch) | |
tree | 107c021de2a26f8cc077b304075812af3165a8cd /searchcore | |
parent | e355514ed46658e015aff3f933101281ae23e8c1 (diff) | |
parent | a29aa609abab633f01a19a7e7576be444a38328e (diff) |
Merge pull request #16495 from vespa-engine/arnej/add-size-literals
add literals for sizes in KB, MB, and GB
Diffstat (limited to 'searchcore')
34 files changed, 113 insertions, 95 deletions
diff --git a/searchcore/src/apps/tests/persistenceconformance_test.cpp b/searchcore/src/apps/tests/persistenceconformance_test.cpp index b47a1954c6f..d28e7a1f8d3 100644 --- a/searchcore/src/apps/tests/persistenceconformance_test.cpp +++ b/searchcore/src/apps/tests/persistenceconformance_test.cpp @@ -36,6 +36,7 @@ #include <vespa/config-indexschema.h> #include <vespa/config-summary.h> #include <vespa/vespalib/io/fileutil.h> +#include <vespa/vespalib/util/size_literals.h> #include <vespa/log/log.h> LOG_SETUP("persistenceconformance_test"); @@ -217,7 +218,7 @@ public: _fileHeaderContext, _config_stores.getConfigStore(docType.toString()), std::make_shared<vespalib::ThreadStackExecutor> - (16, 128 * 1024), + (16, 128_Ki), HwInfo()); } }; @@ -231,7 +232,7 @@ DocumentDBFactory::DocumentDBFactory(const vespalib::string &baseDir, int tlsLis _queryLimiter(), _clock(), _metricsWireService(), - _summaryExecutor(8, 128 * 1024), + _summaryExecutor(8, 128_Ki), _bucketExecutor(2) {} DocumentDBFactory::~DocumentDBFactory() = default; diff --git a/searchcore/src/apps/vespa-feed-bm/vespa_feed_bm.cpp b/searchcore/src/apps/vespa-feed-bm/vespa_feed_bm.cpp index d2f7ba4c2cd..846ff6ece08 100644 --- a/searchcore/src/apps/vespa-feed-bm/vespa_feed_bm.cpp +++ b/searchcore/src/apps/vespa-feed-bm/vespa_feed_bm.cpp @@ -74,6 +74,7 @@ #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/lambdatask.h> +#include <vespa/vespalib/util/size_literals.h> #include <getopt.h> #include <iostream> #include <thread> @@ -722,7 +723,7 @@ PersistenceProviderFixture::PersistenceProviderFixture(const BMParams& params) _clock(), _metrics_wire_service(), _config_stores(), - _summary_executor(8, 128 * 1024), + _summary_executor(8, 128_Ki), _document_db_owner(), _bucket_space(makeBucketSpace(_doc_type_name.getName())), _document_db(), @@ -813,7 +814,7 @@ PersistenceProviderFixture::create_document_db(const BMParams & params) _metrics_wire_service, _file_header_context, _config_stores.getConfigStore(_doc_type_name.toString()), - std::make_shared<vespalib::ThreadStackExecutor>(16, 128 * 1024), + std::make_shared<vespalib::ThreadStackExecutor>(16, 128_Ki), HwInfo()); _document_db->start(); _document_db->waitForOnlineState(); @@ -1327,7 +1328,7 @@ void benchmark_async_spi(const BMParams &bm_params) f.start_message_bus(); } f.create_feed_handler(bm_params); - vespalib::ThreadStackExecutor executor(bm_params.get_client_threads(), 128 * 1024); + vespalib::ThreadStackExecutor executor(bm_params.get_client_threads(), 128_Ki); auto put_feed = make_feed(executor, bm_params, [&f](BMRange range, BucketSelector bucket_selector) { return make_put_feed(f, range, bucket_selector); }, f.num_buckets(), "put"); auto update_feed = make_feed(executor, bm_params, [&f](BMRange range, BucketSelector bucket_selector) { return make_update_feed(f, range, bucket_selector); }, f.num_buckets(), "update"); auto remove_feed = make_feed(executor, bm_params, [&f](BMRange range, BucketSelector bucket_selector) { return make_remove_feed(f, range, bucket_selector); }, f.num_buckets(), "remove"); diff --git a/searchcore/src/apps/vespa-gen-testdocs/vespa-gen-testdocs.cpp b/searchcore/src/apps/vespa-gen-testdocs/vespa-gen-testdocs.cpp index 711a764abaf..86efd8496f2 100644 --- a/searchcore/src/apps/vespa-gen-testdocs/vespa-gen-testdocs.cpp +++ b/searchcore/src/apps/vespa-gen-testdocs/vespa-gen-testdocs.cpp @@ -4,6 +4,7 @@ #include <vespa/vespalib/stllike/string.h> #include <vespa/vespalib/stllike/hash_set.h> #include <vespa/vespalib/stllike/asciistream.h> +#include <vespa/vespalib/util/size_literals.h> #include <vespa/fastlib/io/bufferedfile.h> #include <vespa/fastos/app.h> #include <iostream> @@ -66,7 +67,7 @@ shafile(const string &baseDir, string fullFile(prependBaseDir(baseDir, file)); FastOS_File f; std::ostringstream os; - Alloc buf = Alloc::alloc_aligned(65536, 0x1000); + Alloc buf = Alloc::alloc_aligned(64_Ki, 0x1000); f.EnableDirectIO(); bool openres = f.OpenReadOnly(fullFile.c_str()); if (!openres) { 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..6049afbae27 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,11 +317,10 @@ 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; - // IndexMaintainer::FlushStats small_15G(15*G, 0, 1, 1); + // IndexMaintainer::FlushStats small_15G(15_Gi, 0, 1, 1); EXPECT_FALSE(IndexFlushTarget(_index_manager->getMaintainer()).needUrgentFlush()); - EXPECT_FALSE(IndexFlushTarget(_index_manager->getMaintainer(), FlushStats(15*G)).needUrgentFlush()); - EXPECT_TRUE(IndexFlushTarget(_index_manager->getMaintainer(), FlushStats(17*G)).needUrgentFlush()); + EXPECT_FALSE(IndexFlushTarget(_index_manager->getMaintainer(), FlushStats(15_Gi)).needUrgentFlush()); + EXPECT_TRUE(IndexFlushTarget(_index_manager->getMaintainer(), FlushStats(17_Gi)).needUrgentFlush()); } TEST_F(IndexManagerTest, require_that_multiple_flushes_gives_multiple_indexes) 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..cff44631c6c 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,8 +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; - auto cfg = MemoryFlushConfigUpdater::convertConfig(getConfig(MEM_4G, MEM_4G, 30), defaultMemory); + auto cfg = MemoryFlushConfigUpdater::convertConfig(getConfig(4_Gi, 4_Gi, 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()))); } } diff --git a/searchcore/src/vespa/searchcore/proton/common/hw_info_sampler.cpp b/searchcore/src/vespa/searchcore/proton/common/hw_info_sampler.cpp index cdec0b440c4..5627b27bb32 100644 --- a/searchcore/src/vespa/searchcore/proton/common/hw_info_sampler.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/hw_info_sampler.cpp @@ -7,6 +7,7 @@ #include <vespa/searchcore/config/config-hwinfo.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/util/time.h> +#include <vespa/vespalib/util/size_literals.h> #include <filesystem> #include <thread> #include <vespa/log/log.h> @@ -80,7 +81,7 @@ double measureDiskWriteSpeed(const vespalib::string &path, { FastOS_File testFile; vespalib::string fileName = path + "/hwinfo-writespeed"; - size_t bufferLen = 1024 * 1024; + size_t bufferLen = 1_Mi; Alloc buffer(Alloc::allocMMap(bufferLen)); memset(buffer.get(), 0, buffer.size()); testFile.EnableDirectIO(); @@ -100,7 +101,7 @@ double measureDiskWriteSpeed(const vespalib::string &path, testFile.Close(); vespalib::unlink(fileName); double elapsed = vespalib::to_s(after - before); - double diskWriteSpeed = diskWriteLen / elapsed / 1024 / 1024; + double diskWriteSpeed = diskWriteLen / elapsed / 1_Mi; return diskWriteSpeed; } @@ -148,7 +149,7 @@ HwInfoSampler::setDiskWriteSpeed(const vespalib::string &path, const Config &con void HwInfoSampler::sampleDiskWriteSpeed(const vespalib::string &path, const Config &config) { - size_t minDiskWriteLen = 1024u * 1024u; + size_t minDiskWriteLen = 1_Mi; size_t diskWriteLen = config.diskSampleWriteSize; diskWriteLen = std::max(diskWriteLen, minDiskWriteLen); _sampleTime = Clock::now(); diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.cpp b/searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.cpp index 0dbffe2402a..4263b26dc6b 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.cpp +++ b/searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.cpp @@ -7,6 +7,7 @@ #include <vespa/searchlib/common/location.h> #include <vespa/searchlib/common/matching_elements.h> #include <vespa/vespalib/data/slime/slime.h> +#include <vespa/vespalib/util/size_literals.h> #include <vespa/vespalib/util/stringfmt.h> #include <vespa/log/log.h> @@ -65,7 +66,7 @@ DocsumReply::UP DocsumContext::createReply() { auto reply = std::make_unique<DocsumReply>(); - search::RawBuf buf(4096); + search::RawBuf buf(4_Ki); _docsumWriter.InitState(_attrMgr, &_docsumState); reply->docsums.resize(_docsumState._docsumcnt); SymbolTable::UP symbols = std::make_unique<SymbolTable>(); diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp index 50162936835..16756af9d01 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp +++ b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp @@ -9,6 +9,7 @@ #include <vespa/searchcore/proton/common/eventlogger.h> #include <vespa/searchlib/common/flush_token.h> #include <vespa/vespalib/util/jsonwriter.h> +#include <vespa/vespalib/util/size_literals.h> #include <thread> #include <vespa/log/log.h> @@ -82,10 +83,10 @@ FlushEngine::FlushEngine(std::shared_ptr<flushengine::ITlsStatsFactory> tlsStats _maxConcurrent(numThreads), _idleInterval(idleInterval), _taskId(0), - _threadPool(128 * 1024), + _threadPool(128_Ki), _strategy(std::move(strategy)), _priorityStrategy(), - _executor(numThreads, 128 * 1024, flush_engine_executor), + _executor(numThreads, 128_Ki, flush_engine_executor), _lock(), _cond(), _handlers(), diff --git a/searchcore/src/vespa/searchcore/proton/initializer/task_runner.cpp b/searchcore/src/vespa/searchcore/proton/initializer/task_runner.cpp index 089294967ee..5d72a0fc503 100644 --- a/searchcore/src/vespa/searchcore/proton/initializer/task_runner.cpp +++ b/searchcore/src/vespa/searchcore/proton/initializer/task_runner.cpp @@ -2,6 +2,7 @@ #include "task_runner.h" #include <vespa/vespalib/util/lambdatask.h> +#include <vespa/vespalib/util/size_literals.h> #include <vespa/vespalib/util/threadstackexecutor.h> #include <future> @@ -93,7 +94,7 @@ TaskRunner::internalRunTasks(const TaskList &taskList, Context::SP context) void TaskRunner::runTask(InitializerTask::SP task) { - vespalib::ThreadStackExecutor executor(1, 128 * 1024, task_runner); + vespalib::ThreadStackExecutor executor(1, 128_Ki, task_runner); std::promise<void> promise; auto future = promise.get_future(); runTask(task, executor, makeLambdaTask([&]() { promise.set_value(); })); diff --git a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp index 91ef4b51a40..16946c398b6 100644 --- a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp +++ b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp @@ -5,6 +5,7 @@ #include <vespa/vespalib/data/slime/cursor.h> #include <vespa/vespalib/data/smart_buffer.h> #include <vespa/vespalib/data/slime/binary_format.h> +#include <vespa/vespalib/util/size_literals.h> #include <vespa/log/log.h> @@ -47,7 +48,7 @@ MatchEngine::MatchEngine(size_t numThreads, size_t threadsPerSearch, uint32_t di _distributionKey(distributionKey), _closed(false), _handlers(), - _executor(std::max(size_t(1), numThreads / threadsPerSearch), 256 * 1024, match_engine_executor), + _executor(std::max(size_t(1), numThreads / threadsPerSearch), 256_Ki, match_engine_executor), _threadBundlePool(std::max(size_t(1), threadsPerSearch)), _nodeUp(false) { @@ -146,7 +147,7 @@ MatchEngine::performSearch(search::engine::SearchRequest::Source req, ret->request->trace().getRoot().setLong("distribution-key", _distributionKey); ret->request->trace().done(); search::fef::Properties & trace = ret->propertiesMap.lookupCreate("trace"); - vespalib::SmartBuffer output(4096); + vespalib::SmartBuffer output(4_Ki); vespalib::slime::BinaryFormat::encode(ret->request->trace().getSlime(), output); trace.add("slime", output.obtain().make_stringref()); } diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp index de692ebe68a..8899162d66d 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp @@ -36,6 +36,7 @@ #include <vespa/searchlib/engine/searchreply.h> #include <vespa/vespalib/util/destructor_callbacks.h> #include <vespa/vespalib/util/exceptions.h> +#include <vespa/vespalib/util/size_literals.h> #include <vespa/log/log.h> #include <vespa/searchcorespi/index/warmupconfig.h> @@ -68,7 +69,7 @@ using searchcorespi::IFlushTarget; namespace proton { namespace { -constexpr uint32_t indexing_thread_stack_size = 128 * 1024; +constexpr uint32_t indexing_thread_stack_size = 128_Ki; index::IndexConfig makeIndexConfig(const ProtonConfig::Index & cfg) { diff --git a/searchcore/src/vespa/searchcore/proton/server/memory_flush_config_updater.cpp b/searchcore/src/vespa/searchcore/proton/server/memory_flush_config_updater.cpp index fd880db5655..1e60bb4f388 100644 --- a/searchcore/src/vespa/searchcore/proton/server/memory_flush_config_updater.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/memory_flush_config_updater.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "memory_flush_config_updater.h" +#include <vespa/vespalib/util/size_literals.h> #include <vespa/log/log.h> LOG_SETUP(".proton.server.memory_flush_config_updater"); diff --git a/searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp b/searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp index 9fa90e50fdf..a3f27aa7a92 100644 --- a/searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp @@ -5,6 +5,7 @@ #include <vespa/vespalib/stllike/asciistream.h> #include <vespa/vespalib/stllike/hash_set.h> #include <vespa/vespalib/util/time.h> +#include <vespa/vespalib/util/size_literals.h> #include <algorithm> #include <vespa/log/log.h> @@ -30,8 +31,6 @@ getName(const IFlushHandler & handler, const IFlushTarget & target) return (handler.getName() + "." + target.getName()); } -static constexpr uint64_t gibi = UINT64_C(1024) * UINT64_C(1024) * UINT64_C(1024); - uint64_t estimateNeededTlsSizeForFlushTarget(const TlsStats &tlsStats, SerialNum flushedSerialNum) { @@ -52,10 +51,10 @@ estimateNeededTlsSizeForFlushTarget(const TlsStats &tlsStats, SerialNum flushedS } MemoryFlush::Config::Config() - : maxGlobalMemory(4000*1024*1024ul), - maxGlobalTlsSize(20 * gibi), + : maxGlobalMemory(4000_Mi), + maxGlobalTlsSize(20_Gi), globalDiskBloatFactor(0.2), - maxMemoryGain(1000*1024*1024ul), + maxMemoryGain(1000_Mi), diskBloatFactor(0.2), maxTimeGain(std::chrono::hours(24)) { } diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp index f50fd7e2a07..f6c09b6b7c4 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp @@ -39,6 +39,7 @@ #include <vespa/vespalib/util/lambdatask.h> #include <vespa/vespalib/util/mmap_file_allocator_factory.h> #include <vespa/vespalib/util/random.h> +#include <vespa/vespalib/util/size_literals.h> #include <vespa/searchlib/aggregation/forcelink.hpp> #include <vespa/searchlib/expression/forcelink.hpp> @@ -224,7 +225,7 @@ Proton::Proton(const config::ConfigUri & configUri, _stateServer(), // This executor can only have 1 thread as it is used for // serializing startup. - _executor(1, 128 * 1024), + _executor(1, 128_Ki), _protonDiskLayout(), _protonConfigurer(_executor, *this, _protonDiskLayout), _protonConfigFetcher(configUri, _protonConfigurer, subscribeTimeout), @@ -233,7 +234,7 @@ Proton::Proton(const config::ConfigUri & configUri, _compile_cache_executor_binding(), _queryLimiter(), _clock(0.001), - _threadPool(128 * 1024), + _threadPool(128_Ki), _distributionKey(-1), _isInitializing(true), _abortInit(false), @@ -319,14 +320,14 @@ Proton::init(const BootstrapConfig::SP & configSnapshot) protonConfig.visit.ignoremaxbytes); vespalib::string fileConfigId; - _warmupExecutor = std::make_unique<vespalib::ThreadStackExecutor>(4, 128*1024, index_warmup_executor); + _warmupExecutor = std::make_unique<vespalib::ThreadStackExecutor>(4, 128_Ki, index_warmup_executor); const size_t sharedThreads = derive_shared_threads(protonConfig, hwInfo.cpu()); - _sharedExecutor = std::make_shared<vespalib::BlockingThreadStackExecutor>(sharedThreads, 128*1024, sharedThreads*16, proton_shared_executor); + _sharedExecutor = std::make_shared<vespalib::BlockingThreadStackExecutor>(sharedThreads, 128_Ki, sharedThreads*16, proton_shared_executor); _compile_cache_executor_binding = vespalib::eval::CompileCache::bind(_sharedExecutor); InitializeThreads initializeThreads; if (protonConfig.initialize.threads > 0) { - initializeThreads = std::make_shared<vespalib::ThreadStackExecutor>(protonConfig.initialize.threads, 128 * 1024, initialize_executor); + initializeThreads = std::make_shared<vespalib::ThreadStackExecutor>(protonConfig.initialize.threads, 128_Ki, initialize_executor); _initDocumentDbsInSequence = (protonConfig.initialize.threads == 1); } _protonConfigurer.applyInitialConfig(initializeThreads); @@ -601,7 +602,7 @@ Proton::addDocumentDB(const document::DocumentType &docType, // If configured value for initialize threads was 0, or we // are performing a reconfig after startup has completed, then use // 1 thread per document type. - initializeThreads = std::make_shared<vespalib::ThreadStackExecutor>(1, 128 * 1024); + initializeThreads = std::make_shared<vespalib::ThreadStackExecutor>(1, 128_Ki); } auto ret = std::make_shared<DocumentDB>(config.basedir + "/documents", documentDBConfig, config.tlsspec, _queryLimiter, _clock, docTypeName, bucketSpace, config, *this, diff --git a/searchcore/src/vespa/searchcore/proton/server/proton_config_fetcher.cpp b/searchcore/src/vespa/searchcore/proton/server/proton_config_fetcher.cpp index 8820602d816..dd7112dbfe6 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton_config_fetcher.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/proton_config_fetcher.cpp @@ -6,6 +6,7 @@ #include "i_proton_configurer.h" #include <vespa/config/common/exceptions.h> #include <vespa/vespalib/util/exceptions.h> +#include <vespa/vespalib/util/size_literals.h> #include <thread> #include <cassert> @@ -25,7 +26,7 @@ ProtonConfigFetcher::ProtonConfigFetcher(const config::ConfigUri & configUri, IP _owner(owner), _mutex(), _dbManagerMap(), - _threadPool(128 * 1024, 1), + _threadPool(128_Ki, 1), _oldDocumentTypeRepos(), _currentDocumentTypeRepo() { diff --git a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp index f28526a4b2a..bc8cc7c55c9 100644 --- a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp @@ -5,6 +5,7 @@ #include <vespa/searchcore/proton/summaryengine/docsum_by_slime.h> #include <vespa/searchcore/proton/matchengine/matchengine.h> #include <vespa/vespalib/util/lambdatask.h> +#include <vespa/vespalib/util/size_literals.h> #include <vespa/fnet/frt/supervisor.h> #include <vespa/fnet/transport.h> @@ -198,7 +199,7 @@ RPCHooksBase::RPCHooksBase(Params ¶ms) _regAPI(*_orb, slobrok::ConfiguratorFactory(params.slobrok_config)), _stateLock(), _stateCond(), - _executor(params.numRpcThreads, 128 * 1024, proton_rpc_executor) + _executor(params.numRpcThreads, 128_Ki, proton_rpc_executor) { } void diff --git a/searchcore/src/vespa/searchcore/proton/summaryengine/docsum_by_slime.cpp b/searchcore/src/vespa/searchcore/proton/summaryengine/docsum_by_slime.cpp index edc3b86d9d3..8457d697613 100644 --- a/searchcore/src/vespa/searchcore/proton/summaryengine/docsum_by_slime.cpp +++ b/searchcore/src/vespa/searchcore/proton/summaryengine/docsum_by_slime.cpp @@ -1,10 +1,11 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "docsum_by_slime.h" -#include <vespa/vespalib/util/compressor.h> -#include <vespa/searchlib/util/slime_output_raw_buf_adapter.h> -#include <vespa/searchlib/common/packets.h> #include <vespa/fnet/frt/rpcrequest.h> +#include <vespa/searchlib/common/packets.h> +#include <vespa/searchlib/util/slime_output_raw_buf_adapter.h> #include <vespa/vespalib/data/databuffer.h> +#include <vespa/vespalib/util/compressor.h> +#include <vespa/vespalib/util/size_literals.h> #include <vespa/log/log.h> LOG_SETUP(".proton.summaryengine.docsum_by_slime"); @@ -123,7 +124,7 @@ DocsumByRPC::getDocsums(FRT_RPCRequest & req) vespalib::Slime::UP summaries = _slimeDocsumServer.getDocsums(summariesToGet.get()); assert(summaries); // Mandatory, not optional. - search::RawBuf rbuf(4096); + search::RawBuf rbuf(4_Ki); search::SlimeOutputRawBufAdapter output(rbuf); BinaryFormat::encode(*summaries, output); ConstBufferRef buf(rbuf.GetDrainPos(), rbuf.GetUsedLen()); diff --git a/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp b/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp index fcdb9b25e62..934e6445bd5 100644 --- a/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp +++ b/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "summaryengine.h" #include <vespa/vespalib/data/slime/slime.h> +#include <vespa/vespalib/util/size_literals.h> #include <vespa/log/log.h> LOG_SETUP(".proton.summaryengine.summaryengine"); @@ -62,7 +63,7 @@ SummaryEngine::SummaryEngine(size_t numThreads) : _lock(), _closed(false), _handlers(), - _executor(numThreads, 128 * 1024, summary_engine_executor), + _executor(numThreads, 128_Ki, summary_engine_executor), _metrics(std::make_unique<DocsumMetrics>()) { } |