You need to sign in or sign up before continuing.
mndDnode.c 25.3 KB
Newer Older
H
refact  
Hongze Cheng 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
 * 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/>.
 */

S
Shengliang Guan 已提交
16
#define _DEFAULT_SOURCE
S
Shengliang Guan 已提交
17 18
#include "mndDnode.h"
#include "mndMnode.h"
S
Shengliang Guan 已提交
19
#include "mndShow.h"
S
Shengliang Guan 已提交
20
#include "mndTrans.h"
S
Shengliang Guan 已提交
21
#include "mndVgroup.h"
S
Shengliang Guan 已提交
22

S
Shengliang Guan 已提交
23
#define TSDB_DNODE_VER_NUMBER 1
24
#define TSDB_DNODE_RESERVE_SIZE 64
S
Shengliang Guan 已提交
25 26 27
#define TSDB_CONFIG_OPTION_LEN 16
#define TSDB_CONIIG_VALUE_LEN 48
#define TSDB_CONFIG_NUMBER 8
S
Shengliang Guan 已提交
28

S
Shengliang Guan 已提交
29
static const char *offlineReason[] = {
S
Shengliang Guan 已提交
30 31 32 33 34 35 36 37 38 39 40 41 42
    "",
    "status msg timeout",
    "status not received",
    "version not match",
    "dnodeId not match",
    "clusterId not match",
    "interval not match",
    "timezone not match",
    "locale not match",
    "charset not match",
    "unknown",
};

S
Shengliang Guan 已提交
43 44 45 46 47
static int32_t  mndCreateDefaultDnode(SMnode *pMnode);
static SSdbRaw *mndDnodeActionEncode(SDnodeObj *pDnode);
static SSdbRow *mndDnodeActionDecode(SSdbRaw *pRaw);
static int32_t  mndDnodeActionInsert(SSdb *pSdb, SDnodeObj *pDnode);
static int32_t  mndDnodeActionDelete(SSdb *pSdb, SDnodeObj *pDnode);
48
static int32_t  mndDnodeActionUpdate(SSdb *pSdb, SDnodeObj *pOld, SDnodeObj *pNew);
S
Shengliang Guan 已提交
49

S
Shengliang Guan 已提交
50 51 52 53 54 55
static int32_t mndProcessCreateDnodeReq(SMnodeMsg *pReq);
static int32_t mndProcessDropDnodeReq(SMnodeMsg *pReq);
static int32_t mndProcessConfigDnodeReq(SMnodeMsg *pReq);
static int32_t mndProcessConfigDnodeRsp(SMnodeMsg *pRsp);
static int32_t mndProcessStatusReq(SMnodeMsg *pReq);

S
Shengliang Guan 已提交
56
static int32_t mndGetConfigMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta);
S
Shengliang Guan 已提交
57
static int32_t mndRetrieveConfigs(SMnodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
S
Shengliang Guan 已提交
58
static void    mndCancelGetNextConfig(SMnode *pMnode, void *pIter);
S
Shengliang Guan 已提交
59
static int32_t mndGetDnodeMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta);
S
Shengliang Guan 已提交
60
static int32_t mndRetrieveDnodes(SMnodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
S
Shengliang Guan 已提交
61
static void    mndCancelGetNextDnode(SMnode *pMnode, void *pIter);
S
Shengliang Guan 已提交
62 63 64 65 66 67 68 69 70 71 72

int32_t mndInitDnode(SMnode *pMnode) {
  SSdbTable table = {.sdbType = SDB_DNODE,
                     .keyType = SDB_KEY_INT32,
                     .deployFp = (SdbDeployFp)mndCreateDefaultDnode,
                     .encodeFp = (SdbEncodeFp)mndDnodeActionEncode,
                     .decodeFp = (SdbDecodeFp)mndDnodeActionDecode,
                     .insertFp = (SdbInsertFp)mndDnodeActionInsert,
                     .updateFp = (SdbUpdateFp)mndDnodeActionUpdate,
                     .deleteFp = (SdbDeleteFp)mndDnodeActionDelete};

S
Shengliang Guan 已提交
73 74 75
  mndSetMsgHandle(pMnode, TDMT_MND_CREATE_DNODE, mndProcessCreateDnodeReq);
  mndSetMsgHandle(pMnode, TDMT_MND_DROP_DNODE, mndProcessDropDnodeReq);
  mndSetMsgHandle(pMnode, TDMT_MND_CONFIG_DNODE, mndProcessConfigDnodeReq);
H
Hongze Cheng 已提交
76
  mndSetMsgHandle(pMnode, TDMT_DND_CONFIG_DNODE_RSP, mndProcessConfigDnodeRsp);
S
Shengliang Guan 已提交
77
  mndSetMsgHandle(pMnode, TDMT_MND_STATUS, mndProcessStatusReq);
S
Shengliang Guan 已提交
78

S
Shengliang Guan 已提交
79 80 81 82 83 84 85
  mndAddShowMetaHandle(pMnode, TSDB_MGMT_TABLE_VARIABLES, mndGetConfigMeta);
  mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_VARIABLES, mndRetrieveConfigs);
  mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_VARIABLES, mndCancelGetNextConfig);
  mndAddShowMetaHandle(pMnode, TSDB_MGMT_TABLE_DNODE, mndGetDnodeMeta);
  mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_DNODE, mndRetrieveDnodes);
  mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_DNODE, mndCancelGetNextDnode);

S
Shengliang Guan 已提交
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
  return sdbSetTable(pMnode->pSdb, table);
}

void mndCleanupDnode(SMnode *pMnode) {}

static int32_t mndCreateDefaultDnode(SMnode *pMnode) {
  SDnodeObj dnodeObj = {0};
  dnodeObj.id = 1;
  dnodeObj.createdTime = taosGetTimestampMs();
  dnodeObj.updateTime = dnodeObj.createdTime;
  dnodeObj.port = pMnode->replicas[0].port;
  memcpy(&dnodeObj.fqdn, pMnode->replicas[0].fqdn, TSDB_FQDN_LEN);

  SSdbRaw *pRaw = mndDnodeActionEncode(&dnodeObj);
  if (pRaw == NULL) return -1;
S
Shengliang Guan 已提交
101
  if (sdbSetRawStatus(pRaw, SDB_STATUS_READY) != 0) return -1;
S
Shengliang Guan 已提交
102

103
  mDebug("dnode:%d, will be created while deploy sdb, raw:%p", dnodeObj.id, pRaw);
S
Shengliang Guan 已提交
104 105 106
  return sdbWrite(pMnode->pSdb, pRaw);
}

S
Shengliang Guan 已提交
107
static SSdbRaw *mndDnodeActionEncode(SDnodeObj *pDnode) {
108 109
  terrno = TSDB_CODE_OUT_OF_MEMORY;

S
Shengliang Guan 已提交
110
  SSdbRaw *pRaw = sdbAllocRaw(SDB_DNODE, TSDB_DNODE_VER_NUMBER, sizeof(SDnodeObj) + TSDB_DNODE_RESERVE_SIZE);
111
  if (pRaw == NULL) goto DNODE_ENCODE_OVER;
S
Shengliang Guan 已提交
112 113

  int32_t dataPos = 0;
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
  SDB_SET_INT32(pRaw, dataPos, pDnode->id, DNODE_ENCODE_OVER)
  SDB_SET_INT64(pRaw, dataPos, pDnode->createdTime, DNODE_ENCODE_OVER)
  SDB_SET_INT64(pRaw, dataPos, pDnode->updateTime, DNODE_ENCODE_OVER)
  SDB_SET_INT16(pRaw, dataPos, pDnode->port, DNODE_ENCODE_OVER)
  SDB_SET_BINARY(pRaw, dataPos, pDnode->fqdn, TSDB_FQDN_LEN, DNODE_ENCODE_OVER)
  SDB_SET_RESERVE(pRaw, dataPos, TSDB_DNODE_RESERVE_SIZE, DNODE_ENCODE_OVER)
  SDB_SET_DATALEN(pRaw, dataPos, DNODE_ENCODE_OVER);

  terrno = 0;

DNODE_ENCODE_OVER:
  if (terrno != 0) {
    mError("dnode:%d, failed to encode to raw:%p since %s", pDnode->id, pRaw, terrstr());
    sdbFreeRaw(pRaw);
    return NULL;
  }
S
Shengliang Guan 已提交
130

131
  mTrace("dnode:%d, encode to raw:%p, row:%p", pDnode->id, pRaw, pDnode);
S
Shengliang Guan 已提交
132 133 134 135
  return pRaw;
}

static SSdbRow *mndDnodeActionDecode(SSdbRaw *pRaw) {
136 137
  terrno = TSDB_CODE_OUT_OF_MEMORY;

S
Shengliang Guan 已提交
138
  int8_t sver = 0;
139
  if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto DNODE_DECODE_OVER;
S
Shengliang Guan 已提交
140

S
Shengliang Guan 已提交
141
  if (sver != TSDB_DNODE_VER_NUMBER) {
S
Shengliang Guan 已提交
142
    terrno = TSDB_CODE_SDB_INVALID_DATA_VER;
143
    goto DNODE_DECODE_OVER;
S
Shengliang Guan 已提交
144 145
  }

146 147 148
  SSdbRow *pRow = sdbAllocRow(sizeof(SDnodeObj));
  if (pRow == NULL) goto DNODE_DECODE_OVER;

S
Shengliang Guan 已提交
149
  SDnodeObj *pDnode = sdbGetRowObj(pRow);
150
  if (pDnode == NULL) goto DNODE_DECODE_OVER;
S
Shengliang Guan 已提交
151 152

  int32_t dataPos = 0;
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
  SDB_GET_INT32(pRaw, dataPos, &pDnode->id, DNODE_DECODE_OVER)
  SDB_GET_INT64(pRaw, dataPos, &pDnode->createdTime, DNODE_DECODE_OVER)
  SDB_GET_INT64(pRaw, dataPos, &pDnode->updateTime, DNODE_DECODE_OVER)
  SDB_GET_INT16(pRaw, dataPos, &pDnode->port, DNODE_DECODE_OVER)
  SDB_GET_BINARY(pRaw, dataPos, pDnode->fqdn, TSDB_FQDN_LEN, DNODE_DECODE_OVER)
  SDB_GET_RESERVE(pRaw, dataPos, TSDB_DNODE_RESERVE_SIZE, DNODE_DECODE_OVER)

  terrno = 0;

DNODE_DECODE_OVER:
  if (terrno != 0) {
    mError("dnode:%d, failed to decode from raw:%p since %s", pDnode->id, pRaw, terrstr());
    tfree(pRow);
    return NULL;
  }
S
Shengliang Guan 已提交
168

169
  mTrace("dnode:%d, decode from raw:%p, row:%p", pDnode->id, pRaw, pDnode);
S
Shengliang Guan 已提交
170 171 172
  return pRow;
}

173
static int32_t mndDnodeActionInsert(SSdb *pSdb, SDnodeObj *pDnode) {
174
  mTrace("dnode:%d, perform insert action, row:%p", pDnode->id, pDnode);
S
Shengliang Guan 已提交
175
  pDnode->offlineReason = DND_REASON_STATUS_NOT_RECEIVED;
S
Shengliang Guan 已提交
176 177 178 179
  snprintf(pDnode->ep, TSDB_EP_LEN, "%s:%u", pDnode->fqdn, pDnode->port);
  return 0;
}

S
Shengliang Guan 已提交
180
static int32_t mndDnodeActionDelete(SSdb *pSdb, SDnodeObj *pDnode) {
181
  mTrace("dnode:%d, perform delete action, row:%p", pDnode->id, pDnode);
S
Shengliang Guan 已提交
182 183
  return 0;
}
S
Shengliang Guan 已提交
184

