提交 f6315af0 编写于 作者: H Haojun Liao

other: merge main.

...@@ -104,6 +104,7 @@ extern int32_t tsCacheLazyLoadThreshold; // cost threshold for last/last_row lo ...@@ -104,6 +104,7 @@ extern int32_t tsCacheLazyLoadThreshold; // cost threshold for last/last_row lo
// query client // query client
extern int32_t tsQueryPolicy; extern int32_t tsQueryPolicy;
extern int32_t tsQueryRspPolicy; extern int32_t tsQueryRspPolicy;
extern int64_t tsQueryMaxConcurrentTables;
extern int32_t tsQuerySmaOptimize; extern int32_t tsQuerySmaOptimize;
extern int32_t tsQueryRsmaTolerance; extern int32_t tsQueryRsmaTolerance;
extern bool tsQueryPlannerTrace; extern bool tsQueryPlannerTrace;
......
...@@ -181,12 +181,8 @@ typedef enum _mgmt_table { ...@@ -181,12 +181,8 @@ typedef enum _mgmt_table {
#define TSDB_ALTER_USER_REMOVE_READ_TABLE 0xE #define TSDB_ALTER_USER_REMOVE_READ_TABLE 0xE
#define TSDB_ALTER_USER_ADD_WRITE_TABLE 0xF #define TSDB_ALTER_USER_ADD_WRITE_TABLE 0xF
#define TSDB_ALTER_USER_REMOVE_WRITE_TABLE 0x10 #define TSDB_ALTER_USER_REMOVE_WRITE_TABLE 0x10
#define TSDB_ALTER_USER_ADD_READ_TAG 0x11 #define TSDB_ALTER_USER_ADD_ALL_TABLE 0x11
#define TSDB_ALTER_USER_REMOVE_READ_TAG 0x12 #define TSDB_ALTER_USER_REMOVE_ALL_TABLE 0x12
#define TSDB_ALTER_USER_ADD_WRITE_TAG 0x13
#define TSDB_ALTER_USER_REMOVE_WRITE_TAG 0x14
#define TSDB_ALTER_USER_ADD_ALL_TABLE 0x15
#define TSDB_ALTER_USER_REMOVE_ALL_TABLE 0x16
#define TSDB_ALTER_USER_PRIVILEGES 0x2 #define TSDB_ALTER_USER_PRIVILEGES 0x2
...@@ -713,6 +709,7 @@ typedef struct { ...@@ -713,6 +709,7 @@ typedef struct {
SHashObj* writeDbs; SHashObj* writeDbs;
SHashObj* readTbs; SHashObj* readTbs;
SHashObj* writeTbs; SHashObj* writeTbs;
SHashObj* useDbs;
} SGetUserAuthRsp; } SGetUserAuthRsp;
int32_t tSerializeSGetUserAuthRsp(void* buf, int32_t bufLen, SGetUserAuthRsp* pRsp); int32_t tSerializeSGetUserAuthRsp(void* buf, int32_t bufLen, SGetUserAuthRsp* pRsp);
......
...@@ -599,12 +599,14 @@ function install_data() { ...@@ -599,12 +599,14 @@ function install_data() {
} }
function install_connector() { function install_connector() {
[ -d "${script_dir}/connector/" ] && ${csudo}cp -rf ${script_dir}/connector/ ${install_main_dir}/ if [ -d "${script_dir}/connector/" ]; then
${csudo}cp -rf ${script_dir}/connector/ ${install_main_dir}/ || echo "failed to copy connector"
fi
} }
function install_examples() { function install_examples() {
if [ -d ${script_dir}/examples ]; then if [ -d ${script_dir}/examples ]; then
${csudo}cp -rf ${script_dir}/examples/* ${install_main_dir}/examples ${csudo}cp -rf ${script_dir}/examples/* ${install_main_dir}/examples || echo "failed to copy examples"
fi fi
} }
......
...@@ -144,6 +144,15 @@ extern char *gStmtStatusStr[]; ...@@ -144,6 +144,15 @@ extern char *gStmtStatusStr[];
goto _return; \ goto _return; \
} \ } \
} while (0) } while (0)
#define STMT_ERRI_JRET(c) \
do { \
code = c; \
if (code != TSDB_CODE_SUCCESS) { \
terrno = code; \
goto _return; \
} \
} while (0)
#define STMT_ELOG(param, ...) qError("stmt:%p " param, pStmt, __VA_ARGS__) #define STMT_ELOG(param, ...) qError("stmt:%p " param, pStmt, __VA_ARGS__)
#define STMT_DLOG(param, ...) qDebug("stmt:%p " param, pStmt, __VA_ARGS__) #define STMT_DLOG(param, ...) qDebug("stmt:%p " param, pStmt, __VA_ARGS__)
......
...@@ -699,7 +699,7 @@ static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SArray *pColumns, ...@@ -699,7 +699,7 @@ static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SArray *pColumns,
pReq.numOfTags = 1; pReq.numOfTags = 1;
SField field = {0}; SField field = {0};
field.type = TSDB_DATA_TYPE_NCHAR; field.type = TSDB_DATA_TYPE_NCHAR;
field.bytes = 1; field.bytes = TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE;
strcpy(field.name, tsSmlTagName); strcpy(field.name, tsSmlTagName);
taosArrayPush(pReq.pTags, &field); taosArrayPush(pReq.pTags, &field);
} }
......
...@@ -975,15 +975,17 @@ int stmtIsInsert(TAOS_STMT* stmt, int* insert) { ...@@ -975,15 +975,17 @@ int stmtIsInsert(TAOS_STMT* stmt, int* insert) {
} }
int stmtGetTagFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) { int stmtGetTagFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) {
int32_t code = 0;
STscStmt* pStmt = (STscStmt*)stmt; STscStmt* pStmt = (STscStmt*)stmt;
int32_t preCode = pStmt->errCode;
STMT_DLOG_E("start to get tag fields"); STMT_DLOG_E("start to get tag fields");
if (STMT_TYPE_QUERY == pStmt->sql.type) { if (STMT_TYPE_QUERY == pStmt->sql.type) {
STMT_RET(TSDB_CODE_TSC_STMT_API_ERROR); STMT_ERRI_JRET(TSDB_CODE_TSC_STMT_API_ERROR);
} }
STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_FETCH_FIELDS)); STMT_ERRI_JRET(stmtSwitchStatus(pStmt, STMT_FETCH_FIELDS));
if (pStmt->bInfo.needParse && pStmt->sql.runTimes && pStmt->sql.type > 0 && if (pStmt->bInfo.needParse && pStmt->sql.runTimes && pStmt->sql.type > 0 &&
STMT_TYPE_MULTI_INSERT != pStmt->sql.type) { STMT_TYPE_MULTI_INSERT != pStmt->sql.type) {
...@@ -995,27 +997,33 @@ int stmtGetTagFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) { ...@@ -995,27 +997,33 @@ int stmtGetTagFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) {
pStmt->exec.pRequest = NULL; pStmt->exec.pRequest = NULL;
} }
STMT_ERR_RET(stmtCreateRequest(pStmt)); STMT_ERRI_JRET(stmtCreateRequest(pStmt));
if (pStmt->bInfo.needParse) { if (pStmt->bInfo.needParse) {
STMT_ERR_RET(stmtParseSql(pStmt)); STMT_ERRI_JRET(stmtParseSql(pStmt));
} }
STMT_ERR_RET(stmtFetchTagFields(stmt, nums, fields)); STMT_ERRI_JRET(stmtFetchTagFields(stmt, nums, fields));
return TSDB_CODE_SUCCESS; _return:
pStmt->errCode = preCode;
return code;
} }
int stmtGetColFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) { int stmtGetColFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) {
int32_t code = 0;
STscStmt* pStmt = (STscStmt*)stmt; STscStmt* pStmt = (STscStmt*)stmt;
int32_t preCode = pStmt->errCode;
STMT_DLOG_E("start to get col fields"); STMT_DLOG_E("start to get col fields");
if (STMT_TYPE_QUERY == pStmt->sql.type) { if (STMT_TYPE_QUERY == pStmt->sql.type) {
STMT_RET(TSDB_CODE_TSC_STMT_API_ERROR); STMT_ERRI_JRET(TSDB_CODE_TSC_STMT_API_ERROR);
} }
STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_FETCH_FIELDS)); STMT_ERRI_JRET(stmtSwitchStatus(pStmt, STMT_FETCH_FIELDS));
if (pStmt->bInfo.needParse && pStmt->sql.runTimes && pStmt->sql.type > 0 && if (pStmt->bInfo.needParse && pStmt->sql.runTimes && pStmt->sql.type > 0 &&
STMT_TYPE_MULTI_INSERT != pStmt->sql.type) { STMT_TYPE_MULTI_INSERT != pStmt->sql.type) {
...@@ -1027,15 +1035,19 @@ int stmtGetColFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) { ...@@ -1027,15 +1035,19 @@ int stmtGetColFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) {
pStmt->exec.pRequest = NULL; pStmt->exec.pRequest = NULL;
} }
STMT_ERR_RET(stmtCreateRequest(pStmt)); STMT_ERRI_JRET(stmtCreateRequest(pStmt));
if (pStmt->bInfo.needParse) { if (pStmt->bInfo.needParse) {
STMT_ERR_RET(stmtParseSql(pStmt)); STMT_ERRI_JRET(stmtParseSql(pStmt));
} }
STMT_ERR_RET(stmtFetchColFields(stmt, nums, fields)); STMT_ERRI_JRET(stmtFetchColFields(stmt, nums, fields));
return TSDB_CODE_SUCCESS; _return:
pStmt->errCode = preCode;
return code;
} }
int stmtGetParamNum(TAOS_STMT* stmt, int* nums) { int stmtGetParamNum(TAOS_STMT* stmt, int* nums) {
......
...@@ -103,6 +103,7 @@ char tsSmlChildTableName[TSDB_TABLE_NAME_LEN] = ""; // user defined child table ...@@ -103,6 +103,7 @@ char tsSmlChildTableName[TSDB_TABLE_NAME_LEN] = ""; // user defined child table
// query // query
int32_t tsQueryPolicy = 1; int32_t tsQueryPolicy = 1;
int32_t tsQueryRspPolicy = 0; int32_t tsQueryRspPolicy = 0;
int64_t tsQueryMaxConcurrentTables = 200; // unit is TSDB_TABLE_NUM_UNIT
bool tsEnableQueryHb = false; bool tsEnableQueryHb = false;
int32_t tsQuerySmaOptimize = 0; int32_t tsQuerySmaOptimize = 0;
int32_t tsQueryRsmaTolerance = 1000; // the tolerance time (ms) to judge from which level to query rsma data. int32_t tsQueryRsmaTolerance = 1000; // the tolerance time (ms) to judge from which level to query rsma data.
...@@ -340,6 +341,7 @@ static int32_t taosAddClientCfg(SConfig *pCfg) { ...@@ -340,6 +341,7 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
if (cfgAddInt32(pCfg, "maxRetryWaitTime", tsMaxRetryWaitTime, 0, 86400000, 0) != 0) return -1; if (cfgAddInt32(pCfg, "maxRetryWaitTime", tsMaxRetryWaitTime, 0, 86400000, 0) != 0) return -1;
if (cfgAddBool(pCfg, "useAdapter", tsUseAdapter, true) != 0) return -1; if (cfgAddBool(pCfg, "useAdapter", tsUseAdapter, true) != 0) return -1;
if (cfgAddBool(pCfg, "crashReporting", tsEnableCrashReport, true) != 0) return -1; if (cfgAddBool(pCfg, "crashReporting", tsEnableCrashReport, true) != 0) return -1;
if (cfgAddInt64(pCfg, "queryMaxConcurrentTables", tsQueryMaxConcurrentTables, INT64_MIN, INT64_MAX, 1) != 0) return -1;
tsNumOfRpcThreads = tsNumOfCores / 2; tsNumOfRpcThreads = tsNumOfCores / 2;
tsNumOfRpcThreads = TRANGE(tsNumOfRpcThreads, 2, TSDB_MAX_RPC_THREADS); tsNumOfRpcThreads = TRANGE(tsNumOfRpcThreads, 2, TSDB_MAX_RPC_THREADS);
...@@ -735,6 +737,7 @@ static int32_t taosSetClientCfg(SConfig *pCfg) { ...@@ -735,6 +737,7 @@ static int32_t taosSetClientCfg(SConfig *pCfg) {
tsKeepColumnName = cfgGetItem(pCfg, "keepColumnName")->bval; tsKeepColumnName = cfgGetItem(pCfg, "keepColumnName")->bval;
tsUseAdapter = cfgGetItem(pCfg, "useAdapter")->bval; tsUseAdapter = cfgGetItem(pCfg, "useAdapter")->bval;
tsEnableCrashReport = cfgGetItem(pCfg, "crashReporting")->bval; tsEnableCrashReport = cfgGetItem(pCfg, "crashReporting")->bval;
tsQueryMaxConcurrentTables = cfgGetItem(pCfg, "queryMaxConcurrentTables")->i64;
tsMaxRetryWaitTime = cfgGetItem(pCfg, "maxRetryWaitTime")->i32; tsMaxRetryWaitTime = cfgGetItem(pCfg, "maxRetryWaitTime")->i32;
......
...@@ -1445,14 +1445,10 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp) ...@@ -1445,14 +1445,10 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp)
int32_t numOfCreatedDbs = taosHashGetSize(pRsp->createdDbs); int32_t numOfCreatedDbs = taosHashGetSize(pRsp->createdDbs);
int32_t numOfReadDbs = taosHashGetSize(pRsp->readDbs); int32_t numOfReadDbs = taosHashGetSize(pRsp->readDbs);
int32_t numOfWriteDbs = taosHashGetSize(pRsp->writeDbs); int32_t numOfWriteDbs = taosHashGetSize(pRsp->writeDbs);
int32_t numOfReadTbs = taosHashGetSize(pRsp->readTbs);
int32_t numOfWriteTbs = taosHashGetSize(pRsp->writeTbs);
if (tEncodeI32(pEncoder, numOfCreatedDbs) < 0) return -1; if (tEncodeI32(pEncoder, numOfCreatedDbs) < 0) return -1;
if (tEncodeI32(pEncoder, numOfReadDbs) < 0) return -1; if (tEncodeI32(pEncoder, numOfReadDbs) < 0) return -1;
if (tEncodeI32(pEncoder, numOfWriteDbs) < 0) return -1; if (tEncodeI32(pEncoder, numOfWriteDbs) < 0) return -1;
if (tEncodeI32(pEncoder, numOfReadTbs) < 0) return -1;
if (tEncodeI32(pEncoder, numOfWriteTbs) < 0) return -1;
char *db = taosHashIterate(pRsp->createdDbs, NULL); char *db = taosHashIterate(pRsp->createdDbs, NULL);
while (db != NULL) { while (db != NULL) {
...@@ -1472,6 +1468,13 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp) ...@@ -1472,6 +1468,13 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp)
db = taosHashIterate(pRsp->writeDbs, db); db = taosHashIterate(pRsp->writeDbs, db);
} }
int32_t numOfReadTbs = taosHashGetSize(pRsp->readTbs);
int32_t numOfWriteTbs = taosHashGetSize(pRsp->writeTbs);
int32_t numOfUseTbs = taosHashGetSize(pRsp->useDbs);
if (tEncodeI32(pEncoder, numOfReadTbs) < 0) return -1;
if (tEncodeI32(pEncoder, numOfWriteTbs) < 0) return -1;
if (tEncodeI32(pEncoder, numOfUseTbs) < 0) return -1;
char *tb = taosHashIterate(pRsp->readTbs, NULL); char *tb = taosHashIterate(pRsp->readTbs, NULL);
while (tb != NULL) { while (tb != NULL) {
size_t keyLen = 0; size_t keyLen = 0;
...@@ -1502,6 +1505,17 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp) ...@@ -1502,6 +1505,17 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp)
tb = taosHashIterate(pRsp->writeTbs, tb); tb = taosHashIterate(pRsp->writeTbs, tb);
} }
int32_t *useDb = taosHashIterate(pRsp->useDbs, NULL);
while (useDb != NULL) {
size_t keyLen = 0;
void *key = taosHashGetKey(useDb, &keyLen);
if (tEncodeI32(pEncoder, keyLen) < 0) return -1;
if (tEncodeCStr(pEncoder, key) < 0) return -1;
if (tEncodeI32(pEncoder, *useDb) < 0) return -1;
useDb = taosHashIterate(pRsp->useDbs, useDb);
}
return 0; return 0;
} }
...@@ -1526,7 +1540,9 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs ...@@ -1526,7 +1540,9 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs
pRsp->writeDbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); pRsp->writeDbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
pRsp->readTbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); pRsp->readTbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
pRsp->writeTbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); pRsp->writeTbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
if (pRsp->readDbs == NULL || pRsp->writeDbs == NULL) { pRsp->useDbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
if (pRsp->createdDbs == NULL || pRsp->readDbs == NULL || pRsp->writeDbs == NULL || pRsp->readTbs == NULL ||
pRsp->writeTbs == NULL || pRsp->useDbs == NULL) {
return -1; return -1;
} }
...@@ -1540,13 +1556,9 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs ...@@ -1540,13 +1556,9 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs
int32_t numOfCreatedDbs = 0; int32_t numOfCreatedDbs = 0;
int32_t numOfReadDbs = 0; int32_t numOfReadDbs = 0;
int32_t numOfWriteDbs = 0; int32_t numOfWriteDbs = 0;
int32_t numOfReadTbs = 0;
int32_t numOfWriteTbs = 0;
if (tDecodeI32(pDecoder, &numOfCreatedDbs) < 0) return -1; if (tDecodeI32(pDecoder, &numOfCreatedDbs) < 0) return -1;
if (tDecodeI32(pDecoder, &numOfReadDbs) < 0) return -1; if (tDecodeI32(pDecoder, &numOfReadDbs) < 0) return -1;
if (tDecodeI32(pDecoder, &numOfWriteDbs) < 0) return -1; if (tDecodeI32(pDecoder, &numOfWriteDbs) < 0) return -1;
if (tDecodeI32(pDecoder, &numOfReadTbs) < 0) return -1;
if (tDecodeI32(pDecoder, &numOfWriteTbs) < 0) return -1;
for (int32_t i = 0; i < numOfCreatedDbs; ++i) { for (int32_t i = 0; i < numOfCreatedDbs; ++i) {
char db[TSDB_DB_FNAME_LEN] = {0}; char db[TSDB_DB_FNAME_LEN] = {0};
...@@ -1569,6 +1581,14 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs ...@@ -1569,6 +1581,14 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs
taosHashPut(pRsp->writeDbs, db, len, db, len); taosHashPut(pRsp->writeDbs, db, len, db, len);
} }
if (!tDecodeIsEnd(pDecoder)) {
int32_t numOfReadTbs = 0;
int32_t numOfWriteTbs = 0;
int32_t numOfUseDbs = 0;
if (tDecodeI32(pDecoder, &numOfReadTbs) < 0) return -1;
if (tDecodeI32(pDecoder, &numOfWriteTbs) < 0) return -1;
if (tDecodeI32(pDecoder, &numOfUseDbs) < 0) return -1;
for (int32_t i = 0; i < numOfReadTbs; ++i) { for (int32_t i = 0; i < numOfReadTbs; ++i) {
int32_t keyLen = 0; int32_t keyLen = 0;
if (tDecodeI32(pDecoder, &keyLen) < 0) return -1; if (tDecodeI32(pDecoder, &keyLen) < 0) return -1;
...@@ -1581,7 +1601,7 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs ...@@ -1581,7 +1601,7 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs
char *value = taosMemoryCalloc(valuelen + 1, sizeof(char)); char *value = taosMemoryCalloc(valuelen + 1, sizeof(char));
if (tDecodeCStrTo(pDecoder, value) < 0) return -1; if (tDecodeCStrTo(pDecoder, value) < 0) return -1;
taosHashPut(pRsp->readTbs, key, strlen(key), value, valuelen); taosHashPut(pRsp->readTbs, key, strlen(key), value, valuelen + 1);
taosMemoryFree(key); taosMemoryFree(key);
taosMemoryFree(value); taosMemoryFree(value);
...@@ -1599,12 +1619,25 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs ...@@ -1599,12 +1619,25 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs
char *value = taosMemoryCalloc(valuelen + 1, sizeof(char)); char *value = taosMemoryCalloc(valuelen + 1, sizeof(char));
if (tDecodeCStrTo(pDecoder, value) < 0) return -1; if (tDecodeCStrTo(pDecoder, value) < 0) return -1;
taosHashPut(pRsp->writeTbs, key, strlen(key), value, valuelen); taosHashPut(pRsp->writeTbs, key, strlen(key), value, valuelen + 1);
taosMemoryFree(key); taosMemoryFree(key);
taosMemoryFree(value); taosMemoryFree(value);
} }
for (int32_t i = 0; i < numOfUseDbs; ++i) {
int32_t keyLen = 0;
if (tDecodeI32(pDecoder, &keyLen) < 0) return -1;
char *key = taosMemoryCalloc(keyLen + 1, sizeof(char));
if (tDecodeCStrTo(pDecoder, key) < 0) return -1;
int32_t ref = 0;
if (tDecodeI32(pDecoder, &ref) < 0) return -1;
taosHashPut(pRsp->useDbs, key, strlen(key), &ref, sizeof(ref));
}
}
return 0; return 0;
} }
...@@ -1628,6 +1661,7 @@ void tFreeSGetUserAuthRsp(SGetUserAuthRsp *pRsp) { ...@@ -1628,6 +1661,7 @@ void tFreeSGetUserAuthRsp(SGetUserAuthRsp *pRsp) {
taosHashCleanup(pRsp->writeDbs); taosHashCleanup(pRsp->writeDbs);
taosHashCleanup(pRsp->writeTbs); taosHashCleanup(pRsp->writeTbs);
taosHashCleanup(pRsp->readTbs); taosHashCleanup(pRsp->readTbs);
taosHashCleanup(pRsp->useDbs);
} }
int32_t tSerializeSCreateDropMQSNodeReq(void *buf, int32_t bufLen, SMCreateQnodeReq *pReq) { int32_t tSerializeSCreateDropMQSNodeReq(void *buf, int32_t bufLen, SMCreateQnodeReq *pReq) {
......
...@@ -114,11 +114,11 @@ static void vmProcessFetchQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO ...@@ -114,11 +114,11 @@ static void vmProcessFetchQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
int32_t code = vnodeProcessFetchMsg(pVnode->pImpl, pMsg, pInfo); int32_t code = vnodeProcessFetchMsg(pVnode->pImpl, pMsg, pInfo);
if (code != 0) { if (code != 0) {
if (terrno != 0) code = terrno; if (terrno != 0) code = terrno;
dGError("vgId:%d, msg:%p failed to fetch since %s", pVnode->vgId, pMsg, terrstr(code)); dGError("vnodeProcessFetchMsg vgId:%d, msg:%p failed to fetch since %s", pVnode->vgId, pMsg, terrstr());
vmSendRsp(pMsg, code); vmSendRsp(pMsg, code);
} }
dGTrace("vgId:%d, msg:%p is freed, code:0x%x", pVnode->vgId, pMsg, code); dGTrace("vnodeProcessFetchMsg vgId:%d, msg:%p is freed, code:0x%x", pVnode->vgId, pMsg, code);
rpcFreeCont(pMsg->pCont); rpcFreeCont(pMsg->pCont);
taosFreeQitem(pMsg); taosFreeQitem(pMsg);
} }
......
...@@ -282,6 +282,7 @@ typedef struct { ...@@ -282,6 +282,7 @@ typedef struct {
SHashObj* topics; SHashObj* topics;
SHashObj* readTbs; SHashObj* readTbs;
SHashObj* writeTbs; SHashObj* writeTbs;
SHashObj* useDbs;
SRWLatch lock; SRWLatch lock;
} SUserObj; } SUserObj;
......
...@@ -128,8 +128,9 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) { ...@@ -128,8 +128,9 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) {
int32_t numOfReadStbs = taosHashGetSize(pUser->readTbs); int32_t numOfReadStbs = taosHashGetSize(pUser->readTbs);
int32_t numOfWriteStbs = taosHashGetSize(pUser->writeTbs); int32_t numOfWriteStbs = taosHashGetSize(pUser->writeTbs);
int32_t numOfTopics = taosHashGetSize(pUser->topics); int32_t numOfTopics = taosHashGetSize(pUser->topics);
int32_t size = sizeof(SUserObj) + USER_RESERVE_SIZE + (numOfReadDbs + numOfWriteDbs) * TSDB_DB_FNAME_LEN + int32_t numOfUseDbs = taosHashGetSize(pUser->useDbs);
numOfTopics * TSDB_TOPIC_FNAME_LEN; int32_t size = sizeof(SUserObj) + USER_RESERVE_SIZE +
(numOfReadDbs + numOfWriteDbs + numOfUseDbs) * TSDB_DB_FNAME_LEN + numOfTopics * TSDB_TOPIC_FNAME_LEN;
char *stb = taosHashIterate(pUser->readTbs, NULL); char *stb = taosHashIterate(pUser->readTbs, NULL);
while (stb != NULL) { while (stb != NULL) {
...@@ -155,7 +156,7 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) { ...@@ -155,7 +156,7 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) {
size_t valueLen = 0; size_t valueLen = 0;
valueLen = strlen(stb); valueLen = strlen(stb);
size += sizeof(int32_t); size += sizeof(int32_t);
size += keyLen; size += valueLen;
stb = taosHashIterate(pUser->writeTbs, stb); stb = taosHashIterate(pUser->writeTbs, stb);
} }
...@@ -176,8 +177,6 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) { ...@@ -176,8 +177,6 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) {
SDB_SET_INT32(pRaw, dataPos, numOfReadDbs, _OVER) SDB_SET_INT32(pRaw, dataPos, numOfReadDbs, _OVER)
SDB_SET_INT32(pRaw, dataPos, numOfWriteDbs, _OVER) SDB_SET_INT32(pRaw, dataPos, numOfWriteDbs, _OVER)
SDB_SET_INT32(pRaw, dataPos, numOfTopics, _OVER) SDB_SET_INT32(pRaw, dataPos, numOfTopics, _OVER)
SDB_SET_INT32(pRaw, dataPos, numOfReadStbs, _OVER)
SDB_SET_INT32(pRaw, dataPos, numOfWriteStbs, _OVER)
char *db = taosHashIterate(pUser->readDbs, NULL); char *db = taosHashIterate(pUser->readDbs, NULL);
while (db != NULL) { while (db != NULL) {
...@@ -197,6 +196,10 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) { ...@@ -197,6 +196,10 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) {
topic = taosHashIterate(pUser->topics, topic); topic = taosHashIterate(pUser->topics, topic);
} }
SDB_SET_INT32(pRaw, dataPos, numOfReadStbs, _OVER)
SDB_SET_INT32(pRaw, dataPos, numOfWriteStbs, _OVER)
SDB_SET_INT32(pRaw, dataPos, numOfUseDbs, _OVER)
stb = taosHashIterate(pUser->readTbs, NULL); stb = taosHashIterate(pUser->readTbs, NULL);
while (stb != NULL) { while (stb != NULL) {
size_t keyLen = 0; size_t keyLen = 0;
...@@ -225,6 +228,17 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) { ...@@ -225,6 +228,17 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) {
stb = taosHashIterate(pUser->writeTbs, stb); stb = taosHashIterate(pUser->writeTbs, stb);
} }
int32_t *useDb = taosHashIterate(pUser->useDbs, NULL);
while (useDb != NULL) {
size_t keyLen = 0;
void *key = taosHashGetKey(useDb, &keyLen);
SDB_SET_INT32(pRaw, dataPos, keyLen, _OVER)
SDB_SET_BINARY(pRaw, dataPos, key, keyLen, _OVER);
SDB_SET_INT32(pRaw, dataPos, *useDb, _OVER)
useDb = taosHashIterate(pUser->writeTbs, useDb);
}
SDB_SET_RESERVE(pRaw, dataPos, USER_RESERVE_SIZE, _OVER) SDB_SET_RESERVE(pRaw, dataPos, USER_RESERVE_SIZE, _OVER)
SDB_SET_DATALEN(pRaw, dataPos, _OVER) SDB_SET_DATALEN(pRaw, dataPos, _OVER)
...@@ -275,26 +289,16 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { ...@@ -275,26 +289,16 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
int32_t numOfReadDbs = 0; int32_t numOfReadDbs = 0;
int32_t numOfWriteDbs = 0; int32_t numOfWriteDbs = 0;
int32_t numOfTopics = 0; int32_t numOfTopics = 0;
int32_t numOfReadStbs = 0;
int32_t numOfWriteStbs = 0;
SDB_GET_INT32(pRaw, dataPos, &numOfReadDbs, _OVER) SDB_GET_INT32(pRaw, dataPos, &numOfReadDbs, _OVER)
SDB_GET_INT32(pRaw, dataPos, &numOfWriteDbs, _OVER) SDB_GET_INT32(pRaw, dataPos, &numOfWriteDbs, _OVER)
if (sver >= 2) { if (sver >= 2) {
SDB_GET_INT32(pRaw, dataPos, &numOfTopics, _OVER) SDB_GET_INT32(pRaw, dataPos, &numOfTopics, _OVER)
} }
if (sver >= 3) {
SDB_GET_INT32(pRaw, dataPos, &numOfReadStbs, _OVER)
SDB_GET_INT32(pRaw, dataPos, &numOfWriteStbs, _OVER)
}
pUser->readDbs = taosHashInit(numOfReadDbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); pUser->readDbs = taosHashInit(numOfReadDbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
pUser->writeDbs = pUser->writeDbs =
taosHashInit(numOfWriteDbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); taosHashInit(numOfWriteDbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
pUser->topics = taosHashInit(numOfTopics, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); pUser->topics = taosHashInit(numOfTopics, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
pUser->readTbs =
taosHashInit(numOfReadStbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
pUser->writeTbs =
taosHashInit(numOfWriteStbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
if (pUser->readDbs == NULL || pUser->writeDbs == NULL || pUser->topics == NULL) goto _OVER; if (pUser->readDbs == NULL || pUser->writeDbs == NULL || pUser->topics == NULL) goto _OVER;
for (int32_t i = 0; i < numOfReadDbs; ++i) { for (int32_t i = 0; i < numOfReadDbs; ++i) {
...@@ -321,6 +325,19 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { ...@@ -321,6 +325,19 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
} }
if (sver >= 3) { if (sver >= 3) {
int32_t numOfReadStbs = 0;
int32_t numOfWriteStbs = 0;
int32_t numOfUseDbs = 0;
SDB_GET_INT32(pRaw, dataPos, &numOfReadStbs, _OVER)
SDB_GET_INT32(pRaw, dataPos, &numOfWriteStbs, _OVER)
SDB_GET_INT32(pRaw, dataPos, &numOfUseDbs, _OVER)
pUser->readTbs =
taosHashInit(numOfReadStbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
pUser->writeTbs =
taosHashInit(numOfWriteStbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
pUser->useDbs = taosHashInit(numOfUseDbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
for (int32_t i = 0; i < numOfReadStbs; ++i) { for (int32_t i = 0; i < numOfReadStbs; ++i) {
int32_t keyLen = 0; int32_t keyLen = 0;
SDB_GET_INT32(pRaw, dataPos, &keyLen, _OVER); SDB_GET_INT32(pRaw, dataPos, &keyLen, _OVER);
...@@ -332,7 +349,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { ...@@ -332,7 +349,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
int32_t valuelen = 0; int32_t valuelen = 0;
SDB_GET_INT32(pRaw, dataPos, &valuelen, _OVER); SDB_GET_INT32(pRaw, dataPos, &valuelen, _OVER);
char *value = taosMemoryCalloc(valuelen, sizeof(char)); char *value = taosMemoryCalloc(valuelen, sizeof(char));
memset(value, 0, keyLen); memset(value, 0, valuelen);
SDB_GET_BINARY(pRaw, dataPos, value, valuelen, _OVER) SDB_GET_BINARY(pRaw, dataPos, value, valuelen, _OVER)
taosHashPut(pUser->readTbs, key, keyLen, value, valuelen); taosHashPut(pUser->readTbs, key, keyLen, value, valuelen);
...@@ -352,7 +369,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { ...@@ -352,7 +369,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
int32_t valuelen = 0; int32_t valuelen = 0;
SDB_GET_INT32(pRaw, dataPos, &valuelen, _OVER); SDB_GET_INT32(pRaw, dataPos, &valuelen, _OVER);
char *value = taosMemoryCalloc(valuelen, sizeof(char)); char *value = taosMemoryCalloc(valuelen, sizeof(char));
memset(value, 0, keyLen); memset(value, 0, valuelen);
SDB_GET_BINARY(pRaw, dataPos, value, valuelen, _OVER) SDB_GET_BINARY(pRaw, dataPos, value, valuelen, _OVER)
taosHashPut(pUser->writeTbs, key, keyLen, value, valuelen); taosHashPut(pUser->writeTbs, key, keyLen, value, valuelen);
...@@ -360,6 +377,20 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { ...@@ -360,6 +377,20 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
taosMemoryFree(key); taosMemoryFree(key);
taosMemoryFree(value); taosMemoryFree(value);
} }
for (int32_t i = 0; i < numOfUseDbs; ++i) {
int32_t keyLen = 0;
SDB_GET_INT32(pRaw, dataPos, &keyLen, _OVER);
char *key = taosMemoryCalloc(keyLen, sizeof(char));
memset(key, 0, keyLen);
SDB_GET_BINARY(pRaw, dataPos, key, keyLen, _OVER);
int32_t ref = 0;
SDB_GET_INT32(pRaw, dataPos, &ref, _OVER);
taosHashPut(pUser->useDbs, key, keyLen, &ref, sizeof(ref));
}
} }
SDB_GET_RESERVE(pRaw, dataPos, USER_RESERVE_SIZE, _OVER) SDB_GET_RESERVE(pRaw, dataPos, USER_RESERVE_SIZE, _OVER)
...@@ -376,6 +407,7 @@ _OVER: ...@@ -376,6 +407,7 @@ _OVER:
taosHashCleanup(pUser->topics); taosHashCleanup(pUser->topics);
taosHashCleanup(pUser->readTbs); taosHashCleanup(pUser->readTbs);
taosHashCleanup(pUser->writeTbs); taosHashCleanup(pUser->writeTbs);
taosHashCleanup(pUser->useDbs);
} }
taosMemoryFreeClear(pRow); taosMemoryFreeClear(pRow);
return NULL; return NULL;
...@@ -426,6 +458,31 @@ SHashObj *mndDupTableHash(SHashObj *pOld) { ...@@ -426,6 +458,31 @@ SHashObj *mndDupTableHash(SHashObj *pOld) {
return pNew; return pNew;
} }
SHashObj *mndDupUseDbHash(SHashObj *pOld) {
SHashObj *pNew =
taosHashInit(taosHashGetSize(pOld), taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
if (pNew == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return NULL;
}
int32_t *db = taosHashIterate(pOld, NULL);
while (db != NULL) {
size_t keyLen = 0;
char *key = taosHashGetKey(db, &keyLen);
if (taosHashPut(pNew, key, keyLen, db, sizeof(*db)) != 0) {
taosHashCancelIterate(pOld, db);
taosHashCleanup(pNew);
terrno = TSDB_CODE_OUT_OF_MEMORY;
return NULL;
}
db = taosHashIterate(pOld, db);
}
return pNew;
}
static int32_t mndUserDupObj(SUserObj *pUser, SUserObj *pNew) { static int32_t mndUserDupObj(SUserObj *pUser, SUserObj *pNew) {
memcpy(pNew, pUser, sizeof(SUserObj)); memcpy(pNew, pUser, sizeof(SUserObj));
pNew->authVersion++; pNew->authVersion++;
...@@ -437,6 +494,7 @@ static int32_t mndUserDupObj(SUserObj *pUser, SUserObj *pNew) { ...@@ -437,6 +494,7 @@ static int32_t mndUserDupObj(SUserObj *pUser, SUserObj *pNew) {
pNew->readTbs = mndDupTableHash(pUser->readTbs); pNew->readTbs = mndDupTableHash(pUser->readTbs);
pNew->writeTbs = mndDupTableHash(pUser->writeTbs); pNew->writeTbs = mndDupTableHash(pUser->writeTbs);
pNew->topics = mndDupTopicHash(pUser->topics); pNew->topics = mndDupTopicHash(pUser->topics);
pNew->useDbs = mndDupUseDbHash(pUser->useDbs);
taosRUnLockLatch(&pUser->lock); taosRUnLockLatch(&pUser->lock);
if (pNew->readDbs == NULL || pNew->writeDbs == NULL || pNew->topics == NULL) { if (pNew->readDbs == NULL || pNew->writeDbs == NULL || pNew->topics == NULL) {
...@@ -451,11 +509,13 @@ static void mndUserFreeObj(SUserObj *pUser) { ...@@ -451,11 +509,13 @@ static void mndUserFreeObj(SUserObj *pUser) {
taosHashCleanup(pUser->topics); taosHashCleanup(pUser->topics);
taosHashCleanup(pUser->readTbs); taosHashCleanup(pUser->readTbs);
taosHashCleanup(pUser->writeTbs); taosHashCleanup(pUser->writeTbs);
taosHashCleanup(pUser->useDbs);
pUser->readDbs = NULL; pUser->readDbs = NULL;
pUser->writeDbs = NULL; pUser->writeDbs = NULL;
pUser->topics = NULL; pUser->topics = NULL;
pUser->readTbs = NULL; pUser->readTbs = NULL;
pUser->writeTbs = NULL; pUser->writeTbs = NULL;
pUser->useDbs = NULL;
} }
static int32_t mndUserActionDelete(SSdb *pSdb, SUserObj *pUser) { static int32_t mndUserActionDelete(SSdb *pSdb, SUserObj *pUser) {
...@@ -477,6 +537,7 @@ static int32_t mndUserActionUpdate(SSdb *pSdb, SUserObj *pOld, SUserObj *pNew) { ...@@ -477,6 +537,7 @@ static int32_t mndUserActionUpdate(SSdb *pSdb, SUserObj *pOld, SUserObj *pNew) {
TSWAP(pOld->topics, pNew->topics); TSWAP(pOld->topics, pNew->topics);
TSWAP(pOld->readTbs, pNew->readTbs); TSWAP(pOld->readTbs, pNew->readTbs);
TSWAP(pOld->writeTbs, pNew->writeTbs); TSWAP(pOld->writeTbs, pNew->writeTbs);
TSWAP(pOld->useDbs, pNew->useDbs);
taosWUnLockLatch(&pOld->lock); taosWUnLockLatch(&pOld->lock);
return 0; return 0;
...@@ -647,38 +708,8 @@ SHashObj *mndDupDbHash(SHashObj *pOld) { return mndDupObjHash(pOld, TSDB_DB_FNAM ...@@ -647,38 +708,8 @@ SHashObj *mndDupDbHash(SHashObj *pOld) { return mndDupObjHash(pOld, TSDB_DB_FNAM
SHashObj *mndDupTopicHash(SHashObj *pOld) { return mndDupObjHash(pOld, TSDB_TOPIC_FNAME_LEN); } SHashObj *mndDupTopicHash(SHashObj *pOld) { return mndDupObjHash(pOld, TSDB_TOPIC_FNAME_LEN); }
static int32_t mndTagPriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq *alterReq) { static int32_t mndTablePriviledge(SMnode *pMnode, SHashObj *hash, SHashObj *useDbHash, SAlterUserReq *alterReq,
char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; SSdb *pSdb) {
snprintf(tbFName, TSDB_TABLE_FNAME_LEN, "%s.%s", alterReq->objname, alterReq->tabName);
int32_t len = strlen(tbFName) + 1;
SStbObj *pStb = mndAcquireStb(pMnode, tbFName);
if (pStb == NULL) {
mndReleaseStb(pMnode, pStb);
return -1;
}
if (alterReq->tagCond == NULL) {
mndReleaseStb(pMnode, pStb);
return -1;
}
char *value = taosHashGet(hash, tbFName, len);
if (value != NULL) {
mndReleaseStb(pMnode, pStb);
terrno = TSDB_CODE_MND_PRIVILEDGE_EXIST;
return -1;
}
int32_t condLen = alterReq->tagCondLen + 1;
if (taosHashPut(hash, tbFName, len, alterReq->tagCond, condLen) != 0) {
mndReleaseStb(pMnode, pStb);
return -1;
}
mndReleaseStb(pMnode, pStb);
return 0;
}
static int32_t mndTablePriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq *alterReq, SSdb *pSdb) {
void *pIter = NULL; void *pIter = NULL;
char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; char tbFName[TSDB_TABLE_FNAME_LEN] = {0};
...@@ -692,7 +723,7 @@ static int32_t mndTablePriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq ...@@ -692,7 +723,7 @@ static int32_t mndTablePriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq
return -1; return -1;
} }
int32_t condLen = alterReq->tagCondLen + 1; int32_t condLen = alterReq->tagCondLen;
if (taosHashPut(hash, tbFName, len, alterReq->tagCond, condLen) != 0) { if (taosHashPut(hash, tbFName, len, alterReq->tagCond, condLen) != 0) {
return -1; return -1;
} }
...@@ -702,10 +733,21 @@ static int32_t mndTablePriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq ...@@ -702,10 +733,21 @@ static int32_t mndTablePriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq
} }
} }
int32_t dbKeyLen = strlen(alterReq->objname) + 1;
int32_t ref = 1;
int32_t *currRef = taosHashGet(useDbHash, alterReq->objname, dbKeyLen);
if (NULL != currRef) {
ref = (*currRef) + 1;
}
if (taosHashPut(useDbHash, alterReq->objname, dbKeyLen, &ref, sizeof(ref)) != 0) {
return -1;
}
return 0; return 0;
} }
static int32_t mndRemoveTablePriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq *alterReq, SSdb *pSdb) { static int32_t mndRemoveTablePriviledge(SMnode *pMnode, SHashObj *hash, SHashObj *useDbHash, SAlterUserReq *alterReq,
SSdb *pSdb) {
void *pIter = NULL; void *pIter = NULL;
char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; char tbFName[TSDB_TABLE_FNAME_LEN] = {0};
snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq->objname, alterReq->tabName); snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq->objname, alterReq->tabName);
...@@ -715,6 +757,19 @@ static int32_t mndRemoveTablePriviledge(SMnode *pMnode, SHashObj *hash, SAlterUs ...@@ -715,6 +757,19 @@ static int32_t mndRemoveTablePriviledge(SMnode *pMnode, SHashObj *hash, SAlterUs
return -1; return -1;
} }
int32_t dbKeyLen = strlen(alterReq->objname) + 1;
int32_t *currRef = taosHashGet(useDbHash, alterReq->objname, dbKeyLen);
if (NULL == currRef || 1 == *currRef) {
if (taosHashRemove(useDbHash, alterReq->objname, dbKeyLen) != 0) {
return -1;
}
return 0;
}
int32_t ref = (*currRef) - 1;
if (taosHashPut(useDbHash, alterReq->objname, dbKeyLen, &ref, sizeof(ref)) != 0) {
return -1;
}
return 0; return 0;
} }
...@@ -858,21 +913,19 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { ...@@ -858,21 +913,19 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) {
} }
if (alterReq.alterType == TSDB_ALTER_USER_ADD_READ_TABLE) { if (alterReq.alterType == TSDB_ALTER_USER_ADD_READ_TABLE) {
if (mndTablePriviledge(pMnode, newUser.readTbs, &alterReq, pSdb) != 0) goto _OVER; if (mndTablePriviledge(pMnode, newUser.readTbs, newUser.useDbs, &alterReq, pSdb) != 0) goto _OVER;
} }
if (alterReq.alterType == TSDB_ALTER_USER_ADD_WRITE_TABLE) { if (alterReq.alterType == TSDB_ALTER_USER_ADD_WRITE_TABLE) {
if (mndTablePriviledge(pMnode, newUser.writeTbs, &alterReq, pSdb) != 0) goto _OVER; if (mndTablePriviledge(pMnode, newUser.writeTbs, newUser.useDbs, &alterReq, pSdb) != 0) goto _OVER;
} }
if (alterReq.alterType == TSDB_ALTER_USER_REMOVE_READ_TABLE || if (alterReq.alterType == TSDB_ALTER_USER_REMOVE_READ_TABLE) {
alterReq.alterType == TSDB_ALTER_USER_REMOVE_READ_TAG) { if (mndRemoveTablePriviledge(pMnode, newUser.readTbs, newUser.useDbs, &alterReq, pSdb) != 0) goto _OVER;
if (mndRemoveTablePriviledge(pMnode, newUser.readTbs, &alterReq, pSdb) != 0) goto _OVER;
} }
if (alterReq.alterType == TSDB_ALTER_USER_REMOVE_WRITE_TABLE || if (alterReq.alterType == TSDB_ALTER_USER_REMOVE_WRITE_TABLE) {
alterReq.alterType == TSDB_ALTER_USER_REMOVE_WRITE_TAG) { if (mndRemoveTablePriviledge(pMnode, newUser.writeTbs, newUser.useDbs, &alterReq, pSdb) != 0) goto _OVER;
if (mndRemoveTablePriviledge(pMnode, newUser.writeTbs, &alterReq, pSdb) != 0) goto _OVER;
} }
if (alterReq.alterType == TSDB_ALTER_USER_ADD_SUBSCRIBE_TOPIC) { if (alterReq.alterType == TSDB_ALTER_USER_ADD_SUBSCRIBE_TOPIC) {
...@@ -885,14 +938,6 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { ...@@ -885,14 +938,6 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) {
taosHashPut(newUser.topics, pTopic->name, len, pTopic->name, TSDB_TOPIC_FNAME_LEN); taosHashPut(newUser.topics, pTopic->name, len, pTopic->name, TSDB_TOPIC_FNAME_LEN);
} }
if (alterReq.alterType == TSDB_ALTER_USER_ADD_READ_TAG) {
if (mndTagPriviledge(pMnode, newUser.readTbs, &alterReq) != 0) goto _OVER;
}
if (alterReq.alterType == TSDB_ALTER_USER_ADD_WRITE_TAG) {
if (mndTagPriviledge(pMnode, newUser.writeTbs, &alterReq) != 0) goto _OVER;
}
if (alterReq.alterType == TSDB_ALTER_USER_REMOVE_SUBSCRIBE_TOPIC) { if (alterReq.alterType == TSDB_ALTER_USER_REMOVE_SUBSCRIBE_TOPIC) {
int32_t len = strlen(alterReq.objname) + 1; int32_t len = strlen(alterReq.objname) + 1;
SMqTopicObj *pTopic = mndAcquireTopic(pMnode, alterReq.objname); SMqTopicObj *pTopic = mndAcquireTopic(pMnode, alterReq.objname);
...@@ -1397,8 +1442,6 @@ int32_t mndUserRemoveDb(SMnode *pMnode, STrans *pTrans, char *db) { ...@@ -1397,8 +1442,6 @@ int32_t mndUserRemoveDb(SMnode *pMnode, STrans *pTrans, char *db) {
if (inRead || inWrite) { if (inRead || inWrite) {
(void)taosHashRemove(newUser.readDbs, db, len); (void)taosHashRemove(newUser.readDbs, db, len);
(void)taosHashRemove(newUser.writeDbs, db, len); (void)taosHashRemove(newUser.writeDbs, db, len);
(void)taosHashRemove(newUser.readTbs, db, len);
(void)taosHashRemove(newUser.writeTbs, db, len);
SSdbRaw *pCommitRaw = mndUserActionEncode(&newUser); SSdbRaw *pCommitRaw = mndUserActionEncode(&newUser);
if (pCommitRaw == NULL || mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) break; if (pCommitRaw == NULL || mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) break;
......
...@@ -294,7 +294,6 @@ void tqCloseReader(STqReader* pReader) { ...@@ -294,7 +294,6 @@ void tqCloseReader(STqReader* pReader) {
int32_t tqSeekVer(STqReader* pReader, int64_t ver, const char* id) { int32_t tqSeekVer(STqReader* pReader, int64_t ver, const char* id) {
if (walReadSeekVer(pReader->pWalReader, ver) < 0) { if (walReadSeekVer(pReader->pWalReader, ver) < 0) {
tqDebug("wal reader failed to seek to ver:%"PRId64" code:%s, %s", ver, tstrerror(terrno), id);
return -1; return -1;
} }
tqDebug("wal reader seek to ver:%"PRId64" %s", ver, id); tqDebug("wal reader seek to ver:%"PRId64" %s", ver, id);
......
...@@ -238,7 +238,8 @@ _return: ...@@ -238,7 +238,8 @@ _return:
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t ctgAcquireVgMetaFromCache(SCatalog *pCtg, const char *dbFName, const char *tbName, SCtgDBCache **pDb, SCtgTbCache **pTb) { int32_t ctgAcquireVgMetaFromCache(SCatalog *pCtg, const char *dbFName, const char *tbName, SCtgDBCache **pDb,
SCtgTbCache **pTb) {
SCtgDBCache *dbCache = NULL; SCtgDBCache *dbCache = NULL;
SCtgTbCache *tbCache = NULL; SCtgTbCache *tbCache = NULL;
bool vgInCache = false; bool vgInCache = false;
...@@ -306,7 +307,6 @@ _return: ...@@ -306,7 +307,6 @@ _return:
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
/* /*
int32_t ctgAcquireStbMetaFromCache(SCatalog *pCtg, char *dbFName, uint64_t suid, SCtgDBCache **pDb, SCtgTbCache **pTb) { int32_t ctgAcquireStbMetaFromCache(SCatalog *pCtg, char *dbFName, uint64_t suid, SCtgDBCache **pDb, SCtgTbCache **pTb) {
SCtgDBCache *dbCache = NULL; SCtgDBCache *dbCache = NULL;
...@@ -360,7 +360,8 @@ _return: ...@@ -360,7 +360,8 @@ _return:
} }
*/ */
int32_t ctgAcquireStbMetaFromCache(SCtgDBCache *dbCache, SCatalog *pCtg, char *dbFName, uint64_t suid, SCtgTbCache **pTb) { int32_t ctgAcquireStbMetaFromCache(SCtgDBCache *dbCache, SCatalog *pCtg, char *dbFName, uint64_t suid,
SCtgTbCache **pTb) {
SCtgTbCache *pCache = NULL; SCtgTbCache *pCache = NULL;
char *stName = taosHashAcquire(dbCache->stbCache, &suid, sizeof(suid)); char *stName = taosHashAcquire(dbCache->stbCache, &suid, sizeof(suid));
if (NULL == stName) { if (NULL == stName) {
...@@ -459,7 +460,8 @@ int32_t ctgTbMetaExistInCache(SCatalog *pCtg, char *dbFName, char *tbName, int32 ...@@ -459,7 +460,8 @@ int32_t ctgTbMetaExistInCache(SCatalog *pCtg, char *dbFName, char *tbName, int32
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCtgTbCache **pTb, STableMeta **pTableMeta, char* dbFName) { int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCtgTbCache **pTb, STableMeta **pTableMeta,
char *dbFName) {
SCtgDBCache *dbCache = *pDb; SCtgDBCache *dbCache = *pDb;
SCtgTbCache *tbCache = *pTb; SCtgTbCache *tbCache = *pTb;
STableMeta *tbMeta = tbCache->pMeta; STableMeta *tbMeta = tbCache->pMeta;
...@@ -491,7 +493,7 @@ int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCt ...@@ -491,7 +493,7 @@ int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCt
memcpy(*pTableMeta, tbMeta, metaSize); memcpy(*pTableMeta, tbMeta, metaSize);
//ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache); // ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache);
CTG_UNLOCK(CTG_READ, &tbCache->metaLock); CTG_UNLOCK(CTG_READ, &tbCache->metaLock);
taosHashRelease(dbCache->tbCache, tbCache); taosHashRelease(dbCache->tbCache, tbCache);
...@@ -528,7 +530,6 @@ int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCt ...@@ -528,7 +530,6 @@ int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCt
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t ctgReadTbMetaFromCache(SCatalog *pCtg, SCtgTbMetaCtx *ctx, STableMeta **pTableMeta) { int32_t ctgReadTbMetaFromCache(SCatalog *pCtg, SCtgTbMetaCtx *ctx, STableMeta **pTableMeta) {
int32_t code = 0; int32_t code = 0;
SCtgDBCache *dbCache = NULL; SCtgDBCache *dbCache = NULL;
...@@ -598,7 +599,7 @@ int32_t ctgReadTbVerFromCache(SCatalog *pCtg, SName *pTableName, int32_t *sver, ...@@ -598,7 +599,7 @@ int32_t ctgReadTbVerFromCache(SCatalog *pCtg, SName *pTableName, int32_t *sver,
// PROCESS FOR CHILD TABLE // PROCESS FOR CHILD TABLE
//ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache); // ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache);
if (tbCache) { if (tbCache) {
CTG_UNLOCK(CTG_READ, &tbCache->metaLock); CTG_UNLOCK(CTG_READ, &tbCache->metaLock);
taosHashRelease(dbCache->tbCache, tbCache); taosHashRelease(dbCache->tbCache, tbCache);
...@@ -608,7 +609,7 @@ int32_t ctgReadTbVerFromCache(SCatalog *pCtg, SName *pTableName, int32_t *sver, ...@@ -608,7 +609,7 @@ int32_t ctgReadTbVerFromCache(SCatalog *pCtg, SName *pTableName, int32_t *sver,
ctgAcquireStbMetaFromCache(dbCache, pCtg, dbFName, *suid, &tbCache); ctgAcquireStbMetaFromCache(dbCache, pCtg, dbFName, *suid, &tbCache);
if (NULL == tbCache) { if (NULL == tbCache) {
//ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache); // ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache);
ctgDebug("stb 0x%" PRIx64 " meta not in cache", *suid); ctgDebug("stb 0x%" PRIx64 " meta not in cache", *suid);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -678,7 +679,7 @@ _return: ...@@ -678,7 +679,7 @@ _return:
CTG_RET(code); CTG_RET(code);
} }
int32_t ctgChkAuthFromCache(SCatalog *pCtg, SUserAuthInfo *pReq, bool *inCache, SCtgAuthRsp* pRes) { int32_t ctgChkAuthFromCache(SCatalog *pCtg, SUserAuthInfo *pReq, bool *inCache, SCtgAuthRsp *pRes) {
if (IS_SYS_DBNAME(pReq->tbName.dbname)) { if (IS_SYS_DBNAME(pReq->tbName.dbname)) {
*inCache = true; *inCache = true;
pRes->pRawRes->pass = true; pRes->pRawRes->pass = true;
...@@ -1685,9 +1686,9 @@ void ctgFreeAllInstance(void) { ...@@ -1685,9 +1686,9 @@ void ctgFreeAllInstance(void) {
taosHashClear(gCtgMgmt.pCluster); taosHashClear(gCtgMgmt.pCluster);
} }
int32_t ctgVgInfoIdComp(void const* lp, void const* rp) { int32_t ctgVgInfoIdComp(void const *lp, void const *rp) {
int32_t* key = (int32_t*)lp; int32_t *key = (int32_t *)lp;
SVgroupInfo* pVg = (SVgroupInfo*)rp; SVgroupInfo *pVg = (SVgroupInfo *)rp;
if (*key < pVg->vgId) { if (*key < pVg->vgId) {
return -1; return -1;
...@@ -1698,7 +1699,6 @@ int32_t ctgVgInfoIdComp(void const* lp, void const* rp) { ...@@ -1698,7 +1699,6 @@ int32_t ctgVgInfoIdComp(void const* lp, void const* rp) {
return 0; return 0;
} }
int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) { int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) {
int32_t code = 0; int32_t code = 0;
SCtgUpdateVgMsg *msg = operation->data; SCtgUpdateVgMsg *msg = operation->data;
...@@ -1763,7 +1763,7 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) { ...@@ -1763,7 +1763,7 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) {
dbCache = NULL; dbCache = NULL;
//if (!IS_SYS_DBNAME(dbFName)) { // if (!IS_SYS_DBNAME(dbFName)) {
tstrncpy(vgVersion.dbFName, dbFName, sizeof(vgVersion.dbFName)); tstrncpy(vgVersion.dbFName, dbFName, sizeof(vgVersion.dbFName));
CTG_ERR_JRET(ctgMetaRentUpdate(&msg->pCtg->dbRent, &vgVersion, vgVersion.dbId, sizeof(SDbVgVersion), CTG_ERR_JRET(ctgMetaRentUpdate(&msg->pCtg->dbRent, &vgVersion, vgVersion.dbId, sizeof(SDbVgVersion),
ctgDbVgVersionSortCompare, ctgDbVgVersionSearchCompare)); ctgDbVgVersionSortCompare, ctgDbVgVersionSearchCompare));
...@@ -2043,6 +2043,10 @@ int32_t ctgOpUpdateUser(SCtgCacheOperation *operation) { ...@@ -2043,6 +2043,10 @@ int32_t ctgOpUpdateUser(SCtgCacheOperation *operation) {
pUser->userAuth.writeTbs = msg->userAuth.writeTbs; pUser->userAuth.writeTbs = msg->userAuth.writeTbs;
msg->userAuth.writeTbs = NULL; msg->userAuth.writeTbs = NULL;
taosHashCleanup(pUser->userAuth.useDbs);
pUser->userAuth.useDbs = msg->userAuth.useDbs;
msg->userAuth.useDbs = NULL;
CTG_UNLOCK(CTG_WRITE, &pUser->lock); CTG_UNLOCK(CTG_WRITE, &pUser->lock);
_return: _return:
...@@ -2052,6 +2056,7 @@ _return: ...@@ -2052,6 +2056,7 @@ _return:
taosHashCleanup(msg->userAuth.writeDbs); taosHashCleanup(msg->userAuth.writeDbs);
taosHashCleanup(msg->userAuth.readTbs); taosHashCleanup(msg->userAuth.readTbs);
taosHashCleanup(msg->userAuth.writeTbs); taosHashCleanup(msg->userAuth.writeTbs);
taosHashCleanup(msg->userAuth.useDbs);
taosMemoryFreeClear(msg); taosMemoryFreeClear(msg);
...@@ -2246,6 +2251,7 @@ void ctgFreeCacheOperationData(SCtgCacheOperation *op) { ...@@ -2246,6 +2251,7 @@ void ctgFreeCacheOperationData(SCtgCacheOperation *op) {
taosHashCleanup(msg->userAuth.writeDbs); taosHashCleanup(msg->userAuth.writeDbs);
taosHashCleanup(msg->userAuth.readTbs); taosHashCleanup(msg->userAuth.readTbs);
taosHashCleanup(msg->userAuth.writeTbs); taosHashCleanup(msg->userAuth.writeTbs);
taosHashCleanup(msg->userAuth.useDbs);
taosMemoryFreeClear(op->data); taosMemoryFreeClear(op->data);
break; break;
} }
......
...@@ -179,6 +179,7 @@ void ctgFreeSCtgUserAuth(SCtgUserAuth* userCache) { ...@@ -179,6 +179,7 @@ void ctgFreeSCtgUserAuth(SCtgUserAuth* userCache) {
taosHashCleanup(userCache->userAuth.writeDbs); taosHashCleanup(userCache->userAuth.writeDbs);
taosHashCleanup(userCache->userAuth.readTbs); taosHashCleanup(userCache->userAuth.readTbs);
taosHashCleanup(userCache->userAuth.writeTbs); taosHashCleanup(userCache->userAuth.writeTbs);
taosHashCleanup(userCache->userAuth.useDbs);
} }
void ctgFreeMetaRent(SCtgRentMgmt* mgmt) { void ctgFreeMetaRent(SCtgRentMgmt* mgmt) {
...@@ -427,6 +428,7 @@ void ctgFreeMsgCtx(SCtgMsgCtx* pCtx) { ...@@ -427,6 +428,7 @@ void ctgFreeMsgCtx(SCtgMsgCtx* pCtx) {
taosHashCleanup(pOut->writeDbs); taosHashCleanup(pOut->writeDbs);
taosHashCleanup(pOut->readTbs); taosHashCleanup(pOut->readTbs);
taosHashCleanup(pOut->writeTbs); taosHashCleanup(pOut->writeTbs);
taosHashCleanup(pOut->useDbs);
taosMemoryFreeClear(pCtx->out); taosMemoryFreeClear(pCtx->out);
break; break;
} }
...@@ -873,7 +875,7 @@ int32_t ctgGetVgInfoFromHashValue(SCatalog* pCtg, SDBVgInfo* dbInfo, const SName ...@@ -873,7 +875,7 @@ int32_t ctgGetVgInfoFromHashValue(SCatalog* pCtg, SDBVgInfo* dbInfo, const SName
vgInfo = taosArraySearch(dbInfo->vgArray, &hashValue, ctgHashValueComp, TD_EQ); vgInfo = taosArraySearch(dbInfo->vgArray, &hashValue, ctgHashValueComp, TD_EQ);
/* /*
void* pIter = taosHashIterate(dbInfo->vgHash, NULL); void* pIter = taosHashIterate(dbInfo->vgHash, NULL);
while (pIter) { while (pIter) {
vgInfo = pIter; vgInfo = pIter;
...@@ -885,7 +887,7 @@ int32_t ctgGetVgInfoFromHashValue(SCatalog* pCtg, SDBVgInfo* dbInfo, const SName ...@@ -885,7 +887,7 @@ int32_t ctgGetVgInfoFromHashValue(SCatalog* pCtg, SDBVgInfo* dbInfo, const SName
pIter = taosHashIterate(dbInfo->vgHash, pIter); pIter = taosHashIterate(dbInfo->vgHash, pIter);
vgInfo = NULL; vgInfo = NULL;
} }
*/ */
if (NULL == vgInfo) { if (NULL == vgInfo) {
ctgError("no hash range found for hash value [%u], db:%s, numOfVgId:%d", hashValue, db, ctgError("no hash range found for hash value [%u], db:%s, numOfVgId:%d", hashValue, db,
...@@ -990,7 +992,8 @@ int32_t ctgGetVgInfosFromHashValue(SCatalog* pCtg, SCtgTaskReq* tReq, SDBVgInfo* ...@@ -990,7 +992,8 @@ int32_t ctgGetVgInfosFromHashValue(SCatalog* pCtg, SCtgTaskReq* tReq, SDBVgInfo*
CTG_RET(code); CTG_RET(code);
} }
int32_t ctgGetVgIdsFromHashValue(SCatalog* pCtg, SDBVgInfo* dbInfo, char* dbFName, const char* pTbs[], int32_t tbNum, int32_t* vgId) { int32_t ctgGetVgIdsFromHashValue(SCatalog* pCtg, SDBVgInfo* dbInfo, char* dbFName, const char* pTbs[], int32_t tbNum,
int32_t* vgId) {
int32_t code = 0; int32_t code = 0;
CTG_ERR_RET(ctgMakeVgArray(dbInfo)); CTG_ERR_RET(ctgMakeVgArray(dbInfo));
...@@ -1026,7 +1029,6 @@ int32_t ctgGetVgIdsFromHashValue(SCatalog* pCtg, SDBVgInfo* dbInfo, char* dbFNam ...@@ -1026,7 +1029,6 @@ int32_t ctgGetVgIdsFromHashValue(SCatalog* pCtg, SDBVgInfo* dbInfo, char* dbFNam
CTG_RET(code); CTG_RET(code);
} }
int32_t ctgStbVersionSearchCompare(const void* key1, const void* key2) { int32_t ctgStbVersionSearchCompare(const void* key1, const void* key2) {
if (*(uint64_t*)key1 < ((SSTableVersion*)key2)->suid) { if (*(uint64_t*)key1 < ((SSTableVersion*)key2)->suid) {
return -1; return -1;
...@@ -1090,7 +1092,6 @@ int32_t ctgMakeVgArray(SDBVgInfo* dbInfo) { ...@@ -1090,7 +1092,6 @@ int32_t ctgMakeVgArray(SDBVgInfo* dbInfo) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t ctgCloneVgInfo(SDBVgInfo* src, SDBVgInfo** dst) { int32_t ctgCloneVgInfo(SDBVgInfo* src, SDBVgInfo** dst) {
CTG_ERR_RET(ctgMakeVgArray(src)); CTG_ERR_RET(ctgMakeVgArray(src));
...@@ -1334,15 +1335,15 @@ static void* ctgCloneDnodeList(void* pSrc) { return taosArrayDup((const SArray*) ...@@ -1334,15 +1335,15 @@ static void* ctgCloneDnodeList(void* pSrc) { return taosArrayDup((const SArray*)
static void ctgFreeDnodeList(void* p) { taosArrayDestroy((SArray*)((SMetaRes*)p)->pRes); } static void ctgFreeDnodeList(void* p) { taosArrayDestroy((SArray*)((SMetaRes*)p)->pRes); }
int32_t ctgChkSetTbAuthRes(SCatalog *pCtg, SCtgAuthReq *req, SCtgAuthRsp* res) { int32_t ctgChkSetTbAuthRes(SCatalog* pCtg, SCtgAuthReq* req, SCtgAuthRsp* res) {
int32_t code = 0; int32_t code = 0;
STableMeta *pMeta = NULL; STableMeta* pMeta = NULL;
SGetUserAuthRsp *pInfo = &req->authInfo; SGetUserAuthRsp* pInfo = &req->authInfo;
SHashObj *pTbs = (AUTH_TYPE_READ == req->singleType) ? pInfo->readTbs : pInfo->writeTbs; SHashObj* pTbs = (AUTH_TYPE_READ == req->singleType) ? pInfo->readTbs : pInfo->writeTbs;
char tbFullName[TSDB_TABLE_FNAME_LEN]; char tbFullName[TSDB_TABLE_FNAME_LEN];
tNameExtractFullName(&req->pRawReq->tbName, tbFullName); tNameExtractFullName(&req->pRawReq->tbName, tbFullName);
char *pCond = taosHashGet(pTbs, tbFullName, strlen(tbFullName)); char* pCond = taosHashGet(pTbs, tbFullName, strlen(tbFullName));
if (pCond) { if (pCond) {
if (strlen(pCond) > 1) { if (strlen(pCond) > 1) {
CTG_ERR_RET(nodesStringToNode(pCond, &res->pRawRes->pCond)); CTG_ERR_RET(nodesStringToNode(pCond, &res->pRawRes->pCond));
...@@ -1352,38 +1353,40 @@ int32_t ctgChkSetTbAuthRes(SCatalog *pCtg, SCtgAuthReq *req, SCtgAuthRsp* res) { ...@@ -1352,38 +1353,40 @@ int32_t ctgChkSetTbAuthRes(SCatalog *pCtg, SCtgAuthReq *req, SCtgAuthRsp* res) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
CTG_ERR_RET(catalogGetCachedTableMeta(pCtg, &req->pRawReq->tbName, &pMeta));
if (NULL == pMeta) {
if (req->onlyCache) {
res->metaNotExists = true;
ctgDebug("db %s tb %s meta not in cache for auth", req->pRawReq->tbName.dbname, req->pRawReq->tbName.tname);
return TSDB_CODE_SUCCESS;
}
CTG_ERR_RET(catalogGetTableMeta(pCtg, req->pConn, &req->pRawReq->tbName, &pMeta));
}
if (TSDB_SUPER_TABLE == pMeta->tableType || TSDB_NORMAL_TABLE == pMeta->tableType) {
res->pRawRes->pass = false; res->pRawRes->pass = false;
goto _return;
}
if (TSDB_CHILD_TABLE == pMeta->tableType) {
res->pRawRes->pass = true;
/*
char stbName[TSDB_TABLE_NAME_LEN] = {0};
CTG_ERR_JRET(ctgGetCachedStbNameFromSuid(pCtg, pMeta->suid, stbName));
if (0 == stbName[0]) {
if (req->onlyCache) {
res->notExists = true;
return TSDB_CODE_SUCCESS;
}
CTG_ERR_RET(catalogRefreshTableMeta(pCtg, req->pConn, &req->pRawReq->tbName, 0)); // CTG_ERR_RET(catalogGetCachedTableMeta(pCtg, &req->pRawReq->tbName, &pMeta));
} // if (NULL == pMeta) {
*/ // if (req->onlyCache) {
} // res->metaNotExists = true;
// ctgDebug("db %s tb %s meta not in cache for auth", req->pRawReq->tbName.dbname, req->pRawReq->tbName.tname);
// return TSDB_CODE_SUCCESS;
// }
// CTG_ERR_RET(catalogGetTableMeta(pCtg, req->pConn, &req->pRawReq->tbName, &pMeta));
// }
// if (TSDB_SUPER_TABLE == pMeta->tableType || TSDB_NORMAL_TABLE == pMeta->tableType) {
// res->pRawRes->pass = false;
// goto _return;
// }
// if (TSDB_CHILD_TABLE == pMeta->tableType) {
// res->pRawRes->pass = true;
// /*
// char stbName[TSDB_TABLE_NAME_LEN] = {0};
// CTG_ERR_JRET(ctgGetCachedStbNameFromSuid(pCtg, pMeta->suid, stbName));
// if (0 == stbName[0]) {
// if (req->onlyCache) {
// res->notExists = true;
// return TSDB_CODE_SUCCESS;
// }
// CTG_ERR_RET(catalogRefreshTableMeta(pCtg, req->pConn, &req->pRawReq->tbName, 0));
// }
// */
// }
_return: _return:
...@@ -1392,11 +1395,11 @@ _return: ...@@ -1392,11 +1395,11 @@ _return:
CTG_RET(code); CTG_RET(code);
} }
int32_t ctgChkSetAuthRes(SCatalog *pCtg, SCtgAuthReq *req, SCtgAuthRsp* res) { int32_t ctgChkSetAuthRes(SCatalog* pCtg, SCtgAuthReq* req, SCtgAuthRsp* res) {
int32_t code = 0; int32_t code = 0;
SUserAuthInfo* pReq = req->pRawReq; SUserAuthInfo* pReq = req->pRawReq;
SUserAuthRes* pRes = res->pRawRes; SUserAuthRes* pRes = res->pRawRes;
SGetUserAuthRsp *pInfo = &req->authInfo; SGetUserAuthRsp* pInfo = &req->authInfo;
pRes->pass = false; pRes->pass = false;
pRes->pCond = NULL; pRes->pCond = NULL;
...@@ -1421,32 +1424,41 @@ int32_t ctgChkSetAuthRes(SCatalog *pCtg, SCtgAuthReq *req, SCtgAuthRsp* res) { ...@@ -1421,32 +1424,41 @@ int32_t ctgChkSetAuthRes(SCatalog *pCtg, SCtgAuthReq *req, SCtgAuthRsp* res) {
switch (pReq->type) { switch (pReq->type) {
case AUTH_TYPE_READ: { case AUTH_TYPE_READ: {
if (pInfo->readTbs && taosHashGetSize(pInfo->readTbs) > 0) {
req->singleType = AUTH_TYPE_READ;
CTG_ERR_RET(ctgChkSetTbAuthRes(pCtg, req, res));
if (pRes->pass) {
return TSDB_CODE_SUCCESS;
}
}
if (pInfo->readDbs && taosHashGet(pInfo->readDbs, dbFName, strlen(dbFName))) { if (pInfo->readDbs && taosHashGet(pInfo->readDbs, dbFName, strlen(dbFName))) {
pRes->pass = true; pRes->pass = true;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
if (pInfo->readTbs && taosHashGetSize(pInfo->readTbs) > 0) {
req->singleType = AUTH_TYPE_READ;
CTG_RET(ctgChkSetTbAuthRes(pCtg, req, res));
}
break; break;
} }
case AUTH_TYPE_WRITE: { case AUTH_TYPE_WRITE: {
if (pInfo->writeTbs && taosHashGetSize(pInfo->writeTbs) > 0) {
req->singleType = AUTH_TYPE_WRITE;
CTG_ERR_RET(ctgChkSetTbAuthRes(pCtg, req, res));
if (pRes->pass) {
return TSDB_CODE_SUCCESS;
}
}
if (pInfo->writeDbs && taosHashGet(pInfo->writeDbs, dbFName, strlen(dbFName))) { if (pInfo->writeDbs && taosHashGet(pInfo->writeDbs, dbFName, strlen(dbFName))) {
pRes->pass = true; pRes->pass = true;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
if (pInfo->writeTbs && taosHashGetSize(pInfo->writeTbs) > 0) {
req->singleType = AUTH_TYPE_WRITE;
CTG_RET(ctgChkSetTbAuthRes(pCtg, req, res));
}
break; break;
} }
case AUTH_TYPE_READ_OR_WRITE: { case AUTH_TYPE_READ_OR_WRITE: {
if ((pInfo->readDbs && taosHashGet(pInfo->readDbs, dbFName, strlen(dbFName))) || if ((pInfo->readDbs && taosHashGet(pInfo->readDbs, dbFName, strlen(dbFName))) ||
(pInfo->writeDbs && taosHashGet(pInfo->writeDbs, dbFName, strlen(dbFName)))){ (pInfo->writeDbs && taosHashGet(pInfo->writeDbs, dbFName, strlen(dbFName))) ||
(pInfo->useDbs && taosHashGet(pInfo->useDbs, dbFName, strlen(dbFName)))) {
pRes->pass = true; pRes->pass = true;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -1460,7 +1472,6 @@ int32_t ctgChkSetAuthRes(SCatalog *pCtg, SCtgAuthReq *req, SCtgAuthRsp* res) { ...@@ -1460,7 +1472,6 @@ int32_t ctgChkSetAuthRes(SCatalog *pCtg, SCtgAuthReq *req, SCtgAuthRsp* res) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
#if 0 #if 0
static int32_t ctgCloneMetaDataArray(SArray* pSrc, __array_item_dup_fn_t copyFunc, SArray** pDst) { static int32_t ctgCloneMetaDataArray(SArray* pSrc, __array_item_dup_fn_t copyFunc, SArray** pDst) {
if (NULL == pSrc) { if (NULL == pSrc) {
...@@ -1554,4 +1565,3 @@ void catalogFreeMetaData(SMetaData* pData) { ...@@ -1554,4 +1565,3 @@ void catalogFreeMetaData(SMetaData* pData) {
taosMemoryFree(pData); taosMemoryFree(pData);
} }
#endif #endif
...@@ -29,7 +29,6 @@ struct SDataSinkHandle; ...@@ -29,7 +29,6 @@ struct SDataSinkHandle;
typedef struct SDataSinkManager { typedef struct SDataSinkManager {
SDataSinkMgtCfg cfg; SDataSinkMgtCfg cfg;
TdThreadMutex mutex;
} SDataSinkManager; } SDataSinkManager;
typedef int32_t (*FPutDataBlock)(struct SDataSinkHandle* pHandle, const SInputData* pInput, bool* pContinue); typedef int32_t (*FPutDataBlock)(struct SDataSinkHandle* pHandle, const SInputData* pInput, bool* pContinue);
......
...@@ -23,7 +23,6 @@ SDataSinkStat gDataSinkStat = {0}; ...@@ -23,7 +23,6 @@ SDataSinkStat gDataSinkStat = {0};
int32_t dsDataSinkMgtInit(SDataSinkMgtCfg* cfg) { int32_t dsDataSinkMgtInit(SDataSinkMgtCfg* cfg) {
gDataSinkManager.cfg = *cfg; gDataSinkManager.cfg = *cfg;
taosThreadMutexInit(&gDataSinkManager.mutex, NULL);
return 0; // to avoid compiler eror return 0; // to avoid compiler eror
} }
......
...@@ -1057,6 +1057,7 @@ int32_t qStreamSetScanMemData(qTaskInfo_t tinfo, SPackedData submit) { ...@@ -1057,6 +1057,7 @@ int32_t qStreamSetScanMemData(qTaskInfo_t tinfo, SPackedData submit) {
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
if((pTaskInfo->execModel != OPTR_EXEC_MODEL_QUEUE) || (pTaskInfo->streamInfo.submit.msgStr != NULL)){ if((pTaskInfo->execModel != OPTR_EXEC_MODEL_QUEUE) || (pTaskInfo->streamInfo.submit.msgStr != NULL)){
qError("qStreamSetScanMemData err:%d,%p", pTaskInfo->execModel, pTaskInfo->streamInfo.submit.msgStr); qError("qStreamSetScanMemData err:%d,%p", pTaskInfo->execModel, pTaskInfo->streamInfo.submit.msgStr);
terrno = TSDB_CODE_PAR_INTERNAL_ERROR;
return -1; return -1;
} }
qDebug("set the submit block for future scan"); qDebug("set the submit block for future scan");
...@@ -1097,7 +1098,6 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT ...@@ -1097,7 +1098,6 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
// let's seek to the next version in wal file // let's seek to the next version in wal file
if (tqSeekVer(pInfo->tqReader, pOffset->version + 1, id) < 0) { if (tqSeekVer(pInfo->tqReader, pOffset->version + 1, id) < 0) {
qError("tqSeekVer failed ver:%"PRId64", %s", pOffset->version + 1, id);
return -1; return -1;
} }
} else if (pOffset->type == TMQ_OFFSET__SNAPSHOT_DATA) { } else if (pOffset->type == TMQ_OFFSET__SNAPSHOT_DATA) {
...@@ -1120,6 +1120,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT ...@@ -1120,6 +1120,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
} else { } else {
taosRUnLockLatch(&pTaskInfo->lock); taosRUnLockLatch(&pTaskInfo->lock);
qError("no table in table list, %s", id); qError("no table in table list, %s", id);
terrno = TSDB_CODE_PAR_INTERNAL_ERROR;
return -1; return -1;
} }
} }
...@@ -1138,6 +1139,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT ...@@ -1138,6 +1139,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
} else { } else {
qError("vgId:%d uid:%" PRIu64 " not found in table list, total:%d, index:%d %s", pTaskInfo->id.vgId, uid, qError("vgId:%d uid:%" PRIu64 " not found in table list, total:%d, index:%d %s", pTaskInfo->id.vgId, uid,
numOfTables, pScanInfo->currentTable, id); numOfTables, pScanInfo->currentTable, id);
terrno = TSDB_CODE_PAR_INTERNAL_ERROR;
return -1; return -1;
} }
...@@ -1170,6 +1172,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT ...@@ -1170,6 +1172,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
pScanBaseInfo->cond.twindows.skey = oldSkey; pScanBaseInfo->cond.twindows.skey = oldSkey;
} else { } else {
qError("invalid pOffset->type:%d, %s", pOffset->type, id); qError("invalid pOffset->type:%d, %s", pOffset->type, id);
terrno = TSDB_CODE_PAR_INTERNAL_ERROR;
return -1; return -1;
} }
...@@ -1184,6 +1187,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT ...@@ -1184,6 +1187,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
if (setForSnapShot(sContext, pOffset->uid) != 0) { if (setForSnapShot(sContext, pOffset->uid) != 0) {
qError("setDataForSnapShot error. uid:%" PRId64" , %s", pOffset->uid, id); qError("setDataForSnapShot error. uid:%" PRId64" , %s", pOffset->uid, id);
terrno = TSDB_CODE_PAR_INTERNAL_ERROR;
return -1; return -1;
} }
...@@ -1219,6 +1223,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT ...@@ -1219,6 +1223,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
SSnapContext* sContext = pInfo->sContext; SSnapContext* sContext = pInfo->sContext;
if (setForSnapShot(sContext, pOffset->uid) != 0) { if (setForSnapShot(sContext, pOffset->uid) != 0) {
qError("setForSnapShot error. uid:%" PRIu64 " ,version:%" PRId64, pOffset->uid, pOffset->version); qError("setForSnapShot error. uid:%" PRIu64 " ,version:%" PRId64, pOffset->uid, pOffset->version);
terrno = TSDB_CODE_PAR_INTERNAL_ERROR;
return -1; return -1;
} }
qDebug("tmqsnap qStreamPrepareScan snapshot meta uid:%" PRId64 " ts %" PRId64 " %s", pOffset->uid, pOffset->ts, id); qDebug("tmqsnap qStreamPrepareScan snapshot meta uid:%" PRId64 " ts %" PRId64 " %s", pOffset->uid, pOffset->ts, id);
......
...@@ -999,6 +999,7 @@ int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t* order, int32_t* scan ...@@ -999,6 +999,7 @@ int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t* order, int32_t* scan
SOperatorInfo* extractOperatorInTree(SOperatorInfo* pOperator, int32_t type, const char* id) { SOperatorInfo* extractOperatorInTree(SOperatorInfo* pOperator, int32_t type, const char* id) {
if (pOperator == NULL) { if (pOperator == NULL) {
qError("invalid operator, failed to find tableScanOperator %s", id); qError("invalid operator, failed to find tableScanOperator %s", id);
terrno = TSDB_CODE_PAR_INTERNAL_ERROR;
return NULL; return NULL;
} }
...@@ -1007,6 +1008,7 @@ SOperatorInfo* extractOperatorInTree(SOperatorInfo* pOperator, int32_t type, con ...@@ -1007,6 +1008,7 @@ SOperatorInfo* extractOperatorInTree(SOperatorInfo* pOperator, int32_t type, con
} else { } else {
if (pOperator->pDownstream == NULL || pOperator->pDownstream[0] == NULL) { if (pOperator->pDownstream == NULL || pOperator->pDownstream[0] == NULL) {
qError("invalid operator, failed to find tableScanOperator %s", id); qError("invalid operator, failed to find tableScanOperator %s", id);
terrno = TSDB_CODE_PAR_INTERNAL_ERROR;
return NULL; return NULL;
} }
......
...@@ -571,13 +571,13 @@ int32_t udfdLoadUdf(char *udfName, SUdf *udf) { ...@@ -571,13 +571,13 @@ int32_t udfdLoadUdf(char *udfName, SUdf *udf) {
char initFuncName[TSDB_FUNC_NAME_LEN + 5] = {0}; char initFuncName[TSDB_FUNC_NAME_LEN + 5] = {0};
char *initSuffix = "_init"; char *initSuffix = "_init";
strcpy(initFuncName, udfName); strcpy(initFuncName, udfName);
strncat(initFuncName, initSuffix, strlen(initSuffix)); strncat(initFuncName, initSuffix, TSDB_FUNC_NAME_LEN + 5 - strlen(initFuncName) - 1);
uv_dlsym(&udf->lib, initFuncName, (void **)(&udf->initFunc)); uv_dlsym(&udf->lib, initFuncName, (void **)(&udf->initFunc));
char destroyFuncName[TSDB_FUNC_NAME_LEN + 5] = {0}; char destroyFuncName[TSDB_FUNC_NAME_LEN + 5] = {0};
char *destroySuffix = "_destroy"; char *destroySuffix = "_destroy";
strcpy(destroyFuncName, udfName); strcpy(destroyFuncName, udfName);
strncat(destroyFuncName, destroySuffix, strlen(destroySuffix)); strncat(destroyFuncName, destroySuffix, TSDB_FUNC_NAME_LEN + 5 - strlen(destroyFuncName) - 1);
uv_dlsym(&udf->lib, destroyFuncName, (void **)(&udf->destroyFunc)); uv_dlsym(&udf->lib, destroyFuncName, (void **)(&udf->destroyFunc));
if (udf->funcType == TSDB_FUNC_TYPE_SCALAR) { if (udf->funcType == TSDB_FUNC_TYPE_SCALAR) {
...@@ -591,17 +591,17 @@ int32_t udfdLoadUdf(char *udfName, SUdf *udf) { ...@@ -591,17 +591,17 @@ int32_t udfdLoadUdf(char *udfName, SUdf *udf) {
char startFuncName[TSDB_FUNC_NAME_LEN + 6] = {0}; char startFuncName[TSDB_FUNC_NAME_LEN + 6] = {0};
char *startSuffix = "_start"; char *startSuffix = "_start";
strncpy(startFuncName, processFuncName, sizeof(startFuncName)); strncpy(startFuncName, processFuncName, sizeof(startFuncName));
strncat(startFuncName, startSuffix, strlen(startSuffix)); strncat(startFuncName, startSuffix, TSDB_FUNC_NAME_LEN + 6 - strlen(startSuffix) - 1);
uv_dlsym(&udf->lib, startFuncName, (void **)(&udf->aggStartFunc)); uv_dlsym(&udf->lib, startFuncName, (void **)(&udf->aggStartFunc));
char finishFuncName[TSDB_FUNC_NAME_LEN + 7] = {0}; char finishFuncName[TSDB_FUNC_NAME_LEN + 7] = {0};
char *finishSuffix = "_finish"; char *finishSuffix = "_finish";
strncpy(finishFuncName, processFuncName, sizeof(finishFuncName)); strncpy(finishFuncName, processFuncName, sizeof(finishFuncName));
strncat(finishFuncName, finishSuffix, strlen(finishSuffix)); strncat(finishFuncName, finishSuffix, TSDB_FUNC_NAME_LEN + 7 - strlen(finishFuncName) - 1);
uv_dlsym(&udf->lib, finishFuncName, (void **)(&udf->aggFinishFunc)); uv_dlsym(&udf->lib, finishFuncName, (void **)(&udf->aggFinishFunc));
char mergeFuncName[TSDB_FUNC_NAME_LEN + 6] = {0}; char mergeFuncName[TSDB_FUNC_NAME_LEN + 6] = {0};
char *mergeSuffix = "_merge"; char *mergeSuffix = "_merge";
strncpy(mergeFuncName, processFuncName, sizeof(mergeFuncName)); strncpy(mergeFuncName, processFuncName, sizeof(mergeFuncName));
strncat(mergeFuncName, mergeSuffix, strlen(mergeSuffix)); strncat(mergeFuncName, mergeSuffix, TSDB_FUNC_NAME_LEN + 6 - strlen(mergeFuncName) - 1);
uv_dlsym(&udf->lib, mergeFuncName, (void **)(&udf->aggMergeFunc)); uv_dlsym(&udf->lib, mergeFuncName, (void **)(&udf->aggMergeFunc));
} }
return 0; return 0;
......
...@@ -287,6 +287,10 @@ static int32_t collectMetaKeyFromDropTable(SCollectMetaKeyCxt* pCxt, SDropTableS ...@@ -287,6 +287,10 @@ static int32_t collectMetaKeyFromDropTable(SCollectMetaKeyCxt* pCxt, SDropTableS
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = reserveTableVgroupInCache(pCxt->pParseCxt->acctId, pClause->dbName, pClause->tableName, pCxt->pMetaCache); code = reserveTableVgroupInCache(pCxt->pParseCxt->acctId, pClause->dbName, pClause->tableName, pCxt->pMetaCache);
} }
if (TSDB_CODE_SUCCESS == code) {
code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pClause->dbName,
pClause->tableName, AUTH_TYPE_WRITE, pCxt->pMetaCache);
}
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
break; break;
} }
...@@ -294,6 +298,11 @@ static int32_t collectMetaKeyFromDropTable(SCollectMetaKeyCxt* pCxt, SDropTableS ...@@ -294,6 +298,11 @@ static int32_t collectMetaKeyFromDropTable(SCollectMetaKeyCxt* pCxt, SDropTableS
return code; return code;
} }
static int32_t collectMetaKeyFromDropStable(SCollectMetaKeyCxt* pCxt, SDropSuperTableStmt* pStmt) {
return reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pStmt->dbName, pStmt->tableName,
AUTH_TYPE_WRITE, pCxt->pMetaCache);
}
static int32_t collectMetaKeyFromAlterTable(SCollectMetaKeyCxt* pCxt, SAlterTableStmt* pStmt) { static int32_t collectMetaKeyFromAlterTable(SCollectMetaKeyCxt* pCxt, SAlterTableStmt* pStmt) {
int32_t code = reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache); int32_t code = reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
...@@ -302,6 +311,10 @@ static int32_t collectMetaKeyFromAlterTable(SCollectMetaKeyCxt* pCxt, SAlterTabl ...@@ -302,6 +311,10 @@ static int32_t collectMetaKeyFromAlterTable(SCollectMetaKeyCxt* pCxt, SAlterTabl
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = reserveTableVgroupInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, pCxt->pMetaCache); code = reserveTableVgroupInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, pCxt->pMetaCache);
} }
if (TSDB_CODE_SUCCESS == code) {
code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pStmt->dbName, pStmt->tableName,
AUTH_TYPE_WRITE, pCxt->pMetaCache);
}
return code; return code;
} }
...@@ -310,6 +323,10 @@ static int32_t collectMetaKeyFromAlterStable(SCollectMetaKeyCxt* pCxt, SAlterTab ...@@ -310,6 +323,10 @@ static int32_t collectMetaKeyFromAlterStable(SCollectMetaKeyCxt* pCxt, SAlterTab
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, pCxt->pMetaCache); code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, pCxt->pMetaCache);
} }
if (TSDB_CODE_SUCCESS == code) {
code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pStmt->dbName, pStmt->tableName,
AUTH_TYPE_WRITE, pCxt->pMetaCache);
}
return code; return code;
} }
...@@ -638,6 +655,8 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) { ...@@ -638,6 +655,8 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) {
return collectMetaKeyFromCreateMultiTable(pCxt, (SCreateMultiTablesStmt*)pStmt); return collectMetaKeyFromCreateMultiTable(pCxt, (SCreateMultiTablesStmt*)pStmt);
case QUERY_NODE_DROP_TABLE_STMT: case QUERY_NODE_DROP_TABLE_STMT:
return collectMetaKeyFromDropTable(pCxt, (SDropTableStmt*)pStmt); return collectMetaKeyFromDropTable(pCxt, (SDropTableStmt*)pStmt);
case QUERY_NODE_DROP_SUPER_TABLE_STMT:
return collectMetaKeyFromDropStable(pCxt, (SDropSuperTableStmt*)pStmt);
case QUERY_NODE_ALTER_TABLE_STMT: case QUERY_NODE_ALTER_TABLE_STMT:
return collectMetaKeyFromAlterTable(pCxt, (SAlterTableStmt*)pStmt); return collectMetaKeyFromAlterTable(pCxt, (SAlterTableStmt*)pStmt);
case QUERY_NODE_ALTER_SUPER_TABLE_STMT: case QUERY_NODE_ALTER_SUPER_TABLE_STMT:
......
...@@ -197,6 +197,29 @@ static int32_t authCreateMultiTable(SAuthCxt* pCxt, SCreateMultiTablesStmt* pStm ...@@ -197,6 +197,29 @@ static int32_t authCreateMultiTable(SAuthCxt* pCxt, SCreateMultiTablesStmt* pStm
return code; return code;
} }
static int32_t authDropTable(SAuthCxt* pCxt, SDropTableStmt* pStmt) {
int32_t code = TSDB_CODE_SUCCESS;
SNode* pNode = NULL;
FOREACH(pNode, pStmt->pTables) {
SDropTableClause* pClause = (SDropTableClause*)pNode;
code = checkAuth(pCxt, pClause->dbName, pClause->tableName, AUTH_TYPE_WRITE, NULL);
if (TSDB_CODE_SUCCESS != code) {
break;
}
}
return code;
}
static int32_t authDropStable(SAuthCxt* pCxt, SDropSuperTableStmt* pStmt) {
return checkAuth(pCxt, pStmt->dbName, pStmt->tableName, AUTH_TYPE_WRITE, NULL);
}
static int32_t authAlterTable(SAuthCxt* pCxt, SAlterTableStmt* pStmt) {
SNode* pTagCond = NULL;
// todo check tag condition for subtable
return checkAuth(pCxt, pStmt->dbName, pStmt->tableName, AUTH_TYPE_WRITE, NULL);
}
static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) { static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) {
switch (nodeType(pStmt)) { switch (nodeType(pStmt)) {
case QUERY_NODE_SET_OPERATOR: case QUERY_NODE_SET_OPERATOR:
...@@ -213,6 +236,13 @@ static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) { ...@@ -213,6 +236,13 @@ static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) {
return authCreateTable(pCxt, (SCreateTableStmt*)pStmt); return authCreateTable(pCxt, (SCreateTableStmt*)pStmt);
case QUERY_NODE_CREATE_MULTI_TABLES_STMT: case QUERY_NODE_CREATE_MULTI_TABLES_STMT:
return authCreateMultiTable(pCxt, (SCreateMultiTablesStmt*)pStmt); return authCreateMultiTable(pCxt, (SCreateMultiTablesStmt*)pStmt);
case QUERY_NODE_DROP_TABLE_STMT:
return authDropTable(pCxt, (SDropTableStmt*)pStmt);
case QUERY_NODE_DROP_SUPER_TABLE_STMT:
return authDropStable(pCxt, (SDropSuperTableStmt*)pStmt);
case QUERY_NODE_ALTER_TABLE_STMT:
case QUERY_NODE_ALTER_SUPER_TABLE_STMT:
return authAlterTable(pCxt, (SAlterTableStmt*)pStmt);
case QUERY_NODE_SHOW_DNODES_STMT: case QUERY_NODE_SHOW_DNODES_STMT:
case QUERY_NODE_SHOW_MNODES_STMT: case QUERY_NODE_SHOW_MNODES_STMT:
case QUERY_NODE_SHOW_MODULES_STMT: case QUERY_NODE_SHOW_MODULES_STMT:
......
...@@ -2022,7 +2022,7 @@ static int32_t buildInsertUserAuthReq(const char* pUser, SName* pName, SArray** ...@@ -2022,7 +2022,7 @@ static int32_t buildInsertUserAuthReq(const char* pUser, SName* pName, SArray**
SUserAuthInfo userAuth = {.type = AUTH_TYPE_WRITE}; SUserAuthInfo userAuth = {.type = AUTH_TYPE_WRITE};
snprintf(userAuth.user, sizeof(userAuth.user), "%s", pUser); snprintf(userAuth.user, sizeof(userAuth.user), "%s", pUser);
// tNameGetFullDbName(pName, userAuth.dbFName); memcpy(&userAuth.tbName, pName, sizeof(SName));
taosArrayPush(*pUserAuth, &userAuth); taosArrayPush(*pUserAuth, &userAuth);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
......
...@@ -1079,11 +1079,23 @@ static bool sortPriKeyOptMayBeOptimized(SLogicNode* pNode) { ...@@ -1079,11 +1079,23 @@ static bool sortPriKeyOptMayBeOptimized(SLogicNode* pNode) {
if (!sortPriKeyOptIsPriKeyOrderBy(pSort->pSortKeys) || 1 != LIST_LENGTH(pSort->node.pChildren)) { if (!sortPriKeyOptIsPriKeyOrderBy(pSort->pSortKeys) || 1 != LIST_LENGTH(pSort->node.pChildren)) {
return false; return false;
} }
SNode* pChild;
FOREACH(pChild, pSort->node.pChildren) {
SLogicNode* pSortDescendent = optFindPossibleNode((SLogicNode*)pChild, sortPriKeyOptMayBeOptimized);
if (pSortDescendent != NULL) {
return false;
}
}
return true; return true;
} }
static int32_t sortPriKeyOptGetSequencingNodesImpl(SLogicNode* pNode, bool groupSort, bool* pNotOptimize, static int32_t sortPriKeyOptGetSequencingNodesImpl(SLogicNode* pNode, bool groupSort, bool* pNotOptimize,
SNodeList** pSequencingNodes) { SNodeList** pSequencingNodes) {
if (NULL != pNode->pLimit || NULL != pNode->pSlimit) {
*pNotOptimize = false;
return TSDB_CODE_SUCCESS;
}
switch (nodeType(pNode)) { switch (nodeType(pNode)) {
case QUERY_NODE_LOGIC_PLAN_SCAN: { case QUERY_NODE_LOGIC_PLAN_SCAN: {
SScanLogicNode* pScan = (SScanLogicNode*)pNode; SScanLogicNode* pScan = (SScanLogicNode*)pNode;
......
...@@ -54,7 +54,6 @@ typedef enum { ...@@ -54,7 +54,6 @@ typedef enum {
#define SCHEDULE_DEFAULT_MAX_JOB_NUM 1000 #define SCHEDULE_DEFAULT_MAX_JOB_NUM 1000
#define SCHEDULE_DEFAULT_MAX_TASK_NUM 1000 #define SCHEDULE_DEFAULT_MAX_TASK_NUM 1000
#define SCHEDULE_DEFAULT_MAX_NODE_TABLE_NUM 200 // unit is TSDB_TABLE_NUM_UNIT
#define SCHEDULE_DEFAULT_POLICY SCH_LOAD_SEQ #define SCHEDULE_DEFAULT_POLICY SCH_LOAD_SEQ
#define SCHEDULE_DEFAULT_MAX_NODE_NUM 20 #define SCHEDULE_DEFAULT_MAX_NODE_NUM 20
...@@ -134,7 +133,7 @@ typedef struct SSchStatusFps { ...@@ -134,7 +133,7 @@ typedef struct SSchStatusFps {
typedef struct SSchedulerCfg { typedef struct SSchedulerCfg {
uint32_t maxJobNum; uint32_t maxJobNum;
int32_t maxNodeTableNum; int64_t maxNodeTableNum;
SCH_POLICY schPolicy; SCH_POLICY schPolicy;
bool enableReSchedule; bool enableReSchedule;
} SSchedulerCfg; } SSchedulerCfg;
...@@ -175,7 +174,7 @@ typedef struct SSchHbCallbackParam { ...@@ -175,7 +174,7 @@ typedef struct SSchHbCallbackParam {
typedef struct SSchFlowControl { typedef struct SSchFlowControl {
SRWLatch lock; SRWLatch lock;
bool sorted; bool sorted;
int32_t tableNumSum; int64_t tableNumSum;
uint32_t execTaskNum; uint32_t execTaskNum;
SArray *taskList; // Element is SSchTask* SArray *taskList; // Element is SSchTask*
} SSchFlowControl; } SSchFlowControl;
......
...@@ -46,7 +46,7 @@ int32_t schChkJobNeedFlowCtrl(SSchJob *pJob, SSchLevel *pLevel) { ...@@ -46,7 +46,7 @@ int32_t schChkJobNeedFlowCtrl(SSchJob *pJob, SSchLevel *pLevel) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t sum = 0; int64_t sum = 0;
int32_t taskNum = taosArrayGetSize(pJob->dataSrcTasks); int32_t taskNum = taosArrayGetSize(pJob->dataSrcTasks);
for (int32_t i = 0; i < taskNum; ++i) { for (int32_t i = 0; i < taskNum; ++i) {
SSchTask *pTask = *(SSchTask **)taosArrayGet(pJob->dataSrcTasks, i); SSchTask *pTask = *(SSchTask **)taosArrayGet(pJob->dataSrcTasks, i);
...@@ -55,7 +55,7 @@ int32_t schChkJobNeedFlowCtrl(SSchJob *pJob, SSchLevel *pLevel) { ...@@ -55,7 +55,7 @@ int32_t schChkJobNeedFlowCtrl(SSchJob *pJob, SSchLevel *pLevel) {
} }
if (schMgmt.cfg.maxNodeTableNum <= 0 || sum < schMgmt.cfg.maxNodeTableNum) { if (schMgmt.cfg.maxNodeTableNum <= 0 || sum < schMgmt.cfg.maxNodeTableNum) {
SCH_JOB_DLOG("job no need flow ctrl, totalTableNum:%d", sum); SCH_JOB_DLOG("job no need flow ctrl, totalTableNum:%" PRId64, sum);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -68,7 +68,7 @@ int32_t schChkJobNeedFlowCtrl(SSchJob *pJob, SSchLevel *pLevel) { ...@@ -68,7 +68,7 @@ int32_t schChkJobNeedFlowCtrl(SSchJob *pJob, SSchLevel *pLevel) {
SCH_SET_JOB_NEED_FLOW_CTRL(pJob); SCH_SET_JOB_NEED_FLOW_CTRL(pJob);
SCH_JOB_DLOG("job NEED flow ctrl, totalTableNum:%d", sum); SCH_JOB_DLOG("job NEED flow ctrl, totalTableNum:%" PRId64, sum);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -94,7 +94,7 @@ int32_t schDecTaskFlowQuota(SSchJob *pJob, SSchTask *pTask) { ...@@ -94,7 +94,7 @@ int32_t schDecTaskFlowQuota(SSchJob *pJob, SSchTask *pTask) {
--ctrl->execTaskNum; --ctrl->execTaskNum;
ctrl->tableNumSum -= pTask->plan->execNodeStat.tableNum; ctrl->tableNumSum -= pTask->plan->execNodeStat.tableNum;
SCH_TASK_DLOG("task quota removed, fqdn:%s, port:%d, tableNum:%d, remainNum:%d, remainExecTaskNum:%d", ep->fqdn, SCH_TASK_DLOG("task quota removed, fqdn:%s, port:%d, tableNum:%d, remainNum:%" PRId64 ", remainExecTaskNum:%d", ep->fqdn,
ep->port, pTask->plan->execNodeStat.tableNum, ctrl->tableNumSum, ctrl->execTaskNum); ep->port, pTask->plan->execNodeStat.tableNum, ctrl->tableNumSum, ctrl->execTaskNum);
_return: _return:
...@@ -125,7 +125,7 @@ int32_t schCheckIncTaskFlowQuota(SSchJob *pJob, SSchTask *pTask, bool *enough) { ...@@ -125,7 +125,7 @@ int32_t schCheckIncTaskFlowQuota(SSchJob *pJob, SSchTask *pTask, bool *enough) {
SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
} }
SCH_TASK_DLOG("task quota added, fqdn:%s, port:%d, tableNum:%d, remainNum:%d, remainExecTaskNum:%d", ep->fqdn, SCH_TASK_DLOG("task quota added, fqdn:%s, port:%d, tableNum:%d, remainNum:%" PRId64 ", remainExecTaskNum:%d", ep->fqdn,
ep->port, pTask->plan->execNodeStat.tableNum, nctrl.tableNumSum, nctrl.execTaskNum); ep->port, pTask->plan->execNodeStat.tableNum, nctrl.tableNumSum, nctrl.execTaskNum);
*enough = true; *enough = true;
...@@ -142,7 +142,7 @@ int32_t schCheckIncTaskFlowQuota(SSchJob *pJob, SSchTask *pTask, bool *enough) { ...@@ -142,7 +142,7 @@ int32_t schCheckIncTaskFlowQuota(SSchJob *pJob, SSchTask *pTask, bool *enough) {
break; break;
} }
int32_t sum = pTask->plan->execNodeStat.tableNum + ctrl->tableNumSum; int64_t sum = pTask->plan->execNodeStat.tableNum + ctrl->tableNumSum;
if (sum <= schMgmt.cfg.maxNodeTableNum) { if (sum <= schMgmt.cfg.maxNodeTableNum) {
ctrl->tableNumSum = sum; ctrl->tableNumSum = sum;
...@@ -173,7 +173,7 @@ int32_t schCheckIncTaskFlowQuota(SSchJob *pJob, SSchTask *pTask, bool *enough) { ...@@ -173,7 +173,7 @@ int32_t schCheckIncTaskFlowQuota(SSchJob *pJob, SSchTask *pTask, bool *enough) {
_return: _return:
SCH_TASK_DLOG("task quota %s added, fqdn:%s, port:%d, tableNum:%d, remainNum:%d, remainExecTaskNum:%d", SCH_TASK_DLOG("task quota %s added, fqdn:%s, port:%d, tableNum:%d, remainNum:%" PRId64 ", remainExecTaskNum:%d",
((*enough) ? "" : "NOT"), ep->fqdn, ep->port, pTask->plan->execNodeStat.tableNum, ctrl->tableNumSum, ((*enough) ? "" : "NOT"), ep->fqdn, ep->port, pTask->plan->execNodeStat.tableNum, ctrl->tableNumSum,
ctrl->execTaskNum); ctrl->execTaskNum);
...@@ -203,7 +203,7 @@ int32_t schLaunchTasksInFlowCtrlListImpl(SSchJob *pJob, SSchFlowControl *ctrl) { ...@@ -203,7 +203,7 @@ int32_t schLaunchTasksInFlowCtrlListImpl(SSchJob *pJob, SSchFlowControl *ctrl) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t remainNum = schMgmt.cfg.maxNodeTableNum - ctrl->tableNumSum; int64_t remainNum = schMgmt.cfg.maxNodeTableNum - ctrl->tableNumSum;
int32_t taskNum = taosArrayGetSize(ctrl->taskList); int32_t taskNum = taosArrayGetSize(ctrl->taskList);
int32_t code = 0; int32_t code = 0;
SSchTask *pTask = NULL; SSchTask *pTask = NULL;
...@@ -217,7 +217,7 @@ int32_t schLaunchTasksInFlowCtrlListImpl(SSchJob *pJob, SSchFlowControl *ctrl) { ...@@ -217,7 +217,7 @@ int32_t schLaunchTasksInFlowCtrlListImpl(SSchJob *pJob, SSchFlowControl *ctrl) {
SEp *ep = SCH_GET_CUR_EP(&pTask->plan->execNode); SEp *ep = SCH_GET_CUR_EP(&pTask->plan->execNode);
if (pTask->plan->execNodeStat.tableNum > remainNum && ctrl->execTaskNum > 0) { if (pTask->plan->execNodeStat.tableNum > remainNum && ctrl->execTaskNum > 0) {
SCH_TASK_DLOG("task NOT to launch, fqdn:%s, port:%d, tableNum:%d, remainNum:%d, remainExecTaskNum:%d", ep->fqdn, SCH_TASK_DLOG("task NOT to launch, fqdn:%s, port:%d, tableNum:%d, remainNum:%" PRId64 ", remainExecTaskNum:%d", ep->fqdn,
ep->port, pTask->plan->execNodeStat.tableNum, ctrl->tableNumSum, ctrl->execTaskNum); ep->port, pTask->plan->execNodeStat.tableNum, ctrl->tableNumSum, ctrl->execTaskNum);
continue; continue;
...@@ -228,14 +228,14 @@ int32_t schLaunchTasksInFlowCtrlListImpl(SSchJob *pJob, SSchFlowControl *ctrl) { ...@@ -228,14 +228,14 @@ int32_t schLaunchTasksInFlowCtrlListImpl(SSchJob *pJob, SSchFlowControl *ctrl) {
taosArrayRemove(ctrl->taskList, i); taosArrayRemove(ctrl->taskList, i);
SCH_TASK_DLOG("task to launch, fqdn:%s, port:%d, tableNum:%d, remainNum:%d, remainExecTaskNum:%d", ep->fqdn, SCH_TASK_DLOG("task to launch, fqdn:%s, port:%d, tableNum:%d, remainNum:%" PRId64 ", remainExecTaskNum:%d", ep->fqdn,
ep->port, pTask->plan->execNodeStat.tableNum, ctrl->tableNumSum, ctrl->execTaskNum); ep->port, pTask->plan->execNodeStat.tableNum, ctrl->tableNumSum, ctrl->execTaskNum);
SCH_ERR_JRET(schAsyncLaunchTaskImpl(pJob, pTask)); SCH_ERR_JRET(schAsyncLaunchTaskImpl(pJob, pTask));
remainNum -= pTask->plan->execNodeStat.tableNum; remainNum -= pTask->plan->execNodeStat.tableNum;
if (remainNum <= 0) { if (remainNum <= 0) {
SCH_TASK_DLOG("no more task to launch, fqdn:%s, port:%d, remainNum:%d, remainExecTaskNum:%d", ep->fqdn, ep->port, SCH_TASK_DLOG("no more task to launch, fqdn:%s, port:%d, remainNum:%" PRId64 ", remainExecTaskNum:%d", ep->fqdn, ep->port,
ctrl->tableNumSum, ctrl->execTaskNum); ctrl->tableNumSum, ctrl->execTaskNum);
break; break;
...@@ -244,7 +244,7 @@ int32_t schLaunchTasksInFlowCtrlListImpl(SSchJob *pJob, SSchFlowControl *ctrl) { ...@@ -244,7 +244,7 @@ int32_t schLaunchTasksInFlowCtrlListImpl(SSchJob *pJob, SSchFlowControl *ctrl) {
if (i < (taskNum - 1)) { if (i < (taskNum - 1)) {
SSchTask *pLastTask = *(SSchTask **)taosArrayGetLast(ctrl->taskList); SSchTask *pLastTask = *(SSchTask **)taosArrayGetLast(ctrl->taskList);
if (remainNum < pLastTask->plan->execNodeStat.tableNum) { if (remainNum < pLastTask->plan->execNodeStat.tableNum) {
SCH_TASK_DLOG("no more task to launch, fqdn:%s, port:%d, remainNum:%d, remainExecTaskNum:%d, smallestInList:%d", SCH_TASK_DLOG("no more task to launch, fqdn:%s, port:%d, remainNum:%" PRId64 ", remainExecTaskNum:%d, smallestInList:%d",
ep->fqdn, ep->port, ctrl->tableNumSum, ctrl->execTaskNum, pLastTask->plan->execNodeStat.tableNum); ep->fqdn, ep->port, ctrl->tableNumSum, ctrl->execTaskNum, pLastTask->plan->execNodeStat.tableNum);
break; break;
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "schInt.h" #include "schInt.h"
#include "tmsg.h" #include "tmsg.h"
#include "tref.h" #include "tref.h"
#include "tglobal.h"
SSchedulerMgmt schMgmt = { SSchedulerMgmt schMgmt = {
.jobRef = -1, .jobRef = -1,
...@@ -30,11 +31,12 @@ int32_t schedulerInit() { ...@@ -30,11 +31,12 @@ int32_t schedulerInit() {
} }
schMgmt.cfg.maxJobNum = SCHEDULE_DEFAULT_MAX_JOB_NUM; schMgmt.cfg.maxJobNum = SCHEDULE_DEFAULT_MAX_JOB_NUM;
schMgmt.cfg.maxNodeTableNum = SCHEDULE_DEFAULT_MAX_NODE_TABLE_NUM; schMgmt.cfg.maxNodeTableNum = tsQueryMaxConcurrentTables;
schMgmt.cfg.schPolicy = SCHEDULE_DEFAULT_POLICY; schMgmt.cfg.schPolicy = SCHEDULE_DEFAULT_POLICY;
schMgmt.cfg.enableReSchedule = true; schMgmt.cfg.enableReSchedule = true;
qDebug("schedule policy init to %d", schMgmt.cfg.schPolicy); qDebug("schedule init, policy: %d, maxNodeTableNum: %" PRId64", reSchedule:%d",
schMgmt.cfg.schPolicy, schMgmt.cfg.maxNodeTableNum, schMgmt.cfg.enableReSchedule);
schMgmt.jobRef = taosOpenRef(schMgmt.cfg.maxJobNum, schFreeJobImpl); schMgmt.jobRef = taosOpenRef(schMgmt.cfg.maxJobNum, schFreeJobImpl);
if (schMgmt.jobRef < 0) { if (schMgmt.jobRef < 0) {
......
...@@ -209,17 +209,12 @@ int32_t walReadSeekVer(SWalReader *pReader, int64_t ver) { ...@@ -209,17 +209,12 @@ int32_t walReadSeekVer(SWalReader *pReader, int64_t ver) {
return 0; return 0;
} }
// pReader->curInvalid = 1;
// pReader->curVersion = ver;
if (ver > pWal->vers.lastVer || ver < pWal->vers.firstVer) { if (ver > pWal->vers.lastVer || ver < pWal->vers.firstVer) {
wDebug("vgId:%d, invalid index:%" PRId64 ", first index:%" PRId64 ", last index:%" PRId64, pReader->pWal->cfg.vgId, wInfo("vgId:%d, invalid index:%" PRId64 ", first index:%" PRId64 ", last index:%" PRId64, pReader->pWal->cfg.vgId,
ver, pWal->vers.firstVer, pWal->vers.lastVer); ver, pWal->vers.firstVer, pWal->vers.lastVer);
terrno = TSDB_CODE_WAL_LOG_NOT_EXIST; terrno = TSDB_CODE_WAL_LOG_NOT_EXIST;
return -1; return -1;
} }
// if (ver < pWal->vers.snapshotVer) {
// }
if (walReadSeekVerImpl(pReader, ver) < 0) { if (walReadSeekVerImpl(pReader, ver) < 0) {
return -1; return -1;
...@@ -238,8 +233,6 @@ static int32_t walFetchHeadNew(SWalReader *pRead, int64_t fetchVer) { ...@@ -238,8 +233,6 @@ static int32_t walFetchHeadNew(SWalReader *pRead, int64_t fetchVer) {
if (pRead->curVersion != fetchVer) { if (pRead->curVersion != fetchVer) {
if (walReadSeekVer(pRead, fetchVer) < 0) { if (walReadSeekVer(pRead, fetchVer) < 0) {
// pRead->curVersion = fetchVer;
// pRead->curInvalid = 1;
return -1; return -1;
} }
seeked = true; seeked = true;
...@@ -258,7 +251,6 @@ static int32_t walFetchHeadNew(SWalReader *pRead, int64_t fetchVer) { ...@@ -258,7 +251,6 @@ static int32_t walFetchHeadNew(SWalReader *pRead, int64_t fetchVer) {
} else { } else {
terrno = TSDB_CODE_WAL_FILE_CORRUPTED; terrno = TSDB_CODE_WAL_FILE_CORRUPTED;
} }
// pRead->curInvalid = 1;
return -1; return -1;
} }
} }
......
...@@ -875,6 +875,7 @@ ...@@ -875,6 +875,7 @@
,,y,script,./test.sh -f tsim/query/udf_with_const.sim ,,y,script,./test.sh -f tsim/query/udf_with_const.sim
,,y,script,./test.sh -f tsim/query/join_interval.sim ,,y,script,./test.sh -f tsim/query/join_interval.sim
,,y,script,./test.sh -f tsim/query/unionall_as_table.sim ,,y,script,./test.sh -f tsim/query/unionall_as_table.sim
,,y,script,./test.sh -f tsim/query/multi_order_by.sim
,,y,script,./test.sh -f tsim/query/sys_tbname.sim ,,y,script,./test.sh -f tsim/query/sys_tbname.sim
,,y,script,./test.sh -f tsim/query/groupby.sim ,,y,script,./test.sh -f tsim/query/groupby.sim
,,y,script,./test.sh -f tsim/query/event.sim ,,y,script,./test.sh -f tsim/query/event.sim
......
...@@ -51,10 +51,7 @@ class AutoGen: ...@@ -51,10 +51,7 @@ class AutoGen:
metas = [] metas = []
for i in range(cnt): for i in range(cnt):
colname = f"{pre}{i}" colname = f"{pre}{i}"
if i < len(types): sel = i % len(types)
sel = i
else:
sel = random.randint(0, len(types)-1)
coltype = types[sel] coltype = types[sel]
sql = f"{colname} {coltype}" sql = f"{colname} {coltype}"
if sqls != "": if sqls != "":
......
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect
sql create database test;
sql use test;
sql create table t(ts timestamp, f int);
sql insert into t values(now,0)(now+1s, 1)(now+2s, 2)(now+3s,3)(now+4s,4)(now+5s,5)(now+6s,6)(now+7s,7)(now+8s,8)(now+9s,9)
sql select * from (select * from t order by ts desc limit 3 offset 2) order by ts;
print $data01 $data11 $data21
if $data01 != 5 then
return -1
endi
if $data11 != 6 then
return -1
endi
if $data21 != 7 then
return -1
endi
sql select * from (select * from t order by ts limit 3 offset 2) order by ts desc;
print $data01 $data11 $data21
if $data01 != 4 then
return -1
endi
if $data11 != 3 then
return -1
endi
if $data21 != 2 then
return -1
endi
sql select * from (select * from t order by ts desc limit 3 offset 2) order by ts desc;
print $data01 $data11 $data21
if $data01 != 7 then
return -1
endi
if $data11 != 6 then
return -1
endi
if $data21 != 5 then
return -1
endi
sql select * from (select * from t order by ts limit 3 offset 2) order by ts;
print $data01 $data11 $data21
if $data01 != 2 then
return -1
endi
if $data11 != 3 then
return -1
endi
if $data21 != 4 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
# start -N3
echo " ********** -N 3 *************"
python3 ./test.py -f 7-tmq/tmqDelete-multiCtb.py -N 3 -n 3
python3 ./test.py -f 1-insert/alter_database.py -P
python3 ./test.py -f 1-insert/influxdb_line_taosc_insert.py -P
python3 ./test.py -f 1-insert/opentsdb_telnet_line_taosc_insert.py -P
python3 ./test.py -f 1-insert/opentsdb_json_taosc_insert.py -P
python3 ./test.py -f 1-insert/test_stmt_muti_insert_query.py -P
python3 ./test.py -f 1-insert/test_stmt_set_tbname_tag.py -P
python3 ./test.py -f 1-insert/alter_stable.py -P
python3 ./test.py -f 1-insert/alter_table.py -P
python3 ./test.py -f 1-insert/boundary.py -P
python3 ./test.py -f 1-insert/insertWithMoreVgroup.py -P
python3 ./test.py -f 1-insert/table_comment.py -P
python3 ./test.py -f 1-insert/time_range_wise.py -P
python3 ./test.py -f 1-insert/block_wise.py -P
python3 ./test.py -f 1-insert/create_retentions.py -P
python3 ./test.py -f 1-insert/mutil_stage.py -P
python3 ./test.py -f 1-insert/table_param_ttl.py -P
python3 ./test.py -f 1-insert/table_param_ttl.py -P -R
python3 ./test.py -f 1-insert/update_data_muti_rows.py -P
python3 ./test.py -f 1-insert/db_tb_name_check.py -P
python3 ./test.py -f 1-insert/InsertFuturets.py -P
python3 ./test.py -f 1-insert/insert_wide_column.py -P
python3 ./test.py -f 2-query/nestedQuery.py -P
python3 ./test.py -f 2-query/nestedQuery_str.py -P
python3 ./test.py -f 2-query/nestedQuery_math.py -P
python3 ./test.py -f 2-query/nestedQuery_time.py -P
python3 ./test.py -f 2-query/nestedQuery_26.py -P
python3 ./test.py -f 2-query/nestedQuery_str.py -P -Q 2
python3 ./test.py -f 2-query/nestedQuery_math.py -P -Q 2
python3 ./test.py -f 2-query/nestedQuery_time.py -P -Q 2
python3 ./test.py -f 2-query/nestedQuery.py -P -Q 2
python3 ./test.py -f 2-query/nestedQuery_26.py -P -Q 2
python3 ./test.py -f 2-query/columnLenUpdated.py -P
python3 ./test.py -f 2-query/columnLenUpdated.py -P -Q 2
python3 ./test.py -f 2-query/columnLenUpdated.py -P -Q 3
python3 ./test.py -f 2-query/columnLenUpdated.py -P -Q 4
python3 ./test.py -f 2-query/nestedQuery.py -P -Q 4
python3 ./test.py -f 2-query/nestedQuery_str.py -P -Q 4
python3 ./test.py -f 2-query/nestedQuery_math.py -P -Q 4
python3 ./test.py -f 2-query/nestedQuery_time.py -P -Q 4
python3 ./test.py -f 2-query/nestedQuery_26.py -P -Q 4
python3 ./test.py -f 7-tmq/tmqShow.py -P
python3 ./test.py -f 7-tmq/tmqDropStb.py -P
python3 ./test.py -f 7-tmq/subscribeStb0.py -P
python3 ./test.py -f 7-tmq/subscribeStb1.py -P
python3 ./test.py -f 7-tmq/subscribeStb2.py -P
python3 ./test.py -f 7-tmq/subscribeStb3.py -P
python3 ./test.py -f 7-tmq/subscribeDb0.py -P -N 3 -n 3
python3 ./test.py -f 1-insert/delete_stable.py -P
python3 ./test.py -f 2-query/out_of_order.py -P -Q 3
python3 ./test.py -f 2-query/out_of_order.py -P
python3 ./test.py -f 2-query/insert_null_none.py -P
python3 ./test.py -f 2-query/insert_null_none.py -P -R
python3 ./test.py -f 2-query/insert_null_none.py -P -Q 2
python3 ./test.py -f 2-query/insert_null_none.py -P -Q 3
python3 ./test.py -f 2-query/insert_null_none.py -P -Q 4
python3 ./test.py -f 1-insert/database_pre_suf.py -P
python3 ./test.py -f 2-query/concat.py -P -Q 3
python3 ./test.py -f 2-query/out_of_order.py -P -Q 2
python3 ./test.py -f 2-query/out_of_order.py -P -Q 4
python3 ./test.py -f 2-query/nestedQuery.py -P -Q 3
python3 ./test.py -f 2-query/nestedQuery_str.py -P -Q 3
python3 ./test.py -f 2-query/nestedQuery_math.py -P -Q 3
python3 ./test.py -f 2-query/nestedQuery_time.py -P -Q 3
python3 ./test.py -f 2-query/nestedQuery_26.py -P -Q 3
python3 ./test.py -f 7-tmq/create_wrong_topic.py -P
python3 ./test.py -f 7-tmq/dropDbR3ConflictTransaction.py -P -N 3
python3 ./test.py -f 7-tmq/basic5.py -P
python3 ./test.py -f 7-tmq/subscribeDb.py -P -N 3 -n 3
python3 ./test.py -f 7-tmq/subscribeDb1.py -P
python3 ./test.py -f 7-tmq/subscribeDb2.py -P
python3 ./test.py -f 7-tmq/subscribeDb3.py -P
python3 ./test.py -f 7-tmq/subscribeDb4.py -P
python3 ./test.py -f 7-tmq/subscribeStb.py -P
python3 ./test.py -f 7-tmq/subscribeStb4.py -P
python3 ./test.py -f 7-tmq/db.py -P
python3 ./test.py -f 7-tmq/tmqError.py -P
python3 ./test.py -f 7-tmq/schema.py -P
python3 ./test.py -f 7-tmq/stbFilter.py -P
python3 ./test.py -f 7-tmq/tmqCheckData.py -P
python3 ./test.py -f 7-tmq/tmqCheckData1.py -P
python3 ./test.py -f 7-tmq/tmqConsumerGroup.py -P
python3 ./test.py -f 7-tmq/tmqAlterSchema.py -P
python3 ./test.py -f 7-tmq/tmqConsFromTsdb.py -P -N 3 -n 3
python3 ./test.py -f 7-tmq/tmqConsFromTsdb1.py -P -N 3 -n 3
python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg.py -P
python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg.py -P
python3 ./test.py -f 7-tmq/tmqConsFromTsdb-1ctb.py -P
python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-1ctb.py -P
python3 ./test.py -f 7-tmq/tmqConsFromTsdb-1ctb-funcNFilter.py -P
python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg-mutilCtb-funcNFilter.py -P
python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg-mutilCtb.py -P
python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-1ctb-funcNFilter.py -P
python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb-funcNFilter.py -P
python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py -P
python3 ./test.py -f 7-tmq/tmqAutoCreateTbl.py -P
python3 ./test.py -f 7-tmq/tmqDnodeRestart.py -P
python3 ./test.py -f 7-tmq/tmqDnodeRestart1.py -P
python3 ./test.py -f 7-tmq/tmqUpdate-1ctb.py -P
python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot0.py -P
python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot1.py -P
python3 ./test.py -f 7-tmq/tmqDropStbCtb.py -P
python3 ./test.py -f 7-tmq/tmqDropNtb-snapshot0.py -P
python3 ./test.py -f 7-tmq/tmqDropNtb-snapshot1.py -P
python3 ./test.py -f 7-tmq/tmqUdf-multCtb-snapshot0.py -P
python3 ./test.py -f 7-tmq/tmqUdf-multCtb-snapshot1.py -P
python3 ./test.py -f 7-tmq/stbTagFilter-1ctb.py -P
python3 ./test.py -f 7-tmq/dataFromTsdbNWal.py -P
python3 ./test.py -f 7-tmq/dataFromTsdbNWal-multiCtb.py -P
python3 ./test.py -f 7-tmq/tmq_taosx.py -P
python3 ./test.py -f 7-tmq/raw_block_interface_test.py -P
python3 ./test.py -f 7-tmq/stbTagFilter-multiCtb.py -P
python3 ./test.py -f 99-TDcase/TD-19201.py -P
python3 ./test.py -f 99-TDcase/TD-21561.py -P
python3 ./test.py -f 0-others/taosShell.py -P
python3 ./test.py -f 0-others/taosShellError.py -P
python3 ./test.py -f 0-others/taosShellNetChk.py -P
python3 ./test.py -f 0-others/telemetry.py -P
python3 ./test.py -f 0-others/backquote_check.py -P
python3 ./test.py -f 0-others/taosdMonitor.py -P
python3 ./test.py -f 0-others/udfTest.py -P
python3 ./test.py -f 0-others/udf_create.py -P
python3 ./test.py -f 0-others/udf_restart_taosd.py -P
python3 ./test.py -f 0-others/udf_cfg1.py -P
python3 ./test.py -f 0-others/udf_cfg2.py -P
python3 ./test.py -f 0-others/cachemodel.py -P
python3 ./test.py -f 0-others/sysinfo.py -P
python3 ./test.py -f 0-others/user_control.py -P
python3 ./test.py -f 0-others/user_manage.py -P
python3 ./test.py -f 0-others/fsync.py -P
python3 ./test.py -f 0-others/tag_index_basic.py -P
python3 ./test.py -f 0-others/show.py -P
python3 ./test.py -f 0-others/information_schema.py -P
python3 ./test.py -f 2-query/abs.py -P
python3 ./test.py -f 2-query/abs.py -P -R
python3 ./test.py -f 2-query/and_or_for_byte.py -P
python3 ./test.py -f 2-query/and_or_for_byte.py -P -R
python3 ./test.py -f 2-query/apercentile.py -P
python3 ./test.py -f 2-query/apercentile.py -P -R
python3 ./test.py -f 2-query/arccos.py -P
python3 ./test.py -f 2-query/arccos.py -P -R
python3 ./test.py -f 2-query/arcsin.py -P
python3 ./test.py -f 2-query/arcsin.py -P -R
python3 ./test.py -f 2-query/arctan.py -P
python3 ./test.py -f 2-query/arctan.py -P -R
python3 ./test.py -f 2-query/avg.py -P
python3 ./test.py -f 2-query/avg.py -P -R
python3 ./test.py -f 2-query/between.py -P
python3 ./test.py -f 2-query/between.py -P -R
python3 ./test.py -f 2-query/bottom.py -P
python3 ./test.py -f 2-query/bottom.py -P -R
python3 ./test.py -f 2-query/cast.py -P
python3 ./test.py -f 2-query/cast.py -P -R
python3 ./test.py -f 2-query/ceil.py -P
python3 ./test.py -f 2-query/ceil.py -P -R
python3 ./test.py -f 2-query/char_length.py -P
python3 ./test.py -f 2-query/char_length.py -P -R
python3 ./test.py -f 2-query/check_tsdb.py -P
python3 ./test.py -f 2-query/check_tsdb.py -P -R
python3 ./test.py -f 2-query/concat.py -P
python3 ./test.py -f 2-query/concat.py -P -R
python3 ./test.py -f 2-query/concat_ws.py -P
python3 ./test.py -f 2-query/concat_ws.py -P -R
python3 ./test.py -f 2-query/concat_ws2.py -P
python3 ./test.py -f 2-query/concat_ws2.py -P -R
python3 ./test.py -f 2-query/cos.py -P
python3 ./test.py -f 2-query/cos.py -P -R
python3 ./test.py -f 2-query/count_partition.py -P
python3 ./test.py -f 2-query/count_partition.py -P -R
python3 ./test.py -f 2-query/count.py -P
python3 ./test.py -f 2-query/count.py -P -R
python3 ./test.py -f 2-query/countAlwaysReturnValue.py -P
python3 ./test.py -f 2-query/countAlwaysReturnValue.py -P -R
python3 ./test.py -f 2-query/db.py -P
python3 ./test.py -f 2-query/diff.py -P
python3 ./test.py -f 2-query/diff.py -P -R
python3 ./test.py -f 2-query/distinct.py -P
python3 ./test.py -f 2-query/distinct.py -P -R
python3 ./test.py -f 2-query/distribute_agg_apercentile.py -P
python3 ./test.py -f 2-query/distribute_agg_apercentile.py -P -R
python3 ./test.py -f 2-query/distribute_agg_avg.py -P
python3 ./test.py -f 2-query/distribute_agg_avg.py -P -R
python3 ./test.py -f 2-query/distribute_agg_count.py -P
python3 ./test.py -f 2-query/distribute_agg_count.py -P -R
python3 ./test.py -f 2-query/distribute_agg_max.py -P
python3 ./test.py -f 2-query/distribute_agg_max.py -P -R
python3 ./test.py -f 2-query/distribute_agg_min.py -P
python3 ./test.py -f 2-query/distribute_agg_min.py -P -R
python3 ./test.py -f 2-query/distribute_agg_spread.py -P
python3 ./test.py -f 2-query/distribute_agg_spread.py -P -R
python3 ./test.py -f 2-query/distribute_agg_stddev.py -P
python3 ./test.py -f 2-query/distribute_agg_stddev.py -P -R
python3 ./test.py -f 2-query/distribute_agg_sum.py -P
python3 ./test.py -f 2-query/distribute_agg_sum.py -P -R
python3 ./test.py -f 2-query/explain.py -P
python3 ./test.py -f 2-query/explain.py -P -R
python3 ./test.py -f 2-query/first.py -P
python3 ./test.py -f 2-query/first.py -P -R
python3 ./test.py -f 2-query/floor.py -P
python3 ./test.py -f 2-query/floor.py -P -R
python3 ./test.py -f 2-query/function_null.py -P
python3 ./test.py -f 2-query/function_null.py -P -R
python3 ./test.py -f 2-query/function_stateduration.py -P
python3 ./test.py -f 2-query/function_stateduration.py -P -R
python3 ./test.py -f 2-query/histogram.py -P
python3 ./test.py -f 2-query/histogram.py -P -R
python3 ./test.py -f 2-query/hyperloglog.py -P
python3 ./test.py -f 2-query/hyperloglog.py -P -R
python3 ./test.py -f 2-query/interp.py -P
python3 ./test.py -f 2-query/interp.py -P -R
python3 ./test.py -f 2-query/irate.py -P
python3 ./test.py -f 2-query/irate.py -P -R
python3 ./test.py -f 2-query/join.py -P
python3 ./test.py -f 2-query/join.py -P -R
python3 ./test.py -f 2-query/last_row.py -P
python3 ./test.py -f 2-query/last_row.py -P -R
python3 ./test.py -f 2-query/last.py -P
python3 ./test.py -f 2-query/last.py -P -R
python3 ./test.py -f 2-query/leastsquares.py -P
python3 ./test.py -f 2-query/leastsquares.py -P -R
python3 ./test.py -f 2-query/length.py -P
python3 ./test.py -f 2-query/length.py -P -R
python3 ./test.py -f 2-query/limit.py -P
python3 ./test.py -f 2-query/log.py -P
python3 ./test.py -f 2-query/log.py -P -R
python3 ./test.py -f 2-query/lower.py -P
python3 ./test.py -f 2-query/lower.py -P -R
python3 ./test.py -f 2-query/ltrim.py -P
python3 ./test.py -f 2-query/ltrim.py -P -R
python3 ./test.py -f 2-query/mavg.py -P
python3 ./test.py -f 2-query/mavg.py -P -R
python3 ./test.py -f 2-query/max_partition.py -P
python3 ./test.py -f 2-query/max_partition.py -P -R
python3 ./test.py -f 2-query/max_min_last_interval.py -P
python3 ./test.py -f 2-query/last_row_interval.py -P
python3 ./test.py -f 2-query/max.py -P
python3 ./test.py -f 2-query/max.py -P -R
python3 ./test.py -f 2-query/min.py -P
python3 ./test.py -f 2-query/min.py -P -R
python3 ./test.py -f 2-query/mode.py -P
python3 ./test.py -f 2-query/mode.py -P -R
python3 ./test.py -f 2-query/Now.py -P
python3 ./test.py -f 2-query/Now.py -P -R
python3 ./test.py -f 2-query/percentile.py -P
python3 ./test.py -f 2-query/percentile.py -P -R
python3 ./test.py -f 2-query/pow.py -P
python3 ./test.py -f 2-query/pow.py -P -R
python3 ./test.py -f 2-query/query_cols_tags_and_or.py -P
python3 ./test.py -f 2-query/query_cols_tags_and_or.py -P -R
python3 ./test.py -f 2-query/round.py -P
python3 ./test.py -f 2-query/round.py -P -R
python3 ./test.py -f 2-query/rtrim.py -P
python3 ./test.py -f 2-query/rtrim.py -P -R
python3 ./test.py -f 1-insert/drop.py -P -N 3 -M 3 -i False -n 3
python3 ./test.py -f 7-tmq/tmqUpdateWithConsume.py -P -N 3 -n 3
python3 ./test.py -f 2-query/db.py -P -N 3 -n 3 -R
python3 ./test.py -f 2-query/stablity.py -P
python3 ./test.py -f 2-query/stablity_1.py -P
python3 ./test.py -f 2-query/elapsed.py -P
python3 ./test.py -f 2-query/csum.py -P
python3 ./test.py -f 2-query/function_diff.py -P
python3 ./test.py -f 2-query/tagFilter.py -P
python3 ./test.py -f 2-query/projectionDesc.py -P
python3 ./test.py -f 2-query/queryQnode.py -P
python3 ./test.py -f 6-cluster/5dnode1mnode.py -P
# -N 4
echo " ********** -N 4 *************"
python3 ./test.py -f 6-cluster/vnode/4dnode1mnode_basic_createDb_replica1.py -N 4 -M 1
python3 ./test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas.py -P -N 4 -M 1
python3 ./test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas_querys.py -P -N 4 -M 1
python3 ./test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas.py -P -N 4 -M 1
python3 ./test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys.py -P -N 4 -M 1
python3 ./test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups.py -P -N 4 -M 1
python3 ./test.py -f 2-query/varchar.py -P -R
python3 ./test.py -f 2-query/case_when.py -P
python3 ./test.py -f 2-query/case_when.py -P -R
python3 ./test.py -f 2-query/blockSMA.py -P
python3 ./test.py -f 2-query/blockSMA.py -P -R
python3 ./test.py -f 2-query/projectionDesc.py -P
python3 ./test.py -f 2-query/projectionDesc.py -P -R
python3 ./test.py -f 1-insert/update_data.py -P
python3 ./test.py -f 1-insert/tb_100w_data_order.py -P
python3 ./test.py -f 1-insert/delete_childtable.py -P
python3 ./test.py -f 1-insert/delete_normaltable.py -P
python3 ./test.py -f 1-insert/keep_expired.py -P
python3 ./test.py -f 1-insert/drop.py -P
python3 ./test.py -f 2-query/join2.py -P
python3 ./test.py -f 2-query/union1.py -P
python3 ./test.py -f 2-query/concat2.py -P
python3 ./test.py -f 2-query/json_tag.py -P
python3 ./test.py -f 2-query/nestedQueryInterval.py -P
# -N 5
echo " ********** -N 5 *************"
python3 ./test.py -f 6-cluster/5dnode2mnode.py -P -N 5
python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -P -N 5 -M 3 -i False
python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -P -N 5 -M 3
python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -P -N 5 -M 3 -i False
python3 ./test.py -f 6-cluster/5dnode3mnodeStopLoop.py -P -N 5 -M 3
python3 ./test.py -f 6-cluster/5dnode3mnodeRecreateMnode.py -P -N 5 -M 3
python3 ./test.py -f 6-cluster/5dnode3mnodeStopFollowerLeader.py -P -N 5 -M 3
python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -P -N 5 -M 3
python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -P -N 5 -M 3
python3 ./test.py -f 0-others/taosdShell.py -P -N 5 -M 3 -Q 3
python3 ./test.py -f 7-tmq/tmqSubscribeStb-r3.py -P -N 5
python3 ./test.py -f 2-query/timezone.py -P
python3 ./test.py -f 2-query/timezone.py -P -R
python3 ./test.py -f 2-query/To_iso8601.py -P
python3 ./test.py -f 2-query/To_iso8601.py -P -R
python3 ./test.py -f 2-query/To_unixtimestamp.py -P
python3 ./test.py -f 2-query/To_unixtimestamp.py -P -R
python3 ./test.py -f 2-query/Today.py -P
python3 ./test.py -f 2-query/Today.py -P -R
python3 ./test.py -f 2-query/top.py -P
python3 ./test.py -f 2-query/top.py -P -R
python3 ./test.py -f 2-query/tsbsQuery.py -P
python3 ./test.py -f 2-query/tsbsQuery.py -P -R
python3 ./test.py -f 2-query/ttl_comment.py -P
python3 ./test.py -f 2-query/ttl_comment.py -P -R
python3 ./test.py -f 2-query/twa.py -P
python3 ./test.py -f 2-query/twa.py -P -R
python3 ./test.py -f 2-query/union.py -P
python3 ./test.py -f 2-query/union.py -P -R
python3 ./test.py -f 2-query/unique.py -P
python3 ./test.py -f 2-query/unique.py -P -R
python3 ./test.py -f 2-query/upper.py -P
python3 ./test.py -f 2-query/upper.py -P -R
python3 ./test.py -f 2-query/varchar.py -P
# -N6
echo " ********** -N 6 *************"
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py -N 6 -M 3
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py -P -N 6 -M 3 -n 3
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -P -N 6 -M 3
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -P -N 6 -M 3 -n 3
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py -P -N 6 -M 3
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py -P -N 6 -M 3 -n 3
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeModifyMeta.py -P -N 6 -M 3
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeModifyMeta.py -P -N 6 -M 3
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py -P -N 6 -M 3
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py -P -N 6 -M 3 -n 3
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py -P -N 6 -M 3
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py -P -N 6 -M 3 -n 3
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py -P -N 6 -M 3
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py -P -N 6 -M 3 -n 3
python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertData.py -P -N 6 -M 3
python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertData.py -P -N 6 -M 3 -n 3
python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -P -N 6 -M 3
python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -P -N 6 -M 3 -n 3
python3 ./test.py -f 7-tmq/tmq3mnodeSwitch.py -P -N 6 -M 3
python3 ./test.py -f 7-tmq/tmq3mnodeSwitch.py -P -N 6 -M 3 -n 3
python3 ./test.py -f 0-others/balance_vgroups_r1.py -P -N 6
python3 ./test.py -f 2-query/sample.py -P
python3 ./test.py -f 2-query/sample.py -P -R
python3 ./test.py -f 2-query/sin.py -P
python3 ./test.py -f 2-query/sin.py -P -R
python3 ./test.py -f 2-query/smaTest.py -P
python3 ./test.py -f 2-query/smaTest.py -P -R
python3 ./test.py -f 2-query/sml.py -P
python3 ./test.py -f 2-query/sml.py -P -R
python3 ./test.py -f 2-query/spread.py -P
python3 ./test.py -f 2-query/spread.py -P -R
python3 ./test.py -f 2-query/sqrt.py -P
python3 ./test.py -f 2-query/sqrt.py -P -R
python3 ./test.py -f 2-query/statecount.py -P
python3 ./test.py -f 2-query/statecount.py -P -R
python3 ./test.py -f 2-query/stateduration.py -P
python3 ./test.py -f 2-query/stateduration.py -P -R
python3 ./test.py -f 2-query/substr.py -P
python3 ./test.py -f 2-query/substr.py -P -R
python3 ./test.py -f 2-query/sum.py -P
python3 ./test.py -f 2-query/sum.py -P -R
python3 ./test.py -f 2-query/tail.py -P
python3 ./test.py -f 2-query/tail.py -P -R
python3 ./test.py -f 2-query/tan.py -P
python3 ./test.py -f 2-query/tan.py -P -R
python3 ./test.py -f 2-query/Timediff.py -P
python3 ./test.py -f 2-query/Timediff.py -P -R
python3 ./test.py -f 2-query/timetruncate.py -P
python3 ./test.py -f 2-query/timetruncate.py -P -R
# N-7
echo " ********** -N 7 *************"
python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 7 -M 3 -C 6
python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -P -N 7 -M 3 -C 6 -n 3
python3 ./test.py -f 2-query/between.py -P -Q 2
python3 ./test.py -f 2-query/distinct.py -P -Q 2
python3 ./test.py -f 2-query/varchar.py -P -Q 2
python3 ./test.py -f 2-query/ltrim.py -P -Q 2
python3 ./test.py -f 2-query/rtrim.py -P -Q 2
python3 ./test.py -f 2-query/length.py -P -Q 2
python3 ./test.py -f 2-query/char_length.py -P -Q 2
python3 ./test.py -f 2-query/upper.py -P -Q 2
python3 ./test.py -f 2-query/lower.py -P -Q 2
python3 ./test.py -f 2-query/join.py -P -Q 2
python3 ./test.py -f 2-query/join2.py -P -Q 2
python3 ./test.py -f 2-query/cast.py -P -Q 2
python3 ./test.py -f 2-query/substr.py -P -Q 2
python3 ./test.py -f 2-query/union.py -P -Q 2
python3 ./test.py -f 2-query/union1.py -P -Q 2
python3 ./test.py -f 2-query/concat.py -P -Q 2
python3 ./test.py -f 2-query/concat2.py -P -Q 2
python3 ./test.py -f 2-query/concat_ws.py -P -Q 2
python3 ./test.py -f 2-query/concat_ws2.py -P -Q 2
python3 ./test.py -f 2-query/check_tsdb.py -P -Q 2
python3 ./test.py -f 2-query/spread.py -P -Q 2
python3 ./test.py -f 2-query/hyperloglog.py -P -Q 2
python3 ./test.py -f 2-query/explain.py -P -Q 2
python3 ./test.py -f 2-query/leastsquares.py -P -Q 2
python3 ./test.py -f 2-query/timezone.py -P -Q 2
python3 ./test.py -f 2-query/Now.py -P -Q 2
python3 ./test.py -f 2-query/Today.py -P -Q 2
python3 ./test.py -f 2-query/max.py -P -Q 2
python3 ./test.py -f 2-query/min.py -P -Q 2
python3 ./test.py -f 2-query/mode.py -P -Q 2
python3 ./test.py -f 2-query/count.py -P -Q 2
python3 ./test.py -f 2-query/countAlwaysReturnValue.py -P -Q 2
python3 ./test.py -f 2-query/last.py -P -Q 2
python3 ./test.py -f 2-query/first.py -P -Q 2
python3 ./test.py -f 2-query/To_iso8601.py -P -Q 2
python3 ./test.py -f 2-query/To_unixtimestamp.py -P -Q 2
python3 ./test.py -f 2-query/timetruncate.py -P -Q 2
python3 ./test.py -f 2-query/diff.py -P -Q 2
python3 ./test.py -f 2-query/Timediff.py -P -Q 2
python3 ./test.py -f 2-query/json_tag.py -P -Q 2
python3 ./test.py -f 2-query/top.py -P -Q 2
python3 ./test.py -f 2-query/bottom.py -P -Q 2
python3 ./test.py -f 2-query/percentile.py -P -Q 2
python3 ./test.py -f 2-query/apercentile.py -P -Q 2
python3 ./test.py -f 2-query/abs.py -P -Q 2
python3 ./test.py -f 2-query/ceil.py -P -Q 2
python3 ./test.py -f 2-query/floor.py -P -Q 2
python3 ./test.py -f 2-query/round.py -P -Q 2
python3 ./test.py -f 2-query/log.py -P -Q 2
python3 ./test.py -f 2-query/pow.py -P -Q 2
python3 ./test.py -f 2-query/sqrt.py -P -Q 2
python3 ./test.py -f 2-query/sin.py -P -Q 2
python3 ./test.py -f 2-query/cos.py -P -Q 2
python3 ./test.py -f 2-query/tan.py -P -Q 2
python3 ./test.py -f 2-query/arcsin.py -P -Q 2
python3 ./test.py -f 2-query/arccos.py -P -Q 2
python3 ./test.py -f 2-query/arctan.py -P -Q 2
python3 ./test.py -f 2-query/query_cols_tags_and_or.py -P -Q 2
python3 ./test.py -f 2-query/interp.py -P -Q 2
python3 ./test.py -f 2-query/nestedQueryInterval.py -P -Q 2
python3 ./test.py -f 2-query/stablity.py -P -Q 2
python3 ./test.py -f 2-query/stablity_1.py -P -Q 2
python3 ./test.py -f 2-query/avg.py -P -Q 2
python3 ./test.py -f 2-query/elapsed.py -P -Q 2
python3 ./test.py -f 2-query/csum.py -P -Q 2
python3 ./test.py -f 2-query/mavg.py -P -Q 2
python3 ./test.py -f 2-query/sample.py -P -Q 2
python3 ./test.py -f 2-query/function_diff.py -P -Q 2
python3 ./test.py -f 2-query/unique.py -P -Q 2
python3 ./test.py -f 2-query/stateduration.py -P -Q 2
python3 ./test.py -f 2-query/function_stateduration.py -P -Q 2
python3 ./test.py -f 2-query/statecount.py -P -Q 2
python3 ./test.py -f 2-query/tail.py -P -Q 2
python3 ./test.py -f 2-query/ttl_comment.py -P -Q 2
python3 ./test.py -f 2-query/distribute_agg_count.py -P -Q 2
python3 ./test.py -f 2-query/distribute_agg_max.py -P -Q 2
python3 ./test.py -f 2-query/distribute_agg_min.py -P -Q 2
python3 ./test.py -f 2-query/distribute_agg_sum.py -P -Q 2
python3 ./test.py -f 2-query/distribute_agg_spread.py -P -Q 2
python3 ./test.py -f 2-query/distribute_agg_apercentile.py -P -Q 2
python3 ./test.py -f 2-query/distribute_agg_avg.py -P -Q 2
python3 ./test.py -f 2-query/distribute_agg_stddev.py -P -Q 2
python3 ./test.py -f 2-query/twa.py -P -Q 2
python3 ./test.py -f 2-query/irate.py -P -Q 2
python3 ./test.py -f 2-query/function_null.py -P -Q 2
python3 ./test.py -f 2-query/count_partition.py -P -Q 2
python3 ./test.py -f 2-query/max_partition.py -P -Q 2
python3 ./test.py -f 2-query/max_min_last_interval.py -P -Q 2
python3 ./test.py -f 2-query/last_row_interval.py -P -Q 2
python3 ./test.py -f 2-query/last_row.py -P -Q 2
python3 ./test.py -f 2-query/tsbsQuery.py -P -Q 2
python3 ./test.py -f 2-query/sml.py -P -Q 2
python3 ./test.py -f 2-query/case_when.py -P -Q 2
python3 ./test.py -f 2-query/blockSMA.py -P -Q 2
python3 ./test.py -f 2-query/projectionDesc.py -P -Q 2
python3 ./test.py -f 99-TDcase/TD-21561.py -P -Q 2
python3 ./test.py -f 2-query/between.py -P -Q 3
python3 ./test.py -f 2-query/distinct.py -P -Q 3
python3 ./test.py -f 2-query/varchar.py -P -Q 3
python3 ./test.py -f 2-query/ltrim.py -P -Q 3
python3 ./test.py -f 2-query/rtrim.py -P -Q 3
python3 ./test.py -f 2-query/length.py -P -Q 3
python3 ./test.py -f 2-query/char_length.py -P -Q 3
python3 ./test.py -f 2-query/upper.py -P -Q 3
python3 ./test.py -f 2-query/lower.py -P -Q 3
python3 ./test.py -f 2-query/join.py -P -Q 3
python3 ./test.py -f 2-query/join2.py -P -Q 3
python3 ./test.py -f 2-query/cast.py -P -Q 3
python3 ./test.py -f 2-query/substr.py -P -Q 3
python3 ./test.py -f 2-query/union.py -P -Q 3
python3 ./test.py -f 2-query/union1.py -P -Q 3
python3 ./test.py -f 2-query/concat2.py -P -Q 3
python3 ./test.py -f 2-query/concat_ws.py -P -Q 3
python3 ./test.py -f 2-query/concat_ws2.py -P -Q 3
python3 ./test.py -f 2-query/check_tsdb.py -P -Q 3
python3 ./test.py -f 2-query/spread.py -P -Q 3
python3 ./test.py -f 2-query/hyperloglog.py -P -Q 3
python3 ./test.py -f 2-query/explain.py -P -Q 3
python3 ./test.py -f 2-query/leastsquares.py -P -Q 3
python3 ./test.py -f 2-query/timezone.py -P -Q 3
python3 ./test.py -f 2-query/Now.py -P -Q 3
python3 ./test.py -f 2-query/Today.py -P -Q 3
python3 ./test.py -f 2-query/max.py -P -Q 3
python3 ./test.py -f 2-query/min.py -P -Q 3
python3 ./test.py -f 2-query/mode.py -P -Q 3
python3 ./test.py -f 2-query/count.py -P -Q 3
python3 ./test.py -f 2-query/countAlwaysReturnValue.py -P -Q 3
python3 ./test.py -f 2-query/last.py -P -Q 3
python3 ./test.py -f 2-query/first.py -P -Q 3
python3 ./test.py -f 2-query/To_iso8601.py -P -Q 3
python3 ./test.py -f 2-query/To_unixtimestamp.py -P -Q 3
python3 ./test.py -f 2-query/timetruncate.py -P -Q 3
python3 ./test.py -f 2-query/diff.py -P -Q 3
python3 ./test.py -f 2-query/Timediff.py -P -Q 3
python3 ./test.py -f 2-query/json_tag.py -P -Q 3
python3 ./test.py -f 2-query/top.py -P -Q 3
python3 ./test.py -f 2-query/bottom.py -P -Q 3
python3 ./test.py -f 2-query/percentile.py -P -Q 3
python3 ./test.py -f 2-query/apercentile.py -P -Q 3
python3 ./test.py -f 2-query/abs.py -P -Q 3
python3 ./test.py -f 2-query/ceil.py -P -Q 3
python3 ./test.py -f 2-query/floor.py -P -Q 3
python3 ./test.py -f 2-query/round.py -P -Q 3
python3 ./test.py -f 2-query/log.py -P -Q 3
python3 ./test.py -f 2-query/pow.py -P -Q 3
python3 ./test.py -f 2-query/sqrt.py -P -Q 3
python3 ./test.py -f 2-query/sin.py -P -Q 3
python3 ./test.py -f 2-query/cos.py -P -Q 3
python3 ./test.py -f 2-query/tan.py -P -Q 3
python3 ./test.py -f 2-query/arcsin.py -P -Q 3
python3 ./test.py -f 2-query/arccos.py -P -Q 3
python3 ./test.py -f 2-query/arctan.py -P -Q 3
python3 ./test.py -f 2-query/query_cols_tags_and_or.py -P -Q 3
python3 ./test.py -f 2-query/nestedQueryInterval.py -P -Q 3
python3 ./test.py -f 2-query/stablity.py -P -Q 3
python3 ./test.py -f 2-query/stablity_1.py -P -Q 3
python3 ./test.py -f 2-query/avg.py -P -Q 3
python3 ./test.py -f 2-query/elapsed.py -P -Q 3
python3 ./test.py -f 2-query/csum.py -P -Q 3
python3 ./test.py -f 2-query/mavg.py -P -Q 3
python3 ./test.py -f 2-query/sample.py -P -Q 3
python3 ./test.py -f 2-query/function_diff.py -P -Q 3
python3 ./test.py -f 2-query/unique.py -P -Q 3
python3 ./test.py -f 2-query/stateduration.py -P -Q 3
python3 ./test.py -f 2-query/function_stateduration.py -P -Q 3
python3 ./test.py -f 2-query/statecount.py -P -Q 3
python3 ./test.py -f 2-query/tail.py -P -Q 3
python3 ./test.py -f 2-query/ttl_comment.py -P -Q 3
python3 ./test.py -f 2-query/distribute_agg_count.py -P -Q 3
python3 ./test.py -f 2-query/distribute_agg_max.py -P -Q 3
python3 ./test.py -f 2-query/distribute_agg_min.py -P -Q 3
python3 ./test.py -f 2-query/distribute_agg_sum.py -P -Q 3
python3 ./test.py -f 2-query/distribute_agg_spread.py -P -Q 3
python3 ./test.py -f 2-query/distribute_agg_apercentile.py -P -Q 3
python3 ./test.py -f 2-query/distribute_agg_avg.py -P -Q 3
python3 ./test.py -f 2-query/distribute_agg_stddev.py -P -Q 3
python3 ./test.py -f 2-query/twa.py -P -Q 3
python3 ./test.py -f 2-query/irate.py -P -Q 3
python3 ./test.py -f 2-query/function_null.py -P -Q 3
python3 ./test.py -f 2-query/count_partition.py -P -Q 3
python3 ./test.py -f 2-query/max_partition.py -P -Q 3
python3 ./test.py -f 2-query/max_min_last_interval.py -P -Q 3
python3 ./test.py -f 2-query/last_row_interval.py -P -Q 3
python3 ./test.py -f 2-query/last_row.py -P -Q 3
python3 ./test.py -f 2-query/tsbsQuery.py -P -Q 3
python3 ./test.py -f 2-query/sml.py -P -Q 3
python3 ./test.py -f 2-query/interp.py -P -Q 3
python3 ./test.py -f 2-query/case_when.py -P -Q 3
python3 ./test.py -f 2-query/blockSMA.py -P -Q 3
python3 ./test.py -f 2-query/projectionDesc.py -P -Q 3
python3 ./test.py -f 99-TDcase/TD-21561.py -P -Q 3
python3 ./test.py -f 2-query/between.py -P -Q 4
python3 ./test.py -f 2-query/distinct.py -P -Q 4
python3 ./test.py -f 2-query/varchar.py -P -Q 4
python3 ./test.py -f 2-query/ltrim.py -P -Q 4
python3 ./test.py -f 2-query/rtrim.py -P -Q 4
python3 ./test.py -f 2-query/length.py -P -Q 4
python3 ./test.py -f 2-query/char_length.py -P -Q 4
python3 ./test.py -f 2-query/upper.py -P -Q 4
python3 ./test.py -f 2-query/lower.py -P -Q 4
python3 ./test.py -f 2-query/join.py -P -Q 4
python3 ./test.py -f 2-query/join2.py -P -Q 4
python3 ./test.py -f 2-query/substr.py -P -Q 4
python3 ./test.py -f 2-query/union.py -P -Q 4
python3 ./test.py -f 2-query/union1.py -P -Q 4
python3 ./test.py -f 2-query/concat.py -P -Q 4
python3 ./test.py -f 2-query/concat2.py -P -Q 4
python3 ./test.py -f 2-query/concat_ws.py -P -Q 4
python3 ./test.py -f 2-query/concat_ws2.py -P -Q 4
python3 ./test.py -f 2-query/check_tsdb.py -P -Q 4
python3 ./test.py -f 2-query/spread.py -P -Q 4
python3 ./test.py -f 2-query/hyperloglog.py -P -Q 4
python3 ./test.py -f 2-query/explain.py -P -Q 4
python3 ./test.py -f 2-query/leastsquares.py -P -Q 4
python3 ./test.py -f 2-query/timezone.py -P -Q 4
python3 ./test.py -f 2-query/Now.py -P -Q 4
python3 ./test.py -f 2-query/Today.py -P -Q 4
python3 ./test.py -f 2-query/max.py -P -Q 4
python3 ./test.py -f 2-query/min.py -P -Q 4
python3 ./test.py -f 2-query/mode.py -P -Q 4
python3 ./test.py -f 2-query/count.py -P -Q 4
python3 ./test.py -f 2-query/countAlwaysReturnValue.py -P -Q 4
python3 ./test.py -f 2-query/last.py -P -Q 4
python3 ./test.py -f 2-query/first.py -P -Q 4
python3 ./test.py -f 2-query/To_iso8601.py -P -Q 4
python3 ./test.py -f 2-query/To_unixtimestamp.py -P -Q 4
python3 ./test.py -f 2-query/timetruncate.py -P -Q 4
python3 ./test.py -f 2-query/diff.py -P -Q 4
python3 ./test.py -f 2-query/Timediff.py -P -Q 4
python3 ./test.py -f 2-query/json_tag.py -P -Q 4
python3 ./test.py -f 2-query/top.py -P -Q 4
python3 ./test.py -f 2-query/bottom.py -P -Q 4
python3 ./test.py -f 2-query/percentile.py -P -Q 4
python3 ./test.py -f 2-query/apercentile.py -P -Q 4
python3 ./test.py -f 2-query/abs.py -P -Q 4
python3 ./test.py -f 2-query/ceil.py -P -Q 4
python3 ./test.py -f 2-query/floor.py -P -Q 4
python3 ./test.py -f 2-query/round.py -P -Q 4
python3 ./test.py -f 2-query/log.py -P -Q 4
python3 ./test.py -f 2-query/pow.py -P -Q 4
python3 ./test.py -f 2-query/sqrt.py -P -Q 4
python3 ./test.py -f 2-query/sin.py -P -Q 4
python3 ./test.py -f 2-query/cos.py -P -Q 4
python3 ./test.py -f 2-query/tan.py -P -Q 4
python3 ./test.py -f 2-query/arcsin.py -P -Q 4
python3 ./test.py -f 2-query/arccos.py -P -Q 4
python3 ./test.py -f 2-query/arctan.py -P -Q 4
python3 ./test.py -f 2-query/query_cols_tags_and_or.py -P -Q 4
python3 ./test.py -f 2-query/nestedQueryInterval.py -P -Q 4
python3 ./test.py -f 2-query/stablity.py -P -Q 4
python3 ./test.py -f 2-query/stablity_1.py -P -Q 4
python3 ./test.py -f 2-query/avg.py -P -Q 4
python3 ./test.py -f 2-query/elapsed.py -P -Q 4
python3 ./test.py -f 2-query/csum.py -P -Q 4
python3 ./test.py -f 2-query/mavg.py -P -Q 4
python3 ./test.py -f 2-query/sample.py -P -Q 4
python3 ./test.py -f 2-query/cast.py -P -Q 4
python3 ./test.py -f 2-query/function_diff.py -P -Q 4
python3 ./test.py -f 2-query/unique.py -P -Q 4
python3 ./test.py -f 2-query/stateduration.py -P -Q 4
python3 ./test.py -f 2-query/function_stateduration.py -P -Q 4
python3 ./test.py -f 2-query/statecount.py -P -Q 4
python3 ./test.py -f 2-query/tail.py -P -Q 4
python3 ./test.py -f 2-query/ttl_comment.py -P -Q 4
python3 ./test.py -f 2-query/distribute_agg_count.py -P -Q 4
python3 ./test.py -f 2-query/distribute_agg_max.py -P -Q 4
python3 ./test.py -f 2-query/distribute_agg_min.py -P -Q 4
python3 ./test.py -f 2-query/distribute_agg_sum.py -P -Q 4
python3 ./test.py -f 2-query/distribute_agg_spread.py -P -Q 4
python3 ./test.py -f 2-query/distribute_agg_apercentile.py -P -Q 4
python3 ./test.py -f 2-query/distribute_agg_avg.py -P -Q 4
python3 ./test.py -f 2-query/distribute_agg_stddev.py -P -Q 4
python3 ./test.py -f 2-query/twa.py -P -Q 4
python3 ./test.py -f 2-query/irate.py -P -Q 4
python3 ./test.py -f 2-query/function_null.py -P -Q 4
python3 ./test.py -f 2-query/count_partition.py -P -Q 4
python3 ./test.py -f 2-query/max_partition.py -P -Q 4
python3 ./test.py -f 2-query/max_min_last_interval.py -P -Q 4
python3 ./test.py -f 2-query/last_row_interval.py -P -Q 4
python3 ./test.py -f 2-query/last_row.py -P -Q 4
python3 ./test.py -f 2-query/tsbsQuery.py -P -Q 4
python3 ./test.py -f 2-query/sml.py -P -Q 4
python3 ./test.py -f 2-query/interp.py -P -Q 4
python3 ./test.py -f 2-query/case_when.py -P -Q 4
python3 ./test.py -f 2-query/insert_select.py -P
python3 ./test.py -f 2-query/insert_select.py -P -R
python3 ./test.py -f 2-query/insert_select.py -P -Q 2
python3 ./test.py -f 2-query/insert_select.py -P -Q 3
python3 ./test.py -f 2-query/insert_select.py -P -Q 4
python3 ./test.py -f 2-query/out_of_order.py -P -R
python3 ./test.py -f 2-query/blockSMA.py -P -Q 4
python3 ./test.py -f 2-query/projectionDesc.py -P -Q 4
python3 ./test.py -f 2-query/odbc.py -P
python3 ./test.py -f 99-TDcase/TD-21561.py -P -Q 4
python3 ./test.py -f 99-TDcase/TD-20582.py -P
\ No newline at end of file
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
# pip install src/connector/python/ # pip install src/connector/python/
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os
import sys import sys
import getopt import getopt
import subprocess import subprocess
...@@ -22,6 +23,7 @@ import json ...@@ -22,6 +23,7 @@ import json
import platform import platform
import socket import socket
import threading import threading
import importlib
import toml import toml
sys.path.append("../pytest") sys.path.append("../pytest")
...@@ -53,8 +55,39 @@ def checkRunTimeError(): ...@@ -53,8 +55,39 @@ def checkRunTimeError():
if hwnd: if hwnd:
os.system("TASKKILL /F /IM taosd.exe") os.system("TASKKILL /F /IM taosd.exe")
#
# run case on previous cluster
#
def runOnPreviousCluster(host, config, fileName):
print("enter run on previeous")
# load case module
sep = "/"
if platform.system().lower() == 'windows':
sep = os.sep
moduleName = fileName.replace(".py", "").replace(sep, ".")
uModule = importlib.import_module(moduleName)
case = uModule.TDTestCase()
# create conn
conn = taos.connect(host, config)
# run case
case.init(conn, False)
try:
case.run()
except Exception as e:
tdLog.notice(repr(e))
tdLog.exit("%s failed" % (fileName))
# stop
case.stop()
if __name__ == "__main__": if __name__ == "__main__":
#
# analysis paramaters
#
fileName = "all" fileName = "all"
deployPath = "" deployPath = ""
masterIp = "" masterIp = ""
...@@ -75,8 +108,9 @@ if __name__ == "__main__": ...@@ -75,8 +108,9 @@ if __name__ == "__main__":
replicaVar = 1 replicaVar = 1
asan = False asan = False
independentMnode = True independentMnode = True
opts, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:m:l:scghrd:k:e:N:M:Q:C:RD:n:i:a', [ previousCluster = False
'file=', 'path=', 'master', 'logSql', 'stop', 'cluster', 'valgrind', 'help', 'restart', 'updateCfgDict', 'killv', 'execCmd','dnodeNums','mnodeNums','queryPolicy','createDnodeNums','restful','adaptercfgupdate','replicaVar','independentMnode']) opts, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:m:l:scghrd:k:e:N:M:Q:C:RD:n:i:aP', [
'file=', 'path=', 'master', 'logSql', 'stop', 'cluster', 'valgrind', 'help', 'restart', 'updateCfgDict', 'killv', 'execCmd','dnodeNums','mnodeNums','queryPolicy','createDnodeNums','restful','adaptercfgupdate','replicaVar','independentMnode','previous'])
for key, value in opts: for key, value in opts:
if key in ['-h', '--help']: if key in ['-h', '--help']:
tdLog.printNoPrefix( tdLog.printNoPrefix(
...@@ -101,6 +135,7 @@ if __name__ == "__main__": ...@@ -101,6 +135,7 @@ if __name__ == "__main__":
tdLog.printNoPrefix('-n the number of replicas') tdLog.printNoPrefix('-n the number of replicas')
tdLog.printNoPrefix('-i independentMnode Mnode') tdLog.printNoPrefix('-i independentMnode Mnode')
tdLog.printNoPrefix('-a address sanitizer mode') tdLog.printNoPrefix('-a address sanitizer mode')
tdLog.printNoPrefix('-P run case with [P]revious cluster, do not create new cluster to run case.')
sys.exit(0) sys.exit(0)
...@@ -182,6 +217,12 @@ if __name__ == "__main__": ...@@ -182,6 +217,12 @@ if __name__ == "__main__":
if key in ['-n', '--replicaVar']: if key in ['-n', '--replicaVar']:
replicaVar = value replicaVar = value
if key in ['-P', '--previous']:
previousCluster = True
#
# do exeCmd command
#
if not execCmd == "": if not execCmd == "":
if restful: if restful:
tAdapter.init(deployPath) tAdapter.init(deployPath)
...@@ -191,6 +232,9 @@ if __name__ == "__main__": ...@@ -191,6 +232,9 @@ if __name__ == "__main__":
exec(execCmd) exec(execCmd)
quit() quit()
#
# do stop option
#
if (stop != 0): if (stop != 0):
if (valgrind == 0): if (valgrind == 0):
toBeKilled = "taosd" toBeKilled = "taosd"
...@@ -248,6 +292,9 @@ if __name__ == "__main__": ...@@ -248,6 +292,9 @@ if __name__ == "__main__":
tdLog.info('stop All dnodes') tdLog.info('stop All dnodes')
#
# get hostname
#
if masterIp == "": if masterIp == "":
host = socket.gethostname() host = socket.gethostname()
else: else:
...@@ -256,8 +303,20 @@ if __name__ == "__main__": ...@@ -256,8 +303,20 @@ if __name__ == "__main__":
host = config["host"] host = config["host"]
except Exception as r: except Exception as r:
host = masterIp host = masterIp
tdLog.info("Procedures for tdengine deployed in %s" % (host)) tdLog.info("Procedures for tdengine deployed in %s" % (host))
#
# do previousCluster option
#
if previousCluster:
tdDnodes.init(deployPath, masterIp)
runOnPreviousCluster(host, tdDnodes.getSimCfgPath(), fileName)
tdLog.info("run on previous cluster end.")
quit()
#
# windows run
#
if platform.system().lower() == 'windows': if platform.system().lower() == 'windows':
fileName = fileName.replace("/", os.sep) fileName = fileName.replace("/", os.sep)
if (masterIp == "" and not fileName == "0-others\\udf_create.py"): if (masterIp == "" and not fileName == "0-others\\udf_create.py"):
...@@ -387,6 +446,10 @@ if __name__ == "__main__": ...@@ -387,6 +446,10 @@ if __name__ == "__main__":
tdCases.runOneWindows(conn, fileName) tdCases.runOneWindows(conn, fileName)
else: else:
tdCases.runAllWindows(conn) tdCases.runAllWindows(conn)
#
# linux run
#
else: else:
tdDnodes.setKillValgrind(killValgrind) tdDnodes.setKillValgrind(killValgrind)
tdDnodes.init(deployPath, masterIp) tdDnodes.init(deployPath, masterIp)
...@@ -418,6 +481,7 @@ if __name__ == "__main__": ...@@ -418,6 +481,7 @@ if __name__ == "__main__":
tAdapter.stop(force_kill=True) tAdapter.stop(force_kill=True)
if dnodeNums == 1 : if dnodeNums == 1 :
# dnode is one
tdDnodes.deploy(1,updateCfgDict) tdDnodes.deploy(1,updateCfgDict)
tdDnodes.start(1) tdDnodes.start(1)
tdCases.logSql(logSql) tdCases.logSql(logSql)
...@@ -458,6 +522,7 @@ if __name__ == "__main__": ...@@ -458,6 +522,7 @@ if __name__ == "__main__":
tdLog.exit(f"alter queryPolicy to {queryPolicy} failed") tdLog.exit(f"alter queryPolicy to {queryPolicy} failed")
else : else :
# dnode > 1 cluster
tdLog.debug("create an cluster with %s nodes and make %s dnode as independent mnode"%(dnodeNums,mnodeNums)) tdLog.debug("create an cluster with %s nodes and make %s dnode as independent mnode"%(dnodeNums,mnodeNums))
dnodeslist = cluster.configure_cluster(dnodeNums=dnodeNums, mnodeNums=mnodeNums, independentMnode=independentMnode) dnodeslist = cluster.configure_cluster(dnodeNums=dnodeNums, mnodeNums=mnodeNums, independentMnode=independentMnode)
tdDnodes = ClusterDnodes(dnodeslist) tdDnodes = ClusterDnodes(dnodeslist)
...@@ -476,6 +541,7 @@ if __name__ == "__main__": ...@@ -476,6 +541,7 @@ if __name__ == "__main__":
tAdapter.deploy(adapter_cfg_dict) tAdapter.deploy(adapter_cfg_dict)
tAdapter.start() tAdapter.start()
# create taos connect
if not restful: if not restful:
conn = taos.connect(host,config=tdDnodes.getSimCfgPath()) conn = taos.connect(host,config=tdDnodes.getSimCfgPath())
else: else:
...@@ -494,6 +560,7 @@ if __name__ == "__main__": ...@@ -494,6 +560,7 @@ if __name__ == "__main__":
except Exception as r: except Exception as r:
print(r) print(r)
# do queryPolicy option
if queryPolicy != 1: if queryPolicy != 1:
queryPolicy=int(queryPolicy) queryPolicy=int(queryPolicy)
if restful: if restful:
...@@ -515,6 +582,7 @@ if __name__ == "__main__": ...@@ -515,6 +582,7 @@ if __name__ == "__main__":
tdLog.exit(f"alter queryPolicy to {queryPolicy} failed") tdLog.exit(f"alter queryPolicy to {queryPolicy} failed")
# run case
if testCluster: if testCluster:
tdLog.info("Procedures for testing cluster") tdLog.info("Procedures for testing cluster")
if fileName == "all": if fileName == "all":
...@@ -533,6 +601,7 @@ if __name__ == "__main__": ...@@ -533,6 +601,7 @@ if __name__ == "__main__":
else: else:
tdCases.runOneLinux(conn, fileName, replicaVar) tdCases.runOneLinux(conn, fileName, replicaVar)
# do restart option
if restart: if restart:
if fileName == "all": if fileName == "all":
tdLog.info("not need to query ") tdLog.info("not need to query ")
...@@ -552,6 +621,7 @@ if __name__ == "__main__": ...@@ -552,6 +621,7 @@ if __name__ == "__main__":
else: else:
tdLog.info("not need to query") tdLog.info("not need to query")
# close for end
if conn is not None: if conn is not None:
conn.close() conn.close()
if asan: if asan:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册