OPTION(nss_db_path, OPT_STR, "") // path to nss db
+
+OPTION(rgw_max_chunk_size, OPT_INT, 512 * 1024)
+
OPTION(rgw_data, OPT_STR, "/var/lib/ceph/radosgw/$cluster-$id")
OPTION(rgw_enable_apis, OPT_STR, "s3, swift, swift_auth, admin")
OPTION(rgw_cache_enabled, OPT_BOOL, true) // rgw cache enabled
#define RGW_BUCKETS_OBJ_SUFFIX ".buckets"
-#define RGW_MAX_CHUNK_SIZE (512*1024)
#define RGW_MAX_PENDING_CHUNKS 16
#define RGW_MAX_PUT_SIZE (5ULL*1024*1024*1024)
#define RGW_MIN_MULTIPART_SIZE (5ULL*1024*1024)
}
}
+ uint64_t max_chunk_size = store->get_max_chunk_size();
+
pending_data_bl.claim_append(bl);
- if (pending_data_bl.length() < RGW_MAX_CHUNK_SIZE)
+ if (pending_data_bl.length() < max_chunk_size)
return 0;
- pending_data_bl.splice(0, RGW_MAX_CHUNK_SIZE, &bl);
+ pending_data_bl.splice(0, max_chunk_size, &bl);
if (!data_ofs && !immutable_head()) {
first_chunk.claim(bl);
head_obj.init(bucket, obj_str);
- manifest.set_trivial_rule(RGW_MAX_CHUNK_SIZE, store->ctx()->_conf->rgw_obj_stripe_size);
+ uint64_t max_chunk_size = store->get_max_chunk_size();
+
+ manifest.set_trivial_rule(max_chunk_size, store->ctx()->_conf->rgw_obj_stripe_size);
int r = manifest_gen.create_begin(store->ctx(), &manifest, bucket, head_obj);
if (r < 0) {
{
int ret;
+ max_chunk_size = cct->_conf->rgw_max_chunk_size;
+
ret = init_rados();
if (ret < 0)
return ret;
copy_data = true;
} else {
uint64_t head_size = astate->manifest.get_head_size();
+
if (head_size > 0) {
- if (head_size > RGW_MAX_CHUNK_SIZE) // should never happen
+ if (head_size > max_chunk_size) // should never happen
copy_data = true;
else
copy_first = true;
}
if (copy_first) {
- ret = get_obj(ctx, NULL, &handle, src_obj, first_chunk, 0, RGW_MAX_CHUNK_SIZE);
+ ret = get_obj(ctx, NULL, &handle, src_obj, first_chunk, 0, max_chunk_size);
if (ret < 0)
goto done_ret;
const char *data = bl.c_str();
- if (ofs < RGW_MAX_CHUNK_SIZE) {
- off_t len = min(RGW_MAX_CHUNK_SIZE - ofs, (off_t)ret);
+ if ((uint64_t)ofs < max_chunk_size) {
+ uint64_t len = min(max_chunk_size - ofs, (uint64_t)ret);
first_chunk.append(data, len);
ofs += len;
ret -= len;
first_part->loc_ofs = 0;
first_part->size = first_chunk.length();
- if (ofs > RGW_MAX_CHUNK_SIZE) {
- RGWObjManifestPart& tail = objs[RGW_MAX_CHUNK_SIZE];
+ if ((uint64_t)ofs > max_chunk_size) {
+ RGWObjManifestPart& tail = objs[max_chunk_size];
tail.loc = shadow_obj;
- tail.loc_ofs = RGW_MAX_CHUNK_SIZE;
- tail.size = ofs - RGW_MAX_CHUNK_SIZE;
+ tail.loc_ofs = max_chunk_size;
+ tail.size = ofs - max_chunk_size;
}
manifest.set_explicit(ofs, objs);
}
}
- if (len > RGW_MAX_CHUNK_SIZE)
- len = RGW_MAX_CHUNK_SIZE;
+ if (len > max_chunk_size)
+ len = max_chunk_size;
state->io_ctx.locator_set_key(key);
op.getxattrs(&unfiltered_attrset, NULL);
op.stat(&size, &mtime, NULL);
if (first_chunk) {
- op.read(0, RGW_MAX_CHUNK_SIZE, first_chunk, NULL);
+ op.read(0, cct->_conf->rgw_max_chunk_size, first_chunk, NULL);
}
bufferlist outbl;
r = ref.ioctx.operate(ref.oid, &op, &outbl);
int get_obj_ref(const rgw_obj& obj, rgw_rados_ref *ref, rgw_bucket *bucket, bool ref_system_obj = false);
uint64_t max_bucket_id;
+ uint64_t max_chunk_size;
+
int get_obj_state(RGWRadosCtx *rctx, rgw_obj& obj, RGWObjState **state, RGWObjVersionTracker *objv_tracker);
int append_atomic_test(RGWRadosCtx *rctx, rgw_obj& obj,
librados::ObjectOperation& op, RGWObjState **state);
num_watchers(0), watchers(NULL), watch_handles(NULL),
watch_initialized(false),
bucket_id_lock("rados_bucket_id"), max_bucket_id(0),
+ max_chunk_size(0),
cct(NULL), rados(NULL),
pools_initialized(false),
quota_handler(NULL),
}
}
+ uint64_t get_max_chunk_size() {
+ return max_chunk_size;
+ }
+
int list_raw_objects(rgw_bucket& pool, const string& prefix_filter, int max,
RGWListRawObjsCtx& ctx, list<string>& oids,
bool *is_truncated);
int RGWPutObj_ObjStore::get_data(bufferlist& bl)
{
size_t cl;
+ uint64_t chunk_size = s->cct->_conf->rgw_max_chunk_size;
if (s->length) {
cl = atoll(s->length) - ofs;
- if (cl > RGW_MAX_CHUNK_SIZE)
- cl = RGW_MAX_CHUNK_SIZE;
+ if (cl > chunk_size)
+ cl = chunk_size;
} else {
- cl = RGW_MAX_CHUNK_SIZE;
+ cl = chunk_size;
}
int len = 0;
{
bufferlist bl;
bool reached_boundary;
- int r = read_line(bl, RGW_MAX_CHUNK_SIZE, &reached_boundary, done);
+ uint64_t chunk_size = s->cct->_conf->rgw_max_chunk_size;
+ int r = read_line(bl, chunk_size, &reached_boundary, done);
if (r < 0)
return r;
}
if (reached_boundary) { // skip the first boundary
- r = read_line(bl, RGW_MAX_CHUNK_SIZE, &reached_boundary, done);
+ r = read_line(bl, chunk_size, &reached_boundary, done);
if (r < 0)
return r;
if (*done)
if (reached_boundary)
break;
- r = read_line(bl, RGW_MAX_CHUNK_SIZE, &reached_boundary, done);
+ r = read_line(bl, chunk_size, &reached_boundary, done);
}
return 0;
}
bool boundary;
- r = read_data(part.data, RGW_MAX_CHUNK_SIZE, &boundary, &done);
+ uint64_t chunk_size = s->cct->_conf->rgw_max_chunk_size;
+ r = read_data(part.data, chunk_size, &boundary, &done);
if (!boundary) {
err_msg = "Couldn't find boundary";
return -EINVAL;
bufferlist part_data;
bool boundary;
- r = read_data(part.data, RGW_MAX_CHUNK_SIZE, &boundary, &done);
+ uint64_t chunk_size = s->cct->_conf->rgw_max_chunk_size;
+ r = read_data(part.data, chunk_size, &boundary, &done);
if (!boundary) {
return -EINVAL;
}
bool boundary;
bool done;
- int r = read_data(bl, RGW_MAX_CHUNK_SIZE, &boundary, &done);
+ uint64_t chunk_size = s->cct->_conf->rgw_max_chunk_size;
+ int r = read_data(bl, chunk_size, &boundary, &done);
if (r < 0)
return r;