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

make file cache updates more robust #10397

Merged
merged 1 commit into from
Aug 8, 2018
Merged

make file cache updates more robust #10397

merged 1 commit into from
Aug 8, 2018

Conversation

schiessle
Copy link
Member

@schiessle schiessle commented Jul 25, 2018

Only update the encrypted version after the write operation is finished and the stream is closed

With Amazon S3 as primary storage it happened that we tried to update the "encryption version" before the file was added to the file cache which lead to a wrong version number. By updating the version only after the stream was closed I could solve the issue.

@icewind1991 please have a look if this makes sense. Thanks!

fix #8299

Copy link
Member

@rullzer rullzer left a comment

Choose a reason for hiding this comment

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

Makes sense. but I'd love for @icewind1991 to have a look

@rullzer
Copy link
Member

rullzer commented Jul 31, 2018

@schiessle can you rebase so CI can run?

only update the encrypted version after the write operation is finished and the stream is closed

Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
@schiessle
Copy link
Member Author

@rullzer done

@icewind1991
Copy link
Member

I would prefer if it used a CallbackWrapper instead and update the cache from the close callback, that way seems a bit cleaner to me and less mixing on concerns.

(you can use the write callback to set the $fileUpdated flag)

@schiessle
Copy link
Member Author

schiessle commented Aug 7, 2018

@icewind1991 I agree with you in general. But as I want to backport it to 13 as well I would like to keep the fix as small as possible.

Suggestion: Let's merge this for 14 and backport it for 13 and I will do a follow up PR for master (15) to add a CallbackWrapper.

'encryptedVersion' => 2,
]);
$cache->expects($this->any())->method('get')->willReturn($entry );
$cache->expects($this->any())->method('update')->with(5, ['encrypted' => 3, 'encryptedVersion' => 3]);
Copy link
Member

Choose a reason for hiding this comment

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

change this to $this->once() please

Copy link
Member Author

@schiessle schiessle Aug 8, 2018

Choose a reason for hiding this comment

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

It is not possible. The stream, created in the method is used in various places. Sometimes the method is never called and some tests uses the instance multiple times so it is used more then once. All I want to make sure is that every time it is called, it should be called with the right parameters.

@icewind1991
Copy link
Member

Suggestion: Let's merge this for 14 and backport it for 13 and I will do a follow up PR for master (15) to add a CallbackWrapper.

Sounds good to me

@schiessle
Copy link
Member Author

Let's get this in for the beta3 so that it gets some test coverage...

@schiessle schiessle merged commit 11e9985 into master Aug 8, 2018
@schiessle schiessle deleted the encryption-s3-fix branch August 8, 2018 16:27
@MorrisJobke
Copy link
Member

@schiessle Could you prepare the backport?

@MorrisJobke MorrisJobke mentioned this pull request Aug 22, 2018
8 tasks
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.

Decryption failed with s3
4 participants