]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: local affinity for exec calls is configurable
authorYehuda Sadeh <ysadehwe@ibm.com>
Wed, 3 Jul 2024 17:26:03 +0000 (13:26 -0400)
committerCasey Bodley <cbodley@redhat.com>
Thu, 12 Dec 2024 22:11:13 +0000 (17:11 -0500)
Signed-off-by: Yehuda Sadeh <ysadehwe@ibm.com>
src/common/options/global.yaml.in
src/librados/IoCtxImpl.cc
src/librados/IoCtxImpl.h

index c4a63e31d092c82171bb9a3ea15cd2956a9924c4..cc6568d3909e3cce60e22c2158f0d6bc30b6795b 100644 (file)
@@ -6395,6 +6395,18 @@ options:
   - localize
   flags:
   - runtime
+- name: rados_replica_read_policy_on_objclass
+  type: bool
+  level: advanced
+  desc: enable read policy for sending read requests to OSD on objclass ops
+  fmt_desc : |
+    This would enable objclass ops to leverage read policy that can
+    determine which OSD will receive read operation. The reason
+    we might want to disable this is because objclass operations may
+    not be flagged correctly as read or write ops and we don't want
+    write ops to be sent to the wrong OSD (and system won't function
+    correctly).
+  default: false
 # true if LTTng-UST tracepoints should be enabled
 - name: rados_tracing
   type: bool
index ebac8a100cfe2b43c6fc7d5b49dbd82c639a0943..f49d1c8ec2b6ac9f4baec73a0675a619637843af 100644 (file)
@@ -241,6 +241,9 @@ librados::IoCtxImpl::IoCtxImpl(RadosClient *c, Objecter *objecter,
     oloc(poolid),
     aio_write_seq(0), objecter(objecter)
 {
+  if (!c->cct->_conf.get_val<bool>("rados_replica_read_policy_on_objclass")) {
+    objclass_flags_mask = ~(CEPH_OSD_FLAG_LOCALIZE_READS | CEPH_OSD_FLAG_BALANCE_READS);
+  }
 }
 
 void librados::IoCtxImpl::set_snap_read(snapid_t s)
@@ -1313,7 +1316,7 @@ int librados::IoCtxImpl::exec(const object_t& oid,
   ::ObjectOperation rd;
   prepare_assert_ops(&rd);
   rd.call(cls, method, inbl);
-  return operate_read(oid, &rd, &outbl, 0, ~(CEPH_OSD_FLAG_LOCALIZE_READS | CEPH_OSD_FLAG_BALANCE_READS));
+  return operate_read(oid, &rd, &outbl, 0, objclass_flags_mask);
 }
 
 int librados::IoCtxImpl::aio_exec(const object_t& oid, AioCompletionImpl *c,
@@ -1333,7 +1336,7 @@ int librados::IoCtxImpl::aio_exec(const object_t& oid, AioCompletionImpl *c,
   prepare_assert_ops(&rd);
   rd.call(cls, method, inbl);
   Objecter::Op *o = objecter->prepare_read_op(
-    oid, oloc, rd, snap_seq, outbl, extra_op_flags, ~(CEPH_OSD_FLAG_LOCALIZE_READS | CEPH_OSD_FLAG_BALANCE_READS), oncomplete, &c->objver);
+    oid, oloc, rd, snap_seq, outbl, extra_op_flags, objclass_flags_mask, oncomplete, &c->objver);
   objecter->op_submit(o, &c->tid);
   return 0;
 }
@@ -1359,7 +1362,7 @@ int librados::IoCtxImpl::aio_exec(const object_t& oid, AioCompletionImpl *c,
   prepare_assert_ops(&rd);
   rd.call(cls, method, inbl);
   Objecter::Op *o = objecter->prepare_read_op(
-    oid, oloc, rd, snap_seq, &c->bl, extra_op_flags, ~(CEPH_OSD_FLAG_LOCALIZE_READS | CEPH_OSD_FLAG_BALANCE_READS), oncomplete, &c->objver);
+    oid, oloc, rd, snap_seq, &c->bl, extra_op_flags, objclass_flags_mask, oncomplete, &c->objver);
   objecter->op_submit(o, &c->tid);
   return 0;
 }
index c0dece81e59ad159221da724879a73b7fc79aee0..6d8c10225447826e19fb4b74f411a5739d80efc7 100644 (file)
@@ -41,6 +41,7 @@ struct librados::IoCtxImpl {
   uint32_t notify_timeout = 30;
   object_locator_t oloc;
   int extra_op_flags = 0;
+  int objclass_flags_mask = -1;
 
   ceph::mutex aio_write_list_lock =
     ceph::make_mutex("librados::IoCtxImpl::aio_write_list_lock");