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 1jlwea-0003d0-DX for pgsql-bugs@arkaria.postgresql.org; Thu, 18 Jun 2020 15:40:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jlweY-000439-5U for pgsql-bugs@arkaria.postgresql.org; Thu, 18 Jun 2020 15:40:34 +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 1jlweX-000432-VF for pgsql-bugs@lists.postgresql.org; Thu, 18 Jun 2020 15:40:33 +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 1jlweV-0000RN-FC for pgsql-bugs@lists.postgresql.org; Thu, 18 Jun 2020 15:40:33 +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 05IFeCQv1550942; Thu, 18 Jun 2020 11:40:12 -0400 From: Tom Lane To: abcxiaod@126.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16498: The master inserts data successfully when the standby stopped in synchronous stream replication In-reply-to: <16498-4e2fce82c5d90d9c@postgresql.org> References: <16498-4e2fce82c5d90d9c@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Thu, 18 Jun 2020 03:20:03 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1550940.1592494812.1@sss.pgh.pa.us> Date: Thu, 18 Jun 2020 11:40:12 -0400 Message-ID: <1550941.1592494812@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk PG Bug reporting form writes: > [ $subject ] I don't think this is a bug; you are just misunderstanding the guarantee that synchronous replication offers. In syncrep mode, the primary server commits and then waits for some number of standbys to acknowledge having replicated that commit action before it tells the client the commit is complete. Killing the primary during that wait does not, and cannot, cause the commit not to have happened. What I think you are looking for is two-phase commit, which is a whole different animal that is far more complex and expensive than syncrep. regards, tom lane