Fix comment in LockReleaseAll() on when locallock->nLock can be zero
authorHeikki Linnakangas <[email protected]>
Mon, 4 Nov 2024 13:31:46 +0000 (15:31 +0200)
committerHeikki Linnakangas <[email protected]>
Mon, 4 Nov 2024 13:31:46 +0000 (15:31 +0200)
We reach this case also e.g. when a deadlock is detected, not only
when we run out of memory.

Reviewed-by: Maxim Orlov
Discussion: https://www.postgresql.org/message-id/7c2090cd-a72a-4e34-afaa-6dd2ef31440e@iki.fi

src/backend/storage/lmgr/lock.c

index 59ca97ba025f7572e326cc92d7701a726b2790e2..b273ff1afd363378702be9a072aaad029afaaa6f 100644 (file)
@@ -2258,9 +2258,8 @@ LockReleaseAll(LOCKMETHODID lockmethodid, bool allLocks)
    while ((locallock = (LOCALLOCK *) hash_seq_search(&status)) != NULL)
    {
        /*
-        * If the LOCALLOCK entry is unused, we must've run out of shared
-        * memory while trying to set up this lock.  Just forget the local
-        * entry.
+        * If the LOCALLOCK entry is unused, something must've gone wrong
+        * while trying to acquire this lock.  Just forget the local entry.
         */
        if (locallock->nLocks == 0)
        {