vmHandle.c 18.5 KB
Newer Older
S
shm  
Shengliang Guan 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/*
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
 *
 * This program is free software: you can use, redistribute, and/or modify
 * it under the terms of the GNU Affero General Public License, version 3
 * or later ("AGPL"), as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http:www.gnu.org/licenses/>.
 */

#define _DEFAULT_SOURCE
S
shm  
Shengliang Guan 已提交
17
#include "vmInt.h"
S
shm  
Shengliang Guan 已提交
18

S
Shengliang Guan 已提交
19
void vmGetVnodeLoads(SVnodeMgmt *pMgmt, SMonVloadInfo *pInfo) {
S
Shengliang Guan 已提交
20 21 22
  pInfo->pVloads = taosArrayInit(pMgmt->state.totalVnodes, sizeof(SVnodeLoad));
  if (pInfo->pVloads == NULL) return;

23
  taosThreadRwlockRdlock(&pMgmt->lock);
S
Shengliang Guan 已提交
24 25 26 27 28 29 30 31 32 33 34 35 36

  void *pIter = taosHashIterate(pMgmt->hash, NULL);
  while (pIter) {
    SVnodeObj **ppVnode = pIter;
    if (ppVnode == NULL || *ppVnode == NULL) continue;

    SVnodeObj *pVnode = *ppVnode;
    SVnodeLoad vload = {0};
    vnodeGetLoad(pVnode->pImpl, &vload);
    taosArrayPush(pInfo->pVloads, &vload);
    pIter = taosHashIterate(pMgmt->hash, pIter);
  }

37
  taosThreadRwlockUnlock(&pMgmt->lock);
S
Shengliang Guan 已提交
38 39
}

S
Shengliang Guan 已提交
40
void vmGetMonitorInfo(SVnodeMgmt *pMgmt, SMonVmInfo *pInfo) {
S
Shengliang Guan 已提交
41
  SMonVloadInfo vloads = {0};
S
Shengliang 已提交
42
  vmGetVnodeLoads(pMgmt, &vloads);
S
Shengliang Guan 已提交
43 44 45

  SArray *pVloads = vloads.pVloads;
  if (pVloads == NULL) return;
S
Shengliang Guan 已提交
46 47 48 49 50 51 52 53 54

  int32_t totalVnodes = 0;
  int32_t masterNum = 0;
  int64_t numOfSelectReqs = 0;
  int64_t numOfInsertReqs = 0;
  int64_t numOfInsertSuccessReqs = 0;
  int64_t numOfBatchInsertReqs = 0;
  int64_t numOfBatchInsertSuccessReqs = 0;

S
Shengliang Guan 已提交
55 56
  for (int32_t i = 0; i < taosArrayGetSize(pVloads); ++i) {
    SVnodeLoad *pLoad = taosArrayGet(pVloads, i);
S
Shengliang Guan 已提交
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
    numOfSelectReqs += pLoad->numOfSelectReqs;
    numOfInsertReqs += pLoad->numOfInsertReqs;
    numOfInsertSuccessReqs += pLoad->numOfInsertSuccessReqs;
    numOfBatchInsertReqs += pLoad->numOfBatchInsertReqs;
    numOfBatchInsertSuccessReqs += pLoad->numOfBatchInsertSuccessReqs;
    if (pLoad->syncState == TAOS_SYNC_STATE_LEADER) masterNum++;
    totalVnodes++;
  }

  pInfo->vstat.totalVnodes = totalVnodes;
  pInfo->vstat.masterNum = masterNum;
  pInfo->vstat.numOfSelectReqs = numOfSelectReqs - pMgmt->state.numOfSelectReqs;
  pInfo->vstat.numOfInsertReqs = numOfInsertReqs - pMgmt->state.numOfInsertReqs;
  pInfo->vstat.numOfInsertSuccessReqs = numOfInsertSuccessReqs - pMgmt->state.numOfInsertSuccessReqs;
  pInfo->vstat.numOfBatchInsertReqs = numOfBatchInsertReqs - pMgmt->state.numOfBatchInsertReqs;
  pInfo->vstat.numOfBatchInsertSuccessReqs = numOfBatchInsertSuccessReqs - pMgmt->state.numOfBatchInsertSuccessReqs;
S
Shengliang Guan 已提交
73 74 75 76 77 78 79
  pMgmt->state.totalVnodes = totalVnodes;
  pMgmt->state.masterNum = masterNum;
  pMgmt->state.numOfSelectReqs = numOfSelectReqs;
  pMgmt->state.numOfInsertReqs = numOfInsertReqs;
  pMgmt->state.numOfInsertSuccessReqs = numOfInsertSuccessReqs;
  pMgmt->state.numOfBatchInsertReqs = numOfBatchInsertReqs;
  pMgmt->state.numOfBatchInsertSuccessReqs = numOfBatchInsertSuccessReqs;
S
Shengliang Guan 已提交
80

C
Cary Xu 已提交
81 82 83 84 85 86 87 88 89
  printf("%s:%d: Info: nInsert:%" PRIi64 ", nInsertSuccess:%" PRIi64 ", nBatch:%" PRIi64 ", nBatchSuccess:%" PRIi64
         "\n",
         __func__, __LINE__, pInfo->vstat.numOfInsertReqs, pInfo->vstat.numOfInsertSuccessReqs,
         pInfo->vstat.numOfBatchInsertReqs, pInfo->vstat.numOfBatchInsertSuccessReqs);
  printf("%s:%d: Mgmt: nInsert:%" PRIi64 ", nInsertSuccess:%" PRIi64 ", nBatch:%" PRIi64 ", nBatchSuccess:%" PRIi64
         "\n",
         __func__, __LINE__, pMgmt->state.numOfInsertReqs, pMgmt->state.numOfInsertSuccessReqs,
         pMgmt->state.numOfBatchInsertReqs, pMgmt->state.numOfBatchInsertSuccessReqs);

90
  tfsGetMonitorInfo(pMgmt->pTfs, &pInfo->tfs);
S
Shengliang Guan 已提交
91
  taosArrayDestroy(pVloads);
92 93
}

