diff --git a/source/client/src/clientMonitor.c b/source/client/src/clientMonitor.c index 6a75b8ef55..2488fa12b3 100644 --- a/source/client/src/clientMonitor.c +++ b/source/client/src/clientMonitor.c @@ -727,19 +727,22 @@ static void monitorSendAllSlowLogFromTempDir(int64_t clusterId) { tscError("failed to open file:%s since %s", filename, terrstr()); continue; } + char* tmp = taosStrdup(filename); + if (tmp == NULL) { + tscError("failed to dup string:%s since %s", filename, terrstr()); + continue; + } if (taosLockFile(pFile) < 0) { tscInfo("failed to lock file:%s since %s, maybe used by other process", filename, terrstr()); int32_t ret = taosCloseFile(&pFile); if (ret != 0){ tscError("failed to close file:%p ret:%d", pFile, ret); } + taosMemoryFree(tmp); continue; } - char* tmp = taosStrdup(filename); - if (tmp != NULL){ - monitorSendSlowLogAtBeginning(clusterId, &tmp, pFile, 0); - taosMemoryFree(tmp); - } + monitorSendSlowLogAtBeginning(clusterId, &tmp, pFile, 0); + taosMemoryFree(tmp); } int32_t ret = taosCloseDir(&pDir); diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 611d76f606..f466c3bde1 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -300,6 +300,7 @@ void tmq_conf_destroy(tmq_conf_t* conf) { tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value) { int32_t code = 0; if (conf == NULL || key == NULL || value == NULL) { + tscError("tmq_conf_set null, conf:%p key:%p value:%p", conf, key, value); return TMQ_CONF_INVALID; } if (strcasecmp(key, "group.id") == 0) { @@ -320,6 +321,7 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value conf->autoCommit = false; return TMQ_CONF_OK; } else { + tscError("invalid value for enable.auto.commit: %s", value); return TMQ_CONF_INVALID; } } @@ -328,6 +330,7 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value int64_t tmp; code = taosStr2int64(value, &tmp); if (tmp < 0 || code != 0) { + tscError("invalid value for auto.commit.interval.ms: %s", value); return TMQ_CONF_INVALID; } conf->autoCommitInterval = (tmp > INT32_MAX ? INT32_MAX : tmp); @@ -338,6 +341,7 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value int64_t tmp; code = taosStr2int64(value, &tmp); if (tmp < 6000 || tmp > 1800000 || code != 0) { + tscError("invalid value for session.timeout.ms: %s", value); return TMQ_CONF_INVALID; } conf->sessionTimeoutMs = tmp; @@ -348,6 +352,7 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value int64_t tmp; code = taosStr2int64(value, &tmp); if (tmp < 1000 || tmp >= conf->sessionTimeoutMs || code != 0) { + tscError("invalid value for heartbeat.interval.ms: %s", value); return TMQ_CONF_INVALID; } conf->heartBeatIntervalMs = tmp; @@ -358,6 +363,7 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value int32_t tmp; code = taosStr2int32(value, &tmp); if (tmp < 1000 || code != 0) { + tscError("invalid value for max.poll.interval.ms: %s", value); return TMQ_CONF_INVALID; } conf->maxPollIntervalMs = tmp; @@ -375,6 +381,7 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value conf->resetOffset = TMQ_OFFSET__RESET_LATEST; return TMQ_CONF_OK; } else { + tscError("invalid value for auto.offset.reset: %s", value); return TMQ_CONF_INVALID; } } @@ -387,6 +394,7 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value conf->withTbName = false; return TMQ_CONF_OK; } else { + tscError("invalid value for msg.with.table.name: %s", value); return TMQ_CONF_INVALID; } } @@ -399,6 +407,7 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value conf->snapEnable = false; return TMQ_CONF_OK; } else { + tscError("invalid value for experimental.snapshot.enable: %s", value); return TMQ_CONF_INVALID; } } @@ -406,6 +415,7 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value if (strcasecmp(key, "td.connect.ip") == 0) { void *tmp = taosStrdup(value); if (tmp == NULL) { + tscError("tmq_conf_set out of memory:%d", terrno); return TMQ_CONF_INVALID; } conf->ip = tmp; @@ -415,6 +425,7 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value if (strcasecmp(key, "td.connect.user") == 0) { void *tmp = taosStrdup(value); if (tmp == NULL) { + tscError("tmq_conf_set out of memory:%d", terrno); return TMQ_CONF_INVALID; } conf->user = tmp; @@ -424,6 +435,7 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value if (strcasecmp(key, "td.connect.pass") == 0) { void *tmp = taosStrdup(value); if (tmp == NULL) { + tscError("tmq_conf_set out of memory:%d", terrno); return TMQ_CONF_INVALID; } conf->pass = tmp; @@ -434,6 +446,7 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value int64_t tmp; code = taosStr2int64(value, &tmp); if (tmp <= 0 || tmp > 65535 || code != 0) { + tscError("invalid value for td.connect.port: %s", value); return TMQ_CONF_INVALID; } @@ -449,6 +462,7 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value conf->replayEnable = false; return TMQ_CONF_OK; } else { + tscError("invalid value for enable.replay: %s", value); return TMQ_CONF_INVALID; } } @@ -470,6 +484,7 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value return TMQ_CONF_OK; } + tscError("unknown key: %s", key); return TMQ_CONF_UNKNOWN; }