Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Track SLRU page hits in SimpleLruReadPage_ReadOnly
authorTomas Vondra <tomas.vondra@postgresql.org>
Wed, 8 Apr 2020 00:06:00 +0000 (02:06 +0200)
committerTomas Vondra <tomas.vondra@postgresql.org>
Wed, 8 Apr 2020 00:15:47 +0000 (02:15 +0200)
SLRU page hits were tracked only in SimpleLruReadPage, but that's not
enough because we may hit the page in SimpleLruReadPage_ReadOnly in
which case we don't call SimpleLruReadPage at all.

Reported-by: Kuntal Ghosh
Discussion: https://postgr.es/m/20200119143707.gyinppnigokesjok@development

src/backend/access/transam/slru.c

index de3c94105d1d0817decf11514a0b47da842ae2be..b2316af7794b325cee89de3d4e356e5f7ab68649 100644 (file)
@@ -491,6 +491,10 @@ SimpleLruReadPage_ReadOnly(SlruCtl ctl, int pageno, TransactionId xid)
        {
            /* See comments for SlruRecentlyUsed macro */
            SlruRecentlyUsed(shared, slotno);
+
+           /* update the stats counter of pages found in the SLRU */
+           pgstat_count_slru_page_hit(ctl);
+
            return slotno;
        }
    }