It was discovered as part of the newly introduced `implicit_query_settings_fallback` that trying to set query settings over commands involving variables fails with a "Use of undefined variable: <variable>" error. This happens when generating the query shape hash, and it's most probably due to how the blank expression context is constructed.
Example error: Parsley Logs]
uncaught exception: Error: command failed: { "ok" : 0, "errmsg" : "Invalid $addFields :: caused by :: Use of undefined variable: variable", "code" : 17276, "codeName" : "Location17276", "$clusterTime" : { "clusterTime" : Timestamp(1712334639, 18), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } }, "operationTime" : Timestamp(1712334639, 18) } with original command request: { "setQuerySettings" : { "aggregate" : "command_let_variables", "$db" : "test", "cursor" : { }, "pipeline" : [ { "$merge" : { "into" : "command_let_variables_target", "whenMatched" : [ { "$addFields" : { "var" : "$$variable" } } ] } } ], "let" : { "variable" : "OUTER" }, "lsid" : { "id" : UUID("70376fd6-a2da-4d01-a7e9-a0780b412de9") }, "$clusterTime" : { "clusterTime" : Timestamp(1712334639, 18), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } } }, "settings" : { "indexHints" : { "ns" : { "db" : "test", "coll" : "command_let_variables" }, "allowedIndexes" : [ "doesnotexist" ] } }, "lsid" : { "id" : UUID("70376fd6-a2da-4d01-a7e9-a0780b412de9") }, "$clusterTime" : { "clusterTime" : Timestamp(1712334639, 18), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } } } on connection: connection to localhost:20000 :
- is related to
-
SERVER-89609 Pass let parameters to query_settings_utils::createRepresentativeInfoFind()
- Closed
- tested by
-
SERVER-88333 Introduce query settings fallback suite
- Closed