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