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

fixing the localfs reader writer truncate bug #52 #53

Merged
merged 6 commits into from
May 12, 2018

Conversation

epsniff
Copy link
Contributor

@epsniff epsniff commented May 11, 2018

fixes #52

The localfs store wasn't correctly truncating the file when a new writer was created.

@epsniff
Copy link
Contributor Author

epsniff commented May 11, 2018

My new testcases exposed a bug in SFTP so I'll fix that one tomorrow, in this pr.

@codecov-io
Copy link

codecov-io commented May 12, 2018

Codecov Report

Merging #53 into master will decrease coverage by 0.12%.
The diff coverage is 37.5%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #53      +/-   ##
==========================================
- Coverage   65.02%   64.89%   -0.13%     
==========================================
  Files          13       13              
  Lines        1990     1997       +7     
==========================================
+ Hits         1294     1296       +2     
- Misses        488      491       +3     
- Partials      208      210       +2
Impacted Files Coverage Δ
sftp/store.go 61.66% <25%> (-0.35%) ⬇️
localfs/store.go 69.37% <50%> (-0.41%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bab6fd6...c93d7f1. Read the comment docs.

Copy link
Contributor

@araddon araddon left a comment

Choose a reason for hiding this comment

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

looks good, thank you!

@araddon araddon changed the title [WIP] fixing the localfs reader writer truncate bug fixing the localfs reader writer truncate bug #52 May 12, 2018
@araddon araddon merged commit 2244260 into master May 12, 2018
@araddon araddon deleted the 52_localstore_writer_truc branch May 12, 2018 19:07
@mh-cbon
Copy link
Contributor

mh-cbon commented May 29, 2018

Hi guys,

i wonder why we d try to delete a file that does not exist.

	if !m.Exists(name) {
+		if err := m.Delete(ctx, name); err != nil {
+			gou.Errorf("failed to delete existing file %v %v", name, err)
+			return nil, err
+		}
+	}

Besides, i think this line https://github.com/lytics/cloudstorage/blob/master/sftp/store.go#L251
should look for an error such as : &errors.errorString{s:"file does not exist"}

@araddon araddon mentioned this pull request May 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

localfs NewWriter, should use O_TRUNC ?
4 participants