Skip to content

Commit cff6628

Browse files
committed
Remove excessive logging.
1 parent 50d0f70 commit cff6628

File tree

2 files changed

+20
-35
lines changed

2 files changed

+20
-35
lines changed

contrib/pg_xtm/dtmd/src/main.c

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,7 @@ static char *onbegin(void *stream, void *clientdata, cmd_t *cmd) {
141141
xmax[node] = xid;
142142
}
143143
}
144-
if (global_transaction_mark(clg, gt, DOUBT)) {
145-
shout(
146-
"[%d] BEGIN: global transaction marked as DOUBT",
147-
CLIENT_ID(clientdata)
148-
);
149-
} else {
144+
if (!global_transaction_mark(clg, gt, DOUBT)) {
150145
shout(
151146
"[%d] BEGIN: global transaction failed"
152147
" to initialize clog bits O_o\n",
@@ -208,17 +203,17 @@ static char *onvote(void *stream, void *clientdata, cmd_t *cmd, int vote) {
208203
switch (global_transaction_status(transactions + i)) {
209204
case NEGATIVE:
210205
if (global_transaction_mark(clg, transactions + i, NEGATIVE)) {
211-
shout(
212-
"[%d] VOTE: global transaction aborted\n",
213-
CLIENT_ID(clientdata)
214-
);
206+
//shout(
207+
// "[%d] VOTE: global transaction aborted\n",
208+
// CLIENT_ID(clientdata)
209+
//);
215210

216211
void *listener;
217212
while ((listener = global_transaction_pop_listener(transactions + i))) {
218-
shout(
219-
"[%d] VOTE: notifying a listener\n",
220-
CLIENT_ID(clientdata)
221-
);
213+
//shout(
214+
// "[%d] VOTE: notifying a listener\n",
215+
// CLIENT_ID(clientdata)
216+
//);
222217
write_to_stream(listener, strdup("+a"));
223218
}
224219

@@ -234,21 +229,21 @@ static char *onvote(void *stream, void *clientdata, cmd_t *cmd, int vote) {
234229
return strdup("-");
235230
}
236231
case DOUBT:
237-
shout("[%d] VOTE: vote counted\n", CLIENT_ID(clientdata));
232+
//shout("[%d] VOTE: vote counted\n", CLIENT_ID(clientdata));
238233
return strdup("+");
239234
case POSITIVE:
240235
if (global_transaction_mark(clg, transactions + i, POSITIVE)) {
241-
shout(
242-
"[%d] VOTE: global transaction committed\n",
243-
CLIENT_ID(clientdata)
244-
);
236+
//shout(
237+
// "[%d] VOTE: global transaction committed\n",
238+
// CLIENT_ID(clientdata)
239+
//);
245240

246241
void *listener;
247242
while ((listener = global_transaction_pop_listener(transactions + i))) {
248-
shout(
249-
"[%d] VOTE: notifying a listener\n",
250-
CLIENT_ID(clientdata)
251-
);
243+
//shout(
244+
// "[%d] VOTE: notifying a listener\n",
245+
// CLIENT_ID(clientdata)
246+
//);
252247
write_to_stream(listener, strdup("+c"));
253248
}
254249

@@ -390,26 +385,20 @@ static char *onstatus(void *stream, void *clientdata, cmd_t *cmd) {
390385
int status = clog_read(clg, MUX_XID(node, xid));
391386
switch (status) {
392387
case BLANK:
393-
shout("[%d] STATUS(%llu): BLANK\n", CLIENT_ID(clientdata), MUX_XID(node, xid));
394388
return strdup("+0");
395389
case POSITIVE:
396-
shout("[%d] STATUS(%llu): POSITIVE\n", CLIENT_ID(clientdata), MUX_XID(node, xid));
397390
return strdup("+c");
398391
case NEGATIVE:
399-
shout("[%d] STATUS(%llu): NEGATIVE\n", CLIENT_ID(clientdata), MUX_XID(node, xid));
400392
return strdup("+a");
401393
case DOUBT:
402-
shout("[%d] STATUS(%llu): DOUBT\n", CLIENT_ID(clientdata), MUX_XID(node, xid));
403394
if (wait) {
404-
shout("[%d] STATUS: adding self to the wait queue\n", CLIENT_ID(clientdata));
405395
if (!queue_for_transaction_finish(stream, clientdata, node, xid)) {
406396
shout(
407397
"[%d] STATUS: couldn't queue for transaction finish\n",
408398
CLIENT_ID(clientdata)
409399
);
410400
return strdup("-");
411401
}
412-
shout("[%d] STATUS: returning NULL\n", CLIENT_ID(clientdata));
413402
return NULL;
414403
} else {
415404
return strdup("+?");
@@ -531,7 +520,7 @@ char *ondata(void *stream, void *clientdata, size_t len, char *data) {
531520
}
532521

533522
void usage(char *prog) {
534-
shout("Usage: %s [-d DATADIR] [-a HOST] [-p PORT]\n", prog);
523+
printf("Usage: %s [-d DATADIR] [-a HOST] [-p PORT]\n", prog);
535524
}
536525

537526
int main(int argc, char **argv) {

contrib/pg_xtm/dtmd/src/transaction.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,10 @@ bool global_transaction_mark(clog_t clg, GlobalTransaction *gt, int status) {
4747
Transaction *t = gt->participants + node;
4848
if (t->active) {
4949
assert(t->node == node);
50-
if (clog_write(clg, MUX_XID(node, t->xid), status)) {
51-
shout("clog write %llu, %d\n", MUX_XID(node, t->xid), status);
52-
} else {
50+
if (!clog_write(clg, MUX_XID(node, t->xid), status)) {
5351
shout("clog write failed\n");
5452
return false;
5553
}
56-
} else {
57-
shout("node %d is not a participant\n", node);
5854
}
5955
}
6056
return true;

0 commit comments

Comments
 (0)