Stephen O'Donnell created HDDS-5398:
---------------------------------------

             Summary: Avoid object creation in ReplicationManger debug log 
statements
                 Key: HDDS-5398
                 URL: https://issues.apache.org/jira/browse/HDDS-5398
             Project: Apache Ozone
          Issue Type: Improvement
          Components: SCM
    Affects Versions: 1.1.0
            Reporter: Stephen O'Donnell
            Assignee: Stephen O'Donnell


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

{code}
    LOG.debug("Handling under-replicated container: {}",
        container.getContainerID());

      LOG.debug("Deleting empty container {} replicas,", 
container.containerID());
{code}

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:

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

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



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to