LCOV - differential code coverage report
Current view: top level - src/backend/access/rmgrdesc - logicalmsgdesc.c (source / functions) Coverage Total Hit UBC GBC
Current: Differential Code Coverage 16@8cea358b128 vs 17@8cea358b128 Lines: 89.5 % 19 17 2 17
Current Date: 2024-04-14 14:21:10 Functions: 100.0 % 2 2 2
Baseline: 16@8cea358b128 Branches: 60.0 % 10 6 4 6
Baseline Date: 2024-04-14 14:21:09 Line coverage date bins:
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed (240..) days: 89.5 % 19 17 2 17
Function coverage date bins:
(240..) days: 100.0 % 2 2 2
Branch coverage date bins:
(240..) days: 60.0 % 10 6 4 6

 Age         Owner                    Branch data    TLA  Line data    Source code
                                  1                 :                : /*-------------------------------------------------------------------------
                                  2                 :                :  *
                                  3                 :                :  * logicalmsgdesc.c
                                  4                 :                :  *    rmgr descriptor routines for replication/logical/message.c
                                  5                 :                :  *
                                  6                 :                :  * Portions Copyright (c) 2015-2024, 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
 2930 simon@2ndQuadrant.co       19                 :GBC           6 : logicalmsg_desc(StringInfo buf, XLogReaderState *record)
                                 20                 :                : {
                                 21                 :              6 :     char       *rec = XLogRecGetData(record);
                                 22                 :              6 :     uint8       info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
                                 23                 :                : 
                                 24         [ +  - ]:              6 :     if (info == XLOG_LOGICAL_MESSAGE)
                                 25                 :                :     {
                                 26                 :              6 :         xl_logical_message *xlrec = (xl_logical_message *) rec;
 1312 alvherre@alvh.no-ip.       27                 :              6 :         char       *prefix = xlrec->message;
                                 28                 :              6 :         char       *message = xlrec->message + xlrec->prefix_size;
                                 29                 :              6 :         char       *sep = "";
                                 30                 :                : 
  607 tomas.vondra@postgre       31         [ -  + ]:              6 :         Assert(prefix[xlrec->prefix_size - 1] == '\0');
                                 32                 :                : 
 1312 alvherre@alvh.no-ip.       33                 :UBC           0 :         appendStringInfo(buf, "%s, prefix \"%s\"; payload (%zu bytes): ",
 1312 alvherre@alvh.no-ip.       34         [ +  - ]:GBC           6 :                          xlrec->transactional ? "transactional" : "non-transactional",
                                 35                 :                :                          prefix, xlrec->message_size);
                                 36                 :                :         /* Write message payload as a series of hex bytes */
                                 37         [ +  + ]:             24 :         for (int cnt = 0; cnt < xlrec->message_size; cnt++)
                                 38                 :                :         {
                                 39                 :             18 :             appendStringInfo(buf, "%s%02X", sep, (unsigned char) message[cnt]);
                                 40                 :             18 :             sep = " ";
                                 41                 :                :         }
                                 42                 :                :     }
 2930 simon@2ndQuadrant.co       43                 :              6 : }
                                 44                 :                : 
                                 45                 :                : const char *
                                 46                 :              7 : logicalmsg_identify(uint8 info)
                                 47                 :                : {
                                 48         [ +  - ]:              7 :     if ((info & ~XLR_INFO_MASK) == XLOG_LOGICAL_MESSAGE)
                                 49                 :              7 :         return "MESSAGE";
                                 50                 :                : 
 2930 simon@2ndQuadrant.co       51                 :UBC           0 :     return NULL;
                                 52                 :                : }
        

Generated by: LCOV version 2.1-beta2-3-g6141622