rajeshkumarchandolu commented on code in PR #12145:
URL: https://github.com/apache/ozone/pull/12145#discussion_r4704092316


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineManagerImpl.java:
##########
@@ -221,9 +224,10 @@ public Pipeline createPipeline(ReplicationConfig 
replicationConfig,
       throws IOException {
     checkIfPipelineCreationIsAllowed(replicationConfig);
 
-    acquireWriteLock();
+    final Span span = 
TracingUtil.createInternalSpan("PipelineManagerImpl.createPipeline");
+    TracingUtil.executeInNewSpan("PipelineManagerImpl.acquireWriteLock", () -> 
acquireWriteLock());
     final Pipeline pipeline;
-    try {
+    try (Scope ignored = span.makeCurrent()) {

Review Comment:
   Thanks, you're right. I first tried creating the lock span before 
createPipeline (keeping it as a sibling), but testing it on a compose cluster 
with Jaeger showed a problem: when createPipeline has no parent span — which is 
the case for the background pipeline creator, the most common path — the lock 
span had nothing to attach to and became its own single-span trace (12 of them 
in one short run), while the createPipeline traces had no lock span at all.
   
   So I moved the lock acquisition inside the createPipeline scope as you 
suggested. The lock span is now a child on every path:
   
   createPipeline
   ├─ acquireWriteLock   (wait time only, ends once the lock is held)
   └─ addPipeline
      └─ applyTransaction
   
   Moving the lock acquire inside the try is safe here since acquireWriteLock() 
is just writeLock().lock(), which cannot throw. Screenshots of the 
admin-request and background-creation traces are attached.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to