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

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

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      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

            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: