:Default: ``none``
:Values: ``none``, ``compressible``, ``incompressible``
+``rbd read from replica policy``
+
+:Description: policy for determining which OSD will receive read operations. If set to `default`, the primary OSD will always be used for read operations. If set to `balance`, read operations will be sent to a randomly selected OSD within the replica set. If set to `localize`, read operations will be sent to the closest OSD as determined by the CRUSH map. Note: this feature requires the cluster to be configured with a minimum compatible OSD release of Octopus.
+:Type: Enum
+:Required: No
+:Default: ``default``
+:Values: ``default``, ``balance``, ``localize``
+
Cache Settings
=======================
.set_description("Compression hint to send to the OSDs during writes")
.set_flag(Option::FLAG_RUNTIME),
+ Option("rbd_read_from_replica_policy", Option::TYPE_STR, Option::LEVEL_BASIC)
+ .set_enum_allowed({"default", "balance", "localize"})
+ .set_default("default")
+ .set_description("Read replica policy send to the OSDS during reads")
+ .set_flag(Option::FLAG_RUNTIME),
+
Option("rbd_tracing", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(false)
.set_description("true if LTTng-UST tracepoints should be enabled"),
}
int ImageCtx::get_read_flags(snap_t snap_id) {
- int flags = librados::OPERATION_NOFLAG | extra_read_flags;
+ int flags = librados::OPERATION_NOFLAG | read_flags;
+ if (flags != 0)
+ return flags;
+
+ flags = librados::OPERATION_NOFLAG | extra_read_flags;
if (snap_id == LIBRADOS_SNAP_HEAD)
return flags;
alloc_hint_flags |= librados::ALLOC_HINT_FLAG_INCOMPRESSIBLE;
}
+ librados::Rados rados(md_ctx);
+ int8_t require_osd_release;
+ int r = rados.get_min_compatible_osd(&require_osd_release);
+ if (r == 0 && require_osd_release >= CEPH_RELEASE_OCTOPUS) {
+ read_flags = 0;
+ auto read_policy = config.get_val<std::string>("rbd_read_from_replica_policy");
+ if (read_policy == "balance") {
+ read_flags |= CEPH_OSD_FLAG_BALANCE_READS;
+ } else if (read_policy == "localize") {
+ read_flags |= CEPH_OSD_FLAG_LOCALIZE_READS;
+ }
+ }
+
io_work_queue->apply_qos_schedule_tick_min(
config.get_val<uint64_t>("rbd_qos_schedule_tick_min"));
bool clone_copy_on_read;
bool enable_alloc_hint;
uint32_t alloc_hint_flags = 0U;
+ uint32_t read_flags = 0U;
uint32_t discard_granularity_bytes = 0;
bool blkin_trace_all;
uint64_t mirroring_replay_delay;