LCOV - differential code coverage report
Current view: top level - src/backend/access/rmgrdesc - heapdesc.c (source / functions) Coverage Total Hit UBC CBC
Current: c70b6db34ffeab48beef1fb4ce61bcad3772b8dd vs 06473f5a344df8c9594ead90a609b86f6724cff8 Lines: 89.8 % 254 228 26 228
Current Date: 2025-09-06 07:49:51 +0900 Functions: 100.0 % 8 8 8
Baseline: lcov-20250906-005545-baseline Branches: 78.2 % 110 86 24 86
Baseline Date: 2025-09-05 08:21:35 +0100 Line coverage date bins:
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
(30,360] days: 100.0 % 2 2 2
(360..) days: 89.7 % 252 226 26 226
Function coverage date bins:
(360..) days: 100.0 % 8 8 8
Branch coverage date bins:
(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 "storage/standbydefs.h"
                                 20                 :                : 
                                 21                 :                : /*
                                 22                 :                :  * NOTE: "keyname" argument cannot have trailing spaces or punctuation
                                 23                 :                :  * characters
                                 24                 :                :  */
                                 25                 :                : static void
  879 pg@bowt.ie                 26                 :CBC       62095 : infobits_desc(StringInfo buf, uint8 infobits, const char *keyname)
                                 27                 :                : {
                                 28                 :          62095 :     appendStringInfo(buf, "%s: [", keyname);
                                 29                 :                : 
                                 30         [ -  + ]:          62095 :     Assert(buf->data[buf->len - 1] != ' ');
                                 31                 :                : 
 4609 alvherre@alvh.no-ip.       32         [ -  + ]:          62095 :     if (infobits & XLHL_XMAX_IS_MULTI)
  879 pg@bowt.ie                 33                 :UBC           0 :         appendStringInfoString(buf, "IS_MULTI, ");
 4609 alvherre@alvh.no-ip.       34         [ +  + ]:CBC       62095 :     if (infobits & XLHL_XMAX_LOCK_ONLY)
  879 pg@bowt.ie                 35                 :          30498 :         appendStringInfoString(buf, "LOCK_ONLY, ");
 4609 alvherre@alvh.no-ip.       36         [ +  + ]:          62095 :     if (infobits & XLHL_XMAX_EXCL_LOCK)
  879 pg@bowt.ie                 37                 :          30498 :         appendStringInfoString(buf, "EXCL_LOCK, ");
 4609 alvherre@alvh.no-ip.       38         [ -  + ]:          62095 :     if (infobits & XLHL_XMAX_KEYSHR_LOCK)
  879 pg@bowt.ie                 39                 :UBC           0 :         appendStringInfoString(buf, "KEYSHR_LOCK, ");
 4609 alvherre@alvh.no-ip.       40         [ +  + ]:CBC       62095 :     if (infobits & XLHL_KEYS_UPDATED)
  879 pg@bowt.ie                 41                 :            235 :         appendStringInfoString(buf, "KEYS_UPDATED, ");
                                 42                 :                : 
                                 43         [ +  + ]:          62095 :     if (buf->data[buf->len - 1] == ' ')
                                 44                 :                :     {
                                 45                 :                :         /* Truncate-away final unneeded ", "  */
                                 46         [ -  + ]:          30733 :         Assert(buf->data[buf->len - 2] == ',');
                                 47                 :          30733 :         buf->len -= 2;
                                 48                 :          30733 :         buf->data[buf->len] = '\0';
                                 49                 :                :     }
                                 50                 :                : 
  704 drowley@postgresql.o       51                 :          62095 :     appendStringInfoChar(buf, ']');
  879 pg@bowt.ie                 52                 :          62095 : }
                                 53                 :                : 
                                 54                 :                : static void
                                 55                 :              6 : truncate_flags_desc(StringInfo buf, uint8 flags)
                                 56                 :                : {
                                 57                 :              6 :     appendStringInfoString(buf, "flags: [");
                                 58                 :                : 
                                 59         [ -  + ]:              6 :     if (flags & XLH_TRUNCATE_CASCADE)
  879 pg@bowt.ie                 60                 :UBC           0 :         appendStringInfoString(buf, "CASCADE, ");
  879 pg@bowt.ie                 61         [ -  + ]:CBC           6 :     if (flags & XLH_TRUNCATE_RESTART_SEQS)
  879 pg@bowt.ie                 62                 :UBC           0 :         appendStringInfoString(buf, "RESTART_SEQS, ");
                                 63                 :                : 
  879 pg@bowt.ie                 64         [ -  + ]:CBC           6 :     if (buf->data[buf->len - 1] == ' ')
                                 65                 :                :     {
                                 66                 :                :         /* Truncate-away final unneeded ", "  */
  879 pg@bowt.ie                 67         [ #  # ]:UBC           0 :         Assert(buf->data[buf->len - 2] == ',');
                                 68                 :              0 :         buf->len -= 2;
                                 69                 :              0 :         buf->data[buf->len] = '\0';
                                 70                 :                :     }
                                 71                 :                : 
  704 drowley@postgresql.o       72                 :CBC           6 :     appendStringInfoChar(buf, ']');
  883 pg@bowt.ie                 73                 :              6 : }
                                 74                 :                : 
                                 75                 :                : static void
                                 76                 :            656 : plan_elem_desc(StringInfo buf, void *plan, void *data)
                                 77                 :                : {
  530 heikki.linnakangas@i       78                 :            656 :     xlhp_freeze_plan *new_plan = (xlhp_freeze_plan *) plan;
  883 pg@bowt.ie                 79                 :            656 :     OffsetNumber **offsets = data;
                                 80                 :                : 
                                 81                 :            656 :     appendStringInfo(buf, "{ xmax: %u, infomask: %u, infomask2: %u, ntuples: %u",
                                 82                 :                :                      new_plan->xmax,
                                 83                 :            656 :                      new_plan->t_infomask, new_plan->t_infomask2,
                                 84                 :            656 :                      new_plan->ntuples);
                                 85                 :                : 
                                 86                 :            656 :     appendStringInfoString(buf, ", offsets:");
                                 87                 :            656 :     array_desc(buf, *offsets, sizeof(OffsetNumber), new_plan->ntuples,
                                 88                 :                :                &offset_elem_desc, NULL);
                                 89                 :                : 
                                 90                 :            656 :     *offsets += new_plan->ntuples;
                                 91                 :                : 
  704 drowley@postgresql.o       92                 :            656 :     appendStringInfoString(buf, " }");
 4609 alvherre@alvh.no-ip.       93                 :            656 : }
                                 94                 :                : 
                                 95                 :                : 
                                 96                 :                : /*
                                 97                 :                :  * Given a MAXALIGNed buffer returned by XLogRecGetBlockData() and pointed to
                                 98                 :                :  * by cursor and any xl_heap_prune flags, deserialize the arrays of
                                 99                 :                :  * OffsetNumbers contained in an XLOG_HEAP2_PRUNE_* record.
                                100                 :                :  *
                                101                 :                :  * This is in heapdesc.c so it can be shared between heap2_redo and heap2_desc
                                102                 :                :  * code, the latter of which is used in frontend (pg_waldump) code.
                                103                 :                :  */
                                104                 :                : void
  530 heikki.linnakangas@i      105                 :          12711 : heap_xlog_deserialize_prune_and_freeze(char *cursor, uint8 flags,
                                106                 :                :                                        int *nplans, xlhp_freeze_plan **plans,
                                107                 :                :                                        OffsetNumber **frz_offsets,
                                108                 :                :                                        int *nredirected, OffsetNumber **redirected,
                                109                 :                :                                        int *ndead, OffsetNumber **nowdead,
                                110                 :                :                                        int *nunused, OffsetNumber **nowunused)
                                111                 :                : {
                                112         [ +  + ]:          12711 :     if (flags & XLHP_HAS_FREEZE_PLANS)
                                113                 :                :     {
                                114                 :           2176 :         xlhp_freeze_plans *freeze_plans = (xlhp_freeze_plans *) cursor;
                                115                 :                : 
                                116                 :           2176 :         *nplans = freeze_plans->nplans;
                                117         [ -  + ]:           2176 :         Assert(*nplans > 0);
                                118                 :           2176 :         *plans = freeze_plans->plans;
                                119                 :                : 
                                120                 :           2176 :         cursor += offsetof(xlhp_freeze_plans, plans);
                                121                 :           2176 :         cursor += sizeof(xlhp_freeze_plan) * *nplans;
                                122                 :                :     }
                                123                 :                :     else
                                124                 :                :     {
                                125                 :          10535 :         *nplans = 0;
                                126                 :          10535 :         *plans = NULL;
                                127                 :                :     }
                                128                 :                : 
                                129         [ +  + ]:          12711 :     if (flags & XLHP_HAS_REDIRECTIONS)
                                130                 :                :     {
                                131                 :           2344 :         xlhp_prune_items *subrecord = (xlhp_prune_items *) cursor;
                                132                 :                : 
                                133                 :           2344 :         *nredirected = subrecord->ntargets;
                                134         [ -  + ]:           2344 :         Assert(*nredirected > 0);
                                135                 :           2344 :         *redirected = &subrecord->data[0];
                                136                 :                : 
                                137                 :           2344 :         cursor += offsetof(xlhp_prune_items, data);
                                138                 :           2344 :         cursor += sizeof(OffsetNumber[2]) * *nredirected;
                                139                 :                :     }
                                140                 :                :     else
                                141                 :                :     {
                                142                 :          10367 :         *nredirected = 0;
                                143                 :          10367 :         *redirected = NULL;
                                144                 :                :     }
                                145                 :                : 
                                146         [ +  + ]:          12711 :     if (flags & XLHP_HAS_DEAD_ITEMS)
                                147                 :                :     {
                                148                 :           6471 :         xlhp_prune_items *subrecord = (xlhp_prune_items *) cursor;
                                149                 :                : 
                                150                 :           6471 :         *ndead = subrecord->ntargets;
                                151         [ -  + ]:           6471 :         Assert(*ndead > 0);
                                152                 :           6471 :         *nowdead = subrecord->data;
                                153                 :                : 
                                154                 :           6471 :         cursor += offsetof(xlhp_prune_items, data);
                                155                 :           6471 :         cursor += sizeof(OffsetNumber) * *ndead;
                                156                 :                :     }
                                157                 :                :     else
                                158                 :                :     {
                                159                 :           6240 :         *ndead = 0;
                                160                 :           6240 :         *nowdead = NULL;
                                161                 :                :     }
                                162                 :                : 
                                163         [ +  + ]:          12711 :     if (flags & XLHP_HAS_NOW_UNUSED_ITEMS)
                                164                 :                :     {
                                165                 :           4794 :         xlhp_prune_items *subrecord = (xlhp_prune_items *) cursor;
                                166                 :                : 
                                167                 :           4794 :         *nunused = subrecord->ntargets;
                                168         [ -  + ]:           4794 :         Assert(*nunused > 0);
                                169                 :           4794 :         *nowunused = subrecord->data;
                                170                 :                : 
                                171                 :           4794 :         cursor += offsetof(xlhp_prune_items, data);
                                172                 :           4794 :         cursor += sizeof(OffsetNumber) * *nunused;
                                173                 :                :     }
                                174                 :                :     else
                                175                 :                :     {
                                176                 :           7917 :         *nunused = 0;
                                177                 :           7917 :         *nowunused = NULL;
                                178                 :                :     }
                                179                 :                : 
                                180                 :          12711 :     *frz_offsets = (OffsetNumber *) cursor;
                                181                 :          12711 : }
                                182                 :                : 
                                183                 :                : void
 3943                           184                 :         167823 : heap_desc(StringInfo buf, XLogReaderState *record)
                                185                 :                : {
 4102                           186                 :         167823 :     char       *rec = XLogRecGetData(record);
 3943                           187                 :         167823 :     uint8       info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
                                188                 :                : 
 4665 alvherre@alvh.no-ip.      189                 :         167823 :     info &= XLOG_HEAP_OPMASK;
                                190         [ +  + ]:         167823 :     if (info == XLOG_HEAP_INSERT)
                                191                 :                :     {
                                192                 :         104418 :         xl_heap_insert *xlrec = (xl_heap_insert *) rec;
                                193                 :                : 
  883 pg@bowt.ie                194                 :         104418 :         appendStringInfo(buf, "off: %u, flags: 0x%02X",
                                195                 :         104418 :                          xlrec->offnum,
 2488 michael@paquier.xyz       196                 :         104418 :                          xlrec->flags);
                                197                 :                :     }
 4665 alvherre@alvh.no-ip.      198         [ +  + ]:          63405 :     else if (info == XLOG_HEAP_DELETE)
                                199                 :                :     {
                                200                 :            235 :         xl_heap_delete *xlrec = (xl_heap_delete *) rec;
                                201                 :                : 
  879 pg@bowt.ie                202                 :            235 :         appendStringInfo(buf, "xmax: %u, off: %u, ",
                                203                 :            235 :                          xlrec->xmax, xlrec->offnum);
                                204                 :            235 :         infobits_desc(buf, xlrec->infobits_set, "infobits");
                                205                 :            235 :         appendStringInfo(buf, ", flags: 0x%02X", xlrec->flags);
                                206                 :                :     }
 4665 alvherre@alvh.no-ip.      207         [ +  + ]:          63170 :     else if (info == XLOG_HEAP_UPDATE)
                                208                 :                :     {
                                209                 :          30526 :         xl_heap_update *xlrec = (xl_heap_update *) rec;
                                210                 :                : 
  879 pg@bowt.ie                211                 :          30526 :         appendStringInfo(buf, "old_xmax: %u, old_off: %u, ",
                                212                 :          30526 :                          xlrec->old_xmax, xlrec->old_offnum);
                                213                 :          30526 :         infobits_desc(buf, xlrec->old_infobits_set, "old_infobits");
                                214                 :          30526 :         appendStringInfo(buf, ", flags: 0x%02X, new_xmax: %u, new_off: %u",
                                215                 :          30526 :                          xlrec->flags, xlrec->new_xmax, xlrec->new_offnum);
                                216                 :                :     }
 4665 alvherre@alvh.no-ip.      217         [ +  + ]:          32644 :     else if (info == XLOG_HEAP_HOT_UPDATE)
                                218                 :                :     {
                                219                 :            836 :         xl_heap_update *xlrec = (xl_heap_update *) rec;
                                220                 :                : 
  879 pg@bowt.ie                221                 :            836 :         appendStringInfo(buf, "old_xmax: %u, old_off: %u, ",
                                222                 :            836 :                          xlrec->old_xmax, xlrec->old_offnum);
                                223                 :            836 :         infobits_desc(buf, xlrec->old_infobits_set, "old_infobits");
                                224                 :            836 :         appendStringInfo(buf, ", flags: 0x%02X, new_xmax: %u, new_off: %u",
                                225                 :            836 :                          xlrec->flags, xlrec->new_xmax, xlrec->new_offnum);
                                226                 :                :     }
 2709 peter_e@gmx.net           227         [ +  + ]:          31808 :     else if (info == XLOG_HEAP_TRUNCATE)
                                228                 :                :     {
                                229                 :              6 :         xl_heap_truncate *xlrec = (xl_heap_truncate *) rec;
                                230                 :                : 
  879 pg@bowt.ie                231                 :              6 :         truncate_flags_desc(buf, xlrec->flags);
  883                           232                 :              6 :         appendStringInfo(buf, ", nrelids: %u", xlrec->nrelids);
                                233                 :              6 :         appendStringInfoString(buf, ", relids:");
                                234                 :              6 :         array_desc(buf, xlrec->relids, sizeof(Oid), xlrec->nrelids,
                                235                 :                :                    &oid_elem_desc, NULL);
                                236                 :                :     }
 3774 andres@anarazel.de        237         [ -  + ]:          31802 :     else if (info == XLOG_HEAP_CONFIRM)
                                238                 :                :     {
 3774 andres@anarazel.de        239                 :UBC           0 :         xl_heap_confirm *xlrec = (xl_heap_confirm *) rec;
                                240                 :                : 
  883 pg@bowt.ie                241                 :              0 :         appendStringInfo(buf, "off: %u", xlrec->offnum);
                                242                 :                :     }
 4665 alvherre@alvh.no-ip.      243         [ +  + ]:CBC       31802 :     else if (info == XLOG_HEAP_LOCK)
                                244                 :                :     {
                                245                 :          30498 :         xl_heap_lock *xlrec = (xl_heap_lock *) rec;
                                246                 :                : 
  879 pg@bowt.ie                247                 :          30498 :         appendStringInfo(buf, "xmax: %u, off: %u, ",
                                248                 :          30498 :                          xlrec->xmax, xlrec->offnum);
                                249                 :          30498 :         infobits_desc(buf, xlrec->infobits_set, "infobits");
                                250                 :          30498 :         appendStringInfo(buf, ", flags: 0x%02X", xlrec->flags);
                                251                 :                :     }
 4665 alvherre@alvh.no-ip.      252         [ +  - ]:           1304 :     else if (info == XLOG_HEAP_INPLACE)
                                253                 :                :     {
                                254                 :           1304 :         xl_heap_inplace *xlrec = (xl_heap_inplace *) rec;
                                255                 :                : 
  883 pg@bowt.ie                256                 :           1304 :         appendStringInfo(buf, "off: %u", xlrec->offnum);
  316 noah@leadboat.com         257                 :           1304 :         standby_desc_invalidations(buf, xlrec->nmsgs, xlrec->msgs,
                                258                 :                :                                    xlrec->dbId, xlrec->tsId,
                                259                 :           1304 :                                    xlrec->relcacheInitFileInval);
                                260                 :                :     }
 4665 alvherre@alvh.no-ip.      261                 :         167823 : }
                                262                 :                : 
                                263                 :                : void
 3943 heikki.linnakangas@i      264                 :           8665 : heap2_desc(StringInfo buf, XLogReaderState *record)
                                265                 :                : {
 4102                           266                 :           8665 :     char       *rec = XLogRecGetData(record);
 3943                           267                 :           8665 :     uint8       info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
                                268                 :                : 
 4665 alvherre@alvh.no-ip.      269                 :           8665 :     info &= XLOG_HEAP_OPMASK;
  530 heikki.linnakangas@i      270   [ +  +  +  + ]:           8665 :     if (info == XLOG_HEAP2_PRUNE_ON_ACCESS ||
                                271         [ +  + ]:           7359 :         info == XLOG_HEAP2_PRUNE_VACUUM_SCAN ||
                                272                 :                :         info == XLOG_HEAP2_PRUNE_VACUUM_CLEANUP)
 4665 alvherre@alvh.no-ip.      273                 :           1588 :     {
 1614 pg@bowt.ie                274                 :           1588 :         xl_heap_prune *xlrec = (xl_heap_prune *) rec;
                                275                 :                : 
  530 heikki.linnakangas@i      276         [ +  + ]:           1588 :         if (xlrec->flags & XLHP_HAS_CONFLICT_HORIZON)
                                277                 :                :         {
                                278                 :                :             TransactionId conflict_xid;
                                279                 :                : 
                                280                 :           1212 :             memcpy(&conflict_xid, rec + SizeOfHeapPrune, sizeof(TransactionId));
                                281                 :                : 
                                282                 :           1212 :             appendStringInfo(buf, "snapshotConflictHorizon: %u",
                                283                 :                :                              conflict_xid);
                                284                 :                :         }
                                285                 :                : 
                                286                 :           1588 :         appendStringInfo(buf, ", isCatalogRel: %c",
                                287         [ +  + ]:           1588 :                          xlrec->flags & XLHP_IS_CATALOG_REL ? 'T' : 'F');
                                288                 :                : 
  871 pg@bowt.ie                289         [ +  - ]:           1588 :         if (XLogRecHasBlockData(record, 0))
                                290                 :                :         {
                                291                 :                :             Size        datalen;
                                292                 :                :             OffsetNumber *redirected;
                                293                 :                :             OffsetNumber *nowdead;
                                294                 :                :             OffsetNumber *nowunused;
                                295                 :                :             int         nredirected;
                                296                 :                :             int         nunused;
                                297                 :                :             int         ndead;
                                298                 :                :             int         nplans;
                                299                 :                :             xlhp_freeze_plan *plans;
                                300                 :                :             OffsetNumber *frz_offsets;
                                301                 :                : 
  530 heikki.linnakangas@i      302                 :           1588 :             char       *cursor = XLogRecGetBlockData(record, 0, &datalen);
                                303                 :                : 
                                304                 :           1588 :             heap_xlog_deserialize_prune_and_freeze(cursor, xlrec->flags,
                                305                 :                :                                                    &nplans, &plans, &frz_offsets,
                                306                 :                :                                                    &nredirected, &redirected,
                                307                 :                :                                                    &ndead, &nowdead,
                                308                 :                :                                                    &nunused, &nowunused);
                                309                 :                : 
                                310                 :           1588 :             appendStringInfo(buf, ", nplans: %u, nredirected: %u, ndead: %u, nunused: %u",
                                311                 :                :                              nplans, nredirected, ndead, nunused);
                                312                 :                : 
                                313         [ +  + ]:           1588 :             if (nplans > 0)
                                314                 :                :             {
                                315                 :            548 :                 appendStringInfoString(buf, ", plans:");
                                316                 :            548 :                 array_desc(buf, plans, sizeof(xlhp_freeze_plan), nplans,
                                317                 :                :                            &plan_elem_desc, &frz_offsets);
                                318                 :                :             }
                                319                 :                : 
                                320         [ +  + ]:           1588 :             if (nredirected > 0)
                                321                 :                :             {
                                322                 :            364 :                 appendStringInfoString(buf, ", redirected:");
                                323                 :            364 :                 array_desc(buf, redirected, sizeof(OffsetNumber) * 2,
                                324                 :                :                            nredirected, &redirect_elem_desc, NULL);
                                325                 :                :             }
                                326                 :                : 
                                327         [ +  + ]:           1588 :             if (ndead > 0)
                                328                 :                :             {
                                329                 :            427 :                 appendStringInfoString(buf, ", dead:");
                                330                 :            427 :                 array_desc(buf, nowdead, sizeof(OffsetNumber), ndead,
                                331                 :                :                            &offset_elem_desc, NULL);
                                332                 :                :             }
                                333                 :                : 
                                334         [ +  + ]:           1588 :             if (nunused > 0)
                                335                 :                :             {
                                336                 :            383 :                 appendStringInfoString(buf, ", unused:");
                                337                 :            383 :                 array_desc(buf, nowunused, sizeof(OffsetNumber), nunused,
                                338                 :                :                            &offset_elem_desc, NULL);
                                339                 :                :             }
                                340                 :                :         }
                                341                 :                :     }
 4665 alvherre@alvh.no-ip.      342         [ +  + ]:           7077 :     else if (info == XLOG_HEAP2_VISIBLE)
                                343                 :                :     {
                                344                 :           1598 :         xl_heap_visible *xlrec = (xl_heap_visible *) rec;
                                345                 :                : 
  883 pg@bowt.ie                346                 :           1598 :         appendStringInfo(buf, "snapshotConflictHorizon: %u, flags: 0x%02X",
 1024                           347                 :           1598 :                          xlrec->snapshotConflictHorizon, xlrec->flags);
                                348                 :                :     }
 4665 alvherre@alvh.no-ip.      349         [ +  + ]:           5479 :     else if (info == XLOG_HEAP2_MULTI_INSERT)
                                350                 :                :     {
                                351                 :           3864 :         xl_heap_multi_insert *xlrec = (xl_heap_multi_insert *) rec;
  883 pg@bowt.ie                352                 :           3864 :         bool        isinit = (XLogRecGetInfo(record) & XLOG_HEAP_INIT_PAGE) != 0;
                                353                 :                : 
                                354                 :           3864 :         appendStringInfo(buf, "ntuples: %d, flags: 0x%02X", xlrec->ntuples,
 2488 michael@paquier.xyz       355                 :           3864 :                          xlrec->flags);
                                356                 :                : 
  871 pg@bowt.ie                357   [ +  +  +  + ]:           3864 :         if (XLogRecHasBlockData(record, 0) && !isinit)
                                358                 :                :         {
  879                           359                 :           3715 :             appendStringInfoString(buf, ", offsets:");
  883                           360                 :           3715 :             array_desc(buf, xlrec->offsets, sizeof(OffsetNumber),
                                361                 :           3715 :                        xlrec->ntuples, &offset_elem_desc, NULL);
                                362                 :                :         }
                                363                 :                :     }
 4609 alvherre@alvh.no-ip.      364         [ -  + ]:           1615 :     else if (info == XLOG_HEAP2_LOCK_UPDATED)
                                365                 :                :     {
 4609 alvherre@alvh.no-ip.      366                 :UBC           0 :         xl_heap_lock_updated *xlrec = (xl_heap_lock_updated *) rec;
                                367                 :                : 
  879 pg@bowt.ie                368                 :              0 :         appendStringInfo(buf, "xmax: %u, off: %u, ",
                                369                 :              0 :                          xlrec->xmax, xlrec->offnum);
                                370                 :              0 :         infobits_desc(buf, xlrec->infobits_set, "infobits");
                                371                 :              0 :         appendStringInfo(buf, ", flags: 0x%02X", xlrec->flags);
                                372                 :                :     }
 4288 rhaas@postgresql.org      373         [ +  - ]:CBC        1615 :     else if (info == XLOG_HEAP2_NEW_CID)
                                374                 :                :     {
                                375                 :           1615 :         xl_heap_new_cid *xlrec = (xl_heap_new_cid *) rec;
                                376                 :                : 
  883 pg@bowt.ie                377                 :           1615 :         appendStringInfo(buf, "rel: %u/%u/%u, tid: %u/%u",
                                378                 :                :                          xlrec->target_locator.spcOid,
                                379                 :                :                          xlrec->target_locator.dbOid,
                                380                 :                :                          xlrec->target_locator.relNumber,
 3943 heikki.linnakangas@i      381                 :           1615 :                          ItemPointerGetBlockNumber(&(xlrec->target_tid)),
                                382                 :           1615 :                          ItemPointerGetOffsetNumber(&(xlrec->target_tid)));
  883 pg@bowt.ie                383                 :           1615 :         appendStringInfo(buf, ", cmin: %u, cmax: %u, combo: %u",
                                384                 :                :                          xlrec->cmin, xlrec->cmax, xlrec->combocid);
                                385                 :                :     }
 4005 andres@anarazel.de        386                 :           8665 : }
                                387                 :                : 
                                388                 :                : const char *
                                389                 :         167832 : heap_identify(uint8 info)
                                390                 :                : {
                                391                 :         167832 :     const char *id = NULL;
                                392                 :                : 
 4002                           393   [ +  +  +  +  :         167832 :     switch (info & ~XLR_INFO_MASK)
                                     +  +  -  +  -  
                                           +  +  - ]
                                394                 :                :     {
 4005                           395                 :         102271 :         case XLOG_HEAP_INSERT:
                                396                 :         102271 :             id = "INSERT";
                                397                 :         102271 :             break;
 4002                           398                 :           2149 :         case XLOG_HEAP_INSERT | XLOG_HEAP_INIT_PAGE:
                                399                 :           2149 :             id = "INSERT+INIT";
                                400                 :           2149 :             break;
 4005                           401                 :            236 :         case XLOG_HEAP_DELETE:
                                402                 :            236 :             id = "DELETE";
                                403                 :            236 :             break;
                                404                 :          30305 :         case XLOG_HEAP_UPDATE:
                                405                 :          30305 :             id = "UPDATE";
                                406                 :          30305 :             break;
 4002                           407                 :            223 :         case XLOG_HEAP_UPDATE | XLOG_HEAP_INIT_PAGE:
                                408                 :            223 :             id = "UPDATE+INIT";
                                409                 :            223 :             break;
 4005                           410                 :            837 :         case XLOG_HEAP_HOT_UPDATE:
                                411                 :            837 :             id = "HOT_UPDATE";
                                412                 :            837 :             break;
 4002 andres@anarazel.de        413                 :UBC           0 :         case XLOG_HEAP_HOT_UPDATE | XLOG_HEAP_INIT_PAGE:
                                414                 :              0 :             id = "HOT_UPDATE+INIT";
                                415                 :              0 :             break;
 2709 peter_e@gmx.net           416                 :CBC           7 :         case XLOG_HEAP_TRUNCATE:
                                417                 :              7 :             id = "TRUNCATE";
                                418                 :              7 :             break;
 3774 andres@anarazel.de        419                 :UBC           0 :         case XLOG_HEAP_CONFIRM:
                                420                 :              0 :             id = "HEAP_CONFIRM";
                                421                 :              0 :             break;
 4005 andres@anarazel.de        422                 :CBC       30499 :         case XLOG_HEAP_LOCK:
                                423                 :          30499 :             id = "LOCK";
                                424                 :          30499 :             break;
                                425                 :           1305 :         case XLOG_HEAP_INPLACE:
                                426                 :           1305 :             id = "INPLACE";
                                427                 :           1305 :             break;
                                428                 :                :     }
                                429                 :                : 
                                430                 :         167832 :     return id;
                                431                 :                : }
                                432                 :                : 
                                433                 :                : const char *
                                434                 :           8672 : heap2_identify(uint8 info)
                                435                 :                : {
                                436                 :           8672 :     const char *id = NULL;
                                437                 :                : 
 4002                           438   [ +  +  +  +  :           8672 :     switch (info & ~XLR_INFO_MASK)
                                     +  +  -  +  -  
                                                 - ]
                                439                 :                :     {
  530 heikki.linnakangas@i      440                 :            569 :         case XLOG_HEAP2_PRUNE_ON_ACCESS:
                                441                 :            569 :             id = "PRUNE_ON_ACCESS";
 1614 pg@bowt.ie                442                 :            569 :             break;
  530 heikki.linnakangas@i      443                 :            739 :         case XLOG_HEAP2_PRUNE_VACUUM_SCAN:
                                444                 :            739 :             id = "PRUNE_VACUUM_SCAN";
 4005 andres@anarazel.de        445                 :            739 :             break;
  530 heikki.linnakangas@i      446                 :            283 :         case XLOG_HEAP2_PRUNE_VACUUM_CLEANUP:
                                447                 :            283 :             id = "PRUNE_VACUUM_CLEANUP";
 4005 andres@anarazel.de        448                 :            283 :             break;
                                449                 :           1599 :         case XLOG_HEAP2_VISIBLE:
                                450                 :           1599 :             id = "VISIBLE";
                                451                 :           1599 :             break;
                                452                 :           3750 :         case XLOG_HEAP2_MULTI_INSERT:
                                453                 :           3750 :             id = "MULTI_INSERT";
                                454                 :           3750 :             break;
 4002                           455                 :            116 :         case XLOG_HEAP2_MULTI_INSERT | XLOG_HEAP_INIT_PAGE:
                                456                 :            116 :             id = "MULTI_INSERT+INIT";
                                457                 :            116 :             break;
 4005 andres@anarazel.de        458                 :UBC           0 :         case XLOG_HEAP2_LOCK_UPDATED:
                                459                 :              0 :             id = "LOCK_UPDATED";
                                460                 :              0 :             break;
 4005 andres@anarazel.de        461                 :CBC        1616 :         case XLOG_HEAP2_NEW_CID:
                                462                 :           1616 :             id = "NEW_CID";
                                463                 :           1616 :             break;
 4005 andres@anarazel.de        464                 :UBC           0 :         case XLOG_HEAP2_REWRITE:
                                465                 :              0 :             id = "REWRITE";
                                466                 :              0 :             break;
                                467                 :                :     }
                                468                 :                : 
 4005 andres@anarazel.de        469                 :CBC        8672 :     return id;
                                470                 :                : }
        

Generated by: LCOV version 2.4-beta