pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: Andres Freund <andres@anarazel.de>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: logical decoding / rewrite map vs. maxAllocatedDescs
Date: Sat, 11 Aug 2018 01:55:43 +0200
Message-ID: <0328ccdf-17d6-911b-ae35-c6dc4c76708a@2ndquadrant.com> (raw)
In-Reply-To: <470adb65-5101-4659-d213-41bde1eef8f2@2ndquadrant.com>
References: <20180809174746.aa6rbpsu4zjipzif@alvherre.pgsql>
	<b346c3eb-0e65-29ec-47db-0d9a46feaa2c@2ndquadrant.com>
	<20180810211340.nlgyfa7jlmkjcs5m@alap3.anarazel.de>
	<470adb65-5101-4659-d213-41bde1eef8f2@2ndquadrant.com>

On 08/10/2018 11:59 PM, Tomas Vondra wrote:
> 
> ...
> 
> I suspect there's some other ingredient, e.g. some manipulation with the
> subscription. Or maybe it's not needed at all and I'm just imagining things.
> 

Indeed, the manipulation with the subscription seems to be the key here.
I pretty reliably get the 'could not read block' error when doing this:

1) start the insert pgbench

   pgbench -n -c 4 -T 300 -p 5433 -f insert.sql test

2) start the vacuum full pgbench

   pgbench -n -f vacuum.sql -T 300 -p 5433 test

3) try to create a subscription, but with small amount of conflicting
data so that the sync fails like this:

  LOG:  logical replication table synchronization worker for
  subscription "s", table "t" has started
  ERROR:  duplicate key value violates unique constraint "t_pkey"
  DETAIL:  Key (a)=(5997542) already exists.
  CONTEXT:  COPY t, line 1
  LOG:  worker process: logical replication worker for subscription
  16458 sync 16397 (PID 31983) exited with exit code 1

4) At this point the insert pgbench (at least some clients) should have
failed with the error. If not, rinse and repeat.

This kinda explains why I've been seeing the error only occasionally,
because it only happened when I forgotten to clean the table on the
subscriber while recreating the subscription.

regards

-- 
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




view thread (27+ messages)  latest in thread

Message-ID: <0328ccdf-17d6-911b-ae35-c6dc4c76708a@2ndquadrant.com>
Permalink:  ../0328ccdf-17d6-911b-ae35-c6dc4c76708a@2ndquadrant.com/
Also on:    postgresql.org/message-id/0328ccdf-17d6-911b-ae35-c6dc4c76708a@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tomas.vondra@2ndquadrant.com, andres@anarazel.de, alvherre@2ndquadrant.com
  Subject: Re: logical decoding / rewrite map vs. maxAllocatedDescs
  In-Reply-To: <0328ccdf-17d6-911b-ae35-c6dc4c76708a@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox