From: Radoslaw Zarzynski Date: Wed, 27 Nov 2019 15:34:25 +0000 (+0100) Subject: crimson: implement CEPH_OSD_WATCH_OP_RECONNECT. X-Git-Tag: v15.1.1~415^2~15 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d56daf46f22189e8cabcfda9208d4cf3eafc4516;p=ceph.git crimson: implement CEPH_OSD_WATCH_OP_RECONNECT. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/crimson/common/errorator.h b/src/crimson/common/errorator.h index f26b65847c4e..1824764718df 100644 --- a/src/crimson/common/errorator.h +++ b/src/crimson/common/errorator.h @@ -851,6 +851,7 @@ namespace ct_error { using permission_denied = ct_error_code; using operation_not_supported = ct_error_code; + using not_connected = ct_error_code; } using stateful_errc = stateful_error_t; diff --git a/src/crimson/osd/ops_executer.cc b/src/crimson/osd/ops_executer.cc index b69583d4826c..8c2ddc9ca70e 100644 --- a/src/crimson/osd/ops_executer.cc +++ b/src/crimson/osd/ops_executer.cc @@ -163,6 +163,21 @@ OpsExecuter::watch_errorator::future<> OpsExecuter::do_op_watch_subop_watch( }); } +OpsExecuter::watch_errorator::future<> OpsExecuter::do_op_watch_subop_reconnect( + OSDOp& osd_op, + ObjectState& os, + ceph::os::Transaction& txn) +{ + const entity_name_t& entity = get_message().get_reqid().name; + const auto& cookie = osd_op.op.watch.cookie; + if (!os.oi.watchers.count(std::make_pair(cookie, entity))) { + return crimson::ct_error::not_connected::make(); + } else { + logger().info("found existing watch by {}", entity); + return do_op_watch_subop_watch(osd_op, os, txn); + } +} + OpsExecuter::watch_errorator::future<> OpsExecuter::do_op_watch_subop_unwatch( OSDOp& osd_op, ObjectState& os, @@ -211,8 +226,7 @@ OpsExecuter::watch_errorator::future<> OpsExecuter::do_op_watch( case CEPH_OSD_WATCH_OP_WATCH: return do_op_watch_subop_watch(osd_op, os, txn); case CEPH_OSD_WATCH_OP_RECONNECT: - // TODO: implement reconnect - break; + return do_op_watch_subop_reconnect(osd_op, os, txn); case CEPH_OSD_WATCH_OP_PING: // TODO: implement ping break; diff --git a/src/crimson/osd/ops_executer.h b/src/crimson/osd/ops_executer.h index d371fc6319bf..82385ff30480 100644 --- a/src/crimson/osd/ops_executer.h +++ b/src/crimson/osd/ops_executer.h @@ -48,7 +48,8 @@ class OpsExecuter { using get_attr_errorator = PGBackend::get_attr_errorator; using watch_errorator = crimson::errorator< crimson::ct_error::enoent, - crimson::ct_error::invarg>; + crimson::ct_error::invarg, + crimson::ct_error::not_connected>; public: // because OpsExecuter is pretty heavy-weight object we want to ensure @@ -106,6 +107,10 @@ private: class OSDOp& osd_op, class ObjectState& os, ceph::os::Transaction& txn); + watch_errorator::future<> do_op_watch_subop_reconnect( + class OSDOp& osd_op, + class ObjectState& os, + ceph::os::Transaction& txn); watch_errorator::future<> do_op_watch_subop_unwatch( class OSDOp& osd_op, class ObjectState& os,