Thanks for reviewing!

> === 1
>
> We need to check if tranche_name is NULL and report an error if that's the 
> case.
> If not, strlen() would segfault.

Added an error. Good call. The error message follows previously used
convention.

```
+       if (!tranche_name)
+               elog(ERROR, "tranche name cannot be null");
```

> === 2
>
> +       if (tranche_name_length > MAX_NAMED_TRANCHES_NAME_LEN)
> +               elog(ERROR, "tranche name too long");
>
> I think that we should mention in the doc that the tranche name is limited to
> 63 bytes.

Done. I just mentioned NAMEDATALEN -1 in the docs.

> === 3
>
> I was skeptical about using strcpy() while we hold a spinlock. I do see some
> examples with strlcpy() though (walreceiver.c for example), so that looks 
> OK-ish.
>
> Using strcpy() might be OK too, as we already have validated the length, but 
> maybe
> it would be safer to switch to strlcpy(), instead?

OK, since that is the pattern used, I changed to strlcpy. But since we are doing
checks in advance, I think it will be safe either way.

--
Sami

Attachment: v14-0003-Remove-the-DSA-suffix-for-tranches-created-with-.patch
Description: Binary data

Attachment: v14-0001-Improve-LWLock-tranche-registration.patch
Description: Binary data

Attachment: v14-0002-Tests-for-LWLock-tranche-registration-improvemen.patch
Description: Binary data

Reply via email to