Header And Logo

PostgreSQL
| The world's most advanced open source database.

Functions

standbydesc.c File Reference

#include "postgres.h"
#include "storage/standby.h"
Include dependency graph for standbydesc.c:

Go to the source code of this file.

Functions

static void standby_desc_running_xacts (StringInfo buf, xl_running_xacts *xlrec)
void standby_desc (StringInfo buf, uint8 xl_info, char *rec)

Function Documentation

void standby_desc ( StringInfo  buf,
uint8  xl_info,
char *  rec 
)

Definition at line 40 of file standbydesc.c.

References appendStringInfo(), xl_standby_lock::dbOid, i, xl_standby_locks::locks, xl_standby_locks::nlocks, xl_standby_lock::relOid, standby_desc_running_xacts(), xl_standby_lock::xid, XLOG_RUNNING_XACTS, and XLOG_STANDBY_LOCK.

{
    uint8       info = xl_info & ~XLR_INFO_MASK;

    if (info == XLOG_STANDBY_LOCK)
    {
        xl_standby_locks *xlrec = (xl_standby_locks *) rec;
        int         i;

        appendStringInfo(buf, "AccessExclusive locks:");

        for (i = 0; i < xlrec->nlocks; i++)
            appendStringInfo(buf, " xid %u db %u rel %u",
                             xlrec->locks[i].xid, xlrec->locks[i].dbOid,
                             xlrec->locks[i].relOid);
    }
    else if (info == XLOG_RUNNING_XACTS)
    {
        xl_running_xacts *xlrec = (xl_running_xacts *) rec;

        appendStringInfo(buf, "running xacts:");
        standby_desc_running_xacts(buf, xlrec);
    }
    else
        appendStringInfo(buf, "UNKNOWN");
}

static void standby_desc_running_xacts ( StringInfo  buf,
xl_running_xacts xlrec 
) [static]

Definition at line 20 of file standbydesc.c.

References appendStringInfo(), i, xl_running_xacts::latestCompletedXid, xl_running_xacts::nextXid, xl_running_xacts::oldestRunningXid, xl_running_xacts::subxid_overflow, xl_running_xacts::xcnt, and xl_running_xacts::xids.

Referenced by standby_desc().

{
    int         i;

    appendStringInfo(buf, " nextXid %u latestCompletedXid %u oldestRunningXid %u",
                     xlrec->nextXid,
                     xlrec->latestCompletedXid,
                     xlrec->oldestRunningXid);
    if (xlrec->xcnt > 0)
    {
        appendStringInfo(buf, "; %d xacts:", xlrec->xcnt);
        for (i = 0; i < xlrec->xcnt; i++)
            appendStringInfo(buf, " %u", xlrec->xids[i]);
    }

    if (xlrec->subxid_overflow)
        appendStringInfo(buf, "; subxid ovf");
}