S
Shengliang Guan 已提交
94
int32_t vmProcessGetMonitorInfoReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
95
  SMonVmInfo vmInfo = {0};
S
Shengliang 已提交
96
  vmGetMonitorInfo(pMgmt, &vmInfo);
S
Shengliang Guan 已提交
97
  dmGetMonitorSystemInfo(&vmInfo.sys);
98
  monGetLogs(&vmInfo.log);
99 100 101 102 103 104 105 106 107 108 109 110 111 112

  int32_t rspLen = tSerializeSMonVmInfo(NULL, 0, &vmInfo);
  if (rspLen < 0) {
    terrno = TSDB_CODE_INVALID_MSG;
    return -1;
  }

  void *pRsp = rpcMallocCont(rspLen);
  if (pRsp == NULL) {
    terrno = TSDB_CODE_OUT_OF_MEMORY;
    return -1;
  }

  tSerializeSMonVmInfo(pRsp, rspLen, &vmInfo);
S
Shengliang Guan 已提交
113 114
  pMsg->info.rsp = pRsp;
  pMsg->info.rspLen = rspLen;
115 116 117 118
  tFreeSMonVmInfo(&vmInfo);
  return 0;
}

S
Shengliang Guan 已提交
119
int32_t vmProcessGetLoadsReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
120
  SMonVloadInfo vloads = {0};
S
Shengliang 已提交
121
  vmGetVnodeLoads(pMgmt, &vloads);
122 123 124 125 126 127 128 129 130 131 132 133 134 135

  int32_t rspLen = tSerializeSMonVloadInfo(NULL, 0, &vloads);
  if (rspLen < 0) {
    terrno = TSDB_CODE_INVALID_MSG;
    return -1;
  }

  void *pRsp = rpcMallocCont(rspLen);
  if (pRsp == NULL) {
    terrno = TSDB_CODE_OUT_OF_MEMORY;
    return -1;
  }

  tSerializeSMonVloadInfo(pRsp, rspLen, &vloads);
S
Shengliang Guan 已提交
136 137
  pMsg->info.rsp = pRsp;
  pMsg->info.rspLen = rspLen;
138 139 140 141
  tFreeSMonVloadInfo(&vloads);
  return 0;
}

