Replies: 1 comment 2 replies
-
@aawsome / @simonsan , tagging you as recent committers. Could you give your thoughts on my proposal please? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Today, rustic supports cold storage through two parameters,
--warm-up-command
and--warm-up-wait
.rustic calls the warm-up command once per pack, giving it one pack ID at a time.
Then rustic waits for the given duration.
After the wait, rustic assumes that all files are available.
problem
rustic does not know when the packs truly become available for download.
This requires the operator to provide the maximum possible duration that files can take to become available.
If the operator underestimates, rustic will attempt to read an object that isn't available, get an error, and abort the restore.
I want to propose a better way and get consensus before I invest time in implementing it.
The cold storage I am most familiar with is AWS S3 Glacier Deep Archive (GDA).
With GDA, you first request object(s), wait for them to become available, then get them.
There are two key features of S3 that rustic does not currently have support for, but could add it pretty straightforwardly.
The first feature is batch restore.
Instead of requesting one object at a time, S3 supports making a single request with a list of objects.
The second feature is restore notifications.
S3 Deep Archive's restoration can take anywhere from 1 minute to 48 hours.
Instead of waiting a fixed amount, the requester can listen for a notification that the file is ready.
With these two features, restore from Glacier cold storage would be as fast as possible.
It is not possible to achieve this as-is without updating rustic logic.
Batching is not possible because rustic invokes the warm-up command one pack at a time.
Listening for restore notifications is technically possible today, but due to the above, we can wait for only one pack at a time.
For three packs, we'd request one pack, then wait for it to get restored, then request the second pack, wait for that, then continue to the third.
Although today only Glacier supports this, AFAIK, batching and notifications are generic features that any cold storage provider can support. rustic will support these in a generic way.
the key idea
The key shortcoming we'll address is the warm-up command knowing only about one pack at a time, not all packs at once.
We'll create two new restic parameters:
--warm-up-batch=N
(integer argument). The default is 1, with the current behavior of calling the warm-up command with one pack at a time, then waiting for the given time.Any larger number N causes restic to invoke the warm-up command with N packs at once.
--warm-up-pack-id-input=<arg>
, with argument being one ofanchor
orargv
. Default isanchor
, where rustic replaces the%id
anchor in the given warm-up command with the pack ID. Usingargv
causes rustic to pass the pack ID(s) as argv elements without any string replacement. (We need this because replacing%id
cannot meaningfully support batching.)For Glacier, this set of new parameters will allow the command to batch-request packs and to wait for all those packs to complete restoration.
happy case walkthrough
The user:
The user runs a rustic restore:
Let's say rustic wants to restore 3 packs with IDs pk1, pk2, and pk3. For this, it needs only one batch.
It invokes
./restore-from-glacier.sh pk1 pk2 pk3
.The restore command receives:
First, the warm-up command creates a batch job manifest and uploads it to S3:
Next, the warm-up command initiates restoration for all the pack IDs in the manifest. It create a batch job.
Once restoration started, the warm-up command starts listening for restoration events:
Now all files are restored, and restore-from-glacier.sh exits.
rustic resumes execution and starts retrieving cold packs.
progress bar
Today, there is a progress bar during warm-up, updating for each warm-up invocation, so per pack.
With the new system, we would update the progress bar per batch, not per pack.
For most cases where batch size is >= packs we are restoring, the progress bar will be either at 0% or 100%.
This feels like a regression.
The warm-up command for Glacier knows how many packs have finished restoring.
We could devise a protocol for the warm-up command to communicate its status back to rustic.
That would support updating the progress bar more granularly.
I do not want to devise this protocol as a necessary part of this change, as it adds complexity and ambiguity.
The protocol could support more than just the quantity of packs restored, and I want to separate the discussion of potential capabilities and requirements of this protocol.
Once the protocol is devised, we could add it to this feature straightforwardly.
use of argv
Is it ideal to pass all packs in
argv
, or is there a better way?I believe it's the best way because it is a POSIX standard, so it is highly portable.
There is a limit on the number of arguments supported in
argv
. Supposedly the minimum allowed is 4,096. My macOS computer supports 1,048,576.https://stackoverflow.com/a/7499490/1214939
The limit on
argv
is main reason I want to support letting the user specify the batch size, rather than just supporting all packs at once.It is a lower limit than the number of objects Glacier supports in a batch request.
next steps
What do you think about the proposal? Is there a better way? Do you see any concerns?
If I build it as written, will it get accepted?
I would like to build this feature and believe I can, but my main concern is that I am not familiar with Rust.
Would anyone be willing to be my code reviewer?
Beta Was this translation helpful? Give feedback.
All reactions