On Tue, Apr 19, 2022 at 10:42 AM Michael Paquier <mich...@paquier.xyz> wrote: > > > I would like to know if there's any problem with the proposed fix. > > There is nothing done for the case of compressed segments, meaning > that you would see the same problem when being in the middle of > writing a segment compressed with gzip or lz4 in the middle of writing > it, and that's what you want to avoid here. So the important part is > not the pre-padding, it is to make sure that there is enough space > reserved for the handling of a full segment before beginning the work > on it.
Right. We find enough disk space and go to write and suddenly the write operations fail for some reason or the VM crashes because of a reason other than disk space. I think the foolproof solution is to figure out the available disk space before prepadding or compressing and also use the write-first-to-temp-file-and-then-rename-it-to-original-file as proposed in the earlier patches in this thread. Having said that, is there a portable way that we can find out the disk space available? I read your response upthread that statvfs isn't portable to WIN32 platforms. So, we just say that part of the fix we proposed here (checking disk space before prepadding or compressing) isn't supported on WIN32 and we just do the temp file thing for WIN32 alone? Regards, Bharath Rupireddy.