185
static int32_t mndDnodeActionUpdate(SSdb *pSdb, SDnodeObj *pOld, SDnodeObj *pNew) {
S
Shengliang Guan 已提交
186
  mTrace("dnode:%d, perform update action, old row:%p new row:%p", pOld->id, pOld, pNew);
187
  pOld->updateTime = pNew->updateTime;
S
Shengliang Guan 已提交
188
  return 0;
S
Shengliang Guan 已提交
189 190
}

S
Shengliang Guan 已提交
191
SDnodeObj *mndAcquireDnode(SMnode *pMnode, int32_t dnodeId) {
S
Shengliang Guan 已提交
192 193 194 195 196 197
  SSdb      *pSdb = pMnode->pSdb;
  SDnodeObj *pDnode = sdbAcquire(pSdb, SDB_DNODE, &dnodeId);
  if (pDnode == NULL) {
    terrno = TSDB_CODE_MND_DNODE_NOT_EXIST;
  }
  return pDnode;
S
Shengliang Guan 已提交
198
}
S
Shengliang Guan 已提交
199

S
Shengliang Guan 已提交
200 201 202
void mndReleaseDnode(SMnode *pMnode, SDnodeObj *pDnode) {
  SSdb *pSdb = pMnode->pSdb;
  sdbRelease(pSdb, pDnode);
S
Shengliang Guan 已提交
203 204
}

S
Shengliang Guan 已提交
205
SEpSet mndGetDnodeEpset(SDnodeObj *pDnode) {
H
Haojun Liao 已提交
206 207
  SEpSet epSet = {0};
  addEpIntoEpSet(&epSet, pDnode->fqdn, pDnode->port);
S
Shengliang Guan 已提交
208 209 210
  return epSet;
}

S
Shengliang Guan 已提交
211 212 213 214 215 216 217 218 219 220 221 222 223
static SDnodeObj *mndAcquireDnodeByEp(SMnode *pMnode, char *pEpStr) {
  SSdb *pSdb = pMnode->pSdb;

  void *pIter = NULL;
  while (1) {
    SDnodeObj *pDnode = NULL;
    pIter = sdbFetch(pSdb, SDB_DNODE, pIter, (void **)&pDnode);
    if (pIter == NULL) break;

    if (strncasecmp(pEpStr, pDnode->ep, TSDB_EP_LEN) == 0) {
      sdbCancelFetch(pSdb, pIter);
      return pDnode;
    }
S
Shengliang Guan 已提交
224 225

    sdbRelease(pSdb, pDnode);
S
Shengliang Guan 已提交
226 227 228 229 230
  }

  return NULL;
}

S
Shengliang Guan 已提交
231
int32_t mndGetDnodeSize(SMnode *pMnode) {
S
Shengliang Guan 已提交
232 233 234 235
  SSdb *pSdb = pMnode->pSdb;
  return sdbGetSize(pSdb, SDB_DNODE);
}

S
Shengliang Guan 已提交
236
bool mndIsDnodeOnline(SMnode *pMnode, SDnodeObj *pDnode, int64_t curMs) {
dengyihao's avatar
dengyihao 已提交
237
  int64_t interval = TABS(pDnode->lastAccessTime - curMs);
S
Shengliang Guan 已提交
238
  if (interval > 3500 * pMnode->cfg.statusInterval) {
S
Shengliang Guan 已提交
239 240 241
    if (pDnode->rebootTime > 0) {
      pDnode->offlineReason = DND_REASON_STATUS_MSG_TIMEOUT;
    }
S
Shengliang Guan 已提交
242 243 244 245 246
    return false;
  }
  return true;
}

247
static void mndGetDnodeData(SMnode *pMnode, SDnodeEps *pEps, int32_t maxEps) {
S
Shengliang Guan 已提交
248 249
  SSdb *pSdb = pMnode->pSdb;

250
  int32_t numOfEps = 0;
S
Shengliang Guan 已提交
251 252 253 254 255
  void   *pIter = NULL;
  while (1) {
    SDnodeObj *pDnode = NULL;
    pIter = sdbFetch(pSdb, SDB_DNODE, pIter, (void **)&pDnode);
    if (pIter == NULL) break;
256
    if (numOfEps >= maxEps) {
S
Shengliang Guan 已提交
257
      sdbCancelFetch(pSdb, pIter);
258
      sdbRelease(pSdb, pDnode);
S
Shengliang Guan 已提交
259 260 261
      break;
    }

262
    SDnodeEp *pEp = &pEps->eps[numOfEps];
S
Shengliang Guan 已提交
263
    pEp->id = htonl(pDnode->id);
H
Haojun Liao 已提交
264 265
    pEp->ep.port = htons(pDnode->port);
    memcpy(pEp->ep.fqdn, pDnode->fqdn, TSDB_FQDN_LEN);
S
Shengliang Guan 已提交
266 267 268 269
    pEp->isMnode = 0;
    if (mndIsMnode(pMnode, pDnode->id)) {
      pEp->isMnode = 1;
    }
270
    numOfEps++;
271
    sdbRelease(pSdb, pDnode);
S
Shengliang Guan 已提交
272 273
  }

274
  pEps->num = htonl(numOfEps);
S
Shengliang Guan 已提交
275 276 277
}

