Skip to content

Commit

Permalink
Merge pull request #12539 from liewegas/wip-mon-pg-creates
Browse files Browse the repository at this point in the history
mon: fix force_pg_create pg stuck in creating bug

Reviewed-by: Joao Eduardo Luis <joao@suse.de>
Reviewed-by: Kefu Chai <kchai@redhat.com>
  • Loading branch information
liewegas committed Feb 9, 2017
2 parents 9c881e9 + 9a41a0b commit 4d505ac
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 27 deletions.
2 changes: 0 additions & 2 deletions src/mon/MonCommands.h
Expand Up @@ -123,8 +123,6 @@

COMMAND("pg stat", "show placement group status.", "pg", "r", "cli,rest")
COMMAND("pg getmap", "get binary pg map to -o/stdout", "pg", "r", "cli,rest")
COMMAND("pg send_pg_creates", "trigger pg creates to be issued",\
"pg", "rw", "cli,rest")
COMMAND("pg dump " \
"name=dumpcontents,type=CephChoices,strings=all|summary|sum|delta|pools|osds|pgs|pgs_brief,n=N,req=false", \
"show human-readable versions of pg map (only 'all' valid with plain)", "pg", "r", "cli,rest")
Expand Down
1 change: 0 additions & 1 deletion src/mon/PGMap.h
Expand Up @@ -412,7 +412,6 @@ class PGMapUpdater
PGMap *pg_map,
PGMap::Incremental *pending_inc);

protected:
static void register_pg(
const OSDMap &osd_map,
pg_t pgid, epoch_t epoch,
Expand Down
37 changes: 14 additions & 23 deletions src/mon/PGMonitor.cc
Expand Up @@ -236,8 +236,12 @@ void PGMonitor::upgrade_format()
void PGMonitor::post_paxos_update()
{
dout(10) << __func__ << dendl;
if (mon->osdmon()->osdmap.get_epoch()) {
send_pg_creates();
OSDMap& osdmap = mon->osdmon()->osdmap;
if (osdmap.get_epoch()) {
if (osdmap.get_num_up_osds() > 0) {
assert(osdmap.get_up_osd_features() & CEPH_FEATURE_MON_STATEFUL_SUB);
check_subs();
}
}
}

Expand Down Expand Up @@ -885,17 +889,6 @@ void PGMonitor::check_osd_map(epoch_t epoch)
propose_pending();
}

void PGMonitor::send_pg_creates()
{
OSDMap& osdmap = mon->osdmon()->osdmap;
if (osdmap.get_num_up_osds() == 0)
return;

assert(osdmap.get_up_osd_features() & CEPH_FEATURE_MON_STATEFUL_SUB);
check_subs();
return;
}

epoch_t PGMonitor::send_pg_creates(int osd, Connection *con, epoch_t next)
{
dout(30) << __func__ << " " << pg_map.creating_pgs_by_osd_epoch << dendl;
Expand Down Expand Up @@ -933,12 +926,7 @@ epoch_t PGMonitor::send_pg_creates(int osd, Connection *con, epoch_t next)
return next;
}

if (con) {
con->send_message(m);
} else {
assert(mon->osdmon()->osdmap.is_up(osd));
mon->messenger->send_message(m, mon->osdmon()->osdmap.get_inst(osd));
}
con->send_message(m);
last_sent_pg_create[osd] = ceph_clock_now();

// sub is current through last + 1
Expand Down Expand Up @@ -1410,10 +1398,13 @@ bool PGMonitor::prepare_command(MonOpRequestRef op)
goto reply;
}
{
pg_stat_t& s = pending_inc.pg_stat_updates[pgid];
s.state = PG_STATE_CREATING;
s.created = epoch;
s.last_change = ceph_clock_now();
PGMapUpdater::register_pg(
mon->osdmon()->osdmap,
pgid,
epoch,
true,
&pg_map,
&pending_inc);
}
ss << "pg " << pgidstr << " now creating, ok";
goto update;
Expand Down
1 change: 0 additions & 1 deletion src/mon/PGMonitor.h
Expand Up @@ -92,7 +92,6 @@ class PGMonitor : public PaxosService {

void register_new_pgs();

void send_pg_creates();
epoch_t send_pg_creates(int osd, Connection *con, epoch_t next);

/**
Expand Down

0 comments on commit 4d505ac

Please sign in to comment.