mirror of
https://github.com/ceph/ceph
synced 2025-02-21 18:17:42 +00:00
osd/: clarify rebuilt_missing_with_deletes and set in init
Updates PeeringState::init to set may_include_deletes_in_missing when possible to avoid needlessly rebuilding the missing set on the next map. The previous behavior was also subtly wrong as until the the next map the osd would be possibly adding deletes to the missing set without the flag having been set in the missing set on disk This patch also renames the flag to reflect the fact that it simply denotes wheter the may_include_deletes_in_missing omap entry needs to be written out. This may happen during rebuild_missing_set_with_deletes, but it'll also happen more commonly during init now. Signed-off-by: Samuel Just <sjust@redhat.com>
This commit is contained in:
parent
8c86678ba7
commit
6d66072cc4
@ -644,7 +644,7 @@ void PGLog::write_log_and_missing(
|
||||
dirty_to_dups,
|
||||
dirty_from_dups,
|
||||
write_from_dups,
|
||||
&rebuilt_missing_with_deletes,
|
||||
&may_include_deletes_in_missing_dirty,
|
||||
(pg_log_debug ? &log_keys_debug : nullptr));
|
||||
undirty();
|
||||
} else {
|
||||
@ -678,7 +678,7 @@ void PGLog::write_log_and_missing(
|
||||
const ghobject_t &log_oid,
|
||||
const pg_missing_tracker_t &missing,
|
||||
bool require_rollback,
|
||||
bool *rebuilt_missing_with_deletes)
|
||||
bool *may_include_deletes_in_missing_dirty)
|
||||
{
|
||||
_write_log_and_missing(
|
||||
t, km, log, coll, log_oid,
|
||||
@ -692,7 +692,7 @@ void PGLog::write_log_and_missing(
|
||||
eversion_t::max(),
|
||||
eversion_t(),
|
||||
eversion_t(),
|
||||
rebuilt_missing_with_deletes, nullptr);
|
||||
may_include_deletes_in_missing_dirty, nullptr);
|
||||
}
|
||||
|
||||
// static
|
||||
@ -828,7 +828,7 @@ void PGLog::_write_log_and_missing(
|
||||
eversion_t dirty_to_dups,
|
||||
eversion_t dirty_from_dups,
|
||||
eversion_t write_from_dups,
|
||||
bool *rebuilt_missing_with_deletes, // in/out param
|
||||
bool *may_include_deletes_in_missing_dirty, // in/out param
|
||||
set<string> *log_keys_debug
|
||||
) {
|
||||
set<string> to_remove;
|
||||
@ -931,9 +931,9 @@ void PGLog::_write_log_and_missing(
|
||||
}
|
||||
// since we encode individual missing items instead of a whole
|
||||
// missing set, we need another key to store this bit of state
|
||||
if (*rebuilt_missing_with_deletes) {
|
||||
if (*may_include_deletes_in_missing_dirty) {
|
||||
(*km)["may_include_deletes_in_missing"] = bufferlist();
|
||||
*rebuilt_missing_with_deletes = false;
|
||||
*may_include_deletes_in_missing_dirty = false;
|
||||
}
|
||||
missing.get_changed(
|
||||
[&](const hobject_t &obj) {
|
||||
@ -975,7 +975,6 @@ void PGLog::rebuild_missing_set_with_deletes(
|
||||
}
|
||||
}
|
||||
missing.clear();
|
||||
missing.may_include_deletes = true;
|
||||
|
||||
// go through the log and add items that are not present or older
|
||||
// versions on disk, just as if we were reading the log + metadata
|
||||
@ -1014,5 +1013,6 @@ void PGLog::rebuild_missing_set_with_deletes(
|
||||
for (const auto& p : extra_missing) {
|
||||
missing.add(p.first, p.second.need, p.second.have, p.second.is_delete());
|
||||
}
|
||||
rebuilt_missing_with_deletes = true;
|
||||
|
||||
set_missing_may_contain_deletes();
|
||||
}
|
||||
|
@ -571,7 +571,7 @@ protected:
|
||||
/// Log is clean on [dirty_to, dirty_from)
|
||||
bool touched_log;
|
||||
bool clear_divergent_priors;
|
||||
bool rebuilt_missing_with_deletes = false;
|
||||
bool may_include_deletes_in_missing_dirty = false;
|
||||
|
||||
void mark_dirty_to(eversion_t to) {
|
||||
if (to > dirty_to)
|
||||
@ -608,7 +608,7 @@ public:
|
||||
(dirty_to_dups != eversion_t()) ||
|
||||
(dirty_from_dups != eversion_t::max()) ||
|
||||
(write_from_dups != eversion_t::max()) ||
|
||||
rebuilt_missing_with_deletes;
|
||||
may_include_deletes_in_missing_dirty;
|
||||
}
|
||||
|
||||
void mark_log_for_rewrite() {
|
||||
@ -618,8 +618,8 @@ public:
|
||||
mark_dirty_from_dups(eversion_t());
|
||||
touched_log = false;
|
||||
}
|
||||
bool get_rebuilt_missing_with_deletes() const {
|
||||
return rebuilt_missing_with_deletes;
|
||||
bool get_may_include_deletes_in_missing_dirty() const {
|
||||
return may_include_deletes_in_missing_dirty;
|
||||
}
|
||||
protected:
|
||||
|
||||
@ -763,8 +763,9 @@ public:
|
||||
opg_log->mark_dirty_to_dups(eversion_t::max());
|
||||
mark_dirty_to(eversion_t::max());
|
||||
mark_dirty_to_dups(eversion_t::max());
|
||||
if (missing.may_include_deletes)
|
||||
opg_log->rebuilt_missing_with_deletes = true;
|
||||
if (missing.may_include_deletes) {
|
||||
opg_log->set_missing_may_contain_deletes();
|
||||
}
|
||||
}
|
||||
|
||||
void merge_from(
|
||||
@ -839,6 +840,11 @@ public:
|
||||
const pg_log_t &olog,
|
||||
pg_missing_t& omissing, pg_shard_t from) const;
|
||||
|
||||
void set_missing_may_contain_deletes() {
|
||||
missing.may_include_deletes = true;
|
||||
may_include_deletes_in_missing_dirty = true;
|
||||
}
|
||||
|
||||
void rebuild_missing_set_with_deletes(ObjectStore *store,
|
||||
ObjectStore::CollectionHandle& ch,
|
||||
const pg_info_t &info);
|
||||
@ -1302,7 +1308,7 @@ public:
|
||||
eversion_t dirty_to_dups,
|
||||
eversion_t dirty_from_dups,
|
||||
eversion_t write_from_dups,
|
||||
bool *rebuilt_missing_with_deletes,
|
||||
bool *may_include_deletes_in_missing_dirty,
|
||||
set<string> *log_keys_debug
|
||||
);
|
||||
|
||||
|
@ -728,12 +728,12 @@ void PeeringState::on_new_interval()
|
||||
<< get_pg_log().get_missing() << dendl;
|
||||
|
||||
if (!pg_log.get_missing().may_include_deletes &&
|
||||
get_osdmap()->test_flag(CEPH_OSDMAP_RECOVERY_DELETES)) {
|
||||
!perform_deletes_during_peering()) {
|
||||
pl->rebuild_missing_set_with_deletes(pg_log);
|
||||
}
|
||||
ceph_assert(
|
||||
pg_log.get_missing().may_include_deletes == get_osdmap()->test_flag(
|
||||
CEPH_OSDMAP_RECOVERY_DELETES));
|
||||
pg_log.get_missing().may_include_deletes ==
|
||||
!perform_deletes_during_peering());
|
||||
|
||||
pl->on_new_interval();
|
||||
}
|
||||
@ -3354,6 +3354,10 @@ void PeeringState::init(
|
||||
info.stats.acting_primary = new_acting_primary;
|
||||
info.stats.mapping_epoch = info.history.same_interval_since;
|
||||
|
||||
if (!perform_deletes_during_peering()) {
|
||||
pg_log.set_missing_may_contain_deletes();
|
||||
}
|
||||
|
||||
if (backfill) {
|
||||
psdout(10) << __func__ << ": Setting backfill" << dendl;
|
||||
info.set_last_backfill(hobject_t());
|
||||
|
@ -2271,23 +2271,23 @@ TEST_F(PGLogTest, split_into_preserves_may_include_deletes) {
|
||||
clear();
|
||||
|
||||
{
|
||||
rebuilt_missing_with_deletes = false;
|
||||
may_include_deletes_in_missing_dirty = false;
|
||||
missing.may_include_deletes = true;
|
||||
PGLog child_log(cct);
|
||||
pg_t child_pg;
|
||||
split_into(child_pg, 6, &child_log);
|
||||
ASSERT_TRUE(child_log.get_missing().may_include_deletes);
|
||||
ASSERT_TRUE(child_log.get_rebuilt_missing_with_deletes());
|
||||
ASSERT_TRUE(child_log.get_may_include_deletes_in_missing_dirty());
|
||||
}
|
||||
|
||||
{
|
||||
rebuilt_missing_with_deletes = false;
|
||||
may_include_deletes_in_missing_dirty = false;
|
||||
missing.may_include_deletes = false;
|
||||
PGLog child_log(cct);
|
||||
pg_t child_pg;
|
||||
split_into(child_pg, 6, &child_log);
|
||||
ASSERT_FALSE(child_log.get_missing().may_include_deletes);
|
||||
ASSERT_FALSE(child_log.get_rebuilt_missing_with_deletes());
|
||||
ASSERT_FALSE(child_log.get_may_include_deletes_in_missing_dirty());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user