diff --git a/docs/en/28-releases/01-tdengine.md b/docs/en/28-releases/01-tdengine.md
index e33970c407aa8c53c72eb32cf8418cdb709aacdb..bcfcaf9ffb37206b92f265435f577b47aa452807 100644
--- a/docs/en/28-releases/01-tdengine.md
+++ b/docs/en/28-releases/01-tdengine.md
@@ -10,6 +10,10 @@ For TDengine 2.x installation packages by version, please visit [here](https://w
import Release from "/components/ReleaseV3";
+## 3.0.2.1
+
+
+
## 3.0.2.0
diff --git a/docs/en/28-releases/02-tools.md b/docs/en/28-releases/02-tools.md
index f2212bb2d4f2a692a1285f1869c7df61cc9cc374..6013aacc35692dc75c15de4fd2427bfaee36ea34 100644
--- a/docs/en/28-releases/02-tools.md
+++ b/docs/en/28-releases/02-tools.md
@@ -10,6 +10,10 @@ For other historical version installers, please visit [here](https://www.taosdat
import Release from "/components/ReleaseV3";
+## 2.3.3
+
+
+
## 2.3.2
diff --git a/docs/zh/28-releases/01-tdengine.md b/docs/zh/28-releases/01-tdengine.md
index 0ea34829a5f2c28658f5cc41d8a3341efdd0b39d..0fe6555162dc2b043288bfba882dab621916f35b 100644
--- a/docs/zh/28-releases/01-tdengine.md
+++ b/docs/zh/28-releases/01-tdengine.md
@@ -10,6 +10,10 @@ TDengine 2.x 各版本安装包请访问[这里](https://www.taosdata.com/all-do
import Release from "/components/ReleaseV3";
+## 3.0.2.1
+
+
+
## 3.0.2.0
diff --git a/docs/zh/28-releases/02-tools.md b/docs/zh/28-releases/02-tools.md
index 6471826b501996c4ba033a8fcbb08fc4e7333c03..331f6832c00888941f4c1a22565a3d5d62512ade 100644
--- a/docs/zh/28-releases/02-tools.md
+++ b/docs/zh/28-releases/02-tools.md
@@ -10,6 +10,10 @@ taosTools 各版本安装包下载链接如下:
import Release from "/components/ReleaseV3";
+## 2.3.3
+
+
+
## 2.3.2
diff --git a/include/common/tcommon.h b/include/common/tcommon.h
index f74795a250e66298ff08a1a1aa97d37f740a1942..aad69862f0ec5591fccbf0e0f8e024c34e426be2 100644
--- a/include/common/tcommon.h
+++ b/include/common/tcommon.h
@@ -195,7 +195,7 @@ typedef struct SDataBlockInfo {
uint32_t capacity;
SBlockID id;
int16_t hasVarCol;
- int16_t dataLoad; // denote if the data is loaded or not
+ int16_t dataLoad; // denote if the data is loaded or not
// TODO: optimize and remove following
int64_t version; // used for stream, and need serialization
@@ -204,8 +204,9 @@ typedef struct SDataBlockInfo {
STimeWindow calWin; // used for stream, do not serialize
TSKEY watermark; // used for stream
- char parTbName[TSDB_TABLE_NAME_LEN]; // used for stream partition
- STag* pTag; // used for stream partition
+ char parTbName[TSDB_TABLE_NAME_LEN]; // used for stream partition
+ int32_t tagLen;
+ void* pTag; // used for stream partition
} SDataBlockInfo;
typedef struct SSDataBlock {
@@ -239,22 +240,22 @@ typedef struct SVarColAttr {
// pBlockAgg->numOfNull == info.rows, all data are null
// pBlockAgg->numOfNull == 0, no data are null.
typedef struct SColumnInfoData {
- char* pData; // the corresponding block data in memory
+ char* pData; // the corresponding block data in memory
union {
char* nullbitmap; // bitmap, one bit for each item in the list
SVarColAttr varmeta;
};
- SColumnInfo info; // column info
- bool hasNull; // if current column data has null value.
+ SColumnInfo info; // column info
+ bool hasNull; // if current column data has null value.
} SColumnInfoData;
typedef struct SQueryTableDataCond {
uint64_t suid;
- int32_t order; // desc|asc order to iterate the data block
+ int32_t order; // desc|asc order to iterate the data block
int32_t numOfCols;
SColumnInfo* colList;
- int32_t* pSlotList; // the column output destation slot, and it may be null
- int32_t type; // data block load type:
+ int32_t* pSlotList; // the column output destation slot, and it may be null
+ int32_t type; // data block load type:
STimeWindow twindows;
int64_t startVersion;
int64_t endVersion;
diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h
index 6ea76a991a2000034a80d1f23fb9e4da582a68e6..66988ff135a59918e200d5138f6f5142351227b6 100644
--- a/include/libs/nodes/cmdnodes.h
+++ b/include/libs/nodes/cmdnodes.h
@@ -171,10 +171,10 @@ typedef struct SCreateSubTableClause {
STableOptions* pOptions;
} SCreateSubTableClause;
-typedef struct SCreateMultiTableStmt {
+typedef struct SCreateMultiTablesStmt {
ENodeType type;
SNodeList* pSubTables;
-} SCreateMultiTableStmt;
+} SCreateMultiTablesStmt;
typedef struct SDropTableClause {
ENodeType type;
@@ -209,14 +209,14 @@ typedef struct SAlterTableStmt {
typedef struct SCreateUserStmt {
ENodeType type;
- char useName[TSDB_USER_LEN];
+ char userName[TSDB_USER_LEN];
char password[TSDB_USET_PASSWORD_LEN];
int8_t sysinfo;
} SCreateUserStmt;
typedef struct SAlterUserStmt {
ENodeType type;
- char useName[TSDB_USER_LEN];
+ char userName[TSDB_USER_LEN];
int8_t alterType;
char password[TSDB_USET_PASSWORD_LEN];
int8_t enable;
diff --git a/include/libs/nodes/nodes.h b/include/libs/nodes/nodes.h
index d023e0df630a18f386bc4707c4a1e9b521c4f418..e111f36077575adc381c59ba1de62ccbab07af24 100644
--- a/include/libs/nodes/nodes.h
+++ b/include/libs/nodes/nodes.h
@@ -125,7 +125,7 @@ typedef enum ENodeType {
QUERY_NODE_TRIM_DATABASE_STMT,
QUERY_NODE_CREATE_TABLE_STMT,
QUERY_NODE_CREATE_SUBTABLE_CLAUSE,
- QUERY_NODE_CREATE_MULTI_TABLE_STMT,
+ QUERY_NODE_CREATE_MULTI_TABLES_STMT,
QUERY_NODE_DROP_TABLE_CLAUSE,
QUERY_NODE_DROP_TABLE_STMT,
QUERY_NODE_DROP_SUPER_TABLE_STMT,
diff --git a/include/libs/stream/streamState.h b/include/libs/stream/streamState.h
index 8fdac0da7fe3758a7ba335ee11c0709f2cf56e83..d7bc151eccd2a05610c1ac843859405f97ff8fd6 100644
--- a/include/libs/stream/streamState.h
+++ b/include/libs/stream/streamState.h
@@ -35,6 +35,7 @@ typedef struct STdbState {
TTB* pFillStateDb; // todo refactor
TTB* pSessionStateDb;
TTB* pParNameDb;
+ TTB* pParTagDb;
TXN* txn;
} STdbState;
@@ -108,6 +109,9 @@ int32_t streamStateCurPrev(SStreamState* pState, SStreamStateCur* pCur);
int32_t streamStatePutParName(SStreamState* pState, int64_t groupId, const char* tbname);
int32_t streamStateGetParName(SStreamState* pState, int64_t groupId, void** pVal);
+int32_t streamStatePutParTag(SStreamState* pState, int64_t groupId, const void* tag, int32_t tagLen);
+int32_t streamStateGetParTag(SStreamState* pState, int64_t groupId, void** tagVal, int32_t* tagLen);
+
#if 0
char* streamStateSessionDump(SStreamState* pState);
#endif
diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c
index c63ddea25d250ca400a3126b7780504ef4b8d887..1dd8117c1e51552528bb756c1a904cc7ac5113b9 100644
--- a/source/client/src/clientTmq.c
+++ b/source/client/src/clientTmq.c
@@ -530,7 +530,6 @@ static int32_t tmqSendCommitReq(tmq_t* tmq, SMqClientVg* pVg, SMqClientTopic* pT
int32_t tmqCommitMsgImpl(tmq_t* tmq, const TAOS_RES* msg, int8_t async, tmq_commit_cb* userCb, void* userParam) {
char* topic;
int32_t vgId;
- ASSERT(msg != NULL);
if (TD_RES_TMQ(msg)) {
SMqRspObj* pRspObj = (SMqRspObj*)msg;
topic = pRspObj->topic;
@@ -809,8 +808,6 @@ int32_t tmqHandleAllDelayedTask(tmq_t* tmq) {
taosTmrReset(tmqAssignDelayedCommitTask, tmq->autoCommitInterval, pRefId, tmqMgmt.timer, &tmq->commitTimer);
} else if (*pTaskType == TMQ_DELAYED_TASK__REPORT) {
- } else {
- ASSERT(0);
}
taosFreeQitem(pTaskType);
}
@@ -953,10 +950,6 @@ tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) {
const char* user = conf->user == NULL ? TSDB_DEFAULT_USER : conf->user;
const char* pass = conf->pass == NULL ? TSDB_DEFAULT_PASS : conf->pass;
- ASSERT(user);
- ASSERT(pass);
- ASSERT(conf->groupId[0]);
-
pTmq->clientTopics = taosArrayInit(0, sizeof(SMqClientTopic));
pTmq->mqueue = taosOpenQueue();
pTmq->qall = taosAllocateQall();
@@ -1247,8 +1240,6 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) {
tDecodeSTaosxRsp(&decoder, &pRspWrapper->taosxRsp);
tDecoderClear(&decoder);
memcpy(&pRspWrapper->taosxRsp, pMsg->pData, sizeof(SMqRspHead));
- } else {
- ASSERT(0);
}
taosMemoryFree(pMsg->pData);
diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c
index 37e2c3522512de3e4b8bb82741df50e09d8c598b..cf2386348ee8486984c0fbe2be1b8ea6b25ea536 100644
--- a/source/dnode/mnode/impl/src/mndConsumer.c
+++ b/source/dnode/mnode/impl/src/mndConsumer.c
@@ -133,7 +133,10 @@ static int32_t mndProcessConsumerRecoverMsg(SRpcMsg *pMsg) {
SMnode *pMnode = pMsg->info.node;
SMqConsumerRecoverMsg *pRecoverMsg = pMsg->pCont;
SMqConsumerObj *pConsumer = mndAcquireConsumer(pMnode, pRecoverMsg->consumerId);
- ASSERT(pConsumer);
+ if (pConsumer == NULL) {
+ mError("cannot find consumer %" PRId64 " when processing consumer recover msg", pRecoverMsg->consumerId);
+ return -1;
+ }
mInfo("receive consumer recover msg, consumer id %" PRId64 ", status %s", pRecoverMsg->consumerId,
mndConsumerStatusName(pConsumer->status));
@@ -381,8 +384,6 @@ static int32_t mndProcessAskEpReq(SRpcMsg *pMsg) {
return -1;
}
- ASSERT(strcmp(req.cgroup, pConsumer->cgroup) == 0);
-
atomic_store_32(&pConsumer->hbStatus, 0);
// 1. check consumer status
@@ -428,9 +429,8 @@ static int32_t mndProcessAskEpReq(SRpcMsg *pMsg) {
for (int32_t i = 0; i < numOfTopics; i++) {
char *topic = taosArrayGetP(pConsumer->currentTopics, i);
SMqSubscribeObj *pSub = mndAcquireSubscribe(pMnode, pConsumer->cgroup, topic);
-
// txn guarantees pSub is created
- ASSERT(pSub);
+
taosRLockLatch(&pSub->lock);
SMqSubTopicEp topicEp = {0};
@@ -438,7 +438,6 @@ static int32_t mndProcessAskEpReq(SRpcMsg *pMsg) {
// 2.1 fetch topic schema
SMqTopicObj *pTopic = mndAcquireTopic(pMnode, topic);
- ASSERT(pTopic);
taosRLockLatch(&pTopic->lock);
tstrncpy(topicEp.db, pTopic->db, TSDB_DB_FNAME_LEN);
topicEp.schema.nCols = pTopic->schema.nCols;
@@ -775,8 +774,8 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer,
taosWLockLatch(&pOldConsumer->lock);
if (pNewConsumer->updateType == CONSUMER_UPDATE__MODIFY) {
- ASSERT(taosArrayGetSize(pOldConsumer->rebNewTopics) == 0);
- ASSERT(taosArrayGetSize(pOldConsumer->rebRemovedTopics) == 0);
+ /*A(taosArrayGetSize(pOldConsumer->rebNewTopics) == 0);*/
+ /*A(taosArrayGetSize(pOldConsumer->rebRemovedTopics) == 0);*/
if (taosArrayGetSize(pNewConsumer->rebNewTopics) == 0 && taosArrayGetSize(pNewConsumer->rebRemovedTopics) == 0) {
pOldConsumer->status = MQ_CONSUMER_STATUS__READY;
@@ -798,8 +797,8 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer,
pOldConsumer->status = MQ_CONSUMER_STATUS__MODIFY;
}
} else if (pNewConsumer->updateType == CONSUMER_UPDATE__LOST) {
- ASSERT(taosArrayGetSize(pOldConsumer->rebNewTopics) == 0);
- ASSERT(taosArrayGetSize(pOldConsumer->rebRemovedTopics) == 0);
+ /*A(taosArrayGetSize(pOldConsumer->rebNewTopics) == 0);*/
+ /*A(taosArrayGetSize(pOldConsumer->rebRemovedTopics) == 0);*/
int32_t sz = taosArrayGetSize(pOldConsumer->currentTopics);
/*pOldConsumer->rebRemovedTopics = taosArrayInit(sz, sizeof(void *));*/
@@ -812,8 +811,8 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer,
pOldConsumer->status = MQ_CONSUMER_STATUS__LOST;
} else if (pNewConsumer->updateType == CONSUMER_UPDATE__RECOVER) {
- ASSERT(taosArrayGetSize(pOldConsumer->currentTopics) == 0);
- ASSERT(taosArrayGetSize(pOldConsumer->rebNewTopics) == 0);
+ /*A(taosArrayGetSize(pOldConsumer->currentTopics) == 0);*/
+ /*A(taosArrayGetSize(pOldConsumer->rebNewTopics) == 0);*/
int32_t sz = taosArrayGetSize(pOldConsumer->assignedTopics);
for (int32_t i = 0; i < sz; i++) {
@@ -830,15 +829,15 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer,
pOldConsumer->rebalanceTime = pNewConsumer->upTime;
} else if (pNewConsumer->updateType == CONSUMER_UPDATE__ADD) {
- ASSERT(taosArrayGetSize(pNewConsumer->rebNewTopics) == 1);
- ASSERT(taosArrayGetSize(pNewConsumer->rebRemovedTopics) == 0);
+ /*A(taosArrayGetSize(pNewConsumer->rebNewTopics) == 1);*/
+ /*A(taosArrayGetSize(pNewConsumer->rebRemovedTopics) == 0);*/
char *addedTopic = strdup(taosArrayGetP(pNewConsumer->rebNewTopics, 0));
// not exist in current topic
-#if 1
+#if 0
for (int32_t i = 0; i < taosArrayGetSize(pOldConsumer->currentTopics); i++) {
char *topic = taosArrayGetP(pOldConsumer->currentTopics, i);
- ASSERT(strcmp(topic, addedTopic) != 0);
+ A(strcmp(topic, addedTopic) != 0);
}
#endif
@@ -879,15 +878,15 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer,
atomic_add_fetch_32(&pOldConsumer->epoch, 1);
} else if (pNewConsumer->updateType == CONSUMER_UPDATE__REMOVE) {
- ASSERT(taosArrayGetSize(pNewConsumer->rebNewTopics) == 0);
- ASSERT(taosArrayGetSize(pNewConsumer->rebRemovedTopics) == 1);
+ /*A(taosArrayGetSize(pNewConsumer->rebNewTopics) == 0);*/
+ /*A(taosArrayGetSize(pNewConsumer->rebRemovedTopics) == 1);*/
char *removedTopic = taosArrayGetP(pNewConsumer->rebRemovedTopics, 0);
// not exist in new topic
-#if 1
+#if 0
for (int32_t i = 0; i < taosArrayGetSize(pOldConsumer->rebNewTopics); i++) {
char *topic = taosArrayGetP(pOldConsumer->rebNewTopics, i);
- ASSERT(strcmp(topic, removedTopic) != 0);
+ A(strcmp(topic, removedTopic) != 0);
}
#endif
@@ -913,7 +912,7 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer,
}
}
// must find the topic
- ASSERT(i < sz);
+ /*A(i < sz);*/
// set status
if (taosArrayGetSize(pOldConsumer->rebNewTopics) == 0 && taosArrayGetSize(pOldConsumer->rebRemovedTopics) == 0) {
diff --git a/source/dnode/mnode/impl/src/mndScheduler.c b/source/dnode/mnode/impl/src/mndScheduler.c
index af1a29def08eae42072fffc889cd494a95dea239..bdef8000bd3b54d3428b0dc6336d5e5ad66893e6 100644
--- a/source/dnode/mnode/impl/src/mndScheduler.c
+++ b/source/dnode/mnode/impl/src/mndScheduler.c
@@ -115,13 +115,11 @@ int32_t mndAddDispatcherToInnerTask(SMnode* pMnode, SStreamObj* pStream, SStream
if (pStream->fixedSinkVgId == 0) {
SDbObj* pDb = mndAcquireDb(pMnode, pStream->targetDb);
- ASSERT(pDb);
if (pDb->cfg.numOfVgroups > 1) {
isShuffle = true;
pTask->outputType = TASK_OUTPUT__SHUFFLE_DISPATCH;
pTask->dispatchMsgType = TDMT_STREAM_TASK_DISPATCH;
if (mndExtractDbInfo(pMnode, pDb, &pTask->shuffleDispatcher.dbInfo, NULL) < 0) {
- ASSERT(0);
return -1;
}
}
@@ -140,9 +138,7 @@ int32_t mndAddDispatcherToInnerTask(SMnode* pMnode, SStreamObj* pStream, SStream
for (int32_t j = 0; j < sinkLvSize; j++) {
SStreamTask* pLastLevelTask = taosArrayGetP(sinkLv, j);
if (pLastLevelTask->nodeId == pVgInfo->vgId) {
- ASSERT(pVgInfo->vgId > 0);
pVgInfo->taskId = pLastLevelTask->taskId;
- ASSERT(pVgInfo->taskId != 0);
break;
}
}
@@ -152,7 +148,6 @@ int32_t mndAddDispatcherToInnerTask(SMnode* pMnode, SStreamObj* pStream, SStream
pTask->dispatchMsgType = TDMT_STREAM_TASK_DISPATCH;
SArray* pArray = taosArrayGetP(pStream->tasks, 0);
// one sink only
- ASSERT(taosArrayGetSize(pArray) == 1);
SStreamTask* lastLevelTask = taosArrayGetP(pArray, 0);
pTask->fixedEpDispatcher.taskId = lastLevelTask->taskId;
pTask->fixedEpDispatcher.nodeId = lastLevelTask->nodeId;
@@ -170,7 +165,6 @@ int32_t mndAssignTaskToVg(SMnode* pMnode, SStreamTask* pTask, SSubplan* plan, co
plan->execNode.epSet = pTask->epSet;
if (qSubPlanToString(plan, &pTask->exec.qmsg, &msgLen) < 0) {
- ASSERT(0);
terrno = TSDB_CODE_QRY_INVALID_INPUT;
return -1;
}
@@ -195,7 +189,6 @@ int32_t mndAssignTaskToSnode(SMnode* pMnode, SStreamTask* pTask, SSubplan* plan,
plan->execNode.epSet = pTask->epSet;
if (qSubPlanToString(plan, &pTask->exec.qmsg, &msgLen) < 0) {
- ASSERT(0);
terrno = TSDB_CODE_QRY_INVALID_INPUT;
return -1;
}
@@ -222,8 +215,6 @@ int32_t mndAddShuffleSinkTasksToStream(SMnode* pMnode, SStreamObj* pStream) {
void* pIter = NULL;
SArray* tasks = taosArrayGetP(pStream->tasks, 0);
- ASSERT(taosArrayGetSize(pStream->tasks) == 1);
-
while (1) {
SVgObj* pVgroup = NULL;
pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void**)&pVgroup);
@@ -257,7 +248,10 @@ int32_t mndAddShuffleSinkTasksToStream(SMnode* pMnode, SStreamObj* pStream) {
pTask->tbSink.stbUid = pStream->targetStbUid;
memcpy(pTask->tbSink.stbFullName, pStream->targetSTbName, TSDB_TABLE_FNAME_LEN);
pTask->tbSink.pSchemaWrapper = tCloneSSchemaWrapper(&pStream->outputSchema);
- ASSERT(pTask->tbSink.pSchemaWrapper);
+ if (pTask->tbSink.pSchemaWrapper == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return -1;
+ }
}
sdbRelease(pSdb, pVgroup);
}
@@ -265,7 +259,6 @@ int32_t mndAddShuffleSinkTasksToStream(SMnode* pMnode, SStreamObj* pStream) {
}
int32_t mndAddFixedSinkTaskToStream(SMnode* pMnode, SStreamObj* pStream) {
- ASSERT(pStream->fixedSinkVgId != 0);
SArray* tasks = taosArrayGetP(pStream->tasks, 0);
SStreamTask* pTask = tNewSStreamTask(pStream->uid);
if (pTask == NULL) {
@@ -275,8 +268,6 @@ int32_t mndAddFixedSinkTaskToStream(SMnode* pMnode, SStreamObj* pStream) {
pTask->fillHistory = pStream->fillHistory;
mndAddTaskToTaskSet(tasks, pTask);
- ASSERT(pStream->fixedSinkVg.vgId == pStream->fixedSinkVgId);
-
pTask->nodeId = pStream->fixedSinkVgId;
#if 0
SVgObj* pVgroup = mndAcquireVgroup(pMnode, pStream->fixedSinkVgId);
@@ -311,13 +302,16 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) {
return -1;
}
int32_t planTotLevel = LIST_LENGTH(pPlan->pSubplans);
- ASSERT(planTotLevel <= 2);
+
pStream->tasks = taosArrayInit(planTotLevel, sizeof(void*));
bool hasExtraSink = false;
bool externalTargetDB = strcmp(pStream->sourceDb, pStream->targetDb) != 0;
SDbObj* pDbObj = mndAcquireDb(pMnode, pStream->targetDb);
- ASSERT(pDbObj != NULL);
+ if (pDbObj == NULL) {
+ terrno = TSDB_CODE_QRY_INVALID_INPUT;
+ return -1;
+ }
bool multiTarget = pDbObj->cfg.numOfVgroups > 1;
sdbRelease(pSdb, pDbObj);
@@ -351,7 +345,10 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) {
SNodeListNode* inner = (SNodeListNode*)nodesListGetNode(pPlan->pSubplans, 0);
SSubplan* plan = (SSubplan*)nodesListGetNode(inner->pNodeList, 0);
- ASSERT(plan->subplanType == SUBPLAN_TYPE_MERGE);
+ if (plan->subplanType != SUBPLAN_TYPE_MERGE) {
+ terrno = TSDB_CODE_QRY_INVALID_INPUT;
+ return -1;
+ }
pInnerTask = tNewSStreamTask(pStream->uid);
if (pInnerTask == NULL) {
@@ -409,7 +406,10 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) {
SNodeListNode* inner = (SNodeListNode*)nodesListGetNode(pPlan->pSubplans, 1);
SSubplan* plan = (SSubplan*)nodesListGetNode(inner->pNodeList, 0);
- ASSERT(plan->subplanType == SUBPLAN_TYPE_SCAN);
+ if (plan->subplanType != SUBPLAN_TYPE_SCAN) {
+ terrno = TSDB_CODE_QRY_INVALID_INPUT;
+ return -1;
+ }
void* pIter = NULL;
while (1) {
@@ -471,9 +471,15 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) {
taosArrayPush(pStream->tasks, &taskOneLevel);
SNodeListNode* inner = (SNodeListNode*)nodesListGetNode(pPlan->pSubplans, 0);
- ASSERT(LIST_LENGTH(inner->pNodeList) == 1);
+ if (LIST_LENGTH(inner->pNodeList) != 1) {
+ terrno = TSDB_CODE_QRY_INVALID_INPUT;
+ return -1;
+ }
SSubplan* plan = (SSubplan*)nodesListGetNode(inner->pNodeList, 0);
- ASSERT(plan->subplanType == SUBPLAN_TYPE_SCAN);
+ if (plan->subplanType != SUBPLAN_TYPE_SCAN) {
+ terrno = TSDB_CODE_QRY_INVALID_INPUT;
+ return -1;
+ }
void* pIter = NULL;
while (1) {
@@ -550,9 +556,6 @@ int32_t mndSchedInitSubEp(SMnode* pMnode, const SMqTopicObj* pTopic, SMqSubscrib
plan = (SSubplan*)nodesListGetNode(inner->pNodeList, 0);
}
- ASSERT(pSub->unassignedVgs);
- ASSERT(taosHashGetSize(pSub->consumerHash) == 0);
-
void* pIter = NULL;
while (1) {
pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void**)&pVgroup);
@@ -590,10 +593,6 @@ int32_t mndSchedInitSubEp(SMnode* pMnode, const SMqTopicObj* pTopic, SMqSubscrib
sdbRelease(pSdb, pVgroup);
}
- ASSERT(pSub->unassignedVgs->size > 0);
-
- ASSERT(taosHashGetSize(pSub->consumerHash) == 0);
-
qDestroyQueryPlan(pPlan);
return 0;
diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c
index 05c05943397ec42daa1d6e35baab6c19b7d2f940..10ecd5628083282d8dfdad9e21eb8452644e185f 100644
--- a/source/dnode/mnode/impl/src/mndStream.c
+++ b/source/dnode/mnode/impl/src/mndStream.c
@@ -326,13 +326,11 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj,
// deserialize ast
if (nodesStringToNode(pObj->ast, &pAst) < 0) {
- /*ASSERT(0);*/
goto FAIL;
}
// extract output schema from ast
if (qExtractResultSchema(pAst, (int32_t *)&pObj->outputSchema.nCols, &pObj->outputSchema.pSchema) != 0) {
- /*ASSERT(0);*/
goto FAIL;
}
@@ -347,13 +345,11 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj,
// using ast and param to build physical plan
if (qCreateQueryPlan(&cxt, &pPlan, NULL) < 0) {
- /*ASSERT(0);*/
goto FAIL;
}
// save physcial plan
if (nodesNodeToString((SNode *)pPlan, false, &pObj->physicalPlan, NULL) != 0) {
- /*ASSERT(0);*/
goto FAIL;
}
@@ -361,7 +357,7 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj,
if (pCreate->numOfTags) {
pObj->tagSchema.pSchema = taosMemoryCalloc(pCreate->numOfTags, sizeof(SSchema));
}
- ASSERT(pCreate->numOfTags == taosArrayGetSize(pCreate->pTags));
+ /*A(pCreate->numOfTags == taosArrayGetSize(pCreate->pTags));*/
for (int32_t i = 0; i < pCreate->numOfTags; i++) {
SField *pField = taosArrayGet(pCreate->pTags, i);
pObj->tagSchema.pSchema[i].colId = pObj->outputSchema.nCols + i + 1;
@@ -378,9 +374,6 @@ FAIL:
}
int32_t mndPersistTaskDeployReq(STrans *pTrans, const SStreamTask *pTask) {
- if (pTask->taskLevel == TASK_LEVEL__AGG) {
- ASSERT(taosArrayGetSize(pTask->childEpInfo) != 0);
- }
SEncoder encoder;
tEncoderInit(&encoder, NULL, 0);
tEncodeSStreamTask(&encoder, pTask);
@@ -545,8 +538,6 @@ _OVER:
}
static int32_t mndPersistTaskDropReq(STrans *pTrans, SStreamTask *pTask) {
- ASSERT(pTask->nodeId != 0);
-
// vnode
/*if (pTask->nodeId > 0) {*/
SVDropStreamTaskReq *pReq = taosMemoryCalloc(1, sizeof(SVDropStreamTaskReq));
@@ -800,10 +791,9 @@ static int32_t mndProcessStreamDoCheckpoint(SRpcMsg *pReq) {
int32_t sz = taosArrayGetSize(pLevel);
for (int32_t j = 0; j < sz; j++) {
SStreamTask *pTask = taosArrayGetP(pLevel, j);
- ASSERT(pTask->nodeId > 0);
+ /*A(pTask->nodeId > 0);*/
SVgObj *pVgObj = mndAcquireVgroup(pMnode, pTask->nodeId);
if (pVgObj == NULL) {
- ASSERT(0);
taosRUnLockLatch(&pStream->lock);
mndReleaseStream(pMnode, pStream);
mndTransDrop(pTrans);
@@ -863,7 +853,6 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) {
SMDropStreamReq dropReq = {0};
if (tDeserializeSMDropStreamReq(pReq->pCont, pReq->contLen, &dropReq) < 0) {
- ASSERT(0);
terrno = TSDB_CODE_INVALID_MSG;
return -1;
}
diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c
index 4a941b3c2027003d0465910d884c3d1222ca58a3..222339d3879b507f63883502b64949a26e1e1953 100644
--- a/source/dnode/vnode/src/tq/tq.c
+++ b/source/dnode/vnode/src/tq/tq.c
@@ -92,21 +92,21 @@ STQ* tqOpen(const char* path, SVnode* pVnode) {
taosHashSetFreeFp(pTq->pCheckInfo, (FDelete)tDeleteSTqCheckInfo);
if (tqMetaOpen(pTq) < 0) {
- ASSERT(0);
+ return NULL;
}
pTq->pOffsetStore = tqOffsetOpen(pTq);
if (pTq->pOffsetStore == NULL) {
- ASSERT(0);
+ return NULL;
}
pTq->pStreamMeta = streamMetaOpen(path, pTq, (FTaskExpand*)tqExpandTask, pTq->pVnode->config.vgId);
if (pTq->pStreamMeta == NULL) {
- ASSERT(0);
+ return NULL;
}
if (streamLoadTasks(pTq->pStreamMeta) < 0) {
- ASSERT(0);
+ return NULL;
}
return pTq;
@@ -166,19 +166,17 @@ int32_t tqSendMetaPollRsp(STQ* pTq, const SRpcMsg* pMsg, const SMqPollReq* pReq,
int32_t tqPushDataRsp(STQ* pTq, STqPushEntry* pPushEntry) {
SMqDataRsp* pRsp = &pPushEntry->dataRsp;
- ASSERT(taosArrayGetSize(pRsp->blockData) == pRsp->blockNum);
- ASSERT(taosArrayGetSize(pRsp->blockDataLen) == pRsp->blockNum);
+#if 0
+ A(taosArrayGetSize(pRsp->blockData) == pRsp->blockNum);
+ A(taosArrayGetSize(pRsp->blockDataLen) == pRsp->blockNum);
- ASSERT(!pRsp->withSchema);
- ASSERT(taosArrayGetSize(pRsp->blockSchema) == 0);
+ A(!pRsp->withSchema);
+ A(taosArrayGetSize(pRsp->blockSchema) == 0);
if (pRsp->reqOffset.type == TMQ_OFFSET__LOG) {
- /*if (pRsp->blockNum > 0) {*/
- /*ASSERT(pRsp->rspOffset.version > pRsp->reqOffset.version);*/
- /*} else {*/
- ASSERT(pRsp->rspOffset.version > pRsp->reqOffset.version);
- /*}*/
+ A(pRsp->rspOffset.version > pRsp->reqOffset.version);
}
+#endif
int32_t len = 0;
int32_t code = 0;
@@ -223,19 +221,21 @@ int32_t tqPushDataRsp(STQ* pTq, STqPushEntry* pPushEntry) {
}
int32_t tqSendDataRsp(STQ* pTq, const SRpcMsg* pMsg, const SMqPollReq* pReq, const SMqDataRsp* pRsp) {
- ASSERT(taosArrayGetSize(pRsp->blockData) == pRsp->blockNum);
- ASSERT(taosArrayGetSize(pRsp->blockDataLen) == pRsp->blockNum);
+#if 0
+ A(taosArrayGetSize(pRsp->blockData) == pRsp->blockNum);
+ A(taosArrayGetSize(pRsp->blockDataLen) == pRsp->blockNum);
- ASSERT(!pRsp->withSchema);
- ASSERT(taosArrayGetSize(pRsp->blockSchema) == 0);
+ A(!pRsp->withSchema);
+ A(taosArrayGetSize(pRsp->blockSchema) == 0);
if (pRsp->reqOffset.type == TMQ_OFFSET__LOG) {
if (pRsp->blockNum > 0) {
- ASSERT(pRsp->rspOffset.version > pRsp->reqOffset.version);
+ A(pRsp->rspOffset.version > pRsp->reqOffset.version);
} else {
- ASSERT(pRsp->rspOffset.version >= pRsp->reqOffset.version);
+ A(pRsp->rspOffset.version >= pRsp->reqOffset.version);
}
}
+#endif
int32_t len = 0;
int32_t code = 0;
@@ -279,22 +279,24 @@ int32_t tqSendDataRsp(STQ* pTq, const SRpcMsg* pMsg, const SMqPollReq* pReq, con
}
int32_t tqSendTaosxRsp(STQ* pTq, const SRpcMsg* pMsg, const SMqPollReq* pReq, const STaosxRsp* pRsp) {
- ASSERT(taosArrayGetSize(pRsp->blockData) == pRsp->blockNum);
- ASSERT(taosArrayGetSize(pRsp->blockDataLen) == pRsp->blockNum);
+#if 0
+ A(taosArrayGetSize(pRsp->blockData) == pRsp->blockNum);
+ A(taosArrayGetSize(pRsp->blockDataLen) == pRsp->blockNum);
if (pRsp->withSchema) {
- ASSERT(taosArrayGetSize(pRsp->blockSchema) == pRsp->blockNum);
+ A(taosArrayGetSize(pRsp->blockSchema) == pRsp->blockNum);
} else {
- ASSERT(taosArrayGetSize(pRsp->blockSchema) == 0);
+ A(taosArrayGetSize(pRsp->blockSchema) == 0);
}
if (pRsp->reqOffset.type == TMQ_OFFSET__LOG) {
if (pRsp->blockNum > 0) {
- ASSERT(pRsp->rspOffset.version > pRsp->reqOffset.version);
+ A(pRsp->rspOffset.version > pRsp->reqOffset.version);
} else {
- ASSERT(pRsp->rspOffset.version >= pRsp->reqOffset.version);
+ A(pRsp->rspOffset.version >= pRsp->reqOffset.version);
}
}
+#endif
int32_t len = 0;
int32_t code = 0;
@@ -348,7 +350,6 @@ int32_t tqProcessOffsetCommitReq(STQ* pTq, int64_t version, char* msg, int32_t m
SDecoder decoder;
tDecoderInit(&decoder, msg, msgLen);
if (tDecodeSTqOffset(&decoder, &offset) < 0) {
- ASSERT(0);
return -1;
}
tDecoderClear(&decoder);
@@ -362,8 +363,8 @@ int32_t tqProcessOffsetCommitReq(STQ* pTq, int64_t version, char* msg, int32_t m
if (offset.val.version + 1 == version) {
offset.val.version += 1;
}
- } else {
- ASSERT(0);
+ /*} else {*/
+ /*A(0);*/
}
STqOffset* pOffset = tqOffsetRead(pTq->pOffsetStore, offset.subKey);
if (pOffset != NULL && tqOffsetLessOrEqual(&offset, pOffset)) {
@@ -371,7 +372,6 @@ int32_t tqProcessOffsetCommitReq(STQ* pTq, int64_t version, char* msg, int32_t m
}
if (tqOffsetWrite(pTq->pOffsetStore, &offset) < 0) {
- ASSERT(0);
return -1;
}
@@ -434,7 +434,7 @@ static int32_t tqInitDataRsp(SMqDataRsp* pRsp, const SMqPollReq* pReq, int8_t su
}
#endif
- ASSERT(subType == TOPIC_SUB_TYPE__COLUMN);
+ /*A(subType == TOPIC_SUB_TYPE__COLUMN);*/
pRsp->withSchema = false;
return 0;
@@ -473,7 +473,6 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
// 1.find handle
STqHandle* pHandle = taosHashGet(pTq->pHandle, req.subKey, strlen(req.subKey));
- /*ASSERT(pHandle);*/
if (pHandle == NULL) {
tqError("tmq poll: no consumer handle for consumer:%" PRId64 ", in vgId:%d, subkey %s", consumerId,
TD_VID(pTq->pVnode), req.subKey);
@@ -560,7 +559,9 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
tqInitDataRsp(&dataRsp, &req, pHandle->execHandle.subType);
// lock
taosWLockLatch(&pTq->pushLock);
- tqScanData(pTq, pHandle, &dataRsp, &fetchOffsetNew);
+ if (tqScanData(pTq, pHandle, &dataRsp, &fetchOffsetNew) < 0) {
+ return -1;
+ }
#if 1
if (dataRsp.blockNum == 0 && dataRsp.reqOffset.type == TMQ_OFFSET__LOG &&
@@ -599,7 +600,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
}
// for taosx
- ASSERT(pHandle->execHandle.subType != TOPIC_SUB_TYPE__COLUMN);
+ /*A(pHandle->execHandle.subType != TOPIC_SUB_TYPE__COLUMN);*/
SMqMetaRsp metaRsp = {0};
@@ -607,7 +608,9 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
tqInitTaosxRsp(&taosxRsp, &req);
if (fetchOffsetNew.type != TMQ_OFFSET__LOG) {
- tqScanTaosx(pTq, pHandle, &taosxRsp, &metaRsp, &fetchOffsetNew);
+ if (tqScanTaosx(pTq, pHandle, &taosxRsp, &metaRsp, &fetchOffsetNew) < 0) {
+ return -1;
+ }
if (metaRsp.metaRspLen > 0) {
if (tqSendMetaPollRsp(pTq, pMsg, &req, &metaRsp) < 0) {
@@ -690,8 +693,8 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
}
} else {
- ASSERT(pHandle->fetchMeta);
- ASSERT(IS_META_MSG(pHead->msgType));
+ /*A(pHandle->fetchMeta);*/
+ /*A(IS_META_MSG(pHead->msgType));*/
tqDebug("fetch meta msg, ver:%" PRId64 ", type:%d", pHead->version, pHead->msgType);
tqOffsetResetToLog(&metaRsp.rspOffset, fetchVer);
metaRsp.resMsgType = pHead->msgType;
@@ -808,7 +811,6 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL
// TODO version should be assigned and refed during preprocess
SWalRef* pRef = walRefCommittedVer(pTq->pVnode->pWal);
if (pRef == NULL) {
- ASSERT(0);
return -1;
}
int64_t ver = pRef->refVer;
@@ -829,12 +831,12 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL
pHandle->execHandle.task =
qCreateQueueExecTaskInfo(pHandle->execHandle.execCol.qmsg, &handle, &pHandle->execHandle.numOfCols, NULL);
- ASSERT(pHandle->execHandle.task);
+ /*A(pHandle->execHandle.task);*/
void* scanner = NULL;
qExtractStreamScanner(pHandle->execHandle.task, &scanner);
- ASSERT(scanner);
+ /*A(scanner);*/
pHandle->execHandle.pExecReader = qExtractReaderFromStreamScanner(scanner);
- ASSERT(pHandle->execHandle.pExecReader);
+ /*A(pHandle->execHandle.pExecReader);*/
} else if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__DB) {
pHandle->pWalReader = walOpenReader(pTq->pVnode->pWal, NULL);
pHandle->execHandle.pExecReader = tqOpenReader(pTq->pVnode);
@@ -867,19 +869,14 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL
taosHashPut(pTq->pHandle, req.subKey, strlen(req.subKey), pHandle, sizeof(STqHandle));
tqDebug("try to persist handle %s consumer %" PRId64, req.subKey, pHandle->consumerId);
if (tqMetaSaveHandle(pTq, req.subKey, pHandle) < 0) {
- // TODO
- ASSERT(0);
}
} else {
- /*ASSERT(pExec->consumerId == req.oldConsumerId);*/
// TODO handle qmsg and exec modification
atomic_store_32(&pHandle->epoch, -1);
atomic_store_64(&pHandle->consumerId, req.newConsumerId);
atomic_add_fetch_32(&pHandle->epoch, 1);
taosMemoryFree(req.qmsg);
if (tqMetaSaveHandle(pTq, req.subKey, pHandle) < 0) {
- // TODO
- ASSERT(0);
}
// close handle
}
@@ -888,9 +885,11 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL
}
int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) {
+#if 0
if (pTask->taskLevel == TASK_LEVEL__AGG) {
- ASSERT(taosArrayGetSize(pTask->childEpInfo) != 0);
+ A(taosArrayGetSize(pTask->childEpInfo) != 0);
}
+#endif
pTask->refCnt = 1;
pTask->schedStatus = TASK_SCHED_STATUS__INACTIVE;
@@ -927,7 +926,9 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) {
.pStateBackend = pTask->pState,
};
pTask->exec.executor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, &handle);
- ASSERT(pTask->exec.executor);
+ if (pTask->exec.executor == NULL) {
+ return -1;
+ }
} else if (pTask->taskLevel == TASK_LEVEL__AGG) {
pTask->pState = streamStateOpen(pTq->pStreamMeta->path, pTask, false, -1, -1);
@@ -940,7 +941,9 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) {
.pStateBackend = pTask->pState,
};
pTask->exec.executor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, &mgHandle);
- ASSERT(pTask->exec.executor);
+ if (pTask->exec.executor == NULL) {
+ return -1;
+ }
}
// sink
@@ -952,12 +955,12 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) {
pTask->tbSink.vnode = pTq->pVnode;
pTask->tbSink.tbSinkFunc = tqSinkToTablePipeline;
- ASSERT(pTask->tbSink.pSchemaWrapper);
- ASSERT(pTask->tbSink.pSchemaWrapper->pSchema);
+ /*A(pTask->tbSink.pSchemaWrapper);*/
+ /*A(pTask->tbSink.pSchemaWrapper->pSchema);*/
pTask->tbSink.pTSchema =
tdGetSTSChemaFromSSChema(pTask->tbSink.pSchemaWrapper->pSchema, pTask->tbSink.pSchemaWrapper->nCols, 1);
- ASSERT(pTask->tbSink.pTSchema);
+ /*A(pTask->tbSink.pTSchema);*/
}
streamSetupTrigger(pTask);
@@ -1003,7 +1006,8 @@ int32_t tqProcessStreamTaskCheckReq(STQ* pTq, SRpcMsg* pMsg) {
int32_t len;
tEncodeSize(tEncodeSStreamTaskCheckRsp, &rsp, len, code);
if (code < 0) {
- ASSERT(0);
+ tqError("unable to encode rsp %d", __LINE__);
+ return -1;
}
void* buf = rpcMallocCont(sizeof(SMsgHead) + len);
((SMsgHead*)buf)->vgId = htonl(req.upstreamNodeId);
@@ -1096,12 +1100,10 @@ int32_t tqProcessTaskRecover1Req(STQ* pTq, SRpcMsg* pMsg) {
if (pTask == NULL) {
return -1;
}
- ASSERT(pReq->taskId == pTask->taskId);
// check param
int64_t fillVer1 = pTask->startVer;
if (fillVer1 <= 0) {
- ASSERT(0);
streamMetaReleaseTask(pTq->pStreamMeta, pTask);
return -1;
}
@@ -1296,7 +1298,7 @@ int32_t tqProcessDelReq(STQ* pTq, void* pReq, int32_t len, int64_t ver) {
}
int32_t ref = atomic_sub_fetch_32(pRef, 1);
- ASSERT(ref >= 0);
+ /*A(ref >= 0);*/
if (ref == 0) {
blockDataDestroy(pDelBlock);
taosMemoryFree(pRef);
diff --git a/source/dnode/vnode/src/tq/tqExec.c b/source/dnode/vnode/src/tq/tqExec.c
index 093186ebbb188841bf0fa012be4dd59f8d0b5a1b..426fceb7ede9e22841931ba5a9581fe66986e7ea 100644
--- a/source/dnode/vnode/src/tq/tqExec.c
+++ b/source/dnode/vnode/src/tq/tqExec.c
@@ -29,7 +29,6 @@ int32_t tqAddBlockDataToRsp(const SSDataBlock* pBlock, SMqDataRsp* pRsp, int32_t
int32_t actualLen = blockEncode(pBlock, pRetrieve->data, numOfCols);
actualLen += sizeof(SRetrieveTableRsp);
- ASSERT(actualLen <= dataStrLen);
taosArrayPush(pRsp->blockDataLen, &actualLen);
taosArrayPush(pRsp->blockData, &buf);
return 0;
@@ -62,7 +61,6 @@ static int32_t tqAddTbNameToRsp(const STQ* pTq, int64_t uid, SMqDataRsp* pRsp, i
int32_t tqScanData(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffsetVal* pOffset) {
const STqExecHandle* pExec = &pHandle->execHandle;
- ASSERT(pExec->subType == TOPIC_SUB_TYPE__COLUMN);
qTaskInfo_t task = pExec->task;
@@ -87,7 +85,8 @@ int32_t tqScanData(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffs
uint64_t ts = 0;
tqDebug("vgId:%d, tmq task start to execute", pTq->pVnode->config.vgId);
if (qExecTask(task, &pDataBlock, &ts) < 0) {
- ASSERT(0);
+ tqError("vgId:%d task exec error since %s", pTq->pVnode->config.vgId, terrstr());
+ return -1;
}
tqDebug("vgId:%d, tmq task executed, get %p", pTq->pVnode->config.vgId, pDataBlock);
@@ -105,10 +104,14 @@ int32_t tqScanData(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffs
}
if (qStreamExtractOffset(task, &pRsp->rspOffset) < 0) {
- ASSERT(0);
return -1;
}
- ASSERT(pRsp->rspOffset.type != 0);
+
+ if (pRsp->rspOffset.type == 0) {
+ tqError("expected rsp offset: type %d %" PRId64 " %" PRId64 " %" PRId64, pRsp->rspOffset.type, pRsp->rspOffset.ts,
+ pRsp->rspOffset.uid, pRsp->rspOffset.version);
+ return -1;
+ }
if (pRsp->withTbName) {
if (pRsp->rspOffset.type == TMQ_OFFSET__LOG) {
@@ -118,7 +121,6 @@ int32_t tqScanData(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffs
pRsp->withTbName = false;
}
}
- ASSERT(pRsp->withSchema == false);
return 0;
}
@@ -148,7 +150,8 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMeta
uint64_t ts = 0;
tqDebug("tmqsnap task start to execute");
if (qExecTask(task, &pDataBlock, &ts) < 0) {
- ASSERT(0);
+ tqError("vgId:%d task exec error since %s", pTq->pVnode->config.vgId, terrstr());
+ return -1;
}
tqDebug("tmqsnap task execute end, get %p", pDataBlock);
@@ -215,17 +218,20 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMeta
break;
}
- if (qStreamExtractOffset(task, &pRsp->rspOffset) < 0) {
- ASSERT(0);
+ qStreamExtractOffset(task, &pRsp->rspOffset);
+
+ if (pRsp->rspOffset.type == 0) {
+ tqError("expected rsp offset: type %d %" PRId64 " %" PRId64 " %" PRId64, pRsp->rspOffset.type, pRsp->rspOffset.ts,
+ pRsp->rspOffset.uid, pRsp->rspOffset.version);
+ return -1;
}
- ASSERT(pRsp->rspOffset.type != 0);
return 0;
}
int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SSubmitReq* pReq, STaosxRsp* pRsp) {
STqExecHandle* pExec = &pHandle->execHandle;
- ASSERT(pExec->subType != TOPIC_SUB_TYPE__COLUMN);
+ /*A(pExec->subType != TOPIC_SUB_TYPE__COLUMN);*/
SArray* pBlocks = taosArrayInit(0, sizeof(SSDataBlock));
SArray* pSchemas = taosArrayInit(0, sizeof(void*));
diff --git a/source/dnode/vnode/src/tq/tqMeta.c b/source/dnode/vnode/src/tq/tqMeta.c
index f476f58b565943f5cdd1e8c99233e37a9f1fdf24..05ed8d734854415fefdd8aa6b830edbdf007793b 100644
--- a/source/dnode/vnode/src/tq/tqMeta.c
+++ b/source/dnode/vnode/src/tq/tqMeta.c
@@ -71,17 +71,14 @@ int32_t tDecodeSTqHandle(SDecoder* pDecoder, STqHandle* pHandle) {
int32_t tqMetaOpen(STQ* pTq) {
if (tdbOpen(pTq->path, 16 * 1024, 1, &pTq->pMetaDB, 0) < 0) {
- ASSERT(0);
return -1;
}
if (tdbTbOpen("tq.db", -1, -1, NULL, pTq->pMetaDB, &pTq->pExecStore, 0) < 0) {
- ASSERT(0);
return -1;
}
if (tdbTbOpen("tq.check.db", -1, -1, NULL, pTq->pMetaDB, &pTq->pCheckStore, 0) < 0) {
- ASSERT(0);
return -1;
}
@@ -135,19 +132,19 @@ int32_t tqMetaDeleteCheckInfo(STQ* pTq, const char* key) {
if (tdbBegin(pTq->pMetaDB, &txn, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) <
0) {
- ASSERT(0);
+ return -1;
}
if (tdbTbDelete(pTq->pCheckStore, key, (int)strlen(key), txn) < 0) {
- /*ASSERT(0);*/
+ tqWarn("vgId:%d, tq try delete checkinfo failed %s", pTq->pVnode->config.vgId, key);
}
if (tdbCommit(pTq->pMetaDB, txn) < 0) {
- ASSERT(0);
+ return -1;
}
if (tdbPostCommit(pTq->pMetaDB, txn) < 0) {
- ASSERT(0);
+ return -1;
}
return 0;
@@ -156,7 +153,6 @@ int32_t tqMetaDeleteCheckInfo(STQ* pTq, const char* key) {
int32_t tqMetaRestoreCheckInfo(STQ* pTq) {
TBC* pCur = NULL;
if (tdbTbcOpen(pTq->pCheckStore, &pCur, NULL) < 0) {
- ASSERT(0);
return -1;
}
@@ -197,40 +193,42 @@ int32_t tqMetaSaveHandle(STQ* pTq, const char* key, const STqHandle* pHandle) {
int32_t code;
int32_t vlen;
tEncodeSize(tEncodeSTqHandle, pHandle, vlen, code);
- ASSERT(code == 0);
+ if (code < 0) {
+ return -1;
+ }
tqDebug("tq save %s(%d) consumer %" PRId64 " vgId:%d", pHandle->subKey, (int32_t)strlen(pHandle->subKey),
pHandle->consumerId, TD_VID(pTq->pVnode));
void* buf = taosMemoryCalloc(1, vlen);
if (buf == NULL) {
- ASSERT(0);
+ return -1;
}
SEncoder encoder;
tEncoderInit(&encoder, buf, vlen);
if (tEncodeSTqHandle(&encoder, pHandle) < 0) {
- ASSERT(0);
+ return -1;
}
TXN* txn;
if (tdbBegin(pTq->pMetaDB, &txn, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) <
0) {
- ASSERT(0);
+ return -1;
}
if (tdbTbUpsert(pTq->pExecStore, key, (int)strlen(key), buf, vlen, txn) < 0) {
- ASSERT(0);
+ return -1;
}
if (tdbCommit(pTq->pMetaDB, txn) < 0) {
- ASSERT(0);
+ return -1;
}
if (tdbPostCommit(pTq->pMetaDB, txn) < 0) {
- ASSERT(0);
+ return -1;
}
tEncoderClear(&encoder);
@@ -243,19 +241,18 @@ int32_t tqMetaDeleteHandle(STQ* pTq, const char* key) {
if (tdbBegin(pTq->pMetaDB, &txn, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) <
0) {
- ASSERT(0);
+ return -1;
}
if (tdbTbDelete(pTq->pExecStore, key, (int)strlen(key), txn) < 0) {
- /*ASSERT(0);*/
}
if (tdbCommit(pTq->pMetaDB, txn) < 0) {
- ASSERT(0);
+ return -1;
}
if (tdbPostCommit(pTq->pMetaDB, txn) < 0) {
- ASSERT(0);
+ return -1;
}
return 0;
@@ -264,7 +261,6 @@ int32_t tqMetaDeleteHandle(STQ* pTq, const char* key) {
int32_t tqMetaRestoreHandle(STQ* pTq) {
TBC* pCur = NULL;
if (tdbTbcOpen(pTq->pExecStore, &pCur, NULL) < 0) {
- ASSERT(0);
return -1;
}
@@ -284,7 +280,6 @@ int32_t tqMetaRestoreHandle(STQ* pTq) {
handle.pRef = walOpenRef(pTq->pVnode->pWal);
if (handle.pRef == NULL) {
- ASSERT(0);
return -1;
}
walRefVer(handle.pRef, handle.snapshotVer);
@@ -300,12 +295,19 @@ int32_t tqMetaRestoreHandle(STQ* pTq) {
if (handle.execHandle.subType == TOPIC_SUB_TYPE__COLUMN) {
handle.execHandle.task =
qCreateQueueExecTaskInfo(handle.execHandle.execCol.qmsg, &reader, &handle.execHandle.numOfCols, NULL);
- ASSERT(handle.execHandle.task);
+ if (handle.execHandle.task == NULL) {
+ tqError("cannot create exec task for %s", handle.subKey);
+ return -1;
+ }
void* scanner = NULL;
qExtractStreamScanner(handle.execHandle.task, &scanner);
- ASSERT(scanner);
+ if (scanner == NULL) {
+ tqError("cannot extract stream scanner for %s", handle.subKey);
+ }
handle.execHandle.pExecReader = qExtractReaderFromStreamScanner(scanner);
- ASSERT(handle.execHandle.pExecReader);
+ if (handle.execHandle.pExecReader == NULL) {
+ tqError("cannot extract exec reader for %s", handle.subKey);
+ }
} else if (handle.execHandle.subType == TOPIC_SUB_TYPE__DB) {
handle.pWalReader = walOpenReader(pTq->pVnode->pWal, NULL);
handle.execHandle.pExecReader = tqOpenReader(pTq->pVnode);
diff --git a/source/dnode/vnode/src/tq/tqOffset.c b/source/dnode/vnode/src/tq/tqOffset.c
index dd56c165fddf97aae724cebf062c07a63e27f1c7..5a4d414ab7f9591a095148635634fb350f8f078d 100644
--- a/source/dnode/vnode/src/tq/tqOffset.c
+++ b/source/dnode/vnode/src/tq/tqOffset.c
@@ -40,26 +40,23 @@ int32_t tqOffsetRestoreFromFile(STqOffsetStore* pStore, const char* fname) {
if (code == 0) {
break;
} else {
- ASSERT(0);
- // TODO handle error
+ return -1;
}
}
int32_t size = htonl(head.size);
void* memBuf = taosMemoryCalloc(1, size);
if ((code = taosReadFile(pFile, memBuf, size)) != size) {
- ASSERT(0);
- // TODO handle error
+ return -1;
}
STqOffset offset;
SDecoder decoder;
tDecoderInit(&decoder, memBuf, size);
if (tDecodeSTqOffset(&decoder, &offset) < 0) {
- ASSERT(0);
+ return -1;
}
tDecoderClear(&decoder);
if (taosHashPut(pStore->pHash, offset.subKey, strlen(offset.subKey), &offset, sizeof(STqOffset)) < 0) {
- ASSERT(0);
- // TODO
+ return -1;
}
taosMemoryFree(memBuf);
}
@@ -85,7 +82,9 @@ STqOffsetStore* tqOffsetOpen(STQ* pTq) {
}
char* fname = tqOffsetBuildFName(pStore->pTq->path, 0);
if (tqOffsetRestoreFromFile(pStore, fname) < 0) {
- ASSERT(0);
+ taosMemoryFree(fname);
+ taosMemoryFree(pStore);
+ return NULL;
}
taosMemoryFree(fname);
return pStore;
@@ -124,7 +123,6 @@ int32_t tqOffsetCommitFile(STqOffsetStore* pStore) {
const char* sysErrStr = strerror(errno);
tqError("vgId:%d, cannot open file %s when commit offset since %s", pStore->pTq->pVnode->config.vgId, fname,
sysErrStr);
- ASSERT(0);
return -1;
}
taosMemoryFree(fname);
@@ -136,9 +134,7 @@ int32_t tqOffsetCommitFile(STqOffsetStore* pStore) {
int32_t bodyLen;
int32_t code;
tEncodeSize(tEncodeSTqOffset, pOffset, bodyLen, code);
- ASSERT(code == 0);
if (code < 0) {
- ASSERT(0);
taosHashCancelIterate(pStore->pHash, pIter);
return -1;
}
@@ -154,7 +150,6 @@ int32_t tqOffsetCommitFile(STqOffsetStore* pStore) {
// write file
int64_t writeLen;
if ((writeLen = taosWriteFile(pFile, buf, totLen)) != totLen) {
- ASSERT(0);
tqError("write offset incomplete, len %d, write len %" PRId64, bodyLen, writeLen);
taosHashCancelIterate(pStore->pHash, pIter);
taosMemoryFree(buf);
diff --git a/source/dnode/vnode/src/tq/tqOffsetSnapshot.c b/source/dnode/vnode/src/tq/tqOffsetSnapshot.c
index b63ff8af1d623aa2017ce5768a80e2dbf783d5a4..2413a792c60c36a059e5411f2ff51d3792c12aa0 100644
--- a/source/dnode/vnode/src/tq/tqOffsetSnapshot.c
+++ b/source/dnode/vnode/src/tq/tqOffsetSnapshot.c
@@ -56,24 +56,28 @@ int32_t tqOffsetSnapRead(STqOffsetReader* pReader, uint8_t** ppData) {
TdFilePtr pFile = taosOpenFile(fname, TD_FILE_READ);
if (pFile == NULL) {
taosMemoryFree(fname);
- return 0;
+ return -1;
}
int64_t sz = 0;
if (taosStatFile(fname, &sz, NULL) < 0) {
- ASSERT(0);
+ taosCloseFile(&pFile);
+ taosMemoryFree(fname);
+ return -1;
}
taosMemoryFree(fname);
SSnapDataHdr* buf = taosMemoryCalloc(1, sz + sizeof(SSnapDataHdr));
if (buf == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
+ taosCloseFile(&pFile);
return terrno;
}
void* abuf = POINTER_SHIFT(buf, sizeof(SSnapDataHdr));
int64_t contLen = taosReadFile(pFile, abuf, sz);
if (contLen != sz) {
- ASSERT(0);
+ taosCloseFile(&pFile);
+ taosMemoryFree(buf);
return -1;
}
buf->size = sz;
@@ -122,14 +126,17 @@ int32_t tqOffsetWriterClose(STqOffsetWriter** ppWriter, int8_t rollback) {
if (rollback) {
if (taosRemoveFile(pWriter->fname) < 0) {
- ASSERT(0);
+ taosMemoryFree(fname);
+ return -1;
}
} else {
if (taosRenameFile(pWriter->fname, fname) < 0) {
- ASSERT(0);
+ taosMemoryFree(fname);
+ return -1;
}
if (tqOffsetRestoreFromFile(pTq->pOffsetStore, fname) < 0) {
- ASSERT(0);
+ taosMemoryFree(fname);
+ return -1;
}
}
taosMemoryFree(fname);
@@ -146,14 +153,13 @@ int32_t tqOffsetSnapWrite(STqOffsetWriter* pWriter, uint8_t* pData, uint32_t nDa
TdFilePtr pFile = taosOpenFile(pWriter->fname, TD_FILE_CREATE | TD_FILE_WRITE);
SSnapDataHdr* pHdr = (SSnapDataHdr*)pData;
int64_t size = pHdr->size;
- ASSERT(size == nData - sizeof(SSnapDataHdr));
if (pFile) {
int64_t contLen = taosWriteFile(pFile, pHdr->data, size);
if (contLen != size) {
- ASSERT(0);
+ taosCloseFile(&pFile);
+ return -1;
}
} else {
- ASSERT(0);
return -1;
}
return 0;
diff --git a/source/dnode/vnode/src/tq/tqPush.c b/source/dnode/vnode/src/tq/tqPush.c
index f89bc2036252961ff10d81774a9c6f756fdebf43..63c3c25218c0532e58c1b52e0ac2ace30eef3d11 100644
--- a/source/dnode/vnode/src/tq/tqPush.c
+++ b/source/dnode/vnode/src/tq/tqPush.c
@@ -25,9 +25,7 @@ void tqTmrRspFunc(void* param, void* tmrId) {
static int32_t tqLoopExecFromQueue(STQ* pTq, STqHandle* pHandle, SStreamDataSubmit** ppSubmit, SMqDataRsp* pRsp) {
SStreamDataSubmit* pSubmit = *ppSubmit;
while (pSubmit != NULL) {
- ASSERT(pSubmit->ver == pHandle->pushHandle.processedVer + 1);
if (tqLogScanExec(pTq, &pHandle->execHandle, pSubmit->data, pRsp, 0) < 0) {
- /*ASSERT(0);*/
}
// update processed
atomic_store_64(&pHandle->pushHandle.processedVer, pSubmit->ver);
@@ -160,8 +158,7 @@ int32_t tqPushMsgNew(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_
if (msgType == TDMT_VND_SUBMIT) {
tqLogScanExec(pTq, &pHandle->execHandle, pReq, &rsp, workerId);
} else {
- // TODO
- ASSERT(0);
+ tqError("tq push unexpected msg type %d", msgType);
}
if (rsp.blockNum == 0) {
@@ -169,9 +166,6 @@ int32_t tqPushMsgNew(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_
continue;
}
- ASSERT(taosArrayGetSize(rsp.blockData) == rsp.blockNum);
- ASSERT(taosArrayGetSize(rsp.blockDataLen) == rsp.blockNum);
-
rsp.rspOffset = fetchOffset;
int32_t tlen = sizeof(SMqRspHead) + tEncodeSMqDataBlkRsp(NULL, &rsp);
@@ -263,7 +257,7 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver)
SSDataBlock* pDataBlock = NULL;
uint64_t ts = 0;
if (qExecTask(task, &pDataBlock, &ts) < 0) {
- ASSERT(0);
+ tqDebug("vgId:%d, tq exec error since %s", pTq->pVnode->config.vgId, terrstr());
}
if (pDataBlock == NULL) {
@@ -282,7 +276,7 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver)
// remove from hash
size_t kLen;
void* key = taosHashGetKey(pIter, &kLen);
- void* keyCopy = taosMemoryMalloc(kLen);
+ void* keyCopy = taosMemoryCalloc(1, kLen + 1);
memcpy(keyCopy, key, kLen);
taosArrayPush(cachedKeys, &keyCopy);
@@ -296,7 +290,7 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver)
void* key = taosArrayGetP(cachedKeys, i);
size_t kLen = *(size_t*)taosArrayGet(cachedKeyLens, i);
if (taosHashRemove(pTq->pPushMgr, key, kLen) != 0) {
- ASSERT(0);
+ tqError("vgId:%d, tq push hash remove key error, key: %s", pTq->pVnode->config.vgId, (char*)key);
}
}
taosArrayDestroyP(cachedKeys, (FDelete)taosMemoryFree);
diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c
index 46b31bc5b0fed0f42e3f570772ec46a190f70ea1..e5392bbd0263e724617fbba47ac28924bc9bc8e4 100644
--- a/source/dnode/vnode/src/tq/tqRead.c
+++ b/source/dnode/vnode/src/tq/tqRead.c
@@ -176,8 +176,6 @@ bool isValValidForTable(STqHandle* pHandle, SWalCont* pHead) {
goto end;
}
realTbSuid = req.suid;
- } else {
- ASSERT(0);
}
end:
@@ -206,7 +204,6 @@ int64_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, SWalCkHea
code = walFetchBody(pHandle->pWalReader, ppCkHead);
if (code < 0) {
- ASSERT(0);
*fetchOffset = offset;
code = -1;
goto END;
@@ -220,7 +217,6 @@ int64_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, SWalCkHea
if (IS_META_MSG(pHead->msgType)) {
code = walFetchBody(pHandle->pWalReader, ppCkHead);
if (code < 0) {
- ASSERT(0);
*fetchOffset = offset;
code = -1;
goto END;
@@ -238,7 +234,6 @@ int64_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, SWalCkHea
}
code = walSkipFetchBody(pHandle->pWalReader, *ppCkHead);
if (code < 0) {
- ASSERT(0);
*fetchOffset = offset;
code = -1;
goto END;
@@ -297,11 +292,8 @@ void tqCloseReader(STqReader* pReader) {
int32_t tqSeekVer(STqReader* pReader, int64_t ver) {
if (walReadSeekVer(pReader->pWalReader, ver) < 0) {
- ASSERT(pReader->pWalReader->curInvalid);
- ASSERT(pReader->pWalReader->curVersion == ver);
return -1;
}
- ASSERT(pReader->pWalReader->curVersion == ver);
return 0;
}
@@ -317,7 +309,6 @@ int32_t tqNextBlock(STqReader* pReader, SFetchRet* ret) {
ret->offset.version = pReader->ver;
ret->fetchType = FETCH_TYPE__NONE;
tqDebug("return offset %" PRId64 ", no more valid", ret->offset.version);
- ASSERT(ret->offset.version >= 0);
return -1;
}
void* body = pReader->pWalReader->pHead->head.body;
@@ -340,7 +331,6 @@ int32_t tqNextBlock(STqReader* pReader, SFetchRet* ret) {
memset(&ret->data, 0, sizeof(SSDataBlock));
int32_t code = tqRetrieveDataBlock(&ret->data, pReader);
if (code != 0 || ret->data.info.rows == 0) {
- ASSERT(0);
continue;
}
ret->fetchType = FETCH_TYPE__DATA;
@@ -351,7 +341,6 @@ int32_t tqNextBlock(STqReader* pReader, SFetchRet* ret) {
if (fromProcessedMsg) {
ret->offset.type = TMQ_OFFSET__LOG;
ret->offset.version = pReader->ver;
- ASSERT(pReader->ver >= 0);
ret->fetchType = FETCH_TYPE__SEP;
tqDebug("return offset %" PRId64 ", processed finish", ret->offset.version);
return 0;
@@ -434,7 +423,6 @@ bool tqNextDataBlockFilterOut(STqReader* pHandle, SHashObj* filterOutUids) {
}
if (pHandle->pBlock == NULL) return false;
- ASSERT(pHandle->tbIdHash == NULL);
void* ret = taosHashGet(filterOutUids, &pHandle->msgIter.uid, sizeof(int64_t));
if (ret == NULL) {
return true;
@@ -453,7 +441,6 @@ int32_t tqRetrieveDataBlock(SSDataBlock* pBlock, STqReader* pReader) {
if (pReader->pSchema == NULL) {
tqWarn("cannot found tsschema for table: uid:%" PRId64 " (suid:%" PRId64 "), version %d, possibly dropped table",
pReader->msgIter.uid, pReader->msgIter.suid, pReader->cachedSchemaVer);
- /*ASSERT(0);*/
pReader->cachedSchemaSuid = 0;
terrno = TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND;
return -1;
@@ -464,7 +451,6 @@ int32_t tqRetrieveDataBlock(SSDataBlock* pBlock, STqReader* pReader) {
if (pReader->pSchemaWrapper == NULL) {
tqWarn("cannot found schema wrapper for table: suid:%" PRId64 ", version %d, possibly dropped table",
pReader->msgIter.uid, pReader->cachedSchemaVer);
- /*ASSERT(0);*/
pReader->cachedSchemaSuid = 0;
terrno = TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND;
return -1;
@@ -567,7 +553,6 @@ int32_t tqRetrieveTaosxBlock(STqReader* pReader, SArray* blocks, SArray* schemas
if (pReader->pSchema == NULL) {
tqWarn("cannot found tsschema for table: uid:%" PRId64 " (suid:%" PRId64 "), version %d, possibly dropped table",
pReader->msgIter.uid, pReader->msgIter.suid, pReader->cachedSchemaVer);
- /*ASSERT(0);*/
pReader->cachedSchemaSuid = 0;
terrno = TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND;
return -1;
@@ -578,7 +563,6 @@ int32_t tqRetrieveTaosxBlock(STqReader* pReader, SArray* blocks, SArray* schemas
if (pReader->pSchemaWrapper == NULL) {
tqWarn("cannot found schema wrapper for table: suid:%" PRId64 ", version %d, possibly dropped table",
pReader->msgIter.uid, pReader->cachedSchemaVer);
- /*ASSERT(0);*/
pReader->cachedSchemaSuid = 0;
terrno = TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND;
return -1;
@@ -671,8 +655,6 @@ int32_t tqRetrieveTaosxBlock(STqReader* pReader, SArray* blocks, SArray* schemas
break;
}
- ASSERT(sVal.valType != TD_VTYPE_NONE);
-
if (colDataAppend(pColData, curRow, sVal.val, sVal.valType == TD_VTYPE_NULL) < 0) {
goto FAIL;
}
@@ -732,8 +714,6 @@ int tqReaderAddTbUidList(STqReader* pReader, const SArray* tbUidList) {
}
int tqReaderRemoveTbUidList(STqReader* pReader, const SArray* tbUidList) {
- ASSERT(pReader->tbIdHash != NULL);
-
for (int32_t i = 0; i < taosArrayGetSize(tbUidList); i++) {
int64_t* pKey = (int64_t*)taosArrayGet(tbUidList, i);
taosHashRemove(pReader->tbIdHash, pKey, sizeof(int64_t));
@@ -750,7 +730,10 @@ int32_t tqUpdateTbUidList(STQ* pTq, const SArray* tbUidList, bool isAdd) {
STqHandle* pExec = (STqHandle*)pIter;
if (pExec->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) {
int32_t code = qUpdateQualifiedTableId(pExec->execHandle.task, tbUidList, isAdd);
- ASSERT(code == 0);
+ if (code != 0) {
+ tqError("update qualified table error for %s", pExec->subKey);
+ continue;
+ }
} else if (pExec->execHandle.subType == TOPIC_SUB_TYPE__DB) {
if (!isAdd) {
int32_t sz = taosArrayGetSize(tbUidList);
@@ -769,7 +752,7 @@ int32_t tqUpdateTbUidList(STQ* pTq, const SArray* tbUidList, bool isAdd) {
int32_t code = metaGetTableEntryByUidCache(&mr, *id);
if (code != TSDB_CODE_SUCCESS) {
- qError("failed to get table meta, uid:%" PRIu64 " code:%s", *id, tstrerror(terrno));
+ tqError("failed to get table meta, uid:%" PRIu64 " code:%s", *id, tstrerror(terrno));
continue;
}
@@ -790,8 +773,6 @@ int32_t tqUpdateTbUidList(STQ* pTq, const SArray* tbUidList, bool isAdd) {
} else {
// TODO handle delete table from stb
}
- } else {
- ASSERT(0);
}
}
while (1) {
@@ -800,7 +781,10 @@ int32_t tqUpdateTbUidList(STQ* pTq, const SArray* tbUidList, bool isAdd) {
SStreamTask* pTask = *(SStreamTask**)pIter;
if (pTask->taskLevel == TASK_LEVEL__SOURCE) {
int32_t code = qUpdateQualifiedTableId(pTask->exec.executor, tbUidList, isAdd);
- ASSERT(code == 0);
+ if (code != 0) {
+ tqError("update qualified table error for stream task %d", pTask->taskId);
+ continue;
+ }
}
}
return 0;
diff --git a/source/dnode/vnode/src/tq/tqSink.c b/source/dnode/vnode/src/tq/tqSink.c
index 5907be576a67441f12c4045ba33243b751451fd4..078b50db680d05e1127f54d5bd94fe71459abd4c 100644
--- a/source/dnode/vnode/src/tq/tqSink.c
+++ b/source/dnode/vnode/src/tq/tqSink.c
@@ -19,7 +19,6 @@
int32_t tqBuildDeleteReq(SVnode* pVnode, const char* stbFullName, const SSDataBlock* pDataBlock,
SBatchDeleteReq* deleteReq) {
- ASSERT(pDataBlock->info.type == STREAM_DELETE_RESULT);
int32_t totRow = pDataBlock->info.rows;
SColumnInfoData* pStartTsCol = taosArrayGet(pDataBlock->pDataBlock, START_TS_COLUMN_INDEX);
SColumnInfoData* pEndTsCol = taosArrayGet(pDataBlock->pDataBlock, END_TS_COLUMN_INDEX);
@@ -334,8 +333,8 @@ void tqSinkToTablePipeline(SStreamTask* pTask, void* vnode, int64_t ver, void* d
int32_t code;
tEncodeSize(tEncodeSBatchDeleteReq, &deleteReq, len, code);
if (code < 0) {
- //
- ASSERT(0);
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return;
}
SEncoder encoder;
void* serializedDeleteReq = rpcMallocCont(len + sizeof(SMsgHead));
@@ -559,7 +558,6 @@ void tqSinkToTableMerge(SStreamTask* pTask, void* vnode, int64_t ver, void* data
tqDebug("vgId:%d, task %d write into table, block num: %d", TD_VID(pVnode), pTask->taskId, (int32_t)pRes->size);
- ASSERT(pTask->tbSink.pTSchema);
deleteReq.deleteReqs = taosArrayInit(0, sizeof(SSingleDeleteReq));
SSubmitReq* submitReq = tqBlockToSubmit(pVnode, pRes, pTask->tbSink.pTSchema, pTask->tbSink.pSchemaWrapper, true,
pTask->tbSink.stbUid, pTask->tbSink.stbFullName, &deleteReq);
@@ -570,10 +568,6 @@ void tqSinkToTableMerge(SStreamTask* pTask, void* vnode, int64_t ver, void* data
int32_t code;
int32_t len;
tEncodeSize(tEncodeSBatchDeleteReq, &deleteReq, len, code);
- if (code < 0) {
- //
- ASSERT(0);
- }
SEncoder encoder;
void* serializedDeleteReq = rpcMallocCont(len + sizeof(SMsgHead));
void* abuf = POINTER_SHIFT(serializedDeleteReq, sizeof(SMsgHead));
diff --git a/source/dnode/vnode/src/tq/tqSnapshot.c b/source/dnode/vnode/src/tq/tqSnapshot.c
index d811d943ed9c45f30e64ac717a93e88587ed3fcc..ab7093a701e0a5207b5f64072350ba5bc2bae703 100644
--- a/source/dnode/vnode/src/tq/tqSnapshot.c
+++ b/source/dnode/vnode/src/tq/tqSnapshot.c
@@ -100,8 +100,6 @@ int32_t tqSnapRead(STqSnapReader* pReader, uint8_t** ppData) {
}
}
- ASSERT(pVal && vLen);
-
*ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + vLen);
if (*ppData == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
diff --git a/source/dnode/vnode/src/tq/tqStreamStateSnap.c b/source/dnode/vnode/src/tq/tqStreamStateSnap.c
index b1f00bdf7446789fa3c572ff366bd20319db10ec..ab7093a701e0a5207b5f64072350ba5bc2bae703 100644
--- a/source/dnode/vnode/src/tq/tqStreamStateSnap.c
+++ b/source/dnode/vnode/src/tq/tqStreamStateSnap.c
@@ -100,8 +100,6 @@ int32_t tqSnapRead(STqSnapReader* pReader, uint8_t** ppData) {
}
}
- ASSERT(pVal && vLen);
-
*ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + vLen);
if (*ppData == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
@@ -168,7 +166,6 @@ int32_t tqSnapWriterClose(STqSnapWriter** ppWriter, int8_t rollback) {
if (rollback) {
tdbAbort(pWriter->pTq->pMetaDB, pWriter->txn);
- ASSERT(0);
} else {
code = tdbCommit(pWriter->pTq->pMetaDB, pWriter->txn);
if (code) goto _err;
diff --git a/source/dnode/vnode/src/tq/tqStreamTaskSnap.c b/source/dnode/vnode/src/tq/tqStreamTaskSnap.c
index 305378bc932f0484c71a9d1c91935a580189488e..ab7093a701e0a5207b5f64072350ba5bc2bae703 100644
--- a/source/dnode/vnode/src/tq/tqStreamTaskSnap.c
+++ b/source/dnode/vnode/src/tq/tqStreamTaskSnap.c
@@ -100,8 +100,6 @@ int32_t tqSnapRead(STqSnapReader* pReader, uint8_t** ppData) {
}
}
- ASSERT(pVal && vLen);
-
*ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + vLen);
if (*ppData == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
@@ -146,7 +144,7 @@ int32_t tqSnapWriterOpen(STQ* pTq, int64_t sver, int64_t ever, STqSnapWriter** p
pWriter->sver = sver;
pWriter->ever = ever;
- if (tdbBegin(pTq->pMetaStore, &pWriter->txn, tdbDefaultMalloc, tdbDefaultFree, NULL, 0) < 0) {
+ if (tdbBegin(pTq->pMetaDB, &pWriter->txn, tdbDefaultMalloc, tdbDefaultFree, NULL, 0) < 0) {
code = -1;
taosMemoryFree(pWriter);
goto _err;
@@ -167,12 +165,11 @@ int32_t tqSnapWriterClose(STqSnapWriter** ppWriter, int8_t rollback) {
STQ* pTq = pWriter->pTq;
if (rollback) {
- tdbAbort(pWriter->pTq->pMetaStore, pWriter->txn);
- ASSERT(0);
+ tdbAbort(pWriter->pTq->pMetaDB, pWriter->txn);
} else {
- code = tdbCommit(pWriter->pTq->pMetaStore, pWriter->txn);
+ code = tdbCommit(pWriter->pTq->pMetaDB, pWriter->txn);
if (code) goto _err;
- code = tdbPostCommit(pWriter->pTq->pMetaStore, pWriter->txn);
+ code = tdbPostCommit(pWriter->pTq->pMetaDB, pWriter->txn);
if (code) goto _err;
}
diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c
index d074ceede81a7f4f5f696b73746f4e91f4131b2e..1414d3b4ab310b427491f51f982c60f4ddb21107 100644
--- a/source/libs/executor/src/scanoperator.c
+++ b/source/libs/executor/src/scanoperator.c
@@ -768,8 +768,8 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) {
tableListGetGroupList(pTaskInfo->pTableInfoList, pInfo->currentGroupId, &pList, &num);
ASSERT(pInfo->base.dataReader == NULL);
- int32_t code = tsdbReaderOpen(pInfo->base.readHandle.vnode, &pInfo->base.cond, pList, num,
- pInfo->pResBlock, (STsdbReader**)&pInfo->base.dataReader, GET_TASKID(pTaskInfo));
+ int32_t code = tsdbReaderOpen(pInfo->base.readHandle.vnode, &pInfo->base.cond, pList, num, pInfo->pResBlock,
+ (STsdbReader**)&pInfo->base.dataReader, GET_TASKID(pTaskInfo));
if (code != TSDB_CODE_SUCCESS) {
T_LONG_JMP(pTaskInfo->env, code);
}
@@ -986,8 +986,8 @@ static SSDataBlock* readPreVersionData(SOperatorInfo* pTableScanOp, uint64_t tbU
SSDataBlock* pBlock = pTableScanInfo->pResBlock;
STsdbReader* pReader = NULL;
- int32_t code = tsdbReaderOpen(pTableScanInfo->base.readHandle.vnode, &cond, &tblInfo, 1, pBlock, (STsdbReader**)&pReader,
- GET_TASKID(pTaskInfo));
+ int32_t code = tsdbReaderOpen(pTableScanInfo->base.readHandle.vnode, &cond, &tblInfo, 1, pBlock,
+ (STsdbReader**)&pReader, GET_TASKID(pTaskInfo));
if (code != TSDB_CODE_SUCCESS) {
terrno = code;
T_LONG_JMP(pTaskInfo->env, code);
@@ -995,7 +995,7 @@ static SSDataBlock* readPreVersionData(SOperatorInfo* pTableScanOp, uint64_t tbU
}
if (tsdbNextDataBlock(pReader)) {
- /*SSDataBlock* p = */tsdbRetrieveDataBlock(pReader, NULL);
+ /*SSDataBlock* p = */ tsdbRetrieveDataBlock(pReader, NULL);
doSetTagColumnData(&pTableScanInfo->base, pBlock, pTaskInfo, pBlock->info.rows);
pBlock->info.id.groupId = getTableGroupId(pTaskInfo->pTableInfoList, pBlock->info.id.uid);
}
@@ -1224,7 +1224,7 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS
SColumnInfoData* pSrcUidCol = taosArrayGet(pSrcBlock->pDataBlock, UID_COLUMN_INDEX);
SColumnInfoData* pSrcGpCol = taosArrayGet(pSrcBlock->pDataBlock, GROUPID_COLUMN_INDEX);
- uint64_t* srcUidData = (uint64_t*)pSrcUidCol->pData;
+ uint64_t* srcUidData = (uint64_t*)pSrcUidCol->pData;
ASSERT(pSrcStartTsCol->info.type == TSDB_DATA_TYPE_TIMESTAMP);
TSKEY* srcStartTsCol = (TSKEY*)pSrcStartTsCol->pData;
TSKEY* srcEndTsCol = (TSKEY*)pSrcEndTsCol->pData;
@@ -1347,6 +1347,36 @@ static int32_t generateScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock,
return code;
}
+#if 0
+void calBlockTag(SStreamScanInfo* pInfo, SSDataBlock* pBlock) {
+ SExprSupp* pTagCalSup = &pInfo->tagCalSup;
+ SStreamState* pState = pInfo->pStreamScanOp->pTaskInfo->streamInfo.pState;
+ if (pTagCalSup == NULL || pTagCalSup->numOfExprs == 0) return;
+ if (pBlock == NULL || pBlock->info.rows == 0) return;
+
+ void* tag = NULL;
+ int32_t tagLen = 0;
+ if (streamStateGetParTag(pState, pBlock->info.id.groupId, &tag, &tagLen) == 0) {
+ pBlock->info.tagLen = tagLen;
+ void* pTag = taosMemoryRealloc(pBlock->info.pTag, tagLen);
+ if (pTag == NULL) {
+ tdbFree(tag);
+ taosMemoryFree(pBlock->info.pTag);
+ pBlock->info.pTag = NULL;
+ pBlock->info.tagLen = 0;
+ return;
+ }
+ pBlock->info.pTag = pTag;
+ memcpy(pBlock->info.pTag, tag, tagLen);
+ tdbFree(tag);
+ return;
+ } else {
+ pBlock->info.pTag = NULL;
+ }
+ tdbFree(tag);
+}
+#endif
+
void calBlockTbName(SStreamScanInfo* pInfo, SSDataBlock* pBlock) {
SExprSupp* pTbNameCalSup = &pInfo->tbnameCalSup;
SStreamState* pState = pInfo->pStreamScanOp->pTaskInfo->streamInfo.pState;
@@ -1354,10 +1384,12 @@ void calBlockTbName(SStreamScanInfo* pInfo, SSDataBlock* pBlock) {
if (pBlock == NULL || pBlock->info.rows == 0) return;
void* tbname = NULL;
- if (streamStateGetParName(pInfo->pStreamScanOp->pTaskInfo->streamInfo.pState, pBlock->info.id.groupId, &tbname) < 0) {
- pBlock->info.parTbName[0] = 0;
- } else {
+ if (streamStateGetParName(pState, pBlock->info.id.groupId, &tbname) == 0) {
memcpy(pBlock->info.parTbName, tbname, TSDB_TABLE_NAME_LEN);
+ tdbFree(tbname);
+ return;
+ } else {
+ pBlock->info.parTbName[0] = 0;
}
tdbFree(tbname);
@@ -2285,7 +2317,8 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys
if (pHandle->initTableReader) {
pTSInfo->scanMode = TABLE_SCAN__TABLE_ORDER;
pTSInfo->base.dataReader = NULL;
- code = tsdbReaderOpen(pHandle->vnode, &pTSInfo->base.cond, pList, num, pTSInfo->pResBlock, &pTSInfo->base.dataReader, NULL);
+ code = tsdbReaderOpen(pHandle->vnode, &pTSInfo->base.cond, pList, num, pTSInfo->pResBlock,
+ &pTSInfo->base.dataReader, NULL);
if (code != 0) {
terrno = code;
destroyTableScanOperatorInfo(pTableScanOp);
@@ -2355,7 +2388,8 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys
pOperator->exprSupp.numOfExprs = taosArrayGetSize(pInfo->pRes->pDataBlock);
__optr_fn_t nextFn = pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM ? doStreamScan : doQueueScan;
- pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, nextFn, NULL, destroyStreamScanOperatorInfo, optrDefaultBufFn, NULL);
+ pOperator->fpSet =
+ createOperatorFpSet(optrDummyOpenFn, nextFn, NULL, destroyStreamScanOperatorInfo, optrDefaultBufFn, NULL);
return pOperator;
@@ -2492,7 +2526,8 @@ SOperatorInfo* createTagScanOperatorInfo(SReadHandle* pReadHandle, STagScanPhysi
initResultSizeInfo(&pOperator->resultInfo, 4096);
blockDataEnsureCapacity(pInfo->pRes, pOperator->resultInfo.capacity);
- pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doTagScan, NULL, destroyTagScanOperatorInfo, optrDefaultBufFn, NULL);
+ pOperator->fpSet =
+ createOperatorFpSet(optrDummyOpenFn, doTagScan, NULL, destroyTagScanOperatorInfo, optrDefaultBufFn, NULL);
return pOperator;
@@ -2513,11 +2548,12 @@ static SSDataBlock* getTableDataBlockImpl(void* param) {
SQueryTableDataCond* pQueryCond = taosArrayGet(pInfo->queryConds, readIdx);
- int64_t st = taosGetTimestampUs();
- void* p = tableListGetInfo(pTaskInfo->pTableInfoList, readIdx + pInfo->tableStartIndex);
+ int64_t st = taosGetTimestampUs();
+ void* p = tableListGetInfo(pTaskInfo->pTableInfoList, readIdx + pInfo->tableStartIndex);
SReadHandle* pHandle = &pInfo->base.readHandle;
- int32_t code = tsdbReaderOpen(pHandle->vnode, pQueryCond, p, 1, pBlock, &pInfo->base.dataReader, GET_TASKID(pTaskInfo));
+ int32_t code =
+ tsdbReaderOpen(pHandle->vnode, pQueryCond, p, 1, pBlock, &pInfo->base.dataReader, GET_TASKID(pTaskInfo));
if (code != 0) {
T_LONG_JMP(pTaskInfo->env, code);
}
@@ -2915,8 +2951,8 @@ static void buildVnodeGroupedNtbTableCount(STableCountScanOperatorInfo*
SSDataBlock* pRes, char* dbName);
static void buildVnodeFilteredTbCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
STableCountScanSupp* pSupp, SSDataBlock* pRes, char* dbName);
-static void buildVnodeGroupedTableCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
- STableCountScanSupp* pSupp, SSDataBlock* pRes, int32_t vgId, char* dbName);
+static void buildVnodeGroupedTableCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
+ STableCountScanSupp* pSupp, SSDataBlock* pRes, int32_t vgId, char* dbName);
static SSDataBlock* buildVnodeDbTableCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
STableCountScanSupp* pSupp, SSDataBlock* pRes);
static void buildSysDbGroupedTableCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo,
@@ -3041,8 +3077,8 @@ SOperatorInfo* createTableCountScanOperatorInfo(SReadHandle* readHandle, STableC
setOperatorInfo(pOperator, "TableCountScanOperator", QUERY_NODE_PHYSICAL_PLAN_TABLE_COUNT_SCAN, false, OP_NOT_OPENED,
pInfo, pTaskInfo);
- pOperator->fpSet =
- createOperatorFpSet(optrDummyOpenFn, doTableCountScan, NULL, destoryTableCountScanOperator, optrDefaultBufFn, NULL);
+ pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doTableCountScan, NULL, destoryTableCountScanOperator,
+ optrDefaultBufFn, NULL);
return pOperator;
_error:
diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c
index af0b325f84e4a7383752cb0ec91ab02c27a7b19e..45d65d5ea109db2a939119d140bb03d899261389 100644
--- a/source/libs/nodes/src/nodesCodeFuncs.c
+++ b/source/libs/nodes/src/nodesCodeFuncs.c
@@ -79,6 +79,10 @@ const char* nodesNodeName(ENodeType type) {
return "TableOptions";
case QUERY_NODE_INDEX_OPTIONS:
return "IndexOptions";
+ case QUERY_NODE_EXPLAIN_OPTIONS:
+ return "ExplainOptions";
+ case QUERY_NODE_STREAM_OPTIONS:
+ return "StreamOptions";
case QUERY_NODE_LEFT_VALUE:
return "LeftValue";
case QUERY_NODE_WHEN_THEN:
@@ -107,7 +111,7 @@ const char* nodesNodeName(ENodeType type) {
return "CreateTableStmt";
case QUERY_NODE_CREATE_SUBTABLE_CLAUSE:
return "CreateSubtableClause";
- case QUERY_NODE_CREATE_MULTI_TABLE_STMT:
+ case QUERY_NODE_CREATE_MULTI_TABLES_STMT:
return "CreateMultiTableStmt";
case QUERY_NODE_DROP_TABLE_CLAUSE:
return "DropTableClause";
@@ -141,20 +145,42 @@ const char* nodesNodeName(ENodeType type) {
return "CreateQnodeStmt";
case QUERY_NODE_DROP_QNODE_STMT:
return "DropQnodeStmt";
+ case QUERY_NODE_CREATE_SNODE_STMT:
+ return "CreateSnodeStmt";
case QUERY_NODE_DROP_SNODE_STMT:
return "DropSnodeStmt";
+ case QUERY_NODE_CREATE_MNODE_STMT:
+ return "CreateMnodeStmt";
case QUERY_NODE_DROP_MNODE_STMT:
return "DropMnodeStmt";
case QUERY_NODE_CREATE_TOPIC_STMT:
return "CreateTopicStmt";
case QUERY_NODE_DROP_TOPIC_STMT:
return "DropTopicStmt";
+ case QUERY_NODE_DROP_CGROUP_STMT:
+ return "DropConsumerGroupStmt";
case QUERY_NODE_ALTER_LOCAL_STMT:
return "AlterLocalStmt";
+ case QUERY_NODE_EXPLAIN_STMT:
+ return "ExplainStmt";
+ case QUERY_NODE_DESCRIBE_STMT:
+ return "DescribeStmt";
+ case QUERY_NODE_CREATE_STREAM_STMT:
+ return "CreateStreamStmt";
case QUERY_NODE_DROP_STREAM_STMT:
return "DropStreamStmt";
+ case QUERY_NODE_BALANCE_VGROUP_STMT:
+ return "BalanceVgroupStmt";
+ case QUERY_NODE_MERGE_VGROUP_STMT:
+ return "MergeVgroupStmt";
+ case QUERY_NODE_REDISTRIBUTE_VGROUP_STMT:
+ return "RedistributeVgroupStmt";
case QUERY_NODE_SPLIT_VGROUP_STMT:
return "SplitVgroupStmt";
+ case QUERY_NODE_GRANT_STMT:
+ return "GrantStmt";
+ case QUERY_NODE_REVOKE_STMT:
+ return "RevokeStmt";
case QUERY_NODE_SHOW_DNODES_STMT:
return "ShowDnodesStmt";
case QUERY_NODE_SHOW_MNODES_STMT:
@@ -1400,6 +1426,23 @@ static int32_t logicJoinNodeToJson(const void* pObj, SJson* pJson) {
return code;
}
+static int32_t jsonToLogicJoinNode(const SJson* pJson, void* pObj) {
+ SJoinLogicNode* pNode = (SJoinLogicNode*)pObj;
+
+ int32_t code = jsonToLogicPlanNode(pJson, pObj);
+ if (TSDB_CODE_SUCCESS == code) {
+ tjsonGetNumberValue(pJson, jkJoinLogicPlanJoinType, pNode->joinType, code);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeObject(pJson, jkJoinLogicPlanMergeCondition, &pNode->pMergeCondition);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeObject(pJson, jkJoinLogicPlanOnConditions, &pNode->pOnConditions);
+ }
+
+ return code;
+}
+
static const char* jkPhysiPlanOutputDataBlockDesc = "OutputDataBlockDesc";
static const char* jkPhysiPlanConditions = "Conditions";
static const char* jkPhysiPlanChildren = "Children";
@@ -4004,6 +4047,45 @@ static int32_t jsonToSlotDescNode(const SJson* pJson, void* pObj) {
return code;
}
+static const char* jkColumnDefColName = "ColName";
+static const char* jkColumnDefDataType = "DataType";
+static const char* jkColumnDefComments = "Comments";
+static const char* jkColumnDefSma = "Sma";
+
+static int32_t columnDefNodeToJson(const void* pObj, SJson* pJson) {
+ const SColumnDefNode* pNode = (const SColumnDefNode*)pObj;
+
+ int32_t code = tjsonAddStringToObject(pJson, jkColumnDefColName, pNode->colName);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddObject(pJson, jkColumnDefDataType, dataTypeToJson, &pNode->dataType);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddStringToObject(pJson, jkColumnDefComments, pNode->comments);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddBoolToObject(pJson, jkColumnDefSma, pNode->sma);
+ }
+
+ return code;
+}
+
+static int32_t jsonToColumnDefNode(const SJson* pJson, void* pObj) {
+ SColumnDefNode* pNode = (SColumnDefNode*)pObj;
+
+ int32_t code = tjsonGetStringValue(pJson, jkColumnDefColName, pNode->colName);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonToObject(pJson, jkColumnDefDataType, jsonToDataType, &pNode->dataType);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetStringValue(pJson, jkColumnDefComments, pNode->comments);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetBoolValue(pJson, jkColumnDefSma, &pNode->sma);
+ }
+
+ return code;
+}
+
static const char* jkDownstreamSourceAddr = "Addr";
static const char* jkDownstreamSourceTaskId = "TaskId";
static const char* jkDownstreamSourceSchedId = "SchedId";
@@ -4194,6 +4276,190 @@ static int32_t jsonToDatabaseOptions(const SJson* pJson, void* pObj) {
return code;
}
+static const char* jkTableOptionsComment = "Comment";
+static const char* jkTableOptionsMaxDelay = "MaxDelay";
+static const char* jkTableOptionsWatermark = "Watermark";
+static const char* jkTableOptionsDeleteMark = "DeleteMark";
+static const char* jkTableOptionsRollupFuncs = "RollupFuncs";
+static const char* jkTableOptionsTtl = "Ttl";
+static const char* jkTableOptionsSma = "Sma";
+
+static int32_t tableOptionsToJson(const void* pObj, SJson* pJson) {
+ const STableOptions* pNode = (const STableOptions*)pObj;
+
+ int32_t code = tjsonAddStringToObject(pJson, jkTableOptionsComment, pNode->comment);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = nodeListToJson(pJson, jkTableOptionsMaxDelay, pNode->pMaxDelay);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = nodeListToJson(pJson, jkTableOptionsWatermark, pNode->pWatermark);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = nodeListToJson(pJson, jkTableOptionsDeleteMark, pNode->pDeleteMark);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = nodeListToJson(pJson, jkTableOptionsRollupFuncs, pNode->pRollupFuncs);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddIntegerToObject(pJson, jkTableOptionsTtl, pNode->ttl);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = nodeListToJson(pJson, jkTableOptionsSma, pNode->pSma);
+ }
+
+ return code;
+}
+
+static int32_t jsonToTableOptions(const SJson* pJson, void* pObj) {
+ STableOptions* pNode = (STableOptions*)pObj;
+
+ int32_t code = tjsonGetStringValue(pJson, jkTableOptionsComment, pNode->comment);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeList(pJson, jkTableOptionsMaxDelay, &pNode->pMaxDelay);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeList(pJson, jkTableOptionsWatermark, &pNode->pWatermark);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeList(pJson, jkTableOptionsDeleteMark, &pNode->pDeleteMark);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeList(pJson, jkTableOptionsRollupFuncs, &pNode->pRollupFuncs);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetIntValue(pJson, jkTableOptionsTtl, &pNode->ttl);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeList(pJson, jkTableOptionsSma, &pNode->pSma);
+ }
+
+ return code;
+}
+
+static const char* jkIndexOptionsFuncs = "Funcs";
+static const char* jkIndexOptionsInterval = "Interval";
+static const char* jkIndexOptionsOffset = "Offset";
+static const char* jkIndexOptionsSliding = "Sliding";
+static const char* jkIndexOptionsStreamOptions = "StreamOptions";
+
+static int32_t indexOptionsToJson(const void* pObj, SJson* pJson) {
+ const SIndexOptions* pNode = (const SIndexOptions*)pObj;
+
+ int32_t code = nodeListToJson(pJson, jkIndexOptionsFuncs, pNode->pFuncs);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddObject(pJson, jkIndexOptionsInterval, nodeToJson, pNode->pInterval);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddObject(pJson, jkIndexOptionsOffset, nodeToJson, pNode->pOffset);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddObject(pJson, jkIndexOptionsSliding, nodeToJson, pNode->pSliding);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddObject(pJson, jkIndexOptionsStreamOptions, nodeToJson, pNode->pStreamOptions);
+ }
+
+ return code;
+}
+
+static int32_t jsonToIndexOptions(const SJson* pJson, void* pObj) {
+ SIndexOptions* pNode = (SIndexOptions*)pObj;
+
+ int32_t code = jsonToNodeList(pJson, jkIndexOptionsFuncs, &pNode->pFuncs);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeObject(pJson, jkIndexOptionsInterval, &pNode->pInterval);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeObject(pJson, jkIndexOptionsOffset, &pNode->pOffset);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeObject(pJson, jkIndexOptionsSliding, &pNode->pSliding);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeObject(pJson, jkIndexOptionsStreamOptions, &pNode->pStreamOptions);
+ }
+
+ return code;
+}
+
+static const char* jkExplainOptionsVerbose = "Verbose";
+static const char* jkExplainOptionsRatio = "Ratio";
+
+static int32_t explainOptionsToJson(const void* pObj, SJson* pJson) {
+ const SExplainOptions* pNode = (const SExplainOptions*)pObj;
+
+ int32_t code = tjsonAddBoolToObject(pJson, jkExplainOptionsVerbose, pNode->verbose);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddDoubleToObject(pJson, jkExplainOptionsRatio, pNode->ratio);
+ }
+
+ return code;
+}
+
+static int32_t jsonToExplainOptions(const SJson* pJson, void* pObj) {
+ SExplainOptions* pNode = (SExplainOptions*)pObj;
+
+ int32_t code = tjsonGetBoolValue(pJson, jkExplainOptionsVerbose, &pNode->verbose);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetDoubleValue(pJson, jkExplainOptionsRatio, &pNode->ratio);
+ }
+
+ return code;
+}
+
+static const char* jkStreamOptionsTriggerType = "TriggerType";
+static const char* jkStreamOptionsDelay = "Delay";
+static const char* jkStreamOptionsWatermark = "Watermark";
+static const char* jkStreamOptionsDeleteMark = "DeleteMark";
+static const char* jkStreamOptionsFillHistory = "FillHistory";
+static const char* jkStreamOptionsIgnoreExpired = "IgnoreExpired";
+
+static int32_t streamOptionsToJson(const void* pObj, SJson* pJson) {
+ const SStreamOptions* pNode = (const SStreamOptions*)pObj;
+
+ int32_t code = tjsonAddIntegerToObject(pJson, jkStreamOptionsTriggerType, pNode->triggerType);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddObject(pJson, jkStreamOptionsDelay, nodeToJson, pNode->pDelay);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddObject(pJson, jkStreamOptionsWatermark, nodeToJson, pNode->pWatermark);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddObject(pJson, jkStreamOptionsDeleteMark, nodeToJson, pNode->pDeleteMark);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddIntegerToObject(pJson, jkStreamOptionsFillHistory, pNode->fillHistory);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddIntegerToObject(pJson, jkStreamOptionsIgnoreExpired, pNode->ignoreExpired);
+ }
+
+ return code;
+}
+
+static int32_t jsonToStreamOptions(const SJson* pJson, void* pObj) {
+ SStreamOptions* pNode = (SStreamOptions*)pObj;
+
+ int32_t code = tjsonGetTinyIntValue(pJson, jkStreamOptionsTriggerType, &pNode->triggerType);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeObject(pJson, jkStreamOptionsDelay, &pNode->pDelay);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeObject(pJson, jkStreamOptionsWatermark, &pNode->pWatermark);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeObject(pJson, jkStreamOptionsDeleteMark, &pNode->pDeleteMark);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetTinyIntValue(pJson, jkStreamOptionsFillHistory, &pNode->fillHistory);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetTinyIntValue(pJson, jkStreamOptionsIgnoreExpired, &pNode->ignoreExpired);
+ }
+
+ return code;
+}
+
static const char* jkWhenThenWhen = "When";
static const char* jkWhenThenThen = "Then";
@@ -4512,6 +4778,38 @@ static int32_t jsonToVnodeModifyStmt(const SJson* pJson, void* pObj) {
return code;
}
+static const char* jkCreateDatabaseStmtDbName = "DbName";
+static const char* jkCreateDatabaseStmtIgnoreExists = "IgnoreExists";
+static const char* jkCreateDatabaseStmtOptions = "Options";
+
+static int32_t createDatabaseStmtToJson(const void* pObj, SJson* pJson) {
+ const SCreateDatabaseStmt* pNode = (const SCreateDatabaseStmt*)pObj;
+
+ int32_t code = tjsonAddStringToObject(pJson, jkCreateDatabaseStmtDbName, pNode->dbName);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddBoolToObject(pJson, jkCreateDatabaseStmtIgnoreExists, pNode->ignoreExists);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddObject(pJson, jkCreateDatabaseStmtOptions, nodeToJson, pNode->pOptions);
+ }
+
+ return code;
+}
+
+static int32_t jsonToCreateDatabaseStmt(const SJson* pJson, void* pObj) {
+ SCreateDatabaseStmt* pNode = (SCreateDatabaseStmt*)pObj;
+
+ int32_t code = tjsonGetStringValue(pJson, jkCreateDatabaseStmtDbName, pNode->dbName);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetBoolValue(pJson, jkCreateDatabaseStmtIgnoreExists, &pNode->ignoreExists);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeObject(pJson, jkCreateDatabaseStmtOptions, (SNode**)&pNode->pOptions);
+ }
+
+ return code;
+}
+
static const char* jkAlterDatabaseStmtDbName = "DbName";
static const char* jkAlterDatabaseStmtOptions = "Options";
@@ -4562,6 +4860,138 @@ static int32_t jsonToTrimDatabaseStmt(const SJson* pJson, void* pObj) {
return code;
}
+static const char* jkCreateTableStmtDbName = "DbName";
+static const char* jkCreateTableStmtTableName = "TableName";
+static const char* jkCreateTableStmtIgnoreExists = "IgnoreExists";
+static const char* jkCreateTableStmtCols = "Cols";
+static const char* jkCreateTableStmtTags = "Tags";
+static const char* jkCreateTableStmtOptions = "Options";
+
+static int32_t createTableStmtToJson(const void* pObj, SJson* pJson) {
+ const SCreateTableStmt* pNode = (const SCreateTableStmt*)pObj;
+
+ int32_t code = tjsonAddStringToObject(pJson, jkCreateTableStmtDbName, pNode->dbName);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddStringToObject(pJson, jkCreateTableStmtTableName, pNode->tableName);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddBoolToObject(pJson, jkCreateTableStmtIgnoreExists, pNode->ignoreExists);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = nodeListToJson(pJson, jkCreateTableStmtCols, pNode->pCols);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = nodeListToJson(pJson, jkCreateTableStmtTags, pNode->pTags);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddObject(pJson, jkCreateTableStmtOptions, nodeToJson, pNode->pOptions);
+ }
+
+ return code;
+}
+
+static int32_t jsonToCreateTableStmt(const SJson* pJson, void* pObj) {
+ SCreateTableStmt* pNode = (SCreateTableStmt*)pObj;
+
+ int32_t code = tjsonGetStringValue(pJson, jkCreateTableStmtDbName, pNode->dbName);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetStringValue(pJson, jkCreateTableStmtTableName, pNode->tableName);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetBoolValue(pJson, jkCreateTableStmtIgnoreExists, &pNode->ignoreExists);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeList(pJson, jkCreateTableStmtCols, &pNode->pCols);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeList(pJson, jkCreateTableStmtTags, &pNode->pTags);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeObject(pJson, jkCreateTableStmtOptions, (SNode**)&pNode->pOptions);
+ }
+
+ return code;
+}
+
+static const char* jkCreateSubTableClauseDbName = "DbName";
+static const char* jkCreateSubTableClauseTableName = "TableName";
+static const char* jkCreateSubTableClauseUseDbName = "UseDbName";
+static const char* jkCreateSubTableClauseUseTableName = "UseTableName";
+static const char* jkCreateSubTableClauseIgnoreExists = "IgnoreExists";
+static const char* jkCreateSubTableClauseSpecificTags = "SpecificTags";
+static const char* jkCreateSubTableClauseValsOfTags = "ValsOfTags";
+static const char* jkCreateSubTableClauseOptions = "Options";
+
+static int32_t createSubTableClauseToJson(const void* pObj, SJson* pJson) {
+ const SCreateSubTableClause* pNode = (const SCreateSubTableClause*)pObj;
+
+ int32_t code = tjsonAddStringToObject(pJson, jkCreateSubTableClauseDbName, pNode->dbName);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddStringToObject(pJson, jkCreateSubTableClauseTableName, pNode->tableName);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddStringToObject(pJson, jkCreateSubTableClauseUseDbName, pNode->useDbName);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddStringToObject(pJson, jkCreateSubTableClauseUseTableName, pNode->useTableName);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddBoolToObject(pJson, jkCreateSubTableClauseIgnoreExists, pNode->ignoreExists);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = nodeListToJson(pJson, jkCreateSubTableClauseSpecificTags, pNode->pSpecificTags);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = nodeListToJson(pJson, jkCreateSubTableClauseValsOfTags, pNode->pValsOfTags);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddObject(pJson, jkCreateSubTableClauseOptions, nodeToJson, pNode->pOptions);
+ }
+
+ return code;
+}
+
+static int32_t jsonToCreateSubTableClause(const SJson* pJson, void* pObj) {
+ SCreateSubTableClause* pNode = (SCreateSubTableClause*)pObj;
+
+ int32_t code = tjsonGetStringValue(pJson, jkCreateSubTableClauseDbName, pNode->dbName);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetStringValue(pJson, jkCreateSubTableClauseTableName, pNode->tableName);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetStringValue(pJson, jkCreateSubTableClauseUseDbName, pNode->useDbName);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetStringValue(pJson, jkCreateSubTableClauseUseTableName, pNode->useTableName);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetBoolValue(pJson, jkCreateSubTableClauseIgnoreExists, &pNode->ignoreExists);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeList(pJson, jkCreateSubTableClauseSpecificTags, &pNode->pSpecificTags);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeList(pJson, jkCreateSubTableClauseValsOfTags, &pNode->pValsOfTags);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeObject(pJson, jkCreateSubTableClauseOptions, (SNode**)&pNode->pOptions);
+ }
+
+ return code;
+}
+
+static const char* jkCreateMultiTablesStmtSubTables = "SubTables";
+
+static int32_t createMultiTablesStmtToJson(const void* pObj, SJson* pJson) {
+ const SCreateMultiTablesStmt* pNode = (const SCreateMultiTablesStmt*)pObj;
+ return nodeListToJson(pJson, jkCreateMultiTablesStmtSubTables, pNode->pSubTables);
+}
+
+static int32_t jsonToCreateMultiTablesStmt(const SJson* pJson, void* pObj) {
+ SCreateMultiTablesStmt* pNode = (SCreateMultiTablesStmt*)pObj;
+ return jsonToNodeList(pJson, jkCreateMultiTablesStmtSubTables, &pNode->pSubTables);
+}
+
static const char* jkDropTableClauseDbName = "DbName";
static const char* jkDropTableClauseTableName = "TableName";
static const char* jkDropTableClauseIgnoreNotExists = "IgnoreNotExists";
@@ -4705,23 +5135,105 @@ static int32_t jsonToAlterTableStmt(const SJson* pJson, void* pObj) {
return code;
}
-static const char* jkDropUserStmtUserName = "UserName";
+static int32_t alterStableStmtToJson(const void* pObj, SJson* pJson) { return alterTableStmtToJson(pObj, pJson); }
-static int32_t dropUserStmtToJson(const void* pObj, SJson* pJson) {
- const SDropUserStmt* pNode = (const SDropUserStmt*)pObj;
- return tjsonAddStringToObject(pJson, jkDropUserStmtUserName, pNode->userName);
-}
+static int32_t jsonToAlterStableStmt(const SJson* pJson, void* pObj) { return jsonToAlterTableStmt(pJson, pObj); }
-static int32_t jsonToDropUserStmt(const SJson* pJson, void* pObj) {
- SDropUserStmt* pNode = (SDropUserStmt*)pObj;
- return tjsonGetStringValue(pJson, jkDropUserStmtUserName, pNode->userName);
-}
+static const char* jkCreateUserStmtUserName = "UserName";
+static const char* jkCreateUserStmtPassword = "Password";
+static const char* jkCreateUserStmtSysinfo = "Sysinfo";
-static const char* jkUseDatabaseStmtDbName = "DbName";
+static int32_t createUserStmtToJson(const void* pObj, SJson* pJson) {
+ const SCreateUserStmt* pNode = (const SCreateUserStmt*)pObj;
-static int32_t useDatabaseStmtToJson(const void* pObj, SJson* pJson) {
- const SUseDatabaseStmt* pNode = (const SUseDatabaseStmt*)pObj;
- return tjsonAddStringToObject(pJson, jkUseDatabaseStmtDbName, pNode->dbName);
+ int32_t code = tjsonAddStringToObject(pJson, jkCreateUserStmtUserName, pNode->userName);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddStringToObject(pJson, jkCreateUserStmtPassword, pNode->password);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddIntegerToObject(pJson, jkCreateUserStmtSysinfo, pNode->sysinfo);
+ }
+
+ return code;
+}
+
+static int32_t jsonToCreateUserStmt(const SJson* pJson, void* pObj) {
+ SCreateUserStmt* pNode = (SCreateUserStmt*)pObj;
+
+ int32_t code = tjsonGetStringValue(pJson, jkCreateUserStmtUserName, pNode->userName);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetStringValue(pJson, jkCreateUserStmtPassword, pNode->password);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetTinyIntValue(pJson, jkCreateUserStmtSysinfo, &pNode->sysinfo);
+ }
+
+ return code;
+}
+
+static const char* jkAlterUserStmtUserName = "UserName";
+static const char* jkAlterUserStmtAlterType = "AlterType";
+static const char* jkAlterUserStmtPassword = "Password";
+static const char* jkAlterUserStmtEnable = "Enable";
+static const char* jkAlterUserStmtSysinfo = "Sysinfo";
+
+static int32_t alterUserStmtToJson(const void* pObj, SJson* pJson) {
+ const SAlterUserStmt* pNode = (const SAlterUserStmt*)pObj;
+
+ int32_t code = tjsonAddStringToObject(pJson, jkAlterUserStmtUserName, pNode->userName);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddIntegerToObject(pJson, jkAlterUserStmtAlterType, pNode->alterType);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddStringToObject(pJson, jkAlterUserStmtPassword, pNode->password);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddIntegerToObject(pJson, jkAlterUserStmtEnable, pNode->enable);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddIntegerToObject(pJson, jkAlterUserStmtSysinfo, pNode->sysinfo);
+ }
+
+ return code;
+}
+
+static int32_t jsonToAlterUserStmt(const SJson* pJson, void* pObj) {
+ SAlterUserStmt* pNode = (SAlterUserStmt*)pObj;
+
+ int32_t code = tjsonGetStringValue(pJson, jkAlterUserStmtUserName, pNode->userName);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetTinyIntValue(pJson, jkAlterUserStmtAlterType, &pNode->alterType);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetStringValue(pJson, jkAlterUserStmtPassword, pNode->password);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetTinyIntValue(pJson, jkAlterUserStmtEnable, &pNode->enable);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetTinyIntValue(pJson, jkAlterUserStmtSysinfo, &pNode->sysinfo);
+ }
+
+ return code;
+}
+
+static const char* jkDropUserStmtUserName = "UserName";
+
+static int32_t dropUserStmtToJson(const void* pObj, SJson* pJson) {
+ const SDropUserStmt* pNode = (const SDropUserStmt*)pObj;
+ return tjsonAddStringToObject(pJson, jkDropUserStmtUserName, pNode->userName);
+}
+
+static int32_t jsonToDropUserStmt(const SJson* pJson, void* pObj) {
+ SDropUserStmt* pNode = (SDropUserStmt*)pObj;
+ return tjsonGetStringValue(pJson, jkDropUserStmtUserName, pNode->userName);
+}
+
+static const char* jkUseDatabaseStmtDbName = "DbName";
+
+static int32_t useDatabaseStmtToJson(const void* pObj, SJson* pJson) {
+ const SUseDatabaseStmt* pNode = (const SUseDatabaseStmt*)pObj;
+ return tjsonAddStringToObject(pJson, jkUseDatabaseStmtDbName, pNode->dbName);
}
static int32_t jsonToUseDatabaseStmt(const SJson* pJson, void* pObj) {
@@ -4729,6 +5241,31 @@ static int32_t jsonToUseDatabaseStmt(const SJson* pJson, void* pObj) {
return tjsonGetStringValue(pJson, jkUseDatabaseStmtDbName, pNode->dbName);
}
+static const char* jkCreateDnodeStmtFqdn = "Fqdn";
+static const char* jkCreateDnodeStmtPort = "Port";
+
+static int32_t createDnodeStmtToJson(const void* pObj, SJson* pJson) {
+ const SCreateDnodeStmt* pNode = (const SCreateDnodeStmt*)pObj;
+
+ int32_t code = tjsonAddStringToObject(pJson, jkCreateDnodeStmtFqdn, pNode->fqdn);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddIntegerToObject(pJson, jkCreateDnodeStmtPort, pNode->port);
+ }
+
+ return code;
+}
+
+static int32_t jsonToCreateDnodeStmt(const SJson* pJson, void* pObj) {
+ SCreateDnodeStmt* pNode = (SCreateDnodeStmt*)pObj;
+
+ int32_t code = tjsonGetStringValue(pJson, jkCreateDnodeStmtFqdn, pNode->fqdn);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetIntValue(pJson, jkCreateDnodeStmtPort, &pNode->port);
+ }
+
+ return code;
+}
+
static const char* jkAlterDnodeStmtDnodeId = "DnodeId";
static const char* jkAlterDnodeStmtConfig = "Config";
static const char* jkAlterDnodeStmtValue = "Value";
@@ -4761,6 +5298,118 @@ static int32_t jsonToAlterDnodeStmt(const SJson* pJson, void* pObj) {
return code;
}
+static const char* jkCreateIndexStmtIndexType = "IndexType";
+static const char* jkCreateIndexStmtIgnoreExists = "IgnoreExists";
+static const char* jkCreateIndexStmtIndexDbName = "IndexDbName";
+static const char* jkCreateIndexStmtIndexName = "indexName";
+static const char* jkCreateIndexStmtDbName = "DbName";
+static const char* jkCreateIndexStmtTableName = "TableName";
+static const char* jkCreateIndexStmtCols = "Cols";
+static const char* jkCreateIndexStmtOptions = "Options";
+
+static int32_t createIndexStmtToJson(const void* pObj, SJson* pJson) {
+ const SCreateIndexStmt* pNode = (const SCreateIndexStmt*)pObj;
+
+ int32_t code = tjsonAddIntegerToObject(pJson, jkCreateIndexStmtIndexType, pNode->indexType);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddBoolToObject(pJson, jkCreateIndexStmtIgnoreExists, pNode->ignoreExists);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddStringToObject(pJson, jkCreateIndexStmtIndexDbName, pNode->indexDbName);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddStringToObject(pJson, jkCreateIndexStmtIndexName, pNode->indexName);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddStringToObject(pJson, jkCreateIndexStmtDbName, pNode->dbName);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddStringToObject(pJson, jkCreateIndexStmtTableName, pNode->tableName);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = nodeListToJson(pJson, jkCreateIndexStmtCols, pNode->pCols);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddObject(pJson, jkCreateIndexStmtOptions, nodeToJson, pNode->pOptions);
+ }
+
+ return code;
+}
+
+static int32_t jsonToCreateIndexStmt(const SJson* pJson, void* pObj) {
+ SCreateIndexStmt* pNode = (SCreateIndexStmt*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ tjsonGetNumberValue(pJson, jkCreateIndexStmtIndexType, pNode->indexType, code);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetBoolValue(pJson, jkCreateIndexStmtIgnoreExists, &pNode->ignoreExists);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetStringValue(pJson, jkCreateIndexStmtIndexDbName, pNode->indexDbName);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetStringValue(pJson, jkCreateIndexStmtIndexName, pNode->indexName);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetStringValue(pJson, jkCreateIndexStmtDbName, pNode->dbName);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetStringValue(pJson, jkCreateIndexStmtTableName, pNode->tableName);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeList(pJson, jkCreateIndexStmtCols, &pNode->pCols);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeObject(pJson, jkCreateIndexStmtOptions, (SNode**)&pNode->pOptions);
+ }
+
+ return code;
+}
+
+static const char* jkDropIndexStmtIgnoreNotExists = "IgnoreNotExists";
+static const char* jkDropIndexStmtIndexDbName = "IndexDbName";
+static const char* jkDropIndexStmtIndexName = "IndexName";
+
+static int32_t dropIndexStmtToJson(const void* pObj, SJson* pJson) {
+ const SDropIndexStmt* pNode = (const SDropIndexStmt*)pObj;
+
+ int32_t code = tjsonAddBoolToObject(pJson, jkDropIndexStmtIgnoreNotExists, pNode->ignoreNotExists);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddStringToObject(pJson, jkDropIndexStmtIndexDbName, pNode->indexDbName);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddStringToObject(pJson, jkDropIndexStmtIndexName, pNode->indexName);
+ }
+
+ return code;
+}
+
+static int32_t jsonToDropIndexStmt(const SJson* pJson, void* pObj) {
+ SDropIndexStmt* pNode = (SDropIndexStmt*)pObj;
+
+ int32_t code = tjsonGetBoolValue(pJson, jkDropIndexStmtIgnoreNotExists, &pNode->ignoreNotExists);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetStringValue(pJson, jkDropIndexStmtIndexDbName, pNode->indexDbName);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetStringValue(pJson, jkDropIndexStmtIndexName, pNode->indexName);
+ }
+
+ return code;
+}
+
+static const char* jkCreateComponentNodeStmtDnodeId = "DnodeId";
+
+static int32_t createComponentNodeStmtToJson(const void* pObj, SJson* pJson) {
+ const SCreateComponentNodeStmt* pNode = (const SCreateComponentNodeStmt*)pObj;
+ return tjsonAddIntegerToObject(pJson, jkCreateComponentNodeStmtDnodeId, pNode->dnodeId);
+}
+
+static int32_t jsonToCreateComponentNodeStmt(const SJson* pJson, void* pObj) {
+ SCreateComponentNodeStmt* pNode = (SCreateComponentNodeStmt*)pObj;
+ return tjsonGetIntValue(pJson, jkCreateComponentNodeStmtDnodeId, &pNode->dnodeId);
+}
+
static const char* jkDropComponentNodeStmtDnodeId = "DnodeId";
static int32_t dropComponentNodeStmtToJson(const void* pObj, SJson* pJson) {
@@ -4773,14 +5422,38 @@ static int32_t jsonToDropComponentNodeStmt(const SJson* pJson, void* pObj) {
return tjsonGetIntValue(pJson, jkDropComponentNodeStmtDnodeId, &pNode->dnodeId);
}
+static int32_t createQnodeStmtToJson(const void* pObj, SJson* pJson) {
+ return createComponentNodeStmtToJson(pObj, pJson);
+}
+
+static int32_t jsonToCreateQnodeStmt(const SJson* pJson, void* pObj) {
+ return jsonToCreateComponentNodeStmt(pJson, pObj);
+}
+
static int32_t dropQnodeStmtToJson(const void* pObj, SJson* pJson) { return dropComponentNodeStmtToJson(pObj, pJson); }
static int32_t jsonToDropQnodeStmt(const SJson* pJson, void* pObj) { return jsonToDropComponentNodeStmt(pJson, pObj); }
+static int32_t createSnodeStmtToJson(const void* pObj, SJson* pJson) {
+ return createComponentNodeStmtToJson(pObj, pJson);
+}
+
+static int32_t jsonToCreateSnodeStmt(const SJson* pJson, void* pObj) {
+ return jsonToCreateComponentNodeStmt(pJson, pObj);
+}
+
static int32_t dropSnodeStmtToJson(const void* pObj, SJson* pJson) { return dropComponentNodeStmtToJson(pObj, pJson); }
static int32_t jsonToDropSnodeStmt(const SJson* pJson, void* pObj) { return jsonToDropComponentNodeStmt(pJson, pObj); }
+static int32_t createMnodeStmtToJson(const void* pObj, SJson* pJson) {
+ return createComponentNodeStmtToJson(pObj, pJson);
+}
+
+static int32_t jsonToCreateMnodeStmt(const SJson* pJson, void* pObj) {
+ return jsonToCreateComponentNodeStmt(pJson, pObj);
+}
+
static int32_t dropMnodeStmtToJson(const void* pObj, SJson* pJson) { return dropComponentNodeStmtToJson(pObj, pJson); }
static int32_t jsonToDropMnodeStmt(const SJson* pJson, void* pObj) { return jsonToDropComponentNodeStmt(pJson, pObj); }
@@ -4888,6 +5561,187 @@ static int32_t jsonToDropTopicStmt(const SJson* pJson, void* pObj) {
return code;
}
+static const char* jkDropCGroupStmtTopicName = "TopicName";
+static const char* jkDropCGroupStmtConsumerGroup = "ConsumerGroup";
+static const char* jkDropCGroupStmtIgnoreNotExists = "IgnoreNotExists";
+
+static int32_t dropConsumerGroupStmtToJson(const void* pObj, SJson* pJson) {
+ const SDropCGroupStmt* pNode = (const SDropCGroupStmt*)pObj;
+
+ int32_t code = tjsonAddStringToObject(pJson, jkDropCGroupStmtTopicName, pNode->topicName);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddStringToObject(pJson, jkDropCGroupStmtConsumerGroup, pNode->cgroup);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddBoolToObject(pJson, jkDropCGroupStmtIgnoreNotExists, pNode->ignoreNotExists);
+ }
+
+ return code;
+}
+
+static int32_t jsonToDropConsumerGroupStmt(const SJson* pJson, void* pObj) {
+ SDropCGroupStmt* pNode = (SDropCGroupStmt*)pObj;
+
+ int32_t code = tjsonGetStringValue(pJson, jkDropCGroupStmtTopicName, pNode->topicName);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetStringValue(pJson, jkDropCGroupStmtConsumerGroup, pNode->cgroup);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetBoolValue(pJson, jkDropCGroupStmtIgnoreNotExists, &pNode->ignoreNotExists);
+ }
+
+ return code;
+}
+
+static const char* jkAlterLocalStmtConfig = "Config";
+static const char* jkAlterLocalStmtValue = "Value";
+
+static int32_t alterLocalStmtToJson(const void* pObj, SJson* pJson) {
+ const SAlterLocalStmt* pNode = (const SAlterLocalStmt*)pObj;
+
+ int32_t code = tjsonAddStringToObject(pJson, jkAlterLocalStmtConfig, pNode->config);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddStringToObject(pJson, jkAlterLocalStmtValue, pNode->value);
+ }
+
+ return code;
+}
+
+static int32_t jsonToAlterLocalStmt(const SJson* pJson, void* pObj) {
+ SAlterLocalStmt* pNode = (SAlterLocalStmt*)pObj;
+
+ int32_t code = tjsonGetStringValue(pJson, jkAlterLocalStmtConfig, pNode->config);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetStringValue(pJson, jkAlterLocalStmtValue, pNode->value);
+ }
+
+ return code;
+}
+
+static const char* jkExplainStmtAnalyze = "Analyze";
+static const char* jkExplainStmtOptions = "Options";
+static const char* jkExplainStmtQuery = "Query";
+
+static int32_t explainStmtToJson(const void* pObj, SJson* pJson) {
+ const SExplainStmt* pNode = (const SExplainStmt*)pObj;
+
+ int32_t code = tjsonAddBoolToObject(pJson, jkExplainStmtAnalyze, pNode->analyze);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddObject(pJson, jkExplainStmtOptions, nodeToJson, pNode->pOptions);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddObject(pJson, jkExplainStmtQuery, nodeToJson, pNode->pQuery);
+ }
+
+ return code;
+}
+
+static int32_t jsonToExplainStmt(const SJson* pJson, void* pObj) {
+ SExplainStmt* pNode = (SExplainStmt*)pObj;
+
+ int32_t code = tjsonGetBoolValue(pJson, jkExplainStmtAnalyze, &pNode->analyze);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeObject(pJson, jkExplainStmtOptions, (SNode**)&pNode->pOptions);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeObject(pJson, jkExplainStmtQuery, &pNode->pQuery);
+ }
+
+ return code;
+}
+
+static const char* jkDescribeStmtDbName = "DbName";
+static const char* jkDescribeStmtTableName = "TableName";
+
+static int32_t describeStmtToJson(const void* pObj, SJson* pJson) {
+ const SDescribeStmt* pNode = (const SDescribeStmt*)pObj;
+
+ int32_t code = tjsonAddStringToObject(pJson, jkDescribeStmtDbName, pNode->dbName);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddStringToObject(pJson, jkDescribeStmtTableName, pNode->tableName);
+ }
+
+ return code;
+}
+
+static int32_t jsonToDescribeStmt(const SJson* pJson, void* pObj) {
+ SDescribeStmt* pNode = (SDescribeStmt*)pObj;
+
+ int32_t code = tjsonGetStringValue(pJson, jkDescribeStmtDbName, pNode->dbName);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetStringValue(pJson, jkDescribeStmtTableName, pNode->tableName);
+ }
+
+ return code;
+}
+
+static const char* jkCreateStreamStmtStreamName = "StreamName";
+static const char* jkCreateStreamStmtTargetDbName = "TargetDbName";
+static const char* jkCreateStreamStmtTargetTabName = "TargetTabName";
+static const char* jkCreateStreamStmtIgnoreExists = "IgnoreExists";
+static const char* jkCreateStreamStmtOptions = "Options";
+static const char* jkCreateStreamStmtQuery = "Query";
+static const char* jkCreateStreamStmtTags = "Tags";
+static const char* jkCreateStreamStmtSubtable = "Subtable";
+
+static int32_t createStreamStmtToJson(const void* pObj, SJson* pJson) {
+ const SCreateStreamStmt* pNode = (const SCreateStreamStmt*)pObj;
+
+ int32_t code = tjsonAddStringToObject(pJson, jkCreateStreamStmtStreamName, pNode->streamName);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddStringToObject(pJson, jkCreateStreamStmtTargetDbName, pNode->targetDbName);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddStringToObject(pJson, jkCreateStreamStmtTargetTabName, pNode->targetTabName);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddBoolToObject(pJson, jkCreateStreamStmtIgnoreExists, pNode->ignoreExists);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddObject(pJson, jkCreateStreamStmtOptions, nodeToJson, pNode->pOptions);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddObject(pJson, jkCreateStreamStmtQuery, nodeToJson, pNode->pQuery);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = nodeListToJson(pJson, jkCreateStreamStmtTags, pNode->pTags);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddObject(pJson, jkCreateStreamStmtSubtable, nodeToJson, pNode->pSubtable);
+ }
+
+ return code;
+}
+
+static int32_t jsonToCreateStreamStmt(const SJson* pJson, void* pObj) {
+ SCreateStreamStmt* pNode = (SCreateStreamStmt*)pObj;
+
+ int32_t code = tjsonGetStringValue(pJson, jkCreateStreamStmtStreamName, pNode->streamName);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetStringValue(pJson, jkCreateStreamStmtTargetDbName, pNode->targetDbName);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetStringValue(pJson, jkCreateStreamStmtTargetTabName, pNode->targetTabName);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetBoolValue(pJson, jkCreateStreamStmtIgnoreExists, &pNode->ignoreExists);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeObject(pJson, jkCreateStreamStmtOptions, (SNode**)&pNode->pOptions);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeObject(pJson, jkCreateStreamStmtQuery, &pNode->pQuery);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeList(pJson, jkCreateStreamStmtTags, &pNode->pTags);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeObject(pJson, jkCreateStreamStmtSubtable, &pNode->pSubtable);
+ }
+
+ return code;
+}
+
static const char* jkDropStreamStmtStreamName = "StreamName";
static const char* jkDropStreamStmtIgnoreNotExists = "IgnoreNotExists";
@@ -4913,6 +5767,77 @@ static int32_t jsonToDropStreamStmt(const SJson* pJson, void* pObj) {
return code;
}
+static const char* jkMergeVgroupStmtVgroupId1 = "VgroupId1";
+static const char* jkMergeVgroupStmtVgroupId2 = "VgroupId2";
+
+static int32_t mergeVgroupStmtToJson(const void* pObj, SJson* pJson) {
+ const SMergeVgroupStmt* pNode = (const SMergeVgroupStmt*)pObj;
+
+ int32_t code = tjsonAddIntegerToObject(pJson, jkMergeVgroupStmtVgroupId1, pNode->vgId1);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddIntegerToObject(pJson, jkMergeVgroupStmtVgroupId2, pNode->vgId2);
+ }
+
+ return code;
+}
+
+static int32_t jsonToMergeVgroupStmt(const SJson* pJson, void* pObj) {
+ SMergeVgroupStmt* pNode = (SMergeVgroupStmt*)pObj;
+
+ int32_t code = tjsonGetIntValue(pJson, jkMergeVgroupStmtVgroupId1, &pNode->vgId1);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetIntValue(pJson, jkMergeVgroupStmtVgroupId2, &pNode->vgId2);
+ }
+
+ return code;
+}
+
+static const char* jkRedistributeVgroupStmtVgroupId = "VgroupId";
+static const char* jkRedistributeVgroupStmtDnodeId1 = "DnodeId1";
+static const char* jkRedistributeVgroupStmtDnodeId2 = "DnodeId2";
+static const char* jkRedistributeVgroupStmtDnodeId3 = "DnodeId3";
+static const char* jkRedistributeVgroupStmtDnodes = "Dnodes";
+
+static int32_t redistributeVgroupStmtToJson(const void* pObj, SJson* pJson) {
+ const SRedistributeVgroupStmt* pNode = (const SRedistributeVgroupStmt*)pObj;
+
+ int32_t code = tjsonAddIntegerToObject(pJson, jkRedistributeVgroupStmtVgroupId, pNode->vgId);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddIntegerToObject(pJson, jkRedistributeVgroupStmtDnodeId1, pNode->dnodeId1);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddIntegerToObject(pJson, jkRedistributeVgroupStmtDnodeId2, pNode->dnodeId2);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddIntegerToObject(pJson, jkRedistributeVgroupStmtDnodeId3, pNode->dnodeId3);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = nodeListToJson(pJson, jkRedistributeVgroupStmtDnodes, pNode->pDnodes);
+ }
+
+ return code;
+}
+
+static int32_t jsonToRedistributeVgroupStmt(const SJson* pJson, void* pObj) {
+ SRedistributeVgroupStmt* pNode = (SRedistributeVgroupStmt*)pObj;
+
+ int32_t code = tjsonGetIntValue(pJson, jkRedistributeVgroupStmtVgroupId, &pNode->vgId);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetIntValue(pJson, jkRedistributeVgroupStmtDnodeId1, &pNode->dnodeId1);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetIntValue(pJson, jkRedistributeVgroupStmtDnodeId2, &pNode->dnodeId2);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetIntValue(pJson, jkRedistributeVgroupStmtDnodeId3, &pNode->dnodeId3);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeList(pJson, jkRedistributeVgroupStmtDnodes, &pNode->pDnodes);
+ }
+
+ return code;
+}
+
static const char* jkSplitVgroupStmtVgroupId = "VgroupId";
static int32_t splitVgroupStmtToJson(const void* pObj, SJson* pJson) {
@@ -4925,6 +5850,42 @@ static int32_t jsonToSplitVgroupStmt(const SJson* pJson, void* pObj) {
return tjsonGetIntValue(pJson, jkSplitVgroupStmtVgroupId, &pNode->vgId);
}
+static const char* jkGrantStmtUserName = "UserName";
+static const char* jkGrantStmtObjName = "ObjName";
+static const char* jkGrantStmtPrivileges = "Privileges";
+
+static int32_t grantStmtToJson(const void* pObj, SJson* pJson) {
+ const SGrantStmt* pNode = (const SGrantStmt*)pObj;
+
+ int32_t code = tjsonAddStringToObject(pJson, jkGrantStmtUserName, pNode->userName);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddStringToObject(pJson, jkGrantStmtObjName, pNode->objName);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddIntegerToObject(pJson, jkGrantStmtPrivileges, pNode->privileges);
+ }
+
+ return code;
+}
+
+static int32_t jsonToGrantStmt(const SJson* pJson, void* pObj) {
+ SGrantStmt* pNode = (SGrantStmt*)pObj;
+
+ int32_t code = tjsonGetStringValue(pJson, jkGrantStmtUserName, pNode->userName);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetStringValue(pJson, jkGrantStmtObjName, pNode->objName);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetBigIntValue(pJson, jkGrantStmtPrivileges, &pNode->privileges);
+ }
+
+ return code;
+}
+
+static int32_t revokeStmtToJson(const void* pObj, SJson* pJson) { return grantStmtToJson(pObj, pJson); }
+
+static int32_t jsonToRevokeStmt(const SJson* pJson, void* pObj) { return jsonToGrantStmt(pJson, pObj); }
+
static const char* jkShowStmtDbName = "DbName";
static const char* jkShowStmtTbName = "TbName";
static const char* jkShowStmtTableCondType = "TableCondType";
@@ -5252,6 +6213,45 @@ static int32_t jsonToDeleteStmt(const SJson* pJson, void* pObj) {
return code;
}
+static const char* jkInsertStmtTable = "Table";
+static const char* jkInsertStmtCols = "Cols";
+static const char* jkInsertStmtQuery = "Query";
+static const char* jkInsertStmtPrecision = "Precision";
+
+static int32_t insertStmtToJson(const void* pObj, SJson* pJson) {
+ const SInsertStmt* pNode = (const SInsertStmt*)pObj;
+
+ int32_t code = tjsonAddObject(pJson, jkInsertStmtTable, nodeToJson, pNode->pTable);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = nodeListToJson(pJson, jkInsertStmtCols, pNode->pCols);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddObject(pJson, jkInsertStmtQuery, nodeToJson, pNode->pQuery);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddIntegerToObject(pJson, jkInsertStmtPrecision, pNode->precision);
+ }
+
+ return code;
+}
+
+static int32_t jsonToInsertStmt(const SJson* pJson, void* pObj) {
+ SInsertStmt* pNode = (SInsertStmt*)pObj;
+
+ int32_t code = jsonToNodeObject(pJson, jkInsertStmtTable, &pNode->pTable);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeList(pJson, jkInsertStmtCols, &pNode->pCols);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeObject(pJson, jkInsertStmtQuery, &pNode->pQuery);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetUTinyIntValue(pJson, jkInsertStmtPrecision, &pNode->precision);
+ }
+
+ return code;
+}
+
static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
switch (nodeType(pObj)) {
case QUERY_NODE_COLUMN:
@@ -5295,11 +6295,19 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
case QUERY_NODE_SLOT_DESC:
return slotDescNodeToJson(pObj, pJson);
case QUERY_NODE_COLUMN_DEF:
- break;
+ return columnDefNodeToJson(pObj, pJson);
case QUERY_NODE_DOWNSTREAM_SOURCE:
return downstreamSourceNodeToJson(pObj, pJson);
case QUERY_NODE_DATABASE_OPTIONS:
return databaseOptionsToJson(pObj, pJson);
+ case QUERY_NODE_TABLE_OPTIONS:
+ return tableOptionsToJson(pObj, pJson);
+ case QUERY_NODE_INDEX_OPTIONS:
+ return indexOptionsToJson(pObj, pJson);
+ case QUERY_NODE_EXPLAIN_OPTIONS:
+ return explainOptionsToJson(pObj, pJson);
+ case QUERY_NODE_STREAM_OPTIONS:
+ return streamOptionsToJson(pObj, pJson);
case QUERY_NODE_LEFT_VALUE:
return TSDB_CODE_SUCCESS; // SLeftValueNode has no fields to serialize.
case QUERY_NODE_WHEN_THEN:
@@ -5315,13 +6323,17 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
case QUERY_NODE_VNODE_MODIFY_STMT:
return vnodeModifyStmtToJson(pObj, pJson);
case QUERY_NODE_CREATE_DATABASE_STMT:
- break;
+ return createDatabaseStmtToJson(pObj, pJson);
case QUERY_NODE_ALTER_DATABASE_STMT:
return alterDatabaseStmtToJson(pObj, pJson);
case QUERY_NODE_TRIM_DATABASE_STMT:
return trimDatabaseStmtToJson(pObj, pJson);
case QUERY_NODE_CREATE_TABLE_STMT:
- break;
+ return createTableStmtToJson(pObj, pJson);
+ case QUERY_NODE_CREATE_SUBTABLE_CLAUSE:
+ return createSubTableClauseToJson(pObj, pJson);
+ case QUERY_NODE_CREATE_MULTI_TABLES_STMT:
+ return createMultiTablesStmtToJson(pObj, pJson);
case QUERY_NODE_DROP_TABLE_CLAUSE:
return dropTableClauseToJson(pObj, pJson);
case QUERY_NODE_DROP_TABLE_STMT:
@@ -5330,28 +6342,66 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
return dropStableStmtToJson(pObj, pJson);
case QUERY_NODE_ALTER_TABLE_STMT:
return alterTableStmtToJson(pObj, pJson);
+ case QUERY_NODE_ALTER_SUPER_TABLE_STMT:
+ return alterStableStmtToJson(pObj, pJson);
+ case QUERY_NODE_CREATE_USER_STMT:
+ return createUserStmtToJson(pObj, pJson);
+ case QUERY_NODE_ALTER_USER_STMT:
+ return alterUserStmtToJson(pObj, pJson);
case QUERY_NODE_DROP_USER_STMT:
return dropUserStmtToJson(pObj, pJson);
case QUERY_NODE_USE_DATABASE_STMT:
return useDatabaseStmtToJson(pObj, pJson);
+ case QUERY_NODE_CREATE_DNODE_STMT:
+ return createDnodeStmtToJson(pObj, pJson);
case QUERY_NODE_DROP_DNODE_STMT:
return dropDnodeStmtToJson(pObj, pJson);
case QUERY_NODE_ALTER_DNODE_STMT:
return alterDnodeStmtToJson(pObj, pJson);
+ case QUERY_NODE_CREATE_INDEX_STMT:
+ return createIndexStmtToJson(pObj, pJson);
+ case QUERY_NODE_DROP_INDEX_STMT:
+ return dropIndexStmtToJson(pObj, pJson);
+ case QUERY_NODE_CREATE_QNODE_STMT:
+ return createQnodeStmtToJson(pObj, pJson);
case QUERY_NODE_DROP_QNODE_STMT:
return dropQnodeStmtToJson(pObj, pJson);
+ case QUERY_NODE_CREATE_SNODE_STMT:
+ return createSnodeStmtToJson(pObj, pJson);
case QUERY_NODE_DROP_SNODE_STMT:
return dropSnodeStmtToJson(pObj, pJson);
+ case QUERY_NODE_CREATE_MNODE_STMT:
+ return createMnodeStmtToJson(pObj, pJson);
case QUERY_NODE_DROP_MNODE_STMT:
return dropMnodeStmtToJson(pObj, pJson);
case QUERY_NODE_CREATE_TOPIC_STMT:
return createTopicStmtToJson(pObj, pJson);
case QUERY_NODE_DROP_TOPIC_STMT:
return dropTopicStmtToJson(pObj, pJson);
+ case QUERY_NODE_DROP_CGROUP_STMT:
+ return dropConsumerGroupStmtToJson(pObj, pJson);
+ case QUERY_NODE_ALTER_LOCAL_STMT:
+ return alterLocalStmtToJson(pObj, pJson);
+ case QUERY_NODE_EXPLAIN_STMT:
+ return explainStmtToJson(pObj, pJson);
+ case QUERY_NODE_DESCRIBE_STMT:
+ return describeStmtToJson(pObj, pJson);
+ case QUERY_NODE_CREATE_STREAM_STMT:
+ return createStreamStmtToJson(pObj, pJson);
case QUERY_NODE_DROP_STREAM_STMT:
return dropStreamStmtToJson(pObj, pJson);
+ case QUERY_NODE_BALANCE_VGROUP_STMT:
+ return TSDB_CODE_SUCCESS; // SBalanceVgroupStmt has no fields to serialize.
+ case QUERY_NODE_MERGE_VGROUP_STMT:
+ return mergeVgroupStmtToJson(pObj, pJson);
+ case QUERY_NODE_REDISTRIBUTE_VGROUP_STMT:
+ return redistributeVgroupStmtToJson(pObj, pJson);
case QUERY_NODE_SPLIT_VGROUP_STMT:
return splitVgroupStmtToJson(pObj, pJson);
+ case QUERY_NODE_GRANT_STMT:
+ return grantStmtToJson(pObj, pJson);
+ case QUERY_NODE_REVOKE_STMT:
+ return revokeStmtToJson(pObj, pJson);
case QUERY_NODE_SHOW_DNODES_STMT:
return showDnodesStmtToJson(pObj, pJson);
case QUERY_NODE_SHOW_MNODES_STMT:
@@ -5406,6 +6456,8 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
return showTableTagsStmtToJson(pObj, pJson);
case QUERY_NODE_DELETE_STMT:
return deleteStmtToJson(pObj, pJson);
+ case QUERY_NODE_INSERT_STMT:
+ return insertStmtToJson(pObj, pJson);
case QUERY_NODE_LOGIC_PLAN_SCAN:
return logicScanNodeToJson(pObj, pJson);
case QUERY_NODE_LOGIC_PLAN_JOIN:
@@ -5548,10 +6600,20 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
return jsonToDataBlockDescNode(pJson, pObj);
case QUERY_NODE_SLOT_DESC:
return jsonToSlotDescNode(pJson, pObj);
+ case QUERY_NODE_COLUMN_DEF:
+ return jsonToColumnDefNode(pJson, pObj);
case QUERY_NODE_DOWNSTREAM_SOURCE:
return jsonToDownstreamSourceNode(pJson, pObj);
case QUERY_NODE_DATABASE_OPTIONS:
return jsonToDatabaseOptions(pJson, pObj);
+ case QUERY_NODE_TABLE_OPTIONS:
+ return jsonToTableOptions(pJson, pObj);
+ case QUERY_NODE_INDEX_OPTIONS:
+ return jsonToIndexOptions(pJson, pObj);
+ case QUERY_NODE_EXPLAIN_OPTIONS:
+ return jsonToExplainOptions(pJson, pObj);
+ case QUERY_NODE_STREAM_OPTIONS:
+ return jsonToStreamOptions(pJson, pObj);
case QUERY_NODE_LEFT_VALUE:
return TSDB_CODE_SUCCESS; // SLeftValueNode has no fields to deserialize.
case QUERY_NODE_WHEN_THEN:
@@ -5566,10 +6628,18 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
return jsonToSelectStmt(pJson, pObj);
case QUERY_NODE_VNODE_MODIFY_STMT:
return jsonToVnodeModifyStmt(pJson, pObj);
+ case QUERY_NODE_CREATE_DATABASE_STMT:
+ return jsonToCreateDatabaseStmt(pJson, pObj);
case QUERY_NODE_ALTER_DATABASE_STMT:
return jsonToAlterDatabaseStmt(pJson, pObj);
case QUERY_NODE_TRIM_DATABASE_STMT:
return jsonToTrimDatabaseStmt(pJson, pObj);
+ case QUERY_NODE_CREATE_TABLE_STMT:
+ return jsonToCreateTableStmt(pJson, pObj);
+ case QUERY_NODE_CREATE_SUBTABLE_CLAUSE:
+ return jsonToCreateSubTableClause(pJson, pObj);
+ case QUERY_NODE_CREATE_MULTI_TABLES_STMT:
+ return jsonToCreateMultiTablesStmt(pJson, pObj);
case QUERY_NODE_DROP_TABLE_CLAUSE:
return jsonToDropTableClause(pJson, pObj);
case QUERY_NODE_DROP_TABLE_STMT:
@@ -5578,28 +6648,66 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
return jsonToDropStableStmt(pJson, pObj);
case QUERY_NODE_ALTER_TABLE_STMT:
return jsonToAlterTableStmt(pJson, pObj);
+ case QUERY_NODE_ALTER_SUPER_TABLE_STMT:
+ return jsonToAlterStableStmt(pJson, pObj);
+ case QUERY_NODE_CREATE_USER_STMT:
+ return jsonToCreateUserStmt(pJson, pObj);
+ case QUERY_NODE_ALTER_USER_STMT:
+ return jsonToAlterUserStmt(pJson, pObj);
case QUERY_NODE_DROP_USER_STMT:
return jsonToDropUserStmt(pJson, pObj);
case QUERY_NODE_USE_DATABASE_STMT:
return jsonToUseDatabaseStmt(pJson, pObj);
+ case QUERY_NODE_CREATE_DNODE_STMT:
+ return jsonToCreateDnodeStmt(pJson, pObj);
case QUERY_NODE_DROP_DNODE_STMT:
return jsonToDropDnodeStmt(pJson, pObj);
case QUERY_NODE_ALTER_DNODE_STMT:
return jsonToAlterDnodeStmt(pJson, pObj);
+ case QUERY_NODE_CREATE_INDEX_STMT:
+ return jsonToCreateIndexStmt(pJson, pObj);
+ case QUERY_NODE_DROP_INDEX_STMT:
+ return jsonToDropIndexStmt(pJson, pObj);
+ case QUERY_NODE_CREATE_QNODE_STMT:
+ return jsonToCreateQnodeStmt(pJson, pObj);
case QUERY_NODE_DROP_QNODE_STMT:
return jsonToDropQnodeStmt(pJson, pObj);
+ case QUERY_NODE_CREATE_SNODE_STMT:
+ return jsonToCreateSnodeStmt(pJson, pObj);
case QUERY_NODE_DROP_SNODE_STMT:
return jsonToDropSnodeStmt(pJson, pObj);
+ case QUERY_NODE_CREATE_MNODE_STMT:
+ return jsonToCreateMnodeStmt(pJson, pObj);
case QUERY_NODE_DROP_MNODE_STMT:
return jsonToDropMnodeStmt(pJson, pObj);
case QUERY_NODE_CREATE_TOPIC_STMT:
return jsonToCreateTopicStmt(pJson, pObj);
case QUERY_NODE_DROP_TOPIC_STMT:
return jsonToDropTopicStmt(pJson, pObj);
+ case QUERY_NODE_DROP_CGROUP_STMT:
+ return jsonToDropConsumerGroupStmt(pJson, pObj);
+ case QUERY_NODE_ALTER_LOCAL_STMT:
+ return jsonToAlterLocalStmt(pJson, pObj);
+ case QUERY_NODE_EXPLAIN_STMT:
+ return jsonToExplainStmt(pJson, pObj);
+ case QUERY_NODE_DESCRIBE_STMT:
+ return jsonToDescribeStmt(pJson, pObj);
+ case QUERY_NODE_CREATE_STREAM_STMT:
+ return jsonToCreateStreamStmt(pJson, pObj);
case QUERY_NODE_DROP_STREAM_STMT:
return jsonToDropStreamStmt(pJson, pObj);
+ case QUERY_NODE_BALANCE_VGROUP_STMT:
+ return TSDB_CODE_SUCCESS; // SBalanceVgroupStmt has no fields to deserialize.
+ case QUERY_NODE_MERGE_VGROUP_STMT:
+ return jsonToMergeVgroupStmt(pJson, pObj);
+ case QUERY_NODE_REDISTRIBUTE_VGROUP_STMT:
+ return jsonToRedistributeVgroupStmt(pJson, pObj);
case QUERY_NODE_SPLIT_VGROUP_STMT:
return jsonToSplitVgroupStmt(pJson, pObj);
+ case QUERY_NODE_GRANT_STMT:
+ return jsonToGrantStmt(pJson, pObj);
+ case QUERY_NODE_REVOKE_STMT:
+ return jsonToRevokeStmt(pJson, pObj);
case QUERY_NODE_SHOW_DNODES_STMT:
return jsonToShowDnodesStmt(pJson, pObj);
case QUERY_NODE_SHOW_MNODES_STMT:
@@ -5654,8 +6762,12 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
return jsonToShowTableTagsStmt(pJson, pObj);
case QUERY_NODE_DELETE_STMT:
return jsonToDeleteStmt(pJson, pObj);
+ case QUERY_NODE_INSERT_STMT:
+ return jsonToInsertStmt(pJson, pObj);
case QUERY_NODE_LOGIC_PLAN_SCAN:
return jsonToLogicScanNode(pJson, pObj);
+ case QUERY_NODE_LOGIC_PLAN_JOIN:
+ return jsonToLogicJoinNode(pJson, pObj);
case QUERY_NODE_LOGIC_PLAN_AGG:
return jsonToLogicAggNode(pJson, pObj);
case QUERY_NODE_LOGIC_PLAN_PROJECT:
diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c
index 198127278545878c3f669a371046e11e579bf811..38203e61b0c95dfabcb8aa8d1a5f05bb73daa26b 100644
--- a/source/libs/nodes/src/nodesUtilFuncs.c
+++ b/source/libs/nodes/src/nodesUtilFuncs.c
@@ -321,8 +321,8 @@ SNode* nodesMakeNode(ENodeType type) {
return makeNode(type, sizeof(SCreateTableStmt));
case QUERY_NODE_CREATE_SUBTABLE_CLAUSE:
return makeNode(type, sizeof(SCreateSubTableClause));
- case QUERY_NODE_CREATE_MULTI_TABLE_STMT:
- return makeNode(type, sizeof(SCreateMultiTableStmt));
+ case QUERY_NODE_CREATE_MULTI_TABLES_STMT:
+ return makeNode(type, sizeof(SCreateMultiTablesStmt));
case QUERY_NODE_DROP_TABLE_CLAUSE:
return makeNode(type, sizeof(SDropTableClause));
case QUERY_NODE_DROP_TABLE_STMT:
@@ -861,8 +861,8 @@ void nodesDestroyNode(SNode* pNode) {
nodesDestroyNode((SNode*)pStmt->pOptions);
break;
}
- case QUERY_NODE_CREATE_MULTI_TABLE_STMT:
- nodesDestroyList(((SCreateMultiTableStmt*)pNode)->pSubTables);
+ case QUERY_NODE_CREATE_MULTI_TABLES_STMT:
+ nodesDestroyList(((SCreateMultiTablesStmt*)pNode)->pSubTables);
break;
case QUERY_NODE_DROP_TABLE_CLAUSE: // no pointer field
break;
diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c
index 3307f560dc6abf47ef608310d27a027bbec236af..6e6fdd64b23dda67e07f227b5bbd24215b3065e8 100644
--- a/source/libs/parser/src/parAstCreater.c
+++ b/source/libs/parser/src/parAstCreater.c
@@ -1208,7 +1208,7 @@ SNode* createCreateSubTableClause(SAstCreateContext* pCxt, bool ignoreExists, SN
SNode* createCreateMultiTableStmt(SAstCreateContext* pCxt, SNodeList* pSubTables) {
CHECK_PARSER_STATUS(pCxt);
- SCreateMultiTableStmt* pStmt = (SCreateMultiTableStmt*)nodesMakeNode(QUERY_NODE_CREATE_MULTI_TABLE_STMT);
+ SCreateMultiTablesStmt* pStmt = (SCreateMultiTablesStmt*)nodesMakeNode(QUERY_NODE_CREATE_MULTI_TABLES_STMT);
CHECK_OUT_OF_MEM(pStmt);
pStmt->pSubTables = pSubTables;
return (SNode*)pStmt;
@@ -1430,7 +1430,7 @@ SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const ST
}
SCreateUserStmt* pStmt = (SCreateUserStmt*)nodesMakeNode(QUERY_NODE_CREATE_USER_STMT);
CHECK_OUT_OF_MEM(pStmt);
- COPY_STRING_FORM_ID_TOKEN(pStmt->useName, pUserName);
+ COPY_STRING_FORM_ID_TOKEN(pStmt->userName, pUserName);
strcpy(pStmt->password, password);
pStmt->sysinfo = sysinfo;
return (SNode*)pStmt;
@@ -1443,7 +1443,7 @@ SNode* createAlterUserStmt(SAstCreateContext* pCxt, SToken* pUserName, int8_t al
}
SAlterUserStmt* pStmt = (SAlterUserStmt*)nodesMakeNode(QUERY_NODE_ALTER_USER_STMT);
CHECK_OUT_OF_MEM(pStmt);
- COPY_STRING_FORM_ID_TOKEN(pStmt->useName, pUserName);
+ COPY_STRING_FORM_ID_TOKEN(pStmt->userName, pUserName);
pStmt->alterType = alterType;
switch (alterType) {
case TSDB_ALTER_USER_PASSWD: {
diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c
index 92b9e67f370c70f40f9e4374a76237a3bbdb13d0..b57690f9b13e39ab74eaa84d3d36405831ff62aa 100644
--- a/source/libs/parser/src/parAstParser.c
+++ b/source/libs/parser/src/parAstParser.c
@@ -252,7 +252,7 @@ static int32_t collectMetaKeyFromCreateTable(SCollectMetaKeyCxt* pCxt, SCreateTa
return code;
}
-static int32_t collectMetaKeyFromCreateMultiTable(SCollectMetaKeyCxt* pCxt, SCreateMultiTableStmt* pStmt) {
+static int32_t collectMetaKeyFromCreateMultiTable(SCollectMetaKeyCxt* pCxt, SCreateMultiTablesStmt* pStmt) {
int32_t code = TSDB_CODE_SUCCESS;
SNode* pNode = NULL;
FOREACH(pNode, pStmt->pSubTables) {
@@ -613,8 +613,8 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) {
return collectMetaKeyFromFlushDatabase(pCxt, (SFlushDatabaseStmt*)pStmt);
case QUERY_NODE_CREATE_TABLE_STMT:
return collectMetaKeyFromCreateTable(pCxt, (SCreateTableStmt*)pStmt);
- case QUERY_NODE_CREATE_MULTI_TABLE_STMT:
- return collectMetaKeyFromCreateMultiTable(pCxt, (SCreateMultiTableStmt*)pStmt);
+ case QUERY_NODE_CREATE_MULTI_TABLES_STMT:
+ return collectMetaKeyFromCreateMultiTable(pCxt, (SCreateMultiTablesStmt*)pStmt);
case QUERY_NODE_DROP_TABLE_STMT:
return collectMetaKeyFromDropTable(pCxt, (SDropTableStmt*)pStmt);
case QUERY_NODE_ALTER_TABLE_STMT:
diff --git a/source/libs/parser/src/parAuthenticator.c b/source/libs/parser/src/parAuthenticator.c
index 4a2806511decda0b924f87893b8a44f265dd1483..fe82ce8706ca3b33bfe4fc877ee75895a67abdd2 100644
--- a/source/libs/parser/src/parAuthenticator.c
+++ b/source/libs/parser/src/parAuthenticator.c
@@ -108,7 +108,7 @@ static int32_t authCreateTable(SAuthCxt* pCxt, SCreateTableStmt* pStmt) {
return checkAuth(pCxt, pStmt->dbName, AUTH_TYPE_WRITE);
}
-static int32_t authCreateMultiTable(SAuthCxt* pCxt, SCreateMultiTableStmt* pStmt) {
+static int32_t authCreateMultiTable(SAuthCxt* pCxt, SCreateMultiTablesStmt* pStmt) {
int32_t code = TSDB_CODE_SUCCESS;
SNode* pNode = NULL;
FOREACH(pNode, pStmt->pSubTables) {
@@ -134,8 +134,8 @@ static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) {
return authInsert(pCxt, (SInsertStmt*)pStmt);
case QUERY_NODE_CREATE_TABLE_STMT:
return authCreateTable(pCxt, (SCreateTableStmt*)pStmt);
- case QUERY_NODE_CREATE_MULTI_TABLE_STMT:
- return authCreateMultiTable(pCxt, (SCreateMultiTableStmt*)pStmt);
+ case QUERY_NODE_CREATE_MULTI_TABLES_STMT:
+ return authCreateMultiTable(pCxt, (SCreateMultiTablesStmt*)pStmt);
case QUERY_NODE_SHOW_DNODES_STMT:
case QUERY_NODE_SHOW_MNODES_STMT:
case QUERY_NODE_SHOW_MODULES_STMT:
diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c
index 1f00d17be14525cbb98fce25ba551840c37dfe88..a5bb660c37b6cda75eb3fc31a03fd595cf918a33 100644
--- a/source/libs/parser/src/parTranslater.c
+++ b/source/libs/parser/src/parTranslater.c
@@ -5083,7 +5083,7 @@ static int32_t translateUseDatabase(STranslateContext* pCxt, SUseDatabaseStmt* p
static int32_t translateCreateUser(STranslateContext* pCxt, SCreateUserStmt* pStmt) {
SCreateUserReq createReq = {0};
- strcpy(createReq.user, pStmt->useName);
+ strcpy(createReq.user, pStmt->userName);
createReq.createType = 0;
createReq.superUser = 0;
createReq.sysInfo = pStmt->sysinfo;
@@ -5095,7 +5095,7 @@ static int32_t translateCreateUser(STranslateContext* pCxt, SCreateUserStmt* pSt
static int32_t translateAlterUser(STranslateContext* pCxt, SAlterUserStmt* pStmt) {
SAlterUserReq alterReq = {0};
- strcpy(alterReq.user, pStmt->useName);
+ strcpy(alterReq.user, pStmt->userName);
alterReq.alterType = pStmt->alterType;
alterReq.superUser = 0;
alterReq.enable = pStmt->enable;
@@ -7029,7 +7029,7 @@ SArray* serializeVgroupsCreateTableBatch(SHashObj* pVgroupHashmap) {
}
static int32_t rewriteCreateMultiTable(STranslateContext* pCxt, SQuery* pQuery) {
- SCreateMultiTableStmt* pStmt = (SCreateMultiTableStmt*)pQuery->pRoot;
+ SCreateMultiTablesStmt* pStmt = (SCreateMultiTablesStmt*)pQuery->pRoot;
SHashObj* pVgroupHashmap = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
if (NULL == pVgroupHashmap) {
@@ -7637,7 +7637,7 @@ static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) {
code = rewriteCreateTable(pCxt, pQuery);
}
break;
- case QUERY_NODE_CREATE_MULTI_TABLE_STMT:
+ case QUERY_NODE_CREATE_MULTI_TABLES_STMT:
code = rewriteCreateMultiTable(pCxt, pQuery);
break;
case QUERY_NODE_DROP_TABLE_STMT:
diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c
index 2f965de76f61c7ec1d1b5b42d5f196fc672ecb8b..4e1e98c9c026b116e9cf67d5324b53a003a65192 100644
--- a/source/libs/planner/src/planLogicCreater.c
+++ b/source/libs/planner/src/planLogicCreater.c
@@ -1386,7 +1386,7 @@ static int32_t createSetOperatorLogicNode(SLogicPlanContext* pCxt, SSetOperator*
static int32_t getMsgType(ENodeType sqlType) {
switch (sqlType) {
case QUERY_NODE_CREATE_TABLE_STMT:
- case QUERY_NODE_CREATE_MULTI_TABLE_STMT:
+ case QUERY_NODE_CREATE_MULTI_TABLES_STMT:
return TDMT_VND_CREATE_TABLE;
case QUERY_NODE_DROP_TABLE_STMT:
return TDMT_VND_DROP_TABLE;
diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c
index 20608a6cf3c7a5a071611e3bbb01ccaf788c3066..b5bceb9b94fb8e819e0774a477286fd8b14e4a24 100644
--- a/source/libs/stream/src/streamExec.c
+++ b/source/libs/stream/src/streamExec.c
@@ -121,7 +121,11 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) {
block.info.childId = pTask->selfChildId;
taosArrayPush(pRes, &block);
- if (++batchCnt >= batchSz) break;
+ batchCnt++;
+
+ qDebug("task %d scan exec block num %d, block limit %d", pTask->taskId, batchCnt, batchSz);
+
+ if (batchCnt >= batchSz) break;
}
if (taosArrayGetSize(pRes) == 0) {
taosArrayDestroy(pRes);
@@ -139,6 +143,7 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) {
streamTaskOutput(pTask, qRes);
if (pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH || pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) {
+ qDebug("task %d scan exec dispatch block num %d", pTask->taskId, batchCnt);
streamDispatch(pTask);
}
if (finished) break;
diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c
index af1d738de05a34b4be237e959996b2c478de5486..cf388da92ca8bec662fb5ddfbd6ada79510bfcd2 100644
--- a/source/libs/stream/src/streamState.c
+++ b/source/libs/stream/src/streamState.c
@@ -159,6 +159,11 @@ SStreamState* streamStateOpen(char* path, SStreamTask* pTask, bool specPath, int
goto _err;
}
+ if (tdbTbOpen("partag.state.db", sizeof(int64_t), -1, NULL, pState->pTdbState->db, &pState->pTdbState->pParTagDb, 0) <
+ 0) {
+ goto _err;
+ }
+
if (streamStateBegin(pState) < 0) {
goto _err;
}
@@ -173,6 +178,7 @@ _err:
tdbTbClose(pState->pTdbState->pFillStateDb);
tdbTbClose(pState->pTdbState->pSessionStateDb);
tdbTbClose(pState->pTdbState->pParNameDb);
+ tdbTbClose(pState->pTdbState->pParTagDb);
tdbClose(pState->pTdbState->db);
streamStateDestroy(pState);
return NULL;
@@ -186,6 +192,7 @@ void streamStateClose(SStreamState* pState) {
tdbTbClose(pState->pTdbState->pFillStateDb);
tdbTbClose(pState->pTdbState->pSessionStateDb);
tdbTbClose(pState->pTdbState->pParNameDb);
+ tdbTbClose(pState->pTdbState->pParTagDb);
tdbClose(pState->pTdbState->db);
streamStateDestroy(pState);
@@ -821,10 +828,17 @@ _end:
return res;
}
+int32_t streamStatePutParTag(SStreamState* pState, int64_t groupId, const void* tag, int32_t tagLen) {
+ return tdbTbUpsert(pState->pTdbState->pParTagDb, &groupId, sizeof(int64_t), tag, tagLen, pState->pTdbState->txn);
+}
+
+int32_t streamStateGetParTag(SStreamState* pState, int64_t groupId, void** tagVal, int32_t* tagLen) {
+ return tdbTbGet(pState->pTdbState->pParTagDb, &groupId, sizeof(int64_t), tagVal, tagLen);
+}
+
int32_t streamStatePutParName(SStreamState* pState, int64_t groupId, const char tbname[TSDB_TABLE_NAME_LEN]) {
- tdbTbUpsert(pState->pTdbState->pParNameDb, &groupId, sizeof(int64_t), tbname, TSDB_TABLE_NAME_LEN,
- pState->pTdbState->txn);
- return 0;
+ return tdbTbUpsert(pState->pTdbState->pParNameDb, &groupId, sizeof(int64_t), tbname, TSDB_TABLE_NAME_LEN,
+ pState->pTdbState->txn);
}
int32_t streamStateGetParName(SStreamState* pState, int64_t groupId, void** pVal) {
diff --git a/source/libs/wal/src/walMeta.c b/source/libs/wal/src/walMeta.c
index 8e6628bb21eabc25e2e66000e58b796854c5ac34..da8cf24627a8f672e101856451210ed5faf975b9 100644
--- a/source/libs/wal/src/walMeta.c
+++ b/source/libs/wal/src/walMeta.c
@@ -25,7 +25,7 @@ bool FORCE_INLINE walLogExist(SWal* pWal, int64_t ver) {
}
bool FORCE_INLINE walIsEmpty(SWal* pWal) {
- return (pWal->vers.firstVer == -1 || pWal->vers.lastVer < pWal->vers.firstVer); // [firstVer, lastVer + 1)
+ return (pWal->vers.firstVer == -1 || pWal->vers.lastVer < pWal->vers.firstVer); // [firstVer, lastVer + 1)
}
int64_t FORCE_INLINE walGetFirstVer(SWal* pWal) { return pWal->vers.firstVer; }
@@ -49,7 +49,6 @@ static FORCE_INLINE int walBuildTmpMetaName(SWal* pWal, char* buf) {
static FORCE_INLINE int64_t walScanLogGetLastVer(SWal* pWal, int32_t fileIdx) {
int32_t sz = taosArrayGetSize(pWal->fileInfoSet);
terrno = TSDB_CODE_SUCCESS;
- ASSERT(fileIdx >= 0 && fileIdx < sz);
SWalFileInfo* pFileInfo = taosArrayGet(pWal->fileInfoSet, fileIdx);
char fnameStr[WAL_FILE_LEN];
@@ -101,7 +100,6 @@ static FORCE_INLINE int64_t walScanLogGetLastVer(SWal* pWal, int32_t fileIdx) {
offsetBackward = offset;
}
- ASSERT(offset <= end);
readSize = end - offset;
capacity = readSize + sizeof(magic);
@@ -257,7 +255,6 @@ static void walRebuildFileInfoSet(SArray* metaLogList, SArray* actualLogList) {
SWalFileInfo* pLogInfo = taosArrayGet(actualLogList, i);
while (j < metaFileNum) {
SWalFileInfo* pMetaInfo = taosArrayGet(metaLogList, j);
- ASSERT(pMetaInfo != NULL);
if (pMetaInfo->firstVer < pLogInfo->firstVer) {
j++;
} else if (pMetaInfo->firstVer == pLogInfo->firstVer) {
@@ -385,7 +382,6 @@ int walCheckAndRepairMeta(SWal* pWal) {
taosArrayDestroy(actualLog);
int32_t sz = taosArrayGetSize(pWal->fileInfoSet);
- ASSERT(sz == actualFileNum);
// scan and determine the lastVer
int32_t fileIdx = sz;
@@ -403,8 +399,6 @@ int walCheckAndRepairMeta(SWal* pWal) {
return -1;
}
- ASSERT(pFileInfo->firstVer >= 0);
-
if (pFileInfo->lastVer >= pFileInfo->firstVer && fileSize == pFileInfo->fileSize) {
totSize += pFileInfo->fileSize;
continue;
@@ -417,7 +411,6 @@ int walCheckAndRepairMeta(SWal* pWal) {
wError("failed to scan wal last ver since %s", terrstr());
return -1;
}
- ASSERT(pFileInfo->fileSize == 0);
// remove the empty wal log, and its idx
wInfo("vgId:%d, wal remove empty file %s", pWal->cfg.vgId, fnameStr);
taosRemoveFile(fnameStr);
@@ -477,8 +470,7 @@ int walReadLogHead(TdFilePtr pLogFile, int64_t offset, SWalCkHead* pCkHead) {
}
int walCheckAndRepairIdxFile(SWal* pWal, int32_t fileIdx) {
- int32_t sz = taosArrayGetSize(pWal->fileInfoSet);
- ASSERT(fileIdx >= 0 && fileIdx < sz);
+ int32_t sz = taosArrayGetSize(pWal->fileInfoSet);
SWalFileInfo* pFileInfo = taosArrayGet(pWal->fileInfoSet, fileIdx);
char fnameStr[WAL_FILE_LEN];
walBuildIdxName(pWal, pFileInfo->firstVer, fnameStr);
@@ -492,7 +484,6 @@ int walCheckAndRepairIdxFile(SWal* pWal, int32_t fileIdx) {
return -1;
}
- ASSERT(pFileInfo->fileSize > 0 && pFileInfo->firstVer >= 0 && pFileInfo->lastVer >= pFileInfo->firstVer);
if (fileSize == (pFileInfo->lastVer - pFileInfo->firstVer + 1) * sizeof(SWalIdxEntry)) {
return 0;
}
@@ -556,7 +547,7 @@ int walCheckAndRepairIdxFile(SWal* pWal, int32_t fileIdx) {
}
offset += sizeof(SWalIdxEntry);
- ASSERT(offset == (idxEntry.ver - pFileInfo->firstVer + 1) * sizeof(SWalIdxEntry));
+ /*A(offset == (idxEntry.ver - pFileInfo->firstVer + 1) * sizeof(SWalIdxEntry));*/
// ftruncate idx file
if (offset < fileSize) {
@@ -577,7 +568,7 @@ int walCheckAndRepairIdxFile(SWal* pWal, int32_t fileIdx) {
}
while (idxEntry.ver < pFileInfo->lastVer) {
- ASSERT(idxEntry.ver == ckHead.head.version);
+ /*A(idxEntry.ver == ckHead.head.version);*/
idxEntry.ver += 1;
idxEntry.offset += sizeof(SWalCkHead) + ckHead.head.bodyLen;
@@ -649,8 +640,7 @@ int walRollFileInfo(SWal* pWal) {
}
char* walMetaSerialize(SWal* pWal) {
- char buf[30];
- ASSERT(pWal->fileInfoSet);
+ char buf[30];
int sz = taosArrayGetSize(pWal->fileInfoSet);
cJSON* pRoot = cJSON_CreateObject();
cJSON* pMeta = cJSON_CreateObject();
@@ -707,7 +697,7 @@ char* walMetaSerialize(SWal* pWal) {
}
int walMetaDeserialize(SWal* pWal, const char* bytes) {
- ASSERT(taosArrayGetSize(pWal->fileInfoSet) == 0);
+ /*A(taosArrayGetSize(pWal->fileInfoSet) == 0);*/
cJSON *pRoot, *pMeta, *pFiles, *pInfoJson, *pField;
pRoot = cJSON_Parse(bytes);
if (!pRoot) goto _err;
@@ -823,7 +813,9 @@ int walSaveMeta(SWal* pWal) {
// flush to a tmpfile
n = walBuildTmpMetaName(pWal, tmpFnameStr);
- ASSERT(n < sizeof(tmpFnameStr) && "Buffer overflow of file name");
+ if (n >= sizeof(tmpFnameStr)) {
+ return -1;
+ }
TdFilePtr pMetaFile = taosOpenFile(tmpFnameStr, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC);
if (pMetaFile == NULL) {
@@ -854,7 +846,9 @@ int walSaveMeta(SWal* pWal) {
// rename it
n = walBuildMetaName(pWal, metaVer + 1, fnameStr);
- ASSERT(n < sizeof(fnameStr) && "Buffer overflow of file name");
+ if (n >= sizeof(fnameStr)) {
+ goto _err;
+ }
if (taosRenameFile(tmpFnameStr, fnameStr) < 0) {
wError("failed to rename file due to %s. dest:%s", strerror(errno), fnameStr);
@@ -877,7 +871,6 @@ _err:
}
int walLoadMeta(SWal* pWal) {
- ASSERT(pWal->fileInfoSet->size == 0);
// find existing meta file
int metaVer = walFindCurMetaVer(pWal);
if (metaVer == -1) {
diff --git a/source/libs/wal/src/walRead.c b/source/libs/wal/src/walRead.c
index ed02d29e3bfcf98fe272a029c6191443e8f39a6c..a89c4bb546d548f2bc67bb4f18c3c9d63766e5b4 100644
--- a/source/libs/wal/src/walRead.c
+++ b/source/libs/wal/src/walRead.c
@@ -97,7 +97,6 @@ int32_t walNextValidMsg(SWalReader *pReader) {
return -1;
}
fetchVer++;
- ASSERT(fetchVer == pReader->curVersion);
}
}
pReader->curStopped = 1;
@@ -132,7 +131,6 @@ static int64_t walReadSeekFilePos(SWalReader *pReader, int64_t fileFirstVer, int
return -1;
}
- ASSERT(entry.ver == ver);
ret = taosLSeekFile(pLogTFile, entry.offset, SEEK_SET);
if (ret < 0) {
terrno = TAOS_SYSTEM_ERROR(errno);
@@ -241,7 +239,6 @@ static int32_t walFetchHeadNew(SWalReader *pRead, int64_t fetchVer) {
if (pRead->curInvalid || pRead->curVersion != fetchVer) {
if (walReadSeekVer(pRead, fetchVer) < 0) {
- ASSERT(0);
pRead->curVersion = fetchVer;
pRead->curInvalid = 1;
return -1;
@@ -262,7 +259,6 @@ static int32_t walFetchHeadNew(SWalReader *pRead, int64_t fetchVer) {
} else {
terrno = TSDB_CODE_WAL_FILE_CORRUPTED;
}
- ASSERT(0);
pRead->curInvalid = 1;
return -1;
}
@@ -299,7 +295,6 @@ static int32_t walFetchBodyNew(SWalReader *pRead) {
terrno = TSDB_CODE_WAL_FILE_CORRUPTED;
}
pRead->curInvalid = 1;
- ASSERT(0);
return -1;
}
@@ -308,7 +303,6 @@ static int32_t walFetchBodyNew(SWalReader *pRead) {
pRead->pHead->head.version, ver);
pRead->curInvalid = 1;
terrno = TSDB_CODE_WAL_FILE_CORRUPTED;
- ASSERT(0);
return -1;
}
@@ -316,7 +310,6 @@ static int32_t walFetchBodyNew(SWalReader *pRead) {
wError("vgId:%d, wal fetch body error:%" PRId64 ", since body checksum not passed", pRead->pWal->cfg.vgId, ver);
pRead->curInvalid = 1;
terrno = TSDB_CODE_WAL_FILE_CORRUPTED;
- ASSERT(0);
return -1;
}
@@ -328,14 +321,10 @@ static int32_t walFetchBodyNew(SWalReader *pRead) {
static int32_t walSkipFetchBodyNew(SWalReader *pRead) {
int64_t code;
- ASSERT(pRead->curVersion == pRead->pHead->head.version);
- ASSERT(pRead->curInvalid == 0);
-
code = taosLSeekFile(pRead->pLogFile, pRead->pHead->head.bodyLen, SEEK_CUR);
if (code < 0) {
terrno = TAOS_SYSTEM_ERROR(errno);
pRead->curInvalid = 1;
- ASSERT(0);
return -1;
}
@@ -384,7 +373,6 @@ int32_t walFetchHead(SWalReader *pRead, int64_t ver, SWalCkHead *pHead) {
} else {
terrno = TSDB_CODE_WAL_FILE_CORRUPTED;
}
- ASSERT(0);
pRead->curInvalid = 1;
return -1;
}
@@ -410,9 +398,6 @@ int32_t walSkipFetchBody(SWalReader *pRead, const SWalCkHead *pHead) {
pRead->pWal->cfg.vgId, pHead->head.version, pRead->pWal->vers.firstVer, pRead->pWal->vers.commitVer,
pRead->pWal->vers.lastVer, pRead->pWal->vers.appliedVer);
- ASSERT(pRead->curVersion == pHead->head.version);
- ASSERT(pRead->curInvalid == 0);
-
code = taosLSeekFile(pRead->pLogFile, pHead->head.bodyLen, SEEK_CUR);
if (code < 0) {
terrno = TAOS_SYSTEM_ERROR(errno);
@@ -447,7 +432,6 @@ int32_t walFetchBody(SWalReader *pRead, SWalCkHead **ppHead) {
if (pReadHead->bodyLen != taosReadFile(pRead->pLogFile, pReadHead->body, pReadHead->bodyLen)) {
if (pReadHead->bodyLen < 0) {
- ASSERT(0);
terrno = TAOS_SYSTEM_ERROR(errno);
wError("vgId:%d, wal fetch body error:%" PRId64 ", read request index:%" PRId64 ", since %s",
pRead->pWal->cfg.vgId, pReadHead->version, ver, tstrerror(terrno));
@@ -457,12 +441,10 @@ int32_t walFetchBody(SWalReader *pRead, SWalCkHead **ppHead) {
terrno = TSDB_CODE_WAL_FILE_CORRUPTED;
}
pRead->curInvalid = 1;
- ASSERT(0);
return -1;
}
if (pReadHead->version != ver) {
- ASSERT(0);
wError("vgId:%d, wal fetch body error, index:%" PRId64 ", read request index:%" PRId64, pRead->pWal->cfg.vgId,
pReadHead->version, ver);
pRead->curInvalid = 1;
@@ -471,7 +453,6 @@ int32_t walFetchBody(SWalReader *pRead, SWalCkHead **ppHead) {
}
if (walValidBodyCksum(*ppHead) != 0) {
- ASSERT(0);
wError("vgId:%d, wal fetch body error, index:%" PRId64 ", since body checksum not passed", pRead->pWal->cfg.vgId,
ver);
pRead->curInvalid = 1;
diff --git a/source/libs/wal/src/walRef.c b/source/libs/wal/src/walRef.c
index e86111109ce4fc9768be8b662670ae711f935e39..fa04ba3e58a05c3ee902bde8ace004e821683f37 100644
--- a/source/libs/wal/src/walRef.c
+++ b/source/libs/wal/src/walRef.c
@@ -61,7 +61,7 @@ int32_t walRefVer(SWalRef *pRef, int64_t ver) {
SWalFileInfo tmpInfo;
tmpInfo.firstVer = ver;
SWalFileInfo *pRet = taosArraySearch(pWal->fileInfoSet, &tmpInfo, compareWalFileInfo, TD_LE);
- ASSERT(pRet != NULL);
+ /*A(pRet != NULL);*/
pRef->refFile = pRet->firstVer;
taosThreadMutexUnlock(&pWal->mutex);
@@ -80,6 +80,7 @@ void walUnrefVer(SWalRef *pRef) {
SWalRef *walRefCommittedVer(SWal *pWal) {
SWalRef *pRef = walOpenRef(pWal);
if (pRef == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
return NULL;
}
taosThreadMutexLock(&pWal->mutex);
@@ -91,7 +92,7 @@ SWalRef *walRefCommittedVer(SWal *pWal) {
SWalFileInfo tmpInfo;
tmpInfo.firstVer = ver;
SWalFileInfo *pRet = taosArraySearch(pWal->fileInfoSet, &tmpInfo, compareWalFileInfo, TD_LE);
- ASSERT(pRet != NULL);
+ /*A(pRet != NULL);*/
pRef->refFile = pRet->firstVer;
taosThreadMutexUnlock(&pWal->mutex);
diff --git a/source/libs/wal/src/walSeek.c b/source/libs/wal/src/walSeek.c
index 2cb6614b01bab90cc41e0d11408f3380de4a95fc..cbfd0ef7417389b662ece46d4032f2f7a1a31cbd 100644
--- a/source/libs/wal/src/walSeek.c
+++ b/source/libs/wal/src/walSeek.c
@@ -40,7 +40,6 @@ static int64_t walSeekWritePos(SWal* pWal, int64_t ver) {
terrno = TAOS_SYSTEM_ERROR(errno);
return -1;
}
- ASSERT(entry.ver == ver);
code = taosLSeekFile(pLogTFile, entry.offset, SEEK_SET);
if (code < 0) {
terrno = TAOS_SYSTEM_ERROR(errno);
@@ -53,8 +52,7 @@ static int64_t walSeekWritePos(SWal* pWal, int64_t ver) {
int walInitWriteFile(SWal* pWal) {
TdFilePtr pIdxTFile, pLogTFile;
SWalFileInfo* pRet = taosArrayGetLast(pWal->fileInfoSet);
- ASSERT(pRet != NULL);
- int64_t fileFirstVer = pRet->firstVer;
+ int64_t fileFirstVer = pRet->firstVer;
char fnameStr[WAL_FILE_LEN];
walBuildIdxName(pWal, fileFirstVer, fnameStr);
@@ -109,9 +107,8 @@ int64_t walChangeWrite(SWal* pWal, int64_t ver) {
tmpInfo.firstVer = ver;
// bsearch in fileSet
int32_t idx = taosArraySearchIdx(pWal->fileInfoSet, &tmpInfo, compareWalFileInfo, TD_LE);
- ASSERT(idx != -1);
+ /*A(idx != -1);*/
SWalFileInfo* pFileInfo = taosArrayGet(pWal->fileInfoSet, idx);
- /*ASSERT(pFileInfo != NULL);*/
int64_t fileFirstVer = pFileInfo->firstVer;
walBuildIdxName(pWal, fileFirstVer, fnameStr);
diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c
index a5c7bf1abdb8fd4ee71beb7fb3186a21cda03c32..4233c089a4753f2adf3c1ec0418e3262914610df 100644
--- a/source/libs/wal/src/walWrite.c
+++ b/source/libs/wal/src/walWrite.c
@@ -87,12 +87,10 @@ int32_t walApplyVer(SWal *pWal, int64_t ver) {
}
int32_t walCommit(SWal *pWal, int64_t ver) {
- ASSERT(pWal->vers.commitVer >= pWal->vers.snapshotVer);
- ASSERT(pWal->vers.commitVer <= pWal->vers.lastVer);
if (ver < pWal->vers.commitVer) {
return 0;
}
- if (ver > pWal->vers.lastVer) {
+ if (ver > pWal->vers.lastVer || pWal->vers.commitVer < pWal->vers.snapshotVer) {
terrno = TSDB_CODE_WAL_INVALID_VER;
return -1;
}
@@ -138,25 +136,21 @@ int32_t walRollback(SWal *pWal, int64_t ver) {
TdFilePtr pIdxFile = taosOpenFile(fnameStr, TD_FILE_WRITE | TD_FILE_READ | TD_FILE_APPEND);
if (pIdxFile == NULL) {
- ASSERT(0);
taosThreadMutexUnlock(&pWal->mutex);
return -1;
}
int64_t idxOff = walGetVerIdxOffset(pWal, ver);
code = taosLSeekFile(pIdxFile, idxOff, SEEK_SET);
if (code < 0) {
- ASSERT(0);
taosThreadMutexUnlock(&pWal->mutex);
return -1;
}
// read idx file and get log file pos
SWalIdxEntry entry;
if (taosReadFile(pIdxFile, &entry, sizeof(SWalIdxEntry)) != sizeof(SWalIdxEntry)) {
- ASSERT(0);
taosThreadMutexUnlock(&pWal->mutex);
return -1;
}
- ASSERT(entry.ver == ver);
walBuildLogName(pWal, walGetCurFileFirstVer(pWal), fnameStr);
TdFilePtr pLogFile = taosOpenFile(fnameStr, TD_FILE_WRITE | TD_FILE_READ | TD_FILE_APPEND);
@@ -176,24 +170,19 @@ int32_t walRollback(SWal *pWal, int64_t ver) {
}
// validate offset
SWalCkHead head;
- ASSERT(taosValidFile(pLogFile));
- int64_t size = taosReadFile(pLogFile, &head, sizeof(SWalCkHead));
+ int64_t size = taosReadFile(pLogFile, &head, sizeof(SWalCkHead));
if (size != sizeof(SWalCkHead)) {
- ASSERT(0);
taosThreadMutexUnlock(&pWal->mutex);
return -1;
}
code = walValidHeadCksum(&head);
- ASSERT(code == 0);
if (code != 0) {
terrno = TSDB_CODE_WAL_FILE_CORRUPTED;
- ASSERT(0);
taosThreadMutexUnlock(&pWal->mutex);
return -1;
}
if (head.head.version != ver) {
- ASSERT(0);
terrno = TSDB_CODE_WAL_FILE_CORRUPTED;
taosThreadMutexUnlock(&pWal->mutex);
return -1;
@@ -202,22 +191,22 @@ int32_t walRollback(SWal *pWal, int64_t ver) {
// truncate old files
code = taosFtruncateFile(pLogFile, entry.offset);
if (code < 0) {
- ASSERT(0);
terrno = TAOS_SYSTEM_ERROR(errno);
taosThreadMutexUnlock(&pWal->mutex);
return -1;
}
code = taosFtruncateFile(pIdxFile, idxOff);
if (code < 0) {
- ASSERT(0);
terrno = TAOS_SYSTEM_ERROR(errno);
taosThreadMutexUnlock(&pWal->mutex);
return -1;
}
pWal->vers.lastVer = ver - 1;
+#if 0
if (pWal->vers.lastVer < pWal->vers.firstVer) {
- ASSERT(pWal->vers.lastVer == pWal->vers.firstVer - 1);
+ A(pWal->vers.lastVer == pWal->vers.firstVer - 1);
}
+#endif
((SWalFileInfo *)taosArrayGetLast(pWal->fileInfoSet))->lastVer = ver - 1;
((SWalFileInfo *)taosArrayGetLast(pWal->fileInfoSet))->fileSize = entry.offset;
taosCloseFile(&pIdxFile);
@@ -386,7 +375,8 @@ int32_t walEndSnapshot(SWal *pWal) {
walBuildIdxName(pWal, pInfo->firstVer, fnameStr);
wDebug("vgId:%d, wal remove file %s", pWal->cfg.vgId, fnameStr);
if (taosRemoveFile(fnameStr) < 0 && errno != ENOENT) {
- ASSERT(0);
+ wError("vgId:%d, failed to remove idx file %s due to %s", pWal->cfg.vgId, fnameStr, strerror(errno));
+ goto END;
}
}
taosArrayClear(pWal->toDeleteFiles);
@@ -441,7 +431,6 @@ int32_t walRollImpl(SWal *pWal) {
pWal->pIdxFile = pIdxFile;
pWal->pLogFile = pLogFile;
pWal->writeCur = taosArrayGetSize(pWal->fileInfoSet) - 1;
- ASSERT(pWal->writeCur >= 0);
pWal->lastRollSeq = walGetSeq();
@@ -458,8 +447,7 @@ END:
static int32_t walWriteIndex(SWal *pWal, int64_t ver, int64_t offset) {
SWalIdxEntry entry = {.ver = ver, .offset = offset};
SWalFileInfo *pFileInfo = walGetCurFileInfo(pWal);
- ASSERT(pFileInfo != NULL);
- ASSERT(pFileInfo->firstVer >= 0);
+
int64_t idxOffset = (entry.ver - pFileInfo->firstVer) * sizeof(SWalIdxEntry);
wDebug("vgId:%d, write index, index:%" PRId64 ", offset:%" PRId64 ", at %" PRId64, pWal->cfg.vgId, ver, offset,
idxOffset);
@@ -476,7 +464,6 @@ static int32_t walWriteIndex(SWal *pWal, int64_t ver, int64_t offset) {
if (endOffset < 0) {
wFatal("vgId:%d, failed to seek end of idxfile due to %s. ver:%" PRId64 "", pWal->cfg.vgId, strerror(errno), ver);
}
- ASSERT(endOffset == idxOffset + sizeof(SWalIdxEntry) && "Offset of idx entries misaligned");
return 0;
}
@@ -486,9 +473,7 @@ static FORCE_INLINE int32_t walWriteImpl(SWal *pWal, int64_t index, tmsg_t msgTy
int64_t offset = walGetCurFileOffset(pWal);
SWalFileInfo *pFileInfo = walGetCurFileInfo(pWal);
- ASSERT(pFileInfo != NULL);
- ASSERT(pFileInfo->firstVer != -1);
pWal->writeHead.head.version = index;
pWal->writeHead.head.bodyLen = bodyLen;
pWal->writeHead.head.msgType = msgType;
@@ -525,7 +510,6 @@ static FORCE_INLINE int32_t walWriteImpl(SWal *pWal, int64_t index, tmsg_t msgTy
// set status
if (pWal->vers.firstVer == -1) {
- ASSERT(index == 0);
pWal->vers.firstVer = 0;
}
pWal->vers.lastVer = index;
@@ -541,7 +525,6 @@ END:
wFatal("vgId:%d, failed to ftruncate logfile to offset:%" PRId64 " during recovery due to %s", pWal->cfg.vgId,
offset, strerror(errno));
terrno = TAOS_SYSTEM_ERROR(errno);
- ASSERT(0 && "failed to recover from error");
}
int64_t idxOffset = (index - pFileInfo->firstVer) * sizeof(SWalIdxEntry);
@@ -549,7 +532,6 @@ END:
wFatal("vgId:%d, failed to ftruncate idxfile to offset:%" PRId64 "during recovery due to %s", pWal->cfg.vgId,
idxOffset, strerror(errno));
terrno = TAOS_SYSTEM_ERROR(errno);
- ASSERT(0 && "failed to recover from error");
}
return -1;
}
@@ -576,8 +558,6 @@ int64_t walAppendLog(SWal *pWal, int64_t index, tmsg_t msgType, SWalSyncInfo syn
}
}
- ASSERT(pWal->pLogFile != NULL && pWal->pIdxFile != NULL && pWal->writeCur >= 0);
-
if (walWriteImpl(pWal, index, msgType, syncMeta, body, bodyLen) < 0) {
taosThreadMutexUnlock(&pWal->mutex);
return -1;
@@ -614,8 +594,6 @@ int32_t walWriteWithSyncInfo(SWal *pWal, int64_t index, tmsg_t msgType, SWalSync
}
}
- ASSERT(pWal->pIdxFile != NULL && pWal->pLogFile != NULL && pWal->writeCur >= 0);
-
if (walWriteImpl(pWal, index, msgType, syncMeta, body, bodyLen) < 0) {
taosThreadMutexUnlock(&pWal->mutex);
return -1;