[SERVER-70665] Histogram stats types are incorrect Created: 18/Oct/22  Updated: 29/Oct/23  Resolved: 25/Oct/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Alya Berciu Assignee: Misha Tyulenev
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

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"
}

Sprint: QO 2022-10-31
Participants:

 Description   

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.



 Comments   
Comment by Misha Tyulenev [ 25/Oct/22 ]

This issue was fixed in SERVER-68490.

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