ashishkumar50 commented on code in PR #9228:
URL: https://github.com/apache/ozone/pull/9228#discussion_r2601764501
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerStateManagerImpl.java:
##########
@@ -353,29 +353,39 @@ public boolean contains(ContainerID id) {
}
@Override
- public void updateContainerState(final HddsProtos.ContainerID containerID,
- final LifeCycleEvent event)
+ 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)) {
if (containers.contains(id)) {
- final ContainerInfo oldInfo = containers.getContainerInfo(id);
- final LifeCycleState oldState = oldInfo.getState();
+ final ContainerInfo containerInfo = containers.getContainerInfo(id);
+
+ // Synchronize sequenceId first
+ if (containerInfo.getSequenceId() < sequenceId) {
+ containerInfo.updateSequenceId(sequenceId);
+ }
+
+ final LifeCycleState oldState = containerInfo.getState();
final LifeCycleState newState = stateMachine.getNextState(
- oldInfo.getState(), event);
+ containerInfo.getState(), event);
Review Comment:
Done
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerStateManagerImpl.java:
##########
@@ -353,29 +353,39 @@ public boolean contains(ContainerID id) {
}
@Override
- public void updateContainerState(final HddsProtos.ContainerID containerID,
- final LifeCycleEvent event)
+ 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)) {
if (containers.contains(id)) {
- final ContainerInfo oldInfo = containers.getContainerInfo(id);
- final LifeCycleState oldState = oldInfo.getState();
+ final ContainerInfo containerInfo = containers.getContainerInfo(id);
+
+ // Synchronize sequenceId first
+ if (containerInfo.getSequenceId() < sequenceId) {
+ containerInfo.updateSequenceId(sequenceId);
+ }
Review Comment:
Added log
--
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]