From 65790df4dfb9e5c0ab3e1fd90fa117351bb624ef Mon Sep 17 00:00:00 2001 From: Tor Brede Vekterli Date: Tue, 9 Apr 2024 13:38:16 +0000 Subject: Ensure visibility of max batch size reconfiguration in persistence thread --- .../src/tests/persistence/filestorage/filestormanagertest.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp index 56149bbc14d..43e6bbe1c89 100644 --- a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp +++ b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp @@ -411,9 +411,18 @@ TEST_F(FileStorManagerTest, feed_op_batch_updates_bucket_db_and_reply_bucket_inf c.manager->getFileStorHandler().set_max_feed_op_batch_size(10); BucketId bucket_id(16, 1); createBucket(bucket_id); + // The persistence thread is already running at this point, and may not have observed the max + // batch size configuration change. Trigger an implicit thread barrier by roundtripping a message. + { + auto get = make_get_command(120, "id:foo:testdoctype1:n=1:0"); + get->setAddress(_storage3); + c.top.sendDown(get); + c.top.waitForMessages(1, _waitTime); + (void)c.top.getRepliesOnce(); + } constexpr uint32_t n = 10; { - // Barrier to prevent any messages from being processed until we've enqueued all puts + // Explicit barrier to prevent any messages from being processed until we've enqueued all puts auto guard = c.manager->getFileStorHandler().lock(makeDocumentBucket(bucket_id), LockingRequirements::Exclusive); for (uint32_t i = 0; i < n; ++i) { auto put = make_put_command(120, vespalib::make_string("id:foo:testdoctype1:n=1:%u", i), Timestamp(1000) + i); -- cgit v1.2.3