The oplog.rs is much larger than the default limit

Mongo Version: 4.4.1 in ReplicaSet with 3 nodes
Disk Size: 750GB

The collection oplog.rs is much larger than the default limit of 35GB. Right now It has reached the size of over 300GB which is more than 10 times the limit. it’s a normal thing? How can I do to reduce its size?

I tried the compact command but it did not reduce the size. Thanks

Hi @Francesco_Rossi welcome to the community!

The oplog is a special collection that is the lifeblood of a replica set, and thus can grow beyond the configured size as mentioned in https://www.mongodb.com/docs/manual/core/replica-set-oplog/

Unlike other capped collections, the oplog can grow past its configured size limit to avoid deleting the majority commit point.

A majority commit point is:

Information, from the viewpoint of this member, regarding the most recent operation that has been written to a majority of replica set members.

If the oplog grew to 10x the configured size, you might want to double check that all is well with the replica set. A non-moving majority commit point is typically due to the use of an Arbiter, and one of the data bearing node is down.

The typical scenario is: writes keep coming in during this downtime (usually w:1 writes), which is possible due to the Arbiter keeping a Primary available, even though the replica set is in an unhealthy state. The Primary is unable to send the oplog entries to the offline Secondary, and thus the “majority commit point” of the data is held back to the most recently committed entry of the offline Secondary (which keeps falling behind as time goes on and it stays offline). At this point, the Primary’s oplog will keep growing so the offline Secondary does not fall off the oplog, which typically require an expensive maintenance procedure to fix.

Having said that, this is only a typical scenario. There are other possible scenario as well, usually involving network issues. Another possibility is that you hit a fixed issue, since you’re using an older version.

I recommend you to upgrade to the latest in the 4.4 series (currently 4.4.18 is the latest). I counted 7 mentions of oplog improvements between 4.4.1 and 4.4.18, so you might want to upgrade and see if this persists.

Best regards
Kevin

3 Likes

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