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.92) (envelope-from ) id 1jGOuo-0001MK-6U for pgsql-general@arkaria.postgresql.org; Mon, 23 Mar 2020 15:22:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jGOum-0003pm-Sp for pgsql-general@arkaria.postgresql.org; Mon, 23 Mar 2020 15:22:56 +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 1jGOum-0003pZ-FW for pgsql-general@lists.postgresql.org; Mon, 23 Mar 2020 15:22:56 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jGOuk-000223-1r for pgsql-general@lists.postgresql.org; Mon, 23 Mar 2020 15:22:55 +0000 Received: by mail-wr1-x443.google.com with SMTP id h15so5375386wrx.9 for ; Mon, 23 Mar 2020 08:22:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=6bPdJxhOlzAJri4vgKLNZV7j43jqn3Y1mgDpsZavlRo=; b=b/YNBoVOPhr2PJJ0r9GcgK5P7/8CN7ErScQNtbIRb4lbySgPzoUc9WO805Cv5aMJ7B KGnIU4KtD5UyNXU5iv345wG5jP2tafRIF/v5iezyg1B2TXGQdUHu7hwE7fyy9Quzg1zJ KVFUT0r2q7zIEw1Q26D9tcVkdm0X/uua5GIrDJVqGxDgMEimxpbItpNgtPIunuNDJ3vf mDTB86eHjA+dGd7aZWfCdynxLV0NIBXlzhWwSVIldyuqB7KSt+p7h364mlfieWbjXabV mR8HzpNs2oHhbPrMsKKSRA57agq62bXeUqyEDkFYvu7uIlyBdxQQxtqU3fkS+CmjEaZ2 bkPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=6bPdJxhOlzAJri4vgKLNZV7j43jqn3Y1mgDpsZavlRo=; b=f1lLFjbmLgXTEw94ERQVJWKffs21/3arSPQIHEVw4g02DKoKanoshidWmvbAP677fV 544NHpx2EZrf5D6CwFd1dZsQHnFdp3ZEPfHxhXoMSyZpfixC2QWdHDnFt+BiXpUzB/9g 2f+lfUh0gSbDVccX9FNWg5DAxMZolAwNum/GQVNMnpSWiOBR5ky/VU23GCS9TBh2J295 F4lLt0ZRghcy85d2cYM4FtNJyObugTN+qIhsw6Gr57utetJJmC/ImyR07ufmCGnaDAXj tHlXW+uSjuHN7WrBldLLGSGKrGZAeraZ72LMtDz+KLHsu/Q6GQ8cPuxsur60hrG/91IC QcgA== X-Gm-Message-State: ANhLgQ2qTZy2JoMoaDXFHNRjei+ilHqqZCvHbqDN0l7lA6OYtmnYfYqm Ma+gvWSmV/5LcDMR8Qdn0zg= X-Google-Smtp-Source: ADFU+vtRvuripDKeaIG9Dosse3k7sGhF45UYfuS5Eq65jeODKl4pl82mJNiUE4yFPkidOOBtgPw/8A== X-Received: by 2002:adf:f1ce:: with SMTP id z14mr30828738wro.68.1584976971909; Mon, 23 Mar 2020 08:22:51 -0700 (PDT) Received: from nol (82-64-124-11.subs.proxad.net. [82.64.124.11]) by smtp.gmail.com with ESMTPSA id y16sm2911223wrp.78.2020.03.23.08.22.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Mar 2020 08:22:51 -0700 (PDT) Date: Mon, 23 Mar 2020 16:22:47 +0100 From: Julien Rouhaud To: Andres Freund Cc: Justin King , pgsql-general@lists.postgresql.org, michael@paquier.xyz, kgrittn@gmail.com Subject: Re: PG12 autovac issues Message-ID: <20200323152247.GB52612@nol> References: <20200318011952.caitfhlslpq6zype@alap3.anarazel.de> <20200319223520.2mnjt6l3yybgnd77@alap3.anarazel.de> <20200319235626.wz4b57hbhuuy4w7j@alap3.anarazel.de> <20200320190317.gdxwzexdfutymqs6@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200320190317.gdxwzexdfutymqs6@alap3.anarazel.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, Mar 20, 2020 at 12:03:17PM -0700, Andres Freund wrote: > Hi, > > On 2020-03-20 12:42:31 -0500, Justin King wrote: > > When we get into this state again, is there some other information > > (other than what is in pg_stat_statement or pg_stat_activity) that > > would be useful for folks here to help understand what is going on? > > If it's actually stuck on a single table, and that table is not large, > it would be useful to get a backtrace with gdb. FTR, we're facing a very similar issue at work (adding Michael and Kevin in Cc) during performance tests since a recent upgrade to pg12 . What seems to be happening is that after reaching 200M transaction a first pass of autovacuum freeze is being run, bumping pg_database.darfrozenxid by ~ 800k (age(datfrozenxid) still being more than autovacuum_freeze_max_age afterwards). After that point, all available information seems to indicate that no autovacuum worker is scheduled anymore: - log_autovacuum_min_duration is set to 0 and no activity is logged (while having thousands of those per hour before that) - 15 min interval snapshot of pg_database and pg_class shows that datfrozenxid/relfrozenxid keeps increasing at a consistent rate and never goes down - 15 min interval snapshot of pg_stat_activity doesn't show any autovacuum worker - the autovacuum launcher is up and running and doesn't show any sign of problem - n_mod_since_analyze keeps growing at a consistent rate, never going down - 15 min delta of tup_updated and tup_deleted shows that the globate write activity doesn't change before and after the autovacuum problem The situation continues for ~2h, at which point the bloat is so heavy that the main filesystem becomes full, and postgres panics after a failed write in pg_logical directory or similar. The same bench was run against pg11 many times and never triggered this issue. So far our best guess is a side effect of 2aa6e331ead7. Michael and I have been trying to reproduce this issue locally (drastically reducing the various freeze_age parameters) for hours, but no luck for now. This is using a vanilla pg 12.1, with some OLTP workload. The only possibly relevant configuration changes are quite aggressive autovacuum settings on some tables (no delay, analyze/vacuum threshold to 1k and analyze/vacuum scale factor to 0, for both heap and toast).