This is a portion of Part 1 of the namespace project: using ADL
properly in encode and decode so we can use namespaces easily in Ceph.
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
These are no longer used; we manage forward state explicitly via the
Monitor sessions instead. Mark them deprecated so we don't accidentally
rely on them. Also, fix the annoying "mon.-1" garbage debug output that
is confusing.
Signed-off-by: Sage Weil <sage@inktank.com>
On each election, we resend routed requests to the new leader (or
requeue for ourselves). Therefore, if we receive a forwarded request,
we should drop it on the floor if there is a new election. Add a field
in the PaxosServiceMessage struct to track which election epoch we
received the request in, and drop it in PaxosService::dispatch() if
that is in the past.
Signed-off-by: Sage Weil <sage@inktank.com>
Define a HEAD_VERSION and COMPAT_VERSION for any versioned message. Pass
to Message constructor so that it is always initialized, even from the
the default constructor. That's needed because we use that to check
decoding compatibility when receiving/decoding messages.
If we are conditionally encoding an old version, explicitly set
header.version in encode_payload().
We also set compat_version to demonstrate what will happen for future
revisions. In this case, it's moot, because no old code understands
compat_version yet: nobody with old decode code will see these values
anyway. But use this opportunity to demonstrate how it would be used in
the future.
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
Avoid using the connection reference; pass it in explicitly instead. This
will make ceph-dencoder's life a bit easier.
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
A couple of preprocessor symbols for include guards tampered with the reserved namespace.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Sage Weil <sage@newdream.net>
The problem is that on some platforms __u64 == uint64_t (x86_64), and on
others it's doesn't (ppc64). Which means we don't know whether to define
different versions of overloaded functions for both types or just one.
So, standardize on uint64_t. This plays nicer with STL, which defines
hash<uint64_t> on 64 bit arches but not 32 bit. Which means we can't
standarzie on __u64 or else hash<__u64> won't work. Bah!
because the session close clears connection->priv. We need to check at
each site anyway, either for null session, or for session->closed. So
check for null session.
This reverts commit 0c688f94be.
Revert "mon: Use PaxosServiceMessage::caps instead of Session::caps where applicable"
This reverts commit e33e17ec2f.
This needs to be reworked slightly to handle inter-mon communication better.
We track which monitor requests are forwarded to the leader in the mon
Session, and clean them out when we send a reply back via MRoute.
Only forward once, and resend pending requests on election completion.
This may lead to harmless dups, but at least we know our request didn't
get dropped on the floor by another mon failing somewhere.
This changes the monitor protocol by expanding the PaxosServiceMessage
header.