You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by ad...@apache.org on 2021/02/03 20:50:11 UTC
[ozone] branch master updated: HDDS-4756. Add lock for
activate/deactivate in SCMPipelineManager (#1861)
This is an automated email from the ASF dual-hosted git repository.
adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new f8b6113 HDDS-4756. Add lock for activate/deactivate in SCMPipelineManager (#1861)
f8b6113 is described below
commit f8b6113f8dab97e5f3f124976456c285255d8a5a
Author: Nibiru <ax...@qq.com>
AuthorDate: Thu Feb 4 04:49:56 2021 +0800
HDDS-4756. Add lock for activate/deactivate in SCMPipelineManager (#1861)
---
.../hdds/scm/pipeline/SCMPipelineManager.java | 26 +++++++++++++++-------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/SCMPipelineManager.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/SCMPipelineManager.java
index e0ea885..aefa413 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/SCMPipelineManager.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/SCMPipelineManager.java
@@ -557,10 +557,15 @@ public class SCMPipelineManager implements PipelineManager {
@Override
public void activatePipeline(PipelineID pipelineID)
throws IOException {
- Pipeline.PipelineState state = stateManager.
- getPipeline(pipelineID).getPipelineState();
- stateManager.activatePipeline(pipelineID);
- updatePipelineStateInDb(pipelineID, state);
+ lock.writeLock().lock();
+ try {
+ Pipeline.PipelineState state = stateManager.
+ getPipeline(pipelineID).getPipelineState();
+ stateManager.activatePipeline(pipelineID);
+ updatePipelineStateInDb(pipelineID, state);
+ } finally {
+ lock.writeLock().unlock();
+ }
}
/**
@@ -572,10 +577,15 @@ public class SCMPipelineManager implements PipelineManager {
@Override
public void deactivatePipeline(PipelineID pipelineID)
throws IOException {
- Pipeline.PipelineState state = stateManager.
- getPipeline(pipelineID).getPipelineState();
- stateManager.deactivatePipeline(pipelineID);
- updatePipelineStateInDb(pipelineID, state);
+ lock.writeLock().lock();
+ try {
+ Pipeline.PipelineState state = stateManager.
+ getPipeline(pipelineID).getPipelineState();
+ stateManager.deactivatePipeline(pipelineID);
+ updatePipelineStateInDb(pipelineID, state);
+ } finally {
+ lock.writeLock().unlock();
+ }
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ozone.apache.org
For additional commands, e-mail: commits-help@ozone.apache.org