[SERVER-74895] Expect command errors in validation when querying $collStats, and improve the error message Created: 15/Mar/23  Updated: 29/Oct/23  Resolved: 16/Mar/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.0.0-rc0, 4.4.20, 5.0.16, 6.0.6, 6.3.1

Type: Task Priority: Major - P3
Reporter: Dianna Hohensee (Inactive) Assignee: Dianna Hohensee (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Related
related to SERVER-74632 Log $collStats output when a collecti... Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v6.3, v6.0, v5.0, v4.4
Sprint: Execution Team 2023-03-20
Participants:
Linked BF Score: 18

 Description   

In production this is fine, validate will just log a message, though ideally the log doesn't talk about expecting a cursor to be present. In our testing environments, the command failure should be handled before escalating to an invariant

[conn69] "Invariant failure","attr":{"expr":"!collStatsResult.getObjectField(\"cursor\").isEmpty() && !collStatsResult.getObjectField(\"cursor\").getObjectField(\"firstBatch\").isEmpty()","msg":"Expected a cursor to be present in the $collStats results: { ok: 0.0, errmsg: \"PlanExecutor error during aggregation :: caused by :: Unable to retrieve count in $collStats stage :: caused by :: Collection [test.capped1] not found.\", code: 26, codeName: \"NamespaceNotFound\", $clusterTime: { clusterTime: Timestamp(1678833862, 262), signature: { hash: BinData(0, 0000000000000000000000000000000000000000), keyId: 0 } }, operationTime: Timestamp(1678833862, 262) }","file":"src/mongo/db/commands/validate.cpp","line":90}
[conn69] "\n\n***aborting after invariant() failure\n\n"



 Comments   
Comment by Githook User [ 14/Apr/23 ]

Author:

{'name': 'Dianna Hohensee', 'email': 'dianna.hohensee@mongodb.com', 'username': 'DiannaHohensee'}

Message: SERVER-74895 Expect command errors in validation when querying $collStats

(cherry picked from commit 80caaf6c05cc0a9bb5f5e0458c671ba7ffd528b5)
Branch: v6.3
https://github.com/mongodb/mongo/commit/75d93e40f3ec5386b4ffe6b09cc3bfd95f42aee7

Comment by Githook User [ 29/Mar/23 ]

Author:

{'name': 'Dianna Hohensee', 'email': 'dianna.hohensee@mongodb.com', 'username': 'DiannaHohensee'}

Message: SERVER-74895 Expect command errors in validation when querying $collStats

(cherry picked from commit 80caaf6c05cc0a9bb5f5e0458c671ba7ffd528b5)
Branch: v5.0
https://github.com/mongodb/mongo/commit/3f24d5d25363a17963027526a8531202e8f3cd6e

Comment by Githook User [ 29/Mar/23 ]

Author:

{'name': 'Dianna Hohensee', 'email': 'dianna.hohensee@mongodb.com', 'username': 'DiannaHohensee'}

Message: SERVER-74895 Expect command errors in validation when querying $collStats

(cherry picked from commit 80caaf6c05cc0a9bb5f5e0458c671ba7ffd528b5)
Branch: v4.4
https://github.com/mongodb/mongo/commit/9b200f4c1d6b8fa118e98571e38ec7bede2f07d2

Comment by Githook User [ 29/Mar/23 ]

Author:

{'name': 'Dianna Hohensee', 'email': 'dianna.hohensee@mongodb.com', 'username': 'DiannaHohensee'}

Message: SERVER-74895 Expect command errors in validation when querying $collStats

(cherry picked from commit 80caaf6c05cc0a9bb5f5e0458c671ba7ffd528b5)
Branch: v6.0
https://github.com/mongodb/mongo/commit/204ed9d85c3c6196c34cd9b35c1d275416f58528

Comment by Githook User [ 16/Mar/23 ]

Author:

{'name': 'Dianna Hohensee', 'email': 'dianna.hohensee@mongodb.com', 'username': 'DiannaHohensee'}

Message: SERVER-74895 Expect command errors in validation when querying $collStats
Branch: master
https://github.com/mongodb/mongo/commit/80caaf6c05cc0a9bb5f5e0458c671ba7ffd528b5

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