Skip to content

Commit 2b14a67

Browse files
committed
Merge PR ceph#65392 into main
* refs/pull/65392/head: Reviewed-by: Venky Shankar <[email protected]> Reviewed-by: Dhairya Parmar <[email protected]>
2 parents 15ebe51 + 8c47f85 commit 2b14a67

23 files changed

+367
-268
lines changed

src/global/signal_handler.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "common/Clock.h" // for ceph_clock_now()
2424
#include "common/BackTrace.h"
2525
#include "common/debug.h"
26+
#include "common/Formatter.h"
2627
#include "common/safe_io.h"
2728
#include "common/version.h"
2829

src/mds/MDBalancer.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include "include/compat.h"
1919
#include "mdstypes.h"
2020

21-
#include "mon/MonClient.h"
2221
#include "osdc/Objecter.h"
2322
#include "MDSRank.h"
2423
#include "MDSMap.h"

src/mds/MDCache.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
*/
1414

1515
#include "MDCache.h"
16+
#include "Mutation.h"
1617
#include "RetryMessage.h"
1718
#include "RetryRequest.h"
1819

src/mds/MDCache.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@
3737
#include "StrayManager.h"
3838
#include "OpenFileTable.h"
3939
#include "MDSContext.h"
40-
#include "Mutation.h"
4140
#include "LogSegmentRef.h"
4241

42+
#include <boost/intrusive_ptr.hpp>
43+
4344
class EMetaBlob;
4445
class MCacheExpire;
4546
class MClientRequest;
@@ -68,6 +69,11 @@ class Session;
6869

6970
class ESubtreeMap;
7071

72+
struct MutationImpl;
73+
struct MDRequestImpl;
74+
typedef boost::intrusive_ptr<MutationImpl> MutationRef;
75+
typedef boost::intrusive_ptr<MDRequestImpl> MDRequestRef;
76+
7177
enum {
7278
l_mdc_first = 3000,
7379

src/mds/MDSRank.cc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "osdc/Journaler.h"
1717

1818
#include <typeinfo>
19+
#include "common/DecayCounter.h"
1920
#include "common/debug.h"
2021
#include "common/errno.h"
2122
#include "common/fair_mutex.h"
@@ -34,6 +35,7 @@
3435

3536
#include "mgr/MgrClient.h"
3637

38+
#include "Beacon.h"
3739
#include "MDCache.h"
3840
#include "MDLog.h"
3941
#include "MDSDaemon.h"
@@ -898,6 +900,15 @@ MDSTableServer *MDSRank::get_table_server(int t)
898900
}
899901
}
900902

903+
MDSMap::DaemonState MDSRank::get_want_state() const
904+
{
905+
return beacon.get_want_state();
906+
}
907+
908+
uint64_t MDSRank::get_global_id() const {
909+
return monc->get_global_id();
910+
}
911+
901912
void MDSRank::suicide()
902913
{
903914
if (suicide_hook) {
@@ -943,6 +954,11 @@ void MDSRank::damaged_unlocked()
943954
damaged();
944955
}
945956

957+
double MDSRank::last_cleared_laggy() const
958+
{
959+
return beacon.last_cleared_laggy();
960+
}
961+
946962
void MDSRank::handle_write_error(int err)
947963
{
948964
if (err == -EBLOCKLISTED) {

src/mds/MDSRank.h

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,24 @@
1919
#include <string_view>
2020

2121
#include "common/admin_socket.h" // for asok_finisher
22-
#include "common/DecayCounter.h"
2322
#include "common/LogClient.h"
2423
#include "common/TrackedOp.h" // for class OpTracker
2524

2625
#include "include/common_fwd.h"
2726

28-
#include "Beacon.h"
2927
#include "DamageTable.h"
3028
#include "MDSMap.h"
3129
#include "SessionMap.h"
3230
#include "PurgeQueue.h"
3331
#include "MetricsHandler.h"
34-
#include "mon/MonClient.h"
3532

3633
// Full .h import instead of forward declaration for PerfCounter, for the
3734
// benefit of those including this header and using MDSRank::logger
3835
#include "common/perf_counters.h"
3936

4037
#include <boost/intrusive_ptr.hpp>
4138

39+
class DecayCounter;
4240
class MDSContext;
4341
class MDSMetaRequest;
4442
class MMDSMap;
@@ -134,6 +132,7 @@ namespace ceph {
134132
template <class Mutex>
135133
class CommonSafeTimer;
136134

135+
class Beacon;
137136
class Locker;
138137
class MDCache;
139138
class MDLog;
@@ -209,7 +208,7 @@ class MDSRank {
209208
Session *get_session(const cref_t<Message> &m);
210209

211210
MDSMap::DaemonState get_state() const { return state; }
212-
MDSMap::DaemonState get_want_state() const { return beacon.get_want_state(); }
211+
MDSMap::DaemonState get_want_state() const;
213212

214213
bool is_creating() const { return state == MDSMap::STATE_CREATING; }
215214
bool is_starting() const { return state == MDSMap::STATE_STARTING; }
@@ -259,9 +258,7 @@ class MDSRank {
259258
progress_thread.signal();
260259
}
261260

262-
uint64_t get_global_id() const {
263-
return monc->get_global_id();
264-
}
261+
uint64_t get_global_id() const;
265262

266263
// Daemon lifetime functions: these guys break the abstraction
267264
// and call up into the parent MDSDaemon instance. It's kind
@@ -308,9 +305,7 @@ class MDSRank {
308305
*/
309306
void damaged_unlocked();
310307

311-
double last_cleared_laggy() const {
312-
return beacon.last_cleared_laggy();
313-
}
308+
double last_cleared_laggy() const;
314309

315310
double get_dispatch_queue_max_age(utime_t now) const;
316311

src/mds/MDSRankQuiesce.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "MDSRank.h"
1414
#include "MDCache.h"
15+
#include "mon/MonClient.h"
1516

1617
#include "QuiesceDbManager.h"
1718
#include "QuiesceAgent.h"

src/mds/MDSTableClient.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "MDSMap.h"
1717

1818
#include "MDSContext.h"
19+
#include "mds_table_types.h"
1920
#include "RetryMessage.h"
2021
#include "msg/Messenger.h"
2122

src/mds/MDSTableClient.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717

1818
#include "include/buffer.h"
1919
#include "include/types.h"
20-
#include "mds_table_types.h"
21-
#include "mdstypes.h" // for mds_rank_t
20+
#include "include/cephfs/types.h" // for mds_rank_t
2221
#include "common/ref.h" // for cref_t
2322
#include "LogSegmentRef.h"
2423

src/mds/MDSTableServer.cc

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,65 @@
2121
#include "events/ETableServer.h"
2222
#include "common/debug.h"
2323

24+
#include "messages/MMDSTableRequest.h"
25+
2426
#define dout_context g_ceph_context
2527
#define dout_subsys ceph_subsys_mds
2628
#undef dout_prefix
2729
#define dout_prefix *_dout << "mds." << rank << ".tableserver(" << get_mdstable_name(table) << ") "
2830

2931
using namespace std;
3032

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+
3183
void MDSTableServer::handle_request(const cref_t<MMDSTableRequest> &req)
3284
{
3385
ceph_assert(req->op >= 0);
@@ -297,6 +349,16 @@ void MDSTableServer::_do_server_recovery()
297349
recovered = true;
298350
}
299351

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+
300362
void MDSTableServer::finish_recovery(set<mds_rank_t>& active)
301363
{
302364
dout(7) << __func__ << dendl;

0 commit comments

Comments
 (0)