Re: Use pg_pwritev_with_retry() instead of write() in dir_open_for_write() to avoid partial writes?

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Use pg_pwritev_with_retry() instead of write() in dir_open_for_write() to avoid partial writes?
Date: 2022-09-23 20:24:39
Message-ID: 20220923202439.GA1156054@nathanxps13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

+ PGAlignedXLogBlock zbuffer;
+
+ memset(zbuffer.data, 0, XLOG_BLCKSZ);

This seems excessive for only writing a single byte.

+#ifdef WIN32
+ /*
+ * XXX: It looks like on Windows, we need an explicit lseek() call here
+ * despite using pwrite() implementation from win32pwrite.c. Otherwise
+ * an error occurs.
+ */

I think this comment is too vague. Can we describe the error in more
detail? Or better yet, can we fix it as a prerequisite to this patch set?

--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2022-09-23 20:31:03 Re: libpq error message refactoring
Previous Message Melih Mutlu 2022-09-23 20:14:09 Re: Summary function for pg_buffercache