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
.gitignore
base64.c
config_info.c
controldata_utils.c Try to handle torn reads of pg_control in frontend. 2023-10-16 17:25:43 +13:00
d2s.c
d2s_full_table.h
d2s_intrinsics.h
digit_table.h
exec.c Make EXEC_BACKEND more convenient on Linux and FreeBSD. 2023-02-08 13:09:52 +09:00
f2s.c
fe_memutils.c
file_perm.c
file_utils.c
ip.c
keywords.c
kwlookup.c
link-canary.c
logging.c Fix command-line colorization on Windows with VT100-compatible environments 2020-03-02 15:46:24 +09:00
Makefile
md5.c
pg_lzcompress.c
pgfnames.c
psprintf.c
relpath.c
restricted_token.c
rmtree.c
ryu_common.h
saslprep.c
scram-common.c
sha2.c
sha2_openssl.c
string.c
unicode_norm.c Fix buffer overrun in unicode string normalization with empty input 2021-11-11 15:01:57 +09:00
username.c
wait_error.c