static int32_t mndCheckClusterCfgPara(SMnode *pMnode, const SClusterCfg *pCfg) {
S
Shengliang Guan 已提交
278
  if (pCfg->statusInterval != pMnode->cfg.statusInterval) {
279
    mError("statusInterval [%d - %d] cfg inconsistent", pCfg->statusInterval, pMnode->cfg.statusInterval);
S
Shengliang Guan 已提交
280 281 282
    return DND_REASON_STATUS_INTERVAL_NOT_MATCH;
  }

S
Shengliang Guan 已提交
283
  if ((0 != strcasecmp(pCfg->timezone, pMnode->cfg.timezone)) && (pMnode->checkTime != pCfg->checkTime)) {
284
    mError("timezone [%s - %s] [%" PRId64 " - %" PRId64 "] cfg inconsistent", pCfg->timezone, pMnode->cfg.timezone,
S
Shengliang Guan 已提交
285
           pCfg->checkTime, pMnode->checkTime);
S
Shengliang Guan 已提交
286 287 288
    return DND_REASON_TIME_ZONE_NOT_MATCH;
  }

S
Shengliang Guan 已提交
289
  if (0 != strcasecmp(pCfg->locale, pMnode->cfg.locale)) {
290
    mError("locale [%s - %s]  cfg inconsistent", pCfg->locale, pMnode->cfg.locale);
S
Shengliang Guan 已提交
291 292 293
    return DND_REASON_LOCALE_NOT_MATCH;
  }

S
Shengliang Guan 已提交
294
  if (0 != strcasecmp(pCfg->charset, pMnode->cfg.charset)) {
295
    mError("charset [%s - %s] cfg inconsistent.", pCfg->charset, pMnode->cfg.charset);
S
Shengliang Guan 已提交
296 297 298 299 300 301
    return DND_REASON_CHARSET_NOT_MATCH;
  }

  return 0;
}

S
Shengliang Guan 已提交
302
static int32_t mndProcessStatusReq(SMnodeMsg *pReq) {
S
Shengliang Guan 已提交
303 304 305 306
  SMnode    *pMnode = pReq->pMnode;
  SStatusReq statusReq = {0};
  SDnodeObj *pDnode = NULL;
  int32_t    code = -1;
S
Shengliang Guan 已提交
307

S
Shengliang Guan 已提交
308
  if (tDeserializeSStatusReq(pReq->rpcMsg.pCont, &statusReq) == NULL) goto PROCESS_STATUS_MSG_OVER;
S
Shengliang Guan 已提交
309

S
Shengliang Guan 已提交
310 311
  if (statusReq.dnodeId == 0) {
    pDnode = mndAcquireDnodeByEp(pMnode, statusReq.dnodeEp);
S
Shengliang Guan 已提交
312
    if (pDnode == NULL) {
S
Shengliang Guan 已提交
313
      mDebug("dnode:%s, not created yet", statusReq.dnodeEp);
314
      terrno = TSDB_CODE_MND_DNODE_NOT_EXIST;
S
Shengliang Guan 已提交
315
      goto PROCESS_STATUS_MSG_OVER;
S
Shengliang Guan 已提交
316 317
    }
  } else {
S
Shengliang Guan 已提交
318
    pDnode = mndAcquireDnode(pMnode, statusReq.dnodeId);
S
Shengliang Guan 已提交
319
    if (pDnode == NULL) {
S
Shengliang Guan 已提交
320
      pDnode = mndAcquireDnodeByEp(pMnode, statusReq.dnodeEp);
S
Shengliang Guan 已提交
321
      if (pDnode != NULL) {
S
Shengliang Guan 已提交
322 323
        pDnode->offlineReason = DND_REASON_DNODE_ID_NOT_MATCH;
      }
S
Shengliang Guan 已提交
324
      mError("dnode:%d, %s not exist", statusReq.dnodeId, statusReq.dnodeEp);
325
      terrno = TSDB_CODE_MND_DNODE_NOT_EXIST;
S
Shengliang Guan 已提交
326
      goto PROCESS_STATUS_MSG_OVER;
S
Shengliang Guan 已提交
327 328 329
    }
  }

S
Shengliang Guan 已提交
330 331
  int64_t curMs = taosGetTimestampMs();
  bool    online = mndIsDnodeOnline(pMnode, pDnode, curMs);
S
Shengliang Guan 已提交
332 333
  bool    dnodeChanged = (statusReq.dver != sdbGetTableVer(pMnode->pSdb, SDB_DNODE));
  bool    reboot = (pDnode->rebootTime != statusReq.rebootTime);
334
  bool    needCheck = !online || dnodeChanged || reboot;
S
Shengliang Guan 已提交
335

336
  if (needCheck) {
S
Shengliang Guan 已提交
337
    if (statusReq.sver != pMnode->cfg.sver) {
S
Shengliang Guan 已提交
338
      if (pDnode != NULL) {
S
Shengliang Guan 已提交
339
        pDnode->offlineReason = DND_REASON_VERSION_NOT_MATCH;
S
Shengliang Guan 已提交
340
      }
S
Shengliang Guan 已提交
341
      mError("dnode:%d, status msg version:%d not match cluster:%d", statusReq.dnodeId, statusReq.sver, pMnode->cfg.sver);
S
Shengliang Guan 已提交
342
      terrno = TSDB_CODE_MND_INVALID_MSG_VERSION;
S
Shengliang Guan 已提交
343
      goto PROCESS_STATUS_MSG_OVER;
S
Shengliang Guan 已提交
344 345
    }

S
Shengliang Guan 已提交
346
    if (statusReq.dnodeId == 0) {
S
Shengliang Guan 已提交
347
      mDebug("dnode:%d, %s first access, set clusterId %" PRId64, pDnode->id, pDnode->ep, pMnode->clusterId);
S
Shengliang Guan 已提交
348
    } else {
S
Shengliang Guan 已提交
349
      if (statusReq.clusterId != pMnode->clusterId) {
S
Shengliang Guan 已提交
350 351 352
        if (pDnode != NULL) {
          pDnode->offlineReason = DND_REASON_CLUSTER_ID_NOT_MATCH;
        }
S
Shengliang Guan 已提交
353
        mError("dnode:%d, clusterId %" PRId64 " not match exist %" PRId64, pDnode->id, statusReq.clusterId,
S
Shengliang Guan 已提交
354 355 356 357 358 359 360
               pMnode->clusterId);
        terrno = TSDB_CODE_MND_INVALID_CLUSTER_ID;
        goto PROCESS_STATUS_MSG_OVER;
      } else {
        pDnode->accessTimes++;
        mTrace("dnode:%d, status received, access times %d", pDnode->id, pDnode->accessTimes);
      }
S
Shengliang Guan 已提交
361 362 363
    }

    // Verify whether the cluster parameters are consistent when status change from offline to ready
S
Shengliang Guan 已提交
364
    int32_t ret = mndCheckClusterCfgPara(pMnode, &statusReq.clusterCfg);
S
Shengliang Guan 已提交
365 366 367
    if (0 != ret) {
      pDnode->offlineReason = ret;
      mError("dnode:%d, cluster cfg inconsistent since:%s", pDnode->id, offlineReason[ret]);
368
      terrno = TSDB_CODE_MND_INVALID_CLUSTER_CFG;
S
Shengliang Guan 已提交
369
      goto PROCESS_STATUS_MSG_OVER;
S
Shengliang Guan 已提交
370 371
    }

372 373 374 375 376
    if (!online) {
      mInfo("dnode:%d, from offline to online", pDnode->id);
    } else {
      mDebug("dnode:%d, send dnode eps", pDnode->id);
    }
S
Shengliang Guan 已提交
377

S
Shengliang Guan 已提交
378 379 380
    pDnode->rebootTime = statusReq.rebootTime;
    pDnode->numOfCores = statusReq.numOfCores;
    pDnode->numOfSupportVnodes = statusReq.numOfSupportVnodes;
S
Shengliang Guan 已提交
381

S
Shengliang Guan 已提交
382 383 384 385 386 387 388 389
    int32_t     numOfEps = mndGetDnodeSize(pMnode);
    int32_t     contLen = sizeof(SStatusRsp) + numOfEps * sizeof(SDnodeEp);
    SStatusRsp *pRsp = rpcMallocCont(contLen);
    if (pRsp == NULL) {
      terrno = TSDB_CODE_OUT_OF_MEMORY;
      goto PROCESS_STATUS_MSG_OVER;
    }

390
    pRsp->dver = htobe64(sdbGetTableVer(pMnode->pSdb, SDB_DNODE));
S
Shengliang Guan 已提交
391 392 393
    pRsp->dnodeCfg.dnodeId = htonl(pDnode->id);
    pRsp->dnodeCfg.clusterId = htobe64(pMnode->clusterId);
    mndGetDnodeData(pMnode, &pRsp->dnodeEps, numOfEps);
S
Shengliang Guan 已提交
394

S
Shengliang Guan 已提交
395 396
    pReq->contLen = contLen;
    pReq->pCont = pRsp;
S
Shengliang Guan 已提交
397
  }
S
Shengliang Guan 已提交
398

S
Shengliang Guan 已提交
399
  pDnode->lastAccessTime = curMs;
S
Shengliang Guan 已提交
400 401 402 403 404
  code = 0;

PROCESS_STATUS_MSG_OVER:
  mndReleaseDnode(pMnode, pDnode);
  return code;
S
Shengliang Guan 已提交
405 406
}

