postgresql/src/common
Thomas Munro 43c9790868 Try to handle torn reads of pg_control in frontend.
Some of our src/bin tools read the control file without any kind of
interlocking against concurrent writes from the server.  At least ext4
and ntfs can expose partially modified contents when you do that.

For now, we'll try to tolerate this by retrying up to 10 times if the
checksum doesn't match, until we get two reads in a row with the same
bad checksum.  This is not guaranteed to reach the right conclusion, but
it seems very likely to.  Thanks to Tom Lane for this suggestion.

Various ideas for interlocking or atomicity were considered too
complicated, unportable or expensive given the lack of field reports,
but remain open for future reconsideration.

Back-patch as far as 12.  It doesn't seem like a good idea to put a
heuristic change for a very rare problem into the final release of 11.

Reviewed-by: Anton A. Melnikov <aamelnikov@inbox.ru>
Reviewed-by: David Steele <david@pgmasters.net>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/20221123014224.xisi44byq3cf5psi%40awork3.anarazel.de
2023-10-16 17:25:43 +13:00
..
unicode Make script output more pgindent compatible 2019-06-24 22:50:56 +02:00
.gitignore Replace the data structure used for keyword lookup. 2019-01-06 17:02:57 -05:00
Makefile Move logging.h and logging.c from src/fe_utils/ to src/common/. 2019-05-14 14:20:10 -04:00
base64.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
config_info.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
controldata_utils.c Try to handle torn reads of pg_control in frontend. 2023-10-16 17:25:43 +13:00
d2s.c Initial pgindent run for v12. 2019-05-22 12:55:34 -04:00
d2s_full_table.h Change floating-point output format for improved performance. 2019-02-13 15:20:33 +00:00
d2s_intrinsics.h Change floating-point output format for improved performance. 2019-02-13 15:20:33 +00:00
digit_table.h Change floating-point output format for improved performance. 2019-02-13 15:20:33 +00:00
exec.c Make EXEC_BACKEND more convenient on Linux and FreeBSD. 2023-02-08 13:09:52 +09:00
f2s.c Initial pgindent run for v12. 2019-05-22 12:55:34 -04:00
fe_memutils.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
file_perm.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
file_utils.c Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
ip.c Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
keywords.c Replace the data structure used for keyword lookup. 2019-01-06 17:02:57 -05:00
kwlookup.c Use perfect hashing, instead of binary search, for keyword lookup. 2019-01-09 19:47:46 -05:00
link-canary.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
logging.c Fix command-line colorization on Windows with VT100-compatible environments 2020-03-02 15:46:24 +09:00
md5.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_lzcompress.c Initial pgindent run for v12. 2019-05-22 12:55:34 -04:00
pgfnames.c Move logging.h and logging.c from src/fe_utils/ to src/common/. 2019-05-14 14:20:10 -04:00
psprintf.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
relpath.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
restricted_token.c Move logging.h and logging.c from src/fe_utils/ to src/common/. 2019-05-14 14:20:10 -04:00
rmtree.c Initial pgindent run for v12. 2019-05-22 12:55:34 -04:00
ryu_common.h Change floating-point output format for improved performance. 2019-02-13 15:20:33 +00:00
saslprep.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
scram-common.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
sha2.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
sha2_openssl.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
string.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
unicode_norm.c Fix buffer overrun in unicode string normalization with empty input 2021-11-11 15:01:57 +09:00
username.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
wait_error.c Update copyright for 2019 2019-01-02 12:44:25 -05:00