Skip to content

Commit

Permalink
Merge pull request #10405 from athanatos/wip-ec-pg-log
Browse files Browse the repository at this point in the history
osd: fixups to explicitly persistenting missing sets

Reviewed-by: Josh Durgin <jdurgin@redhat.com>
  • Loading branch information
jdurgin committed Jul 22, 2016
2 parents b0e239d + 45995c9 commit f84be8f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/osd/PG.cc
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ void PG::proc_master_log(
assert(cct->_conf->osd_find_best_info_ignore_history_les ||
info.last_epoch_started >= info.history.last_epoch_started);

peer_missing[from].swap(omissing);
peer_missing[from].claim(omissing);
}

void PG::proc_replica_log(
Expand All @@ -344,7 +344,7 @@ void PG::proc_replica_log(
dout(20) << " after missing " << i->first << " need " << i->second.need
<< " have " << i->second.have << dendl;
}
peer_missing[from].swap(omissing);
peer_missing[from].claim(omissing);
}

bool PG::proc_replica_info(
Expand Down Expand Up @@ -7709,7 +7709,7 @@ boost::statechart::result PG::RecoveryState::WaitUpThru::react(const MLogRec& lo
{
dout(10) << "Noting missing from osd." << logevt.from << dendl;
PG *pg = context< RecoveryMachine >().pg;
pg->peer_missing[logevt.from].swap(logevt.msg->missing);
pg->peer_missing[logevt.from].claim(logevt.msg->missing);
pg->peer_info[logevt.from] = logevt.msg->info;
return discard_event();
}
Expand Down
9 changes: 3 additions & 6 deletions src/osd/osd_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -2800,7 +2800,7 @@ class ChangeTracker {
template <typename F>
void get_changed(F &&f) const {}
void flush() {}
void clean() {
bool is_clean() const {
return true;
}
};
Expand Down Expand Up @@ -2884,13 +2884,10 @@ class pg_missing_set : public pg_missing_const_i {
return item.have;
}

void swap(pg_missing_set& o) {
for (auto &&i: missing)
tracker.changed(i.first);
void claim(pg_missing_set& o) {
static_assert(!TrackChanges, "Can't use claim with TrackChanges");
missing.swap(o.missing);
rmissing.swap(o.rmissing);
for (auto &&i: missing)
tracker.changed(i.first);
}

/*
Expand Down
5 changes: 2 additions & 3 deletions src/test/osd/types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ TEST(pg_missing_t, have_missing)
EXPECT_TRUE(missing.have_missing());
}

TEST(pg_missing_t, swap)
TEST(pg_missing_t, claim)
{
hobject_t oid(object_t("objname"), "key", 123, 456, 0, "");
pg_missing_t missing;
Expand All @@ -760,8 +760,7 @@ TEST(pg_missing_t, swap)
pg_missing_t other;
EXPECT_FALSE(other.have_missing());

other.swap(missing);
EXPECT_FALSE(missing.have_missing());
other.claim(missing);
EXPECT_TRUE(other.have_missing());
}

Expand Down

0 comments on commit f84be8f

Please sign in to comment.