better msg for create child table. (#7565)
This commit is contained in:
parent
15362557e6
commit
ceeb22d667
|
@ -443,6 +443,7 @@ typedef struct SThreadInfo_S {
|
|||
uint64_t start_table_from;
|
||||
uint64_t end_table_to;
|
||||
int64_t ntables;
|
||||
int64_t tables_created;
|
||||
uint64_t data_of_rate;
|
||||
int64_t start_time;
|
||||
char* cols;
|
||||
|
@ -639,6 +640,7 @@ SArguments g_args = {
|
|||
|
||||
static SDbs g_Dbs;
|
||||
static int64_t g_totalChildTables = 0;
|
||||
static int64_t g_actualChildTables = 0;
|
||||
static SQueryMetaInfo g_queryInfo;
|
||||
static FILE * g_fpOfInsertResult = NULL;
|
||||
|
||||
|
@ -964,6 +966,7 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
arguments->num_of_tables = atoi(argv[++i]);
|
||||
g_totalChildTables = arguments->num_of_tables;
|
||||
} else if (strcmp(argv[i], "-n") == 0) {
|
||||
if ((argc == i+1) ||
|
||||
(!isStringNumber(argv[i+1]))) {
|
||||
|
@ -3276,6 +3279,7 @@ static void* createTable(void *sarg)
|
|||
pThreadInfo->db_name,
|
||||
g_args.tb_prefix, i,
|
||||
pThreadInfo->cols);
|
||||
batchNum ++;
|
||||
} else {
|
||||
if (stbInfo == NULL) {
|
||||
free(pThreadInfo->buffer);
|
||||
|
@ -3330,6 +3334,7 @@ static void* createTable(void *sarg)
|
|||
free(pThreadInfo->buffer);
|
||||
return NULL;
|
||||
}
|
||||
pThreadInfo->tables_created += batchNum;
|
||||
|
||||
uint64_t currentPrintTime = taosGetTimestampMs();
|
||||
if (currentPrintTime - lastPrintTime > 30*1000) {
|
||||
|
@ -3401,6 +3406,7 @@ static int startMultiThreadCreateChildTable(
|
|||
pThreadInfo->use_metric = true;
|
||||
pThreadInfo->cols = cols;
|
||||
pThreadInfo->minDelay = UINT64_MAX;
|
||||
pThreadInfo->tables_created = 0;
|
||||
pthread_create(pids + i, NULL, createTable, pThreadInfo);
|
||||
}
|
||||
|
||||
|
@ -3411,6 +3417,8 @@ static int startMultiThreadCreateChildTable(
|
|||
for (int i = 0; i < threads; i++) {
|
||||
threadInfo *pThreadInfo = infos + i;
|
||||
taos_close(pThreadInfo->taos);
|
||||
|
||||
g_actualChildTables += pThreadInfo->tables_created;
|
||||
}
|
||||
|
||||
free(pids);
|
||||
|
@ -3437,7 +3445,6 @@ static void createChildTables() {
|
|||
verbosePrint("%s() LN%d: %s\n", __func__, __LINE__,
|
||||
g_Dbs.db[i].superTbls[j].colsOfCreateChildTable);
|
||||
uint64_t startFrom = 0;
|
||||
g_totalChildTables += g_Dbs.db[i].superTbls[j].childTblCount;
|
||||
|
||||
verbosePrint("%s() LN%d: create %"PRId64" child tables from %"PRIu64"\n",
|
||||
__func__, __LINE__, g_totalChildTables, startFrom);
|
||||
|
@ -4232,6 +4239,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
|||
goto PARSE_OVER;
|
||||
}
|
||||
g_Dbs.db[i].superTbls[j].childTblCount = count->valueint;
|
||||
g_totalChildTables += g_Dbs.db[i].superTbls[j].childTblCount;
|
||||
|
||||
cJSON *dataSource = cJSON_GetObjectItem(stbInfo, "data_source");
|
||||
if (dataSource && dataSource->type == cJSON_String
|
||||
|
@ -7932,18 +7940,30 @@ static int insertTestProcess() {
|
|||
double start;
|
||||
double end;
|
||||
|
||||
if (g_totalChildTables > 0) {
|
||||
fprintf(stderr,
|
||||
"creating %"PRId64" table(s) with %d thread(s)\n\n",
|
||||
g_totalChildTables, g_Dbs.threadCountByCreateTbl);
|
||||
if (g_fpOfInsertResult) {
|
||||
fprintf(g_fpOfInsertResult,
|
||||
"creating %"PRId64" table(s) with %d thread(s)\n\n",
|
||||
g_totalChildTables, g_Dbs.threadCountByCreateTbl);
|
||||
}
|
||||
|
||||
// create child tables
|
||||
start = taosGetTimestampMs();
|
||||
createChildTables();
|
||||
end = taosGetTimestampMs();
|
||||
|
||||
if (g_totalChildTables > 0) {
|
||||
fprintf(stderr, "Spent %.4f seconds to create %"PRId64" tables with %d thread(s)\n\n",
|
||||
(end - start)/1000.0, g_totalChildTables, g_Dbs.threadCountByCreateTbl);
|
||||
fprintf(stderr,
|
||||
"Spent %.4f seconds to create %"PRId64" table(s) with %d thread(s), actual %"PRId64" table(s) created\n\n",
|
||||
(end - start)/1000.0, g_totalChildTables,
|
||||
g_Dbs.threadCountByCreateTbl, g_actualChildTables);
|
||||
if (g_fpOfInsertResult) {
|
||||
fprintf(g_fpOfInsertResult,
|
||||
"Spent %.4f seconds to create %"PRId64" tables with %d thread(s)\n\n",
|
||||
(end - start)/1000.0, g_totalChildTables, g_Dbs.threadCountByCreateTbl);
|
||||
"Spent %.4f seconds to create %"PRId64" table(s) with %d thread(s), actual %"PRId64" table(s) created\n\n",
|
||||
(end - start)/1000.0, g_totalChildTables,
|
||||
g_Dbs.threadCountByCreateTbl, g_actualChildTables);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue