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

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: af51fea) | patch
Don't be so trusting that shm_toc_lookup() will always succeed.
Mon, 5 Jun 2017 16:05:42 +0000 (12:05 -0400)
Mon, 5 Jun 2017 16:05:42 +0000 (12:05 -0400)
commit d4663350646ca0c069a36d906155a0f7e3372eb7
Don't be so trusting that shm_toc_lookup() will always succeed.

Given the possibility of race conditions and so on, it seems entirely
unsafe to just assume that shm_toc_lookup() always finds the key it's
looking for --- but that was exactly what all but one call site were
doing. To fix, add a "bool noError" argument, similarly to what we
have in many other functions, and throw an error on an unexpected
lookup failure. Remove now-redundant Asserts that a rather random
subset of call sites had.

I doubt this will throw any light on buildfarm member lorikeet's
recent failures, because if an unnoticed lookup failure were involved,
you'd kind of expect a null-pointer-dereference crash rather than the
observed symptom. But you never know ... and this is better coding
practice even if it never catches anything.

Discussion: https://postgr.es/m/9697.1496675981@sss.pgh.pa.us
src/backend/access/transam/parallel.c diff | blob | blame | history
src/backend/executor/execParallel.c diff | blob | blame | history
src/backend/executor/nodeBitmapHeapscan.c diff | blob | blame | history
src/backend/executor/nodeCustom.c diff | blob | blame | history
src/backend/executor/nodeForeignscan.c diff | blob | blame | history
src/backend/executor/nodeIndexonlyscan.c diff | blob | blame | history
src/backend/executor/nodeIndexscan.c diff | blob | blame | history
src/backend/executor/nodeSeqscan.c diff | blob | blame | history
src/backend/storage/ipc/shm_toc.c diff | blob | blame | history
src/include/storage/shm_toc.h diff | blob | blame | history
src/test/modules/test_shm_mq/worker.c diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

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