From 308ad10e7c7931ce9c10621ef61817a15fb4de3d Mon Sep 17 00:00:00 2001 From: Oleksandr Poliakov Date: Thu, 2 Jan 2025 14:21:12 -0800 Subject: [PATCH 1/3] Mark `new` as optional for findOneAndModify commands --- .../tests/unified/findOneAndReplace.json | 8 ++++++-- .../transactions/tests/unified/findOneAndReplace.yml | 4 ++-- .../transactions/tests/unified/findOneAndUpdate.json | 12 +++++++++--- .../transactions/tests/unified/findOneAndUpdate.yml | 6 +++--- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/source/transactions/tests/unified/findOneAndReplace.json b/source/transactions/tests/unified/findOneAndReplace.json index d9248244b3..f0742f0c60 100644 --- a/source/transactions/tests/unified/findOneAndReplace.json +++ b/source/transactions/tests/unified/findOneAndReplace.json @@ -127,7 +127,9 @@ "update": { "x": 1 }, - "new": false, + "new": { + "$$unsetOrMatches": false + }, "lsid": { "$$sessionLsid": "session0" }, @@ -299,7 +301,9 @@ "update": { "x": 1 }, - "new": false, + "new": { + "$$unsetOrMatches": false + }, "lsid": { "$$sessionLsid": "session0" }, diff --git a/source/transactions/tests/unified/findOneAndReplace.yml b/source/transactions/tests/unified/findOneAndReplace.yml index 2b4a9920d6..f1b79c9588 100644 --- a/source/transactions/tests/unified/findOneAndReplace.yml +++ b/source/transactions/tests/unified/findOneAndReplace.yml @@ -88,7 +88,7 @@ tests: findAndModify: *collection_name query: { _id: 3 } update: { x: 1 } - new: false + new: { $$unsetOrMatches: false } lsid: { $$sessionLsid: *session0 } txnNumber: { $numberLong: '1' } startTransaction: true @@ -178,7 +178,7 @@ tests: findAndModify: *collection_name query: { _id: 3 } update: { x: 1 } - new: false + new: { $$unsetOrMatches: false } lsid: { $$sessionLsid: *session0 } txnNumber: { $numberLong: '1' } startTransaction: true diff --git a/source/transactions/tests/unified/findOneAndUpdate.json b/source/transactions/tests/unified/findOneAndUpdate.json index 34a40bb570..b9b0dcfcc4 100644 --- a/source/transactions/tests/unified/findOneAndUpdate.json +++ b/source/transactions/tests/unified/findOneAndUpdate.json @@ -189,7 +189,9 @@ "x": 1 } }, - "new": false, + "new": { + "$$unsetOrMatches": false + }, "lsid": { "$$sessionLsid": "session0" }, @@ -281,7 +283,9 @@ "x": 1 } }, - "new": false, + "new": { + "$$unsetOrMatches": false + }, "lsid": { "$$sessionLsid": "session0" }, @@ -340,7 +344,9 @@ "x": 1 } }, - "new": false, + "new": { + "$$unsetOrMatches": false + }, "lsid": { "$$sessionLsid": "session0" }, diff --git a/source/transactions/tests/unified/findOneAndUpdate.yml b/source/transactions/tests/unified/findOneAndUpdate.yml index 1865cabb0d..9969933212 100644 --- a/source/transactions/tests/unified/findOneAndUpdate.yml +++ b/source/transactions/tests/unified/findOneAndUpdate.yml @@ -130,7 +130,7 @@ tests: findAndModify: *collection_name query: { _id: 3 } update: { $inc: { x: 1 } } - new: false + new: { $$unsetOrMatches: false } lsid: { $$sessionLsid: *session0 } txnNumber: { $numberLong: '1' } startTransaction: true @@ -173,7 +173,7 @@ tests: findAndModify: *collection_name query: { _id: 3 } update: { $inc: { x: 1 } } - new: false + new: { $$unsetOrMatches: false } lsid: { $$sessionLsid: *session0 } txnNumber: { $numberLong: '2' } startTransaction: true @@ -201,7 +201,7 @@ tests: findAndModify: *collection_name query: { _id: 3 } update: { $inc: { x: 1 } } - new: false + new: { $$unsetOrMatches: false } lsid: { $$sessionLsid: *session0 } txnNumber: { $numberLong: '3' } startTransaction: true From 5943c5f3e05ba9fca09fe0366e2eaac955f8bdd6 Mon Sep 17 00:00:00 2001 From: Oleksandr Poliakov Date: Thu, 9 Jan 2025 12:15:25 -0800 Subject: [PATCH 2/3] Relax requirement for having default optional value of 'new' for findAndModify --- source/transactions/tests/unified/findOneAndUpdate.json | 4 +++- source/transactions/tests/unified/findOneAndUpdate.yml | 2 +- source/transactions/tests/unified/write-concern.json | 8 ++++++-- source/transactions/tests/unified/write-concern.yml | 4 ++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/source/transactions/tests/unified/findOneAndUpdate.json b/source/transactions/tests/unified/findOneAndUpdate.json index b9b0dcfcc4..f5308efef3 100644 --- a/source/transactions/tests/unified/findOneAndUpdate.json +++ b/source/transactions/tests/unified/findOneAndUpdate.json @@ -491,7 +491,9 @@ "x": 1 } }, - "new": false, + "new": { + "$$unsetOrMatches": false + }, "lsid": { "$$sessionLsid": "session0" }, diff --git a/source/transactions/tests/unified/findOneAndUpdate.yml b/source/transactions/tests/unified/findOneAndUpdate.yml index 9969933212..49d68a2090 100644 --- a/source/transactions/tests/unified/findOneAndUpdate.yml +++ b/source/transactions/tests/unified/findOneAndUpdate.yml @@ -277,7 +277,7 @@ tests: findAndModify: *collection_name query: { _id: 3 } update: { $inc: { x: 1 } } - new: false + new: { $$unsetOrMatches: false } lsid: { $$sessionLsid: *session0 } txnNumber: { $numberLong: '1' } startTransaction: true diff --git a/source/transactions/tests/unified/write-concern.json b/source/transactions/tests/unified/write-concern.json index 7acdd54066..29d1977a82 100644 --- a/source/transactions/tests/unified/write-concern.json +++ b/source/transactions/tests/unified/write-concern.json @@ -1417,7 +1417,9 @@ "update": { "x": 1 }, - "new": false, + "new": { + "$$unsetOrMatches": false + }, "lsid": { "$$sessionLsid": "session0" }, @@ -1522,7 +1524,9 @@ "x": 1 } }, - "new": false, + "new": { + "$$unsetOrMatches": false + }, "lsid": { "$$sessionLsid": "session0" }, diff --git a/source/transactions/tests/unified/write-concern.yml b/source/transactions/tests/unified/write-concern.yml index ecb9fac0ea..1eb27cf1d1 100644 --- a/source/transactions/tests/unified/write-concern.yml +++ b/source/transactions/tests/unified/write-concern.yml @@ -606,7 +606,7 @@ tests: findAndModify: *collection_name query: { _id: 0 } update: { x: 1 } - new: false + new: { $$unsetOrMatches: false } <<: *transactionCommandArgs commandName: findAndModify databaseName: *database_name @@ -642,7 +642,7 @@ tests: findAndModify: *collection_name query: { _id: 0 } update: { $inc: { x: 1 } } - new: false + new: { $$unsetOrMatches: false } <<: *transactionCommandArgs commandName: findAndModify databaseName: *database_name From 8c528e8978996dd2cffcc07a27a6cd589c15aa6a Mon Sep 17 00:00:00 2001 From: Oleksandr Poliakov Date: Thu, 9 Jan 2025 12:16:14 -0800 Subject: [PATCH 3/3] Set appName when failPoint set on 'hello' command --- .../transactions/tests/unified/mongos-recovery-token.json | 6 ++++-- source/transactions/tests/unified/mongos-recovery-token.yml | 2 ++ source/transactions/tests/unified/pin-mongos.json | 6 ++++-- source/transactions/tests/unified/pin-mongos.yml | 2 ++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/source/transactions/tests/unified/mongos-recovery-token.json b/source/transactions/tests/unified/mongos-recovery-token.json index 00909c4218..bb88aa16bd 100644 --- a/source/transactions/tests/unified/mongos-recovery-token.json +++ b/source/transactions/tests/unified/mongos-recovery-token.json @@ -232,7 +232,8 @@ "id": "client1", "useMultipleMongoses": true, "uriOptions": { - "heartbeatFrequencyMS": 30000 + "heartbeatFrequencyMS": 30000, + "appName": "transactionsClient" }, "observeEvents": [ "commandStartedEvent" @@ -299,7 +300,8 @@ "isMaster", "hello" ], - "closeConnection": true + "closeConnection": true, + "appName": "transactionsClient" } } } diff --git a/source/transactions/tests/unified/mongos-recovery-token.yml b/source/transactions/tests/unified/mongos-recovery-token.yml index f8606f0782..9eed826ec5 100644 --- a/source/transactions/tests/unified/mongos-recovery-token.yml +++ b/source/transactions/tests/unified/mongos-recovery-token.yml @@ -150,6 +150,7 @@ tests: # flight heartbeat refreshes the first mongoes' SDAM state in between # the initial commitTransaction and the retry attempt. heartbeatFrequencyMS: 30000 + appName: &appName transactionsClient observeEvents: - commandStartedEvent - database: @@ -195,6 +196,7 @@ tests: - isMaster - hello closeConnection: true + appName: *appName # The first commitTransaction sees a retryable connection error due to # the fail point and also fails on the server. The retry attempt on a # new mongos will wait for the transaction to timeout and will fail diff --git a/source/transactions/tests/unified/pin-mongos.json b/source/transactions/tests/unified/pin-mongos.json index 5f2ecca5c1..c96f3f341f 100644 --- a/source/transactions/tests/unified/pin-mongos.json +++ b/source/transactions/tests/unified/pin-mongos.json @@ -1249,7 +1249,8 @@ "id": "client1", "useMultipleMongoses": true, "uriOptions": { - "heartbeatFrequencyMS": 30000 + "heartbeatFrequencyMS": 30000, + "appName": "transactionsClient" }, "observeEvents": [ "commandStartedEvent" @@ -1316,7 +1317,8 @@ "isMaster", "hello" ], - "closeConnection": true + "closeConnection": true, + "appName": "transactionsClient" } } } diff --git a/source/transactions/tests/unified/pin-mongos.yml b/source/transactions/tests/unified/pin-mongos.yml index 596dc2d00d..4869ac3c16 100644 --- a/source/transactions/tests/unified/pin-mongos.yml +++ b/source/transactions/tests/unified/pin-mongos.yml @@ -527,6 +527,7 @@ tests: # flight heartbeat refreshes the first mongoes' SDAM state in between # the insert connection error and the single commit attempt. heartbeatFrequencyMS: 30000 + appName: &appName transactionsClient observeEvents: - commandStartedEvent - database: @@ -572,6 +573,7 @@ tests: - isMaster - hello closeConnection: true + appName: *appName - object: *collection1 name: insertOne