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 1sONCu-00Drm3-5O for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Jul 2024 20:01:00 +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 1sONCs-0044WF-IL for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Jul 2024 20:00:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sONCs-0044W7-91 for pgsql-hackers@lists.postgresql.org; Mon, 01 Jul 2024 20:00:58 +0000 Received: from mail-io1-xd30.google.com ([2607:f8b0:4864:20::d30]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sONCq-004Y4y-HI for pgsql-hackers@postgresql.org; Mon, 01 Jul 2024 20:00:57 +0000 Received: by mail-io1-xd30.google.com with SMTP id ca18e2360f4ac-7f3cc78afb6so117957139f.0 for ; Mon, 01 Jul 2024 13:00:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719864055; x=1720468855; darn=postgresql.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=aeCnypj0cCMKFZKgNuuZdf1qhFPxPbMDsXNQvMoZW5o=; b=Frg2Lg+q3GKRBcIp/+9kZkhUXWlpccLxq28TDbsEC1Om+IE7taEUvYhVTcik3zaiwX HTAAUZ+mm8PQwj2m5XXI+1mXJqXXFWp2/pYwT9FzLXFqefNwqhRU/udOndyWw3wXYPbS VPFOvi4NjzFzYj/ABMmJyeHSR+YyGY28PAQ6c9+HOxtkp3KK2NTRms8pssEGCruWvO/q YKjHWgpeF5hjCeNeIKTiw/N95ODJBxHj6y73EcYwYYqAljh84YDv1L0vQo6fczyLllq3 4fU/imYgRVz9xnaY1iEIXouRfL2euDuBW9quyyXkXKhDnqBH5txhq2UXsDFK3I/mALic A0dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719864055; x=1720468855; h=in-reply-to:content-transfer-encoding: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=aeCnypj0cCMKFZKgNuuZdf1qhFPxPbMDsXNQvMoZW5o=; b=hpkeozbTnnqNxIBZ/AcWbP2/xQYCpMGm0QtAwsn52P08IxZg/3E9wpgF5sped3/k68 7ZEU7nE/uhw8R9J7yX1H0kM3KhuPgEaN8bLcn/nE4qAZqD+v/+KzH9uFhaJ34EOK4/b7 w6dFRaTflTTgPPFed8F7AdedTe9uB6n+PYo62yvOaOCr8+eemv5pM86nwWmf9X8afUNh nNFezswIQHnyJiXCN+QA+YIiMQsCebcz3JetwoXoNTds9UUhmWv58Rrpl39UZy+ha/Y/ J2/q7yns64h5GDwh8AlqiaaUgTczR+n3EDDQF4L1K4uVhTHO0ArJ615tHAV4/vv6qkyG W3Pw== X-Forwarded-Encrypted: i=1; AJvYcCV4S534zpDht6kUfr9/HwLrb1upQ8CVsLzsjjYx5AuZ+yLfQXfYUTlMnmqcd4bmzK2HfWzmGMMi0DFbG7gtgSN+bEwjZmjriIIv5aAk X-Gm-Message-State: AOJu0YwwuPntUsq54kZsJVcsMPIRIltgNnxoH4TO8nb8zwkLtVrSdZsM VYv9/oPDLMCZEtbwhtOFXNLOzO/de9uAZVPrNhGiQUDH7uE463db X-Google-Smtp-Source: AGHT+IHJC232kfwDVC6Tht25r5SbvrTREjUeZcfsmsmfy5/IuZqwtlQpA307NRxlaDkPdgV8SUHXmg== X-Received: by 2002:a5d:954e:0:b0:7f6:2412:116f with SMTP id ca18e2360f4ac-7f62eeb04ccmr593566639f.18.1719864054796; Mon, 01 Jul 2024 13:00:54 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4bb742f1d89sm2366113173.176.2024.07.01.13.00.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jul 2024 13:00:54 -0700 (PDT) Date: Mon, 1 Jul 2024 15:00:53 -0500 From: Nathan Bossart To: Robert Haas Cc: Jeff Davis , pgsql-hackers@postgresql.org Subject: Re: optimizing pg_upgrade's once-in-each-database steps Message-ID: References: <20240516211638.GA1688936@nathanxps13> <3b97ab8e295ec3db22baa2dfdd49073449ae1696.camel@j-davis.com> <20240517012408.GA1691322@nathanxps13> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Jul 01, 2024 at 03:58:16PM -0400, Robert Haas wrote: > On Mon, Jul 1, 2024 at 3:47 PM Nathan Bossart wrote: >> 0001 introduces a new API for registering callbacks and running them in >> parallel on all databases in the cluster. This new system manages a set of >> "slots" that follow a simple state machine to asynchronously establish a >> connection and run the queries. It uses system() to wait for these >> asynchronous tasks to complete. Users of this API only need to provide two >> callbacks: one to return the query that should be run on each database and >> another to process the results of that query. If multiple queries are >> required for each database, users can provide multiple sets of callbacks. > > I do really like the idea of using asynchronous communication here. It > should be significantly cheaper than using multiple processes or > threads, and maybe less code, too. But I'm confused about why you > would need or want to use system() to wait for asynchronous tasks to > complete. Wouldn't it be something like select()? Whoops, I meant to type "select()" there. Sorry for the confusion. -- nathan