Re: [PATCH] Check more invariants during syscache initialization

From: Zhang Mingli <zmlpostgres(at)gmail(dot)com>
To: Aleksander Alekseev <aleksander(at)timescale(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Michael Paquier <michael(at)paquier(dot)xyz>
Subject: Re: [PATCH] Check more invariants during syscache initialization
Date: 2023-07-26 13:29:53
Message-ID: 63812D43-161D-4E08-A825-B72184C711C4@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

HI,

> On Jul 26, 2023, at 20:50, Aleksander Alekseev <aleksander(at)timescale(dot)com> wrote:
>
> Hi Michael,
>
>> That was more a question. I was wondering if it was something you've
>> noticed while working on a different patch because you somewhat
>> assigned incorrect values in the syscache array, but it looks like you
>> have noticed that while scanning the code.
>
> Oh, got it. That's correct.
>
>> Still it's hard to miss at compile time. I think that I would remove
>> this one.
>
> Fair enough. Here is the updated patch.
>
> --
> Best regards,
> Aleksander Alekseev
> <v2-0001-Check-more-invariants-during-syscache-initializat.patch>

LGTM.

```
- Assert(cacheinfo[cacheId].reloid != 0);
+ Assert(cacheinfo[cacheId].reloid != InvalidOid);
```

That remind me to have a look other codes, and a grep search `oid != 0` show there are several files using old != 0.

```
.//src/bin/pg_resetwal/pg_resetwal.c: if (set_oid != 0)
.//src/bin/pg_resetwal/pg_resetwal.c: if (set_oid != 0)
.//src/bin/pg_dump/pg_backup_tar.c: if (oid != 0)
.//src/bin/pg_dump/pg_backup_custom.c: while (oid != 0)
.//src/bin/pg_dump/pg_backup_custom.c: while (oid != 0)
```
That is another story…I would like provide a patch if it worths.

Zhang Mingli
https://www.hashdata.xyz

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2023-07-26 13:41:48 Re: Optimizing nbtree ScalarArrayOp execution, allowing multi-column ordered scans, skip scan
Previous Message Aleksander Alekseev 2023-07-26 13:20:49 Re: Remove unused fields in ReorderBufferTupleBuf