LCOV - code coverage report
Current view: top level - src/bin/pg_waldump - logicalmsgdesc.c (source / functions) Coverage Total Hit
Test: PostgreSQL 20devel Lines: 94.4 % 18 17
Test Date: 2026-07-15 11:15:40 Functions: 100.0 % 2 2
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
Branches: 62.5 % 8 5

             Branch data     Line data    Source code
       1                 :             : /*-------------------------------------------------------------------------
       2                 :             :  *
       3                 :             :  * logicalmsgdesc.c
       4                 :             :  *    rmgr descriptor routines for replication/logical/message.c
       5                 :             :  *
       6                 :             :  * Portions Copyright (c) 2015-2026, PostgreSQL Global Development Group
       7                 :             :  *
       8                 :             :  *
       9                 :             :  * IDENTIFICATION
      10                 :             :  *    src/backend/access/rmgrdesc/logicalmsgdesc.c
      11                 :             :  *
      12                 :             :  *-------------------------------------------------------------------------
      13                 :             :  */
      14                 :             : #include "postgres.h"
      15                 :             : 
      16                 :             : #include "replication/message.h"
      17                 :             : 
      18                 :             : void
      19                 :          30 : logicalmsg_desc(StringInfo buf, XLogReaderState *record)
      20                 :             : {
      21                 :          30 :     char       *rec = XLogRecGetData(record);
      22                 :          30 :     uint8       info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
      23                 :             : 
      24         [ +  - ]:          30 :     if (info == XLOG_LOGICAL_MESSAGE)
      25                 :             :     {
      26                 :          30 :         xl_logical_message *xlrec = (xl_logical_message *) rec;
      27                 :          30 :         char       *prefix = xlrec->message;
      28                 :          30 :         char       *message = xlrec->message + xlrec->prefix_size;
      29                 :          30 :         char       *sep = "";
      30                 :             : 
      31                 :             :         Assert(prefix[xlrec->prefix_size - 1] == '\0');
      32                 :             : 
      33                 :          30 :         appendStringInfo(buf, "%s, prefix \"%s\"; payload (%zu bytes): ",
      34         [ +  - ]:          30 :                          xlrec->transactional ? "transactional" : "non-transactional",
      35                 :             :                          prefix, xlrec->message_size);
      36                 :             :         /* Write message payload as a series of hex bytes */
      37         [ +  + ]:     9876552 :         for (Size cnt = 0; cnt < xlrec->message_size; cnt++)
      38                 :             :         {
      39                 :     9876522 :             appendStringInfo(buf, "%s%02X", sep, (unsigned char) message[cnt]);
      40                 :     9876522 :             sep = " ";
      41                 :             :         }
      42                 :             :     }
      43                 :          30 : }
      44                 :             : 
      45                 :             : const char *
      46                 :          33 : logicalmsg_identify(uint8 info)
      47                 :             : {
      48         [ +  - ]:          33 :     if ((info & ~XLR_INFO_MASK) == XLOG_LOGICAL_MESSAGE)
      49                 :          33 :         return "MESSAGE";
      50                 :             : 
      51                 :           0 :     return NULL;
      52                 :             : }
        

Generated by: LCOV version 2.0-1