PG: remove old log when we upgrade log version

Otherwise the log_oid will be non-empty and the next
boot will cause us to try to upgrade again.

Fixes: #6057
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
This commit is contained in:
Samuel Just 2013-08-19 17:23:44 -07:00 committed by Sage Weil
parent 00080d785f
commit 1f851cb248
2 changed files with 9 additions and 0 deletions

View File

@ -2438,7 +2438,9 @@ void PG::read_state(ObjectStore *store, bufferlist &bl)
/* We don't want to leave the old format around in case the next log
* write happens to be an append_log()
*/
pg_log.mark_log_for_rewrite();
ObjectStore::Transaction t;
t.remove(coll_t(), log_oid); // remove old version
pg_log.write_log(t, log_oid);
int r = osd->store->apply_transaction(t);
assert(!r);

View File

@ -180,6 +180,13 @@ protected:
divergent_priors.insert(make_pair(version, obj));
dirty_divergent_priors = true;
}
public:
void mark_log_for_rewrite() {
mark_dirty_to(eversion_t::max());
mark_dirty_from(eversion_t());
touched_log = false;
}
protected:
/// DEBUG
set<string> log_keys_debug;