mirror of
https://github.com/ceph/ceph
synced 2025-01-01 08:32:24 +00:00
OSD: clear_temp: split delete into many transactions
Signed-off-by: Samuel Just <sam.just@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com>
This commit is contained in:
parent
145d1c146b
commit
88c7629e04
@ -1115,13 +1115,21 @@ void OSD::clear_temp(ObjectStore *store, coll_t tmp)
|
||||
return;
|
||||
|
||||
// delete them.
|
||||
ObjectStore::Transaction *t = new ObjectStore::Transaction;
|
||||
ObjectStore::Transaction t;
|
||||
unsigned removed = 0;
|
||||
for (vector<hobject_t>::iterator p = objects.begin();
|
||||
p != objects.end();
|
||||
p++)
|
||||
t->collection_remove(tmp, *p);
|
||||
t->remove_collection(tmp);
|
||||
int r = store->queue_transaction(NULL, t);
|
||||
p++, removed++) {
|
||||
t.collection_remove(tmp, *p);
|
||||
if (removed > 300) {
|
||||
int r = store->apply_transaction(t);
|
||||
assert(r == 0);
|
||||
t = ObjectStore::Transaction();
|
||||
removed = 0;
|
||||
}
|
||||
}
|
||||
t.remove_collection(tmp);
|
||||
int r = store->apply_transaction(t);
|
||||
assert(r == 0);
|
||||
store->sync_and_flush();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user