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 1o98FK-0001Oe-6S for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Jul 2022 16:51:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o98FI-00076g-QM for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Jul 2022 16:51:24 +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 1o98FI-00076W-1K for pgsql-hackers@lists.postgresql.org; Wed, 06 Jul 2022 16:51:24 +0000 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1o98F8-0003NP-NC for pgsql-hackers@postgresql.org; Wed, 06 Jul 2022 16:51:23 +0000 Received: by mail-pf1-x42e.google.com with SMTP id e16so2096239pfm.11 for ; Wed, 06 Jul 2022 09:51:14 -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=7bXR3qooB8GSIH732d00zIK5GJjbKrTkN8Slp2eekJ0=; b=N3vq3j04wZtwujpil8j/lTGkEGZL4hSFnHJTbbtcD/cw3nSTDx4b6lE1efrK6yplAW oleAIo5vsnvqqrf1PxA5QTXbOOYgimBIiQVcGflqZ7oR65TQ7tUzpcsjQy8qOrIg705F /kNuCvDQdNpBjUTdLdV9TFtbn8EBesAJxXpzudVZPlL8d6fWnmH9IFk0Sd0CCXos7TvR nWgMBGZdNuUkieJKKVUBWAv7eQU4tbtB+WDXPybkatwwg1CBQU7oH8rGaMT2QmE+wRJp HPvPHTS/fqVxW4RUUdLqOAeSNsx55iTV0XetwjSwVwieleom5PTH4qkhVEKsJFcEeL5N 6FRg== 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=7bXR3qooB8GSIH732d00zIK5GJjbKrTkN8Slp2eekJ0=; b=FRo1VP2H1dfZwRgKKGJ2diCYX3RLCPYlV8HrLdxfLtJcXNkDWbVgA5b6GyHN3YjgMw cwkR4lA4zRF4UaV/Pq+ekkPMz0A42gzBZ3Wc6TuYiMLFnnlWEQnvPT4dHAtNOBmLni29 ujZX5O59UsbFUjd1vV2kGYN7kFWxPvRmkbvAUBc2w4OZsHGlgQowZGjOGSpdOyOCQ1dt LzP+YpRRbMQZEZuN+rnttHECwG5h3xK7l5AHGp5X3kCAhv3o4NIMsIKhSzsz7C22mF98 +7IwxLVEzo0RlU6RUe3QzkZQ9eQpUspnbplIeJGOZxBR5SSa+Y7QGNnr7McfIPf7wJ4c ZGuw== X-Gm-Message-State: AJIora9qTXu8j+N7pmEbkXW0aIaCmildiKLOlk+sHVLsQAyBmjrC/IAw OyfQsag1h6xBkI4NCJ+7b4ir3p3ZPI0= X-Google-Smtp-Source: AGRyM1tYNe8qJ1U2LZ7QDlWtoFZlvj4bx9svUKgzovnQq7tHtE+1mSVjmlEDdepyxgNIEu40so7m+w== X-Received: by 2002:aa7:8b51:0:b0:525:5132:8a84 with SMTP id i17-20020aa78b51000000b0052551328a84mr48067404pfd.45.1657126273579; Wed, 06 Jul 2022 09:51:13 -0700 (PDT) Received: from nathanxps13 ([50.54.155.70]) by smtp.gmail.com with ESMTPSA id q13-20020a17090311cd00b0016bdeb58611sm7997684plh.112.2022.07.06.09.51.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 09:51:12 -0700 (PDT) Date: Wed, 6 Jul 2022 09:51:10 -0700 From: Nathan Bossart To: Andres Freund Cc: Simon Riggs , Robert Haas , "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: <20220706165110.GB2135371@nathanxps13> References: <20220218164454.GA3403811@nathanxps13> <20220218205111.GA3447220@nathanxps13> <20220623171552.GA96638@nathanxps13> <20220702220554.GA1044460@nathanxps13> <20220702225456.zit5kjdtdfqmjujt@alap3.anarazel.de> <20220703170754.GA1048244@nathanxps13> <20220703172732.wembjsb55xl63vuw@awork3.anarazel.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="/04w6evG8XlLl3ft" Content-Disposition: inline In-Reply-To: <20220703172732.wembjsb55xl63vuw@awork3.anarazel.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --/04w6evG8XlLl3ft Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Here's a new revision where I've attempted to address all the feedback I've received thus far. Notably, the custodian now uses a queue for registering tasks and determining which tasks to execute. Other changes include splitting the temporary file functions apart to avoid consecutive boolean flags, using a timestamp instead of an integer for the staging name for temporary directories, moving temporary directories to a dedicated directory so that the custodian doesn't need to scan relation files, ERROR-ing when something goes wrong when cleaning up temporary files, executing requested tasks immediately in single-user mode, and more. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com --/04w6evG8XlLl3ft Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0001-Introduce-custodian.patch"