diff options
author | Samuel Just <sam.just@inktank.com> | 2013-08-19 17:23:44 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-08-19 22:51:05 -0700 |
commit | 1f851cb2489a95526de932ec6734ebf413e43490 (patch) | |
tree | 9ade4d4f3392ab8ff33b498166f75beece2e5207 | |
parent | 00080d785f6695b800f71317a3048a21064e61cb (diff) | |
download | ceph-1f851cb2489a95526de932ec6734ebf413e43490.tar.gz |
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>
-rw-r--r-- | src/osd/PG.cc | 2 | ||||
-rw-r--r-- | src/osd/PGLog.h | 7 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 5d6cdca9b6a..49ea61a603a 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -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); diff --git a/src/osd/PGLog.h b/src/osd/PGLog.h index 955b9c18937..552f9b0cee9 100644 --- a/src/osd/PGLog.h +++ b/src/osd/PGLog.h @@ -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; |