ArafatKhan2198 commented on PR #6742:
URL: https://github.com/apache/ozone/pull/6742#issuecomment-2161154682

   > @ArafatKhan2198 If we always want to check whether pipeline exists before 
addition, then the check should be performed inside `addPipeline`. The method 
should be changed to return whether the pipeline was added or not. The caller 
can then use this information to perform conditional action, e.g.
   > 
   > * update pipeline state/timestamp (for existing pipeline whose addition 
was skipped)
   > * log the action
   > 
   > Benefits:
   > 
   > 1. existence is checked atomically with addition
   > 2. existence is checked only once
   > 3. logging etc. are performed without lock
   
   Thanks for the suggestion @adoroszlai 
   I have added the following changes :- 
   
   **ReconContainerManager:**
   - Simplified the `addNewContainer` method by using the return value of 
`addPipeline` to conditionally log the addition of new pipelines, removing 
redundant pipeline existence checks.
   
   **ReconPipelineManager:**
   - Modified the `initializePipelines` method to use the return value of 
`addPipeline` for logging whether a new pipeline was added or already existed, 
ensuring updates are made to the state and creation time only if the pipeline 
already exists.
   
   **ReconPipelineReportHandler:**
   - No changes were made. The existing early check for pipeline existence and 
fetching from SCM if it doesn't exist remains intact to ensure the necessary 
pipeline information is retrieved before attempting to add it.


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