]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test_filestore_idempotent: detect commit cycles due to non-idempotent ops
authorSage Weil <sage@newdream.net>
Thu, 10 Nov 2011 21:35:57 +0000 (13:35 -0800)
committerSage Weil <sage.weil@dreamhost.com>
Fri, 11 Nov 2011 05:12:38 +0000 (21:12 -0800)
If we do a non-idempotent op and it does a commit itself, we don't see
fs->is_committed() true ever.  Also count full commit cycles, and kill
ourselves after several of those have gone by.

Signed-off-by: Sage Weil <sage@newdream.net>
src/os/JournalingObjectStore.h
src/test/test_filestore_idempotent.cc

index a701a7d12e3a6c11e099b0c8e99a602e44c2d6f2..3df539fb5c7e85284806e0231fd8bc3e5dab126f 100644 (file)
@@ -70,6 +70,10 @@ public:
     Mutex::Locker l(com_lock);
     return committing_seq != committed_seq;
   }
+  uint64_t get_committed_seq() {
+    Mutex::Locker l(com_lock);
+    return committed_seq;
+  }
 
 public:
   JournalingObjectStore() : op_seq(0), 
index 15b372e65aaa7402556cd37bb477409928532e0e..a4aafa7da66d343404fde84655cdfb393e4d6939 100644 (file)
@@ -87,6 +87,8 @@ int main(int argc, const char **argv)
 
     bool committing = false;
     uint64_t committed_at = 0;
+    uint64_t committed_seq = 0;
+    int num_commits = 0;
     while (true) {
       // build buffer
       bufferlist bl;
@@ -116,9 +118,18 @@ int main(int argc, const char **argv)
        }
       }
       if (committed_at && committed > committed_at + 100) {
-       cout << " have seen several commits since the last journal flush, exiting to fake a crash" << std::endl;
+       cout << " have seen several ops commit since the last journal flush, exiting to fake a crash" << std::endl;
        _exit(0);
       }
+
+      if (fs->get_committed_seq() != committed_seq) {
+       num_commits++;
+       committed_seq = fs->get_committed_seq();
+       if (num_commits > 5) {
+         cout << " have seen several commit cycles, exiting to fake a crash" << std::endl;
+         _exit(0);
+       }
+      }
     }
   }