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

Actually starting to use the deallocator to clean up services #2814

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

wk8
Copy link
Contributor

@wk8 wk8 commented Feb 1, 2019

- What I did

This patch allows users to choose to make removals of services and networks
asynchronous, which means that they only get deleted once all the containers
belonging to them or using them are safely shut down.

- How I did it

A previous patch (#2759) introduced a
new component, the deallocator, responsible for cleaning up services and
service-level resources. This patch is actually starting to make use of that
component.

Since the deallocator used to rely on the reaper deleting the tasks belonging
to services that had been marked for removal, a previous version of this patch
was modifying the task reaper quite heavily to also keep track of such services
(needed since otherwise the reaper would fail to clean up all of them, instead
keeping some for history tracking purposes). However, it soon appeared that
this was not the best approach:

  • this creates a hidden coupling between the reaper and the deallocator
  • it's also not the best user experience to suddenly remove all of a service's
    task history while shutting down, for not apparent reason to the user

For these reasons, this patch instead amends the deallocator to also look at tasks status when keeping track of how many alive tasks remain to a service.

Part of this test was already reviewed in
#2778, which subsequently got reverted
following the discussion in moby/moby#38525.
The main difference between this PR and #2778 is that asynchronous removal is
an opt-in behaviour here instead of changing the existing behaviour.

- How to test it

Updated tests.

- Description for the changelog

Services & networks can be deleted asynchronously, in which case the request
for their removal simply marks them for removal, and they are then actually
deleted only when all their tasks are actually shut down.

Signed-off-by: Jean Rouge rougej+github@gmail.com

- What I did

- How I did it

- How to test it

- Description for the changelog

@wk8 wk8 force-pushed the wk8/opt_in_for_soft_delete branch from 93c6711 to 07d79cd Compare February 1, 2019 19:42
**- What I did**

This patch allows users to choose to make removals of services and networks
asynchronous, which means that they only get deleted once all the containers
belonging to them or using them are safely shut down.

**- How I did it**

A previous patch (moby#2759) introduced a
new component, the deallocator, responsible for cleaning up services and
service-level resources. This patch is actually starting to make use of that
component.

Since the deallocator used to rely on the reaper deleting the tasks belonging
to services that had been marked for removal, a previous version of this patch
was modifying the task reaper quite heavily to also keep track of such services
(needed since otherwise the reaper would fail to clean up all of them, instead
keeping some for history tracking purposes). However, it soon appeared that
this was not the best approach:
 * this creates a hidden coupling between the reaper and the deallocator
 * it's also not the best user experience to suddenly remove all of a service's
   task history while shutting down, for not apparent reason to the user

For these reasons, this patch instead amends the deallocator to also look at tasks status when keeping track of how many alive tasks remain to a service.

Part of this test was already reviewed in
moby#2778, which subsequently got reverted
following the discussion in moby/moby#38525.
The main difference between this PR and moby#2778 is that asynchronous removal is
an opt-in behaviour here instead of changing the existing behaviour.

**- How to test it**

Updated tests.

**- Description for the changelog**

Services & networks can be deleted asynchronously, in which case the request
for their removal simply marks them for removal, and they are then actually
deleted only when all their tasks are actually shut down.

Signed-off-by: Jean Rouge <rougej+github@gmail.com>
@wk8 wk8 force-pushed the wk8/opt_in_for_soft_delete branch from 07d79cd to 9f80f21 Compare February 1, 2019 19:54
@codecov
Copy link

codecov bot commented Feb 1, 2019

Codecov Report

Merging #2814 into master will increase coverage by 0.05%.
The diff coverage is 79.38%.

@@            Coverage Diff             @@
##           master    #2814      +/-   ##
==========================================
+ Coverage   61.82%   61.88%   +0.05%     
==========================================
  Files         139      137       -2     
  Lines       22120    22168      +48     
==========================================
+ Hits        13676    13718      +42     
- Misses       6973     6976       +3     
- Partials     1471     1474       +3

@wk8 wk8 requested review from anshulpundir and dperny February 1, 2019 20:23
@dperny
Copy link
Collaborator

dperny commented Feb 20, 2019

LGTM, but needs a rebase evidently.

Signed-off-by: Jean Rouge <rougej+github@gmail.com>
@wk8
Copy link
Contributor Author

wk8 commented Feb 20, 2019

Thanks @dperny , rebased :)

Signed-off-by: Jean Rouge <rougej+github@gmail.com>
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.

2 participants