From: Sage Weil Date: Thu, 4 Feb 2016 14:24:22 +0000 (-0500) Subject: os/memstore/MemStore: set Collection::cid on create X-Git-Tag: v10.0.4~34^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F7521%2Fhead;p=ceph.git os/memstore/MemStore: set Collection::cid on create This was broken by the collection handles merge in 2e52a8b17c348bb3356eb76a8a0f6ef6efbe5bd3 because the c->cid value was never initialized and now we started to rely on it. Signed-off-by: Sage Weil --- diff --git a/src/os/memstore/MemStore.cc b/src/os/memstore/MemStore.cc index cd0cd3610e8..68972dd51db 100644 --- a/src/os/memstore/MemStore.cc +++ b/src/os/memstore/MemStore.cc @@ -157,7 +157,7 @@ int MemStore::_load() int r = cbl.read_file(fn.c_str(), &err); if (r < 0) return r; - CollectionRef c(new Collection(cct)); + CollectionRef c(new Collection(cct, *q)); bufferlist::iterator p = cbl.begin(); c->decode(p); coll_map[*q] = c; @@ -466,6 +466,8 @@ int MemStore::collection_list(const coll_t& cid, ghobject_t start, ghobject_t en return -ENOENT; RWLock::RLocker l(c->lock); + dout(10) << __func__ << " cid " << cid << " start " << start + << " end " << end << dendl; map::iterator p = c->object_map.lower_bound(start); while (p != c->object_map.end() && ls->size() < (unsigned)max && @@ -479,6 +481,7 @@ int MemStore::collection_list(const coll_t& cid, ghobject_t start, ghobject_t en else *next = p->first; } + dout(10) << __func__ << " cid " << cid << " got " << ls->size() << dendl; return 0; } @@ -1281,7 +1284,7 @@ int MemStore::_create_collection(const coll_t& cid) auto result = coll_map.insert(std::make_pair(cid, CollectionRef())); if (!result.second) return -EEXIST; - result.first->second.reset(new Collection(cct)); + result.first->second.reset(new Collection(cct, cid)); return 0; } diff --git a/src/os/memstore/MemStore.h b/src/os/memstore/MemStore.h index df37d881652..2d809f3384f 100644 --- a/src/os/memstore/MemStore.h +++ b/src/os/memstore/MemStore.h @@ -243,8 +243,10 @@ public: return result; } - explicit Collection(CephContext *cct) - : cct(cct), use_page_set(cct->_conf->memstore_page_set), + explicit Collection(CephContext *cct, coll_t c) + : cid(c), + cct(cct), + use_page_set(cct->_conf->memstore_page_set), lock("MemStore::Collection::lock", true, false), exists(true) {} };