This is an automated email from the ASF dual-hosted git repository.

elek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hadoop-ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 1238769  HDDS-3760. Avoid UUID#toString call in 
Pipeline#getProtobufMessage (#1043)
1238769 is described below

commit 12387697a4c1fa8460edafcfbadcc67d70db46de
Author: runzhiwang <[email protected]>
AuthorDate: Wed Jun 10 22:00:43 2020 +0800

    HDDS-3760. Avoid UUID#toString call in Pipeline#getProtobufMessage (#1043)
---
 .../main/java/org/apache/hadoop/hdds/scm/pipeline/Pipeline.java   | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/pipeline/Pipeline.java
 
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/pipeline/Pipeline.java
index 97d4837..c40b71b 100644
--- 
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/pipeline/Pipeline.java
+++ 
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/pipeline/Pipeline.java
@@ -59,6 +59,7 @@ public final class Pipeline {
   private ThreadLocal<List<DatanodeDetails>> nodesInOrder = new 
ThreadLocal<>();
   // Current reported Leader for the pipeline
   private UUID leaderId;
+  private String strLeaderID = "";
   // Timestamp for pipeline upon creation
   private Instant creationTimestamp;
 
@@ -146,6 +147,9 @@ public final class Pipeline {
    */
   void setLeaderId(UUID leaderId) {
     this.leaderId = leaderId;
+    if (leaderId != null) {
+      this.strLeaderID = leaderId.toString();
+    }
   }
 
   /**
@@ -266,7 +270,7 @@ public final class Pipeline {
         .setType(type)
         .setFactor(factor)
         .setState(PipelineState.getProtobuf(state))
-        .setLeaderID(leaderId != null ? leaderId.toString() : "")
+        .setLeaderID(strLeaderID)
         .setCreationTimeStamp(creationTimestamp.toEpochMilli())
         .addAllMembers(members);
     // To save the message size on wire, only transfer the node order based on
@@ -344,7 +348,7 @@ public final class Pipeline {
     b.append(", Type:").append(getType());
     b.append(", Factor:").append(getFactor());
     b.append(", State:").append(getPipelineState());
-    b.append(", leaderId:").append(getLeaderId());
+    b.append(", leaderId:").append(strLeaderID);
     b.append(", CreationTimestamp").append(getCreationTimestamp());
     b.append("]");
     return b.toString();


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

Reply via email to