LCOV - differential code coverage report
Current view: top level - src/backend/access/rmgrdesc - brindesc.c (source / functions) Coverage Total Hit UBC CBC
Current: Differential Code Coverage HEAD vs 15 Lines: 71.4 % 56 40 16 40
Current Date: 2023-04-08 17:13:01 Functions: 100.0 % 2 2 2
Baseline: 15 Line coverage date bins:
Baseline Date: 2023-04-08 15:09:40 (240..) days: 71.4 % 56 40 16 40
Legend: Lines: hit not hit Function coverage date bins:
(240..) days: 100.0 % 2 2 2

 Age         Owner                  TLA  Line data    Source code
                                  1                 : /*-------------------------------------------------------------------------
                                  2                 :  *
                                  3                 :  * brindesc.c
                                  4                 :  *    rmgr descriptor routines for BRIN indexes
                                  5                 :  *
                                  6                 :  * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
                                  7                 :  * Portions Copyright (c) 1994, Regents of the University of California
                                  8                 :  *
                                  9                 :  *
                                 10                 :  * IDENTIFICATION
                                 11                 :  *    src/backend/access/rmgrdesc/brindesc.c
                                 12                 :  *
                                 13                 :  *-------------------------------------------------------------------------
                                 14                 :  */
                                 15                 : #include "postgres.h"
                                 16                 : 
                                 17                 : #include "access/brin_xlog.h"
                                 18                 : 
                                 19                 : void
 3062 heikki.linnakangas         20 CBC        3222 : brin_desc(StringInfo buf, XLogReaderState *record)
                                 21                 : {
 3075 alvherre                   22            3222 :     char       *rec = XLogRecGetData(record);
 3062 heikki.linnakangas         23            3222 :     uint8       info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
                                 24                 : 
 3075 alvherre                   25            3222 :     info &= XLOG_BRIN_OPMASK;
                                 26            3222 :     if (info == XLOG_BRIN_CREATE_INDEX)
                                 27                 :     {
 3075 alvherre                   28 UBC           0 :         xl_brin_createidx *xlrec = (xl_brin_createidx *) rec;
                                 29                 : 
 3062 heikki.linnakangas         30               0 :         appendStringInfo(buf, "v%d pagesPerRange %u",
                                 31               0 :                          xlrec->version, xlrec->pagesPerRange);
                                 32                 :     }
 3075 alvherre                   33 CBC        3222 :     else if (info == XLOG_BRIN_INSERT)
                                 34                 :     {
                                 35            1402 :         xl_brin_insert *xlrec = (xl_brin_insert *) rec;
                                 36                 : 
 3062 heikki.linnakangas         37            1402 :         appendStringInfo(buf, "heapBlk %u pagesPerRange %u offnum %u",
                                 38                 :                          xlrec->heapBlk,
                                 39                 :                          xlrec->pagesPerRange,
                                 40            1402 :                          xlrec->offnum);
                                 41                 :     }
 3075 alvherre                   42            1820 :     else if (info == XLOG_BRIN_UPDATE)
                                 43                 :     {
                                 44             295 :         xl_brin_update *xlrec = (xl_brin_update *) rec;
                                 45                 : 
 3062 heikki.linnakangas         46             295 :         appendStringInfo(buf, "heapBlk %u pagesPerRange %u old offnum %u, new offnum %u",
                                 47                 :                          xlrec->insert.heapBlk,
                                 48                 :                          xlrec->insert.pagesPerRange,
                                 49             295 :                          xlrec->oldOffnum,
                                 50             295 :                          xlrec->insert.offnum);
                                 51                 :     }
 3075 alvherre                   52            1525 :     else if (info == XLOG_BRIN_SAMEPAGE_UPDATE)
                                 53                 :     {
                                 54            1524 :         xl_brin_samepage_update *xlrec = (xl_brin_samepage_update *) rec;
                                 55                 : 
 3062 heikki.linnakangas         56            1524 :         appendStringInfo(buf, "offnum %u", xlrec->offnum);
                                 57                 :     }
 3075 alvherre                   58               1 :     else if (info == XLOG_BRIN_REVMAP_EXTEND)
                                 59                 :     {
                                 60               1 :         xl_brin_revmap_extend *xlrec = (xl_brin_revmap_extend *) rec;
                                 61                 : 
 3062 heikki.linnakangas         62               1 :         appendStringInfo(buf, "targetBlk %u", xlrec->targetBlk);
                                 63                 :     }
 2199 alvherre                   64 UBC           0 :     else if (info == XLOG_BRIN_DESUMMARIZE)
                                 65                 :     {
                                 66               0 :         xl_brin_desummarize *xlrec = (xl_brin_desummarize *) rec;
                                 67                 : 
                                 68               0 :         appendStringInfo(buf, "pagesPerRange %u, heapBlk %u, page offset %u",
 2118 tgl                        69               0 :                          xlrec->pagesPerRange, xlrec->heapBlk, xlrec->regOffset);
                                 70                 :     }
 3075 alvherre                   71 CBC        3222 : }
                                 72                 : 
                                 73                 : const char *
                                 74            3222 : brin_identify(uint8 info)
                                 75                 : {
                                 76            3222 :     const char *id = NULL;
                                 77                 : 
                                 78            3222 :     switch (info & ~XLR_INFO_MASK)
                                 79                 :     {
 3075 alvherre                   80 UBC           0 :         case XLOG_BRIN_CREATE_INDEX:
                                 81               0 :             id = "CREATE_INDEX";
                                 82               0 :             break;
 3075 alvherre                   83 CBC        1402 :         case XLOG_BRIN_INSERT:
                                 84            1402 :             id = "INSERT";
                                 85            1402 :             break;
 3075 alvherre                   86 UBC           0 :         case XLOG_BRIN_INSERT | XLOG_BRIN_INIT_PAGE:
                                 87               0 :             id = "INSERT+INIT";
                                 88               0 :             break;
 3075 alvherre                   89 CBC         290 :         case XLOG_BRIN_UPDATE:
                                 90             290 :             id = "UPDATE";
                                 91             290 :             break;
                                 92               5 :         case XLOG_BRIN_UPDATE | XLOG_BRIN_INIT_PAGE:
                                 93               5 :             id = "UPDATE+INIT";
                                 94               5 :             break;
                                 95            1524 :         case XLOG_BRIN_SAMEPAGE_UPDATE:
                                 96            1524 :             id = "SAMEPAGE_UPDATE";
                                 97            1524 :             break;
                                 98               1 :         case XLOG_BRIN_REVMAP_EXTEND:
                                 99               1 :             id = "REVMAP_EXTEND";
                                100               1 :             break;
 2199 alvherre                  101 UBC           0 :         case XLOG_BRIN_DESUMMARIZE:
                                102               0 :             id = "DESUMMARIZE";
                                103               0 :             break;
                                104                 :     }
                                105                 : 
 3075 alvherre                  106 CBC        3222 :     return id;
                                107                 : }
        

Generated by: LCOV version v1.16-55-g56c0a2a