]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD: kill old split code, it's been dead for a while
authorSamuel Just <sam.just@inktank.com>
Mon, 20 May 2013 22:19:35 +0000 (15:19 -0700)
committerSamuel Just <sam.just@inktank.com>
Mon, 20 May 2013 22:32:53 +0000 (15:32 -0700)
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: David Zafman <david.zafman@inktank.com>
src/osd/OSD.cc
src/osd/OSD.h

index 2c5cc07e04f117bec9e9ef85edb574c094db38c4..fbc0555ed143c9d3f38cc850c43ba9396101a7c3 100644 (file)
@@ -5050,164 +5050,6 @@ void OSD::split_pgs(
   parent->write_if_dirty(*(rctx->transaction));
 }
   
-
-void OSD::do_split(PG *parent, set<pg_t>& childpgids, ObjectStore::Transaction& t,
-                  C_Contexts *tfin)
-{
-  dout(10) << "do_split to " << childpgids << " on " << *parent << dendl;
-
-  parent->lock();
-  // create and lock children
-  map<pg_t,PG*> children;
-  for (set<pg_t>::iterator q = childpgids.begin();
-       q != childpgids.end();
-       ++q) {
-    pg_history_t history;
-    history.epoch_created = history.same_up_since =
-      history.same_interval_since = history.same_primary_since =
-      osdmap->get_epoch();
-    pg_interval_map_t pi;
-    PG *pg = _create_lock_pg(service.get_osdmap(), *q, true, true,
-                            parent->get_role(), parent->up, parent->acting, history, pi, t);
-    children[*q] = pg;
-    dout(10) << "  child " << *pg << dendl;
-  }
-
-  split_pg(parent, children, t); 
-
-#if 0
-  // reset pg
-  map< int, vector<pair<pg_notify_t, pg_interval_map_t> > >  notify_list;  // primary -> list
-  map< int, map<pg_t,pg_query_t> > query_map;    // peer -> PG -> get_summary_since
-  map<int,vector<pair<pg_notify_t, pg_interval_map_t> > > info_map;  // peer -> message
-  PG::RecoveryCtx rctx(&query_map, &info_map, &notify_list, &tfin->contexts, &t);
-
-  // FIXME: this breaks if we have a map discontinuity
-  //parent->handle_split(osdmap, get_map(osdmap->get_epoch() - 1), &rctx);
-
-  // unlock parent, children
-  parent->unlock();
-
-  for (map<pg_t,PG*>::iterator q = children.begin(); q != children.end(); ++q) {
-    PG *pg = q->second;
-    pg->handle_create(&rctx);
-    pg->write_if_dirty(t);
-    wake_pg_waiters(pg->info.pgid);
-    pg->unlock();
-  }
-
-  do_notifies(notify_list);
-  do_queries(query_map);
-  do_infos(info_map);
-#endif
-}
-
-void OSD::split_pg(PG *parent, map<pg_t,PG*>& children, ObjectStore::Transaction &t)
-{
-  dout(10) << "split_pg " << *parent << dendl;
-  pg_t parentid = parent->info.pgid;
-
-  // split objects
-  vector<hobject_t> olist;
-  store->collection_list(coll_t(parent->info.pgid), olist);
-
-  for (vector<hobject_t>::iterator p = olist.begin(); p != olist.end(); ++p) {
-    hobject_t poid = *p;
-    object_locator_t oloc(parentid.pool());
-    if (poid.get_key().size())
-      oloc.key = poid.get_key();
-    pg_t rawpg = osdmap->object_locator_to_pg(poid.oid, oloc);
-    pg_t pgid = osdmap->raw_pg_to_pg(rawpg);
-    if (pgid != parentid) {
-      dout(20) << "  moving " << poid << " from " << parentid << " -> " << pgid << dendl;
-      PG *child = children[pgid];
-      assert(child);
-      bufferlist bv;
-
-      struct stat st;
-      store->stat(coll_t(parentid), poid, &st);
-      store->getattr(coll_t(parentid), poid, OI_ATTR, bv);
-      object_info_t oi(bv);
-
-      t.collection_move(coll_t(pgid), coll_t(parentid), poid);
-      if (!oi.snaps.empty()) {
-       snapid_t first = oi.snaps[0];
-       t.collection_move(coll_t(pgid, first), coll_t(parentid), poid);
-       if (oi.snaps.size() > 1) {
-         snapid_t last = oi.snaps[oi.snaps.size()-1];
-         t.collection_move(coll_t(pgid, last), coll_t(parentid), poid);
-       }
-      }
-
-      // add to child stats
-      child->info.stats.stats.sum.num_bytes += st.st_size;
-      child->info.stats.stats.sum.num_objects++;
-      if (poid.snap && poid.snap != CEPH_NOSNAP)
-       child->info.stats.stats.sum.num_object_clones++;
-    } else {
-      dout(20) << " leaving " << poid << "   in " << parentid << dendl;
-    }
-  }
-
-  // split log
-  parent->log.index();
-  dout(20) << " parent " << parent->info.pgid << " log was ";
-  parent->log.print(*_dout);
-  *_dout << dendl;
-  parent->log.unindex();
-
-  list<pg_log_entry_t>::iterator p = parent->log.log.begin();
-  while (p != parent->log.log.end()) {
-    list<pg_log_entry_t>::iterator cur = p;
-    ++p;
-    hobject_t& poid = cur->soid;
-    object_locator_t oloc(parentid.pool());
-    if (poid.get_key().size())
-      oloc.key = poid.get_key();
-    pg_t rawpg = osdmap->object_locator_to_pg(poid.oid, oloc);
-    pg_t pgid = osdmap->raw_pg_to_pg(rawpg);
-    if (pgid != parentid) {
-      dout(20) << "  moving " << *cur << " from " << parentid << " -> " << pgid << dendl;
-      PG *child = children[pgid];
-
-      child->log.log.splice(child->log.log.end(), parent->log.log, cur);
-    }
-  }
-
-  parent->log.index();
-  dout(20) << " parent " << parent->info.pgid << " log now ";
-  parent->log.print(*_dout);
-  *_dout << dendl;
-
-  for (map<pg_t,PG*>::iterator p = children.begin();
-       p != children.end();
-       ++p) {
-    PG *child = p->second;
-
-    // fix log bounds
-    if (!child->log.empty()) {
-      child->log.head = child->log.log.rbegin()->version;
-      child->log.tail =  parent->log.tail;
-      child->log.index();
-    }
-    child->info.last_update = child->log.head;
-    child->info.last_complete = child->info.last_update;
-    child->info.log_tail = parent->log.tail;
-    child->info.history.last_epoch_split = osdmap->get_epoch();
-
-    child->snap_trimq = parent->snap_trimq;
-
-    dout(20) << " child " << p->first << " log now ";
-    child->log.print(*_dout);
-    *_dout << dendl;
-
-    // sub off child stats
-    parent->info.stats.sub(child->info.stats);
-  }
-}  
-
-
 /*
  * holding osd_lock
  */
index b14592880aac824a5771508865541e969abf0a14..bc6ae94f15e3427994e21f637abd75b6d163a574 100644 (file)
@@ -1076,8 +1076,6 @@ protected:
   bool can_create_pg(pg_t pgid);
   void handle_pg_create(OpRequestRef op);
 
-  void do_split(PG *parent, set<pg_t>& children, ObjectStore::Transaction &t, C_Contexts *tfin);
-  void split_pg(PG *parent, map<pg_t,PG*>& children, ObjectStore::Transaction &t);
   void split_pgs(
     PG *parent,
     const set<pg_t> &childpgids, set<boost::intrusive_ptr<PG> > *out_pgs,