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 1pMv6S-0005lr-Uf for pgsql-general@arkaria.postgresql.org; Tue, 31 Jan 2023 18:11:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pMv6R-00066Y-Se for pgsql-general@arkaria.postgresql.org; Tue, 31 Jan 2023 18:11:31 +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 1pMv6Q-00065m-PA for pgsql-general@lists.postgresql.org; Tue, 31 Jan 2023 18:11:31 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pMv6O-0000ln-4p for pgsql-general@lists.postgresql.org; Tue, 31 Jan 2023 18:11:29 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 7BAA05C00CB for ; Tue, 31 Jan 2023 13:11:26 -0500 (EST) Received: from imap46 ([10.202.2.96]) by compute6.internal (MEProxy); Tue, 31 Jan 2023 13:11:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lateraljoin.com; h=cc:content-type:date:date:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to; s=fm2; t= 1675188686; x=1675275086; bh=iF100/gO4bY1JZMj09k81LhKMXSi0IU02PM cWhUjjH8=; b=vqMec+iT2sjFhXgaCEwLKVRQtI2hUUEJhJfBFOZcm6lv9DAfqSM XfaExsgcnbijgs2PcNAIKJ0l0BqgQ+rAq1u6smrs80PnVsO8Fqc8uuQlQ1KLMCmk sCD7BzG7ARwRALOK0n/Vb3TqjZwupgvLta39NuJUCHvBsBGBefoa925JuExbBJEZ iuS727bEP+RdfOtNrWWM1L/ffOsbf9kEJh69xN+/CUxUNkWFIr6lr+o+NIWKXHPU BBu0CxPip2ZDT6JBa1Z1Kqei7mkR3ktAXRojZJ5mqwpneZAIDLdIc7quXFZYRaJ3 gMIIWsWcZ2BvEI7z3FP6It7BekauOc66kAg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:message-id:mime-version :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1675188686; x= 1675275086; bh=iF100/gO4bY1JZMj09k81LhKMXSi0IU02PMcWhUjjH8=; b=N X5A6Aq2Wt7yTW4dhyz5HnL+6NCUr9lpVUvBXGK7mbArhmUgPs3LrHdIKznqIRL71 IPIXIpUoGtpF6iOJK/88rBtUyisUuGqiQjTJj6gBNWVpkB9m1HBZT6PnQmmTaRFh rVShuDxmmLeTXTLugmOvApLGIBPc8taTTwqrmX4d/+84pgr0EpmBiNPWtM0MllnP 8V/fiAZl8UsHmYZdItZ1/IQ9Gk0UsnzxUORbChu3PMhykZKZmjCAW6NEM1AcQseL DFvAvzhgnP7qOArZCWUAVctNEMlKMkOLkIlLWQmqG7/+oUkKLhhVnK56sgBG8ipC kf57LNf5pSUPkqfU/xtzQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudefgedguddutdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepofgfggfkfffhvffutgesthdtre dtreertdenucfhrhhomhepfdflohgvucghihhlughishhhfdcuoehjohgvsehlrghtvghr rghljhhoihhnrdgtohhmqeenucggtffrrghtthgvrhhnpeffhfejfedvgefhkeevjeeuke dvffetgedvhefggeetteffteelgeetleehhfegleenucevlhhushhtvghrufhiiigvpedt necurfgrrhgrmhepmhgrihhlfhhrohhmpehjohgvsehlrghtvghrrghljhhoihhnrdgtoh hm X-ME-Proxy: Feedback-ID: i7cb144c0:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 3B64F2A20080; Tue, 31 Jan 2023 13:11:26 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-106-gfe3ab13a96-fm-20230124.001-gfe3ab13a Mime-Version: 1.0 Message-Id: Date: Tue, 31 Jan 2023 18:10:59 +0000 From: "Joe Wildish" To: pgsql-general@lists.postgresql.org Subject: Logical Replication - "invalid ordering of speculative insertion changes" Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello, We have a logical replication publisher (13.7) and subscriber (14.6) where we are seeing the following error on the subscriber. IP address and publication name changed, otherwise verbatim: 2023-01-31 15:24:49 UTC:x.x.x.x(56276):super@pubdb:[1040971]: WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables 2023-01-31 15:24:50 UTC::@:[1040975]: LOG: logical replication apply worker for subscription "pub" has started 2023-01-31 15:24:50 UTC::@:[1040975]: ERROR: could not receive data from WAL stream: ERROR: invalid ordering of speculative insertion changes This error occurs during the initial set up of the subscription. We hit REFRESH, and then immediately it goes into this error state. It then repeats as it is retrying from here onwards and keeps hitting the same error. My understanding is that the subscriber is performing some kind of reordering of the events contained within the WAL message. As it cannot then consume the message, it aborts, retries, and gets the same message and errors again. Looking in the source code it seems there is only one place where this error can be emitted --- reorderbuffer.c:2179. Moreover I can't tell if this is an error that I can be expected to recover from as a user. We see this error only sometimes. Other times, we REFRESH the subscription and it makes progress as one would expect. Can anyone advise on what we are doing wrong here? -Joe