LCOV - code coverage report
Current view: top level - src/test/modules/test_slru - test_multixact.c (source / functions) Coverage Total Hit
Test: PostgreSQL 20devel Lines: 91.7 % 12 11
Test Date: 2026-07-06 21:15:38 Functions: 100.0 % 4 4
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
Branches: 25.0 % 4 1

             Branch data     Line data    Source code
       1                 :             : /*--------------------------------------------------------------------------
       2                 :             :  *
       3                 :             :  * test_multixact.c
       4                 :             :  *      Support code for multixact testing
       5                 :             :  *
       6                 :             :  * Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
       7                 :             :  * Portions Copyright (c) 1994, Regents of the University of California
       8                 :             :  *
       9                 :             :  * IDENTIFICATION
      10                 :             :  *      src/test/modules/test_slru/test_multixact.c
      11                 :             :  *
      12                 :             :  * -------------------------------------------------------------------------
      13                 :             :  */
      14                 :             : 
      15                 :             : #include "postgres.h"
      16                 :             : 
      17                 :             : #include "access/multixact.h"
      18                 :             : #include "access/xact.h"
      19                 :             : #include "fmgr.h"
      20                 :             : 
      21                 :          19 : PG_FUNCTION_INFO_V1(test_create_multixact);
      22                 :          17 : PG_FUNCTION_INFO_V1(test_read_multixact);
      23                 :             : 
      24                 :             : /*
      25                 :             :  * Produces multixact with 2 current xids
      26                 :             :  */
      27                 :             : Datum
      28                 :          16 : test_create_multixact(PG_FUNCTION_ARGS)
      29                 :             : {
      30                 :             :     MultiXactId id;
      31                 :             : 
      32                 :          16 :     MultiXactIdSetOldestMember();
      33                 :          16 :     id = MultiXactIdCreate(GetCurrentTransactionId(), MultiXactStatusUpdate,
      34                 :             :                            GetCurrentTransactionId(), MultiXactStatusForShare);
      35                 :          16 :     PG_RETURN_TRANSACTIONID(id);
      36                 :             : }
      37                 :             : 
      38                 :             : /*
      39                 :             :  * Reads given multixact.  Discards local cache to make a real read.
      40                 :             :  */
      41                 :             : Datum
      42                 :          14 : test_read_multixact(PG_FUNCTION_ARGS)
      43                 :             : {
      44                 :          14 :     MultiXactId id = PG_GETARG_TRANSACTIONID(0);
      45                 :             :     MultiXactMember *members;
      46                 :             : 
      47                 :             :     /* discard caches */
      48                 :          14 :     AtEOXact_MultiXact();
      49                 :             : 
      50         [ -  + ]:          14 :     if (GetMultiXactIdMembers(id, &members, false, false) == -1)
      51         [ #  # ]:           0 :         elog(ERROR, "MultiXactId not found");
      52                 :             : 
      53                 :          14 :     PG_RETURN_VOID();
      54                 :             : }
        

Generated by: LCOV version 2.0-1