From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Code review for shm_toc.h/.c. |
Date: | 2017-06-05 18:51:10 |
Message-ID: | E1dHx5q-0004cv-MK@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Code review for shm_toc.h/.c.
Declare the toc_nentry field as uint32 not Size. Since shm_toc_lookup()
reads the field without any lock, it has to be atomically readable, and
we do not assume that for fields wider than 32 bits. Performance would
be impossibly bad for entry counts approaching 2^32 anyway, so there is
no need to try to preserve maximum width here.
This is probably an academic issue, because even if reading int64 isn't
atomic, the high order half would never change in practice. Still, it's
a coding rule violation, so let's fix it.
Adjust some other not-terribly-well-chosen data types too, and copy-edit
some comments. Make shm_toc_attach's Asserts consistent with
shm_toc_create's.
None of this looks to be a live bug, so no need for back-patch.
Discussion: https://postgr.es/m/16984.1496679541@sss.pgh.pa.us
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/3e60c6f72328a9ad14d8a087411cd394752c5b23
Modified Files
--------------
src/backend/storage/ipc/shm_toc.c | 40 +++++++++++++++++++++------------------
src/include/storage/shm_toc.h | 15 ++++++++-------
2 files changed, 30 insertions(+), 25 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2017-06-05 23:12:00 | pgsql: Fix record length computation in pg_waldump/xlogdump. |
Previous Message | Andrew Dunstan | 2017-06-05 18:29:43 | pgsql: Find openssl lib files in right directory for MSVC |