diff --git a/packaging/docker/Dockerfile b/packaging/docker/Dockerfile index 629f8f9fd6a4167db6f30d29646263710602693a..c0ca674555aa66d1c848b89f8af3f26cc2ee97b6 100644 --- a/packaging/docker/Dockerfile +++ b/packaging/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:18.04 +FROM ubuntu:20.04 WORKDIR /root diff --git a/src/common/inc/tglobal.h b/src/common/inc/tglobal.h index 26475834d5aa91a87e6f8e14e86b211d5b68d6d2..2f4aa4c2b2ad0822fcf7a45987b812376fe5d9f0 100644 --- a/src/common/inc/tglobal.h +++ b/src/common/inc/tglobal.h @@ -44,6 +44,7 @@ extern int32_t tsDnodeId; // common extern int tsRpcTimer; extern int tsRpcMaxTime; +extern int tsRpcForceTcp; // all commands go to tcp protocol if this is enabled extern int32_t tsMaxConnections; extern int32_t tsMaxShellConns; extern int32_t tsShellActivityTimer; diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index 1524f15b7d5df38fe5f9e75d5dd88c4dd6553f0d..3a4a87f69d3a3c86807fb3206d5303e50343b276 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -48,6 +48,7 @@ int32_t tsDnodeId = 0; // common int32_t tsRpcTimer = 1000; int32_t tsRpcMaxTime = 600; // seconds; +int32_t tsRpcForceTcp = 0; //disable this, means query, show command use udp protocol as default int32_t tsMaxShellConns = 50000; int32_t tsMaxConnections = 5000; int32_t tsShellActivityTimer = 3; // second @@ -625,6 +626,16 @@ static void doInitGlobalConfig(void) { cfg.unitType = TAOS_CFG_UTYPE_MS; taosInitConfigOption(cfg); + cfg.option = "rpcForceTcp"; + cfg.ptr = &tsRpcForceTcp; + cfg.valType = TAOS_CFG_VTYPE_INT32; + cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT; + cfg.minValue = 0; + cfg.maxValue = 1; + cfg.ptrLength = 0; + cfg.unitType = TAOS_CFG_UTYPE_NONE; + taosInitConfigOption(cfg); + cfg.option = "rpcMaxTime"; cfg.ptr = &tsRpcMaxTime; cfg.valType = TAOS_CFG_VTYPE_INT32; diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index 2ec508f050ea7cf916f8b1c1e6ff37d18fb96523..08e7551a2e8fe72a24825362c17cf413509de9c3 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -399,7 +399,7 @@ void rpcSendRequest(void *shandle, const SRpcEpSet *pEpSet, SRpcMsg *pMsg, int64 pContext->oldInUse = pEpSet->inUse; pContext->connType = RPC_CONN_UDPC; - if (contLen > tsRpcMaxUdpSize) pContext->connType = RPC_CONN_TCPC; + if (contLen > tsRpcMaxUdpSize || tsRpcForceTcp ) pContext->connType = RPC_CONN_TCPC; // connection type is application specific. // for TDengine, all the query, show commands shall have TCP connection @@ -409,7 +409,7 @@ void rpcSendRequest(void *shandle, const SRpcEpSet *pEpSet, SRpcMsg *pMsg, int64 || type == TSDB_MSG_TYPE_CM_TABLES_META || type == TSDB_MSG_TYPE_CM_TABLE_META || type == TSDB_MSG_TYPE_CM_SHOW || type == TSDB_MSG_TYPE_DM_STATUS) pContext->connType = RPC_CONN_TCPC; - + pContext->rid = taosAddRef(tsRpcRefId, pContext); if (pRid) *pRid = pContext->rid;