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

rgw_sal_motr:[CORTX-33799] Handle progress_cb response in case of copy-object operation failure. #386

Merged
merged 3 commits into from
Aug 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 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 @@ -2230,12 +2231,10 @@ 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;


//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 @@ -2248,9 +2247,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 @@ -2264,6 +2261,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 @@ -2346,7 +2344,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 @@ -2357,9 +2355,6 @@ 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);

// read::iterate -> handle_data() -> write::process
rc = read_op->iterate(dpp, cur_ofs, cur_end, filter, y);
if (rc < 0){
Expand Down
8 changes: 5 additions & 3 deletions src/rgw/rgw_sal_motr.h
Original file line number Diff line number Diff line change
Expand Up @@ -528,13 +528,15 @@ class MotrCopyObj_CB : public MotrCopyObj_Filter
const DoutPrefixProvider* m_dpp;
std::shared_ptr<rgw::sal::Writer> m_dst_writer;
off_t write_offset;

struct req_state *s;
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) :
m_dpp(dpp),
m_dst_writer(dst_writer),
write_offset(0) {}
write_offset(0) {
s = static_cast<req_state*>(obj_ctx.get_private());
}
virtual ~MotrCopyObj_CB() override {}
int handle_data(bufferlist& bl, off_t bl_ofs, off_t bl_len) override;
};
Expand Down