0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

SERVER-55159: Avoid using assert.commandWorked() to wait for writeConcern in an assert.soon() loop

This commit is contained in:
XueruiFa 2021-03-11 16:24:53 +00:00 committed by Evergreen Agent
parent 1f244b3322
commit e793b35538

View File

@ -88,12 +88,10 @@ m0.getDB("db1").createRole({
rstest.add();
rstest.reInitiate();
// This write will have to wait on the initial sync to complete before progressing.
assert.soonNoExcept(() => {
assert.commandWorked(rstest.getPrimary().getDB("db1")["aCollection"].insert(
{a: "afterSecondNodeAdded"}, {writeConcern: {w: 2, wtimeout: 60 * 1000}}));
return true;
});
// Do a write after the node has completed initial sync.
rstest.awaitSecondaryNodes();
assert.commandWorked(rstest.getPrimary().getDB("db1")["aCollection"].insert(
{a: "afterSecondNodeAdded"}, {writeConcern: {w: 2}}));
rstest.getPrimary().getDB("db1").createRole({
role: "r3",