Skip to content

Commit

Permalink
Merge pull request #705 from taosdata/main
Browse files Browse the repository at this point in the history
merge main to 3.0
  • Loading branch information
DuanKuanJun committed Sep 18, 2023
2 parents 3f8a5dd + df061ca commit f5bc51a
Show file tree
Hide file tree
Showing 18 changed files with 771 additions and 92 deletions.
6 changes: 3 additions & 3 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
taosbenchmark-3.2.2
taosdump-2.5.2
2.5.3
taosbenchmark-3.2.3
taosdump-2.5.4
2.5.4
92 changes: 92 additions & 0 deletions example/insertDemo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"filetype": "insert",
"cfgdir": "/etc/taos",
"host": "127.0.0.1",
"port": 6030,
"user": "root",
"password": "taosdata",
"connection_pool_size": 8,
"thread_count": 4,
"create_table_thread_count": 7,
"result_file": "./insert_res.txt",
"confirm_parameter_prompt": "no",
"insert_interval": 0,
"interlace_rows": 100,
"num_of_records_per_req": 20000,
"prepared_rand": 10000,
"chinese": "no",
"escape_character": "yes",
"databases": [
{
"dbinfo": {
"name": "smartmeters",
"drop": "yes",
"vgroups": 4,
"duration": 3650,
"pages": 512,
"minrows":10000,
"maxrows":20000,
"stt_trigger":1,
"wal_retention_period": 10,
"wal_retention_size": 100,
"cachemodel": "'both'",
"precision": "ms"
},
"super_tables": [
{
"name": "meters",
"child_table_exists": "no",
"childtable_count": 100000,
"childtable_prefix": "d",
"auto_create_table": "no",
"batch_create_tbl_num": 5,
"data_source": "rand",
"insert_mode": "taosc",
"non_stop_mode": "no",
"line_protocol": "line",
"insert_rows": 100000,
"childtable_limit": 10,
"childtable_offset": 100,
"interlace_rows": 0,
"insert_interval": 0,
"partial_col_num": 0,
"disorder_ratio": 0,
"disorder_range": 1000,
"timestamp_step": 900000,
"angle_step": 180000,
"start_timestamp": "2020-06-01 00:00:00.000",
"sample_format": "csv",
"sample_file": "./sample.csv",
"use_sample_ts": "no",
"tags_file": "",
"columns": [
{ "type": "FLOAT", "name": "current", "fun": "3*sin(x)+10*random(2)"},
{ "type": "INT", "name": "voltage", "fun": "40*sin(x)+200*random(10)"},
{ "type": "FLOAT", "name": "phase", "fun": "1*sin(x)+1*random(3)"}
],
"tags": [
{
"type": "TINYINT",
"name": "groupid",
"max": 10,
"min": 1
},
{
"name": "location",
"type": "BINARY",
"len": 16,
"values": ["BJ.HaiDian", "BJ.ChaoYang","BJ.FengTai",
"BJ.DongCheng", "BJ.XiCheng", "Bj.YanQing", "BJ.MenTouGou",
"BJ.HuaiRou", "BJ.PingGu", "BJ.MiYun",
"SH.HuangPu", "SH.XuHui", "SH.ChangNing", "SH.JingAn", "SH.PuTuo",
"SH.HongKou", "SH.YangPu", "SH.MinHang", "SH.BaoShan", "SH.JiaDing",
"SH.JinShan", "SH.SongJiang", "SH.QingPu", "SH.FengXian", "SH.ChongMing",
"SH.PuDong"
]
}
]
}
]
}
]
}
78 changes: 78 additions & 0 deletions example/insert_math.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"filetype": "insert",
"cfgdir": "/etc/taos",
"host": "127.0.0.1",
"port": 6030,
"user": "root",
"password": "taosdata",
"connection_pool_size": 8,
"thread_count": 4,
"create_table_thread_count": 7,
"result_file": "./insert_res.txt",
"confirm_parameter_prompt": "no",
"insert_interval": 0,
"interlace_rows": 100,
"num_of_records_per_req": 100,
"prepared_rand": 3600,
"chinese": "no",
"escape_character": "yes",
"databases": [
{
"dbinfo": {
"name": "test",
"drop": "yes",
"precision": "ms"
},
"super_tables": [
{
"name": "meters",
"child_table_exists": "no",
"childtable_count": 1000,
"childtable_prefix": "d",
"auto_create_table": "no",
"batch_create_tbl_num": 5,
"data_source": "rand",
"insert_mode": "taosc",
"non_stop_mode": "no",
"line_protocol": "line",
"insert_rows": 1000,
"childtable_limit": 10,
"childtable_offset": 100,
"interlace_rows": 0,
"insert_interval": 0,
"partial_col_num": 0,
"disorder_ratio": 0,
"disorder_range": 1000,
"timestamp_step": 1000,
"angle_step": 500,
"start_timestamp": "2020-10-01 00:00:00.000",
"sample_format": "csv",
"sample_file": "./sample.csv",
"use_sample_ts": "no",
"tags_file": "",
"columns": [
{ "type": "FLOAT", "name": "current", "fun": "3*sin(x)+10*random(2)"},
{ "type": "INT", "name": "voltage", "fun": "40*sin(x)+200*random(10)"},
{ "type": "FLOAT", "name": "phase", "fun": "1*sin(x)+1*random(3)"}
],
"tags": [
{
"type": "TINYINT",
"name": "groupid",
"max": 10,
"min": 1
},
{
"name": "location",
"type": "BINARY",
"len": 16,
"values": ["San Francisco", "Los Angles", "San Diego",
"San Jose", "Palo Alto", "Campbell", "Mountain View",
"Sunnyvale", "Santa Clara", "Cupertino"]
}
]
}
]
}
]
}
19 changes: 19 additions & 0 deletions inc/bench.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ typedef unsigned __int32 uint32_t;
#define BENCH_INTERVAL \
"Insert interval for interlace mode in milliseconds, default is 0."
#define BENCH_STEP "Timestamp step in milliseconds, default is 1."
#define ANGLE_STEP "Angle step in milliseconds, default is 1."
#define BENCH_SUPPLEMENT \
"Supplementally insert data without create " \
"database and table, optional, default is off."
Expand Down Expand Up @@ -248,6 +249,7 @@ typedef unsigned __int32 uint32_t;
"Specify interval between keep trying insert. " \
"Valid value is a positive number. Only valid " \
"when keep trying be enabled."
#define BENCH_NODROP "Do not drop database."

