Skip to content

Multiwrite union - #3782

Merged
ncw merged 1 commit into
rclone:masterfrom
Max-Sum:multiwrite_union
Mar 21, 2020
Merged

ncw merged 1 commit into
rclone:masterfrom
Max-Sum:multiwrite_union

Conversation

@Max-Sum

@Max-Sum Max-Sum commented Dec 3, 2019 •

Copy link
Copy Markdown
Contributor

What is the purpose of this change?

Enable multiple write support for union backend

Was the change discussed in an issue or in the forum before?

#2737 #3709

Known issues

  • Scheme of upstream fs is changed
  • Creates a lot of unnecessary requests for some command (eg. sync)
  • Cannot report an error when deleting an object hosted only on read-only remote

Checklist

  • I have read the contribution guidelines.
  • I have added tests for all changes in this PR if appropriate.
  • I have added documentation for the changes if appropriate.
  • All commit messages are in house style.
  • I'm done, this Pull Request is ready for review :-)

Comment thread backend/union/upstream/upstream.go Resolved
Comment thread backend/union/policy/all.go Resolved
Comment thread backend/union/policy/epall.go Resolved
Comment thread backend/union/policy/epff.go Resolved
Comment thread backend/union/policy/eplfs.go Resolved
Comment thread backend/union/entry.go Resolved
Comment thread backend/union/entry.go Resolved
Comment thread backend/union/union.go Resolved
Comment thread backend/union/union.go Resolved
Comment thread backend/union/upstream/upstream.go Resolved
Comment thread backend/union/union.go Resolved
Comment thread backend/union/upstream/upstream.go Resolved
Comment thread backend/union/policy/newest.go Resolved
Comment thread backend/union/errors.go Resolved
@Max-Sum
Max-Sum marked this pull request as ready for review December 4, 2019 17:36
@Max-Sum
Max-Sum force-pushed the multiwrite_union branch 2 times, most recently from 7b40e19 to 7292ec2 Compare December 4, 2019 17:57
Comment thread backend/union/union.go Resolved
@ncw

ncw commented Dec 5, 2019

Copy link
Copy Markdown
Member

Can you rebase on master to pick up cb97239 - that should help with the test failures.

@Max-Sum
Max-Sum force-pushed the multiwrite_union branch 2 times, most recently from e950587 to bb4754d Compare December 5, 2019 12:35
Comment thread backend/union/upstream/upstream.go Resolved
@Max-Sum

Max-Sum commented Dec 5, 2019

Copy link
Copy Markdown
Contributor Author

Have no idea why it still fails... @ncw could you help?

@ncw

ncw commented Dec 6, 2019

Copy link
Copy Markdown
Member

The linux build failed because of this

backend/union/entry.go:1: File is not `goimports`-ed (goimports)

The macOS build failed with an unreliable test - you can ignore that one!

@Max-Sum

Max-Sum commented Dec 7, 2019

Copy link
Copy Markdown
Contributor Author

@ncw I ran goimports and it ended with no modification on the file. Is it because I run it on windows?

@Max-Sum

Max-Sum commented Dec 9, 2019

Copy link
Copy Markdown
Contributor Author

@ncw I have fixed goimports. Could we merge this?

@ncw ncw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a sold bit of work well done :-)

I've given it a light review - see inline comments. I think it probably needs more time but I thought it start the process.

Can you explain when the different sort of policies get used? For example I wasn't really clear on when the search policy was used. This could do with some more docs. The docs go in docs/content/union.md.

Did you check the integration tests work? They didn't appear to for me with go test -v in the union directory.

I think the policies directory needs tests - how do you think we should do that? Making a test framework would probably be a good idea - let me know if you need help with this.

Thanks

Comment thread backend/union/entry.go Resolved
Comment thread backend/union/entry.go Resolved
Comment thread backend/union/errors.go Resolved
Comment thread backend/union/errors.go Resolved
Comment thread backend/union/policy/rand.go Resolved
Comment thread backend/union/upstream/upstream.go Resolved
@ncw

ncw commented Jan 20, 2020

Copy link
Copy Markdown
Member

Hi @Max-Sum did you have any comments on the notes above?

@Max-Sum

Max-Sum commented Jan 20, 2020

Copy link
Copy Markdown
Contributor Author

@ncw I am quite busy recently. I will update this week.

Comment thread backend/union/upstream/upstream.go Resolved
@Max-Sum
Max-Sum force-pushed the multiwrite_union branch 4 times, most recently from 5d70731 to 058020f Compare January 25, 2020 16:58
@Max-Sum

Max-Sum commented Jan 25, 2020

Copy link
Copy Markdown
Contributor Author

