Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete containers before the task from BoltDB #3987

Merged
merged 4 commits into from
Apr 17, 2024

Conversation

SreeeS
Copy link
Contributor

@SreeeS SreeeS commented Oct 25, 2023

Summary

At present in removeTaskData we delete the task followed by container/s. In case agent exits after deleting the task before deleting the containers, the DB is left in corrupted state due to which the agent fails to restart with error:

level=critical time=2023-04-23T04:18:49Z msg="Unable to initialize new task engine: failed to load previous data from BoltDB: failed to load task engine state: did not find the task of container <task arn> module=agent.go

The error is triggered here. This change reverses the order of deletion where the container/s are deleted followed by task.

Implementation details

  • Update removeTaskData in agent/engine/data.go to first delete container/s followed by task.

Testing

  • GitHub workflow
  • Manual test for scenario where agent exits after deleting container/s with out deleting task in DB
    • Verified agent is able to start successfully
    • Removed code for task removal during this test and replaced with a log, and observed the log during the test
    • tracked task lifecycle

New tests cover the changes: n/a

Description for the changelog

Delete containers before the task from BoltDB for proper handling of dependent data

Does this PR include breaking model changes? If so, Have you added transformation functions?

no

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@SreeeS SreeeS marked this pull request as ready for review October 26, 2023 20:55
@SreeeS SreeeS requested a review from a team as a code owner October 26, 2023 20:55
@SreeeS SreeeS changed the title [Do not Review] Delete containers before the task from BoltDB Delete containers before the task from BoltDB Oct 26, 2023
@sparrc sparrc added the bot/test label Mar 5, 2024
@hozkaya2000 hozkaya2000 merged commit 81f9a88 into aws:dev Apr 17, 2024
40 checks passed
@harishxr harishxr mentioned this pull request Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants