Repository navigation
chunker: allow for no-rename checkpoints on backends with slow rename - #4675
Conversation
|
@ivandeex have you got time to review this? |
|
Thanks for contribution. I have a few comments. I keep in mind that any remote filesystem can be accessed from several rclone instances, possibly modifying the same file in parallel, possibly from different rclone versions, and rclone must prevent data corruption in all known cases.
UPD. Besides go test unit test rclone has integration test suite (https://github.com/rclone/rclone/blob/master/CONTRIBUTING.md#testing) that can help investigate many corner cases (though it does not test parallel access thoroughly). |
|
Also, worker pools could be used to speed up parallelize-able bits like chunk renames/deletes: |
11a0d21 to
04c4386
Compare
|
@ivandeex I just pushed a new commit trying out your last suggestion of permanently keeping the transaction ID suffix in chunk names. It seems like this should address most of your other concerns as well, but let me know what you think. |
|
@ivandeex @ncw The impact of the performance penalty and server-side overhead of using the copy-and-delete rename operation is a problem broader than IBM COS. I tried Amazon S3 backend it also incurs copy and delete and it takes a few seconds for each one GB chunk object. So we should use the “Remote: S3” label instead of "IBM COS"? Chunker is a great feature for large files, but the S3 server-side copy for large files (e.g., terabytes) can add hours of delay before a Rclone copy operation completes. Is it possible to allow this PR to be merged for 1.54? I had a discussion with Max on addressing backward compatibility by adding a simple extension to his fix to allow the new Rclone to read the files created by existing Rclone versions without the fix. We will also test the current Rclone version's behavior when seeing files created by the new version. Max said that the code already passes the integration tests. Please let us know what else we might be able to do now to ready the PR for merging. Thanks! |
|
rclone supports some 30+ storage backends:
Let's make sure we all (including you, me and @ncw) know what we are doing for backends labeled in this issue. Please run a simple test: create a 10G local file, upload to your storage and compare Please compare results for IBM COS vs S3 as Upd 1. In another comment we can discuss how to avoid affecting others. |
|
By the way, this PR does not do what the title says: avoid renames completely. Currently it only deals with |
@ncw has not yet attached a term to that milestone so it depends. Fairly possible as we have three pair of eyes reviewing this stuff now (with Nick to join later). We can publish a beta and use it before a release. I used to install betas from my own fork to start eating own dogfood before it hit the release. Your patch helps improve chunker performance on more storage systems. If an important patch misses 1.5x there always is 1.5x.1 to land. Missing a release is not good but introducing regressions or breaking peoples data is much worse. |
|
@ivandeex Good idea to get some performance numbers recorded here as a reference! #4675 (comment) Using an IBM COS bucket, I got the following numbers. The AWS S3 move operation had a large fluctuation between the first and second moves. But it's consistent that they all took significant amount of time to complete. |
|
Looks like both S3 and IBM COS are Conclusions:
Upd. [1 hour later] Cleaned up the text. |
|
@ivandeex The latest commit should address most of the points you brought up. Mainly, I made changes to ensure that chunker is backwards compatible, to the extent possible, and made it so the new codepath is only used conditionally (to avoid the inefficiencies you pointed out with reading the metadata file for backends that won’t benefit from the changes). From my testing, the new version of chunker can correctly identify and deal with files that were written using the original version of chunker. The only scenario I see any problems is when the original version of chunker is interacting with version 2 files (files that were written by the new version of chunker using the new style). In this scenario, the permanent chunks are ignored and the metadata file gets treated like a small, unchunked file. Currently, I am just checking if the wrapped file system has a |
Great. We are getting there.
I can't find a unit test for that in your patch. I prefer extensive unit tests activated on every merge as they guarantee against regressions and make changes less fragile.
That's expected
Before this PR rclone always treated them as temporary or garbage chunks, that's fine.
Hmm. I would expect that "List" will list it (as it doesn't read metadata details for performance sake) but any operation that needs NewObject, like
I don't see a better way a.t.m.
@ncw has a big picture of backends. Before we merge we'll ask him about a better way to check it than
Much appreciated. A "level of indirection" will help here, I think. Let's add a parameter However the internal code logic is currently binary: either use rename or avoid it, thus internally we'd better use something like The new flag can also be used to write an internal test like what I suggest above: set flag to true, upload object, set to false, read object, and vice versa. I'm not sure what would be the better default. What do you think? |
259ca4b to
8708d3e
Compare
ivandeex
left a comment
There was a problem hiding this comment.
All inline comments addressed
1d21909 to
6066f71
Compare
|
All commits are squashed in preparation for next review. |
|
@ncw
UPD: Just noticed that UpdateNotify will also reread metadata for every change.
If @ncw decides to merge this PR as is, these requirements should be captured in feature request(s).
|
Some storage providers e.g. S3 don't have an efficient rename operation. Before this change, when chunker finished an upload, the server-side copy and delete operations that renamed temporary chunks to their final names could take a significant amount of time. This PR records transaction identifier (versioning) in the metadata of chunker composite objects striving to remove the need for rename operations on such backends. This approach will be triggered be the new "transactions" configuration option, which can be "rename" (the default) or "norename". We implement the new approach for uploads (Put operations). The chunker Move operation still uses the rename operation of underlying backend. Filling this gap is left for a later PR. Co-authored-by: Ivan Andreev <[email protected]>
6066f71 to
bede6ee
Compare
ncw
left a comment
There was a problem hiding this comment.
Please review this change.
Sorry for the delay in the review.
I can confirm that integration suite passes for all tested flavors of chunker now.
:-)
1.Currently fs.Features does not have a flag likeSlowServerSideMove.
This PR detects such backends using theFeatures.Move == nilguess (see chunker.CanQuickRename).
Can you propose a better method?
Normally we'd use operations.CanServerSideMove() but if you are trying to specifically avoid that Copy+Delete then Features.Move == nil is pretty close.
2.A note about directory listings:
After this PR the metadata for every composite object in a directory will be read during the listing operation (by thereadXactIDfunction, once per object). Additionlly, it will be re-read again byreadMetadatawhen a concrete operation is requested (Open, Move, Hash, etc). Probably, this can be partially optimized during implementation of #3972 (comment).
Composite objects are usually large so there hopefully won't be too many of them in a directory so this seems like an acceptable tradeoff.
UPD: Just noticed that UpdateNotify will also reread metadata for every change.
3.Summary of features yet unimplemented by this PR:
- Avoid server-side moves in
chunker.Movefor the new "norename" transactions- Use transaction identifiers in
chunker.Copyfor the new "norename" transactions- Enable "rename"-style transactions to recognize norename-style chunks
- Switch default transactions value to
auto. This is postponed until the above bullets are finished and sufficient beta-testing of the new feature is done (i.e. while it's released but the default is set torename)If @ncw decides to merge this PR as is, these requirements should be captured in feature request(s).
OK
4.Note about integration tests:
rclone.conf on the integration test box will need a new test remote after this PR:[TestChunkerChunk3bNoRenameLocal] type = chunker remote = /tmp chunk_size = 3b transactions = norename
I've put that in in preparation.
What is the backwards compatibility story with this commit?
I've had a look through the code and I'm happy for you to merge this if you are :-)
Thank you
|
@ncw
After this patch chunker in "rename mode" will not be able to detect "metadata in norename mode" as a chunker object. That's partially why I requested to enable new mode manually only. Nor do I have time now to fix open items left after author. Generally the more chunker features we merge -> the more format flavors we have -> the more combinations we test. @mcalman I will merge it as soon as you submit tickets for open items. |
Some storage providers e.g. S3 don't have an efficient rename operation. Before this change, when chunker finished an upload, the server-side copy and delete operations that renamed temporary chunks to their final names could take a significant amount of time. This PR records transaction identifier (versioning) in the metadata of chunker composite objects striving to remove the need for rename operations on such backends. This approach will be triggered be the new "transactions" configuration option, which can be "rename" (the default) or "norename". We implement the new approach for uploads (Put operations). The chunker Move operation still uses the rename operation of underlying backend. Filling this gap is left for a later PR. Co-authored-by: Ivan Andreev <[email protected]>
What is the purpose of this change?
Some storage providers, such as S3 (edit) or IBM COS, don't have an efficient rename operation. When chunker finishes an upload, the server-side copy and delete operations that are done to rename temporary chunks to their final chunk names takes a very long time (in some cases nearly as long as the upload took).
This change replaces temporary chunk names with a "status" control chunk that is uploaded at the beginning of a chunked upload. All operations that require ignoring temporary chunks will check for the existence of this "status" control chunk. When an upload succeeds, the "status" control chunk is removed to signify that it is a complete upload and the chunks are no longer temporary. This removes the need for temporary chunk namesentirely, and therefore avoids the rename operation that is normally done at the end of a chunked upload.EDIT
This PR extends metadata with a random "transaction identifier" striving to remove the need for the rename operation on such backends.
Was the change discussed in an issue or in the forum before?
Checklist