Merge branch 'develop' into coverity_scan

This commit is contained in:
Shuduo Sang 2020-08-04 19:07:36 +08:00
commit 4a9901d6cf
14 changed files with 52 additions and 49 deletions

View File

@ -31,7 +31,7 @@ TDengine的Grafana插件在安装包的/usr/local/taos/connector/grafana目录
![img](../assets/add_datasource3.jpg) ![img](../assets/add_datasource3.jpg)
* Host TDengine 集群的中任意一台服务器的 IP 地址与 TDengine RESTful 接口的端口号(6020),默认 http://localhost:6020。 * Host TDengine 集群的中任意一台服务器的 IP 地址与 TDengine RESTful 接口的端口号(6041),默认 http://localhost:6041
* UserTDengine 用户名。 * UserTDengine 用户名。
* PasswordTDengine 用户密码。 * PasswordTDengine 用户密码。

View File

@ -846,7 +846,7 @@ curl http://192.168.0.1:6041/rest/login/root/taosdata
- 在demo库里查询表d1001的所有记录 - 在demo库里查询表d1001的所有记录
``` ```
curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'select * from demo.d1001' 192.168.0.1:6041/rest/sql` curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'select * from demo.d1001' 192.168.0.1:6041/rest/sql
``` ```
返回值: 返回值:
@ -865,7 +865,7 @@ curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'select * from demo.d1001
- 创建库demo - 创建库demo
``` ```
curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'create database demo' 192.168.0.1:6041/rest/sql` curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'create database demo' 192.168.0.1:6041/rest/sql
``` ```
返回值: 返回值:

View File

@ -3,7 +3,7 @@
<div class="gf-form-group"> <div class="gf-form-group">
<div class="gf-form max-width-30"> <div class="gf-form max-width-30">
<span class="gf-form-label width-7">Host</span> <span class="gf-form-label width-7">Host</span>
<input type="text" class="gf-form-input" ng-model='ctrl.current.url' placeholder="http://localhost:6020" bs-typeahead="{{['http://localhost:6020']}}" required></input> <input type="text" class="gf-form-input" ng-model='ctrl.current.url' placeholder="http://localhost:6041" bs-typeahead="{{['http://localhost:6041']}}" required></input>
</div> </div>
<div class="gf-form-inline"> <div class="gf-form-inline">

View File

