[SERVER-56642] Fix Test: jstests/replsets/read_write_concern_defaults_propagation.js Created: 05/May/21  Updated: 29/Oct/23  Resolved: 19/May/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.0.0-rc0, 5.1.0-rc0

Type: Task Priority: Major - P3
Reporter: Moustafa Maher Assignee: Samyukta Lanka
Resolution: Fixed Votes: 0
Labels: pm-2130-post-rc0, post-rc0
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Backwards Compatibility: Fully Compatible
Backport Requested:
v5.0
Sprint: Repl 2021-05-17, Repl 2021-05-31
Participants:

 Description   

Fix the test to work with the new default write concern.

Fix also: jstests/sharding/read_write_concern_defaults_propagation.js



 Comments   
Comment by Vivian Ge (Inactive) [ 06/Oct/21 ]

Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you!

Comment by Githook User [ 19/May/21 ]

Author:

{'name': 'Samy Lanka', 'email': 'samy.lanka@mongodb.com', 'username': 'lankas'}

Message: SERVER-56642 fix read_write_concern_defaults_propagation.js when change default write concern feature flag enabled

(cherry picked from commit 5005b41c787fef67a0136f51b97d952a8a1a2629)
Branch: v5.0
https://github.com/mongodb/mongo/commit/2a5d086be403b86ce4fea6f1335610fc6c01c1c9

Comment by Githook User [ 19/May/21 ]

Author:

{'name': 'Samy Lanka', 'email': 'samy.lanka@mongodb.com', 'username': 'lankas'}

Message: SERVER-56642 fix read_write_concern_defaults_propagation.js when change default write concern feature flag enabled
Branch: master
https://github.com/mongodb/mongo/commit/5005b41c787fef67a0136f51b97d952a8a1a2629

Comment by Samyukta Lanka [ 07/May/21 ]

Proposed fix:

diff --git a/jstests/libs/read_write_concern_defaults_propagation_common.js b/jstests/libs/read_write_concern_defaults_propagation_common.js
index 474a9828af..6102240c16 100644
--- a/jstests/libs/read_write_concern_defaults_propagation_common.js
+++ b/jstests/libs/read_write_concern_defaults_propagation_common.js
@@ -1,5 +1,6 @@
 var ReadWriteConcernDefaultsPropagation = (function() {
     "use strict";
+    load("jstests/libs/write_concern_util.js");  // For isDefaultWriteConcernMajorityFlagEnabled.
     const kDefaultReadConcernField = "defaultReadConcern";
     const kDefaultWriteConcernField = "defaultWriteConcern";
@@ -137,7 +138,13 @@ var ReadWriteConcernDefaultsPropagation = (function() {
             // Note localUpdateWallClockTime is generated by the in-memory cache, so it will be
             // present even if there are no defaults
             const unexpectedFields = kDefaultRWCFields.concat(kExtraSetFields);
-            return unexpectedFields.every(field => !defaultsRes.hasOwnProperty(field));
+            return unexpectedFields.every(field => {
+                if (field !== kDefaultWriteConcernField || !isDefaultWriteConcernMajorityFlagEnabled(checkConn)) {
+                    return !defaultsRes.hasOwnProperty(field);
+                } else {
+                    return defaultsRes.hasOwnProperty(field) && !bsonWoCompare(defaultsRes[field], {w: "majority", wtimeout: 60000});
+                }
+            });
         }),
                     "deleted/dropped defaults failed to propagate to all nodes within " +
                         timeoutSecs + " secs. checkConns: " + tojson(checkConns),

Generated at Thu Feb 08 05:39:49 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.