Project

General

Profile

Expiring collections » History » Version 3

Tom Clegg, 05/31/2016 07:18 PM

1 1 Tom Clegg
h1. Expiring collections
2
3
h2. Overview
4
5
Deleting a collection is not an instantaneous operation. Rather, a collection can be set to expire at some future time. Until that time arrives, its data blocks are still considered valuable: a client can "recover from trash" by clearing the expiry flag.
6
7
This addresses (at least) three desirable features:
8
9
A client should be able to undo a "delete collection" operation that was done by a different client. For example, it should be possible to delete a collection using arv-mount, then recover it using Workbench.
10
11
Automated processes need temp/scratch space: a mechanism to protect data _temporarily_ from the garbage collector, without cluttering any user's account. Arvados should not require applications to do things like make "temp" subprojects and set timers to clean up old data.
12
13
It should not be possible to do a series of collection operations that results in "lost" blocks. Example:
14
# Get old collection A (with signed manifest)
15
# Delete old collection A
16
# (garbage collector runs now)
17
# Create new collection B (using the signed manifest from collection A)
18
19
h2. Background: existing race window
20
21
Keep's garbage collection strategy relies on a "race window": new unreferenced data cannot be deleted, because there is necessarily a time interval between getting a signature from a Keep server (by writing the data) and using that signature to add the block to a collection.
22
23
A timestamp signature from a keepstore server means "this data will not be deleted until the given timestamp": before giving out a signature, keepstore updates the mtime of the block on disk, and (even if asked by datamanager/keep-balance) refuses to delete blocks that are too new. This means the API server can safely store a collection without checking whether the referenced data blocks actually exist: if the timestamps are current, the blocks can't have been garbage-collected.
24
25
The expires_at behavior described here should help the API server offer a similar guarantee ("a signature expiring at time T means the data will not be deleted until T").
26
27
h2. Collection expires_at
28
29
Each collection has an expires_at field.
30
31
|expires_at|significance|get (pdh)|get (uuid)|appears in default list|can appear in list when filtering by expires_at|
32
|null      |persistent  |yes      |yes       |yes                    |yes                                            |
33 3 Tom Clegg
|>now      |expiring    |yes(*)   |yes(*)    |no(**)                 |yes                                            |
34 1 Tom Clegg
|<=now     |expired     |no       |no        |no                     |no                                             |
35
36 3 Tom Clegg
(*) If expires_at is not null, any signatures given in a get/list response must expire before expires_at.
37
38
(**) Change to "yes" after updating clients (arv-mount and Workbench) to behave appropriately, i.e., either use an expires_at filter when requesting collection lists, or skip over them in default views.
39 1 Tom Clegg
40
When a client makes a DELETE request, the collection should not be deleted outright. Instead, its expires_at time should be set to @(now + max(defaultExpiryWindow, blobSignatureTTL))@.
41
42
Expired collections are effectively deleted (whether/when the system deletes the rows from the underlying database table is an implementation detail).
43
44
h2. Client behavior
45
46
Workbench should not normally display collections with @(expires_at is not null)@. A "view trash" feature would be useful, though.
47
48
arv-mount should not normally list collections with @(expires_at is not null)@. A "trash directory" feature would be useful, though.
49
50
datamanager/keep-balance must not delete data blocks that are referenced by any collection with @(expires_at is null or expires_at>now)@.
51
52
h2. Collection modifications
53
54
In order to guarantee "permission signature timestamp T == no garbage collection until T", the API server must also make an expiring collection whenever a collection is modified _such that a block disappears from its manifest._
55
56
An expiring collection created this way
57
* ...does not need to include all blocks from the original manifest -- only the ones that are disappearing from the original.
58
* ...is not necessarily visible to the user -- it just has to be visible to datamanager/keep-balance. (If it is also visible to the user, it could support an "undo modification" feature.)
59
60 2 Tom Clegg
Here, the definition of "disappear" must include _all_ blocks in a collection whose replication_desired is changing from non-zero to zero.
61
62
63 1 Tom Clegg
h2. Related: replication_desired=0
64
65
A collection with replication_desired=0 does not protect its data from garbage collection. In this sense, replication_desired=0 is similar to expires_at<now.
66
67
However, replication_desired=0 does not mean the collection record itself should be hidden. It means the collection metadata (filenames, sizes, data hashes, collection PDH) are valuable enough to keep on hand, but the data itself isn't. For example, if we delete intermediate data generated by a workflow, and find later that the same workflow now produces a different result, it would be helpful to see which of the intermediate outputs differed.