LCOV - differential code coverage report
Current view: top level - src/backend/access/rmgrdesc - hashdesc.c (source / functions) Coverage Total Hit UBC CBC
Current: f76c13edadc2b319036e0d238703ed56bb23f934 vs 9e17d25e79d4756be08b4a5521b4b58450217137 Lines: 74.8 % 107 80 27 80
Current Date: 2026-09-20 14:13:17 +0900 Functions: 100.0 % 2 2 2
Baseline: lcov-20260920-baseline Branches: 54.5 % 44 24 20 24
Baseline Date: 2026-09-20 14:13:13 +0900 Line coverage date bins:
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
(360..) days: 74.8 % 107 80 27 80
Function coverage date bins:
(360..) days: 100.0 % 2 2 2
Branch coverage date bins:
(360..) days: 54.5 % 44 24 20 24

 Age         Owner                    Branch data    TLA  Line data    Source code
                                  1                 :                : /*-------------------------------------------------------------------------
                                  2                 :                :  *
                                  3                 :                :  * hashdesc.c
                                  4                 :                :  *    rmgr descriptor routines for access/hash/hash.c
                                  5                 :                :  *
                                  6                 :                :  * Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
                                  7                 :                :  * Portions Copyright (c) 1994, Regents of the University of California
                                  8                 :                :  *
                                  9                 :                :  *
                                 10                 :                :  * IDENTIFICATION
                                 11                 :                :  *    src/backend/access/rmgrdesc/hashdesc.c
                                 12                 :                :  *
                                 13                 :                :  *-------------------------------------------------------------------------
                                 14                 :                :  */
                                 15                 :                : #include "postgres.h"
                                 16                 :                : 
                                 17                 :                : #include "access/hash_xlog.h"
                                 18                 :                : 
                                 19                 :                : void
 4322 heikki.linnakangas@i       20                 :CBC        4230 : hash_desc(StringInfo buf, XLogReaderState *record)
                                 21                 :                : {
 3477 rhaas@postgresql.org       22                 :           4230 :     char       *rec = XLogRecGetData(record);
                                 23                 :           4230 :     uint8       info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
                                 24                 :                : 
                                 25   [ +  +  +  +  :           4230 :     switch (info)
                                     +  +  -  -  +  
                                           +  -  + ]
                                 26                 :                :     {
                                 27                 :              6 :         case XLOG_HASH_INIT_META_PAGE:
                                 28                 :                :             {
                                 29                 :              6 :                 xl_hash_init_meta_page *xlrec = (xl_hash_init_meta_page *) rec;
                                 30                 :                : 
  373 michael@paquier.xyz        31                 :              6 :                 appendStringInfo(buf, "num_tuples %g, procid %u, fillfactor %d",
                                 32                 :                :                                  xlrec->num_tuples,
                                 33                 :                :                                  xlrec->procid,
                                 34                 :              6 :                                  xlrec->ffactor);
 3477 rhaas@postgresql.org       35                 :              6 :                 break;
                                 36                 :                :             }
                                 37                 :              6 :         case XLOG_HASH_INIT_BITMAP_PAGE:
                                 38                 :                :             {
                                 39                 :              6 :                 xl_hash_init_bitmap_page *xlrec = (xl_hash_init_bitmap_page *) rec;
                                 40                 :                : 
                                 41                 :              6 :                 appendStringInfo(buf, "bmsize %d", xlrec->bmsize);
                                 42                 :              6 :                 break;
                                 43                 :                :             }
                                 44                 :           4191 :         case XLOG_HASH_INSERT:
                                 45                 :                :             {
                                 46                 :           4191 :                 xl_hash_insert *xlrec = (xl_hash_insert *) rec;
                                 47                 :                : 
                                 48                 :           4191 :                 appendStringInfo(buf, "off %u", xlrec->offnum);
                                 49                 :           4191 :                 break;
                                 50                 :                :             }
                                 51                 :              3 :         case XLOG_HASH_ADD_OVFL_PAGE:
                                 52                 :                :             {
                                 53                 :              3 :                 xl_hash_add_ovfl_page *xlrec = (xl_hash_add_ovfl_page *) rec;
                                 54                 :                : 
                                 55                 :              3 :                 appendStringInfo(buf, "bmsize %d, bmpage_found %c",
 3378 tgl@sss.pgh.pa.us          56         [ -  + ]:              6 :                                  xlrec->bmsize, (xlrec->bmpage_found) ? 'T' : 'F');
 3477 rhaas@postgresql.org       57                 :              3 :                 break;
                                 58                 :                :             }
                                 59                 :              3 :         case XLOG_HASH_SPLIT_ALLOCATE_PAGE:
                                 60                 :                :             {
                                 61                 :              3 :                 xl_hash_split_allocate_page *xlrec = (xl_hash_split_allocate_page *) rec;
                                 62                 :                : 
  373 michael@paquier.xyz        63                 :              6 :                 appendStringInfo(buf, "new_bucket %u, old_bucket_flag %u, new_bucket_flag %u, meta_page_masks_updated %c, issplitpoint_changed %c",
                                 64                 :                :                                  xlrec->new_bucket,
                                 65                 :              3 :                                  xlrec->old_bucket_flag,
                                 66                 :              3 :                                  xlrec->new_bucket_flag,
 3378 tgl@sss.pgh.pa.us          67         [ -  + ]:              3 :                                  (xlrec->flags & XLH_SPLIT_META_UPDATE_MASKS) ? 'T' : 'F',
 3477 rhaas@postgresql.org       68         [ +  - ]:              3 :                                  (xlrec->flags & XLH_SPLIT_META_UPDATE_SPLITPOINT) ? 'T' : 'F');
                                 69                 :              3 :                 break;
                                 70                 :                :             }
                                 71                 :              3 :         case XLOG_HASH_SPLIT_COMPLETE:
                                 72                 :                :             {
                                 73                 :              3 :                 xl_hash_split_complete *xlrec = (xl_hash_split_complete *) rec;
                                 74                 :                : 
                                 75                 :              3 :                 appendStringInfo(buf, "old_bucket_flag %u, new_bucket_flag %u",
 3378 tgl@sss.pgh.pa.us          76                 :              3 :                                  xlrec->old_bucket_flag, xlrec->new_bucket_flag);
 3477 rhaas@postgresql.org       77                 :              3 :                 break;
                                 78                 :                :             }
 3477 rhaas@postgresql.org       79                 :UBC           0 :         case XLOG_HASH_MOVE_PAGE_CONTENTS:
                                 80                 :                :             {
                                 81                 :              0 :                 xl_hash_move_page_contents *xlrec = (xl_hash_move_page_contents *) rec;
                                 82                 :                : 
                                 83                 :              0 :                 appendStringInfo(buf, "ntups %d, is_primary %c",
                                 84                 :              0 :                                  xlrec->ntups,
                                 85         [ #  # ]:              0 :                                  xlrec->is_prim_bucket_same_wrt ? 'T' : 'F');
                                 86                 :              0 :                 break;
                                 87                 :                :             }
                                 88                 :              0 :         case XLOG_HASH_SQUEEZE_PAGE:
                                 89                 :                :             {
                                 90                 :              0 :                 xl_hash_squeeze_page *xlrec = (xl_hash_squeeze_page *) rec;
                                 91                 :                : 
  373 michael@paquier.xyz        92                 :              0 :                 appendStringInfo(buf, "prevblkno %u, nextblkno %u, ntups %d, is_primary %c, is_previous %c",
                                 93                 :                :                                  xlrec->prevblkno,
                                 94                 :                :                                  xlrec->nextblkno,
 3477 rhaas@postgresql.org       95                 :              0 :                                  xlrec->ntups,
  373 michael@paquier.xyz        96         [ #  # ]:              0 :                                  xlrec->is_prim_bucket_same_wrt ? 'T' : 'F',
                                 97         [ #  # ]:              0 :                                  xlrec->is_prev_bucket_same_wrt ? 'T' : 'F');
 3477 rhaas@postgresql.org       98                 :              0 :                 break;
                                 99                 :                :             }
 3477 rhaas@postgresql.org      100                 :CBC           6 :         case XLOG_HASH_DELETE:
                                101                 :                :             {
                                102                 :              6 :                 xl_hash_delete *xlrec = (xl_hash_delete *) rec;
                                103                 :                : 
 3471                           104                 :             12 :                 appendStringInfo(buf, "clear_dead_marking %c, is_primary %c",
                                105         [ -  + ]:              6 :                                  xlrec->clear_dead_marking ? 'T' : 'F',
 3477                           106         [ +  - ]:              6 :                                  xlrec->is_primary_bucket_page ? 'T' : 'F');
                                107                 :              6 :                 break;
                                108                 :                :             }
                                109                 :              3 :         case XLOG_HASH_UPDATE_META_PAGE:
                                110                 :                :             {
                                111                 :              3 :                 xl_hash_update_meta_page *xlrec = (xl_hash_update_meta_page *) rec;
                                112                 :                : 
 3471                           113                 :              3 :                 appendStringInfo(buf, "ntuples %g",
                                114                 :                :                                  xlrec->ntuples);
                                115                 :              3 :                 break;
                                116                 :                :             }
 3471 rhaas@postgresql.org      117                 :UBC           0 :         case XLOG_HASH_VACUUM_ONE_PAGE:
                                118                 :                :             {
                                119                 :              0 :                 xl_hash_vacuum_one_page *xlrec = (xl_hash_vacuum_one_page *) rec;
                                120                 :                : 
 1004 msawada@postgresql.o      121                 :              0 :                 appendStringInfo(buf, "ntuples %d, snapshotConflictHorizon %u, isCatalogRel %c",
 2735 andres@anarazel.de        122                 :              0 :                                  xlrec->ntuples,
                                123                 :                :                                  xlrec->snapshotConflictHorizon,
 1004 msawada@postgresql.o      124         [ #  # ]:              0 :                                  xlrec->isCatalogRel ? 'T' : 'F');
 3477 rhaas@postgresql.org      125                 :              0 :                 break;
                                126                 :                :             }
                                127                 :                :     }
 5044 alvherre@alvh.no-ip.      128                 :CBC        4230 : }
                                129                 :                : 
                                130                 :                : const char *
 4384 andres@anarazel.de        131                 :           4260 : hash_identify(uint8 info)
                                132                 :                : {
 3477 rhaas@postgresql.org      133                 :           4260 :     const char *id = NULL;
                                134                 :                : 
                                135   [ +  +  +  +  :           4260 :     switch (info & ~XLR_INFO_MASK)
                                     +  +  +  -  -  
                                        +  +  +  -  
                                                 - ]
                                136                 :                :     {
                                137                 :              9 :         case XLOG_HASH_INIT_META_PAGE:
                                138                 :              9 :             id = "INIT_META_PAGE";
                                139                 :              9 :             break;
                                140                 :              9 :         case XLOG_HASH_INIT_BITMAP_PAGE:
                                141                 :              9 :             id = "INIT_BITMAP_PAGE";
                                142                 :              9 :             break;
                                143                 :           4194 :         case XLOG_HASH_INSERT:
                                144                 :           4194 :             id = "INSERT";
                                145                 :           4194 :             break;
                                146                 :              6 :         case XLOG_HASH_ADD_OVFL_PAGE:
                                147                 :              6 :             id = "ADD_OVFL_PAGE";
                                148                 :              6 :             break;
                                149                 :              6 :         case XLOG_HASH_SPLIT_ALLOCATE_PAGE:
                                150                 :              6 :             id = "SPLIT_ALLOCATE_PAGE";
                                151                 :              6 :             break;
                                152                 :              9 :         case XLOG_HASH_SPLIT_PAGE:
                                153                 :              9 :             id = "SPLIT_PAGE";
                                154                 :              9 :             break;
                                155                 :              6 :         case XLOG_HASH_SPLIT_COMPLETE:
                                156                 :              6 :             id = "SPLIT_COMPLETE";
                                157                 :              6 :             break;
 3477 rhaas@postgresql.org      158                 :UBC           0 :         case XLOG_HASH_MOVE_PAGE_CONTENTS:
                                159                 :              0 :             id = "MOVE_PAGE_CONTENTS";
                                160                 :              0 :             break;
                                161                 :              0 :         case XLOG_HASH_SQUEEZE_PAGE:
                                162                 :              0 :             id = "SQUEEZE_PAGE";
                                163                 :              0 :             break;
 3477 rhaas@postgresql.org      164                 :CBC           9 :         case XLOG_HASH_DELETE:
                                165                 :              9 :             id = "DELETE";
                                166                 :              9 :             break;
                                167                 :              6 :         case XLOG_HASH_SPLIT_CLEANUP:
                                168                 :              6 :             id = "SPLIT_CLEANUP";
                                169                 :              6 :             break;
                                170                 :              6 :         case XLOG_HASH_UPDATE_META_PAGE:
                                171                 :              6 :             id = "UPDATE_META_PAGE";
                                172                 :              6 :             break;
 3476 rhaas@postgresql.org      173                 :UBC           0 :         case XLOG_HASH_VACUUM_ONE_PAGE:
                                174                 :              0 :             id = "VACUUM_ONE_PAGE";
                                175                 :                :     }
                                176                 :                : 
 3477 rhaas@postgresql.org      177                 :CBC        4260 :     return id;
                                178                 :                : }
        

Generated by: LCOV version 2.0-1