Skip to content

Commit

Permalink
feat: taosbenchmark tbname in range (#566)
Browse files Browse the repository at this point in the history
* feat: taosbenchmark support specifying child tables from and to

* feat: add basic variables for from/to/continue_if_fail

* feat: refactor fill child tbl name func

* feat: continue-if-fail smart
  • Loading branch information
sangshuduo committed Feb 7, 2023
1 parent 37ed8da commit e04f39b
Show file tree
Hide file tree
Showing 10 changed files with 727 additions and 100 deletions.
84 changes: 84 additions & 0 deletions example/insert-from-to.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"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": 10000,
"chinese": "no",
"databases": [
{
"dbinfo": {
"name": "test",
"drop": "no",
"precision": "ms"
},
"super_tables": [
{
"name": "meters",
"child_table_exists": "yes",
"childtable_count": 10,
"childtable_prefix": "d",
"escape_character": "yes",
"auto_create_table": "no",
"batch_create_tbl_num": 5,
"data_source": "rand",
"insert_mode": "taosc",
"non_stop_mode": "no",
"line_protocol": "line",
"insert_rows": 10,
"childtable_from": 2,
"childtable_to": 5,
"continue_if_fail": "no",
"interlace_rows": 0,
"insert_interval": 0,
"partial_col_num": 0,
"disorder_ratio": 0,
"disorder_range": 1000,
"timestamp_step": 10,
"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",
"count": 1,
"max": 12,
"min": 8
},
{ "type": "INT", "name": "voltage", "max": 225, "min": 215 },
{ "type": "FLOAT", "name": "phase", "max": 1, "min": 0 }
],
"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"]
}
]
}
]
}
]
}
12 changes: 11 additions & 1 deletion inc/bench.h
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,12 @@ typedef struct STSMA {
bool done;
} TSMA;

enum CONTINUE_IF_FAIL_MODE {
NO_IF_FAILED, // 0
YES_IF_FAILED, // 1
SMART_IF_FAILED, // 2
};

typedef struct SSuperTable_S {
char * stbName;
bool random_data_source; // rand_gen or sample
Expand All @@ -483,6 +489,9 @@ typedef struct SSuperTable_S {
uint16_t lineProtocol;
uint64_t childTblLimit;
uint64_t childTblOffset;
uint64_t childTblFrom;
uint64_t childTblTo;
enum CONTINUE_IF_FAIL_MODE continueIfFail;

// int multiThreadWriteOneTbl; // 0: no, 1: yes
uint32_t interlaceRows; //
Expand Down Expand Up @@ -615,7 +624,6 @@ typedef struct SQueryMetaInfo_S {
int32_t killQueryInterval;
uint64_t response_buffer;
bool reset_query_cache;
bool continue_if_fail;
uint16_t iface;
char* dbName;
} SQueryMetaInfo;
Expand Down Expand Up @@ -677,6 +685,8 @@ typedef struct SArguments_S {
#ifdef TD_VER_COMPATIBLE_3_0_0_0
int16_t inputted_vgroups;
#endif
enum CONTINUE_IF_FAIL_MODE continueIfFail;

} SArguments;

typedef struct SBenchConn{
Expand Down
2 changes: 1 addition & 1 deletion src/benchData.c
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ int prepareSampleData(SDataBase* database, SSuperTable* stbInfo) {
}
debugPrint("sampleDataBuf: %s\n", stbInfo->sampleDataBuf);

if (!stbInfo->childTblExists && stbInfo->tags->size != 0) {
if (stbInfo->tags->size != 0) {
stbInfo->tagDataBuf =
benchCalloc(1, stbInfo->childTblCount * stbInfo->lenOfTags, true);
infoPrint(
Expand Down
Loading

0 comments on commit e04f39b

Please sign in to comment.