mirror of
https://github.com/postgres/postgres.git
synced 2025-12-21 05:21:08 +03:00
Use atomic access for SlruShared->latest_page_number
The new concurrency model proposed for slru.c to improve performance does not include any single lock that would coordinate processes doing concurrent reads/writes on SlruShared->latest_page_number. We can instead use atomic reads and writes for that variable. Author: Dilip Kumar <dilipbalaut@gmail.com> Reviewed-by: Andrey M. Borodin <x4mmm@yandex-team.ru> Discussion: https://postgr.es/m/CAFiTN-vzDvNz=ExGXz6gdyjtzGixKSqs0mKHMmaQ8sOSEFZ33A@mail.gmail.com
This commit is contained in:
@@ -766,14 +766,10 @@ StartupCLOG(void)
|
||||
TransactionId xid = XidFromFullTransactionId(TransamVariables->nextXid);
|
||||
int64 pageno = TransactionIdToPage(xid);
|
||||
|
||||
LWLockAcquire(XactSLRULock, LW_EXCLUSIVE);
|
||||
|
||||
/*
|
||||
* Initialize our idea of the latest page number.
|
||||
*/
|
||||
XactCtl->shared->latest_page_number = pageno;
|
||||
|
||||
LWLockRelease(XactSLRULock);
|
||||
pg_atomic_write_u64(&XactCtl->shared->latest_page_number, pageno);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user