[SERVER-16000] collection stats storageSize is incorrect Created: 03/Nov/14  Updated: 19/Nov/14  Resolved: 07/Nov/14

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

Type: Bug Priority: Major - P3
Reporter: Daniel Pasette (Inactive) Assignee: Benety Goh
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

We use the WT stats to calculate storageSize, but the format changes after it reaches a file size threshold. We need to account for and handle the format change or change it upstream.

Calculation is made here:
https://github.com/mongodb/mongo/blob/master/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp#L226

from:

> db.f.stats().wiredtiger["block manager"]
{
	"file allocation unit size" : "4096",
	"blocks allocated" : "0",
	"checkpoint size" : "0",
	"allocations requiring file extension" : "0",
	"blocks freed" : "0",
	"file magic number" : "120897",
	"file major version number" : "1",
	"minor version number" : "0",
	"file bytes available for reuse" : "0",
==>	"file size in bytes" : "4096"
}

To this:

> db.f.stats().wiredtiger["block manager"]
{
	"file allocation unit size" : "4096",
	"blocks allocated" : "97",
	"checkpoint size" : "2M (2322432)",
	"allocations requiring file extension" : "97",
	"blocks freed" : "0",
	"file magic number" : "120897",
	"file major version number" : "1",
	"minor version number" : "0",
	"file bytes available for reuse" : "0",
==>	"file size in bytes" : "2M (2330624)"
}

As a side note, the human readable stats are also wrong in WT once file size goes to GB. For example:

> db.bulk3.stats().wiredtiger["block manager"]
{
	"file allocation unit size" : "4096",
	"blocks allocated" : "0",
	"checkpoint size" : "4B (4217180160)",
	"allocations requiring file extension" : "0",
	"blocks freed" : "0",
	"file magic number" : "120897",
	"file major version number" : "1",
	"minor version number" : "0",
	"file bytes available for reuse" : "20480",
==>	"file size in bytes" : "4B (4217196544)"
}



 Comments   
Comment by Githook User [ 07/Nov/14 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-16000 store integral values of wired tiger statistics instead of string values
Branch: master
https://github.com/mongodb/mongo/commit/716cfde34adf0e1c4a92c4e8fc1960a50d3cbc50

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