]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD: _pg_process_info refactor to use adjust_local_snaps
authorSamuel Just <samuelj@hq.newdream.net>
Thu, 13 Jan 2011 19:10:31 +0000 (11:10 -0800)
committerSamuel Just <samuelj@hq.newdream.net>
Thu, 13 Jan 2011 21:43:14 +0000 (13:43 -0800)
Changes _pg_process_info to use adjust_local_snaps.  Also accounts for
the incoming info not being a superset of the existing info.

Signed-off-by: Samuel Just <samuelj@hq.newdream.net>
src/osd/OSD.cc

index a51f645440497ea2c5f32fbb278fa4f29bb52bc6..a7716a44067a9aea41f61fc799108b72571944ce 100644 (file)
@@ -3991,35 +3991,25 @@ void OSD::_process_pg_info(epoch_t epoch, int from,
       dout(10) << *pg << " writing updated stats" << dendl;
       pg->info.stats = info.stats;
 
-      // did a snap just get purged?
-      if (info.purged_snaps.size() < pg->info.purged_snaps.size()) {
-       stringstream ss;
-       ss << "pg " << pg->info.pgid << " replica got purged_snaps " << info.purged_snaps
-          << " had " << pg->info.purged_snaps;
-       logclient.log(LOG_WARN, ss);
-       pg->info.purged_snaps = info.purged_snaps;
-      } else {
-       interval_set<snapid_t> p = info.purged_snaps;
-       p.subtract(pg->info.purged_snaps);
-       if (!p.empty()) {
-         dout(10) << " purged_snaps " << pg->info.purged_snaps
-                  << " -> " << info.purged_snaps
-                  << " removed " << p << dendl;
-         snapid_t sn = p.range_start();
-         coll_t c(info.pgid, sn);
-         t->remove_collection(c);
-
-         pg->info.purged_snaps = info.purged_snaps;
-       }
-      }
-
-      pg->write_info(*t);
-
-      if (!log.empty()) {
-       dout(10) << *pg << ": inactive replica merging new PG log entries" << dendl;
-       pg->merge_log(*t, info, log, from);
+      // Handle changes to purged_snaps
+      interval_set<snapid_t> p;
+      p.union_of(info.purged_snaps, pg->info.purged_snaps);
+      p.subtract(pg->info.purged_snaps);
+      pg->info.purged_snaps = info.purged_snaps;
+      if (!p.empty()) {
+       dout(10) << " purged_snaps " << pg->info.purged_snaps
+                << " -> " << info.purged_snaps
+                << " removed " << p << dendl;
+       pg->adjust_local_snaps(*t, p);
       }
     }
+    
+    pg->write_info(*t);
+    
+    if (!log.empty()) {
+      dout(10) << *pg << ": inactive replica merging new PG log entries" << dendl;
+      pg->merge_log(*t, info, log, from);
+    }
   }
 
   int tr = store->queue_transaction(&pg->osr, t, new ObjectStore::C_DeleteTransaction(t), fin);