As for the testing, I am not quite sure. Maybe we can have a pseudo entry list?

@ncw

ncw commented Feb 25, 2020

Copy link
Copy Markdown
Member

@thestigma

Copy link
Copy Markdown
Contributor

I've pushed up a new beta here

https://beta.rclone.org/branch/v1.50.2-102-g769dc85d-pr-3782-union-beta/ (uploaded in 15-30 mins)

I think something went wrong in the Windows build again.
Would you mind re-running or pushing a fresh beta?

@ncw

ncw commented Mar 9, 2020

Copy link
Copy Markdown
Member

@thestigma

Copy link
Copy Markdown
Contributor

I stuck up a rebased version here

https://beta.rclone.org/branch/v1.51.0-112-g7da83346-pr-3782-union-beta/ (uploaded in 15-30 mins)

Thanks!
Out of curiosity - what causes the Windows builds in particular to fail so (relatively) often?

@ncw

ncw commented Mar 10, 2020

Copy link
Copy Markdown
Member

It looks like the union tests are timing out on Windows...

When testing locally use the -list-retries 1 flag otherwise rclone will do endless retries (which is causing the test breakage).

The first test to fail is this - what it looks like is that the encoding for the \ has gone wrong somehow.

I wouldn't have though the union backend would need to worry about encoding, it should assume everything in and out is in standard encoding.

What do you think @Max-Sum ?

