[SERVER-12946] Include record headers when computing collection.stats().size Created: 27/Feb/14  Updated: 06/Dec/22  Resolved: 14/Sep/18

Status: Closed
Project: Core Server
Component/s: Diagnostics, MMAPv1, Storage
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Alexander Komyagin Assignee: Backlog - Storage Execution Team
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Storage Execution
Participants:

 Description   

Right now we ignore records headers when computing collection data size (mongo/db/namespace_details.h):

DiskLoc deletedList[Buckets];
// ofs 168 (8 byte aligned)
struct Stats {
    // datasize and nrecords MUST Be adjacent code assumes!
    long long datasize; // this includes padding, but not record headers
    long long nrecords;
} stats;

However, the value includes padding and also includes the alignment that we use in our storage engine.

When the number of records hits 500,000,000 the headers overhead is 7+ GB, which is perceived as a lost disk space. I suggest to include record headers size into the coll.stats().size metric, or to introduce an additional sizeWithHeaders metric to avoid confusion.


Generated at Thu Feb 08 03:30:09 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.