]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG: remove from snap_collections even without objects to trim
authorSamuel Just <sam.just@inktank.com>
Thu, 15 Nov 2012 21:35:47 +0000 (13:35 -0800)
committerSamuel Just <sam.just@inktank.com>
Thu, 29 Nov 2012 21:51:52 +0000 (13:51 -0800)
Also, make sure to write_info after updating snap_collections.

Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/ReplicatedPG.cc

index 3dd5e9566d62694465a4d906ce7121caa3a28ddd..379205a01681974796516c53e53cf89c8334ae35 100644 (file)
@@ -7064,10 +7064,15 @@ boost::statechart::result ReplicatedPG::NotTrimming::react(const SnapTrim&)
     dout(10) << "NotTrimming: obs_to_trim empty!" << dendl;
     dout(10) << "purged_snaps now " << pg->info.purged_snaps << ", snap_trimq now " 
             << pg->snap_trimq << dendl;
-    ObjectStore::Transaction *t = new ObjectStore::Transaction;
-    t->remove_collection(col_to_trim);
-    int r = pg->osd->store->queue_transaction(NULL, t, new ObjectStore::C_DeleteTransaction(t));
-    assert(r == 0);
+    if (pg->snap_collections.contains(snap_to_trim)) {
+      ObjectStore::Transaction *t = new ObjectStore::Transaction;
+      pg->snap_collections.erase(snap_to_trim);
+      t->remove_collection(col_to_trim);
+      pg->write_info(*t);
+      int r = pg->osd->store->queue_transaction(
+       NULL, t, new ObjectStore::C_DeleteTransaction(t));
+      assert(r == 0);
+    }
     post_event(SnapTrim());
     return discard_event();
   } else {
@@ -7118,9 +7123,10 @@ boost::statechart::result ReplicatedPG::RepColTrim::react(const SnapTrim&)
     t->collection_remove(col_to_trim, *i);
   }
   t->remove_collection(col_to_trim);
+  pg->snap_collections.erase(snap_to_trim);
+  pg->write_info(*t);
   int r = pg->osd->store->queue_transaction(NULL, t, new ObjectStore::C_DeleteTransaction(t));
   assert(r == 0);
-  pg->snap_collections.erase(snap_to_trim);
   return discard_event();
 }