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 1o4QR0-0003Uk-1g for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Jun 2022 17:16:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o4QQy-0001W4-Ni for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Jun 2022 17:16:00 +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 1o4QQy-0001Vb-Cw for pgsql-hackers@lists.postgresql.org; Thu, 23 Jun 2022 17:16:00 +0000 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1o4QQv-00037H-TC for pgsql-hackers@postgresql.org; Thu, 23 Jun 2022 17:15:59 +0000 Received: by mail-pj1-x1036.google.com with SMTP id a11-20020a17090acb8b00b001eca0041455so3801201pju.1 for ; Thu, 23 Jun 2022 10:15:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=drHgCLSZCFrLaY4ZfVYlj6/DWl5IyK33LLgrTkQ7HWw=; b=hVSfVP6xHYR2zQABGddpz5oRjkoVGBa0SppBtW55/8wHk3uWBFLQcOE8eYwqMBD57X r4nX0DG1OZ8bf7fpkZLJHSU8P/KFeWN9tN4ZiieaVJS1XcSHiBpZ3iGG+pHsxktW+VYD 6aYe1sdo+Baw75XdUeA8demV2WdM7lSPna+n3DIX6gjbxQYRwDBppVROsIp7Rgu1rSKu EHz1T9xZlwvSCreM4WE58aM/VsPnKtlqdp+EgNDnRfOIITHAkD45BnNNE5zyTCEVAkTv YsnjE+tuwOOZGU/A49h3LDSfQ+EFkMaUD69e/1qq7S0jPiRbJ4wr20FkNOPikzVhMj72 X18g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=drHgCLSZCFrLaY4ZfVYlj6/DWl5IyK33LLgrTkQ7HWw=; b=WBaM/zBIdA0UwoD3Lh76NcSBPhY2fo2s71AvXclwezLP2x4fzk+e5FVl0gD6xhRxgc +xkYXF7UwWzaVjF+wCZFan2w2FuXNGf/akG4+ZHHX+Bo9txm+SVmZfFJMfQgRCwjPqSW uGSmfRZWU5CsiBSCCdqfk+cGsjR6RxQ7Ihga6prGTIhArAK0Y3EmTFxh0MSCg/vcYVwO UeHtIWp8yExkA133Y46z/6vz9qhY7+1d7QkauVGlcuZog3nV01oB8sH2puiKRMuG4c8+ 4/aDWn12JtAhEZWg+gq88hQh1aUBU+p7bjEwDn/3lB6PXg2+oPoIIv7SI1rlugY4sFQk mJ5g== X-Gm-Message-State: AJIora8Ie2S7xytcL42xDGmqz5uJhY3FRJ8KTNmzqcqGqbm0QdDUikus H2vF32HlNU1AKc7g5VtFZlg= X-Google-Smtp-Source: AGRyM1t+w6lk6dpWI9tyYQVw4LKR9T7UoCoL7ta0M3bnmaS3w4YjNzga7NHer1LK+plbENezYVfU3g== X-Received: by 2002:a17:903:291:b0:168:c6b3:1976 with SMTP id j17-20020a170903029100b00168c6b31976mr39734905plr.9.1656004555825; Thu, 23 Jun 2022 10:15:55 -0700 (PDT) Received: from nathanxps13 ([50.54.155.70]) by smtp.gmail.com with ESMTPSA id z11-20020a1709027e8b00b00163f3e91ea0sm28153pla.238.2022.06.23.10.15.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 10:15:55 -0700 (PDT) Date: Thu, 23 Jun 2022 10:15:52 -0700 From: Nathan Bossart To: Robert Haas Cc: Simon Riggs , Andres Freund , "Bossart, Nathan" , Bharath Rupireddy , Maxim Orlov , Amul Sul , Bruce Momjian , "pgsql-hackers@postgresql.org" Subject: Re: O(n) tasks cause lengthy startups and checkpoints Message-ID: <20220623171552.GA96638@nathanxps13> References: <20220217182337.GA3247866@nathanxps13> <20220217192709.eyf2cnymhxqsals7@alap3.anarazel.de> <20220217210022.GA3248793@nathanxps13> <20220217222829.lndzwq72fh4v34c2@alap3.anarazel.de> <20220217225838.GA3292179@nathanxps13> <20220217231247.llfqjvvuk6rkawel@alap3.anarazel.de> <20220218164454.GA3403811@nathanxps13> <20220218205111.GA3447220@nathanxps13> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Jun 23, 2022 at 09:46:28AM -0400, Robert Haas wrote: > I do agree that a general mechanism for getting cleanup tasks done in > the background could be a useful thing to have, but I feel like it's > hard to see exactly how to make it work well. We can't just allow it > to spin up a million new processes, but at the same time, if it can't > guarantee that time-critical tasks get performed relatively quickly, > it's pretty worthless. My intent with this new auxiliary process is to offload tasks that aren't particularly time-critical. They are only time-critical in the sense that 1) you might eventually run out of space and 2) you might encounter wraparound with the logical replication files. But AFAICT these same risks exist today in the checkpointer approach, although maybe not to the same extent. In any case, 2 seems solvable to me outside of this patch set. I'm grateful for the discussion in this thread so far, but I'm not seeing a clear path forward. I'm glad to see threads like the one to stop doing end-of-recovery checkpoints [0], but I don't know if it will be possible to solve all of these availability concerns in a piecemeal fashion. I remain open to exploring other suggested approaches beyond creating a new auxiliary process. [0] https://postgr.es/m/CA%2BTgmobrM2jvkiccCS9NgFcdjNSgAvk1qcAPx5S6F%2BoJT3D2mQ%40mail.gmail.com -- Nathan Bossart Amazon Web Services: https://aws.amazon.com