siddhantsangwan commented on code in PR #9228:
URL: https://github.com/apache/ozone/pull/9228#discussion_r2485489649
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerStateManagerImpl.java:
##########
@@ -356,26 +356,51 @@ public boolean contains(ContainerID id) {
public void updateContainerState(final HddsProtos.ContainerID containerID,
final LifeCycleEvent event)
throws IOException, InvalidStateTransitionException {
+ final ContainerID id = ContainerID.getFromProtobuf(containerID);
+ try (AutoCloseableLock ignored = readLock(id)) {
+ if (containers.contains(id)) {
+ final ContainerInfo containerInfo = containers.getContainerInfo(id);
+ Long currentSequenceId = containerInfo.getSequenceId();
+ // Delegate to @Replicate method with current sequenceId
+ updateContainerStateWithSequenceId(containerID, event,
currentSequenceId);
+ }
+ }
+ }
+
+ @Override
+ public void updateContainerStateWithSequenceId(final HddsProtos.ContainerID
containerID,
+ final LifeCycleEvent event,
+ final Long sequenceId)
+ throws IOException, InvalidStateTransitionException {
// TODO: Remove the protobuf conversion after fixing ContainerStateMap.
final ContainerID id = ContainerID.getFromProtobuf(containerID);
try (AutoCloseableLock ignored = writeLock(id)) {
Review Comment:
A read lock is acquired in the previous method. Can you check if there is
possibility of a deadlock or some other problem with acquire the write lock
here while the read lock is held? AFAIK java doesn't allow a normal reentrant
read write lock to be upgraded from read to write. Not sure if the striped lock
being used here has some handling for this.
--
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]