Deleted unnecessary documents as disk space is about to reach its limit.
However, DiskSpace has not decreased.
LOGICAL DATA SIZE and TOTAL DOCUMENTS in the collection have decreased, but STORAGE SIZE and INDEXES TOTAL SIZE have not decreased.
It seems that I can free up DiskSpace by optimizing storage using the compact operation.
However, the cost is a bit high and I am looking for an easier way to achieve this.
Is there any other way to free up DiskSpace other than the compact operation?
Is it possible to prevent access to clusters that are running compact()?
I think the performance of queries thrown to that cluster while the index is being rebuilt by comapct() will be significantly reduced, am I correct in my understanding?
It’s not really possible to do this. Note that the compact command’s blocking behavior has changed over time (see documentation) so the performance impact should be minimal.
If running replicasets
I believe you should be able to step up/step down a node, compact the secondaries, and rotate in and out to be primary so that way your “Primary” is not affected?