We need this to reinstantiate semi-deleted ec backends.
Signed-off-by: Sage Weil <sage@redhat.com>
{
dout(10) << __func__ << " " << pgid << dendl;
pg_pool_t pi;
+ map<string,string> ec_profile;
string name;
if (createmap->have_pg_pool(pgid.pool())) {
pi = *createmap->get_pg_pool(pgid.pool());
name = createmap->get_pool_name(pgid.pool());
+ if (pi.is_erasure()) {
+ ec_profile = createmap->get_erasure_code_profile(pi.erasure_code_profile);
+ }
} else {
// pool was deleted; grab final pg_pool_t off disk.
ghobject_t oid = make_final_pool_info_oid(pgid.pool());
auto p = bl.begin();
decode(pi, p);
decode(name, p);
+ decode(ec_profile, p);
}
PGPool pool(cct, createmap, pgid.pool(), pi, name);
PG *pg;
if (pi.type == pg_pool_t::TYPE_REPLICATED ||
pi.type == pg_pool_t::TYPE_ERASURE)
- pg = new PrimaryLogPG(&service, createmap, pool, pgid);
+ pg = new PrimaryLogPG(&service, createmap, pool, ec_profile, pgid);
else
ceph_abort();
return pg;
encode(j.second, bl, CEPH_FEATURES_ALL);
string name = lastmap->get_pool_name(j.first);
encode(name, bl);
+ map<string,string> profile;
+ if (lastmap->get_pg_pool(j.first)->is_erasure()) {
+ profile = lastmap->get_erasure_code_profile(
+ lastmap->get_pg_pool(j.first)->erasure_code_profile);
+ }
+ encode(profile, bl);
t.write(coll_t::meta(), obj, 0, bl.length(), bl);
service.store_deleted_pool_pg_num(j.first, j.second.get_pg_num());
}
PGBackend *PGBackend::build_pg_backend(
const pg_pool_t &pool,
- const OSDMapRef curmap,
+ const map<string,string>& profile,
Listener *l,
coll_t coll,
ObjectStore::CollectionHandle &ch,
ObjectStore *store,
CephContext *cct)
{
+ ErasureCodeProfile ec_profile = profile;
switch (pool.type) {
case pg_pool_t::TYPE_REPLICATED: {
return new ReplicatedBackend(l, coll, ch, store, cct);
}
case pg_pool_t::TYPE_ERASURE: {
ErasureCodeInterfaceRef ec_impl;
- ErasureCodeProfile profile = curmap->get_erasure_code_profile(pool.erasure_code_profile);
- assert(profile.count("plugin"));
stringstream ss;
ceph::ErasureCodePluginRegistry::instance().factory(
profile.find("plugin")->second,
cct->_conf->get_val<std::string>("erasure_code_dir"),
- profile,
+ ec_profile,
&ec_impl,
&ss);
assert(ec_impl);
static PGBackend *build_pg_backend(
const pg_pool_t &pool,
- const OSDMapRef curmap,
+ const map<string,string>& profile,
Listener *l,
coll_t coll,
ObjectStore::CollectionHandle &ch,
}
PrimaryLogPG::PrimaryLogPG(OSDService *o, OSDMapRef curmap,
- const PGPool &_pool, spg_t p) :
+ const PGPool &_pool,
+ const map<string,string>& ec_profile, spg_t p) :
PG(o, curmap, _pool, p),
pgbackend(
PGBackend::build_pg_backend(
- _pool.info, curmap, this, coll_t(p), ch, o->store, cct)),
+ _pool.info, ec_profile, this, coll_t(p), ch, o->store, cct)),
object_contexts(o->cct, o->cct->_conf->osd_pg_object_context_cache_count),
snapset_contexts_lock("PrimaryLogPG::snapset_contexts_lock"),
new_backfill(false),
public:
PrimaryLogPG(OSDService *o, OSDMapRef curmap,
- const PGPool &_pool, spg_t p);
+ const PGPool &_pool,
+ const map<string,string>& ec_profile,
+ spg_t p);
~PrimaryLogPG() override {}
int do_command(