#include "rgw_replica_log.h"
#include "cls/replica_log/cls_replica_log_client.h"
+#include "cls/rgw/cls_rgw_client.h"
#include "rgw_rados.h"
+#define dout_subsys ceph_subsys_rgw
void RGWReplicaBounds::dump(Formatter *f) const
{
}
return s;
}
+
+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)
+{
+ if (shard_id >= 0 ||
+ !BucketIndexShardsManager::is_shards_marker(marker)) {
+ return RGWReplicaLogger::update_bound(obj_name(bucket, shard_id), pool,
+ daemon_id, marker, time, entries);
+ }
+
+ BucketIndexShardsManager sm;
+ int ret = sm.from_string(marker, true);
+ if (ret < 0) {
+ ldout(cct, 0) << "ERROR: could not parse shards marker: " << marker << dendl;
+ return ret;
+ }
+
+ map<int, string>& vals = sm.get();
+
+ ret = 0;
+
+ map<int, string>::iterator iter;
+ for (iter = vals.begin(); iter != vals.end(); ++iter) {
+ ldout(cct, 20) << "updating bound: bucket=" << bucket << " shard=" << iter->first << " marker=" << marker << dendl;
+ int r = RGWReplicaLogger::update_bound(obj_name(bucket, iter->first), pool,
+ daemon_id, iter->second, time, entries);
+ if (r < 0) {
+ ldout(cct, 0) << "failed to update bound: bucket=" << bucket << " shard=" << iter->first << " marker=" << marker << dendl;
+ ret = r;
+ }
+ }
+
+ return ret;
+}
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) {
- return RGWReplicaLogger::update_bound(obj_name(bucket, shard_id), pool,
- daemon_id, marker, time, entries);
- }
+ const list<RGWReplicaItemMarker> *entries);
int delete_bound(const rgw_bucket& bucket, int shard_id, const string& daemon_id) {
return RGWReplicaLogger::delete_bound(obj_name(bucket, shard_id), pool,
daemon_id);