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

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

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • None
    • None
    • None
    • None

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

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: