msg/Pipe: make STANDBY behavior optional

In particular, lossless_peers should use STANDBY, but lossless_clients
should reconnect immediately since they are already doing their own session
management.

Specifically, this fixes the problem where the Client tries to open a
connection to the MDS and faults after delivering its OPEN_SESSION message
but before it gets the reply: the session isn't open yet, so it isn't
pinging.  It could, but it is simpler and faster to make the msgr layer
keep the connection open instead of waiting for a periodic keepalive.

Fixes: #2824
Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
Sage Weil 2012-07-24 17:12:02 -07:00
parent 7cf1f1fb7f
commit a879425b37
2 changed files with 16 additions and 10 deletions

View File

@ -64,6 +64,8 @@ public:
bool lossy;
/// If true, the underlying connection can't be re-established from this end.
bool server;
/// If true, we will standby when idle
bool standby;
/**
* The throttler is used to limit how much data is held by Messages from
* the associated Connection(s). When reading in a new Message, the Messenger
@ -77,28 +79,30 @@ public:
uint64_t features_required;
Policy()
: lossy(false), server(false), throttler(NULL),
: lossy(false), server(false), standby(false), throttler(NULL),
features_supported(CEPH_FEATURES_SUPPORTED_DEFAULT),
features_required(0) {}
Policy(bool l, bool s, uint64_t sup, uint64_t req)
: lossy(l), server(s), throttler(NULL),
private:
Policy(bool l, bool s, bool st, uint64_t sup, uint64_t req)
: lossy(l), server(s), standby(st), throttler(NULL),
features_supported(sup | CEPH_FEATURES_SUPPORTED_DEFAULT),
features_required(req) {}
public:
static Policy stateful_server(uint64_t sup, uint64_t req) {
return Policy(false, true, sup, req);
return Policy(false, true, true, sup, req);
}
static Policy stateless_server(uint64_t sup, uint64_t req) {
return Policy(true, true, sup, req);
return Policy(true, true, false, sup, req);
}
static Policy lossless_peer(uint64_t sup, uint64_t req) {
return Policy(false, false, sup, req);
return Policy(false, false, true, sup, req);
}
static Policy lossy_client(uint64_t sup, uint64_t req) {
return Policy(true, false, sup, req);
return Policy(true, false, false, sup, req);
}
static Policy lossless_client(uint64_t sup, uint64_t req) {
return Policy(false, false, sup, req);
return Policy(false, false, false, sup, req);
}
};

View File

@ -1016,11 +1016,13 @@ void Pipe::fault(bool onconnect, bool onread)
if (state == STATE_CLOSING || onconnect) {
ldout(msgr->cct,10) << "fault on connect, or already closing, and q empty: setting closed." << dendl;
state = STATE_CLOSED;
} else {
return;
}
if (policy.standby) {
ldout(msgr->cct,0) << "fault with nothing to send, going to standby" << dendl;
state = STATE_STANDBY;
return;
}
return;
}