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 1oCkkL-0004JI-7I for pgsql-hackers@arkaria.postgresql.org; Sat, 16 Jul 2022 16:34:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oCkkJ-0001wI-5r for pgsql-hackers@arkaria.postgresql.org; Sat, 16 Jul 2022 16:34:23 +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 1oCkkI-0001nw-SU for pgsql-hackers@lists.postgresql.org; Sat, 16 Jul 2022 16:34:22 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oCkkB-0005JH-4y for pgsql-hackers@postgresql.org; Sat, 16 Jul 2022 16:34:21 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 26GGYB2B3885876; Sat, 16 Jul 2022 12:34:11 -0400 From: Tom Lane To: Pavel Borisov cc: Maxim Orlov , Julien Rouhaud , Nathan Bossart , pgsql-hackers Subject: Re: remove reset_shared() In-reply-to: References: <20220329221702.GA559657@nathanxps13> <20220330011942.fpouca2laocok7ng@jrouhaud> Comments: In-reply-to Pavel Borisov message dated "Fri, 15 Jul 2022 16:48:54 +0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3885874.1657989251.1@sss.pgh.pa.us> Date: Sat, 16 Jul 2022 12:34:11 -0400 Message-ID: <3885875.1657989251@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Pavel Borisov writes: > I see the proposed patch as uncontroversial and good enough to be > committed. It will make the code a little clearer. Personally, I don't like > leaving functions that are just wrappers for another and called only once. Yeah, I like this for a different reason: just a couple days ago I was comparing the postmaster's startup sequence to that used in standalone mode (in postgres.c) and was momentarily confused because one had reset_shared() where the other had CreateSharedMemoryAndSemaphores(). Looking in our git history, it seems that reset_shared() used to embed slightly more knowledge, but it sure looks pretty pointless now. > But I think that if there's a question of code readability it's not bad to > restore the comments on the purpose of a call that were originally in the > code. Actually I think you chose the wrong place to move the comment to. It applies to the initial postmaster start, because what it's pointing out is that we'll probably choose the same IPC keys as any previous run did. If we felt the need to enforce that during a crash restart, we surely could do so directly. Pushed after fiddling with the comments. regards, tom lane