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 1jlYHE-00087s-MC for pgsql-general@arkaria.postgresql.org; Wed, 17 Jun 2020 13:38:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jlYHD-0004LH-Fs for pgsql-general@arkaria.postgresql.org; Wed, 17 Jun 2020 13:38:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jlYHD-0004JD-66 for pgsql-general@lists.postgresql.org; Wed, 17 Jun 2020 13:38:51 +0000 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jlYHA-0002Ne-Ad for pgsql-general@postgresql.org; Wed, 17 Jun 2020 13:38:50 +0000 Received: by mail-lf1-x12b.google.com with SMTP id c21so1320168lfb.3 for ; Wed, 17 Jun 2020 06:38:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Wg3xCpgtHUfh3dUf1vTlIDvO4ovKfpQdXiua2zyCfmY=; b=TqSa+h2nWgIMFX9OkV2UIoH+DgZJyban7T1XDL7JmzJY3cXfpxcUoHrnozHTUWhMWN l/plOaTIbVQJv7K46DArDNEbJfBbLh67J8lif3otvhAFKu2LLTI4y5kGnt1DIkc2Fn8S TrRSnCmM7ZMMmb96mSXg8iKmeyUDbE+s/AvkY2Yc2jzP78rcVS8YPni+KjZ/zQvmtAvh v3AIo1sK4xbWQnzw0t1qSIXMYxuAJbNPn16lRDUSx3lgvQZx+eZPqo4jy4dgGensnzOn ShvSIEmCj8j5UzjrkJaPAQk9zOl1Ctf/04x7WdxeWh3IAK28FU6OU0WraHa4rr1EaQou mHUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Wg3xCpgtHUfh3dUf1vTlIDvO4ovKfpQdXiua2zyCfmY=; b=tYgo//wTS33wJpl9kGIGBP3KW6mQfu2frqyt+RkKGfavPgqZJwjFqCm+NUnE08QTJ8 ibs35srSzocBkGANNLoJxyVK+hb4OrnT0DhFABDHEjvV3qS2Gt5efg2ezS4RENr7stDB 8Go5ej+uqx4W9iWNXAiJ7WOkh7bRK51suN1zAqZumwwsieJ8KpV8QeXYIax76WHaaYmh CcRHw9nHqrptPbPEfS3O3L6K+Q5VN1w2p/+WjqtMAMjAcPXhdXDVE2efPaqxNWztSBIE O7FghryL5AXLOe5CnRnjVu5oU7HvKK7gp1tAAPLoDQobC4IWCOAQJvS3A7lknMLBh8mD RVsQ== X-Gm-Message-State: AOAM5326/BVq8K01J+0xytARmyODsn1Ja44x0AXSBwsucNNK9fXs3vIe ME1cbLiH1o7l+4gRUnmVst0= X-Google-Smtp-Source: ABdhPJw4uQAjBGt4K4LBPJ4u5c4L6NJNdk518/mg3JONEUkV55b9JLho29hbNiAhXF5shWSMpioobQ== X-Received: by 2002:a05:6512:3082:: with SMTP id z2mr4744972lfd.32.1592401126169; Wed, 17 Jun 2020 06:38:46 -0700 (PDT) Received: from [192.168.10.108] (133-225-29-85.dyn.estpak.ee. [85.29.225.133]) by smtp.gmail.com with ESMTPSA id 203sm653718lfk.51.2020.06.17.06.38.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Jun 2020 06:38:45 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: Conflict with recovery on PG version 11.6 From: Toomas Kristin In-Reply-To: <70b0df32cce4bcb0e5909854e270458714e187f2.camel@cybertec.at> Date: Wed, 17 Jun 2020 16:38:44 +0300 Cc: pgsql-general Content-Transfer-Encoding: quoted-printable Message-Id: <918BFA04-B89D-4F29-9868-0A113AD72F52@gmail.com> References: <5726DC60-FA11-494F-AC0C-D418DDCC895F@gmail.com> <70b0df32cce4bcb0e5909854e270458714e187f2.camel@cybertec.at> To: Laurenz Albe X-Mailer: Apple Mail (2.3608.80.23.2.2) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi Laurenz, Thank you! What are reasons for conflicts? Based on documentation seems that the = only reason can be that vacuum removed unused tuples that are in use at = standby host and due to that standby host cannot apply modifications = while blocking query either finishes or will be terminated. isnt it? Or = there can be some other reasons? I just wondering what would be impact when I increase value for = autovacuum_vacuum_scale_factor in order force vacuuming process postpone = the clean up process. BR, Toomas > On 17. Jun 2020, at 12:42, Laurenz Albe = wrote: >=20 > On Wed, 2020-06-17 at 08:42 +0300, Toomas Kristin wrote: >> Basically after upgrade to version 11.5 from 10.6 I experience error = messages on streaming >> replica host =E2=80=9CFATAL: terminating connection due to conflict = with recovery=E2=80=9D and >> =E2=80=9CERROR: canceling statement due to conflict with recovery=E2=80= =9D. There is no changes for >> vacuuming on master nor max_standby_streaming_delay for replica. I = tried to correlate >> errors with vacuuming process on master but according to logs there = is no link between >> them. Somehow I have feeling that when query runs longer than value = for parameter >> max_standby_streaming_delay the query will be terminated regardless = vacuuming process on master. >>=20 >> Is there any changes on version 11.5 what may cause it? >>=20 >> Is there any good solution without setting = max_standby_streaming_delay=3D-1 or enabling hot_standby_feedback? >=20 > The basic behavior shouldn't have changed since v10. >=20 > Check "pg_stat_database_conflicts" to see what kinds of conflicts that = are. >=20 > The only solutions to avoid queries being canceled due to replication = conflicts are: >=20 > 1. avoid that such conflicts happen: > - set "hot_standby_feedback =3D on" on the standby and/or > "vacuum_defer_cleanup_age" on the primary to avoid VACUUM = conflicts > - Don't lock tables in access exclusive mode >=20 > 2. set "max_standby_streaming_delay" to -1 >=20 > Note that it can be quite hard to completely avoid replication = conflicts. > Trying to have both no delay in applying changes and no cancelled = queries > is often not possible without seriously crippling autovacuum. >=20 > Yours, > Laurenz Albe > --=20 > Cybertec | https://www.cybertec-postgresql.com >=20