clientMsgHandler.c 15.2 KB
Newer Older
H
Haojun Liao 已提交
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/>.
 */

H
Haojun Liao 已提交
16
#include "os.h"
H
Haojun Liao 已提交
17
#include "tdef.h"
H
Haojun Liao 已提交
18
#include "tname.h"
H
Haojun Liao 已提交
19
#include "clientInt.h"
20
#include "clientLog.h"
D
dapan1121 已提交
21
#include "catalog.h"
D
dapan1121 已提交
22
#include "query.h"
H
Haojun Liao 已提交
23

S
Shengliang Guan 已提交
24
int32_t (*handleRequestRspFp[TDMT_MAX])(void*, const SDataBuf* pMsg, int32_t code);
H
Haojun Liao 已提交
25

H
Haojun Liao 已提交
26 27 28 29 30
static void setErrno(SRequestObj* pRequest, int32_t code) {
  pRequest->code = code;
  terrno = code;
}

S
Shengliang Guan 已提交
31
int32_t genericRspCallback(void* param, const SDataBuf* pMsg, int32_t code) {
32
  SRequestObj* pRequest = param;
H
Haojun Liao 已提交
33 34
  setErrno(pRequest, code);

wafwerar's avatar
wafwerar 已提交
35
  taosMemoryFree(pMsg->pData);
36
  tsem_post(&pRequest->body.rspSem);
H
Haojun Liao 已提交
37
  return code;
38 39
}

S
Shengliang Guan 已提交
40
int32_t processConnectRsp(void* param, const SDataBuf* pMsg, int32_t code) {
41
  SRequestObj* pRequest = param;
H
Haojun Liao 已提交
42
  if (code != TSDB_CODE_SUCCESS) {
wafwerar's avatar
wafwerar 已提交
43
    taosMemoryFree(pMsg->pData);
H
Haojun Liao 已提交
44
    setErrno(pRequest, code);
45
    tsem_post(&pRequest->body.rspSem);
H
Haojun Liao 已提交
46 47
    return code;
  }
48

S
Shengliang Guan 已提交
49
  STscObj* pTscObj = pRequest->pTscObj;
H
Haojun Liao 已提交
50

S
Shengliang Guan 已提交
51 52 53
  SConnectRsp connectRsp = {0};
  tDeserializeSConnectRsp(pMsg->pData, pMsg->len, &connectRsp);
  assert(connectRsp.epSet.numOfEps > 0);
H
Haojun Liao 已提交
54

S
Shengliang Guan 已提交
55 56
  if (!isEpsetEqual(&pTscObj->pAppInfo->mgmtEp.epSet, &connectRsp.epSet)) {
    updateEpSet_s(&pTscObj->pAppInfo->mgmtEp, &connectRsp.epSet);
57 58
  }

S
Shengliang Guan 已提交
59
  for (int32_t i = 0; i < connectRsp.epSet.numOfEps; ++i) {
S
Shengliang Guan 已提交
60
    tscDebug("0x%" PRIx64 " epSet.fqdn[%d]:%s port:%d, connObj:0x%" PRIx64, pRequest->requestId, i,
S
Shengliang Guan 已提交
61
             connectRsp.epSet.eps[i].fqdn, connectRsp.epSet.eps[i].port, pTscObj->id);
H
Haojun Liao 已提交
62 63
  }

S
Shengliang Guan 已提交
64 65 66
  pTscObj->connId = connectRsp.connId;
  pTscObj->acctId = connectRsp.acctId;
  tstrncpy(pTscObj->ver, connectRsp.sVersion, tListLen(pTscObj->ver));
H
Haojun Liao 已提交
67 68

  // update the appInstInfo
S
Shengliang Guan 已提交
69
  pTscObj->pAppInfo->clusterId = connectRsp.clusterId;
H
Haojun Liao 已提交
70 71
  atomic_add_fetch_64(&pTscObj->pAppInfo->numOfConns, 1);

72 73
  pTscObj->connType = HEARTBEAT_TYPE_QUERY;

S
Shengliang Guan 已提交
74
  hbRegisterConn(pTscObj->pAppInfo->pAppHbMgr, connectRsp.connId, connectRsp.clusterId, HEARTBEAT_TYPE_QUERY);
L
Liu Jicong 已提交
75

76
  //  pRequest->body.resInfo.pRspMsg = pMsg->pData;
S
Shengliang Guan 已提交
77
  tscDebug("0x%" PRIx64 " clusterId:%" PRId64 ", totalConn:%" PRId64, pRequest->requestId, connectRsp.clusterId,
78
           pTscObj->pAppInfo->numOfConns);
79

wafwerar's avatar
wafwerar 已提交
80
  taosMemoryFree(pMsg->pData);
81
  tsem_post(&pRequest->body.rspSem);
82 83
  return 0;
}
H
Haojun Liao 已提交
84