S
Shengliang Guan 已提交
407
static int32_t mndCreateDnode(SMnode *pMnode, SMnodeMsg *pReq, SCreateDnodeReq *pCreate) {
S
Shengliang Guan 已提交
408
  SDnodeObj dnodeObj = {0};
S
Shengliang Guan 已提交
409
  dnodeObj.id = sdbGetMaxId(pMnode->pSdb, SDB_DNODE);
S
Shengliang Guan 已提交
410 411
  dnodeObj.createdTime = taosGetTimestampMs();
  dnodeObj.updateTime = dnodeObj.createdTime;
S
Shengliang Guan 已提交
412 413
  dnodeObj.port = pCreate->port;
  memcpy(dnodeObj.fqdn, pCreate->fqdn, TSDB_FQDN_LEN);
S
Shengliang Guan 已提交
414
  snprintf(dnodeObj.ep, TSDB_EP_LEN, "%s:%u", dnodeObj.fqdn, dnodeObj.port);
S
Shengliang Guan 已提交
415

S
Shengliang Guan 已提交
416
  STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, &pReq->rpcMsg);
S
Shengliang Guan 已提交
417
  if (pTrans == NULL) {
S
Shengliang Guan 已提交
418
    mError("dnode:%s, failed to create since %s", dnodeObj.ep, terrstr());
S
Shengliang Guan 已提交
419 420
    return -1;
  }
S
Shengliang Guan 已提交
421
  mDebug("trans:%d, used to create dnode:%s", pTrans->id, dnodeObj.ep);
S
Shengliang Guan 已提交
422 423 424 425 426 427 428

  SSdbRaw *pRedoRaw = mndDnodeActionEncode(&dnodeObj);
  if (pRedoRaw == NULL || mndTransAppendRedolog(pTrans, pRedoRaw) != 0) {
    mError("trans:%d, failed to append redo log since %s", pTrans->id, terrstr());
    mndTransDrop(pTrans);
    return -1;
  }
S
Shengliang Guan 已提交
429
  sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY);
S
Shengliang Guan 已提交
430

S
Shengliang Guan 已提交
431
  if (mndTransPrepare(pMnode, pTrans) != 0) {
S
Shengliang Guan 已提交
432 433 434 435 436 437 438 439 440
    mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr());
    mndTransDrop(pTrans);
    return -1;
  }

  mndTransDrop(pTrans);
  return 0;
}

