::decode(shard_id, bl);
} else {
generation = ghobject_t::NO_GEN;
- shard_id = ghobject_t::NO_SHARD;
+ shard_id = shard_id_t::NO_SHARD;
}
DECODE_FINISH(bl);
}
o.push_back(new ghobject_t(hobject_t(object_t("oname"), string(), 1, 234, -1, "")));
o.push_back(new ghobject_t(hobject_t(object_t("oname2"), string("okey"), CEPH_NOSNAP,
- 67, 0, "n1"), 1, 0));
+ 67, 0, "n1"), 1, shard_id_t(0)));
o.push_back(new ghobject_t(hobject_t(object_t("oname2"), string("okey"), CEPH_NOSNAP,
- 67, 0, "n1"), 1, 1));
+ 67, 0, "n1"), 1, shard_id_t(1)));
o.push_back(new ghobject_t(hobject_t(object_t("oname2"), string("okey"), CEPH_NOSNAP,
- 67, 0, "n1"), 1, 2));
+ 67, 0, "n1"), 1, shard_id_t(2)));
o.push_back(new ghobject_t(hobject_t(object_t("oname3"), string("oname3"),
- CEPH_SNAPDIR, 910, 1, "n2"), 1, 0));
+ CEPH_SNAPDIR, 910, 1, "n2"), 1, shard_id_t(0)));
o.push_back(new ghobject_t(hobject_t(object_t("oname3"), string("oname3"),
- CEPH_SNAPDIR, 910, 1, "n2"), 2, 0));
+ CEPH_SNAPDIR, 910, 1, "n2"), 2, shard_id_t(0)));
o.push_back(new ghobject_t(hobject_t(object_t("oname3"), string("oname3"),
- CEPH_SNAPDIR, 910, 1, "n2"), 3, 0));
+ CEPH_SNAPDIR, 910, 1, "n2"), 3, shard_id_t(0)));
o.push_back(new ghobject_t(hobject_t(object_t("oname3"), string("oname3"),
- CEPH_SNAPDIR, 910, 1, "n2"), 3, 1));
+ CEPH_SNAPDIR, 910, 1, "n2"), 3, shard_id_t(1)));
o.push_back(new ghobject_t(hobject_t(object_t("oname3"), string("oname3"),
- CEPH_SNAPDIR, 910, 1, "n2"), 3, 2));
+ CEPH_SNAPDIR, 910, 1, "n2"), 3, shard_id_t(2)));
}
ostream& operator<<(ostream& out, const ghobject_t& o)
{
out << o.hobj;
if (o.generation != ghobject_t::NO_GEN ||
- o.shard_id != ghobject_t::NO_SHARD) {
- assert(o.shard_id != ghobject_t::NO_SHARD);
+ o.shard_id != shard_id_t::NO_SHARD) {
+ assert(o.shard_id != shard_id_t::NO_SHARD);
out << "/" << o.generation << "/" << (unsigned)(o.shard_id);
}
return out;
}
bool is_degenerate() const {
- return generation == NO_GEN && shard_id == NO_SHARD;
+ return generation == NO_GEN && shard_id == shard_id_t::NO_SHARD;
}
bool is_no_gen() const {
}
bool is_no_shard() const {
- return shard_id == NO_SHARD;
+ return shard_id == shard_id_t::NO_SHARD;
}
// maximum sorted value.
if (header.version >= 3)
::decode(pgid.shard, p);
else
- pgid.shard = ghobject_t::no_shard();
+ pgid.shard = shard_id_t::NO_SHARD;
}
if (header.version >= 3)
::decode(pgid.shard, p);
else
- pgid.shard = ghobject_t::no_shard();
+ pgid.shard = shard_id_t::NO_SHARD;
}
virtual void encode_payload(uint64_t features) {
::decode(to, p);
::decode(from, p);
} else {
- to = ghobject_t::NO_SHARD;
- from = ghobject_t::NO_SHARD;
+ to = shard_id_t::NO_SHARD;
+ from = shard_id_t::NO_SHARD;
}
}
};
::decode(pgid.shard, p);
::decode(from, p);
} else {
- pgid.shard = ghobject_t::NO_SHARD;
- from = pg_shard_t(get_source().num(), ghobject_t::NO_SHARD);
+ pgid.shard = shard_id_t::NO_SHARD;
+ from = pg_shard_t(get_source().num(), shard_id_t::NO_SHARD);
}
}
::decode(pgid.shard, p);
::decode(from, p);
} else {
- pgid.shard = ghobject_t::NO_SHARD;
- from = pg_shard_t(get_source().num(), ghobject_t::NO_SHARD);
+ pgid.shard = shard_id_t::NO_SHARD;
+ from = pg_shard_t(get_source().num(), shard_id_t::NO_SHARD);
}
}
::decode(pgid.shard, p);
::decode(from, p);
} else {
- pgid.shard = ghobject_t::NO_SHARD;
- from = pg_shard_t(get_source().num(), ghobject_t::NO_SHARD);
+ pgid.shard = shard_id_t::NO_SHARD;
+ from = pg_shard_t(get_source().num(), shard_id_t::NO_SHARD);
}
}
::decode(epoch, p);
vector<pair<pg_t, pg_query_t> > _pg_list;
::decode(_pg_list, p);
- vector<shard_id_t> _shard_list(_pg_list.size(), ghobject_t::no_shard());
+ vector<shard_id_t> _shard_list(_pg_list.size(), shard_id_t::NO_SHARD);
if (header.version >= 3) {
_shard_list.clear();
::decode(_shard_list, p);
vector<pg_t> _pg_list;
::decode(_pg_list, p);
- vector<shard_id_t> _shard_list(_pg_list.size(), ghobject_t::no_shard());
+ vector<shard_id_t> _shard_list(_pg_list.size(), shard_id_t::NO_SHARD);
if (header.version >= 2) {
_shard_list.clear();
::decode(_shard_list, p);
} else {
from = pg_shard_t(
get_source().num(),
- ghobject_t::NO_SHARD);
- pgid.shard = ghobject_t::NO_SHARD;
+ shard_id_t::NO_SHARD);
+ pgid.shard = shard_id_t::NO_SHARD;
}
}
if (header.version >= 2)
::decode(pgid.shard, p);
else
- pgid.shard = ghobject_t::no_shard();
+ pgid.shard = shard_id_t::NO_SHARD;
}
};
if (header.version >= 5) {
::decode(pgid.shard, p);
} else {
- pgid.shard = ghobject_t::no_shard();
+ pgid.shard = shard_id_t::NO_SHARD;
}
}
};
} else {
from = pg_shard_t(
get_source().num(),
- ghobject_t::NO_SHARD);
- pgid.shard = ghobject_t::NO_SHARD;
+ shard_id_t::NO_SHARD);
+ pgid.shard = shard_id_t::NO_SHARD;
}
if (header.version >= 10) {
::decode(updated_hit_set_history, p);
} else {
from = pg_shard_t(
get_source().num(),
- ghobject_t::NO_SHARD);
- pgid.shard = ghobject_t::NO_SHARD;
+ shard_id_t::NO_SHARD);
+ pgid.shard = shard_id_t::NO_SHARD;
}
}
virtual void encode_payload(uint64_t features) {
if (header.version >= 2)
::decode(pgid.shard, p);
else
- pgid.shard = ghobject_t::no_shard();
+ pgid.shard = shard_id_t::NO_SHARD;
}
void encode_payload(uint64_t features) {
snprintf(t, end - t, ".%.*X", (int)(sizeof(oid.hobj.hash)*2), oid.hobj.hash);
if (oid.generation != ghobject_t::NO_GEN ||
- oid.shard_id != ghobject_t::NO_SHARD) {
+ oid.shard_id != shard_id_t::NO_SHARD) {
t += snprintf(t, end - t, ".%llx", (long long unsigned)oid.generation);
t += snprintf(t, end - t, ".%x", (int)oid.shard_id);
}
Index *index)
{
assert(get_allow_sharded_objects() ||
- ( oid.shard_id == ghobject_t::NO_SHARD &&
+ ( oid.shard_id == shard_id_t::NO_SHARD &&
oid.generation == ghobject_t::NO_GEN ));
assert(outfd);
int flags = O_RDWR;
full_name += string(buf);
if (oid.generation != ghobject_t::NO_GEN) {
- assert(oid.shard_id != ghobject_t::NO_SHARD);
+ assert(oid.shard_id != shard_id_t::NO_SHARD);
full_name.append(GHOBJECT_KEY_SEP_S);
t = buf;
snapid_t snap;
uint64_t pool;
gen_t generation = ghobject_t::NO_GEN;
- shard_t shard_id = ghobject_t::NO_SHARD;
+ shard_id_t shard_id = shard_id_t::NO_SHARD;
string::const_iterator current = long_name.begin();
string::const_iterator end;
full_name += string(buf);
if (oid.generation != ghobject_t::NO_GEN ||
- oid.shard_id != ghobject_t::NO_SHARD) {
+ oid.shard_id != shard_id_t::NO_SHARD) {
full_name.append("_");
t = buf;
oid.hobj.snap = soid.snap;
oid.hobj.oid = soid.oid;
oid.generation = ghobject_t::NO_GEN;
- oid.shard_id = ghobject_t::NO_SHARD;
+ oid.shard_id = shard_id_t::NO_SHARD;
} else {
::decode(oid, p);
if (use_pool_override && pool_override != -1 &&
for (set<int>::iterator i = need.begin();
i != need.end();
++i) {
- assert(shards.count(*i));
- to_read->insert(shards[*i]);
+ assert(shards.count(shard_id_t(*i)));
+ to_read->insert(shards[shard_id_t(*i)]);
}
return 0;
}
hobject_t hoid1(sobject_t("asdf", 1));
hobject_t hoid2(sobject_t("asdf2", CEPH_NOSNAP));
o.push_back(new ECSubRead());
- o.back()->from = pg_shard_t(2, 255);
+ o.back()->from = pg_shard_t(2, shard_id_t(255));
o.back()->tid = 1;
o.back()->to_read[hoid1].push_back(make_pair(100, 200));
o.back()->to_read[hoid1].push_back(make_pair(400, 600));
o.back()->to_read[hoid2].push_back(make_pair(400, 600));
o.back()->attrs_to_read.insert(hoid1);
o.push_back(new ECSubRead());
- o.back()->from = pg_shard_t(2, 255);
+ o.back()->from = pg_shard_t(2, shard_id_t(255));
o.back()->tid = 300;
o.back()->to_read[hoid1].push_back(make_pair(300, 200));
o.back()->to_read[hoid2].push_back(make_pair(400, 600));
bufferlist bl2;
bl2.append_zero(200);
o.push_back(new ECSubReadReply());
- o.back()->from = pg_shard_t(2, 255);
+ o.back()->from = pg_shard_t(2, shard_id_t(255));
o.back()->tid = 1;
o.back()->buffers_read[hoid1].push_back(make_pair(20, bl));
o.back()->buffers_read[hoid1].push_back(make_pair(2000, bl2));
o.back()->attrs_read[hoid1]["foo"] = bl;
o.back()->attrs_read[hoid1]["_"] = bl2;
o.push_back(new ECSubReadReply());
- o.back()->from = pg_shard_t(2, 255);
+ o.back()->from = pg_shard_t(2, shard_id_t(255));
o.back()->tid = 300;
o.back()->buffers_read[hoid2].push_back(make_pair(0, bl2));
o.back()->attrs_read[hoid2]["foo"] = bl;
pset.insert(
pg_shard_t(
acting[i],
- osdmap->pg_is_ec(pgid.pgid) ? i : ghobject_t::NO_SHARD));
+ osdmap->pg_is_ec(pgid.pgid) ? shard_id_t(i) : shard_id_t::NO_SHARD));
}
up++;
}
pset.insert(
pg_shard_t(
acting[i],
- osdmap->pg_is_ec(pgid.pgid) ? i : ghobject_t::NO_SHARD));
+ osdmap->pg_is_ec(pgid.pgid) ? shard_id_t(i) : shard_id_t::NO_SHARD));
}
}
dout(10) << "calc_priors_during " << pgid
ss << "Must not call on ec pool";
return;
}
- spg_t pgid = spg_t(curmap->raw_pg_to_pg(rawpg), ghobject_t::no_shard());
+ spg_t pgid = spg_t(curmap->raw_pg_to_pg(rawpg), shard_id_t::NO_SHARD);
hobject_t obj(object_t(objname), string(""), CEPH_NOSNAP, rawpg.ps(), pool, nspace);
ObjectStore::Transaction t;
tmpacting.insert(
pg_shard_t(
pg->acting[i],
- pg->pool.info.ec_pool() ? i : ghobject_t::NO_SHARD));
+ pg->pool.info.ec_pool() ? shard_id_t(i) : shard_id_t::NO_SHARD));
}
}
if (i->second.ec_pool()) {
for (uint8_t i = 0; i < acting.size(); ++i) {
if (acting[i] == primary) {
- *out = spg_t(pgid, i);
+ *out = spg_t(pgid, shard_id_t(i));
return true;
}
}
for (uint8_t i = 0; i < want.size(); ++i) {
ss << "For position " << (unsigned)i << ": ";
if (up.size() > (unsigned)i && up[i] != CRUSH_ITEM_NONE &&
- !all_info.find(pg_shard_t(up[i], i))->second.is_incomplete() &&
- all_info.find(pg_shard_t(up[i], i))->second.last_update >=
+ !all_info.find(pg_shard_t(up[i], shard_id_t(i)))->second.is_incomplete() &&
+ all_info.find(pg_shard_t(up[i], shard_id_t(i)))->second.last_update >=
auth_log_shard->second.log_tail) {
- ss << " selecting up[i]: " << pg_shard_t(up[i], i) << std::endl;
+ ss << " selecting up[i]: " << pg_shard_t(up[i], shard_id_t(i)) << std::endl;
want[i] = up[i];
++usable;
continue;
}
if (up.size() > (unsigned)i && up[i] != CRUSH_ITEM_NONE) {
- ss << " backfilling up[i]: " << pg_shard_t(up[i], i)
+ ss << " backfilling up[i]: " << pg_shard_t(up[i], shard_id_t(i))
<< " and ";
- backfill->insert(pg_shard_t(up[i], i));
+ backfill->insert(pg_shard_t(up[i], shard_id_t(i)));
}
if (acting.size() > (unsigned)i && acting[i] != CRUSH_ITEM_NONE &&
- !all_info.find(pg_shard_t(acting[i], i))->second.is_incomplete() &&
- all_info.find(pg_shard_t(acting[i], i))->second.last_update >=
+ !all_info.find(pg_shard_t(acting[i], shard_id_t(i)))->second.is_incomplete() &&
+ all_info.find(pg_shard_t(acting[i], shard_id_t(i)))->second.last_update >=
auth_log_shard->second.log_tail) {
- ss << " selecting acting[i]: " << pg_shard_t(acting[i], i) << std::endl;
+ ss << " selecting acting[i]: " << pg_shard_t(acting[i], shard_id_t(i)) << std::endl;
want[i] = acting[i];
++usable;
} else {
- for (set<pg_shard_t>::iterator j = all_info_by_shard[i].begin();
- j != all_info_by_shard[i].end();
+ for (set<pg_shard_t>::iterator j = all_info_by_shard[shard_id_t(i)].begin();
+ j != all_info_by_shard[shard_id_t(i)].end();
++j) {
assert(j->shard == i);
if (!all_info.find(*j)->second.is_incomplete() &&
bool found_primary = false;
for (uint8_t i = 0; i < want.size(); ++i) {
if (want[i] != CRUSH_ITEM_NONE) {
- acting_backfill->insert(pg_shard_t(want[i], i));
+ acting_backfill->insert(pg_shard_t(want[i], shard_id_t(i)));
if (!found_primary) {
- *want_primary = pg_shard_t(want[i], i);
+ *want_primary = pg_shard_t(want[i], shard_id_t(i));
found_primary = true;
}
}
for (vector<int>::const_iterator i = up.begin();
i != up.end();
++i) {
- pg_shard_t up_cand = pg_shard_t(*i, ghobject_t::no_shard());
+ pg_shard_t up_cand = pg_shard_t(*i, shard_id_t::NO_SHARD);
if (up_cand == primary->first)
continue;
const pg_info_t &cur_info = all_info.find(up_cand)->second;
for (vector<int>::const_iterator i = acting.begin();
i != acting.end();
++i) {
- pg_shard_t acting_cand(*i, ghobject_t::no_shard());
+ pg_shard_t acting_cand(*i, shard_id_t::NO_SHARD);
if (usable >= size)
break;
have.insert(
pg_shard_t(
want[i],
- pool.info.ec_pool() ? i : ghobject_t::NO_SHARD));
+ pool.info.ec_pool() ? shard_id_t(i) : shard_id_t::NO_SHARD));
}
if (!(*recoverable_predicate)(have)) {
want_acting.clear();
std::vector<int>::const_iterator a = interval.acting.begin();
std::vector<int>::const_iterator a_end = interval.acting.end();
for (; a != a_end; ++a, ++i) {
- pg_shard_t shard(*a, pool.info.ec_pool() ? i : ghobject_t::NO_SHARD);
+ pg_shard_t shard(*a, pool.info.ec_pool() ? shard_id_t(i) : shard_id_t::NO_SHARD);
if (*a != CRUSH_ITEM_NONE && shard != pg_whoami)
might_have_unfound.insert(shard);
}
int o = interval.acting[i];
if (o == CRUSH_ITEM_NONE)
continue;
- pg_shard_t so(o, pg->pool.info.ec_pool() ? i : ghobject_t::NO_SHARD);
+ pg_shard_t so(o, pg->pool.info.ec_pool() ? shard_id_t(i) : shard_id_t::NO_SHARD);
if (!osdmap->exists(o) || osdmap->get_info(o).lost_at > interval.first)
continue; // dne or lost
if (osdmap->is_up(o)) {
// sending them any new info/logs/whatever.
for (unsigned i=0; i<acting.size(); i++) {
if (acting[i] != CRUSH_ITEM_NONE)
- probe.insert(pg_shard_t(acting[i], ec_pool ? i : ghobject_t::NO_SHARD));
+ probe.insert(pg_shard_t(acting[i], ec_pool ? shard_id_t(i) : shard_id_t::NO_SHARD));
}
// It may be possible to exlude the up nodes, but let's keep them in
// there for now.
for (unsigned i=0; i<up.size(); i++) {
if (up[i] != CRUSH_ITEM_NONE)
- probe.insert(pg_shard_t(up[i], ec_pool ? i : ghobject_t::NO_SHARD));
+ probe.insert(pg_shard_t(up[i], ec_pool ? shard_id_t(i) : shard_id_t::NO_SHARD));
}
for (map<epoch_t,pg_interval_t>::const_reverse_iterator p = past_intervals.rbegin();
int o = interval.acting[i];
if (o == CRUSH_ITEM_NONE)
continue;
- pg_shard_t so(o, ec_pool ? i : ghobject_t::NO_SHARD);
+ pg_shard_t so(o, ec_pool ? shard_id_t(i) : shard_id_t::NO_SHARD);
const osd_info_t *pinfo = 0;
if (osdmap.exists(o))
actingset.insert(
pg_shard_t(
acting[i],
- pool.info.ec_pool() ? i : ghobject_t::NO_SHARD));
+ pool.info.ec_pool() ? shard_id_t(i) : shard_id_t::NO_SHARD));
}
up = newup;
if (!pool.info.ec_pool()) {
- up_primary = pg_shard_t(new_up_primary, ghobject_t::no_shard());
- primary = pg_shard_t(new_acting_primary, ghobject_t::no_shard());
+ up_primary = pg_shard_t(new_up_primary, shard_id_t::NO_SHARD);
+ primary = pg_shard_t(new_acting_primary, shard_id_t::NO_SHARD);
return;
}
up_primary = pg_shard_t();
primary = pg_shard_t();
for (uint8_t i = 0; i < up.size(); ++i) {
if (up[i] == new_up_primary) {
- up_primary = pg_shard_t(up[i], i);
+ up_primary = pg_shard_t(up[i], shard_id_t(i));
break;
}
}
for (uint8_t i = 0; i < acting.size(); ++i) {
if (acting[i] == new_acting_primary) {
- primary = pg_shard_t(acting[i], i);
+ primary = pg_shard_t(acting[i], shard_id_t(i));
break;
}
}
version_t former_version) {
t->collection_move_rename(
coll, hoid, coll,
- ghobject_t(hoid, former_version, ghobject_t::NO_SHARD));
+ ghobject_t(hoid, former_version, shard_id_t::NO_SHARD));
}
void setattrs(
const hobject_t &hoid,
public:
static string make_shard_prefix(shard_id_t shard) {
- if (shard == ghobject_t::NO_SHARD)
+ if (shard == shard_id_t::NO_SHARD)
return string();
char buf[20];
int r = snprintf(buf, sizeof(buf), ".%x", (int)shard);
{
if (rhs.is_undefined())
return lhs << "?";
- if (rhs.shard == ghobject_t::NO_SHARD)
+ if (rhs.shard == shard_id_t::NO_SHARD)
return lhs << rhs.osd;
return lhs << rhs.osd << '(' << (unsigned)(rhs.shard) << ')';
}
bool spg_t::parse(const char *s)
{
pgid.set_preferred(-1);
- shard = ghobject_t::NO_SHARD;
+ shard = shard_id_t::NO_SHARD;
uint64_t ppool;
uint32_t pseed;
int32_t pref;
if (p) {
r = sscanf(p, "s%d", &pshard);
if (r == 1) {
- shard = pshard;
+ shard = shard_id_t(pshard);
} else {
return false;
}
if (struct_v >= 30)
::decode(pgid.shard, bl);
else
- pgid.shard = ghobject_t::no_shard();
+ pgid.shard = shard_id_t::NO_SHARD;
DECODE_FINISH(bl);
}
list<pg_history_t*> h;
pg_history_t::generate_test_instances(h);
o.back()->history = *h.back();
- o.back()->pgid = spg_t(pg_t(1, 2, -1), ghobject_t::no_shard());
+ o.back()->pgid = spg_t(pg_t(1, 2, -1), shard_id_t::NO_SHARD);
o.back()->last_update = eversion_t(3, 4);
o.back()->last_complete = eversion_t(5, 6);
o.back()->last_user_version = 2;
::decode(to, bl);
::decode(from, bl);
} else {
- to = ghobject_t::NO_SHARD;
- from = ghobject_t::NO_SHARD;
+ to = shard_id_t::NO_SHARD;
+ from = shard_id_t::NO_SHARD;
}
DECODE_FINISH(bl);
}
void pg_notify_t::generate_test_instances(list<pg_notify_t*>& o)
{
- o.push_back(new pg_notify_t(3, ghobject_t::NO_SHARD, 1 ,1 , pg_info_t()));
- o.push_back(new pg_notify_t(0, 0, 3, 10, pg_info_t()));
+ o.push_back(new pg_notify_t(shard_id_t(3), shard_id_t::NO_SHARD, 1, 1, pg_info_t()));
+ o.push_back(new pg_notify_t(shard_id_t(0), shard_id_t(0), 3, 10, pg_info_t()));
}
ostream &operator<<(ostream &lhs, const pg_notify_t ¬ify)
lhs << "(query_epoch:" << notify.query_epoch
<< ", epoch_sent:" << notify.epoch_sent
<< ", info:" << notify.info;
- if (notify.from != ghobject_t::NO_SHARD ||
- notify.to != ghobject_t::NO_SHARD)
+ if (notify.from != shard_id_t::NO_SHARD ||
+ notify.to != shard_id_t::NO_SHARD)
lhs << " " << (unsigned)notify.from
<< "->" << (unsigned)notify.to;
return lhs << ")";
::decode(to, bl);
::decode(from, bl);
} else {
- to = ghobject_t::NO_SHARD;
- from = ghobject_t::NO_SHARD;
+ to = shard_id_t::NO_SHARD;
+ from = shard_id_t::NO_SHARD;
}
DECODE_FINISH(bl);
} catch (...) {
o.push_back(new pg_query_t());
list<pg_history_t*> h;
pg_history_t::generate_test_instances(h);
- o.push_back(new pg_query_t(pg_query_t::INFO, 1, 2, *h.back(), 4));
- o.push_back(new pg_query_t(pg_query_t::MISSING, 2, 3, *h.back(), 4));
- o.push_back(new pg_query_t(pg_query_t::LOG, 0, 0,
+ o.push_back(new pg_query_t(pg_query_t::INFO, shard_id_t(1), shard_id_t(2), *h.back(), 4));
+ o.push_back(new pg_query_t(pg_query_t::MISSING, shard_id_t(2), shard_id_t(3), *h.back(), 4));
+ o.push_back(new pg_query_t(pg_query_t::LOG, shard_id_t(0), shard_id_t(0),
eversion_t(4, 5), *h.back(), 4));
o.push_back(new pg_query_t(pg_query_t::FULLLOG,
- ghobject_t::NO_SHARD, ghobject_t::NO_SHARD,
+ shard_id_t::NO_SHARD, shard_id_t::NO_SHARD,
*h.back(), 5));
}
struct pg_shard_t {
int osd;
shard_id_t shard;
- pg_shard_t() : osd(-1), shard(ghobject_t::NO_SHARD) {}
- explicit pg_shard_t(int osd) : osd(osd), shard(ghobject_t::NO_SHARD) {}
+ pg_shard_t() : osd(-1), shard(shard_id_t::NO_SHARD) {}
+ explicit pg_shard_t(int osd) : osd(osd), shard(shard_id_t::NO_SHARD) {}
pg_shard_t(int osd, shard_id_t shard) : osd(osd), shard(shard) {}
static pg_shard_t undefined_shard() {
- return pg_shard_t(-1, ghobject_t::NO_SHARD);
+ return pg_shard_t(-1, shard_id_t::NO_SHARD);
}
bool is_undefined() const {
return osd == -1;
struct spg_t {
pg_t pgid;
shard_id_t shard;
- spg_t() : shard(ghobject_t::NO_SHARD) {}
+ spg_t() : shard(shard_id_t::NO_SHARD) {}
spg_t(pg_t pgid, shard_id_t shard) : pgid(pgid), shard(shard) {}
- explicit spg_t(pg_t pgid) : pgid(pgid), shard(ghobject_t::NO_SHARD) {}
+ explicit spg_t(pg_t pgid) : pgid(pgid), shard(shard_id_t::NO_SHARD) {}
unsigned get_split_bits(unsigned pg_num) const {
return pgid.get_split_bits(pg_num);
}
return is_split;
}
bool is_no_shard() const {
- return shard == ghobject_t::NO_SHARD;
+ return shard == shard_id_t::NO_SHARD;
}
void encode(bufferlist &bl) const {
ENCODE_START(1, 1, bl);
shard_id_t to;
shard_id_t from;
pg_notify_t() :
- query_epoch(0), epoch_sent(0), to(ghobject_t::no_shard()),
- from(ghobject_t::no_shard()) {}
+ query_epoch(0), epoch_sent(0), to(shard_id_t::NO_SHARD),
+ from(shard_id_t::NO_SHARD) {}
pg_notify_t(
shard_id_t to,
shard_id_t from,
shard_id_t to;
shard_id_t from;
- pg_query_t() : type(-1), epoch_sent(0), to(ghobject_t::NO_SHARD),
- from(ghobject_t::NO_SHARD) {}
+ pg_query_t() : type(-1), epoch_sent(0), to(shard_id_t::NO_SHARD),
+ from(shard_id_t::NO_SHARD) {}
pg_query_t(
int t,
shard_id_t to,
}
TEST_F(ObjectMapTest, CreateOneObject) {
- ghobject_t hoid(hobject_t(sobject_t("foo", CEPH_NOSNAP)), 100, 0);
+ ghobject_t hoid(hobject_t(sobject_t("foo", CEPH_NOSNAP)), 100, shard_id_t(0));
map<string, bufferlist> to_set;
string key("test");
string val("test_val");
}
TEST_F(ObjectMapTest, CloneOneObject) {
- ghobject_t hoid(hobject_t(sobject_t("foo", CEPH_NOSNAP)), 200, 0);
- ghobject_t hoid2(hobject_t(sobject_t("foo2", CEPH_NOSNAP)), 201, 1);
+ ghobject_t hoid(hobject_t(sobject_t("foo", CEPH_NOSNAP)), 200, shard_id_t(0));
+ ghobject_t hoid2(hobject_t(sobject_t("foo2", CEPH_NOSNAP)), 201, shard_id_t(1));
tester.set_key(hoid, "foo", "bar");
tester.set_key(hoid, "foo2", "bar2");
uint64_t hash = 0xABABABAB;
uint64_t pool = 0xCDCDCDCD;
int64_t gen = 0xefefefefef;
- int8_t shard_id = 0xb;
+ shard_id_t shard_id(0xb);
{
std::string name(".XA/B_\\C.D");
bool dirty_info = false;
bool dirty_big_info = false;
merge_log(
- t, oinfo, olog, pg_shard_t(1, 0), info,
+ t, oinfo, olog, pg_shard_t(1, shard_id_t(0)), info,
&h, dirty_info, dirty_big_info);
ASSERT_EQ(info.last_update, oinfo.last_update);
pg_info_t oinfo = tcase.get_divinfo();
proc_replica_log(
- t, oinfo, olog, omissing, pg_shard_t(1, 0));
+ t, oinfo, olog, omissing, pg_shard_t(1, shard_id_t(0)));
if (!tcase.base.empty()) {
ASSERT_EQ(tcase.base.rbegin()->version, oinfo.last_update);
uint32_t mask,
uint32_t bits)
: driver(driver),
- mapper(new SnapMapper(driver, mask, bits, 0, 1)),
+ mapper(new SnapMapper(driver, mask, bits, 0, shard_id_t(1))),
mask(mask), bits(bits),
lock("lock") {}
if (struct_v > 2) {
::decode(pgid.shard, bl);
} else {
- pgid.shard = ghobject_t::NO_SHARD;
+ pgid.shard = shard_id_t::NO_SHARD;
}
DECODE_FINISH(bl);
}
::decode(hoid.shard_id, bl);
} else {
hoid.generation = ghobject_t::NO_GEN;
- hoid.shard_id = ghobject_t::NO_SHARD;
+ hoid.shard_id = shard_id_t::NO_SHARD;
}
DECODE_FINISH(bl);
}