Skip to content

Commit

Permalink
Merge pull request #710 from taosdata/feat/TD-26563
Browse files Browse the repository at this point in the history
test: support insert now timestamp
  • Loading branch information
DuanKuanJun committed Oct 12, 2023
2 parents 3d7a932 + 35dc194 commit ccdb38e
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 2 deletions.
86 changes: 86 additions & 0 deletions example/insertNow.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"filetype": "insert",
"cfgdir": "/etc/taos",
"host": "127.0.0.1",
"port": 6030,
"user": "root",
"password": "taosdata",
"connection_pool_size": 8,
"thread_count": 5,
"create_table_thread_count": 7,
"result_file": "./insert_res.txt",
"confirm_parameter_prompt": "no",
"insert_interval": 0,
"num_of_records_per_req": 2000,
"prepared_rand": 10000,
"chinese": "no",
"escape_character": "yes",
"databases": [
{
"dbinfo": {
"name": "smart",
"drop": "yes",
"vgroups": 4,
"duration": "10d",
"keep": "100d",
"pages": 512,
"minrows":5000,
"maxrows":10000,
"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": 10000,
"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": 900000000000000,
"interlace_rows": 1,
"insert_interval": 1000,
"start_timestamp": "now",
"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"]
}
]
}
]
}
]
}
8 changes: 6 additions & 2 deletions src/benchInsert.c
Original file line number Diff line number Diff line change
Expand Up @@ -1532,8 +1532,12 @@ static void *syncWriteInterlace(void *sarg) {
int64_t disorderTs = getDisorderTs(stbInfo,
&disorderRange);
char time_string[BIGINT_BUFF_LEN];
snprintf(time_string, BIGINT_BUFF_LEN, "%"PRId64"",
disorderTs?disorderTs:timestamp);
if(stbInfo->useNow) {
snprintf(time_string, BIGINT_BUFF_LEN, "now");
} else {
snprintf(time_string, BIGINT_BUFF_LEN, "%"PRId64"",
disorderTs?disorderTs:timestamp);
}
ds_add_strs(&pThreadInfo->buffer, 5,
"(",
time_string,
Expand Down
5 changes: 5 additions & 0 deletions src/benchJsonOpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,11 @@ static int getStableInfo(tools_cJSON *dbinfos, int index) {
superTable->interlaceRows = (uint32_t)stbInterlaceRows->valueint;
}

// force set
if(superTable->useNow) {
superTable->interlaceRows = 1;
}

// disorder
tools_cJSON *disorderRatio =
tools_cJSON_GetObjectItem(stbInfo, "disorder_ratio");
Expand Down

0 comments on commit ccdb38e

Please sign in to comment.