85
SMsgSendInfo* buildMsgInfoImpl(SRequestObj *pRequest) {
wafwerar's avatar
wafwerar 已提交
86
  SMsgSendInfo* pMsgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
87

H
Haojun Liao 已提交
88 89 90 91 92 93 94
  pMsgSendInfo->requestObjRefId = pRequest->self;
  pMsgSendInfo->requestId       = pRequest->requestId;
  pMsgSendInfo->param           = pRequest;
  pMsgSendInfo->msgType         = pRequest->type;

  if (pRequest->type == TDMT_MND_SHOW_RETRIEVE || pRequest->type == TDMT_VND_SHOW_TABLES_FETCH) {
    if (pRequest->type == TDMT_MND_SHOW_RETRIEVE) {
S
Shengliang Guan 已提交
95 96 97 98
      SRetrieveTableReq retrieveReq = {0};
      retrieveReq.showId = pRequest->body.showInfo.execId;

      int32_t contLen = tSerializeSRetrieveTableReq(NULL, 0, &retrieveReq);
wafwerar's avatar
wafwerar 已提交
99
      void*   pReq = taosMemoryMalloc(contLen);
S
Shengliang Guan 已提交
100 101 102
      tSerializeSRetrieveTableReq(pReq, contLen, &retrieveReq);
      pMsgSendInfo->msgInfo.pData = pReq;
      pMsgSendInfo->msgInfo.len = contLen;
dengyihao's avatar
dengyihao 已提交
103
      pMsgSendInfo->msgInfo.handle = NULL;
H
Haojun Liao 已提交
104
    } else {
wafwerar's avatar
wafwerar 已提交
105
      SVShowTablesFetchReq* pFetchMsg = taosMemoryCalloc(1, sizeof(SVShowTablesFetchReq));
H
Haojun Liao 已提交
106 107 108 109
      if (pFetchMsg == NULL) {
        return NULL;
      }

110 111 112
      pFetchMsg->id = htobe64(pRequest->body.showInfo.execId);
      pFetchMsg->head.vgId = htonl(pRequest->body.showInfo.vgId);

H
Haojun Liao 已提交
113 114
      pMsgSendInfo->msgInfo.pData = pFetchMsg;
      pMsgSendInfo->msgInfo.len = sizeof(SVShowTablesFetchReq);
dengyihao's avatar
dengyihao 已提交
115
      pMsgSendInfo->msgInfo.handle = NULL;
H
Haojun Liao 已提交
116
    }
117 118
  } else {
    assert(pRequest != NULL);
H
Haojun Liao 已提交
119
    pMsgSendInfo->msgInfo = pRequest->body.requestMsg;
H
Haojun Liao 已提交
120
  }
121

H
Haojun Liao 已提交
122
  pMsgSendInfo->fp = (handleRequestRspFp[TMSG_INDEX(pRequest->type)] == NULL)? genericRspCallback:handleRequestRspFp[TMSG_INDEX(pRequest->type)];
123
  return pMsgSendInfo;
124 125
}

