-
-
Notifications
You must be signed in to change notification settings - Fork 11k
BUG: Fix ndarray.tofile large file corruption in append mode #8335
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
Conversation
Works 8000 for me. @juliantaylor Comment? |
@@ -46,7 +46,7 @@ npy_fallocate(npy_intp nbytes, FILE * fp) | |||
} | |||
/* btrfs can take a while to allocate making release worthwhile */ | |||
NPY_BEGIN_ALLOW_THREADS; | |||
r = fallocate(fileno(fp), 0, npy_ftell(fp), nbytes); | |||
r = fallocate(fileno(fp), 1, npy_ftell(fp), nbytes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should have a comment that this is FALLOC_FL_KEEP_SIZE needed for the case of files opened in append mode
might be a good idea to flush the file descriptor too, in case there might be some unexpected interactions between the call and unwritten data in the descriptor. |
a test writing two arrays to an append mode file would also be good, similar to the above test but without the seek. |
@juliantaylor I added a |
yes, thank you. Can you still squash the two commits please. |
…append file mode Fixes by using the flag `FALLOC_FL_KEEP_SIZE` (=1) in the `fappend` call. Fixes #8329
Sure, done. |
thanks |
Fixes by using the flag
FALLOC_FL_KEEP_SIZE
(=1) in thefappend
call.Fixes #8329