LCOV - code coverage report
Current view: top level - src/test/modules/test_slru - test_multixact.c (source / functions) Hit Total Coverage
Test: PostgreSQL 19devel Lines: 11 12 91.7 %
Date: 2025-12-03 22:17:38 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*--------------------------------------------------------------------------
       2             :  *
       3             :  * test_multixact.c
       4             :  *      Support code for multixact testing
       5             :  *
       6             :  * Portions Copyright (c) 1996-2025, 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          38 : PG_FUNCTION_INFO_V1(test_create_multixact);
      22          30 : PG_FUNCTION_INFO_V1(test_read_multixact);
      23             : 
      24             : /*
      25             :  * Produces multixact with 2 current xids
      26             :  */
      27             : Datum
      28          32 : test_create_multixact(PG_FUNCTION_ARGS)
      29             : {
      30             :     MultiXactId id;
      31             : 
      32          32 :     MultiXactIdSetOldestMember();
      33          32 :     id = MultiXactIdCreate(GetCurrentTransactionId(), MultiXactStatusUpdate,
      34             :                            GetCurrentTransactionId(), MultiXactStatusForShare);
      35          32 :     PG_RETURN_TRANSACTIONID(id);
      36             : }
      37             : 
      38             : /*
      39             :  * Reads given multixact.  Discards local cache to make a real read.
      40             :  */
      41             : Datum
      42          24 : test_read_multixact(PG_FUNCTION_ARGS)
      43             : {
      44          24 :     MultiXactId id = PG_GETARG_TRANSACTIONID(0);
      45             :     MultiXactMember *members;
      46             : 
      47             :     /* discard caches */
      48          24 :     AtEOXact_MultiXact();
      49             : 
      50          24 :     if (GetMultiXactIdMembers(id, &members, false, false) == -1)
      51           0 :         elog(ERROR, "MultiXactId not found");
      52             : 
      53          24 :     PG_RETURN_VOID();
      54             : }

Generated by: LCOV version 1.16