if datalog trim has no peer zones, it will trim once with
marker=
99999999. if we set last_trim=
99999999, it will never attempt to
trim again
Signed-off-by: Casey Bodley <cbodley@redhat.com>
return r;
}
// nothing left to trim, update last_trim_marker
- if (*last_trim_marker < to_marker) {
+ if (*last_trim_marker < to_marker && to_marker != max_marker) {
*last_trim_marker = to_marker;
}
return 0;
CephContext *cct;
std::string *last_trim_marker;
public:
+ // a marker that compares greater than any timestamp-based index
+ static constexpr const char* max_marker = "99999999";
+
RGWSyncLogTrimCR(RGWRados *store, const std::string& oid,
const std::string& to_marker, std::string *last_trim_marker);
int request_complete() override;
// initialize each shard with the maximum marker, which is only used when
// there are no peers syncing from us
- min_markers.assign(std::max(1u, bucket_info.num_shards), "99999999");
+ min_markers.assign(std::max(1u, bucket_info.num_shards),
+ RGWSyncLogTrimCR::max_marker);
// determine the minimum marker for each shard
retcode = take_min_status(cct, peer_status.begin(), peer_status.end(),
} // anonymous namespace
class DataLogTrimCR : public RGWCoroutine {
+ using TrimCR = RGWSyncLogTrimCR;
RGWRados *store;
RGWHTTPManager *http;
const int num_shards;
num_shards(num_shards),
zone_id(store->svc.zone->get_zone().id),
peer_status(store->svc.zone->get_zone_data_notify_to_map().size()),
- min_shard_markers(num_shards, "99999999"),
+ min_shard_markers(num_shards, TrimCR::max_marker),
last_trim(last_trim)
{}
ldout(cct, 10) << "trimming log shard " << i
<< " at marker=" << m
<< " last_trim=" << last_trim[i] << dendl;
- using TrimCR = RGWSyncLogTrimCR;
spawn(new TrimCR(store, store->data_log->get_oid(i),
m, &last_trim[i]),
true);