mirror of
https://github.com/floci-io/floci.git
synced 2026-12-05 02:58:00 -05:00
Deleting the current version in a versioned bucket made the previous version current by reading its whole file into a byte array and writing it out again as the current file, under the bucket lock. A version over 2 GiB could not be read that way, and because the new current version's metadata was published before the file, the failure left the key pointing at the promoted version while its current file still held the deleted version's bytes. The current file is now a hard link to the promoted version's file, the way a versioned multipart upload already stores its current file, so a version of any size is promoted without being read; in memory both entries share the version's array, as they already did. The body is also put in place before the metadata is published, the order PutObject writes in, so a concurrent GET can no longer pair the promoted version with the deleted version's bytes.