=== RUN   TestStandard/FsMkdir/FsEncoding/punctuation
    TestStandard/FsMkdir/FsEncoding/punctuation: fstests.go:594: testing "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
    TestStandard/FsMkdir/FsEncoding/punctuation: fstest.go:289: Sleeping for 1s for list eventual consistency: 1/1
    TestStandard/FsMkdir/FsEncoding/punctuation: fstest.go:318: 
        	Error Trace:	fstest.go:318
        	            				fstest.go:329
        	            				fstests.go:601
        	Error:      	Not equal: 
        	            	expected: []string{"!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"}
        	            	actual  : []string{"!\"#$%&'()*+,-./:;<=>?@[", "!\"#$%&'()*+,-./:;<=>?@[/]^_`{|}~", "!\"#$%&'()*+,-./:;<=>?@[/]^_`{|}~/!\"#$%&'()*+,-./:;<=>?@[", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"}
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1,2 +1,5 @@
        	            	-([]string) (len=1) {
        	            	+([]string) (len=4) {
        	            	+ (string) (len=25) "!\"#$%&'()*+,-./:;<=>?@[",
        	            	+ (string) (len=34) "!\"#$%&'()*+,-./:;<=>?@[/]^_`{|}~",
        	            	+ (string) (len=60) "!\"#$%&'()*+,-./:;<=>?@[/]^_`{|}~/!\"#$%&'()*+,-./:;<=>?@[",
        	            	  (string) (len=34) "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
        	Test:       	TestStandard/FsMkdir/FsEncoding/punctuation
        	Messages:   	directories
    TestStandard/FsMkdir/FsEncoding/punctuation: fstest.go:289: Sleeping for 1s for list eventual consistency: 1/1
    TestStandard/FsMkdir/FsEncoding/punctuation: fstest.go:318: 
        	Error Trace:	fstest.go:318
        	            				fstest.go:329
        	            				fstests.go:604
        	Error:      	Not equal: 
        	            	expected: []string{}
        	            	actual  : []string{"!\"#$%&'()*+,-./:;<=>?@[", "!\"#$%&'()*+,-./:;<=>?@[/]^_`{|}~", "!\"#$%&'()*+,-./:;<=>?@[/]^_`{|}~/!\"#$%&'()*+,-./:;<=>?@["}
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1,2 +1,5 @@
        	            	-([]string) {
        	            	+([]string) (len=3) {
        	            	+ (string) (len=25) "!\"#$%&'()*+,-./:;<=>?@[",
        	            	+ (string) (len=34) "!\"#$%&'()*+,-./:;<=>?@[/]^_`{|}~",
        	            	+ (string) (len=60) "!\"#$%&'()*+,-./:;<=>?@[/]^_`{|}~/!\"#$%&'()*+,-./:;<=>?@["
        	            	 }
        	Test:       	TestStandard/FsMkdir/FsEncoding/punctuation
        	Messages:   	directories

@Max-Sum

Max-Sum commented Mar 10, 2020 •

Copy link
Copy Markdown
Contributor Author

I did encounter this problem when I run on Windows. I just changed the encoding to include \ and it passed. It doesn't seem like something wrong with union backend.

@ncw

ncw commented Mar 10, 2020

Copy link
Copy Markdown
Member

I did encounter this problem when I run on Windows. I just changed the encoding to include \ and it passed. It doesn't seem like something wrong with union backend.

The windows local backend already encodes \

encoder.EncodeBackSlash |

Where did you add the encoding?

@Max-Sum

Max-Sum commented Mar 10, 2020

Copy link
Copy Markdown
Contributor Author

Where did you add the encoding?

I added EncodeBackSlash to lib/encoder/standard.go:12.

@ncw

ncw commented Mar 10, 2020

Copy link
Copy Markdown
Member

All paths in rclone should be in "Standard" format so they should be encoded in Standard encoding using unix /. Only when it gets to the backend does / get changed to \ on windows.

So I think any uses of filepath in the union backend are suspect and should be removed. Also any uses of ToSlash.

I pushed 98ad80b to the pr-3782-union branch which fixes the problem for me - let's see if it works on the CI.

This should also make a beta for @thestigma and other testers

https://beta.rclone.org/branch/v1.51.0-113-g98ad80be-pr-3782-union-beta/ (uploaded in 15-30 mins)

@Max-Sum

Max-Sum commented Mar 12, 2020

Copy link
Copy Markdown
Contributor Author

@ncw It still fails with the latest patch. I cannot figure out why...

@thestigma

Copy link
Copy Markdown
Contributor

@ncw Is this timeout problem on windows something that will probably happen a lot in normal use, or something pretty spesific the test is triggering in this case?

Would be nice to have an indication for now, so I have some idea of how likely any issues I find are to be related to this spesific bug.

@ncw

ncw commented Mar 20, 2020

Copy link
Copy Markdown
Member

Sorry for the delay!

I think the build failures aren't related to your code.

I think, now that this has had a bit of testing, we should merge it into master and evolve it there.

So @Max-Sum can you squash into one commit with a nice commit log, rebase on master and force push. Hopefully the tests will go green and I'll merge!

Can I put you down as maintainer for the union backend?

Thank you

@Max-Sum

Max-Sum commented Mar 20, 2020 •

Copy link
Copy Markdown
Contributor Author

Thank you all for your help. I'm glad to be a maintainer of this.

@thestigma

Copy link
Copy Markdown
Contributor

You are a real hero Max!
Thank so much for all your work on this. This capability adds incredible flexibility to advanced users :)

@ncw
ncw merged commit 78a9e74 into rclone:master Mar 21, 2020
@ncw

ncw commented Mar 21, 2020

Copy link
Copy Markdown
Member

I've merged this now :-) Thank you very much!

Check the integration tests tomorrow morning: https://pub.rclone.org/integration-tests/current/ for stuff which might need fixing!

I've added you to the MAINTAINERS file for the union backend. Do you want to be a member of the rclone dev team? If so I'll send you an invite. There is a lot of new issues and things which makes it quite busy!

@Visorask

Visorask commented May 7, 2020

Copy link
Copy Markdown

Is the vfs/refresh with --fast-list something that could be fixed to go with this? Thanks a bunch for all this by the way! You guys are great.

#3000

@ncw

ncw commented May 9, 2020

Copy link
Copy Markdown
Member

Is the vfs/refresh with --fast-list something that could be fixed to go with this? Thanks a bunch for all this by the way! You guys are great.

#3000

Good idea, I made a note on the issue for the union maintainer :-)

@Visorask

Visorask commented May 9, 2020

Copy link
Copy Markdown

Thanks a bunch!!

@Max-Sum

Max-Sum commented May 9, 2020

Copy link
Copy Markdown
Contributor Author

I've merged this now :-) Thank you very much!

Check the integration tests tomorrow morning: https://pub.rclone.org/integration-tests/current/ for stuff which might need fixing!

I've added you to the MAINTAINERS file for the union backend. Do you want to be a member of the rclone dev team? If so I'll send you an invite. There is a lot of new issues and things which makes it quite busy!

I am fixing the integration tests but failed to reproduce the error in vfs and TestIntegration/FsMkdir/FsPutFiles/ObjectAbout. Could you provide the rclone.conf of the official test?

@Max-Sum
Max-Sum deleted the multiwrite_union branch May 9, 2020 19:58
@ncw

ncw commented May 10, 2020

Copy link
Copy Markdown
Member

I am fixing the integration tests

Super :-)

but failed to reproduce the error in vfs and TestIntegration/FsMkdir/FsPutFiles/ObjectAbout. Could you provide the rclone.conf of the official test?

This is what the integration test server uses, so quite simple

$ rclone config show TestUnion
--------------------
[TestUnion]
type = union
remotes = /tmp/union1 /tmp/union2 /tmp/union3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants