LCOV - differential code coverage report
Current view: top level - src/backend/access/rmgrdesc - heapdesc.c (source / functions) Coverage Total Hit UNC UBC GNC CBC DCB
Current: b45a8d7d8b306b43f31a002f1b3f1dddc8defeaf vs 8767b449a3a1e75626dfb08f24da54933171d4c5 Lines: 89.7 % 261 234 1 26 7 227 1
Current Date: 2025-10-28 08:26:42 +0900 Functions: 100.0 % 8 8 2 6 1
Baseline: lcov-20251028-005825-baseline Branches: 78.4 % 116 91 1 24 5 86
Baseline Date: 2025-10-27 06:37:35 +0000 Line coverage date bins:
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
(7,30] days: 87.5 % 8 7 1 7
(360..) days: 89.7 % 253 227 26 227
Function coverage date bins:
(7,30] days: 100.0 % 1 1 1
(360..) days: 100.0 % 7 7 1 6
Branch coverage date bins:
(7,30] days: 83.3 % 6 5 1 5
(360..) days: 78.2 % 110 86 24 86

 Age         Owner                    Branch data    TLA  Line data    Source code
                                  1                 :                : /*-------------------------------------------------------------------------
                                  2                 :                :  *
                                  3                 :                :  * heapdesc.c
                                  4                 :                :  *    rmgr descriptor routines for access/heap/heapam.c
                                  5                 :                :  *
                                  6                 :                :  * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
                                  7                 :                :  * Portions Copyright (c) 1994, Regents of the University of California
                                  8                 :                :  *
                                  9                 :                :  *
                                 10                 :                :  * IDENTIFICATION
                                 11                 :                :  *    src/backend/access/rmgrdesc/heapdesc.c
                                 12                 :                :  *
                                 13                 :                :  *-------------------------------------------------------------------------
                                 14                 :                :  */
                                 15                 :                : #include "postgres.h"
                                 16                 :                : 
                                 17                 :                : #include "access/heapam_xlog.h"
                                 18                 :                : #include "access/rmgrdesc_utils.h"
                                 19                 :                : #include "access/visibilitymapdefs.h"
                                 20                 :                : #include "storage/standbydefs.h"
                                 21                 :                : 
                                 22                 :                : /*
                                 23                 :                :  * NOTE: "keyname" argument cannot have trailing spaces or punctuation
                                 24                 :                :  * characters
                                 25                 :                :  */
                                 26                 :                : static void
  931 pg@bowt.ie                 27                 :CBC       62113 : infobits_desc(StringInfo buf, uint8 infobits, const char *keyname)
                                 28                 :                : {
                                 29                 :          62113 :     appendStringInfo(buf, "%s: [", keyname);
                                 30                 :                : 
                                 31         [ -  + ]:          62113 :     Assert(buf->data[buf->len - 1] != ' ');
                                 32                 :                : 
 4661 alvherre@alvh.no-ip.       33         [ -  + ]:          62113 :     if (infobits & XLHL_XMAX_IS_MULTI)
  931 pg@bowt.ie                 34                 :UBC           0 :         appendStringInfoString(buf, "IS_MULTI, ");
 4661 alvherre@alvh.no-ip.       35         [ +  + ]:CBC       62113 :     if (infobits & XLHL_XMAX_LOCK_ONLY)
  931 pg@bowt.ie                 36                 :          30510 :         appendStringInfoString(buf, "LOCK_ONLY, ");
 4661 alvherre@alvh.no-ip.       37         [ +  + ]:          62113 :     if (infobits & XLHL_XMAX_EXCL_LOCK)
  931 pg@bowt.ie                 38                 :          30510 :         appendStringInfoString(buf, "EXCL_LOCK, ");
 4661 alvherre@alvh.no-ip.       39         [ -  + ]:          62113 :     if (infobits & XLHL_XMAX_KEYSHR_LOCK)
  931 pg@bowt.ie                 40                 :UBC           0 :         appendStringInfoString(buf, "KEYSHR_LOCK, ");
 4661 alvherre@alvh.no-ip.       41         [ +  + ]:CBC       62113 :     if (infobits & XLHL_KEYS_UPDATED)
  931 pg@bowt.ie                 42                 :            235 :         appendStringInfoString(buf, "KEYS_UPDATED, ");
                                 43                 :                : 
                                 44         [ +  + ]:          62113 :     if (buf->data[buf->len - 1] == ' ')
                                 45                 :                :     {
                                 46                 :                :         /* Truncate-away final unneeded ", "  */
                                 47         [ -  + ]:          30745 :         Assert(buf->data[buf->len - 2] == ',');
                                 48                 :          30745 :         buf->len -= 2;
                                 49                 :          30745 :         buf->data[buf->len] = '\0';
                                 50                 :                :     }
                                 51                 :                : 
  756 drowley@postgresql.o       52                 :          62113 :     appendStringInfoChar(buf, ']');
  931 pg@bowt.ie                 53                 :          62113 : }
                                 54                 :                : 
                                 55                 :                : static void
                                 56                 :              6 : truncate_flags_desc(StringInfo buf, uint8 flags)
                                 57                 :                : {
                                 58                 :              6 :     appendStringInfoString(buf, "flags: [");
                                 59                 :                : 
                                 60         [ -  + ]:              6 :     if (flags & XLH_TRUNCATE_CASCADE)
  931 pg@bowt.ie                 61                 :UBC           0 :         appendStringInfoString(buf, "CASCADE, ");
  931 pg@bowt.ie                 62         [ -  + ]:CBC           6 :     if (flags & XLH_TRUNCATE_RESTART_SEQS)
  931 pg@bowt.ie                 63                 :UBC           0 :         appendStringInfoString(buf, "RESTART_SEQS, ");
                                 64                 :                : 
  931 pg@bowt.ie                 65         [ -  + ]:CBC           6 :     if (buf->data[buf->len - 1] == ' ')
                                 66                 :                :     {
                                 67                 :                :         /* Truncate-away final unneeded ", "  */
  931 pg@bowt.ie                 68         [ #  # ]:UBC           0 :         Assert(buf->data[buf->len - 2] == ',');
                                 69                 :              0 :         buf->len -= 2;
                                 70                 :              0 :         buf->data[buf->len] = '\0';
                                 71                 :                :     }
                                 72                 :                : 
  756 drowley@postgresql.o       73                 :CBC           6 :     appendStringInfoChar(buf, ']');
  935 pg@bowt.ie                 74                 :              6 : }
                                 75                 :                : 
                                 76                 :                : static void
                                 77                 :            646 : plan_elem_desc(StringInfo buf, void *plan, void *data)
                                 78                 :                : {
  582 heikki.linnakangas@i       79                 :            646 :     xlhp_freeze_plan *new_plan = (xlhp_freeze_plan *) plan;
  935 pg@bowt.ie                 80                 :            646 :     OffsetNumber **offsets = data;
                                 81                 :                : 
                                 82                 :            646 :     appendStringInfo(buf, "{ xmax: %u, infomask: %u, infomask2: %u, ntuples: %u",
                                 83                 :                :                      new_plan->xmax,
                                 84                 :            646 :                      new_plan->t_infomask, new_plan->t_infomask2,
                                 85                 :            646 :                      new_plan->ntuples);
                                 86                 :                : 
                                 87                 :            646 :     appendStringInfoString(buf, ", offsets:");
                                 88                 :            646 :     array_desc(buf, *offsets, sizeof(OffsetNumber), new_plan->ntuples,
                                 89                 :                :                &offset_elem_desc, NULL);
                                 90                 :                : 
                                 91                 :            646 :     *offsets += new_plan->ntuples;
                                 92                 :                : 
  756 drowley@postgresql.o       93                 :            646 :     appendStringInfoString(buf, " }");
 4661 alvherre@alvh.no-ip.       94                 :            646 : }
                                 95                 :                : 
                                 96                 :                : 
                                 97                 :                : /*
                                 98                 :                :  * Given a MAXALIGNed buffer returned by XLogRecGetBlockData() and pointed to
                                 99                 :                :  * by cursor and any xl_heap_prune flags, deserialize the arrays of
                                100                 :                :  * OffsetNumbers contained in an XLOG_HEAP2_PRUNE_* record.
                                101                 :                :  *
                                102                 :                :  * This is in heapdesc.c so it can be shared between heap2_redo and heap2_desc
                                103                 :                :  * code, the latter of which is used in frontend (pg_waldump) code.
                                104                 :                :  */
                                105                 :                : void
   15 melanieplageman@gmai      106                 :GNC       12037 : heap_xlog_deserialize_prune_and_freeze(char *cursor, uint16 flags,
                                107                 :                :                                        int *nplans, xlhp_freeze_plan **plans,
                                108                 :                :                                        OffsetNumber **frz_offsets,
                                109                 :                :                                        int *nredirected, OffsetNumber **redirected,
                                110                 :                :                                        int *ndead, OffsetNumber **nowdead,
                                111                 :                :                                        int *nunused, OffsetNumber **nowunused)
                                112                 :                : {
  582 heikki.linnakangas@i      113         [ +  + ]:CBC       12037 :     if (flags & XLHP_HAS_FREEZE_PLANS)
                                114                 :                :     {
                                115                 :           2166 :         xlhp_freeze_plans *freeze_plans = (xlhp_freeze_plans *) cursor;
                                116                 :                : 
                                117                 :           2166 :         *nplans = freeze_plans->nplans;
                                118         [ -  + ]:           2166 :         Assert(*nplans > 0);
                                119                 :           2166 :         *plans = freeze_plans->plans;
                                120                 :                : 
                                121                 :           2166 :         cursor += offsetof(xlhp_freeze_plans, plans);
                                122                 :           2166 :         cursor += sizeof(xlhp_freeze_plan) * *nplans;
                                123                 :                :     }
                                124                 :                :     else
                                125                 :                :     {
                                126                 :           9871 :         *nplans = 0;
                                127                 :           9871 :         *plans = NULL;
                                128                 :                :     }
                                129                 :                : 
                                130         [ +  + ]:          12037 :     if (flags & XLHP_HAS_REDIRECTIONS)
                                131                 :                :     {
                                132                 :           2294 :         xlhp_prune_items *subrecord = (xlhp_prune_items *) cursor;
                                133                 :                : 
                                134                 :           2294 :         *nredirected = subrecord->ntargets;
                                135         [ -  + ]:           2294 :         Assert(*nredirected > 0);
                                136                 :           2294 :         *redirected = &subrecord->data[0];
                                137                 :                : 
                                138                 :           2294 :         cursor += offsetof(xlhp_prune_items, data);
                                139                 :           2294 :         cursor += sizeof(OffsetNumber[2]) * *nredirected;
                                140                 :                :     }
                                141                 :                :     else
                                142                 :                :     {
                                143                 :           9743 :         *nredirected = 0;
                                144                 :           9743 :         *redirected = NULL;
                                145                 :                :     }
                                146                 :                : 
                                147         [ +  + ]:          12037 :     if (flags & XLHP_HAS_DEAD_ITEMS)
                                148                 :                :     {
                                149                 :           6544 :         xlhp_prune_items *subrecord = (xlhp_prune_items *) cursor;
                                150                 :                : 
                                151                 :           6544 :         *ndead = subrecord->ntargets;
                                152         [ -  + ]:           6544 :         Assert(*ndead > 0);
                                153                 :           6544 :         *nowdead = subrecord->data;
                                154                 :                : 
                                155                 :           6544 :         cursor += offsetof(xlhp_prune_items, data);
                                156                 :           6544 :         cursor += sizeof(OffsetNumber) * *ndead;
                                157                 :                :     }
                                158                 :                :     else
                                159                 :                :     {
                                160                 :           5493 :         *ndead = 0;
                                161                 :           5493 :         *nowdead = NULL;
                                162                 :                :     }
                                163                 :                : 
                                164         [ +  + ]:          12037 :     if (flags & XLHP_HAS_NOW_UNUSED_ITEMS)
                                165                 :                :     {
                                166                 :           4078 :         xlhp_prune_items *subrecord = (xlhp_prune_items *) cursor;
                                167                 :                : 
                                168                 :           4078 :         *nunused = subrecord->ntargets;
                                169         [ -  + ]:           4078 :         Assert(*nunused > 0);
                                170                 :           4078 :         *nowunused = subrecord->data;
                                171                 :                : 
                                172                 :           4078 :         cursor += offsetof(xlhp_prune_items, data);
                                173                 :           4078 :         cursor += sizeof(OffsetNumber) * *nunused;
                                174                 :                :     }
                                175                 :                :     else
                                176                 :                :     {
                                177                 :           7959 :         *nunused = 0;
                                178                 :           7959 :         *nowunused = NULL;
                                179                 :                :     }
                                180                 :                : 
                                181                 :          12037 :     *frz_offsets = (OffsetNumber *) cursor;
                                182                 :          12037 : }
                                183                 :                : 
                                184                 :                : void
 3995                           185                 :         167871 : heap_desc(StringInfo buf, XLogReaderState *record)
                                186                 :                : {
 4154                           187                 :         167871 :     char       *rec = XLogRecGetData(record);
 3995                           188                 :         167871 :     uint8       info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
                                189                 :                : 
 4717 alvherre@alvh.no-ip.      190                 :         167871 :     info &= XLOG_HEAP_OPMASK;
                                191         [ +  + ]:         167871 :     if (info == XLOG_HEAP_INSERT)
                                192                 :                :     {
                                193                 :         104436 :         xl_heap_insert *xlrec = (xl_heap_insert *) rec;
                                194                 :                : 
  935 pg@bowt.ie                195                 :         104436 :         appendStringInfo(buf, "off: %u, flags: 0x%02X",
                                196                 :         104436 :                          xlrec->offnum,
 2540 michael@paquier.xyz       197                 :         104436 :                          xlrec->flags);
                                198                 :                :     }
 4717 alvherre@alvh.no-ip.      199         [ +  + ]:          63435 :     else if (info == XLOG_HEAP_DELETE)
                                200                 :                :     {
                                201                 :            235 :         xl_heap_delete *xlrec = (xl_heap_delete *) rec;
                                202                 :                : 
  931 pg@bowt.ie                203                 :            235 :         appendStringInfo(buf, "xmax: %u, off: %u, ",
                                204                 :            235 :                          xlrec->xmax, xlrec->offnum);
                                205                 :            235 :         infobits_desc(buf, xlrec->infobits_set, "infobits");
                                206                 :            235 :         appendStringInfo(buf, ", flags: 0x%02X", xlrec->flags);
                                207                 :                :     }
 4717 alvherre@alvh.no-ip.      208         [ +  + ]:          63200 :     else if (info == XLOG_HEAP_UPDATE)
                                209                 :                :     {
                                210                 :          30538 :         xl_heap_update *xlrec = (xl_heap_update *) rec;
                                211                 :                : 
  931 pg@bowt.ie                212                 :          30538 :         appendStringInfo(buf, "old_xmax: %u, old_off: %u, ",
                                213                 :          30538 :                          xlrec->old_xmax, xlrec->old_offnum);
                                214                 :          30538 :         infobits_desc(buf, xlrec->old_infobits_set, "old_infobits");
                                215                 :          30538 :         appendStringInfo(buf, ", flags: 0x%02X, new_xmax: %u, new_off: %u",
                                216                 :          30538 :                          xlrec->flags, xlrec->new_xmax, xlrec->new_offnum);
                                217                 :                :     }
 4717 alvherre@alvh.no-ip.      218         [ +  + ]:          32662 :     else if (info == XLOG_HEAP_HOT_UPDATE)
                                219                 :                :     {
                                220                 :            830 :         xl_heap_update *xlrec = (xl_heap_update *) rec;
                                221                 :                : 
  931 pg@bowt.ie                222                 :            830 :         appendStringInfo(buf, "old_xmax: %u, old_off: %u, ",
                                223                 :            830 :                          xlrec->old_xmax, xlrec->old_offnum);
                                224                 :            830 :         infobits_desc(buf, xlrec->old_infobits_set, "old_infobits");
                                225                 :            830 :         appendStringInfo(buf, ", flags: 0x%02X, new_xmax: %u, new_off: %u",
                                226                 :            830 :                          xlrec->flags, xlrec->new_xmax, xlrec->new_offnum);
                                227                 :                :     }
 2761 peter_e@gmx.net           228         [ +  + ]:          31832 :     else if (info == XLOG_HEAP_TRUNCATE)
                                229                 :                :     {
                                230                 :              6 :         xl_heap_truncate *xlrec = (xl_heap_truncate *) rec;
                                231                 :                : 
  931 pg@bowt.ie                232                 :              6 :         truncate_flags_desc(buf, xlrec->flags);
  935                           233                 :              6 :         appendStringInfo(buf, ", nrelids: %u", xlrec->nrelids);
                                234                 :              6 :         appendStringInfoString(buf, ", relids:");
                                235                 :              6 :         array_desc(buf, xlrec->relids, sizeof(Oid), xlrec->nrelids,
                                236                 :                :                    &oid_elem_desc, NULL);
                                237                 :                :     }
 3826 andres@anarazel.de        238         [ -  + ]:          31826 :     else if (info == XLOG_HEAP_CONFIRM)
                                239                 :                :     {
 3826 andres@anarazel.de        240                 :UBC           0 :         xl_heap_confirm *xlrec = (xl_heap_confirm *) rec;
                                241                 :                : 
  935 pg@bowt.ie                242                 :              0 :         appendStringInfo(buf, "off: %u", xlrec->offnum);
                                243                 :                :     }
 4717 alvherre@alvh.no-ip.      244         [ +  + ]:CBC       31826 :     else if (info == XLOG_HEAP_LOCK)
                                245                 :                :     {
                                246                 :          30510 :         xl_heap_lock *xlrec = (xl_heap_lock *) rec;
                                247                 :                : 
  931 pg@bowt.ie                248                 :          30510 :         appendStringInfo(buf, "xmax: %u, off: %u, ",
                                249                 :          30510 :                          xlrec->xmax, xlrec->offnum);
                                250                 :          30510 :         infobits_desc(buf, xlrec->infobits_set, "infobits");
                                251                 :          30510 :         appendStringInfo(buf, ", flags: 0x%02X", xlrec->flags);
                                252                 :                :     }
 4717 alvherre@alvh.no-ip.      253         [ +  - ]:           1316 :     else if (info == XLOG_HEAP_INPLACE)
                                254                 :                :     {
                                255                 :           1316 :         xl_heap_inplace *xlrec = (xl_heap_inplace *) rec;
                                256                 :                : 
  935 pg@bowt.ie                257                 :           1316 :         appendStringInfo(buf, "off: %u", xlrec->offnum);
  368 noah@leadboat.com         258                 :           1316 :         standby_desc_invalidations(buf, xlrec->nmsgs, xlrec->msgs,
                                259                 :                :                                    xlrec->dbId, xlrec->tsId,
                                260                 :           1316 :                                    xlrec->relcacheInitFileInval);
                                261                 :                :     }
 4717 alvherre@alvh.no-ip.      262                 :         167871 : }
                                263                 :                : 
                                264                 :                : void
 3995 heikki.linnakangas@i      265                 :           8392 : heap2_desc(StringInfo buf, XLogReaderState *record)
                                266                 :                : {
 4154                           267                 :           8392 :     char       *rec = XLogRecGetData(record);
 3995                           268                 :           8392 :     uint8       info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
                                269                 :                : 
 4717 alvherre@alvh.no-ip.      270                 :           8392 :     info &= XLOG_HEAP_OPMASK;
  582 heikki.linnakangas@i      271   [ +  +  +  + ]:           8392 :     if (info == XLOG_HEAP2_PRUNE_ON_ACCESS ||
                                272         [ +  + ]:           7084 :         info == XLOG_HEAP2_PRUNE_VACUUM_SCAN ||
                                273                 :                :         info == XLOG_HEAP2_PRUNE_VACUUM_CLEANUP)
 4717 alvherre@alvh.no-ip.      274                 :           1596 :     {
 1666 pg@bowt.ie                275                 :           1596 :         xl_heap_prune *xlrec = (xl_heap_prune *) rec;
                                276                 :                : 
  582 heikki.linnakangas@i      277         [ +  + ]:           1596 :         if (xlrec->flags & XLHP_HAS_CONFLICT_HORIZON)
                                278                 :                :         {
                                279                 :                :             TransactionId conflict_xid;
                                280                 :                : 
                                281                 :           1228 :             memcpy(&conflict_xid, rec + SizeOfHeapPrune, sizeof(TransactionId));
                                282                 :                : 
                                283                 :           1228 :             appendStringInfo(buf, "snapshotConflictHorizon: %u",
                                284                 :                :                              conflict_xid);
                                285                 :                :         }
                                286                 :                : 
                                287                 :           1596 :         appendStringInfo(buf, ", isCatalogRel: %c",
                                288         [ +  + ]:           1596 :                          xlrec->flags & XLHP_IS_CATALOG_REL ? 'T' : 'F');
                                289                 :                : 
   15 melanieplageman@gmai      290         [ +  + ]:GNC        1596 :         if (xlrec->flags & XLHP_VM_ALL_VISIBLE)
                                291                 :                :         {
                                292                 :            288 :             uint8       vmflags = VISIBILITYMAP_ALL_VISIBLE;
                                293                 :                : 
                                294         [ +  + ]:            288 :             if (xlrec->flags & XLHP_VM_ALL_FROZEN)
                                295                 :            268 :                 vmflags |= VISIBILITYMAP_ALL_FROZEN;
                                296                 :            288 :             appendStringInfo(buf, ", vm_flags: 0x%02X", vmflags);
                                297                 :                :         }
                                298                 :                : 
  923 pg@bowt.ie                299         [ +  - ]:CBC        1596 :         if (XLogRecHasBlockData(record, 0))
                                300                 :                :         {
                                301                 :                :             Size        datalen;
                                302                 :                :             OffsetNumber *redirected;
                                303                 :                :             OffsetNumber *nowdead;
                                304                 :                :             OffsetNumber *nowunused;
                                305                 :                :             int         nredirected;
                                306                 :                :             int         nunused;
                                307                 :                :             int         ndead;
                                308                 :                :             int         nplans;
                                309                 :                :             xlhp_freeze_plan *plans;
                                310                 :                :             OffsetNumber *frz_offsets;
                                311                 :                : 
  582 heikki.linnakangas@i      312                 :           1596 :             char       *cursor = XLogRecGetBlockData(record, 0, &datalen);
                                313                 :                : 
                                314                 :           1596 :             heap_xlog_deserialize_prune_and_freeze(cursor, xlrec->flags,
                                315                 :                :                                                    &nplans, &plans, &frz_offsets,
                                316                 :                :                                                    &nredirected, &redirected,
                                317                 :                :                                                    &ndead, &nowdead,
                                318                 :                :                                                    &nunused, &nowunused);
                                319                 :                : 
                                320                 :           1596 :             appendStringInfo(buf, ", nplans: %u, nredirected: %u, ndead: %u, nunused: %u",
                                321                 :                :                              nplans, nredirected, ndead, nunused);
                                322                 :                : 
                                323         [ +  + ]:           1596 :             if (nplans > 0)
                                324                 :                :             {
                                325                 :            542 :                 appendStringInfoString(buf, ", plans:");
                                326                 :            542 :                 array_desc(buf, plans, sizeof(xlhp_freeze_plan), nplans,
                                327                 :                :                            &plan_elem_desc, &frz_offsets);
                                328                 :                :             }
                                329                 :                : 
                                330         [ +  + ]:           1596 :             if (nredirected > 0)
                                331                 :                :             {
                                332                 :            356 :                 appendStringInfoString(buf, ", redirected:");
                                333                 :            356 :                 array_desc(buf, redirected, sizeof(OffsetNumber) * 2,
                                334                 :                :                            nredirected, &redirect_elem_desc, NULL);
                                335                 :                :             }
                                336                 :                : 
                                337         [ +  + ]:           1596 :             if (ndead > 0)
                                338                 :                :             {
                                339                 :            441 :                 appendStringInfoString(buf, ", dead:");
                                340                 :            441 :                 array_desc(buf, nowdead, sizeof(OffsetNumber), ndead,
                                341                 :                :                            &offset_elem_desc, NULL);
                                342                 :                :             }
                                343                 :                : 
                                344         [ +  + ]:           1596 :             if (nunused > 0)
                                345                 :                :             {
                                346                 :            382 :                 appendStringInfoString(buf, ", unused:");
                                347                 :            382 :                 array_desc(buf, nowunused, sizeof(OffsetNumber), nunused,
                                348                 :                :                            &offset_elem_desc, NULL);
                                349                 :                :             }
                                350                 :                :         }
                                351                 :                :     }
 4717 alvherre@alvh.no-ip.      352         [ +  + ]:           6796 :     else if (info == XLOG_HEAP2_VISIBLE)
                                353                 :                :     {
                                354                 :           1304 :         xl_heap_visible *xlrec = (xl_heap_visible *) rec;
                                355                 :                : 
  935 pg@bowt.ie                356                 :           1304 :         appendStringInfo(buf, "snapshotConflictHorizon: %u, flags: 0x%02X",
 1076                           357                 :           1304 :                          xlrec->snapshotConflictHorizon, xlrec->flags);
                                358                 :                :     }
 4717 alvherre@alvh.no-ip.      359         [ +  + ]:           5492 :     else if (info == XLOG_HEAP2_MULTI_INSERT)
                                360                 :                :     {
                                361                 :           3877 :         xl_heap_multi_insert *xlrec = (xl_heap_multi_insert *) rec;
  935 pg@bowt.ie                362                 :           3877 :         bool        isinit = (XLogRecGetInfo(record) & XLOG_HEAP_INIT_PAGE) != 0;
                                363                 :                : 
                                364                 :           3877 :         appendStringInfo(buf, "ntuples: %d, flags: 0x%02X", xlrec->ntuples,
 2540 michael@paquier.xyz       365                 :           3877 :                          xlrec->flags);
                                366                 :                : 
   19 melanieplageman@gmai      367         [ -  + ]:GNC        3877 :         if (xlrec->flags & XLH_INSERT_ALL_FROZEN_SET)
   19 melanieplageman@gmai      368                 :UNC           0 :             appendStringInfo(buf, ", vm_flags: 0x%02X",
                                369                 :                :                              VISIBILITYMAP_ALL_VISIBLE |
                                370                 :                :                              VISIBILITYMAP_ALL_FROZEN);
                                371                 :                : 
  923 pg@bowt.ie                372   [ +  +  +  + ]:CBC        3877 :         if (XLogRecHasBlockData(record, 0) && !isinit)
                                373                 :                :         {
  931                           374                 :           3735 :             appendStringInfoString(buf, ", offsets:");
  935                           375                 :           3735 :             array_desc(buf, xlrec->offsets, sizeof(OffsetNumber),
                                376                 :           3735 :                        xlrec->ntuples, &offset_elem_desc, NULL);
                                377                 :                :         }
                                378                 :                :     }
 4661 alvherre@alvh.no-ip.      379         [ -  + ]:           1615 :     else if (info == XLOG_HEAP2_LOCK_UPDATED)
                                380                 :                :     {
 4661 alvherre@alvh.no-ip.      381                 :UBC           0 :         xl_heap_lock_updated *xlrec = (xl_heap_lock_updated *) rec;
                                382                 :                : 
  931 pg@bowt.ie                383                 :              0 :         appendStringInfo(buf, "xmax: %u, off: %u, ",
                                384                 :              0 :                          xlrec->xmax, xlrec->offnum);
                                385                 :              0 :         infobits_desc(buf, xlrec->infobits_set, "infobits");
                                386                 :              0 :         appendStringInfo(buf, ", flags: 0x%02X", xlrec->flags);
                                387                 :                :     }
 4340 rhaas@postgresql.org      388         [ +  - ]:CBC        1615 :     else if (info == XLOG_HEAP2_NEW_CID)
                                389                 :                :     {
                                390                 :           1615 :         xl_heap_new_cid *xlrec = (xl_heap_new_cid *) rec;
                                391                 :                : 
  935 pg@bowt.ie                392                 :           1615 :         appendStringInfo(buf, "rel: %u/%u/%u, tid: %u/%u",
                                393                 :                :                          xlrec->target_locator.spcOid,
                                394                 :                :                          xlrec->target_locator.dbOid,
                                395                 :                :                          xlrec->target_locator.relNumber,
 3995 heikki.linnakangas@i      396                 :           1615 :                          ItemPointerGetBlockNumber(&(xlrec->target_tid)),
                                397                 :           1615 :                          ItemPointerGetOffsetNumber(&(xlrec->target_tid)));
  935 pg@bowt.ie                398                 :           1615 :         appendStringInfo(buf, ", cmin: %u, cmax: %u, combo: %u",
                                399                 :                :                          xlrec->cmin, xlrec->cmax, xlrec->combocid);
                                400                 :                :     }
 4057 andres@anarazel.de        401                 :           8392 : }
                                402                 :                : 
                                403                 :                : const char *
                                404                 :         167880 : heap_identify(uint8 info)
                                405                 :                : {
                                406                 :         167880 :     const char *id = NULL;
                                407                 :                : 
 4054                           408   [ +  +  +  +  :         167880 :     switch (info & ~XLR_INFO_MASK)
                                     +  +  -  +  -  
                                           +  +  - ]
                                409                 :                :     {
 4057                           410                 :         102289 :         case XLOG_HEAP_INSERT:
                                411                 :         102289 :             id = "INSERT";
                                412                 :         102289 :             break;
 4054                           413                 :           2149 :         case XLOG_HEAP_INSERT | XLOG_HEAP_INIT_PAGE:
                                414                 :           2149 :             id = "INSERT+INIT";
                                415                 :           2149 :             break;
 4057                           416                 :            236 :         case XLOG_HEAP_DELETE:
                                417                 :            236 :             id = "DELETE";
                                418                 :            236 :             break;
                                419                 :          30312 :         case XLOG_HEAP_UPDATE:
                                420                 :          30312 :             id = "UPDATE";
                                421                 :          30312 :             break;
 4054                           422                 :            228 :         case XLOG_HEAP_UPDATE | XLOG_HEAP_INIT_PAGE:
                                423                 :            228 :             id = "UPDATE+INIT";
                                424                 :            228 :             break;
 4057                           425                 :            831 :         case XLOG_HEAP_HOT_UPDATE:
                                426                 :            831 :             id = "HOT_UPDATE";
                                427                 :            831 :             break;
 4054 andres@anarazel.de        428                 :UBC           0 :         case XLOG_HEAP_HOT_UPDATE | XLOG_HEAP_INIT_PAGE:
                                429                 :              0 :             id = "HOT_UPDATE+INIT";
                                430                 :              0 :             break;
 2761 peter_e@gmx.net           431                 :CBC           7 :         case XLOG_HEAP_TRUNCATE:
                                432                 :              7 :             id = "TRUNCATE";
                                433                 :              7 :             break;
 3826 andres@anarazel.de        434                 :UBC           0 :         case XLOG_HEAP_CONFIRM:
                                435                 :              0 :             id = "HEAP_CONFIRM";
                                436                 :              0 :             break;
 4057 andres@anarazel.de        437                 :CBC       30511 :         case XLOG_HEAP_LOCK:
                                438                 :          30511 :             id = "LOCK";
                                439                 :          30511 :             break;
                                440                 :           1317 :         case XLOG_HEAP_INPLACE:
                                441                 :           1317 :             id = "INPLACE";
                                442                 :           1317 :             break;
                                443                 :                :     }
                                444                 :                : 
                                445                 :         167880 :     return id;
                                446                 :                : }
                                447                 :                : 
                                448                 :                : const char *
                                449                 :           8399 : heap2_identify(uint8 info)
                                450                 :                : {
                                451                 :           8399 :     const char *id = NULL;
                                452                 :                : 
 4054                           453   [ +  +  +  +  :           8399 :     switch (info & ~XLR_INFO_MASK)
                                     +  +  -  +  -  
                                                 - ]
                                454                 :                :     {
  582 heikki.linnakangas@i      455                 :            577 :         case XLOG_HEAP2_PRUNE_ON_ACCESS:
                                456                 :            577 :             id = "PRUNE_ON_ACCESS";
 1666 pg@bowt.ie                457                 :            577 :             break;
  582 heikki.linnakangas@i      458                 :            733 :         case XLOG_HEAP2_PRUNE_VACUUM_SCAN:
                                459                 :            733 :             id = "PRUNE_VACUUM_SCAN";
 4057 andres@anarazel.de        460                 :            733 :             break;
  582 heikki.linnakangas@i      461                 :            289 :         case XLOG_HEAP2_PRUNE_VACUUM_CLEANUP:
                                462                 :            289 :             id = "PRUNE_VACUUM_CLEANUP";
 4057 andres@anarazel.de        463                 :            289 :             break;
                                464                 :           1305 :         case XLOG_HEAP2_VISIBLE:
                                465                 :           1305 :             id = "VISIBLE";
                                466                 :           1305 :             break;
                                467                 :           3762 :         case XLOG_HEAP2_MULTI_INSERT:
                                468                 :           3762 :             id = "MULTI_INSERT";
                                469                 :           3762 :             break;
 4054                           470                 :            117 :         case XLOG_HEAP2_MULTI_INSERT | XLOG_HEAP_INIT_PAGE:
                                471                 :            117 :             id = "MULTI_INSERT+INIT";
                                472                 :            117 :             break;
 4057 andres@anarazel.de        473                 :UBC           0 :         case XLOG_HEAP2_LOCK_UPDATED:
                                474                 :              0 :             id = "LOCK_UPDATED";
                                475                 :              0 :             break;
 4057 andres@anarazel.de        476                 :CBC        1616 :         case XLOG_HEAP2_NEW_CID:
                                477                 :           1616 :             id = "NEW_CID";
                                478                 :           1616 :             break;
 4057 andres@anarazel.de        479                 :UBC           0 :         case XLOG_HEAP2_REWRITE:
                                480                 :              0 :             id = "REWRITE";
                                481                 :              0 :             break;
                                482                 :                :     }
                                483                 :                : 
 4057 andres@anarazel.de        484                 :CBC        8399 :     return id;
                                485                 :                : }
        

Generated by: LCOV version 2.4-beta