S
shm  
Shengliang Guan 已提交
142
static void vmGenerateVnodeCfg(SCreateVnodeReq *pCreate, SVnodeCfg *pCfg) {
H
Hongze Cheng 已提交
143 144
  memcpy(pCfg, &vnodeCfgDefault, sizeof(SVnodeCfg));

S
shm  
Shengliang Guan 已提交
145
  pCfg->vgId = pCreate->vgId;
S
Shengliang Guan 已提交
146 147
  tstrncpy(pCfg->dbname, pCreate->db, sizeof(pCfg->dbname));
  pCfg->dbId = pCreate->dbUid;
H
Hongze Cheng 已提交
148 149
  pCfg->szPage = pCreate->pageSize * 1024;
  pCfg->szCache = pCreate->pages;
150 151
  pCfg->cacheLast = pCreate->cacheLast;
  pCfg->cacheLastSize = pCreate->cacheLastSize;
H
Hongze Cheng 已提交
152
  pCfg->szBuf = (uint64_t)pCreate->buffer * 1024 * 1024;
S
shm  
Shengliang Guan 已提交
153
  pCfg->isWeak = true;
C
Cary Xu 已提交
154
  pCfg->isTsma = pCreate->isTsma;
C
Cary Xu 已提交
155
  pCfg->tsdbCfg.compression = pCreate->compression;
H
Hongze Cheng 已提交
156
  pCfg->tsdbCfg.precision = pCreate->precision;
157 158 159 160
  pCfg->tsdbCfg.days = pCreate->daysPerFile;
  pCfg->tsdbCfg.keep0 = pCreate->daysToKeep0;
  pCfg->tsdbCfg.keep1 = pCreate->daysToKeep1;
  pCfg->tsdbCfg.keep2 = pCreate->daysToKeep2;
H
Hongze Cheng 已提交
161 162
  pCfg->tsdbCfg.minRows = pCreate->minRows;
  pCfg->tsdbCfg.maxRows = pCreate->maxRows;
C
Cary Xu 已提交
163
  for (size_t i = 0; i < taosArrayGetSize(pCreate->pRetensions); ++i) {
C
Cary Xu 已提交
164 165 166 167 168
    SRetention *pRetention = &pCfg->tsdbCfg.retentions[i];
    memcpy(pRetention, taosArrayGet(pCreate->pRetensions, i), sizeof(SRetention));
    if (i == 0) {
      if ((pRetention->freq > 0 && pRetention->keep > 0)) pCfg->isRsma = 1;
    }
C
Cary Xu 已提交
169
  }
C
Cary Xu 已提交
170

S
shm  
Shengliang Guan 已提交
171
  pCfg->walCfg.vgId = pCreate->vgId;
172
  pCfg->walCfg.fsyncPeriod = pCreate->walFsyncPeriod;
S
Shengliang Guan 已提交
173
  pCfg->walCfg.retentionPeriod = pCreate->walRetentionPeriod;
L
Liu Jicong 已提交
174 175
  pCfg->walCfg.rollPeriod = pCreate->walRollPeriod;
  pCfg->walCfg.retentionSize = pCreate->walRetentionSize;
S
Shengliang Guan 已提交
176 177 178
  pCfg->walCfg.segSize = pCreate->walSegmentSize;
  pCfg->walCfg.level = pCreate->walLevel;

H
Hongze Cheng 已提交
179
  pCfg->sttTrigger = pCreate->sstTrigger;
S
shm  
Shengliang Guan 已提交
180 181 182
  pCfg->hashBegin = pCreate->hashBegin;
  pCfg->hashEnd = pCreate->hashEnd;
  pCfg->hashMethod = pCreate->hashMethod;
183 184
  pCfg->hashPrefix = pCreate->hashPrefix;
  pCfg->hashSuffix = pCreate->hashSuffix;
185
  pCfg->tsdbPageSize = pCreate->tsdbPageSize * 1024;
M
Minghao Li 已提交
186

S
Shengliang Guan 已提交
187
  pCfg->standby = 0;
M
Minghao Li 已提交
188 189
  pCfg->syncCfg.myIndex = pCreate->selfIndex;
  pCfg->syncCfg.replicaNum = pCreate->replica;
S
Shengliang Guan 已提交
190
  memset(&pCfg->syncCfg.nodeInfo, 0, sizeof(pCfg->syncCfg.nodeInfo));
M
Minghao Li 已提交
191
  for (int i = 0; i < pCreate->replica; ++i) {
192 193 194
    SNodeInfo *pNode = &pCfg->syncCfg.nodeInfo[i];
    pNode->nodePort = pCreate->replicas[i].port;
    tstrncpy(pNode->nodeFqdn, pCreate->replicas[i].fqdn, sizeof(pNode->nodeFqdn));
M
Minghao Li 已提交
195
  }
S
shm  
Shengliang Guan 已提交
196
}
S
shm  
Shengliang Guan 已提交
197

