[SERVER-54196] WiredTiger compact command does not compact data when it does not meet the compact condition Created: 02/Feb/21  Updated: 08/Mar/23  Resolved: 21/Feb/21

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

Type: Question Priority: Major - P3
Reporter: Андрей Маклаков Assignee: Dmitry Agranat
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File all_20210203.txt    
Issue Links:
Duplicate
is duplicated by SERVER-54378 Report useful information during the ... Closed
Related
related to SERVER-41596 Compact doesn't work on all cases Backlog
related to DOCS-14201 Document under what conditions the co... Closed
related to SERVER-54378 Report useful information during the ... Closed
Participants:

 Description   

We run MongoDB 4.4.2 in RS to store about 13Tb of data, and in case of deleting some unused datasets from collections we need to reclaim disk space.

For this option we use compact() functionality, but it doesn't work as expect.

wiredTiger["block-manager"]["file bytes available for reuse"]
19963424768

but

db.runCommand({ compact: 'my_collection'})
{
 "bytesFreed" : 315392,
 "ok" : 1,
 "$clusterTime" : {
 "clusterTime" : Timestamp(1612200831, 1256),
 "signature" : {
 "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
 "keyId" : NumberLong(0)
 }
 },
 "operationTime" : Timestamp(1612200082, 1373)
}

 

and no extra space on disk.

Any ideas?

 



 Comments   
Comment by Dmitry Agranat [ 21/Feb/21 ]

Hi maklakov.andrew@gmail.com,

As the reported issue was identified and DOCS-14201, SERVER-54378 tickets were opened to improve the compact command output, I will go ahead and close this ticket.

Regards,
Dima

Comment by Dmitry Agranat [ 08/Feb/21 ]

Hi maklakov.andrew@gmail.com, thank you for providing the requested information.

Based on the data, the file bytes available for reuse represents only 0.6% of the total file size which does not meet the compact condition. I have created two tickets to improve this:

  • DOCS-14201 - Document under what conditions the compact command will not compact data
  • SERVER-54378 - Report useful information during the compact command

I also changed the title of this ticket to better reflect the reported issue.

Thanks,
Dima

Comment by Андрей Маклаков [ 03/Feb/21 ]

Dmitry, all asked info in attached all_20210203.txt

Comment by Dmitry Agranat [ 03/Feb/21 ]

Hi maklakov.andrew@gmail.com,

As per our documentation:

On WiredTiger, compact attempts to reduce the required storage space for data and indexes in a collection, releasing unneeded disk space to the operating system. The effectiveness of this operation is workload dependent and no disk space may be recovered.

I wonder if you could provide collStats output from before and after the comapct command was executed, as well as the output from the compact command. This will give us a better understanding of the collection statistics prior to the attempt to compact data.

Thanks,
Dima

Generated at Thu Feb 08 05:32:54 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.