]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: fix wrong counter for batch objects removal during remove_dir()
authorxie xingguo <xie.xingguo@zte.com.cn>
Tue, 23 Feb 2016 07:39:56 +0000 (15:39 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Sat, 12 Mar 2016 11:05:15 +0000 (19:05 +0800)
The problem here is that we may skip some meta objects which shall not be
counted since they are not really queued. Besides, the counter itself is
not very accurate, e.g., if we set osd_target_transaction_size to 30, we
may actually queue 31 transactions to trigger a commit.

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

index 874dd38c173754602f50a90ed1899ffe422b09c4..500ad777479d2d1e20ba092f2fe559e96f610e55 100644 (file)
@@ -4486,7 +4486,7 @@ bool remove_dir(
     &next);
   for (vector<ghobject_t>::iterator i = olist.begin();
        i != olist.end();
-       ++i, ++num) {
+       ++i) {
     if (i->is_pgmeta())
       continue;
     OSDriver::OSTransaction _t(osdriver->get_transaction(&t));
@@ -4495,7 +4495,7 @@ bool remove_dir(
       assert(0);
     }
     t.remove(coll, *i);
-    if (num >= cct->_conf->osd_target_transaction_size) {
+    if (++num >= cct->_conf->osd_target_transaction_size) {
       C_SaferCond waiter;
       store->queue_transaction(osr, std::move(t), &waiter);
       bool cont = dstate->pause_clearing();