LCOV - differential code coverage report
Current view: top level - src/backend/backup - basebackup_sink.c (source / functions) Coverage Total Hit UBC CBC
Current: c70b6db34ffeab48beef1fb4ce61bcad3772b8dd vs 06473f5a344df8c9594ead90a609b86f6724cff8 Lines: 100.0 % 43 43 43
Current Date: 2025-09-06 07:49:51 +0900 Functions: 100.0 % 9 9 9
Baseline: lcov-20250906-005545-baseline Branches: 50.0 % 28 14 14 14
Baseline Date: 2025-09-05 08:21:35 +0100 Line coverage date bins:
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
(360..) days: 100.0 % 43 43 43
Function coverage date bins:
(360..) days: 100.0 % 9 9 9
Branch coverage date bins:
(360..) days: 50.0 % 28 14 14 14

 Age         Owner                    Branch data    TLA  Line data    Source code
                                  1                 :                : /*-------------------------------------------------------------------------
                                  2                 :                :  *
                                  3                 :                :  * basebackup_sink.c
                                  4                 :                :  *    Default implementations for bbsink (basebackup sink) callbacks.
                                  5                 :                :  *
                                  6                 :                :  * Portions Copyright (c) 2010-2025, PostgreSQL Global Development Group
                                  7                 :                :  *
                                  8                 :                :  * src/backend/backup/basebackup_sink.c
                                  9                 :                :  *
                                 10                 :                :  *-------------------------------------------------------------------------
                                 11                 :                :  */
                                 12                 :                : 
                                 13                 :                : #include "postgres.h"
                                 14                 :                : 
                                 15                 :                : #include "backup/basebackup_sink.h"
                                 16                 :                : 
                                 17                 :                : /*
                                 18                 :                :  * Forward begin_backup callback.
                                 19                 :                :  *
                                 20                 :                :  * Only use this implementation if you want the bbsink you're implementing to
                                 21                 :                :  * share a buffer with the successor bbsink.
                                 22                 :                :  */
                                 23                 :                : void
 1401 rhaas@postgresql.org       24                 :CBC         175 : bbsink_forward_begin_backup(bbsink *sink)
                                 25                 :                : {
                                 26         [ -  + ]:            175 :     Assert(sink->bbs_next != NULL);
                                 27         [ -  + ]:            175 :     Assert(sink->bbs_state != NULL);
                                 28                 :            175 :     bbsink_begin_backup(sink->bbs_next, sink->bbs_state,
                                 29                 :            175 :                         sink->bbs_buffer_length);
                                 30                 :            175 :     sink->bbs_buffer = sink->bbs_next->bbs_buffer;
                                 31                 :            175 : }
                                 32                 :                : 
                                 33                 :                : /*
                                 34                 :                :  * Forward begin_archive callback.
                                 35                 :                :  */
                                 36                 :                : void
                                 37                 :            220 : bbsink_forward_begin_archive(bbsink *sink, const char *archive_name)
                                 38                 :                : {
                                 39         [ -  + ]:            220 :     Assert(sink->bbs_next != NULL);
                                 40                 :            220 :     bbsink_begin_archive(sink->bbs_next, archive_name);
                                 41                 :            220 : }
                                 42                 :                : 
                                 43                 :                : /*
                                 44                 :                :  * Forward archive_contents callback.
                                 45                 :                :  *
                                 46                 :                :  * Code that wants to use this should initialize its own bbs_buffer and
                                 47                 :                :  * bbs_buffer_length fields to the values from the successor sink. In cases
                                 48                 :                :  * where the buffer isn't shared, the data needs to be copied before forwarding
                                 49                 :                :  * the callback. We don't do try to do that here, because there's really no
                                 50                 :                :  * reason to have separately allocated buffers containing the same identical
                                 51                 :                :  * data.
                                 52                 :                :  */
                                 53                 :                : void
                                 54                 :         388093 : bbsink_forward_archive_contents(bbsink *sink, size_t len)
                                 55                 :                : {
                                 56         [ -  + ]:         388093 :     Assert(sink->bbs_next != NULL);
                                 57         [ -  + ]:         388093 :     Assert(sink->bbs_buffer == sink->bbs_next->bbs_buffer);
                                 58         [ -  + ]:         388093 :     Assert(sink->bbs_buffer_length == sink->bbs_next->bbs_buffer_length);
                                 59                 :         388093 :     bbsink_archive_contents(sink->bbs_next, len);
                                 60                 :         388093 : }
                                 61                 :                : 
                                 62                 :                : /*
                                 63                 :                :  * Forward end_archive callback.
                                 64                 :                :  */
                                 65                 :                : void
                                 66                 :            228 : bbsink_forward_end_archive(bbsink *sink)
                                 67                 :                : {
                                 68         [ -  + ]:            228 :     Assert(sink->bbs_next != NULL);
                                 69                 :            228 :     bbsink_end_archive(sink->bbs_next);
                                 70                 :            228 : }
                                 71                 :                : 
                                 72                 :                : /*
                                 73                 :                :  * Forward begin_manifest callback.
                                 74                 :                :  */
                                 75                 :                : void
                                 76                 :            177 : bbsink_forward_begin_manifest(bbsink *sink)
                                 77                 :                : {
                                 78         [ -  + ]:            177 :     Assert(sink->bbs_next != NULL);
                                 79                 :            177 :     bbsink_begin_manifest(sink->bbs_next);
                                 80                 :            177 : }
                                 81                 :                : 
                                 82                 :                : /*
                                 83                 :                :  * Forward manifest_contents callback.
                                 84                 :                :  *
                                 85                 :                :  * As with the archive_contents callback, it's expected that the buffer is
                                 86                 :                :  * shared.
                                 87                 :                :  */
                                 88                 :                : void
                                 89                 :            863 : bbsink_forward_manifest_contents(bbsink *sink, size_t len)
                                 90                 :                : {
                                 91         [ -  + ]:            863 :     Assert(sink->bbs_next != NULL);
                                 92         [ -  + ]:            863 :     Assert(sink->bbs_buffer == sink->bbs_next->bbs_buffer);
                                 93         [ -  + ]:            863 :     Assert(sink->bbs_buffer_length == sink->bbs_next->bbs_buffer_length);
                                 94                 :            863 :     bbsink_manifest_contents(sink->bbs_next, len);
                                 95                 :            863 : }
                                 96                 :                : 
                                 97                 :                : /*
                                 98                 :                :  * Forward end_manifest callback.
                                 99                 :                :  */
                                100                 :                : void
                                101                 :            177 : bbsink_forward_end_manifest(bbsink *sink)
                                102                 :                : {
                                103         [ -  + ]:            177 :     Assert(sink->bbs_next != NULL);
                                104                 :            177 :     bbsink_end_manifest(sink->bbs_next);
                                105                 :            177 : }
                                106                 :                : 
                                107                 :                : /*
                                108                 :                :  * Forward end_backup callback.
                                109                 :                :  */
                                110                 :                : void
                                111                 :            178 : bbsink_forward_end_backup(bbsink *sink, XLogRecPtr endptr, TimeLineID endtli)
                                112                 :                : {
                                113         [ -  + ]:            178 :     Assert(sink->bbs_next != NULL);
                                114                 :            178 :     bbsink_end_backup(sink->bbs_next, endptr, endtli);
                                115                 :            178 : }
                                116                 :                : 
                                117                 :                : /*
                                118                 :                :  * Forward cleanup callback.
                                119                 :                :  */
                                120                 :                : void
                                121                 :            168 : bbsink_forward_cleanup(bbsink *sink)
                                122                 :                : {
                                123         [ -  + ]:            168 :     Assert(sink->bbs_next != NULL);
                                124                 :            168 :     bbsink_cleanup(sink->bbs_next);
                                125                 :            168 : }
        

Generated by: LCOV version 2.4-beta