Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5cce0cb

Browse files
committed
print notices
1 parenta095c69 commit5cce0cb

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

‎multimaster.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2158,14 +2158,33 @@ static bool MtmRunUtilityStmt(PGconn* conn, char const* sql, char **errmsg)
21582158

21592159
*errmsg=palloc0(errlen);
21602160

2161-
/* Strip "ERROR:\t" from beginning and "\n" from end of error string */
2161+
/* Strip "ERROR:" from beginning and "\n" from end of error string */
21622162
strncpy(*errmsg,errstr+8,errlen-1-8);
21632163
}
21642164

21652165
PQclear(result);
21662166
returnret;
21672167
}
21682168

2169+
voidMtmNoticeReceiver(void*i,constPGresult*res)
2170+
{
2171+
char*notice=PQresultErrorMessage(res);
2172+
char*stripped_notice;
2173+
intlen=strlen(notice);
2174+
2175+
/* Skip notices from other nodes */
2176+
if ( (*(int*)i)!=MtmNodeId-1)
2177+
return;
2178+
2179+
stripped_notice=palloc0(len);
2180+
2181+
/* Strip "NOTICE: " from beginning and "\n" from end of error string */
2182+
strncpy(stripped_notice,notice+9,len-1-9);
2183+
2184+
elog(NOTICE,stripped_notice);
2185+
pfree(stripped_notice);
2186+
}
2187+
21692188
staticvoidMtmBroadcastUtilityStmt(charconst*sql,boolignoreError)
21702189
{
21712190
inti=0;
@@ -2194,6 +2213,7 @@ static void MtmBroadcastUtilityStmt(char const* sql, bool ignoreError)
21942213
elog(ERROR,"Failed to establish connection '%s' to node %d",Mtm->nodes[i].con.connStr,failedNode);
21952214
}
21962215
}
2216+
PQsetNoticeReceiver(conns[i],MtmNoticeReceiver,&i);
21972217
}
21982218
}
21992219
Assert(i==MtmNodes);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp