Investigate changes in SERVER-102961: Add reason to setUserWriteBlockMode

XMLWordPrintableJSON

    • Type: Investigation
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Developer Tools

      Original Downstream Change Summary

      Optional argument added to the setUserWriteBlockMode command. The argument is named "reason" and is an enum that accepts the following values: "Unspecified", "ClusterToClusterMigrationInProgress", and "DiskUseThresholdExceeded".

      The behavior of the setUserWriteBlockMode was changed. When the writes are already blocked, subsequent calls to setUserWriteBlockMode will fail with the IllegalOperation code if the reason specified in the command request is not the same as the reason that was specified when the write-blocking was enabled. The error message will include the human-readable name of the reason specified when the write-blocking was enabled (e.g. "current: Unspecified") and the human-readable name of the reason specified in the failed command (e.g. "reason: DiskUseThresholdExceeded").

      Two new log entries were added. Log ID 10296100 is emitted at info level when the write-blocking is enabled. Log ID 10296101 is emitted at info level when the write-blocking is disabled. Both entries have a "reason" attribute that contains the human-readable name of the reason specified when write-blocking was enabled.

      Log entries 6351900 and 635109, emitted at debug level, now also have the "reason" attribute that contains the human-readable name of the reason specified when enabling the write-blocking.

      When an error with the UserWritesBlocked code is returned, the message contains the human-readable name of the reason specified when the write-blocking was enabled.

      New field added to the "repl" document in the serverStatus response. The field is named "userWriteBlockReason". If the writes are blocked (i.e. if the value of "userWriteBlockMode" is 2), the value of this field represents the reason specified when setUserWriteBlockMode enabled write blocking. Possible values are 0 (Unspecified), 1 (ClusterToClusterMigrationInProgress), or 2 (DiskUseThresholdExceeded).

      New subdocument added to the "repl" document in the serverStatus response. The document is named "userWriteBlockModeCounters". It has 3 fields, named "Unspecified", "ClusterToClusterMigrationInProgress", and "DiskUseThresholdExceeded". The value of each of these fields is the total cumulative number of times (since the server started) that write-blocking was enabled with the reason corresponding to the field name.

      Description of Linked Ticket

      Currently, setUserWriteBlockMode server command is only used by mongosync. We want to expand its usage to scenarios where the file system is about to run out of space. For that, we need to ensure that the reason for blocking writes is visible and that different processes cannot disable each others' attempts to block writes.

      The work tracked in this ticket will:

      • modify the command to accept an optional reason-enum about why user writes are being blocked
        • supported reasons will be DiskUseThresholdExceeded and MigrationInProgress
        • specifying any other reason will result in an error
      • store this reason-enum, if specified, on the GlobalUserWriteBlockState
      • augment the error returned when a write is blocked by GlobalUserWriteBlockState::checkWritesAreaAllowed to contain a human-readable description of this reason
      • expand the set of possible values for the serverStatus result field repl.userWriteBlockMode to include the DiskUseThresholdExceeded and MigrationInProgress cases
      • add the repl.userWriteBlockModeCounters field to the serverStatus result and record it in FTDC

      If setUserWriteBlockMode is already enabled with a different reason, the command will fail with an error indicating that writes are already blocked for another reason. The reason originally provided to enable write blocking must also be provided when disabling write blocking. If no reason or a different reason is provided than what was used when enabling write blocking, the command will fail with an error.

            Assignee:
            Unassigned
            Reporter:
            Backlog - Core Eng Program Management Team
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: