[SERVER-36264] change oplogsize automatically when user provide a different value in parameter file Created: 25/Jul/18  Updated: 15/Nov/21  Resolved: 25/Jul/18

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

Type: Improvement Priority: Minor - P4
Reporter: zhihui fan Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

I think the following code can be changed to have better user experience since we already have the ability to change oplogsize online. 

void createOplog(OperationContext* opCtx, const std::string& oplogCollectionName, bool isReplSet) {
 Lock::GlobalWrite lk(opCtx);
 
const ReplSettings& replSettings = ReplicationCoordinator::get(opCtx)->getSettings();
 
OldClientContext ctx(opCtx, oplogCollectionName);
 Collection* collection = ctx.db()->getCollection(opCtx, oplogCollectionName);
 
if (collection) {
 if (replSettings.getOplogSizeBytes() != 0) {
 const CollectionOptions oplogOpts =
 collection->getCatalogEntry()->getCollectionOptions(opCtx);
 
int o = (int)(oplogOpts.cappedSize / (1024 * 1024));
 int n = (int)(replSettings.getOplogSizeBytes() / (1024 * 1024));
 if (n != o)
 
{ stringstream ss; ss << "cmdline oplogsize (" << n << ") different than existing (" << o << ") see: http://dochub.mongodb.org/core/increase-oplog"; log() << ss.str() << endl; uasserted(13257, ss.str()); }
 
}



 Comments   
Comment by Stennie Steneker (Inactive) [ 25/Jul/18 ]

zhihuifan Closing this issue as per your last comment.

Regards,
Stennie

Comment by zhihui fan [ 25/Jul/18 ]

I found this check just happens on rs.initiate stage and slave rebuild stage rather than every mongod startup stage.  so I think it is ok.   

 

Looks I can't close this Jira even it is opened by me.  so please help to close it directly 

Generated at Thu Feb 08 04:42:34 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.