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 1iIYIQ-0004As-P9 for pgsql-general@arkaria.postgresql.org; Thu, 10 Oct 2019 13:15:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iIYIP-0007fS-HA for pgsql-general@arkaria.postgresql.org; Thu, 10 Oct 2019 13:15:57 +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 1iIYIP-0007fJ-63 for pgsql-general@lists.postgresql.org; Thu, 10 Oct 2019 13:15:57 +0000 Received: from [212.85.157.172] (helo=mail.dalibo.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iIYIJ-0000Cu-4S for pgsql-general@postgresql.org; Thu, 10 Oct 2019 13:15:56 +0000 Received: from firost (unknown [88.190.0.6]) by mail.dalibo.com (Postfix) with ESMTPSA id 4BDE21FAF1; Thu, 10 Oct 2019 15:15:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dalibo.com; s=a; t=1570713348; bh=LExg2TN3vNHCogU0nJspLfTJ7X4kMVYf0fhafM3WtKw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=aGt+fCrS6sHC8k2BP8fN00YsP8TBDceGvqelsaFRNCfDF92qlQyk6O7uC7PZVkn42 dVJsbL1z38J/YnSpjijTT4+fDmWAs6HMAHFYU1N2UqniXMrsy3TT0dMgcAbj9xGjRR DdDmsURO4ttpsKxGTuLeQVdYAay+ccfQSAKn5R8A= Date: Thu, 10 Oct 2019 15:15:46 +0200 From: Jehan-Guillaume de Rorthais To: Peter Eisentraut , Tom Lane Cc: Alvaro Herrera , Tim Clarke , PostgreSQL General List Subject: Re: logical replication - negative bitmapset member not allowed Message-ID: <20191010151546.69d4f0e9@firost> In-Reply-To: <4a16af4e-ba61-e46d-6d69-0a20ef7ed97d@2ndquadrant.com> References: <20190401214304.GA29208@alvherre.pgsql> <4a16af4e-ba61-e46d-6d69-0a20ef7ed97d@2ndquadrant.com> Organization: Dalibo MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 212.85.157.172 (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello, On Thu, 4 Apr 2019 23:37:04 +0200 Peter Eisentraut wrote: > On 2019-04-01 23:43, Alvaro Herrera wrote: > > Maybe the replica identity of a table got set to a unique index on oid? > > Or something else involving system columns? (If replication is > > otherwise working, the I suppose there's a separate publication that's > > having the error; the first thing to isolate would be to see what tables > > are involved in that publication). > > Looking through the code, the bms_add_member() call in > logicalrep_read_attrs() does not use the usual > FirstLowInvalidHeapAttributeNumber offset, so that seems like a possible > problem. > > However, I can't quite reproduce this. There are various other checks > that prevent this scenario, but it's plausible that with a bit of > whacking around you could hit this error message. Here is a script to reproduce it under version 10, 11 and 12: ################################################ # env PUB=/tmp/pub SUB=/tmp/sub unset PGPORT PGHOST PGDATABASE PGDATA export PGUSER=postgres # cleanup kill %1 pg_ctl -w -s -D "$PUB" -m immediate stop; echo $? pg_ctl -w -s -D "$SUB" -m immediate stop; echo $? rm -r "$PUB" "$SUB" # cluster initdb -U postgres -N "$PUB" &>/dev/null; echo $? initdb -U postgres -N "$SUB" &>/dev/null; echo $? echo "wal_level=logical" >> "$PUB"/postgresql.conf echo "port=5433" >> "$SUB"/postgresql.conf pg_ctl -w -s -D $PUB -l "$PUB"-"$(date +%FT%T)".log start; echo $? pg_ctl -w -s -D $SUB -l "$SUB"-"$(date +%FT%T)".log start; echo $? pgbench -p 5432 -qi pg_dump -p 5432 -s | psql -qXp 5433 # fake activity pgbench -p 5432 -T 300 -c 2 & # replication setup psql -p 5432 -Xc "CREATE PUBLICATION prov FOR ALL TABLES" psql -p 5433 -Xc "CREATE SUBSCRIPTION sub CONNECTION 'port=5432' PUBLICATION prov" # wait for the streaming unset V; while [ "$V" != "streaming" ]; do sleep 1 V=$(psql -AtXc "SELECT 'streaming' FROM pg_stat_replication WHERE state='streaming'") done # trigger the error message psql -p 5433 -Xc "ALTER SUBSCRIPTION sub DISABLE" psql -p 5433 -Xc "ALTER TABLE pgbench_history ADD id SERIAL PRIMARY KEY" psql -p 5432 -Xc "ALTER TABLE pgbench_history ADD id SERIAL PRIMARY KEY" psql -p 5433 -Xc "ALTER SUBSCRIPTION sub ENABLE" ################################################ Regards,