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 1oznk2-0002Ux-MQ for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Nov 2022 23:40:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oznk1-0002Yy-7O for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Nov 2022 23:40: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 1oznk0-0002UV-60 for pgsql-hackers@lists.postgresql.org; Mon, 28 Nov 2022 23:40:48 +0000 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oznjv-0004jQ-KR for pgsql-hackers@postgresql.org; Mon, 28 Nov 2022 23:40:46 +0000 Received: by mail-pg1-x530.google.com with SMTP id q71so11378648pgq.8 for ; Mon, 28 Nov 2022 15:40:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=nqrB4HOMDJKOB69ZRjQ7u4uipFX28M6siVP2YnDHPQQ=; b=oenNHfcRIR6HS/LBHJYvqINYt8XjPEVmMsa5R5YUaF1ii/t5dDMMwzNyozDkzEOKLj MaLcvEn6fJ5iQ9L9ToytbMN2les9zREdvhRLokjwR6Werx1npG3jYG594915H9keGYMx Jbb41JKq4tHqnOhWfr3Qz02ckZ9CiMVCGct3LWONkaYdd2Grd+EGAHMZacLrmVAIJcvl 0Mh6AbpRUcrgvW1OAk0eovXyQ4EiRCHUdIVreilN0bPwV192vEl0NsVgiBtDHT5mbCCG 1mZFSiAodP7Qli0ir2PQll3DrHIkPg5MbMj1EcGKQBpJGDqvfZ7GUvKB+MLb/4fg8uGj 7NBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=nqrB4HOMDJKOB69ZRjQ7u4uipFX28M6siVP2YnDHPQQ=; b=eJlcCWgROxQAspdEr3DkO/B/1RtVW/1ybxrdkcEvWqIAwjLpOEEee933Hef7Vn3/UM OvTlhjKW1razk2xLfHdBQb+/8b4pF1bK1WwBx/pb6Pq4leAZO0qlKyLTXF6J2ZN395RW znARCcSdlNs2peVV6iXfGu4SY0BmIwl0ALuuuPpk+D2PRdc8FETlcR6eBKn0u7K6qP7F YL1bX2dMBP8XV+LJbGIXaKtsVPuM8XEu0aOGOV5PmOvTZdKRrC4bk4pmXFg5e6pKiZor oH3Gg3d3NfHxyZOv8Xr5532vqyjsRdKmHR5hTXQqSuBN/NNgJBUPbATA09Wg5qP6XuwS AKKw== X-Gm-Message-State: ANoB5pkZJ6tHvoY0jjq3TYLulhLrG8r03LRnDl3reYPnOD2br5qTeBEK GMfgtbmEC/fM74N1iUJgmmg= X-Google-Smtp-Source: AA0mqf6Y9fHsP1/hYTpu5+WNgsoUQa3YXSZ22k3xJj9HseCiqGvAAHNUPNJamWqNiKqGKdFsi0d6HQ== X-Received: by 2002:a63:ff20:0:b0:477:a48c:5a7f with SMTP id k32-20020a63ff20000000b00477a48c5a7fmr27586169pgi.62.1669678842417; Mon, 28 Nov 2022 15:40:42 -0800 (PST) Received: from nathanxps13 ([50.47.162.83]) by smtp.gmail.com with ESMTPSA id s13-20020a170902b18d00b00174f7d10a03sm9396545plr.86.2022.11.28.15.40.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Nov 2022 15:40:41 -0800 (PST) Date: Mon, 28 Nov 2022 15:40:39 -0800 From: Nathan Bossart To: Robert Haas Cc: Andres Freund , Simon Riggs , "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: <20221128234039.GA1119654@nathanxps13> References: <20220824164624.GA1302727@nathanxps13> <20220902220744.GA1261322@nathanxps13> <20220923174154.GA1111614@nathanxps13> <20221106223842.GA620653@nathanxps13> <20221124001907.GA576983@nathanxps13> <20221127233434.GA878043@nathanxps13> <20221128183129.ip3g5vrcbjrngpp2@awork3.anarazel.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="HcAYCG3uE/tztfnV" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --HcAYCG3uE/tztfnV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Okay, here is a new patch set. 0004 adds logic to prevent custodian tasks from delaying shutdown. I haven't added any logging for long-running tasks yet. Tasks might ordinarily take a while, so such logs wouldn't necessarily indicate something is wrong. Perhaps we could add a GUC for the amount of time to wait before logging. This feature would be off by default. Another option could be to create a log_custodian GUC that causes tasks to be logged when completed, similar to log_checkpoints. Thoughts? On Mon, Nov 28, 2022 at 01:37:01PM -0500, Robert Haas wrote: > On Mon, Nov 28, 2022 at 1:31 PM Andres Freund wrote: >> On 2022-11-28 13:08:57 +0000, Simon Riggs wrote: >> > On Sun, 27 Nov 2022 at 23:34, Nathan Bossart wrote: >> > > > Rather than explicitly use DEBUG1 everywhere I would have an >> > > > #define CUSTODIAN_LOG_LEVEL LOG >> > > > so we can run with it in LOG mode and then set it to DEBUG1 with a one >> > > > line change in a later phase of Beta >> > > >> > > I can create a separate patch for this, but I don't think I've ever seen >> > > this sort of thing before. >> > >> > Much of recovery is coded that way, for the same reason. >> >> I think that's not a good thing to copy without a lot more justification than >> "some old code also does it that way". It's sometimes justified, but also >> makes code harder to read (one doesn't know what it does without looking up >> the #define, line length). > > Yeah. If people need some of the log messages at a higher level during > development, they can patch their own copies. > > I think there might be some argument for having a facility that lets > you pick subsystems or even individual messages that you want to trace > and pump up the log level for just those call sites. But I don't know > exactly what that would look like, and I don't think inventing one-off > mechanisms for particular cases is a good idea. Given this discussion, I haven't made any changes to the logging in the new patch set. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com --HcAYCG3uE/tztfnV Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v15-0001-Introduce-custodian.patch"