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 1lpvPg-0005XR-Pj for pgsql-general@arkaria.postgresql.org; Sun, 06 Jun 2021 16:14:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lpvPe-0008NG-Nx for pgsql-general@arkaria.postgresql.org; Sun, 06 Jun 2021 16:14:10 +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 1lpvPd-0008N8-3i for pgsql-general@lists.postgresql.org; Sun, 06 Jun 2021 16:14:10 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lpvPZ-0006yb-L4 for pgsql-general@lists.postgresql.org; Sun, 06 Jun 2021 16:14:08 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 8695F1458; Sun, 6 Jun 2021 12:14:01 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sun, 06 Jun 2021 12:14:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=F Xz5f3yzpvDdZsI4GZqE1C8+er8R3xBIre6ZKxcc5+A=; b=DfKHnDeSEOgScmJWb RNFD3lpTfY1hOy9V5RxkRm2r88m2+EX5s2x6W4dvbvP3jkFutLBQ9RqRVlR9IOyq 6PcErwG7dg51oNFmSbEvAY9+i/5oJ1MO9Y1l3xea1IpejVPN3WihnLT4OiWeU01h igYC6JWyKR02VyVy8CyYQSXezXz8OczWtCF8iWp7+Jkzd/dwPyCoFRiD1N+OBCRa XXLS8JGEBkK8XaYWwU+Cptt4KE2FGQDDx5xkG07rHVs1pd8Igz9hba7e9hF8y9YZ UupOCbnoxWgyfeWsCir55hq+SQqAJF+95T+q6fPHk2a3slBphZqJyWIOwVWaSj8Z HU2fQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding: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=fm3; bh=FXz5f3yzpvDdZsI4GZqE1C8+er8R3xBIre6ZKxcc5 +A=; b=DGf1IDAw91Cp4DQYkpUQWR/ef67VOePNvsYMJy7v8CdFAMvVezO3x5scx WWyz5FApc9qUqWYALgGXaDDyzrkXz6tYMCTWkAwx9G/xjDMYGGZO3GeEE8tSOW2d XYC0FXGTVzfYBJvnHhkX8LY2Chd73H5IjLUEqfAG2eIMFTDgLn8UJzYYHmCZD8so vkcCMdqVtgXqehf7PR8mda/7qUkvi4S0upDH4XhaGOIl3sjAt7m6HHP18yotL3nA GnUpz3zB33AOruJW9guw1tDzEEjdEUIfAw6eSokDXPIQpdQA/81Ev6R+rWCWOVD7 TKYS+dQOl+8HGhBrPXkBl4S9weQFA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfedthedguddttdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepuffvfhfhkffffgggjggtgfesth ekredttdefjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdr khhlrghvvghrsegrkhhlrghvvghrrdgtohhmqeenucggtffrrghtthgvrhhnpeevveefve efueegffekkefhgeeiueffgfetueejvdfghfeujeejhfekjeelgedtgeenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrg hvvghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 6 Jun 2021 12:14:00 -0400 (EDT) Subject: Re: Symbolic link breaks for postgresql.auto.conf To: RAJAMOHAN , pgsql-general@lists.postgresql.org References: From: Adrian Klaver Message-ID: <8b0d6567-8c10-90b4-187b-3fd59adfcda8@aklaver.com> Date: Sun, 6 Jun 2021 09:13:59 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 6/6/21 9:00 AM, RAJAMOHAN wrote: > Hello all, > > Can someone explain how *postgresql.auto.conf *file contents gets > updated, when running an alter system statement followed by pg_reload_conf? > > I am trying to keep a symbolic link for the > *postgresql.auto.conf* outside the data directory. The link gets created > but whenever I issue an alter system statement it gets broken. > > > The main reason for this symbolic link creation is to retain the > parameter values associated with this cluster, because we will be > copying the entire data directory from another server to this server > from time to time for testing purposes. > And no issues with other files such as hba and postgresql.conf. > > *Operating System: Ubuntu 18.04.1 LTS > * > *Postgresql : 12.7* > > Step1: > Created symbolic links and i am inside data directory > lrwxrwxrwx 1 postgres postgres   41 Jun  3 05:12 postgresql.conf -> > /etc/postgresql/12/test1/postgresql.conf > lrwxrwxrwx 1 postgres postgres   37 Jun  3 05:12 pg_hba.conf -> > /etc/postgresql/12/test1/pg_hba.conf > lrwxrwxrwx 1 postgres postgres   46 Jun  6 15:19 postgresql.auto.conf -> > /etc/postgresql/12/test1/postgresql.auto.conf > > Step2: > alter system set checkpoint_timeout='2min';select pg_reload_conf(); > ALTER SYSTEM >  pg_reload_conf > ---------------- >  t > (1 row) > > Step3: > Symbolic link got broken > lrwxrwxrwx 1 postgres postgres   41 Jun  3 05:12 postgresql.conf -> > /etc/postgresql/12/test1/postgresql.conf > lrwxrwxrwx 1 postgres postgres   37 Jun  3 05:12 pg_hba.conf -> > /etc/postgresql/12/test1/pg_hba.conf > lrwxrwxrwx 1 postgres postgres   46 Jun  6 15:19 postgresql.auto.conf > Have to believe it is due to: ~/src/backend/utils/misc/guc.c /* * Execute ALTER SYSTEM statement. * * Read the old PG_AUTOCONF_FILENAME file, merge in the new variable value, * and write out an updated file. If the command is ALTER SYSTEM RESET ALL, * we can skip reading the old file and just write an empty file. * * An LWLock is used to serialize updates of the configuration file. * * In case of an error, we leave the original automatic * configuration file (PG_AUTOCONF_FILENAME) intact. */ In particular: /* * To ensure crash safety, first write the new file data to a temp file, * then atomically rename it into place. * * If there is a temp file left over due to a previous crash, it's okay to * truncate and reuse it. */ > > > Thanks & Regards, > Rajamohan.J > -- Adrian Klaver adrian.klaver@aklaver.com