126 127 128
int32_t processShowRsp(void* param, const SDataBuf* pMsg, int32_t code) {
  SRequestObj* pRequest = param;
  if (code != TSDB_CODE_SUCCESS) {
H
Haojun Liao 已提交
129
    setErrno(pRequest, code);
130 131 132 133
    tsem_post(&pRequest->body.rspSem);
    return code;
  }

S
Shengliang Guan 已提交
134 135 136
  SShowRsp showRsp = {0};
  tDeserializeSShowRsp(pMsg->pData, pMsg->len, &showRsp);
  STableMetaRsp *pMetaMsg = &showRsp.tableMeta;
137

wafwerar's avatar
wafwerar 已提交
138
  taosMemoryFreeClear(pRequest->body.resInfo.pRspMsg);
139
  pRequest->body.resInfo.pRspMsg = pMsg->pData;
140
  SReqResultInfo* pResInfo = &pRequest->body.resInfo;
141

H
Haojun Liao 已提交
142
  if (pResInfo->fields == NULL) {
wafwerar's avatar
wafwerar 已提交
143
    TAOS_FIELD* pFields = taosMemoryCalloc(pMetaMsg->numOfColumns, sizeof(TAOS_FIELD));
H
Haojun Liao 已提交
144
    for (int32_t i = 0; i < pMetaMsg->numOfColumns; ++i) {
S
Shengliang Guan 已提交
145 146 147 148
      SSchema* pSchema = &pMetaMsg->pSchemas[i];
      tstrncpy(pFields[i].name, pSchema->name, tListLen(pFields[i].name));
      pFields[i].type = pSchema->type;
      pFields[i].bytes = pSchema->bytes;
H
Haojun Liao 已提交
149
    }
H
Haojun Liao 已提交
150

H
Haojun Liao 已提交
151 152 153 154
    pResInfo->fields = pFields;
  }

  pResInfo->numOfCols = pMetaMsg->numOfColumns;
S
Shengliang Guan 已提交
155 156
  pRequest->body.showInfo.execId = showRsp.showId;
  tFreeSShowRsp(&showRsp);
157 158 159 160 161 162 163 164 165 166

  // todo
  if (pRequest->type == TDMT_VND_SHOW_TABLES) {
    SShowReqInfo* pShowInfo = &pRequest->body.showInfo;

    int32_t index = pShowInfo->currentIndex;
    SVgroupInfo* pInfo = taosArrayGet(pShowInfo->pArray, index);
    pShowInfo->vgId = pInfo->vgId;
  }

167
  tsem_post(&pRequest->body.rspSem);
H
Haojun Liao 已提交
168 169 170
  return 0;
}

171
int32_t processRetrieveMnodeRsp(void* param, const SDataBuf* pMsg, int32_t code) {
H
Haojun Liao 已提交
172 173
  SRequestObj    *pRequest = param;
  SReqResultInfo *pResInfo = &pRequest->body.resInfo;
wafwerar's avatar
wafwerar 已提交
174
  taosMemoryFreeClear(pResInfo->pRspMsg);
H
Haojun Liao 已提交
175

H
Haojun Liao 已提交
176
  if (code != TSDB_CODE_SUCCESS) {
H
Haojun Liao 已提交
177
    setErrno(pRequest, code);
H
Haojun Liao 已提交
178 179 180 181
    tsem_post(&pRequest->body.rspSem);
    return code;
  }

H
Haojun Liao 已提交
182 183
  assert(pMsg->len >= sizeof(SRetrieveTableRsp));

184
  SRetrieveTableRsp *pRetrieve = (SRetrieveTableRsp *) pMsg->pData;
H
Haojun Liao 已提交
185 186 187
  pRetrieve->numOfRows  = htonl(pRetrieve->numOfRows);
  pRetrieve->precision  = htons(pRetrieve->precision);

188
  pResInfo->pRspMsg   = pMsg->pData;
H
Haojun Liao 已提交
189
  pResInfo->numOfRows = pRetrieve->numOfRows;
H
Haojun Liao 已提交
190
  pResInfo->pData     = pRetrieve->data;
D
dapan1121 已提交
191
  pResInfo->completed = pRetrieve->completed;
H
Haojun Liao 已提交
192 193

  pResInfo->current = 0;
194
//  setResultDataPtr(pResInfo, pResInfo->fields, pResInfo->numOfCols, pResInfo->numOfRows);
H
Haojun Liao 已提交
195 196

  tscDebug("0x%"PRIx64" numOfRows:%d, complete:%d, qId:0x%"PRIx64, pRequest->self, pRetrieve->numOfRows,
197
           pRetrieve->completed, pRequest->body.showInfo.execId);
198 199

  tsem_post(&pRequest->body.rspSem);
H
Haojun Liao 已提交
200 201 202
  return 0;
}

H
Haojun Liao 已提交
203 204
int32_t processRetrieveVndRsp(void* param, const SDataBuf* pMsg, int32_t code) {
  SRequestObj* pRequest = param;
205 206

  SReqResultInfo* pResInfo = &pRequest->body.resInfo;
wafwerar's avatar
wafwerar 已提交
207
  taosMemoryFreeClear(pResInfo->pRspMsg);
H
Haojun Liao 已提交
208 209

  if (code != TSDB_CODE_SUCCESS) {
H
Haojun Liao 已提交
210
    setErrno(pRequest, code);
H
Haojun Liao 已提交
211 212 213 214
    tsem_post(&pRequest->body.rspSem);
    return code;
  }

215 216 217
  assert(pMsg->len >= sizeof(SRetrieveTableRsp));

  pResInfo->pRspMsg    = pMsg->pData;
H
Haojun Liao 已提交
218 219 220 221 222 223 224 225 226 227

  SVShowTablesFetchRsp *pFetchRsp = (SVShowTablesFetchRsp *) pMsg->pData;
  pFetchRsp->numOfRows  = htonl(pFetchRsp->numOfRows);
  pFetchRsp->precision  = htons(pFetchRsp->precision);

  pResInfo->pRspMsg   = pMsg->pData;
  pResInfo->numOfRows = pFetchRsp->numOfRows;
  pResInfo->pData     = pFetchRsp->data;

  pResInfo->current = 0;
228
//  setResultDataPtr(pResInfo, pResInfo->fields, pResInfo->numOfCols, pResInfo->numOfRows);
H
Haojun Liao 已提交
229 230

  tscDebug("0x%"PRIx64" numOfRows:%d, complete:%d, qId:0x%"PRIx64, pRequest->self, pFetchRsp->numOfRows,
231
           pFetchRsp->completed, pRequest->body.showInfo.execId);
H
Haojun Liao 已提交
232 233 234 235 236

  tsem_post(&pRequest->body.rspSem);
  return 0;
}

237
int32_t processCreateDbRsp(void* param, const SDataBuf* pMsg, int32_t code) {
H
Haojun Liao 已提交
238
  // todo rsp with the vnode id list
239
  SRequestObj* pRequest = param;
wafwerar's avatar
wafwerar 已提交
240
  taosMemoryFree(pMsg->pData);
X
Xiaoyu Wang 已提交
241 242 243
  if (code != TSDB_CODE_SUCCESS) {
    setErrno(pRequest, code);
  }
244
  tsem_post(&pRequest->body.rspSem);
X
Xiaoyu Wang 已提交
245
  return code;
H
Haojun Liao 已提交
246
}
H
Haojun Liao 已提交
247

248
int32_t processUseDbRsp(void* param, const SDataBuf* pMsg, int32_t code) {
H
Haojun Liao 已提交
249 250
  SRequestObj* pRequest = param;

D
dapan1121 已提交
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267
  if (TSDB_CODE_MND_DB_NOT_EXIST == code) {
    SUseDbRsp usedbRsp = {0};
    tDeserializeSUseDbRsp(pMsg->pData, pMsg->len, &usedbRsp);
    struct SCatalog *pCatalog = NULL;

    if (usedbRsp.vgVersion >= 0) {
      int32_t code = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog);
      if (code != TSDB_CODE_SUCCESS) {
        tscWarn("catalogGetHandle failed, clusterId:%"PRIx64", error:%s", pRequest->pTscObj->pAppInfo->clusterId, tstrerror(code));
      } else {
        catalogRemoveDB(pCatalog, usedbRsp.db, usedbRsp.uid);
      }
    }

    tFreeSUsedbRsp(&usedbRsp);    
  }

