some questions about fast-path-lock

Поиск
Список
Период
Сортировка
От Alex
Тема some questions about fast-path-lock
Дата
Msg-id CAKU4AWqxd1hceB8jpWkmCFbZ+38Aqh_xEkPfa9STihV86o-xyQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: some questions about fast-path-lock  (Robert Haas <robertmhaas@gmail.com>)
Список 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! 

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Langote
Дата:
Сообщение: Re: Excessive memory usage in multi-statement queries w/ partitioning
Следующее
От: Fabien COELHO
Дата:
Сообщение: Re: Why does pg_checksums -r not have a long option?