You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Simplify LWLock tranche machinery by removing array_base/array_stride.
array_base and array_stride were added so that we could identify theoffset of an LWLock within a tranche, but this facility is only verymarginally used apart from the main tranche. So, give every lock inthe main tranche its own tranche ID and get rid of array_base,array_stride, and all that's attached. For debugging facilities(Trace_lwlocks and LWLOCK_STATS) print the pointer address of theLWLock using %p instead of the offset. This is arguably more useful,and certainly a lot cheaper. Drop the offset-within-tranche fromthe information reported to dtrace and from one can't-happen messageinside lwlock.c.The main user-visible impact of this change is that pg_stat_activitywill now report all waits for LWLocks as "LWLock" rather thanreporting some as "LWLockTranche" and others as "LWLockNamed".The main motivation for this change is that the need to specify anarray_base and an array_stride is awkward for parallel query. Thereis only a very limited supply of tranche IDs so we can't just keepallocating new ones, and if we try to use the same tranche IDs everytime then we run into trouble when multiple parallel contexts areuse simultaneously. So if we didn't get rid of this mechanism we'dhave to make it even more complicated. By simplifying it in thisway, we instead reduce the size of the generated code for lwlock.cby about 5%.Discussion:http://postgr.es/m/CA+TgmoYsFn6NUW1x0AZtupJGUAs1UDY4dJtCN47_Q6D0sP80PA@mail.gmail.com