Repository: incubator-hawq Updated Branches: refs/heads/master c89e43494 -> 2153c6d0e
HAWQ-1436. Print a message to command line if hawq switches from standby RPS to master RPS. Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/2153c6d0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/2153c6d0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/2153c6d0 Branch: refs/heads/master Commit: 2153c6d0ebe2116a87fcf19aec0ff72390c3d45d Parents: c89e434 Author: Wen Lin <[email protected]> Authored: Tue May 16 12:00:39 2017 +0800 Committer: Wen Lin <[email protected]> Committed: Tue May 16 16:35:51 2017 +0800 ---------------------------------------------------------------------- src/backend/libpq/rangerrest.c | 7 +++++++ 1 file changed, 7 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/2153c6d0/src/backend/libpq/rangerrest.c ---------------------------------------------------------------------- diff --git a/src/backend/libpq/rangerrest.c b/src/backend/libpq/rangerrest.c index a8a7324..1210ed5 100644 --- a/src/backend/libpq/rangerrest.c +++ b/src/backend/libpq/rangerrest.c @@ -385,6 +385,7 @@ static int call_ranger_rest(CURL_HANDLE curl_handle, const char* request) int ret = -1; int retry = 2; CURLcode res; + bool switchToMaster = false; Assert(request != NULL); /* @@ -401,6 +402,7 @@ static int call_ranger_rest(CURL_HANDLE curl_handle, const char* request) elog(RANGER_LOG, "master has been talking to standby RPS for more than %d seconds, try switching to master RPS", rps_check_local_interval); + switchToMaster = true; } } @@ -464,6 +466,11 @@ static int call_ranger_rest(CURL_HANDLE curl_handle, const char* request) } else { + if (switchToMaster && !curl_handle->talkingWithStandby) + { + /* master's RPS has recovered, switch from standby's RPS to master's RPS */ + elog(NOTICE, "switch from standby's RPS to master's RPS"); + } if (curl_handle->talkingWithStandby && curl_handle->lastCheckTimestamp == 0) { curl_handle->lastCheckTimestamp = gettime_microsec();
