mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 18:17:16 +01:00
* filer: delete the chunks a failed copy wrote A copy through the filer (POST dst?cp.from=src) writes the destination's chunks first and its entry last. When it ended before the entry was written (the client gave up, a chunk failed to copy, the entry write failed), the chunks already on the volume servers stayed there, with no entry to reference them and nothing to delete them. The fan-out now waits for the copies it started, starts no further one after a failure or once the request has ended, and deletes what the completed ones wrote. A chunk copy that fails deletes the file id it was assigned, as a failed write can still have stored the needle. A failed entry write deletes only the chunks the destination does not hold, since CreateEntry can fail after storing the entry. #13217 did the same for the S3 copy paths. * filer: keep the copied chunks when the entry write fails CreateEntry can fail after it stored the entry: the entry stays when only its parent folders could not be created. Reading the destination afterwards does not settle whether the chunks are live, since an entry that was stored may have been renamed by then, and deleting on a miss would take its data. So a failed entry write keeps the chunks, as it did before. Only the failures that come before the entry write delete what the copy wrote. * filer: fail a copy whose request ended after its last chunk A request cancelled once every chunk copy had returned still handed the chunks on, to an entry write that the cancelled context then fails, and that write keeps them. The end of the request now fails the fan-out whether or not a copy was left to start, so the chunks are deleted there. --------- Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com>