Skip to content

Commit 632828c

Browse files
authored
Merge pull request ceph#55979 from athanatos/sjust/wip-64546-max-creating-pgs
mon: always create pgs in the epoch in which the pool was created Reviewed-by: Matan Breizman <[email protected]>
2 parents e5c885f + 7ef7a13 commit 632828c

File tree

4 files changed

+16
-22
lines changed

4 files changed

+16
-22
lines changed

src/common/options/mgr.yaml.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@ options:
103103
services:
104104
- mgr
105105
with_legacy: true
106+
- name: mgr_max_pg_creating
107+
type: uint
108+
level: advanced
109+
desc: bound on max creating pgs when acting to create more pgs
110+
default: 1024
111+
services:
112+
- mgr
106113
- name: mgr_module_path
107114
type: str
108115
level: advanced

src/common/options/mon.yaml.in

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,14 +1258,6 @@ options:
12581258
services:
12591259
- mon
12601260
with_legacy: true
1261-
- name: mon_osd_max_creating_pgs
1262-
type: int
1263-
level: advanced
1264-
desc: maximum number of PGs the mon will create at once
1265-
default: 1024
1266-
services:
1267-
- mon
1268-
with_legacy: true
12691261
- name: mon_osd_max_initial_pgs
12701262
type: int
12711263
level: advanced

src/mgr/DaemonServer.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2678,7 +2678,9 @@ void DaemonServer::send_report()
26782678
void DaemonServer::adjust_pgs()
26792679
{
26802680
dout(20) << dendl;
2681-
unsigned max = std::max<int64_t>(1, g_conf()->mon_osd_max_creating_pgs);
2681+
uint64_t max = std::max<uint64_t>(
2682+
1,
2683+
g_conf().get_val<uint64_t>("mgr_max_pg_creating"));
26822684
double max_misplaced = g_conf().get_val<double>("target_max_misplaced_ratio");
26832685
bool aggro = g_conf().get_val<bool>("mgr_debug_aggressive_pg_num_changes");
26842686

@@ -2889,7 +2891,7 @@ void DaemonServer::adjust_pgs()
28892891
<< " pgp_num_target " << p.get_pgp_num_target()
28902892
<< " pgp_num " << p.get_pgp_num()
28912893
<< " - misplaced_ratio " << misplaced_ratio
2892-
<< " > max " << max_misplaced
2894+
<< " > max_misplaced " << max_misplaced
28932895
<< ", deferring pgp_num update" << dendl;
28942896
} else {
28952897
// NOTE: this calculation assumes objects are

src/mon/OSDMonitor.cc

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,32 +1251,25 @@ OSDMonitor::update_pending_pgs(const OSDMap::Incremental& inc,
12511251
}
12521252

12531253
// process queue
1254-
unsigned max = std::max<int64_t>(1, g_conf()->mon_osd_max_creating_pgs);
12551254
const auto total = pending_creatings.pgs.size();
1256-
while (pending_creatings.pgs.size() < max &&
1257-
!pending_creatings.queue.empty()) {
1255+
while (!pending_creatings.queue.empty()) {
12581256
auto p = pending_creatings.queue.begin();
12591257
int64_t poolid = p->first;
12601258
dout(10) << __func__ << " pool " << poolid
12611259
<< " created " << p->second.created
12621260
<< " modified " << p->second.modified
12631261
<< " [" << p->second.start << "-" << p->second.end << ")"
12641262
<< dendl;
1265-
int64_t n = std::min<int64_t>(max - pending_creatings.pgs.size(),
1266-
p->second.end - p->second.start);
1267-
ps_t first = p->second.start;
1268-
ps_t end = first + n;
1269-
for (ps_t ps = first; ps < end; ++ps) {
1263+
for (ps_t ps = p->second.start; ps < p->second.end; ++ps) {
12701264
const pg_t pgid{ps, static_cast<uint64_t>(poolid)};
1271-
// NOTE: use the *current* epoch as the PG creation epoch so that the
1272-
// OSD does not have to generate a long set of PastIntervals.
1265+
// The current epoch must be the pool creation epoch
12731266
pending_creatings.pgs.emplace(
12741267
pgid,
1275-
creating_pgs_t::pg_create_info(inc.epoch,
1268+
creating_pgs_t::pg_create_info(p->second.created,
12761269
p->second.modified));
12771270
dout(10) << __func__ << " adding " << pgid << dendl;
12781271
}
1279-
p->second.start = end;
1272+
p->second.start = p->second.end;
12801273
if (p->second.done()) {
12811274
dout(10) << __func__ << " done with queue for " << poolid << dendl;
12821275
pending_creatings.queue.erase(p);

0 commit comments

Comments
 (0)