From b778f830324137dda0b9a63ddd2a4df45450598d Mon Sep 17 00:00:00 2001 From: Colin Patrick McCabe Date: Wed, 6 Oct 2010 16:01:18 -0700 Subject: [PATCH] osd: on clearing corrupt logs, call pg::write_info After changing PG::info, call PG::write_info to get the on-disk information back in sync with the in-memory state. Signed-off-by: Colin McCabe --- src/osd/PG.cc | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index d8cda15febe3e..683ab3505ee7c 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -2420,24 +2420,29 @@ void PG::read_state(ObjectStore *store) read_log(store); } catch (const buffer::error &e) { - // Pretend that there is no ondisklog string cr_log_coll_name(get_corrupt_pg_log_name()); dout(0) << "Got exception '" << e.what() << "' while reading log. " << "Moving corrupted log file to '" << cr_log_coll_name << "' for later " << "analysis." << dendl; + + ondisklog.zero(); + + // clear log index + log.head = log.tail = info.last_update; + + // reset info + info.log_tail = info.last_update; + info.log_backlog = false; + + // Move the corrupt log to a new place and create a new zero-length log entry. ObjectStore::Transaction t; coll_t cr_log_coll(cr_log_coll_name); t.create_collection(cr_log_coll); t.collection_add(cr_log_coll, coll_t::META_COLL, log_oid); t.collection_remove(coll_t::META_COLL, log_oid); t.touch(coll_t::META_COLL, log_oid); + write_info(t); store->apply_transaction(t); - - // clear the log - ondisklog.zero(); - log.head = log.tail = info.last_update; - info.log_tail = info.last_update; - info.log_backlog = false; } } -- 2.39.5