Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sqeKm-00BWfJ-KE for pgsql-committers@arkaria.postgresql.org; Tue, 17 Sep 2024 19:58:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sqeKm-00FdL4-2D for pgsql-committers@arkaria.postgresql.org; Tue, 17 Sep 2024 19:58:00 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sqeKl-00FdKw-OJ for pgsql-committers@lists.postgresql.org; Tue, 17 Sep 2024 19:57:59 +0000 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sqeKi-001gmD-Oo for pgsql-committers@lists.postgresql.org; Tue, 17 Sep 2024 19:57:58 +0000 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-5c42384c517so5286388a12.3 for ; Tue, 17 Sep 2024 12:57:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726603075; x=1727207875; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Uhl8Mn+ve8unvNaAjuFrQAft5eJD4GCxoYtMEOzqzHc=; b=e51nr9xjIXBjJL0MOTdZ5aAobwrlbOf/bZybZk+1EWDp7xhkc2NqT0ndy9huL9iL2+ lczh/IxXm8lyfnZjAkf4ltVzegn6qosEO6wz9TlUC8QOocLWHLu0/cZCNRF8NiJu4Fib s0G6ZCrfhj8lrYWIGN3nAkaFTk31UpXckJJJX06JLlvjiR60SfYd2YeoNAyVwaXyTjhx 0pp3k17gpPzGMqdhcHEz+n+LXNokbaP3mqa5/tohe3fRTToiskQb7eC3FW0BNhj5oFZa +E/NtYyVGP3qLptIJx7XzgWv7+mPzozp2rtMp3ILwp7aHZ6Iz2ToMInuSYmSi/ubP0Vv IP2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726603075; x=1727207875; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Uhl8Mn+ve8unvNaAjuFrQAft5eJD4GCxoYtMEOzqzHc=; b=ZdRxIRY4U1AYN2NNxdYgYU/em3yLlsi1BQWbIr37iPCOZ++As5fzEuyx4WGzR98DYg C6qYdLuf70cG95bsk7Qh1vLIcRasXBHMV6yxukHDW/8Xy7FAVlKb+LBWTKpjWHxqPheL 7GpF6W/oxQ6iyLi6+CNJbxHo0ylQRy9Y3v101Tye+Rwp9p3HAvJPtstyYqXrUTuJT3dx jwwn3iP0FTp8SCNM9Iyn/70p+qbvaT2mjJoCorNYCromtuhhcu9Y0JpoaxIb7wH6m9Gg emAJYGsZOajXHPtJo2RlqIwFYAKg0A3nk77WWJKDelhkN5Zs1zj/ux+Pw2NjGPj1XXe8 Q+2w== X-Gm-Message-State: AOJu0YwOrhBk2fWLlWJ7Z2fO99iXow4EoYduvFKPxQusEFfof7aTPgFB QSBGhMFU+pFZNPxDy3mvaogAWyxpABH/jWB0KaBsUzoCx6LHY3+rnPERC1ZgoS9seKlRgp2llmF VruiCb04g/7Xg0m0reCbemEh7nWaKkeDrXkU= X-Google-Smtp-Source: AGHT+IFoommXTohfQXyngzE70g0SKw6OSTcY+zdNJYiG3DiykiRUkkpiaeJra9EgqLlOmBy4cjQ2jyd15demBB0Uyww= X-Received: by 2002:a17:907:6d15:b0:a8a:926a:d027 with SMTP id a640c23a62f3a-a9029617a69mr2025225366b.45.1726603075212; Tue, 17 Sep 2024 12:57:55 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Alexander Korotkov Date: Tue, 17 Sep 2024 22:57:43 +0300 Message-ID: Subject: Re: pgsql: Introduce framework for parallelizing various pg_upgrade tasks. To: Nathan Bossart Cc: pgsql-committers@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi! On Tue, Sep 17, 2024 at 12:11=E2=80=AFAM Nathan Bossart wrote: > Introduce framework for parallelizing various pg_upgrade tasks. > > A number of pg_upgrade steps require connecting to every database > in the cluster and running the same query in each one. When there > are many databases, these steps are particularly time-consuming, > especially since they are performed sequentially, i.e., we connect > to a database, run the query, and process the results before moving > on to the next database. > > This commit introduces a new framework that makes it easy to > parallelize most of these once-in-each-database tasks by processing > multiple databases concurrently. This framework manages a set of > slots that follow a simple state machine, and it uses libpq's > asynchronous APIs to establish the connections and run the queries. > The --jobs option is used to determine the number of slots to use. > To use this new task framework, callers simply need to provide the > query and a callback function to process its results, and the > framework takes care of the rest. A more complete description is > provided at the top of the new task.c file. > > None of the eligible once-in-each-database tasks are converted to > use this new framework in this commit. That will be done via > several follow-up commits. > > Reviewed-by: Jeff Davis, Robert Haas, Daniel Gustafsson, Ilya Gladyshev, = Corey Huinker > Discussion: https://postgr.es/m/20240516211638.GA1688936%40nathanxps13 Should we add UpgradeTaskProcessCB to the typedefs.list? I don't see this would directly influence indentation right now, but probably we should do for uniformity? ------ Regards, Alexander Korotkov Supabase