Skip to content

Commit 921cb68

Browse files
authored
fix(tiering): Small test fixes (#6133)
1 parent 7fcb149 commit 921cb68

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/server/tiered_storage_test.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include "base/flags.h"
1414
#include "base/logging.h"
1515
#include "facade/facade_test.h"
16-
#include "gtest/gtest.h"
1716
#include "server/engine_shard_set.h"
1817
#include "server/test_utils.h"
1918
#include "util/fibers/fibers.h"
@@ -28,6 +27,7 @@ ABSL_DECLARE_FLAG(float, tiered_offload_threshold);
2827
ABSL_DECLARE_FLAG(float, tiered_upload_threshold);
2928
ABSL_DECLARE_FLAG(unsigned, tiered_storage_write_depth);
3029
ABSL_DECLARE_FLAG(bool, tiered_experimental_cooling);
30+
ABSL_DECLARE_FLAG(uint64_t, registered_buffer_size);
3131
ABSL_DECLARE_FLAG(bool, tiered_experimental_hash_support);
3232

3333
namespace dfly {
@@ -51,6 +51,12 @@ class TieredStorageTest : public BaseFamilyTest {
5151
exit(0);
5252
}
5353

54+
// Disable registered buffers in half of the runs to use only small heap allocated buffers
55+
// to possibly catch out of bounds reads/writes with sanitizers
56+
if (absl::InsecureBitGen{}() % 2) {
57+
SetFlag(&FLAGS_registered_buffer_size, 0);
58+
}
59+
5460
SetFlag(&FLAGS_tiered_storage_write_depth, 15000);
5561
if (GetFlag(FLAGS_tiered_prefix).empty()) {
5662
SetFlag(&FLAGS_tiered_prefix, "/tmp/tiered_storage_test");

src/server/tiering/disk_storage.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ error_code DiskStorage::Open(string_view path) {
8989

9090
alloc_.AddStorage(0, kInitialSize);
9191

92+
// TODO(vlad): Even though this is called only once for regular use,
93+
// the testing code runs this initializer every time, never unregistering previous buffers
9294
auto* up = static_cast<UringProactor*>(ProactorBase::me());
9395
auto registered_buffer_size = absl::GetFlag(FLAGS_registered_buffer_size);
9496
if (registered_buffer_size > 0) {

src/server/tiering/op_manager_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ TEST_F(OpManagerTest, SimpleStashesWithReads) {
109109
}
110110

111111
EXPECT_EQ(GetStats().pending_stash_cnt, 100);
112-
113-
while (stashed_.size() < 100)
112+
while (GetStats().disk_stats.pending_ops > 0)
114113
util::ThisFiber::SleepFor(1ms);
115114

115+
EXPECT_EQ(stashed_.size(), 100u);
116116
EXPECT_EQ(GetStats().disk_stats.allocated_bytes, 100 * kPageSize) << GetStats();
117117

118118
for (unsigned i = 0; i < 100; i++) {

0 commit comments

Comments
 (0)