提交 65acb7df 编写于 作者: S Shengliang Guan

test for create table

上级 2b6f415a
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
char dbName[32] = "db"; char dbName[32] = "db";
char stbName[64] = "st"; char stbName[64] = "st";
int32_t numOfThreads = 2; int32_t numOfThreads = 2;
int32_t numOfTables = 100; int32_t numOfTables = 10000;
int32_t createTable = 1; int32_t createTable = 1;
int32_t insertData = 0; int32_t insertData = 0;
int32_t batchNum = 1; int32_t batchNum = 1;
...@@ -123,6 +123,15 @@ void createDbAndStb() { ...@@ -123,6 +123,15 @@ void createDbAndStb() {
} }
taos_free_result(pSql); taos_free_result(pSql);
sprintf(qstr, "create table %s (ts timestamp, i int) tags (j int)", stbName);
pSql = taos_query(con, qstr);
code = taos_errno(pSql);
if (code != 0) {
pError("failed to use db, code:%d reason:%s", taos_errno(con), taos_errstr(con));
exit(0);
}
taos_free_result(pSql);
taos_close(con); taos_close(con);
} }
...@@ -144,11 +153,11 @@ void *threadFunc(void *param) { ...@@ -144,11 +153,11 @@ void *threadFunc(void *param) {
if (createTable) { if (createTable) {
int64_t startMs = taosGetTimestampMs(); int64_t startMs = taosGetTimestampMs();
for (int32_t t = pInfo->tableBeginIndex; t < pInfo->tableEndIndex; ++t) { for (int32_t t = pInfo->tableBeginIndex; t < pInfo->tableEndIndex; ++t) {
sprintf(qstr, "create table %s%d (ts timestamp, i int)", stbName, t); sprintf(qstr, "create table t%d using %s tags(%d)", t, stbName, t);
TAOS_RES *pSql = taos_query(con, qstr); TAOS_RES *pSql = taos_query(con, qstr);
code = taos_errno(pSql); code = taos_errno(pSql);
if (code != 0) { if (code != 0) {
pError("failed to create table %s%d, reason:%s", stbName, t, tstrerror(code)); pError("failed to create table t%d, reason:%s", t, tstrerror(code));
} }
taos_free_result(pSql); taos_free_result(pSql);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册