]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: don't get transaction too big during clear_temp_objects()
authorxie xingguo <xie.xingguo@zte.com.cn>
Wed, 3 Aug 2016 06:56:17 +0000 (14:56 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Wed, 3 Aug 2016 23:05:43 +0000 (07:05 +0800)
Basically we don't allow a transaction to get too big, e.g., to
avoid contiguously occupation of CPU.

We break and queue the transaction here whenever we have collected
osd_target_transaction_size temp objects.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/osd/OSD.cc

index 677caee0d29fd3c13e21b18386f1853380af968e..a1ee89be5b39c25b52e3a98b1e3bdf825dcc351b 100644 (file)
@@ -2920,11 +2920,19 @@ void OSD::clear_temp_objects()
     }
     if (!temps.empty()) {
       ObjectStore::Transaction t;
+      int removed = 0;
       for (vector<ghobject_t>::iterator q = temps.begin(); q != temps.end(); ++q) {
        dout(20) << "  removing " << *p << " object " << *q << dendl;
        t.remove(*p, *q);
+        if (++removed > cct->_conf->osd_target_transaction_size) {
+          store->apply_transaction(service.meta_osr.get(), std::move(t));
+          t = ObjectStore::Transaction();
+          removed = 0;
+        }
+      }
+      if (removed) {
+        store->apply_transaction(service.meta_osr.get(), std::move(t));
       }
-      store->apply_transaction(service.meta_osr.get(), std::move(t));
     }
   }
 }