adoroszlai commented on code in PR #6654:
URL: https://github.com/apache/ozone/pull/6654#discussion_r1594387011
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/states/NodeStateMap.java:
##########
@@ -445,6 +465,11 @@ private List<DatanodeInfo>
filterNodes(Predicate<DatanodeInfo> filter) {
return result;
}
+ private @Nonnull DatanodeInfo getNodeInfoUnsafe(@Nonnull UUID uuid) throws
NodeNotFoundException {
+ checkIfNodeExist(uuid);
+ return nodeMap.get(uuid);
+ }
Review Comment:
I'm not sure it's worth creating this method just to skip lock/unlock where
we already have acquired the lock, since it is `Reentrant...`.
But if you prefer to have it, please avoid duplication by calling this one
from `getNodeInfo`.
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/states/NodeStateMap.java:
##########
@@ -43,27 +45,28 @@
* NodeStateManager to maintain the state. If anyone wants to change the
* state of a node they should call NodeStateManager, do not directly use
* this class.
+ * <p>
+ * Concurrency consideration:
+ * - assumes thread-safe usage
+ * - all public WRITE methods are protected by WRITE_LOCK
+ * - all public READ methods are protected by READ_LOCK
Review Comment:
Can we simply say `This class is thread-safe.`?
--
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]