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 1l1WKY-0007Do-Hl for psycopg@arkaria.postgresql.org; Mon, 18 Jan 2021 15:20:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l1WKX-00079a-Fv for psycopg@arkaria.postgresql.org; Mon, 18 Jan 2021 15:20:33 +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 1l1WKX-00079O-Ax for psycopg@lists.postgresql.org; Mon, 18 Jan 2021 15:20:33 +0000 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1l1WKU-0003AQ-S9 for psycopg@postgresql.org; Mon, 18 Jan 2021 15:20:32 +0000 Received: by mail-lf1-x12e.google.com with SMTP id o17so24616407lfg.4 for ; Mon, 18 Jan 2021 07:20:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hagander-net.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=TWXElaDETB+0imKLZNZAjO3qEWVkMl4qfTgDDesPleY=; b=ojBZGtw1T77d6/jFuyWR9x3lxRB5jWb2EgvFM346yKDW5qRYqiVpCcfiTfta+APwUi ySPTu9h9R5IzBREMF+l2KRVGkNj9YOyoygw3g9sPaLzxtvozMRH/nu1SW0ApdpX+WiQB udyrZ6OGf7FKvwyFv4JDvLWc5YSK2yQpqMAoM6GMQTNP+ugCbU3/ogiCjze+JK6N2LXp UEaOpiXa+OHTvrI26Tnf7HMBXHd7SJqsM7+eukP9LqEZxoYu42xWq3+34maTLWNRzqJy mC67dhW4YE2X5LVSYHflvbmwDal45DSJZkkeADPFCqs1Im0Djf2Hl9Q/NJvdmdphVtUf ikFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TWXElaDETB+0imKLZNZAjO3qEWVkMl4qfTgDDesPleY=; b=Zl0dtnlRJ7BDc5AtabIyBl/41q/SFLq1/lEBTZjvldOAaie9Gch9CRcfGLl0dSmaGd Prv5spX41rGOzVYG6aJ+fblkFnJKSJe0Zruy3X2M7NaTgFU115EJ1w2jcG/NGd6J2D9t hC9HSLu+9Whsi9FPbf/o/1afUnKdnG0dq0J+ped2lBdlZud1sCyGprit+O/p2HUTj0ok JF+X1CYkJ87XIVmTnclIfH1RV9vdpzDm0Ce8z6EoOx7xQn01TsDn1+F4MqZXoU/d6DAG Fw+pPeoQL3QwWQ/91b4jMvrjp1DGkwOrBa5ePaiKOl8xvkX/ZQ36027tTn9nKK69DJWN J/Lw== X-Gm-Message-State: AOAM530y6f/Di6X4GSNbm2/MUMrtsKqeyV2LET9kKQnrJKfmCehOzHDa 6QQQYf7nYner+ykPkKhwJHZycczuZ+onfzfN4vNV4w== X-Google-Smtp-Source: ABdhPJwtmluhC5yXpGNgdIW6kwojymPJ/0osEPgZzeKZ1ZACgeBJ1709CRCqvwaU8K80MbfA6xQTvlblUlPG2qCmdm4= X-Received: by 2002:a19:e8a:: with SMTP id 132mr10875888lfo.108.1610983229618; Mon, 18 Jan 2021 07:20:29 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Magnus Hagander Date: Mon, 18 Jan 2021 16:20:18 +0100 Message-ID: Subject: Re: Designing a better connection pool for psycopg3 To: Daniele Varrazzo Cc: psycopg@postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, Jan 18, 2021 at 4:12 PM Daniele Varrazzo wrote: > > On Mon, 18 Jan 2021 at 15:39, Magnus Hagander wrote: > > > > On Mon, Jan 18, 2021 at 3:29 PM Daniele Varrazzo > > wrote: > > > > I'm trying to imagine what happens in a case such as a network > > > partition or reconfiguration, and the app server doesn't see the > > > database anymore. This node is arguably broken. > > > > Only if this is the *only* thing it does. > > > > It might still be able to reach other services on other nodes. Other > > databases. Heck, even other database son the same node if it was a > > config error. > > In your opinion (and Karsten's, if he'd like to chip in), what should > happen on program start? Is attempting to create a new connection in > the main thread, and throwing an exception if failing to do so, a > reasonable behaviour? Yes, I think that's perfectly reasonable. The application is always going to have to be ready to get an exception on the call to get a connection out of the pool. If it cares about the "early startup failure", it should just try to grab a connection immediately on startup and will then notice if it fails. -- Magnus Hagander Me: https://www.hagander.net/ Work: https://www.redpill-linpro.com/