|
21 | 21 | #include "events/ETableServer.h" |
22 | 22 | #include "common/debug.h" |
23 | 23 |
|
| 24 | +#include "messages/MMDSTableRequest.h" |
| 25 | + |
24 | 26 | #define dout_context g_ceph_context |
25 | 27 | #define dout_subsys ceph_subsys_mds |
26 | 28 | #undef dout_prefix |
27 | 29 | #define dout_prefix *_dout << "mds." << rank << ".tableserver(" << get_mdstable_name(table) << ") " |
28 | 30 |
|
29 | 31 | using namespace std; |
30 | 32 |
|
| 33 | +struct MDSTableServer::notify_info_t { |
| 34 | + notify_info_t() {} |
| 35 | + std::set<mds_rank_t> notify_ack_gather; |
| 36 | + mds_rank_t mds; |
| 37 | + ref_t<MMDSTableRequest> reply = NULL; |
| 38 | + MDSContext *onfinish = nullptr; |
| 39 | +}; |
| 40 | + |
| 41 | +MDSTableServer::MDSTableServer(MDSRank *m, int tab) : |
| 42 | + MDSTable(m, get_mdstable_name(tab), false), table(tab) {} |
| 43 | + |
| 44 | +MDSTableServer::~MDSTableServer() = default; |
| 45 | + |
| 46 | +MDSTableServer::MDSTableServer(const MDSTableServer &) = default; |
| 47 | +MDSTableServer &MDSTableServer::operator=(const MDSTableServer &) = default; |
| 48 | + |
| 49 | +void MDSTableServer::_note_prepare(mds_rank_t mds, uint64_t reqid, bool replay) { |
| 50 | + version++; |
| 51 | + if (replay) |
| 52 | + projected_version = version; |
| 53 | + pending_for_mds[version].mds = mds; |
| 54 | + pending_for_mds[version].reqid = reqid; |
| 55 | + pending_for_mds[version].tid = version; |
| 56 | +} |
| 57 | + |
| 58 | +void MDSTableServer::_note_commit(uint64_t tid, bool replay) { |
| 59 | + version++; |
| 60 | + if (replay) |
| 61 | + projected_version = version; |
| 62 | + pending_for_mds.erase(tid); |
| 63 | +} |
| 64 | + |
| 65 | +void MDSTableServer::_note_rollback(uint64_t tid, bool replay) { |
| 66 | + version++; |
| 67 | + if (replay) |
| 68 | + projected_version = version; |
| 69 | + pending_for_mds.erase(tid); |
| 70 | +} |
| 71 | + |
| 72 | +void MDSTableServer::_note_server_update(bufferlist& bl, bool replay) { |
| 73 | + version++; |
| 74 | + if (replay) |
| 75 | + projected_version = version; |
| 76 | +} |
| 77 | + |
| 78 | +void MDSTableServer::reset_state() { |
| 79 | + pending_for_mds.clear(); |
| 80 | + ++version; |
| 81 | +} |
| 82 | + |
31 | 83 | void MDSTableServer::handle_request(const cref_t<MMDSTableRequest> &req) |
32 | 84 | { |
33 | 85 | ceph_assert(req->op >= 0); |
@@ -297,6 +349,16 @@ void MDSTableServer::_do_server_recovery() |
297 | 349 | recovered = true; |
298 | 350 | } |
299 | 351 |
|
| 352 | +void MDSTableServer::encode_state(bufferlist& bl) const { |
| 353 | + encode_server_state(bl); |
| 354 | + encode(pending_for_mds, bl); |
| 355 | +} |
| 356 | + |
| 357 | +void MDSTableServer::decode_state(bufferlist::const_iterator& bl) { |
| 358 | + decode_server_state(bl); |
| 359 | + decode(pending_for_mds, bl); |
| 360 | +} |
| 361 | + |
300 | 362 | void MDSTableServer::finish_recovery(set<mds_rank_t>& active) |
301 | 363 | { |
302 | 364 | dout(7) << __func__ << dendl; |
|
0 commit comments