S3tuit commented on PR #5733:
URL: https://github.com/apache/hop/pull/5733#issuecomment-3333321795

   Using the thread id in the key makes the counter thread-scoped, not 
pipeline-scoped. It does solves the issue, but it also means that even within 
the same pipeline run, two copies (or even the same copy if the thread changes) 
won’t see the same counter when they use the same name. I don't know, but 
guessing from the existing comment:
   
   `// We need to synchronize over the whole pipeline to make sure that we 
always get the same counter regardless of the number of transform copies asking 
for it.`
   
   I think we should scope the counter to the pipeline run, not to the thread. 
Proposed key:
   
   ```
   /**
    * Build a unique identifier for this pipeline run.
    */
     private String lookupCounterName(String counterName) {
      String scope = getPipeline().getContainerId(); // unique per run
      if (scope == null) {
          scope = getPipeline().getLogChannelId(); // fallback: unique per run 
as well
       }
       return "@@sequence:" + scope + ":" + counterName;
     }
   ```
   
   From my tests, this solves the issue case and still allow different copies 
in the same pipeline to access the same counter.


-- 
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]

Reply via email to