Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-36264

change oplogsize automatically when user provide a different value in parameter file

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      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()); }
      
      }
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            zhihuifan@163.com zhihui fan
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: