]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
PGBackend/ECBackend: handle temp objects correctly
authorSamuel Just <sam.just@inktank.com>
Tue, 4 Mar 2014 01:08:10 +0000 (17:08 -0800)
committerSamuel Just <sam.just@inktank.com>
Tue, 4 Mar 2014 23:29:20 +0000 (15:29 -0800)
Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/ECBackend.cc
src/osd/PGBackend.cc

index f83d2977a566a6e64d21c24e26bf1a13b7ce0a04..64bdd2f7e7bf2ad3f308b738b4f06d7a0f616730 100644 (file)
@@ -1409,7 +1409,7 @@ ECUtil::HashInfoRef ECBackend::get_hash_info(
     dout(10) << __func__ << ": not in cache " << hoid << dendl;
     struct stat st;
     int r = store->stat(
-      coll,
+      hoid.is_temp() ? temp_coll : coll,
       ghobject_t(hoid, ghobject_t::NO_GEN, get_parent()->whoami_shard().shard),
       &st);
     ECUtil::HashInfo hinfo(ec_impl->get_chunk_count());
@@ -1417,7 +1417,7 @@ ECUtil::HashInfoRef ECBackend::get_hash_info(
       dout(10) << __func__ << ": found on disk, size " << st.st_size << dendl;
       bufferlist bl;
       r = store->getattr(
-       coll,
+       hoid.is_temp() ? temp_coll : coll,
        ghobject_t(hoid, ghobject_t::NO_GEN, get_parent()->whoami_shard().shard),
        ECUtil::get_hinfo_key(),
        bl);
index 3841ede95ca32972393f880d1aa7c303a939b7cd..f6698a1864de94c8cb87d18cd3d47e8249f8988b 100644 (file)
@@ -173,7 +173,7 @@ int PGBackend::objects_get_attr(
 {
   bufferptr bp;
   int r = store->getattr(
-    coll,
+    hoid.is_temp() ? temp_coll : coll,
     ghobject_t(hoid, ghobject_t::NO_GEN, get_parent()->whoami_shard().shard),
     attr.c_str(),
     bp);
@@ -189,7 +189,7 @@ int PGBackend::objects_get_attrs(
   map<string, bufferlist> *out)
 {
   return store->getattrs(
-    coll,
+    hoid.is_temp() ? temp_coll : coll,
     ghobject_t(hoid, ghobject_t::NO_GEN, get_parent()->whoami_shard().shard),
     *out);
 }
@@ -200,6 +200,7 @@ void PGBackend::rollback_setattrs(
   ObjectStore::Transaction *t) {
   map<string, bufferlist> to_set;
   set<string> to_remove;
+  assert(!hoid.is_temp());
   for (map<string, boost::optional<bufferlist> >::iterator i = old_attrs.begin();
        i != old_attrs.end();
        ++i) {
@@ -222,6 +223,7 @@ void PGBackend::rollback_append(
   const hobject_t &hoid,
   uint64_t old_size,
   ObjectStore::Transaction *t) {
+  assert(!hoid.is_temp());
   t->truncate(
     coll,
     ghobject_t(hoid, ghobject_t::NO_GEN, get_parent()->whoami_shard().shard),
@@ -232,6 +234,7 @@ void PGBackend::rollback_stash(
   const hobject_t &hoid,
   version_t old_version,
   ObjectStore::Transaction *t) {
+  assert(!hoid.is_temp());
   t->remove(coll, hoid);
   t->collection_move_rename(
     coll,
@@ -243,6 +246,7 @@ void PGBackend::rollback_stash(
 void PGBackend::rollback_create(
   const hobject_t &hoid,
   ObjectStore::Transaction *t) {
+  assert(!hoid.is_temp());
   t->remove(
     coll,
     ghobject_t(hoid, ghobject_t::NO_GEN, get_parent()->whoami_shard().shard));
@@ -252,6 +256,7 @@ void PGBackend::trim_stashed_object(
   const hobject_t &hoid,
   version_t old_version,
   ObjectStore::Transaction *t) {
+  assert(!hoid.is_temp());
   t->remove(
     coll, ghobject_t(hoid, old_version, get_parent()->whoami_shard().shard));
 }