S
Shengliang Guan 已提交
441 442 443
static int32_t mndProcessCreateDnodeReq(SMnodeMsg *pReq) {
  SMnode          *pMnode = pReq->pMnode;
  SCreateDnodeReq *pCreate = pReq->rpcMsg.pCont;
S
Shengliang Guan 已提交
444
  pCreate->port = htonl(pCreate->port);
S
Shengliang Guan 已提交
445
  mDebug("dnode:%s:%d, start to create", pCreate->fqdn, pCreate->port);
S
Shengliang Guan 已提交
446

S
Shengliang Guan 已提交
447
  if (pCreate->fqdn[0] == 0 || pCreate->port <= 0 || pCreate->port > UINT16_MAX) {
448
    terrno = TSDB_CODE_MND_INVALID_DNODE_EP;
S
Shengliang Guan 已提交
449
    mError("dnode:%s:%d, failed to create since %s", pCreate->fqdn, pCreate->port, terrstr());
S
Shengliang Guan 已提交
450 451 452
    return -1;
  }

S
Shengliang Guan 已提交
453 454 455
  char ep[TSDB_EP_LEN];
  snprintf(ep, TSDB_EP_LEN, "%s:%d", pCreate->fqdn, pCreate->port);
  SDnodeObj *pDnode = mndAcquireDnodeByEp(pMnode, ep);
S
Shengliang Guan 已提交
456
  if (pDnode != NULL) {
S
Shengliang Guan 已提交
457
    mError("dnode:%d, already exist, %s:%u", pDnode->id, pCreate->fqdn, pCreate->port);
458
    mndReleaseDnode(pMnode, pDnode);
S
Shengliang Guan 已提交
459 460 461
    terrno = TSDB_CODE_MND_DNODE_ALREADY_EXIST;
    return -1;
  }
S
Shengliang Guan 已提交
462

S
Shengliang Guan 已提交
463
  int32_t code = mndCreateDnode(pMnode, pReq, pCreate);
S
Shengliang Guan 已提交
464 465

  if (code != 0) {
S
Shengliang Guan 已提交
466
    mError("dnode:%s:%d, failed to create since %s", pCreate->fqdn, pCreate->port, terrstr());
S
Shengliang Guan 已提交
467 468 469 470 471 472
    return -1;
  }

  return TSDB_CODE_MND_ACTION_IN_PROGRESS;
}

S
Shengliang Guan 已提交
473 474
static int32_t mndDropDnode(SMnode *pMnode, SMnodeMsg *pReq, SDnodeObj *pDnode) {
  STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, &pReq->rpcMsg);
S
Shengliang Guan 已提交
475 476 477 478
  if (pTrans == NULL) {
    mError("dnode:%d, failed to drop since %s", pDnode->id, terrstr());
    return -1;
  }
479
  mDebug("trans:%d, used to drop dnode:%d", pTrans->id, pDnode->id);
S
Shengliang Guan 已提交
480 481 482 483 484 485 486

  SSdbRaw *pRedoRaw = mndDnodeActionEncode(pDnode);
  if (pRedoRaw == NULL || mndTransAppendRedolog(pTrans, pRedoRaw) != 0) {
    mError("trans:%d, failed to append redo log since %s", pTrans->id, terrstr());
    mndTransDrop(pTrans);
    return -1;
  }
S
Shengliang Guan 已提交
487
  sdbSetRawStatus(pRedoRaw, SDB_STATUS_DROPPED);
S
Shengliang Guan 已提交
488

S
Shengliang Guan 已提交
489
  if (mndTransPrepare(pMnode, pTrans) != 0) {
S
Shengliang Guan 已提交
490 491 492 493 494 495 496 497 498
    mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr());
    mndTransDrop(pTrans);
    return -1;
  }

  mndTransDrop(pTrans);
  return 0;
}

S
Shengliang Guan 已提交
499 500 501
static int32_t mndProcessDropDnodeReq(SMnodeMsg *pReq) {
  SMnode        *pMnode = pReq->pMnode;
  SDropDnodeReq *pDrop = pReq->rpcMsg.pCont;
S
Shengliang Guan 已提交
502 503 504 505 506
  pDrop->dnodeId = htonl(pDrop->dnodeId);

  mDebug("dnode:%d, start to drop", pDrop->dnodeId);

  if (pDrop->dnodeId <= 0) {
507
    terrno = TSDB_CODE_MND_INVALID_DNODE_ID;
S
Shengliang Guan 已提交
508
    mError("dnode:%d, failed to drop since %s", pDrop->dnodeId, terrstr());
S
Shengliang Guan 已提交
509 510 511 512 513 514
    return -1;
  }

  SDnodeObj *pDnode = mndAcquireDnode(pMnode, pDrop->dnodeId);
  if (pDnode == NULL) {
    terrno = TSDB_CODE_MND_DNODE_NOT_EXIST;
515
    mError("dnode:%d, failed to drop since %s", pDrop->dnodeId, terrstr());
S
Shengliang Guan 已提交
516 517 518
    return -1;
  }

S
Shengliang Guan 已提交
519
  int32_t code = mndDropDnode(pMnode, pReq, pDnode);
S
Shengliang Guan 已提交
520
  if (code != 0) {
521
    mndReleaseDnode(pMnode, pDnode);
S
Shengliang Guan 已提交
522
    mError("dnode:%d, failed to drop since %s", pDrop->dnodeId, terrstr());
S
Shengliang Guan 已提交
523 524 525
    return -1;
  }

526
  mndReleaseDnode(pMnode, pDnode);
S
Shengliang Guan 已提交
527 528 529
  return TSDB_CODE_MND_ACTION_IN_PROGRESS;
}

