int sync_stats = false;
- int replicalog_index_by_instance = true;
-
uint64_t min_rewrite_size = 4 * 1024 * 1024;
uint64_t max_rewrite_size = ULLONG_MAX;
uint64_t min_rewrite_stripe_size = 0;
// do nothing
} else if (ceph_argparse_binary_flag(args, i, &include_all, NULL, "--include-all", (char*)NULL)) {
// do nothing
- } else if (ceph_argparse_binary_flag(args, i, &replicalog_index_by_instance, NULL, "--replicalog-index-by-instance", (char*)NULL)) {
- // do nothing
} else if (ceph_argparse_witharg(args, i, &val, "--caps", (char*)NULL)) {
caps = val;
} else if (ceph_argparse_witharg(args, i, &val, "-i", "--infile", (char*)NULL)) {
}
RGWReplicaBucketLogger logger(store);
- ret = logger.get_bounds(bucket, shard_id, bounds, replicalog_index_by_instance);
+ ret = logger.get_bounds(bucket, shard_id, bounds);
if (ret < 0)
return -ret;
} else { // shouldn't get here
}
RGWReplicaBucketLogger logger(store);
- ret = logger.delete_bound(bucket, shard_id, daemon_id, replicalog_index_by_instance, false);
+ ret = logger.delete_bound(bucket, shard_id, daemon_id, false);
if (ret < 0)
return -ret;
}
}
RGWReplicaBucketLogger logger(store);
- ret = logger.update_bound(bucket, shard_id, daemon_id, marker, time, &entries, replicalog_index_by_instance);
+ ret = logger.update_bound(bucket, shard_id, daemon_id, marker, time, &entries);
if (ret < 0) {
cerr << "ERROR: failed to update bounds: " << cpp_strerror(-ret) << std::endl;
return -ret;
int RGWReplicaBucketLogger::update_bound(const rgw_bucket& bucket, int shard_id, const string& daemon_id,
const string& marker, const utime_t& time,
- const list<RGWReplicaItemMarker> *entries,
- bool index_by_instance)
+ const list<RGWReplicaItemMarker> *entries)
{
if (shard_id >= 0 ||
!BucketIndexShardsManager::is_shards_marker(marker)) {
map<int, string>::iterator iter;
for (iter = vals.begin(); iter != vals.end(); ++iter) {
- bool need_to_exist = index_by_instance && no_shards; /*
- * don't need to exist if not indexing by instance,
- * also, we only care about non-sharded
+ bool need_to_exist = no_shards; /*
+ * we only care about non-sharded
* buckets, as these are the ones that
- * might not be indexed by instance id
+ * might not be indexed by instance id, and
+ * might need conversion
*/
ldout(cct, 20) << "updating bound: bucket=" << bucket << " shard=" << iter->first << " marker=" << marker << dendl;
int r = RGWReplicaLogger::update_bound(obj_name(bucket, iter->first, true), pool,
return ret;
}
-int RGWReplicaBucketLogger::delete_bound(const rgw_bucket& bucket, int shard_id, const string& daemon_id, bool index_by_instance, bool purge_all)
+int RGWReplicaBucketLogger::delete_bound(const rgw_bucket& bucket, int shard_id, const string& daemon_id, bool purge_all)
{
- bool need_to_exist = index_by_instance; /* don't need to exist if not indexing by instance */
- int r = RGWReplicaLogger::delete_bound(obj_name(bucket, shard_id, index_by_instance), pool, daemon_id, purge_all, need_to_exist);
+ bool need_to_exist = (shard_id < 0); /* don't need to exist if sharded */
+ int r = RGWReplicaLogger::delete_bound(obj_name(bucket, shard_id, true), pool, daemon_id, purge_all, need_to_exist);
if (r != -ENOENT) {
return r;
}
if (r < 0 && r != -ENOENT) {
return r;
}
- return RGWReplicaLogger::delete_bound(obj_name(bucket, shard_id, index_by_instance), pool, daemon_id, purge_all, false);
+ return RGWReplicaLogger::delete_bound(obj_name(bucket, shard_id, true), pool, daemon_id, purge_all, false);
}
-int RGWReplicaBucketLogger::get_bounds(const rgw_bucket& bucket, int shard_id, RGWReplicaBounds& bounds, bool index_by_instance) {
- int r = RGWReplicaLogger::get_bounds(obj_name(bucket, shard_id, index_by_instance), pool, bounds);
- if (r != -ENOENT || !index_by_instance) {
+int RGWReplicaBucketLogger::get_bounds(const rgw_bucket& bucket, int shard_id, RGWReplicaBounds& bounds) {
+ int r = RGWReplicaLogger::get_bounds(obj_name(bucket, shard_id, true), pool, bounds);
+ if (r != -ENOENT || shard_id >= 0) {
return r;
}
return r;
}
- return 0;
+ return RGWReplicaLogger::get_bounds(obj_name(bucket, shard_id, true), pool, bounds);
}
int RGWReplicaBucketLogger::convert_old_bounds(const rgw_bucket& bucket, int shard_id, RGWReplicaBounds& bounds) {
RGWReplicaBucketLogger(RGWRados *_store);
int update_bound(const rgw_bucket& bucket, int shard_id, const string& daemon_id,
const string& marker, const utime_t& time,
- const list<RGWReplicaItemMarker> *entries,
- bool index_by_instance);
- int delete_bound(const rgw_bucket& bucket, int shard_id, const string& daemon_id, bool index_by_instance, bool purge_all);
- int get_bounds(const rgw_bucket& bucket, int shard_id, RGWReplicaBounds& bounds, bool index_by_instance);
+ const list<RGWReplicaItemMarker> *entries);
+ int delete_bound(const rgw_bucket& bucket, int shard_id, const string& daemon_id, bool purge_all);
+ int get_bounds(const rgw_bucket& bucket, int shard_id, RGWReplicaBounds& bounds);
int convert_old_bounds(const rgw_bucket& bucket, int shard_id, RGWReplicaBounds& bounds);
};
return 0;
}
-static int get_bucket_for_bounds(RGWRados *store, XMLArgs& args, const string& bucket_instance, rgw_bucket& bucket, bool *index_by_instance)
-{
- args.get_bool("index-by-instance", index_by_instance, true);
-
- if (*index_by_instance) {
- int r;
- if ((r = bucket_instance_to_bucket(store, bucket_instance, bucket)) < 0) {
- return r;
- }
- } else {
- string bucket_name = args.get("bucket");
-
- if (bucket_name.empty()) {
- bucket_name = bucket_instance;
-
- ssize_t pos = bucket_name.find(':');
- if (pos >= 0) {
- bucket_name = bucket_name.substr(0, pos);
- }
- }
-
- if (bucket_name.empty()) {
- dout(5) << " Error - invalid parameter list" << dendl;
- return -EINVAL;
- }
- RGWBucketInfo bucket_info;
-
- int r = store->get_bucket_info(NULL, bucket_name, bucket_info, NULL, NULL);
- if (r < 0) {
- dout(5) << "could not get bucket info for bucket=" << bucket_name << ": " << cpp_strerror(r) << dendl;
- return r;
- }
-
- bucket = bucket_info.bucket;
- }
-
- return 0;
-
-}
-
void RGWOp_BILog_SetBounds::execute() {
string bucket_instance = s->info.args.get("bucket-instance"),
marker = s->info.args.get("marker"),
}
rgw_bucket bucket;
- bool index_by_instance;
- if ((http_ret = get_bucket_for_bounds(store, s->info.args, bucket_instance, bucket, &index_by_instance)) < 0) {
+ if ((http_ret = bucket_instance_to_bucket(store, bucket_instance, bucket)) < 0) {
return;
}
return;
}
- http_ret = rl.update_bound(bucket, shard_id, daemon_id, marker, ut, &markers, index_by_instance);
+ http_ret = rl.update_bound(bucket, shard_id, daemon_id, marker, ut, &markers);
}
void RGWOp_BILog_GetBounds::execute() {
string bucket_instance = s->info.args.get("bucket-instance");
rgw_bucket bucket;
- bool index_by_instance;
int shard_id;
return;
}
- if ((http_ret = get_bucket_for_bounds(store, s->info.args, bucket_instance, bucket, &index_by_instance)) < 0) {
- return;
- }
-
if ((http_ret = bucket_instance_to_bucket(store, bucket_instance, bucket)) < 0)
return;
RGWReplicaBucketLogger rl(store);
- http_ret = rl.get_bounds(bucket, shard_id, bounds, index_by_instance);
+ http_ret = rl.get_bounds(bucket, shard_id, bounds);
}
void RGWOp_BILog_GetBounds::send_response() {
}
rgw_bucket bucket;
- bool index_by_instance;
- if ((http_ret = get_bucket_for_bounds(store, s->info.args, bucket_instance, bucket, &index_by_instance)) < 0) {
+ if ((http_ret = bucket_instance_to_bucket(store, bucket_instance, bucket)) < 0) {
return;
}
RGWReplicaBucketLogger rl(store);
- http_ret = rl.delete_bound(bucket, shard_id, daemon_id, index_by_instance, purge_all);
+ http_ret = rl.delete_bound(bucket, shard_id, daemon_id, purge_all);
}
RGWOp *RGWHandler_ReplicaLog::op_get() {