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 1jlxpH-0006IK-LE for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Jun 2020 16:55:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jlxpE-0004Ya-2o for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Jun 2020 16:55:40 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jlxpD-0004YT-Rv for pgsql-hackers@lists.postgresql.org; Thu, 18 Jun 2020 16:55:39 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jlxpB-00014s-M3 for pgsql-hackers@postgresql.org; Thu, 18 Jun 2020 16:55:38 +0000 Received: from hnk.local (p2604028-ipngn12401funabasi.chiba.ocn.ne.jp [180.1.110.28]) by oss.nttdata.com (Postfix) with ESMTPSA id CF623600DF; Fri, 19 Jun 2020 01:55:35 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.3 at oss.nttdata.com Subject: Re: [patch] demote To: Robert Haas Cc: Jehan-Guillaume de Rorthais , PostgreSQL-development References: <20200617174451.222078b4@firost> <2eb2fd8f-c9a0-ac31-66dc-2c56dd048540@oss.nttdata.com> From: Fujii Masao Message-ID: Date: Fri, 19 Jun 2020 01:55:35 +0900 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020/06/19 0:22, Robert Haas wrote: > On Thu, Jun 18, 2020 at 8:41 AM Fujii Masao wrote: >> ISTM that a clean switchover is possible without "ALTER SYSTEM READ ONLY". >> What about the following procedure? >> >> 1. Demote the primary to a standby. Then this demoted standby is read-only. >> 2. The orignal standby automatically establishes the cascading replication >> connection with the demoted standby. >> 3. Wait for all the WAL records available in the demoted standby to be streamed >> to the orignal standby. >> 4. Promote the original standby to new primary. >> 5. Change primary_conninfo in the demoted standby so that it establishes >> the replication connection with new primary. >> >> So it seems enough to implement "demote" feature for a clean switchover. > > There's something to that idea. I think it somewhat depends on how > invasive the various operations are. For example, I'm not really sure > how feasible it is to demote without a full server restart that kicks > out all sessions. If that is required, it's a significant disadvantage > compared to ASRO. Even with ASRO, the server restart is necessary and RO sessions are kicked out when demoting RO primary to a standby, i.e., during a clean switchover? Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION