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 1gWrB0-0007WS-TE for pgsql-general@arkaria.postgresql.org; Tue, 11 Dec 2018 23:10:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gWrAz-0003Hd-Ez for pgsql-general@arkaria.postgresql.org; Tue, 11 Dec 2018 23:10:53 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gWrAy-0003CM-8c for pgsql-general@lists.postgresql.org; Tue, 11 Dec 2018 23:10:53 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gWrAv-0004GI-7E for pgsql-general@lists.postgresql.org; Tue, 11 Dec 2018 23:10:50 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 8C05D22D1E; Tue, 11 Dec 2018 18:10:48 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 11 Dec 2018 18:10:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=M l/wUGpMr3JAsMn25c0sVMfHBm0taRQqZ6EdDWUivek=; b=zCZtJMB+YsAGYZkXa Wi6fHBqOAgzuVs5x89kJ2bwWLlfycwzd6pgaCPlW6wgGeNrJdTsEmKQNShPbfZvl DmBN4lATdFB7zRE1UoJ9hh3yP1Lb8Xx2gKYGK4rAGfG2cOlVzxT/bqKr7aUCRUTf lNRwlyemUiS92gYFkStc4HwwWnkQtycBOZ5BEyExlTZW+k0DBClJBXtXePuY1k/X MWx1N3jwtmcyLwNvzmDcikoEq/5BvULnx2OjZv7Sb+VkvXE8B7F+ilH/ttkTCL3c yRsaPTl76YJw3M+HHZaVrxDHQNDMBSQ9rXN84iiyDbns/VW3ADYIQ+C3Ug8oSgwg FzaJA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=Ml/wUGpMr3JAsMn25c0sVMfHBm0taRQqZ6EdDWUiv ek=; b=Hgoa93eYRcfKgZfG3J+JnwjyaWRs7VONUkmS9FgPIiJCfyaq1AoglblrO Cwxm6mcd+p1njnnuLEppzfdn/ZoGMCcb/HVyHnJrT64fUcgicQ0Nwbz90sPHUnbd YGqEOPDizLa4pT/tQfR7V4d6r5TLylNF5+8/SIvGk2eYhyeJ/2R1Gw2L5QVxVhj4 hRvXWpJGc+d3TQMXhGWR93HLQkVFg6PKE8l9/GPDUqhnjNwwYtQrDkFgF2SjuxJ4 G/de31ETuClri4FNoOR7qvN+hOHVDU6n1SQVIqG9vJzJrBAuJ2yYXBr6StA+In/s POVzAGCNuCJH/0QiIYj0XsCAYJItA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtkedrudegkedgtdekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfquhhtnecuuegrihhlohhuthemucef tddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefuvfhfhffkff gfgggjtgfgsehtjeertddtfeejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceo rggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecukfhppeejfedrvd efledruddujedrvdefkeenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhk lhgrvhgvrhesrghklhgrvhgvrhdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from ranger.suse (c-73-239-117-238.hsd1.wa.comcast.net [73.239.117.238]) by mail.messagingengine.com (Postfix) with ESMTPA id 9CEBB102A0; Tue, 11 Dec 2018 18:10:47 -0500 (EST) Subject: =?UTF-8?Q?Re=3a_Errors_with_schema_migration_and_logical_replicatio?= =?UTF-8?B?biDigJQgZXhwZWN0ZWQ/?= To: Mike Lissner Cc: pgsql-general@lists.postgresql.org References: <42bcb35c-9173-bb9e-bda6-ea5c5950119b@aklaver.com> <953748cf-7271-7230-9158-178c8e4f475e@aklaver.com> From: Adrian Klaver Message-ID: <76570a30-61f0-470a-ff4b-582eb3e33df9@aklaver.com> Date: Tue, 11 Dec 2018 15:10:45 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.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 12/11/18 2:21 PM, Mike Lissner wrote: > Reupping this since it was over the weekend and looks like a bug in > logical replication. My problems are solved, but some very weird things > happened when doing a schema migration. > > On Sun, Dec 9, 2018 at 5:48 PM Mike Lissner > > > wrote: > > On Sun, Dec 9, 2018 at 12:42 PM Adrian Klaver > > wrote: > > > 1) Using psql have you verified that NOT NULL is set on that > column on > the publisher? > > > Yes, on the publisher and the subscriber. That was my first step > when I saw the log lines about this. > > 2) And that the row that failed in the subscriber is in the > publisher table. > > > Yep, it's there (though it doesn't show a null for that column, and > I don't know how it ever could have). > > 3) That there are no NULL values in the publisher column? > > > This on the publisher: > > select * from search_docketentry where recap_sequence_number is null; > > returns zero rows, so yeah, no nulls in there (which makes sense > since they're not allowed). > > Whatever the answers to 1), 2) and 3) are the next question is: > > 4) Do you want/need recap_sequence_number to be NOT NULL. > > > Yes, and indeed that's how it always has been. > > a) If not then you could leave things as they are. > > > Well, I was able to fix this by briefly allowing nulls on the > subscriber, letting it catch up with the publisher, setting all > nulls to empty strings (a Django convention), and then disallowing > nulls again. After letting it catch up, there were 118 nulls on the > subscriber in this column: So recap_sequence_number is not actually a number, it is a code? > > I appreciate all the responses. I'm scared to say so, but I think > this is a bug in logical replication. Somehow a null value appeared > at the subscriber that was never in the publisher. > > I also still have this question/suggestion from my first email: > > > Is the process for schema migrations documented somewhere beyond > the above? Not that I know of. It might help, if possible, to detail the steps in the migration. Also what program you used to do it. Given that is Django I am assuming some combination of migrate, makemigrations and/or sqlmigrate. > > Thank you again, > > Mike > -- Adrian Klaver adrian.klaver@aklaver.com