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

Histogram stats types are incorrect

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Hide

      On a mongod with the following parameters set:

      mongod --setParameter enableTestCommands=true --setParameter featureFlagCommonQueryFramework=true --setParameter internalQueryFrameworkControl=tryBonsai

      Run the following:

       

      db.coll.createIndex({a: 1});
      db.coll.insertMany([{a: 1}, {a: 2}, {a: 2}, {a: 3}, {a: 3}, {a: 3}]);
      
      db.runCommand({analyze: "coll", key: "a"}); 

       
       
      At this point, the stats collection should be initialized correctly. Now run the following to force HistogramCE to be used:

       

      db.adminCommand({setParameter: 1, internalQueryCardinalityEstimatorMode: "histogram"})
      db.adminCommand({setParameter: 1, internalQueryFrameworkControl: "forceBonsai"})  

       
       
      This results in the following command failing:

      db.coll.aggregate({$match: {a: 1}});
      > Error: error: {
              "ok" : 0,
              "errmsg" : "Error getting histograms for path test.test : aBSON field 'StatsPath.statistics.documents' is the wrong type 'int', expected type 'long'",
              "code" : 14,
              "codeName" : "TypeMismatch"
      }
      Show
      On a mongod with the following parameters set: mongod --setParameter enableTestCommands=true --setParameter featureFlagCommonQueryFramework=true --setParameter internalQueryFrameworkControl=tryBonsai Run the following:   db.coll.createIndex({a: 1}); db.coll.insertMany([{a: 1}, {a: 2}, {a: 2}, {a: 3}, {a: 3}, {a: 3}]); db.runCommand({analyze: "coll", key: "a"});     At this point, the stats collection should be initialized correctly. Now run the following to force HistogramCE to be used:   db.adminCommand({setParameter: 1, internalQueryCardinalityEstimatorMode: "histogram"}) db.adminCommand({setParameter: 1, internalQueryFrameworkControl: "forceBonsai"})     This results in the following command failing: db.coll.aggregate({$match: {a: 1}}); > Error: error: { "ok" : 0, "errmsg" : "Error getting histograms for path test.test : aBSON field 'StatsPath.statistics.documents' is the wrong type 'int', expected type 'long'", "code" : 14, "codeName" : "TypeMismatch" }
    • QO 2022-10-31

      See the steps to reproduce. Note that it is possible to make the error go away by changing all bucket field types to double and the documents field type to int in ce/stats.idl; however, this may not be the correct fix.

            Assignee:
            misha.tyulenev@mongodb.com Misha Tyulenev (Inactive)
            Reporter:
            alya.berciu@mongodb.com Alya Berciu
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: