refactor stream backend
This commit is contained in:
parent
1c3c58062d
commit
9d210ec957
|
@ -1119,14 +1119,9 @@ static const char *mndGetStreamDB(SMnode *pMnode) {
|
|||
return p;
|
||||
}
|
||||
|
||||
static int32_t mndProcessStreamDoCheckpoint(SRpcMsg *pReq) {
|
||||
SMnode *pMnode = pReq->info.node;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
void *pIter = NULL;
|
||||
SStreamObj *pStream = NULL;
|
||||
int32_t code = 0;
|
||||
|
||||
{ // check if the node update happens or not
|
||||
static int32_t mndCheckNodeStatus(SMnode *pMnode) {
|
||||
bool ready = true;
|
||||
// check if the node update happens or not
|
||||
int64_t ts = taosGetTimestampSec();
|
||||
|
||||
if (execNodeList.pNodeEntryList == NULL || (taosArrayGetSize(execNodeList.pNodeEntryList) == 0)) {
|
||||
|
@ -1140,15 +1135,14 @@ static int32_t mndProcessStreamDoCheckpoint(SRpcMsg *pReq) {
|
|||
if (taosArrayGetSize(execNodeList.pNodeEntryList) == 0) {
|
||||
mDebug("stream task node change checking done, no vgroups exist, do nothing");
|
||||
execNodeList.ts = ts;
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < taosArrayGetSize(execNodeList.pNodeEntryList); ++i) {
|
||||
SNodeEntry *pNodeEntry = taosArrayGet(execNodeList.pNodeEntryList, i);
|
||||
if (pNodeEntry->stageUpdated) {
|
||||
mDebug("stream task not ready due to node update detected, checkpoint not issued");
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
SArray *pNodeSnapshot = mndTakeVgroupSnapshot(pMnode);
|
||||
|
@ -1161,12 +1155,11 @@ static int32_t mndProcessStreamDoCheckpoint(SRpcMsg *pReq) {
|
|||
|
||||
if (nodeUpdated) {
|
||||
mDebug("stream task not ready due to node update, checkpoint not issued");
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
{ // check if all tasks are in TASK_STATUS__NORMAL status
|
||||
bool ready = true;
|
||||
// check if all tasks are in TASK_STATUS__NORMAL status
|
||||
|
||||
taosThreadMutexLock(&execNodeList.lock);
|
||||
for (int32_t i = 0; i < taosArrayGetSize(execNodeList.pTaskList); ++i) {
|
||||
|
@ -1184,10 +1177,16 @@ static int32_t mndProcessStreamDoCheckpoint(SRpcMsg *pReq) {
|
|||
}
|
||||
}
|
||||
taosThreadMutexUnlock(&execNodeList.lock);
|
||||
|
||||
if (!ready) {
|
||||
return 0;
|
||||
}
|
||||
return ready == true ? 0 : -1;
|
||||
}
|
||||
static int32_t mndProcessStreamDoCheckpoint(SRpcMsg *pReq) {
|
||||
SMnode *pMnode = pReq->info.node;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
void *pIter = NULL;
|
||||
SStreamObj *pStream = NULL;
|
||||
int32_t code = 0;
|
||||
if ((code = mndCheckNodeStatus(pMnode)) != 0) {
|
||||
return code;
|
||||
}
|
||||
|
||||
SMStreamDoCheckpointMsg *pMsg = (SMStreamDoCheckpointMsg *)pReq->pCont;
|
||||
|
|
Loading…
Reference in New Issue