MB-20697: ep_testsuite: restore deleted DB dir before cleanup 81/67681/4
authorDave Rigby <daver@couchbase.com>
Wed, 14 Sep 2016 17:52:49 +0000 (18:52 +0100)
committerDave Rigby <daver@couchbase.com>
Tue, 27 Sep 2016 13:48:30 +0000 (13:48 +0000)
In some environments (seen on Windows VM), the regression test for
MB-20697 can hang forever during cleanup due to the writer thread being
stuck in an infinite loop trying to flush to disk.

To address this, re-create the database directory before shutting down
EPStore (after the test is complete).

Change-Id: I474e77bafbe5b30858d9a306669c52713890f846
Reviewed-on: http://review.couchbase.org/67681
Reviewed-by: Daniel Owen <owend@couchbase.com>
Reviewed-by: Manu Dhundi <manu@couchbase.com>
Well-Formed: buildbot <build@couchbase.com>
Tested-by: buildbot <build@couchbase.com>
tests/ep_testsuite.cc

index 91ddc07..a11cfc2 100644 (file)
@@ -49,6 +49,7 @@
 #include <memcached/engine.h>
 #include <memcached/engine_testapp.h>
 #include <platform/cb_malloc.h>
+#include <platform/dirutils.h>
 #include <JSON_checker.h>
 
 #ifdef linux
@@ -6475,6 +6476,10 @@ static enum test_result test_mb20697(ENGINE_HANDLE *h,
     /* Ensure that this results in commit failure and the stat gets incremented */
     wait_for_stat_change(h, h1, "ep_item_commit_failed", 0);
 
+    // Restore the database directory so the flusher can complete (otherwise
+    // the writer thread can loop forever and we cannot shutdown cleanly.
+    CouchbaseDirectoryUtilities::mkdirp(dbname);
+
     return SUCCESS;
 }