You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "Montura (via GitHub)" <gi...@apache.org> on 2024/06/03 08:45:40 UTC
[PR] Pipeline state map concurrency [ozone]
Montura opened a new pull request, #6765:
URL: https://github.com/apache/ozone/pull/6765
There is a class [PipelineStateMap](https://github.com/apache/ozone/blob/master/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineStateMap.java#L50) with 2 fields:
1. `ConcurrentHashMap<PipelineID, Pipeline> pipelineMap`
2. `ConcurrentHashMap<PipelineID, NavigableSet<ContainerID>> pipeline2container`
Both `read` and `write` in `PipelineStateMap` are protected by `lock` in [PipelineStateManagerImpl](https://github.com/apache/ozone/blob/master/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineStateManagerImpl.java#L49).
We can safely replace `ConcurrentHashMap` with pure `HashMap`
## What changes were proposed in this pull request?
1. Replace `ConcurrentHashMap` with pure `HashMap` to avoid extra lock operations.
2. Repalce `CopyOnWriteArrayList` with pure `CopyOnWriteArrayList`
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-10971
## How was this patch tested?
Use standalone tests
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10971. Replace ConcurrentHashMap with HashMap in PipelineStateMap [ozone]
Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on code in PR #6765:
URL: https://github.com/apache/ozone/pull/6765#discussion_r1630650214
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineStateMap.java:
##########
@@ -87,8 +78,7 @@ void addPipeline(Pipeline pipeline) throws IOException {
}
pipeline2container.put(pipeline.getId(), new TreeSet<>());
if (pipeline.getPipelineState() == PipelineState.OPEN) {
- query2OpenPipelines.computeIfAbsent(pipeline.getReplicationConfig(),
- any -> new CopyOnWriteArrayList<>()).add(pipeline);
+ query2OpenPipelines.computeIfAbsent(pipeline.getReplicationConfig(), any -> new ArrayList<>()).add(pipeline);
Review Comment:
nit: I think this layout is more readable:
```suggestion
query2OpenPipelines.computeIfAbsent(pipeline.getReplicationConfig(), any -> new ArrayList<>())
.add(pipeline);
```
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineStateMap.java:
##########
@@ -36,34 +36,25 @@
import java.util.NavigableSet;
import java.util.Set;
import java.util.TreeSet;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
import static java.lang.String.format;
/**
- * Holds the data structures which maintain the information about pipeline and
- * its state.
- * Invariant: If a pipeline exists in PipelineStateMap, both pipelineMap and
- * pipeline2container would have a non-null mapping for it.
+ * Holds the data structures which maintain the information about pipeline and its state.
+ * Invariant: If a pipeline exists in PipelineStateMap, both pipelineMap and pipeline2container would have
+ * a non-null mapping for it.
Review Comment:
Please avoid reformatting unnecessarily.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10971. Replace ConcurrentHashMap with HashMap in PipelineStateMap [ozone]
Posted by "Montura (via GitHub)" <gi...@apache.org>.
Montura commented on PR #6765:
URL: https://github.com/apache/ozone/pull/6765#issuecomment-2151585743
@adoroszlai, assign a reviewer please
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10971. Replace ConcurrentHashMap with HashMap in PipelineStateMap [ozone]
Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on PR #6765:
URL: https://github.com/apache/ozone/pull/6765#issuecomment-2154754169
> something is wrong with the title. But l don't understand what exactly
There were leading and trailing spaces.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10971. Replace ConcurrentHashMap with HashMap in PipelineStateMap [ozone]
Posted by "Montura (via GitHub)" <gi...@apache.org>.
Montura commented on PR #6765:
URL: https://github.com/apache/ozone/pull/6765#issuecomment-2154280766
@adoroszlai, fixed comments and updated
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10971. Replace ConcurrentHashMap with HashMap in PipelineStateMap [ozone]
Posted by "Montura (via GitHub)" <gi...@apache.org>.
Montura commented on PR #6765:
URL: https://github.com/apache/ozone/pull/6765#issuecomment-2154718909
@adoroszlai, something is wrong with the title. But l don't understand what exactly... Do you have any ideas?
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10971. Replace ConcurrentHashMap with HashMap in PipelineStateMap [ozone]
Posted by "Montura (via GitHub)" <gi...@apache.org>.
Montura commented on PR #6765:
URL: https://github.com/apache/ozone/pull/6765#issuecomment-2154717658
@adoroszlai, are we waiting for one more approval?
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10971. Replace ConcurrentHashMap with HashMap in PipelineStateMap [ozone]
Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai merged PR #6765:
URL: https://github.com/apache/ozone/pull/6765
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org