RGWUploadPartInfo stored_info;
int ret = read_omap_entry(hctx, op.part_key, &stored_info);
- if (ret < 0 and ret != -ENOENT) {
+ if (ret < 0 && ret != -ENOENT) {
return ret;
}
/* merge all the prior (stored) manifest prefixes to carry forward */
- if (not stored_info.manifest.empty()) {
+ if (!stored_info.manifest.empty()) {
op.info.past_prefixes.insert(stored_info.manifest.get_prefix());
}
op.info.past_prefixes.merge(stored_info.past_prefixes);
oi.soid.oid.name.c_str(),
op.info.manifest.get_prefix().c_str(),
op.part_key.c_str());
- return -EINVAL;
+ return -EEXIST;
}
bufferlist bl;
return r;
}
-int cls_rgw_mp_upload_part_info_update(librados::IoCtx& io_ctx,
- const std::string& oid,
- const std::string& part_key,
- const RGWUploadPartInfo& info)
-{
- buffer::list in, out;
- cls_rgw_mp_upload_part_info_update_op op;
-
- // For now, there doesn't appear to be a need for an encoded
- // result -- we might in future want to return a copy of the final
- // RGWUploadPartInfo
-
- op.part_key = part_key;
- op.info = info;
- encode(op, in);
+void cls_rgw_mp_upload_part_info_update(librados::ObjectWriteOperation& op,
+ const std::string& part_key,
+ const RGWUploadPartInfo& info)
+{
+ cls_rgw_mp_upload_part_info_update_op call;
+ call.part_key = part_key;
+ call.info = info;
- int r = io_ctx.exec(oid, RGW_CLASS, RGW_MP_UPLOAD_PART_INFO_UPDATE, in, out);
- return r;
+ buffer::list in;
+ encode(call, in);
+
+ op.exec(RGW_CLASS, RGW_MP_UPLOAD_PART_INFO_UPDATE, in);
}
void cls_rgw_reshard_add(librados::ObjectWriteOperation& op, const cls_rgw_reshard_entry& entry)
#endif
/* multipart */
-int cls_rgw_mp_upload_part_info_update(librados::IoCtx& io_ctx, const std::string& oid, const std::string& part_key, const RGWUploadPartInfo& info);
+void cls_rgw_mp_upload_part_info_update(librados::ObjectWriteOperation& op, const std::string& part_key, const RGWUploadPartInfo& info);
/* resharding */
void cls_rgw_reshard_add(librados::ObjectWriteOperation& op, const cls_rgw_reshard_entry& entry);
*
*/
+#include "include/rados/librados.hpp"
#include "rgw_aio.h"
#include "rgw_putobj_processor.h"
#include "rgw_multi.h"
if (r < 0)
return r;
- bufferlist bl;
RGWUploadPartInfo info;
string p = "part.";
bool sorted_omap = is_v2_upload_id(upload_id);
return r;
}
- r = cls_rgw_mp_upload_part_info_update(meta_obj_ref.pool.ioctx(), meta_obj_ref.obj.oid, p, info);
+ librados::ObjectWriteOperation op;
+ cls_rgw_mp_upload_part_info_update(op, p, info);
+ r = rgw_rados_operate(dpp, meta_obj_ref.pool.ioctx(), meta_obj_ref.obj.oid, &op, y);
ldpp_dout(dpp, 20) << "Update meta: " << meta_obj_ref.obj.oid << " part " << p << " prefix " << info.manifest.get_prefix() << " return " << r << dendl;
+ if (r == -EOPNOTSUPP) {
+ // New CLS call to update part info is not yet supported. Fall back to the old handling.
+ bufferlist bl;
+ encode(info, bl);
+ r = meta_obj->omap_set_val_by_key(dpp, p, bl, true, null_yield);
+ }
if (r < 0) {
return r == -ENOENT ? -ERR_NO_SUCH_UPLOAD : r;
}