Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gCCY9-0007xP-TC for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Oct 2018 23:45:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gCCY8-0005au-4H for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Oct 2018 23:45:24 +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_SHA384:256) (Exim 4.89) (envelope-from ) id 1gCCY7-0005an-5H for pgsql-hackers@lists.postgresql.org; Mon, 15 Oct 2018 23:45:23 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gCCXr-0007io-MF for pgsql-hackers@postgresql.org; Mon, 15 Oct 2018 23:45:22 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 5314B21EC1; Mon, 15 Oct 2018 19:45:06 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 15 Oct 2018 19:45:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=6OQjQEMm/MDIjsgnwUDruyrF53B lZbz9cdmxucnrAM4=; b=uhyIfChZDxQoDdmnkGGfYjIcc8jehLQr2XwnHBtTZSV jxZKpsOEirzK9EMEAsqQWnB6F5TXeCIndPonyFBQA0P315Lblx3NcWDRsihUsiIZ slvKffR6ydznXIsDfHqa/yt2RTPv7QNZ453OAGcWdIr1xn3bcX2WSsCAlJqkKhdJ r4zVyB3tJjlW7YMpRfsT33+qJU6u3Zp/ffGKf+MOWKsC7axylKqP5Q1TsCRboeJc iFnPGiTex7F+HcCiagB8Nq69wg7+NXrZ1dtQWgaE3sGh4CxWmfsBwBGQVEcDiQKq z/Fs1tHZoB5LNQNPetaRMGNtxh/V6Afzz5PANKdiYQQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=6OQjQE Mm/MDIjsgnwUDruyrF53BlZbz9cdmxucnrAM4=; b=GOOdsJrKO8C9r+zpvf+WX/ KKhO2e2VbDpd+UogMOb+YQFjzrpIiTYPxmqy40Ooed4NdXIzj7YwKI/xYdMi4mtz YbUZ2TaaRwzxJODxqOef7bHtcV2VRg14nfP+h/x3XtTiyr1dXlkdRlCegClmNrdD jTItPKJLsrmisLXaPbJNr07wxhwVhZXeap6ofyaVrQTS3jpA2ZF7Fw3YX4qC9EjC KAloSSGUm8hHqQO4nkqILoXtCEdtAuVptwHap22Yp2x7FAUGU8ZeoFTrICFhx5iu HJ5oKCD6XwtLnAz+EYpirSvVfDKS4PMnZXDd73ct/j+b5QWIJJ+Wz5eWIPA9fQyQ == X-ME-Sender: X-ME-Proxy: Received: from intern.anarazel.de (c-98-210-140-171.hsd1.ca.comcast.net [98.210.140.171]) by mail.messagingengine.com (Postfix) with ESMTPA id 6C8BAE47E1; Mon, 15 Oct 2018 19:45:05 -0400 (EDT) Date: Mon, 15 Oct 2018 16:45:03 -0700 From: Andres Freund To: Tom Lane Cc: pgsql-hackers@postgresql.org Subject: Re: Large writable variables Message-ID: <20181015234503.rtgz2bokftnkrba5@alap3.anarazel.de> References: <20181015200754.7y7zfuzsoux2c4ya@alap3.anarazel.de> <18430.1539635786@sss.pgh.pa.us> <15484.1539646909@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <15484.1539646909@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, I've a patch making .data variables constant, fwiw. Will post in a bit. Just so we don't duplicate work too much. On 2018-10-15 19:41:49 -0400, Tom Lane wrote: > I wrote: > > Andres Freund writes: > >> 0000000008560224 0000000000023440 b tzdefrules_s > >> 0000000008536704 0000000000023440 b gmtmem.7009 > > > I think that tzdefrules_s is not used in common cases (though I could be > > wrong about that), so we could win by alloc-on-first-use. The same might > > be true for gmtmem, but there's a sticking point: there is no provision > > for failure there, so I'm unsure how we avoid crashing on OOM. > > So my intuition was exactly backwards on this. > > 1. tzdefrules_s is filled in the postmaster, and if it's not filled there > it'd be filled by every child process, so there's zero point in converting > it to malloc-on-the-fly style. This is because tzparse() always wants > it filled. That's actually a tad annoying, because it looks to me like > with many timezone settings the data will not get used, but I'm hesitant > to mess with the IANA code's logic enough to improve that. Maybe I'll try > submitting an upstream patch and see what they think of it first. Ok, that makes sense. > 2. gmtmem, on the other hand, is only used if somebody calls pg_gmtime, > which already has a perfectly good error-report convention, cf gmtime(3). > We have exactly one caller, which was not bothering to test for error :-( > and would dump core on failure. And that caller isn't reached in most > processes, at least not in the regression tests. So this side of it is > easy to improve. > > Hence I propose the attached patch for point 2, which I'd want to > backpatch to keep our copies of the IANA code in sync. That makes sense, too. Greetings, Andres Freund