]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
PG,OSD: _remove_pg must remove pg keys
authorSamuel Just <sam.just@inktank.com>
Mon, 29 Apr 2013 16:07:19 +0000 (09:07 -0700)
committerSamuel Just <sam.just@inktank.com>
Mon, 29 Apr 2013 22:56:54 +0000 (15:56 -0700)
Instead of doing this in OSD::_remove_pg, pass a transaction
to on_removal and do it in PG.

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

index f5571c6f5dbab7e8e3718a3355a4f8ce30b12f9d..85edf66f3b4584bc826434f97929d782a88e3341 100644 (file)
@@ -5834,6 +5834,13 @@ void OSD::_remove_pg(PG *pg)
 {
   vector<coll_t> removals;
   ObjectStore::Transaction *rmt = new ObjectStore::Transaction;
+
+  // on_removal, which calls remove_watchers_and_notifies, and the erasure from
+  // the pg_map must be done together without unlocking the pg lock,
+  // to avoid racing with watcher cleanup in ms_handle_reset
+  // and handle_notify_timeout
+  pg->on_removal(rmt);
+
   coll_t to_remove = get_next_removal_coll(pg->info.pgid);
   removals.push_back(to_remove);
   rmt->collection_rename(coll_t(pg->info.pgid), to_remove);
@@ -5842,8 +5849,6 @@ void OSD::_remove_pg(PG *pg)
     removals.push_back(to_remove);
     rmt->collection_rename(pg->get_temp_coll(), to_remove);
   }
-  rmt->remove(coll_t::META_COLL, pg->log_oid);
-  rmt->remove(coll_t::META_COLL, pg->biginfo_oid);
 
   store->queue_transaction(
     pg->osr.get(), rmt,
@@ -5852,12 +5857,6 @@ void OSD::_remove_pg(PG *pg)
     new ContainerContext<
       SequencerRef>(pg->osr));
 
-  // on_removal, which calls remove_watchers_and_notifies, and the erasure from 
-  // the pg_map must be done together without unlocking the pg lock,
-  // to avoid racing with watcher cleanup in ms_handle_reset
-  // and handle_notify_timeout
-  pg->on_removal();
-
   DeletingStateRef deleting = service.deleting_pgs.lookup_or_create(pg->info.pgid);
   for (vector<coll_t>::iterator i = removals.begin();
        i != removals.end();
index c1155c33bbe1b5da571dfce0d1c0819857ab3070..70584e445912350aaf74c8f9f15fa53a9a1c5202 100644 (file)
@@ -2629,6 +2629,21 @@ void PG::write_info(ObjectStore::Transaction& t)
   dirty_big_info = false;
 }
 
+void PG::clear_info_log(
+  pg_t pgid,
+  const hobject_t &infos_oid,
+  const hobject_t &log_oid,
+  ObjectStore::Transaction *t) {
+
+  set<string> keys_to_remove;
+  keys_to_remove.insert(get_epoch_key(pgid));
+  keys_to_remove.insert(get_biginfo_key(pgid));
+  keys_to_remove.insert(get_info_key(pgid));
+
+  t->remove(coll_t::META_COLL, log_oid);
+  t->omap_rmkeys(coll_t::META_COLL, infos_oid, keys_to_remove);
+}
+
 epoch_t PG::peek_map_epoch(ObjectStore *store, coll_t coll, hobject_t &infos_oid, bufferlist *bl)
 {
   assert(bl);
index 48636476812be495aa8137b992678a2b6127fd33..bdd276d0bc7d5caef7fd252548ef61af8c0c879d 100644 (file)
@@ -1854,7 +1854,13 @@ public:
 private:
   void write_info(ObjectStore::Transaction& t);
   void write_log(ObjectStore::Transaction& t);
+
 public:
+  static void clear_info_log(
+    pg_t pgid,
+    const hobject_t &infos_oid,
+    const hobject_t &log_oid,
+    ObjectStore::Transaction *t);
 
   static int _write_info(ObjectStore::Transaction& t, epoch_t epoch,
     pg_info_t &info, coll_t coll,
@@ -1969,7 +1975,7 @@ public:
   void handle_loaded(RecoveryCtx *rctx);
   void handle_query_state(Formatter *f);
 
-  virtual void on_removal() = 0;
+  virtual void on_removal(ObjectStore::Transaction *t) = 0;
 
 
   // abstract bits
index b08fffbb235cc5afcc7fa0fbc59b7753ddd3eda8..fb24375dca6bb8f55a3964f723de783b3d94157c 100644 (file)
@@ -6241,10 +6241,12 @@ void ReplicatedPG::apply_and_flush_repops(bool requeue)
   waiting_for_ack.clear();
 }
 
-void ReplicatedPG::on_removal()
+void ReplicatedPG::on_removal(ObjectStore::Transaction *t)
 {
   dout(10) << "on_removal" << dendl;
 
+  clear_info_log(info.pgid, osd->infos_oid, log_oid, t);
+
   on_shutdown();
 }
 
index 2ef2627ba707929f4a46f854a6a188964d64f302..644a277f0dc9c2f1ea3afff6813a56b6d89dcf88 100644 (file)
@@ -1004,7 +1004,7 @@ public:
   void on_change();
   void on_activate();
   void on_flushed();
-  void on_removal();
+  void on_removal(ObjectStore::Transaction *t);
   void on_shutdown();
 };