S
Shengliang 已提交
198
static void vmGenerateWrapperCfg(SVnodeMgmt *pMgmt, SCreateVnodeReq *pCreate, SWrapperCfg *pCfg) {
S
shm  
Shengliang Guan 已提交
199 200
  pCfg->vgId = pCreate->vgId;
  pCfg->vgVersion = pCreate->vgVersion;
S
Shengliang Guan 已提交
201 202
  pCfg->dropped = 0;
  snprintf(pCfg->path, sizeof(pCfg->path), "%s%svnode%d", pMgmt->path, TD_DIRSEP, pCreate->vgId);
S
shm  
Shengliang Guan 已提交
203 204
}

C
Cary Xu 已提交
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222
static int32_t vmTsmaAdjustDays(SVnodeCfg *pCfg, SCreateVnodeReq *pReq) {
  if (pReq->isTsma) {
    SMsgHead *smaMsg = pReq->pTsma;
    uint32_t  contLen = (uint32_t)(htonl(smaMsg->contLen) - sizeof(SMsgHead));
    return smaGetTSmaDays(pCfg, POINTER_SHIFT(smaMsg, sizeof(SMsgHead)), contLen, &pCfg->tsdbCfg.days);
  }
  return 0;
}

static int32_t vmTsmaProcessCreate(SVnode *pVnode, SCreateVnodeReq *pReq) {
  if (pReq->isTsma) {
    SMsgHead *smaMsg = pReq->pTsma;
    uint32_t  contLen = (uint32_t)(htonl(smaMsg->contLen) - sizeof(SMsgHead));
    return vnodeProcessCreateTSma(pVnode, POINTER_SHIFT(smaMsg, sizeof(SMsgHead)), contLen);
  }
  return 0;
}

S
Shengliang Guan 已提交
223
int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
S
shm  
Shengliang Guan 已提交
224
  SCreateVnodeReq createReq = {0};
225 226
  SVnodeCfg       vnodeCfg = {0};
  SWrapperCfg     wrapperCfg = {0};
S
Shengliang Guan 已提交
227 228
  int32_t         code = -1;
  char            path[TSDB_FILENAME_LEN] = {0};
H
Hongze Cheng 已提交
229

S
Shengliang Guan 已提交
230
  if (tDeserializeSCreateVnodeReq(pMsg->pCont, pMsg->contLen, &createReq) != 0) {
S
shm  
Shengliang Guan 已提交
231 232 233 234
    terrno = TSDB_CODE_INVALID_MSG;
    return -1;
  }

235 236 237 238 239
  dInfo(
      "vgId:%d, start to create vnode, tsma:%d standby:%d cacheLast:%d cacheLastSize:%d sstTrigger:%d "
      "tsdbPageSize:%d",
      createReq.vgId, createReq.isTsma, createReq.standby, createReq.cacheLast, createReq.cacheLastSize,
      createReq.sstTrigger, createReq.tsdbPageSize);
240
  dInfo("vgId:%d, hashMethod:%d begin:%u end:%u prefix:%d surfix:%d", createReq.vgId, createReq.hashMethod,
H
Hongze Cheng 已提交
241
        createReq.hashBegin, createReq.hashEnd, createReq.hashPrefix, createReq.hashSuffix);
S
shm  
Shengliang Guan 已提交
242 243
  vmGenerateVnodeCfg(&createReq, &vnodeCfg);

C
Cary Xu 已提交
244 245 246 247
  if (vmTsmaAdjustDays(&vnodeCfg, &createReq) < 0) {
    dError("vgId:%d, failed to adjust tsma days since %s", createReq.vgId, terrstr());
    code = terrno;
    goto _OVER;
C
Cary Xu 已提交
248 249
  }

