[SERVER-16917] Return fileSize to db.stats() when using wiredTiger Created: 17/Jan/15 Updated: 13/Dec/19 Resolved: 28/Jun/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Admin, Storage |
| Affects Version/s: | 2.8.0-rc5 |
| Fix Version/s: | 4.3.1 |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Chad Kreimendahl | Assignee: | Maria van Keulen |
| Resolution: | Done | Votes: | 2 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||||||||||||||
| Sprint: | Execution Team 2019-07-01 | ||||||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||||||
| Description |
|
Some properties in db.stats() when using mmap do not exist when querying with wiredTiger configured. However, where a similar stat does exist, it should be included. In this case, the most obvious missing stat is fileSize. In WiredTiger this is the same as storage size plus index size. |
| Comments |
| Comment by Githook User [ 22/Nov/19 ] | |||||||||||||||||
|
Author: {'name': 'David Storch', 'username': 'dstorch', 'email': 'david.storch@mongodb.com'}Message: This tests the "totalSize" field of the collStats command, | |||||||||||||||||
| Comment by Githook User [ 28/Jun/19 ] | |||||||||||||||||
|
Author: {'name': 'Maria van Keulen', 'email': 'maria@mongodb.com', 'username': 'mvankeulen94'}Message: This commit also removes the now obsolete numExtents field. | |||||||||||||||||
| Comment by Eric Sedor [ 30/Jun/16 ] | |||||||||||||||||
|
In my testing, db.stats().storageSize + db.stats().indexSize is indeed identical to sizeOnDisk in listDatabases. Is there any reason these would ever differ? | |||||||||||||||||
| Comment by Chad Kreimendahl [ 21/Jan/15 ] | |||||||||||||||||
|
Matt, For us it was primarily about tracking data usage for our customers. We could likely get by with a combination of dataSize or storageSize plus indexSize. It actually looks like we get the precise number of sizeOnDisk (at least for wt) between storageSize + indexSize. | |||||||||||||||||
| Comment by Matt Kangas [ 21/Jan/15 ] | |||||||||||||||||
|
Database size is cheap to compute for mmapv1, but for WiredTiger or any other KVEngine it will be more costly (stat many files, where "many" is nCollections+nIndices). Note that db.stats() is the "dbstats" command under the hood, and db.getMongo().getDBs() is the "listDatabases" command. Perhaps the key question is: what depends on the "dbstats" command other than humans and how frequently is it called in practice? I'm thinking about things like the MMS agent. | |||||||||||||||||
| Comment by Asya Kamsky [ 17/Jan/15 ] | |||||||||||||||||
|
I realize it's not part of db.stats() but you can see the info via command:
This is where "show dbs" helper in the shell gets its sizes and I checked, this corresponds exactly to on-disk size of the directory. |