]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
PGMonitor: fix stat comparison in prepare_pg_stats
authorSamuel Just <sam.just@inktank.com>
Thu, 11 Jul 2013 01:29:54 +0000 (18:29 -0700)
committerSamuel Just <sam.just@inktank.com>
Thu, 11 Jul 2013 01:33:51 +0000 (18:33 -0700)
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
src/mon/PGMonitor.cc
src/osd/osd_types.h

index 6c9effccd6e6781c9ef730c2fcc93a0acde0f648..0e6e1749725e3b65db82ad7c46afbebd1a2c6201 100644 (file)
@@ -736,15 +736,13 @@ bool PGMonitor::prepare_pg_stats(MPGStats *stats)
     ack->pg_stat[pgid] = make_pair(p->second.reported_seq, p->second.reported_epoch);
 
     if (pg_map.pg_stat.count(pgid) &&
-       (pg_map.pg_stat[pgid].reported_seq > p->second.reported_seq ||
-        pg_map.pg_stat[pgid].reported_epoch > p->second.reported_epoch)) {
+        pg_map.pg_stat[pgid].get_version_pair() > p->second.get_version_pair()) {
       dout(15) << " had " << pgid << " from " << pg_map.pg_stat[pgid].reported_epoch << ":"
               << pg_map.pg_stat[pgid].reported_seq << dendl;
       continue;
     }
     if (pending_inc.pg_stat_updates.count(pgid) && 
-       (pending_inc.pg_stat_updates[pgid].reported_seq > p->second.reported_seq ||
-        pending_inc.pg_stat_updates[pgid].reported_epoch > p->second.reported_epoch)) {
+        pending_inc.pg_stat_updates[pgid].get_version_pair() > p->second.get_version_pair()) {
       dout(15) << " had " << pgid << " from " << pending_inc.pg_stat_updates[pgid].reported_epoch << ":"
               << pending_inc.pg_stat_updates[pgid].reported_seq << " (pending)" << dendl;
       continue;
index 157098f32c422f79ed8948c3c214d45156d6a29f..e3f46f9d601e211ab5dd3094c6c970a35d9a5c6c 100644 (file)
@@ -962,6 +962,10 @@ struct pg_stat_t {
     }
   }
 
+  pair<epoch_t, version_t> get_version_pair() const {
+    return make_pair(reported_epoch, reported_seq);
+  }
+
   void add(const pg_stat_t& o) {
     stats.add(o.stats);
     log_size += o.log_size;