Fix concurrent starting the next group (#1853)

when in StartNextGroupRolloutGroupSuccessAction#startNextGroup:
    1. start all scheduled actions
    2. if started are > 0 -> RUNNING, otherwise -> FINISHED (if not dynamic rollout)

what could possibly happen is that at same time:
    * because of a success condition met the JpaRolloutsExecutor triggers start the group
    * user triggers start of the next group (via RolloutsManagement#triggerNextGroup)

then it could:
    * the 'first' one succeeds to start next group
    * the second attempts to start it (JpaRolloutsExecutor found the previous had met the success condition or trigger next found it SCHEDULED and next to run)
    * the second finds no scheduled actions (just running) and decides there are no actions. So, it assumes (wrongly) no actions in group - and set it as FINISHED

This way we could have FINISHED group with still running actions

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-10-04 11:05:05 +03:00
committed by GitHub
parent 7ca5cbe1aa
commit de323b66d1
7 changed files with 65 additions and 138 deletions

View File

@@ -374,15 +374,12 @@ class RolloutManagementTest extends AbstractJpaIntegrationTest {
successCondition, errorCondition);
finishActionAndDeleteTargetsOfFirstRunningGroup(createdRollout);
checkSecondGroupStatusIsRunning(createdRollout);
finishActionAndDeleteTargetsOfSecondRunningGroup(createdRollout);
deleteAllTargetsFromThirdGroup(createdRollout);
rolloutHandler.handleAll(); // one more time to finish the second group
verifyRolloutAndAllGroupsAreFinished(createdRollout);
}
@Step("Finish three actions of the rollout group and delete two targets")