[SERVER-67198] Investigate CollectionImpl::averageObjectSize() computation when there are no records Created: 10/Jun/22  Updated: 29/Oct/23  Resolved: 15/Jun/22

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

Type: Task Priority: Major - P3
Reporter: Gregory Wlodarek Assignee: Gregory Wlodarek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Execution Team 2022-06-27
Participants:

 Description   

    inline int averageObjectSize(OperationContext* opCtx) const {
        uint64_t n = numRecords(opCtx);
 
        if (n == 0)
            return 5;
        return static_cast<int>(dataSize(opCtx) / n);
    }



 Comments   
Comment by Githook User [ 15/Jun/22 ]

Author:

{'name': 'Gregory Wlodarek', 'email': 'gregory.wlodarek@mongodb.com', 'username': 'GWlodarek'}

Message: SERVER-67198 CollectionImpl::averageObjectSize() returns 0 instead of 5 if there are no records
Branch: master
https://github.com/mongodb/mongo/commit/1a05e3b836a493ca2c205c56ca4f092c88dc918c

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