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

FileSystemUtils: Only create backup copies if files differ #9592

Merged

Conversation

spinscale
Copy link
Contributor

The FileSystemUtils class has a helper method to create files with
a .new suffix, in case the file, which should be created already
exists. If you install plugins and those have configuration files,
even without changes, you will end up with tons of .new files.

This commit checks the file size and sha-256 sum, and only if those
differ, a .new file is actually being created.

@spinscale spinscale added review :Core/Infra/Plugins Plugin API and infrastructure labels Feb 6, 2015
@dadoonet
Copy link
Member

dadoonet commented Feb 6, 2015

LGTM.

@dadoonet dadoonet removed the review label Feb 6, 2015
@@ -205,14 +208,42 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
// We just move the new file to new dir
Files.move(file, path);
Copy link
Member

Choose a reason for hiding this comment

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

To be coherent with the preVisitDirectory() method I think we should use the FileSystemUtils.move() method instead of Files.move() that doesn't support moving non-empty directories between different filesystems.

@tlrx
Copy link
Member

tlrx commented Feb 9, 2015

LGTM, left one comment.

@spinscale spinscale force-pushed the 1502-filesystemutils-check-md5sum branch from fe8f1f6 to 879a692 Compare February 11, 2015 10:52
@spinscale
Copy link
Contributor Author

@tlrx updated the PR

@tlrx
Copy link
Member

tlrx commented Feb 11, 2015

@spinscale I just tested it, LGTM

@spinscale spinscale force-pushed the 1502-filesystemutils-check-md5sum branch 2 times, most recently from f8ecc56 to 332e1ed Compare February 11, 2015 12:48
The FileSystemUtils class has a helper method to create files with
a .new suffix, in case the file, which should be created already
exists. If you install plugins and those have configuration files,
even without changes, you will end up with tons of .new files.

This commit checks the file size and sha-256 sum, and only if those
differ, a .new file is actually being created.
@spinscale spinscale force-pushed the 1502-filesystemutils-check-md5sum branch from 332e1ed to 30a9d97 Compare February 12, 2015 09:08
@spinscale spinscale merged commit 30a9d97 into elastic:master Feb 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants