]> granicus.if.org Git - postgresql/blob - src/backend/access/rmgrdesc/standbydesc.c
Remove spurious space
[postgresql] / src / backend / access / rmgrdesc / standbydesc.c
1 /*-------------------------------------------------------------------------
2  *
3  * standbydesc.c
4  *    rmgr descriptor routines for storage/ipc/standby.c
5  *
6  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  *
10  * IDENTIFICATION
11  *    src/backend/access/rmgrdesc/standbydesc.c
12  *
13  *-------------------------------------------------------------------------
14  */
15 #include "postgres.h"
16
17 #include "storage/standby.h"
18
19 static void
20 standby_desc_running_xacts(StringInfo buf, xl_running_xacts *xlrec)
21 {
22         int                     i;
23
24         appendStringInfo(buf, " nextXid %u latestCompletedXid %u oldestRunningXid %u",
25                                          xlrec->nextXid,
26                                          xlrec->latestCompletedXid,
27                                          xlrec->oldestRunningXid);
28         if (xlrec->xcnt > 0)
29         {
30                 appendStringInfo(buf, "; %d xacts:", xlrec->xcnt);
31                 for (i = 0; i < xlrec->xcnt; i++)
32                         appendStringInfo(buf, " %u", xlrec->xids[i]);
33         }
34
35         if (xlrec->subxid_overflow)
36                 appendStringInfo(buf, "; subxid ovf");
37 }
38
39 void
40 standby_desc(StringInfo buf, uint8 xl_info, char *rec)
41 {
42         uint8           info = xl_info & ~XLR_INFO_MASK;
43
44         if (info == XLOG_STANDBY_LOCK)
45         {
46                 xl_standby_locks *xlrec = (xl_standby_locks *) rec;
47                 int                     i;
48
49                 appendStringInfo(buf, "AccessExclusive locks:");
50
51                 for (i = 0; i < xlrec->nlocks; i++)
52                         appendStringInfo(buf, " xid %u db %u rel %u",
53                                                          xlrec->locks[i].xid, xlrec->locks[i].dbOid,
54                                                          xlrec->locks[i].relOid);
55         }
56         else if (info == XLOG_RUNNING_XACTS)
57         {
58                 xl_running_xacts *xlrec = (xl_running_xacts *) rec;
59
60                 appendStringInfo(buf, "running xacts:");
61                 standby_desc_running_xacts(buf, xlrec);
62         }
63         else
64                 appendStringInfo(buf, "UNKNOWN");
65 }