Previously, snap_collections did not get updated on the replica. As a
result, snap collections would not necessarily get trimmed when the
replica recieved and updated purged_snaps via a pg info from the
primary. Now, the log entries in sub_op_modified are scanned to check
for any new snap collections. The first and last snaps on a clone entry
are possibly new snap collections.
Signed-off-by: Samuel Just <samuel.just@dreamhost.com>
return c;
}
+void PG::update_snap_collections(vector<Log::Entry> &log_entries)
+{
+ for (vector<Log::Entry>::iterator i = log_entries.begin();
+ i != log_entries.end();
+ ++i) {
+ if (i->is_clone()) {
+ vector<snapid_t> snaps;
+ bufferlist::iterator p = i->snaps.begin();
+ ::decode(snaps, p);
+ if (!snap_collections.contains(*snaps.begin())) {
+ snap_collections.insert(*snaps.begin());
+ }
+ if (snaps.size() > 1 && !snap_collections.contains(*(snaps.end() - 1))) {
+ snap_collections.insert(*(snaps.end() - 1));
+ }
+ }
+ }
+}
+
void PG::adjust_local_snaps(ObjectStore::Transaction &t, interval_set<snapid_t> &to_check)
{
interval_set<snapid_t> to_remove;
std::string get_corrupt_pg_log_name() const;
void read_state(ObjectStore *store);
coll_t make_snap_collection(ObjectStore::Transaction& t, snapid_t sn);
+ void update_snap_collections(vector<Log::Entry> &log_entries);
void adjust_local_snaps(ObjectStore::Transaction &t, interval_set<snapid_t> &to_check);
void log_weirdness();
::decode(log, p);
info.stats = op->pg_stats;
+ update_snap_collections(log);
log_op(log, op->pg_trim_to, rm->localt);
rm->tls.push_back(&rm->opt);