Skip to content

Commit

Permalink
Merge pull request ceph#55979 from athanatos/sjust/wip-64546-max-crea…
Browse files Browse the repository at this point in the history
…ting-pgs

mon: always create pgs in the epoch in which the pool was created

Reviewed-by: Matan Breizman <[email protected]>
  • Loading branch information
athanatos authored Apr 1, 2024
2 parents e5c885f + 7ef7a13 commit 632828c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 22 deletions.
7 changes: 7 additions & 0 deletions src/common/options/mgr.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ options:
services:
- mgr
with_legacy: true
- name: mgr_max_pg_creating
type: uint
level: advanced
desc: bound on max creating pgs when acting to create more pgs
default: 1024
services:
- mgr
- name: mgr_module_path
type: str
level: advanced
Expand Down
8 changes: 0 additions & 8 deletions src/common/options/mon.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -1258,14 +1258,6 @@ options:
services:
- mon
with_legacy: true
- name: mon_osd_max_creating_pgs
type: int
level: advanced
desc: maximum number of PGs the mon will create at once
default: 1024
services:
- mon
with_legacy: true
- name: mon_osd_max_initial_pgs
type: int
level: advanced
Expand Down
6 changes: 4 additions & 2 deletions src/mgr/DaemonServer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2678,7 +2678,9 @@ void DaemonServer::send_report()
void DaemonServer::adjust_pgs()
{
dout(20) << dendl;
unsigned max = std::max<int64_t>(1, g_conf()->mon_osd_max_creating_pgs);
uint64_t max = std::max<uint64_t>(
1,
g_conf().get_val<uint64_t>("mgr_max_pg_creating"));
double max_misplaced = g_conf().get_val<double>("target_max_misplaced_ratio");
bool aggro = g_conf().get_val<bool>("mgr_debug_aggressive_pg_num_changes");

Expand Down Expand Up @@ -2889,7 +2891,7 @@ void DaemonServer::adjust_pgs()
<< " pgp_num_target " << p.get_pgp_num_target()
<< " pgp_num " << p.get_pgp_num()
<< " - misplaced_ratio " << misplaced_ratio
<< " > max " << max_misplaced
<< " > max_misplaced " << max_misplaced
<< ", deferring pgp_num update" << dendl;
} else {
// NOTE: this calculation assumes objects are
Expand Down
17 changes: 5 additions & 12 deletions src/mon/OSDMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1251,32 +1251,25 @@ OSDMonitor::update_pending_pgs(const OSDMap::Incremental& inc,
}

// process queue
unsigned max = std::max<int64_t>(1, g_conf()->mon_osd_max_creating_pgs);
const auto total = pending_creatings.pgs.size();
while (pending_creatings.pgs.size() < max &&
!pending_creatings.queue.empty()) {
while (!pending_creatings.queue.empty()) {
auto p = pending_creatings.queue.begin();
int64_t poolid = p->first;
dout(10) << __func__ << " pool " << poolid
<< " created " << p->second.created
<< " modified " << p->second.modified
<< " [" << p->second.start << "-" << p->second.end << ")"
<< dendl;
int64_t n = std::min<int64_t>(max - pending_creatings.pgs.size(),
p->second.end - p->second.start);
ps_t first = p->second.start;
ps_t end = first + n;
for (ps_t ps = first; ps < end; ++ps) {
for (ps_t ps = p->second.start; ps < p->second.end; ++ps) {
const pg_t pgid{ps, static_cast<uint64_t>(poolid)};
// NOTE: use the *current* epoch as the PG creation epoch so that the
// OSD does not have to generate a long set of PastIntervals.
// The current epoch must be the pool creation epoch
pending_creatings.pgs.emplace(
pgid,
creating_pgs_t::pg_create_info(inc.epoch,
creating_pgs_t::pg_create_info(p->second.created,
p->second.modified));
dout(10) << __func__ << " adding " << pgid << dendl;
}
p->second.start = end;
p->second.start = p->second.end;
if (p->second.done()) {
dout(10) << __func__ << " done with queue for " << poolid << dendl;
pending_creatings.queue.erase(p);
Expand Down

0 comments on commit 632828c

Please sign in to comment.