-
Type: Bug
-
Resolution: Works as Designed
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
-
ALL
This metric gets innacurate when resizing the oplog. The metric is based on the first and last entry of the oplog. If you resize it, you won't have an accurate estimation. We also should take in consideration the :
replset:PRIMARY> db.oplog.rs.stats().storageSize replset:PRIMARY> db.oplog.rs.stats().maxSize
if your used is space is 50% of the oplog and the oplog window is 10 hours, it would be fair to say that full oplog can retain 20 hours.
Suggestion:
// Switch to admin database to get a list of databases db = db.getSiblingDB("local"); // gathering oplog max size and oplog used var result = db.getReplicationInfo(); currentOpLogWindow = result.timeDiff; storageSize = result.usedMB; maxSize = result.logSizeMB;print(storageSize + " - " + maxSize)if (storageSize/maxSize < 0.98) { // Estimate oplog window totalOpLogTimeWindow = (maxSize*currentOpLogWindow)/storageSize print (totalOpLogTimeWindow/60/60 + " hours");
}