S
Shengliang Guan 已提交
530 531 532
static int32_t mndProcessConfigDnodeReq(SMnodeMsg *pReq) {
  SMnode        *pMnode = pReq->pMnode;
  SMCfgDnodeReq *pCfg = pReq->rpcMsg.pCont;
S
Shengliang Guan 已提交
533 534 535 536 537
  pCfg->dnodeId = htonl(pCfg->dnodeId);

  SDnodeObj *pDnode = mndAcquireDnode(pMnode, pCfg->dnodeId);
  if (pDnode == NULL) {
    terrno = TSDB_CODE_MND_DNODE_NOT_EXIST;
538
    mError("dnode:%d, failed to config since %s ", pCfg->dnodeId, terrstr());
S
Shengliang Guan 已提交
539 540 541 542 543 544
    return -1;
  }

  SEpSet epSet = mndGetDnodeEpset(pDnode);
  mndReleaseDnode(pMnode, pDnode);

S
Shengliang Guan 已提交
545
  SDCfgDnodeReq *pCfgDnode = rpcMallocCont(sizeof(SDCfgDnodeReq));
S
Shengliang Guan 已提交
546
  pCfgDnode->dnodeId = htonl(pCfg->dnodeId);
547
  memcpy(pCfgDnode->config, pCfg->config, TSDB_DNODE_CONFIG_LEN);
S
Shengliang Guan 已提交
548

H
Hongze Cheng 已提交
549
  SRpcMsg rpcMsg = {.msgType = TDMT_DND_CONFIG_DNODE,
550
                    .pCont = pCfgDnode,
S
Shengliang Guan 已提交
551 552
                    .contLen = sizeof(SDCfgDnodeReq),
                    .ahandle = pReq->rpcMsg.ahandle};
S
Shengliang Guan 已提交
553

554
  mInfo("dnode:%d, app:%p config:%s req send to dnode", pCfg->dnodeId, rpcMsg.ahandle, pCfg->config);
S
Shengliang Guan 已提交
555
  mndSendReqToDnode(pMnode, &epSet, &rpcMsg);
S
Shengliang Guan 已提交
556 557 558 559

  return 0;
}

S
Shengliang Guan 已提交
560 561
static int32_t mndProcessConfigDnodeRsp(SMnodeMsg *pRsp) {
  mInfo("app:%p config rsp from dnode", pRsp->rpcMsg.ahandle);
562
}
S
Shengliang Guan 已提交
563

S
Shengliang Guan 已提交
564
static int32_t mndGetConfigMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta) {
S
Shengliang Guan 已提交
565
  int32_t  cols = 0;
S
Shengliang Guan 已提交
566
  SSchema *pSchema = pMeta->pSchema;
S
Shengliang Guan 已提交
567 568 569 570

  pShow->bytes[cols] = TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE;
  pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
  tstrncpy(pSchema[cols].name, "name", sizeof(pSchema[cols].name));
H
Haojun Liao 已提交
571
  pSchema[cols].bytes = htonl(pShow->bytes[cols]);
S
Shengliang Guan 已提交
572 573 574 575 576
  cols++;

  pShow->bytes[cols] = TSDB_CONIIG_VALUE_LEN + VARSTR_HEADER_SIZE;
  pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
  tstrncpy(pSchema[cols].name, "value", sizeof(pSchema[cols].name));
H
Haojun Liao 已提交
577
  pSchema[cols].bytes = htonl(pShow->bytes[cols]);
S
Shengliang Guan 已提交
578 579
  cols++;

S
Shengliang Guan 已提交
580
  pMeta->numOfColumns = htonl(cols);
S
Shengliang Guan 已提交
581 582 583 584 585 586 587 588 589
  pShow->numOfColumns = cols;

  pShow->offset[0] = 0;
  for (int32_t i = 1; i < cols; ++i) {
    pShow->offset[i] = pShow->offset[i - 1] + pShow->bytes[i - 1];
  }

  pShow->numOfRows = TSDB_CONFIG_NUMBER;
  pShow->rowSize = pShow->offset[cols - 1] + pShow->bytes[cols - 1];
D
dapan1121 已提交
590
  strcpy(pMeta->tbName, mndShowStr(pShow->type));
S
Shengliang Guan 已提交
591 592 593 594

  return 0;
}

S
Shengliang Guan 已提交
595 596
static int32_t mndRetrieveConfigs(SMnodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) {
  SMnode *pMnode = pReq->pMnode;
S
Shengliang Guan 已提交
597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630
  int32_t numOfRows = 0;
  char   *cfgOpts[TSDB_CONFIG_NUMBER] = {0};
  char    cfgVals[TSDB_CONFIG_NUMBER][TSDB_CONIIG_VALUE_LEN + 1] = {0};
  char   *pWrite;
  int32_t cols = 0;

  cfgOpts[numOfRows] = "statusInterval";
  snprintf(cfgVals[numOfRows], TSDB_CONIIG_VALUE_LEN, "%d", pMnode->cfg.statusInterval);
  numOfRows++;

  cfgOpts[numOfRows] = "timezone";
  snprintf(cfgVals[numOfRows], TSDB_CONIIG_VALUE_LEN, "%s", pMnode->cfg.timezone);
  numOfRows++;

  cfgOpts[numOfRows] = "locale";
  snprintf(cfgVals[numOfRows], TSDB_CONIIG_VALUE_LEN, "%s", pMnode->cfg.locale);
  numOfRows++;

  cfgOpts[numOfRows] = "charset";
  snprintf(cfgVals[numOfRows], TSDB_CONIIG_VALUE_LEN, "%s", pMnode->cfg.charset);
  numOfRows++;

  for (int32_t i = 0; i < numOfRows; i++) {
    cols = 0;

    pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
    STR_WITH_MAXSIZE_TO_VARSTR(pWrite, cfgOpts[i], TSDB_CONFIG_OPTION_LEN);
    cols++;

    pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
    STR_WITH_MAXSIZE_TO_VARSTR(pWrite, cfgVals[i], TSDB_CONIIG_VALUE_LEN);
    cols++;
  }

S
Shengliang Guan 已提交
631
  mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow);
S
Shengliang Guan 已提交
632 633 634 635 636 637
  pShow->numOfReads += numOfRows;
  return numOfRows;
}

static void mndCancelGetNextConfig(SMnode *pMnode, void *pIter) {}

