diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 6a17d5e4133..d61f7a74bfa 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -479,6 +479,8 @@ int OSD::init() osdmap->decode(bl); } + clear_temp(); + // load up pgs (as they previously existed) load_pgs(); @@ -774,6 +776,28 @@ int OSD::read_superblock() +void OSD::clear_temp() +{ + dout(10) << "clear_temp" << dendl; + + vector objects; + store->collection_list(temp_coll, objects); + + dout(10) << objects.size() << " objects" << dendl; + if (objects.empty()) + return; + + // delete them. + ObjectStore::Transaction *t = new ObjectStore::Transaction; + for (vector::iterator p = objects.begin(); + p != objects.end(); + p++) + t->collection_remove(temp_coll, *p); + int r = store->queue_transaction(NULL, t); + assert(r == 0); + store->sync_and_flush(); + dout(10) << "done" << dendl; +} // ====================================================== diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 100370bfef2..b95f3430284 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -520,6 +520,8 @@ protected: // -- boot -- void send_boot(); + + void clear_temp(); // -- alive -- epoch_t up_thru_wanted;