[fix](rpc) fix that coordinator rpc timeout too large may make show load blocked for long time (#12152)

Co-authored-by: wuhangze <wuhangze@jd.com>
This commit is contained in:
Henry2SS
2022-09-01 18:05:37 +08:00
committed by GitHub
parent 068e60145e
commit ad8e2f4749
3 changed files with 15 additions and 4 deletions

View File

@ -1753,4 +1753,12 @@ public class Config extends ConfigBase {
*/
@ConfField(mutable = true)
public static boolean enable_new_es_dsl = true;
/**
* The timeout of executing async remote fragment.
* In normal case, the async remote fragment will be executed in a short time. If system are under high load
* condition,try to set this timeout longer.
*/
@ConfField(mutable = true)
public static long remote_fragment_exec_timeout_ms = 5000; // 5 sec
}

View File

@ -689,13 +689,14 @@ public class Coordinator {
}
}
private void waitRpc(List<Pair<BackendExecStates, Future<PExecPlanFragmentResult>>> futures, long timeoutMs,
private void waitRpc(List<Pair<BackendExecStates, Future<PExecPlanFragmentResult>>> futures, long leftTimeMs,
String operation) throws RpcException, UserException {
if (timeoutMs <= 0) {
if (leftTimeMs <= 0) {
throw new UserException("timeout before waiting for " + operation + " RPC. Elapse(sec): " + (
(System.currentTimeMillis() - timeoutDeadline) / 1000 + queryOptions.query_timeout));
}
long timeoutMs = Math.min(leftTimeMs, Config.remote_fragment_exec_timeout_ms);
for (Pair<BackendExecStates, Future<PExecPlanFragmentResult>> pair : futures) {
TStatusCode code;
String errMsg = null;
@ -720,8 +721,7 @@ public class Coordinator {
code = TStatusCode.INTERNAL_ERROR;
} catch (TimeoutException e) {
exception = e;
errMsg = "timeout when waiting for " + operation + " RPC. Elapse(sec): "
+ ((System.currentTimeMillis() - timeoutDeadline) / 1000 + queryOptions.query_timeout);
errMsg = "timeout when waiting for " + operation + " RPC. Wait(sec): " + timeoutMs / 1000;
code = TStatusCode.TIMEOUT;
}