From: | Alex <zhihui(dot)fan1213(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | some questions about fast-path-lock |
Date: | 2019-05-27 06:01:34 |
Message-ID: | CAKU4AWqxd1hceB8jpWkmCFbZ+38Aqh_xEkPfa9STihV86o-xyQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I got some idea from the README under storage/lmgr and read some code of
LockAcquireExtended , but I still have some questions now.
LWLockAcquire(&MyProc->backendLock, LW_EXCLUSIVE);
if (FastPathStrongRelationLocks->count[fasthashcode] != 0)
acquired = false;
else
acquired = FastPathGrantRelationLock(locktag->locktag_field2,
lockmode);
1. In the README, it says: "A key point of this algorithm is that it
must be possible to verify the
absence of possibly conflicting locks without fighting over a shared LWLock
or
spinlock. Otherwise, this effort would simply move the contention
bottleneck
from one place to another."
but in the code, there is LWLockAcquire in the above code. Actually I
can't think out how can we proceed without a lock.
2. Why does the MyProc->backendLock work? it is MyProc not a global
lock.
3. for the line, acquired =
FastPathGrantRelationLock(locktag->locktag_field2,
lockmode); I think it should be able to replaced with "acquired =
true" (but obviously I'm wrong) . I read "FastPathGrantRelationLock" but
can't understand it.
Any hint will be helpful. thanks!
From | Date | Subject | |
---|---|---|---|
Next Message | Fabien COELHO | 2019-05-27 06:32:21 | Re: Why does pg_checksums -r not have a long option? |
Previous Message | Amit Langote | 2019-05-27 05:58:12 | Re: Excessive memory usage in multi-statement queries w/ partitioning |