postgresql/src/include/storage
Noah Misch 0cecc908e9 Lock before setting relhassubclass on RELKIND_PARTITIONED_INDEX.
Commit 5b562644fe added a comment that
SetRelationHasSubclass() callers must hold this lock.  When commit
17f206fbc8 extended use of this column to
partitioned indexes, it didn't take the lock.  As the latter commit
message mentioned, we currently never reset a partitioned index to
relhassubclass=f.  That largely avoids harm from the lock omission.  The
cause for fixing this now is to unblock introducing a rule about locks
required to heap_update() a pg_class row.  This might cause more
deadlocks.  It gives minor user-visible benefits:

- If an ALTER INDEX SET TABLESPACE runs concurrently with ALTER TABLE
  ATTACH PARTITION or CREATE PARTITION OF, one transaction blocks
  instead of failing with "tuple concurrently updated".  (Many cases of
  DDL concurrency still fail that way.)

- Match ALTER INDEX ATTACH PARTITION in choosing to lock the index.

While not user-visible today, we'll need this if we ever make something
set the flag to false for a partitioned index, like ANALYZE does today
for tables.  Back-patch to v12 (all supported versions), the plan for
the commit relying on the new rule.  In back branches, add
LockOrStrongerHeldByMe() instead of adding a LockHeldByMe() parameter.

Reviewed (in an earlier version) by Robert Haas.

Discussion: https://postgr.es/m/20240611024525.9f.nmisch@google.com
2024-06-27 19:21:05 -07:00
..
.gitignore When trace_lwlocks is used, identify individual lwlocks by name. 2015-09-11 14:01:39 -04:00
barrier.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
block.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
buf.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
buf_internals.h Add missing PGDLLIMPORT markings 2024-01-16 13:53:28 +02:00
buffile.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
bufmgr.h Harmonize function parameter names for Postgres 17. 2024-06-12 17:01:51 -04:00
bufpage.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
bulk_write.h Fix compiler warning on typedef redeclaration 2024-02-23 17:39:27 +02:00
checksum.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
checksum_impl.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
condition_variable.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
copydir.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
dsm.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
dsm_impl.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
dsm_registry.h Introduce the dynamic shared memory registry. 2024-01-19 14:24:36 -06:00
fd.h Harmonize function parameter names for Postgres 17. 2024-06-12 17:01:51 -04:00
fileset.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
freespace.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
fsm_internals.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
indexfsm.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
ipc.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
item.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
itemid.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
itemptr.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
large_object.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
latch.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
lmgr.h Lock before setting relhassubclass on RELKIND_PARTITIONED_INDEX. 2024-06-27 19:21:05 -07:00
lock.h Lock before setting relhassubclass on RELKIND_PARTITIONED_INDEX. 2024-06-27 19:21:05 -07:00
lockdefs.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
lwlock.h Use TidStore for dead tuple TIDs storage during lazy vacuum. 2024-04-02 10:15:37 +09:00
lwlocklist.h Add wait event type "InjectionPoint", a custom type like "Extension". 2024-06-27 19:21:05 -07:00
md.h Introduce a new smgr bulk loading facility. 2024-02-23 16:10:51 +02:00
meson.build Rework lwlocknames.txt to become lwlocklist.h 2024-03-20 11:55:20 +01:00
off.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_sema.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_shmem.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
pmsignal.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
predicate.h Improve performance of subsystems on top of SLRU 2024-02-28 17:05:31 +01:00
predicate_internals.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
proc.h Fix typos and duplicate words 2024-04-18 21:28:07 +02:00
procarray.h Replace BackendIds with 0-based ProcNumbers 2024-03-03 19:38:22 +02:00
proclist.h Replace BackendIds with 0-based ProcNumbers 2024-03-03 19:38:22 +02:00
proclist_types.h Replace BackendIds with 0-based ProcNumbers 2024-03-03 19:38:22 +02:00
procnumber.h Replace BackendIds with 0-based ProcNumbers 2024-03-03 19:38:22 +02:00
procsignal.h Replace BackendIds with 0-based ProcNumbers 2024-03-03 19:38:22 +02:00
read_stream.h Harmonize function parameter names for Postgres 17. 2024-06-12 17:01:51 -04:00
reinit.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
relfilelocator.h Replace BackendIds with 0-based ProcNumbers 2024-03-03 19:38:22 +02:00
s_lock.h Remove AIX support 2024-02-28 15:17:23 +04:00
sharedfileset.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
shm_mq.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
shm_toc.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
shmem.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
sinval.h Replace BackendIds with 0-based ProcNumbers 2024-03-03 19:38:22 +02:00
sinvaladt.h Redefine backend ID to be an index into the proc array 2024-03-03 19:37:28 +02:00
smgr.h Harmonize function parameter names for Postgres 17. 2024-06-12 17:01:51 -04:00
spin.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
standby.h Fix MVCC bug with prepared xact with subxacts on standby 2024-06-27 21:09:58 +03:00
standbydefs.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
sync.h Update copyright for 2024 2024-01-03 20:49:05 -05:00