diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c index 89da3c5640c6523d4d2a816b8ae0293310c5830a..6abdab4880f837c505eeba10b0dd9af6c1b86974 100644 --- a/src/client/src/tscSql.c +++ b/src/client/src/tscSql.c @@ -29,6 +29,7 @@ #include "ttimer.h" #include "tscProfile.h" +static char clusterDefaultId[] = "clusterDefaultId"; static bool validImpl(const char* str, size_t maxsize) { if (str == NULL) { return false; @@ -193,7 +194,9 @@ TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass, tscBuildAndSendRequest(pSql, NULL); tsem_wait(&pSql->rspSem); - + if (0 == strlen(pSql->pTscObj->clusterId)) { + memcpy(pSql->pTscObj->clusterId, clusterDefaultId, strlen(clusterDefaultId)); + } pSql->pTscObj->pClusterInfo = (SClusterInfo *)tscAcquireClusterInfo(pSql->pTscObj->clusterId); if (pSql->res.code != TSDB_CODE_SUCCESS) { terrno = pSql->res.code; diff --git a/src/client/src/tscSystem.c b/src/client/src/tscSystem.c index f6614fdb79f18b70cadc2351edc8e402e95bf41e..3b3770dae978f079576799190771b9c628cafb31 100644 --- a/src/client/src/tscSystem.c +++ b/src/client/src/tscSystem.c @@ -133,8 +133,8 @@ void tscClusterInfoDestroy(SClusterInfo *pObj) { void *tscAcquireClusterInfo(const char *clusterId) { pthread_mutex_lock(&clusterMutex); - size_t len = strlen(clusterId); + SClusterInfo *pObj = NULL; SClusterInfo **ppObj = taosHashGet(tscClusterMap, clusterId, len); if (ppObj == NULL || *ppObj == NULL) {