From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
Cc: | Andres Freund <andres(at)anarazel(dot)de>, Daniel Gustafsson <daniel(at)yesql(dot)se>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Avoid overflow with simplehash |
Date: | 2023-07-06 15:16:26 |
Message-ID: | 1211829.1688656586@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> writes:
> See the comments:
> "Search for the first empty element."
> If the empty element is not found, startelem has PG_UINT64_MAX value,
> which do not fit in uint32.
I think the point of that assertion is exactly that we're required to
have an empty element (because max fillfactor is less than 1),
so the search should have succeeded.
It does seem like we could do
uint64 startelem = SH_MAX_SIZE;
...
Assert(startelem < SH_MAX_SIZE);
which'd make it a little clearer that the expectation is for
startelem to have changed value. And I agree that declaring "i"
as int is wrong.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2023-07-06 15:19:13 | Re: [PATCH] Add GitLab CI to PostgreSQL |
Previous Message | Önder Kalacı | 2023-07-06 15:11:10 | Re: [Patch] Use *other* indexes on the subscriber when REPLICA IDENTITY is FULL |