未验证 提交 2d0bcfbe 编写于 作者: sangshuduo's avatar sangshuduo 提交者: GitHub

[TD-5242]<feature>: taosdemo support max columns align with TSDB defines. (#6866)

上级 6fc8211a
...@@ -75,7 +75,7 @@ enum TEST_MODE { ...@@ -75,7 +75,7 @@ enum TEST_MODE {
#define MAX_RECORDS_PER_REQ 32766 #define MAX_RECORDS_PER_REQ 32766
#define HEAD_BUFF_LEN 1024*24 // 16*1024 + (192+32)*2 + insert into .. #define HEAD_BUFF_LEN TSDB_MAX_COLUMNS*24 // 16*MAX_COLUMNS + (192+32)*2 + insert into ..
#define MAX_SQL_SIZE 65536 #define MAX_SQL_SIZE 65536
#define BUFFER_SIZE (65536*2) #define BUFFER_SIZE (65536*2)
...@@ -84,26 +84,23 @@ enum TEST_MODE { ...@@ -84,26 +84,23 @@ enum TEST_MODE {
#define MAX_PASSWORD_SIZE 64 #define MAX_PASSWORD_SIZE 64
#define MAX_HOSTNAME_SIZE 64 #define MAX_HOSTNAME_SIZE 64
#define MAX_TB_NAME_SIZE 64 #define MAX_TB_NAME_SIZE 64
#define MAX_DATA_SIZE (16*1024)+20 // max record len: 16*1024, timestamp string and ,('') need extra space #define MAX_DATA_SIZE (16*TSDB_MAX_COLUMNS)+20 // max record len: 16*MAX_COLUMNS, timestamp string and ,('') need extra space
#define MAX_NUM_DATATYPE 10
#define OPT_ABORT 1 /* –abort */ #define OPT_ABORT 1 /* –abort */
#define STRING_LEN 60000 #define STRING_LEN 60000
#define MAX_PREPARED_RAND 1000000 #define MAX_PREPARED_RAND 1000000
#define MAX_FILE_NAME_LEN 256 // max file name length on linux is 255. #define MAX_FILE_NAME_LEN 256 // max file name length on linux is 255.
#define MAX_SAMPLES_ONCE_FROM_FILE 10000 #define MAX_SAMPLES_ONCE_FROM_FILE 10000
#define MAX_NUM_DATATYPE 10 #define MAX_NUM_COLUMNS (TSDB_MAX_COLUMNS - 1) // exclude first column timestamp
#define MAX_DB_COUNT 8 #define MAX_DB_COUNT 8
#define MAX_SUPER_TABLE_COUNT 200 #define MAX_SUPER_TABLE_COUNT 200
#define MAX_COLUMN_COUNT 1024
#define MAX_TAG_COUNT 128
#define MAX_QUERY_SQL_COUNT 100 #define MAX_QUERY_SQL_COUNT 100
#define MAX_QUERY_SQL_LENGTH 1024 #define MAX_QUERY_SQL_LENGTH 1024
#define MAX_DATABASE_COUNT 256 #define MAX_DATABASE_COUNT 256
#define INPUT_BUF_LEN 256 #define INPUT_BUF_LEN 256
#define DEFAULT_TIMESTAMP_STEP 1 #define DEFAULT_TIMESTAMP_STEP 1
...@@ -218,7 +215,7 @@ typedef struct SArguments_S { ...@@ -218,7 +215,7 @@ typedef struct SArguments_S {
bool performance_print; bool performance_print;
char * output_file; char * output_file;
bool async_mode; bool async_mode;
char * datatype[MAX_NUM_DATATYPE + 1]; char * datatype[MAX_NUM_COLUMNS + 1];
uint32_t len_of_binary; uint32_t len_of_binary;
uint32_t num_of_CPR; uint32_t num_of_CPR;
uint32_t num_of_threads; uint32_t num_of_threads;
...@@ -274,9 +271,9 @@ typedef struct SSuperTable_S { ...@@ -274,9 +271,9 @@ typedef struct SSuperTable_S {
char tagsFile[MAX_FILE_NAME_LEN]; char tagsFile[MAX_FILE_NAME_LEN];
uint32_t columnCount; uint32_t columnCount;
StrColumn columns[MAX_COLUMN_COUNT]; StrColumn columns[TSDB_MAX_COLUMNS];
uint32_t tagCount; uint32_t tagCount;
StrColumn tags[MAX_TAG_COUNT]; StrColumn tags[TSDB_MAX_TAGS];
char* childTblName; char* childTblName;
char* colsOfCreateChildTable; char* colsOfCreateChildTable;
...@@ -731,7 +728,7 @@ static void printHelp() { ...@@ -731,7 +728,7 @@ static void printHelp() {
"The number of columns per record. Default is ", "The number of columns per record. Default is ",
DEFAULT_DATATYPE_NUM, DEFAULT_DATATYPE_NUM,
". Max values is ", ". Max values is ",
MAX_NUM_DATATYPE); MAX_NUM_COLUMNS);
printf("%s%s%s%s\n", indent, indent, indent, printf("%s%s%s%s\n", indent, indent, indent,
"All of the new column(s) type is INT. If use -b to specify column type, -l will be ignored."); "All of the new column(s) type is INT. If use -b to specify column type, -l will be ignored.");
printf("%s%s%s%s\n", indent, "-T", indent, printf("%s%s%s%s\n", indent, "-T", indent,
...@@ -937,16 +934,16 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) { ...@@ -937,16 +934,16 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
} }
arguments->num_of_CPR = atoi(argv[++i]); arguments->num_of_CPR = atoi(argv[++i]);
if (arguments->num_of_CPR > MAX_NUM_DATATYPE) { if (arguments->num_of_CPR > MAX_NUM_COLUMNS) {
printf("WARNING: max acceptible columns count is %d\n", MAX_NUM_DATATYPE); printf("WARNING: max acceptible columns count is %d\n", MAX_NUM_COLUMNS);
prompt(); prompt();
arguments->num_of_CPR = MAX_NUM_DATATYPE; arguments->num_of_CPR = MAX_NUM_COLUMNS;
} }
for (int col = DEFAULT_DATATYPE_NUM; col < arguments->num_of_CPR; col ++) { for (int col = DEFAULT_DATATYPE_NUM; col < arguments->num_of_CPR; col ++) {
arguments->datatype[col] = "INT"; arguments->datatype[col] = "INT";
} }
for (int col = arguments->num_of_CPR; col < MAX_NUM_DATATYPE; col++) { for (int col = arguments->num_of_CPR; col < MAX_NUM_COLUMNS; col++) {
arguments->datatype[col] = NULL; arguments->datatype[col] = NULL;
} }
...@@ -999,7 +996,7 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) { ...@@ -999,7 +996,7 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
} }
arguments->datatype[index++] = token; arguments->datatype[index++] = token;
token = strsep(&running, ","); token = strsep(&running, ",");
if (index >= MAX_NUM_DATATYPE) break; if (index >= MAX_NUM_COLUMNS) break;
} }
arguments->datatype[index] = NULL; arguments->datatype[index] = NULL;
} }
...@@ -1095,7 +1092,7 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) { ...@@ -1095,7 +1092,7 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
} }
int columnCount; int columnCount;
for (columnCount = 0; columnCount < MAX_NUM_DATATYPE; columnCount ++) { for (columnCount = 0; columnCount < MAX_NUM_COLUMNS; columnCount ++) {
if (g_args.datatype[columnCount] == NULL) { if (g_args.datatype[columnCount] == NULL) {
break; break;
} }
...@@ -1120,7 +1117,7 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) { ...@@ -1120,7 +1117,7 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
arguments->use_metric ? "true" : "false"); arguments->use_metric ? "true" : "false");
if (*(arguments->datatype)) { if (*(arguments->datatype)) {
printf("# Specified data type: "); printf("# Specified data type: ");
for (int i = 0; i < MAX_NUM_DATATYPE; i++) for (int i = 0; i < MAX_NUM_COLUMNS; i++)
if (arguments->datatype[i]) if (arguments->datatype[i])
printf("%s,", arguments->datatype[i]); printf("%s,", arguments->datatype[i]);
else else
...@@ -3378,9 +3375,9 @@ static bool getColumnAndTagTypeFromInsertJsonFile( ...@@ -3378,9 +3375,9 @@ static bool getColumnAndTagTypeFromInsertJsonFile(
} }
int columnSize = cJSON_GetArraySize(columns); int columnSize = cJSON_GetArraySize(columns);
if ((columnSize + 1/* ts */) > MAX_COLUMN_COUNT) { if ((columnSize + 1/* ts */) > TSDB_MAX_COLUMNS) {
errorPrint("%s() LN%d, failed to read json, column size overflow, max column size is %d\n", errorPrint("%s() LN%d, failed to read json, column size overflow, max column size is %d\n",
__func__, __LINE__, MAX_COLUMN_COUNT); __func__, __LINE__, TSDB_MAX_COLUMNS);
goto PARSE_OVER; goto PARSE_OVER;
} }
...@@ -3436,9 +3433,9 @@ static bool getColumnAndTagTypeFromInsertJsonFile( ...@@ -3436,9 +3433,9 @@ static bool getColumnAndTagTypeFromInsertJsonFile(
} }
} }
if ((index + 1 /* ts */) > MAX_COLUMN_COUNT) { if ((index + 1 /* ts */) > MAX_NUM_COLUMNS) {
errorPrint("%s() LN%d, failed to read json, column size overflow, allowed max column size is %d\n", errorPrint("%s() LN%d, failed to read json, column size overflow, allowed max column size is %d\n",
__func__, __LINE__, MAX_COLUMN_COUNT); __func__, __LINE__, MAX_NUM_COLUMNS);
goto PARSE_OVER; goto PARSE_OVER;
} }
...@@ -3455,9 +3452,9 @@ static bool getColumnAndTagTypeFromInsertJsonFile( ...@@ -3455,9 +3452,9 @@ static bool getColumnAndTagTypeFromInsertJsonFile(
} }
int tagSize = cJSON_GetArraySize(tags); int tagSize = cJSON_GetArraySize(tags);
if (tagSize > MAX_TAG_COUNT) { if (tagSize > TSDB_MAX_TAGS) {
errorPrint("%s() LN%d, failed to read json, tags size overflow, max tag size is %d\n", errorPrint("%s() LN%d, failed to read json, tags size overflow, max tag size is %d\n",
__func__, __LINE__, MAX_TAG_COUNT); __func__, __LINE__, TSDB_MAX_TAGS);
goto PARSE_OVER; goto PARSE_OVER;
} }
...@@ -3507,17 +3504,17 @@ static bool getColumnAndTagTypeFromInsertJsonFile( ...@@ -3507,17 +3504,17 @@ static bool getColumnAndTagTypeFromInsertJsonFile(
} }
} }
if (index > MAX_TAG_COUNT) { if (index > TSDB_MAX_TAGS) {
errorPrint("%s() LN%d, failed to read json, tags size overflow, allowed max tag count is %d\n", errorPrint("%s() LN%d, failed to read json, tags size overflow, allowed max tag count is %d\n",
__func__, __LINE__, MAX_TAG_COUNT); __func__, __LINE__, TSDB_MAX_TAGS);
goto PARSE_OVER; goto PARSE_OVER;
} }
superTbls->tagCount = index; superTbls->tagCount = index;
if ((superTbls->columnCount + superTbls->tagCount + 1 /* ts */) > MAX_COLUMN_COUNT) { if ((superTbls->columnCount + superTbls->tagCount + 1 /* ts */) > TSDB_MAX_COLUMNS) {
errorPrint("%s() LN%d, columns + tags is more than allowed max columns count: %d\n", errorPrint("%s() LN%d, columns + tags is more than allowed max columns count: %d\n",
__func__, __LINE__, MAX_COLUMN_COUNT); __func__, __LINE__, TSDB_MAX_COLUMNS);
goto PARSE_OVER; goto PARSE_OVER;
} }
ret = true; ret = true;
...@@ -7947,7 +7944,7 @@ static void setParaFromArg(){ ...@@ -7947,7 +7944,7 @@ static void setParaFromArg(){
g_Dbs.db[0].superTbls[0].maxSqlLen = g_args.max_sql_len; g_Dbs.db[0].superTbls[0].maxSqlLen = g_args.max_sql_len;
g_Dbs.db[0].superTbls[0].columnCount = 0; g_Dbs.db[0].superTbls[0].columnCount = 0;
for (int i = 0; i < MAX_NUM_DATATYPE; i++) { for (int i = 0; i < MAX_NUM_COLUMNS; i++) {
if (data_type[i] == NULL) { if (data_type[i] == NULL) {
break; break;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册