Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
rgw_sal_motr:[CORTX-33799] Handle progress_cb response in case of
Browse files Browse the repository at this point in the history
 copy-object operation failure.

Problem:
If copy operation failed after copying some data, then it was throwing
an invalid XML error due to partial progress response. i.e rgw was not closing
'CopyObjectResult' tag in case of failure.

Solution:
Remove progress_cb call from rgw_sal_motr layer, and send 'dump_continue' signal
to avoid client timeout during copy operation.

Signed-off-by: Shriya Deshmukh <shriya.deshmukh@seagate.com>
  • Loading branch information
shriya-deshmukh committed Aug 9, 2022
1 parent 7fa8943 commit 6cb1b85
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
16 changes: 7 additions & 9 deletions src/rgw/rgw_sal_motr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ extern "C" {
#include "rgw_bucket.h"
#include "rgw_quota.h"
#include "motr/addb/rgw_addb.h"
#include "rgw_rest.h"

#define dout_subsys ceph_subsys_rgw

Expand Down Expand Up @@ -2226,12 +2227,12 @@ int MotrObject::delete_obj_aio(const DoutPrefixProvider* dpp, RGWObjState* astat

int MotrCopyObj_CB::handle_data(bufferlist& bl, off_t bl_ofs, off_t bl_len)
{
progress_cb progress_CB = this->get_progress_cb();
int rc = 0;
ldpp_dout(m_dpp, 20) << "Offset=" << bl_ofs << " Length = "
<< " Write Offset=" << write_offset << bl_len << dendl;


struct req_state* s = static_cast<req_state*>(obj_ctx->get_private());
//offset is zero and bufferlength is equal to bl_len
if (!bl_ofs && bl_len == bl.length()) {
bufferptr bptr(bl.c_str(), bl_len);
Expand All @@ -2244,9 +2245,7 @@ int MotrCopyObj_CB::handle_data(bufferlist& bl, off_t bl_ofs, off_t bl_len)
write_offset << "failed rc=" << rc << dendl;
}
write_offset += bl_len;
if(progress_CB){
progress_CB(write_offset, this->get_progress_data());
}
dump_continue(s);
return rc;
}

Expand All @@ -2260,6 +2259,7 @@ int MotrCopyObj_CB::handle_data(bufferlist& bl, off_t bl_ofs, off_t bl_len)
<< " Write Offset=" << write_offset << dendl;
return rc;
}
dump_continue(s);
write_offset += bl_len;

ldpp_dout(m_dpp, 20) << "MotrCopyObj_CB handle_data called rc=" << rc << dendl;
Expand Down Expand Up @@ -2342,7 +2342,7 @@ int MotrObject::copy_object_same_zone(RGWObjectCtx& obj_ctx,
}

// Create filter object.
MotrCopyObj_CB cb(dpp, dst_writer);
MotrCopyObj_CB cb(dpp, dst_writer, &obj_ctx);
MotrCopyObj_Filter* filter = &cb;

// Get offsets.
Expand All @@ -2353,9 +2353,7 @@ int MotrObject::copy_object_same_zone(RGWObjectCtx& obj_ctx,
return rc;
}

//setting the values of progress_cb and progress_data in MotrCopyObj_Filter class
filter->set_progress_callback(progress_cb, progress_data);

struct req_state* s = static_cast<req_state*>(obj_ctx.get_private());
// read::iterate -> handle_data() -> write::process
rc = read_op->iterate(dpp, cur_ofs, cur_end, filter, y);
if (rc < 0){
Expand Down Expand Up @@ -2383,7 +2381,7 @@ int MotrObject::copy_object_same_zone(RGWObjectCtx& obj_ctx,
}

//Set object tags based on tagging-directive
struct req_state* s = static_cast<req_state*>(obj_ctx.get_private());

auto tagging_drctv = s->info.env->get("HTTP_X_AMZ_TAGGING_DIRECTIVE");

bufferlist tags_bl;
Expand Down
7 changes: 5 additions & 2 deletions src/rgw/rgw_sal_motr.h
Original file line number Diff line number Diff line change
Expand Up @@ -528,13 +528,16 @@ class MotrCopyObj_CB : public MotrCopyObj_Filter
const DoutPrefixProvider* m_dpp;
std::shared_ptr<rgw::sal::Writer> m_dst_writer;
off_t write_offset;
RGWObjectCtx* obj_ctx;

public:
explicit MotrCopyObj_CB(const DoutPrefixProvider* dpp,
std::shared_ptr<rgw::sal::Writer> dst_writer) :
std::shared_ptr<rgw::sal::Writer> dst_writer, RGWObjectCtx* obj_ctx_1) :
m_dpp(dpp),
m_dst_writer(dst_writer),
write_offset(0) {}
write_offset(0) {
obj_ctx = obj_ctx_1;
}
virtual ~MotrCopyObj_CB() override {}
int handle_data(bufferlist& bl, off_t bl_ofs, off_t bl_len) override;
};
Expand Down

0 comments on commit 6cb1b85

Please sign in to comment.