14
14
15
15
#include " absl/cleanup/cleanup.h"
16
16
#include " absl/flags/internal/flag.h"
17
+ #include " base/flag_utils.h"
17
18
#include " base/flags.h"
18
19
#include " base/logging.h"
19
- #include " facade/flag_utils.h"
20
20
#include " server/common.h"
21
21
#include " server/db_slice.h"
22
22
#include " server/engine_shard_set.h"
29
29
30
30
using namespace facade ;
31
31
32
+ using AtLeast64 = base::ConstrainedNumericFlagValue<size_t , 64 >; // ABSL_FLAG breaks with commas
33
+ ABSL_FLAG (AtLeast64, tiered_min_value_size, 64 ,
34
+ " Minimum size of values eligible for offloading. Must be at least 64" );
35
+
32
36
ABSL_FLAG (bool , tiered_experimental_cooling, true ,
33
37
" If true, uses intermediate cooling layer "
34
38
" when offloading values to storage" );
@@ -467,6 +471,7 @@ float TieredStorage::WriteDepthUsage() const {
467
471
468
472
void TieredStorage::UpdateFromFlags () {
469
473
config_ = {
474
+ .min_value_size = absl::GetFlag (FLAGS_tiered_min_value_size),
470
475
.experimental_cooling = absl::GetFlag (FLAGS_tiered_experimental_cooling),
471
476
.write_depth_limit = absl::GetFlag (FLAGS_tiered_storage_write_depth),
472
477
.offload_threshold = absl::GetFlag (FLAGS_tiered_offload_threshold),
@@ -475,8 +480,9 @@ void TieredStorage::UpdateFromFlags() {
475
480
}
476
481
477
482
std::vector<std::string> TieredStorage::GetMutableFlagNames () {
478
- return facade::GetFlagNames (FLAGS_tiered_experimental_cooling, FLAGS_tiered_storage_write_depth,
479
- FLAGS_tiered_offload_threshold, FLAGS_tiered_upload_threshold);
483
+ return base::GetFlagNames (FLAGS_tiered_min_value_size, FLAGS_tiered_experimental_cooling,
484
+ FLAGS_tiered_storage_write_depth, FLAGS_tiered_offload_threshold,
485
+ FLAGS_tiered_upload_threshold);
480
486
}
481
487
482
488
bool TieredStorage::ShouldOffload () const {
@@ -564,7 +570,7 @@ size_t TieredStorage::ReclaimMemory(size_t goal) {
564
570
bool TieredStorage::ShouldStash (const PrimeValue& pv) const {
565
571
const auto & disk_stats = op_manager_->GetStats ().disk_stats ;
566
572
return !pv.IsExternal () && !pv.HasStashPending () && pv.ObjType () == OBJ_STRING &&
567
- pv.Size () >= kMinValueSize &&
573
+ pv.Size () >= config_. min_value_size &&
568
574
disk_stats.allocated_bytes + tiering::kPageSize + pv.Size () < disk_stats.max_file_size ;
569
575
}
570
576
0 commit comments