RE: [HACKERS] logical decoding of two-phase transactions

From: "wangsh(dot)fnst(at)fujitsu(dot)com" <wangsh(dot)fnst(at)fujitsu(dot)com>
To: 'Peter Smith' <smithpb2250(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, "osumi(dot)takamichi(at)fujitsu(dot)com" <osumi(dot)takamichi(at)fujitsu(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>
Subject: RE: [HACKERS] logical decoding of two-phase transactions
Date: 2021-03-14 02:52:05
Message-ID: OSBPR01MB4214B06BF99D6C5444B83D7CF26D9@OSBPR01MB4214.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I noticed in patch v58-0001-Add-support-for-apply-at-prepare-time-to-built-i.patch

> +static void
> +prepare_spoolfile_name(char *path, int szpath, Oid subid, char *gid)
> +{
> + PsfHashEntry *hentry;
> +
> + /*
> + * This name is used as the key in the psf_hash HTAB. Therefore, the name
> + * and the key must be exactly same lengths and padded with '\0' so
> + * garbage does not impact the HTAB lookups.
> + */
> + Assert(sizeof(hentry->name) == MAXPGPATH);
> + Assert(szpath == MAXPGPATH);
> + memset(path, '\0', MAXPGPATH);
> +
> + snprintf(path, MAXPGPATH, "%s/psf_%u_%s.changes", PSF_DIR, subid, gid);
> +}

The variable hentry is only used when --enable-cassert is specified, it will be a warning if I don't specify the
--enable-cassert when execute configure

And the comment says the lengths are same, I think ' Assert(sizeof(hentry->name) == szpath) ' will be better.

Best regards.
Shenhao Wang

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2021-03-14 03:23:21 Re: New IndexAM API controlling index vacuum strategies
Previous Message Thomas Munro 2021-03-14 02:35:23 Re: A qsort template