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

Commit7a86d88

Browse files
committed
print notices
1 parentb7d599e commit7a86d88

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

‎contrib/mmts/multimaster.c‎

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

21602160
*errmsg=palloc0(errlen);
21612161

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

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

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp