Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jePrQ-0000Jz-0W for pgsql-hackers@arkaria.postgresql.org; Thu, 28 May 2020 21:14:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jePrN-0007HZ-Dz for pgsql-hackers@arkaria.postgresql.org; Thu, 28 May 2020 21:14:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jePrN-0007HS-1L for pgsql-hackers@lists.postgresql.org; Thu, 28 May 2020 21:14:41 +0000 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jePrC-0005xc-Be for pgsql-hackers@postgresql.org; Thu, 28 May 2020 21:14:37 +0000 Received: by mail-qk1-x742.google.com with SMTP id f18so382052qkh.1 for ; Thu, 28 May 2020 14:14:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=YAb4aNsxNBlvU2h5jg4gfReNKuhLcziOXhpdW44yEWU=; b=sVyPcyitlKiqbSyS+QXqVP0wYIwfJQXcUqP75o+ps6yaPBF9p2AN6H9jrU4o27rc1W /INqLj6qhgCWeogmfGrjc7FaEcOZYknlOoDpflNVHKEO7058KmhLSlycQsI6/QfgjDAC Cs49ORwCDB7FjThfO3L9sjGfUjOmHNlcO2iudg6vU3MaUxWM3eRQgwS3bCN5JeF0Q62F cqiMInnUmS1/mBUPns7lRzrgNzQGIijyjg8HbjA+jlL3hTyA6mViTCQ2gUozcJXnajgo uB0YxLKYt54o9UGSzMX+ddVLGA6WpTy2PSB1gt6g5GKzLlbbwAeSHdVf00t1IO8V6uQ5 w91A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=YAb4aNsxNBlvU2h5jg4gfReNKuhLcziOXhpdW44yEWU=; b=rGKd6NaBsXIDtm/RZwT71PN95XVLOigabrg5saC58Wn/uuWzOUpvhqsgFYPbCsBwNo As1K7q+varbj25gZo2h7gcWjeuSBReRF44iLTMJRBKWaqEaJ65GvmNEPLdA3U3YBhRfl ywalC1g38RUIE0r2hLhlH1RN7Cj0mN//Hz33iSuG7Ctxb+FNwhYSqA8ZVDXjsES/tQk1 uMMHjl8eNIl2Khyme5/0e3N3hw8rsODzTGgr0Ki5LMV9nT7Oq3uufUBdZ5Beh5XYGX7G Y4vEKx3s2E6t4YGdYEbkaueSIORBM/ZMuVWZqSWSuSENi47J2+Wj5LDBpSA2MyxauNtw fw3Q== X-Gm-Message-State: AOAM533KE/9t+2YC0nesomtedEQMGXlaFh23WkhEnPsxzbDJQH8Oxuya +DAsH9O/oEcZAXtnzqqtsCB1hQ== X-Google-Smtp-Source: ABdhPJzqhS+HSTpJ4RXmpTfVivg/YEAkOSC1F3CH0ZY97M14LnxpcKpGJcoZCb59fUbT/klaXsQ+mA== X-Received: by 2002:a37:5d83:: with SMTP id r125mr4672886qkb.50.1590700468256; Thu, 28 May 2020 14:14:28 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([190.95.18.252]) by smtp.gmail.com with ESMTPSA id s15sm6592842qtc.95.2020.05.28.14.14.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 May 2020 14:14:27 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 3B1543007ED; Thu, 28 May 2020 17:14:25 -0400 (-04) Date: Thu, 28 May 2020 17:14:25 -0400 From: Alvaro Herrera To: Thomas Munro Cc: Dmitry Dolgov <9erthalion6@gmail.com>, David Steele , Andres Freund , Tomas Vondra , pgsql-hackers Subject: Re: WIP: WAL prefetch (another approach) Message-ID: <20200528211425.GA5942@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Thomas Munro escribió: > @@ -1094,8 +1103,16 @@ WALRead(XLogReaderState *state, > XLByteToSeg(recptr, nextSegNo, state->segcxt.ws_segsize); > state->routine.segment_open(state, nextSegNo, &tli); > > - /* This shouldn't happen -- indicates a bug in segment_open */ > - Assert(state->seg.ws_file >= 0); > + /* callback reported that there was no such file */ > + if (state->seg.ws_file < 0) > + { > + errinfo->wre_errno = errno; > + errinfo->wre_req = 0; > + errinfo->wre_read = 0; > + errinfo->wre_off = startoff; > + errinfo->wre_seg = state->seg; > + return false; > + } Ah, this is what Michael was saying ... we need to fix WALRead so that it doesn't depend on segment_open alway returning a good FD. This needs a fix everywhere, not just here, and improve the error report interface. Maybe it does make sense to get it fixed in pg13 and avoid a break later. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services