osd: clean out temp pg on startup

This commit is contained in:
Sage Weil 2010-07-19 10:48:48 -07:00
parent e0b6255750
commit 2e137c9a0f
2 changed files with 26 additions and 0 deletions

View File

@ -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<sobject_t> 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<sobject_t>::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;
}
// ======================================================

View File

@ -520,6 +520,8 @@ protected:
// -- boot --
void send_boot();
void clear_temp();
// -- alive --
epoch_t up_thru_wanted;