Skip to content

Commit

Permalink
test: modify code for sanitizer requires and coverity scan requires (#…
Browse files Browse the repository at this point in the history
…589)

* feat: add two new files benchInsertMix.h .c

* feat: new flow with old method finish

* code is finish,next build and run

* CMakeList add benchInsertMix.c

* feat: benchInserMix.c build passed

* feat: add benchInsertMix.c to all CMakeList.txt

* fix: extern fun execInsert

* feat: add delete logic

* feat: build error to fix

* feat: fix build error

* add mix json config

* feat: add config fill interval

* delete with ts=time or time=time2 end

* problem1: one child table 10w rows 30% disorder gen 2w really

* feat: random is ok

* feat: support start_timestamp with int64 input

* feat: add gen row data by random

* gen rows data start build

* feat: end generate mix row data

* feat: add check insert count function

* feat: fixed duplicate ts key

* feat: finish mix data develop

* apply query system request storage format

* suit commit

* reset modify for args

* adjust suit config

* adjust config for benchmark

* add order100 disorder100 function

* add disorder 100% feature

* add write future and remove  super table

* add checkCorrect feature

* modify lost.json

* fix: rd check zero

* fix calcCount

* printf check passok

* genRule set 3

* checkInterval fixed

* use keep_tring and tring_interval

* use keep_tring and tring_interval

* check correct add retry

* check correct add retry

* check correct add retry

* check correct add retry

* check correct add retry

* check correct add retry

* add anothor ts col

* calcTs format

* add insert interval

* PR Build error

* fix: rd float to uint

* fix: pr remove obsolete files

* fix: pr remove no use files

* fix: no variant declare

* fix: remove obsolete deleteInterval

* test: static code analysis

* set string termination explicitly to solve static code analysis

* test: build error fixed

* test: strcpy replace memcpy

* test: memset after malloc for static code analysis

* add class declare in python function

* test: fixed get queryCnt and queryTs return error.

* test: add coverity rate case

* test: query db incorrect

* test: change 1~4 mix database

* test: exeBufSql change function name to execInsert

* fix; restore ../deps/toolscJson/src/toolscJson.c

* test: fixed 2.x create database failed

* test: fix execInsert return error with failed continue

* test: add real.json for real cluster

* test: modify real.json

* test: fix free result twice

* test: test fix queryTs free result

* test: strncpy max buffer fill

* test: remove strncpy max fill len

* test: check taos_fetch_row return null

* test: strncpy with len-1 copy

* test: strncpy with len-1 copy1

* test: sanitizer build error fixed

* test: taosdump strncpy no string end

---------

Co-authored-by: Shuduo Sang <sangshuduo@gmail.com>
  • Loading branch information
DuanKuanJun and sangshuduo committed Feb 23, 2023
1 parent 1fe8e6f commit 1e15545
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion inc/toolsdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ int32_t toolsCloseDir(TdDirPtr *ppDir);

#define tstrncpy(dst, src, size) \
do { \
strncpy((dst), (src), (size)); \
strncpy((dst), (src), (size)-1); \
(dst)[(size)-1] = 0; \
} while (0)

Expand Down
2 changes: 1 addition & 1 deletion src/benchJsonOpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1367,7 +1367,7 @@ static int getMetaFromQueryJsonFile(tools_cJSON *json) {
g_queryInfo.specifiedQueryInfo.queryTimes
* g_queryInfo.specifiedQueryInfo.concurrent,
sizeof(int64_t), true);
tstrncpy(sql->command, buf, bufLen);
tstrncpy(sql->command, buf, bufLen - 1);
debugPrint("read file buffer: %s\n", sql->command);
memset(buf, 0, TSDB_MAX_ALLOWED_SQL_LEN);
}
Expand Down
3 changes: 2 additions & 1 deletion src/taosdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -8682,10 +8682,11 @@ static int createMTableAvroHeadImp(
char *bytes = malloc(nlen+1);
ASSERT(bytes);

strncpy(bytes,
memcpy(bytes,
subTableDes->cols[subTableDes->columns
+ tag].var_value,
nlen);
bytes[nlen] = 0;
avro_value_set_bytes(&branch, bytes, nlen);
free(bytes);
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/wrapDb.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ int32_t queryCnt(TAOS* taos, char* sql, int64_t* pVal) {
TAOS_FIELD* fields = taos_fetch_fields(res);
TAOS_ROW row = taos_fetch_row(res);
code = taos_errno(res);
if (code != 0) {
if (code != 0 || row == NULL) {
printErrCmdCodeStr(sql, code, res);
return code;
}
Expand Down Expand Up @@ -54,7 +54,7 @@ int32_t queryTS(TAOS* taos, char* sql, int64_t* pVal) {
TAOS_FIELD* fields = taos_fetch_fields(res);
TAOS_ROW row = taos_fetch_row(res);
code = taos_errno(res);
if (code != 0) {
if (code != 0 || row == NULL) {
printErrCmdCodeStr(sql, code, res);
return code;
}
Expand Down

0 comments on commit 1e15545

Please sign in to comment.