forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit3cb29c4
committed
Add static assertions about pg_control fitting into one disk sector.
When pg_control was first designed, sizeof(ControlFileData) was smallenough that a comment seemed like plenty to document the assumption thatit'd fit into one disk sector. Now it's nearly 300 bytes, raising thepossibility that somebody would carelessly add enough stuff to createa problem. Let's add a StaticAssertStmt() to ensure that the situationdoesn't pass unnoticed if it ever occurs.While at it, rename PG_CONTROL_SIZE to PG_CONTROL_FILE_SIZE to make itclearer what that symbol means, and convert the existing runtimecomparisons of sizeof(ControlFileData) vs. PG_CONTROL_FILE_SIZE to bestatic asserts --- we didn't have that technology when this code wasfirst written.Discussion:https://postgr.es/m/9192.1500490591@sss.pgh.pa.us1 parent5752dcd commit3cb29c4
File tree
4 files changed
+58
-37
lines changed- src
- backend/access/transam
- bin
- pg_resetwal
- pg_rewind
- include/catalog
4 files changed
+58
-37
lines changedLines changed: 14 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4376 | 4376 |
| |
4377 | 4377 |
| |
4378 | 4378 |
| |
4379 |
| - | |
| 4379 | + | |
| 4380 | + | |
| 4381 | + | |
| 4382 | + | |
| 4383 | + | |
| 4384 | + | |
| 4385 | + | |
| 4386 | + | |
| 4387 | + | |
| 4388 | + | |
4380 | 4389 |
| |
4381 | 4390 |
| |
4382 | 4391 |
| |
| |||
4409 | 4418 |
| |
4410 | 4419 |
| |
4411 | 4420 |
| |
4412 |
| - | |
4413 |
| - | |
| 4421 | + | |
| 4422 | + | |
4414 | 4423 |
| |
4415 | 4424 |
| |
4416 | 4425 |
| |
4417 | 4426 |
| |
4418 |
| - | |
4419 |
| - | |
4420 |
| - | |
4421 |
| - | |
| 4427 | + | |
4422 | 4428 |
| |
4423 | 4429 |
| |
4424 | 4430 |
| |
| |||
4432 | 4438 |
| |
4433 | 4439 |
| |
4434 | 4440 |
| |
4435 |
| - | |
| 4441 | + | |
4436 | 4442 |
| |
4437 | 4443 |
| |
4438 | 4444 |
| |
|
Lines changed: 16 additions & 15 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
552 | 552 |
| |
553 | 553 |
| |
554 | 554 |
| |
555 |
| - | |
| 555 | + | |
556 | 556 |
| |
557 |
| - | |
| 557 | + | |
558 | 558 |
| |
559 | 559 |
| |
560 | 560 |
| |
| |||
834 | 834 |
| |
835 | 835 |
| |
836 | 836 |
| |
837 |
| - | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
838 | 847 |
| |
839 | 848 |
| |
840 | 849 |
| |
| |||
878 | 887 |
| |
879 | 888 |
| |
880 | 889 |
| |
881 |
| - | |
882 |
| - | |
| 890 | + | |
| 891 | + | |
883 | 892 |
| |
884 | 893 |
| |
885 | 894 |
| |
886 | 895 |
| |
887 |
| - | |
888 |
| - | |
889 |
| - | |
890 |
| - | |
891 |
| - | |
892 |
| - | |
893 |
| - | |
894 |
| - | |
895 |
| - | |
| 896 | + | |
896 | 897 |
| |
897 | 898 |
| |
898 | 899 |
| |
| |||
908 | 909 |
| |
909 | 910 |
| |
910 | 911 |
| |
911 |
| - | |
| 912 | + | |
912 | 913 |
| |
913 | 914 |
| |
914 | 915 |
| |
|
Lines changed: 16 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
625 | 625 |
| |
626 | 626 |
| |
627 | 627 |
| |
628 |
| - | |
| 628 | + | |
629 | 629 |
| |
630 |
| - | |
| 630 | + | |
631 | 631 |
| |
632 | 632 |
| |
633 | 633 |
| |
| |||
641 | 641 |
| |
642 | 642 |
| |
643 | 643 |
| |
644 |
| - | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
645 | 654 |
| |
646 | 655 |
| |
647 | 656 |
| |
| |||
651 | 660 |
| |
652 | 661 |
| |
653 | 662 |
| |
654 |
| - | |
655 |
| - | |
| 663 | + | |
| 664 | + | |
656 | 665 |
| |
657 | 666 |
| |
658 |
| - | |
| 667 | + | |
659 | 668 |
| |
660 | 669 |
| |
661 | 670 |
| |
662 | 671 |
| |
663 |
| - | |
| 672 | + | |
664 | 673 |
| |
665 | 674 |
| |
666 | 675 |
| |
|
Lines changed: 12 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
23 |
| - | |
24 |
| - | |
25 | 23 |
| |
26 | 24 |
| |
27 | 25 |
| |
| 26 | + | |
| 27 | + | |
| 28 | + | |
28 | 29 |
| |
29 | 30 |
| |
30 | 31 |
| |
| |||
94 | 95 |
| |
95 | 96 |
| |
96 | 97 |
| |
97 |
| - | |
98 |
| - | |
99 |
| - | |
100 |
| - | |
101 | 98 |
| |
102 | 99 |
| |
103 | 100 |
| |
| |||
235 | 232 |
| |
236 | 233 |
| |
237 | 234 |
| |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
238 | 243 |
| |
239 | 244 |
| |
240 | 245 |
| |
241 | 246 |
| |
242 | 247 |
| |
243 | 248 |
| |
244 | 249 |
| |
245 |
| - | |
| 250 | + | |
246 | 251 |
| |
247 | 252 |
|
0 commit comments
Comments
(0)