From: xie xingguo Date: Fri, 16 Aug 2019 07:28:54 +0000 (+0800) Subject: os/bluestore: prefix omap of temp objects by real pool X-Git-Tag: v15.1.0~1822^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=e924b8436e7c13a1d5e96f452ae70fdcaded0026;p=ceph-ci.git os/bluestore: prefix omap of temp objects by real pool For recovery or backfill, we use temp object at destination if the whole object context can not sent in one shot. And since https://github.com/ceph/ceph/pull/29292, we now segregate omap keys by object's binding pool. However, https://github.com/ceph/ceph/pull/29292 does not work well for recovery or backfill process that need to manipulate temp objects because we always (deliberately) assign a negative pool id for each temp object which is (obviously) different from the corresponding target object, and we do not fix it when trying to rename the temp object back to the target object at the end of recovery/backfill, as a result of which we totally lose track of the omap portion of the recovered object. Fix by prefixing all omap-related stuff of temp objects by using its real(pg's) pool. Signed-off-by: xie xingguo --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 6a2f769a056..04e29e8bd8f 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -3289,7 +3289,7 @@ const string& BlueStore::Onode::get_omap_prefix() void BlueStore::Onode::get_omap_header(string *out) { if (onode.is_perpool_omap() && !onode.is_pgmeta_omap()) { - _key_encode_u64(oid.hobj.pool, out); + _key_encode_u64(c->pool(), out); } _key_encode_u64(onode.nid, out); out->push_back('-'); @@ -3298,7 +3298,7 @@ void BlueStore::Onode::get_omap_header(string *out) void BlueStore::Onode::get_omap_key(const string& key, string *out) { if (onode.is_perpool_omap() && !onode.is_pgmeta_omap()) { - _key_encode_u64(oid.hobj.pool, out); + _key_encode_u64(c->pool(), out); } _key_encode_u64(onode.nid, out); out->push_back('.'); @@ -3308,7 +3308,7 @@ void BlueStore::Onode::get_omap_key(const string& key, string *out) void BlueStore::Onode::rewrite_omap_key(const string& old, string *out) { if (onode.is_perpool_omap() && !onode.is_pgmeta_omap()) { - _key_encode_u64(oid.hobj.pool, out); + _key_encode_u64(c->pool(), out); } _key_encode_u64(onode.nid, out); out->append(old.c_str() + out->length(), old.size() - out->length()); @@ -3317,7 +3317,7 @@ void BlueStore::Onode::rewrite_omap_key(const string& old, string *out) void BlueStore::Onode::get_omap_tail(string *out) { if (onode.is_perpool_omap() && !onode.is_pgmeta_omap()) { - _key_encode_u64(oid.hobj.pool, out); + _key_encode_u64(c->pool(), out); } _key_encode_u64(onode.nid, out); out->push_back('~'); diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 9769ab5fed5..6250ad1fcc5 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -1292,6 +1292,10 @@ public: return false; } + int64_t pool() const { + return cid.pool(); + } + void split_cache(Collection *dest); bool flush_commit(Context *c) override; diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 3e5e71ccdfa..b077c0aba2e 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -742,6 +742,9 @@ public: } return false; } + int64_t pool() const { + return pgid.pool(); + } void encode(ceph::buffer::list& bl) const; void decode(ceph::buffer::list::const_iterator& bl);