Skip to content

Commit 703f265

Browse files
committed
Merge PR ceph#50908 into main
* refs/pull/50908/head: mon/MDSMonitor: plug paxos when maybe manipulating the osdmap mon/MDSMonitor: force immediate propose when evicting an MDS Reviewed-by: Venky Shankar <[email protected]>
2 parents 8f4ae9b + 885005b commit 703f265

File tree

3 files changed

+34
-45
lines changed

3 files changed

+34
-45
lines changed

src/mon/FSCommands.cc

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,6 @@ class FsNewHandler : public FileSystemCommandHandler
146146
{
147147
}
148148

149-
bool batched_propose() override {
150-
return true;
151-
}
152-
153149
int handle(
154150
Monitor *mon,
155151
FSMap& fsmap,
@@ -934,10 +930,6 @@ class AddDataPoolHandler : public FileSystemCommandHandler
934930
: FileSystemCommandHandler("fs add_data_pool"), m_paxos(paxos)
935931
{}
936932

937-
bool batched_propose() override {
938-
return true;
939-
}
940-
941933
int handle(
942934
Monitor *mon,
943935
FSMap& fsmap,
@@ -1159,10 +1151,6 @@ class RenameFilesystemHandler : public FileSystemCommandHandler
11591151
{
11601152
}
11611153

1162-
bool batched_propose() override {
1163-
return true;
1164-
}
1165-
11661154
int handle(
11671155
Monitor *mon,
11681156
FSMap& fsmap,

src/mon/FSCommands.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,6 @@ class FileSystemCommandHandler : protected CommandHandler
7979

8080
static std::list<std::shared_ptr<FileSystemCommandHandler> > load(Paxos *paxos);
8181

82-
virtual bool batched_propose() {
83-
return false;
84-
}
85-
8682
virtual int handle(
8783
Monitor *mon,
8884
FSMap &fsmap,

src/mon/MDSMonitor.cc

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -550,28 +550,35 @@ bool MDSMonitor::prepare_update(MonOpRequestRef op)
550550
auto m = op->get_req<PaxosServiceMessage>();
551551
dout(7) << "prepare_update " << *m << dendl;
552552

553-
switch (m->get_type()) {
554-
555-
case MSG_MDS_BEACON:
556-
return prepare_beacon(op);
553+
bool r = false;
557554

558-
case MSG_MON_COMMAND:
559-
try {
560-
return prepare_command(op);
561-
} catch (const bad_cmd_get& e) {
562-
bufferlist bl;
563-
mon.reply_command(op, -EINVAL, e.what(), bl, get_last_committed());
564-
return false; /* nothing to propose */
565-
}
555+
/* batch any changes to pending with any changes to osdmap */
556+
paxos.plug();
566557

567-
case MSG_MDS_OFFLOAD_TARGETS:
568-
return prepare_offload_targets(op);
569-
570-
default:
571-
ceph_abort();
558+
switch (m->get_type()) {
559+
case MSG_MDS_BEACON:
560+
r = prepare_beacon(op);
561+
break;
562+
case MSG_MON_COMMAND:
563+
try {
564+
r = prepare_command(op);
565+
} catch (const bad_cmd_get& e) {
566+
bufferlist bl;
567+
mon.reply_command(op, -EINVAL, e.what(), bl, get_last_committed());
568+
r = false;
569+
}
570+
break;
571+
case MSG_MDS_OFFLOAD_TARGETS:
572+
r = prepare_offload_targets(op);
573+
break;
574+
default:
575+
ceph_abort();
576+
break;
572577
}
573578

574-
return false; /* nothing to propose! */
579+
paxos.unplug();
580+
581+
return r;
575582
}
576583

577584
bool MDSMonitor::prepare_beacon(MonOpRequestRef op)
@@ -804,6 +811,7 @@ bool MDSMonitor::prepare_beacon(MonOpRequestRef op)
804811
last_beacon.erase(followergid);
805812
}
806813
request_proposal(mon.osdmon());
814+
force_immediate_propose();
807815
pending.damaged(rankgid, blocklist_epoch);
808816
last_beacon.erase(rankgid);
809817

@@ -1277,6 +1285,8 @@ bool MDSMonitor::fail_mds_gid(FSMap &fsmap, mds_gid_t gid)
12771285
utime_t until = ceph_clock_now();
12781286
until += g_conf().get_val<double>("mon_mds_blocklist_interval");
12791287
blocklist_epoch = mon.osdmon()->blocklist(info.addrs, until);
1288+
/* do not delay when we are evicting an MDS */
1289+
force_immediate_propose();
12801290
}
12811291

12821292
fsmap.erase(gid, blocklist_epoch);
@@ -1386,7 +1396,6 @@ bool MDSMonitor::prepare_command(MonOpRequestRef op)
13861396

13871397
auto &pending = get_pending_fsmap_writeable();
13881398

1389-
bool batched_propose = false;
13901399
for (const auto &h : handlers) {
13911400
r = h->can_handle(prefix, op, pending, cmdmap, ss);
13921401
if (r == 1) {
@@ -1397,14 +1406,7 @@ bool MDSMonitor::prepare_command(MonOpRequestRef op)
13971406
goto out;
13981407
}
13991408

1400-
batched_propose = h->batched_propose();
1401-
if (batched_propose) {
1402-
paxos.plug();
1403-
}
14041409
r = h->handle(&mon, pending, op, cmdmap, ss);
1405-
if (batched_propose) {
1406-
paxos.unplug();
1407-
}
14081410

14091411
if (r == -EAGAIN) {
14101412
// message has been enqueued for retry; return.
@@ -1445,9 +1447,6 @@ bool MDSMonitor::prepare_command(MonOpRequestRef op)
14451447
// success.. delay reply
14461448
wait_for_finished_proposal(op, new Monitor::C_Command(mon, op, r, rs,
14471449
get_last_committed() + 1));
1448-
if (batched_propose) {
1449-
force_immediate_propose();
1450-
}
14511450
return true;
14521451
} else {
14531452
// reply immediately
@@ -2319,6 +2318,9 @@ void MDSMonitor::tick()
23192318

23202319
auto &pending = get_pending_fsmap_writeable();
23212320

2321+
/* batch any changes to pending with any changes to osdmap */
2322+
paxos.plug();
2323+
23222324
bool do_propose = false;
23232325
bool propose_osdmap = false;
23242326

@@ -2374,6 +2376,9 @@ void MDSMonitor::tick()
23742376
request_proposal(mon.osdmon());
23752377
}
23762378

2379+
/* allow MDSMonitor::propose_pending() to push the proposal through */
2380+
paxos.unplug();
2381+
23772382
if (do_propose) {
23782383
propose_pending();
23792384
}

0 commit comments

Comments
 (0)