From: Yehuda Sadeh Date: Thu, 3 Sep 2015 00:56:07 +0000 (-0700) Subject: rgw: don't copy delete_at attr, unless it's intra region copy X-Git-Tag: v9.1.0~229^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F5692%2Fhead;p=ceph.git rgw: don't copy delete_at attr, unless it's intra region copy We don't want to keep the expiration value of a copied object, unless we're doing a copy within the same zone group. Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 3ff74e4598ce..ae9d64fc6c9b 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -4024,6 +4024,20 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx, JSONDecoder::decode_json("attrs", src_attrs, &jp); src_attrs.erase(RGW_ATTR_MANIFEST); // not interested in original object layout + if (source_zone.empty()) { /* need to preserve expiration if copy in the same zonegroup */ + src_attrs.erase(RGW_ATTR_DELETE_AT); + } else { + map::iterator iter = src_attrs.find(RGW_ATTR_DELETE_AT); + if (iter != src_attrs.end()) { + try { + utime_t da; + ::decode(da, iter->second); + delete_at = (time_t)da.sec(); + } catch (buffer::error& err) { + ldout(cct, 0) << "ERROR: failed to decode delete_at field in intra zone copy" << dendl; + } + } + } } } @@ -4182,6 +4196,7 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx, } src_attrs[RGW_ATTR_ACL] = attrs[RGW_ATTR_ACL]; + src_attrs.erase(RGW_ATTR_DELETE_AT); set_copy_attrs(src_attrs, attrs, attrs_mod); attrs.erase(RGW_ATTR_ID_TAG);