H
Haojun Liao 已提交
268
  if (code != TSDB_CODE_SUCCESS) {
wafwerar's avatar
wafwerar 已提交
269
    taosMemoryFree(pMsg->pData);
H
Haojun Liao 已提交
270 271 272 273 274
    setErrno(pRequest, code);
    tsem_post(&pRequest->body.rspSem);
    return code;
  }

S
Shengliang Guan 已提交
275 276 277
  SUseDbRsp usedbRsp = {0};
  tDeserializeSUseDbRsp(pMsg->pData, pMsg->len, &usedbRsp);

278
  SName name = {0};
S
Shengliang Guan 已提交
279 280
  tNameFromString(&name, usedbRsp.db, T_NAME_ACCT|T_NAME_DB);

D
dapan1121 已提交
281 282 283 284 285 286
  SUseDbOutput output = {0};
  code = queryBuildUseDbOutput(&output, &usedbRsp);

  if (code != 0) {
    terrno = code;
    if (output.dbVgroup) taosHashCleanup(output.dbVgroup->vgHash);
wafwerar's avatar
wafwerar 已提交
287
    taosMemoryFreeClear(output.dbVgroup);
D
dapan1121 已提交
288 289 290 291 292 293 294 295 296 297 298 299 300

    tscError("failed to build use db output since %s", terrstr());
  } else {
    struct SCatalog *pCatalog = NULL;
    
    int32_t code = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog);
    if (code != TSDB_CODE_SUCCESS) {
      tscWarn("catalogGetHandle failed, clusterId:%"PRIx64", error:%s", pRequest->pTscObj->pAppInfo->clusterId, tstrerror(code));
    } else {
      catalogUpdateDBVgInfo(pCatalog, output.db, output.dbId, output.dbVgroup);
    }
  }

S
Shengliang Guan 已提交
301
  tFreeSUsedbRsp(&usedbRsp);
302 303 304

  char db[TSDB_DB_NAME_LEN] = {0};
  tNameGetDbName(&name, db);
305

306
  setConnectionDB(pRequest->pTscObj, db);
wafwerar's avatar
wafwerar 已提交
307
  taosMemoryFree(pMsg->pData);
308 309
  tsem_post(&pRequest->body.rspSem);
  return 0;
310 311
}

312
int32_t processCreateTableRsp(void* param, const SDataBuf* pMsg, int32_t code) {
H
Haojun Liao 已提交
313
  assert(pMsg != NULL && param != NULL);
314
  SRequestObj* pRequest = param;
H
Haojun Liao 已提交
315

wafwerar's avatar
wafwerar 已提交
316
  taosMemoryFree(pMsg->pData);
H
Haojun Liao 已提交
317 318 319 320 321 322
  if (code != TSDB_CODE_SUCCESS) {
    setErrno(pRequest, code);
    tsem_post(&pRequest->body.rspSem);
    return code;
  }

323
  tsem_post(&pRequest->body.rspSem);
H
Haojun Liao 已提交
324
  return code;
325 326
}

327 328
int32_t processDropDbRsp(void* param, const SDataBuf* pMsg, int32_t code) {
  SRequestObj* pRequest = param;
H
Haojun Liao 已提交
329 330 331 332 333 334
  if (code != TSDB_CODE_SUCCESS) {
    setErrno(pRequest, code);
    tsem_post(&pRequest->body.rspSem);
    return code;
  }

S
Shengliang Guan 已提交
335 336
  SDropDbRsp dropdbRsp = {0};
  tDeserializeSDropDbRsp(pMsg->pData, pMsg->len, &dropdbRsp);
D
dapan1121 已提交
337

S
Shengliang Guan 已提交
338
  struct SCatalog* pCatalog = NULL;
D
dapan1121 已提交
339
  catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog);
S
Shengliang Guan 已提交
340
  catalogRemoveDB(pCatalog, dropdbRsp.db, dropdbRsp.uid);
D
dapan1121 已提交
341

342
  tsem_post(&pRequest->body.rspSem);
H
Haojun Liao 已提交
343
  return code;
344 345
}