S
Shengliang Guan 已提交
638
static int32_t mndGetDnodeMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta) {
S
Shengliang Guan 已提交
639
  SMnode *pMnode = pReq->pMnode;
S
Shengliang Guan 已提交
640 641 642
  SSdb   *pSdb = pMnode->pSdb;

  int32_t  cols = 0;
S
Shengliang Guan 已提交
643
  SSchema *pSchema = pMeta->pSchema;
S
Shengliang Guan 已提交
644 645 646 647

  pShow->bytes[cols] = 2;
  pSchema[cols].type = TSDB_DATA_TYPE_SMALLINT;
  strcpy(pSchema[cols].name, "id");
H
Haojun Liao 已提交
648
  pSchema[cols].bytes = htonl(pShow->bytes[cols]);
S
Shengliang Guan 已提交
649 650 651 652
  cols++;

  pShow->bytes[cols] = TSDB_EP_LEN + VARSTR_HEADER_SIZE;
  pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
H
Haojun Liao 已提交
653 654
  strcpy(pSchema[cols].name, "endpoint");
  pSchema[cols].bytes = htonl(pShow->bytes[cols]);
S
Shengliang Guan 已提交
655 656 657 658 659
  cols++;

  pShow->bytes[cols] = 2;
  pSchema[cols].type = TSDB_DATA_TYPE_SMALLINT;
  strcpy(pSchema[cols].name, "vnodes");
H
Haojun Liao 已提交
660
  pSchema[cols].bytes = htonl(pShow->bytes[cols]);
S
Shengliang Guan 已提交
661 662 663 664
  cols++;

  pShow->bytes[cols] = 2;
  pSchema[cols].type = TSDB_DATA_TYPE_SMALLINT;
S
Shengliang Guan 已提交
665
  strcpy(pSchema[cols].name, "support_vnodes");
H
Haojun Liao 已提交
666
  pSchema[cols].bytes = htonl(pShow->bytes[cols]);
S
Shengliang Guan 已提交
667 668 669 670 671
  cols++;

  pShow->bytes[cols] = 10 + VARSTR_HEADER_SIZE;
  pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
  strcpy(pSchema[cols].name, "status");
H
Haojun Liao 已提交
672
  pSchema[cols].bytes = htonl(pShow->bytes[cols]);
S
Shengliang Guan 已提交
673 674 675 676
  cols++;

  pShow->bytes[cols] = 8;
  pSchema[cols].type = TSDB_DATA_TYPE_TIMESTAMP;
H
Haojun Liao 已提交
677 678
  strcpy(pSchema[cols].name, "create_time");
  pSchema[cols].bytes = htonl(pShow->bytes[cols]);
S
Shengliang Guan 已提交
679 680 681 682
  cols++;

  pShow->bytes[cols] = 24 + VARSTR_HEADER_SIZE;
  pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
H
Haojun Liao 已提交
683 684
  strcpy(pSchema[cols].name, "offline_reason");
  pSchema[cols].bytes = htonl(pShow->bytes[cols]);
S
Shengliang Guan 已提交
685 686
  cols++;

S
Shengliang Guan 已提交
687
  pMeta->numOfColumns = htonl(cols);
S
Shengliang Guan 已提交
688 689 690 691 692 693 694 695 696
  pShow->numOfColumns = cols;

  pShow->offset[0] = 0;
  for (int32_t i = 1; i < cols; ++i) {
    pShow->offset[i] = pShow->offset[i - 1] + pShow->bytes[i - 1];
  }

  pShow->numOfRows = sdbGetSize(pSdb, SDB_DNODE);
  pShow->rowSize = pShow->offset[cols - 1] + pShow->bytes[cols - 1];
D
dapan1121 已提交
697
  strcpy(pMeta->tbName, mndShowStr(pShow->type));
S
Shengliang Guan 已提交
698 699 700 701

  return 0;
}

S
Shengliang Guan 已提交
702 703
static int32_t mndRetrieveDnodes(SMnodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) {
  SMnode    *pMnode = pReq->pMnode;
S
Shengliang Guan 已提交
704 705 706 707 708
  SSdb      *pSdb = pMnode->pSdb;
  int32_t    numOfRows = 0;
  int32_t    cols = 0;
  SDnodeObj *pDnode = NULL;
  char      *pWrite;
S
Shengliang Guan 已提交
709
  int64_t    curMs = taosGetTimestampMs();
S
Shengliang Guan 已提交
710 711 712 713

  while (numOfRows < rows) {
    pShow->pIter = sdbFetch(pSdb, SDB_DNODE, pShow->pIter, (void **)&pDnode);
    if (pShow->pIter == NULL) break;
S
Shengliang Guan 已提交
714
    bool online = mndIsDnodeOnline(pMnode, pDnode, curMs);
S
Shengliang Guan 已提交
715 716 717 718 719 720 721 722 723 724 725 726

    cols = 0;

    pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
    *(int16_t *)pWrite = pDnode->id;
    cols++;

    pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
    STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDnode->ep, pShow->bytes[cols]);
    cols++;

    pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
S
Shengliang Guan 已提交
727
    *(int16_t *)pWrite = mndGetVnodesNum(pMnode, pDnode->id);
S
Shengliang Guan 已提交
728 729 730
    cols++;

    pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
731
    *(int16_t *)pWrite = pDnode->numOfSupportVnodes;
S
Shengliang Guan 已提交
732 733 734
    cols++;

    pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
S
Shengliang Guan 已提交
735
    STR_TO_VARSTR(pWrite, online ? "ready" : "offline");
S
Shengliang Guan 已提交
736 737 738 739 740 741 742
    cols++;

    pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
    *(int64_t *)pWrite = pDnode->createdTime;
    cols++;

    pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
S
Shengliang Guan 已提交
743
    STR_TO_VARSTR(pWrite, online ? "" : offlineReason[pDnode->offlineReason]);
S
Shengliang Guan 已提交
744 745 746 747 748 749
    cols++;

    numOfRows++;
    sdbRelease(pSdb, pDnode);
  }

S
Shengliang Guan 已提交
750
  mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow);
S
Shengliang Guan 已提交
751
  pShow->numOfReads += numOfRows;
S
Shengliang Guan 已提交
752

S
Shengliang Guan 已提交
753 754 755 756 757 758 759
  return numOfRows;
}

static void mndCancelGetNextDnode(SMnode *pMnode, void *pIter) {
  SSdb *pSdb = pMnode->pSdb;
  sdbCancelFetch(pSdb, pIter);
}