S
shm  
Shengliang Guan 已提交
250 251 252 253 254
  vmGenerateWrapperCfg(pMgmt, &createReq, &wrapperCfg);

  SVnodeObj *pVnode = vmAcquireVnode(pMgmt, createReq.vgId);
  if (pVnode != NULL) {
    dDebug("vgId:%d, already exist", createReq.vgId);
S
Shengliang Guan 已提交
255
    tFreeSCreateVnodeReq(&createReq);
S
shm  
Shengliang Guan 已提交
256
    vmReleaseVnode(pMgmt, pVnode);
257
    terrno = TSDB_CODE_NODE_ALREADY_DEPLOYED;
C
Cary Xu 已提交
258
    code = terrno;
259
    return 0;
S
shm  
Shengliang Guan 已提交
260 261
  }

H
Hongze Cheng 已提交
262 263 264 265
  snprintf(path, TSDB_FILENAME_LEN, "vnode%svnode%d", TD_DIRSEP, vnodeCfg.vgId);
  if (vnodeCreate(path, &vnodeCfg, pMgmt->pTfs) < 0) {
    tFreeSCreateVnodeReq(&createReq);
    dError("vgId:%d, failed to create vnode since %s", createReq.vgId, terrstr());
C
Cary Xu 已提交
266 267
    code = terrno;
    goto _OVER;
H
Hongze Cheng 已提交
268 269
  }

S
Shengliang 已提交
270
  SVnode *pImpl = vnodeOpen(path, pMgmt->pTfs, pMgmt->msgCb);
S
shm  
Shengliang Guan 已提交
271
  if (pImpl == NULL) {
C
Cary Xu 已提交
272
    dError("vgId:%d, failed to open vnode since %s", createReq.vgId, terrstr());
273
    code = terrno;
S
Shengliang Guan 已提交
274
    goto _OVER;
S
shm  
Shengliang Guan 已提交
275 276
  }

S
Shengliang Guan 已提交
277
  code = vmOpenVnode(pMgmt, &wrapperCfg, pImpl);
S
shm  
Shengliang Guan 已提交
278 279
  if (code != 0) {
    dError("vgId:%d, failed to open vnode since %s", createReq.vgId, terrstr());
C
Cary Xu 已提交
280
    code = terrno;
S
Shengliang Guan 已提交
281
    goto _OVER;
S
shm  
Shengliang Guan 已提交
282 283
  }

C
Cary Xu 已提交
284 285 286 287 288
  code = vmTsmaProcessCreate(pImpl, &createReq);
  if (code != 0) {
    dError("vgId:%d, failed to create tsma since %s", createReq.vgId, terrstr());
    code = terrno;
    goto _OVER;
C
Cary Xu 已提交
289 290
  }

L
Li Minghao 已提交
291 292 293
  code = vnodeStart(pImpl);
  if (code != 0) {
    dError("vgId:%d, failed to start sync since %s", createReq.vgId, terrstr());
S
Shengliang Guan 已提交
294
    goto _OVER;
L
Li Minghao 已提交
295 296
  }

S
Shengliang Guan 已提交
297
  code = vmWriteVnodeListToFile(pMgmt);
C
Cary Xu 已提交
298 299 300 301
  if (code != 0) {
    code = terrno;
    goto _OVER;
  }
S
Shengliang Guan 已提交
302 303

_OVER:
S
shm  
Shengliang Guan 已提交
304 305
  if (code != 0) {
    vnodeClose(pImpl);
H
refact  
Hongze Cheng 已提交
306
    vnodeDestroy(path, pMgmt->pTfs);
S
Shengliang Guan 已提交
307 308
  } else {
    dInfo("vgId:%d, vnode is created", createReq.vgId);
S
shm  
Shengliang Guan 已提交
309 310
  }

S
Shengliang Guan 已提交
311 312 313
  tFreeSCreateVnodeReq(&createReq);
  terrno = code;
  return code;
S
shm  
Shengliang Guan 已提交
314 315
}

S
Shengliang Guan 已提交
316
int32_t vmProcessDropVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
S
shm  
Shengliang Guan 已提交
317
  SDropVnodeReq dropReq = {0};
S
Shengliang Guan 已提交
318
  if (tDeserializeSDropVnodeReq(pMsg->pCont, pMsg->contLen, &dropReq) != 0) {
S
shm  
Shengliang Guan 已提交
319 320 321 322 323
    terrno = TSDB_CODE_INVALID_MSG;
    return -1;
  }

  int32_t vgId = dropReq.vgId;
S
Shengliang Guan 已提交
324
  dDebug("vgId:%d, start to drop vnode", vgId);
S
shm  
Shengliang Guan 已提交
325 326 327 328

  SVnodeObj *pVnode = vmAcquireVnode(pMgmt, vgId);
  if (pVnode == NULL) {
    dDebug("vgId:%d, failed to drop since %s", vgId, terrstr());
329
    terrno = TSDB_CODE_NODE_NOT_DEPLOYED;
S
shm  
Shengliang Guan 已提交
330 331 332 333
    return -1;
  }

  pVnode->dropped = 1;
S
Shengliang Guan 已提交
334
  if (vmWriteVnodeListToFile(pMgmt) != 0) {
S
shm  
Shengliang Guan 已提交
335 336 337 338 339 340
    pVnode->dropped = 0;
    vmReleaseVnode(pMgmt, pVnode);
    return -1;
  }

  vmCloseVnode(pMgmt, pVnode);
S
Shengliang Guan 已提交
341
  vmWriteVnodeListToFile(pMgmt);
S
shm  
Shengliang Guan 已提交
342 343 344 345

  return 0;
}

S
Shengliang Guan 已提交
346
SArray *vmGetMsgHandles() {
S
Shengliang 已提交
347
  int32_t code = -1;
S
Shengliang Guan 已提交
348
  SArray *pArray = taosArrayInit(32, sizeof(SMgmtHandle));
S
Shengliang 已提交
349 350
  if (pArray == NULL) goto _OVER;

S
Shengliang Guan 已提交
351 352
  if (dmSetMgmtHandle(pArray, TDMT_MON_VM_INFO, vmPutMsgToMonitorQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_MON_VM_LOAD, vmPutMsgToMonitorQueue, 0) == NULL) goto _OVER;
353

S
Shengliang Guan 已提交
354
  if (dmSetMgmtHandle(pArray, TDMT_VND_SUBMIT, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
D
dapan1121 已提交
355
  if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY, vmPutMsgToQueryQueue, 0) == NULL) goto _OVER;
D
dapan1121 已提交
356
  if (dmSetMgmtHandle(pArray, TDMT_SCH_MERGE_QUERY, vmPutMsgToQueryQueue, 0) == NULL) goto _OVER;
D
dapan1121 已提交
357
  if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_CONTINUE, vmPutMsgToQueryQueue, 0) == NULL) goto _OVER;
C
Cary Xu 已提交
358
  if (dmSetMgmtHandle(pArray, TDMT_VND_FETCH_RSMA, vmPutMsgToQueryQueue, 0) == NULL) goto _OVER;
C
Cary Xu 已提交
359
  if (dmSetMgmtHandle(pArray, TDMT_VND_EXEC_RSMA, vmPutMsgToQueryQueue, 0) == NULL) goto _OVER;
