ClientRequest::ClientRequest(
ShardServices &_shard_services, crimson::net::ConnectionRef conn,
Ref<MOSDOp> &&m)
- : shard_services(&_shard_services),
- l_conn(std::move(conn)),
+ : RemoteOperation(std::move(conn)),
+ shard_services(&_shard_services),
m(std::move(m)),
begin_time(std::chrono::steady_clock::now()),
instance_handle(new instance_handle_t)
co_return;
}
- OpsExecuter ox(pg, obc, op_info, *m, r_conn, snapc);
+ OpsExecuter ox(pg, obc, op_info, *m, get_remote_connection(), snapc);
auto ret = co_await pg->run_executer(
ox, obc, op_info, m->ops
).si_then([]() -> std::optional<std::error_code> {
class OSD;
class ShardServices;
-class ClientRequest final : public PhasedOperationT<ClientRequest> {
+class ClientRequest final
+ : public PhasedOperationT<ClientRequest>,
+ public RemoteOperation
+{
// Initially set to primary core, updated to pg core after with_pg()
ShardServices *shard_services = nullptr;
- crimson::net::ConnectionRef l_conn;
- crimson::net::ConnectionXcoreRef r_conn;
-
// must be after conn due to ConnectionPipeline's life-time
Ref<MOSDOp> m;
OpInfo op_info;
static_assert(std::is_same_v<T, MOSDOp>);
return m.get();
}
- const crimson::net::Connection &get_connection() const {
- if (l_conn) {
- return *l_conn;
- } else {
- assert(r_conn);
- return *r_conn;
- }
- }
/**
* instance_handle_t
PerShardPipeline &get_pershard_pipeline(ShardServices &);
- crimson::net::Connection &get_local_connection() {
- assert(l_conn);
- assert(!r_conn);
- return *l_conn;
- };
-
- crimson::net::Connection &get_foreign_connection() {
- assert(r_conn);
- assert(!l_conn);
- return *r_conn;
- };
-
- crimson::net::ConnectionFFRef prepare_remote_submission() {
- assert(l_conn);
- assert(!r_conn);
- auto ret = seastar::make_foreign(std::move(l_conn));
- l_conn.reset();
- return ret;
- }
-
- void finish_remote_submission(crimson::net::ConnectionFFRef conn) {
- assert(conn);
- assert(!l_conn);
- assert(!r_conn);
- r_conn = make_local_shared_foreign(std::move(conn));
- }
-
interruptible_future<> with_pg_process_interruptible(
Ref<PG> pgref, const unsigned instance_id, instance_handle_t &ihref);
LogMissingRequest::LogMissingRequest(crimson::net::ConnectionRef&& conn,
Ref<MOSDPGUpdateLogMissing> &&req)
- : l_conn{std::move(conn)},
+ : RemoteOperation{std::move(conn)},
req{std::move(req)}
{}
std::move(trigger), req->min_epoch);
});
}).then_interruptible([this, pg](auto) {
- return pg->do_update_log_missing(req, r_conn);
+ return pg->do_update_log_missing(req, get_remote_connection());
}).then_interruptible([this] {
logger().debug("{}: complete", *this);
return handle.complete();
class OSD;
class PG;
-class LogMissingRequest final : public PhasedOperationT<LogMissingRequest> {
+class LogMissingRequest final :
+ public PhasedOperationT<LogMissingRequest>,
+ public RemoteOperation {
public:
static constexpr OperationTypeCode type = OperationTypeCode::logmissing_request;
LogMissingRequest(crimson::net::ConnectionRef&&, Ref<MOSDPGUpdateLogMissing>&&);
PerShardPipeline &get_pershard_pipeline(ShardServices &);
- crimson::net::Connection &get_local_connection() {
- assert(l_conn);
- assert(!r_conn);
- return *l_conn;
- };
-
- crimson::net::Connection &get_foreign_connection() {
- assert(r_conn);
- assert(!l_conn);
- return *r_conn;
- };
-
- crimson::net::ConnectionFFRef prepare_remote_submission() {
- assert(l_conn);
- assert(!r_conn);
- auto ret = seastar::make_foreign(std::move(l_conn));
- l_conn.reset();
- return ret;
- }
-
- void finish_remote_submission(crimson::net::ConnectionFFRef conn) {
- assert(conn);
- assert(!l_conn);
- assert(!r_conn);
- r_conn = make_local_shared_foreign(std::move(conn));
- }
-
seastar::future<> with_pg(
ShardServices &shard_services, Ref<PG> pg);
private:
PGRepopPipeline &repop_pipeline(PG &pg);
- crimson::net::ConnectionRef l_conn;
- crimson::net::ConnectionXcoreRef r_conn;
-
// must be after `conn` to ensure the ConnectionPipeline's is alive
PipelineHandle handle;
Ref<MOSDPGUpdateLogMissing> req;
LogMissingRequestReply::LogMissingRequestReply(
crimson::net::ConnectionRef&& conn,
Ref<MOSDPGUpdateLogMissingReply> &&req)
- : l_conn{std::move(conn)},
+ : RemoteOperation{std::move(conn)},
req{std::move(req)}
{}
class OSD;
class PG;
-class LogMissingRequestReply final : public PhasedOperationT<LogMissingRequestReply> {
+class LogMissingRequestReply final :
+ public PhasedOperationT<LogMissingRequestReply>,
+ public RemoteOperation {
public:
static constexpr OperationTypeCode type = OperationTypeCode::logmissing_request_reply;
LogMissingRequestReply(crimson::net::ConnectionRef&&, Ref<MOSDPGUpdateLogMissingReply>&&);
PerShardPipeline &get_pershard_pipeline(ShardServices &);
- crimson::net::Connection &get_local_connection() {
- assert(l_conn);
- assert(!r_conn);
- return *l_conn;
- };
-
- crimson::net::Connection &get_foreign_connection() {
- assert(r_conn);
- assert(!l_conn);
- return *r_conn;
- };
-
- crimson::net::ConnectionFFRef prepare_remote_submission() {
- assert(l_conn);
- assert(!r_conn);
- auto ret = seastar::make_foreign(std::move(l_conn));
- l_conn.reset();
- return ret;
- }
-
- void finish_remote_submission(crimson::net::ConnectionFFRef conn) {
- assert(conn);
- assert(!l_conn);
- assert(!r_conn);
- r_conn = make_local_shared_foreign(std::move(conn));
- }
-
seastar::future<> with_pg(
ShardServices &shard_services, Ref<PG> pg);
> tracking_events;
private:
- crimson::net::ConnectionRef l_conn;
- crimson::net::ConnectionXcoreRef r_conn;
-
// must be after `conn` to ensure the ConnectionPipeline's is alive
PipelineHandle handle;
Ref<MOSDPGUpdateLogMissingReply> req;
ConnectionPipeline &RemotePeeringEvent::get_connection_pipeline()
{
- return get_osd_priv(&get_local_connection()
- ).peering_request_conn_pipeline;
+ return get_osd_priv(&get_connection()
+ ).peering_request_conn_pipeline;
}
PerShardPipeline &RemotePeeringEvent::get_pershard_pipeline(
ShardServices &shard_services, Ref<PG> pg);
};
-class RemotePeeringEvent : public PeeringEvent<RemotePeeringEvent> {
+class RemotePeeringEvent :
+ public PeeringEvent<RemotePeeringEvent>,
+ public RemoteOperation {
protected:
- crimson::net::ConnectionRef l_conn;
- crimson::net::ConnectionXcoreRef r_conn;
-
// must be after conn due to ConnectionPipeline's life-time
PipelineHandle handle;
template <typename... Args>
RemotePeeringEvent(crimson::net::ConnectionRef conn, Args&&... args) :
PeeringEvent(std::forward<Args>(args)...),
- l_conn(conn)
+ RemoteOperation(std::move(conn))
{}
std::tuple<
ConnectionPipeline &get_connection_pipeline();
PerShardPipeline &get_pershard_pipeline(ShardServices &);
-
- crimson::net::Connection &get_local_connection() {
- assert(l_conn);
- assert(!r_conn);
- return *l_conn;
- };
-
- crimson::net::Connection &get_foreign_connection() {
- assert(r_conn);
- assert(!l_conn);
- return *r_conn;
- };
-
- crimson::net::ConnectionFFRef prepare_remote_submission() {
- assert(l_conn);
- assert(!r_conn);
- auto ret = seastar::make_foreign(std::move(l_conn));
- l_conn.reset();
- return ret;
- }
-
- void finish_remote_submission(crimson::net::ConnectionFFRef conn) {
- assert(conn);
- assert(!l_conn);
- assert(!r_conn);
- r_conn = make_local_shared_foreign(std::move(conn));
- }
};
class LocalPeeringEvent final : public PeeringEvent<LocalPeeringEvent> {
PGPCTRequest::PGPCTRequest(crimson::net::ConnectionRef&& conn,
Ref<MOSDPGPCT> &&req)
- : l_conn{std::move(conn)},
+ : RemoteOperation{std::move(conn)},
req{std::move(req)}
{}
class OSD;
class PG;
-class PGPCTRequest final : public PhasedOperationT<PGPCTRequest> {
+class PGPCTRequest final :
+ public PhasedOperationT<PGPCTRequest>,
+ public RemoteOperation {
public:
static constexpr OperationTypeCode type = OperationTypeCode::pgpct_request;
PGPCTRequest(crimson::net::ConnectionRef&&, Ref<MOSDPGPCT>&&);
PerShardPipeline &get_pershard_pipeline(ShardServices &);
- crimson::net::Connection &get_local_connection() {
- assert(l_conn);
- assert(!r_conn);
- return *l_conn;
- };
-
- crimson::net::Connection &get_foreign_connection() {
- assert(r_conn);
- assert(!l_conn);
- return *r_conn;
- };
-
- crimson::net::ConnectionFFRef prepare_remote_submission() {
- assert(l_conn);
- assert(!r_conn);
- auto ret = seastar::make_foreign(std::move(l_conn));
- l_conn.reset();
- return ret;
- }
-
- void finish_remote_submission(crimson::net::ConnectionFFRef conn) {
- assert(conn);
- assert(!l_conn);
- assert(!r_conn);
- r_conn = make_local_shared_foreign(std::move(conn));
- }
-
seastar::future<> with_pg(
ShardServices &shard_services, Ref<PG> pg);
> tracking_events;
private:
- crimson::net::ConnectionRef l_conn;
- crimson::net::ConnectionXcoreRef r_conn;
-
// must be after `conn` to ensure the ConnectionPipeline is alive
PipelineHandle handle;
Ref<MOSDPGPCT> req;
return interruptor::with_interruption([this, pgref] {
LOG_PREFIX(RecoverySubRequest::with_pg);
DEBUGI("{}: {}", "RecoverySubRequest::with_pg", *this);
- return pgref->get_recovery_backend()->handle_recovery_op(m, r_conn
+ return pgref->get_recovery_backend()->handle_recovery_op(
+ m, get_remote_connection()
).then_interruptible([this] {
LOG_PREFIX(RecoverySubRequest::with_pg);
DEBUGI("{}: complete", *this);
class PG;
-class RecoverySubRequest final : public PhasedOperationT<RecoverySubRequest> {
+class RecoverySubRequest final :
+ public PhasedOperationT<RecoverySubRequest>,
+ public RemoteOperation {
public:
static constexpr OperationTypeCode type =
OperationTypeCode::background_recovery_sub;
RecoverySubRequest(
crimson::net::ConnectionRef conn,
Ref<MOSDFastDispatchOp>&& m)
- : l_conn(conn), m(m) {}
+ : RemoteOperation(std::move(conn)), m(m) {}
void print(std::ostream& out) const final
{
PerShardPipeline &get_pershard_pipeline(ShardServices &);
- crimson::net::Connection &get_local_connection() {
- assert(l_conn);
- assert(!r_conn);
- return *l_conn;
- };
-
- crimson::net::Connection &get_foreign_connection() {
- assert(r_conn);
- assert(!l_conn);
- return *r_conn;
- };
-
- crimson::net::ConnectionFFRef prepare_remote_submission() {
- assert(l_conn);
- assert(!r_conn);
- auto ret = seastar::make_foreign(std::move(l_conn));
- l_conn.reset();
- return ret;
- }
-
- void finish_remote_submission(crimson::net::ConnectionFFRef conn) {
- assert(conn);
- assert(!l_conn);
- assert(!r_conn);
- r_conn = make_local_shared_foreign(std::move(conn));
- }
-
seastar::future<> with_pg(
ShardServices &shard_services, Ref<PG> pg);
> tracking_events;
private:
- crimson::net::ConnectionRef l_conn;
- crimson::net::ConnectionXcoreRef r_conn;
-
// must be after `conn` to ensure the ConnectionPipeline's is alive
PipelineHandle handle;
Ref<MOSDFastDispatchOp> m;
RepRequest::RepRequest(crimson::net::ConnectionRef&& conn,
Ref<MOSDRepOp> &&req)
- : l_conn{std::move(conn)},
+ : RemoteOperation{std::move(conn)},
req{std::move(req)}
{}
ConnectionPipeline &RepRequest::get_connection_pipeline()
{
- return get_osd_priv(&get_local_connection()
- ).replicated_request_conn_pipeline;
+ return get_osd_priv(&get_connection()
+ ).replicated_request_conn_pipeline;
}
PerShardPipeline &RepRequest::get_pershard_pipeline(
class OSD;
class PG;
-class RepRequest final : public PhasedOperationT<RepRequest> {
+class RepRequest final :
+ public PhasedOperationT<RepRequest>,
+ public RemoteOperation {
public:
static constexpr OperationTypeCode type = OperationTypeCode::replicated_request;
RepRequest(crimson::net::ConnectionRef&&, Ref<MOSDRepOp>&&);
PerShardPipeline &get_pershard_pipeline(ShardServices &);
- crimson::net::Connection &get_local_connection() {
- assert(l_conn);
- assert(!r_conn);
- return *l_conn;
- };
-
- crimson::net::Connection &get_foreign_connection() {
- assert(r_conn);
- assert(!l_conn);
- return *r_conn;
- };
-
- crimson::net::ConnectionFFRef prepare_remote_submission() {
- assert(l_conn);
- assert(!r_conn);
- auto ret = seastar::make_foreign(std::move(l_conn));
- l_conn.reset();
- return ret;
- }
-
- void finish_remote_submission(crimson::net::ConnectionFFRef conn) {
- assert(conn);
- assert(!l_conn);
- assert(!r_conn);
- r_conn = make_local_shared_foreign(std::move(conn));
- }
-
interruptible_future<> with_pg_interruptible(
Ref<PG> pg);
private:
PGRepopPipeline &repop_pipeline(PG &pg);
- crimson::net::ConnectionRef l_conn;
- crimson::net::ConnectionXcoreRef r_conn;
-
PipelineHandle handle;
Ref<MOSDRepOp> req;
};
class PG;
template <typename T>
-class RemoteScrubEventBaseT : public PhasedOperationT<T> {
+class RemoteScrubEventBaseT :
+ public PhasedOperationT<T>,
+ public RemoteOperation {
T* that() {
return static_cast<T*>(this);
}
PipelineHandle handle;
- crimson::net::ConnectionRef l_conn;
- crimson::net::ConnectionXcoreRef r_conn;
-
spg_t pgid;
protected:
public:
RemoteScrubEventBaseT(
crimson::net::ConnectionRef conn, epoch_t epoch, spg_t pgid)
- : l_conn(std::move(conn)), pgid(pgid), epoch(epoch) {}
+ : RemoteOperation(std::move(conn)), pgid(pgid), epoch(epoch) {}
PGPeeringPipeline &get_peering_pipeline(PG &pg);
PerShardPipeline &get_pershard_pipeline(ShardServices &);
- crimson::net::Connection &get_local_connection() {
- assert(l_conn);
- assert(!r_conn);
- return *l_conn;
- };
-
- crimson::net::Connection &get_foreign_connection() {
- assert(r_conn);
- assert(!l_conn);
- return *r_conn;
- };
-
- crimson::net::ConnectionFFRef prepare_remote_submission() {
- assert(l_conn);
- assert(!r_conn);
- auto ret = seastar::make_foreign(std::move(l_conn));
- l_conn.reset();
- return ret;
- }
-
- void finish_remote_submission(crimson::net::ConnectionFFRef conn) {
- assert(conn);
- assert(!l_conn);
- assert(!r_conn);
- r_conn = make_local_shared_foreign(std::move(conn));
- }
-
static constexpr bool can_create() { return false; }
spg_t get_pgid() const {