mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-28 07:59:02 +01:00
fd05a7c3b3
GitOrigin-RevId: f7d2485163e820162f33c4d600cf18c4bf89b6d0
25 lines
926 B
JavaScript
25 lines
926 B
JavaScript
/**
|
|
* Tests that shutdown can succeed even if the server is fsync locked.
|
|
*/
|
|
|
|
const conn = MongoRunner.runMongod();
|
|
assert.neq(conn, null);
|
|
|
|
const dbName = jsTestName();
|
|
const collName = "testColl";
|
|
const testDB = conn.getDB(dbName);
|
|
const testColl = testDB.getCollection(collName);
|
|
|
|
jsTestLog("Insert some data to create a collection.");
|
|
assert.commandWorked(testColl.insert({x: 1}));
|
|
|
|
jsTestLog("Set fsync lock to block server writes. Create some nesting for extra test coverage");
|
|
testDB.fsyncLock();
|
|
testDB.fsyncLock();
|
|
|
|
jsTestLog("Check that the fsync lock is working: no writes should be possible.");
|
|
assert.commandFailed(testDB.runCommand({insert: {z: 1}, maxTimeMS: 30}));
|
|
|
|
jsTestLog("Check that shutdown can succeed with an fsync lock: the fsync lock should be cleared.");
|
|
// Skipping validation because the fsync lock causes the validate command to hang.
|
|
MongoRunner.stopMongod(conn, null, {skipValidation: true}); |