]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
PG: Fix log.empty confusion
authorSamuel Just <samuel.just@dreamhost.com>
Thu, 13 Oct 2011 21:35:13 +0000 (14:35 -0700)
committerSamuel Just <samuel.just@dreamhost.com>
Fri, 14 Oct 2011 17:17:07 +0000 (10:17 -0700)
Previously, log.empty meant that the log.head was everion_t().  However,
it was in a few places used to mean that log.head == log.tail.  Now,
log.empty means log.head == log.tail and log.null() indicates that
log.head is eversion_t().

Signed-off-by: Samuel Just <samuel.just@dreamhost.com>
src/osd/OSD.cc
src/osd/PG.cc
src/osd/PG.h

index 780936ddf43bd7d4c2f2f3f724185009d6389d7a..9628d5fb41347c01e4587708d90786bb6f2e4bc8 100644 (file)
@@ -3973,7 +3973,7 @@ void OSD::split_pg(PG *parent, map<pg_t,PG*>& children, ObjectStore::Transaction
     PG *child = p->second;
 
     // fix log bounds
-    if (!child->log.log.empty()) {
+    if (!child->log.empty()) {
       child->log.head = child->log.log.rbegin()->version;
       child->log.tail =  parent->log.tail;
       child->log.backlog = parent->log.backlog;
index 0a91c53ad50cba847d6abd165b5e91b50a58ce09..d2ab9688c3eaeab581a7951ecfe5e9d1e2a252be 100644 (file)
@@ -391,9 +391,9 @@ void PG::merge_log(ObjectStore::Transaction& t,
 
   // If our log is empty, the incoming log either needs to have a backlog
   // or have not been trimmed
-  assert(!log.empty() || olog.backlog || olog.tail == eversion_t());
+  assert(!log.null() || olog.backlog || olog.tail == eversion_t());
   // If the logs don't overlap, we need both backlogs
-  assert(log.head >= olog.tail || ((log.backlog || log.empty()) && olog.backlog));
+  assert(log.head >= olog.tail || ((log.backlog || log.null()) && olog.backlog));
 
   for (map<hobject_t, Missing::item>::iterator i = missing.missing.begin();
        i != missing.missing.end();
@@ -529,7 +529,7 @@ void PG::merge_log(ObjectStore::Transaction& t,
       
       // move aside divergent items
       list<Log::Entry> divergent;
-      while (!log.log.empty()) {
+      while (!log.empty()) {
        Log::Entry &oe = *log.log.rbegin();
        /*
         * look at eversion.version here.  we want to avoid a situation like:
@@ -825,7 +825,7 @@ void PG::drop_backlog()
   log.backlog = false;
   info.log_backlog = false;
   
-  while (!log.log.empty()) {
+  while (!log.empty()) {
     Log::Entry &e = *log.log.begin();
     if (e.version > log.tail) break;
 
@@ -2200,7 +2200,7 @@ void PG::read_log(ObjectStore *store)
     
     PG::Log::Entry e;
     bufferlist::iterator p = bl.begin();
-    assert(log.log.empty());
+    assert(log.empty());
     eversion_t last;
     bool reorder = false;
     while (!p.end()) {
@@ -2508,7 +2508,7 @@ void PG::log_weirdness()
                      << " != info.last_update " << info.last_update
                      << "\n";
 
-  if (log.log.empty()) {
+  if (log.empty()) {
     // shoudl it be?
     if (log.head != log.tail)
       osd->clog.error() << info.pgid
@@ -3882,7 +3882,7 @@ ostream& operator<<(ostream& out, const PG& pg)
       pg.log.head != pg.info.last_update)
     out << " (info mismatch, " << pg.log << ")";
 
-  if (pg.log.log.empty()) {
+  if (pg.log.empty()) {
     // shoudl it be?
     if (pg.log.head.version - pg.log.tail.version != 0) {
       out << " (log bound mismatch, empty)";
index f57145a1cf7f257e25354e4490d41d7738c71c85..7592176517ab746385385907d4f15ba7ba150f33 100644 (file)
@@ -457,7 +457,12 @@ public:
       backlog = false;
       log.clear();
     }
+
     bool empty() const {
+      return log.empty();
+    }
+
+    bool null() const {
       return head.version == 0 && head.epoch == 0;
     }