Re: [HACKERS] Moving relation extension locks out of heavyweight lock manager

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Cc: Kuntal Ghosh <kuntalghosh(dot)2007(at)gmail(dot)com>, Masahiko Sawada <masahiko(dot)sawada(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Mahendra Singh Thalor <mahi6run(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Mithun Cy <mithun(dot)cy(at)enterprisedb(dot)com>, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] Moving relation extension locks out of heavyweight lock manager
Date: 2020-03-17 11:44:35
Message-ID: CAA4eK1L-fUijbE86HO9K3a-Jhm8XJ2HK=e6na7M6nD1T3jnSGw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Mar 16, 2020 at 3:24 PM Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
>

+
+ /*
+ * Indicate that the lock is released for certain types of locks
+ */
+#ifdef USE_ASSERT_CHECKING
+ CheckAndSetLockHeld(locallock, false);
+#endif
}

/*
@@ -1618,6 +1666,11 @@ GrantLockLocal(LOCALLOCK *locallock, ResourceOwner owner)
locallock->numLockOwners++;
if (owner != NULL)
ResourceOwnerRememberLock(owner, locallock);
+
+ /* Indicate that the lock is acquired for certain types of locks. */
+#ifdef USE_ASSERT_CHECKING
+ CheckAndSetLockHeld(locallock, true);
+#endif
}

There is no need to sprinkle USE_ASSERT_CHECKING at so many places,
having inside the new function is sufficient. I have changed that,
added few more comments and
made minor changes. See, what you think about attached?

--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

Attachment Content-Type Size
v12-0001-Assert-that-we-don-t-acquire-a-heavyweight-lock-on-a.patch application/octet-stream 4.4 KB
v12-0002-Add-assert-to-ensure-that-page-locks-don-t-participa.patch application/octet-stream 3.1 KB
v12-0003-Allow-relation-extension-lock-to-conflict-among-para.patch application/octet-stream 3.9 KB
v12-0004-Allow-page-lock-to-conflict-among-parallel-group-mem.patch application/octet-stream 10.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Steele 2020-03-17 11:53:08 Re: plan cache overhead on plpgsql expression
Previous Message Ivan N. Taranov 2020-03-17 11:35:08 Re: custom postgres launcher for tests