]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os/bluestore: prefix omap of temp objects by real pool
authorxie xingguo <xie.xingguo@zte.com.cn>
Fri, 16 Aug 2019 07:28:54 +0000 (15:28 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Sat, 17 Aug 2019 00:37:32 +0000 (08:37 +0800)
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 <xie.xingguo@zte.com.cn>
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h
src/osd/osd_types.h

index 6a2f769a0566899b120ead34cbae565f7f4376e5..04e29e8bd8f07b1b94a27f66eab18daaf4c1021e 100644 (file)
@@ -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('~');
index 9769ab5fed5b713ccf42e24fece023b5d478e72b..6250ad1fcc5043a496d4e18175e553a3d5ba6fe2 100644 (file)
@@ -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;
index 3e5e71ccdfab5a5ec4e9a04558a593448f899fb6..b077c0aba2e5df245fd7db307f21c8c0eeb76aee 100644 (file)
@@ -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);