Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-99550

Mark querySettings attribute as 'internal' in idl

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0
    • Affects Version/s: 8.0.4
    • Component/s: None
    • None
    • Query Execution
    • Fully Compatible
    • ALL
    • v8.0
    • Hide

      Run the following test with sharding_jscore_passthrough.

      import {assertDropAndRecreateCollection} from "jstests/libs/collection_drop_recreate.js";
      import {QuerySettingsUtils} from "jstests/libs/query/query_settings_utils.js";
      
      const coll = assertDropAndRecreateCollection(db, jsTestName());
      const qsutils = new QuerySettingsUtils(db, coll.getName());
      
      const apiStrictOpts = {
          apiVersion: "1",
          apiStrict: true
      };
      const findCmd = {
          find: coll.getName(),
          filter: {y: {$gt: 5}}
      };
      qsutils.withQuerySettings(qsutils.makeQueryInstance(findCmd), {queryFramework: "sbe"}, () => {
          assert.commandWorked(db.runCommand({...findCmd, ...apiStrictOpts}));
      }); 
      Show
      Run the following test with sharding_jscore_passthrough. import {assertDropAndRecreateCollection} from "jstests/libs/collection_drop_recreate.js" ; import {QuerySettingsUtils} from "jstests/libs/query/query_settings_utils.js" ; const coll = assertDropAndRecreateCollection(db, jsTestName()); const qsutils = new QuerySettingsUtils(db, coll.getName()); const apiStrictOpts = { apiVersion: "1" , apiStrict: true }; const findCmd = { find: coll.getName(), filter: {y: {$gt: 5}} }; qsutils.withQuerySettings(qsutils.makeQueryInstance(findCmd), {queryFramework: "sbe" }, () => { assert .commandWorked(db.runCommand({...findCmd, ...apiStrictOpts})); });
    • QE 2025-02-03, QE 2025-02-17
    • 0
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      Stable API queries running with settings applied will face the following error in a sharded cluster:

      {
        "ok" : 0,
      	"errmsg" : "Encountered non-retryable error during query :: caused by :: BSON field 'querySettings' is not allowed with apiStrict:true.",
      	"code" : 323,
      	"codeName" : "APIStrictError",
      	"$clusterTime" : {
      		"clusterTime" : Timestamp(1737111453, 21),
      		"signature" : {
      			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
      			"keyId" : NumberLong(0)
      		}
      	},
      	"operationTime" : Timestamp(1737111453, 14)
      }  

      The API strict options are not part of the shape, so settings defined over a non-strict query will also apply to a strict one. 

      The root cause is due to the query settings sharded dissemination mechanism, which bakes the settings in the command body to be later picked up by the shards. This embedded field is not part of the stable api, so the shards will run into this issue during parsing. 

            Assignee:
            denis.grebennicov@mongodb.com Denis Grebennicov
            Reporter:
            catalin.sumanaru@mongodb.com Catalin Sumanaru
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: