Fix inconsistent state format in logging

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Minor - P4
    • 5.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Fully Compatible
    • Repl 2021-06-28, Repl 2021-07-12
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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.

              Assignee:
              Mina Mahmood (Inactive)
              Reporter:
              Nic Cottrell
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: