Skip to content

Commit

Permalink
Merge pull request #15649 from liewegas/wip-20274
Browse files Browse the repository at this point in the history
osd/PrimaryLogPG: record prior_version for DELETE events

Reviewed-by: Josh Durgin <jdurgin@redhat.com>
  • Loading branch information
liewegas committed Jun 22, 2017
2 parents 8d8f2c3 + 7879efd commit dd8fed5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
3 changes: 2 additions & 1 deletion src/osd/PG.cc
Expand Up @@ -1725,7 +1725,8 @@ void PG::activate(ObjectStore::Transaction& t,
for (list<pg_log_entry_t>::iterator p = m->log.log.begin();
p != m->log.log.end();
++p)
if (p->soid <= pi.last_backfill)
if (p->soid <= pi.last_backfill &&
!p->is_error())
pm.add_next_event(*p);
}

Expand Down
32 changes: 20 additions & 12 deletions src/osd/PGLog.h
Expand Up @@ -584,10 +584,6 @@ struct PGLog : DoutPrefixProvider {
missing.add(oid, need, have);
}

void missing_add_event(const pg_log_entry_t &e) {
missing.add_next_event(e);
}

//////////////////// get or set log ////////////////////

const IndexedLog &get_log() const { return log; }
Expand Down Expand Up @@ -739,15 +735,15 @@ struct PGLog : DoutPrefixProvider {
static void _merge_object_divergent_entries(
const IndexedLog &log, ///< [in] log to merge against
const hobject_t &hoid, ///< [in] object we are merging
const mempool::osd_pglog::list<pg_log_entry_t> &entries, ///< [in] entries for hoid to merge
const mempool::osd_pglog::list<pg_log_entry_t> &orig_entries, ///< [in] entries for hoid to merge
const pg_info_t &info, ///< [in] info for merging entries
eversion_t olog_can_rollback_to, ///< [in] rollback boundary
missing_type &missing, ///< [in,out] missing to adjust, use
LogEntryHandler *rollbacker, ///< [in] optional rollbacker object
const DoutPrefixProvider *dpp ///< [in] logging provider
) {
ldpp_dout(dpp, 20) << __func__ << ": merging hoid " << hoid
<< " entries: " << entries << dendl;
<< " entries: " << orig_entries << dendl;

if (hoid > info.last_backfill) {
ldpp_dout(dpp, 10) << __func__ << ": hoid " << hoid << " after last_backfill"
Expand All @@ -756,20 +752,32 @@ struct PGLog : DoutPrefixProvider {
}

// entries is non-empty
assert(!entries.empty());
assert(!orig_entries.empty());
// strip out and ignore ERROR entries
mempool::osd_pglog::list<pg_log_entry_t> entries;
eversion_t last;
for (list<pg_log_entry_t>::const_iterator i = entries.begin();
i != entries.end();
for (list<pg_log_entry_t>::const_iterator i = orig_entries.begin();
i != orig_entries.end();
++i) {
// all entries are on hoid
assert(i->soid == hoid);
if (i != entries.begin() && i->prior_version != eversion_t()) {
if (i != orig_entries.begin() && i->prior_version != eversion_t()) {
// in increasing order of version
assert(i->version > last);
// prior_version correct
assert(i->prior_version == last);
// prior_version correct (unless it is an ERROR entry)
assert(i->prior_version == last || i->is_error());
}
last = i->version;
if (i->is_error()) {
ldpp_dout(dpp, 20) << __func__ << ": ignoring " << *i << dendl;
} else {
ldpp_dout(dpp, 20) << __func__ << ": keeping " << *i << dendl;
entries.push_back(*i);
}
}
if (entries.empty()) {
ldpp_dout(dpp, 10) << __func__ << ": no non-ERROR entries" << dendl;
return;
}

const eversion_t prior_version = entries.begin()->prior_version;
Expand Down

0 comments on commit dd8fed5

Please sign in to comment.