git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: 5752dcd) | patch
Add static assertions about pg_control fitting into one disk sector.
2017年7月19日 20:16:57 +0000 (16:16 -0400)
2017年7月19日 20:16:57 +0000 (16:16 -0400)
commit 3cb29c42f990522131535eea75c691fb23191685
Add static assertions about pg_control fitting into one disk sector.

When pg_control was first designed, sizeof(ControlFileData) was small
enough that a comment seemed like plenty to document the assumption that
it'd fit into one disk sector. Now it's nearly 300 bytes, raising the
possibility that somebody would carelessly add enough stuff to create
a problem. Let's add a StaticAssertStmt() to ensure that the situation
doesn't pass unnoticed if it ever occurs.

While at it, rename PG_CONTROL_SIZE to PG_CONTROL_FILE_SIZE to make it
clearer what that symbol means, and convert the existing runtime
comparisons of sizeof(ControlFileData) vs. PG_CONTROL_FILE_SIZE to be
static asserts --- we didn't have that technology when this code was
first written.

Discussion: https://postgr.es/m/9192.1500490591@sss.pgh.pa.us
src/backend/access/transam/xlog.c diff | blob | blame | history
src/bin/pg_resetwal/pg_resetwal.c diff | blob | blame | history
src/bin/pg_rewind/pg_rewind.c diff | blob | blame | history
src/include/catalog/pg_control.h diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /