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 1pbmHs-0008Oz-7Z for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Mar 2023 17:48:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pbmHr-0000W9-4D for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Mar 2023 17:48:43 +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 1pbmHq-0000W0-PM for pgsql-hackers@lists.postgresql.org; Mon, 13 Mar 2023 17:48:42 +0000 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pbmHn-0001eS-Rw for pgsql-hackers@lists.postgresql.org; Mon, 13 Mar 2023 17:48:42 +0000 Received: by mail-pf1-x433.google.com with SMTP id bd34so8158072pfb.3 for ; Mon, 13 Mar 2023 10:48:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678729717; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=g1irIA53JXvcxUKbzfJQ0ls1EEHGo69v0M5fLrJsV+w=; b=C6i6zr7+9Kh6FCuEeVEhrfOq78XBM7nxiCgGyzOn9WhbfCXziWhEMxaFHQ3do8CbqZ qZkYXNWJ5dTmNVhBwp5OqrJLz8DYNairyAMUAFKk9Ryw/NFwBbXlGHUOErKE/hwDFMb+ UJFIvhU3reo1E3uTQv53IPJHXFLlnrrIG3n6kV8mtzCEF7VIj3LYtSOIwV9pNDlLK5UN TvUUjDinY3PZmkUi36iKEGiiAJQBoigMjAWK6cus+aQ5BE4CSIPMtm3O9Rm4up7j/hnF hNAUsZt+Kwux4PW4OwIgl/V4WaSJ7XvuDuVQpAz9U+pSRMqVb9eFP2v3vqrbWb9oD/ea 2lqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678729717; h=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=g1irIA53JXvcxUKbzfJQ0ls1EEHGo69v0M5fLrJsV+w=; b=NzZSLGYTGSgD7nIe75+DXstbDN30vEjas/hl31JoW/i9EDaXIRq+ZnalgsKNxQsLaQ p+s8ag/kV9Ct8ki7Yvntj5Drbc1HReO3qcBF8s5/8aYyYMiZUtaob6meokjESioTHkDp H0pcJ30IhS2uDP+4xromX/tkp4sJqEQfxgMcp+b4+NtYNUIBZYFtyiRYkv7sBeLtDN6h CMz4GkM1G6YbgqORjvTFcJa1CWVnPFETXCVumwMiIFDNTxnsvTHK3jfbWuC/MzFpNFf7 WiqaYXFcp92NfddO6JMc8cbY3JXb96xt5LW6p7REuUIjqAq7/FUoxTzgiiubRGlllz5q ahcg== X-Gm-Message-State: AO0yUKXfAoMY8B9O7pP+wcVOZrIch2g2dSHf+o+Ji81/z6eFuO6kZGvQ HfFk54nJNcrm6RNzNv/4EgR7NcG81MQ3AG6UPXU= X-Google-Smtp-Source: AK7set8uSZmnlCXwwXXoCK70Lcw86QQGE9L73XLyAWdg5N1XLsih+ramoRaEla5tikN7z3GE/DpEu4AGb935xzgBatc= X-Received: by 2002:a65:6210:0:b0:50a:bf95:34f with SMTP id d16-20020a656210000000b0050abf95034fmr1357258pgv.5.1678729717485; Mon, 13 Mar 2023 10:48:37 -0700 (PDT) MIME-Version: 1.0 References: <20230313173528.GA195204@nathanxps13> In-Reply-To: <20230313173528.GA195204@nathanxps13> From: Yurii Rashkovskii Date: Mon, 13 Mar 2023 10:48:26 -0700 Message-ID: Subject: Re: [PATCH] Extend the length of BackgroundWorker.bgw_library_name To: Nathan Bossart Cc: pgsql-hackers@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000007c150505f6cbb878" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000007c150505f6cbb878 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Nathan, Thank you for your review. Indeed, my motivation for doing the change the way I did it was that only bgw_library_name is expected to be longer, whereas it is much less of a concern for other fields. If we have increased BGW_MAXLEN, it would have increased the size of BackgroundWorker for little to no benefit. On Mon, Mar 13, 2023 at 10:35=E2=80=AFAM Nathan Bossart wrote: > On Mon, Mar 13, 2023 at 07:57:47AM -0700, Yurii Rashkovskii wrote: > > However, there are use cases where [potentially] longer names are > > expected/desired; for example, test benches (where library files may no= t > > [or can not] be copied to Postgres installation) or alternative library > > installation methods that do not put them into $libdir. > > > > The patch is backwards-compatible and ensures that bgw_library_name sta= ys > > *at least* as long as BGW_MAXLEN. Existing external code that uses > > BGW_MAXLEN is a length boundary (for example, in `strncpy`) will contin= ue > > to work as expected. > > I see that BGW_MAXLEN was originally set to 64 in 2013 (7f7485a) [0], but > was increased to 96 in 2018 (3a4b891) [1]. It seems generally reasonable > to me to increase the length of bgw_library_name further for the use-case > you describe, but I wonder if it'd be better to simply increase BGW_MAXLE= N > again. However, IIUC bgw_library_name is the only field that is likely t= o > be used for absolute paths, so only increasing that one to MAXPGPATH make= s > sense. > > [0] > https://postgr.es/m/CA%2BTgmoYtQQ-JqAJPxZg3Mjg7EqugzqQ%2BZBrpnXo95chWMCZs= Xw%40mail.gmail.com > [1] > https://postgr.es/m/304a21ab-a9d6-264a-f688-912869c0d7c6%402ndquadrant.co= m > > -- > Nathan Bossart > Amazon Web Services: https://aws.amazon.com > -- http://omnigres.org Yurii --0000000000007c150505f6cbb878 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Nathan,

Thank you for = your review.=C2=A0

Indeed, my motivation for doing= the change the way I did it was that only bgw_library_name is expected to = be longer, whereas it is much less of a concern for other fields. If we hav= e increased BGW_MAXLEN, it would have increased the size of BackgroundWorke= r for little to no benefit.=C2=A0

On Mon, Mar 13, 2023 at 10:35=E2=80= =AFAM Nathan Bossart <nathan= dbossart@gmail.com> wrote:
On Mon, Mar 13, 2023 at 07:57:47AM -0700, Yurii Rashkovsk= ii wrote:
> However, there are use cases where [potentially] longer names are
> expected/desired; for example, test benches (where library files may n= ot
> [or can not] be copied to Postgres installation) or alternative librar= y
> installation methods that do not put them into $libdir.
>
> The patch is backwards-compatible and ensures that bgw_library_name st= ays
> *at least* as long as BGW_MAXLEN. Existing external code that uses
> BGW_MAXLEN is a length boundary (for example, in `strncpy`) will conti= nue
> to work as expected.

I see that BGW_MAXLEN was originally set to 64 in 2013 (7f7485a) [0], but was increased to 96 in 2018 (3a4b891) [1].=C2=A0 It seems generally reasona= ble
to me to increase the length of bgw_library_name further for the use-case you describe, but I wonder if it'd be better to simply increase BGW_MAX= LEN
again.=C2=A0 However, IIUC bgw_library_name is the only field that is likel= y to
be used for absolute paths, so only increasing that one to MAXPGPATH makes<= br> sense.

[0] http= s://postgr.es/m/CA%2BTgmoYtQQ-JqAJPxZg3Mjg7EqugzqQ%2BZBrpnXo95chWMCZsXw%40m= ail.gmail.com
[1] https://postgr.es/m/30= 4a21ab-a9d6-264a-f688-912869c0d7c6%402ndquadrant.com

--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com


--
--0000000000007c150505f6cbb878--