[TD-3192] <feature>: support supertable limit and offset.
This commit is contained in:
parent
bfc1b0df34
commit
065937dfd5
|
@ -38,7 +38,9 @@
|
||||||
"auto_create_table": "no",
|
"auto_create_table": "no",
|
||||||
"data_source": "rand",
|
"data_source": "rand",
|
||||||
"insert_mode": "taosc",
|
"insert_mode": "taosc",
|
||||||
"insert_rows": 100000,
|
"childtable_limit": 33,
|
||||||
|
"childtable_offset": 33,
|
||||||
|
"insert_rows": 1000,
|
||||||
"multi_thread_write_one_tbl": "no",
|
"multi_thread_write_one_tbl": "no",
|
||||||
"number_of_tbl_in_one_sql": 0,
|
"number_of_tbl_in_one_sql": 0,
|
||||||
"rows_per_tbl": 100,
|
"rows_per_tbl": 100,
|
||||||
|
|
|
@ -218,6 +218,8 @@ typedef struct SSuperTable_S {
|
||||||
char childTblPrefix[MAX_TB_NAME_SIZE];
|
char childTblPrefix[MAX_TB_NAME_SIZE];
|
||||||
char dataSource[MAX_TB_NAME_SIZE+1]; // rand_gen or sample
|
char dataSource[MAX_TB_NAME_SIZE+1]; // rand_gen or sample
|
||||||
char insertMode[MAX_TB_NAME_SIZE]; // taosc, restful
|
char insertMode[MAX_TB_NAME_SIZE]; // taosc, restful
|
||||||
|
int childTblLimit;
|
||||||
|
int childTblOffset;
|
||||||
|
|
||||||
int multiThreadWriteOneTbl; // 0: no, 1: yes
|
int multiThreadWriteOneTbl; // 0: no, 1: yes
|
||||||
int numberOfTblInOneSql; // 0/1: one table, > 1: number of tbl
|
int numberOfTblInOneSql; // 0/1: one table, > 1: number of tbl
|
||||||
|
@ -1076,6 +1078,12 @@ static int printfInsertMeta() {
|
||||||
printf(" childTblPrefix: \033[33m%s\033[0m\n", g_Dbs.db[i].superTbls[j].childTblPrefix);
|
printf(" childTblPrefix: \033[33m%s\033[0m\n", g_Dbs.db[i].superTbls[j].childTblPrefix);
|
||||||
printf(" dataSource: \033[33m%s\033[0m\n", g_Dbs.db[i].superTbls[j].dataSource);
|
printf(" dataSource: \033[33m%s\033[0m\n", g_Dbs.db[i].superTbls[j].dataSource);
|
||||||
printf(" insertMode: \033[33m%s\033[0m\n", g_Dbs.db[i].superTbls[j].insertMode);
|
printf(" insertMode: \033[33m%s\033[0m\n", g_Dbs.db[i].superTbls[j].insertMode);
|
||||||
|
if (g_Dbs.db[i].superTbls[j].childTblLimit > 0) {
|
||||||
|
printf(" childTblLimit: \033[33m%d\033[0m\n", g_Dbs.db[i].superTbls[j].childTblLimit);
|
||||||
|
}
|
||||||
|
if (g_Dbs.db[i].superTbls[j].childTblOffset > 0) {
|
||||||
|
printf(" childTblOffset: \033[33m%d\033[0m\n", g_Dbs.db[i].superTbls[j].childTblOffset);
|
||||||
|
}
|
||||||
printf(" insertRows: \033[33m%"PRId64"\033[0m\n", g_Dbs.db[i].superTbls[j].insertRows);
|
printf(" insertRows: \033[33m%"PRId64"\033[0m\n", g_Dbs.db[i].superTbls[j].insertRows);
|
||||||
|
|
||||||
if (0 == g_Dbs.db[i].superTbls[j].multiThreadWriteOneTbl) {
|
if (0 == g_Dbs.db[i].superTbls[j].multiThreadWriteOneTbl) {
|
||||||
|
@ -1814,15 +1822,25 @@ static int calcRowLen(SSuperTable* superTbls) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int getAllChildNameOfSuperTable(TAOS * taos, char* dbName, char* sTblName, char** childTblNameOfSuperTbl, int* childTblCountOfSuperTbl) {
|
static int getChildNameOfSuperTableWithLimitAndOffset(TAOS * taos,
|
||||||
|
char* dbName, char* sTblName, char** childTblNameOfSuperTbl,
|
||||||
|
int* childTblCountOfSuperTbl, int limit, int offset) {
|
||||||
|
|
||||||
char command[BUFFER_SIZE] = "\0";
|
char command[BUFFER_SIZE] = "\0";
|
||||||
|
char limitBuf[100] = "\0";
|
||||||
|
|
||||||
TAOS_RES * res;
|
TAOS_RES * res;
|
||||||
TAOS_ROW row = NULL;
|
TAOS_ROW row = NULL;
|
||||||
|
|
||||||
char* childTblName = *childTblNameOfSuperTbl;
|
char* childTblName = *childTblNameOfSuperTbl;
|
||||||
|
|
||||||
|
if (offset >= 0) {
|
||||||
|
snprintf(limitBuf, 100, " limit %d offset %d", limit, offset);
|
||||||
|
}
|
||||||
|
|
||||||
//get all child table name use cmd: select tbname from superTblName;
|
//get all child table name use cmd: select tbname from superTblName;
|
||||||
snprintf(command, BUFFER_SIZE, "select tbname from %s.%s", dbName, sTblName);
|
snprintf(command, BUFFER_SIZE, "select tbname from %s.%s %s", dbName, sTblName, limitBuf);
|
||||||
|
|
||||||
res = taos_query(taos, command);
|
res = taos_query(taos, command);
|
||||||
int32_t code = taos_errno(res);
|
int32_t code = taos_errno(res);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
|
@ -1846,7 +1864,8 @@ static int getAllChildNameOfSuperTable(TAOS * taos, char* dbName, char* sTblName
|
||||||
if (tmp != NULL) {
|
if (tmp != NULL) {
|
||||||
childTblName = tmp;
|
childTblName = tmp;
|
||||||
childTblCount = (int)(childTblCount*1.5);
|
childTblCount = (int)(childTblCount*1.5);
|
||||||
memset(childTblName + count*TSDB_TABLE_NAME_LEN, 0, (size_t)((childTblCount-count)*TSDB_TABLE_NAME_LEN));
|
memset(childTblName + count*TSDB_TABLE_NAME_LEN, 0,
|
||||||
|
(size_t)((childTblCount-count)*TSDB_TABLE_NAME_LEN));
|
||||||
} else {
|
} else {
|
||||||
// exit, if allocate more memory failed
|
// exit, if allocate more memory failed
|
||||||
printf("realloc fail for save child table name of %s.%s\n", dbName, sTblName);
|
printf("realloc fail for save child table name of %s.%s\n", dbName, sTblName);
|
||||||
|
@ -1866,6 +1885,16 @@ static int getAllChildNameOfSuperTable(TAOS * taos, char* dbName, char* sTblName
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int getAllChildNameOfSuperTable(TAOS * taos, char* dbName,
|
||||||
|
char* sTblName, char** childTblNameOfSuperTbl,
|
||||||
|
int* childTblCountOfSuperTbl) {
|
||||||
|
|
||||||
|
return getChildNameOfSuperTableWithLimitAndOffset(taos, dbName, sTblName,
|
||||||
|
childTblNameOfSuperTbl, childTblCountOfSuperTbl,
|
||||||
|
-1, -1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static int getSuperTableFromServer(TAOS * taos, char* dbName, SSuperTable* superTbls) {
|
static int getSuperTableFromServer(TAOS * taos, char* dbName, SSuperTable* superTbls) {
|
||||||
char command[BUFFER_SIZE] = "\0";
|
char command[BUFFER_SIZE] = "\0";
|
||||||
TAOS_RES * res;
|
TAOS_RES * res;
|
||||||
|
@ -1915,7 +1944,8 @@ static int getSuperTableFromServer(TAOS * taos, char* dbName, SSuperTable* supe
|
||||||
|
|
||||||
if (TBL_ALREADY_EXISTS == superTbls->childTblExists) {
|
if (TBL_ALREADY_EXISTS == superTbls->childTblExists) {
|
||||||
//get all child table name use cmd: select tbname from superTblName;
|
//get all child table name use cmd: select tbname from superTblName;
|
||||||
getAllChildNameOfSuperTable(taos, dbName, superTbls->sTblName, &superTbls->childTblName, &superTbls->childTblCount);
|
getAllChildNameOfSuperTable(taos, dbName,
|
||||||
|
superTbls->sTblName, &superTbls->childTblName, &superTbls->childTblCount);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2340,8 +2370,8 @@ static void createChildTables() {
|
||||||
g_totalChildTables += g_Dbs.db[i].superTbls[j].childTblCount;
|
g_totalChildTables += g_Dbs.db[i].superTbls[j].childTblCount;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// normal table
|
// normal table
|
||||||
len = snprintf(tblColsBuf, MAX_SQL_SIZE, "(TS TIMESTAMP");
|
len = snprintf(tblColsBuf, MAX_SQL_SIZE, "(TS TIMESTAMP");
|
||||||
for (int i = 0; i < MAX_COLUMN_COUNT; i++) {
|
for (int i = 0; i < MAX_COLUMN_COUNT; i++) {
|
||||||
if (g_args.datatype[i]) {
|
if (g_args.datatype[i]) {
|
||||||
if ((strncasecmp(g_args.datatype[i], "BINARY", strlen("BINARY")) == 0)
|
if ((strncasecmp(g_args.datatype[i], "BINARY", strlen("BINARY")) == 0)
|
||||||
|
@ -2357,12 +2387,12 @@ static void createChildTables() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
debugPrint("DEBUG - %s() LN%d: %s\n", __func__, __LINE__,
|
debugPrint("DEBUG - %s() LN%d: %s\n", __func__, __LINE__,
|
||||||
tblColsBuf);
|
tblColsBuf);
|
||||||
startMultiThreadCreateChildTable(
|
startMultiThreadCreateChildTable(
|
||||||
tblColsBuf,
|
tblColsBuf,
|
||||||
g_Dbs.threadCountByCreateTbl,
|
g_Dbs.threadCountByCreateTbl,
|
||||||
g_args.num_of_DPT,
|
g_args.num_of_tables,
|
||||||
g_Dbs.db[i].dbName,
|
g_Dbs.db[i].dbName,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
@ -2534,7 +2564,7 @@ static bool getColumnAndTagTypeFromInsertJsonFile(cJSON* stbInfo, SSuperTable* s
|
||||||
// columns
|
// columns
|
||||||
cJSON *columns = cJSON_GetObjectItem(stbInfo, "columns");
|
cJSON *columns = cJSON_GetObjectItem(stbInfo, "columns");
|
||||||
if (columns && columns->type != cJSON_Array) {
|
if (columns && columns->type != cJSON_Array) {
|
||||||
printf("failed to read json, columns not found\n");
|
printf("ERROR: failed to read json, columns not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
} else if (NULL == columns) {
|
} else if (NULL == columns) {
|
||||||
superTbls->columnCount = 0;
|
superTbls->columnCount = 0;
|
||||||
|
@ -2544,7 +2574,7 @@ static bool getColumnAndTagTypeFromInsertJsonFile(cJSON* stbInfo, SSuperTable* s
|
||||||
|
|
||||||
int columnSize = cJSON_GetArraySize(columns);
|
int columnSize = cJSON_GetArraySize(columns);
|
||||||
if (columnSize > MAX_COLUMN_COUNT) {
|
if (columnSize > MAX_COLUMN_COUNT) {
|
||||||
printf("failed to read json, column size overflow, max column size is %d\n",
|
printf("ERROR: failed to read json, column size overflow, max column size is %d\n",
|
||||||
MAX_COLUMN_COUNT);
|
MAX_COLUMN_COUNT);
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
@ -2563,7 +2593,7 @@ static bool getColumnAndTagTypeFromInsertJsonFile(cJSON* stbInfo, SSuperTable* s
|
||||||
if (countObj && countObj->type == cJSON_Number) {
|
if (countObj && countObj->type == cJSON_Number) {
|
||||||
count = countObj->valueint;
|
count = countObj->valueint;
|
||||||
} else if (countObj && countObj->type != cJSON_Number) {
|
} else if (countObj && countObj->type != cJSON_Number) {
|
||||||
printf("failed to read json, column count not found");
|
printf("ERROR: failed to read json, column count not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
} else {
|
} else {
|
||||||
count = 1;
|
count = 1;
|
||||||
|
@ -2573,7 +2603,7 @@ static bool getColumnAndTagTypeFromInsertJsonFile(cJSON* stbInfo, SSuperTable* s
|
||||||
memset(&columnCase, 0, sizeof(StrColumn));
|
memset(&columnCase, 0, sizeof(StrColumn));
|
||||||
cJSON *dataType = cJSON_GetObjectItem(column, "type");
|
cJSON *dataType = cJSON_GetObjectItem(column, "type");
|
||||||
if (!dataType || dataType->type != cJSON_String || dataType->valuestring == NULL) {
|
if (!dataType || dataType->type != cJSON_String || dataType->valuestring == NULL) {
|
||||||
printf("failed to read json, column type not found");
|
printf("ERROR: failed to read json, column type not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
//tstrncpy(superTbls->columns[k].dataType, dataType->valuestring, MAX_TB_NAME_SIZE);
|
//tstrncpy(superTbls->columns[k].dataType, dataType->valuestring, MAX_TB_NAME_SIZE);
|
||||||
|
@ -2583,7 +2613,7 @@ static bool getColumnAndTagTypeFromInsertJsonFile(cJSON* stbInfo, SSuperTable* s
|
||||||
if (dataLen && dataLen->type == cJSON_Number) {
|
if (dataLen && dataLen->type == cJSON_Number) {
|
||||||
columnCase.dataLen = dataLen->valueint;
|
columnCase.dataLen = dataLen->valueint;
|
||||||
} else if (dataLen && dataLen->type != cJSON_Number) {
|
} else if (dataLen && dataLen->type != cJSON_Number) {
|
||||||
printf("failed to read json, column len not found");
|
printf("ERROR: failed to read json, column len not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
} else {
|
} else {
|
||||||
columnCase.dataLen = 8;
|
columnCase.dataLen = 8;
|
||||||
|
@ -2602,13 +2632,13 @@ static bool getColumnAndTagTypeFromInsertJsonFile(cJSON* stbInfo, SSuperTable* s
|
||||||
// tags
|
// tags
|
||||||
cJSON *tags = cJSON_GetObjectItem(stbInfo, "tags");
|
cJSON *tags = cJSON_GetObjectItem(stbInfo, "tags");
|
||||||
if (!tags || tags->type != cJSON_Array) {
|
if (!tags || tags->type != cJSON_Array) {
|
||||||
printf("failed to read json, tags not found");
|
printf("ERROR: failed to read json, tags not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tagSize = cJSON_GetArraySize(tags);
|
int tagSize = cJSON_GetArraySize(tags);
|
||||||
if (tagSize > MAX_TAG_COUNT) {
|
if (tagSize > MAX_TAG_COUNT) {
|
||||||
printf("failed to read json, tags size overflow, max tag size is %d\n", MAX_TAG_COUNT);
|
printf("ERROR: failed to read json, tags size overflow, max tag size is %d\n", MAX_TAG_COUNT);
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2622,7 +2652,7 @@ static bool getColumnAndTagTypeFromInsertJsonFile(cJSON* stbInfo, SSuperTable* s
|
||||||
if (countObj && countObj->type == cJSON_Number) {
|
if (countObj && countObj->type == cJSON_Number) {
|
||||||
count = countObj->valueint;
|
count = countObj->valueint;
|
||||||
} else if (countObj && countObj->type != cJSON_Number) {
|
} else if (countObj && countObj->type != cJSON_Number) {
|
||||||
printf("failed to read json, column count not found");
|
printf("ERROR: failed to read json, column count not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
} else {
|
} else {
|
||||||
count = 1;
|
count = 1;
|
||||||
|
@ -2632,7 +2662,7 @@ static bool getColumnAndTagTypeFromInsertJsonFile(cJSON* stbInfo, SSuperTable* s
|
||||||
memset(&columnCase, 0, sizeof(StrColumn));
|
memset(&columnCase, 0, sizeof(StrColumn));
|
||||||
cJSON *dataType = cJSON_GetObjectItem(tag, "type");
|
cJSON *dataType = cJSON_GetObjectItem(tag, "type");
|
||||||
if (!dataType || dataType->type != cJSON_String || dataType->valuestring == NULL) {
|
if (!dataType || dataType->type != cJSON_String || dataType->valuestring == NULL) {
|
||||||
printf("failed to read json, tag type not found");
|
printf("ERROR: failed to read json, tag type not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
tstrncpy(columnCase.dataType, dataType->valuestring, MAX_TB_NAME_SIZE);
|
tstrncpy(columnCase.dataType, dataType->valuestring, MAX_TB_NAME_SIZE);
|
||||||
|
@ -2641,7 +2671,7 @@ static bool getColumnAndTagTypeFromInsertJsonFile(cJSON* stbInfo, SSuperTable* s
|
||||||
if (dataLen && dataLen->type == cJSON_Number) {
|
if (dataLen && dataLen->type == cJSON_Number) {
|
||||||
columnCase.dataLen = dataLen->valueint;
|
columnCase.dataLen = dataLen->valueint;
|
||||||
} else if (dataLen && dataLen->type != cJSON_Number) {
|
} else if (dataLen && dataLen->type != cJSON_Number) {
|
||||||
printf("failed to read json, column len not found");
|
printf("ERROR: failed to read json, column len not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
} else {
|
} else {
|
||||||
columnCase.dataLen = 0;
|
columnCase.dataLen = 0;
|
||||||
|
@ -2678,7 +2708,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!host) {
|
} else if (!host) {
|
||||||
tstrncpy(g_Dbs.host, "127.0.0.1", MAX_DB_NAME_SIZE);
|
tstrncpy(g_Dbs.host, "127.0.0.1", MAX_DB_NAME_SIZE);
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, host not found\n");
|
printf("ERROR: failed to read json, host not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2716,7 +2746,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!threads) {
|
} else if (!threads) {
|
||||||
g_Dbs.threadCount = 1;
|
g_Dbs.threadCount = 1;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, threads not found");
|
printf("ERROR: failed to read json, threads not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2726,7 +2756,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!threads2) {
|
} else if (!threads2) {
|
||||||
g_Dbs.threadCountByCreateTbl = 1;
|
g_Dbs.threadCountByCreateTbl = 1;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, threads2 not found");
|
printf("ERROR: failed to read json, threads2 not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2736,7 +2766,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!insertInterval) {
|
} else if (!insertInterval) {
|
||||||
g_args.insert_interval = 0;
|
g_args.insert_interval = 0;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, insert_interval not found");
|
printf("ERROR: failed to read json, insert_interval not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2746,7 +2776,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!numRecPerReq) {
|
} else if (!numRecPerReq) {
|
||||||
g_args.num_of_RPR = 100;
|
g_args.num_of_RPR = 100;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, num_of_records_per_req not found");
|
printf("ERROR: failed to read json, num_of_records_per_req not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2764,19 +2794,19 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!answerPrompt) {
|
} else if (!answerPrompt) {
|
||||||
g_args.answer_yes = false;
|
g_args.answer_yes = false;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, confirm_parameter_prompt not found");
|
printf("ERROR: failed to read json, confirm_parameter_prompt not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
cJSON* dbs = cJSON_GetObjectItem(root, "databases");
|
cJSON* dbs = cJSON_GetObjectItem(root, "databases");
|
||||||
if (!dbs || dbs->type != cJSON_Array) {
|
if (!dbs || dbs->type != cJSON_Array) {
|
||||||
printf("failed to read json, databases not found\n");
|
printf("ERROR: failed to read json, databases not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dbSize = cJSON_GetArraySize(dbs);
|
int dbSize = cJSON_GetArraySize(dbs);
|
||||||
if (dbSize > MAX_DB_COUNT) {
|
if (dbSize > MAX_DB_COUNT) {
|
||||||
printf("failed to read json, databases size overflow, max database is %d\n", MAX_DB_COUNT);
|
printf("ERROR: failed to read json, databases size overflow, max database is %d\n", MAX_DB_COUNT);
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2788,13 +2818,13 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
// dbinfo
|
// dbinfo
|
||||||
cJSON *dbinfo = cJSON_GetObjectItem(dbinfos, "dbinfo");
|
cJSON *dbinfo = cJSON_GetObjectItem(dbinfos, "dbinfo");
|
||||||
if (!dbinfo || dbinfo->type != cJSON_Object) {
|
if (!dbinfo || dbinfo->type != cJSON_Object) {
|
||||||
printf("failed to read json, dbinfo not found");
|
printf("ERROR: failed to read json, dbinfo not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
cJSON *dbName = cJSON_GetObjectItem(dbinfo, "name");
|
cJSON *dbName = cJSON_GetObjectItem(dbinfo, "name");
|
||||||
if (!dbName || dbName->type != cJSON_String || dbName->valuestring == NULL) {
|
if (!dbName || dbName->type != cJSON_String || dbName->valuestring == NULL) {
|
||||||
printf("failed to read json, db name not found");
|
printf("ERROR: failed to read json, db name not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
tstrncpy(g_Dbs.db[i].dbName, dbName->valuestring, MAX_DB_NAME_SIZE);
|
tstrncpy(g_Dbs.db[i].dbName, dbName->valuestring, MAX_DB_NAME_SIZE);
|
||||||
|
@ -2809,7 +2839,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!drop) {
|
} else if (!drop) {
|
||||||
g_Dbs.db[i].drop = 0;
|
g_Dbs.db[i].drop = 0;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, drop not found");
|
printf("ERROR: failed to read json, drop not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2820,7 +2850,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
//tstrncpy(g_Dbs.db[i].dbCfg.precision, "ms", MAX_DB_NAME_SIZE);
|
//tstrncpy(g_Dbs.db[i].dbCfg.precision, "ms", MAX_DB_NAME_SIZE);
|
||||||
memset(g_Dbs.db[i].dbCfg.precision, 0, MAX_DB_NAME_SIZE);
|
memset(g_Dbs.db[i].dbCfg.precision, 0, MAX_DB_NAME_SIZE);
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, precision not found");
|
printf("ERROR: failed to read json, precision not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2830,7 +2860,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!update) {
|
} else if (!update) {
|
||||||
g_Dbs.db[i].dbCfg.update = -1;
|
g_Dbs.db[i].dbCfg.update = -1;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, update not found");
|
printf("ERROR: failed to read json, update not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2840,7 +2870,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!replica) {
|
} else if (!replica) {
|
||||||
g_Dbs.db[i].dbCfg.replica = -1;
|
g_Dbs.db[i].dbCfg.replica = -1;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, replica not found");
|
printf("ERROR: failed to read json, replica not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2850,7 +2880,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!keep) {
|
} else if (!keep) {
|
||||||
g_Dbs.db[i].dbCfg.keep = -1;
|
g_Dbs.db[i].dbCfg.keep = -1;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, keep not found");
|
printf("ERROR: failed to read json, keep not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2860,7 +2890,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!days) {
|
} else if (!days) {
|
||||||
g_Dbs.db[i].dbCfg.days = -1;
|
g_Dbs.db[i].dbCfg.days = -1;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, days not found");
|
printf("ERROR: failed to read json, days not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2870,7 +2900,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!cache) {
|
} else if (!cache) {
|
||||||
g_Dbs.db[i].dbCfg.cache = -1;
|
g_Dbs.db[i].dbCfg.cache = -1;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, cache not found");
|
printf("ERROR: failed to read json, cache not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2880,7 +2910,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!blocks) {
|
} else if (!blocks) {
|
||||||
g_Dbs.db[i].dbCfg.blocks = -1;
|
g_Dbs.db[i].dbCfg.blocks = -1;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, block not found");
|
printf("ERROR: failed to read json, block not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2900,7 +2930,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!minRows) {
|
} else if (!minRows) {
|
||||||
g_Dbs.db[i].dbCfg.minRows = -1;
|
g_Dbs.db[i].dbCfg.minRows = -1;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, minRows not found");
|
printf("ERROR: failed to read json, minRows not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2910,7 +2940,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!maxRows) {
|
} else if (!maxRows) {
|
||||||
g_Dbs.db[i].dbCfg.maxRows = -1;
|
g_Dbs.db[i].dbCfg.maxRows = -1;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, maxRows not found");
|
printf("ERROR: failed to read json, maxRows not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2920,7 +2950,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!comp) {
|
} else if (!comp) {
|
||||||
g_Dbs.db[i].dbCfg.comp = -1;
|
g_Dbs.db[i].dbCfg.comp = -1;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, comp not found");
|
printf("ERROR: failed to read json, comp not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2930,7 +2960,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!walLevel) {
|
} else if (!walLevel) {
|
||||||
g_Dbs.db[i].dbCfg.walLevel = -1;
|
g_Dbs.db[i].dbCfg.walLevel = -1;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, walLevel not found");
|
printf("ERROR: failed to read json, walLevel not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2940,7 +2970,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!cacheLast) {
|
} else if (!cacheLast) {
|
||||||
g_Dbs.db[i].dbCfg.cacheLast = -1;
|
g_Dbs.db[i].dbCfg.cacheLast = -1;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, cacheLast not found");
|
printf("ERROR: failed to read json, cacheLast not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2950,7 +2980,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!quorum) {
|
} else if (!quorum) {
|
||||||
g_Dbs.db[i].dbCfg.quorum = -1;
|
g_Dbs.db[i].dbCfg.quorum = -1;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, walLevel not found");
|
printf("ERROR: failed to read json, walLevel not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2960,20 +2990,20 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!fsync) {
|
} else if (!fsync) {
|
||||||
g_Dbs.db[i].dbCfg.fsync = -1;
|
g_Dbs.db[i].dbCfg.fsync = -1;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, fsync not found");
|
printf("ERROR: failed to read json, fsync not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
// super_talbes
|
// super_talbes
|
||||||
cJSON *stables = cJSON_GetObjectItem(dbinfos, "super_tables");
|
cJSON *stables = cJSON_GetObjectItem(dbinfos, "super_tables");
|
||||||
if (!stables || stables->type != cJSON_Array) {
|
if (!stables || stables->type != cJSON_Array) {
|
||||||
printf("failed to read json, super_tables not found");
|
printf("ERROR: failed to read json, super_tables not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
int stbSize = cJSON_GetArraySize(stables);
|
int stbSize = cJSON_GetArraySize(stables);
|
||||||
if (stbSize > MAX_SUPER_TABLE_COUNT) {
|
if (stbSize > MAX_SUPER_TABLE_COUNT) {
|
||||||
printf("failed to read json, databases size overflow, max database is %d\n", MAX_SUPER_TABLE_COUNT);
|
printf("ERROR: failed to read json, databases size overflow, max database is %d\n", MAX_SUPER_TABLE_COUNT);
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2985,14 +3015,14 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
// dbinfo
|
// dbinfo
|
||||||
cJSON *stbName = cJSON_GetObjectItem(stbInfo, "name");
|
cJSON *stbName = cJSON_GetObjectItem(stbInfo, "name");
|
||||||
if (!stbName || stbName->type != cJSON_String || stbName->valuestring == NULL) {
|
if (!stbName || stbName->type != cJSON_String || stbName->valuestring == NULL) {
|
||||||
printf("failed to read json, stb name not found");
|
printf("ERROR: failed to read json, stb name not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
tstrncpy(g_Dbs.db[i].superTbls[j].sTblName, stbName->valuestring, MAX_TB_NAME_SIZE);
|
tstrncpy(g_Dbs.db[i].superTbls[j].sTblName, stbName->valuestring, MAX_TB_NAME_SIZE);
|
||||||
|
|
||||||
cJSON *prefix = cJSON_GetObjectItem(stbInfo, "childtable_prefix");
|
cJSON *prefix = cJSON_GetObjectItem(stbInfo, "childtable_prefix");
|
||||||
if (!prefix || prefix->type != cJSON_String || prefix->valuestring == NULL) {
|
if (!prefix || prefix->type != cJSON_String || prefix->valuestring == NULL) {
|
||||||
printf("failed to read json, childtable_prefix not found");
|
printf("ERROR: failed to read json, childtable_prefix not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
tstrncpy(g_Dbs.db[i].superTbls[j].childTblPrefix, prefix->valuestring, MAX_DB_NAME_SIZE);
|
tstrncpy(g_Dbs.db[i].superTbls[j].childTblPrefix, prefix->valuestring, MAX_DB_NAME_SIZE);
|
||||||
|
@ -3011,7 +3041,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!autoCreateTbl) {
|
} else if (!autoCreateTbl) {
|
||||||
g_Dbs.db[i].superTbls[j].autoCreateTable = PRE_CREATE_SUBTBL;
|
g_Dbs.db[i].superTbls[j].autoCreateTable = PRE_CREATE_SUBTBL;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, auto_create_table not found");
|
printf("ERROR: failed to read json, auto_create_table not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3021,7 +3051,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!batchCreateTbl) {
|
} else if (!batchCreateTbl) {
|
||||||
g_Dbs.db[i].superTbls[j].batchCreateTableNum = 1000;
|
g_Dbs.db[i].superTbls[j].batchCreateTableNum = 1000;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, batch_create_tbl_num not found");
|
printf("ERROR: failed to read json, batch_create_tbl_num not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3039,13 +3069,13 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!childTblExists) {
|
} else if (!childTblExists) {
|
||||||
g_Dbs.db[i].superTbls[j].childTblExists = TBL_NO_EXISTS;
|
g_Dbs.db[i].superTbls[j].childTblExists = TBL_NO_EXISTS;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, child_table_exists not found");
|
printf("ERROR: failed to read json, child_table_exists not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
cJSON* count = cJSON_GetObjectItem(stbInfo, "childtable_count");
|
cJSON* count = cJSON_GetObjectItem(stbInfo, "childtable_count");
|
||||||
if (!count || count->type != cJSON_Number || 0 >= count->valueint) {
|
if (!count || count->type != cJSON_Number || 0 >= count->valueint) {
|
||||||
printf("failed to read json, childtable_count not found");
|
printf("ERROR: failed to read json, childtable_count not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
g_Dbs.db[i].superTbls[j].childTblCount = count->valueint;
|
g_Dbs.db[i].superTbls[j].childTblCount = count->valueint;
|
||||||
|
@ -3058,7 +3088,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!dataSource) {
|
} else if (!dataSource) {
|
||||||
tstrncpy(g_Dbs.db[i].superTbls[j].dataSource, "rand", MAX_DB_NAME_SIZE);
|
tstrncpy(g_Dbs.db[i].superTbls[j].dataSource, "rand", MAX_DB_NAME_SIZE);
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, data_source not found");
|
printf("ERROR: failed to read json, data_source not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3070,17 +3100,39 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!insertMode) {
|
} else if (!insertMode) {
|
||||||
tstrncpy(g_Dbs.db[i].superTbls[j].insertMode, "taosc", MAX_DB_NAME_SIZE);
|
tstrncpy(g_Dbs.db[i].superTbls[j].insertMode, "taosc", MAX_DB_NAME_SIZE);
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, insert_mode not found");
|
printf("ERROR: failed to read json, insert_mode not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cJSON* childTbl_limit = cJSON_GetObjectItem(stbInfo, "childtable_limit");
|
||||||
|
if (childTbl_limit) {
|
||||||
|
if (childTbl_limit->type != cJSON_Number) {
|
||||||
|
printf("ERROR: failed to read json, childtable_limit\n");
|
||||||
|
goto PARSE_OVER;
|
||||||
|
}
|
||||||
|
g_Dbs.db[i].superTbls[j].childTblLimit = childTbl_limit->valueint;
|
||||||
|
} else {
|
||||||
|
g_Dbs.db[i].superTbls[j].childTblLimit = -1; // select ... limit -1 means all query result
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON* childTbl_offset = cJSON_GetObjectItem(stbInfo, "childtable_offset");
|
||||||
|
if (childTbl_offset) {
|
||||||
|
if (childTbl_offset->type != cJSON_Number || 0 > childTbl_offset->valueint) {
|
||||||
|
printf("ERROR: failed to read json, childtable_offset\n");
|
||||||
|
goto PARSE_OVER;
|
||||||
|
}
|
||||||
|
g_Dbs.db[i].superTbls[j].childTblOffset = childTbl_offset->valueint;
|
||||||
|
} else {
|
||||||
|
g_Dbs.db[i].superTbls[j].childTblOffset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
cJSON *ts = cJSON_GetObjectItem(stbInfo, "start_timestamp");
|
cJSON *ts = cJSON_GetObjectItem(stbInfo, "start_timestamp");
|
||||||
if (ts && ts->type == cJSON_String && ts->valuestring != NULL) {
|
if (ts && ts->type == cJSON_String && ts->valuestring != NULL) {
|
||||||
tstrncpy(g_Dbs.db[i].superTbls[j].startTimestamp, ts->valuestring, MAX_DB_NAME_SIZE);
|
tstrncpy(g_Dbs.db[i].superTbls[j].startTimestamp, ts->valuestring, MAX_DB_NAME_SIZE);
|
||||||
} else if (!ts) {
|
} else if (!ts) {
|
||||||
tstrncpy(g_Dbs.db[i].superTbls[j].startTimestamp, "now", MAX_DB_NAME_SIZE);
|
tstrncpy(g_Dbs.db[i].superTbls[j].startTimestamp, "now", MAX_DB_NAME_SIZE);
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, start_timestamp not found");
|
printf("ERROR: failed to read json, start_timestamp not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3090,7 +3142,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!timestampStep) {
|
} else if (!timestampStep) {
|
||||||
g_Dbs.db[i].superTbls[j].timeStampStep = 1000;
|
g_Dbs.db[i].superTbls[j].timeStampStep = 1000;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, timestamp_step not found");
|
printf("ERROR: failed to read json, timestamp_step not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3103,7 +3155,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!sampleDataBufSize) {
|
} else if (!sampleDataBufSize) {
|
||||||
g_Dbs.db[i].superTbls[j].sampleDataBufSize = 1024*1024 + 1024;
|
g_Dbs.db[i].superTbls[j].sampleDataBufSize = 1024*1024 + 1024;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, sample_buf_size not found");
|
printf("ERROR: failed to read json, sample_buf_size not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3114,7 +3166,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!sampleFormat) {
|
} else if (!sampleFormat) {
|
||||||
tstrncpy(g_Dbs.db[i].superTbls[j].sampleFormat, "csv", MAX_DB_NAME_SIZE);
|
tstrncpy(g_Dbs.db[i].superTbls[j].sampleFormat, "csv", MAX_DB_NAME_SIZE);
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, sample_format not found");
|
printf("ERROR: failed to read json, sample_format not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3125,7 +3177,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!sampleFile) {
|
} else if (!sampleFile) {
|
||||||
memset(g_Dbs.db[i].superTbls[j].sampleFile, 0, MAX_FILE_NAME_LEN);
|
memset(g_Dbs.db[i].superTbls[j].sampleFile, 0, MAX_FILE_NAME_LEN);
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, sample_file not found");
|
printf("ERROR: failed to read json, sample_file not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3142,7 +3194,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
memset(g_Dbs.db[i].superTbls[j].tagsFile, 0, MAX_FILE_NAME_LEN);
|
memset(g_Dbs.db[i].superTbls[j].tagsFile, 0, MAX_FILE_NAME_LEN);
|
||||||
g_Dbs.db[i].superTbls[j].tagSource = 0;
|
g_Dbs.db[i].superTbls[j].tagSource = 0;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, tags_file not found");
|
printf("ERROR: failed to read json, tags_file not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3158,7 +3210,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!maxSqlLen) {
|
} else if (!maxSqlLen) {
|
||||||
g_Dbs.db[i].superTbls[j].maxSqlLen = TSDB_MAX_SQL_LEN;
|
g_Dbs.db[i].superTbls[j].maxSqlLen = TSDB_MAX_SQL_LEN;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, maxSqlLen not found");
|
printf("ERROR: failed to read json, maxSqlLen not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3175,7 +3227,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!multiThreadWriteOneTbl) {
|
} else if (!multiThreadWriteOneTbl) {
|
||||||
g_Dbs.db[i].superTbls[j].multiThreadWriteOneTbl = 0;
|
g_Dbs.db[i].superTbls[j].multiThreadWriteOneTbl = 0;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, multiThreadWriteOneTbl not found");
|
printf("ERROR: failed to read json, multiThreadWriteOneTbl not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3185,7 +3237,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!numberOfTblInOneSql) {
|
} else if (!numberOfTblInOneSql) {
|
||||||
g_Dbs.db[i].superTbls[j].numberOfTblInOneSql = 0;
|
g_Dbs.db[i].superTbls[j].numberOfTblInOneSql = 0;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, numberOfTblInOneSql not found");
|
printf("ERROR: failed to read json, numberOfTblInOneSql not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3195,7 +3247,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!rowsPerTbl) {
|
} else if (!rowsPerTbl) {
|
||||||
g_Dbs.db[i].superTbls[j].rowsPerTbl = 1;
|
g_Dbs.db[i].superTbls[j].rowsPerTbl = 1;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, rowsPerTbl not found");
|
printf("ERROR: failed to read json, rowsPerTbl not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3205,7 +3257,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!disorderRatio) {
|
} else if (!disorderRatio) {
|
||||||
g_Dbs.db[i].superTbls[j].disorderRatio = 0;
|
g_Dbs.db[i].superTbls[j].disorderRatio = 0;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, disorderRatio not found");
|
printf("ERROR: failed to read json, disorderRatio not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3215,11 +3267,10 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} else if (!disorderRange) {
|
} else if (!disorderRange) {
|
||||||
g_Dbs.db[i].superTbls[j].disorderRange = 1000;
|
g_Dbs.db[i].superTbls[j].disorderRange = 1000;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, disorderRange not found");
|
printf("ERROR: failed to read json, disorderRange not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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;
|
||||||
|
@ -3229,7 +3280,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
} 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("ERROR: failed to read json, insert_rows not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3268,7 +3319,7 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
|
||||||
} else if (!host) {
|
} else if (!host) {
|
||||||
tstrncpy(g_queryInfo.host, "127.0.0.1", MAX_DB_NAME_SIZE);
|
tstrncpy(g_queryInfo.host, "127.0.0.1", MAX_DB_NAME_SIZE);
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, host not found\n");
|
printf("ERROR: failed to read json, host not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3306,7 +3357,7 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
|
||||||
} else if (!answerPrompt) {
|
} else if (!answerPrompt) {
|
||||||
g_args.answer_yes = false;
|
g_args.answer_yes = false;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, confirm_parameter_prompt not found");
|
printf("ERROR: failed to read json, confirm_parameter_prompt not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3314,7 +3365,7 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
|
||||||
if (dbs && dbs->type == cJSON_String && dbs->valuestring != NULL) {
|
if (dbs && dbs->type == cJSON_String && dbs->valuestring != NULL) {
|
||||||
tstrncpy(g_queryInfo.dbName, dbs->valuestring, MAX_DB_NAME_SIZE);
|
tstrncpy(g_queryInfo.dbName, dbs->valuestring, MAX_DB_NAME_SIZE);
|
||||||
} else if (!dbs) {
|
} else if (!dbs) {
|
||||||
printf("failed to read json, databases not found\n");
|
printf("ERROR: failed to read json, databases not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3324,7 +3375,7 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
|
||||||
} else if (!queryMode) {
|
} else if (!queryMode) {
|
||||||
tstrncpy(g_queryInfo.queryMode, "taosc", MAX_TB_NAME_SIZE);
|
tstrncpy(g_queryInfo.queryMode, "taosc", MAX_TB_NAME_SIZE);
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, query_mode not found\n");
|
printf("ERROR: failed to read json, query_mode not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3334,7 +3385,7 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
|
||||||
g_queryInfo.superQueryInfo.concurrent = 0;
|
g_queryInfo.superQueryInfo.concurrent = 0;
|
||||||
g_queryInfo.superQueryInfo.sqlCount = 0;
|
g_queryInfo.superQueryInfo.sqlCount = 0;
|
||||||
} else if (superQuery->type != cJSON_Object) {
|
} else if (superQuery->type != cJSON_Object) {
|
||||||
printf("failed to read json, super_table_query not found");
|
printf("ERROR: failed to read json, super_table_query not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
} else {
|
} else {
|
||||||
cJSON* rate = cJSON_GetObjectItem(superQuery, "query_interval");
|
cJSON* rate = cJSON_GetObjectItem(superQuery, "query_interval");
|
||||||
|
@ -3358,7 +3409,7 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
|
||||||
} else if (0 == strcmp("async", mode->valuestring)) {
|
} else if (0 == strcmp("async", mode->valuestring)) {
|
||||||
g_queryInfo.superQueryInfo.subscribeMode = 1;
|
g_queryInfo.superQueryInfo.subscribeMode = 1;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, subscribe mod error\n");
|
printf("ERROR: failed to read json, subscribe mod error\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -3381,7 +3432,7 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
|
||||||
} else if (0 == strcmp("no", restart->valuestring)) {
|
} else if (0 == strcmp("no", restart->valuestring)) {
|
||||||
g_queryInfo.superQueryInfo.subscribeRestart = 0;
|
g_queryInfo.superQueryInfo.subscribeRestart = 0;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, subscribe restart error\n");
|
printf("ERROR: failed to read json, subscribe restart error\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -3397,7 +3448,7 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
|
||||||
} else if (0 == strcmp("no", keepProgress->valuestring)) {
|
} else if (0 == strcmp("no", keepProgress->valuestring)) {
|
||||||
g_queryInfo.superQueryInfo.subscribeKeepProgress = 0;
|
g_queryInfo.superQueryInfo.subscribeKeepProgress = 0;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, subscribe keepProgress error\n");
|
printf("ERROR: failed to read json, subscribe keepProgress error\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -3409,12 +3460,12 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
|
||||||
if (!superSqls) {
|
if (!superSqls) {
|
||||||
g_queryInfo.superQueryInfo.sqlCount = 0;
|
g_queryInfo.superQueryInfo.sqlCount = 0;
|
||||||
} else if (superSqls->type != cJSON_Array) {
|
} else if (superSqls->type != cJSON_Array) {
|
||||||
printf("failed to read json, super sqls not found\n");
|
printf("ERROR: failed to read json, super sqls not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
} else {
|
} else {
|
||||||
int superSqlSize = cJSON_GetArraySize(superSqls);
|
int superSqlSize = cJSON_GetArraySize(superSqls);
|
||||||
if (superSqlSize > MAX_QUERY_SQL_COUNT) {
|
if (superSqlSize > MAX_QUERY_SQL_COUNT) {
|
||||||
printf("failed to read json, query sql size overflow, max is %d\n", MAX_QUERY_SQL_COUNT);
|
printf("ERROR: failed to read json, query sql size overflow, max is %d\n", MAX_QUERY_SQL_COUNT);
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3425,7 +3476,7 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
|
||||||
|
|
||||||
cJSON *sqlStr = cJSON_GetObjectItem(sql, "sql");
|
cJSON *sqlStr = cJSON_GetObjectItem(sql, "sql");
|
||||||
if (!sqlStr || sqlStr->type != cJSON_String || sqlStr->valuestring == NULL) {
|
if (!sqlStr || sqlStr->type != cJSON_String || sqlStr->valuestring == NULL) {
|
||||||
printf("failed to read json, sql not found\n");
|
printf("ERROR: failed to read json, sql not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
tstrncpy(g_queryInfo.superQueryInfo.sql[j], sqlStr->valuestring, MAX_QUERY_SQL_LENGTH);
|
tstrncpy(g_queryInfo.superQueryInfo.sql[j], sqlStr->valuestring, MAX_QUERY_SQL_LENGTH);
|
||||||
|
@ -3436,7 +3487,7 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
|
||||||
} else if (NULL == result) {
|
} else if (NULL == result) {
|
||||||
memset(g_queryInfo.superQueryInfo.result[j], 0, MAX_FILE_NAME_LEN);
|
memset(g_queryInfo.superQueryInfo.result[j], 0, MAX_FILE_NAME_LEN);
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, super query result file not found\n");
|
printf("ERROR: failed to read json, super query result file not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3449,7 +3500,7 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
|
||||||
g_queryInfo.subQueryInfo.threadCnt = 0;
|
g_queryInfo.subQueryInfo.threadCnt = 0;
|
||||||
g_queryInfo.subQueryInfo.sqlCount = 0;
|
g_queryInfo.subQueryInfo.sqlCount = 0;
|
||||||
} else if (subQuery->type != cJSON_Object) {
|
} else if (subQuery->type != cJSON_Object) {
|
||||||
printf("failed to read json, sub_table_query not found");
|
printf("ERROR: failed to read json, sub_table_query not found\n");
|
||||||
ret = true;
|
ret = true;
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
} else {
|
} else {
|
||||||
|
@ -3478,7 +3529,7 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
|
||||||
if (stblname && stblname->type == cJSON_String && stblname->valuestring != NULL) {
|
if (stblname && stblname->type == cJSON_String && stblname->valuestring != NULL) {
|
||||||
tstrncpy(g_queryInfo.subQueryInfo.sTblName, stblname->valuestring, MAX_TB_NAME_SIZE);
|
tstrncpy(g_queryInfo.subQueryInfo.sTblName, stblname->valuestring, MAX_TB_NAME_SIZE);
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, super table name not found\n");
|
printf("ERROR: failed to read json, super table name not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3489,7 +3540,7 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
|
||||||
} else if (0 == strcmp("async", submode->valuestring)) {
|
} else if (0 == strcmp("async", submode->valuestring)) {
|
||||||
g_queryInfo.subQueryInfo.subscribeMode = 1;
|
g_queryInfo.subQueryInfo.subscribeMode = 1;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, subscribe mod error\n");
|
printf("ERROR: failed to read json, subscribe mod error\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -3512,7 +3563,7 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
|
||||||
} else if (0 == strcmp("no", subrestart->valuestring)) {
|
} else if (0 == strcmp("no", subrestart->valuestring)) {
|
||||||
g_queryInfo.subQueryInfo.subscribeRestart = 0;
|
g_queryInfo.subQueryInfo.subscribeRestart = 0;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, subscribe restart error\n");
|
printf("ERROR: failed to read json, subscribe restart error\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -3526,7 +3577,7 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
|
||||||
} else if (0 == strcmp("no", subkeepProgress->valuestring)) {
|
} else if (0 == strcmp("no", subkeepProgress->valuestring)) {
|
||||||
g_queryInfo.subQueryInfo.subscribeKeepProgress = 0;
|
g_queryInfo.subQueryInfo.subscribeKeepProgress = 0;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, subscribe keepProgress error\n");
|
printf("ERROR: failed to read json, subscribe keepProgress error\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -3538,12 +3589,12 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
|
||||||
if (!subsqls) {
|
if (!subsqls) {
|
||||||
g_queryInfo.subQueryInfo.sqlCount = 0;
|
g_queryInfo.subQueryInfo.sqlCount = 0;
|
||||||
} else if (subsqls->type != cJSON_Array) {
|
} else if (subsqls->type != cJSON_Array) {
|
||||||
printf("failed to read json, super sqls not found\n");
|
printf("ERROR: failed to read json, super sqls not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
} else {
|
} else {
|
||||||
int superSqlSize = cJSON_GetArraySize(subsqls);
|
int superSqlSize = cJSON_GetArraySize(subsqls);
|
||||||
if (superSqlSize > MAX_QUERY_SQL_COUNT) {
|
if (superSqlSize > MAX_QUERY_SQL_COUNT) {
|
||||||
printf("failed to read json, query sql size overflow, max is %d\n", MAX_QUERY_SQL_COUNT);
|
printf("ERROR: failed to read json, query sql size overflow, max is %d\n", MAX_QUERY_SQL_COUNT);
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3554,7 +3605,7 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
|
||||||
|
|
||||||
cJSON *sqlStr = cJSON_GetObjectItem(sql, "sql");
|
cJSON *sqlStr = cJSON_GetObjectItem(sql, "sql");
|
||||||
if (!sqlStr || sqlStr->type != cJSON_String || sqlStr->valuestring == NULL) {
|
if (!sqlStr || sqlStr->type != cJSON_String || sqlStr->valuestring == NULL) {
|
||||||
printf("failed to read json, sql not found\n");
|
printf("ERROR: failed to read json, sql not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
tstrncpy(g_queryInfo.subQueryInfo.sql[j], sqlStr->valuestring, MAX_QUERY_SQL_LENGTH);
|
tstrncpy(g_queryInfo.subQueryInfo.sql[j], sqlStr->valuestring, MAX_QUERY_SQL_LENGTH);
|
||||||
|
@ -3565,7 +3616,7 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
|
||||||
} else if (NULL == result) {
|
} else if (NULL == result) {
|
||||||
memset(g_queryInfo.subQueryInfo.result[j], 0, MAX_FILE_NAME_LEN);
|
memset(g_queryInfo.subQueryInfo.result[j], 0, MAX_FILE_NAME_LEN);
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, sub query result file not found\n");
|
printf("ERROR: failed to read json, sub query result file not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3604,7 +3655,7 @@ static bool getInfoFromJsonFile(char* file) {
|
||||||
content[len] = 0;
|
content[len] = 0;
|
||||||
cJSON* root = cJSON_Parse(content);
|
cJSON* root = cJSON_Parse(content);
|
||||||
if (root == NULL) {
|
if (root == NULL) {
|
||||||
printf("failed to cjson parse %s, invalid json format", file);
|
printf("ERROR: failed to cjson parse %s, invalid json format\n", file);
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3617,13 +3668,13 @@ static bool getInfoFromJsonFile(char* file) {
|
||||||
} else if (0 == strcasecmp("subscribe", filetype->valuestring)) {
|
} else if (0 == strcasecmp("subscribe", filetype->valuestring)) {
|
||||||
g_args.test_mode = SUBSCRIBE_MODE;
|
g_args.test_mode = SUBSCRIBE_MODE;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, filetype not support\n");
|
printf("ERROR: failed to read json, filetype not support\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
} else if (!filetype) {
|
} else if (!filetype) {
|
||||||
g_args.test_mode = INSERT_MODE;
|
g_args.test_mode = INSERT_MODE;
|
||||||
} else {
|
} else {
|
||||||
printf("failed to read json, filetype not found\n");
|
printf("ERROR: failed to read json, filetype not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3634,7 +3685,7 @@ static bool getInfoFromJsonFile(char* file) {
|
||||||
} else if (SUBSCRIBE_MODE == g_args.test_mode) {
|
} else if (SUBSCRIBE_MODE == g_args.test_mode) {
|
||||||
ret = getMetaFromQueryJsonFile(root);
|
ret = getMetaFromQueryJsonFile(root);
|
||||||
} else {
|
} else {
|
||||||
printf("input json file type error! please input correct file type: insert or query or subscribe\n");
|
printf("ERROR: input json file type error! please input correct file type: insert or query or subscribe\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4507,8 +4558,8 @@ void *asyncWrite(void *sarg) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void startMultiThreadInsertData(int threads, char* db_name, char* precision,
|
static void startMultiThreadInsertData(int threads, char* db_name,
|
||||||
SSuperTable* superTblInfo) {
|
char* precision,SSuperTable* superTblInfo) {
|
||||||
|
|
||||||
pthread_t *pids = malloc(threads * sizeof(pthread_t));
|
pthread_t *pids = malloc(threads * sizeof(pthread_t));
|
||||||
threadInfo *infos = malloc(threads * sizeof(threadInfo));
|
threadInfo *infos = malloc(threads * sizeof(threadInfo));
|
||||||
|
@ -4658,7 +4709,8 @@ void startMultiThreadInsertData(int threads, char* db_name, char* precision,
|
||||||
superTblInfo->totalAffectedRows,
|
superTblInfo->totalAffectedRows,
|
||||||
threads, db_name, superTblInfo->sTblName,
|
threads, db_name, superTblInfo->sTblName,
|
||||||
superTblInfo->totalRowsInserted / t);
|
superTblInfo->totalRowsInserted / t);
|
||||||
fprintf(g_fpOfInsertResult, "Spent %.4f seconds to insert rows: %"PRId64", affected rows: %"PRId64" with %d thread(s) into %s.%s. %2.f records/second\n\n",
|
fprintf(g_fpOfInsertResult,
|
||||||
|
"Spent %.4f seconds to insert rows: %"PRId64", affected rows: %"PRId64" with %d thread(s) into %s.%s. %2.f records/second\n\n",
|
||||||
t, superTblInfo->totalRowsInserted,
|
t, superTblInfo->totalRowsInserted,
|
||||||
superTblInfo->totalAffectedRows,
|
superTblInfo->totalAffectedRows,
|
||||||
threads, db_name, superTblInfo->sTblName,
|
threads, db_name, superTblInfo->sTblName,
|
||||||
|
@ -4820,7 +4872,7 @@ void *readMetric(void *sarg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int insertTestProcess() {
|
static int insertTestProcess() {
|
||||||
|
|
||||||
setupForAnsiEscape();
|
setupForAnsiEscape();
|
||||||
int ret = printfInsertMeta();
|
int ret = printfInsertMeta();
|
||||||
|
|
Loading…
Reference in New Issue