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 1jlUbK-0007KN-3X for pgsql-general@arkaria.postgresql.org; Wed, 17 Jun 2020 09:43:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jlUan-0006oe-3M for pgsql-general@arkaria.postgresql.org; Wed, 17 Jun 2020 09:42:49 +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 1jlUam-0006oX-Rr for pgsql-general@lists.postgresql.org; Wed, 17 Jun 2020 09:42:48 +0000 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jlUaj-0000nU-HX for pgsql-general@postgresql.org; Wed, 17 Jun 2020 09:42:47 +0000 Received: by mail-wr1-x436.google.com with SMTP id b6so1574440wrs.11 for ; Wed, 17 Jun 2020 02:42:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=pP6lK0ViaceCwfyKptkyPahpxOKOn4j6ylw+AVp8Qzk=; b=OeS3b6nFxWT7bFfBoTmiYdqn/t6to9e7N21oY5HxS67QaHkSg2FWSd3akBnXdT3Pr0 +6jgSxSJgVNNhJpBnCLGsj9kORDOxwpLVkszGhWFxu32ktpQ5VHuM29XRq0y8wyma/zQ UWbiAdGeqAw8X8w7TldghpDHjnIdl1sJMd8n+06WIdeBge33/9NEG/8FnfbH8K84FMXu uYH0g0iCMj1WmcKRVJXlcro/GCfUaG40aA804wLZqERR0Ql/M9Rx61xP9/UZ+jI/22Ag 5BYCWZENTOL2FUAQTLPJ2wAMunGkdkjq9y4/3jY8/hKnS28JqCCz3K2HzQ56SCqykQKz N28Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=pP6lK0ViaceCwfyKptkyPahpxOKOn4j6ylw+AVp8Qzk=; b=RA8xmHFqiXopMyOjcArlkTFYHySk4j1KClL1DsSqQB3r4+9cA8tCKgmhGmh0em6+mM fubqJ0sqjlkKM80SU41hZQx2Q8Wb5M5R2tc8cHah/+2DCWMbjqvnUvRo6VYTNIV3IY30 yv1XlvTeNyykEloQF542YLFglihyJg+om4iYARqKceiJ4hfobthmBeMJMXp97BtPVG+H yLDgPZ6n6Zpcvu1eMZy99E8SEPfYmfTBVFqpY+CapVvpNJnn9s+2iV8s0l52LG0sSJpW WxGyuJFjEpGsdPFvhdTqpg/pWMUKZcGcU2lC6hj3WjYf9a8fBfN7Gc8D36AJjT2FjfVN 0MNw== X-Gm-Message-State: AOAM530Z4zwkLHOI4zohX+22RMKTKR0/F54kQXus0yLp3eK4gdVoX9NM 0Sjyd4VI1yqWrEfgAj8ucwNByA== X-Google-Smtp-Source: ABdhPJwZz2Tn0J/NowwfB1sU3dK96B5c94ESU8KpTtK4lZX7Wkb7+Q8e/1FtBaSTvic6oHZp0xKMww== X-Received: by 2002:adf:e9cb:: with SMTP id l11mr7256494wrn.86.1592386961486; Wed, 17 Jun 2020 02:42:41 -0700 (PDT) Received: from localhost.localdomain ([212.186.219.234]) by smtp.gmail.com with ESMTPSA id c65sm7461602wme.8.2020.06.17.02.42.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 02:42:40 -0700 (PDT) Message-ID: <70b0df32cce4bcb0e5909854e270458714e187f2.camel@cybertec.at> Subject: Re: Conflict with recovery on PG version 11.6 From: Laurenz Albe To: Toomas Kristin , pgsql-general Date: Wed, 17 Jun 2020 11:42:40 +0200 In-Reply-To: <5726DC60-FA11-494F-AC0C-D418DDCC895F@gmail.com> References: <5726DC60-FA11-494F-AC0C-D418DDCC895F@gmail.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.5 (3.32.5-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 “FATAL: terminating connection due to conflict with recovery” and > “ERROR: canceling statement due to conflict with recovery”. 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. > > Is there any changes on version 11.5 what may cause it? > > Is there any good solution without setting max_standby_streaming_delay=-1 or enabling hot_standby_feedback? The basic behavior shouldn't have changed since v10. Check "pg_stat_database_conflicts" to see what kinds of conflicts that are. The only solutions to avoid queries being canceled due to replication conflicts are: 1. avoid that such conflicts happen: - set "hot_standby_feedback = 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 2. set "max_standby_streaming_delay" to -1 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. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com