From f2a4eec1d68524a13951ba48ecb71d0855453b68 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Mon, 3 Mar 2014 17:08:10 -0800 Subject: [PATCH] PGBackend/ECBackend: handle temp objects correctly Signed-off-by: Samuel Just --- src/osd/ECBackend.cc | 4 ++-- src/osd/PGBackend.cc | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/osd/ECBackend.cc b/src/osd/ECBackend.cc index f83d2977a566a..64bdd2f7e7bf2 100644 --- a/src/osd/ECBackend.cc +++ b/src/osd/ECBackend.cc @@ -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); diff --git a/src/osd/PGBackend.cc b/src/osd/PGBackend.cc index 3841ede95ca32..f6698a1864de9 100644 --- a/src/osd/PGBackend.cc +++ b/src/osd/PGBackend.cc @@ -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 *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 to_set; set to_remove; + assert(!hoid.is_temp()); for (map >::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)); } -- 2.39.5