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

TD-1415

上级 a1ce0a26
...@@ -130,8 +130,15 @@ static int32_t vnodeProcessCreateTableMsg(SVnodeObj *pVnode, void *pCont, SRspRe ...@@ -130,8 +130,15 @@ static int32_t vnodeProcessCreateTableMsg(SVnodeObj *pVnode, void *pCont, SRspRe
int code = TSDB_CODE_SUCCESS; int code = TSDB_CODE_SUCCESS;
STableCfg *pCfg = tsdbCreateTableCfgFromMsg((SMDCreateTableMsg *)pCont); STableCfg *pCfg = tsdbCreateTableCfgFromMsg((SMDCreateTableMsg *)pCont);
if (pCfg == NULL) return terrno; if (pCfg == NULL) {
if (tsdbCreateTable(pVnode->tsdb, pCfg) < 0) code = terrno; ASSERT(terrno != 0);
return terrno;
}
if (tsdbCreateTable(pVnode->tsdb, pCfg) < 0) {
code = terrno;
ASSERT(code != 0);
}
tsdbClearTableCfg(pCfg); tsdbClearTableCfg(pCfg);
return code; return code;
......
...@@ -31,16 +31,16 @@ IF (TD_LINUX) ...@@ -31,16 +31,16 @@ IF (TD_LINUX)
#add_executable(createTablePerformance createTablePerformance.c) #add_executable(createTablePerformance createTablePerformance.c)
#target_link_libraries(createTablePerformance taos_static tutil common pthread) #target_link_libraries(createTablePerformance taos_static tutil common pthread)
#add_executable(createNormalTable createNormalTable.c) add_executable(createNormalTable createNormalTable.c)
#target_link_libraries(createNormalTable taos_static tutil common pthread) target_link_libraries(createNormalTable taos_static tutil common pthread)
#add_executable(queryPerformance queryPerformance.c) #add_executable(queryPerformance queryPerformance.c)
#target_link_libraries(queryPerformance taos_static tutil common pthread) #target_link_libraries(queryPerformance taos_static tutil common pthread)
add_executable(httpTest httpTest.c) #add_executable(httpTest httpTest.c)
target_link_libraries(httpTest taos_static tutil common pthread mnode monitor http tsdb twal vnode cJson lz4) #target_link_libraries(httpTest taos_static tutil common pthread mnode monitor http tsdb twal vnode cJson lz4)
add_executable(cacheTest cacheTest.c) #add_executable(cacheTest cacheTest.c)
target_link_libraries(cacheTest taos_static tutil common pthread mnode monitor http tsdb twal vnode cJson lz4) #target_link_libraries(cacheTest taos_static tutil common pthread mnode monitor http tsdb twal vnode cJson lz4)
ENDIF() ENDIF()
...@@ -50,7 +50,9 @@ void createDbAndSTable(); ...@@ -50,7 +50,9 @@ void createDbAndSTable();
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
shellParseArgument(argc, argv); shellParseArgument(argc, argv);
taos_init(); taos_init();
if (replica != 0) {
createDbAndSTable(); createDbAndSTable();
}
pPrint("%d threads are spawned to create table", numOfThreads); pPrint("%d threads are spawned to create table", numOfThreads);
...@@ -134,6 +136,7 @@ void *threadFunc(void *param) { ...@@ -134,6 +136,7 @@ void *threadFunc(void *param) {
int64_t startMs = taosGetTimestampMs(); int64_t startMs = taosGetTimestampMs();
if (replica != 0) {
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)", stableName, t); sprintf(qstr, "create table %s%d (ts timestamp, i int)", stableName, t);
TAOS_RES *pSql = taos_query(con, qstr); TAOS_RES *pSql = taos_query(con, qstr);
...@@ -143,6 +146,22 @@ void *threadFunc(void *param) { ...@@ -143,6 +146,22 @@ void *threadFunc(void *param) {
} }
taos_free_result(pSql); taos_free_result(pSql);
} }
} else {
for (int32_t t = pInfo->tableBeginIndex; t < pInfo->tableEndIndex; ++t) {
sprintf(qstr, "insert into %s%d values(now, 1)", stableName, t);
TAOS_RES *pSql = taos_query(con, qstr);
code = taos_errno(pSql);
if (code != 0) {
if (code != TSDB_CODE_MND_INVALID_TABLE_NAME) {
pError("failed to create table %s%d, reason:%s", stableName, t, tstrerror(code));
}
if (code == TSDB_CODE_VND_INVALID_VGROUP_ID) {
exit(0);
}
}
taos_free_result(pSql);
}
}
float createTableSpeed = 0; float createTableSpeed = 0;
for (int i = 0; i < numOfThreads; ++i) { for (int i = 0; i < numOfThreads; ++i) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册