Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2ccf1fc

Browse files
knizhnikkelvich
authored andcommitted
Improve logging
1 parent 63e88b3 commit 2ccf1fc

7 files changed

+105
-88
lines changed

arbiter.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ static bool MtmSendToNode(int node, void const* buf, int size)
412412
MtmOnNodeDisconnect(node+1);
413413
return false;
414414
}
415-
MTM_TRACE("Arbiter restablished connection with node %d\n", node+1);
415+
MTM_LOG3("Arbiter restablished connection with node %d", node+1);
416416
} else {
417417
return true;
418418
}
@@ -456,7 +456,7 @@ static void MtmAcceptOneConnection()
456456
elog(WARNING, "Arbiter failed to write response for handshake message to node %d", resp.node);
457457
close(fd);
458458
} else {
459-
elog(NOTICE, "Arbiter established connection with node %d", req.hdr.node);
459+
MTM_LOG1("Arbiter established connection with node %d", req.hdr.node);
460460
BIT_CLEAR(Mtm->connectivityMask, req.hdr.node-1);
461461
MtmRegisterSocket(fd, req.hdr.node-1);
462462
sockets[req.hdr.node-1] = fd;
@@ -509,8 +509,8 @@ static void MtmAppendBuffer(MtmBuffer* txBuffer, TransactionId xid, int node, Mt
509509
}
510510
buf->used = 0;
511511
}
512-
MTM_TRACE("Send %s message CSN=%ld to node %d from node %d for global transaction %d/local transaction %d\n",
513-
messageText[ts->cmd], ts->csn, node+1, MtmNodeId, ts->gtid.xid, ts->xid);
512+
MTM_LOG3("Send %s message CSN=%ld to node %d from node %d for global transaction %d/local transaction %d",
513+
messageText[ts->cmd], ts->csn, node+1, MtmNodeId, ts->gtid.xid, ts->xid);
514514

515515
Assert(ts->cmd != MSG_INVALID);
516516
buf->data[buf->used].code = ts->cmd;

decoder_raw.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ decoder_raw_begin_txn(LogicalDecodingContext *ctx, ReorderBufferTXN *txn)
108108
Assert(lastXid != txn->xid);
109109
lastXid = txn->xid;
110110
if (MMIsLocalTransaction(txn->xid)) {
111-
MTM_TRACE("Skip local transaction %u\n", txn->xid);
111+
MTM_LOG3("Skip local transaction %u", txn->xid);
112112
data->isLocal = true;
113113
} else {
114114
OutputPluginPrepareWrite(ctx, true);
115-
MTM_TRACE("Send transaction %u to replica\n", txn->xid);
115+
MTM_LOG3("Send transaction %u to replica", txn->xid);
116116
appendStringInfo(ctx->out, "BEGIN %u;", txn->xid);
117117
OutputPluginWrite(ctx, true);
118118
data->isLocal = false;
@@ -126,12 +126,12 @@ decoder_raw_commit_txn(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
126126
{
127127
DecoderRawData *data = ctx->output_plugin_private;
128128
if (!data->isLocal) {
129-
MTM_TRACE("Send commit of transaction %u to replica\n", txn->xid);
129+
MTM_LOG3("Send commit of transaction %u to replica", txn->xid);
130130
OutputPluginPrepareWrite(ctx, true);
131131
appendStringInfoString(ctx->out, "COMMIT;");
132132
OutputPluginWrite(ctx, true);
133133
} else {
134-
MTM_TRACE("Skip commit of transaction %u\n", txn->xid);
134+
MTM_LOG3("Skip commit of transaction %u", txn->xid);
135135
}
136136
}
137137

@@ -483,10 +483,10 @@ decoder_raw_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
483483

484484
data = ctx->output_plugin_private;
485485
if (data->isLocal) {
486-
MTM_TRACE("Skip action %d in transaction %u\n", change->action, txn->xid);
486+
MTM_LOG3("Skip action %d in transaction %u", change->action, txn->xid);
487487
return;
488488
}
489-
MTM_TRACE("Send action %d in transaction %u to replica\n", change->action, txn->xid);
489+
MTM_LOG3("Send action %d in transaction %u to replica", change->action, txn->xid);
490490

491491
/* Avoid leaking memory by using and resetting our own context */
492492
old = MemoryContextSwitchTo(data->context);

0 commit comments

Comments
 (0)