提交 bf7c5baa 编写于 作者: S Shengliang Guan

minor changes

上级 f1c76fcd
...@@ -115,6 +115,8 @@ elif [ $NODE -eq 8 ]; then ...@@ -115,6 +115,8 @@ elif [ $NODE -eq 8 ]; then
NODE=7800 NODE=7800
fi fi
HOSTNAME=localhost
echo " " >> $TAOS_CFG echo " " >> $TAOS_CFG
echo "firstEp ${HOSTNAME}:7100" >> $TAOS_CFG echo "firstEp ${HOSTNAME}:7100" >> $TAOS_CFG
echo "secondEp ${HOSTNAME}:7200" >> $TAOS_CFG echo "secondEp ${HOSTNAME}:7200" >> $TAOS_CFG
......
...@@ -35,8 +35,7 @@ int32_t numOfVgroups = 2; ...@@ -35,8 +35,7 @@ int32_t numOfVgroups = 2;
int32_t showTablesFlag = 0; int32_t showTablesFlag = 0;
int32_t queryFlag = 0; int32_t queryFlag = 0;
int64_t startTimestamp = 1640966400000; // 2020-01-01 00:00:00.000 int64_t startTimestamp = 1640966400000; // 2020-01-01 00:00:00.000
typedef struct { typedef struct {
int64_t tableBeginIndex; int64_t tableBeginIndex;
...@@ -89,7 +88,7 @@ void createDbAndStb() { ...@@ -89,7 +88,7 @@ void createDbAndStb() {
pRes = taos_query(con, qstr); pRes = taos_query(con, qstr);
code = taos_errno(pRes); code = taos_errno(pRes);
if (code != 0) { if (code != 0) {
pError("failed to use db, code:%d reason:%s", taos_errno(pRes), taos_errstr(pRes)); pError("failed to create stable, code:%d reason:%s", taos_errno(pRes), taos_errstr(pRes));
exit(0); exit(0);
} }
taos_free_result(pRes); taos_free_result(pRes);
...@@ -182,18 +181,14 @@ void *threadFunc(void *param) { ...@@ -182,18 +181,14 @@ void *threadFunc(void *param) {
exit(1); exit(1);
} }
pPrint("====before thread:%d, table range: %"PRId64 " - %"PRId64 "\n", pPrint("====before thread:%d, table range: %" PRId64 " - %" PRId64 "\n", pInfo->threadIndex, pInfo->tableBeginIndex,
pInfo->threadIndex, pInfo->tableEndIndex);
pInfo->tableBeginIndex,
pInfo->tableEndIndex);
pInfo->tableBeginIndex += startOffset; pInfo->tableBeginIndex += startOffset;
pInfo->tableEndIndex += startOffset; pInfo->tableEndIndex += startOffset;
pPrint("====after thread:%d, table range: %"PRId64 " - %"PRId64 "\n", pPrint("====after thread:%d, table range: %" PRId64 " - %" PRId64 "\n", pInfo->threadIndex, pInfo->tableBeginIndex,
pInfo->threadIndex, pInfo->tableEndIndex);
pInfo->tableBeginIndex,
pInfo->tableEndIndex);
sprintf(qstr, "use %s", pInfo->dbName); sprintf(qstr, "use %s", pInfo->dbName);
TAOS_RES *pRes = taos_query(con, qstr); TAOS_RES *pRes = taos_query(con, qstr);
...@@ -221,7 +216,7 @@ void *threadFunc(void *param) { ...@@ -221,7 +216,7 @@ void *threadFunc(void *param) {
int64_t startTs = taosGetTimestampUs(); int64_t startTs = taosGetTimestampUs();
TAOS_RES *pRes = taos_query(con, qstr); TAOS_RES *pRes = taos_query(con, qstr);
code = taos_errno(pRes); code = taos_errno(pRes);
if ((code != 0) && (code != TSDB_CODE_RPC_AUTH_REQUIRED)) { if (code != 0) {
pError("failed to create table reason:%s, sql: %s", tstrerror(code), qstr); pError("failed to create table reason:%s, sql: %s", tstrerror(code), qstr);
} }
taos_free_result(pRes); taos_free_result(pRes);
...@@ -251,20 +246,20 @@ void *threadFunc(void *param) { ...@@ -251,20 +246,20 @@ void *threadFunc(void *param) {
// batch = MIN(batch, batchNum); // batch = MIN(batch, batchNum);
int32_t len = sprintf(qstr, "insert into "); int32_t len = sprintf(qstr, "insert into ");
for (int32_t i = 0; i < batchNumOfTbl;) { for (int32_t i = 0; i < batchNumOfTbl;) {
int64_t ts = startTimestamp; int64_t ts = startTimestamp;
len += sprintf(qstr + len, "%s_t%" PRId64 " values ", stbName, t); len += sprintf(qstr + len, "%s_t%" PRId64 " values ", stbName, t);
for (int32_t j = 0; j < batchNumOfRow; j++) { for (int32_t j = 0; j < batchNumOfRow; j++) {
len += sprintf(qstr + len, "(%" PRId64 ", 6666) ", ts++); len += sprintf(qstr + len, "(%" PRId64 ", 6666) ", ts++);
} }
t++; t++;
i++; i++;
if (t > pInfo->tableEndIndex) { if (t > pInfo->tableEndIndex) {
break; break;
} }
} }
int64_t startTs = taosGetTimestampUs(); int64_t startTs = taosGetTimestampUs();
TAOS_RES *pRes = taos_query(con, qstr); TAOS_RES *pRes = taos_query(con, qstr);
...@@ -360,7 +355,7 @@ void parseArgument(int32_t argc, char *argv[]) { ...@@ -360,7 +355,7 @@ void parseArgument(int32_t argc, char *argv[]) {
} else if (strcmp(argv[i], "-q") == 0) { } else if (strcmp(argv[i], "-q") == 0) {
queryFlag = atoi(argv[++i]); queryFlag = atoi(argv[++i]);
} else { } else {
pPrint("%s unknow para: %s %s", GREEN, argv[++i], NC); pPrint("%s unknow para: %s %s", GREEN, argv[++i], NC);
} }
} }
...@@ -390,15 +385,16 @@ int32_t main(int32_t argc, char *argv[]) { ...@@ -390,15 +385,16 @@ int32_t main(int32_t argc, char *argv[]) {
} }
if (queryFlag) { if (queryFlag) {
//selectRowsFromTable(); // selectRowsFromTable();
return 0; return 0;
} }
if (createTable) { if (createTable) {
createDbAndStb(); createDbAndStb();
} }
pPrint("%d threads are spawned to create %" PRId64 " tables, offset is %" PRId64 " ", numOfThreads, numOfTables, startOffset); pPrint("%d threads are spawned to create %" PRId64 " tables, offset is %" PRId64 " ", numOfThreads, numOfTables,
startOffset);
pthread_attr_t thattr; pthread_attr_t thattr;
pthread_attr_init(&thattr); pthread_attr_init(&thattr);
...@@ -456,8 +452,8 @@ int32_t main(int32_t argc, char *argv[]) { ...@@ -456,8 +452,8 @@ int32_t main(int32_t argc, char *argv[]) {
if (createTable) { if (createTable) {
pPrint("%s total %" PRId64 " tables, %.1f tables/second, threads:%d, maxDelay: %" PRId64 "us, minDelay: %" PRId64 pPrint("%s total %" PRId64 " tables, %.1f tables/second, threads:%d, maxDelay: %" PRId64 "us, minDelay: %" PRId64
"us %s", "us %s",
GREEN, numOfTables, createTableSpeed, numOfThreads, maxDelay, minDelay, NC); GREEN, numOfTables, createTableSpeed, numOfThreads, maxDelay, minDelay, NC);
} }
if (insertData) { if (insertData) {
......
...@@ -42,7 +42,8 @@ char *simParseArbitratorName(char *varName) { ...@@ -42,7 +42,8 @@ char *simParseArbitratorName(char *varName) {
char *simParseHostName(char *varName) { char *simParseHostName(char *varName) {
static char hostName[140]; static char hostName[140];
sprintf(hostName, "%s", simHostName); //sprintf(hostName, "%s", simHostName);
sprintf(hostName, "%s", "localhost");
return hostName; return hostName;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册