Skip to content

Commit b9db6df

Browse files
committed
Reduce tracing
1 parent ff9dab5 commit b9db6df

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

contrib/pg_xtm/pg_dtm.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ static bool DtmGlobalTransaction = false;
5757
static TransactionManager DtmTM = { DtmGetTransactionStatus, DtmSetTransactionStatus, DtmGetSnapshot, DtmTransactionIsInProgress };
5858
static DTMConn DtmConn;
5959

60-
#define XTM_TRACE(fmt, ...) fprintf(stderr, fmt, ## __VA_ARGS__)
60+
#define XTM_TRACE(fmt, ...)
61+
//#define XTM_TRACE(fmt, ...) fprintf(stderr, fmt, ## __VA_ARGS__)
6162
#define XTM_CONNECT_ATTEMPTS 10
6263

6364
static void DtmEnsureConnection(void)
@@ -81,8 +82,8 @@ static void DumpSnapshot(Snapshot s, char *name)
8182
char *cursor = buf;
8283
cursor += sprintf(
8384
cursor,
84-
"snapshot %s: xmin=%d, xmax=%d, active=[",
85-
name, s->xmin, s->xmax
85+
"snapshot %s for transaction %d: xmin=%d, xmax=%d, active=[",
86+
name, GetCurrentTransactionId(), s->xmin, s->xmax
8687
);
8788
for (i = 0; i < s->xcnt; i++) {
8889
if (i == 0) {
@@ -92,7 +93,7 @@ static void DumpSnapshot(Snapshot s, char *name)
9293
}
9394
}
9495
cursor += sprintf(cursor, "]");
95-
XTM_TRACE("%s\n", buf);
96+
printf("%s\n", buf);
9697
}
9798

9899
static void DtmCopySnapshot(Snapshot dst, Snapshot src)
@@ -101,7 +102,6 @@ static void DtmCopySnapshot(Snapshot dst, Snapshot src)
101102
static TransactionId* buf;
102103
TransactionId prev = InvalidTransactionId;
103104

104-
XTM_TRACE("XTM: DtmCopySnapshot for transaction%u\n", GetCurrentTransactionId());
105105
DumpSnapshot(dst, "local");
106106
DumpSnapshot(src, "DTM");
107107

@@ -127,7 +127,7 @@ static void DtmCopySnapshot(Snapshot dst, Snapshot src)
127127
}
128128
}
129129
dst->xcnt = j;
130-
DumpSnapshot(dst, "Merged");
130+
DumpSnapshot(dst, "merged");
131131
}
132132

133133
static void DtmUpdateRecentXmin(void)
@@ -157,7 +157,7 @@ static Snapshot DtmGetSnapshot(Snapshot snapshot)
157157
snapshot = GetLocalSnapshotData(snapshot);
158158
if (DtmHasSnapshot) {
159159
DtmCopySnapshot(snapshot, &DtmSnapshot);
160-
//DtmUpdateRecentXmin();
160+
DtmUpdateRecentXmin();
161161
}
162162
return snapshot;
163163
}

contrib/pg_xtm/tests/transfers.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,13 @@ func inspect(wg *sync.WaitGroup) {
144144
var prevSum int32 = 0
145145
var xids []int32 = make([]int32, 2)
146146

147+
for running {
147148
conn1, err := pgx.Connect(cfg1)
148149
checkErr(err)
149150

150151
conn2, err := pgx.Connect(cfg2)
151152
checkErr(err)
152153

153-
for running {
154154
exec(conn1, "begin")
155155
exec(conn2, "begin")
156156

@@ -172,12 +172,12 @@ func inspect(wg *sync.WaitGroup) {
172172

173173
sum = sum1 + sum2
174174
if (sum != prevSum) {
175-
fmt.Println("Total = ", sum)
175+
fmt.Println("Total = ", sum, "xids=", xids)
176176
prevSum = sum
177177
}
178-
}
179178
conn1.Close()
180179
conn2.Close()
180+
}
181181
wg.Done()
182182
}
183183

0 commit comments

Comments
 (0)