From c7fc87f9f1a1418407b5ea9cd18ef736a6e92c1e Mon Sep 17 00:00:00 2001 From: Orit Wasserman Date: Fri, 19 May 2017 15:20:18 +0300 Subject: [PATCH] rgw: check if buckets needs resharding on all ops that add new objects Signed-off-by: Orit Wasserman --- src/rgw/rgw_file.cc | 5 +++++ src/rgw/rgw_op.cc | 26 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/rgw/rgw_file.cc b/src/rgw/rgw_file.cc index 3a49acbbd14..c472e41159b 100644 --- a/src/rgw/rgw_file.cc +++ b/src/rgw/rgw_file.cc @@ -1337,6 +1337,11 @@ namespace rgw { goto done; } + op_ret = get_store()->check_bucket_shards(s->bucket_info, s->bucket, bucket_quota); + if (op_ret < 0) { + goto done; + } + hash.Final(m); buf_to_hex(m, CEPH_CRYPTO_MD5_DIGESTSIZE, calc_md5); diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 4114cf0caa0..daee3f2cdb7 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -3323,6 +3323,12 @@ void RGWPutObj::execute() goto done; } + op_ret = store->check_bucket_shards(s->bucket_info, s->bucket, bucket_quota); + if (op_ret < 0) { + ldout(s->cct, 20) << "check_bucket_shards() returned ret=" << op_ret << dendl; + goto done; + } + hash.Final(m); if (compressor && compressor->is_compressed()) { @@ -3492,6 +3498,11 @@ void RGWPostObj::execute() return; } + op_ret = store->check_bucket_shards(s->bucket_info, s->bucket, bucket_quota); + if (op_ret < 0) { + return; + } + RGWPutObjProcessor_Atomic processor(*static_cast(s->obj_ctx), s->bucket_info, s->bucket, @@ -3572,6 +3583,11 @@ void RGWPostObj::execute() return; } + op_ret = store->check_bucket_shards(s->bucket_info, s->bucket, bucket_quota); + if (op_ret < 0) { + return; + } + hash.Final(m); buf_to_hex(m, CEPH_CRYPTO_MD5_DIGESTSIZE, calc_md5); @@ -6010,6 +6026,11 @@ int RGWBulkUploadOp::handle_file(const boost::string_ref path, return op_ret; } + op_ret = store->check_bucket_shards(s->bucket_info, s->bucket, bucket_quota); + if (op_ret < 0) { + return op_ret; + } + RGWPutObjProcessor_Atomic processor(obj_ctx, binfo, binfo.bucket, @@ -6083,6 +6104,11 @@ int RGWBulkUploadOp::handle_file(const boost::string_ref path, return op_ret; } + op_ret = store->check_bucket_shards(s->bucket_info, s->bucket, bucket_quota); + if (op_ret < 0) { + return op_ret; + } + char calc_md5[CEPH_CRYPTO_MD5_DIGESTSIZE * 2 + 1]; unsigned char m[CEPH_CRYPTO_MD5_DIGESTSIZE]; hash.Final(m); -- 2.47.3