adds x-rgw-replicated-from headers for each zone in the object's
replication path. the RGW_ATTR_OBJ_REPLICATION_TRACE attribute is stored
as a vector instead of a set to preserve the replication order
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit
9ec4fd7e4977b3b68b22a3f759e29c0ffc2b088b)
bl.clear(); // overwrite source's status
bl.append("REPLICA");
}
+ { // update replication trace
+ std::vector<rgw_zone_set_entry> trace;
+ if (auto i = cb.get_attrs().find(RGW_ATTR_OBJ_REPLICATION_TRACE);
+ i != cb.get_attrs().end()) {
+ try {
+ decode(trace, i->second);
+ } catch (const buffer::error&) {}
+ }
+ // add the source entry to the end
+ trace.push_back(source_trace_entry);
+
+ bufferlist bl;
+ encode(trace, bl);
+ cb.get_attrs()[RGW_ATTR_OBJ_REPLICATION_TRACE] = std::move(bl);
+ }
if (source_zone.empty()) {
set_copy_attrs(cb.get_attrs(), attrs, attrs_mod);
#define RGW_ATTR_CLOUD_TIER_CONFIG RGW_ATTR_PREFIX "cloud_tier_config"
#define RGW_ATTR_OBJ_REPLICATION_STATUS RGW_ATTR_PREFIX "amz-replication-status"
+#define RGW_ATTR_OBJ_REPLICATION_TRACE RGW_ATTR_PREFIX "replication-trace"
/* IAM Policy */
#define RGW_ATTR_IAM_POLICY RGW_ATTR_PREFIX "iam-policy"
i != attrs.end()) {
dump_header(s, "x-amz-replication-status", i->second);
}
+ if (auto i = attrs.find(RGW_ATTR_OBJ_REPLICATION_TRACE);
+ i != attrs.end()) {
+ try {
+ std::vector<rgw_zone_set_entry> zones;
+ auto p = i->second.cbegin();
+ decode(zones, p);
+ for (const auto& zone : zones) {
+ dump_header(s, "x-rgw-replicated-from", zone.to_str());
+ }
+ } catch (const buffer::error&) {} // omit x-rgw-replicated-from headers
+ }
if (! op_ret) {
if (! lo_etag.empty()) {