Uploaded image for project: 'Apache Ozone'
  1. Apache Ozone
  2. HDDS-5398

Avoid object creation in ReplicationManger debug log statements

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.1.0
    • 1.2.0
    • SCM

    Description

      There are a few debug log entries in replication manager like this:

          LOG.debug("Handling under-replicated container: {}",
              container.getContainerID());
      
            LOG.debug("Deleting empty container {} replicas,", container.containerID());
      

      Especially the latter one, will always allocate a new ContainerID object on each call, even if debug is not enabled.

      If we just pass "container" then it will use the container.toString() method inside the logger, only if debug is enabled. The ContainerInfo toString looks like:

        @Override
        public String toString() {
          return "ContainerInfo{"
              + "id=" + containerID
              + ", state=" + state
              + ", pipelineID=" + pipelineID
              + ", stateEnterTime=" + stateEnterTime
              + ", owner=" + owner
              + '}';
        }
      

      It contains some extra information, but some of that may be useful if debugging a problem.

      Attachments

        Issue Links

          Activity

            People

              sodonnell Stephen O'Donnell
              sodonnell Stephen O'Donnell
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: