xichen01 commented on code in PR #7160:
URL: https://github.com/apache/ozone/pull/7160#discussion_r1760005696
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/scm/ReconPipelineManager.java:
##########
@@ -99,29 +100,34 @@ public static ReconPipelineManager newReconPipelineManager(
void initializePipelines(List<Pipeline> pipelinesFromScm)
throws IOException {
- acquireWriteLock();
- try {
- List<Pipeline> pipelinesInHouse = getPipelines();
- LOG.info("Recon has {} pipelines in house.", pipelinesInHouse.size());
- for (Pipeline pipeline : pipelinesFromScm) {
+
+ List<Pipeline> pipelinesInHouse = getPipelines();
+ LOG.info("Recon has {} pipelines in house.", pipelinesInHouse.size());
+ for (Pipeline pipeline : pipelinesFromScm) {
+
+ ReplicationConfig replicationConfig = pipeline.getReplicationConfig();
+ acquireWriteLock(replicationConfig);
+ try {
// New pipeline got from SCM. Validate If it doesn't exist at Recon,
try adding it.
if (addPipeline(pipeline)) {
LOG.info("Added new pipeline {} from SCM.", pipeline.getId());
} else {
- LOG.warn("Pipeline {} already exists in Recon pipeline metadata.",
pipeline.getId());
+ LOG.warn("Pipeline {} already exists in Recon pipeline metadata.",
+ pipeline.getId());
// Recon already has this pipeline. Just update state and creation
// time.
- getStateManager().updatePipelineState(
- pipeline.getId().getProtobuf(),
+ getStateManager().updatePipelineState(pipeline.getId().getProtobuf(),
Pipeline.PipelineState.getProtobuf(pipeline.getPipelineState()));
getPipeline(pipeline.getId()).setCreationTimestamp(
pipeline.getCreationTimestamp());
}
+ } finally {
+ releaseWriteLock(replicationConfig);
}
- removeInvalidPipelines(pipelinesFromScm);
- } finally {
- releaseWriteLock();
+
}
+ removeInvalidPipelines(pipelinesFromScm);
Review Comment:
Should we call it inside the write lock?
--
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]