提交 5404c297 编写于 作者: S Shuduo Sang

[TD-3147] <fix>: support stable level interval.

上级 d6fcc051
...@@ -227,7 +227,8 @@ typedef struct SSuperTable_S { ...@@ -227,7 +227,8 @@ typedef struct SSuperTable_S {
int disorderRatio; // 0: no disorder, >0: x% int disorderRatio; // 0: no disorder, >0: x%
int disorderRange; // ms or us by database precision int disorderRange; // ms or us by database precision
int maxSqlLen; // int maxSqlLen; //
int insertInterval; // insert interval, will override global insert interval
int64_t insertRows; // 0: no limit int64_t insertRows; // 0: no limit
int timeStampStep; int timeStampStep;
char startTimestamp[MAX_TB_NAME_SIZE]; // char startTimestamp[MAX_TB_NAME_SIZE]; //
...@@ -473,8 +474,8 @@ char *aggreFunc[] = {"*", "count(*)", "avg(col0)", "sum(col0)", ...@@ -473,8 +474,8 @@ char *aggreFunc[] = {"*", "count(*)", "avg(col0)", "sum(col0)",
"max(col0)", "min(col0)", "first(col0)", "last(col0)"}; "max(col0)", "min(col0)", "first(col0)", "last(col0)"};
SArguments g_args = { SArguments g_args = {
NULL, // metaFile NULL, // metaFile
0, // test_mode 0, // test_mode
"127.0.0.1", // host "127.0.0.1", // host
6030, // port 6030, // port
"root", // user "root", // user
...@@ -737,7 +738,8 @@ void parse_args(int argc, char *argv[], SArguments *arguments) { ...@@ -737,7 +738,8 @@ void parse_args(int argc, char *argv[], SArguments *arguments) {
} }
} }
if (arguments->debug_print) { if (((arguments->debug_print) && (arguments->metaFile == NULL))
|| arguments->verbose_print) {
printf("###################################################################\n"); printf("###################################################################\n");
printf("# meta file: %s\n", arguments->metaFile); printf("# meta file: %s\n", arguments->metaFile);
printf("# Server IP: %s:%hu\n", printf("# Server IP: %s:%hu\n",
...@@ -1234,6 +1236,7 @@ static void printfInsertMetaToFile(FILE* fp) { ...@@ -1234,6 +1236,7 @@ static void printfInsertMetaToFile(FILE* fp) {
fprintf(fp, " dataSource: %s\n", g_Dbs.db[i].superTbls[j].dataSource); fprintf(fp, " dataSource: %s\n", g_Dbs.db[i].superTbls[j].dataSource);
fprintf(fp, " insertMode: %s\n", g_Dbs.db[i].superTbls[j].insertMode); fprintf(fp, " insertMode: %s\n", g_Dbs.db[i].superTbls[j].insertMode);
fprintf(fp, " insertRows: %"PRId64"\n", g_Dbs.db[i].superTbls[j].insertRows); fprintf(fp, " insertRows: %"PRId64"\n", g_Dbs.db[i].superTbls[j].insertRows);
fprintf(fp, " insert interval: %d\n", g_Dbs.db[i].superTbls[j].insertInterval);
if (0 == g_Dbs.db[i].superTbls[j].multiThreadWriteOneTbl) { if (0 == g_Dbs.db[i].superTbls[j].multiThreadWriteOneTbl) {
fprintf(fp, " multiThreadWriteOneTbl: no\n"); fprintf(fp, " multiThreadWriteOneTbl: no\n");
...@@ -2743,13 +2746,13 @@ static bool getMetaFromInsertJsonFile(cJSON* root) { ...@@ -2743,13 +2746,13 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
goto PARSE_OVER; goto PARSE_OVER;
} }
cJSON* insertInterval = cJSON_GetObjectItem(root, "insert_interval"); cJSON* gInsertInterval = cJSON_GetObjectItem(root, "insert_interval");
if (insertInterval && insertInterval->type == cJSON_Number) { if (gInsertInterval && gInsertInterval->type == cJSON_Number) {
g_args.insert_interval = insertInterval->valueint; g_args.insert_interval = gInsertInterval->valueint;
} else if (!insertInterval) { } else if (!gInsertInterval) {
g_args.insert_interval = 0; g_args.insert_interval = 0;
} else { } else {
printf("failed to read json, insert_interval not found"); printf("failed to read json, insert_interval input mistake");
goto PARSE_OVER; goto PARSE_OVER;
} }
...@@ -3235,13 +3238,22 @@ static bool getMetaFromInsertJsonFile(cJSON* root) { ...@@ -3235,13 +3238,22 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
cJSON* insertRows = cJSON_GetObjectItem(stbInfo, "insert_rows"); cJSON* insertRows = cJSON_GetObjectItem(stbInfo, "insert_rows");
if (insertRows && insertRows->type == cJSON_Number) { if (insertRows && insertRows->type == cJSON_Number) {
g_Dbs.db[i].superTbls[j].insertRows = insertRows->valueint; g_Dbs.db[i].superTbls[j].insertRows = insertRows->valueint;
//if (0 == g_Dbs.db[i].superTbls[j].insertRows) {
// g_Dbs.db[i].superTbls[j].insertRows = 0x7FFFFFFFFFFFFFFF;
//}
} else if (!insertRows) { } else if (!insertRows) {
g_Dbs.db[i].superTbls[j].insertRows = 0x7FFFFFFFFFFFFFFF; g_Dbs.db[i].superTbls[j].insertRows = 0x7FFFFFFFFFFFFFFF;
} else { } else {
printf("failed to read json, insert_rows not found"); printf("failed to read json, insert_rows input mistake");
goto PARSE_OVER;
}
cJSON* insertInterval = cJSON_GetObjectItem(stbInfo, "insert_interval");
if (insertInterval && insertInterval->type == cJSON_Number) {
g_Dbs.db[i].superTbls[j].insertInterval = insertInterval->valueint;
} else if (!insertInterval) {
debugPrint("%s() LN%d: stable insert interval be overrided by global %d.\n",
__func__, __LINE__, g_args.insert_interval);
g_Dbs.db[i].superTbls[j].insertInterval = g_args.insert_interval;
} else {
printf("failed to read json, insert_interval input mistake");
goto PARSE_OVER; goto PARSE_OVER;
} }
...@@ -3928,7 +3940,7 @@ static void syncWriteForNumberOfTblInOneSql( ...@@ -3928,7 +3940,7 @@ static void syncWriteForNumberOfTblInOneSql(
send_to_server: send_to_server:
if (g_args.insert_interval && (g_args.insert_interval > (et - st))) { if (g_args.insert_interval && (g_args.insert_interval > (et - st))) {
int sleep_time = g_args.insert_interval - (et -st); int sleep_time = g_args.insert_interval - (et -st);
printf("sleep: %d ms specified by insert_interval\n", sleep_time); printf("sleep: %d ms insert interval\n", sleep_time);
taosMsleep(sleep_time); // ms taosMsleep(sleep_time); // ms
} }
...@@ -4268,14 +4280,14 @@ static void* syncWriteWithStb(void *sarg) { ...@@ -4268,14 +4280,14 @@ static void* syncWriteWithStb(void *sarg) {
int64_t tblInserted = i; int64_t tblInserted = i;
if (i > 0 && g_args.insert_interval if (i > 0 && superTblInfo->insertInterval
&& (g_args.insert_interval > (et - st) )) { && (superTblInfo->insertInterval > (et - st) )) {
int sleep_time = g_args.insert_interval - (et -st); int sleep_time = superTblInfo->insertInterval - (et -st);
printf("sleep: %d ms specified by insert_interval\n", sleep_time); printf("sleep: %d ms insert interval\n", sleep_time);
taosMsleep(sleep_time); // ms taosMsleep(sleep_time); // ms
} }
if (g_args.insert_interval) { if (superTblInfo->insertInterval) {
st = taosGetTimestampMs(); st = taosGetTimestampMs();
} }
...@@ -4412,7 +4424,7 @@ static void* syncWriteWithStb(void *sarg) { ...@@ -4412,7 +4424,7 @@ static void* syncWriteWithStb(void *sarg) {
goto free_and_statistics_2; goto free_and_statistics_2;
} }
} }
if (g_args.insert_interval) { if (superTblInfo->insertInterval) {
et = taosGetTimestampMs(); et = taosGetTimestampMs();
} }
...@@ -4427,7 +4439,6 @@ static void* syncWriteWithStb(void *sarg) { ...@@ -4427,7 +4439,6 @@ static void* syncWriteWithStb(void *sarg) {
} }
} }
//printf("========loop %d childTables duration:%"PRId64 "========inserted rows:%d\n", winfo->end_table_id - winfo->start_table_id, et - st, i);
} // tID } // tID
free_and_statistics_2: free_and_statistics_2:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册