H
Haojun Liao 已提交
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370
void initMsgHandleFp() {
#if 0
  tscBuildMsg[TSDB_SQL_SELECT] = tscBuildQueryMsg;
  tscBuildMsg[TSDB_SQL_INSERT] = tscBuildSubmitMsg;
  tscBuildMsg[TSDB_SQL_FETCH] = tscBuildFetchMsg;

  tscBuildMsg[TSDB_SQL_CREATE_DB] = tscBuildCreateDbMsg;
  tscBuildMsg[TSDB_SQL_CREATE_USER] = tscBuildUserMsg;
  tscBuildMsg[TSDB_SQL_CREATE_FUNCTION] = tscBuildCreateFuncMsg;

  tscBuildMsg[TSDB_SQL_CREATE_ACCT] = tscBuildAcctMsg;
  tscBuildMsg[TSDB_SQL_ALTER_ACCT] = tscBuildAcctMsg;

  tscBuildMsg[TSDB_SQL_CREATE_TABLE] = tscBuildCreateTableMsg;
  tscBuildMsg[TSDB_SQL_DROP_USER] = tscBuildDropUserAcctMsg;
  tscBuildMsg[TSDB_SQL_DROP_ACCT] = tscBuildDropUserAcctMsg;
  tscBuildMsg[TSDB_SQL_DROP_DB] = tscBuildDropDbMsg;
  tscBuildMsg[TSDB_SQL_DROP_FUNCTION] = tscBuildDropFuncMsg;
  tscBuildMsg[TSDB_SQL_SYNC_DB_REPLICA] = tscBuildSyncDbReplicaMsg;
  tscBuildMsg[TSDB_SQL_DROP_TABLE] = tscBuildDropTableMsg;
  tscBuildMsg[TSDB_SQL_ALTER_USER] = tscBuildUserMsg;
  tscBuildMsg[TSDB_SQL_CREATE_DNODE] = tscBuildCreateDnodeMsg;
  tscBuildMsg[TSDB_SQL_DROP_DNODE] = tscBuildDropDnodeMsg;
  tscBuildMsg[TSDB_SQL_CFG_DNODE] = tscBuildCfgDnodeMsg;
  tscBuildMsg[TSDB_SQL_ALTER_TABLE] = tscBuildAlterTableMsg;
H
Haojun Liao 已提交
371
  tscBuildMsg[TSDB_SQL_UPDATE_TAG_VAL] = tscBuildUpdateTagMsg;
H
Haojun Liao 已提交
372 373 374 375 376 377 378 379 380 381
  tscBuildMsg[TSDB_SQL_ALTER_DB] = tscAlterDbMsg;
  tscBuildMsg[TSDB_SQL_COMPACT_VNODE] = tscBuildCompactMsg;


  tscBuildMsg[TSDB_SQL_USE_DB] = tscBuildUseDbMsg;
  tscBuildMsg[TSDB_SQL_STABLEVGROUP] = tscBuildSTableVgroupMsg;
  tscBuildMsg[TSDB_SQL_RETRIEVE_FUNC] = tscBuildRetrieveFuncMsg;

  tscBuildMsg[TSDB_SQL_HB] = tscBuildHeartBeatMsg;
  tscBuildMsg[TSDB_SQL_SHOW] = tscBuildShowMsg;
H
Haojun Liao 已提交
382
  tscBuildMsg[TSDB_SQL_RETRIEVE_MNODE] = tscBuildRetrieveFromMgmtMsg;
H
Haojun Liao 已提交
383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399
  tscBuildMsg[TSDB_SQL_KILL_QUERY] = tscBuildKillMsg;
  tscBuildMsg[TSDB_SQL_KILL_STREAM] = tscBuildKillMsg;
  tscBuildMsg[TSDB_SQL_KILL_CONNECTION] = tscBuildKillMsg;

  tscProcessMsgRsp[TSDB_SQL_SELECT] = tscProcessQueryRsp;
  tscProcessMsgRsp[TSDB_SQL_FETCH] = tscProcessRetrieveRspFromNode;

  tscProcessMsgRsp[TSDB_SQL_DROP_DB] = tscProcessDropDbRsp;
  tscProcessMsgRsp[TSDB_SQL_DROP_TABLE] = tscProcessDropTableRsp;

  tscProcessMsgRsp[TSDB_SQL_USE_DB] = tscProcessUseDbRsp;
  tscProcessMsgRsp[TSDB_SQL_META] = tscProcessTableMetaRsp;
  tscProcessMsgRsp[TSDB_SQL_STABLEVGROUP] = tscProcessSTableVgroupRsp;
  tscProcessMsgRsp[TSDB_SQL_MULTI_META] = tscProcessMultiTableMetaRsp;
  tscProcessMsgRsp[TSDB_SQL_RETRIEVE_FUNC] = tscProcessRetrieveFuncRsp;

  tscProcessMsgRsp[TSDB_SQL_SHOW] = tscProcessShowRsp;
H
Haojun Liao 已提交
400
  tscProcessMsgRsp[TSDB_SQL_RETRIEVE_MNODE] = tscProcessRetrieveRspFromNode;  // rsp handled by same function.
H
Haojun Liao 已提交
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421
  tscProcessMsgRsp[TSDB_SQL_DESCRIBE_TABLE] = tscProcessDescribeTableRsp;

  tscProcessMsgRsp[TSDB_SQL_CURRENT_DB]   = tscProcessLocalRetrieveRsp;
  tscProcessMsgRsp[TSDB_SQL_CURRENT_USER] = tscProcessLocalRetrieveRsp;
  tscProcessMsgRsp[TSDB_SQL_SERV_VERSION] = tscProcessLocalRetrieveRsp;
  tscProcessMsgRsp[TSDB_SQL_CLI_VERSION]  = tscProcessLocalRetrieveRsp;
  tscProcessMsgRsp[TSDB_SQL_SERV_STATUS]  = tscProcessLocalRetrieveRsp;

  tscProcessMsgRsp[TSDB_SQL_RETRIEVE_EMPTY_RESULT] = tscProcessEmptyResultRsp;

  tscProcessMsgRsp[TSDB_SQL_RETRIEVE_GLOBALMERGE] = tscProcessRetrieveGlobalMergeRsp;

  tscProcessMsgRsp[TSDB_SQL_ALTER_TABLE] = tscProcessAlterTableMsgRsp;
  tscProcessMsgRsp[TSDB_SQL_ALTER_DB] = tscProcessAlterDbMsgRsp;
  tscProcessMsgRsp[TSDB_SQL_COMPACT_VNODE] = tscProcessCompactRsp;

  tscProcessMsgRsp[TSDB_SQL_SHOW_CREATE_TABLE] = tscProcessShowCreateRsp;
  tscProcessMsgRsp[TSDB_SQL_SHOW_CREATE_STABLE] = tscProcessShowCreateRsp;
  tscProcessMsgRsp[TSDB_SQL_SHOW_CREATE_DATABASE] = tscProcessShowCreateRsp;
#endif

D
catalog  
dapan1121 已提交
422 423 424 425 426 427 428
  handleRequestRspFp[TMSG_INDEX(TDMT_MND_CONNECT)]       = processConnectRsp;
  handleRequestRspFp[TMSG_INDEX(TDMT_MND_SHOW)]          = processShowRsp;
  handleRequestRspFp[TMSG_INDEX(TDMT_MND_SHOW_RETRIEVE)] = processRetrieveMnodeRsp;
  handleRequestRspFp[TMSG_INDEX(TDMT_MND_CREATE_DB)]     = processCreateDbRsp;
  handleRequestRspFp[TMSG_INDEX(TDMT_MND_USE_DB)]        = processUseDbRsp;
  handleRequestRspFp[TMSG_INDEX(TDMT_MND_CREATE_STB)]    = processCreateTableRsp;
  handleRequestRspFp[TMSG_INDEX(TDMT_MND_DROP_DB)]       = processDropDbRsp;
H
Haojun Liao 已提交
429 430 431

  handleRequestRspFp[TMSG_INDEX(TDMT_VND_SHOW_TABLES)]   = processShowRsp;
  handleRequestRspFp[TMSG_INDEX(TDMT_VND_SHOW_TABLES_FETCH)]   = processRetrieveVndRsp;
L
Liu Jicong 已提交
432
}