ozone
ozone copied to clipboard
HDDS-10830. Replace ConcurrentHashMap with HashMap protected by ReadWriteLock in NodeStateMap
There is a class NodeStateMap with 3 fields:
-
ConcurrentHashMap<UUID, DatanodeInfo> nodeMap
-
ConcurrentHashMap<UUID, Set<ContainerID>> nodeToContainer
-
private final ReadWriteLock lock
Both read
and write
operations in NodeStateMap
are protected by lock
.
What changes were proposed in this pull request?
- Replace
ConcurrentHashMap
with pureHashMap
to avoid extra lock operations. - Create
private NodeStateMap::getNodeInfoUnsafe
method withoutlock.readLock.lock()
to use it whenlock.writeLock.lock()
has already acquired:-
NodeStateMap::updateNodeHealthState
-
NodeStateMap::updateNodeOperationalState
-
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-10830
How was this patch tested?
Use standalone tests
@adoroszlai, done!
Thanks @Montura for the contribution.