Deleted sizeable content from database, back ups and DB did not shrink

Hello, I host a cluster on Mongo Atlas. One one the collections in a database had around 110 million documents and the collection was over 300gb by itself. A cleanup took place to purge unneeded documents of which about 100 million documents were deleted. The collection now reports a size of about 25gb. However storage utilized by the cluster did not decrease and the backup size did not decrease. Any ideas on how to complete the clean up and decrease backup size?

Hi @Kendall_Baker

Given the data size the cluster must be a dedicated tier M10+.

A compaction can be done to reclaim free blocks from the collection.

This should be done on each secondary in turn. Directly connect to run the command, do not use the mongodb+srv:// connection string. The host name are visible from the metrics view, tls should be set to true, and for most cases authSource set to admin.

Once the secondaries have been compacted use the test-primary-failover-process to switch primary to another member.

Then compact the collection on the old primary.

refs:
https://www.mongodb.com/docs/manual/reference/command/compact/#compact
https://www.mongodb.com/docs/atlas/tutorial/test-resilience/test-primary-failover/?tck=mongodb_ai_chatbot#test-primary-failover-process

I think this is normal in atlas as it use WT engine it will not release space but hold up for reuse. but u can try by using compact
try compacting the databse . if you have primary and 2 secondary , start compact with one secondary node then move to other secondary and failover the primary and compact as in atlas we cannot use stepdown function .
compact - MongoDB Manual v8.0
MongoDB Support: Popular Articles

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.