postgresql/src/backend
Thomas Munro 5e7608e81e Fix lock assertions in dshash.c.
dshash.c previously maintained flags to be able to assert that you
didn't hold any partition lock.  These flags could get out of sync with
reality in error scenarios.

Get rid of all that, and make assertions about the locks themselves
instead.  Since LWLockHeldByMe() loops internally, we don't want to put
that inside another loop over all partition locks.  Introduce a new
debugging-only interface LWLockAnyHeldByMe() to avoid that.

This problem was noted by Tom and Andres while reviewing changes to
support the new shared memory stats system, and later showed up in
reality while working on commit 389869af.

Back-patch to 11, where dshash.c arrived.

Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Reported-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
Reviewed-by: Zhihong Yu <zyu@yugabyte.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/20220311012712.botrpsikaufzteyt@alap3.anarazel.de
Discussion: https://postgr.es/m/CA%2BhUKGJ31Wce6HJ7xnVTKWjFUWQZPBngxfJVx4q0E98pDr3kAw%40mail.gmail.com
2022-07-11 15:47:12 +12:00
..
access Fix visibility check when XID is committed in CLOG but not in procarray. 2022-06-27 08:24:30 +03:00
bootstrap Rethink definition of pg_attribute.attcompression. 2021-05-27 13:24:27 -04:00
catalog Make relation-enumerating operations be security-restricted operations. 2022-05-09 08:35:12 -07:00
commands CREATE INDEX: use the original userid for more ACL checks. 2022-06-25 09:07:44 -07:00
executor Fix SPI's handling of errors during transaction commit. 2022-06-22 12:11:59 -04:00
foreign Update copyright for 2021 2021-01-02 13:06:25 -05:00
jit Back-patch LLVM 14 API changes. 2022-03-16 11:42:00 +13:00
lib Fix lock assertions in dshash.c. 2022-07-11 15:47:12 +12:00
libpq Remove misguided SSL key file ownership check in libpq. 2022-05-26 14:14:05 -04:00
main Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodes Fix assorted missing logic for GroupingFunc nodes. 2022-03-21 17:44:29 -04:00
optimizer Fix incorrect row estimates used for Memoize costing 2022-05-16 16:08:37 +12:00
parser Fix alias matching in transformLockingClause(). 2022-07-07 13:08:03 +01:00
partitioning Avoid using ambiguous word "non-negative" in error messages. 2021-07-28 01:21:35 +09:00
po Translation updates 2022-06-13 07:32:39 +02:00
port Reject huge_pages=on if shared_memory_type=sysv. 2021-10-26 13:09:00 +13:00
postmaster Wake up for latches in CheckpointWriteDelay(). 2022-03-16 13:57:07 +13:00
regex Make pg_regexec() robust against out-of-range search_start. 2021-09-11 15:19:43 -04:00
replication Fix memory leak due to LogicalRepRelMapEntry.attrmap. 2022-06-23 09:20:41 +05:30
rewrite Fix incautious CTE matching in rewriteSearchAndCycle(). 2022-04-23 12:16:12 -04:00
snowball Update snowball 2021-02-19 08:10:15 +01:00
statistics Build inherited extended stats on partitioned tables 2022-01-15 19:05:22 +01:00
storage Fix lock assertions in dshash.c. 2022-07-11 15:47:12 +12:00
tcop Fix SPI's handling of errors during transaction commit. 2022-06-22 12:11:59 -04:00
tsearch Fix typos and grammar in comments and docs 2021-04-19 11:32:30 +09:00
utils Remove %error-verbose directive from jsonpath parser 2022-07-03 17:16:11 -04:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
Makefile Use sort_template.h for qsort_tuple() and qsort_ssup(). 2021-03-03 17:02:32 +13:00
nls.mk Translation updates 2021-09-20 16:23:13 +02:00