]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD: clear_temp: split delete into many transactions
authorSamuel Just <sam.just@inktank.com>
Tue, 19 Jun 2012 21:29:48 +0000 (14:29 -0700)
committerSage Weil <sage@inktank.com>
Wed, 20 Jun 2012 00:34:20 +0000 (17:34 -0700)
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
src/osd/OSD.cc

index 9c73020aafca13fc9efa61b56b87244c753fc224..3cd6bd7e9198804fca535af016d02f4425513b85 100644 (file)
@@ -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();
 }