Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iFzU3-0007a1-VC for pgsql-general@arkaria.postgresql.org; Thu, 03 Oct 2019 11:41:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iFzU2-0002rK-Pj for pgsql-general@arkaria.postgresql.org; Thu, 03 Oct 2019 11:41:22 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1iFzU2-0002r7-FC for pgsql-general@lists.postgresql.org; Thu, 03 Oct 2019 11:41:22 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iFzTz-0004eK-E6 for pgsql-general@postgresql.org; Thu, 03 Oct 2019 11:41:21 +0000 Received: by mail-wr1-x444.google.com with SMTP id q9so2556127wrm.8 for ; Thu, 03 Oct 2019 04:41:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=lCV059F4FyKm/2SNmzLsk5JuZWKsKSdcSC47YGfnuxU=; b=BEY6e5OVAar9LE9AVyQZs7zhzxqAQpLZW66oZoXtVgJOGtOmQiGl7I5sZMKHfqmm6N r8Fmy49J2UPL72uqy7qsb87ju7wKTWcso0PXnGN4W/W1UGNLQPI3xTOm4DhClxSoiXza G3vLVwXM2u/aoAiF1RkIdGXgJarIr6prE8fdCntjGEL1ZL4STrJPHFHRHm9+zuUf+zEb BKDnngaSUYUcbEgeXJ05tQX1ZYsqMYjxT9VpRpkEF5uPvqezUxd9hsbeA3kwIWMgkjla uZO8jgGnaNr2Zj/a+7QjUo2JGaiYGrubxhjVJ6/HTzA0EdFvQ/an7TSPQTBWeSRTy/un SIuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=lCV059F4FyKm/2SNmzLsk5JuZWKsKSdcSC47YGfnuxU=; b=fTBv6YOGwPudMXgXxEsy6POx8qhgY6u20mRl5wUUIXnLg83XxIu7FumWv9tP89kNFb 21RI/R29gUJuSQ3+P0Ck+ApI0nm0u66UM6xhRj4hgzccxBoS3iVIlRtjkIgAbtaFdLRh zc8YYyXuz8VinZlcZM5WdZZwMaDVNhAo5i41IIbdJZ6ocZzmNkHZArGWiILrTgXFj2gD jMuJUxv7oVWFHAtCw0YUNh+PgPwjxVS27jBv9e+VNzx+AAp8DvMfHr7ib9Su4k7DRW/6 7AL7IbZPPd/rYU2XaFDmjX8mfC89pO0V5rDHMTgmFW5oXaupwlYk1tMaGAcpx5zWYjKq 4I8A== X-Gm-Message-State: APjAAAXH9uq/Bb0ux31yXW8AyvCYBR3pychiRI1s0wM6t144IujzR2/R lXsiDEEuT/JeliF3Q6MEXfK/7A== X-Google-Smtp-Source: APXvYqxY4KSzrfsDnT48grADfb7ENL3IwyhRVaAFX0HRjR9q2jwyFD4Wmlz+hr6HgSTtQPyDayfQog== X-Received: by 2002:a5d:5052:: with SMTP id h18mr6513534wrt.397.1570102878095; Thu, 03 Oct 2019 04:41:18 -0700 (PDT) Received: from localhost.localdomain (217-149-172-64.nat.highway.telekom.at. [217.149.172.64]) by smtp.gmail.com with ESMTPSA id z142sm6505867wmc.24.2019.10.03.04.41.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Oct 2019 04:41:17 -0700 (PDT) Message-ID: Subject: Re: Urgent :: Postgresql streaming replication issue - sync mode From: Laurenz Albe To: Shital A , pgsql-general@postgresql.org Date: Thu, 03 Oct 2019 13:41:16 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.4 (3.32.4-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, 2019-10-02 at 23:58 +0530, Shital A wrote: > We are seeing a strange issue with postgresql streaming application > in sync mode. > > We are using postgresql 9.6. Old version because of some specific > requirements. We have setup cluster with master-standby using > pacemaker. > > When we kill master using killall -9 postgres. The failed primary has > few records extra than standby node. We have done setup with > synchronous_commit = remote_apply and have set > synchronous_standby_names=server_name. > > As the failed primary is having more data, How is it possible that > primary is committing transaction before they were applied on standby > with synchronous_commit=remote_apply? > > > Please share if you have any thoughts. Are we missing any config ? This is to be expected. The transaction will be committed on the primary, then on the standby, and COMMIT will only return once the standby reports success. But the transacaction still has to be committed on the primary first. If the standby sis promoted while COMMIT is waiting for the standby, you can end up with the transaction committed on the primary, but not yet committed on the standby. You should use "pg_rewind" on the failed primary if you want to use it as new standby for the promoted server. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com