D
dapan1121 已提交
360
  if (dmSetMgmtHandle(pArray, TDMT_SCH_FETCH, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER;
D
dapan1121 已提交
361
  if (dmSetMgmtHandle(pArray, TDMT_SCH_MERGE_FETCH, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER;
S
Shengliang Guan 已提交
362 363 364
  if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_TABLE, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_VND_UPDATE_TAG_VAL, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_VND_TABLE_META, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER;
D
dapan1121 已提交
365
  if (dmSetMgmtHandle(pArray, TDMT_VND_TABLE_CFG, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER;
D
dapan1121 已提交
366
  if (dmSetMgmtHandle(pArray, TDMT_VND_BATCH_META, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER;
S
Shengliang Guan 已提交
367
  if (dmSetMgmtHandle(pArray, TDMT_VND_TABLES_META, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER;
D
dapan1121 已提交
368 369
  if (dmSetMgmtHandle(pArray, TDMT_SCH_CANCEL_TASK, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_SCH_DROP_TASK, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER;
S
Shengliang Guan 已提交
370
  if (dmSetMgmtHandle(pArray, TDMT_VND_CREATE_STB, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
wmmhello's avatar
wmmhello 已提交
371
  if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_TTL_TABLE, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
S
Shengliang Guan 已提交
372 373 374 375 376 377 378 379 380 381
  if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_STB, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_STB, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_VND_CREATE_TABLE, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_TABLE, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_VND_CREATE_SMA, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_VND_CANCEL_SMA, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_SMA, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_VND_SUBMIT_RSMA, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_VND_MQ_VG_CHANGE, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_VND_MQ_VG_DELETE, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
382
  if (dmSetMgmtHandle(pArray, TDMT_VND_MQ_COMMIT_OFFSET, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
383 384
  if (dmSetMgmtHandle(pArray, TDMT_VND_ADD_CHECK_INFO, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_VND_DELETE_CHECK_INFO, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
S
Shengliang Guan 已提交
385
  if (dmSetMgmtHandle(pArray, TDMT_VND_CONSUME, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER;
386
  if (dmSetMgmtHandle(pArray, TDMT_VND_DELETE, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
387
  if (dmSetMgmtHandle(pArray, TDMT_VND_BATCH_DEL, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
H
Hongze Cheng 已提交
388
  if (dmSetMgmtHandle(pArray, TDMT_VND_COMMIT, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
D
dapan1121 已提交
389
  if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_HEARTBEAT, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER;
390

L
Liu Jicong 已提交
391
  if (dmSetMgmtHandle(pArray, TDMT_VND_STREAM_TRIGGER, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
L
Liu Jicong 已提交
392
  if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DROP, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
S
Shengliang Guan 已提交
393
  if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DEPLOY, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
L
Liu Jicong 已提交
394 395 396 397 398 399 400
  if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_RUN, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DISPATCH, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DISPATCH_RSP, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_RECOVER, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_RECOVER_RSP, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_STREAM_RETRIEVE, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_STREAM_RETRIEVE_RSP, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
S
Shengliang Guan 已提交
401 402 403

  if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_REPLICA, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_CONFIG, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
404
  if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_CONFIRM, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
S
Shengliang Guan 已提交
405
  if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_HASHRANGE, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
S
Shengliang Guan 已提交
406
  if (dmSetMgmtHandle(pArray, TDMT_VND_COMPACT, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
S
Shengliang Guan 已提交
407
  if (dmSetMgmtHandle(pArray, TDMT_VND_TRIM, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
S
Shengliang Guan 已提交
408 409 410
  if (dmSetMgmtHandle(pArray, TDMT_DND_CREATE_VNODE, vmPutMsgToMgmtQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_DND_DROP_VNODE, vmPutMsgToMgmtQueue, 0) == NULL) goto _OVER;

411 412 413 414
  if (dmSetMgmtHandle(pArray, TDMT_SYNC_TIMEOUT, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_SYNC_PING, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_SYNC_PING_REPLY, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_SYNC_CLIENT_REQUEST, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
415
  if (dmSetMgmtHandle(pArray, TDMT_SYNC_CLIENT_REQUEST_BATCH, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
416 417 418 419
  if (dmSetMgmtHandle(pArray, TDMT_SYNC_CLIENT_REQUEST_REPLY, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_SYNC_REQUEST_VOTE, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_SYNC_REQUEST_VOTE_REPLY, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_SYNC_APPEND_ENTRIES, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
420
  if (dmSetMgmtHandle(pArray, TDMT_SYNC_APPEND_ENTRIES_BATCH, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
421
  if (dmSetMgmtHandle(pArray, TDMT_SYNC_APPEND_ENTRIES_REPLY, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
422 423
  if (dmSetMgmtHandle(pArray, TDMT_SYNC_SNAPSHOT_SEND, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
  if (dmSetMgmtHandle(pArray, TDMT_SYNC_SNAPSHOT_RSP, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
424
  if (dmSetMgmtHandle(pArray, TDMT_SYNC_SET_VNODE_STANDBY, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
S
Shengliang 已提交
425 426 427 428 429 430 431 432 433 434

  code = 0;

_OVER:
  if (code != 0) {
    taosArrayDestroy(pArray);
    return NULL;
  } else {
    return pArray;
  }
S
shm  
Shengliang Guan 已提交
435
}