diff options
Diffstat (limited to 'jstests/noPassthrough/libs/index_build.js')
-rw-r--r-- | jstests/noPassthrough/libs/index_build.js | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/jstests/noPassthrough/libs/index_build.js b/jstests/noPassthrough/libs/index_build.js index 28f0b91fba0..09ca4b01b1c 100644 --- a/jstests/noPassthrough/libs/index_build.js +++ b/jstests/noPassthrough/libs/index_build.js @@ -617,18 +617,36 @@ const ResumableIndexBuildTest = class { ResumableIndexBuildTest.checkIndexes( rst, dbName, collName, indexName, postIndexBuildInserts); - if (!failWhileParsing) { - // Ensure that the persisted Sorter data was cleaned up after failing to resume. This - // cleanup does not occur if parsing failed. - const files = listFiles(primary.dbpath + "/_tmp"); + const checkLogIdAfterRestart = function(primary, id) { + rst.stop(primary); + rst.start(primary, {noCleanData: true}); + checkLog.containsJson(primary, id); + }; + + const checkTempDirectoryCleared = function(primary) { + const tempDir = primary.dbpath + "/_tmp"; + + // If the index build was interrupted for shutdown before anything was inserted into + // the Sorter, the temp directory may not exist. + if (!fileExists(tempDir)) + return; + + // Ensure that the persisted Sorter data was cleaned up after failing to resume. + const files = listFiles(tempDir); assert.eq(files.length, 0, files); + }; + + if (failWhileParsing) { + // If we fail while parsing, the persisted Sorter data will only be cleaned up after + // another restart. + checkLogIdAfterRestart(primary, 5071100); + checkTempDirectoryCleared(primary); + } else { + checkTempDirectoryCleared(primary); // If we fail after parsing, any remaining internal idents will only be cleaned up // after another restart. - clearRawMongoProgramOutput(); - rst.stop(primary); - rst.start(primary, {noCleanData: true}); - assert(RegExp("22257.*").test(rawMongoProgramOutput())); + checkLogIdAfterRestart(primary, 22257); } } }; |