copy from develop branch. stmt: 0, nanosec: 0 (#6955)
* copy from develop branch. stmt: 0, nanosec: 0 * set thread name disabled on master branch.
This commit is contained in:
parent
d9cc1eb783
commit
c41d23daaa
|
@ -55,6 +55,11 @@
|
||||||
|
|
||||||
#define STMT_IFACE_ENABLED 0
|
#define STMT_IFACE_ENABLED 0
|
||||||
#define NANO_SECOND_ENABLED 0
|
#define NANO_SECOND_ENABLED 0
|
||||||
|
#define SET_THREADNAME_ENABLED 0
|
||||||
|
|
||||||
|
#if SET_THREADNAME_ENABLED == 0
|
||||||
|
#define setThreadName(name)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define REQ_EXTRA_BUF_LEN 1024
|
#define REQ_EXTRA_BUF_LEN 1024
|
||||||
#define RESP_BUF_LEN 4096
|
#define RESP_BUF_LEN 4096
|
||||||
|
@ -90,7 +95,7 @@ extern char configDir[];
|
||||||
#define MAX_SUPER_TABLE_COUNT 200
|
#define MAX_SUPER_TABLE_COUNT 200
|
||||||
|
|
||||||
#define MAX_QUERY_SQL_COUNT 100
|
#define MAX_QUERY_SQL_COUNT 100
|
||||||
#define MAX_QUERY_SQL_LENGTH 1024
|
#define MAX_QUERY_SQL_LENGTH BUFFER_SIZE
|
||||||
|
|
||||||
#define MAX_DATABASE_COUNT 256
|
#define MAX_DATABASE_COUNT 256
|
||||||
#define INPUT_BUF_LEN 256
|
#define INPUT_BUF_LEN 256
|
||||||
|
@ -2367,7 +2372,25 @@ static char* getTagValueFromTagSample(SSuperTable* stbInfo, int tagUsePos) {
|
||||||
return dataBuf;
|
return dataBuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char* generateTagValuesForStb(SSuperTable* stbInfo, int32_t tableSeq) {
|
static char *generateBinaryNCharTagValues(int64_t tableSeq, uint32_t len)
|
||||||
|
{
|
||||||
|
char* buf = (char*)calloc(len, 1);
|
||||||
|
if (NULL == buf) {
|
||||||
|
printf("calloc failed! size:%d\n", len);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tableSeq % 2) {
|
||||||
|
tstrncpy(buf, "beijing", len);
|
||||||
|
} else {
|
||||||
|
tstrncpy(buf, "shanghai", len);
|
||||||
|
}
|
||||||
|
//rand_string(buf, stbInfo->tags[i].dataLen);
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char* generateTagValuesForStb(SSuperTable* stbInfo, int64_t tableSeq) {
|
||||||
char* dataBuf = (char*)calloc(TSDB_MAX_SQL_LEN+1, 1);
|
char* dataBuf = (char*)calloc(TSDB_MAX_SQL_LEN+1, 1);
|
||||||
if (NULL == dataBuf) {
|
if (NULL == dataBuf) {
|
||||||
printf("calloc failed! size:%d\n", TSDB_MAX_SQL_LEN+1);
|
printf("calloc failed! size:%d\n", TSDB_MAX_SQL_LEN+1);
|
||||||
|
@ -2388,20 +2411,12 @@ static char* generateTagValuesForStb(SSuperTable* stbInfo, int32_t tableSeq) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tagBufLen = stbInfo->tags[i].dataLen + 1;
|
int32_t tagBufLen = stbInfo->tags[i].dataLen + 1;
|
||||||
char* buf = (char*)calloc(tagBufLen, 1);
|
char *buf = generateBinaryNCharTagValues(tableSeq, tagBufLen);
|
||||||
if (NULL == buf) {
|
if (NULL == buf) {
|
||||||
printf("calloc failed! size:%d\n", stbInfo->tags[i].dataLen);
|
|
||||||
tmfree(dataBuf);
|
tmfree(dataBuf);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tableSeq % 2) {
|
|
||||||
tstrncpy(buf, "beijing", tagBufLen);
|
|
||||||
} else {
|
|
||||||
tstrncpy(buf, "shanghai", tagBufLen);
|
|
||||||
}
|
|
||||||
//rand_string(buf, stbInfo->tags[i].dataLen);
|
|
||||||
dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
|
dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
|
||||||
"\'%s\',", buf);
|
"\'%s\',", buf);
|
||||||
tmfree(buf);
|
tmfree(buf);
|
||||||
|
@ -2410,11 +2425,11 @@ static char* generateTagValuesForStb(SSuperTable* stbInfo, int32_t tableSeq) {
|
||||||
if ((g_args.demo_mode) && (i == 0)) {
|
if ((g_args.demo_mode) && (i == 0)) {
|
||||||
dataLen += snprintf(dataBuf + dataLen,
|
dataLen += snprintf(dataBuf + dataLen,
|
||||||
TSDB_MAX_SQL_LEN - dataLen,
|
TSDB_MAX_SQL_LEN - dataLen,
|
||||||
"%d,", tableSeq % 10);
|
"%"PRId64",", tableSeq % 10);
|
||||||
} else {
|
} else {
|
||||||
dataLen += snprintf(dataBuf + dataLen,
|
dataLen += snprintf(dataBuf + dataLen,
|
||||||
TSDB_MAX_SQL_LEN - dataLen,
|
TSDB_MAX_SQL_LEN - dataLen,
|
||||||
"%d,", tableSeq);
|
"%"PRId64",", tableSeq);
|
||||||
}
|
}
|
||||||
} else if (0 == strncasecmp(stbInfo->tags[i].dataType,
|
} else if (0 == strncasecmp(stbInfo->tags[i].dataType,
|
||||||
"bigint", strlen("bigint"))) {
|
"bigint", strlen("bigint"))) {
|
||||||
|
@ -2445,7 +2460,7 @@ static char* generateTagValuesForStb(SSuperTable* stbInfo, int32_t tableSeq) {
|
||||||
dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
|
dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
|
||||||
"%"PRId64",", rand_bigint());
|
"%"PRId64",", rand_bigint());
|
||||||
} else {
|
} else {
|
||||||
printf("No support data type: %s\n", stbInfo->tags[i].dataType);
|
errorPrint("No support data type: %s\n", stbInfo->tags[i].dataType);
|
||||||
tmfree(dataBuf);
|
tmfree(dataBuf);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -3025,10 +3040,11 @@ static void* createTable(void *sarg)
|
||||||
threadInfo *pThreadInfo = (threadInfo *)sarg;
|
threadInfo *pThreadInfo = (threadInfo *)sarg;
|
||||||
SSuperTable* superTblInfo = pThreadInfo->superTblInfo;
|
SSuperTable* superTblInfo = pThreadInfo->superTblInfo;
|
||||||
|
|
||||||
|
setThreadName("createTable");
|
||||||
|
|
||||||
uint64_t lastPrintTime = taosGetTimestampMs();
|
uint64_t lastPrintTime = taosGetTimestampMs();
|
||||||
|
|
||||||
int buff_len;
|
int buff_len = BUFFER_SIZE;
|
||||||
buff_len = BUFFER_SIZE;
|
|
||||||
|
|
||||||
pThreadInfo->buffer = calloc(buff_len, 1);
|
pThreadInfo->buffer = calloc(buff_len, 1);
|
||||||
if (pThreadInfo->buffer == NULL) {
|
if (pThreadInfo->buffer == NULL) {
|
||||||
|
@ -5318,7 +5334,7 @@ static int generateSQLHeadWithoutStb(char *tableName,
|
||||||
|
|
||||||
static int generateStbSQLHead(
|
static int generateStbSQLHead(
|
||||||
SSuperTable* superTblInfo,
|
SSuperTable* superTblInfo,
|
||||||
char *tableName, int32_t tableSeq,
|
char *tableName, int64_t tableSeq,
|
||||||
char *dbName,
|
char *dbName,
|
||||||
char *buffer, int remainderBufLen)
|
char *buffer, int remainderBufLen)
|
||||||
{
|
{
|
||||||
|
@ -5650,8 +5666,7 @@ static int32_t prepareStmtBindArrayByType(TAOS_BIND *bind,
|
||||||
|
|
||||||
*ptr += bind->buffer_length;
|
*ptr += bind->buffer_length;
|
||||||
} else {
|
} else {
|
||||||
errorPrint( "No support data type: %s\n",
|
errorPrint( "No support data type: %s\n", dataType);
|
||||||
dataType);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5737,64 +5752,40 @@ static int32_t prepareStmtWithoutStb(
|
||||||
return k;
|
return k;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t prepareStbStmt(
|
static int32_t prepareStbStmtBind(
|
||||||
SSuperTable *stbInfo,
|
char *bindArray, SSuperTable *stbInfo, bool sourceRand,
|
||||||
TAOS_STMT *stmt,
|
int64_t startTime, int32_t recSeq,
|
||||||
char *tableName, uint32_t batch,
|
bool isColumn)
|
||||||
uint64_t insertRows,
|
|
||||||
uint64_t recordFrom,
|
|
||||||
int64_t startTime,
|
|
||||||
int64_t *pSamplePos)
|
|
||||||
{
|
{
|
||||||
int ret = taos_stmt_set_tbname(stmt, tableName);
|
char *bindBuffer = calloc(1, g_args.len_of_binary);
|
||||||
if (ret != 0) {
|
|
||||||
errorPrint("failed to execute taos_stmt_set_tbname(%s). return 0x%x. reason: %s\n",
|
|
||||||
tableName, ret, taos_errstr(NULL));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *bindArray = malloc(sizeof(TAOS_BIND) * (stbInfo->columnCount + 1));
|
|
||||||
if (bindArray == NULL) {
|
|
||||||
errorPrint("%s() LN%d, Failed to allocate %d bind params\n",
|
|
||||||
__func__, __LINE__, (stbInfo->columnCount + 1));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool sourceRand;
|
|
||||||
if (0 == strncasecmp(stbInfo->dataSource, "rand", strlen("rand"))) {
|
|
||||||
sourceRand = true;
|
|
||||||
} else {
|
|
||||||
sourceRand = false; // from sample data file
|
|
||||||
}
|
|
||||||
|
|
||||||
char *bindBuffer = malloc(g_args.len_of_binary);
|
|
||||||
if (bindBuffer == NULL) {
|
if (bindBuffer == NULL) {
|
||||||
errorPrint("%s() LN%d, Failed to allocate %d bind buffer\n",
|
errorPrint("%s() LN%d, Failed to allocate %d bind buffer\n",
|
||||||
__func__, __LINE__, g_args.len_of_binary);
|
__func__, __LINE__, g_args.len_of_binary);
|
||||||
free(bindArray);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t k;
|
|
||||||
for (k = 0; k < batch;) {
|
|
||||||
/* columnCount + 1 (ts) */
|
|
||||||
char data[MAX_DATA_SIZE];
|
char data[MAX_DATA_SIZE];
|
||||||
memset(data, 0, MAX_DATA_SIZE);
|
memset(data, 0, MAX_DATA_SIZE);
|
||||||
|
|
||||||
char *ptr = data;
|
char *ptr = data;
|
||||||
TAOS_BIND *bind = (TAOS_BIND *)(bindArray + 0);
|
|
||||||
|
|
||||||
|
TAOS_BIND *bind;
|
||||||
|
|
||||||
|
if (isColumn) {
|
||||||
|
for (int i = 0; i < stbInfo->columnCount + 1; i ++) {
|
||||||
|
bind = (TAOS_BIND *)((char *)bindArray + (sizeof(TAOS_BIND) * i));
|
||||||
|
|
||||||
|
if (i == 0) {
|
||||||
int64_t *bind_ts;
|
int64_t *bind_ts;
|
||||||
|
|
||||||
bind_ts = (int64_t *)ptr;
|
bind_ts = (int64_t *)ptr;
|
||||||
bind->buffer_type = TSDB_DATA_TYPE_TIMESTAMP;
|
bind->buffer_type = TSDB_DATA_TYPE_TIMESTAMP;
|
||||||
if (stbInfo->disorderRatio) {
|
if (stbInfo->disorderRatio) {
|
||||||
*bind_ts = startTime + getTSRandTail(
|
*bind_ts = startTime + getTSRandTail(
|
||||||
stbInfo->timeStampStep, k,
|
stbInfo->timeStampStep, recSeq,
|
||||||
stbInfo->disorderRatio,
|
stbInfo->disorderRatio,
|
||||||
stbInfo->disorderRange);
|
stbInfo->disorderRange);
|
||||||
} else {
|
} else {
|
||||||
*bind_ts = startTime + stbInfo->timeStampStep * k;
|
*bind_ts = startTime + stbInfo->timeStampStep * recSeq;
|
||||||
}
|
}
|
||||||
bind->buffer_length = sizeof(int64_t);
|
bind->buffer_length = sizeof(int64_t);
|
||||||
bind->buffer = bind_ts;
|
bind->buffer = bind_ts;
|
||||||
|
@ -5802,19 +5793,16 @@ static int32_t prepareStbStmt(
|
||||||
bind->is_null = NULL;
|
bind->is_null = NULL;
|
||||||
|
|
||||||
ptr += bind->buffer_length;
|
ptr += bind->buffer_length;
|
||||||
|
} else {
|
||||||
int cursor = 0;
|
int cursor = 0;
|
||||||
for (int i = 0; i < stbInfo->columnCount; i ++) {
|
|
||||||
bind = (TAOS_BIND *)((char *)bindArray + (sizeof(TAOS_BIND) * (i + 1)));
|
|
||||||
|
|
||||||
if (sourceRand) {
|
if (sourceRand) {
|
||||||
if ( -1 == prepareStmtBindArrayByType(
|
if ( -1 == prepareStmtBindArrayByType(
|
||||||
bind,
|
bind,
|
||||||
stbInfo->columns[i].dataType,
|
stbInfo->columns[i-1].dataType,
|
||||||
stbInfo->columns[i].dataLen,
|
stbInfo->columns[i-1].dataLen,
|
||||||
&ptr,
|
&ptr,
|
||||||
NULL)) {
|
NULL)) {
|
||||||
free(bindArray);
|
|
||||||
free(bindBuffer);
|
free(bindBuffer);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -5835,16 +5823,120 @@ static int32_t prepareStbStmt(
|
||||||
|
|
||||||
if ( -1 == prepareStmtBindArrayByType(
|
if ( -1 == prepareStmtBindArrayByType(
|
||||||
bind,
|
bind,
|
||||||
stbInfo->columns[i].dataType,
|
stbInfo->columns[i-1].dataType,
|
||||||
stbInfo->columns[i].dataLen,
|
stbInfo->columns[i-1].dataLen,
|
||||||
&ptr,
|
&ptr,
|
||||||
bindBuffer)) {
|
bindBuffer)) {
|
||||||
free(bindArray);
|
|
||||||
free(bindBuffer);
|
free(bindBuffer);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
TAOS_BIND *tag;
|
||||||
|
|
||||||
|
for (int t = 0; t < stbInfo->tagCount; t ++) {
|
||||||
|
tag = (TAOS_BIND *)((char *)bindArray + (sizeof(TAOS_BIND) * t));
|
||||||
|
if ( -1 == prepareStmtBindArrayByType(
|
||||||
|
tag,
|
||||||
|
stbInfo->tags[t].dataType,
|
||||||
|
stbInfo->tags[t].dataLen,
|
||||||
|
&ptr,
|
||||||
|
NULL)) {
|
||||||
|
free(bindBuffer);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t prepareStbStmt(
|
||||||
|
SSuperTable *stbInfo,
|
||||||
|
TAOS_STMT *stmt,
|
||||||
|
char *tableName,
|
||||||
|
int64_t tableSeq,
|
||||||
|
uint32_t batch,
|
||||||
|
uint64_t insertRows,
|
||||||
|
uint64_t recordFrom,
|
||||||
|
int64_t startTime,
|
||||||
|
int64_t *pSamplePos)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
bool sourceRand;
|
||||||
|
if (0 == strncasecmp(stbInfo->dataSource, "rand", strlen("rand"))) {
|
||||||
|
sourceRand = true;
|
||||||
|
} else {
|
||||||
|
sourceRand = false; // from sample data file
|
||||||
|
}
|
||||||
|
|
||||||
|
if (AUTO_CREATE_SUBTBL == stbInfo->autoCreateTable) {
|
||||||
|
char* tagsValBuf = NULL;
|
||||||
|
|
||||||
|
bool tagRand;
|
||||||
|
if (0 == stbInfo->tagSource) {
|
||||||
|
tagRand = true;
|
||||||
|
tagsValBuf = generateTagValuesForStb(stbInfo, tableSeq);
|
||||||
|
} else {
|
||||||
|
tagRand = false;
|
||||||
|
tagsValBuf = getTagValueFromTagSample(
|
||||||
|
stbInfo,
|
||||||
|
tableSeq % stbInfo->tagSampleCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NULL == tagsValBuf) {
|
||||||
|
errorPrint("%s() LN%d, tag buf failed to allocate memory\n",
|
||||||
|
__func__, __LINE__);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *tagsArray = calloc(1, sizeof(TAOS_BIND) * stbInfo->tagCount);
|
||||||
|
if (NULL == tagsArray) {
|
||||||
|
tmfree(tagsValBuf);
|
||||||
|
errorPrint("%s() LN%d, tag buf failed to allocate memory\n",
|
||||||
|
__func__, __LINE__);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-1 == prepareStbStmtBind(
|
||||||
|
tagsArray, stbInfo, tagRand, -1, -1, false /* is tag */)) {
|
||||||
|
free(tagsArray);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = taos_stmt_set_tbname_tags(stmt, tableName, (TAOS_BIND *)tagsArray);
|
||||||
|
|
||||||
|
tmfree(tagsValBuf);
|
||||||
|
tmfree((char *)tagsArray);
|
||||||
|
} else {
|
||||||
|
ret = taos_stmt_set_tbname(stmt, tableName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret != 0) {
|
||||||
|
errorPrint("failed to execute taos_stmt_set_tbname(%s). return 0x%x. reason: %s\n",
|
||||||
|
tableName, ret, taos_errstr(NULL));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *bindArray = calloc(1, sizeof(TAOS_BIND) * (stbInfo->columnCount + 1));
|
||||||
|
if (bindArray == NULL) {
|
||||||
|
errorPrint("%s() LN%d, Failed to allocate %d bind params\n",
|
||||||
|
__func__, __LINE__, (stbInfo->columnCount + 1));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t k;
|
||||||
|
for (k = 0; k < batch;) {
|
||||||
|
/* columnCount + 1 (ts) */
|
||||||
|
if (-1 == prepareStbStmtBind(bindArray, stbInfo, sourceRand,
|
||||||
|
startTime, k, true /* is column */)) {
|
||||||
|
free(bindArray);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
taos_stmt_bind_param(stmt, (TAOS_BIND *)bindArray);
|
taos_stmt_bind_param(stmt, (TAOS_BIND *)bindArray);
|
||||||
// if msg > 3MB, break
|
// if msg > 3MB, break
|
||||||
taos_stmt_add_batch(stmt);
|
taos_stmt_add_batch(stmt);
|
||||||
|
@ -5861,7 +5953,6 @@ static int32_t prepareStbStmt(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(bindBuffer);
|
|
||||||
free(bindArray);
|
free(bindArray);
|
||||||
return k;
|
return k;
|
||||||
}
|
}
|
||||||
|
@ -5869,7 +5960,9 @@ static int32_t prepareStbStmt(
|
||||||
static int32_t prepareStbStmtInterlace(
|
static int32_t prepareStbStmtInterlace(
|
||||||
SSuperTable *stbInfo,
|
SSuperTable *stbInfo,
|
||||||
TAOS_STMT *stmt,
|
TAOS_STMT *stmt,
|
||||||
char *tableName, uint32_t batch,
|
char *tableName,
|
||||||
|
int64_t tableSeq,
|
||||||
|
uint32_t batch,
|
||||||
uint64_t insertRows,
|
uint64_t insertRows,
|
||||||
uint64_t recordFrom,
|
uint64_t recordFrom,
|
||||||
int64_t startTime,
|
int64_t startTime,
|
||||||
|
@ -5879,6 +5972,7 @@ static int32_t prepareStbStmtInterlace(
|
||||||
stbInfo,
|
stbInfo,
|
||||||
stmt,
|
stmt,
|
||||||
tableName,
|
tableName,
|
||||||
|
tableSeq,
|
||||||
batch,
|
batch,
|
||||||
insertRows, 0, startTime,
|
insertRows, 0, startTime,
|
||||||
pSamplePos);
|
pSamplePos);
|
||||||
|
@ -5887,7 +5981,9 @@ static int32_t prepareStbStmtInterlace(
|
||||||
static int32_t prepareStbStmtProgressive(
|
static int32_t prepareStbStmtProgressive(
|
||||||
SSuperTable *stbInfo,
|
SSuperTable *stbInfo,
|
||||||
TAOS_STMT *stmt,
|
TAOS_STMT *stmt,
|
||||||
char *tableName, uint32_t batch,
|
char *tableName,
|
||||||
|
int64_t tableSeq,
|
||||||
|
uint32_t batch,
|
||||||
uint64_t insertRows,
|
uint64_t insertRows,
|
||||||
uint64_t recordFrom,
|
uint64_t recordFrom,
|
||||||
int64_t startTime,
|
int64_t startTime,
|
||||||
|
@ -5897,6 +5993,7 @@ static int32_t prepareStbStmtProgressive(
|
||||||
stbInfo,
|
stbInfo,
|
||||||
stmt,
|
stmt,
|
||||||
tableName,
|
tableName,
|
||||||
|
tableSeq,
|
||||||
g_args.num_of_RPR,
|
g_args.num_of_RPR,
|
||||||
insertRows, recordFrom, startTime,
|
insertRows, recordFrom, startTime,
|
||||||
pSamplePos);
|
pSamplePos);
|
||||||
|
@ -6097,6 +6194,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
|
||||||
superTblInfo,
|
superTblInfo,
|
||||||
pThreadInfo->stmt,
|
pThreadInfo->stmt,
|
||||||
tableName,
|
tableName,
|
||||||
|
tableSeq,
|
||||||
batchPerTbl,
|
batchPerTbl,
|
||||||
insertRows, i,
|
insertRows, i,
|
||||||
startTime,
|
startTime,
|
||||||
|
@ -6326,6 +6424,7 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
|
||||||
superTblInfo,
|
superTblInfo,
|
||||||
pThreadInfo->stmt,
|
pThreadInfo->stmt,
|
||||||
tableName,
|
tableName,
|
||||||
|
tableSeq,
|
||||||
g_args.num_of_RPR,
|
g_args.num_of_RPR,
|
||||||
insertRows, i, start_time,
|
insertRows, i, start_time,
|
||||||
&(pThreadInfo->samplePos));
|
&(pThreadInfo->samplePos));
|
||||||
|
@ -6428,6 +6527,8 @@ static void* syncWrite(void *sarg) {
|
||||||
threadInfo *pThreadInfo = (threadInfo *)sarg;
|
threadInfo *pThreadInfo = (threadInfo *)sarg;
|
||||||
SSuperTable* superTblInfo = pThreadInfo->superTblInfo;
|
SSuperTable* superTblInfo = pThreadInfo->superTblInfo;
|
||||||
|
|
||||||
|
setThreadName("syncWrite");
|
||||||
|
|
||||||
uint32_t interlaceRows;
|
uint32_t interlaceRows;
|
||||||
|
|
||||||
if (superTblInfo) {
|
if (superTblInfo) {
|
||||||
|
@ -6513,6 +6614,8 @@ static void *asyncWrite(void *sarg) {
|
||||||
threadInfo *pThreadInfo = (threadInfo *)sarg;
|
threadInfo *pThreadInfo = (threadInfo *)sarg;
|
||||||
SSuperTable* superTblInfo = pThreadInfo->superTblInfo;
|
SSuperTable* superTblInfo = pThreadInfo->superTblInfo;
|
||||||
|
|
||||||
|
setThreadName("asyncWrite");
|
||||||
|
|
||||||
pThreadInfo->st = 0;
|
pThreadInfo->st = 0;
|
||||||
pThreadInfo->et = 0;
|
pThreadInfo->et = 0;
|
||||||
pThreadInfo->lastTs = pThreadInfo->start_time;
|
pThreadInfo->lastTs = pThreadInfo->start_time;
|
||||||
|
@ -6754,7 +6857,7 @@ static void startMultiThreadInsertData(int threads, char* db_name,
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
char buffer[3000];
|
char buffer[BUFFER_SIZE];
|
||||||
char *pstr = buffer;
|
char *pstr = buffer;
|
||||||
|
|
||||||
if ((superTblInfo)
|
if ((superTblInfo)
|
||||||
|
@ -6913,6 +7016,7 @@ static void *readTable(void *sarg) {
|
||||||
#if 1
|
#if 1
|
||||||
threadInfo *pThreadInfo = (threadInfo *)sarg;
|
threadInfo *pThreadInfo = (threadInfo *)sarg;
|
||||||
TAOS *taos = pThreadInfo->taos;
|
TAOS *taos = pThreadInfo->taos;
|
||||||
|
setThreadName("readTable");
|
||||||
char command[BUFFER_SIZE] = "\0";
|
char command[BUFFER_SIZE] = "\0";
|
||||||
uint64_t sTime = pThreadInfo->start_time;
|
uint64_t sTime = pThreadInfo->start_time;
|
||||||
char *tb_prefix = pThreadInfo->tb_prefix;
|
char *tb_prefix = pThreadInfo->tb_prefix;
|
||||||
|
@ -6985,6 +7089,7 @@ static void *readMetric(void *sarg) {
|
||||||
#if 1
|
#if 1
|
||||||
threadInfo *pThreadInfo = (threadInfo *)sarg;
|
threadInfo *pThreadInfo = (threadInfo *)sarg;
|
||||||
TAOS *taos = pThreadInfo->taos;
|
TAOS *taos = pThreadInfo->taos;
|
||||||
|
setThreadName("readMetric");
|
||||||
char command[BUFFER_SIZE] = "\0";
|
char command[BUFFER_SIZE] = "\0";
|
||||||
FILE *fp = fopen(pThreadInfo->filePath, "a");
|
FILE *fp = fopen(pThreadInfo->filePath, "a");
|
||||||
if (NULL == fp) {
|
if (NULL == fp) {
|
||||||
|
@ -7161,6 +7266,8 @@ static int insertTestProcess() {
|
||||||
static void *specifiedTableQuery(void *sarg) {
|
static void *specifiedTableQuery(void *sarg) {
|
||||||
threadInfo *pThreadInfo = (threadInfo *)sarg;
|
threadInfo *pThreadInfo = (threadInfo *)sarg;
|
||||||
|
|
||||||
|
setThreadName("specTableQuery");
|
||||||
|
|
||||||
if (pThreadInfo->taos == NULL) {
|
if (pThreadInfo->taos == NULL) {
|
||||||
TAOS * taos = NULL;
|
TAOS * taos = NULL;
|
||||||
taos = taos_connect(g_queryInfo.host,
|
taos = taos_connect(g_queryInfo.host,
|
||||||
|
@ -7260,6 +7367,8 @@ static void *superTableQuery(void *sarg) {
|
||||||
char sqlstr[MAX_QUERY_SQL_LENGTH];
|
char sqlstr[MAX_QUERY_SQL_LENGTH];
|
||||||
threadInfo *pThreadInfo = (threadInfo *)sarg;
|
threadInfo *pThreadInfo = (threadInfo *)sarg;
|
||||||
|
|
||||||
|
setThreadName("superTableQuery");
|
||||||
|
|
||||||
if (pThreadInfo->taos == NULL) {
|
if (pThreadInfo->taos == NULL) {
|
||||||
TAOS * taos = NULL;
|
TAOS * taos = NULL;
|
||||||
taos = taos_connect(g_queryInfo.host,
|
taos = taos_connect(g_queryInfo.host,
|
||||||
|
@ -7562,6 +7671,8 @@ static void *superSubscribe(void *sarg) {
|
||||||
TAOS_SUB* tsub[MAX_QUERY_SQL_COUNT] = {0};
|
TAOS_SUB* tsub[MAX_QUERY_SQL_COUNT] = {0};
|
||||||
uint64_t tsubSeq;
|
uint64_t tsubSeq;
|
||||||
|
|
||||||
|
setThreadName("superSub");
|
||||||
|
|
||||||
if (pThreadInfo->ntables > MAX_QUERY_SQL_COUNT) {
|
if (pThreadInfo->ntables > MAX_QUERY_SQL_COUNT) {
|
||||||
errorPrint("The table number(%"PRId64") of the thread is more than max query sql count: %d\n",
|
errorPrint("The table number(%"PRId64") of the thread is more than max query sql count: %d\n",
|
||||||
pThreadInfo->ntables, MAX_QUERY_SQL_COUNT);
|
pThreadInfo->ntables, MAX_QUERY_SQL_COUNT);
|
||||||
|
@ -7708,6 +7819,8 @@ static void *specifiedSubscribe(void *sarg) {
|
||||||
threadInfo *pThreadInfo = (threadInfo *)sarg;
|
threadInfo *pThreadInfo = (threadInfo *)sarg;
|
||||||
// TAOS_SUB* tsub = NULL;
|
// TAOS_SUB* tsub = NULL;
|
||||||
|
|
||||||
|
setThreadName("specSub");
|
||||||
|
|
||||||
if (pThreadInfo->taos == NULL) {
|
if (pThreadInfo->taos == NULL) {
|
||||||
pThreadInfo->taos = taos_connect(g_queryInfo.host,
|
pThreadInfo->taos = taos_connect(g_queryInfo.host,
|
||||||
g_queryInfo.user,
|
g_queryInfo.user,
|
||||||
|
|
Loading…
Reference in New Issue