model-writtenrun 8707 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
May - Jun 2017 · 2 entries
- Masahiko Sawada began by replacing heavyweight relation-extension locks with LWLocks stored in a shared hash to support parallel utility work, initially reporting little throughput difference #1.
- Robert Haas identified the loss of interruptibility for LWLock holders and waiters, prompting Sawada to introduce a dedicated atomic lock manager with condition-variable waits #2 #7 #9.
Oct 2017 - Jun 2018 · 10 entries
- After several rebases, Haas found that the draft held a partition LWLock across waits and proposed pin counts, lock-order assertions, and targeted benchmarks #15 #16.
- The discussion considered extending the mechanism to tuple and speculative-insertion locks, but Haas demonstrated deadlock and TOAST/syscache hazards, Tom Lane agreed, and Sawada narrowed the work to relation-extension locks #21 #22 #23.
- Sawada replaced the unsafe waiting arrangement with pin-counted hash reclamation and recursive lock tracking, then added nesting assertions and simplified the unlock interface #24 #27.
- Haas proposed replacing shared locking with a wait-until-free operation and replacing the dynamic hash with a fixed lock array; Sawada implemented both stages and reported roughly tenfold faster lock/unlock microbenchmarks #28 #31 #32 #34.
- Review exposed cancellation-related waiter-count leaks and incorrect shared-relation identities, which Sawada fixed before Haas supplied further cleanup-state, error-handling, and presentation improvements #36 #37 #38 #39 #40.
- Andres Freund objected that array collisions could serialize unrelated relations during slow filesystem operations, and collision tests reported losses ranging from 2–5% in Sawada's tests to 25% at high concurrency in Mithun Cy's tests #41 #44 #52 #53.
- Haas favored common-case speed and simplicity while Freund emphasized partitioning and collision risks, leaving the design unresolved when Michael Paquier returned it with feedback for PostgreSQL 11 #54 #57 #61.
- The disagreement continued over exposing collision information and requiring user tuning, before Sawada supplied another rebase in May 2018 #66 #67 #68 #72.
- Konstantin Knizhnik initially reported an apparent lock leak during customer testing but withdrew that diagnosis, while Alexander Korotkov traced the observed starvation to buffer-related LWLocks and suggested discussing their fairness separately #73 #77 #78 #80 #82.
- Sawada's partition-load tests found small mixed performance changes, and he later withdrew the patch because the narrowed parallel-index-vacuum work no longer required it #84 #87.
Feb - Mar 2020 · 18 entries
- Amit Kapila revived the work in 2020, Sawada rebased it, and Mahendra Singh Thalor reviewed and benchmarked the renewed implementation, including partition and collision workloads #88 #89 #90 #94 #95.
- Tom Lane questioned the complexity of a separate manager, Andres profiled expensive operations performed under the extension lock, and Amit clarified that the essential goal was safe conflicts among parallel workers rather than lock-speed improvements alone #98 #100 #103.
- After renewed debate over interruptibility, Andres advocated adapting the existing heavyweight manager, Haas proposed enforcing lock-order invariants so extension and page locks could be excluded from deadlock traversal, and Amit distilled that approach into three implementation steps #112 #115 #117 #119 #126.
- Mahendra posted the first implementation of that alternative, crediting Dilip Kumar with the conflict/deadlock patch and himself with the assertion patch; Amit's review then required permitting recursive acquisition of the same extension lock #127 #130 #132.
- Haas objected to scanning the local-lock hash for every assertion, and Sawada identified the corresponding page-lock requirement through GIN cleanup, leading Dilip to introduce counters and a separate page-lock component #134 #144 #151.
- Amit audited acquisition paths to establish that page locks may precede extension locks but not the reverse, while Haas rejected transaction-level bookkeeping and explained the tradeoffs among LWLocks, another lock manager, and adapting heavyweight locks #152 #153 #154.
- Dilip replaced counters and transaction hooks with a flag maintained inside lock.c, and Amit's subsequent review moved maintenance into GrantLockLocal and RemoveLocalLock #161 #167.
- Amit revised the conflict patch and supplied a testing extension that demonstrated a parallel-group member correctly waiting for its leader's extension lock; this testing extension was not included in the final production series #162.
- Amit deliberately retained existing group-member queue priority and documented that choice in ProcSleep, after which Dilip combined both development branches into four separate assertion and conflict patches #171 #173 #174.
- Amit supplied polished comments and commit descriptions, while Dilip demonstrated that the patch removed false GIN page-lock deadlocks and simplified flag maintenance into one helper #175 #176 #177.
- Further testing confirmed that deliberately invalid lock acquisition triggered the new assertion and legitimate GIN page-to-extension locking still worked, with the latter already covered by existing regression tests #182 #185.
- Sawada requested removing bookkeeping overhead from non-assertion builds, and Kuntal reviewed comments and reported successful group-lock testing, leading to assertion-only bookkeeping and final comment corrections #183 #184 #186 #187.
- Amit consolidated conditional compilation and updated the planner explanation in the final four-patch submission, which Dilip retested successfully #188 #189.
- The extension-lock ordering assertion landed unchanged from the first component of the final submission as 15ef6ff4b9, and the thread's last message reported that landing while promising the remaining patches in coming days #188 #190.
- The page-lock ordering assertion subsequently landed unchanged from the second component as 72e78d831a, enforcing the invariant that makes page-lock deadlock exclusion safe #188.
- The extension-lock conflict change landed unchanged from the third component as 85f6b49c2c, making parallel-group members conflict while excluding extension-lock wait edges from deadlock detection #188.
- The page-lock conflict change completed the series as 3ba59ccc89, unchanged from the fourth component, extending the same treatment to page locks and updating explanatory documentation #188.
- The delivered design therefore kept extension and page locks in the heavyweight manager and established infrastructure for future parallel inserts and COPY, leaving the separate lock manager aside and parallel update/delete issues unresolved #188.