Skip to content

Commit 24087ec

Browse files
yehudasacbodley
authored andcommitted
librados: local affinity for exec calls is configurable
Signed-off-by: Yehuda Sadeh <[email protected]>
1 parent 2028e4e commit 24087ec

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

src/common/options/global.yaml.in

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6395,6 +6395,18 @@ options:
63956395
- localize
63966396
flags:
63976397
- runtime
6398+
- name: rados_replica_read_policy_on_objclass
6399+
type: bool
6400+
level: advanced
6401+
desc: enable read policy for sending read requests to OSD on objclass ops
6402+
fmt_desc : |
6403+
This would enable objclass ops to leverage read policy that can
6404+
determine which OSD will receive read operation. The reason
6405+
we might want to disable this is because objclass operations may
6406+
not be flagged correctly as read or write ops and we don't want
6407+
write ops to be sent to the wrong OSD (and system won't function
6408+
correctly).
6409+
default: false
63986410
# true if LTTng-UST tracepoints should be enabled
63996411
- name: rados_tracing
64006412
type: bool

src/librados/IoCtxImpl.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@ librados::IoCtxImpl::IoCtxImpl(RadosClient *c, Objecter *objecter,
241241
oloc(poolid),
242242
aio_write_seq(0), objecter(objecter)
243243
{
244+
if (!c->cct->_conf.get_val<bool>("rados_replica_read_policy_on_objclass")) {
245+
objclass_flags_mask = ~(CEPH_OSD_FLAG_LOCALIZE_READS | CEPH_OSD_FLAG_BALANCE_READS);
246+
}
244247
}
245248

246249
void librados::IoCtxImpl::set_snap_read(snapid_t s)
@@ -1313,7 +1316,7 @@ int librados::IoCtxImpl::exec(const object_t& oid,
13131316
::ObjectOperation rd;
13141317
prepare_assert_ops(&rd);
13151318
rd.call(cls, method, inbl);
1316-
return operate_read(oid, &rd, &outbl, 0, ~(CEPH_OSD_FLAG_LOCALIZE_READS | CEPH_OSD_FLAG_BALANCE_READS));
1319+
return operate_read(oid, &rd, &outbl, 0, objclass_flags_mask);
13171320
}
13181321

13191322
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,
13331336
prepare_assert_ops(&rd);
13341337
rd.call(cls, method, inbl);
13351338
Objecter::Op *o = objecter->prepare_read_op(
1336-
oid, oloc, rd, snap_seq, outbl, extra_op_flags, ~(CEPH_OSD_FLAG_LOCALIZE_READS | CEPH_OSD_FLAG_BALANCE_READS), oncomplete, &c->objver);
1339+
oid, oloc, rd, snap_seq, outbl, extra_op_flags, objclass_flags_mask, oncomplete, &c->objver);
13371340
objecter->op_submit(o, &c->tid);
13381341
return 0;
13391342
}
@@ -1359,7 +1362,7 @@ int librados::IoCtxImpl::aio_exec(const object_t& oid, AioCompletionImpl *c,
13591362
prepare_assert_ops(&rd);
13601363
rd.call(cls, method, inbl);
13611364
Objecter::Op *o = objecter->prepare_read_op(
1362-
oid, oloc, rd, snap_seq, &c->bl, extra_op_flags, ~(CEPH_OSD_FLAG_LOCALIZE_READS | CEPH_OSD_FLAG_BALANCE_READS), oncomplete, &c->objver);
1365+
oid, oloc, rd, snap_seq, &c->bl, extra_op_flags, objclass_flags_mask, oncomplete, &c->objver);
13631366
objecter->op_submit(o, &c->tid);
13641367
return 0;
13651368
}

src/librados/IoCtxImpl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ struct librados::IoCtxImpl {
4141
uint32_t notify_timeout = 30;
4242
object_locator_t oloc;
4343
int extra_op_flags = 0;
44+
int objclass_flags_mask = -1;
4445

4546
ceph::mutex aio_write_list_lock =
4647
ceph::make_mutex("librados::IoCtxImpl::aio_write_list_lock");

0 commit comments

Comments
 (0)