Skip to content

Commit

Permalink
feat: taosbenchmark stmt subtable with sample (#598)
Browse files Browse the repository at this point in the history
* feat: taosbenchmark supports specifying child table example data

* feat: subtable with sample works

* test: add stmt child table sample file

* feat: make random data apply to each sub-table

* fix: change demo mode to use random data per table

* fix: sml data use own sample file per table

* fix: add cols in child table for stmt

* feat: stmt sample data per child table complete

* fix: disable mist mode for stmt interface
  • Loading branch information
sangshuduo committed Mar 3, 2023
1 parent 48cc475 commit f806257
Show file tree
Hide file tree
Showing 9 changed files with 719 additions and 341 deletions.
57 changes: 33 additions & 24 deletions inc/bench.h
Original file line number Diff line number Diff line change
Expand Up @@ -530,14 +530,22 @@ static const int OFF_CUSTOM = -3;
static const int OFF_LEN = -2;
static const int OFF_CAP = -1;

typedef struct SStmtData {
void *data;
char *is_null;
} StmtData;

typedef struct SChildField {
StmtData stmtData;
} ChildField;

typedef struct SField {
uint8_t type;
char name[TSDB_COL_NAME_LEN + 1];
uint32_t length;
bool none;
bool null;
void * data;
char * is_null;
StmtData stmtData;
int64_t max;
int64_t min;
tools_cJSON * values;
Expand Down Expand Up @@ -575,10 +583,11 @@ enum CONTINUE_IF_FAIL_MODE {
};

typedef struct SChildTable_S {
char childTableName[TSDB_TABLE_NAME_LEN];
char name[TSDB_TABLE_NAME_LEN];
bool useOwnSample;
char *sampleDataBuf;
uint64_t insertRows;
BArray *childCols;
} SChildTable;

typedef struct SSuperTable_S {
Expand Down Expand Up @@ -687,10 +696,10 @@ typedef struct SSTREAM_S {

#ifdef TD_VER_COMPATIBLE_3_0_0_0
typedef struct SVGroup_S {
int32_t vgId;
uint64_t tbCountPerVgId;
char **childTblName; // table name pointer array
uint64_t tbOffset; // internal use
int32_t vgId;
uint64_t tbCountPerVgId;
SChildTable **childTblArray;
uint64_t tbOffset; // internal use
} SVGroup;
#endif // TD_VER_COMPATIBLE_3_0_0_0
//
Expand Down Expand Up @@ -771,28 +780,27 @@ typedef struct SQueryMetaInfo_S {


typedef struct SConsumerInfo_S {
uint32_t concurrent;
uint32_t pollDelay; // ms
char* groupId;
char* clientId;
char* autoOffsetReset;

char* enableAutoCommit;
uint32_t autoCommitIntervalMs; // ms
char* enableHeartbeatBackground;
char* snapshotEnable;
char* msgWithTableName;

char topicName[MAX_QUERY_SQL_COUNT][256];
char topicSql[MAX_QUERY_SQL_COUNT][256];
int topicCount;

uint32_t concurrent;
uint32_t pollDelay; // ms
char* groupId;
char* clientId;
char* autoOffsetReset;

char* enableAutoCommit;
uint32_t autoCommitIntervalMs; // ms
char* enableHeartbeatBackground;
char* snapshotEnable;
char* msgWithTableName;

char topicName[MAX_QUERY_SQL_COUNT][256];
char topicSql[MAX_QUERY_SQL_COUNT][256];
int topicCount;
} SConsumerInfo;

typedef struct STmqMetaInfo_S {
SConsumerInfo consumerInfo;
uint16_t iface;
int16_t ifSaveData;
int16_t ifSaveData;
} STmqMetaInfo;

typedef struct SArguments_S {
Expand Down Expand Up @@ -855,6 +863,7 @@ typedef struct SArguments_S {
int16_t inputted_vgroups;
#endif
enum CONTINUE_IF_FAIL_MODE continueIfFail;
bool mistMode;
} SArguments;

typedef struct SBenchConn {
Expand Down
4 changes: 2 additions & 2 deletions inc/benchData.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ int64_t getTSRandTail(int64_t timeStampStep, int32_t seq, int disorderRatio,
int generateRandData(SSuperTable *stbInfo, char *sampleDataBuf,
int bufLen,
int lenOfOneRow, BArray * fields, int64_t loop,
bool tag);
bool tag, BArray *childCols);
int prepareStmt(SSuperTable *stbInfo, TAOS_STMT *stmt, uint64_t tableSeq);
uint32_t bindParamBatch(threadInfo *pThreadInfo,
uint32_t batch, int64_t startTime);
uint32_t batch, int64_t startTime, SChildTable *childTbl);
int prepareSampleData(SDataBase* database, SSuperTable* stbInfo);
void generateSmlJsonTags(tools_cJSON *tagsList,
char **sml_tags_json_array,
Expand Down
11 changes: 9 additions & 2 deletions src/benchCommandOpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,8 @@ int32_t benchParseSingleOpt(int32_t key, char* arg) {
break;

case 'M':
g_arguments->demo_mode = false;
g_arguments->mistMode = true;
g_arguments->prepared_rand = 57;
break;

case 'x':
Expand Down Expand Up @@ -730,7 +731,7 @@ void init_argument() {
g_arguments->taosc_version = 2;
}
g_arguments->test_mode = INSERT_TEST;
g_arguments->demo_mode = 1;
g_arguments->demo_mode = true;
g_arguments->host = NULL;
g_arguments->host_auto = true;
g_arguments->port = DEFAULT_PORT;
Expand Down Expand Up @@ -771,6 +772,7 @@ void init_argument() {
#ifdef TD_VER_COMPATIBLE_3_0_0_0
g_arguments->inputted_vgroups = -1;
#endif
g_arguments->mistMode = false;

initDatabase();
initStable();
Expand Down Expand Up @@ -871,6 +873,11 @@ void modify_argument() {
g_arguments->rest_server_ver_major =
getServerVersionRest(g_arguments->port);
}

if (g_arguments->demo_mode && TAOSC_IFACE == g_arguments->iface) {
g_arguments->mistMode = true;
g_arguments->prepared_rand = 57;
}
}

static void *queryStableAggrFunc(void *sarg) {
Expand Down
Loading

0 comments on commit f806257

Please sign in to comment.