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

Avoid object creation in ReplicationManger debug log statements

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.0
    • Fix Version/s: 1.2.0
    • Component/s: SCM
    • Target Version/s:

      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

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

                Dates

                • Created:
                  Updated:
                  Resolved: