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

server parameter on_update handlers shouldn't return status

    • Type: Icon: Bug Bug
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: IDL
    • Labels:
      None
    • Service Arch
    • Fully Compatible
    • ALL

      the on_update handler for server parameters with storage should not return a Status. Because we call it after storing the value, it can cause us to store an illegal value, report it via getParameter, but not have that updated value reflected in the rest of the system.

      See onUpdateFTDCDirectorySize:

      Status onUpdateFTDCDirectorySize(const std::int32_t potentialNewValue) {
          if (potentialNewValue < ftdcStartupParams.maxFileSizeMB.load()) {
              return Status(
                  ErrorCodes::BadValue,
                  str::stream()
                      << "diagnosticDataCollectionDirectorySizeMB must be greater than or equal to '"
                      << ftdcStartupParams.maxFileSizeMB.load()
                      << "' which is the current value of diagnosticDataCollectionFileSizeMB.");
          }
      
          auto controller = getGlobalFTDCController();
          if (controller) {
              controller->setMaxDirectorySizeBytes(potentialNewValue * 1024 * 1024);
          }
      
          return Status::OK();
      }
      

      For an example of where we probably should have had a validator + on_update handler, but by merging into one have allowed the observable value and the use of that value to drift out of sync

            Assignee:
            backlog-server-servicearch [DO NOT USE] Backlog - Service Architecture
            Reporter:
            mira.carey@mongodb.com Mira Carey
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: