#21602: FileSystemStorage._save() Should Save to a Temporary Filename and
Rename to
Attempt to be Atomic
-------------------------------------+-------------------------------------
Reporter: Kevin Stone | Owner: Jyry
Type: | Suvilehto
Cleanup/optimization | Status: assigned
Component: File | Version: dev
uploads/storage |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Jyry Suvilehto):
Now the system uses atomic `os.rename()` where possible. This lead to
another issue: if two uploads to the same file name `os.rename()` calls
are made almost simultaneously with the same target file name, only the
latter file will exist at the end. The current implementation does not
behave like this. Will it be surprising to the users if in rare cases two
uploads can result in only one file?
We could avoid this by copying the files ourselves and locking, but that
just moves a hacky locking operation from the upload to the copy. Copy
will be a faster operation since it's on the same machine, but still a bit
clunky IMO.
--
Ticket URL: <https://code.djangoproject.com/ticket/21602#comment:8>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019e3d55f268-31abae72-e518-4e95-a8d8-8a49b78c5f54-000000%40eu-central-1.amazonses.com.