RGW:Multisite: Convert is_mpu_obj into an enum SourceObjType

Signed-off-by: Prasad Krishnan <prasad.krishnan@flipkart.com>
This commit is contained in:
Prasad Krishnan 2020-03-20 20:01:35 +00:00
parent 6c4262bfa7
commit fa54225978
3 changed files with 16 additions and 8 deletions

View File

@ -11,5 +11,6 @@ overrides:
rgw curl low speed time: 300
rgw md log max shards: 4
rgw data log num shards: 4
rgw sync obj etag verify: true
rgw:
compression type: random

View File

@ -18,6 +18,12 @@
#include "rgw_putobj.h"
#include "rgw_op.h"
enum SourceObjType {
OBJ_TYPE_UNINIT, /* Object type is not initialised yet */
OBJ_TYPE_ATOMIC,
OBJ_TYPE_MPU, /* Object at source was created through MPU */
};
class RGWPutObj_ETagVerifier : public rgw::putobj::Pipe
{
protected:

View File

@ -3259,7 +3259,8 @@ class RGWRadosPutObj : public RGWHTTPStreamRWRequest::ReceiveCB
void *progress_data;
bufferlist extra_data_bl, manifest_bl;
uint64_t extra_data_left{0};
bool need_to_process_attrs{true}, is_mpu_obj{false};
bool need_to_process_attrs{true};
SourceObjType obj_type{OBJ_TYPE_UNINIT};
uint64_t data_len{0};
map<string, bufferlist> src_attrs;
uint64_t ofs{0};
@ -3353,10 +3354,11 @@ public:
if (rule.part_size == 0) {
/* Atomic object */
obj_type = OBJ_TYPE_ATOMIC;
etag_verifier_atomic = boost::in_place(cct, filter);
filter = &*etag_verifier_atomic;
} else {
is_mpu_obj = true;
obj_type = OBJ_TYPE_MPU;
etag_verifier_mpu = boost::in_place(cct, filter);
uint64_t cur_part_ofs = UINT64_MAX;
@ -3444,15 +3446,14 @@ public:
}
string get_calculated_etag() {
if (!cct->_conf->rgw_sync_obj_etag_verify)
return "";
if (is_mpu_obj) {
if (obj_type == OBJ_TYPE_ATOMIC) {
etag_verifier_atomic->calculate_etag();
return etag_verifier_atomic->get_calculated_etag();
} else if (obj_type == OBJ_TYPE_MPU) {
etag_verifier_mpu->calculate_etag();
return etag_verifier_mpu->get_calculated_etag();
} else {
etag_verifier_atomic->calculate_etag();
return etag_verifier_atomic->get_calculated_etag();
return "";
}
}
};