Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aQiFx-0007fd-Jo for pgsql-bugs@arkaria.postgresql.org; Tue, 02 Feb 2016 21:13:01 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aQiFw-0000Sv-Ha for pgsql-bugs@arkaria.postgresql.org; Tue, 02 Feb 2016 21:13:00 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aQiFw-0000Sj-0S for pgsql-bugs@postgresql.org; Tue, 02 Feb 2016 21:13:00 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aQiFt-0000je-6z for pgsql-bugs@postgresql.org; Tue, 02 Feb 2016 21:12:58 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u12LCsl2019039; Tue, 2 Feb 2016 16:12:54 -0500 From: Tom Lane To: Alvaro Herrera cc: Michael Paquier , kunschikov@gmail.com, PostgreSQL mailing lists Subject: Re: BUG #13888: pg_dump write error In-reply-to: <20160127113326.GA639380@alvherre.pgsql> References: <20160127113326.GA639380@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Wed, 27 Jan 2016 12:33:26 +0100" Date: Tue, 02 Feb 2016 16:12:54 -0500 Message-ID: <19038.1454447574@sss.pgh.pa.us> X-Pg-Spam-Score: -2.3 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Alvaro Herrera writes: > Tom Lane wrote: >> I do not understand these claims that there isn't an error check there. >> There surely is. But fwrite() didn't set errno. > Yeah, that's what I was remembering actually: > http://www.postgresql.org/message-id/20150608174336.GM133018@postgresql.org >> The real question is why did he get a short write in the first place. >> We don't make any attempt to support filesystems that require retries, >> which seems to be what is going on here. Should we? > Sounds likely. Actually, now that I think about it while not in an airport, what I think we really need is logic along the lines of errno = 0; nbytes = fwrite(...); if (nbytes != expected && errno == 0) errno = ENOSPC; ie, assume a short write implies out-of-disk-space. I believe that is what we do in most (hopefully all) cases in the backend; see for example UpdateControlFile() in xlog.c. IMO it is not really WRITE_ERROR_EXIT's place to assume that errno == 0 should be replaced by ENOSPC; in particular, that would be incorrect, or at least insufficient, unless there's an explicit initialization of "errno = 0;" before the fwrite call. So I'm inclined to put the responsibility to do all of the above logic on the fwrite call sites, rather than splitting it between callers and WRITE_ERROR_EXIT. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs