Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s56tW-003Fx8-6Z for pgsql-general@arkaria.postgresql.org; Thu, 09 May 2024 16:45:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1s56tU-009BxP-7z for pgsql-general@arkaria.postgresql.org; Thu, 09 May 2024 16:45:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s56tT-009BxH-9C for pgsql-general@lists.postgresql.org; Thu, 09 May 2024 16:45:20 +0000 Received: from fhigh7-smtp.messagingengine.com ([103.168.172.158]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s56tP-000DK5-Nk for pgsql-general@postgresql.org; Thu, 09 May 2024 16:45:18 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 539E51140078; Thu, 9 May 2024 12:45:15 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 09 May 2024 12:45:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1715273115; x=1715359515; bh=qDaPcZwmIhoQ7NQJSq5rW6kZzdOLG84pFcD7RmoZjIY=; b= eTDoOMXc4Ju/u4P6n8cwNqcdRwI/oHEfaK52MHhCW1ti34T6Gm0Z4fQ2SKKam67J +g7din0vcgq7lHQ/6nI6z+VDLfwgBHt/JHk2PtnrIj2jkTmHMJchlsC2tAK1trXZ Q1fs0Xcku0G3X4yQ/pP3HT9AUypzA4lecLTP9VxCxYGluTrVZ8Oe947CEj3LTno8 xhyf4Gsw0xWd/mBLKBhqW8FkU7XpfrPZvv8cS1w/AA2T7sF2WUoVEBKIb2S5l2FR vH/MW8SsgYAUc6tiyRbdZcmS4ijVXitfom5+6bheXwgIlIBiToCkFX9pVGz/cLIO DuM3by7Nk2yCSFqRA/kbVg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1715273115; x= 1715359515; bh=qDaPcZwmIhoQ7NQJSq5rW6kZzdOLG84pFcD7RmoZjIY=; b=M dtuxajQLvbHCzPiH57J4P00Eq9HGKBdq2ItEZGqscL0uboS2Q7mrdrF12R7Peh+A 0kBhEQp1aNmRm6Uyv8/JKWXrA3bSns1MxCdT/cjhb7bzuqNDq/L1a0XlGGt9yKzk Y2OtVv8caO3TdIrhB59TuqQYUmwAPlh0l02jGRtZfRZdjKE+uSxlIJoa4c2J4Yjk EKwTkXr0aEHCRrKZfztJamt1lf4N4loMgF9c4OqNYTIvc+Ntln8Ao5LS6TDIE0cp h6uqmpkm0TMU382tjRqsybrNHp//igmiQAXdW5ebenJfJHtX5Qyo/gqhWFW2XH+y /oqhcspm6HTQGamAl9VNw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdefvddguddtfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttddvjeenucfhrhhomheptegu rhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrd gtohhmqeenucggtffrrghtthgvrhhnpeejtdfhgeduueefieejteejhffgheegvdduuefh lefhleefteejveekjefgueehleenucffohhmrghinhepthhhvgdrnhgvthenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhl rghvvghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 9 May 2024 12:45:14 -0400 (EDT) Message-ID: <654ded11-6223-462c-ab3f-ee3a17975fd6@aklaver.com> Date: Thu, 9 May 2024 09:45:13 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Unexpected data when subscribing to logical replication slot To: Daniel McKenzie , tomas.vondra@enterprisedb.com Cc: pgsql-general@postgresql.org References: <8a534c5f-e400-4bb5-b39e-2017d259ff06@aklaver.com> <10bcc03d-fa3e-40b6-bdd2-cac0acd046f4@aklaver.com> Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 5/9/24 00:32, Daniel McKenzie wrote: > We've had this running in live now for years without a hiccup so we are > surprised to learn that we have this massive race condition and it just > so happens that the hardware is fast enough to process the transaction > before the .NET application can react to replication slot changes. On broad scale I'm going to say that over 'for years' there has been an increase in load on the Postgres server as well as the I/0 system of the machine it is running on. What you are seeing now is the canary in the mine giving you the heads up that more trouble lies ahead as the hardware and software is reaching load limits. On finer scale my guess is that the following is happening when synchronous_commit = on: 1) Postgres session #1 does data change. 2) This is replicated out and picked up by wal2json, which sees the new data. 3) The Postgres server waits for the confirmation that the WAL record has been written out to disk. Upon confirmation it commits on the server. This is the part that I am not sure of in relation to wal2json. 4) Postgres session #2 queries the database for the record. In the case where 3) has not completed it sees the old values as the data change in session #1 has not committed and therefore the new values are not seen by other sessions. > > Daniel McKenzie > Software Developer -- Adrian Klaver adrian.klaver@aklaver.com