refactor(stream): try to lock during build stream hb.

This commit is contained in:
Haojun Liao 2025-02-28 18:49:48 +08:00
parent e1c4451f81
commit 6e3f738490
1 changed files with 15 additions and 8 deletions

View File

@ -364,15 +364,22 @@ void streamMetaHbToMnode(void* param, void* tmrId) {
} }
// NOTE: stream task in restart procedure. not generate the hb now, try to acquire the lock may cause stuck this timer. // NOTE: stream task in restart procedure. not generate the hb now, try to acquire the lock may cause stuck this timer.
if (pMeta->startInfo.startAllTasks == 1) { int32_t count = 30;
stWarn("vgId:%d in restart all task procedure, not try to genbrate the hb now, try again in 5s", pMeta->vgId); bool send = false;
} else { while ((--count) >= 0) {
streamMetaRLock(pMeta); int32_t ret = streamMetaTryRlock(pMeta);
code = streamMetaSendHbHelper(pMeta); if (ret != 0) {
if (code) { taosMsleep(10);
stError("vgId:%d failed to send hmMsg to mnode, try again in 5s, code:%s", pMeta->vgId, tstrerror(code)); } else {
send = true;
code = streamMetaSendHbHelper(pMeta);
streamMetaRUnLock(pMeta);
break;
} }
streamMetaRUnLock(pMeta); }
if (!send) {
stError("vgId:%d failed to send hmMsg to mnode, retry again in 5s, code:%s", pMeta->vgId, tstrerror(code));
} }
streamTmrStart(streamMetaHbToMnode, META_HB_CHECK_INTERVAL, param, streamTimer, &pMeta->pHbInfo->hbTmr, pMeta->vgId, streamTmrStart(streamMetaHbToMnode, META_HB_CHECK_INTERVAL, param, streamTimer, &pMeta->pHbInfo->hbTmr, pMeta->vgId,