@ -13,13 +13,13 @@ docker network create --ip-range 172.15.1.255/24 --subnet 172.15.1.1/16 minidevo
docker run -d --net minidevops --ip 172.15.1.11 -v $LP/grafana:/var/lib/grafana/plugins -p 3000:3000 grafana/grafana docker run -d --net minidevops --ip 172.15.1.11 -v $LP/grafana:/var/lib/grafana/plugins -p 3000:3000 grafana/grafana
#docker run -d --net minidevops --ip 172.15.1.11 -v /Users/tom/Documents/minidevops/grafana:/var/lib/grafana/plugins -p 3000:3000 grafana/grafana #docker run -d --net minidevops --ip 172.15.1.11 -v /Users/tom/Documents/minidevops/grafana:/var/lib/grafana/plugins -p 3000:3000 grafana/grafana
TDENGINE=`docker run -d --net minidevops --ip 172.15.1.6 -p 6030:6030 -p 6020:6020 -p 6031:6031 -p 6032:6032 -p 6033:6033 -p 6034:6034 -p 6035:6035 -p 6036:6036 -p 6037:6037 -p 6038:6038 -p 6039:6039 tdengine/tdengine:1.6.4.5` TDENGINE=`docker run -d --net minidevops --ip 172.15.1.6 -p 6030:6030 -p 6020:6020 -p 6031:6031 -p 6032:6032 -p 6033:6033 -p 6034:6034 -p 6035:6035 -p 6036:6036 -p 6037:6037 -p 6038:6038 -p 6039:6039 -p 6040:6040 -p 6041:6041 -h '172.15.1.6' tdengine/tdengine:2.0.0.0`
docker cp /etc/localtime $TDENGINE:/etc/localtime docker cp /etc/localtime $TDENGINE:/etc/localtime
BLMPROMETHEUS=`docker run -d --net minidevops --ip 172.15.1.7 -p 10203:10203 tdengine/blm_prometheus 172.15.1.6` BLMPROMETHEUS=`docker run -d --net minidevops --ip 172.15.1.7 -v $(pwd)/taos:/etc/taos -p 10203:10203 tdengine/blm_prometheus:2.0.0.0 -tdengine-name 172.15.1.6 -tdengine-api-port 6041`
BLMPTELEGRAF=`docker run -d --net minidevops --ip 172.15.1.8 -p 10202:10202 tdengine/blm_telegraf 172.15.1.6` BLMPTELEGRAF=`docker run -d --net minidevops --ip 172.15.1.8 -p 10202:10202 tdengine/blm_telegraf:2.0.0.0 -host 172.15.1.6`
docker run -d --net minidevops --ip 172.15.1.9 -v $LP/prometheus:/etc/prometheus -p 9090:9090 prom/prometheus docker run -d --net minidevops --ip 172.15.1.9 -v $LP/prometheus:/etc/prometheus -p 9090:9090 prom/prometheus
#docker run -d --net minidevops --ip 172.15.1.9 -v /Users/tom/Documents/minidevops/prometheus:/etc/prometheus -p 9090:9090 prom/prometheus #docker run -d --net minidevops --ip 172.15.1.9 -v /Users/tom/Documents/minidevops/prometheus:/etc/prometheus -p 9090:9090 prom/prometheus
@ -29,7 +29,7 @@ docker run -d --net minidevops --ip 172.15.1.10 -v $LP/telegraf:/etc/telegraf -p
sleep 10 sleep 10
curl -X POST http://localhost:3000/api/datasources --header "Content-Type:application/json" -u admin:admin -d '{"Name": "TDengine","Type": "tdengine","TypeLogoUrl": "public/plugins/tdengine/img/taosdata_logo.png","Access": "proxy","Url": "http://172.15.1.6:6020","BasicAuth": false,"isDefault": true,"jsonData": {},"readOnly": false}' curl -X POST http://localhost:3000/api/datasources --header "Content-Type:application/json" -u admin:admin -d '{"Name": "TDengine","Type": "tdengine","TypeLogoUrl": "public/plugins/tdengine/img/taosdata_logo.png","Access": "proxy","Url": "http://172.15.1.6:6041","BasicAuth": false,"isDefault": true,"jsonData": {},"readOnly": false}'
curl -X POST http://localhost:3000/api/dashboards/db --header "Content-Type:application/json" -u admin:admin -d '{"dashboard":{"annotations":{"list":[{"builtIn":1,"datasource":"-- Grafana --","enable":true,"hide":true,"iconColor":"rgba(0, 211, 255, 1)","name":"Annotations & Alerts","type":"dashboard"}]},"editable":true,"gnetId":null,"graphTooltip":0,"id":1,"links":[],"panels":[{"datasource":null,"gridPos":{"h":8,"w":6,"x":0,"y":0},"id":6,"options":{"fieldOptions":{"calcs":["mean"],"defaults":{"color":{"mode":"thresholds"},"links":[{"title":"","url":""}],"mappings":[],"max":100,"min":0,"thresholds":{"mode":"absolute","steps":[{"color":"green","value":null},{"color":"red","value":80}]},"unit":"percent"},"overrides":[],"values":false},"orientation":"auto","showThresholdLabels":false,"showThresholdMarkers":true},"pluginVersion":"6.6.0","targets":[{"refId":"A","sql":"select last_row(value) from telegraf.mem where field=\"used_percent\""}],"timeFrom":null,"timeShift":null,"title":"Memory used percent","type":"gauge"},{"aliasColors":{},"bars":false,"dashLength":10,"dashes":false,"datasource":null,"fill":1,"fillGradient":0,"gridPos":{"h":8,"w":12,"x":6,"y":0},"hiddenSeries":false,"id":8,"legend":{"avg":false,"current":false,"max":false,"min":false,"show":true,"total":false,"values":false},"lines":true,"linewidth":1,"nullPointMode":"null","options":{"dataLinks":[]},"percentage":false,"pointradius":2,"points":false,"renderer":"flot","seriesOverrides":[],"spaceLength":10,"stack":false,"steppedLine":false,"targets":[{"alias":"MEMUSED-PERCENT","refId":"A","sql":"select avg(value) from telegraf.mem where field=\"used_percent\" interval(1m)"}],"thresholds":[],"timeFrom":null,"timeRegions":[],"timeShift":null,"title":"MEM","tooltip":{"shared":true,"sort":0,"value_type":"individual"},"type":"graph","xaxis":{"buckets":null,"mode":"time","name":null,"show":true,"values":[]},"yaxes":[{"format":"short","label":null,"logBase":1,"max":null,"min":null,"show":true},{"format":"short","label":null,"logBase":1,"max":null,"min":null,"show":true}],"yaxis":{"align":false,"alignLevel":null}},{"datasource":null,"gridPos":{"h":3,"w":18,"x":0,"y":8},"id":10,"options":{"displayMode":"lcd","fieldOptions":{"calcs":["mean"],"defaults":{"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"green","value":null}]},"unit":"percent"},"overrides":[],"values":false},"orientation":"auto","showUnfilled":true},"pluginVersion":"6.6.0","targets":[{"alias":"CPU-SYS","refId":"A","sql":"select last_row(value) from telegraf.cpu where field=\"usage_system\""},{"alias":"CPU-IDLE","refId":"B","sql":"select last_row(value) from telegraf.cpu where field=\"usage_idle\""},{"alias":"CPU-USER","refId":"C","sql":"select last_row(value) from telegraf.cpu where field=\"usage_user\""}],"timeFrom":null,"timeShift":null,"title":"CPU-USED","type":"bargauge"},{"aliasColors":{},"bars":false,"dashLength":10,"dashes":false,"datasource":"TDengine","description":"General CPU monitor","fill":1,"fillGradient":0,"gridPos":{"h":9,"w":18,"x":0,"y":11},"hiddenSeries":false,"id":2,"legend":{"avg":false,"current":false,"max":false,"min":false,"show":true,"total":false,"values":false},"lines":true,"linewidth":1,"nullPointMode":"null","options":{"dataLinks":[]},"percentage":false,"pointradius":2,"points":false,"renderer":"flot","seriesOverrides":[],"spaceLength":10,"stack":false,"steppedLine":false,"targets":[{"alias":"CPU-USER","refId":"A","sql":"select avg(value) from telegraf.cpu where field=\"usage_user\" and cpu=\"cpu-total\" interval(1m)"},{"alias":"CPU-SYS","refId":"B","sql":"select avg(value) from telegraf.cpu where field=\"usage_system\" and cpu=\"cpu-total\" interval(1m)"},{"alias":"CPU-IDLE","refId":"C","sql":"select avg(value) from telegraf.cpu where field=\"usage_idle\" and cpu=\"cpu-total\" interval(1m)"}],"thresholds":[],"timeFrom":null,"timeRegions":[],"timeShift":null,"title":"CPU","tooltip":{"shared":true,"sort":0,"value_type":"individual"},"type":"graph","xaxis":{"buckets":null,"mode":"time","name":null,"show":true,"values":[]},"yaxes":[{"format":"short","label":null,"logBase":1,"max":null,"min":null,"show":true},{"format":"short","label":null,"logBase":1,"max":null,"min":null,"show":true}],"yaxis":{"align":false,"alignLevel":null}}],"refresh":"10s","schemaVersion":22,"style":"dark","tags":["demo"],"templating":{"list":[]},"time":{"from":"now-3h","to":"now"},"timepicker":{"refresh_intervals":["5s","10s","30s","1m","5m","15m","30m","1h","2h","1d"]},"timezone":"","title":"TDengineDashboardDemo","id":null,"uid":null,"version":0}}' curl -X POST http://localhost:3000/api/dashboards/db --header "Content-Type:application/json" -u admin:admin -d '{"dashboard":{"annotations":{"list":[{"builtIn":1,"datasource":"-- Grafana --","enable":true,"hide":true,"iconColor":"rgba(0, 211, 255, 1)","name":"Annotations & Alerts","type":"dashboard"}]},"editable":true,"gnetId":null,"graphTooltip":0,"id":1,"links":[],"panels":[{"datasource":null,"gridPos":{"h":8,"w":6,"x":0,"y":0},"id":6,"options":{"fieldOptions":{"calcs":["mean"],"defaults":{"color":{"mode":"thresholds"},"links":[{"title":"","url":""}],"mappings":[],"max":100,"min":0,"thresholds":{"mode":"absolute","steps":[{"color":"green","value":null},{"color":"red","value":80}]},"unit":"percent"},"overrides":[],"values":false},"orientation":"auto","showThresholdLabels":false,"showThresholdMarkers":true},"pluginVersion":"6.6.0","targets":[{"refId":"A","sql":"select last_row(value) from telegraf.mem where field=\"used_percent\""}],"timeFrom":null,"timeShift":null,"title":"Memory used percent","type":"gauge"},{"aliasColors":{},"bars":false,"dashLength":10,"dashes":false,"datasource":null,"fill":1,"fillGradient":0,"gridPos":{"h":8,"w":12,"x":6,"y":0},"hiddenSeries":false,"id":8,"legend":{"avg":false,"current":false,"max":false,"min":false,"show":true,"total":false,"values":false},"lines":true,"linewidth":1,"nullPointMode":"null","options":{"dataLinks":[]},"percentage":false,"pointradius":2,"points":false,"renderer":"flot","seriesOverrides":[],"spaceLength":10,"stack":false,"steppedLine":false,"targets":[{"alias":"MEMUSED-PERCENT","refId":"A","sql":"select avg(value) from telegraf.mem where field=\"used_percent\" interval(1m)"}],"thresholds":[],"timeFrom":null,"timeRegions":[],"timeShift":null,"title":"MEM","tooltip":{"shared":true,"sort":0,"value_type":"individual"},"type":"graph","xaxis":{"buckets":null,"mode":"time","name":null,"show":true,"values":[]},"yaxes":[{"format":"short","label":null,"logBase":1,"max":null,"min":null,"show":true},{"format":"short","label":null,"logBase":1,"max":null,"min":null,"show":true}],"yaxis":{"align":false,"alignLevel":null}},{"datasource":null,"gridPos":{"h":3,"w":18,"x":0,"y":8},"id":10,"options":{"displayMode":"lcd","fieldOptions":{"calcs":["mean"],"defaults":{"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"green","value":null}]},"unit":"percent"},"overrides":[],"values":false},"orientation":"auto","showUnfilled":true},"pluginVersion":"6.6.0","targets":[{"alias":"CPU-SYS","refId":"A","sql":"select last_row(value) from telegraf.cpu where field=\"usage_system\""},{"alias":"CPU-IDLE","refId":"B","sql":"select last_row(value) from telegraf.cpu where field=\"usage_idle\""},{"alias":"CPU-USER","refId":"C","sql":"select last_row(value) from telegraf.cpu where field=\"usage_user\""}],"timeFrom":null,"timeShift":null,"title":"CPU-USED","type":"bargauge"},{"aliasColors":{},"bars":false,"dashLength":10,"dashes":false,"datasource":"TDengine","description":"General CPU monitor","fill":1,"fillGradient":0,"gridPos":{"h":9,"w":18,"x":0,"y":11},"hiddenSeries":false,"id":2,"legend":{"avg":false,"current":false,"max":false,"min":false,"show":true,"total":false,"values":false},"lines":true,"linewidth":1,"nullPointMode":"null","options":{"dataLinks":[]},"percentage":false,"pointradius":2,"points":false,"renderer":"flot","seriesOverrides":[],"spaceLength":10,"stack":false,"steppedLine":false,"targets":[{"alias":"CPU-USER","refId":"A","sql":"select avg(value) from telegraf.cpu where field=\"usage_user\" and cpu=\"cpu-total\" interval(1m)"},{"alias":"CPU-SYS","refId":"B","sql":"select avg(value) from telegraf.cpu where field=\"usage_system\" and cpu=\"cpu-total\" interval(1m)"},{"alias":"CPU-IDLE","refId":"C","sql":"select avg(value) from telegraf.cpu where field=\"usage_idle\" and cpu=\"cpu-total\" interval(1m)"}],"thresholds":[],"timeFrom":null,"timeRegions":[],"timeShift":null,"title":"CPU","tooltip":{"shared":true,"sort":0,"value_type":"individual"},"type":"graph","xaxis":{"buckets":null,"mode":"time","name":null,"show":true,"values":[]},"yaxes":[{"format":"short","label":null,"logBase":1,"max":null,"min":null,"show":true},{"format":"short","label":null,"logBase":1,"max":null,"min":null,"show":true}],"yaxis":{"align":false,"alignLevel":null}}],"refresh":"10s","schemaVersion":22,"style":"dark","tags":["demo"],"templating":{"list":[]},"time":{"from":"now-3h","to":"now"},"timepicker":{"refresh_intervals":["5s","10s","30s","1m","5m","15m","30m","1h","2h","1d"]},"timezone":"","title":"TDengineDashboardDemo","id":null,"uid":null,"version":0}}'

