Skip to content

Commit

Permalink
rgw: Object::Write::_do_write_meta() takes optional olh epoch
Browse files Browse the repository at this point in the history
take an optional olh_epoch, and use its empty state to skip set_olh()

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 519f1b4)
  • Loading branch information
cbodley authored and Prashant D committed Jul 23, 2018
1 parent e957e17 commit 53d218a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 4 additions & 3 deletions src/rgw/rgw_rados.cc
Expand Up @@ -7156,7 +7156,8 @@ int RGWRados::Object::Write::_do_write_meta(uint64_t size, uint64_t accounted_si
orig_size = state->accounted_size;
}

bool versioned_target = (meta.olh_epoch > 0 || !obj.key.instance.empty());
bool versioned_target = (meta.olh_epoch && *meta.olh_epoch > 0) ||
!obj.key.instance.empty();

bool versioned_op = (target->versioning_enabled() || is_olh || versioned_target);

Expand Down Expand Up @@ -7209,8 +7210,8 @@ int RGWRados::Object::Write::_do_write_meta(uint64_t size, uint64_t accounted_si
target->invalidate_state();
state = NULL;

if (versioned_op) {
r = store->set_olh(target->get_ctx(), target->get_bucket_info(), obj, false, NULL, meta.olh_epoch, real_time(), false, meta.zones_trace);
if (versioned_op && meta.olh_epoch) {
r = store->set_olh(target->get_ctx(), target->get_bucket_info(), obj, false, NULL, *meta.olh_epoch, real_time(), false, meta.zones_trace);
if (r < 0) {
return r;
}
Expand Down
7 changes: 3 additions & 4 deletions src/rgw/rgw_rados.h
Expand Up @@ -2853,7 +2853,7 @@ class RGWRados : public AdminSocketHook
int flags;
const char *if_match;
const char *if_nomatch;
uint64_t olh_epoch;
std::optional<uint64_t> olh_epoch;
ceph::real_time delete_at;
bool canceled;
const string *user_data;
Expand All @@ -2863,7 +2863,7 @@ class RGWRados : public AdminSocketHook

MetaParams() : mtime(NULL), rmattrs(NULL), data(NULL), manifest(NULL), ptag(NULL),
remove_objs(NULL), category(RGW_OBJ_CATEGORY_MAIN), flags(0),
if_match(NULL), if_nomatch(NULL), olh_epoch(0), canceled(false), user_data(nullptr), zones_trace(nullptr),
if_match(NULL), if_nomatch(NULL), canceled(false), user_data(nullptr), zones_trace(nullptr),
modify_tail(false), completeMultipart(false) {}
} meta;

Expand Down Expand Up @@ -4044,7 +4044,7 @@ class RGWPutObjProcessor_Atomic : public RGWPutObjProcessor_Aio
uint64_t max_chunk_size;

bool versioned_object;
uint64_t olh_epoch;
std::optional<uint64_t> olh_epoch;
string version_id;

protected:
Expand Down Expand Up @@ -4081,7 +4081,6 @@ class RGWPutObjProcessor_Atomic : public RGWPutObjProcessor_Aio
data_ofs(0),
max_chunk_size(0),
versioned_object(versioned),
olh_epoch(0),
bucket(_b),
obj_str(_o),
unique_tag(_t) {}
Expand Down

0 comments on commit 53d218a

Please sign in to comment.