diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2020-05-15 14:28:19 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2020-05-15 14:28:25 -0400 |
commit | 5da14938f7bfb96b648ee3c47e7ea2afca5bcc4a (patch) | |
tree | a637e548f3a39f0ebaef513f870964eb5dcecec9 /src/backend/access/transam/subtrans.c | |
parent | 756abe2bc7608b38c579c510eb66f2bd80d10785 (diff) |
Rename SLRU structures and associated LWLocks.
Originally, the names assigned to SLRUs had no purpose other than
being shmem lookup keys, so not a lot of thought went into them.
As of v13, though, we're exposing them in the pg_stat_slru view and
the pg_stat_reset_slru function, so it seems advisable to take a bit
more care. Rename them to names based on the associated on-disk
storage directories (which fortunately we *did* think about, to some
extent; since those are also visible to DBAs, consistency seems like
a good thing). Also rename the associated LWLocks, since those names
are likewise user-exposed now as wait event names.
For the most part I only touched symbols used in the respective modules'
SimpleLruInit() calls, not the names of other related objects. This
renaming could have been taken further, and maybe someday we will do so.
But for now it seems undesirable to change the names of any globally
visible functions or structs, so some inconsistency is unavoidable.
(But I *did* terminate "oldserxid" with prejudice, as I found that
name both unreadable and not descriptive of the SLRU's contents.)
Table 27.12 needs re-alphabetization now, but I'll leave that till
after the other LWLock renamings I have in mind.
Discussion: https://postgr.es/m/28683.1589405363@sss.pgh.pa.us
Diffstat (limited to 'src/backend/access/transam/subtrans.c')
-rw-r--r-- | src/backend/access/transam/subtrans.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/backend/access/transam/subtrans.c b/src/backend/access/transam/subtrans.c index 25d7d739cf1..f33ae407a60 100644 --- a/src/backend/access/transam/subtrans.c +++ b/src/backend/access/transam/subtrans.c @@ -81,7 +81,7 @@ SubTransSetParent(TransactionId xid, TransactionId parent) Assert(TransactionIdIsValid(parent)); Assert(TransactionIdFollows(xid, parent)); - LWLockAcquire(SubtransControlLock, LW_EXCLUSIVE); + LWLockAcquire(SubtransSLRULock, LW_EXCLUSIVE); slotno = SimpleLruReadPage(SubTransCtl, pageno, true, xid); ptr = (TransactionId *) SubTransCtl->shared->page_buffer[slotno]; @@ -99,7 +99,7 @@ SubTransSetParent(TransactionId xid, TransactionId parent) SubTransCtl->shared->page_dirty[slotno] = true; } - LWLockRelease(SubtransControlLock); + LWLockRelease(SubtransSLRULock); } /* @@ -129,7 +129,7 @@ SubTransGetParent(TransactionId xid) parent = *ptr; - LWLockRelease(SubtransControlLock); + LWLockRelease(SubtransSLRULock); return parent; } @@ -191,9 +191,9 @@ void SUBTRANSShmemInit(void) { SubTransCtl->PagePrecedes = SubTransPagePrecedes; - SimpleLruInit(SubTransCtl, "subtrans", NUM_SUBTRANS_BUFFERS, 0, - SubtransControlLock, "pg_subtrans", - LWTRANCHE_SUBTRANS_BUFFERS); + SimpleLruInit(SubTransCtl, "Subtrans", NUM_SUBTRANS_BUFFERS, 0, + SubtransSLRULock, "pg_subtrans", + LWTRANCHE_SUBTRANS_BUFFER); /* Override default assumption that writes should be fsync'd */ SubTransCtl->do_fsync = false; } @@ -213,7 +213,7 @@ BootStrapSUBTRANS(void) { int slotno; - LWLockAcquire(SubtransControlLock, LW_EXCLUSIVE); + LWLockAcquire(SubtransSLRULock, LW_EXCLUSIVE); /* Create and zero the first page of the subtrans log */ slotno = ZeroSUBTRANSPage(0); @@ -222,7 +222,7 @@ BootStrapSUBTRANS(void) SimpleLruWritePage(SubTransCtl, slotno); Assert(!SubTransCtl->shared->page_dirty[slotno]); - LWLockRelease(SubtransControlLock); + LWLockRelease(SubtransSLRULock); } /* @@ -259,7 +259,7 @@ StartupSUBTRANS(TransactionId oldestActiveXID) * Whenever we advance into a new page, ExtendSUBTRANS will likewise zero * the new page without regard to whatever was previously on disk. */ - LWLockAcquire(SubtransControlLock, LW_EXCLUSIVE); + LWLockAcquire(SubtransSLRULock, LW_EXCLUSIVE); startPage = TransactionIdToPage(oldestActiveXID); nextFullXid = ShmemVariableCache->nextFullXid; @@ -275,7 +275,7 @@ StartupSUBTRANS(TransactionId oldestActiveXID) } (void) ZeroSUBTRANSPage(startPage); - LWLockRelease(SubtransControlLock); + LWLockRelease(SubtransSLRULock); } /* @@ -337,12 +337,12 @@ ExtendSUBTRANS(TransactionId newestXact) pageno = TransactionIdToPage(newestXact); - LWLockAcquire(SubtransControlLock, LW_EXCLUSIVE); + LWLockAcquire(SubtransSLRULock, LW_EXCLUSIVE); /* Zero the page */ ZeroSUBTRANSPage(pageno); - LWLockRelease(SubtransControlLock); + LWLockRelease(SubtransSLRULock); } |