mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-30 00:56:44 +01:00
SERVER-44859 fix plan_cache_index_create.js to work with two phase index builds
This commit is contained in:
parent
22c12339cd
commit
a4926b39a1
@ -6,6 +6,8 @@
|
||||
(function() {
|
||||
"use strict";
|
||||
|
||||
load('jstests/noPassthrough/libs/index_build.js');
|
||||
|
||||
const dbName = "test";
|
||||
const collName = "coll";
|
||||
|
||||
@ -76,6 +78,16 @@ function runTest({rst, readDB, writeDB}) {
|
||||
assert.commandWorked(
|
||||
readDB.adminCommand({configureFailPoint: 'hangAfterStartingIndexBuild', mode: 'alwaysOn'}));
|
||||
|
||||
// The commitIndexBuild oplog entry may block $planCacheStats on the secondary during oplog
|
||||
// application because it will hold the PBWM while waiting for the index build to complete in
|
||||
// the backgroud. Therefore, we get the primary to hold off on writing the commitIndexBuild
|
||||
// oplog entry until we are ready to resume index builds on the secondary.
|
||||
if (writeDB.getMongo().host != readDB.getMongo().host &&
|
||||
IndexBuildTest.supportsTwoPhaseIndexBuild(writeDB.getMongo())) {
|
||||
assert.commandWorked(writeDB.adminCommand(
|
||||
{configureFailPoint: 'hangAfterStartingIndexBuild', mode: 'alwaysOn'}));
|
||||
}
|
||||
|
||||
// Build a "most selective" index in the background.
|
||||
TestData.dbName = dbName;
|
||||
TestData.collName = collName;
|
||||
@ -102,6 +114,11 @@ function runTest({rst, readDB, writeDB}) {
|
||||
// Disable the hang and wait for the index build to complete.
|
||||
assert.commandWorked(
|
||||
readDB.adminCommand({configureFailPoint: 'hangAfterStartingIndexBuild', mode: 'off'}));
|
||||
|
||||
// No effect if the fail point is already disabled.
|
||||
assert.commandWorked(
|
||||
writeDB.adminCommand({configureFailPoint: 'hangAfterStartingIndexBuild', mode: 'off'}));
|
||||
|
||||
assert.soon(() => !indexBuildIsRunning(readDB, "most_selective"));
|
||||
createIdxShell({checkExitSuccess: true});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user