Skip to content

Commit 0d76061

Browse files
authored
Merge pull request ceph#63843 from aainscow/ec_scrub_pr2
Optimised EC: Ignore snapshot scrubbing on non-primary shards
2 parents 9cde3e2 + 6bae0a0 commit 0d76061

File tree

1 file changed

+37
-35
lines changed

1 file changed

+37
-35
lines changed

src/osd/scrubber/scrub_backend.cc

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1809,50 +1809,52 @@ std::vector<snap_mapper_fix_t> ScrubBackend::scan_snaps(
18091809
// in this function
18101810
dout(15) << "_scan_snaps starts" << dendl;
18111811

1812-
for (auto i = smap.objects.rbegin(); i != smap.objects.rend(); ++i) {
1812+
if (!m_pg.get_is_nonprimary_shard(m_pg_whoami)) {
1813+
for (auto i = smap.objects.rbegin(); i != smap.objects.rend(); ++i) {
18131814

1814-
const hobject_t& hoid = i->first;
1815-
ScrubMap::object& o = i->second;
1815+
const hobject_t& hoid = i->first;
1816+
ScrubMap::object& o = i->second;
18161817

1817-
dout(20) << __func__ << " " << hoid << dendl;
1818+
dout(20) << __func__ << " " << hoid << dendl;
18181819

1819-
ceph_assert(!hoid.is_snapdir());
1820+
ceph_assert(!hoid.is_snapdir());
18201821

1821-
if (hoid.is_head()) {
1822-
// parse the SnapSet
1823-
if (o.attrs.find(SS_ATTR) == o.attrs.end()) {
1824-
// no snaps for this head
1825-
continue;
1826-
}
1827-
auto p = o.attrs[SS_ATTR].cbegin();
1828-
try {
1829-
decode(snapset, p);
1830-
} catch (...) {
1831-
dout(20) << fmt::format("{}: failed to decode the snapset ({})",
1832-
__func__,
1833-
hoid)
1834-
<< dendl;
1835-
continue;
1822+
if (hoid.is_head()) {
1823+
// parse the SnapSet
1824+
if (o.attrs.find(SS_ATTR) == o.attrs.end()) {
1825+
// no snaps for this head
1826+
continue;
1827+
}
1828+
auto p = o.attrs[SS_ATTR].cbegin();
1829+
try {
1830+
decode(snapset, p);
1831+
} catch (...) {
1832+
dout(20) << fmt::format("{}: failed to decode the snapset ({})",
1833+
__func__,
1834+
hoid)
1835+
<< dendl;
1836+
continue;
1837+
}
1838+
head = hoid.get_head();
1839+
continue;
18361840
}
1837-
head = hoid.get_head();
1838-
continue;
1839-
}
18401841

1841-
/// \todo document why guaranteed to have initialized 'head' at this point
1842+
/// \todo document why guaranteed to have initialized 'head' at this point
18421843

1843-
if (hoid.snap < CEPH_MAXSNAP) {
1844+
if (hoid.snap < CEPH_MAXSNAP) {
18441845

1845-
if (hoid.get_head() != head) {
1846-
derr << __func__ << " no head for " << hoid << " (have " << head << ")"
1847-
<< dendl;
1848-
continue;
1849-
}
1846+
if (hoid.get_head() != head) {
1847+
derr << __func__ << " no head for " << hoid << " (have " << head << ")"
1848+
<< dendl;
1849+
continue;
1850+
}
18501851

1851-
// the 'hoid' is a clone hoid at this point. The 'snapset' below was taken
1852-
// from the corresponding head hoid.
1853-
auto maybe_fix_order = scan_object_snaps(hoid, snapset, snaps_getter);
1854-
if (maybe_fix_order) {
1855-
out_orders.push_back(std::move(*maybe_fix_order));
1852+
// the 'hoid' is a clone hoid at this point. The 'snapset' below was taken
1853+
// from the corresponding head hoid.
1854+
auto maybe_fix_order = scan_object_snaps(hoid, snapset, snaps_getter);
1855+
if (maybe_fix_order) {
1856+
out_orders.push_back(std::move(*maybe_fix_order));
1857+
}
18561858
}
18571859
}
18581860
}

0 commit comments

Comments
 (0)