Merge branch 'enh/new3.0' into enh/refactorBackend
This commit is contained in:
commit
6ce878948f
|
@ -2,7 +2,7 @@
|
||||||
# taosadapter
|
# taosadapter
|
||||||
ExternalProject_Add(taosadapter
|
ExternalProject_Add(taosadapter
|
||||||
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
|
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
|
||||||
GIT_TAG main
|
GIT_TAG 3.0
|
||||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
|
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
|
||||||
BINARY_DIR ""
|
BINARY_DIR ""
|
||||||
#BUILD_IN_SOURCE TRUE
|
#BUILD_IN_SOURCE TRUE
|
||||||
|
|
|
@ -428,7 +428,8 @@ typedef struct SVgDataBlocks {
|
||||||
|
|
||||||
typedef void (*FFreeTableBlockHash)(SHashObj*);
|
typedef void (*FFreeTableBlockHash)(SHashObj*);
|
||||||
typedef void (*FFreeVgourpBlockArray)(SArray*);
|
typedef void (*FFreeVgourpBlockArray)(SArray*);
|
||||||
|
struct SStbRowsDataContext;
|
||||||
|
typedef void (*FFreeStbRowsDataContext)(struct SStbRowsDataContext*);
|
||||||
typedef struct SVnodeModifyOpStmt {
|
typedef struct SVnodeModifyOpStmt {
|
||||||
ENodeType nodeType;
|
ENodeType nodeType;
|
||||||
ENodeType sqlNodeType;
|
ENodeType sqlNodeType;
|
||||||
|
@ -443,11 +444,11 @@ typedef struct SVnodeModifyOpStmt {
|
||||||
struct STableMeta* pTableMeta;
|
struct STableMeta* pTableMeta;
|
||||||
SNode* pTagCond;
|
SNode* pTagCond;
|
||||||
SArray* pTableTag;
|
SArray* pTableTag;
|
||||||
SHashObj* pVgroupsHashObj;
|
SHashObj* pVgroupsHashObj; // SHashObj<vgId, SVgInfo>
|
||||||
SHashObj* pTableBlockHashObj; // SHashObj<tuid, STableDataCxt*>
|
SHashObj* pTableBlockHashObj; // SHashObj<tuid, STableDataCxt*>
|
||||||
SHashObj* pSubTableHashObj;
|
SHashObj* pSubTableHashObj; // SHashObj<table_name, STableMeta*>
|
||||||
SHashObj* pTableNameHashObj;
|
SHashObj* pTableNameHashObj; // set of table names for refreshing meta, sync mode
|
||||||
SHashObj* pDbFNameHashObj;
|
SHashObj* pDbFNameHashObj; // set of db names for refreshing meta, sync mode
|
||||||
SArray* pVgDataBlocks; // SArray<SVgroupDataCxt*>
|
SArray* pVgDataBlocks; // SArray<SVgroupDataCxt*>
|
||||||
SVCreateTbReq* pCreateTblReq;
|
SVCreateTbReq* pCreateTblReq;
|
||||||
TdFilePtr fp;
|
TdFilePtr fp;
|
||||||
|
@ -455,6 +456,10 @@ typedef struct SVnodeModifyOpStmt {
|
||||||
FFreeVgourpBlockArray freeArrayFunc;
|
FFreeVgourpBlockArray freeArrayFunc;
|
||||||
bool usingTableProcessing;
|
bool usingTableProcessing;
|
||||||
bool fileProcessing;
|
bool fileProcessing;
|
||||||
|
|
||||||
|
bool stbSyntax;
|
||||||
|
struct SStbRowsDataContext* pStbRowsCxt;
|
||||||
|
FFreeStbRowsDataContext freeStbRowsCxtFunc;
|
||||||
} SVnodeModifyOpStmt;
|
} SVnodeModifyOpStmt;
|
||||||
|
|
||||||
typedef struct SExplainOptions {
|
typedef struct SExplainOptions {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1451,7 +1451,7 @@ static bool doUpdateLocalEp(tmq_t* tmq, int32_t epoch, const SMqAskEpRsp* pRsp)
|
||||||
bool set = false;
|
bool set = false;
|
||||||
|
|
||||||
int32_t topicNumGet = taosArrayGetSize(pRsp->topics);
|
int32_t topicNumGet = taosArrayGetSize(pRsp->topics);
|
||||||
if (topicNumGet <= 0 && epoch <= tmq->epoch) {
|
if (epoch < tmq->epoch || (epoch == tmq->epoch && topicNumGet == 0)) {
|
||||||
tscInfo("consumer:0x%" PRIx64 " no update ep epoch from %d to epoch %d, incoming topics:%d",
|
tscInfo("consumer:0x%" PRIx64 " no update ep epoch from %d to epoch %d, incoming topics:%d",
|
||||||
tmq->consumerId, tmq->epoch, epoch, topicNumGet);
|
tmq->consumerId, tmq->epoch, epoch, topicNumGet);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1018,7 +1018,7 @@ static int32_t mndProcessCreateDnodeReq(SRpcMsg *pReq) {
|
||||||
char obj[200] = {0};
|
char obj[200] = {0};
|
||||||
sprintf(obj, "%s:%d", createReq.fqdn, createReq.port);
|
sprintf(obj, "%s:%d", createReq.fqdn, createReq.port);
|
||||||
|
|
||||||
auditRecord(pReq, pMnode->clusterId, "createDnode", obj, "", createReq.sql, createReq.sqlLen);
|
auditRecord(pReq, pMnode->clusterId, "createDnode", "", obj, createReq.sql, createReq.sqlLen);
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
||||||
|
@ -1167,7 +1167,7 @@ static int32_t mndProcessDropDnodeReq(SRpcMsg *pReq) {
|
||||||
char obj1[30] = {0};
|
char obj1[30] = {0};
|
||||||
sprintf(obj1, "%d", dropReq.dnodeId);
|
sprintf(obj1, "%d", dropReq.dnodeId);
|
||||||
|
|
||||||
auditRecord(pReq, pMnode->clusterId, "dropDnode", obj1, "", dropReq.sql, dropReq.sqlLen);
|
auditRecord(pReq, pMnode->clusterId, "dropDnode", "", obj1, dropReq.sql, dropReq.sqlLen);
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
||||||
|
@ -1368,7 +1368,7 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) {
|
||||||
char obj[50] = {0};
|
char obj[50] = {0};
|
||||||
sprintf(obj, "%d", cfgReq.dnodeId);
|
sprintf(obj, "%d", cfgReq.dnodeId);
|
||||||
|
|
||||||
auditRecord(pReq, pMnode->clusterId, "alterDnode", obj, "", cfgReq.sql, cfgReq.sqlLen);
|
auditRecord(pReq, pMnode->clusterId, "alterDnode", "", obj, cfgReq.sql, cfgReq.sqlLen);
|
||||||
|
|
||||||
tFreeSMCfgDnodeReq(&cfgReq);
|
tFreeSMCfgDnodeReq(&cfgReq);
|
||||||
|
|
||||||
|
|
|
@ -656,7 +656,7 @@ static int32_t mndProcessCreateMnodeReq(SRpcMsg *pReq) {
|
||||||
char obj[40] = {0};
|
char obj[40] = {0};
|
||||||
sprintf(obj, "%d", createReq.dnodeId);
|
sprintf(obj, "%d", createReq.dnodeId);
|
||||||
|
|
||||||
auditRecord(pReq, pMnode->clusterId, "createMnode", obj, "", createReq.sql, createReq.sqlLen);
|
auditRecord(pReq, pMnode->clusterId, "createMnode", "", obj, createReq.sql, createReq.sqlLen);
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
||||||
|
@ -798,7 +798,7 @@ static int32_t mndProcessDropMnodeReq(SRpcMsg *pReq) {
|
||||||
char obj[40] = {0};
|
char obj[40] = {0};
|
||||||
sprintf(obj, "%d", dropReq.dnodeId);
|
sprintf(obj, "%d", dropReq.dnodeId);
|
||||||
|
|
||||||
auditRecord(pReq, pMnode->clusterId, "dropMnode", obj, "", dropReq.sql, dropReq.sqlLen);
|
auditRecord(pReq, pMnode->clusterId, "dropMnode", "", obj, dropReq.sql, dropReq.sqlLen);
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
||||||
|
|
|
@ -312,13 +312,10 @@ _CONNECT:
|
||||||
|
|
||||||
code = 0;
|
code = 0;
|
||||||
|
|
||||||
char obj[100] = {0};
|
|
||||||
sprintf(obj, "%s:%d", ip, pConn->port);
|
|
||||||
|
|
||||||
char detail[1000] = {0};
|
char detail[1000] = {0};
|
||||||
sprintf(detail, "app:%s", connReq.app);
|
sprintf(detail, "%s:%d, app:%s", ip, pConn->port, connReq.app);
|
||||||
|
|
||||||
auditRecord(pReq, pMnode->clusterId, "login", connReq.user, obj, detail, strlen(detail));
|
auditRecord(pReq, pMnode->clusterId, "login", "", "", detail, strlen(detail));
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
|
|
||||||
|
|
|
@ -310,7 +310,7 @@ static int32_t mndProcessCreateQnodeReq(SRpcMsg *pReq) {
|
||||||
char obj[33] = {0};
|
char obj[33] = {0};
|
||||||
sprintf(obj, "%d", createReq.dnodeId);
|
sprintf(obj, "%d", createReq.dnodeId);
|
||||||
|
|
||||||
auditRecord(pReq, pMnode->clusterId, "createQnode", obj, "", createReq.sql, createReq.sqlLen);
|
auditRecord(pReq, pMnode->clusterId, "createQnode", "", obj, createReq.sql, createReq.sqlLen);
|
||||||
_OVER:
|
_OVER:
|
||||||
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
||||||
mError("qnode:%d, failed to create since %s", createReq.dnodeId, terrstr());
|
mError("qnode:%d, failed to create since %s", createReq.dnodeId, terrstr());
|
||||||
|
@ -424,7 +424,7 @@ static int32_t mndProcessDropQnodeReq(SRpcMsg *pReq) {
|
||||||
char obj[33] = {0};
|
char obj[33] = {0};
|
||||||
sprintf(obj, "%d", dropReq.dnodeId);
|
sprintf(obj, "%d", dropReq.dnodeId);
|
||||||
|
|
||||||
auditRecord(pReq, pMnode->clusterId, "dropQnode", obj, "", dropReq.sql, dropReq.sqlLen);
|
auditRecord(pReq, pMnode->clusterId, "dropQnode", "", obj, dropReq.sql, dropReq.sqlLen);
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
||||||
|
|
|
@ -728,7 +728,7 @@ int32_t mndSchedInitSubEp(SMnode* pMnode, const SMqTopicObj* pTopic, SMqSubscrib
|
||||||
pVgEp->vgId = pVgroup->vgId;
|
pVgEp->vgId = pVgroup->vgId;
|
||||||
taosArrayPush(pSub->unassignedVgs, &pVgEp);
|
taosArrayPush(pSub->unassignedVgs, &pVgEp);
|
||||||
|
|
||||||
mDebug("init subscription %s for topic:%s assign vgId:%d", pSub->key, pTopic->name, pVgEp->vgId);
|
mInfo("init subscription %s for topic:%s assign vgId:%d", pSub->key, pTopic->name, pVgEp->vgId);
|
||||||
|
|
||||||
sdbRelease(pSdb, pVgroup);
|
sdbRelease(pSdb, pVgroup);
|
||||||
}
|
}
|
||||||
|
|
|
@ -857,13 +857,13 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
|
||||||
code = TSDB_CODE_ACTION_IN_PROGRESS;
|
code = TSDB_CODE_ACTION_IN_PROGRESS;
|
||||||
|
|
||||||
SName name = {0};
|
SName name = {0};
|
||||||
tNameFromString(&name, createStreamReq.name, T_NAME_ACCT | T_NAME_DB);
|
tNameFromString(&name, createStreamReq.name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||||
//reuse this function for stream
|
//reuse this function for stream
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
if (createStreamReq.sql != NULL) {
|
if (createStreamReq.sql != NULL) {
|
||||||
auditRecord(pReq, pMnode->clusterId, "createStream", name.dbname, "", createStreamReq.sql,
|
auditRecord(pReq, pMnode->clusterId, "createStream", name.dbname, name.tname,
|
||||||
strlen(createStreamReq.sql));
|
createStreamReq.sql, strlen(createStreamReq.sql));
|
||||||
}
|
}
|
||||||
_OVER:
|
_OVER:
|
||||||
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
||||||
|
@ -1291,10 +1291,9 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) {
|
||||||
removeStreamTasksInBuf(pStream, &execInfo);
|
removeStreamTasksInBuf(pStream, &execInfo);
|
||||||
|
|
||||||
SName name = {0};
|
SName name = {0};
|
||||||
tNameFromString(&name, dropReq.name, T_NAME_ACCT | T_NAME_DB);
|
tNameFromString(&name, dropReq.name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||||
// reuse this function for stream
|
|
||||||
|
|
||||||
auditRecord(pReq, pMnode->clusterId, "dropStream", name.dbname, "", dropReq.sql, dropReq.sqlLen);
|
auditRecord(pReq, pMnode->clusterId, "dropStream", name.dbname, name.tname, dropReq.sql, dropReq.sqlLen);
|
||||||
|
|
||||||
sdbRelease(pMnode->pSdb, pStream);
|
sdbRelease(pMnode->pSdb, pStream);
|
||||||
mndTransDrop(pTrans);
|
mndTransDrop(pTrans);
|
||||||
|
|
|
@ -611,10 +611,10 @@ static int32_t mndProcessCreateTopicReq(SRpcMsg *pReq) {
|
||||||
tNameFromString(&dbname, createTopicReq.subDbName, T_NAME_ACCT | T_NAME_DB);
|
tNameFromString(&dbname, createTopicReq.subDbName, T_NAME_ACCT | T_NAME_DB);
|
||||||
|
|
||||||
SName topicName = {0};
|
SName topicName = {0};
|
||||||
tNameFromString(&topicName, createTopicReq.name, T_NAME_ACCT | T_NAME_DB);
|
tNameFromString(&topicName, createTopicReq.name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||||
//reuse this function for topic
|
//reuse this function for topic
|
||||||
|
|
||||||
auditRecord(pReq, pMnode->clusterId, "createTopic", topicName.dbname, dbname.dbname,
|
auditRecord(pReq, pMnode->clusterId, "createTopic", dbname.dbname, topicName.dbname,
|
||||||
createTopicReq.sql, strlen(createTopicReq.sql));
|
createTopicReq.sql, strlen(createTopicReq.sql));
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
|
@ -817,10 +817,10 @@ end:
|
||||||
}
|
}
|
||||||
|
|
||||||
SName name = {0};
|
SName name = {0};
|
||||||
tNameFromString(&name, dropReq.name, T_NAME_ACCT | T_NAME_DB);
|
tNameFromString(&name, dropReq.name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||||
//reuse this function for topic
|
//reuse this function for topic
|
||||||
|
|
||||||
auditRecord(pReq, pMnode->clusterId, "dropTopic", name.dbname, "", dropReq.sql, dropReq.sqlLen);
|
auditRecord(pReq, pMnode->clusterId, "dropTopic", name.dbname, name.tname, dropReq.sql, dropReq.sqlLen);
|
||||||
|
|
||||||
tFreeSMDropTopicReq(&dropReq);
|
tFreeSMDropTopicReq(&dropReq);
|
||||||
|
|
||||||
|
|
|
@ -1561,7 +1561,7 @@ static int32_t mndProcessCreateUserReq(SRpcMsg *pReq) {
|
||||||
code = mndCreateUser(pMnode, pOperUser->acct, &createReq, pReq);
|
code = mndCreateUser(pMnode, pOperUser->acct, &createReq, pReq);
|
||||||
if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;
|
if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;
|
||||||
|
|
||||||
auditRecord(pReq, pMnode->clusterId, "createUser", createReq.user, "", createReq.sql, createReq.sqlLen);
|
auditRecord(pReq, pMnode->clusterId, "createUser", "", createReq.user, createReq.sql, createReq.sqlLen);
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
||||||
|
@ -1746,7 +1746,11 @@ static int32_t mndRemoveTablePriviledge(SMnode *pMnode, SHashObj *hash, SHashObj
|
||||||
|
|
||||||
int32_t dbKeyLen = strlen(alterReq->objname) + 1;
|
int32_t dbKeyLen = strlen(alterReq->objname) + 1;
|
||||||
int32_t *currRef = taosHashGet(useDbHash, alterReq->objname, dbKeyLen);
|
int32_t *currRef = taosHashGet(useDbHash, alterReq->objname, dbKeyLen);
|
||||||
if (NULL == currRef || 1 == *currRef) {
|
if (NULL == currRef) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (1 == *currRef) {
|
||||||
if (taosHashRemove(useDbHash, alterReq->objname, dbKeyLen) != 0) {
|
if (taosHashRemove(useDbHash, alterReq->objname, dbKeyLen) != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -2094,12 +2098,12 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) {
|
||||||
sprintf(detail, "alterType:%s, enable:%d, superUser:%d, sysInfo:%d, tabName:%s, password:xxx",
|
sprintf(detail, "alterType:%s, enable:%d, superUser:%d, sysInfo:%d, tabName:%s, password:xxx",
|
||||||
mndUserAuditTypeStr(alterReq.alterType), alterReq.enable, alterReq.superUser, alterReq.sysInfo,
|
mndUserAuditTypeStr(alterReq.alterType), alterReq.enable, alterReq.superUser, alterReq.sysInfo,
|
||||||
alterReq.tabName);
|
alterReq.tabName);
|
||||||
auditRecord(pReq, pMnode->clusterId, "alterUser", alterReq.user, "", detail, strlen(detail));
|
auditRecord(pReq, pMnode->clusterId, "alterUser", "", alterReq.user, detail, strlen(detail));
|
||||||
}
|
}
|
||||||
else if(alterReq.alterType == TSDB_ALTER_USER_SUPERUSER ||
|
else if(alterReq.alterType == TSDB_ALTER_USER_SUPERUSER ||
|
||||||
alterReq.alterType == TSDB_ALTER_USER_ENABLE ||
|
alterReq.alterType == TSDB_ALTER_USER_ENABLE ||
|
||||||
alterReq.alterType == TSDB_ALTER_USER_SYSINFO){
|
alterReq.alterType == TSDB_ALTER_USER_SYSINFO){
|
||||||
auditRecord(pReq, pMnode->clusterId, "alterUser", alterReq.user, "", alterReq.sql, alterReq.sqlLen);
|
auditRecord(pReq, pMnode->clusterId, "alterUser", "", alterReq.user, alterReq.sql, alterReq.sqlLen);
|
||||||
}
|
}
|
||||||
else if(ALTER_USER_ADD_READ_DB_PRIV(alterReq.alterType, alterReq.privileges, alterReq.tabName)||
|
else if(ALTER_USER_ADD_READ_DB_PRIV(alterReq.alterType, alterReq.privileges, alterReq.tabName)||
|
||||||
ALTER_USER_ADD_WRITE_DB_PRIV(alterReq.alterType, alterReq.privileges, alterReq.tabName)||
|
ALTER_USER_ADD_WRITE_DB_PRIV(alterReq.alterType, alterReq.privileges, alterReq.tabName)||
|
||||||
|
@ -2110,29 +2114,29 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) {
|
||||||
if (strcmp(alterReq.objname, "1.*") != 0){
|
if (strcmp(alterReq.objname, "1.*") != 0){
|
||||||
SName name = {0};
|
SName name = {0};
|
||||||
tNameFromString(&name, alterReq.objname, T_NAME_ACCT | T_NAME_DB);
|
tNameFromString(&name, alterReq.objname, T_NAME_ACCT | T_NAME_DB);
|
||||||
auditRecord(pReq, pMnode->clusterId, "GrantPrivileges", alterReq.user, name.dbname,
|
auditRecord(pReq, pMnode->clusterId, "GrantPrivileges", name.dbname, alterReq.user,
|
||||||
alterReq.sql, alterReq.sqlLen);
|
alterReq.sql, alterReq.sqlLen);
|
||||||
}else{
|
}else{
|
||||||
auditRecord(pReq, pMnode->clusterId, "GrantPrivileges", alterReq.user, "*",
|
auditRecord(pReq, pMnode->clusterId, "GrantPrivileges", "", alterReq.user,
|
||||||
alterReq.sql, alterReq.sqlLen);
|
alterReq.sql, alterReq.sqlLen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(ALTER_USER_ADD_SUBSCRIBE_TOPIC_PRIV(alterReq.alterType, alterReq.privileges)){
|
else if(ALTER_USER_ADD_SUBSCRIBE_TOPIC_PRIV(alterReq.alterType, alterReq.privileges)){
|
||||||
auditRecord(pReq, pMnode->clusterId, "GrantPrivileges", alterReq.user, alterReq.objname,
|
auditRecord(pReq, pMnode->clusterId, "GrantPrivileges", alterReq.objname, alterReq.user,
|
||||||
alterReq.sql, alterReq.sqlLen);
|
alterReq.sql, alterReq.sqlLen);
|
||||||
}
|
}
|
||||||
else if(ALTER_USER_DEL_SUBSCRIBE_TOPIC_PRIV(alterReq.alterType, alterReq.privileges)){
|
else if(ALTER_USER_DEL_SUBSCRIBE_TOPIC_PRIV(alterReq.alterType, alterReq.privileges)){
|
||||||
auditRecord(pReq, pMnode->clusterId, "RevokePrivileges", alterReq.user, alterReq.objname,
|
auditRecord(pReq, pMnode->clusterId, "RevokePrivileges", alterReq.objname, alterReq.user,
|
||||||
alterReq.sql, alterReq.sqlLen);
|
alterReq.sql, alterReq.sqlLen);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if (strcmp(alterReq.objname, "1.*") != 0){
|
if (strcmp(alterReq.objname, "1.*") != 0){
|
||||||
SName name = {0};
|
SName name = {0};
|
||||||
tNameFromString(&name, alterReq.objname, T_NAME_ACCT | T_NAME_DB);
|
tNameFromString(&name, alterReq.objname, T_NAME_ACCT | T_NAME_DB);
|
||||||
auditRecord(pReq, pMnode->clusterId, "RevokePrivileges", alterReq.user, name.dbname,
|
auditRecord(pReq, pMnode->clusterId, "RevokePrivileges", name.dbname, alterReq.user,
|
||||||
alterReq.sql, alterReq.sqlLen);
|
alterReq.sql, alterReq.sqlLen);
|
||||||
}else{
|
}else{
|
||||||
auditRecord(pReq, pMnode->clusterId, "RevokePrivileges", alterReq.user, "*",
|
auditRecord(pReq, pMnode->clusterId, "RevokePrivileges", "", alterReq.user,
|
||||||
alterReq.sql, alterReq.sqlLen);
|
alterReq.sql, alterReq.sqlLen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2207,7 +2211,7 @@ static int32_t mndProcessDropUserReq(SRpcMsg *pReq) {
|
||||||
code = mndDropUser(pMnode, pReq, pUser);
|
code = mndDropUser(pMnode, pReq, pUser);
|
||||||
if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;
|
if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;
|
||||||
|
|
||||||
auditRecord(pReq, pMnode->clusterId, "dropUser", dropReq.user, "", dropReq.sql, dropReq.sqlLen);
|
auditRecord(pReq, pMnode->clusterId, "dropUser", "", dropReq.user, dropReq.sql, dropReq.sqlLen);
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
||||||
|
|
|
@ -2185,7 +2185,7 @@ static int32_t mndProcessRedistributeVgroupMsg(SRpcMsg *pReq) {
|
||||||
char obj[33] = {0};
|
char obj[33] = {0};
|
||||||
sprintf(obj, "%d", req.vgId);
|
sprintf(obj, "%d", req.vgId);
|
||||||
|
|
||||||
auditRecord(pReq, pMnode->clusterId, "RedistributeVgroup", obj, "", req.sql, req.sqlLen);
|
auditRecord(pReq, pMnode->clusterId, "RedistributeVgroup", "", obj, req.sql, req.sqlLen);
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
||||||
|
|
|
@ -606,8 +606,10 @@ int32_t tsdbTFileSetRemove(STFileSet *fset) {
|
||||||
if (fset == NULL) return 0;
|
if (fset == NULL) return 0;
|
||||||
|
|
||||||
for (tsdb_ftype_t ftype = TSDB_FTYPE_MIN; ftype < TSDB_FTYPE_MAX; ++ftype) {
|
for (tsdb_ftype_t ftype = TSDB_FTYPE_MIN; ftype < TSDB_FTYPE_MAX; ++ftype) {
|
||||||
if (fset->farr[ftype] == NULL) continue;
|
if (fset->farr[ftype] != NULL) {
|
||||||
tsdbTFileObjRemove(fset->farr[ftype]);
|
tsdbTFileObjRemove(fset->farr[ftype]);
|
||||||
|
fset->farr[ftype] = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TARRAY2_DESTROY(fset->lvlArr, tsdbSttLvlRemove);
|
TARRAY2_DESTROY(fset->lvlArr, tsdbSttLvlRemove);
|
||||||
|
|
|
@ -485,9 +485,10 @@ _exit:
|
||||||
static int32_t tsdbDoMerge(SMerger *merger) {
|
static int32_t tsdbDoMerge(SMerger *merger) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
int32_t lino = 0;
|
int32_t lino = 0;
|
||||||
SSttLvl *lvl = TARRAY2_FIRST(merger->fset->lvlArr);
|
|
||||||
|
|
||||||
if (TARRAY2_SIZE(merger->fset->lvlArr) == 0) return 0;
|
if (TARRAY2_SIZE(merger->fset->lvlArr) == 0) return 0;
|
||||||
|
|
||||||
|
SSttLvl *lvl = TARRAY2_FIRST(merger->fset->lvlArr);
|
||||||
if (lvl->level != 0 || TARRAY2_SIZE(lvl->fobjArr) < merger->sttTrigger) return 0;
|
if (lvl->level != 0 || TARRAY2_SIZE(lvl->fobjArr) < merger->sttTrigger) return 0;
|
||||||
|
|
||||||
code = tsdbMergerOpen(merger);
|
code = tsdbMergerOpen(merger);
|
||||||
|
|
|
@ -895,6 +895,10 @@ void nodesDestroyNode(SNode* pNode) {
|
||||||
}
|
}
|
||||||
tdDestroySVCreateTbReq(pStmt->pCreateTblReq);
|
tdDestroySVCreateTbReq(pStmt->pCreateTblReq);
|
||||||
taosMemoryFreeClear(pStmt->pCreateTblReq);
|
taosMemoryFreeClear(pStmt->pCreateTblReq);
|
||||||
|
if (pStmt->freeStbRowsCxtFunc) {
|
||||||
|
pStmt->freeStbRowsCxtFunc(pStmt->pStbRowsCxt);
|
||||||
|
}
|
||||||
|
taosMemoryFreeClear(pStmt->pStbRowsCxt);
|
||||||
taosCloseFile(&pStmt->fp);
|
taosCloseFile(&pStmt->fp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,9 +45,10 @@ int16_t insFindCol(struct SToken *pColname, int16_t start, int16_t end, SSchema
|
||||||
void insBuildCreateTbReq(SVCreateTbReq *pTbReq, const char *tname, STag *pTag, int64_t suid, const char *sname,
|
void insBuildCreateTbReq(SVCreateTbReq *pTbReq, const char *tname, STag *pTag, int64_t suid, const char *sname,
|
||||||
SArray *tagName, uint8_t tagNum, int32_t ttl);
|
SArray *tagName, uint8_t tagNum, int32_t ttl);
|
||||||
int32_t insInitBoundColsInfo(int32_t numOfBound, SBoundColInfo *pInfo);
|
int32_t insInitBoundColsInfo(int32_t numOfBound, SBoundColInfo *pInfo);
|
||||||
|
void insInitColValues(STableMeta* pTableMeta, SArray* aColValues);
|
||||||
void insCheckTableDataOrder(STableDataCxt *pTableCxt, TSKEY tsKey);
|
void insCheckTableDataOrder(STableDataCxt *pTableCxt, TSKEY tsKey);
|
||||||
int32_t insGetTableDataCxt(SHashObj *pHash, void *id, int32_t idLen, STableMeta *pTableMeta,
|
int32_t insGetTableDataCxt(SHashObj *pHash, void *id, int32_t idLen, STableMeta *pTableMeta,
|
||||||
SVCreateTbReq **pCreateTbReq, STableDataCxt **pTableCxt, bool colMode);
|
SVCreateTbReq **pCreateTbReq, STableDataCxt **pTableCxt, bool colMode, bool ignoreColVals);
|
||||||
int32_t initTableColSubmitData(STableDataCxt *pTableCxt);
|
int32_t initTableColSubmitData(STableDataCxt *pTableCxt);
|
||||||
int32_t insMergeTableDataCxt(SHashObj *pTableHash, SArray **pVgDataBlocks);
|
int32_t insMergeTableDataCxt(SHashObj *pTableHash, SArray **pVgDataBlocks);
|
||||||
int32_t insBuildVgDataBlocks(SHashObj *pVgroupsHashObj, SArray *pVgDataBlocks, SArray **pDataBlocks);
|
int32_t insBuildVgDataBlocks(SHashObj *pVgroupsHashObj, SArray *pVgDataBlocks, SArray **pDataBlocks);
|
||||||
|
|
|
@ -169,7 +169,7 @@ STableDataCxt* smlInitTableDataCtx(SQuery* query, STableMeta* pTableMeta) {
|
||||||
STableDataCxt* pTableCxt = NULL;
|
STableDataCxt* pTableCxt = NULL;
|
||||||
SVCreateTbReq* pCreateTbReq = NULL;
|
SVCreateTbReq* pCreateTbReq = NULL;
|
||||||
int ret = insGetTableDataCxt(((SVnodeModifyOpStmt*)(query->pRoot))->pTableBlockHashObj, &pTableMeta->uid,
|
int ret = insGetTableDataCxt(((SVnodeModifyOpStmt*)(query->pRoot))->pTableBlockHashObj, &pTableMeta->uid,
|
||||||
sizeof(pTableMeta->uid), pTableMeta, &pCreateTbReq, &pTableCxt, false);
|
sizeof(pTableMeta->uid), pTableMeta, &pCreateTbReq, &pTableCxt, false, false);
|
||||||
if (ret != TSDB_CODE_SUCCESS) {
|
if (ret != TSDB_CODE_SUCCESS) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -305,7 +305,7 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc
|
||||||
|
|
||||||
STableDataCxt* pTableCxt = NULL;
|
STableDataCxt* pTableCxt = NULL;
|
||||||
ret = insGetTableDataCxt(((SVnodeModifyOpStmt*)(query->pRoot))->pTableBlockHashObj, &pTableMeta->uid,
|
ret = insGetTableDataCxt(((SVnodeModifyOpStmt*)(query->pRoot))->pTableBlockHashObj, &pTableMeta->uid,
|
||||||
sizeof(pTableMeta->uid), pTableMeta, &pCreateTblReq, &pTableCxt, false);
|
sizeof(pTableMeta->uid), pTableMeta, &pCreateTblReq, &pTableCxt, false, false);
|
||||||
if (ret != TSDB_CODE_SUCCESS) {
|
if (ret != TSDB_CODE_SUCCESS) {
|
||||||
buildInvalidOperationMsg(&pBuf, "insGetTableDataCxt error");
|
buildInvalidOperationMsg(&pBuf, "insGetTableDataCxt error");
|
||||||
goto end;
|
goto end;
|
||||||
|
|
|
@ -182,9 +182,32 @@ static int32_t parseDuplicateUsingClause(SInsertParseContext* pCxt, SVnodeModify
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
BOUND_TAGS,
|
||||||
|
BOUND_COLUMNS,
|
||||||
|
BOUND_ALL_AND_TBNAME
|
||||||
|
} EBoundColumnsType;
|
||||||
|
|
||||||
|
static int32_t getTbnameSchemaIndex(STableMeta* pTableMeta) {
|
||||||
|
return pTableMeta->tableInfo.numOfTags + pTableMeta->tableInfo.numOfColumns;
|
||||||
|
}
|
||||||
|
|
||||||
// pStmt->pSql -> field1_name, ...)
|
// pStmt->pSql -> field1_name, ...)
|
||||||
static int32_t parseBoundColumns(SInsertParseContext* pCxt, const char** pSql, bool isTags, SSchema* pSchema,
|
static int32_t parseBoundColumns(SInsertParseContext* pCxt, const char** pSql, EBoundColumnsType boundColsType, STableMeta* pTableMeta,
|
||||||
SBoundColInfo* pBoundInfo) {
|
SBoundColInfo* pBoundInfo) {
|
||||||
|
SSchema* pSchema = NULL;
|
||||||
|
if (boundColsType == BOUND_TAGS) {
|
||||||
|
pSchema = getTableTagSchema(pTableMeta);
|
||||||
|
} else if (boundColsType == BOUND_COLUMNS) {
|
||||||
|
pSchema = getTableColumnSchema(pTableMeta);
|
||||||
|
} else {
|
||||||
|
pSchema = pTableMeta->schema;
|
||||||
|
if (pBoundInfo->numOfCols != getTbnameSchemaIndex(pTableMeta) + 1) {
|
||||||
|
return TSDB_CODE_PAR_INTERNAL_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int32_t tbnameSchemaIndex = getTbnameSchemaIndex(pTableMeta);
|
||||||
|
|
||||||
bool* pUseCols = taosMemoryCalloc(pBoundInfo->numOfCols, sizeof(bool));
|
bool* pUseCols = taosMemoryCalloc(pBoundInfo->numOfCols, sizeof(bool));
|
||||||
if (NULL == pUseCols) {
|
if (NULL == pUseCols) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
@ -207,8 +230,16 @@ static int32_t parseBoundColumns(SInsertParseContext* pCxt, const char** pSql, b
|
||||||
token.z = tmpTokenBuf;
|
token.z = tmpTokenBuf;
|
||||||
token.n = strdequote(token.z);
|
token.n = strdequote(token.z);
|
||||||
|
|
||||||
|
if (boundColsType == BOUND_ALL_AND_TBNAME &&
|
||||||
|
token.n == strlen("tbname") && (strcasecmp(token.z, "tbname") == 0)) {
|
||||||
|
pBoundInfo->pColIndex[pBoundInfo->numOfBound] = tbnameSchemaIndex;
|
||||||
|
pUseCols[tbnameSchemaIndex] = true;
|
||||||
|
++pBoundInfo->numOfBound;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
int16_t t = lastColIdx + 1;
|
int16_t t = lastColIdx + 1;
|
||||||
int16_t index = insFindCol(&token, t, pBoundInfo->numOfCols, pSchema);
|
int16_t end = (boundColsType == BOUND_ALL_AND_TBNAME) ? (pBoundInfo->numOfCols - 1) : pBoundInfo->numOfCols;
|
||||||
|
int16_t index = insFindCol(&token, t, end, pSchema);
|
||||||
if (index < 0 && t > 0) {
|
if (index < 0 && t > 0) {
|
||||||
index = insFindCol(&token, 0, t, pSchema);
|
index = insFindCol(&token, 0, t, pSchema);
|
||||||
}
|
}
|
||||||
|
@ -224,10 +255,12 @@ static int32_t parseBoundColumns(SInsertParseContext* pCxt, const char** pSql, b
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code && !isTags && !pUseCols[0]) {
|
if (TSDB_CODE_SUCCESS == code && (BOUND_TAGS != boundColsType) && !pUseCols[0]) {
|
||||||
code = buildInvalidOperationMsg(&pCxt->msg, "primary timestamp column can not be null");
|
code = buildInvalidOperationMsg(&pCxt->msg, "primary timestamp column can not be null");
|
||||||
}
|
}
|
||||||
|
if (TSDB_CODE_SUCCESS == code && (BOUND_ALL_AND_TBNAME == boundColsType) &&!pUseCols[tbnameSchemaIndex]) {
|
||||||
|
code = buildInvalidOperationMsg(&pCxt->msg, "tbname column can not be null");
|
||||||
|
}
|
||||||
taosMemoryFree(pUseCols);
|
taosMemoryFree(pUseCols);
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
|
@ -586,10 +619,10 @@ static int32_t parseBoundTagsClause(SInsertParseContext* pCxt, SVnodeModifyOpStm
|
||||||
}
|
}
|
||||||
|
|
||||||
pStmt->pSql += index;
|
pStmt->pSql += index;
|
||||||
return parseBoundColumns(pCxt, &pStmt->pSql, true, getTableTagSchema(pStmt->pTableMeta), &pCxt->tags);
|
return parseBoundColumns(pCxt, &pStmt->pSql, BOUND_TAGS, pStmt->pTableMeta, &pCxt->tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t parseTagValue(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, SSchema* pTagSchema, SToken* pToken,
|
static int32_t parseTagValue(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, const char** ppSql, SSchema* pTagSchema, SToken* pToken,
|
||||||
SArray* pTagName, SArray* pTagVals, STag** pTag) {
|
SArray* pTagName, SArray* pTagVals, STag** pTag) {
|
||||||
if (!isNullValue(pTagSchema->type, pToken)) {
|
if (!isNullValue(pTagSchema->type, pToken)) {
|
||||||
taosArrayPush(pTagName, pTagSchema->name);
|
taosArrayPush(pTagName, pTagSchema->name);
|
||||||
|
@ -609,7 +642,7 @@ static int32_t parseTagValue(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStm
|
||||||
|
|
||||||
STagVal val = {0};
|
STagVal val = {0};
|
||||||
int32_t code =
|
int32_t code =
|
||||||
parseTagToken(&pStmt->pSql, pToken, pTagSchema, pStmt->pTableMeta->tableInfo.precision, &val, &pCxt->msg);
|
parseTagToken(ppSql, pToken, pTagSchema, pStmt->pTableMeta->tableInfo.precision, &val, &pCxt->msg);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
taosArrayPush(pTagVals, &val);
|
taosArrayPush(pTagVals, &val);
|
||||||
}
|
}
|
||||||
|
@ -812,7 +845,7 @@ static int32_t parseTagsClauseImpl(SInsertParseContext* pCxt, SVnodeModifyOpStmt
|
||||||
isJson = pTagSchema->type == TSDB_DATA_TYPE_JSON;
|
isJson = pTagSchema->type == TSDB_DATA_TYPE_JSON;
|
||||||
code = checkAndTrimValue(&token, pCxt->tmpTokenBuf, &pCxt->msg);
|
code = checkAndTrimValue(&token, pCxt->tmpTokenBuf, &pCxt->msg);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = parseTagValue(pCxt, pStmt, pTagSchema, &token, pTagName, pTagVals, &pTag);
|
code = parseTagValue(pCxt, pStmt, &pStmt->pSql, pTagSchema, &token, pTagName, pTagVals, &pTag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -867,7 +900,7 @@ static int32_t parseTagsClause(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pS
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t storeTableMeta(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt) {
|
static int32_t storeChildTableMeta(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt) {
|
||||||
pStmt->pTableMeta->suid = pStmt->pTableMeta->uid;
|
pStmt->pTableMeta->suid = pStmt->pTableMeta->uid;
|
||||||
pStmt->pTableMeta->uid = pStmt->totalTbNum;
|
pStmt->pTableMeta->uid = pStmt->totalTbNum;
|
||||||
pStmt->pTableMeta->tableType = TSDB_CHILD_TABLE;
|
pStmt->pTableMeta->tableType = TSDB_CHILD_TABLE;
|
||||||
|
@ -974,27 +1007,12 @@ static int32_t checkAuth(SParseContext* pCxt, SName* pTbName, bool* pMissCache,
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t checkAuthForTable(SParseContext* pCxt, SName* pTbName, bool* pMissCache, bool* pNeedTableTagVal) {
|
static int32_t getTableMeta(SInsertParseContext* pCxt, SName* pTbName, STableMeta** pTableMeta,
|
||||||
SNode* pTagCond = NULL;
|
bool* pMissCache, bool bUsingTable) {
|
||||||
int32_t code = checkAuth(pCxt, pTbName, pMissCache, &pTagCond);
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
|
||||||
*pNeedTableTagVal = ((*pMissCache) || (NULL != pTagCond));
|
|
||||||
*pMissCache = (NULL != pTagCond);
|
|
||||||
}
|
|
||||||
nodesDestroyNode(pTagCond);
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t checkAuthForStable(SParseContext* pCxt, SName* pTbName, bool* pMissCache, SNode** pTagCond) {
|
|
||||||
return checkAuth(pCxt, pTbName, pMissCache, pTagCond);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t getTableMeta(SInsertParseContext* pCxt, SName* pTbName, bool isStb, STableMeta** pTableMeta,
|
|
||||||
bool* pMissCache) {
|
|
||||||
SParseContext* pComCxt = pCxt->pComCxt;
|
SParseContext* pComCxt = pCxt->pComCxt;
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
if (pComCxt->async) {
|
if (pComCxt->async) {
|
||||||
if (isStb) {
|
if (bUsingTable) {
|
||||||
code = catalogGetCachedSTableMeta(pComCxt->pCatalog, pTbName, pTableMeta);
|
code = catalogGetCachedSTableMeta(pComCxt->pCatalog, pTbName, pTableMeta);
|
||||||
} else {
|
} else {
|
||||||
code = catalogGetCachedTableMeta(pComCxt->pCatalog, pTbName, pTableMeta);
|
code = catalogGetCachedTableMeta(pComCxt->pCatalog, pTbName, pTableMeta);
|
||||||
|
@ -1004,7 +1022,7 @@ static int32_t getTableMeta(SInsertParseContext* pCxt, SName* pTbName, bool isSt
|
||||||
.requestId = pComCxt->requestId,
|
.requestId = pComCxt->requestId,
|
||||||
.requestObjRefId = pComCxt->requestRid,
|
.requestObjRefId = pComCxt->requestRid,
|
||||||
.mgmtEps = pComCxt->mgmtEpSet};
|
.mgmtEps = pComCxt->mgmtEpSet};
|
||||||
if (isStb) {
|
if (bUsingTable) {
|
||||||
code = catalogGetSTableMeta(pComCxt->pCatalog, &conn, pTbName, pTableMeta);
|
code = catalogGetSTableMeta(pComCxt->pCatalog, &conn, pTbName, pTableMeta);
|
||||||
} else {
|
} else {
|
||||||
code = catalogGetTableMeta(pComCxt->pCatalog, &conn, pTbName, pTableMeta);
|
code = catalogGetTableMeta(pComCxt->pCatalog, &conn, pTbName, pTableMeta);
|
||||||
|
@ -1013,16 +1031,14 @@ static int32_t getTableMeta(SInsertParseContext* pCxt, SName* pTbName, bool isSt
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
if (NULL == *pTableMeta) {
|
if (NULL == *pTableMeta) {
|
||||||
*pMissCache = true;
|
*pMissCache = true;
|
||||||
} else if (isStb && TSDB_SUPER_TABLE != (*pTableMeta)->tableType) {
|
} else if (bUsingTable && TSDB_SUPER_TABLE != (*pTableMeta)->tableType) {
|
||||||
code = buildInvalidOperationMsg(&pCxt->msg, "create table only from super table is allowed");
|
code = buildInvalidOperationMsg(&pCxt->msg, "create table only from super table is allowed");
|
||||||
} else if (!isStb && TSDB_SUPER_TABLE == (*pTableMeta)->tableType) {
|
|
||||||
code = buildInvalidOperationMsg(&pCxt->msg, "insert data into super table is not supported");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t getTableVgroup(SParseContext* pCxt, SVnodeModifyOpStmt* pStmt, bool isStb, bool* pMissCache) {
|
static int32_t getTargetTableVgroup(SParseContext* pCxt, SVnodeModifyOpStmt* pStmt, bool isStb, bool* pMissCache) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
SVgroupInfo vg;
|
SVgroupInfo vg;
|
||||||
bool exists = true;
|
bool exists = true;
|
||||||
|
@ -1047,27 +1063,34 @@ static int32_t getTableVgroup(SParseContext* pCxt, SVnodeModifyOpStmt* pStmt, bo
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t getTableMetaAndVgroupImpl(SParseContext* pCxt, SVnodeModifyOpStmt* pStmt, bool* pMissCache) {
|
static int32_t getTargetTableMetaAndVgroup(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, bool* pMissCache) {
|
||||||
SVgroupInfo vg;
|
|
||||||
int32_t code = catalogGetCachedTableVgMeta(pCxt->pCatalog, &pStmt->targetTableName, &vg, &pStmt->pTableMeta);
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
|
||||||
if (NULL != pStmt->pTableMeta) {
|
|
||||||
code = taosHashPut(pStmt->pVgroupsHashObj, (const char*)&vg.vgId, sizeof(vg.vgId), (char*)&vg, sizeof(vg));
|
|
||||||
}
|
|
||||||
*pMissCache = (NULL == pStmt->pTableMeta);
|
|
||||||
}
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t getTableMetaAndVgroup(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, bool* pMissCache) {
|
|
||||||
SParseContext* pComCxt = pCxt->pComCxt;
|
SParseContext* pComCxt = pCxt->pComCxt;
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
if (pComCxt->async) {
|
if (pComCxt->async) {
|
||||||
code = getTableMetaAndVgroupImpl(pComCxt, pStmt, pMissCache);
|
{
|
||||||
|
SVgroupInfo vg;
|
||||||
|
code = catalogGetCachedTableVgMeta(pComCxt->pCatalog, &pStmt->targetTableName, &vg, &pStmt->pTableMeta);
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
if (NULL != pStmt->pTableMeta) {
|
||||||
|
if (pStmt->pTableMeta->tableType == TSDB_SUPER_TABLE) {
|
||||||
|
pStmt->stbSyntax = true;
|
||||||
} else {
|
} else {
|
||||||
code = getTableMeta(pCxt, &pStmt->targetTableName, false, &pStmt->pTableMeta, pMissCache);
|
code = taosHashPut(pStmt->pVgroupsHashObj, (const char*)&vg.vgId, sizeof(vg.vgId), (char*)&vg, sizeof(vg));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*pMissCache = (NULL == pStmt->pTableMeta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
bool bUsingTable = false;
|
||||||
|
code = getTableMeta(pCxt, &pStmt->targetTableName, &pStmt->pTableMeta, pMissCache, bUsingTable);
|
||||||
if (TSDB_CODE_SUCCESS == code && !pCxt->missCache) {
|
if (TSDB_CODE_SUCCESS == code && !pCxt->missCache) {
|
||||||
code = getTableVgroup(pCxt->pComCxt, pStmt, false, &pCxt->missCache);
|
if (TSDB_SUPER_TABLE == pStmt->pTableMeta->tableType) {
|
||||||
|
pStmt->stbSyntax = true;
|
||||||
|
}
|
||||||
|
if (!pStmt->stbSyntax) {
|
||||||
|
code = getTargetTableVgroup(pCxt->pComCxt, pStmt, false, &pCxt->missCache);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
|
@ -1090,11 +1113,21 @@ static int32_t getTargetTableSchema(SInsertParseContext* pCxt, SVnodeModifyOpStm
|
||||||
pCxt->missCache = true;
|
pCxt->missCache = true;
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
SNode* pTagCond = NULL;
|
||||||
int32_t code = checkAuthForTable(pCxt->pComCxt, &pStmt->targetTableName, &pCxt->missCache, &pCxt->needTableTagVal);
|
int32_t code = checkAuth(pCxt->pComCxt, &pStmt->targetTableName, &pCxt->missCache, &pTagCond);
|
||||||
if (TSDB_CODE_SUCCESS == code && !pCxt->missCache) {
|
if (TSDB_CODE_SUCCESS == code && !pCxt->missCache) {
|
||||||
code = getTableMetaAndVgroup(pCxt, pStmt, &pCxt->missCache);
|
code = getTargetTableMetaAndVgroup(pCxt, pStmt, &pCxt->missCache);
|
||||||
}
|
}
|
||||||
|
if (TSDB_CODE_SUCCESS == code && !pCxt->missCache) {
|
||||||
|
if (TSDB_SUPER_TABLE != pStmt->pTableMeta->tableType) {
|
||||||
|
pCxt->needTableTagVal = (NULL != pTagCond);
|
||||||
|
pCxt->missCache = (NULL != pTagCond);
|
||||||
|
} else {
|
||||||
|
pStmt->pTagCond = nodesCloneNode(pTagCond);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nodesDestroyNode(pTagCond);
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code && !pCxt->pComCxt->async) {
|
if (TSDB_CODE_SUCCESS == code && !pCxt->pComCxt->async) {
|
||||||
code = collectUseDatabase(&pStmt->targetTableName, pStmt->pDbFNameHashObj);
|
code = collectUseDatabase(&pStmt->targetTableName, pStmt->pDbFNameHashObj);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
@ -1114,12 +1147,13 @@ static int32_t getUsingTableSchema(SInsertParseContext* pCxt, SVnodeModifyOpStmt
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t code = checkAuthForStable(pCxt->pComCxt, &pStmt->usingTableName, &pCxt->missCache, &pStmt->pTagCond);
|
int32_t code = checkAuth(pCxt->pComCxt, &pStmt->usingTableName, &pCxt->missCache, &pStmt->pTagCond);
|
||||||
if (TSDB_CODE_SUCCESS == code && !pCxt->missCache) {
|
if (TSDB_CODE_SUCCESS == code && !pCxt->missCache) {
|
||||||
code = getTableMeta(pCxt, &pStmt->usingTableName, true, &pStmt->pTableMeta, &pCxt->missCache);
|
bool bUsingTable = true;
|
||||||
|
code = getTableMeta(pCxt, &pStmt->usingTableName, &pStmt->pTableMeta, &pCxt->missCache, bUsingTable);
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code && !pCxt->missCache) {
|
if (TSDB_CODE_SUCCESS == code && !pCxt->missCache) {
|
||||||
code = getTableVgroup(pCxt->pComCxt, pStmt, true, &pCxt->missCache);
|
code = getTargetTableVgroup(pCxt->pComCxt, pStmt, true, &pCxt->missCache);
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code && !pCxt->pComCxt->async) {
|
if (TSDB_CODE_SUCCESS == code && !pCxt->pComCxt->async) {
|
||||||
code = collectUseDatabase(&pStmt->usingTableName, pStmt->pDbFNameHashObj);
|
code = collectUseDatabase(&pStmt->usingTableName, pStmt->pDbFNameHashObj);
|
||||||
|
@ -1138,7 +1172,7 @@ static int32_t parseUsingTableNameImpl(SInsertParseContext* pCxt, SVnodeModifyOp
|
||||||
code = getUsingTableSchema(pCxt, pStmt);
|
code = getUsingTableSchema(pCxt, pStmt);
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code && !pCxt->missCache) {
|
if (TSDB_CODE_SUCCESS == code && !pCxt->missCache) {
|
||||||
code = storeTableMeta(pCxt, pStmt);
|
code = storeChildTableMeta(pCxt, pStmt);
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -1202,7 +1236,7 @@ static int32_t preParseBoundColumnsClause(SInsertParseContext* pCxt, SVnodeModif
|
||||||
static int32_t getTableDataCxt(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, STableDataCxt** pTableCxt) {
|
static int32_t getTableDataCxt(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, STableDataCxt** pTableCxt) {
|
||||||
if (pCxt->pComCxt->async) {
|
if (pCxt->pComCxt->async) {
|
||||||
return insGetTableDataCxt(pStmt->pTableBlockHashObj, &pStmt->pTableMeta->uid, sizeof(pStmt->pTableMeta->uid),
|
return insGetTableDataCxt(pStmt->pTableBlockHashObj, &pStmt->pTableMeta->uid, sizeof(pStmt->pTableMeta->uid),
|
||||||
pStmt->pTableMeta, &pStmt->pCreateTblReq, pTableCxt, false);
|
pStmt->pTableMeta, &pStmt->pCreateTblReq, pTableCxt, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
char tbFName[TSDB_TABLE_FNAME_LEN];
|
char tbFName[TSDB_TABLE_FNAME_LEN];
|
||||||
|
@ -1211,7 +1245,7 @@ static int32_t getTableDataCxt(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pS
|
||||||
pStmt->pTableMeta->uid = 0;
|
pStmt->pTableMeta->uid = 0;
|
||||||
}
|
}
|
||||||
return insGetTableDataCxt(pStmt->pTableBlockHashObj, tbFName, strlen(tbFName), pStmt->pTableMeta,
|
return insGetTableDataCxt(pStmt->pTableBlockHashObj, tbFName, strlen(tbFName), pStmt->pTableMeta,
|
||||||
&pStmt->pCreateTblReq, pTableCxt, NULL != pCxt->pComCxt->pStmtCb);
|
&pStmt->pCreateTblReq, pTableCxt, NULL != pCxt->pComCxt->pStmtCb, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t parseBoundColumnsClause(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, STableDataCxt* pTableCxt) {
|
static int32_t parseBoundColumnsClause(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, STableDataCxt* pTableCxt) {
|
||||||
|
@ -1224,12 +1258,12 @@ static int32_t parseBoundColumnsClause(SInsertParseContext* pCxt, SVnodeModifyOp
|
||||||
return buildSyntaxErrMsg(&pCxt->msg, "keyword VALUES or FILE is expected", token.z);
|
return buildSyntaxErrMsg(&pCxt->msg, "keyword VALUES or FILE is expected", token.z);
|
||||||
}
|
}
|
||||||
// pStmt->pSql -> field1_name, ...)
|
// pStmt->pSql -> field1_name, ...)
|
||||||
return parseBoundColumns(pCxt, &pStmt->pSql, false, getTableColumnSchema(pStmt->pTableMeta),
|
return parseBoundColumns(pCxt, &pStmt->pSql, BOUND_COLUMNS, pStmt->pTableMeta,
|
||||||
&pTableCxt->boundColsInfo);
|
&pTableCxt->boundColsInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL != pStmt->pBoundCols) {
|
if (NULL != pStmt->pBoundCols) {
|
||||||
return parseBoundColumns(pCxt, &pStmt->pBoundCols, false, getTableColumnSchema(pStmt->pTableMeta),
|
return parseBoundColumns(pCxt, &pStmt->pBoundCols, BOUND_COLUMNS, pStmt->pTableMeta,
|
||||||
&pTableCxt->boundColsInfo);
|
&pTableCxt->boundColsInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1525,8 +1559,282 @@ static void clearColValArray(SArray* pCols) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int parseOneRow(SInsertParseContext* pCxt, const char** pSql, STableDataCxt* pTableCxt, bool* pGotRow,
|
typedef struct SStbRowsDataContext {
|
||||||
SToken* pToken) {
|
SName stbName;
|
||||||
|
|
||||||
|
STableMeta* pStbMeta;
|
||||||
|
SNode* pTagCond;
|
||||||
|
SBoundColInfo boundColsInfo;
|
||||||
|
|
||||||
|
// the following fields are for each stb row
|
||||||
|
SArray* aTagVals;
|
||||||
|
SArray* aColVals;
|
||||||
|
SArray* aTagNames;
|
||||||
|
SName ctbName;
|
||||||
|
STag* pTag;
|
||||||
|
STableMeta* pCtbMeta;
|
||||||
|
SVCreateTbReq* pCreateCtbReq;
|
||||||
|
bool hasTimestampTag;
|
||||||
|
bool isJsonTag;
|
||||||
|
} SStbRowsDataContext;
|
||||||
|
|
||||||
|
typedef union SRowsDataContext{
|
||||||
|
STableDataCxt* pTableDataCxt;
|
||||||
|
SStbRowsDataContext* pStbRowsCxt;
|
||||||
|
} SRowsDataContext;
|
||||||
|
|
||||||
|
static int32_t parseTbnameToken(SInsertParseContext* pCxt, SStbRowsDataContext* pStbRowsCxt, SToken* pToken,
|
||||||
|
char* ctbName, bool* pFoundCtbName) {
|
||||||
|
*pFoundCtbName = false;
|
||||||
|
int32_t code = checkAndTrimValue(pToken, pCxt->tmpTokenBuf, &pCxt->msg);
|
||||||
|
if (code == TSDB_CODE_SUCCESS){
|
||||||
|
if (isNullValue(TSDB_DATA_TYPE_BINARY, pToken)) {
|
||||||
|
return buildInvalidOperationMsg(&pCxt->msg, "tbname can not be null value");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pToken->n > 0) {
|
||||||
|
if (pToken->n <= TSDB_TABLE_NAME_LEN - 1) {
|
||||||
|
memcpy(ctbName, pToken->z, pToken->n);
|
||||||
|
ctbName[pToken->n] = '\0';
|
||||||
|
*pFoundCtbName = true;
|
||||||
|
tNameSetDbName(&pStbRowsCxt->ctbName, pStbRowsCxt->stbName.acctId, pStbRowsCxt->stbName.dbname, strlen(pStbRowsCxt->stbName.dbname));
|
||||||
|
tNameAddTbName(&pStbRowsCxt->ctbName, ctbName, pToken->n);
|
||||||
|
} else {
|
||||||
|
return buildInvalidOperationMsg(&pCxt->msg, "tbname is too long");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return buildInvalidOperationMsg(&pCxt->msg, "tbname can not be empty");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t processCtbTagsAfterCtbName(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt,
|
||||||
|
SStbRowsDataContext* pStbRowsCxt, bool ctbFirst,
|
||||||
|
const SToken* tagTokens, SSchema* const* tagSchemas,
|
||||||
|
int numOfTagTokens) {
|
||||||
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
|
if (code == TSDB_CODE_SUCCESS && ctbFirst) {
|
||||||
|
for (int32_t i = 0; code == TSDB_CODE_SUCCESS && i < numOfTagTokens; ++i) {
|
||||||
|
SToken* pTagToken = (SToken*)(tagTokens + i);
|
||||||
|
SSchema* pTagSchema = tagSchemas[i];
|
||||||
|
code = checkAndTrimValue(pTagToken, pCxt->tmpTokenBuf, &pCxt->msg);
|
||||||
|
if (code == TSDB_CODE_SUCCESS) {
|
||||||
|
code = parseTagValue(pCxt, pStmt, NULL, pTagSchema, pTagToken, pStbRowsCxt->aTagNames, pStbRowsCxt->aTagVals,
|
||||||
|
&pStbRowsCxt->pTag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (code == TSDB_CODE_SUCCESS && !pStbRowsCxt->isJsonTag) {
|
||||||
|
code = tTagNew(pStbRowsCxt->aTagVals, 1, false, &pStbRowsCxt->pTag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (code == TSDB_CODE_SUCCESS && pStbRowsCxt->pTagCond) {
|
||||||
|
code = checkSubtablePrivilege(pStbRowsCxt->aTagVals, pStbRowsCxt->aTagNames, &pStbRowsCxt->pTagCond);
|
||||||
|
}
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t doGetStbRowValues(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, const char** ppSql,
|
||||||
|
SStbRowsDataContext* pStbRowsCxt, SToken* pToken,
|
||||||
|
const SBoundColInfo* pCols, const SSchema* pSchemas,
|
||||||
|
SToken* tagTokens, SSchema** tagSchemas, int* pNumOfTagTokens, bool* bFoundTbName) {
|
||||||
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
SArray* pTagNames = pStbRowsCxt->aTagNames;
|
||||||
|
SArray* pTagVals = pStbRowsCxt->aTagVals;
|
||||||
|
bool canParseTagsAfter = !pStbRowsCxt->pTagCond && !pStbRowsCxt->hasTimestampTag;
|
||||||
|
for (int i = 0; i < pCols->numOfBound && (code) == TSDB_CODE_SUCCESS; ++i) {
|
||||||
|
const char* pTmpSql = *ppSql;
|
||||||
|
bool ignoreComma = false;
|
||||||
|
NEXT_TOKEN_WITH_PREV_EXT(*ppSql, *pToken, &ignoreComma);
|
||||||
|
if (ignoreComma) {
|
||||||
|
code = buildSyntaxErrMsg(&pCxt->msg, "invalid data or symbol", pTmpSql);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TK_NK_RP == pToken->type) {
|
||||||
|
code = generateSyntaxErrMsg(&pCxt->msg, TSDB_CODE_PAR_INVALID_COLUMNS_NUM);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pCols->pColIndex[i] < getNumOfColumns(pStbRowsCxt->pStbMeta)) {
|
||||||
|
const SSchema* pSchema = &pSchemas[pCols->pColIndex[i]];
|
||||||
|
SColVal* pVal = taosArrayGet(pStbRowsCxt->aColVals, pCols->pColIndex[i]);
|
||||||
|
code = parseValueToken(pCxt, ppSql, pToken, (SSchema*)pSchema, getTableInfo(pStbRowsCxt->pStbMeta).precision, pVal);
|
||||||
|
} else if (pCols->pColIndex[i] < getTbnameSchemaIndex(pStbRowsCxt->pStbMeta)) {
|
||||||
|
const SSchema* pTagSchema = &pSchemas[pCols->pColIndex[i]];
|
||||||
|
if (canParseTagsAfter) {
|
||||||
|
tagTokens[(*pNumOfTagTokens)] = *pToken;
|
||||||
|
tagSchemas[(*pNumOfTagTokens)] = (SSchema*)pTagSchema;
|
||||||
|
++(*pNumOfTagTokens);
|
||||||
|
} else {
|
||||||
|
code = checkAndTrimValue(pToken, pCxt->tmpTokenBuf, &pCxt->msg);
|
||||||
|
if (code == TSDB_CODE_SUCCESS) {
|
||||||
|
code = parseTagValue(pCxt, pStmt, ppSql, (SSchema*)pTagSchema, pToken, pTagNames, pTagVals, &pStbRowsCxt->pTag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (pCols->pColIndex[i] == getTbnameSchemaIndex(pStbRowsCxt->pStbMeta)) {
|
||||||
|
char ctbName[TSDB_TABLE_NAME_LEN];
|
||||||
|
code = parseTbnameToken(pCxt, pStbRowsCxt, pToken, ctbName, bFoundTbName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (code == TSDB_CODE_SUCCESS && i < pCols->numOfBound - 1) {
|
||||||
|
NEXT_VALID_TOKEN(*ppSql, *pToken);
|
||||||
|
if (TK_NK_COMMA != pToken->type) {
|
||||||
|
code = buildSyntaxErrMsg(&pCxt->msg, ", expected", pToken->z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t getStbRowValues(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, const char** ppSql,
|
||||||
|
SStbRowsDataContext* pStbRowsCxt, bool* pGotRow,
|
||||||
|
SToken* pToken, bool *pCtbFirst) {
|
||||||
|
SBoundColInfo* pCols = &pStbRowsCxt->boundColsInfo;
|
||||||
|
SSchema* pSchemas = getTableColumnSchema(pStbRowsCxt->pStbMeta);
|
||||||
|
|
||||||
|
bool bFoundTbName = false;
|
||||||
|
const char* pOrigSql = *ppSql;
|
||||||
|
|
||||||
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
SToken tagTokens[TSDB_MAX_TAGS] = {0};
|
||||||
|
SSchema* tagSchemas[TSDB_MAX_TAGS] = {0};
|
||||||
|
int numOfTagTokens = 0;
|
||||||
|
|
||||||
|
code = doGetStbRowValues(pCxt, pStmt, ppSql, pStbRowsCxt, pToken, pCols, pSchemas, tagTokens,
|
||||||
|
tagSchemas, &numOfTagTokens, &bFoundTbName);
|
||||||
|
|
||||||
|
if (code == TSDB_CODE_SUCCESS && !bFoundTbName) {
|
||||||
|
code = buildSyntaxErrMsg(&pCxt->msg, "tbname value expected", pOrigSql);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ctbFirst = true;
|
||||||
|
if (code == TSDB_CODE_SUCCESS) {
|
||||||
|
char ctbFName[TSDB_TABLE_FNAME_LEN];
|
||||||
|
tNameExtractFullName(&pStbRowsCxt->ctbName, ctbFName);
|
||||||
|
STableMeta** pCtbMeta = taosHashGet(pStmt->pSubTableHashObj, ctbFName, strlen(ctbFName));
|
||||||
|
ctbFirst = (pCtbMeta == NULL);
|
||||||
|
if (!ctbFirst) {
|
||||||
|
pStbRowsCxt->pCtbMeta->uid = (*pCtbMeta)->uid;
|
||||||
|
pStbRowsCxt->pCtbMeta->vgId = (*pCtbMeta)->vgId;
|
||||||
|
}
|
||||||
|
*pCtbFirst = ctbFirst;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (code == TSDB_CODE_SUCCESS) {
|
||||||
|
code = processCtbTagsAfterCtbName(pCxt, pStmt, pStbRowsCxt, ctbFirst, tagTokens, tagSchemas, numOfTagTokens);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (code == TSDB_CODE_SUCCESS) {
|
||||||
|
*pGotRow = true;
|
||||||
|
}
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t processCtbAutoCreationAndCtbMeta(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, SStbRowsDataContext* pStbRowsCxt) {
|
||||||
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
|
pStbRowsCxt->pCreateCtbReq = taosMemoryCalloc(1, sizeof(SVCreateTbReq));
|
||||||
|
if (pStbRowsCxt->pCreateCtbReq == NULL) {
|
||||||
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
if (code == TSDB_CODE_SUCCESS) {
|
||||||
|
insBuildCreateTbReq(pStbRowsCxt->pCreateCtbReq, pStbRowsCxt->ctbName.tname, pStbRowsCxt->pTag, pStbRowsCxt->pStbMeta->uid,
|
||||||
|
pStbRowsCxt->stbName.tname, pStbRowsCxt->aTagNames, getNumOfTags(pStbRowsCxt->pStbMeta),
|
||||||
|
TSDB_DEFAULT_TABLE_TTL);
|
||||||
|
pStbRowsCxt->pTag = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (code == TSDB_CODE_SUCCESS) {
|
||||||
|
char ctbFName[TSDB_TABLE_FNAME_LEN];
|
||||||
|
tNameExtractFullName(&pStbRowsCxt->ctbName, ctbFName);
|
||||||
|
SVgroupInfo vg;
|
||||||
|
SRequestConnInfo conn = {.pTrans = pCxt->pComCxt->pTransporter,
|
||||||
|
.requestId = pCxt->pComCxt->requestId,
|
||||||
|
.requestObjRefId = pCxt->pComCxt->requestRid,
|
||||||
|
.mgmtEps = pCxt->pComCxt->mgmtEpSet};
|
||||||
|
code = catalogGetTableHashVgroup(pCxt->pComCxt->pCatalog, &conn, &pStmt->targetTableName, &vg);
|
||||||
|
if (code == TSDB_CODE_SUCCESS) {
|
||||||
|
taosHashPut(pStmt->pVgroupsHashObj, (const char*)(&vg.vgId), sizeof(vg.vgId), &vg, sizeof(vg));
|
||||||
|
pStbRowsCxt->pCtbMeta->uid = taosHashGetSize(pStmt->pSubTableHashObj) + 1;
|
||||||
|
pStbRowsCxt->pCtbMeta->vgId = vg.vgId;
|
||||||
|
|
||||||
|
STableMeta* pBackup = NULL;
|
||||||
|
cloneTableMeta(pStbRowsCxt->pCtbMeta, &pBackup);
|
||||||
|
taosHashPut(pStmt->pSubTableHashObj, ctbFName, strlen(ctbFName), &pBackup, POINTER_BYTES);
|
||||||
|
}
|
||||||
|
collectUseTable(&pStbRowsCxt->ctbName, pStmt->pTableNameHashObj);
|
||||||
|
}
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void resetStbRowsDataContextPreStbRow(SStbRowsDataContext* pStbRowsCxt) {
|
||||||
|
pStbRowsCxt->pCtbMeta->tableType = TSDB_CHILD_TABLE;
|
||||||
|
pStbRowsCxt->pCtbMeta->suid = pStbRowsCxt->pStbMeta->uid;
|
||||||
|
|
||||||
|
insInitColValues(pStbRowsCxt->pStbMeta, pStbRowsCxt->aColVals);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void clearStbRowsDataContext(SStbRowsDataContext* pStbRowsCxt) {
|
||||||
|
if (pStbRowsCxt == NULL) return;
|
||||||
|
|
||||||
|
taosArrayClear(pStbRowsCxt->aTagNames);
|
||||||
|
for (int i = 0; i < taosArrayGetSize(pStbRowsCxt->aTagVals); ++i) {
|
||||||
|
STagVal* p = (STagVal*)taosArrayGet(pStbRowsCxt->aTagVals, i);
|
||||||
|
if (IS_VAR_DATA_TYPE(p->type)) {
|
||||||
|
taosMemoryFreeClear(p->pData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
taosArrayClear(pStbRowsCxt->aTagVals);
|
||||||
|
|
||||||
|
clearColValArray(pStbRowsCxt->aColVals);
|
||||||
|
taosArrayClear(pStbRowsCxt->aColVals);
|
||||||
|
|
||||||
|
tTagFree(pStbRowsCxt->pTag);
|
||||||
|
pStbRowsCxt->pTag = NULL;
|
||||||
|
pStbRowsCxt->pCtbMeta->uid = 0;
|
||||||
|
pStbRowsCxt->pCtbMeta->vgId = 0;
|
||||||
|
tdDestroySVCreateTbReq(pStbRowsCxt->pCreateCtbReq);
|
||||||
|
taosMemoryFreeClear(pStbRowsCxt->pCreateCtbReq);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t parseOneStbRow(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, const char** ppSql,
|
||||||
|
SStbRowsDataContext* pStbRowsCxt, bool* pGotRow, SToken* pToken) {
|
||||||
|
resetStbRowsDataContextPreStbRow(pStbRowsCxt);
|
||||||
|
bool bFirstTable = false;
|
||||||
|
int32_t code = getStbRowValues(pCxt, pStmt, ppSql, pStbRowsCxt, pGotRow, pToken, &bFirstTable);
|
||||||
|
if (code != TSDB_CODE_SUCCESS || !*pGotRow) {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (code == TSDB_CODE_SUCCESS && bFirstTable) {
|
||||||
|
code = processCtbAutoCreationAndCtbMeta(pCxt, pStmt, pStbRowsCxt);
|
||||||
|
}
|
||||||
|
|
||||||
|
STableDataCxt* pTableDataCxt = NULL;
|
||||||
|
code = insGetTableDataCxt(pStmt->pTableBlockHashObj, &pStbRowsCxt->pCtbMeta->uid, sizeof(pStbRowsCxt->pCtbMeta->uid),
|
||||||
|
pStbRowsCxt->pCtbMeta, &pStbRowsCxt->pCreateCtbReq, &pTableDataCxt, false, true);
|
||||||
|
initTableColSubmitData(pTableDataCxt);
|
||||||
|
if (code == TSDB_CODE_SUCCESS) {
|
||||||
|
SRow** pRow = taosArrayReserve(pTableDataCxt->pData->aRowP, 1);
|
||||||
|
code = tRowBuild(pStbRowsCxt->aColVals, pTableDataCxt->pSchema, pRow);
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
insCheckTableDataOrder(pTableDataCxt, TD_ROW_KEY(*pRow));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (code == TSDB_CODE_SUCCESS) {
|
||||||
|
*pGotRow = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
clearStbRowsDataContext(pStbRowsCxt);
|
||||||
|
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int parseOneRow(SInsertParseContext* pCxt, const char** pSql, STableDataCxt* pTableCxt, bool* pGotRow, SToken* pToken) {
|
||||||
SBoundColInfo* pCols = &pTableCxt->boundColsInfo;
|
SBoundColInfo* pCols = &pTableCxt->boundColsInfo;
|
||||||
bool isParseBindParam = false;
|
bool isParseBindParam = false;
|
||||||
SSchema* pSchemas = getTableColumnSchema(pTableCxt->pMeta);
|
SSchema* pSchemas = getTableColumnSchema(pTableCxt->pMeta);
|
||||||
|
@ -1593,7 +1901,7 @@ static int parseOneRow(SInsertParseContext* pCxt, const char** pSql, STableDataC
|
||||||
}
|
}
|
||||||
|
|
||||||
// pSql -> (field1_value, ...) [(field1_value2, ...) ...]
|
// pSql -> (field1_value, ...) [(field1_value2, ...) ...]
|
||||||
static int32_t parseValues(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, STableDataCxt* pTableCxt,
|
static int32_t parseValues(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, SRowsDataContext rowsDataCxt,
|
||||||
int32_t* pNumOfRows, SToken* pToken) {
|
int32_t* pNumOfRows, SToken* pToken) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
|
@ -1608,7 +1916,11 @@ static int32_t parseValues(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt,
|
||||||
|
|
||||||
bool gotRow = false;
|
bool gotRow = false;
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = parseOneRow(pCxt, &pStmt->pSql, pTableCxt, &gotRow, pToken);
|
if (!pStmt->stbSyntax) {
|
||||||
|
code = parseOneRow(pCxt, &pStmt->pSql, rowsDataCxt.pTableDataCxt, &gotRow, pToken);
|
||||||
|
} else {
|
||||||
|
code = parseOneStbRow(pCxt, pStmt, &pStmt->pSql, rowsDataCxt.pStbRowsCxt, &gotRow, pToken);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
@ -1633,10 +1945,10 @@ static int32_t parseValues(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt,
|
||||||
}
|
}
|
||||||
|
|
||||||
// VALUES (field1_value, ...) [(field1_value2, ...) ...]
|
// VALUES (field1_value, ...) [(field1_value2, ...) ...]
|
||||||
static int32_t parseValuesClause(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, STableDataCxt* pTableCxt,
|
static int32_t parseValuesClause(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, SRowsDataContext rowsDataContext,
|
||||||
SToken* pToken) {
|
SToken* pToken) {
|
||||||
int32_t numOfRows = 0;
|
int32_t numOfRows = 0;
|
||||||
int32_t code = parseValues(pCxt, pStmt, pTableCxt, &numOfRows, pToken);
|
int32_t code = parseValues(pCxt, pStmt, rowsDataContext, &numOfRows, pToken);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
pStmt->totalRowsNum += numOfRows;
|
pStmt->totalRowsNum += numOfRows;
|
||||||
pStmt->totalTbNum += 1;
|
pStmt->totalTbNum += 1;
|
||||||
|
@ -1645,7 +1957,7 @@ static int32_t parseValuesClause(SInsertParseContext* pCxt, SVnodeModifyOpStmt*
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t parseCsvFile(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, STableDataCxt* pTableCxt,
|
static int32_t parseCsvFile(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, SRowsDataContext rowsDataCxt,
|
||||||
int32_t* pNumOfRows) {
|
int32_t* pNumOfRows) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
(*pNumOfRows) = 0;
|
(*pNumOfRows) = 0;
|
||||||
|
@ -1668,8 +1980,11 @@ static int32_t parseCsvFile(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt
|
||||||
SToken token;
|
SToken token;
|
||||||
strtolower(pLine, pLine);
|
strtolower(pLine, pLine);
|
||||||
const char* pRow = pLine;
|
const char* pRow = pLine;
|
||||||
|
if (!pStmt->stbSyntax) {
|
||||||
code = parseOneRow(pCxt, (const char**)&pRow, pTableCxt, &gotRow, &token);
|
code = parseOneRow(pCxt, (const char**)&pRow, rowsDataCxt.pTableDataCxt, &gotRow, &token);
|
||||||
|
} else {
|
||||||
|
code = parseOneStbRow(pCxt, pStmt, (const char**)&pRow, rowsDataCxt.pStbRowsCxt, &gotRow, &token);
|
||||||
|
}
|
||||||
if (code && firstLine) {
|
if (code && firstLine) {
|
||||||
firstLine = false;
|
firstLine = false;
|
||||||
code = 0;
|
code = 0;
|
||||||
|
@ -1699,9 +2014,9 @@ static int32_t parseCsvFile(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t parseDataFromFileImpl(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, STableDataCxt* pTableCxt) {
|
static int32_t parseDataFromFileImpl(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, SRowsDataContext rowsDataCxt) {
|
||||||
int32_t numOfRows = 0;
|
int32_t numOfRows = 0;
|
||||||
int32_t code = parseCsvFile(pCxt, pStmt, pTableCxt, &numOfRows);
|
int32_t code = parseCsvFile(pCxt, pStmt, rowsDataCxt, &numOfRows);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
pStmt->totalRowsNum += numOfRows;
|
pStmt->totalRowsNum += numOfRows;
|
||||||
pStmt->totalTbNum += 1;
|
pStmt->totalTbNum += 1;
|
||||||
|
@ -1716,7 +2031,7 @@ static int32_t parseDataFromFileImpl(SInsertParseContext* pCxt, SVnodeModifyOpSt
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t parseDataFromFile(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, SToken* pFilePath,
|
static int32_t parseDataFromFile(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, SToken* pFilePath,
|
||||||
STableDataCxt* pTableCxt) {
|
SRowsDataContext rowsDataCxt) {
|
||||||
char filePathStr[TSDB_FILENAME_LEN] = {0};
|
char filePathStr[TSDB_FILENAME_LEN] = {0};
|
||||||
if (TK_NK_STRING == pFilePath->type) {
|
if (TK_NK_STRING == pFilePath->type) {
|
||||||
trimString(pFilePath->z, pFilePath->n, filePathStr, sizeof(filePathStr));
|
trimString(pFilePath->z, pFilePath->n, filePathStr, sizeof(filePathStr));
|
||||||
|
@ -1728,10 +2043,10 @@ static int32_t parseDataFromFile(SInsertParseContext* pCxt, SVnodeModifyOpStmt*
|
||||||
return TAOS_SYSTEM_ERROR(errno);
|
return TAOS_SYSTEM_ERROR(errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
return parseDataFromFileImpl(pCxt, pStmt, pTableCxt);
|
return parseDataFromFileImpl(pCxt, pStmt, rowsDataCxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t parseFileClause(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, STableDataCxt* pTableCxt,
|
static int32_t parseFileClause(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, SRowsDataContext rowsDataCxt,
|
||||||
SToken* pToken) {
|
SToken* pToken) {
|
||||||
if (tsUseAdapter) {
|
if (tsUseAdapter) {
|
||||||
return buildInvalidOperationMsg(&pCxt->msg, "proxy mode does not support csv loading");
|
return buildInvalidOperationMsg(&pCxt->msg, "proxy mode does not support csv loading");
|
||||||
|
@ -1741,34 +2056,127 @@ static int32_t parseFileClause(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pS
|
||||||
if (0 == pToken->n || (TK_NK_STRING != pToken->type && TK_NK_ID != pToken->type)) {
|
if (0 == pToken->n || (TK_NK_STRING != pToken->type && TK_NK_ID != pToken->type)) {
|
||||||
return buildSyntaxErrMsg(&pCxt->msg, "file path is required following keyword FILE", pToken->z);
|
return buildSyntaxErrMsg(&pCxt->msg, "file path is required following keyword FILE", pToken->z);
|
||||||
}
|
}
|
||||||
return parseDataFromFile(pCxt, pStmt, pToken, pTableCxt);
|
return parseDataFromFile(pCxt, pStmt, pToken, rowsDataCxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
// VALUES (field1_value, ...) [(field1_value2, ...) ...] | FILE csv_file_path
|
// VALUES (field1_value, ...) [(field1_value2, ...) ...] | FILE csv_file_path
|
||||||
static int32_t parseDataClause(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, STableDataCxt* pTableCxt) {
|
static int32_t parseDataClause(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, SRowsDataContext rowsDataCxt) {
|
||||||
SToken token;
|
SToken token;
|
||||||
NEXT_TOKEN(pStmt->pSql, token);
|
NEXT_TOKEN(pStmt->pSql, token);
|
||||||
switch (token.type) {
|
switch (token.type) {
|
||||||
case TK_VALUES:
|
case TK_VALUES:
|
||||||
return parseValuesClause(pCxt, pStmt, pTableCxt, &token);
|
return parseValuesClause(pCxt, pStmt, rowsDataCxt, &token);
|
||||||
case TK_FILE:
|
case TK_FILE:
|
||||||
return parseFileClause(pCxt, pStmt, pTableCxt, &token);
|
return parseFileClause(pCxt, pStmt, rowsDataCxt, &token);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return buildSyntaxErrMsg(&pCxt->msg, "keyword VALUES or FILE is expected", token.z);
|
return buildSyntaxErrMsg(&pCxt->msg, "keyword VALUES or FILE is expected", token.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void destroyStbRowsDataContext(SStbRowsDataContext* pStbRowsCxt) {
|
||||||
|
if (pStbRowsCxt == NULL) return;
|
||||||
|
clearStbRowsDataContext(pStbRowsCxt);
|
||||||
|
taosArrayDestroy(pStbRowsCxt->aColVals);
|
||||||
|
pStbRowsCxt->aColVals = NULL;
|
||||||
|
taosArrayDestroy(pStbRowsCxt->aTagVals);
|
||||||
|
pStbRowsCxt->aTagVals = NULL;
|
||||||
|
taosArrayDestroy(pStbRowsCxt->aTagNames);
|
||||||
|
pStbRowsCxt->aTagNames = NULL;
|
||||||
|
insDestroyBoundColInfo(&pStbRowsCxt->boundColsInfo);
|
||||||
|
tTagFree(pStbRowsCxt->pTag);
|
||||||
|
pStbRowsCxt->pTag = NULL;
|
||||||
|
taosMemoryFreeClear(pStbRowsCxt->pCtbMeta);
|
||||||
|
tdDestroySVCreateTbReq(pStbRowsCxt->pCreateCtbReq);
|
||||||
|
taosMemoryFreeClear(pStbRowsCxt->pCreateCtbReq);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t constructStbRowsDataContext(SVnodeModifyOpStmt* pStmt, SStbRowsDataContext** ppStbRowsCxt) {
|
||||||
|
SStbRowsDataContext* pStbRowsCxt = taosMemoryCalloc(1, sizeof(SStbRowsDataContext));
|
||||||
|
if (!pStbRowsCxt) {
|
||||||
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
tNameAssign(&pStbRowsCxt->stbName, &pStmt->targetTableName);
|
||||||
|
collectUseTable(&pStbRowsCxt->stbName, pStmt->pTableNameHashObj);
|
||||||
|
collectUseDatabase(&pStbRowsCxt->stbName, pStmt->pDbFNameHashObj);
|
||||||
|
|
||||||
|
pStbRowsCxt->pTagCond = pStmt->pTagCond;
|
||||||
|
pStbRowsCxt->pStbMeta = pStmt->pTableMeta;
|
||||||
|
|
||||||
|
cloneTableMeta(pStbRowsCxt->pStbMeta, &pStbRowsCxt->pCtbMeta);
|
||||||
|
pStbRowsCxt->pCtbMeta->tableType = TSDB_CHILD_TABLE;
|
||||||
|
pStbRowsCxt->pCtbMeta->suid = pStbRowsCxt->pStbMeta->uid;
|
||||||
|
|
||||||
|
pStbRowsCxt->aTagNames = taosArrayInit(8, TSDB_COL_NAME_LEN);
|
||||||
|
pStbRowsCxt->aTagVals = taosArrayInit(8, sizeof(STagVal));
|
||||||
|
|
||||||
|
// col values and bound cols info of STableDataContext is not used
|
||||||
|
pStbRowsCxt->aColVals = taosArrayInit(getNumOfColumns(pStbRowsCxt->pStbMeta), sizeof(SColVal));
|
||||||
|
insInitColValues(pStbRowsCxt->pStbMeta, pStbRowsCxt->aColVals);
|
||||||
|
|
||||||
|
STableComInfo tblInfo = getTableInfo(pStmt->pTableMeta);
|
||||||
|
insInitBoundColsInfo(tblInfo.numOfColumns + tblInfo.numOfTags + 1, &pStbRowsCxt->boundColsInfo);
|
||||||
|
|
||||||
|
*ppStbRowsCxt = pStbRowsCxt;
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t parseInsertStbClauseBottom(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt) {
|
||||||
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
if (!pStmt->pBoundCols) {
|
||||||
|
return buildSyntaxErrMsg(&pCxt->msg, "(...tbname, ts...) bounded cols is expected for supertable insertion", pStmt->pSql);
|
||||||
|
}
|
||||||
|
|
||||||
|
SStbRowsDataContext* pStbRowsCxt = NULL;
|
||||||
|
code = constructStbRowsDataContext(pStmt, &pStbRowsCxt);
|
||||||
|
|
||||||
|
if (code == TSDB_CODE_SUCCESS) {
|
||||||
|
code = parseBoundColumns(pCxt, &pStmt->pBoundCols, BOUND_ALL_AND_TBNAME, pStmt->pTableMeta,
|
||||||
|
&pStbRowsCxt->boundColsInfo);
|
||||||
|
pStbRowsCxt->hasTimestampTag = false;
|
||||||
|
for (int32_t i = 0; i < pStbRowsCxt->boundColsInfo.numOfBound; ++i) {
|
||||||
|
int16_t schemaIndex = pStbRowsCxt->boundColsInfo.pColIndex[i];
|
||||||
|
if (schemaIndex != getTbnameSchemaIndex(pStmt->pTableMeta) && schemaIndex >= getNumOfColumns(pStmt->pTableMeta) ) {
|
||||||
|
if (pStmt->pTableMeta->schema[schemaIndex].type == TSDB_DATA_TYPE_TIMESTAMP) {
|
||||||
|
pStbRowsCxt->hasTimestampTag = true;
|
||||||
|
}
|
||||||
|
if (pStmt->pTableMeta->schema[schemaIndex].type == TSDB_DATA_TYPE_JSON) {
|
||||||
|
pStbRowsCxt->isJsonTag = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pStmt->pStbRowsCxt = pStbRowsCxt;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (code == TSDB_CODE_SUCCESS) {
|
||||||
|
SRowsDataContext rowsDataCxt;
|
||||||
|
rowsDataCxt.pStbRowsCxt = pStbRowsCxt;
|
||||||
|
code = parseDataClause(pCxt, pStmt, rowsDataCxt);
|
||||||
|
}
|
||||||
|
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
// input pStmt->pSql:
|
// input pStmt->pSql:
|
||||||
// 1. [(tag1_name, ...)] ...
|
// 1. [(tag1_name, ...)] ...
|
||||||
// 2. VALUES ... | FILE ...
|
// 2. VALUES ... | FILE ...
|
||||||
static int32_t parseInsertTableClauseBottom(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt) {
|
static int32_t parseInsertTableClauseBottom(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt) {
|
||||||
|
if (pStmt->stbSyntax && TSDB_QUERY_HAS_TYPE(pStmt->insertType, TSDB_QUERY_TYPE_STMT_INSERT)) {
|
||||||
|
return buildInvalidOperationMsg(&pCxt->msg, "insert into super table syntax is not supported for stmt");
|
||||||
|
}
|
||||||
|
if (!pStmt->stbSyntax) {
|
||||||
STableDataCxt* pTableCxt = NULL;
|
STableDataCxt* pTableCxt = NULL;
|
||||||
int32_t code = parseSchemaClauseBottom(pCxt, pStmt, &pTableCxt);
|
int32_t code = parseSchemaClauseBottom(pCxt, pStmt, &pTableCxt);
|
||||||
|
SRowsDataContext rowsDataCxt;
|
||||||
|
rowsDataCxt.pTableDataCxt = pTableCxt;
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = parseDataClause(pCxt, pStmt, pTableCxt);
|
code = parseDataClause(pCxt, pStmt, rowsDataCxt);
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
|
} else {
|
||||||
|
int32_t code = parseInsertStbClauseBottom(pCxt, pStmt);
|
||||||
|
return code;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void resetEnvPreTable(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt) {
|
static void resetEnvPreTable(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt) {
|
||||||
|
@ -1784,6 +2192,10 @@ static void resetEnvPreTable(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStm
|
||||||
pStmt->usingTableProcessing = false;
|
pStmt->usingTableProcessing = false;
|
||||||
pStmt->fileProcessing = false;
|
pStmt->fileProcessing = false;
|
||||||
pStmt->usingTableName.type = 0;
|
pStmt->usingTableName.type = 0;
|
||||||
|
|
||||||
|
destroyStbRowsDataContext(pStmt->pStbRowsCxt);
|
||||||
|
taosMemoryFreeClear(pStmt->pStbRowsCxt);
|
||||||
|
pStmt->stbSyntax = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// input pStmt->pSql: [(field1_name, ...)] [ USING ... ] VALUES ... | FILE ...
|
// input pStmt->pSql: [(field1_name, ...)] [ USING ... ] VALUES ... | FILE ...
|
||||||
|
@ -1793,6 +2205,7 @@ static int32_t parseInsertTableClause(SInsertParseContext* pCxt, SVnodeModifyOpS
|
||||||
if (TSDB_CODE_SUCCESS == code && !pCxt->missCache) {
|
if (TSDB_CODE_SUCCESS == code && !pCxt->missCache) {
|
||||||
code = parseInsertTableClauseBottom(pCxt, pStmt);
|
code = parseInsertTableClauseBottom(pCxt, pStmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1908,8 +2321,10 @@ static int32_t createVnodeModifOpStmt(SInsertParseContext* pCxt, bool reentry, S
|
||||||
TSDB_QUERY_SET_TYPE(pStmt->insertType, TSDB_QUERY_TYPE_STMT_INSERT);
|
TSDB_QUERY_SET_TYPE(pStmt->insertType, TSDB_QUERY_TYPE_STMT_INSERT);
|
||||||
}
|
}
|
||||||
pStmt->pSql = pCxt->pComCxt->pSql;
|
pStmt->pSql = pCxt->pComCxt->pSql;
|
||||||
|
|
||||||
pStmt->freeHashFunc = insDestroyTableDataCxtHashMap;
|
pStmt->freeHashFunc = insDestroyTableDataCxtHashMap;
|
||||||
pStmt->freeArrayFunc = insDestroyVgroupDataCxtList;
|
pStmt->freeArrayFunc = insDestroyVgroupDataCxtList;
|
||||||
|
pStmt->freeStbRowsCxtFunc = destroyStbRowsDataContext;
|
||||||
|
|
||||||
if (!reentry) {
|
if (!reentry) {
|
||||||
pStmt->pVgroupsHashObj = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK);
|
pStmt->pVgroupsHashObj = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK);
|
||||||
|
@ -1982,7 +2397,7 @@ static int32_t getTableMetaFromMetaData(const SArray* pTables, STableMeta** pMet
|
||||||
return pRes->code;
|
return pRes->code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t getTableVgroupFromMetaData(const SArray* pTables, SVnodeModifyOpStmt* pStmt, bool isStb) {
|
static int32_t addTableVgroupFromMetaData(const SArray* pTables, SVnodeModifyOpStmt* pStmt, bool isStb) {
|
||||||
if (1 != taosArrayGetSize(pTables)) {
|
if (1 != taosArrayGetSize(pTables)) {
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
|
@ -2031,20 +2446,17 @@ static int32_t checkSubtablePrivilegeForTable(const SArray* pTables, SVnodeModif
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t getTableSchemaFromMetaData(SInsertParseContext* pCxt, const SMetaData* pMetaData,
|
static int32_t processTableSchemaFromMetaData(SInsertParseContext* pCxt, const SMetaData* pMetaData,
|
||||||
SVnodeModifyOpStmt* pStmt, bool isStb) {
|
SVnodeModifyOpStmt* pStmt, bool isStb) {
|
||||||
int32_t code = checkAuthFromMetaData(pMetaData->pUser, &pStmt->pTagCond);
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (!isStb && TSDB_SUPER_TABLE == pStmt->pTableMeta->tableType) {
|
||||||
code = getTableMetaFromMetaData(pMetaData->pTableMeta, &pStmt->pTableMeta);
|
|
||||||
}
|
|
||||||
if (TSDB_CODE_SUCCESS == code && !isStb && TSDB_SUPER_TABLE == pStmt->pTableMeta->tableType) {
|
|
||||||
code = buildInvalidOperationMsg(&pCxt->msg, "insert data into super table is not supported");
|
code = buildInvalidOperationMsg(&pCxt->msg, "insert data into super table is not supported");
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code && isStb) {
|
if (TSDB_CODE_SUCCESS == code && isStb) {
|
||||||
code = storeTableMeta(pCxt, pStmt);
|
code = storeChildTableMeta(pCxt, pStmt);
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = getTableVgroupFromMetaData(pMetaData->pTableHash, pStmt, isStb);
|
code = addTableVgroupFromMetaData(pMetaData->pTableHash, pStmt, isStb);
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code && !isStb && NULL != pStmt->pTagCond) {
|
if (TSDB_CODE_SUCCESS == code && !isStb && NULL != pStmt->pTagCond) {
|
||||||
code = checkSubtablePrivilegeForTable(pMetaData->pTableTag, pStmt);
|
code = checkSubtablePrivilegeForTable(pMetaData->pTableTag, pStmt);
|
||||||
|
@ -2075,11 +2487,22 @@ static void clearCatalogReq(SCatalogReq* pCatalogReq) {
|
||||||
static int32_t setVnodeModifOpStmt(SInsertParseContext* pCxt, SCatalogReq* pCatalogReq, const SMetaData* pMetaData,
|
static int32_t setVnodeModifOpStmt(SInsertParseContext* pCxt, SCatalogReq* pCatalogReq, const SMetaData* pMetaData,
|
||||||
SVnodeModifyOpStmt* pStmt) {
|
SVnodeModifyOpStmt* pStmt) {
|
||||||
clearCatalogReq(pCatalogReq);
|
clearCatalogReq(pCatalogReq);
|
||||||
|
int32_t code = checkAuthFromMetaData(pMetaData->pUser, &pStmt->pTagCond);
|
||||||
if (pStmt->usingTableProcessing) {
|
if (code == TSDB_CODE_SUCCESS) {
|
||||||
return getTableSchemaFromMetaData(pCxt, pMetaData, pStmt, true);
|
code = getTableMetaFromMetaData(pMetaData->pTableMeta, &pStmt->pTableMeta);
|
||||||
}
|
}
|
||||||
return getTableSchemaFromMetaData(pCxt, pMetaData, pStmt, false);
|
if (code == TSDB_CODE_SUCCESS) {
|
||||||
|
if (pStmt->pTableMeta->tableType == TSDB_SUPER_TABLE && !pStmt->usingTableProcessing) {
|
||||||
|
pStmt->stbSyntax = true;
|
||||||
|
}
|
||||||
|
if (!pStmt->stbSyntax) {
|
||||||
|
if (pStmt->usingTableProcessing) {
|
||||||
|
return processTableSchemaFromMetaData(pCxt, pMetaData, pStmt, true);
|
||||||
|
}
|
||||||
|
return processTableSchemaFromMetaData(pCxt, pMetaData, pStmt, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t resetVnodeModifOpStmt(SInsertParseContext* pCxt, SQuery* pQuery) {
|
static int32_t resetVnodeModifOpStmt(SInsertParseContext* pCxt, SQuery* pQuery) {
|
||||||
|
@ -2125,7 +2548,7 @@ static int32_t initInsertQuery(SInsertParseContext* pCxt, SCatalogReq* pCatalogR
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t setRefreshMate(SQuery* pQuery) {
|
static int32_t setRefreshMeta(SQuery* pQuery) {
|
||||||
SVnodeModifyOpStmt* pStmt = (SVnodeModifyOpStmt*)pQuery->pRoot;
|
SVnodeModifyOpStmt* pStmt = (SVnodeModifyOpStmt*)pQuery->pRoot;
|
||||||
|
|
||||||
if (taosHashGetSize(pStmt->pTableNameHashObj) > 0) {
|
if (taosHashGetSize(pStmt->pTableNameHashObj) > 0) {
|
||||||
|
@ -2166,10 +2589,18 @@ static int32_t parseInsertSqlFromStart(SInsertParseContext* pCxt, SVnodeModifyOp
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t parseInsertSqlFromCsv(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt) {
|
static int32_t parseInsertSqlFromCsv(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt) {
|
||||||
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
SRowsDataContext rowsDataCxt;
|
||||||
|
|
||||||
|
if (!pStmt->stbSyntax) {
|
||||||
STableDataCxt* pTableCxt = NULL;
|
STableDataCxt* pTableCxt = NULL;
|
||||||
int32_t code = getTableDataCxt(pCxt, pStmt, &pTableCxt);
|
code = getTableDataCxt(pCxt, pStmt, &pTableCxt);
|
||||||
|
rowsDataCxt.pTableDataCxt = pTableCxt;
|
||||||
|
} else {
|
||||||
|
rowsDataCxt.pStbRowsCxt = pStmt->pStbRowsCxt;
|
||||||
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = parseDataFromFileImpl(pCxt, pStmt, pTableCxt);
|
code = parseDataFromFileImpl(pCxt, pStmt, rowsDataCxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
@ -2298,7 +2729,7 @@ int32_t parseInsertSql(SParseContext* pCxt, SQuery** pQuery, SCatalogReq* pCatal
|
||||||
}
|
}
|
||||||
if ((TSDB_CODE_SUCCESS == code || NEED_CLIENT_HANDLE_ERROR(code)) &&
|
if ((TSDB_CODE_SUCCESS == code || NEED_CLIENT_HANDLE_ERROR(code)) &&
|
||||||
QUERY_EXEC_STAGE_SCHEDULE == (*pQuery)->execStage) {
|
QUERY_EXEC_STAGE_SCHEDULE == (*pQuery)->execStage) {
|
||||||
code = setRefreshMate(*pQuery);
|
code = setRefreshMeta(*pQuery);
|
||||||
}
|
}
|
||||||
insDestroyBoundColInfo(&context.tags);
|
insDestroyBoundColInfo(&context.tags);
|
||||||
return code;
|
return code;
|
||||||
|
|
|
@ -170,6 +170,10 @@ static void initColValues(STableMeta* pTableMeta, SArray* pValues) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void insInitColValues(STableMeta* pTableMeta, SArray* aColValues) {
|
||||||
|
initColValues(pTableMeta, aColValues);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t insInitBoundColsInfo(int32_t numOfBound, SBoundColInfo* pInfo) {
|
int32_t insInitBoundColsInfo(int32_t numOfBound, SBoundColInfo* pInfo) {
|
||||||
pInfo->numOfCols = numOfBound;
|
pInfo->numOfCols = numOfBound;
|
||||||
pInfo->numOfBound = numOfBound;
|
pInfo->numOfBound = numOfBound;
|
||||||
|
@ -177,7 +181,9 @@ int32_t insInitBoundColsInfo(int32_t numOfBound, SBoundColInfo* pInfo) {
|
||||||
if (NULL == pInfo->pColIndex) {
|
if (NULL == pInfo->pColIndex) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
initBoundCols(numOfBound, pInfo->pColIndex);
|
for (int32_t i = 0; i < numOfBound; ++i) {
|
||||||
|
pInfo->pColIndex[i] = i;
|
||||||
|
}
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,7 +208,7 @@ void insCheckTableDataOrder(STableDataCxt* pTableCxt, TSKEY tsKey) {
|
||||||
void insDestroyBoundColInfo(SBoundColInfo* pInfo) { taosMemoryFreeClear(pInfo->pColIndex); }
|
void insDestroyBoundColInfo(SBoundColInfo* pInfo) { taosMemoryFreeClear(pInfo->pColIndex); }
|
||||||
|
|
||||||
static int32_t createTableDataCxt(STableMeta* pTableMeta, SVCreateTbReq** pCreateTbReq, STableDataCxt** pOutput,
|
static int32_t createTableDataCxt(STableMeta* pTableMeta, SVCreateTbReq** pCreateTbReq, STableDataCxt** pOutput,
|
||||||
bool colMode) {
|
bool colMode, bool ignoreColVals) {
|
||||||
STableDataCxt* pTableCxt = taosMemoryCalloc(1, sizeof(STableDataCxt));
|
STableDataCxt* pTableCxt = taosMemoryCalloc(1, sizeof(STableDataCxt));
|
||||||
if (NULL == pTableCxt) {
|
if (NULL == pTableCxt) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
@ -228,7 +234,7 @@ static int32_t createTableDataCxt(STableMeta* pTableMeta, SVCreateTbReq** pCreat
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = insInitBoundColsInfo(pTableMeta->tableInfo.numOfColumns, &pTableCxt->boundColsInfo);
|
code = insInitBoundColsInfo(pTableMeta->tableInfo.numOfColumns, &pTableCxt->boundColsInfo);
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code && !ignoreColVals) {
|
||||||
pTableCxt->pValues = taosArrayInit(pTableMeta->tableInfo.numOfColumns, sizeof(SColVal));
|
pTableCxt->pValues = taosArrayInit(pTableMeta->tableInfo.numOfColumns, sizeof(SColVal));
|
||||||
if (NULL == pTableCxt->pValues) {
|
if (NULL == pTableCxt->pValues) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
@ -316,14 +322,16 @@ static void resetColValues(SArray* pValues) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t insGetTableDataCxt(SHashObj* pHash, void* id, int32_t idLen, STableMeta* pTableMeta,
|
int32_t insGetTableDataCxt(SHashObj* pHash, void* id, int32_t idLen, STableMeta* pTableMeta,
|
||||||
SVCreateTbReq** pCreateTbReq, STableDataCxt** pTableCxt, bool colMode) {
|
SVCreateTbReq** pCreateTbReq, STableDataCxt** pTableCxt, bool colMode, bool ignoreColVals) {
|
||||||
STableDataCxt** tmp = (STableDataCxt**)taosHashGet(pHash, id, idLen);
|
STableDataCxt** tmp = (STableDataCxt**)taosHashGet(pHash, id, idLen);
|
||||||
if (NULL != tmp) {
|
if (NULL != tmp) {
|
||||||
*pTableCxt = *tmp;
|
*pTableCxt = *tmp;
|
||||||
|
if (!ignoreColVals) {
|
||||||
resetColValues((*pTableCxt)->pValues);
|
resetColValues((*pTableCxt)->pValues);
|
||||||
|
}
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
int32_t code = createTableDataCxt(pTableMeta, pCreateTbReq, pTableCxt, colMode);
|
int32_t code = createTableDataCxt(pTableMeta, pCreateTbReq, pTableCxt, colMode, ignoreColVals);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
void* pData = *pTableCxt; // deal scan coverity
|
void* pData = *pTableCxt; // deal scan coverity
|
||||||
code = taosHashPut(pHash, id, idLen, &pData, POINTER_BYTES);
|
code = taosHashPut(pHash, id, idLen, &pData, POINTER_BYTES);
|
||||||
|
@ -616,7 +624,7 @@ int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreate
|
||||||
void* tmp = taosHashGet(((SVnodeModifyOpStmt*)(query->pRoot))->pTableBlockHashObj, &pTableMeta->uid, sizeof(pTableMeta->uid));
|
void* tmp = taosHashGet(((SVnodeModifyOpStmt*)(query->pRoot))->pTableBlockHashObj, &pTableMeta->uid, sizeof(pTableMeta->uid));
|
||||||
STableDataCxt* pTableCxt = NULL;
|
STableDataCxt* pTableCxt = NULL;
|
||||||
int ret = insGetTableDataCxt(((SVnodeModifyOpStmt*)(query->pRoot))->pTableBlockHashObj, &pTableMeta->uid,
|
int ret = insGetTableDataCxt(((SVnodeModifyOpStmt*)(query->pRoot))->pTableBlockHashObj, &pTableMeta->uid,
|
||||||
sizeof(pTableMeta->uid), pTableMeta, &pCreateTb, &pTableCxt, true);
|
sizeof(pTableMeta->uid), pTableMeta, &pCreateTb, &pTableCxt, true, false);
|
||||||
if (ret != TSDB_CODE_SUCCESS) {
|
if (ret != TSDB_CODE_SUCCESS) {
|
||||||
uError("insGetTableDataCxt error");
|
uError("insGetTableDataCxt error");
|
||||||
goto end;
|
goto end;
|
||||||
|
|
|
@ -267,7 +267,7 @@ static int32_t createSimpleSelectStmtFromProjList(const char* pDb, const char*
|
||||||
SSelectStmt** pStmt);
|
SSelectStmt** pStmt);
|
||||||
static int32_t createLastTsSelectStmt(char* pDb, char* pTable, STableMeta* pMeta, SNode** pQuery);
|
static int32_t createLastTsSelectStmt(char* pDb, char* pTable, STableMeta* pMeta, SNode** pQuery);
|
||||||
static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery);
|
static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery);
|
||||||
static int32_t setRefreshMate(STranslateContext* pCxt, SQuery* pQuery);
|
static int32_t setRefreshMeta(STranslateContext* pCxt, SQuery* pQuery);
|
||||||
|
|
||||||
static int32_t replacePsedudoColumnFuncWithColumn(STranslateContext* pCxt, SNode** ppNode);
|
static int32_t replacePsedudoColumnFuncWithColumn(STranslateContext* pCxt, SNode** ppNode);
|
||||||
|
|
||||||
|
@ -6405,7 +6405,7 @@ int32_t translatePostCreateSmaIndex(SParseContext* pParseCxt, SQuery* pQuery, vo
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = setQuery(&pCxt, pQuery);
|
code = setQuery(&pCxt, pQuery);
|
||||||
}
|
}
|
||||||
setRefreshMate(&pCxt, pQuery);
|
setRefreshMeta(&pCxt, pQuery);
|
||||||
destroyTranslateContext(&pCxt);
|
destroyTranslateContext(&pCxt);
|
||||||
tFreeSMCreateSmaReq(pStmt->pReq);
|
tFreeSMCreateSmaReq(pStmt->pReq);
|
||||||
taosMemoryFreeClear(pStmt->pReq);
|
taosMemoryFreeClear(pStmt->pReq);
|
||||||
|
@ -7678,7 +7678,7 @@ int32_t translatePostCreateStream(SParseContext* pParseCxt, SQuery* pQuery, void
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = setQuery(&cxt, pQuery);
|
code = setQuery(&cxt, pQuery);
|
||||||
}
|
}
|
||||||
setRefreshMate(&cxt, pQuery);
|
setRefreshMeta(&cxt, pQuery);
|
||||||
destroyTranslateContext(&cxt);
|
destroyTranslateContext(&cxt);
|
||||||
|
|
||||||
tFreeSCMCreateStreamReq(pStmt->pReq);
|
tFreeSCMCreateStreamReq(pStmt->pReq);
|
||||||
|
@ -10048,7 +10048,7 @@ static int32_t toMsgType(ENodeType type) {
|
||||||
return TDMT_VND_CREATE_TABLE;
|
return TDMT_VND_CREATE_TABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t setRefreshMate(STranslateContext* pCxt, SQuery* pQuery) {
|
static int32_t setRefreshMeta(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
if (NULL != pCxt->pDbs) {
|
if (NULL != pCxt->pDbs) {
|
||||||
taosArrayDestroy(pQuery->pDbList);
|
taosArrayDestroy(pQuery->pDbList);
|
||||||
pQuery->pDbList = taosArrayInit(taosHashGetSize(pCxt->pDbs), TSDB_DB_FNAME_LEN);
|
pQuery->pDbList = taosArrayInit(taosHashGetSize(pCxt->pDbs), TSDB_DB_FNAME_LEN);
|
||||||
|
@ -10183,7 +10183,7 @@ int32_t translate(SParseContext* pParseCxt, SQuery* pQuery, SParseMetaCache* pMe
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = setQuery(&cxt, pQuery);
|
code = setQuery(&cxt, pQuery);
|
||||||
}
|
}
|
||||||
setRefreshMate(&cxt, pQuery);
|
setRefreshMeta(&cxt, pQuery);
|
||||||
destroyTranslateContext(&cxt);
|
destroyTranslateContext(&cxt);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
|
@ -795,7 +795,12 @@ static void *taosAsyncOutputLog(void *param) {
|
||||||
updateCron = 0;
|
updateCron = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pLogBuf->stop || pSlowBuf->stop) break;
|
if (pLogBuf->stop || pSlowBuf->stop) {
|
||||||
|
pLogBuf->lastDuration = LOG_MAX_WAIT_MSEC;
|
||||||
|
taosWriteLog(pLogBuf);
|
||||||
|
taosWriteLog(pSlowBuf);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -822,7 +827,7 @@ bool taosAssertDebug(bool condition, const char *file, int32_t line, const char
|
||||||
taosPrintTrace(flags, level, dflag, -1);
|
taosPrintTrace(flags, level, dflag, -1);
|
||||||
|
|
||||||
if (tsAssert) {
|
if (tsAssert) {
|
||||||
// taosCloseLog();
|
taosCloseLog();
|
||||||
taosMsleep(300);
|
taosMsleep(300);
|
||||||
|
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
|
|
|
@ -87,6 +87,7 @@
|
||||||
,,n,system-test,python3 ./test.py -f 7-tmq/tmqDropConsumer.py
|
,,n,system-test,python3 ./test.py -f 7-tmq/tmqDropConsumer.py
|
||||||
|
|
||||||
|
|
||||||
|
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/insert_stb.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/delete_stable.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/delete_stable.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/out_of_order.py -Q 3
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/out_of_order.py -Q 3
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/out_of_order.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/out_of_order.py
|
||||||
|
@ -182,7 +183,7 @@
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq3mnodeSwitch.py -N 6 -M 3 -n 3 -i True
|
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq3mnodeSwitch.py -N 6 -M 3 -n 3 -i True
|
||||||
,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeTransform-stb.py -N 2 -n 1
|
,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeTransform-stb.py -N 2 -n 1
|
||||||
,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeTransform-stb.py -N 6 -n 3
|
,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeTransform-stb.py -N 6 -n 3
|
||||||
,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeTransform-db.py -N 6 -n 3
|
#,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeTransform-db.py -N 6 -n 3
|
||||||
,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeSplit-stb-select.py -N 2 -n 1
|
,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeSplit-stb-select.py -N 2 -n 1
|
||||||
,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeSplit-stb-select-duplicatedata.py -N 3 -n 3
|
,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeSplit-stb-select-duplicatedata.py -N 3 -n 3
|
||||||
,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeSplit-stb-select.py -N 3 -n 3
|
,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeSplit-stb-select.py -N 3 -n 3
|
||||||
|
@ -942,6 +943,7 @@ e
|
||||||
,,y,script,./test.sh -f tsim/insert/delete0.sim
|
,,y,script,./test.sh -f tsim/insert/delete0.sim
|
||||||
,,y,script,./test.sh -f tsim/insert/update1_sort_merge.sim
|
,,y,script,./test.sh -f tsim/insert/update1_sort_merge.sim
|
||||||
,,y,script,./test.sh -f tsim/insert/update2.sim
|
,,y,script,./test.sh -f tsim/insert/update2.sim
|
||||||
|
,,y,script,./test.sh -f tsim/insert/insert_stb.sim
|
||||||
,,y,script,./test.sh -f tsim/parser/alter__for_community_version.sim
|
,,y,script,./test.sh -f tsim/parser/alter__for_community_version.sim
|
||||||
,,y,script,./test.sh -f tsim/parser/alter_column.sim
|
,,y,script,./test.sh -f tsim/parser/alter_column.sim
|
||||||
,,y,script,./test.sh -f tsim/parser/alter_stable.sim
|
,,y,script,./test.sh -f tsim/parser/alter_stable.sim
|
||||||
|
|
|
@ -0,0 +1,164 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can use, redistribute, and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License, version 3
|
||||||
|
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// TAOS standard API example. The same syntax as MySQL, but only a subset
|
||||||
|
// to compile: gcc -o demo demo.c -ltaos
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
#include "taos.h" // TAOS header file
|
||||||
|
|
||||||
|
static void executeSql(TAOS *taos, char *command) {
|
||||||
|
int i;
|
||||||
|
TAOS_RES *pSql = NULL;
|
||||||
|
int32_t code = -1;
|
||||||
|
|
||||||
|
for (i = 0; i < 5; i++) {
|
||||||
|
if (NULL != pSql) {
|
||||||
|
taos_free_result(pSql);
|
||||||
|
pSql = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
pSql = taos_query(taos, command);
|
||||||
|
code = taos_errno(pSql);
|
||||||
|
if (0 == code) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (code != 0) {
|
||||||
|
fprintf(stderr, "Failed to run %s, reason: %s\n", command, taos_errstr(pSql));
|
||||||
|
taos_free_result(pSql);
|
||||||
|
taos_close(taos);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
taos_free_result(pSql);
|
||||||
|
}
|
||||||
|
|
||||||
|
void testInsert(TAOS *taos, char *qstr) {
|
||||||
|
executeSql(taos, "drop database if exists demo2");
|
||||||
|
executeSql(taos, "create database demo2");
|
||||||
|
executeSql(taos, "use demo2");
|
||||||
|
|
||||||
|
executeSql(taos, "create table st (ts timestamp, ti tinyint, si smallint, i int, bi bigint, f float, d double, b binary(10)) tags(t1 int, t2 float, t3 binary(10))");
|
||||||
|
printf("success to create table\n");
|
||||||
|
|
||||||
|
struct timeval start_time;
|
||||||
|
gettimeofday(&start_time, NULL);
|
||||||
|
|
||||||
|
for (int tblIdx = 0; tblIdx < 10; ++tblIdx) {
|
||||||
|
int len = 0;
|
||||||
|
len += sprintf(qstr+len, "insert into ct%d using st tags(%d, %f, '%s')", tblIdx, tblIdx, (float)tblIdx, "childtable");
|
||||||
|
int batchStart = len;
|
||||||
|
for (int batchIdx = 0; batchIdx < 10000; ++batchIdx) {
|
||||||
|
len = batchStart;
|
||||||
|
len += sprintf(qstr+len, " values");
|
||||||
|
|
||||||
|
for (int rowIdx = 0; rowIdx < 100; ++ rowIdx) {
|
||||||
|
int i = rowIdx + batchIdx * 100 + tblIdx*10000*100;
|
||||||
|
len += sprintf(qstr+len, " (%" PRId64 ", %d, %d, %d, %d, %f, %lf, '%s')", (uint64_t)(1546300800000 + i), (int8_t)i, (int16_t)i, i, i, i*1.0, i*2.0, "hello");
|
||||||
|
}
|
||||||
|
TAOS_RES *result1 = taos_query(taos, qstr);
|
||||||
|
if (result1 == NULL || taos_errno(result1) != 0) {
|
||||||
|
printf("failed to insert row, reason:%s. qstr: %s\n", taos_errstr(result1), qstr);
|
||||||
|
taos_free_result(result1);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
taos_free_result(result1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
struct timeval end_time;
|
||||||
|
gettimeofday(&end_time, NULL);
|
||||||
|
double elapsed_time = (double)(end_time.tv_sec - start_time.tv_sec) +
|
||||||
|
(double)(end_time.tv_usec - start_time.tv_usec) / 1000000.0;
|
||||||
|
printf("elapsed time: %.3f\n", elapsed_time);
|
||||||
|
executeSql(taos, "drop database if exists demo2");
|
||||||
|
}
|
||||||
|
|
||||||
|
void testInsertStb(TAOS *taos, char *qstr) {
|
||||||
|
executeSql(taos, "drop database if exists demo");
|
||||||
|
executeSql(taos, "create database demo");
|
||||||
|
executeSql(taos, "use demo");
|
||||||
|
|
||||||
|
executeSql(taos, "create table st (ts timestamp, ti tinyint, si smallint, i int, bi bigint, f float, d double, b binary(10)) tags(t1 int, t2 float, t3 binary(10))");
|
||||||
|
printf("success to create table\n");
|
||||||
|
|
||||||
|
struct timeval start_time;
|
||||||
|
gettimeofday(&start_time, NULL);
|
||||||
|
|
||||||
|
for (int tblIdx = 0; tblIdx < 10; ++tblIdx) {
|
||||||
|
int len = 0;
|
||||||
|
len += sprintf(qstr+len, "insert into st(tbname, t1, t2, t3, ts, ti, si, i, bi, f, d, b)");
|
||||||
|
int batchStart = len;
|
||||||
|
for (int batchIdx = 0; batchIdx < 10000; ++batchIdx) {
|
||||||
|
len = batchStart;
|
||||||
|
len += sprintf(qstr+len, " values");
|
||||||
|
|
||||||
|
for (int rowIdx = 0; rowIdx < 100; ++rowIdx) {
|
||||||
|
int i = rowIdx + batchIdx * 100 + tblIdx*10000*100;
|
||||||
|
len += sprintf(qstr+len, " ('ct%d', %d, %f, '%s', %" PRId64 ", %d, %d, %d, %d, %f, %lf, '%s')", tblIdx, tblIdx, (float)tblIdx, "childtable",
|
||||||
|
(uint64_t)(1546300800000 + i), (int8_t)i, (int16_t)i, i, i, i*1.0, i*2.0, "hello");
|
||||||
|
}
|
||||||
|
TAOS_RES *result1 = taos_query(taos, qstr);
|
||||||
|
if (result1 == NULL || taos_errno(result1) != 0) {
|
||||||
|
printf("failed to insert row, reason:%s. qstr: %s\n", taos_errstr(result1), qstr);
|
||||||
|
taos_free_result(result1);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
taos_free_result(result1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
struct timeval end_time;
|
||||||
|
gettimeofday(&end_time, NULL);
|
||||||
|
double elapsed_time = (double)(end_time.tv_sec - start_time.tv_sec) +
|
||||||
|
(double)(end_time.tv_usec - start_time.tv_usec) / 1000000.0;
|
||||||
|
|
||||||
|
printf("elapsed time: %.3f\n", elapsed_time);
|
||||||
|
executeSql(taos, "drop database if exists demo");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
|
// connect to server
|
||||||
|
if (argc < 2) {
|
||||||
|
printf("please input server-ip \n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
TAOS *taos = taos_connect(argv[1], "root", "taosdata", NULL, 0);
|
||||||
|
if (taos == NULL) {
|
||||||
|
printf("failed to connect to server, reason:%s\n", taos_errstr(NULL));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
char* qstr = malloc(1024*1024);
|
||||||
|
printf("test insert into tb using stb\n\n");
|
||||||
|
for (int i =0; i < 5; ++i) {
|
||||||
|
testInsert(taos, qstr);
|
||||||
|
}
|
||||||
|
printf("test insert into stb tbname\n\n");
|
||||||
|
for (int i =0; i < 5; ++i) {
|
||||||
|
testInsertStb(taos, qstr);
|
||||||
|
}
|
||||||
|
free(qstr);
|
||||||
|
taos_close(taos);
|
||||||
|
taos_cleanup();
|
||||||
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ exe:
|
||||||
gcc $(CFLAGS) ./insertSameTs.c -o $(ROOT)insertSameTs $(LFLAGS)
|
gcc $(CFLAGS) ./insertSameTs.c -o $(ROOT)insertSameTs $(LFLAGS)
|
||||||
gcc $(CFLAGS) ./passwdTest.c -o $(ROOT)passwdTest $(LFLAGS)
|
gcc $(CFLAGS) ./passwdTest.c -o $(ROOT)passwdTest $(LFLAGS)
|
||||||
gcc $(CFLAGS) ./whiteListTest.c -o $(ROOT)whiteListTest $(LFLAGS)
|
gcc $(CFLAGS) ./whiteListTest.c -o $(ROOT)whiteListTest $(LFLAGS)
|
||||||
|
gcc $(CFLAGS) ./insert_stb.c -o $(ROOT)insert_stb $(LFLAGS)
|
||||||
gcc $(CFLAGS) ./tmqViewTest.c -o $(ROOT)tmqViewTest $(LFLAGS)
|
gcc $(CFLAGS) ./tmqViewTest.c -o $(ROOT)tmqViewTest $(LFLAGS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
@ -26,4 +27,5 @@ clean:
|
||||||
rm $(ROOT)insertSameTs
|
rm $(ROOT)insertSameTs
|
||||||
rm $(ROOT)passwdTest
|
rm $(ROOT)passwdTest
|
||||||
rm $(ROOT)whiteListTest
|
rm $(ROOT)whiteListTest
|
||||||
|
rm $(ROOT)insert_stb
|
||||||
rm $(ROOT)tmqViewTest
|
rm $(ROOT)tmqViewTest
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
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 d1
|
||||||
|
sql create database d2
|
||||||
|
|
||||||
|
sql use d1;
|
||||||
|
sql create table st(ts timestamp, f int) tags(t int);
|
||||||
|
sql insert into ct1 using st tags(1) values('2021-04-19 00:00:00', 1);
|
||||||
|
sql insert into ct2 using st tags(2) values('2021-04-19 00:00:01', 2);
|
||||||
|
sql insert into ct1 values('2021-04-19 00:00:02', 2);
|
||||||
|
sql create table st2(ts timestamp, f int) tags(t int);
|
||||||
|
|
||||||
|
sql use d2;
|
||||||
|
sql create table st(ts timestamp, f int) tags(t int);
|
||||||
|
sql insert into ct1 using st tags(1) values('2021-04-19 00:00:00', 1);
|
||||||
|
sql insert into ct2 using st tags(2) values('2021-04-19 00:00:01', 2);
|
||||||
|
|
||||||
|
sql create database db1 vgroups 1;
|
||||||
|
sql create table db1.stb (ts timestamp, c1 int, c2 int) tags(t1 int, t2 int);
|
||||||
|
|
||||||
|
sql use d1;
|
||||||
|
sql insert into st (tbname, ts, f, t) values('ct3', '2021-04-19 08:00:03', 3, 3);
|
||||||
|
sql insert into d1.st (tbname, ts, f) values('ct6', '2021-04-19 08:00:04', 6);
|
||||||
|
sql insert into d1.st (tbname, ts, f) values('ct6', '2021-04-19 08:00:05', 7)('ct8', '2021-04-19 08:00:06', 8);
|
||||||
|
sql insert into d1.st (tbname, ts, f, t) values('ct6', '2021-04-19 08:00:07', 9, 9)('ct8', '2021-04-19 08:00:08', 10, 10);
|
||||||
|
sql insert into d1.st (tbname, ts, f, t) values('ct6', '2021-04-19 08:00:09', 9, 9)('ct8', '2021-04-19 08:00:10', 10, 10) d2.st (tbname, ts, f, t) values('ct6', '2021-04-19 08:00:11', 9, 9)('ct8', '2021-04-19 08:00:12', 10, 10);
|
||||||
|
|
||||||
|
sql select * from d1.st
|
||||||
|
print $rows
|
||||||
|
if $rows != 11 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql select * from d2.st;
|
||||||
|
print $rows
|
||||||
|
if $rows != 4 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql insert into d2.st(ts, f, tbname) values('2021-04-19 08:00:13', 1, 'ct1') d1.ct1 values('2021-04-19 08:00:14', 1);
|
||||||
|
|
||||||
|
sql select * from d1.st
|
||||||
|
print $rows
|
||||||
|
if $rows != 12 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql select * from d2.st;
|
||||||
|
print $rows
|
||||||
|
if $rows != 5 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql_error insert into d2.st values(now, 1, 1)
|
||||||
|
sql_error insert into d2.st(ts, f) values(now, 1);
|
||||||
|
sql_error insert into d2.st(ts, f, tbname) values(now, 1);
|
||||||
|
sql_error insert into d2.st(ts, f, tbname) values(now, 1, '');
|
||||||
|
sql_error insert into d2.st(ts, tbname) values(now, 1, 34)
|
||||||
|
sql_error insert into st using st2 tags(2) values(now,1);
|
||||||
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
|
@ -0,0 +1,627 @@
|
||||||
|
import sys
|
||||||
|
from util.log import *
|
||||||
|
from util.cases import *
|
||||||
|
from util.sql import *
|
||||||
|
from util.dnodes import tdDnodes
|
||||||
|
from math import inf
|
||||||
|
import taos
|
||||||
|
|
||||||
|
class TDTestCase:
|
||||||
|
def caseDescription(self):
|
||||||
|
'''
|
||||||
|
case1<shenglian zhou>: [TS-3932] insert into stb
|
||||||
|
'''
|
||||||
|
return
|
||||||
|
|
||||||
|
def init(self, conn, logSql, replicaVer=1):
|
||||||
|
tdLog.debug("start to execute %s" % __file__)
|
||||||
|
tdSql.init(conn.cursor(), True)
|
||||||
|
self.conn = conn
|
||||||
|
|
||||||
|
|
||||||
|
def restartTaosd(self, index=1, dbname="db"):
|
||||||
|
tdDnodes.stop(index)
|
||||||
|
tdDnodes.startWithoutSleep(index)
|
||||||
|
tdSql.execute(f"use insert_stb")
|
||||||
|
|
||||||
|
|
||||||
|
def run_normal(self):
|
||||||
|
print("running {}".format(__file__))
|
||||||
|
tdSql.execute("drop database if exists insert_stb")
|
||||||
|
tdSql.execute("create database if not exists insert_stb")
|
||||||
|
tdSql.execute('use insert_stb')
|
||||||
|
tdSql.execute('create database d1')
|
||||||
|
|
||||||
|
tdSql.execute('create database d2')
|
||||||
|
|
||||||
|
tdSql.execute('use d1;')
|
||||||
|
|
||||||
|
tdSql.execute('create table st(ts timestamp, f int) tags(t int);')
|
||||||
|
|
||||||
|
tdSql.execute("insert into ct1 using st tags(1) values('2021-04-19 00:00:00', 1);")
|
||||||
|
|
||||||
|
tdSql.execute("insert into ct2 using st tags(2) values('2021-04-19 00:00:01', 2);")
|
||||||
|
|
||||||
|
tdSql.execute("insert into ct1 values('2021-04-19 00:00:02', 2);")
|
||||||
|
|
||||||
|
tdSql.execute('use d2;')
|
||||||
|
|
||||||
|
tdSql.execute('create table st(ts timestamp, f int) tags(t int);')
|
||||||
|
|
||||||
|
tdSql.execute("insert into ct1 using st tags(1) values('2021-04-19 00:00:00', 1);")
|
||||||
|
|
||||||
|
tdSql.execute("insert into ct2 using st tags(2) values('2021-04-19 00:00:01', 2);")
|
||||||
|
|
||||||
|
tdSql.execute('create database db1 vgroups 1;')
|
||||||
|
|
||||||
|
tdSql.execute('create table db1.stb (ts timestamp, c1 int, c2 int) tags(t1 int, t2 int);')
|
||||||
|
|
||||||
|
tdSql.execute('use d1;')
|
||||||
|
|
||||||
|
tdSql.execute("insert into st (tbname, ts, f, t) values('ct3', '2021-04-19 08:00:03', 3, 3);")
|
||||||
|
|
||||||
|
tdSql.execute("insert into d1.st (tbname, ts, f) values('ct6', '2021-04-19 08:00:04', 6);")
|
||||||
|
|
||||||
|
tdSql.execute("insert into d1.st (tbname, ts, f) values('ct6', '2021-04-19 08:00:05', 7)('ct8', '2021-04-19 08:00:06', 8);")
|
||||||
|
|
||||||
|
tdSql.execute("insert into d1.st (tbname, ts, f, t) values('ct6', '2021-04-19 08:00:07', 9, 9)('ct8', '2021-04-19 08:00:08', 10, 10);")
|
||||||
|
|
||||||
|
tdSql.execute("insert into d1.st (tbname, ts, f, t) values('ct6', '2021-04-19 08:00:09', 9, 9)('ct8', '2021-04-19 08:00:10', 10, 10) d2.st (tbname, ts, f, t) values('ct6', '2021-04-19 08:00:11', 9, 9)('ct8', '2021-04-19 08:00:12', 10, 10);")
|
||||||
|
|
||||||
|
tdSql.query('select * from d1.st order by ts;')
|
||||||
|
tdSql.checkRows(11)
|
||||||
|
tdSql.checkData(0, 0, datetime.datetime(2021, 4, 19, 0, 0))
|
||||||
|
tdSql.checkData(0, 1, 1)
|
||||||
|
tdSql.checkData(0, 2, 1)
|
||||||
|
tdSql.checkData(1, 0, datetime.datetime(2021, 4, 19, 0, 0, 1))
|
||||||
|
tdSql.checkData(1, 1, 2)
|
||||||
|
tdSql.checkData(1, 2, 2)
|
||||||
|
tdSql.checkData(2, 0, datetime.datetime(2021, 4, 19, 0, 0, 2))
|
||||||
|
tdSql.checkData(2, 1, 2)
|
||||||
|
tdSql.checkData(2, 2, 1)
|
||||||
|
tdSql.checkData(3, 0, datetime.datetime(2021, 4, 19, 8, 0, 3))
|
||||||
|
tdSql.checkData(3, 1, 3)
|
||||||
|
tdSql.checkData(3, 2, 3)
|
||||||
|
tdSql.checkData(4, 0, datetime.datetime(2021, 4, 19, 8, 0, 4))
|
||||||
|
tdSql.checkData(4, 1, 6)
|
||||||
|
tdSql.checkData(4, 2, None)
|
||||||
|
tdSql.checkData(5, 0, datetime.datetime(2021, 4, 19, 8, 0, 5))
|
||||||
|
tdSql.checkData(5, 1, 7)
|
||||||
|
tdSql.checkData(5, 2, None)
|
||||||
|
tdSql.checkData(6, 0, datetime.datetime(2021, 4, 19, 8, 0, 6))
|
||||||
|
tdSql.checkData(6, 1, 8)
|
||||||
|
tdSql.checkData(6, 2, None)
|
||||||
|
tdSql.checkData(7, 0, datetime.datetime(2021, 4, 19, 8, 0, 7))
|
||||||
|
tdSql.checkData(7, 1, 9)
|
||||||
|
tdSql.checkData(7, 2, None)
|
||||||
|
tdSql.checkData(8, 0, datetime.datetime(2021, 4, 19, 8, 0, 8))
|
||||||
|
tdSql.checkData(8, 1, 10)
|
||||||
|
tdSql.checkData(8, 2, None)
|
||||||
|
tdSql.checkData(9, 0, datetime.datetime(2021, 4, 19, 8, 0, 9))
|
||||||
|
tdSql.checkData(9, 1, 9)
|
||||||
|
tdSql.checkData(9, 2, None)
|
||||||
|
tdSql.checkData(10, 0, datetime.datetime(2021, 4, 19, 8, 0, 10))
|
||||||
|
tdSql.checkData(10, 1, 10)
|
||||||
|
tdSql.checkData(10, 2, None)
|
||||||
|
|
||||||
|
tdSql.query('select * from d2.st order by ts;')
|
||||||
|
tdSql.checkRows(4)
|
||||||
|
tdSql.checkData(0, 0, datetime.datetime(2021, 4, 19, 0, 0))
|
||||||
|
tdSql.checkData(0, 1, 1)
|
||||||
|
tdSql.checkData(0, 2, 1)
|
||||||
|
tdSql.checkData(1, 0, datetime.datetime(2021, 4, 19, 0, 0, 1))
|
||||||
|
tdSql.checkData(1, 1, 2)
|
||||||
|
tdSql.checkData(1, 2, 2)
|
||||||
|
tdSql.checkData(2, 0, datetime.datetime(2021, 4, 19, 8, 0, 11))
|
||||||
|
tdSql.checkData(2, 1, 9)
|
||||||
|
tdSql.checkData(2, 2, 9)
|
||||||
|
tdSql.checkData(3, 0, datetime.datetime(2021, 4, 19, 8, 0, 12))
|
||||||
|
tdSql.checkData(3, 1, 10)
|
||||||
|
tdSql.checkData(3, 2, 10)
|
||||||
|
|
||||||
|
tdSql.execute("insert into d2.st(ts, f, tbname) values('2021-04-19 08:00:13', 1, 'ct1') d1.ct1 values('2021-04-19 08:00:14', 1);")
|
||||||
|
|
||||||
|
tdSql.query('select * from d1.st order by ts;')
|
||||||
|
tdSql.checkRows(12)
|
||||||
|
tdSql.checkData(0, 0, datetime.datetime(2021, 4, 19, 0, 0))
|
||||||
|
tdSql.checkData(0, 1, 1)
|
||||||
|
tdSql.checkData(0, 2, 1)
|
||||||
|
tdSql.checkData(1, 0, datetime.datetime(2021, 4, 19, 0, 0, 1))
|
||||||
|
tdSql.checkData(1, 1, 2)
|
||||||
|
tdSql.checkData(1, 2, 2)
|
||||||
|
tdSql.checkData(2, 0, datetime.datetime(2021, 4, 19, 0, 0, 2))
|
||||||
|
tdSql.checkData(2, 1, 2)
|
||||||
|
tdSql.checkData(2, 2, 1)
|
||||||
|
tdSql.checkData(3, 0, datetime.datetime(2021, 4, 19, 8, 0, 3))
|
||||||
|
tdSql.checkData(3, 1, 3)
|
||||||
|
tdSql.checkData(3, 2, 3)
|
||||||
|
tdSql.checkData(4, 0, datetime.datetime(2021, 4, 19, 8, 0, 4))
|
||||||
|
tdSql.checkData(4, 1, 6)
|
||||||
|
tdSql.checkData(4, 2, None)
|
||||||
|
tdSql.checkData(5, 0, datetime.datetime(2021, 4, 19, 8, 0, 5))
|
||||||
|
tdSql.checkData(5, 1, 7)
|
||||||
|
tdSql.checkData(5, 2, None)
|
||||||
|
tdSql.checkData(6, 0, datetime.datetime(2021, 4, 19, 8, 0, 6))
|
||||||
|
tdSql.checkData(6, 1, 8)
|
||||||
|
tdSql.checkData(6, 2, None)
|
||||||
|
tdSql.checkData(7, 0, datetime.datetime(2021, 4, 19, 8, 0, 7))
|
||||||
|
tdSql.checkData(7, 1, 9)
|
||||||
|
tdSql.checkData(7, 2, None)
|
||||||
|
tdSql.checkData(8, 0, datetime.datetime(2021, 4, 19, 8, 0, 8))
|
||||||
|
tdSql.checkData(8, 1, 10)
|
||||||
|
tdSql.checkData(8, 2, None)
|
||||||
|
tdSql.checkData(9, 0, datetime.datetime(2021, 4, 19, 8, 0, 9))
|
||||||
|
tdSql.checkData(9, 1, 9)
|
||||||
|
tdSql.checkData(9, 2, None)
|
||||||
|
tdSql.checkData(10, 0, datetime.datetime(2021, 4, 19, 8, 0, 10))
|
||||||
|
tdSql.checkData(10, 1, 10)
|
||||||
|
tdSql.checkData(10, 2, None)
|
||||||
|
tdSql.checkData(11, 0, datetime.datetime(2021, 4, 19, 8, 0, 14))
|
||||||
|
tdSql.checkData(11, 1, 1)
|
||||||
|
tdSql.checkData(11, 2, 1)
|
||||||
|
|
||||||
|
tdSql.query('select * from d2.st order by ts;')
|
||||||
|
tdSql.checkRows(5)
|
||||||
|
tdSql.checkData(0, 0, datetime.datetime(2021, 4, 19, 0, 0))
|
||||||
|
tdSql.checkData(0, 1, 1)
|
||||||
|
tdSql.checkData(0, 2, 1)
|
||||||
|
tdSql.checkData(1, 0, datetime.datetime(2021, 4, 19, 0, 0, 1))
|
||||||
|
tdSql.checkData(1, 1, 2)
|
||||||
|
tdSql.checkData(1, 2, 2)
|
||||||
|
tdSql.checkData(2, 0, datetime.datetime(2021, 4, 19, 8, 0, 11))
|
||||||
|
tdSql.checkData(2, 1, 9)
|
||||||
|
tdSql.checkData(2, 2, 9)
|
||||||
|
tdSql.checkData(3, 0, datetime.datetime(2021, 4, 19, 8, 0, 12))
|
||||||
|
tdSql.checkData(3, 1, 10)
|
||||||
|
tdSql.checkData(3, 2, 10)
|
||||||
|
tdSql.checkData(4, 0, datetime.datetime(2021, 4, 19, 8, 0, 13))
|
||||||
|
tdSql.checkData(4, 1, 1)
|
||||||
|
tdSql.checkData(4, 2, None)
|
||||||
|
|
||||||
|
def run_insert_stb(self):
|
||||||
|
print("running {}".format('insert_stb'))
|
||||||
|
self.conn.select_db('insert_stb')
|
||||||
|
tdSql.execute('create table stb1 (ts timestamp, c1 bool, c2 tinyint, c3 smallint, c4 int, c5 bigint, c6 float, c7 double, c8 binary(10), c9 nchar(10), c10 tinyint unsigned, c11 smallint unsigned, c12 int unsigned, c13 bigint unsigned) TAGS(t1 int, t2 binary(10), t3 double);')
|
||||||
|
|
||||||
|
tdSql.execute('insert into stb1(ts,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,t1,t2,t3,tbname) values (\'2021-11-11 09:00:00\',true,1,1,1,1,1,1,"123","1234",1,1,1,1, 1, \'1\', 1.0, \'tb1\');')
|
||||||
|
|
||||||
|
tdSql.execute("insert into stb1(ts,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,t1,t2,t3,tbname) values ('2021-11-11 09:00:01',true,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 2, '2', 2.0, 'tb1');")
|
||||||
|
|
||||||
|
tdSql.execute('insert into stb1(ts,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,t1,t2,t3,tbname) values (\'2021-11-11 09:00:02\',true,2,NULL,2,NULL,2,NULL,"234",NULL,2,NULL,2,NULL, 2, \'2\', 2.0, \'tb2\');')
|
||||||
|
|
||||||
|
tdSql.execute('insert into stb1(ts,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,t1,t2,t3,tbname) values (\'2021-11-11 09:00:03\',false,NULL,3,NULL,3,NULL,3,NULL,"3456",NULL,3,NULL,3, 3, \'3\', 3.0, \'tb3\');')
|
||||||
|
|
||||||
|
tdSql.execute('insert into stb1(ts,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,t1,t2,t3,tbname) values (\'2021-11-11 09:00:04\',true,4,4,4,4,4,4,"456","4567",4,4,4,4, 4, \'4.0\', 4.0, \'tb4\');')
|
||||||
|
|
||||||
|
tdSql.execute('insert into stb1(ts,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,t1,t2,t3,tbname) values (\'2021-11-11 09:00:05\',true,127,32767,2147483647,9223372036854775807,3.402823466e+38,1.79769e+308,"567","5678",254,65534,4294967294,9223372036854775807, 5, \'5\', 5, \'max\' );')
|
||||||
|
|
||||||
|
tdSql.execute('insert into stb1(ts,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,t1,t2,t3,tbname) values (\'2021-11-11 09:00:06\',true,-127,-32767,-2147483647,-9223372036854775807,-3.402823466e+38,-1.79769e+308,"678","6789",0,0,0,0, 6, \'6\', 6, \'min\');')
|
||||||
|
|
||||||
|
tdSql.execute('insert into stb1(ts,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,tbname,t1,t2,t3) values (\'2021-11-11 09:00:07\',true,-127,-32767,-2147483647,-9223372036854775807,-3.402823466e+38,-1.79769e+308,"678","6789",0,0,0,0, \'min\', 6, \'6\', 6);')
|
||||||
|
|
||||||
|
tdSql.query('select tbname,* from stb1 order by ts;')
|
||||||
|
tdSql.checkRows(8)
|
||||||
|
tdSql.checkData(0, 0, 'tb1')
|
||||||
|
tdSql.checkData(0, 1, datetime.datetime(2021, 11, 11, 9, 0))
|
||||||
|
tdSql.checkData(0, 2, True)
|
||||||
|
tdSql.checkData(0, 3, 1)
|
||||||
|
tdSql.checkData(0, 4, 1)
|
||||||
|
tdSql.checkData(0, 5, 1)
|
||||||
|
tdSql.checkData(0, 6, 1)
|
||||||
|
tdSql.checkData(0, 7, 1.0)
|
||||||
|
tdSql.checkData(0, 8, 1.0)
|
||||||
|
tdSql.checkData(0, 9, '123')
|
||||||
|
tdSql.checkData(0, 10, '1234')
|
||||||
|
tdSql.checkData(0, 11, 1)
|
||||||
|
tdSql.checkData(0, 12, 1)
|
||||||
|
tdSql.checkData(0, 13, 1)
|
||||||
|
tdSql.checkData(0, 14, 1)
|
||||||
|
tdSql.checkData(0, 15, 1)
|
||||||
|
tdSql.checkData(0, 16, '1')
|
||||||
|
tdSql.checkData(0, 17, 1.0)
|
||||||
|
tdSql.checkData(1, 0, 'tb1')
|
||||||
|
tdSql.checkData(1, 1, datetime.datetime(2021, 11, 11, 9, 0, 1))
|
||||||
|
tdSql.checkData(1, 2, True)
|
||||||
|
tdSql.checkData(1, 3, None)
|
||||||
|
tdSql.checkData(1, 4, None)
|
||||||
|
tdSql.checkData(1, 5, None)
|
||||||
|
tdSql.checkData(1, 6, None)
|
||||||
|
tdSql.checkData(1, 7, None)
|
||||||
|
tdSql.checkData(1, 8, None)
|
||||||
|
tdSql.checkData(1, 9, None)
|
||||||
|
tdSql.checkData(1, 10, None)
|
||||||
|
tdSql.checkData(1, 11, None)
|
||||||
|
tdSql.checkData(1, 12, None)
|
||||||
|
tdSql.checkData(1, 13, None)
|
||||||
|
tdSql.checkData(1, 14, None)
|
||||||
|
tdSql.checkData(1, 15, 1)
|
||||||
|
tdSql.checkData(1, 16, '1')
|
||||||
|
tdSql.checkData(1, 17, 1.0)
|
||||||
|
tdSql.checkData(2, 0, 'tb2')
|
||||||
|
tdSql.checkData(2, 1, datetime.datetime(2021, 11, 11, 9, 0, 2))
|
||||||
|
tdSql.checkData(2, 2, True)
|
||||||
|
tdSql.checkData(2, 3, 2)
|
||||||
|
tdSql.checkData(2, 4, None)
|
||||||
|
tdSql.checkData(2, 5, 2)
|
||||||
|
tdSql.checkData(2, 6, None)
|
||||||
|
tdSql.checkData(2, 7, 2.0)
|
||||||
|
tdSql.checkData(2, 8, None)
|
||||||
|
tdSql.checkData(2, 9, '234')
|
||||||
|
tdSql.checkData(2, 10, None)
|
||||||
|
tdSql.checkData(2, 11, 2)
|
||||||
|
tdSql.checkData(2, 12, None)
|
||||||
|
tdSql.checkData(2, 13, 2)
|
||||||
|
tdSql.checkData(2, 14, None)
|
||||||
|
tdSql.checkData(2, 15, 2)
|
||||||
|
tdSql.checkData(2, 16, '2')
|
||||||
|
tdSql.checkData(2, 17, 2.0)
|
||||||
|
tdSql.checkData(3, 0, 'tb3')
|
||||||
|
tdSql.checkData(3, 1, datetime.datetime(2021, 11, 11, 9, 0, 3))
|
||||||
|
tdSql.checkData(3, 2, False)
|
||||||
|
tdSql.checkData(3, 3, None)
|
||||||
|
tdSql.checkData(3, 4, 3)
|
||||||
|
tdSql.checkData(3, 5, None)
|
||||||
|
tdSql.checkData(3, 6, 3)
|
||||||
|
tdSql.checkData(3, 7, None)
|
||||||
|
tdSql.checkData(3, 8, 3.0)
|
||||||
|
tdSql.checkData(3, 9, None)
|
||||||
|
tdSql.checkData(3, 10, '3456')
|
||||||
|
tdSql.checkData(3, 11, None)
|
||||||
|
tdSql.checkData(3, 12, 3)
|
||||||
|
tdSql.checkData(3, 13, None)
|
||||||
|
tdSql.checkData(3, 14, 3)
|
||||||
|
tdSql.checkData(3, 15, 3)
|
||||||
|
tdSql.checkData(3, 16, '3')
|
||||||
|
tdSql.checkData(3, 17, 3.0)
|
||||||
|
tdSql.checkData(4, 0, 'tb4')
|
||||||
|
tdSql.checkData(4, 1, datetime.datetime(2021, 11, 11, 9, 0, 4))
|
||||||
|
tdSql.checkData(4, 2, True)
|
||||||
|
tdSql.checkData(4, 3, 4)
|
||||||
|
tdSql.checkData(4, 4, 4)
|
||||||
|
tdSql.checkData(4, 5, 4)
|
||||||
|
tdSql.checkData(4, 6, 4)
|
||||||
|
tdSql.checkData(4, 7, 4.0)
|
||||||
|
tdSql.checkData(4, 8, 4.0)
|
||||||
|
tdSql.checkData(4, 9, '456')
|
||||||
|
tdSql.checkData(4, 10, '4567')
|
||||||
|
tdSql.checkData(4, 11, 4)
|
||||||
|
tdSql.checkData(4, 12, 4)
|
||||||
|
tdSql.checkData(4, 13, 4)
|
||||||
|
tdSql.checkData(4, 14, 4)
|
||||||
|
tdSql.checkData(4, 15, 4)
|
||||||
|
tdSql.checkData(4, 16, '4.0')
|
||||||
|
tdSql.checkData(4, 17, 4.0)
|
||||||
|
tdSql.checkData(5, 0, 'max')
|
||||||
|
tdSql.checkData(5, 1, datetime.datetime(2021, 11, 11, 9, 0, 5))
|
||||||
|
tdSql.checkData(5, 2, True)
|
||||||
|
tdSql.checkData(5, 3, 127)
|
||||||
|
tdSql.checkData(5, 4, 32767)
|
||||||
|
tdSql.checkData(5, 5, 2147483647)
|
||||||
|
tdSql.checkData(5, 6, 9223372036854775807)
|
||||||
|
tdSql.checkData(5, 7, 3.4028234663852886e+38)
|
||||||
|
tdSql.checkData(5, 8, 1.79769e+308)
|
||||||
|
tdSql.checkData(5, 9, '567')
|
||||||
|
tdSql.checkData(5, 10, '5678')
|
||||||
|
tdSql.checkData(5, 11, 254)
|
||||||
|
tdSql.checkData(5, 12, 65534)
|
||||||
|
tdSql.checkData(5, 13, 4294967294)
|
||||||
|
tdSql.checkData(5, 14, 9223372036854775807)
|
||||||
|
tdSql.checkData(5, 15, 5)
|
||||||
|
tdSql.checkData(5, 16, '5')
|
||||||
|
tdSql.checkData(5, 17, 5.0)
|
||||||
|
tdSql.checkData(6, 0, 'min')
|
||||||
|
tdSql.checkData(6, 1, datetime.datetime(2021, 11, 11, 9, 0, 6))
|
||||||
|
tdSql.checkData(6, 2, True)
|
||||||
|
tdSql.checkData(6, 3, -127)
|
||||||
|
tdSql.checkData(6, 4, -32767)
|
||||||
|
tdSql.checkData(6, 5, -2147483647)
|
||||||
|
tdSql.checkData(6, 6, -9223372036854775807)
|
||||||
|
tdSql.checkData(6, 7, -3.4028234663852886e+38)
|
||||||
|
tdSql.checkData(6, 8, -1.79769e+308)
|
||||||
|
tdSql.checkData(6, 9, '678')
|
||||||
|
tdSql.checkData(6, 10, '6789')
|
||||||
|
tdSql.checkData(6, 11, 0)
|
||||||
|
tdSql.checkData(6, 12, 0)
|
||||||
|
tdSql.checkData(6, 13, 0)
|
||||||
|
tdSql.checkData(6, 14, 0)
|
||||||
|
tdSql.checkData(6, 15, 6)
|
||||||
|
tdSql.checkData(6, 16, '6')
|
||||||
|
tdSql.checkData(6, 17, 6.0)
|
||||||
|
tdSql.checkData(7, 0, 'min')
|
||||||
|
tdSql.checkData(7, 1, datetime.datetime(2021, 11, 11, 9, 0, 7))
|
||||||
|
tdSql.checkData(7, 2, True)
|
||||||
|
tdSql.checkData(7, 3, -127)
|
||||||
|
tdSql.checkData(7, 4, -32767)
|
||||||
|
tdSql.checkData(7, 5, -2147483647)
|
||||||
|
tdSql.checkData(7, 6, -9223372036854775807)
|
||||||
|
tdSql.checkData(7, 7, -3.4028234663852886e+38)
|
||||||
|
tdSql.checkData(7, 8, -1.79769e+308)
|
||||||
|
tdSql.checkData(7, 9, '678')
|
||||||
|
tdSql.checkData(7, 10, '6789')
|
||||||
|
tdSql.checkData(7, 11, 0)
|
||||||
|
tdSql.checkData(7, 12, 0)
|
||||||
|
tdSql.checkData(7, 13, 0)
|
||||||
|
tdSql.checkData(7, 14, 0)
|
||||||
|
tdSql.checkData(7, 15, 6)
|
||||||
|
tdSql.checkData(7, 16, '6')
|
||||||
|
tdSql.checkData(7, 17, 6.0)
|
||||||
|
|
||||||
|
def run_stmt_error(self):
|
||||||
|
conn = self.conn
|
||||||
|
conn.select_db('insert_stb')
|
||||||
|
conn.execute('create table stb9(ts timestamp, f int) tags (t int)')
|
||||||
|
try:
|
||||||
|
stmt = conn.statement("insert into stb9(tbname, f, t) values('ctb91', 1, ?)")
|
||||||
|
params = taos.new_bind_params(1)
|
||||||
|
params[0].int(1)
|
||||||
|
stmt.bind_param(params)
|
||||||
|
stmt.execute()
|
||||||
|
result = stmt.use_result()
|
||||||
|
except Exception as err:
|
||||||
|
print(str(err))
|
||||||
|
|
||||||
|
def run_consecutive_seq(self):
|
||||||
|
print("running {}".format("consecutive_seq"))
|
||||||
|
tdSql.execute("drop database if exists insert_stb3")
|
||||||
|
tdSql.execute("create database if not exists insert_stb3")
|
||||||
|
tdSql.execute('use insert_stb3')
|
||||||
|
tdSql.execute('create table st (ts timestamp, ti tinyint, si smallint, i int, bi bigint, f float, d double, b binary(10)) tags(t1 int, t2 float, t3 binary(10))')
|
||||||
|
|
||||||
|
tdSql.execute("insert into st(tbname, t1, t2, t3, ts, ti, si, i, bi, f, d, b) values ('ct0', 0, 0.000000, 'childtable', 1546300800000, 0, 0, 0, 0, 0.000000, 0.000000, 'hello') ('ct0', 0, 0.000000, 'childtable', 1546300800001, 1, 1, 1, 1, 1.000000, 2.000000, 'hello')")
|
||||||
|
|
||||||
|
tdSql.execute("insert into st(tbname, t1, t2, t3, ts, ti, si, i, bi, f, d, b) values ('ct1', 1, 1.000000, 'childtable', 1546301800000, 64, 16960, 1000000, 1000000, 1000000.000000, 2000000.000000, 'hello') ('ct1', 1, 1.000000, 'childtable', 1546301800001, 65, 16961, 1000001, 1000001, 1000001.000000, 2000002.000000, 'hello')")
|
||||||
|
|
||||||
|
tdSql.execute("insert into st(tbname, t1, t2, t3, ts, ti, si, i, bi, f, d, b) values ('ct2', 2, 2.000000, 'childtable', 1546302800000, -128, -31616, 2000000, 2000000, 2000000.000000, 4000000.000000, 'hello') ('ct2', 2, 2.000000, 'childtable', 1546302800001, -127, -31615, 2000001, 2000001, 2000001.000000, 4000002.000000, 'hello')")
|
||||||
|
|
||||||
|
tdSql.execute("insert into st(tbname, t1, t2, t3, ts, ti, si, i, bi, f, d, b) values ('ct3', 3, 3.000000, 'childtable', 1546303800000, -64, -14656, 3000000, 3000000, 3000000.000000, 6000000.000000, 'hello') ('ct3', 3, 3.000000, 'childtable', 1546303800001, -63, -14655, 3000001, 3000001, 3000001.000000, 6000002.000000, 'hello')")
|
||||||
|
|
||||||
|
tdSql.execute("insert into st(tbname, t1, t2, t3, ts, ti, si, i, bi, f, d, b) values ('ct4', 4, 4.000000, 'childtable', 1546304800000, 0, 2304, 4000000, 4000000, 4000000.000000, 8000000.000000, 'hello') ('ct4', 4, 4.000000, 'childtable', 1546304800001, 1, 2305, 4000001, 4000001, 4000001.000000, 8000002.000000, 'hello')")
|
||||||
|
|
||||||
|
tdSql.execute("insert into st(tbname, t1, t2, t3, ts, ti, si, i, bi, f, d, b) values ('ct5', 5, 5.000000, 'childtable', 1546305800000, 64, 19264, 5000000, 5000000, 5000000.000000, 10000000.000000, 'hello') ('ct5', 5, 5.000000, 'childtable', 1546305800001, 65, 19265, 5000001, 5000001, 5000001.000000, 10000002.000000, 'hello')")
|
||||||
|
|
||||||
|
tdSql.execute("insert into st(tbname, t1, t2, t3, ts, ti, si, i, bi, f, d, b) values ('ct6', 6, 6.000000, 'childtable', 1546306800000, -128, -29312, 6000000, 6000000, 6000000.000000, 12000000.000000, 'hello') ('ct6', 6, 6.000000, 'childtable', 1546306800001, -127, -29311, 6000001, 6000001, 6000001.000000, 12000002.000000, 'hello')")
|
||||||
|
|
||||||
|
tdSql.execute("insert into st(tbname, t1, t2, t3, ts, ti, si, i, bi, f, d, b) values ('ct7', 7, 7.000000, 'childtable', 1546307800000, -64, -12352, 7000000, 7000000, 7000000.000000, 14000000.000000, 'hello') ('ct7', 7, 7.000000, 'childtable', 1546307800001, -63, -12351, 7000001, 7000001, 7000001.000000, 14000002.000000, 'hello')")
|
||||||
|
|
||||||
|
tdSql.execute("insert into st(tbname, t1, t2, t3, ts, ti, si, i, bi, f, d, b) values ('ct8', 8, 8.000000, 'childtable', 1546308800000, 0, 4608, 8000000, 8000000, 8000000.000000, 16000000.000000, 'hello') ('ct8', 8, 8.000000, 'childtable', 1546308800001, 1, 4609, 8000001, 8000001, 8000001.000000, 16000002.000000, 'hello')")
|
||||||
|
|
||||||
|
tdSql.execute("insert into st(tbname, t1, t2, t3, ts, ti, si, i, bi, f, d, b) values ('ct9', 9, 9.000000, 'childtable', 1546309800000, 64, 21568, 9000000, 9000000, 9000000.000000, 18000000.000000, 'hello') ('ct9', 9, 9.000000, 'childtable', 1546309800001, 65, 21569, 9000001, 9000001, 9000001.000000, 18000002.000000, 'hello')")
|
||||||
|
|
||||||
|
tdSql.query('select * from st order by ts')
|
||||||
|
tdSql.checkRows(20)
|
||||||
|
tdSql.checkData(0, 0, datetime.datetime(2019, 1, 1, 8, 0))
|
||||||
|
tdSql.checkData(0, 1, 0)
|
||||||
|
tdSql.checkData(0, 2, 0)
|
||||||
|
tdSql.checkData(0, 3, 0)
|
||||||
|
tdSql.checkData(0, 4, 0)
|
||||||
|
tdSql.checkData(0, 5, 0.0)
|
||||||
|
tdSql.checkData(0, 6, 0.0)
|
||||||
|
tdSql.checkData(0, 7, 'hello')
|
||||||
|
tdSql.checkData(0, 8, 0)
|
||||||
|
tdSql.checkData(0, 9, 0.0)
|
||||||
|
tdSql.checkData(0, 10, 'childtable')
|
||||||
|
tdSql.checkData(1, 0, datetime.datetime(2019, 1, 1, 8, 0, 0, 1000))
|
||||||
|
tdSql.checkData(1, 1, 1)
|
||||||
|
tdSql.checkData(1, 2, 1)
|
||||||
|
tdSql.checkData(1, 3, 1)
|
||||||
|
tdSql.checkData(1, 4, 1)
|
||||||
|
tdSql.checkData(1, 5, 1.0)
|
||||||
|
tdSql.checkData(1, 6, 2.0)
|
||||||
|
tdSql.checkData(1, 7, 'hello')
|
||||||
|
tdSql.checkData(1, 8, 0)
|
||||||
|
tdSql.checkData(1, 9, 0.0)
|
||||||
|
tdSql.checkData(1, 10, 'childtable')
|
||||||
|
tdSql.checkData(2, 0, datetime.datetime(2019, 1, 1, 8, 16, 40))
|
||||||
|
tdSql.checkData(2, 1, 64)
|
||||||
|
tdSql.checkData(2, 2, 16960)
|
||||||
|
tdSql.checkData(2, 3, 1000000)
|
||||||
|
tdSql.checkData(2, 4, 1000000)
|
||||||
|
tdSql.checkData(2, 5, 1000000.0)
|
||||||
|
tdSql.checkData(2, 6, 2000000.0)
|
||||||
|
tdSql.checkData(2, 7, 'hello')
|
||||||
|
tdSql.checkData(2, 8, 1)
|
||||||
|
tdSql.checkData(2, 9, 1.0)
|
||||||
|
tdSql.checkData(2, 10, 'childtable')
|
||||||
|
tdSql.checkData(3, 0, datetime.datetime(2019, 1, 1, 8, 16, 40, 1000))
|
||||||
|
tdSql.checkData(3, 1, 65)
|
||||||
|
tdSql.checkData(3, 2, 16961)
|
||||||
|
tdSql.checkData(3, 3, 1000001)
|
||||||
|
tdSql.checkData(3, 4, 1000001)
|
||||||
|
tdSql.checkData(3, 5, 1000001.0)
|
||||||
|
tdSql.checkData(3, 6, 2000002.0)
|
||||||
|
tdSql.checkData(3, 7, 'hello')
|
||||||
|
tdSql.checkData(3, 8, 1)
|
||||||
|
tdSql.checkData(3, 9, 1.0)
|
||||||
|
tdSql.checkData(3, 10, 'childtable')
|
||||||
|
tdSql.checkData(4, 0, datetime.datetime(2019, 1, 1, 8, 33, 20))
|
||||||
|
tdSql.checkData(4, 1, -128)
|
||||||
|
tdSql.checkData(4, 2, -31616)
|
||||||
|
tdSql.checkData(4, 3, 2000000)
|
||||||
|
tdSql.checkData(4, 4, 2000000)
|
||||||
|
tdSql.checkData(4, 5, 2000000.0)
|
||||||
|
tdSql.checkData(4, 6, 4000000.0)
|
||||||
|
tdSql.checkData(4, 7, 'hello')
|
||||||
|
tdSql.checkData(4, 8, 2)
|
||||||
|
tdSql.checkData(4, 9, 2.0)
|
||||||
|
tdSql.checkData(4, 10, 'childtable')
|
||||||
|
tdSql.checkData(5, 0, datetime.datetime(2019, 1, 1, 8, 33, 20, 1000))
|
||||||
|
tdSql.checkData(5, 1, -127)
|
||||||
|
tdSql.checkData(5, 2, -31615)
|
||||||
|
tdSql.checkData(5, 3, 2000001)
|
||||||
|
tdSql.checkData(5, 4, 2000001)
|
||||||
|
tdSql.checkData(5, 5, 2000001.0)
|
||||||
|
tdSql.checkData(5, 6, 4000002.0)
|
||||||
|
tdSql.checkData(5, 7, 'hello')
|
||||||
|
tdSql.checkData(5, 8, 2)
|
||||||
|
tdSql.checkData(5, 9, 2.0)
|
||||||
|
tdSql.checkData(5, 10, 'childtable')
|
||||||
|
tdSql.checkData(6, 0, datetime.datetime(2019, 1, 1, 8, 50))
|
||||||
|
tdSql.checkData(6, 1, -64)
|
||||||
|
tdSql.checkData(6, 2, -14656)
|
||||||
|
tdSql.checkData(6, 3, 3000000)
|
||||||
|
tdSql.checkData(6, 4, 3000000)
|
||||||
|
tdSql.checkData(6, 5, 3000000.0)
|
||||||
|
tdSql.checkData(6, 6, 6000000.0)
|
||||||
|
tdSql.checkData(6, 7, 'hello')
|
||||||
|
tdSql.checkData(6, 8, 3)
|
||||||
|
tdSql.checkData(6, 9, 3.0)
|
||||||
|
tdSql.checkData(6, 10, 'childtable')
|
||||||
|
tdSql.checkData(7, 0, datetime.datetime(2019, 1, 1, 8, 50, 0, 1000))
|
||||||
|
tdSql.checkData(7, 1, -63)
|
||||||
|
tdSql.checkData(7, 2, -14655)
|
||||||
|
tdSql.checkData(7, 3, 3000001)
|
||||||
|
tdSql.checkData(7, 4, 3000001)
|
||||||
|
tdSql.checkData(7, 5, 3000001.0)
|
||||||
|
tdSql.checkData(7, 6, 6000002.0)
|
||||||
|
tdSql.checkData(7, 7, 'hello')
|
||||||
|
tdSql.checkData(7, 8, 3)
|
||||||
|
tdSql.checkData(7, 9, 3.0)
|
||||||
|
tdSql.checkData(7, 10, 'childtable')
|
||||||
|
tdSql.checkData(8, 0, datetime.datetime(2019, 1, 1, 9, 6, 40))
|
||||||
|
tdSql.checkData(8, 1, 0)
|
||||||
|
tdSql.checkData(8, 2, 2304)
|
||||||
|
tdSql.checkData(8, 3, 4000000)
|
||||||
|
tdSql.checkData(8, 4, 4000000)
|
||||||
|
tdSql.checkData(8, 5, 4000000.0)
|
||||||
|
tdSql.checkData(8, 6, 8000000.0)
|
||||||
|
tdSql.checkData(8, 7, 'hello')
|
||||||
|
tdSql.checkData(8, 8, 4)
|
||||||
|
tdSql.checkData(8, 9, 4.0)
|
||||||
|
tdSql.checkData(8, 10, 'childtable')
|
||||||
|
tdSql.checkData(9, 0, datetime.datetime(2019, 1, 1, 9, 6, 40, 1000))
|
||||||
|
tdSql.checkData(9, 1, 1)
|
||||||
|
tdSql.checkData(9, 2, 2305)
|
||||||
|
tdSql.checkData(9, 3, 4000001)
|
||||||
|
tdSql.checkData(9, 4, 4000001)
|
||||||
|
tdSql.checkData(9, 5, 4000001.0)
|
||||||
|
tdSql.checkData(9, 6, 8000002.0)
|
||||||
|
tdSql.checkData(9, 7, 'hello')
|
||||||
|
tdSql.checkData(9, 8, 4)
|
||||||
|
tdSql.checkData(9, 9, 4.0)
|
||||||
|
tdSql.checkData(9, 10, 'childtable')
|
||||||
|
tdSql.checkData(10, 0, datetime.datetime(2019, 1, 1, 9, 23, 20))
|
||||||
|
tdSql.checkData(10, 1, 64)
|
||||||
|
tdSql.checkData(10, 2, 19264)
|
||||||
|
tdSql.checkData(10, 3, 5000000)
|
||||||
|
tdSql.checkData(10, 4, 5000000)
|
||||||
|
tdSql.checkData(10, 5, 5000000.0)
|
||||||
|
tdSql.checkData(10, 6, 10000000.0)
|
||||||
|
tdSql.checkData(10, 7, 'hello')
|
||||||
|
tdSql.checkData(10, 8, 5)
|
||||||
|
tdSql.checkData(10, 9, 5.0)
|
||||||
|
tdSql.checkData(10, 10, 'childtable')
|
||||||
|
tdSql.checkData(11, 0, datetime.datetime(2019, 1, 1, 9, 23, 20, 1000))
|
||||||
|
tdSql.checkData(11, 1, 65)
|
||||||
|
tdSql.checkData(11, 2, 19265)
|
||||||
|
tdSql.checkData(11, 3, 5000001)
|
||||||
|
tdSql.checkData(11, 4, 5000001)
|
||||||
|
tdSql.checkData(11, 5, 5000001.0)
|
||||||
|
tdSql.checkData(11, 6, 10000002.0)
|
||||||
|
tdSql.checkData(11, 7, 'hello')
|
||||||
|
tdSql.checkData(11, 8, 5)
|
||||||
|
tdSql.checkData(11, 9, 5.0)
|
||||||
|
tdSql.checkData(11, 10, 'childtable')
|
||||||
|
tdSql.checkData(12, 0, datetime.datetime(2019, 1, 1, 9, 40))
|
||||||
|
tdSql.checkData(12, 1, -128)
|
||||||
|
tdSql.checkData(12, 2, -29312)
|
||||||
|
tdSql.checkData(12, 3, 6000000)
|
||||||
|
tdSql.checkData(12, 4, 6000000)
|
||||||
|
tdSql.checkData(12, 5, 6000000.0)
|
||||||
|
tdSql.checkData(12, 6, 12000000.0)
|
||||||
|
tdSql.checkData(12, 7, 'hello')
|
||||||
|
tdSql.checkData(12, 8, 6)
|
||||||
|
tdSql.checkData(12, 9, 6.0)
|
||||||
|
tdSql.checkData(12, 10, 'childtable')
|
||||||
|
tdSql.checkData(13, 0, datetime.datetime(2019, 1, 1, 9, 40, 0, 1000))
|
||||||
|
tdSql.checkData(13, 1, -127)
|
||||||
|
tdSql.checkData(13, 2, -29311)
|
||||||
|
tdSql.checkData(13, 3, 6000001)
|
||||||
|
tdSql.checkData(13, 4, 6000001)
|
||||||
|
tdSql.checkData(13, 5, 6000001.0)
|
||||||
|
tdSql.checkData(13, 6, 12000002.0)
|
||||||
|
tdSql.checkData(13, 7, 'hello')
|
||||||
|
tdSql.checkData(13, 8, 6)
|
||||||
|
tdSql.checkData(13, 9, 6.0)
|
||||||
|
tdSql.checkData(13, 10, 'childtable')
|
||||||
|
tdSql.checkData(14, 0, datetime.datetime(2019, 1, 1, 9, 56, 40))
|
||||||
|
tdSql.checkData(14, 1, -64)
|
||||||
|
tdSql.checkData(14, 2, -12352)
|
||||||
|
tdSql.checkData(14, 3, 7000000)
|
||||||
|
tdSql.checkData(14, 4, 7000000)
|
||||||
|
tdSql.checkData(14, 5, 7000000.0)
|
||||||
|
tdSql.checkData(14, 6, 14000000.0)
|
||||||
|
tdSql.checkData(14, 7, 'hello')
|
||||||
|
tdSql.checkData(14, 8, 7)
|
||||||
|
tdSql.checkData(14, 9, 7.0)
|
||||||
|
tdSql.checkData(14, 10, 'childtable')
|
||||||
|
tdSql.checkData(15, 0, datetime.datetime(2019, 1, 1, 9, 56, 40, 1000))
|
||||||
|
tdSql.checkData(15, 1, -63)
|
||||||
|
tdSql.checkData(15, 2, -12351)
|
||||||
|
tdSql.checkData(15, 3, 7000001)
|
||||||
|
tdSql.checkData(15, 4, 7000001)
|
||||||
|
tdSql.checkData(15, 5, 7000001.0)
|
||||||
|
tdSql.checkData(15, 6, 14000002.0)
|
||||||
|
tdSql.checkData(15, 7, 'hello')
|
||||||
|
tdSql.checkData(15, 8, 7)
|
||||||
|
tdSql.checkData(15, 9, 7.0)
|
||||||
|
tdSql.checkData(15, 10, 'childtable')
|
||||||
|
tdSql.checkData(16, 0, datetime.datetime(2019, 1, 1, 10, 13, 20))
|
||||||
|
tdSql.checkData(16, 1, 0)
|
||||||
|
tdSql.checkData(16, 2, 4608)
|
||||||
|
tdSql.checkData(16, 3, 8000000)
|
||||||
|
tdSql.checkData(16, 4, 8000000)
|
||||||
|
tdSql.checkData(16, 5, 8000000.0)
|
||||||
|
tdSql.checkData(16, 6, 16000000.0)
|
||||||
|
tdSql.checkData(16, 7, 'hello')
|
||||||
|
tdSql.checkData(16, 8, 8)
|
||||||
|
tdSql.checkData(16, 9, 8.0)
|
||||||
|
tdSql.checkData(16, 10, 'childtable')
|
||||||
|
tdSql.checkData(17, 0, datetime.datetime(2019, 1, 1, 10, 13, 20, 1000))
|
||||||
|
tdSql.checkData(17, 1, 1)
|
||||||
|
tdSql.checkData(17, 2, 4609)
|
||||||
|
tdSql.checkData(17, 3, 8000001)
|
||||||
|
tdSql.checkData(17, 4, 8000001)
|
||||||
|
tdSql.checkData(17, 5, 8000001.0)
|
||||||
|
tdSql.checkData(17, 6, 16000002.0)
|
||||||
|
tdSql.checkData(17, 7, 'hello')
|
||||||
|
tdSql.checkData(17, 8, 8)
|
||||||
|
tdSql.checkData(17, 9, 8.0)
|
||||||
|
tdSql.checkData(17, 10, 'childtable')
|
||||||
|
tdSql.checkData(18, 0, datetime.datetime(2019, 1, 1, 10, 30))
|
||||||
|
tdSql.checkData(18, 1, 64)
|
||||||
|
tdSql.checkData(18, 2, 21568)
|
||||||
|
tdSql.checkData(18, 3, 9000000)
|
||||||
|
tdSql.checkData(18, 4, 9000000)
|
||||||
|
tdSql.checkData(18, 5, 9000000.0)
|
||||||
|
tdSql.checkData(18, 6, 18000000.0)
|
||||||
|
tdSql.checkData(18, 7, 'hello')
|
||||||
|
tdSql.checkData(18, 8, 9)
|
||||||
|
tdSql.checkData(18, 9, 9.0)
|
||||||
|
tdSql.checkData(18, 10, 'childtable')
|
||||||
|
tdSql.checkData(19, 0, datetime.datetime(2019, 1, 1, 10, 30, 0, 1000))
|
||||||
|
tdSql.checkData(19, 1, 65)
|
||||||
|
tdSql.checkData(19, 2, 21569)
|
||||||
|
tdSql.checkData(19, 3, 9000001)
|
||||||
|
tdSql.checkData(19, 4, 9000001)
|
||||||
|
tdSql.checkData(19, 5, 9000001.0)
|
||||||
|
tdSql.checkData(19, 6, 18000002.0)
|
||||||
|
tdSql.checkData(19, 7, 'hello')
|
||||||
|
tdSql.checkData(19, 8, 9)
|
||||||
|
tdSql.checkData(19, 9, 9.0)
|
||||||
|
tdSql.checkData(19, 10, 'childtable')
|
||||||
|
|
||||||
|
tdSql.execute('drop database insert_stb3')
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
self.run_normal()
|
||||||
|
self.run_insert_stb()
|
||||||
|
self.run_stmt_error()
|
||||||
|
self.run_consecutive_seq()
|
||||||
|
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -0,0 +1,91 @@
|
||||||
|
{
|
||||||
|
"filetype": "insert",
|
||||||
|
"cfgdir": "/etc/taos",
|
||||||
|
"host": "127.0.0.1",
|
||||||
|
"port": 6030,
|
||||||
|
"user": "root",
|
||||||
|
"password": "taosdata",
|
||||||
|
"connection_pool_size": 8,
|
||||||
|
"thread_count": 100,
|
||||||
|
"create_table_thread_count": 7,
|
||||||
|
"result_file": "./insert_res.txt",
|
||||||
|
"confirm_parameter_prompt": "no",
|
||||||
|
"insert_interval": 0,
|
||||||
|
"interlace_rows": 100,
|
||||||
|
"num_of_records_per_req": 100,
|
||||||
|
"prepared_rand": 10000,
|
||||||
|
"chinese": "no",
|
||||||
|
"databases": [
|
||||||
|
{
|
||||||
|
"dbinfo": {
|
||||||
|
"name": "db",
|
||||||
|
"drop": "yes",
|
||||||
|
"replica": 1,
|
||||||
|
"precision": "ms",
|
||||||
|
"vgroups": 1,
|
||||||
|
"duration": "1d",
|
||||||
|
"keep": 3650,
|
||||||
|
"minRows": 100,
|
||||||
|
"maxRows": 200,
|
||||||
|
"STT_TRIGGER": 1,
|
||||||
|
"comp": 2
|
||||||
|
},
|
||||||
|
"super_tables": [
|
||||||
|
{
|
||||||
|
"name": "meters",
|
||||||
|
"child_table_exists": "no",
|
||||||
|
"childtable_count": 1,
|
||||||
|
"childtable_prefix": "d",
|
||||||
|
"escape_character": "yes",
|
||||||
|
"auto_create_table": "no",
|
||||||
|
"batch_create_tbl_num": 5,
|
||||||
|
"data_source": "rand",
|
||||||
|
"insert_mode": "taosc",
|
||||||
|
"non_stop_mode": "no",
|
||||||
|
"line_protocol": "line",
|
||||||
|
"insert_rows": 10000,
|
||||||
|
"childtable_limit": 0,
|
||||||
|
"childtable_offset": 100,
|
||||||
|
"interlace_rows": 0,
|
||||||
|
"insert_interval": 0,
|
||||||
|
"partial_col_num": 0,
|
||||||
|
"disorder_ratio": 0,
|
||||||
|
"disorder_range": 1000,
|
||||||
|
"timestamp_step": 1000,
|
||||||
|
"start_timestamp": "2021-10-02 00:01:00.000",
|
||||||
|
"sample_format": "csv",
|
||||||
|
"sample_file": "./sample.csv",
|
||||||
|
"use_sample_ts": "no",
|
||||||
|
"tags_file": "",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"type": "FLOAT",
|
||||||
|
"name": "current",
|
||||||
|
"count": 1,
|
||||||
|
"max": 12,
|
||||||
|
"min": 8
|
||||||
|
},
|
||||||
|
{ "type": "INT", "name": "voltage", "max": 225, "min": 215 },
|
||||||
|
{ "type": "FLOAT", "name": "phase", "max": 1, "min": 0 }
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"type": "INT",
|
||||||
|
"name": "groupid",
|
||||||
|
"max": -10000,
|
||||||
|
"min": 10000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "location",
|
||||||
|
"type": "BINARY",
|
||||||
|
"len": 16,
|
||||||
|
"values": ["San Francisco", "Los Angles", "San Diego",
|
||||||
|
"San Jose", "Palo Alto", "Campbell", "Mountain View",
|
||||||
|
"Sunnyvale", "Santa Clara", "Cupertino"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,91 @@
|
||||||
|
{
|
||||||
|
"filetype": "insert",
|
||||||
|
"cfgdir": "/etc/taos",
|
||||||
|
"host": "127.0.0.1",
|
||||||
|
"port": 6030,
|
||||||
|
"user": "root",
|
||||||
|
"password": "taosdata",
|
||||||
|
"connection_pool_size": 8,
|
||||||
|
"thread_count": 100,
|
||||||
|
"create_table_thread_count": 7,
|
||||||
|
"result_file": "./insert_res.txt",
|
||||||
|
"confirm_parameter_prompt": "no",
|
||||||
|
"insert_interval": 0,
|
||||||
|
"interlace_rows": 100,
|
||||||
|
"num_of_records_per_req": 100,
|
||||||
|
"prepared_rand": 10000,
|
||||||
|
"chinese": "no",
|
||||||
|
"databases": [
|
||||||
|
{
|
||||||
|
"dbinfo": {
|
||||||
|
"name": "db",
|
||||||
|
"drop": "no",
|
||||||
|
"replica": 1,
|
||||||
|
"precision": "ms",
|
||||||
|
"vgroups": 1,
|
||||||
|
"duration": "1d",
|
||||||
|
"keep": 3650,
|
||||||
|
"minRows": 100,
|
||||||
|
"maxRows": 200,
|
||||||
|
"STT_TRIGGER": 1,
|
||||||
|
"comp": 2
|
||||||
|
},
|
||||||
|
"super_tables": [
|
||||||
|
{
|
||||||
|
"name": "meters",
|
||||||
|
"child_table_exists": "yes",
|
||||||
|
"childtable_count": 1,
|
||||||
|
"childtable_prefix": "d",
|
||||||
|
"escape_character": "yes",
|
||||||
|
"auto_create_table": "no",
|
||||||
|
"batch_create_tbl_num": 5,
|
||||||
|
"data_source": "rand",
|
||||||
|
"insert_mode": "taosc",
|
||||||
|
"non_stop_mode": "no",
|
||||||
|
"line_protocol": "line",
|
||||||
|
"insert_rows": 4,
|
||||||
|
"childtable_limit": 0,
|
||||||
|
"childtable_offset": 100,
|
||||||
|
"interlace_rows": 0,
|
||||||
|
"insert_interval": 0,
|
||||||
|
"partial_col_num": 0,
|
||||||
|
"disorder_ratio": 0,
|
||||||
|
"disorder_range": 1000,
|
||||||
|
"timestamp_step": 3600000,
|
||||||
|
"start_timestamp": "2021-10-02 00:00:00.001",
|
||||||
|
"sample_format": "csv",
|
||||||
|
"sample_file": "./sample.csv",
|
||||||
|
"use_sample_ts": "no",
|
||||||
|
"tags_file": "",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"type": "FLOAT",
|
||||||
|
"name": "current",
|
||||||
|
"count": 1,
|
||||||
|
"max": 12,
|
||||||
|
"min": 8
|
||||||
|
},
|
||||||
|
{ "type": "INT", "name": "voltage", "max": 225, "min": 215 },
|
||||||
|
{ "type": "FLOAT", "name": "phase", "max": 1, "min": 0 }
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"type": "INT",
|
||||||
|
"name": "groupid",
|
||||||
|
"max": -10000,
|
||||||
|
"min": 10000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "location",
|
||||||
|
"type": "BINARY",
|
||||||
|
"len": 16,
|
||||||
|
"values": ["San Francisco", "Los Angles", "San Diego",
|
||||||
|
"San Jose", "Palo Alto", "Campbell", "Mountain View",
|
||||||
|
"Sunnyvale", "Santa Clara", "Cupertino"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,71 @@
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
from util.log import *
|
||||||
|
from util.cases import *
|
||||||
|
from util.sql import *
|
||||||
|
from util.dnodes import *
|
||||||
|
import time
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
class TDTestCase:
|
||||||
|
def init(self, conn, logSql, replicaVar=1):
|
||||||
|
self.replicaVar = int(replicaVar)
|
||||||
|
tdLog.debug("start to execute %s" % __file__)
|
||||||
|
tdSql.init(conn.cursor())
|
||||||
|
|
||||||
|
self.rowNum = 10
|
||||||
|
self.ts = 1537146000000
|
||||||
|
|
||||||
|
def getPath(self, tool="taosBenchmark"):
|
||||||
|
if (platform.system().lower() == 'windows'):
|
||||||
|
tool = tool + ".exe"
|
||||||
|
selfPath = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
|
||||||
|
if ("community" in selfPath):
|
||||||
|
projPath = selfPath[:selfPath.find("community")]
|
||||||
|
else:
|
||||||
|
projPath = selfPath[:selfPath.find("tests")]
|
||||||
|
|
||||||
|
paths = []
|
||||||
|
for root, dirs, files in os.walk(projPath):
|
||||||
|
if ((tool) in files):
|
||||||
|
rootRealPath = os.path.dirname(os.path.realpath(root))
|
||||||
|
if ("packaging" not in rootRealPath):
|
||||||
|
paths.append(os.path.join(root, tool))
|
||||||
|
break
|
||||||
|
if (len(paths) == 0):
|
||||||
|
tdLog.exit("taosBenchmark not found!")
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
tdLog.info("taosBenchmark found in %s" % paths[0])
|
||||||
|
return paths[0]
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
binPath = self.getPath()
|
||||||
|
tdLog.debug("insert full data block and flush db")
|
||||||
|
os.system(f"{binPath} -f ./2-query/megeFileSttQuery.json")
|
||||||
|
tdSql.execute("flush database db;")
|
||||||
|
tdLog.debug("insert disorder data and flush db")
|
||||||
|
os.system(f"{binPath} -f ./2-query/megeFileSttQueryUpdate.json")
|
||||||
|
tdSql.execute("flush database db;")
|
||||||
|
tdLog.debug("check data")
|
||||||
|
tdSql.query("select ts from db.d0 limit 5;")
|
||||||
|
tdSql.checkData(0, 0, '2021-10-02 00:00:00.001')
|
||||||
|
tdSql.checkData(1, 0, '2021-10-02 00:01:00.000')
|
||||||
|
tdLog.debug("update disorder data and flush db")
|
||||||
|
|
||||||
|
os.system(f"{binPath} -f ./2-query/megeFileSttQueryUpdate.json")
|
||||||
|
tdSql.query("select ts from db.d0 limit 5;")
|
||||||
|
tdSql.checkData(0, 0, '2021-10-02 00:00:00.001')
|
||||||
|
tdSql.checkData(1, 0, '2021-10-02 00:01:00.000')
|
||||||
|
tdSql.execute("flush database db;")
|
||||||
|
tdSql.query("select ts from db.d0 limit 5;")
|
||||||
|
tdSql.checkData(0, 0, '2021-10-02 00:00:00.001')
|
||||||
|
tdSql.checkData(1, 0, '2021-10-02 00:01:00.000')
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -49,7 +49,7 @@ class TDTestCase:
|
||||||
'rowsPerTbl': 10000,
|
'rowsPerTbl': 10000,
|
||||||
'batchNum': 10,
|
'batchNum': 10,
|
||||||
'startTs': 1640966400000, # 2022-01-01 00:00:00.000
|
'startTs': 1640966400000, # 2022-01-01 00:00:00.000
|
||||||
'pollDelay': 30,
|
'pollDelay': 60,
|
||||||
'showMsg': 1,
|
'showMsg': 1,
|
||||||
'showRow': 1,
|
'showRow': 1,
|
||||||
'snapshot': 0}
|
'snapshot': 0}
|
||||||
|
|
|
@ -108,16 +108,17 @@ ELSE ()
|
||||||
)
|
)
|
||||||
EXECUTE_PROCESS(
|
EXECUTE_PROCESS(
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/taosadapter
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/taosadapter
|
||||||
COMMAND git rev-parse --short HEAD
|
COMMAND git rev-parse HEAD
|
||||||
RESULT_VARIABLE commit_sha1
|
RESULT_VARIABLE commit_sha1
|
||||||
OUTPUT_VARIABLE taosadapter_commit_sha1
|
OUTPUT_VARIABLE taosadapter_commit_sha1
|
||||||
)
|
)
|
||||||
IF ("${taosadapter_commit_sha1}" STREQUAL "")
|
IF ("${taosadapter_commit_sha1}" STREQUAL "")
|
||||||
SET(taosadapter_commit_sha1 "unknown")
|
SET(taosadapter_commit_sha1 "unknown")
|
||||||
ELSE ()
|
ELSE ()
|
||||||
STRING(SUBSTRING "${taosadapter_commit_sha1}" 0 7 taosadapter_commit_sha1)
|
# STRING(SUBSTRING "${taosadapter_commit_sha1}" 0 7 taosadapter_commit_sha1)
|
||||||
STRING(STRIP "${taosadapter_commit_sha1}" taosadapter_commit_sha1)
|
STRING(STRIP "${taosadapter_commit_sha1}" taosadapter_commit_sha1)
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
SET(taos_version ${TD_VER_NUMBER})
|
||||||
MESSAGE("${Green} taosAdapter will use ${taos_version} and commit ${taosadapter_commit_sha1} as version ${ColourReset}")
|
MESSAGE("${Green} taosAdapter will use ${taos_version} and commit ${taosadapter_commit_sha1} as version ${ColourReset}")
|
||||||
EXECUTE_PROCESS(
|
EXECUTE_PROCESS(
|
||||||
COMMAND cd ..
|
COMMAND cd ..
|
||||||
|
@ -139,9 +140,8 @@ ELSE ()
|
||||||
BUILD_COMMAND
|
BUILD_COMMAND
|
||||||
COMMAND set CGO_CFLAGS=-I${CMAKE_CURRENT_SOURCE_DIR}/../include/client
|
COMMAND set CGO_CFLAGS=-I${CMAKE_CURRENT_SOURCE_DIR}/../include/client
|
||||||
COMMAND set CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/build/lib
|
COMMAND set CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/build/lib
|
||||||
# COMMAND go build -a -o taosadapter.exe -ldflags "-X github.com/taosdata/taosadapter/v3/version.Version=${taos_version} -X github.com/taosdata/taosadapter/v3/version.CommitID=${taosadapter_commit_sha1}"
|
COMMAND go build -a -o taosadapter.exe -ldflags "-s -w -X 'github.com/taosdata/taosadapter/v3/version.Version=${taos_version}' -X 'github.com/taosdata/taosadapter/v3/version.CommitID=${taosadapter_commit_sha1}' -X 'github.com/taosdata/taosadapter/v3/version.BuildInfo=${TD_VER_DATE}'"
|
||||||
COMMAND go build -a -o taosadapter.exe -ldflags "-s -w -X github.com/taosdata/taosadapter/v3/version.Version=${taos_version} -X github.com/taosdata/taosadapter/v3/version.CommitID=${taosadapter_commit_sha1}"
|
COMMAND go build -a -o taosadapter-debug.exe -ldflags "-X 'github.com/taosdata/taosadapter/v3/version.Version=${taos_version}' -X 'github.com/taosdata/taosadapter/v3/version.CommitID=${taosadapter_commit_sha1}' -X 'github.com/taosdata/taosadapter/v3/version.BuildInfo=${TD_VER_DATE}'"
|
||||||
COMMAND go build -a -o taosadapter-debug.exe -ldflags "-X github.com/taosdata/taosadapter/v3/version.Version=${taos_version} -X github.com/taosdata/taosadapter/v3/version.CommitID=${taosadapter_commit_sha1}"
|
|
||||||
|
|
||||||
INSTALL_COMMAND
|
INSTALL_COMMAND
|
||||||
COMMAND cmake -E echo "Comparessing taosadapter.exe"
|
COMMAND cmake -E echo "Comparessing taosadapter.exe"
|
||||||
|
@ -167,9 +167,8 @@ ELSE ()
|
||||||
PATCH_COMMAND
|
PATCH_COMMAND
|
||||||
COMMAND git clean -f -d
|
COMMAND git clean -f -d
|
||||||
BUILD_COMMAND
|
BUILD_COMMAND
|
||||||
# COMMAND CGO_CFLAGS=-I${CMAKE_CURRENT_SOURCE_DIR}/../include/client CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/build/lib go build -a -ldflags "-X github.com/taosdata/taosadapter/v3/version.Version=${taos_version} -X github.com/taosdata/taosadapter/v3/version.CommitID=${taosadapter_commit_sha1}"
|
COMMAND CGO_CFLAGS=-I${CMAKE_CURRENT_SOURCE_DIR}/../include/client CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/build/lib go build -a -ldflags "-s -w -X 'github.com/taosdata/taosadapter/v3/version.Version=${taos_version}' -X 'github.com/taosdata/taosadapter/v3/version.CommitID=${taosadapter_commit_sha1}' -X 'github.com/taosdata/taosadapter/v3/version.BuildInfo=${TD_VER_DATE}'"
|
||||||
COMMAND CGO_CFLAGS=-I${CMAKE_CURRENT_SOURCE_DIR}/../include/client CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/build/lib go build -a -ldflags "-s -w -X github.com/taosdata/taosadapter/v3/version.Version=${taos_version} -X github.com/taosdata/taosadapter/v3/version.CommitID=${taosadapter_commit_sha1}"
|
COMMAND CGO_CFLAGS=-I${CMAKE_CURRENT_SOURCE_DIR}/../include/client CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/build/lib go build -a -o taosadapter-debug -ldflags "-X 'github.com/taosdata/taosadapter/v3/version.Version=${taos_version}' -X 'github.com/taosdata/taosadapter/v3/version.CommitID=${taosadapter_commit_sha1}' -X 'github.com/taosdata/taosadapter/v3/version.BuildInfo=${TD_VER_DATE}'"
|
||||||
COMMAND CGO_CFLAGS=-I${CMAKE_CURRENT_SOURCE_DIR}/../include/client CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/build/lib go build -a -o taosadapter-debug -ldflags "-X github.com/taosdata/taosadapter/v3/version.Version=${taos_version} -X github.com/taosdata/taosadapter/v3/version.CommitID=${taosadapter_commit_sha1}"
|
|
||||||
INSTALL_COMMAND
|
INSTALL_COMMAND
|
||||||
COMMAND cmake -E echo "Copy taosadapter"
|
COMMAND cmake -E echo "Copy taosadapter"
|
||||||
COMMAND cmake -E copy taosadapter ${CMAKE_BINARY_DIR}/build/bin
|
COMMAND cmake -E copy taosadapter ${CMAKE_BINARY_DIR}/build/bin
|
||||||
|
@ -193,9 +192,8 @@ ELSE ()
|
||||||
PATCH_COMMAND
|
PATCH_COMMAND
|
||||||
COMMAND git clean -f -d
|
COMMAND git clean -f -d
|
||||||
BUILD_COMMAND
|
BUILD_COMMAND
|
||||||
# COMMAND CGO_CFLAGS=-I${CMAKE_CURRENT_SOURCE_DIR}/../include/client CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/build/lib go build -a -ldflags "-X github.com/taosdata/taosadapter/v3/version.Version=${taos_version} -X github.com/taosdata/taosadapter/v3/version.CommitID=${taosadapter_commit_sha1}"
|
COMMAND CGO_CFLAGS=-I${CMAKE_CURRENT_SOURCE_DIR}/../include/client CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/build/lib go build -a -ldflags "-s -w -X 'github.com/taosdata/taosadapter/v3/version.Version=${taos_version}' -X 'github.com/taosdata/taosadapter/v3/version.CommitID=${taosadapter_commit_sha1}' -X 'github.com/taosdata/taosadapter/v3/version.BuildInfo=${TD_VER_DATE}'"
|
||||||
COMMAND CGO_CFLAGS=-I${CMAKE_CURRENT_SOURCE_DIR}/../include/client CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/build/lib go build -a -ldflags "-s -w -X github.com/taosdata/taosadapter/v3/version.Version=${taos_version} -X github.com/taosdata/taosadapter/v3/version.CommitID=${taosadapter_commit_sha1}"
|
COMMAND CGO_CFLAGS=-I${CMAKE_CURRENT_SOURCE_DIR}/../include/client CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/build/lib go build -a -o taosadapter-debug -ldflags "-X 'github.com/taosdata/taosadapter/v3/version.Version=${taos_version}' -X 'github.com/taosdata/taosadapter/v3/version.CommitID=${taosadapter_commit_sha1}' -X 'github.com/taosdata/taosadapter/v3/version.BuildInfo=${TD_VER_DATE}'"
|
||||||
COMMAND CGO_CFLAGS=-I${CMAKE_CURRENT_SOURCE_DIR}/../include/client CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/build/lib go build -a -o taosadapter-debug -ldflags "-X github.com/taosdata/taosadapter/v3/version.Version=${taos_version} -X github.com/taosdata/taosadapter/v3/version.CommitID=${taosadapter_commit_sha1}"
|
|
||||||
INSTALL_COMMAND
|
INSTALL_COMMAND
|
||||||
COMMAND cmake -E echo "Comparessing taosadapter.exe"
|
COMMAND cmake -E echo "Comparessing taosadapter.exe"
|
||||||
COMMAND upx taosadapter || :
|
COMMAND upx taosadapter || :
|
||||||
|
|
|
@ -1678,8 +1678,8 @@ int main(int argc, char *argv[]) {
|
||||||
ASSERT(!ret);
|
ASSERT(!ret);
|
||||||
ret = sml_td18789_Test();
|
ret = sml_td18789_Test();
|
||||||
ASSERT(!ret);
|
ASSERT(!ret);
|
||||||
// ret = sml_td24070_Test();
|
ret = sml_td24070_Test();
|
||||||
// ASSERT(!ret);
|
ASSERT(!ret);
|
||||||
ret = sml_td23881_Test();
|
ret = sml_td23881_Test();
|
||||||
ASSERT(ret);
|
ASSERT(ret);
|
||||||
ret = sml_escape_Test();
|
ret = sml_escape_Test();
|
||||||
|
|
Loading…
Reference in New Issue