Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hdGn1-0002iw-UF for pgsql-hackers@arkaria.postgresql.org; Tue, 18 Jun 2019 16:16:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hdGn0-0005L8-9v for pgsql-hackers@arkaria.postgresql.org; Tue, 18 Jun 2019 16:16:54 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hdGjp-0005T2-1X for pgsql-hackers@lists.postgresql.org; Tue, 18 Jun 2019 16:13:37 +0000 Received: from smtp-fw-9101.amazon.com ([207.171.184.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hdGjm-0005FK-I5 for pgsql-hackers@postgresql.org; Tue, 18 Jun 2019 16:13:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1560874414; x=1592410414; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=mZF4z+bquz2qXUyGtvah21vTOODI5ZzrfA4zIffI0A8=; b=u7J9bg9zll/r2nXXN4KvygzpuRTmPGKBoklWpouANGTrksH8266jllZx hFCqAKm1wmnDWQ/zBH0WvtwvqctnW/M+4lu6LoUSNpmxaHUqpVQtu6f1V AXm4vy6vUW9YpP9TjYgHNRY4nNfBYC2mBwNpbvxBmQJPUNXjUgotF9dN1 0=; X-IronPort-AV: E=Sophos;i="5.62,389,1554768000"; d="scan'208";a="811120281" Received: from sea3-co-svc-lb6-vlan2.sea.amazon.com (HELO email-inbound-relay-2c-168cbb73.us-west-2.amazon.com) ([10.47.22.34]) by smtp-border-fw-out-9101.sea19.amazon.com with ESMTP; 18 Jun 2019 16:13:23 +0000 Received: from EX13MTAUWC001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-2c-168cbb73.us-west-2.amazon.com (Postfix) with ESMTPS id E1E60A283B; Tue, 18 Jun 2019 16:13:22 +0000 (UTC) Received: from EX13D05UWC002.ant.amazon.com (10.43.162.92) by EX13MTAUWC001.ant.amazon.com (10.43.162.135) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 18 Jun 2019 16:13:21 +0000 Received: from f01898859afd.ant.amazon.com (10.43.162.225) by EX13D05UWC002.ant.amazon.com (10.43.162.92) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 18 Jun 2019 16:13:20 +0000 Date: Tue, 18 Jun 2019 09:13:19 -0700 From: Shawn Debnath To: Peter Eisentraut CC: pgsql-hackers Subject: Re: fix "Success" error messages Message-ID: <20190618161319.GA5285@f01898859afd.ant.amazon.com> References: <5de61b6b-8be9-7771-0048-860328efe027@2ndquadrant.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <5de61b6b-8be9-7771-0048-860328efe027@2ndquadrant.com> User-Agent: Mutt/1.12.0 (2019-05-25) X-Originating-IP: [10.43.162.225] X-ClientProxiedBy: EX13D08UWC001.ant.amazon.com (10.43.162.110) To EX13D05UWC002.ant.amazon.com (10.43.162.92) Precedence: Bulk List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, Jun 18, 2019 at 02:35:02PM +0200, Peter Eisentraut wrote: > --- a/src/backend/access/transam/slru.c > +++ b/src/backend/access/transam/slru.c > @@ -923,15 +923,19 @@ SlruReportIOError(SlruCtl ctl, int pageno, TransactionId xid) > ereport(ERROR, > (errcode_for_file_access(), > errmsg("could not access status of transaction %u", xid), > - errdetail("Could not read from file \"%s\" at offset %u: %m.", > - path, offset))); > + errno == 0 > + ? errdetail("Short read from file \"%s\" at offset %u.", path, offset) > + : errdetail("Could not read from file \"%s\" at offset %u: %m.", > + path, offset))); Perhaps using "Encountered partial read from file ..." would be better suited for the error message. > break; > case SLRU_WRITE_FAILED: > ereport(ERROR, > (errcode_for_file_access(), > errmsg("could not access status of transaction %u", xid), > - errdetail("Could not write to file \"%s\" at offset %u: %m.", > - path, offset))); > + errno == 0 > + ? errdetail("Short write to file \"%s\" at offset %u.", path, offset) > + : errdetail("Could not write to file \"%s\" at offset %u: %m.", > + path, offset))); Similarly, "Encountered partial write to file ..." would be better? Not a 100% on using "Encountered" but "partial" seems to be the right word to use here. Do note that SlruPhysicalWritePage() will always set errno to ENOSPC if errno was 0 during a write attempt, see [0]. Not sure this is a good assumption to make since write(2) should return ENOSPC if the storage medium is out of space [1]. [0] https://github.com/postgres/postgres/blob/master/src/backend/access/transam/slru.c#L854 [1] https://linux.die.net/man/2/write -- Shawn Debnath Amazon Web Services (AWS)