Repeatedly setting query settings on aggregate([\{$setWindowFields: ...}]) queries generates multiple query shape configurations due to diverging query shape hashes.
Enterprise rs0 [direct: primary] test> db.adminCommand({ setQuerySettings: { aggregate: "test", pipeline: [{ $setWindowFields: { partitionBy: { int_field: "$int_field", other_field: "$other_field" }, output: { count: { $sum: 1 } } } }, { $project: { _id: 0 } }], $db: "test" }, settings: { indexHints: { ns: { db: "test", coll: "test" }, allowedIndexes: ["a_1"] } } }) { queryShapeHash: '5902836CF946238C384741B17CFF8EC94698DC3FE049ADC70B252AF81954347E', settings: { indexHints: { ns: { db: 'test', coll: 'test' }, allowedIndexes: [ 'a_1' ] } }, representativeQuery: { aggregate: 'test', pipeline: [ { '$setWindowFields': { partitionBy: { int_field: '$int_field', other_field: '$other_field' }, output: { count: { '$sum': 1 } } } }, { '$project': { _id: 0 } } ], '$db': 'test' }, ok: 1, '$clusterTime': { clusterTime: Timestamp({ t: 1712852882, i: 2 }), signature: { hash: Binary.createFromBase64("AAAAAAAAAAAAAAAAAAAAAAAAAAA=", 0), keyId: Long("0") } }, operationTime: Timestamp({ t: 1712852882, i: 2 }) } Enterprise rs0 [direct: primary] test> db.adminCommand({ setQuerySettings: { aggregate: "test", pipeline: [{ $setWindowFields: { partitionBy: { int_field: "$int_field", other_field: "$other_field" }, output: { count: { $sum: 1 } } } }, { $project: { _id: 0 } }], $db: "test" }, settings: { indexHints: { ns: { db: "test", coll: "test" }, allowedIndexes: ["a_1"] } } }) { queryShapeHash: '247818291A399B424BCF04722ABC42CB9109C7EEF6B02A7F796BE3D255DDDBB7', settings: { indexHints: { ns: { db: 'test', coll: 'test' }, allowedIndexes: [ 'a_1' ] } }, representativeQuery: { aggregate: 'test', pipeline: [ { '$setWindowFields': { partitionBy: { int_field: '$int_field', other_field: '$other_field' }, output: { count: { '$sum': 1 } } } }, { '$project': { _id: 0 } } ], '$db': 'test' }, ok: 1, '$clusterTime': { clusterTime: Timestamp({ t: 1712852884, i: 1 }), signature: { hash: Binary.createFromBase64("AAAAAAAAAAAAAAAAAAAAAAAAAAA=", 0), keyId: Long("0") } }, operationTime: Timestamp({ t: 1712852884, i: 1 }) }
- is related to
-
SERVER-53974 Generate unique fieldname for partitionBy expression
- Closed
- related to
-
SERVER-89627 Complete TODO listed in SERVER-89299
- Closed
- tested by
-
SERVER-88333 Introduce query settings fallback suite
- Closed