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 1hNiFE-0000O4-Pe for pgsql-hackers@arkaria.postgresql.org; Mon, 06 May 2019 18:21:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hNiFD-0004sv-Ez for pgsql-hackers@arkaria.postgresql.org; Mon, 06 May 2019 18:21:43 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hNiFD-0004ql-1E for pgsql-hackers@lists.postgresql.org; Mon, 06 May 2019 18:21:43 +0000 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hNiF9-0004Rh-J2 for pgsql-hackers@postgresql.org; Mon, 06 May 2019 18:21:42 +0000 Received: by mail-qt1-x843.google.com with SMTP id c13so15903473qtn.8 for ; Mon, 06 May 2019 11:21:39 -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=YPH6iheqQYMI6FHhWi6nj1WboV1YX3BZY6RxmrNXKpo=; b=rfRc8IqBwkcrlljBkjgg/UW4++HleUeAnj/uC0LtQ+f+t4B6bfNw9tUzwhbPYIsWDy qqGcTdA7/nntM80vUo/1myutN+6hsPBYpePOQzqhW4JAm28j8sl0Lu8SyBNlk/UO+jll cnq3s5W+odwpRFk3U1E3v1E1g3Uw9qNtW8CPLHNWljzMP5ZoP5909GVVFbZnmIXvPdXY qa12+ZadXC9rUVJyck4ACwCvxcuQy17TPTjx17ibMh27/NTrlxI6Mm7TEwc8iEVyHmIM YDDZ2pzTJ/+2zFLsWx4u20mj3wwRYro7qcDr/lVnNDOp0DYtigDYkB8fLJL1DwoRaHyn fM6w== 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=YPH6iheqQYMI6FHhWi6nj1WboV1YX3BZY6RxmrNXKpo=; b=eAK65dQn8wkukDELYyNLoEcM30yYrnm7N0NZKMW0Xfic3fuyF1Ihqd6+Ixp1saW/op 0/oJScqB/rCfZqvbJlkZBrrthIzetth59z+wXTRQhVAKMQDdlIhKW6PgWTAmP943R51T 78XX50iHmTHgEu0AVsFHX39pYKme14OpcwMWw2HLLtHEQUpPSzPkRxNXtwwVYYhXd3ep bUFo5s4sPJdIxcOZWmlrmhIYjpbCHY7yx1ItpOUxisxU0d+VucOSrTVopaqify/ra8SO es94j43dncP7o6h1r4DEGNJ7tLpTvvpk9WXE81035LyWW/UkEdIW26xxGMUv1fPtJxcu y9GQ== X-Gm-Message-State: APjAAAUafR/pKEgB4QqjCmByxT2eYv6mvzPvrazZ6Ze0lDSTbGnsXxts MUz8frGed4mCs+LZ0l/Ju9/gjg== X-Google-Smtp-Source: APXvYqwWJY3/MhX/dFbFk8Hmn+YvAH3Y8jtAZyAejBOnxAmsDTp/fyjpNHpoLKZB7QiNtw8++QcJyQ== X-Received: by 2002:ac8:28d0:: with SMTP id j16mr23129082qtj.15.1557166897748; Mon, 06 May 2019 11:21:37 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([190.121.29.3]) by smtp.gmail.com with ESMTPSA id i62sm5741441qkd.66.2019.05.06.11.21.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 May 2019 11:21:37 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id D48311239A8; Mon, 6 May 2019 14:21:34 -0400 (-04) Date: Mon, 6 May 2019 14:21:34 -0400 From: Alvaro Herrera To: Robert Haas Cc: Antonin Houska , "pgsql-hackers@postgresql.org" Subject: Re: Attempt to consolidate reading of XLOG page Message-ID: <20190506182134.GA592@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.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-May-06, Robert Haas wrote: > On Thu, May 2, 2019 at 12:18 PM Antonin Houska wrote: > > The next version of the patch is attached. > > I don't think any of this looks acceptable: I agree. I inteded to suggest upthread to pass an additional argument to XLogRead, which is a function that takes a message string and SQLSTATE; in backend, the function does errstart / errstate / errmsg / errfinish, and in frontend programs it does pg_log_fatal (and ignores sqlstate). The message must be sprintf'ed and translated by XLogRead. (xlogreader.c could itself provide a default error reporting callback, at least for frontend, to avoid repeating the code). That way, if a different frontend program wants to do something different, it's fairly easy to pass a different function pointer. BTW, having frontend's XLogFileNameCommon use a totally unrelated variable for its printing is naughty. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services