On Sat, Aug 24, 2013 at 3:48 AM, William A. Rowe Jr. <wr...@rowe-clan.net> wrote: > On Fri, 23 Aug 2013 18:39:35 -0500 > "William A. Rowe Jr." <wr...@rowe-clan.net> wrote: > >> On Sat, 24 Aug 2013 00:33:38 +0400 >> Ivan Zhakov <i...@visualsvn.com> wrote: >> >> > Actually Windows supports atomic seek-to-end+write: file should be >> > opened with FILE_APPEND_DATA access right only [1] or Offset and >> > OffsetHigh should be 0xFFFFFFFF if overlapped I/O is used [2]. >> > >> > I'm reopening this thread because in Subversion we found case where >> > we need true atomic append across processes/threads. So I'm willing >> > to create a patch implementing atomic append on Windows. Is right >> > idea for APR or not? Any concerns will be very helpful. >> > >> > [1] >> > http://msdn.microsoft.com/en-us/library/windows/desktop/aa363778%28v=vs.85%29.aspx >> > [2] >> > http://msdn.microsoft.com/en-us/library/windows/desktop/aa365747%28v=vs.85%29.aspx >> >> IIRC the difference is that you have writev on unix to atomically >> write multiple buffers. On Windows we fake writev, so your proposed >> atomic writes are no longer atomic. > Subversion doesn't use writev for file I/O, so implementing atomic writes is enough for our case.
> Now we might use WriteFileGather at this point (remember, this stuff > was all written when Server 2000 was still around :)... but note that > the compatibility is listed as "Windows Server 2003 [Desktop apps only]. > WTF would that mean? Also not supported for 32 bit Itanium apps running > under WOW64. How bizarre. Then read the description of the > aSegmentArray arg to really break your brain. > WriteFileGather does not help anyway: provided buffers must be at least the size of a system memory page and must be aligned on a system memory page size boundary. -- Ivan Zhakov