1
minidevops/taos/taos.cfg Normal file
View File

@ -0,0 +1 @@
debugFlag 135

View File

@ -220,15 +220,16 @@ static void tscProcessStreamRetrieveResult(void *param, TAOS_RES *res, int numOf
STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(&pSql->cmd, 0, 0); STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(&pSql->cmd, 0, 0);
if (numOfRows > 0) { // when reaching here the first execution of stream computing is successful. if (numOfRows > 0) { // when reaching here the first execution of stream computing is successful.
pStream->numOfRes += numOfRows;
for(int32_t i = 0; i < numOfRows; ++i) { for(int32_t i = 0; i < numOfRows; ++i) {
TAOS_ROW row = taos_fetch_row(res); TAOS_ROW row = taos_fetch_row(res);
if (row != NULL) {
tscDebug("%p stream:%p fetch result", pSql, pStream); tscDebug("%p stream:%p fetch result", pSql, pStream);
tscStreamFillTimeGap(pStream, *(TSKEY*)row[0]); tscStreamFillTimeGap(pStream, *(TSKEY*)row[0]);
pStream->stime = *(TSKEY *)row[0]; pStream->stime = *(TSKEY *)row[0];
// user callback function // user callback function
(*pStream->fp)(pStream->param, res, row); (*pStream->fp)(pStream->param, res, row);
pStream->numOfRes++;
}
} }
if (!pStream->isProject) { if (!pStream->isProject) {

View File

@ -203,6 +203,7 @@ static void tscProcessSubscriptionTimer(void *handle, void *tmrId) {
static SArray* getTableList( SSqlObj* pSql ) { static SArray* getTableList( SSqlObj* pSql ) {
const char* p = strstr( pSql->sqlstr, " from " ); const char* p = strstr( pSql->sqlstr, " from " );
assert(p != NULL); // we are sure this is a 'select' statement
char* sql = alloca(strlen(p) + 32); char* sql = alloca(strlen(p) + 32);
sprintf(sql, "select tbid(tbname)%s", p); sprintf(sql, "select tbid(tbname)%s", p);

View File

@ -3,7 +3,7 @@
<div class="gf-form-group"> <div class="gf-form-group">
<div class="gf-form max-width-30"> <div class="gf-form max-width-30">
<span class="gf-form-label width-7">Host</span> <span class="gf-form-label width-7">Host</span>
<input type="text" class="gf-form-input" ng-model='ctrl.current.url' placeholder="http://localhost:6020" bs-typeahead="{{['http://localhost:6020']}}" required></input> <input type="text" class="gf-form-input" ng-model='ctrl.current.url' placeholder="http://localhost:6041" bs-typeahead="{{['http://localhost:6041']}}" required></input>
</div> </div>
<div class="gf-form-inline"> <div class="gf-form-inline">

View File

@ -3,7 +3,7 @@
<div class="gf-form-group"> <div class="gf-form-group">
<div class="gf-form max-width-30"> <div class="gf-form max-width-30">
<span class="gf-form-label width-7">Host</span> <span class="gf-form-label width-7">Host</span>
<input type="text" class="gf-form-input" ng-model='ctrl.current.url' placeholder="http://localhost:6020" bs-typeahead="{{['http://localhost:6020']}}" required></input> <input type="text" class="gf-form-input" ng-model='ctrl.current.url' placeholder="http://localhost:6041" bs-typeahead="{{['http://localhost:6041']}}" required></input>
</div> </div>
<div class="gf-form-inline"> <div class="gf-form-inline">

View File

@ -220,28 +220,34 @@ static void sendTelemetryReport() {
taosWriteSocket(fd, tbufGetData(&bw, false), contLen); taosWriteSocket(fd, tbufGetData(&bw, false), contLen);
tbufCloseWriter(&bw); tbufCloseWriter(&bw);
taosReadSocket(fd, buf, 10); // read something to avoid nginx error 499 // read something to avoid nginx error 499
if (taosReadSocket(fd, buf, 10) < 0) {
dTrace("failed to receive response, reason:%s", strerror(errno));
}
taosCloseSocket(fd); taosCloseSocket(fd);
} }
static void* telemetryThread(void* param) { static void* telemetryThread(void* param) {
int timeToWait = 0; struct timespec end = {0};
clock_gettime(CLOCK_REALTIME, &end);
end.tv_sec += 300; // wait 5 minutes to send first report
while (1) { while (1) {
if (timeToWait <= 0) { while (1) {
if (sem_timedwait(&tsExitSem, &end) == 0) {
return NULL;
}
struct timespec now = {0};
clock_gettime(CLOCK_REALTIME, &now);
if (now.tv_sec > end.tv_sec || (now.tv_sec == end.tv_sec && now.tv_nsec >= end.tv_nsec)) {
break;
}
}
if (sdbIsMaster()) { if (sdbIsMaster()) {
sendTelemetryReport(); sendTelemetryReport();
} }
timeToWait = REPORT_INTERVAL; end.tv_sec += REPORT_INTERVAL;
}
int startAt = taosGetTimestampSec();
struct timespec timeout = {.tv_sec = 0, .tv_nsec = 0};
clock_gettime(CLOCK_REALTIME, &timeout);
timeout.tv_sec += timeToWait;
if (sem_timedwait(&tsExitSem, &timeout) == 0) {
break;
}
timeToWait -= (taosGetTimestampSec() - startAt);
} }
return NULL; return NULL;

View File

@ -275,7 +275,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
fprintf(stderr, "Invalid path %s\n", arg); fprintf(stderr, "Invalid path %s\n", arg);
return -1; return -1;
} }
strcpy(configDir, full_path.we_wordv[0]); tstrncpy(configDir, full_path.we_wordv[0], TSDB_FILENAME_LEN);
wordfree(&full_path); wordfree(&full_path);
break; break;
case 'e': case 'e':
@ -597,7 +597,7 @@ int32_t taosSaveTableOfMetricToTempFile(TAOS *taosCon, char* metric, struct argu
numOfThread++; numOfThread++;
} }
memset(tableRecord.name, 0, sizeof(STableRecord)); memset(&tableRecord, 0, sizeof(STableRecord));
tstrncpy(tableRecord.name, (char *)row[0], fields[0].bytes); tstrncpy(tableRecord.name, (char *)row[0], fields[0].bytes);
tstrncpy(tableRecord.metric, metric, TSDB_TABLE_NAME_LEN); tstrncpy(tableRecord.metric, metric, TSDB_TABLE_NAME_LEN);
@ -851,6 +851,7 @@ int taosGetTableDes(char *table, STableDef *tableDes, TAOS* taosCon, bool isSupe
if (code != 0) { if (code != 0) {
fprintf(stderr, "failed to run command %s\n", tempCommand); fprintf(stderr, "failed to run command %s\n", tempCommand);
free(tempCommand); free(tempCommand);
free(tbuf);
taos_free_result(tmpResult); taos_free_result(tmpResult);
return -1; return -1;
} }
@ -876,6 +877,7 @@ int taosGetTableDes(char *table, STableDef *tableDes, TAOS* taosCon, bool isSupe
if (isSuperTable) { if (isSuperTable) {
free(tempCommand); free(tempCommand);
free(tbuf);
return count; return count;
} }
@ -891,6 +893,7 @@ int taosGetTableDes(char *table, STableDef *tableDes, TAOS* taosCon, bool isSupe
if (code != 0) { if (code != 0) {
fprintf(stderr, "failed to run command %s\n", tempCommand); fprintf(stderr, "failed to run command %s\n", tempCommand);
free(tempCommand); free(tempCommand);
free(tbuf);
taos_free_result(tmpResult); taos_free_result(tmpResult);
return -1; return -1;
} }
@ -901,6 +904,7 @@ int taosGetTableDes(char *table, STableDef *tableDes, TAOS* taosCon, bool isSupe
if (NULL == row) { if (NULL == row) {
fprintf(stderr, " fetch failed to run command %s\n", tempCommand); fprintf(stderr, " fetch failed to run command %s\n", tempCommand);
free(tempCommand); free(tempCommand);
free(tbuf);
taos_free_result(tmpResult); taos_free_result(tmpResult);
return -1; return -1;
} }
@ -961,6 +965,7 @@ int taosGetTableDes(char *table, STableDef *tableDes, TAOS* taosCon, bool isSupe
} }
free(tempCommand); free(tempCommand);
free(tbuf);
return count; return count;
} }
@ -1835,7 +1840,7 @@ static void taosParseDirectory(const char *directoryName, const char *prefix, ch
} }
int fileNum = 0; int fileNum = 0;
while (fscanf(fp, "%s", fileArray[fileNum++])) { while (fscanf(fp, "%128s", fileArray[fileNum++])) {
if (strcmp(fileArray[fileNum-1], tsDbSqlFile) == 0) { if (strcmp(fileArray[fileNum-1], tsDbSqlFile) == 0) {
fileNum--; fileNum--;
} }
@ -1864,7 +1869,7 @@ static void taosCheckTablesSQLFile(const char *directoryName)
exit(0); exit(0);
} }
while (fscanf(fp, "%s", tsDbSqlFile)) { while (fscanf(fp, "%128s", tsDbSqlFile)) {
break; break;
} }
@ -1922,20 +1927,6 @@ static FILE* taosOpenDumpInFile(char *fptr) {
char *fname = full_path.we_wordv[0]; char *fname = full_path.we_wordv[0];
if (access(fname, F_OK) != 0) {
fprintf(stderr, "ERROR: file %s is not exist\n", fptr);
wordfree(&full_path);
return NULL;
}
if (access(fname, R_OK) != 0) {
fprintf(stderr, "ERROR: file %s is not readable\n", fptr);
wordfree(&full_path);
return NULL;
}
FILE *f = fopen(fname, "r"); FILE *f = fopen(fname, "r");
if (f == NULL) { if (f == NULL) {
fprintf(stderr, "ERROR: failed to open file %s\n", fname); fprintf(stderr, "ERROR: failed to open file %s\n", fname);

View File

@ -39,6 +39,7 @@ class TDSimClient:
"udebugFlag": "135", "udebugFlag": "135",
"jnidebugFlag": "135", "jnidebugFlag": "135",
"qdebugFlag": "135", "qdebugFlag": "135",
"telemetryReporting": "0",
} }
def init(self, path): def init(self, path):
self.__init__() self.__init__()

View File

@ -36,6 +36,7 @@ class TDSimClient:
"udebugFlag": "135", "udebugFlag": "135",
"jnidebugFlag": "135", "jnidebugFlag": "135",
"qdebugFlag": "135", "qdebugFlag": "135",
"telemetryReporting": "0",
} }
def init(self, path): def init(self, path):

View File

@ -36,6 +36,7 @@ class TDSimClient:
"udebugFlag": "135", "udebugFlag": "135",
"jnidebugFlag": "135", "jnidebugFlag": "135",
"qdebugFlag": "135", "qdebugFlag": "135",
"telemetryReporting": "0",
} }
def init(self, path): def init(self, path):