summaryrefslogtreecommitdiff
path: root/jstests/disk/directoryperdb.js
diff options
context:
space:
mode:
authorDianna Hohensee <dianna.hohensee@mongodb.com>2020-11-05 17:20:31 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-11-12 17:54:28 +0000
commitccd024d9fb5c0587e33a3a3321e7f9a0430d0190 (patch)
treee4035ba5b8f90bc300b7645d8d1ae4cf3df3c401 /jstests/disk/directoryperdb.js
parentc1ad4eab08f4679ca5071d76cfa845a9652881fe (diff)
downloadmongo-ccd024d9fb5c0587e33a3a3321e7f9a0430d0190.tar.gz
SERVER-52562 Enable two-phase drop for standalone mode; allow Lock-Free reads for standalone mode.
Diffstat (limited to 'jstests/disk/directoryperdb.js')
-rw-r--r--jstests/disk/directoryperdb.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/jstests/disk/directoryperdb.js b/jstests/disk/directoryperdb.js
index 0d4c23fe3e3..49c2c89bb0f 100644
--- a/jstests/disk/directoryperdb.js
+++ b/jstests/disk/directoryperdb.js
@@ -15,6 +15,27 @@ assertDocumentCount = function(db, count) {
};
/**
+ * Wait for the sub-directory for database 'dbName' in the MongoDB file directory 'dbDirPath' to be
+ * deleted. MongoDB does not always delete data immediately with a catalog change.
+ */
+const waitForDatabaseDirectoryRemoval = function(dbName, dbDirPath) {
+ assert.soon(
+ function() {
+ const files = listFiles(dbDirPath).filter(function(path) {
+ return path.name.endsWith(dbName);
+ });
+ if (files.length == 0) {
+ return true;
+ } else {
+ return false;
+ }
+ },
+ "dbpath contained '" + dbName +
+ "' directory when it should have been removed: " + tojson(listFiles(dbDirPath)),
+ 10 * 1000); // The periodic task to run data table cleanup runs once a second.
+};
+
+/**
* Returns the current connection which gets restarted with wiredtiger.
*/
checkDBFilesInDBDirectory = function(conn, dbToCheck) {
@@ -94,6 +115,7 @@ dbBase = m.getDB(baseName);
// Drop a database created with directoryperdb.
assert.commandWorked(dbBase.runCommand({dropDatabase: 1}));
+waitForDatabaseDirectoryRemoval(baseName, dbpath);
assertDocumentCount(dbBase, 0);
m = checkDBDirectoryNonexistent(m, baseName);
dbBase = m.getDB(baseName);