#ifdef WEBSOCKET
#define BENCH_DSN "The dsn to connect the cloud service."
Expand Down Expand Up @@ -553,6 +555,15 @@ typedef struct SChildField {
StmtData stmtData;
} ChildField;

#define PI 3.141592654
#define ATOR(x) (x*3.141592654/180)

#define FUNTYPE_NONE 0
#define FUNTYPE_SIN 1
#define FUNTYPE_COS 2

#define FUNTYPE_CNT 2

typedef struct SField {
uint8_t type;
char name[TSDB_COL_NAME_LEN + 1];
Expand All @@ -563,6 +574,13 @@ typedef struct SField {
int64_t max;
int64_t min;
tools_cJSON * values;

// fun
uint8_t funType;
float multiple;
int32_t addend;
int32_t random;

bool sma;
} Field;

Expand Down Expand Up @@ -666,6 +684,7 @@ typedef struct SSuperTable_S {
uint64_t insert_interval;
uint64_t insertRows;
uint64_t timestamp_step;
uint64_t angle_step;
int64_t startTimestamp;
int64_t specifiedColumns;
char sampleFile[MAX_FILE_NAME_LEN];
Expand Down
20 changes: 10 additions & 10 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin
FIND_LIBRARY(LIBZ_LIBRARY z)
MESSAGE(${ARGP_LIBRARY})

TARGET_LINK_LIBRARIES(taosBenchmark taos pthread toolscJson $<$<BOOL:${LIBZ_LIBRARY}>:${LIBZ_LIBRARY}> $<$<BOOL:${ARGP_LIBRARY}>:${ARGP_LIBRARY}> ${WEBSOCKET_LINK_FLAGS})
TARGET_LINK_LIBRARIES(taosdump taos avro jansson atomic pthread argp $<$<BOOL:${LIBZ_LIBRARY}>:${LIBZ_LIBRARY}> $<$<BOOL:${ARGP_LIBRARY}>:${ARGP_LIBRARY}> ${WEBSOCKET_LINK_FLAGS})
TARGET_LINK_LIBRARIES(taosBenchmark taos pthread m toolscJson $<$<BOOL:${LIBZ_LIBRARY}>:${LIBZ_LIBRARY}> $<$<BOOL:${ARGP_LIBRARY}>:${ARGP_LIBRARY}> ${WEBSOCKET_LINK_FLAGS})
TARGET_LINK_LIBRARIES(taosdump taos avro jansson atomic pthread m argp $<$<BOOL:${LIBZ_LIBRARY}>:${LIBZ_LIBRARY}> $<$<BOOL:${ARGP_LIBRARY}>:${ARGP_LIBRARY}> ${WEBSOCKET_LINK_FLAGS})
ELSEIF(${OS_ID} MATCHES "Darwin")
ADD_LIBRARY(argp STATIC IMPORTED)
IF (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
Expand All @@ -319,11 +319,11 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin
SET_PROPERTY(TARGET argp PROPERTY IMPORTED_LOCATION "/usr/local/lib/libargp.a")
INCLUDE_DIRECTORIES(/usr/local/include/)
ENDIF ()
TARGET_LINK_LIBRARIES(taosBenchmark taos pthread toolscJson argp ${WEBSOCKET_LINK_FLAGS})
TARGET_LINK_LIBRARIES(taosBenchmark taos pthread m toolscJson argp ${WEBSOCKET_LINK_FLAGS})
ElSE ()
MESSAGE("${Yellow} DEBUG mode use shared avro library to link for debug ${ColourReset}")
TARGET_LINK_LIBRARIES(taosdump taos avro jansson atomic pthread ${WEBSOCKET_LINK_FLAGS} ${GCC_COVERAGE_LINK_FLAGS})
TARGET_LINK_LIBRARIES(taosBenchmark taos pthread toolscJson ${WEBSOCKET_LINK_FLAGS} ${GCC_COVERAGE_LINK_FLAGS})
TARGET_LINK_LIBRARIES(taosdump taos avro jansson atomic pthread m ${WEBSOCKET_LINK_FLAGS} ${GCC_COVERAGE_LINK_FLAGS})
TARGET_LINK_LIBRARIES(taosBenchmark taos pthread m toolscJson ${WEBSOCKET_LINK_FLAGS} ${GCC_COVERAGE_LINK_FLAGS})
ENDIF()

ELSE ()
Expand Down Expand Up @@ -362,7 +362,7 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin
INCLUDE_DIRECTORIES(/usr/local/include/)
ENDIF ()

TARGET_LINK_LIBRARIES(taosBenchmark taos pthread toolscJson argp ${WEBSOCKET_LINK_FLAGS})
TARGET_LINK_LIBRARIES(taosBenchmark taos pthread m toolscJson argp ${WEBSOCKET_LINK_FLAGS})
ELSE ()
EXECUTE_PROCESS (
COMMAND sh -c "awk -F= '/^ID=/{print $2}' /etc/os-release |tr -d '\n' | tr -d '\"'"
Expand Down Expand Up @@ -414,10 +414,10 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin
MESSAGE(${LIBZ_LIBRARY})

TARGET_LINK_LIBRARIES(taosdump taos avro jansson snappy stdc++ lzma atomic pthread $<$<BOOL:${LIBZ_LIBRARY}>:${LIBZ_LIBRARY}> $<$<BOOL:${ARGP_LIBRARY}>:${ARGP_LIBRARY}> ${WEBSOCKET_LINK_FLAGS} ${GCC_COVERAGE_LINK_FLAGS})
TARGET_LINK_LIBRARIES(taosBenchmark taos pthread toolscJson $<$<BOOL:${LIBZ_LIBRARY}>:${LIBZ_LIBRARY}> $<$<BOOL:${ARGP_LIBRARY}>:${ARGP_LIBRARY}> ${WEBSOCKET_LINK_FLAGS} ${GCC_COVERAGE_LINK_FLAGS})
TARGET_LINK_LIBRARIES(taosBenchmark taos pthread m toolscJson $<$<BOOL:${LIBZ_LIBRARY}>:${LIBZ_LIBRARY}> $<$<BOOL:${ARGP_LIBRARY}>:${ARGP_LIBRARY}> ${WEBSOCKET_LINK_FLAGS} ${GCC_COVERAGE_LINK_FLAGS})
ELSE()
TARGET_LINK_LIBRARIES(taosdump taos avro jansson snappy stdc++ lzma libz-static atomic pthread ${WEBSOCKET_LINK_FLAGS} ${GCC_COVERAGE_LINK_FLAGS})
TARGET_LINK_LIBRARIES(taosBenchmark taos pthread toolscJson ${WEBSOCKET_LINK_FLAGS} ${GCC_COVERAGE_LINK_FLAGS})
TARGET_LINK_LIBRARIES(taosBenchmark taos pthread m toolscJson ${WEBSOCKET_LINK_FLAGS} ${GCC_COVERAGE_LINK_FLAGS})
ENDIF()
ENDIF ()

Expand All @@ -443,9 +443,9 @@ ELSE ()

IF (${WEBSOCKET})
INCLUDE_DIRECTORIES(/usr/local/include/)
SET(WEBSOCKET_LINK_FLAGS "taosws.dll.lib")
SET(WEBSOCKET_LINK_FLAGS "taosws.lib")
IF (${CMAKE_PROJECT_NAME} STREQUAL "taos-tools")
MESSAGE("taosws.dll.lib need to be installed first")
MESSAGE("taosws.lib need to be installed first")
ELSE ()
ADD_DEPENDENCIES(taosBenchmark taosws-rs)
ADD_DEPENDENCIES(taosdump taosws-rs)
Expand Down
22 changes: 20 additions & 2 deletions src/benchCommandOpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,28 @@ static void initStable() {
tstrncpy(c3->name, "phase", TSDB_COL_NAME_LEN + 1);

c1->min = 9;
c1->max = 10;
c1->max = 10;
// fun = "3*sin(x)+10*random(2)"
c1->funType = FUNTYPE_SIN;
c1->multiple = 3;
c1->random = 2;
c1->addend = 10;

c2->min = 110;
c2->max = 119;
// fun = "40*sin(x)+200*random(10)"
c2->funType = FUNTYPE_SIN;
c2->multiple = 40;
c2->random = 10;
c2->addend = 200;

c3->min = 115;
c3->max = 125;
// fun = "1*sin(x)+1*random(3)"
c3->funType = FUNTYPE_SIN;
c3->multiple = 1;
c3->random = 3;
c3->addend = 1;

stbInfo->tags = benchArrayInit(2, sizeof(Field));
for (int i = 0; i < 2; ++i) {
Expand All @@ -166,6 +183,7 @@ static void initStable() {

stbInfo->insert_interval = 0;
stbInfo->timestamp_step = 1;
stbInfo->angle_step = 1;
stbInfo->interlaceRows = 0;
stbInfo->childTblCount = DEFAULT_CHILDTABLES;
stbInfo->childTblLimit = 0;
Expand Down Expand Up @@ -349,7 +367,7 @@ void modifyArgument() {

if (g_arguments->demo_mode && TAOSC_IFACE == g_arguments->iface) {
g_arguments->mistMode = true;
g_arguments->prepared_rand = 57;
g_arguments->prepared_rand = 360;
}
}

Expand Down
Loading

0 comments on commit f5bc51a

Please sign in to comment.