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

Fix inconsistent state format in logging

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor - P4 Minor - P4
    • 5.1.0-rc0
    • None
    • None
    • Fully Compatible
    • Repl 2021-06-28, Repl 2021-07-12

    Description

      In parts of the code:

       
       if (_lastResponse.getState() != MemberState::RS_DOWN)
          { log() << "Member " << _hostAndPort.toString() << " is now in state RS_DOWN - " << redact(heartbeatMessage) << rsLog; 
      }

      In others we use toString:

      // Log if the state changes
       if (_lastResponse.getState() != hbResponse.getState())
           { log() << "Member " << _hostAndPort.toString() << " is now in state " << hbResponse.getState().toString() << rsLog; 
      }

      The second example will display the official state name from the docs wheras the first uses RS_DOWN. Other part in the same file says RS_UNKNOWN which should be UNKNOWN. The RS_ prefix is the enum label.

      Since this is already inconsistent I don't see any major compatibility risks in fixing this.

      Attachments

        Activity

          People

            mina.mahmood@mongodb.com Mina Mahmood (Inactive)
            nicholas.cottrell@mongodb.com Nic Cottrell
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: