Commit 2ada677
committed
Fix race condition in relcache init file invalidation.
The previous code tried to synchronize by unlinking the init file twice,
but that doesn't actually work: it leaves a window wherein a third process
could read the already-stale init file but miss the SI messages that would
tell it the data is stale. The result would be bizarre failures in catalog
accesses, typically "could not read block 0 in file ..." later during
startup.
Instead, hold RelCacheInitLock across both the unlink and the sending of
the SI messages. This is more straightforward, and might even be a bit
faster since only one unlink call is needed.
This has been wrong since it was put in (in 2002!), so back-patch to all
supported releases.1 parent 1bb6924 commit 2ada677
File tree
4 files changed
+57
-49
lines changed- src
- backend
- access/transam
- utils/cache
- include/utils
4 files changed
+57
-49
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1356 | 1356 | | |
1357 | 1357 | | |
1358 | 1358 | | |
1359 | | - | |
| 1359 | + | |
1360 | 1360 | | |
1361 | 1361 | | |
1362 | | - | |
| 1362 | + | |
1363 | 1363 | | |
1364 | 1364 | | |
1365 | 1365 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
854 | 854 | | |
855 | 855 | | |
856 | 856 | | |
857 | | - | |
858 | | - | |
859 | | - | |
860 | | - | |
861 | | - | |
862 | | - | |
863 | | - | |
864 | | - | |
865 | 857 | | |
866 | 858 | | |
867 | 859 | | |
868 | 860 | | |
869 | 861 | | |
870 | 862 | | |
871 | | - | |
872 | | - | |
873 | | - | |
874 | | - | |
875 | 863 | | |
876 | 864 | | |
877 | 865 | | |
| |||
885 | 873 | | |
886 | 874 | | |
887 | 875 | | |
888 | | - | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
889 | 890 | | |
890 | 891 | | |
891 | 892 | | |
892 | 893 | | |
893 | | - | |
| 894 | + | |
894 | 895 | | |
895 | 896 | | |
896 | 897 | | |
| |||
931 | 932 | | |
932 | 933 | | |
933 | 934 | | |
934 | | - | |
| 935 | + | |
935 | 936 | | |
936 | 937 | | |
937 | 938 | | |
| |||
940 | 941 | | |
941 | 942 | | |
942 | 943 | | |
943 | | - | |
| 944 | + | |
944 | 945 | | |
945 | 946 | | |
946 | 947 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4377 | 4377 | | |
4378 | 4378 | | |
4379 | 4379 | | |
4380 | | - | |
4381 | | - | |
| 4380 | + | |
| 4381 | + | |
4382 | 4382 | | |
4383 | 4383 | | |
4384 | 4384 | | |
| |||
4442 | 4442 | | |
4443 | 4443 | | |
4444 | 4444 | | |
4445 | | - | |
4446 | | - | |
4447 | | - | |
4448 | | - | |
4449 | | - | |
4450 | | - | |
4451 | | - | |
4452 | | - | |
4453 | | - | |
4454 | | - | |
| 4445 | + | |
| 4446 | + | |
| 4447 | + | |
| 4448 | + | |
| 4449 | + | |
| 4450 | + | |
| 4451 | + | |
| 4452 | + | |
| 4453 | + | |
| 4454 | + | |
| 4455 | + | |
| 4456 | + | |
4455 | 4457 | | |
4456 | | - | |
4457 | | - | |
| 4458 | + | |
| 4459 | + | |
| 4460 | + | |
4458 | 4461 | | |
4459 | 4462 | | |
4460 | 4463 | | |
| |||
4464 | 4467 | | |
4465 | 4468 | | |
4466 | 4469 | | |
4467 | | - | |
| 4470 | + | |
4468 | 4471 | | |
4469 | 4472 | | |
4470 | 4473 | | |
4471 | 4474 | | |
4472 | 4475 | | |
4473 | 4476 | | |
4474 | | - | |
4475 | | - | |
4476 | | - | |
4477 | | - | |
4478 | | - | |
4479 | | - | |
| 4477 | + | |
| 4478 | + | |
| 4479 | + | |
4480 | 4480 | | |
4481 | 4481 | | |
4482 | | - | |
4483 | | - | |
4484 | | - | |
4485 | | - | |
4486 | | - | |
4487 | | - | |
| 4482 | + | |
| 4483 | + | |
| 4484 | + | |
| 4485 | + | |
4488 | 4486 | | |
4489 | | - | |
4490 | | - | |
4491 | | - | |
| 4487 | + | |
| 4488 | + | |
| 4489 | + | |
| 4490 | + | |
| 4491 | + | |
4492 | 4492 | | |
4493 | 4493 | | |
4494 | 4494 | | |
| 4495 | + | |
| 4496 | + | |
| 4497 | + | |
| 4498 | + | |
| 4499 | + | |
| 4500 | + | |
4495 | 4501 | | |
4496 | 4502 | | |
4497 | 4503 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
| 102 | + | |
102 | 103 | | |
103 | 104 | | |
104 | 105 | | |
| |||
0 commit comments