Skip to content

Commit 2028605

Browse files
authored
Merge pull request #5051 from sysown/v3.0_mirror_crash_fix
Prevent crash when mirroring is configured for PostgreSQL
2 parents 431fda0 + 0de6425 commit 2028605

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/PgSQL_Session.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2443,7 +2443,14 @@ int PgSQL_Session::get_pkts_from_client(bool& wrong_pass, PtrSize_t& pkt) {
24432443
}
24442444
}
24452445
if (mirror == false) {
2446-
handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_COM_QUERY___create_mirror_session();
2446+
if (qpo->mirror_hostgroup >= 0 || qpo->mirror_flagOUT >= 0) {
2447+
const char* query_text = CurrentQuery.get_digest_text();
2448+
proxy_warning("ProxySQL does not currently support query mirroring for PostgreSQL. "
2449+
"The mirror flag(s) will be ignored, but other query rule conditions will still apply. "
2450+
"(mirror_hostgroup=%d, mirror_flagOUT=%d, query='%s')\n",
2451+
qpo->mirror_hostgroup, qpo->mirror_flagOUT, query_text ? query_text : "");
2452+
}
2453+
//handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_COM_QUERY___create_mirror_session();
24472454
}
24482455

24492456
if (autocommit_on_hostgroup >= 0) {

0 commit comments

Comments
 (0)