Merge pull request #11464 from taosdata/feature/3.0_liaohj
enh: a few internal improvements
This commit is contained in:
commit
1ade7f7440
|
@ -953,9 +953,14 @@ typedef struct {
|
|||
char db[TSDB_DB_FNAME_LEN];
|
||||
char tb[TSDB_TABLE_NAME_LEN];
|
||||
int64_t showId;
|
||||
int8_t free;
|
||||
} SRetrieveTableReq;
|
||||
|
||||
typedef struct SSysTableSchema {
|
||||
int8_t type;
|
||||
col_id_t colId;
|
||||
int32_t bytes;
|
||||
} SSysTableSchema;
|
||||
|
||||
int32_t tSerializeSRetrieveTableReq(void* buf, int32_t bufLen, SRetrieveTableReq* pReq);
|
||||
int32_t tDeserializeSRetrieveTableReq(void* buf, int32_t bufLen, SRetrieveTableReq* pReq);
|
||||
|
||||
|
|
|
@ -136,7 +136,6 @@ enum {
|
|||
TD_DEF_MSG_TYPE(TDMT_MND_KILL_CONN, "mnode-kill-conn", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_HEARTBEAT, "mnode-heartbeat", SClientHbBatchReq, SClientHbBatchRsp)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_SHOW, "mnode-show", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_SHOW_RETRIEVE, "mnode-retrieve", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_SYSTABLE_RETRIEVE, "mnode-systable-retrieve", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_STATUS, "mnode-status", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_TRANS_TIMER, "mnode-trans-tmr", NULL, NULL)
|
||||
|
@ -189,8 +188,8 @@ enum {
|
|||
TD_DEF_MSG_TYPE(TDMT_VND_CREATE_TOPIC, "vnode-create-topic", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_VND_ALTER_TOPIC, "vnode-alter-topic", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_VND_DROP_TOPIC, "vnode-drop-topic", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_VND_SHOW_TABLES, "vnode-show-tables", SVShowTablesReq, SVShowTablesRsp)
|
||||
TD_DEF_MSG_TYPE(TDMT_VND_SHOW_TABLES_FETCH, "vnode-show-tables-fetch", SVShowTablesFetchReq, SVShowTablesFetchRsp)
|
||||
// TD_DEF_MSG_TYPE(TDMT_VND_SHOW_TABLES, "vnode-show-tables", SVShowTablesReq, SVShowTablesRsp)
|
||||
// TD_DEF_MSG_TYPE(TDMT_VND_SHOW_TABLES_FETCH, "vnode-show-tables-fetch", SVShowTablesFetchReq, SVShowTablesFetchRsp)
|
||||
TD_DEF_MSG_TYPE(TDMT_VND_QUERY_CONTINUE, "vnode-query-continue", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_VND_QUERY_HEARTBEAT, "vnode-query-heartbeat", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_VND_EXPLAIN, "vnode-explain", NULL, NULL)
|
||||
|
|
|
@ -24,7 +24,6 @@ extern "C" {
|
|||
#include "types.h"
|
||||
|
||||
// ----------------- For variable data types such as TSDB_DATA_TYPE_BINARY and TSDB_DATA_TYPE_NCHAR
|
||||
typedef int32_t VarDataOffsetT;
|
||||
typedef uint32_t TDRowLenT;
|
||||
typedef uint8_t TDRowValT;
|
||||
typedef uint64_t TDRowVerT;
|
||||
|
|
|
@ -100,6 +100,7 @@ extern const int32_t TYPE_BYTES[15];
|
|||
#define TSDB_TIME_PRECISION_NANO_DIGITS 19
|
||||
|
||||
#define TSDB_INFORMATION_SCHEMA_DB "information_schema"
|
||||
#define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema"
|
||||
#define TSDB_INS_TABLE_DNODES "dnodes"
|
||||
#define TSDB_INS_TABLE_MNODES "mnodes"
|
||||
#define TSDB_INS_TABLE_MODULES "modules"
|
||||
|
|
|
@ -193,13 +193,6 @@ int32_t execDdlQuery(SRequestObj* pRequest, SQuery* pQuery) {
|
|||
STscObj* pTscObj = pRequest->pTscObj;
|
||||
SMsgSendInfo* pSendMsg = buildMsgInfoImpl(pRequest);
|
||||
|
||||
if (pMsgInfo->msgType == TDMT_VND_SHOW_TABLES) {
|
||||
SShowReqInfo* pShowReqInfo = &pRequest->body.showInfo;
|
||||
if (pShowReqInfo->pArray == NULL) {
|
||||
pShowReqInfo->currentIndex = 0; // set the first vnode/ then iterate the next vnode
|
||||
pShowReqInfo->pArray = pMsgInfo->pExtension;
|
||||
}
|
||||
}
|
||||
int64_t transporterId = 0;
|
||||
asyncSendMsgToServer(pTscObj->pAppInfo->pTransporter, &pMsgInfo->epSet, &transporterId, pSendMsg);
|
||||
|
||||
|
@ -615,100 +608,36 @@ void doSetOneRowPtr(SReqResultInfo* pResultInfo) {
|
|||
|
||||
void* doFetchRow(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUcs4) {
|
||||
assert(pRequest != NULL);
|
||||
|
||||
SReqResultInfo* pResultInfo = &pRequest->body.resInfo;
|
||||
|
||||
SEpSet epSet = {0};
|
||||
|
||||
if (pResultInfo->pData == NULL || pResultInfo->current >= pResultInfo->numOfRows) {
|
||||
if (pRequest->type == TDMT_VND_QUERY) {
|
||||
// All data has returned to App already, no need to try again
|
||||
if (pResultInfo->completed) {
|
||||
pResultInfo->numOfRows = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SReqResultInfo* pResInfo = &pRequest->body.resInfo;
|
||||
pRequest->code = schedulerFetchRows(pRequest->body.queryJob, (void**)&pResInfo->pData);
|
||||
if (pRequest->code != TSDB_CODE_SUCCESS) {
|
||||
pResultInfo->numOfRows = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pRequest->code = setQueryResultFromRsp(&pRequest->body.resInfo, (SRetrieveTableRsp*)pResInfo->pData, convertUcs4);
|
||||
if (pRequest->code != TSDB_CODE_SUCCESS) {
|
||||
pResultInfo->numOfRows = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tscDebug("0x%" PRIx64 " fetch results, numOfRows:%d total Rows:%" PRId64 ", complete:%d, reqId:0x%" PRIx64,
|
||||
pRequest->self, pResInfo->numOfRows, pResInfo->totalRows, pResInfo->completed, pRequest->requestId);
|
||||
|
||||
if (pResultInfo->numOfRows == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
goto _return;
|
||||
} else if (pRequest->type == TDMT_MND_SHOW) {
|
||||
pRequest->type = TDMT_MND_SHOW_RETRIEVE;
|
||||
epSet = getEpSet_s(&pRequest->pTscObj->pAppInfo->mgmtEp);
|
||||
} else if (pRequest->type == TDMT_VND_SHOW_TABLES) {
|
||||
pRequest->type = TDMT_VND_SHOW_TABLES_FETCH;
|
||||
SShowReqInfo* pShowReqInfo = &pRequest->body.showInfo;
|
||||
SVgroupInfo* pVgroupInfo = taosArrayGet(pShowReqInfo->pArray, pShowReqInfo->currentIndex);
|
||||
|
||||
epSet = pVgroupInfo->epSet;
|
||||
} else if (pRequest->type == TDMT_VND_SHOW_TABLES_FETCH) {
|
||||
pRequest->type = TDMT_VND_SHOW_TABLES;
|
||||
SShowReqInfo* pShowReqInfo = &pRequest->body.showInfo;
|
||||
pShowReqInfo->currentIndex += 1;
|
||||
if (pShowReqInfo->currentIndex >= taosArrayGetSize(pShowReqInfo->pArray)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SVgroupInfo* pVgroupInfo = taosArrayGet(pShowReqInfo->pArray, pShowReqInfo->currentIndex);
|
||||
SVShowTablesReq* pShowReq = taosMemoryCalloc(1, sizeof(SVShowTablesReq));
|
||||
pShowReq->head.vgId = htonl(pVgroupInfo->vgId);
|
||||
|
||||
pRequest->body.requestMsg.len = sizeof(SVShowTablesReq);
|
||||
pRequest->body.requestMsg.pData = pShowReq;
|
||||
|
||||
SMsgSendInfo* body = buildMsgInfoImpl(pRequest);
|
||||
epSet = pVgroupInfo->epSet;
|
||||
|
||||
int64_t transporterId = 0;
|
||||
STscObj* pTscObj = pRequest->pTscObj;
|
||||
asyncSendMsgToServer(pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, body);
|
||||
tsem_wait(&pRequest->body.rspSem);
|
||||
|
||||
pRequest->type = TDMT_VND_SHOW_TABLES_FETCH;
|
||||
} else if (pRequest->type == TDMT_MND_SHOW_RETRIEVE) {
|
||||
epSet = getEpSet_s(&pRequest->pTscObj->pAppInfo->mgmtEp);
|
||||
|
||||
if (pResultInfo->completed) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// All data has returned to App already, no need to try again
|
||||
if (pResultInfo->completed) {
|
||||
pResultInfo->numOfRows = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SMsgSendInfo* body = buildMsgInfoImpl(pRequest);
|
||||
SReqResultInfo* pResInfo = &pRequest->body.resInfo;
|
||||
pRequest->code = schedulerFetchRows(pRequest->body.queryJob, (void**)&pResInfo->pData);
|
||||
if (pRequest->code != TSDB_CODE_SUCCESS) {
|
||||
pResultInfo->numOfRows = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int64_t transporterId = 0;
|
||||
STscObj* pTscObj = pRequest->pTscObj;
|
||||
asyncSendMsgToServer(pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, body);
|
||||
pRequest->code = setQueryResultFromRsp(&pRequest->body.resInfo, (SRetrieveTableRsp*)pResInfo->pData, convertUcs4);
|
||||
if (pRequest->code != TSDB_CODE_SUCCESS) {
|
||||
pResultInfo->numOfRows = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tsem_wait(&pRequest->body.rspSem);
|
||||
tscDebug("0x%" PRIx64 " fetch results, numOfRows:%d total Rows:%" PRId64 ", complete:%d, reqId:0x%" PRIx64,
|
||||
pRequest->self, pResInfo->numOfRows, pResInfo->totalRows, pResInfo->completed, pRequest->requestId);
|
||||
|
||||
pResultInfo->current = 0;
|
||||
if (pResultInfo->numOfRows <= pResultInfo->current) {
|
||||
if (pResultInfo->numOfRows == 0) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
_return:
|
||||
if (setupOneRowPtr) {
|
||||
doSetOneRowPtr(pResultInfo);
|
||||
pResultInfo->current += 1;
|
||||
|
|
|
@ -90,150 +90,13 @@ SMsgSendInfo* buildMsgInfoImpl(SRequestObj *pRequest) {
|
|||
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) {
|
||||
SRetrieveTableReq retrieveReq = {0};
|
||||
retrieveReq.showId = pRequest->body.showInfo.execId;
|
||||
|
||||
int32_t contLen = tSerializeSRetrieveTableReq(NULL, 0, &retrieveReq);
|
||||
void* pReq = taosMemoryMalloc(contLen);
|
||||
tSerializeSRetrieveTableReq(pReq, contLen, &retrieveReq);
|
||||
pMsgSendInfo->msgInfo.pData = pReq;
|
||||
pMsgSendInfo->msgInfo.len = contLen;
|
||||
pMsgSendInfo->msgInfo.handle = NULL;
|
||||
} else {
|
||||
SVShowTablesFetchReq* pFetchMsg = taosMemoryCalloc(1, sizeof(SVShowTablesFetchReq));
|
||||
if (pFetchMsg == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pFetchMsg->id = htobe64(pRequest->body.showInfo.execId);
|
||||
pFetchMsg->head.vgId = htonl(pRequest->body.showInfo.vgId);
|
||||
|
||||
pMsgSendInfo->msgInfo.pData = pFetchMsg;
|
||||
pMsgSendInfo->msgInfo.len = sizeof(SVShowTablesFetchReq);
|
||||
pMsgSendInfo->msgInfo.handle = NULL;
|
||||
}
|
||||
} else {
|
||||
assert(pRequest != NULL);
|
||||
pMsgSendInfo->msgInfo = pRequest->body.requestMsg;
|
||||
}
|
||||
assert(pRequest != NULL);
|
||||
pMsgSendInfo->msgInfo = pRequest->body.requestMsg;
|
||||
|
||||
pMsgSendInfo->fp = (handleRequestRspFp[TMSG_INDEX(pRequest->type)] == NULL)? genericRspCallback:handleRequestRspFp[TMSG_INDEX(pRequest->type)];
|
||||
return pMsgSendInfo;
|
||||
}
|
||||
|
||||
int32_t processShowRsp(void* param, const SDataBuf* pMsg, int32_t code) {
|
||||
SRequestObj* pRequest = param;
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
setErrno(pRequest, code);
|
||||
tsem_post(&pRequest->body.rspSem);
|
||||
return code;
|
||||
}
|
||||
|
||||
SShowRsp showRsp = {0};
|
||||
tDeserializeSShowRsp(pMsg->pData, pMsg->len, &showRsp);
|
||||
STableMetaRsp *pMetaMsg = &showRsp.tableMeta;
|
||||
|
||||
taosMemoryFreeClear(pRequest->body.resInfo.pRspMsg);
|
||||
pRequest->body.resInfo.pRspMsg = pMsg->pData;
|
||||
SReqResultInfo* pResInfo = &pRequest->body.resInfo;
|
||||
|
||||
if (pResInfo->fields == NULL) {
|
||||
TAOS_FIELD* pFields = taosMemoryCalloc(pMetaMsg->numOfColumns, sizeof(TAOS_FIELD));
|
||||
for (int32_t i = 0; i < pMetaMsg->numOfColumns; ++i) {
|
||||
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;
|
||||
}
|
||||
|
||||
pResInfo->fields = pFields;
|
||||
}
|
||||
|
||||
pResInfo->numOfCols = pMetaMsg->numOfColumns;
|
||||
pRequest->body.showInfo.execId = showRsp.showId;
|
||||
tFreeSShowRsp(&showRsp);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
tsem_post(&pRequest->body.rspSem);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t processRetrieveMnodeRsp(void* param, const SDataBuf* pMsg, int32_t code) {
|
||||
SRequestObj *pRequest = param;
|
||||
SReqResultInfo *pResInfo = &pRequest->body.resInfo;
|
||||
taosMemoryFreeClear(pResInfo->pRspMsg);
|
||||
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
setErrno(pRequest, code);
|
||||
tsem_post(&pRequest->body.rspSem);
|
||||
return code;
|
||||
}
|
||||
|
||||
assert(pMsg->len >= sizeof(SRetrieveTableRsp));
|
||||
|
||||
SRetrieveTableRsp *pRetrieve = (SRetrieveTableRsp *) pMsg->pData;
|
||||
pRetrieve->numOfRows = htonl(pRetrieve->numOfRows);
|
||||
pRetrieve->precision = htons(pRetrieve->precision);
|
||||
|
||||
pResInfo->pRspMsg = pMsg->pData;
|
||||
pResInfo->numOfRows = pRetrieve->numOfRows;
|
||||
pResInfo->pData = pRetrieve->data;
|
||||
pResInfo->completed = pRetrieve->completed;
|
||||
|
||||
pResInfo->current = 0;
|
||||
// setResultDataPtr(pResInfo, pResInfo->fields, pResInfo->numOfCols, pResInfo->numOfRows);
|
||||
|
||||
tscDebug("0x%"PRIx64" numOfRows:%d, complete:%d, qId:0x%"PRIx64, pRequest->self, pRetrieve->numOfRows,
|
||||
pRetrieve->completed, pRequest->body.showInfo.execId);
|
||||
|
||||
tsem_post(&pRequest->body.rspSem);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t processRetrieveVndRsp(void* param, const SDataBuf* pMsg, int32_t code) {
|
||||
SRequestObj* pRequest = param;
|
||||
|
||||
SReqResultInfo* pResInfo = &pRequest->body.resInfo;
|
||||
taosMemoryFreeClear(pResInfo->pRspMsg);
|
||||
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
setErrno(pRequest, code);
|
||||
tsem_post(&pRequest->body.rspSem);
|
||||
return code;
|
||||
}
|
||||
|
||||
assert(pMsg->len >= sizeof(SRetrieveTableRsp));
|
||||
|
||||
pResInfo->pRspMsg = pMsg->pData;
|
||||
|
||||
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;
|
||||
// setResultDataPtr(pResInfo, pResInfo->fields, pResInfo->numOfCols, pResInfo->numOfRows);
|
||||
|
||||
tscDebug("0x%"PRIx64" numOfRows:%d, complete:%d, qId:0x%"PRIx64, pRequest->self, pFetchRsp->numOfRows,
|
||||
pFetchRsp->completed, pRequest->body.showInfo.execId);
|
||||
|
||||
tsem_post(&pRequest->body.rspSem);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t processCreateDbRsp(void* param, const SDataBuf* pMsg, int32_t code) {
|
||||
// todo rsp with the vnode id list
|
||||
SRequestObj* pRequest = param;
|
||||
|
@ -420,13 +283,8 @@ void initMsgHandleFp() {
|
|||
#endif
|
||||
|
||||
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;
|
||||
|
||||
handleRequestRspFp[TMSG_INDEX(TDMT_VND_SHOW_TABLES)] = processShowRsp;
|
||||
handleRequestRspFp[TMSG_INDEX(TDMT_VND_SHOW_TABLES_FETCH)] = processRetrieveVndRsp;
|
||||
}
|
||||
|
|
|
@ -675,8 +675,15 @@ TEST(testCase, agg_query_tables) {
|
|||
|
||||
char str[512] = {0};
|
||||
while ((pRow = taos_fetch_row(pRes)) != NULL) {
|
||||
int32_t* length = taos_fetch_lengths(pRes);
|
||||
for(int32_t i = 0; i < numOfFields; ++i) {
|
||||
printf("(%d):%d " , i, length[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
int32_t code = taos_print_row(str, pRow, pFields, numOfFields);
|
||||
printf("%s\n", str);
|
||||
memset(str, 0, sizeof(str));
|
||||
}
|
||||
|
||||
taos_free_result(pRes);
|
||||
|
|
|
@ -2182,7 +2182,7 @@ int32_t tSerializeSRetrieveTableReq(void *buf, int32_t bufLen, SRetrieveTableReq
|
|||
if (tStartEncode(&encoder) < 0) return -1;
|
||||
if (tEncodeI64(&encoder, pReq->showId) < 0) return -1;
|
||||
if (tEncodeI32(&encoder, pReq->type) < 0) return -1;
|
||||
if (tEncodeI8(&encoder, pReq->free) < 0) return -1;
|
||||
// if (tEncodeI8(&encoder, pReq->free) < 0) return -1;
|
||||
if (tEncodeCStr(&encoder, pReq->db) < 0) return -1;
|
||||
if (tEncodeCStr(&encoder, pReq->tb) < 0) return -1;
|
||||
tEndEncode(&encoder);
|
||||
|
@ -2199,7 +2199,7 @@ int32_t tDeserializeSRetrieveTableReq(void *buf, int32_t bufLen, SRetrieveTableR
|
|||
if (tStartDecode(&decoder) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &pReq->showId) < 0) return -1;
|
||||
if (tDecodeI32(&decoder, &pReq->type) < 0) return -1;
|
||||
if (tDecodeI8(&decoder, &pReq->free) < 0) return -1;
|
||||
// if (tDecodeI8(&decoder, &pReq->free) < 0) return -1;
|
||||
if (tDecodeCStrTo(&decoder, pReq->db) < 0) return -1;
|
||||
if (tDecodeCStrTo(&decoder, pReq->tb) < 0) return -1;
|
||||
tEndDecode(&decoder);
|
||||
|
|
|
@ -164,7 +164,6 @@ void mmInitMsgHandle(SMgmtWrapper *pWrapper) {
|
|||
dndSetMsgHandle(pWrapper, TDMT_MND_KILL_CONN, mmProcessWriteMsg, DEFAULT_HANDLE);
|
||||
dndSetMsgHandle(pWrapper, TDMT_MND_HEARTBEAT, mmProcessWriteMsg, DEFAULT_HANDLE);
|
||||
dndSetMsgHandle(pWrapper, TDMT_MND_SHOW, mmProcessReadMsg, DEFAULT_HANDLE);
|
||||
dndSetMsgHandle(pWrapper, TDMT_MND_SHOW_RETRIEVE, mmProcessReadMsg, DEFAULT_HANDLE);
|
||||
dndSetMsgHandle(pWrapper, TDMT_MND_SYSTABLE_RETRIEVE, mmProcessReadMsg, DEFAULT_HANDLE);
|
||||
dndSetMsgHandle(pWrapper, TDMT_MND_STATUS, mmProcessReadMsg, DEFAULT_HANDLE);
|
||||
dndSetMsgHandle(pWrapper, TDMT_MND_KILL_TRANS, mmProcessWriteMsg, DEFAULT_HANDLE);
|
||||
|
|
|
@ -95,5 +95,4 @@ void qmInitMsgHandle(SMgmtWrapper *pWrapper) {
|
|||
dndSetMsgHandle(pWrapper, TDMT_VND_TASKS_STATUS, qmProcessFetchMsg, QNODE_HANDLE);
|
||||
dndSetMsgHandle(pWrapper, TDMT_VND_CANCEL_TASK, qmProcessFetchMsg, QNODE_HANDLE);
|
||||
dndSetMsgHandle(pWrapper, TDMT_VND_DROP_TASK, qmProcessFetchMsg, QNODE_HANDLE);
|
||||
dndSetMsgHandle(pWrapper, TDMT_VND_SHOW_TABLES, qmProcessFetchMsg, QNODE_HANDLE);
|
||||
}
|
||||
|
|
|
@ -133,17 +133,17 @@ const char* Testbase::GetMetaTbName() { return metaRsp.tbName; }
|
|||
void Testbase::SendShowRetrieveReq() {
|
||||
SRetrieveTableReq retrieveReq = {0};
|
||||
retrieveReq.showId = showId;
|
||||
retrieveReq.free = 0;
|
||||
// retrieveReq.free = 0;
|
||||
|
||||
int32_t contLen = tSerializeSRetrieveTableReq(NULL, 0, &retrieveReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSRetrieveTableReq(pReq, contLen, &retrieveReq);
|
||||
|
||||
SRpcMsg* pRsp = SendReq(TDMT_MND_SHOW_RETRIEVE, pReq, contLen);
|
||||
pRetrieveRsp = (SRetrieveTableRsp*)pRsp->pCont;
|
||||
pRetrieveRsp->numOfRows = htonl(pRetrieveRsp->numOfRows);
|
||||
pRetrieveRsp->useconds = htobe64(pRetrieveRsp->useconds);
|
||||
pRetrieveRsp->compLen = htonl(pRetrieveRsp->compLen);
|
||||
// SRpcMsg* pRsp = SendReq(TDMT_MND_SHOW_RETRIEVE, pReq, contLen);
|
||||
// pRetrieveRsp = (SRetrieveTableRsp*)pRsp->pCont;
|
||||
// pRetrieveRsp->numOfRows = htonl(pRetrieveRsp->numOfRows);
|
||||
// pRetrieveRsp->useconds = htobe64(pRetrieveRsp->useconds);
|
||||
// pRetrieveRsp->compLen = htonl(pRetrieveRsp->compLen);
|
||||
|
||||
pData = pRetrieveRsp->data;
|
||||
pos = 0;
|
||||
|
|
|
@ -335,8 +335,6 @@ void vmInitMsgHandle(SMgmtWrapper *pWrapper) {
|
|||
dndSetMsgHandle(pWrapper, TDMT_VND_CREATE_SMA, (NodeMsgFp)vmProcessWriteMsg, DEFAULT_HANDLE);
|
||||
dndSetMsgHandle(pWrapper, TDMT_VND_CANCEL_SMA, (NodeMsgFp)vmProcessWriteMsg, DEFAULT_HANDLE);
|
||||
dndSetMsgHandle(pWrapper, TDMT_VND_DROP_SMA, (NodeMsgFp)vmProcessWriteMsg, DEFAULT_HANDLE);
|
||||
dndSetMsgHandle(pWrapper, TDMT_VND_SHOW_TABLES, (NodeMsgFp)vmProcessFetchMsg, DEFAULT_HANDLE);
|
||||
dndSetMsgHandle(pWrapper, TDMT_VND_SHOW_TABLES_FETCH, (NodeMsgFp)vmProcessFetchMsg, DEFAULT_HANDLE);
|
||||
dndSetMsgHandle(pWrapper, TDMT_VND_MQ_SET_CONN, (NodeMsgFp)vmProcessWriteMsg, DEFAULT_HANDLE);
|
||||
dndSetMsgHandle(pWrapper, TDMT_VND_MQ_REB, (NodeMsgFp)vmProcessWriteMsg, DEFAULT_HANDLE);
|
||||
dndSetMsgHandle(pWrapper, TDMT_VND_MQ_CANCEL_CONN, (NodeMsgFp)vmProcessWriteMsg, DEFAULT_HANDLE);
|
||||
|
|
|
@ -385,14 +385,14 @@ typedef struct {
|
|||
int16_t numOfColumns;
|
||||
int32_t rowSize;
|
||||
int32_t numOfRows;
|
||||
int32_t numOfReads;
|
||||
int32_t payloadLen;
|
||||
void* pIter;
|
||||
SMnode* pMnode;
|
||||
STableMetaRsp* pMeta;
|
||||
bool sysDbRsp;
|
||||
char db[TSDB_DB_FNAME_LEN];
|
||||
int16_t offset[TSDB_MAX_COLUMNS];
|
||||
int32_t bytes[TSDB_MAX_COLUMNS];
|
||||
char payload[];
|
||||
} SShowObj;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -41,8 +41,7 @@ extern "C" {
|
|||
typedef int32_t (*MndMsgFp)(SNodeMsg *pMsg);
|
||||
typedef int32_t (*MndInitFp)(SMnode *pMnode);
|
||||
typedef void (*MndCleanupFp)(SMnode *pMnode);
|
||||
typedef int32_t (*ShowMetaFp)(SNodeMsg *pMsg, SShowObj *pShow, STableMetaRsp *pMeta);
|
||||
typedef int32_t (*ShowRetrieveFp)(SNodeMsg *pMsg, SShowObj *pShow, char *data, int32_t rows);
|
||||
typedef int32_t (*ShowRetrieveFp)(SNodeMsg *pMsg, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows);
|
||||
typedef void (*ShowFreeIterFp)(SMnode *pMnode, void *pIter);
|
||||
|
||||
typedef struct SMnodeLoad {
|
||||
|
@ -98,7 +97,7 @@ typedef struct {
|
|||
int64_t timeseriesAllowed;
|
||||
} SGrantInfo;
|
||||
|
||||
typedef struct SMnode {
|
||||
struct SMnode {
|
||||
int32_t selfId;
|
||||
int64_t clusterId;
|
||||
int8_t replica;
|
||||
|
@ -122,7 +121,7 @@ typedef struct SMnode {
|
|||
SGrantInfo grant;
|
||||
MndMsgFp msgFp[TDMT_MAX];
|
||||
SMsgCb msgCb;
|
||||
} SMnode;
|
||||
};
|
||||
|
||||
void mndSetMsgHandle(SMnode *pMnode, tmsg_t msgType, MndMsgFp fp);
|
||||
int64_t mndGenerateUid(char *name, int32_t len);
|
||||
|
|
|
@ -33,8 +33,7 @@ static int32_t mndProcessCreateBnodeReq(SNodeMsg *pReq);
|
|||
static int32_t mndProcessCreateBnodeRsp(SNodeMsg *pRsp);
|
||||
static int32_t mndProcessDropBnodeReq(SNodeMsg *pReq);
|
||||
static int32_t mndProcessDropBnodeRsp(SNodeMsg *pRsp);
|
||||
static int32_t mndGetBnodeMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta);
|
||||
static int32_t mndRetrieveBnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
||||
static int32_t mndRetrieveBnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows);
|
||||
static void mndCancelGetNextBnode(SMnode *pMnode, void *pIter);
|
||||
|
||||
int32_t mndInitBnode(SMnode *pMnode) {
|
||||
|
@ -438,39 +437,35 @@ static int32_t mndProcessDropBnodeRsp(SNodeMsg *pRsp) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t mndRetrieveBnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) {
|
||||
static int32_t mndRetrieveBnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
int32_t numOfRows = 0;
|
||||
int32_t cols = 0;
|
||||
SBnodeObj *pObj = NULL;
|
||||
char *pWrite;
|
||||
|
||||
while (numOfRows < rows) {
|
||||
pShow->pIter = sdbFetch(pSdb, SDB_BNODE, pShow->pIter, (void **)&pObj);
|
||||
if (pShow->pIter == NULL) break;
|
||||
|
||||
cols = 0;
|
||||
SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char*) &pObj->id, false);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int16_t *)pWrite = pObj->id;
|
||||
cols++;
|
||||
char buf[TSDB_EP_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(buf, pObj->pDnode->ep, pShow->bytes[cols]);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pObj->pDnode->ep, pShow->bytes[cols]);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, buf, false);
|
||||
|
||||
cols++;
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int64_t *)pWrite = pObj->createdTime;
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char*) &pObj->createdTime, false);
|
||||
|
||||
numOfRows++;
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
|
||||
mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow);
|
||||
pShow->numOfReads += numOfRows;
|
||||
pShow->numOfRows += numOfRows;
|
||||
|
||||
return numOfRows;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ static int32_t mndClusterActionInsert(SSdb *pSdb, SClusterObj *pCluster);
|
|||
static int32_t mndClusterActionDelete(SSdb *pSdb, SClusterObj *pCluster);
|
||||
static int32_t mndClusterActionUpdate(SSdb *pSdb, SClusterObj *pOldCluster, SClusterObj *pNewCluster);
|
||||
static int32_t mndCreateDefaultCluster(SMnode *pMnode);
|
||||
static int32_t mndRetrieveClusters(SNodeMsg *pMsg, SShowObj *pShow, char *data, int32_t rows);
|
||||
static int32_t mndRetrieveClusters(SNodeMsg *pMsg, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows);
|
||||
static void mndCancelGetNextCluster(SMnode *pMnode, void *pIter);
|
||||
|
||||
int32_t mndInitCluster(SMnode *pMnode) {
|
||||
|
@ -178,12 +178,11 @@ static int32_t mndCreateDefaultCluster(SMnode *pMnode) {
|
|||
return sdbWrite(pMnode->pSdb, pRaw);
|
||||
}
|
||||
|
||||
static int32_t mndRetrieveClusters(SNodeMsg *pMsg, SShowObj *pShow, char *data, int32_t rows) {
|
||||
static int32_t mndRetrieveClusters(SNodeMsg *pMsg, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) {
|
||||
SMnode *pMnode = pMsg->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
int32_t numOfRows = 0;
|
||||
int32_t cols = 0;
|
||||
char *pWrite;
|
||||
SClusterObj *pCluster = NULL;
|
||||
|
||||
while (numOfRows < rows) {
|
||||
|
@ -191,25 +190,23 @@ static int32_t mndRetrieveClusters(SNodeMsg *pMsg, SShowObj *pShow, char *data,
|
|||
if (pShow->pIter == NULL) break;
|
||||
|
||||
cols = 0;
|
||||
SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char*) &pCluster->id, false);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int64_t *)pWrite = pCluster->id;
|
||||
cols++;
|
||||
char buf[tListLen(pCluster->name) + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(buf, pCluster->name, pShow->bytes[cols]);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pCluster->name, TSDB_CLUSTER_ID_LEN);
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, buf, false);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int64_t *)pWrite = pCluster->createdTime;
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char*) &pCluster->createdTime, false);
|
||||
|
||||
sdbRelease(pSdb, pCluster);
|
||||
numOfRows++;
|
||||
}
|
||||
|
||||
mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow);
|
||||
pShow->numOfReads += numOfRows;
|
||||
pShow->numOfRows += numOfRows;
|
||||
return numOfRows;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ static int32_t mndConsumerActionInsert(SSdb *pSdb, SMqConsumerObj *pConsumer);
|
|||
static int32_t mndConsumerActionDelete(SSdb *pSdb, SMqConsumerObj *pConsumer);
|
||||
static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pConsumer, SMqConsumerObj *pNewConsumer);
|
||||
static int32_t mndProcessConsumerMetaMsg(SNodeMsg *pMsg);
|
||||
static int32_t mndRetrieveConsumer(SNodeMsg *pMsg, SShowObj *pShow, char *data, int32_t rows);
|
||||
static int32_t mndRetrieveConsumer(SNodeMsg *pMsg, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows);
|
||||
static void mndCancelGetNextConsumer(SMnode *pMnode, void *pIter);
|
||||
|
||||
int32_t mndInitConsumer(SMnode *pMnode) {
|
||||
|
|
|
@ -38,7 +38,7 @@ static int32_t mndProcessDropDbReq(SNodeMsg *pReq);
|
|||
static int32_t mndProcessUseDbReq(SNodeMsg *pReq);
|
||||
static int32_t mndProcessSyncDbReq(SNodeMsg *pReq);
|
||||
static int32_t mndProcessCompactDbReq(SNodeMsg *pReq);
|
||||
static int32_t mndRetrieveDbs(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
||||
static int32_t mndRetrieveDbs(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rowsCapacity);
|
||||
static void mndCancelGetNextDb(SMnode *pMnode, void *pIter);
|
||||
static int32_t mndProcessGetDbCfgReq(SNodeMsg *pReq);
|
||||
static int32_t mndProcessGetIndexReq(SNodeMsg *pReq);
|
||||
|
@ -1351,90 +1351,76 @@ char *mnGetDbStr(char *src) {
|
|||
return pos;
|
||||
}
|
||||
|
||||
static char *getDataPosition(char *pData, SShowObj *pShow, int32_t cols, int32_t rows, int32_t capacityOfRow) {
|
||||
return pData + pShow->offset[cols] * capacityOfRow + pShow->bytes[cols] * rows;
|
||||
}
|
||||
|
||||
static void dumpDbInfoToPayload(char *data, SDbObj *pDb, SShowObj *pShow, int32_t rows, int32_t rowCapacity,
|
||||
int64_t numOfTables) {
|
||||
static void dumpDbInfoData(SSDataBlock* pBlock, SDbObj *pDb, SShowObj *pShow, int32_t rows, int64_t numOfTables) {
|
||||
int32_t cols = 0;
|
||||
|
||||
char *pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity);
|
||||
char* buf = taosMemoryMalloc(pShow->bytes[cols]);
|
||||
char *name = mnGetDbStr(pDb->name);
|
||||
if (name != NULL) {
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, name, pShow->bytes[cols]);
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(buf, name, pShow->bytes[cols]);
|
||||
} else {
|
||||
STR_TO_VARSTR(pWrite, "NULL");
|
||||
// STR_TO_VARSTR(pWrite, "NULL");
|
||||
ASSERT(0);
|
||||
}
|
||||
cols++;
|
||||
|
||||
pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity);
|
||||
*(int64_t *)pWrite = pDb->createdTime;
|
||||
cols++;
|
||||
SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, rows, buf, false);
|
||||
taosMemoryFree(buf);
|
||||
|
||||
pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity);
|
||||
*(int16_t *)pWrite = pDb->cfg.numOfVgroups;
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, rows, (const char *)&pDb->createdTime, false);
|
||||
|
||||
pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity);
|
||||
*(int64_t *)pWrite = numOfTables;
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.numOfVgroups, false);
|
||||
|
||||
pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity);
|
||||
*(int16_t *)pWrite = pDb->cfg.replications;
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, rows, (const char *)&numOfTables, false);
|
||||
|
||||
pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity);
|
||||
*(int16_t *)pWrite = pDb->cfg.quorum;
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.replications, false);
|
||||
|
||||
pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity);
|
||||
*(int32_t *)pWrite = pDb->cfg.daysPerFile;
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.quorum, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.daysPerFile, false);
|
||||
|
||||
pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity);
|
||||
char tmp[128] = {0};
|
||||
int32_t len = 0;
|
||||
if (pDb->cfg.daysToKeep0 > pDb->cfg.daysToKeep1 || pDb->cfg.daysToKeep0 > pDb->cfg.daysToKeep2) {
|
||||
sprintf(tmp, "%d,%d,%d", pDb->cfg.daysToKeep1, pDb->cfg.daysToKeep2, pDb->cfg.daysToKeep0);
|
||||
len = sprintf(&tmp[VARSTR_HEADER_SIZE], "%d,%d,%d", pDb->cfg.daysToKeep1, pDb->cfg.daysToKeep2, pDb->cfg.daysToKeep0);
|
||||
} else {
|
||||
sprintf(tmp, "%d,%d,%d", pDb->cfg.daysToKeep0, pDb->cfg.daysToKeep1, pDb->cfg.daysToKeep2);
|
||||
len = sprintf(&tmp[VARSTR_HEADER_SIZE], "%d,%d,%d", pDb->cfg.daysToKeep0, pDb->cfg.daysToKeep1, pDb->cfg.daysToKeep2);
|
||||
}
|
||||
STR_WITH_SIZE_TO_VARSTR(pWrite, tmp, strlen(tmp));
|
||||
cols++;
|
||||
|
||||
pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity);
|
||||
*(int32_t *)pWrite = pDb->cfg.cacheBlockSize;
|
||||
cols++;
|
||||
varDataSetLen(tmp, len);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, rows, (const char *)tmp, false);
|
||||
|
||||
pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity);
|
||||
*(int32_t *)pWrite = pDb->cfg.totalBlocks;
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.cacheBlockSize, false);
|
||||
|
||||
pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity);
|
||||
*(int32_t *)pWrite = pDb->cfg.minRows;
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.totalBlocks, false);
|
||||
|
||||
pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity);
|
||||
*(int32_t *)pWrite = pDb->cfg.maxRows;
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.minRows, false);
|
||||
|
||||
pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity);
|
||||
*(int8_t *)pWrite = pDb->cfg.walLevel;
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.maxRows, false);
|
||||
|
||||
pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity);
|
||||
*(int32_t *)pWrite = pDb->cfg.fsyncPeriod;
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.walLevel, false);
|
||||
|
||||
pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity);
|
||||
*(int8_t *)pWrite = pDb->cfg.compression;
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.fsyncPeriod, false);
|
||||
|
||||
pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity);
|
||||
*(int8_t *)pWrite = pDb->cfg.cacheLastRow;
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.compression, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.cacheLastRow, false);
|
||||
|
||||
pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity);
|
||||
char *prec = NULL;
|
||||
switch (pDb->cfg.precision) {
|
||||
case TSDB_TIME_PRECISION_MILLI:
|
||||
|
@ -1450,28 +1436,31 @@ static void dumpDbInfoToPayload(char *data, SDbObj *pDb, SShowObj *pShow, int32_
|
|||
prec = "none";
|
||||
break;
|
||||
}
|
||||
STR_WITH_SIZE_TO_VARSTR(pWrite, prec, 2);
|
||||
cols++;
|
||||
|
||||
pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity);
|
||||
*(int32_t *)pWrite = pDb->cfg.ttl;
|
||||
cols++;
|
||||
char t[10] = {0};
|
||||
STR_WITH_SIZE_TO_VARSTR(t, prec, 2);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, rows, (const char *)t, false);
|
||||
|
||||
pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity);
|
||||
*(int8_t *)pWrite = pDb->cfg.singleSTable;
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.ttl, false);
|
||||
|
||||
pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity);
|
||||
*(int8_t *)pWrite = pDb->cfg.streamMode;
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.singleSTable, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.streamMode, false);
|
||||
|
||||
pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity);
|
||||
char *status = "ready";
|
||||
STR_WITH_SIZE_TO_VARSTR(pWrite, status, strlen(status));
|
||||
cols++;
|
||||
char b[24] = {0};
|
||||
STR_WITH_SIZE_TO_VARSTR(b, status, strlen(status));
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, rows, (const char *)b, false);
|
||||
|
||||
// pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity);
|
||||
// *(int8_t *)pWrite = pDb->cfg.update;
|
||||
|
||||
}
|
||||
|
||||
static void setInformationSchemaDbCfg(SDbObj *pDbObj) {
|
||||
|
@ -1486,6 +1475,18 @@ static void setInformationSchemaDbCfg(SDbObj *pDbObj) {
|
|||
pDbObj->cfg.precision = TSDB_TIME_PRECISION_MILLI;
|
||||
}
|
||||
|
||||
static void setPerfSchemaDbCfg(SDbObj* pDbObj) {
|
||||
ASSERT(pDbObj != NULL);
|
||||
strncpy(pDbObj->name, TSDB_PERFORMANCE_SCHEMA_DB, tListLen(pDbObj->name));
|
||||
|
||||
pDbObj->createdTime = 0;
|
||||
pDbObj->cfg.numOfVgroups = 0;
|
||||
pDbObj->cfg.quorum = 1;
|
||||
pDbObj->cfg.replications = 1;
|
||||
pDbObj->cfg.update = 1;
|
||||
pDbObj->cfg.precision = TSDB_TIME_PRECISION_MILLI;
|
||||
}
|
||||
|
||||
static bool mndGetTablesOfDbFp(SMnode *pMnode, void *pObj, void *p1, void *p2, void *p3) {
|
||||
SVgObj *pVgroup = pObj;
|
||||
int32_t *numOfTables = p1;
|
||||
|
@ -1494,12 +1495,28 @@ static bool mndGetTablesOfDbFp(SMnode *pMnode, void *pObj, void *p1, void *p2, v
|
|||
return true;
|
||||
}
|
||||
|
||||
static int32_t mndRetrieveDbs(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rowsCapacity) {
|
||||
static int32_t mndRetrieveDbs(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rowsCapacity) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
int32_t numOfRows = 0;
|
||||
SDbObj *pDb = NULL;
|
||||
|
||||
// Append the information_schema database into the result.
|
||||
if (!pShow->sysDbRsp) {
|
||||
SDbObj infoschemaDb = {0};
|
||||
setInformationSchemaDbCfg(&infoschemaDb);
|
||||
dumpDbInfoData(pBlock, &infoschemaDb, pShow, numOfRows, 14);
|
||||
|
||||
numOfRows += 1;
|
||||
|
||||
SDbObj perfschemaDb = {0};
|
||||
setPerfSchemaDbCfg(&perfschemaDb);
|
||||
dumpDbInfoData(pBlock, &perfschemaDb, pShow, numOfRows, 3);
|
||||
|
||||
numOfRows += 1;
|
||||
pShow->sysDbRsp = true;
|
||||
}
|
||||
|
||||
while (numOfRows < rowsCapacity) {
|
||||
pShow->pIter = sdbFetch(pSdb, SDB_DB, pShow->pIter, (void **)&pDb);
|
||||
if (pShow->pIter == NULL) {
|
||||
|
@ -1509,21 +1526,12 @@ static int32_t mndRetrieveDbs(SNodeMsg *pReq, SShowObj *pShow, char *data, int32
|
|||
int32_t numOfTables = 0;
|
||||
sdbTraverse(pSdb, SDB_VGROUP, mndGetTablesOfDbFp, &numOfTables, NULL, NULL);
|
||||
|
||||
dumpDbInfoToPayload(data, pDb, pShow, numOfRows, rowsCapacity, numOfTables);
|
||||
dumpDbInfoData(pBlock, pDb, pShow, numOfRows, numOfTables);
|
||||
numOfRows++;
|
||||
sdbRelease(pSdb, pDb);
|
||||
}
|
||||
|
||||
// Append the information_schema database into the result.
|
||||
if (numOfRows < rowsCapacity) {
|
||||
SDbObj dummyISDb = {0};
|
||||
setInformationSchemaDbCfg(&dummyISDb);
|
||||
dumpDbInfoToPayload(data, &dummyISDb, pShow, numOfRows, rowsCapacity, 14);
|
||||
numOfRows += 1;
|
||||
}
|
||||
|
||||
mndVacuumResult(data, pShow->numOfColumns, numOfRows, rowsCapacity, pShow);
|
||||
pShow->numOfReads += numOfRows;
|
||||
pShow->numOfRows += numOfRows;
|
||||
|
||||
return numOfRows;
|
||||
}
|
||||
|
|
|
@ -56,9 +56,9 @@ static int32_t mndProcessConfigDnodeRsp(SNodeMsg *pRsp);
|
|||
static int32_t mndProcessStatusReq(SNodeMsg *pReq);
|
||||
|
||||
static int32_t mndGetConfigMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta);
|
||||
static int32_t mndRetrieveConfigs(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
||||
static int32_t mndRetrieveConfigs(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows);
|
||||
static void mndCancelGetNextConfig(SMnode *pMnode, void *pIter);
|
||||
static int32_t mndRetrieveDnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
||||
static int32_t mndRetrieveDnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows);
|
||||
static void mndCancelGetNextDnode(SMnode *pMnode, void *pIter);
|
||||
|
||||
int32_t mndInitDnode(SMnode *pMnode) {
|
||||
|
@ -669,7 +669,7 @@ static int32_t mndGetConfigMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t mndRetrieveConfigs(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) {
|
||||
static int32_t mndRetrieveConfigs(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
int32_t totalRows = 0;
|
||||
int32_t numOfRows = 0;
|
||||
|
@ -694,34 +694,36 @@ static int32_t mndRetrieveConfigs(SNodeMsg *pReq, SShowObj *pShow, char *data, i
|
|||
snprintf(cfgVals[totalRows], TSDB_CONIIG_VALUE_LEN, "%s", tsCharset);
|
||||
totalRows++;
|
||||
|
||||
char buf[TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
char bufVal[TSDB_CONIIG_VALUE_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
|
||||
for (int32_t i = 0; i < totalRows; 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++;
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(buf, cfgOpts[i], TSDB_CONFIG_OPTION_LEN);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, cfgVals[i], TSDB_CONIIG_VALUE_LEN);
|
||||
cols++;
|
||||
SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char*) buf, false);
|
||||
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(bufVal, cfgVals[i], TSDB_CONIIG_VALUE_LEN);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char*) bufVal, false);
|
||||
|
||||
numOfRows++;
|
||||
}
|
||||
|
||||
mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow);
|
||||
pShow->numOfReads += numOfRows;
|
||||
pShow->numOfRows += numOfRows;
|
||||
return numOfRows;
|
||||
}
|
||||
|
||||
static void mndCancelGetNextConfig(SMnode *pMnode, void *pIter) {}
|
||||
|
||||
static int32_t mndRetrieveDnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) {
|
||||
static int32_t mndRetrieveDnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
int32_t numOfRows = 0;
|
||||
int32_t cols = 0;
|
||||
SDnodeObj *pDnode = NULL;
|
||||
char *pWrite;
|
||||
int64_t curMs = taosGetTimestampMs();
|
||||
|
||||
while (numOfRows < rows) {
|
||||
|
@ -731,40 +733,42 @@ static int32_t mndRetrieveDnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, in
|
|||
|
||||
cols = 0;
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int16_t *)pWrite = pDnode->id;
|
||||
cols++;
|
||||
SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char*) &pDnode->id, false);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDnode->ep, pShow->bytes[cols]);
|
||||
cols++;
|
||||
char buf[tListLen(pDnode->ep) + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(buf, pDnode->ep, pShow->bytes[cols]);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int16_t *)pWrite = mndGetVnodesNum(pMnode, pDnode->id);
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, buf, false);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int16_t *)pWrite = pDnode->numOfSupportVnodes;
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
int16_t id = mndGetVnodesNum(pMnode, pDnode->id);
|
||||
colDataAppend(pColInfo, numOfRows, (const char*) &id, false);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
STR_TO_VARSTR(pWrite, online ? "ready" : "offline");
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)&pDnode->numOfSupportVnodes, false);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int64_t *)pWrite = pDnode->createdTime;
|
||||
cols++;
|
||||
char b1[9] = {0};
|
||||
STR_TO_VARSTR(b1, online? "ready":"offline");
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
STR_TO_VARSTR(pWrite, online ? "" : offlineReason[pDnode->offlineReason]);
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, b1, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char*) &pDnode->createdTime, false);
|
||||
|
||||
char b[tListLen(offlineReason) + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_TO_VARSTR(b, online ? "" : offlineReason[pDnode->offlineReason]);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, b, false);
|
||||
|
||||
numOfRows++;
|
||||
sdbRelease(pSdb, pDnode);
|
||||
}
|
||||
|
||||
mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow);
|
||||
pShow->numOfReads += numOfRows;
|
||||
pShow->numOfRows += numOfRows;
|
||||
|
||||
return numOfRows;
|
||||
}
|
||||
|
|
|
@ -34,8 +34,7 @@ static int32_t mndDropFunc(SMnode *pMnode, SNodeMsg *pReq, SFuncObj *pFunc);
|
|||
static int32_t mndProcessCreateFuncReq(SNodeMsg *pReq);
|
||||
static int32_t mndProcessDropFuncReq(SNodeMsg *pReq);
|
||||
static int32_t mndProcessRetrieveFuncReq(SNodeMsg *pReq);
|
||||
static int32_t mndGetFuncMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta);
|
||||
static int32_t mndRetrieveFuncs(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
||||
static int32_t mndRetrieveFuncs(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows);
|
||||
static void mndCancelGetNextFunc(SMnode *pMnode, void *pIter);
|
||||
|
||||
int32_t mndInitFunc(SMnode *pMnode) {
|
||||
|
@ -462,70 +461,6 @@ RETRIEVE_FUNC_OVER:
|
|||
return code;
|
||||
}
|
||||
|
||||
static int32_t mndGetFuncMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
|
||||
int32_t cols = 0;
|
||||
SSchema *pSchema = pMeta->pSchemas;
|
||||
|
||||
pShow->bytes[cols] = TSDB_FUNC_NAME_LEN + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "name");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = PATH_MAX + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "comment");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 4;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_INT;
|
||||
strcpy(pSchema[cols].name, "aggregate");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = TSDB_TYPE_STR_MAX_LEN + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "outputtype");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 8;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_TIMESTAMP;
|
||||
strcpy(pSchema[cols].name, "create_time");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 4;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_INT;
|
||||
strcpy(pSchema[cols].name, "code_len");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 4;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_INT;
|
||||
strcpy(pSchema[cols].name, "bufsize");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pMeta->numOfColumns = cols;
|
||||
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_FUNC);
|
||||
pShow->rowSize = pShow->offset[cols - 1] + pShow->bytes[cols - 1];
|
||||
strcpy(pMeta->tbName, mndShowStr(pShow->type));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void *mnodeGenTypeStr(char *buf, int32_t buflen, uint8_t type, int16_t len) {
|
||||
char *msg = "unknown";
|
||||
if (type >= sizeof(tDataTypes) / sizeof(tDataTypes[0])) {
|
||||
|
@ -544,13 +479,12 @@ static void *mnodeGenTypeStr(char *buf, int32_t buflen, uint8_t type, int16_t le
|
|||
return tDataTypes[type].name;
|
||||
}
|
||||
|
||||
static int32_t mndRetrieveFuncs(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) {
|
||||
static int32_t mndRetrieveFuncs(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
int32_t numOfRows = 0;
|
||||
SFuncObj *pFunc = NULL;
|
||||
int32_t cols = 0;
|
||||
char *pWrite;
|
||||
char buf[TSDB_TYPE_STR_MAX_LEN];
|
||||
|
||||
while (numOfRows < rows) {
|
||||
|
@ -559,41 +493,43 @@ static int32_t mndRetrieveFuncs(SNodeMsg *pReq, SShowObj *pShow, char *data, int
|
|||
|
||||
cols = 0;
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pFunc->name, pShow->bytes[cols]);
|
||||
cols++;
|
||||
char b1[tListLen(pFunc->name) + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(b1, pFunc->name, pShow->bytes[cols]);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pFunc->pComment, pShow->bytes[cols]);
|
||||
cols++;
|
||||
SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char*) b1, false);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int32_t *)pWrite = pFunc->funcType == TSDB_FUNC_TYPE_AGGREGATE ? 1 : 0;
|
||||
cols++;
|
||||
char* b2 = taosMemoryCalloc(1, pShow->bytes[cols]);
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(b2, pFunc->pComment, pShow->bytes[cols]);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, mnodeGenTypeStr(buf, TSDB_TYPE_STR_MAX_LEN, pFunc->outputType, pFunc->outputLen),
|
||||
pShow->bytes[cols]);
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char*) b2, false);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int64_t *)pWrite = pFunc->createdTime;
|
||||
cols++;
|
||||
int32_t isAgg = (pFunc->funcType == TSDB_FUNC_TYPE_AGGREGATE) ? 1 : 0;
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int32_t *)pWrite = pFunc->codeSize;
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char*) &isAgg, false);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int32_t *)pWrite = pFunc->bufSize;
|
||||
cols++;
|
||||
char b3[TSDB_TYPE_STR_MAX_LEN] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(b3, mnodeGenTypeStr(buf, TSDB_TYPE_STR_MAX_LEN, pFunc->outputType, pFunc->outputLen), pShow->bytes[cols]);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char*) b3, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char*) &pFunc->createdTime, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char*) &pFunc->codeSize, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char*) &pFunc->bufSize, false);
|
||||
|
||||
numOfRows++;
|
||||
sdbRelease(pSdb, pFunc);
|
||||
}
|
||||
|
||||
mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow);
|
||||
pShow->numOfReads += numOfRows;
|
||||
pShow->numOfRows += numOfRows;
|
||||
return numOfRows;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,54 +23,54 @@
|
|||
//!!!! Note: only APPEND columns in below tables, NO insert !!!!
|
||||
static const SInfosTableSchema dnodesSchema[] = {
|
||||
{.name = "id", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT},
|
||||
{.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "vnodes", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT},
|
||||
{.name = "max_vnodes", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT},
|
||||
{.name = "status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||
{.name = "note", .bytes = 256 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "note", .bytes = 256 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
};
|
||||
static const SInfosTableSchema mnodesSchema[] = {
|
||||
{.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "role", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "role", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "role_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||
};
|
||||
static const SInfosTableSchema modulesSchema[] = {
|
||||
{.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "endpoint", .bytes = 134, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "module", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "endpoint", .bytes = 134, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "module", .bytes = 10, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
};
|
||||
static const SInfosTableSchema qnodesSchema[] = {
|
||||
{.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||
};
|
||||
static const SInfosTableSchema snodesSchema[] = {
|
||||
{.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||
};
|
||||
static const SInfosTableSchema bnodesSchema[] = {
|
||||
{.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||
};
|
||||
static const SInfosTableSchema clusterSchema[] = {
|
||||
{.name = "id", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT},
|
||||
{.name = "name", .bytes = TSDB_CLUSTER_ID_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "name", .bytes = TSDB_CLUSTER_ID_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||
};
|
||||
static const SInfosTableSchema userDBSchema[] = {
|
||||
{.name = "name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||
{.name = "vgroups", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT},
|
||||
{.name = "ntables", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT},
|
||||
{.name = "replica", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT},
|
||||
{.name = "quorum", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT},
|
||||
{.name = "replica", .bytes = 2, .type = TSDB_DATA_TYPE_TINYINT},
|
||||
{.name = "quorum", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT},
|
||||
{.name = "days", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "keep", .bytes = 24 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "keep", .bytes = 24 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "cache", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "blocks", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "minrows", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
|
@ -79,61 +79,61 @@ static const SInfosTableSchema userDBSchema[] = {
|
|||
{.name = "fsync", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "comp", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT},
|
||||
{.name = "cachelast", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT},
|
||||
{.name = "precision", .bytes = 2 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "precision", .bytes = 2 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "ttl", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "single_stable", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT},
|
||||
{.name = "stream_mode", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT},
|
||||
{.name = "status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
// {.name = "update", .bytes = 1, .type =
|
||||
// TSDB_DATA_TYPE_TINYINT}, // disable update
|
||||
};
|
||||
static const SInfosTableSchema userFuncSchema[] = {
|
||||
{.name = "name", .bytes = 32, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "name", .bytes = 32, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||
{.name = "ntables", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "precision", .bytes = 2, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "status", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "precision", .bytes = 2, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "status", .bytes = 10, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
};
|
||||
static const SInfosTableSchema userIdxSchema[] = {
|
||||
{.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "table_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "index_database", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "index_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "column_name", .bytes = SYSTABLE_SCH_COL_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "index_type", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "index_extensions", .bytes = 256, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "table_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "index_database", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "index_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "column_name", .bytes = SYSTABLE_SCH_COL_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "index_type", .bytes = 10, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "index_extensions", .bytes = 256, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
};
|
||||
static const SInfosTableSchema userStbsSchema[] = {
|
||||
{.name = "stable_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "stable_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||
{.name = "columns", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "tags", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "last_update", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||
{.name = "table_comment", .bytes = 1024 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "table_comment", .bytes = 1024 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
};
|
||||
static const SInfosTableSchema userStreamsSchema[] = {
|
||||
{.name = "stream_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "user_name", .bytes = 23, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "dest_table", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "stream_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "user_name", .bytes = 23, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "dest_table", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||
{.name = "sql", .bytes = 1024, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "sql", .bytes = 1024, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
};
|
||||
static const SInfosTableSchema userTblsSchema[] = {
|
||||
{.name = "table_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "table_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||
{.name = "columns", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "stable_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "stable_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "uid", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT},
|
||||
{.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "ttl", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "table_comment", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
};
|
||||
static const SInfosTableSchema userTblDistSchema[] = {
|
||||
{.name = "db_name", .bytes = 32, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "table_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "distributed_histogram", .bytes = 500, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "db_name", .bytes = 32, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "table_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "distributed_histogram", .bytes = 500, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "min_of_rows", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "max_of_rows", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "avg_of_rows", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
|
@ -146,10 +146,10 @@ static const SInfosTableSchema userTblDistSchema[] = {
|
|||
{.name = "seek_header_time", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
};
|
||||
static const SInfosTableSchema userUsersSchema[] = {
|
||||
{.name = "name", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "privilege", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "name", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "privilege", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||
{.name = "account", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "account", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
};
|
||||
static const SInfosTableSchema grantsSchema[] = {
|
||||
{.name = "version", .bytes = 8 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||
|
@ -169,16 +169,16 @@ static const SInfosTableSchema grantsSchema[] = {
|
|||
};
|
||||
static const SInfosTableSchema vgroupsSchema[] = {
|
||||
{.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "tables", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "status", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "status", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "onlines", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "v1_dnode", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "v1_status", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "v1_status", .bytes = 10, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "v2_dnode", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "v2_status", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "v2_status", .bytes = 10, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "v3_dnode", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "v3_status", .bytes = 10, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "v3_status", .bytes = 10, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "compacting", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "nfiles", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "file_size", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
|
@ -186,16 +186,16 @@ static const SInfosTableSchema vgroupsSchema[] = {
|
|||
|
||||
// TODO put into perf schema
|
||||
static const SInfosTableSchema topicSchema[] = {
|
||||
{.name = "topic_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "topic_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||
{.name = "sql", .bytes = 1024, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "sql", .bytes = 1024, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "row_len", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
};
|
||||
|
||||
static const SInfosTableSchema consumerSchema[] = {
|
||||
{.name = "client_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "group_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "client_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "group_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "pid", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "status", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
// ep
|
||||
|
@ -204,10 +204,10 @@ static const SInfosTableSchema consumerSchema[] = {
|
|||
};
|
||||
|
||||
static const SInfosTableSchema subscribeSchema[] = {
|
||||
{.name = "topic_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "group_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "topic_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "group_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||
{.name = "client_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY},
|
||||
{.name = "client_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
};
|
||||
|
||||
static const SInfosTableMeta infosMeta[] = {
|
||||
|
@ -303,7 +303,7 @@ int32_t mndBuildInsTableSchema(SMnode *pMnode, const char *dbFName, const char *
|
|||
}
|
||||
|
||||
int32_t mndInitInfos(SMnode *pMnode) {
|
||||
pMnode->infosMeta = taosHashInit(20, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK);
|
||||
pMnode->infosMeta = taosHashInit(20, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), false, HASH_NO_LOCK);
|
||||
if (pMnode->infosMeta == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
|
|
|
@ -35,7 +35,7 @@ static int32_t mndProcessDropMnodeReq(SNodeMsg *pReq);
|
|||
static int32_t mndProcessCreateMnodeRsp(SNodeMsg *pRsp);
|
||||
static int32_t mndProcessAlterMnodeRsp(SNodeMsg *pRsp);
|
||||
static int32_t mndProcessDropMnodeRsp(SNodeMsg *pRsp);
|
||||
static int32_t mndRetrieveMnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
||||
static int32_t mndRetrieveMnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows);
|
||||
static void mndCancelGetNextMnode(SMnode *pMnode, void *pIter);
|
||||
|
||||
int32_t mndInitMnode(SMnode *pMnode) {
|
||||
|
@ -615,7 +615,7 @@ static int32_t mndProcessDropMnodeRsp(SNodeMsg *pRsp) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t mndRetrieveMnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) {
|
||||
static int32_t mndRetrieveMnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
int32_t numOfRows = 0;
|
||||
|
@ -628,35 +628,33 @@ static int32_t mndRetrieveMnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, in
|
|||
if (pShow->pIter == NULL) break;
|
||||
|
||||
cols = 0;
|
||||
SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char*) &pObj->id, false);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int16_t *)pWrite = pObj->id;
|
||||
cols++;
|
||||
char b1[TSDB_EP_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(b1, pObj->pDnode->ep, pShow->bytes[cols]);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pObj->pDnode->ep, pShow->bytes[cols]);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, b1, false);
|
||||
|
||||
cols++;
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
const char *roles = mndGetRoleStr(pObj->role);
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, roles, pShow->bytes[cols]);
|
||||
cols++;
|
||||
char* b2 = taosMemoryCalloc(1, strlen(roles) + VARSTR_HEADER_SIZE);
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(b2, roles, pShow->bytes[cols]);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int64_t *)pWrite = pObj->roleTime;
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char*) b2, false);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int64_t *)pWrite = pObj->createdTime;
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)&pObj->roleTime, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)&pObj->createdTime, false);
|
||||
|
||||
numOfRows++;
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
|
||||
mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow);
|
||||
pShow->numOfReads += numOfRows;
|
||||
pShow->numOfRows += numOfRows;
|
||||
|
||||
return numOfRows;
|
||||
}
|
||||
|
|
|
@ -77,9 +77,9 @@ int32_t mndInitProfile(SMnode *pMnode) {
|
|||
mndSetMsgHandle(pMnode, TDMT_MND_KILL_QUERY, mndProcessKillQueryReq);
|
||||
mndSetMsgHandle(pMnode, TDMT_MND_KILL_CONN, mndProcessKillConnReq);
|
||||
|
||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_CONNS, mndRetrieveConns);
|
||||
// mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_CONNS, mndRetrieveConns);
|
||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_CONNS, mndCancelGetNextConn);
|
||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_QUERIES, mndRetrieveQueries);
|
||||
// mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_QUERIES, mndRetrieveQueries);
|
||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_QUERIES, mndCancelGetNextQuery);
|
||||
|
||||
return 0;
|
||||
|
@ -685,7 +685,7 @@ static int32_t mndRetrieveConns(SNodeMsg *pReq, SShowObj *pShow, char *data, int
|
|||
numOfRows++;
|
||||
}
|
||||
|
||||
pShow->numOfReads += numOfRows;
|
||||
pShow->numOfRows += numOfRows;
|
||||
|
||||
return numOfRows;
|
||||
}
|
||||
|
@ -903,8 +903,7 @@ static int32_t mndRetrieveQueries(SNodeMsg *pReq, SShowObj *pShow, char *data, i
|
|||
}
|
||||
}
|
||||
|
||||
mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow);
|
||||
pShow->numOfReads += numOfRows;
|
||||
pShow->numOfRows += numOfRows;
|
||||
return numOfRows;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ static int32_t mndProcessCreateQnodeRsp(SNodeMsg *pRsp);
|
|||
static int32_t mndProcessDropQnodeReq(SNodeMsg *pReq);
|
||||
static int32_t mndProcessDropQnodeRsp(SNodeMsg *pRsp);
|
||||
static int32_t mndProcessQnodeListReq(SNodeMsg *pReq);
|
||||
static int32_t mndRetrieveQnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
||||
static int32_t mndRetrieveQnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows);
|
||||
static void mndCancelGetNextQnode(SMnode *pMnode, void *pIter);
|
||||
|
||||
int32_t mndInitQnode(SMnode *pMnode) {
|
||||
|
@ -497,7 +497,7 @@ static int32_t mndProcessDropQnodeRsp(SNodeMsg *pRsp) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t mndRetrieveQnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) {
|
||||
static int32_t mndRetrieveQnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
int32_t numOfRows = 0;
|
||||
|
@ -510,26 +510,22 @@ static int32_t mndRetrieveQnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, in
|
|||
if (pShow->pIter == NULL) break;
|
||||
|
||||
cols = 0;
|
||||
SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char*)&pObj->id, false);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int16_t *)pWrite = pObj->id;
|
||||
cols++;
|
||||
char ep[TSDB_EP_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(ep, pObj->pDnode->ep, pShow->bytes[cols]);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)ep, false);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pObj->pDnode->ep, pShow->bytes[cols]);
|
||||
|
||||
cols++;
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int64_t *)pWrite = pObj->createdTime;
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)&pObj->createdTime, false);
|
||||
|
||||
numOfRows++;
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
|
||||
mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow);
|
||||
pShow->numOfReads += numOfRows;
|
||||
pShow->numOfRows += numOfRows;
|
||||
|
||||
return numOfRows;
|
||||
}
|
||||
|
|
|
@ -60,7 +60,6 @@ static SShowObj *mndCreateShowObj(SMnode *pMnode, SShowReq *pReq) {
|
|||
showObj.type = pReq->type;
|
||||
showObj.payloadLen = pReq->payloadLen;
|
||||
memcpy(showObj.db, pReq->db, TSDB_DB_FNAME_LEN);
|
||||
memcpy(showObj.payload, pReq->payload, pReq->payloadLen);
|
||||
|
||||
int32_t keepTime = tsShellActivityTimer * 6 * 1000;
|
||||
SShowObj *pShow = taosCachePut(pMgmt->cache, &showId, sizeof(int64_t), &showObj, size, keepTime);
|
||||
|
@ -113,95 +112,10 @@ static void mndReleaseShowObj(SShowObj *pShow, bool forceRemove) {
|
|||
taosCacheRelease(pMgmt->cache, (void **)(&pShow), forceRemove);
|
||||
}
|
||||
|
||||
static int32_t mndProcessRetrieveReq(SNodeMsg *pReq) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SShowMgmt *pMgmt = &pMnode->showMgmt;
|
||||
int32_t rowsToRead = 0;
|
||||
int32_t size = 0;
|
||||
int32_t rowsRead = 0;
|
||||
|
||||
SRetrieveTableReq retrieveReq = {0};
|
||||
if (tDeserializeSRetrieveTableReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &retrieveReq) != 0) {
|
||||
terrno = TSDB_CODE_INVALID_MSG;
|
||||
return -1;
|
||||
}
|
||||
|
||||
SShowObj *pShow = mndAcquireShowObj(pMnode, retrieveReq.showId);
|
||||
if (pShow == NULL) {
|
||||
terrno = TSDB_CODE_MND_INVALID_SHOWOBJ;
|
||||
mError("failed to process show-retrieve req:%p since %s", pShow, terrstr());
|
||||
return -1;
|
||||
}
|
||||
|
||||
ShowRetrieveFp retrieveFp = pMgmt->retrieveFps[pShow->type];
|
||||
if (retrieveFp == NULL) {
|
||||
mndReleaseShowObj(pShow, false);
|
||||
terrno = TSDB_CODE_MSG_NOT_PROCESSED;
|
||||
mError("show:0x%" PRIx64 ", failed to retrieve data since %s", pShow->id, terrstr());
|
||||
return -1;
|
||||
}
|
||||
|
||||
mDebug("show:0x%" PRIx64 ", start retrieve data, numOfReads:%d numOfRows:%d type:%s", pShow->id, pShow->numOfReads,
|
||||
pShow->numOfRows, mndShowStr(pShow->type));
|
||||
|
||||
if (mndCheckRetrieveFinished(pShow)) {
|
||||
mDebug("show:0x%" PRIx64 ", read finished, numOfReads:%d numOfRows:%d", pShow->id, pShow->numOfReads,
|
||||
pShow->numOfRows);
|
||||
pShow->numOfReads = pShow->numOfRows;
|
||||
}
|
||||
|
||||
if ((retrieveReq.free & TSDB_QUERY_TYPE_FREE_RESOURCE) != TSDB_QUERY_TYPE_FREE_RESOURCE) {
|
||||
rowsToRead = pShow->numOfRows - pShow->numOfReads;
|
||||
}
|
||||
|
||||
/* return no more than 100 tables in one round trip */
|
||||
if (rowsToRead > SHOW_STEP_SIZE) rowsToRead = SHOW_STEP_SIZE;
|
||||
|
||||
/*
|
||||
* the actual number of table may be larger than the value of pShow->numOfRows, if a query is
|
||||
* issued during a continuous create table operation. Therefore, rowToRead may be less than 0.
|
||||
*/
|
||||
if (rowsToRead < 0) rowsToRead = 0;
|
||||
size = pShow->rowSize * rowsToRead;
|
||||
|
||||
size += SHOW_STEP_SIZE;
|
||||
SRetrieveTableRsp *pRsp = rpcMallocCont(size);
|
||||
if (pRsp == NULL) {
|
||||
mndReleaseShowObj(pShow, false);
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
mError("show:0x%" PRIx64 ", failed to retrieve data since %s", pShow->id, terrstr());
|
||||
return -1;
|
||||
}
|
||||
|
||||
// if free flag is set, client wants to clean the resources
|
||||
if ((retrieveReq.free & TSDB_QUERY_TYPE_FREE_RESOURCE) != TSDB_QUERY_TYPE_FREE_RESOURCE) {
|
||||
rowsRead = (*retrieveFp)(pReq, pShow, pRsp->data, rowsToRead);
|
||||
}
|
||||
|
||||
mDebug("show:0x%" PRIx64 ", stop retrieve data, rowsRead:%d rowsToRead:%d", pShow->id, rowsRead, rowsToRead);
|
||||
|
||||
pRsp->numOfRows = htonl(rowsRead);
|
||||
pRsp->precision = TSDB_TIME_PRECISION_MILLI; // millisecond time precision
|
||||
|
||||
pReq->pRsp = pRsp;
|
||||
pReq->rspLen = size;
|
||||
|
||||
if (rowsRead == 0 || rowsToRead == 0 || (rowsRead == rowsToRead && pShow->numOfRows == pShow->numOfReads)) {
|
||||
pRsp->completed = 1;
|
||||
mDebug("show:0x%" PRIx64 ", retrieve completed", pShow->id);
|
||||
mndReleaseShowObj(pShow, true);
|
||||
} else {
|
||||
mDebug("show:0x%" PRIx64 ", retrieve not completed yet", pShow->id);
|
||||
mndReleaseShowObj(pShow, false);
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t mndProcessRetrieveSysTableReq(SNodeMsg *pReq) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SShowMgmt *pMgmt = &pMnode->showMgmt;
|
||||
int32_t rowsToRead = 0;
|
||||
int32_t rowsToRead = SHOW_STEP_SIZE;
|
||||
int32_t size = 0;
|
||||
int32_t rowsRead = 0;
|
||||
|
||||
|
@ -225,15 +139,14 @@ static int32_t mndProcessRetrieveSysTableReq(SNodeMsg *pReq) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
STableMetaRsp *meta = (STableMetaRsp *)taosHashGet(pMnode->infosMeta, retrieveReq.tb, strlen(retrieveReq.tb));
|
||||
pShow->numOfRows = 100;
|
||||
|
||||
pShow->pMeta = (STableMetaRsp *)taosHashGet(pMnode->infosMeta, retrieveReq.tb, strlen(retrieveReq.tb));
|
||||
pShow->numOfColumns = pShow->pMeta->numOfColumns;
|
||||
int32_t offset = 0;
|
||||
for(int32_t i = 0; i < meta->numOfColumns; ++i) {
|
||||
pShow->numOfColumns = meta->numOfColumns;
|
||||
|
||||
for(int32_t i = 0; i < pShow->pMeta->numOfColumns; ++i) {
|
||||
pShow->offset[i] = offset;
|
||||
|
||||
int32_t bytes = meta->pSchemas[i].bytes;
|
||||
int32_t bytes = pShow->pMeta->pSchemas[i].bytes;
|
||||
pShow->rowSize += bytes;
|
||||
pShow->bytes[i] = bytes;
|
||||
offset += bytes;
|
||||
|
@ -245,8 +158,6 @@ static int32_t mndProcessRetrieveSysTableReq(SNodeMsg *pReq) {
|
|||
mError("failed to process show-retrieve req:%p since %s", pShow, terrstr());
|
||||
return -1;
|
||||
}
|
||||
|
||||
pShow->numOfReads = 0;
|
||||
}
|
||||
|
||||
ShowRetrieveFp retrieveFp = pMgmt->retrieveFps[pShow->type];
|
||||
|
@ -257,61 +168,87 @@ static int32_t mndProcessRetrieveSysTableReq(SNodeMsg *pReq) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
mDebug("show:0x%" PRIx64 ", start retrieve data, numOfReads:%d numOfRows:%d type:%s", pShow->id, pShow->numOfReads,
|
||||
pShow->numOfRows, mndShowStr(pShow->type));
|
||||
mDebug("show:0x%" PRIx64 ", start retrieve data, type:%s", pShow->id, mndShowStr(pShow->type));
|
||||
|
||||
int32_t numOfCols = pShow->pMeta->numOfColumns;
|
||||
|
||||
SSDataBlock* pBlock = taosMemoryCalloc(1, sizeof(SSDataBlock));
|
||||
pBlock->pDataBlock = taosArrayInit(numOfCols, sizeof(SColumnInfoData));
|
||||
pBlock->info.numOfCols = numOfCols;
|
||||
|
||||
for(int32_t i = 0; i < numOfCols; ++i) {
|
||||
SColumnInfoData idata = {0};
|
||||
SSchema* p = &pShow->pMeta->pSchemas[i];
|
||||
|
||||
idata.info.bytes = p->bytes;
|
||||
idata.info.type = p->type;
|
||||
idata.info.colId = p->colId;
|
||||
|
||||
taosArrayPush(pBlock->pDataBlock, &idata);
|
||||
if (IS_VAR_DATA_TYPE(p->type)) {
|
||||
pBlock->info.hasVarCol = true;
|
||||
}
|
||||
}
|
||||
|
||||
blockDataEnsureCapacity(pBlock, rowsToRead);
|
||||
if (mndCheckRetrieveFinished((SShowObj*) pShow)) {
|
||||
mDebug("show:0x%" PRIx64 ", read finished, numOfReads:%d numOfRows:%d", pShow->id, pShow->numOfReads,
|
||||
pShow->numOfRows);
|
||||
pShow->numOfReads = pShow->numOfRows;
|
||||
mDebug("show:0x%" PRIx64 ", read finished, numOfRows:%d", pShow->id, pShow->numOfRows);
|
||||
rowsRead = 0;
|
||||
} else {
|
||||
rowsRead = (*retrieveFp)(pReq, (SShowObj *)pShow, pBlock, rowsToRead);
|
||||
if (rowsRead < 0) {
|
||||
terrno = rowsRead;
|
||||
mDebug("show:0x%" PRIx64 ", retrieve completed", pShow->id);
|
||||
mndReleaseShowObj((SShowObj *)pShow, true);
|
||||
return -1;
|
||||
}
|
||||
|
||||
pBlock->info.rows = rowsRead;
|
||||
mDebug("show:0x%" PRIx64 ", stop retrieve data, rowsRead:%d numOfRows:%d", pShow->id, rowsRead, pShow->numOfRows);
|
||||
}
|
||||
|
||||
if ((retrieveReq.free & TSDB_QUERY_TYPE_FREE_RESOURCE) != TSDB_QUERY_TYPE_FREE_RESOURCE) {
|
||||
rowsToRead = pShow->numOfRows - pShow->numOfReads;
|
||||
}
|
||||
// numOfCols + sizeof(SSysTableSchema) * numOfCols + data payload
|
||||
size = sizeof(SRetrieveMetaTableRsp) + sizeof(int32_t) + sizeof(SSysTableSchema) * pShow->pMeta->numOfColumns + blockDataGetSize(pBlock)
|
||||
+ blockDataGetSerialMetaSize(pBlock);
|
||||
|
||||
/* return no more than 100 tables in one round trip */
|
||||
if (rowsToRead > SHOW_STEP_SIZE) rowsToRead = SHOW_STEP_SIZE;
|
||||
|
||||
/*
|
||||
* the actual number of table may be larger than the value of pShow->numOfRows, if a query is
|
||||
* issued during a continuous create table operation. Therefore, rowToRead may be less than 0.
|
||||
*/
|
||||
if (rowsToRead < 0) rowsToRead = 0;
|
||||
size = pShow->rowSize * rowsToRead;
|
||||
|
||||
size += SHOW_STEP_SIZE;
|
||||
SRetrieveMetaTableRsp *pRsp = rpcMallocCont(size);
|
||||
if (pRsp == NULL) {
|
||||
mndReleaseShowObj((SShowObj*) pShow, false);
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
mError("show:0x%" PRIx64 ", failed to retrieve data since %s", pShow->id, terrstr());
|
||||
blockDataDestroy(pBlock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
pRsp->handle = htobe64(pShow->id);
|
||||
|
||||
// if free flag is set, client wants to clean the resources
|
||||
if ((retrieveReq.free & TSDB_QUERY_TYPE_FREE_RESOURCE) != TSDB_QUERY_TYPE_FREE_RESOURCE) {
|
||||
rowsRead = (*retrieveFp)(pReq, (SShowObj*) pShow, pRsp->data, rowsToRead);
|
||||
if (rowsRead < 0) {
|
||||
terrno = rowsRead;
|
||||
rpcFreeCont(pRsp);
|
||||
mDebug("show:0x%" PRIx64 ", retrieve completed", pShow->id);
|
||||
mndReleaseShowObj((SShowObj*) pShow, true);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (rowsRead > 0) {
|
||||
char * pStart = pRsp->data;
|
||||
SSchema *ps = pShow->pMeta->pSchemas;
|
||||
|
||||
mDebug("show:0x%" PRIx64 ", stop retrieve data, rowsRead:%d rowsToRead:%d", pShow->id, rowsRead, rowsToRead);
|
||||
*(int32_t *)pStart = htonl(pShow->pMeta->numOfColumns);
|
||||
pStart += sizeof(int32_t); // number of columns
|
||||
|
||||
for (int32_t i = 0; i < pShow->pMeta->numOfColumns; ++i) {
|
||||
SSysTableSchema *pSchema = (SSysTableSchema *)pStart;
|
||||
pSchema->bytes = htonl(ps[i].bytes);
|
||||
pSchema->colId = htons(ps[i].colId);
|
||||
pSchema->type = ps[i].type;
|
||||
|
||||
pStart += sizeof(SSysTableSchema);
|
||||
}
|
||||
|
||||
int32_t len = 0;
|
||||
blockCompressEncode(pBlock, pStart, &len, pShow->pMeta->numOfColumns, false);
|
||||
}
|
||||
|
||||
pRsp->numOfRows = htonl(rowsRead);
|
||||
pRsp->precision = TSDB_TIME_PRECISION_MILLI; // millisecond time precision
|
||||
pReq->pRsp = pRsp;
|
||||
pReq->rspLen = size;
|
||||
|
||||
pReq->pRsp = pRsp;
|
||||
pReq->rspLen = size;
|
||||
|
||||
if (rowsRead == 0 || rowsToRead == 0 || (rowsRead < rowsToRead)) {
|
||||
if (rowsRead == 0 || rowsRead < rowsToRead) {
|
||||
pRsp->completed = 1;
|
||||
mDebug("show:0x%" PRIx64 ", retrieve completed", pShow->id);
|
||||
mndReleaseShowObj((SShowObj*) pShow, true);
|
||||
|
@ -320,6 +257,7 @@ static int32_t mndProcessRetrieveSysTableReq(SNodeMsg *pReq) {
|
|||
mndReleaseShowObj((SShowObj*) pShow, false);
|
||||
}
|
||||
|
||||
blockDataDestroy(pBlock);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -379,7 +317,7 @@ char *mndShowStr(int32_t showType) {
|
|||
}
|
||||
|
||||
static bool mndCheckRetrieveFinished(SShowObj *pShow) {
|
||||
if (pShow->pIter == NULL && pShow->numOfReads != 0) {
|
||||
if (pShow->pIter == NULL && pShow->numOfRows != 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -40,8 +40,7 @@ static int32_t mndProcessMCreateSmaReq(SNodeMsg *pReq);
|
|||
static int32_t mndProcessMDropSmaReq(SNodeMsg *pReq);
|
||||
static int32_t mndProcessVCreateSmaRsp(SNodeMsg *pRsp);
|
||||
static int32_t mndProcessVDropSmaRsp(SNodeMsg *pRsp);
|
||||
static int32_t mndGetSmaMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta);
|
||||
static int32_t mndRetrieveSma(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
||||
static int32_t mndRetrieveSma(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows);
|
||||
static void mndCancelGetNextSma(SMnode *pMnode, void *pIter);
|
||||
|
||||
int32_t mndInitSma(SMnode *pMnode) {
|
||||
|
@ -765,14 +764,12 @@ static int32_t mndGetSmaMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMe
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t mndRetrieveSma(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) {
|
||||
static int32_t mndRetrieveSma(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
int32_t numOfRows = 0;
|
||||
SSmaObj *pSma = NULL;
|
||||
int32_t cols = 0;
|
||||
char *pWrite;
|
||||
char prefix[TSDB_DB_FNAME_LEN] = {0};
|
||||
|
||||
SDbObj *pDb = mndAcquireDb(pMnode, pShow->db);
|
||||
if (pDb == NULL) return 0;
|
||||
|
@ -790,27 +787,32 @@ static int32_t mndRetrieveSma(SNodeMsg *pReq, SShowObj *pShow, char *data, int32
|
|||
|
||||
SName smaName = {0};
|
||||
tNameFromString(&smaName, pSma->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
STR_TO_VARSTR(pWrite, (char *)tNameGetTableName(&smaName));
|
||||
cols++;
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int64_t *)pWrite = pSma->createdTime;
|
||||
char n[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_TO_VARSTR(n, (char *)tNameGetTableName(&smaName));
|
||||
cols++;
|
||||
|
||||
SName stbName = {0};
|
||||
tNameFromString(&stbName, pSma->stb, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
STR_TO_VARSTR(pWrite, (char *)tNameGetTableName(&stbName));
|
||||
cols++;
|
||||
|
||||
char n1[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_TO_VARSTR(n1, (char *)tNameGetTableName(&stbName));
|
||||
|
||||
SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char*) n, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)&pSma->createdTime, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)n1, false);
|
||||
|
||||
numOfRows++;
|
||||
sdbRelease(pSdb, pSma);
|
||||
}
|
||||
|
||||
mndReleaseDb(pMnode, pDb);
|
||||
pShow->numOfReads += numOfRows;
|
||||
mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow);
|
||||
pShow->numOfRows += numOfRows;
|
||||
return numOfRows;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ static int32_t mndProcessCreateSnodeReq(SNodeMsg *pReq);
|
|||
static int32_t mndProcessCreateSnodeRsp(SNodeMsg *pRsp);
|
||||
static int32_t mndProcessDropSnodeReq(SNodeMsg *pReq);
|
||||
static int32_t mndProcessDropSnodeRsp(SNodeMsg *pRsp);
|
||||
static int32_t mndRetrieveSnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
||||
static int32_t mndRetrieveSnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows);
|
||||
static void mndCancelGetNextSnode(SMnode *pMnode, void *pIter);
|
||||
|
||||
int32_t mndInitSnode(SMnode *pMnode) {
|
||||
|
@ -447,39 +447,35 @@ static int32_t mndProcessDropSnodeRsp(SNodeMsg *pRsp) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t mndRetrieveSnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) {
|
||||
static int32_t mndRetrieveSnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
int32_t numOfRows = 0;
|
||||
int32_t cols = 0;
|
||||
SSnodeObj *pObj = NULL;
|
||||
char *pWrite;
|
||||
|
||||
while (numOfRows < rows) {
|
||||
pShow->pIter = sdbFetch(pSdb, SDB_SNODE, pShow->pIter, (void **)&pObj);
|
||||
if (pShow->pIter == NULL) break;
|
||||
|
||||
cols = 0;
|
||||
SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char*)&pObj->id, false);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int16_t *)pWrite = pObj->id;
|
||||
cols++;
|
||||
char ep[TSDB_EP_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(ep, pObj->pDnode->ep, pShow->bytes[cols]);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pObj->pDnode->ep, pShow->bytes[cols]);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)ep, false);
|
||||
|
||||
cols++;
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int64_t *)pWrite = pObj->createdTime;
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)&pObj->createdTime, false);
|
||||
|
||||
numOfRows++;
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
|
||||
mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow);
|
||||
pShow->numOfReads += numOfRows;
|
||||
pShow->numOfRows += numOfRows;
|
||||
|
||||
return numOfRows;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ static int32_t mndProcessVCreateStbRsp(SNodeMsg *pRsp);
|
|||
static int32_t mndProcessVAlterStbRsp(SNodeMsg *pRsp);
|
||||
static int32_t mndProcessVDropStbRsp(SNodeMsg *pRsp);
|
||||
static int32_t mndProcessTableMetaReq(SNodeMsg *pReq);
|
||||
static int32_t mndRetrieveStb(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
||||
static int32_t mndRetrieveStb(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows);
|
||||
static void mndCancelGetNextStb(SMnode *pMnode, void *pIter);
|
||||
|
||||
int32_t mndInitStb(SMnode *pMnode) {
|
||||
|
@ -1638,13 +1638,12 @@ static void mndExtractTableName(char *tableId, char *name) {
|
|||
}
|
||||
}
|
||||
|
||||
static int32_t mndRetrieveStb(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) {
|
||||
static int32_t mndRetrieveStb(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
int32_t numOfRows = 0;
|
||||
SStbObj *pStb = NULL;
|
||||
int32_t cols = 0;
|
||||
char *pWrite;
|
||||
|
||||
SDbObj* pDb = NULL;
|
||||
if (strlen(pShow->db) > 0) {
|
||||
|
@ -1664,42 +1663,45 @@ static int32_t mndRetrieveStb(SNodeMsg *pReq, SShowObj *pShow, char *data, int32
|
|||
cols = 0;
|
||||
|
||||
SName name = {0};
|
||||
char stbName[TSDB_TABLE_NAME_LEN] = {0};
|
||||
mndExtractTableName(pStb->name, stbName);
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
STR_TO_VARSTR(pWrite, stbName);
|
||||
cols++;
|
||||
char stbName[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
mndExtractTableName(pStb->name, &stbName[VARSTR_HEADER_SIZE]);
|
||||
varDataSetLen(stbName, strlen(&stbName[VARSTR_HEADER_SIZE]));
|
||||
|
||||
char db[TSDB_DB_NAME_LEN] = {0};
|
||||
SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char*) stbName, false);
|
||||
|
||||
char db[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
tNameFromString(&name, pStb->db, T_NAME_ACCT|T_NAME_DB);
|
||||
tNameGetDbName(&name, db);
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
STR_TO_VARSTR(pWrite, db);
|
||||
cols++;
|
||||
tNameGetDbName(&name, varDataVal(db));
|
||||
varDataSetLen(db, strlen(varDataVal(db)));
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int64_t *)pWrite = pStb->createdTime;
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char*) db, false);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int32_t *)pWrite = pStb->numOfColumns;
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)&pStb->createdTime, false);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int32_t *)pWrite = pStb->numOfTags;
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)&pStb->numOfColumns, false);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int64_t *)pWrite = pStb->updateTime; // number of tables
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)&pStb->numOfTags, false);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
if (pStb->commentLen != 0) {
|
||||
STR_TO_VARSTR(pWrite, pStb->comment);
|
||||
} else {
|
||||
STR_TO_VARSTR(pWrite, "");
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)&pStb->updateTime, false); // number of tables
|
||||
|
||||
char* p = taosMemoryMalloc(pStb->commentLen + VARSTR_HEADER_SIZE); // check malloc failures
|
||||
if (p != NULL) {
|
||||
if (pStb->commentLen != 0) {
|
||||
STR_TO_VARSTR(p, pStb->comment);
|
||||
} else {
|
||||
STR_TO_VARSTR(p, "");
|
||||
}
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols);
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)p, false);
|
||||
taosMemoryFree(p);
|
||||
}
|
||||
cols++;
|
||||
|
||||
numOfRows++;
|
||||
sdbRelease(pSdb, pStb);
|
||||
|
@ -1709,8 +1711,7 @@ static int32_t mndRetrieveStb(SNodeMsg *pReq, SShowObj *pShow, char *data, int32
|
|||
mndReleaseDb(pMnode, pDb);
|
||||
}
|
||||
|
||||
pShow->numOfReads += numOfRows;
|
||||
mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow);
|
||||
pShow->numOfRows += numOfRows;
|
||||
return numOfRows;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ int32_t mndInitStream(SMnode *pMnode) {
|
|||
/*mndSetMsgHandle(pMnode, TDMT_MND_DROP_STREAM, mndProcessDropStreamReq);*/
|
||||
/*mndSetMsgHandle(pMnode, TDMT_MND_DROP_STREAM_RSP, mndProcessDropStreamInRsp);*/
|
||||
|
||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_TP, mndRetrieveStream);
|
||||
// mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_TP, mndRetrieveStream);
|
||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_TP, mndCancelGetNextStream);
|
||||
|
||||
return sdbSetTable(pMnode->pSdb, table);
|
||||
|
@ -515,8 +515,7 @@ static int32_t mndRetrieveStream(SNodeMsg *pReq, SShowObj *pShow, char *data, in
|
|||
}
|
||||
|
||||
mndReleaseDb(pMnode, pDb);
|
||||
pShow->numOfReads += numOfRows;
|
||||
mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow);
|
||||
pShow->numOfRows += numOfRows;
|
||||
return numOfRows;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@ static int32_t mndTopicActionUpdate(SSdb *pSdb, SMqTopicObj *pTopic, SMqTopicObj
|
|||
static int32_t mndProcessCreateTopicReq(SNodeMsg *pReq);
|
||||
static int32_t mndProcessDropTopicReq(SNodeMsg *pReq);
|
||||
static int32_t mndProcessDropTopicInRsp(SNodeMsg *pRsp);
|
||||
static int32_t mndProcessTopicMetaReq(SNodeMsg *pReq);
|
||||
static int32_t mndGetTopicMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta);
|
||||
static int32_t mndRetrieveTopic(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
||||
static void mndCancelGetNextTopic(SMnode *pMnode, void *pIter);
|
||||
|
@ -53,7 +52,7 @@ int32_t mndInitTopic(SMnode *pMnode) {
|
|||
mndSetMsgHandle(pMnode, TDMT_MND_DROP_TOPIC, mndProcessDropTopicReq);
|
||||
mndSetMsgHandle(pMnode, TDMT_VND_DROP_TOPIC_RSP, mndProcessDropTopicInRsp);
|
||||
|
||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_TP, mndRetrieveTopic);
|
||||
// mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_TP, mndRetrieveTopic);
|
||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_TP, mndCancelGetNextTopic);
|
||||
|
||||
return sdbSetTable(pMnode->pSdb, table);
|
||||
|
@ -595,8 +594,7 @@ static int32_t mndRetrieveTopic(SNodeMsg *pReq, SShowObj *pShow, char *data, int
|
|||
}
|
||||
|
||||
mndReleaseDb(pMnode, pDb);
|
||||
pShow->numOfReads += numOfRows;
|
||||
mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow);
|
||||
pShow->numOfRows += numOfRows;
|
||||
return numOfRows;
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ int32_t mndInitTrans(SMnode *pMnode) {
|
|||
mndSetMsgHandle(pMnode, TDMT_MND_TRANS_TIMER, mndProcessTransReq);
|
||||
mndSetMsgHandle(pMnode, TDMT_MND_KILL_TRANS, mndProcessKillTransReq);
|
||||
|
||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_TRANS, mndRetrieveTrans);
|
||||
// mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_TRANS, mndRetrieveTrans);
|
||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_TRANS, mndCancelGetNextTrans);
|
||||
return sdbSetTable(pMnode->pSdb, table);
|
||||
}
|
||||
|
@ -1370,8 +1370,7 @@ static int32_t mndRetrieveTrans(SNodeMsg *pReq, SShowObj *pShow, char *data, int
|
|||
sdbRelease(pSdb, pTrans);
|
||||
}
|
||||
|
||||
mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow);
|
||||
pShow->numOfReads += numOfRows;
|
||||
pShow->numOfRows += numOfRows;
|
||||
return numOfRows;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,8 +35,7 @@ static int32_t mndProcessCreateUserReq(SNodeMsg *pReq);
|
|||
static int32_t mndProcessAlterUserReq(SNodeMsg *pReq);
|
||||
static int32_t mndProcessDropUserReq(SNodeMsg *pReq);
|
||||
static int32_t mndProcessGetUserAuthReq(SNodeMsg *pReq);
|
||||
static int32_t mndGetUserMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta);
|
||||
static int32_t mndRetrieveUsers(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
||||
static int32_t mndRetrieveUsers(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows);
|
||||
static void mndCancelGetNextUser(SMnode *pMnode, void *pIter);
|
||||
|
||||
int32_t mndInitUser(SMnode *pMnode) {
|
||||
|
@ -640,55 +639,7 @@ GET_AUTH_OVER:
|
|||
return code;
|
||||
}
|
||||
|
||||
static int32_t mndGetUserMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
|
||||
int32_t cols = 0;
|
||||
SSchema *pSchema = pMeta->pSchemas;
|
||||
|
||||
pShow->bytes[cols] = TSDB_USER_LEN + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "name");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 10 + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "privilege");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 8;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_TIMESTAMP;
|
||||
strcpy(pSchema[cols].name, "create_time");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = TSDB_USER_LEN + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "account");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pMeta->numOfColumns = cols;
|
||||
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_USER);
|
||||
pShow->rowSize = pShow->offset[cols - 1] + pShow->bytes[cols - 1];
|
||||
strcpy(pMeta->tbName, mndShowStr(pShow->type));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t mndRetrieveUsers(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) {
|
||||
printf("%s(%d) %s rows=%d\n", __FILE__, __LINE__,__func__,rows);
|
||||
printf("%s(%d) %s pShow->numOfReads=%d\n", __FILE__, __LINE__,__func__,pShow->numOfReads);
|
||||
static int32_t mndRetrieveUsers(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
int32_t numOfRows = 0;
|
||||
|
@ -702,39 +653,32 @@ static int32_t mndRetrieveUsers(SNodeMsg *pReq, SShowObj *pShow, char *data, int
|
|||
|
||||
cols = 0;
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
printf("%s(%d) %s pWrite=%p\n", __FILE__, __LINE__,__func__,pWrite);
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pUser->user, pShow->bytes[cols]);
|
||||
cols++;
|
||||
SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
printf("%s(%d) %s pWrite=%p\n", __FILE__, __LINE__,__func__,pWrite);
|
||||
if (pUser->superUser) {
|
||||
const char *src = "super";
|
||||
STR_WITH_SIZE_TO_VARSTR(pWrite, src, strlen(src));
|
||||
} else {
|
||||
const char *src = "normal";
|
||||
STR_WITH_SIZE_TO_VARSTR(pWrite, src, strlen(src));
|
||||
}
|
||||
cols++;
|
||||
char name[TSDB_USER_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(name, pUser->user, pShow->bytes[cols]);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
printf("%s(%d) %s pWrite=%p\n", __FILE__, __LINE__,__func__,pWrite);
|
||||
*(int64_t *)pWrite = pUser->createdTime;
|
||||
cols++;
|
||||
colDataAppend(pColInfo, numOfRows, (const char*) name, false);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
printf("%s(%d) %s pWrite=%p\n", __FILE__, __LINE__,__func__,pWrite);
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pUser->acct, pShow->bytes[cols]);
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
|
||||
const char* src = pUser->superUser? "super":"normal";
|
||||
char b[10+VARSTR_HEADER_SIZE] = {0};
|
||||
STR_WITH_SIZE_TO_VARSTR(b, src, strlen(src));
|
||||
colDataAppend(pColInfo, numOfRows, (const char*) b, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char*) &pUser->createdTime, false);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols);
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(name, pUser->acct, pShow->bytes[cols]);
|
||||
colDataAppend(pColInfo, numOfRows, (const char*) name, false);
|
||||
|
||||
numOfRows++;
|
||||
sdbRelease(pSdb, pUser);
|
||||
}
|
||||
|
||||
mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow);
|
||||
pShow->numOfReads += numOfRows;
|
||||
printf("%s(%d) %s numOfRows=%d\n", __FILE__, __LINE__,__func__,numOfRows);
|
||||
pShow->numOfRows += numOfRows;
|
||||
return numOfRows;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,10 +35,9 @@ static int32_t mndProcessDropVnodeRsp(SNodeMsg *pRsp);
|
|||
static int32_t mndProcessSyncVnodeRsp(SNodeMsg *pRsp);
|
||||
static int32_t mndProcessCompactVnodeRsp(SNodeMsg *pRsp);
|
||||
|
||||
static int32_t mndGetVgroupMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta);
|
||||
static int32_t mndRetrieveVgroups(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
||||
static int32_t mndRetrieveVgroups(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows);
|
||||
static void mndCancelGetNextVgroup(SMnode *pMnode, void *pIter);
|
||||
static int32_t mndRetrieveVnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
||||
static int32_t mndRetrieveVnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows);
|
||||
static void mndCancelGetNextVnode(SMnode *pMnode, void *pIter);
|
||||
|
||||
int32_t mndInitVgroup(SMnode *pMnode) {
|
||||
|
@ -499,64 +498,12 @@ static int32_t mndGetVgroupMaxReplica(SMnode *pMnode, char *dbName, int8_t *pRep
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t mndGetVgroupMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
|
||||
if (mndGetVgroupMaxReplica(pMnode, pShow->db, &pShow->replica, &pShow->numOfRows) != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t cols = 0;
|
||||
SSchema *pSchema = pMeta->pSchemas;
|
||||
|
||||
pShow->bytes[cols] = 4;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_INT;
|
||||
strcpy(pSchema[cols].name, "vgId");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 4;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_INT;
|
||||
strcpy(pSchema[cols].name, "tables");
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
for (int32_t i = 0; i < pShow->replica; ++i) {
|
||||
pShow->bytes[cols] = 2;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_SMALLINT;
|
||||
snprintf(pSchema[cols].name, TSDB_COL_NAME_LEN, "v%d_dnode", i + 1);
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 9 + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
snprintf(pSchema[cols].name, TSDB_COL_NAME_LEN, "v%d_status", i + 1);
|
||||
pSchema[cols].bytes = pShow->bytes[cols];
|
||||
cols++;
|
||||
}
|
||||
|
||||
pMeta->numOfColumns = cols;
|
||||
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->rowSize = pShow->offset[cols - 1] + pShow->bytes[cols - 1];
|
||||
strcpy(pMeta->tbName, mndShowStr(pShow->type));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t mndRetrieveVgroups(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) {
|
||||
static int32_t mndRetrieveVgroups(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
int32_t numOfRows = 0;
|
||||
SVgObj *pVgroup = NULL;
|
||||
int32_t cols = 0;
|
||||
char *pWrite;
|
||||
|
||||
SDbObj *pDb = NULL;
|
||||
if (strlen(pShow->db) > 0) {
|
||||
|
@ -575,46 +522,61 @@ static int32_t mndRetrieveVgroups(SNodeMsg *pReq, SShowObj *pShow, char *data, i
|
|||
}
|
||||
|
||||
cols = 0;
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int32_t *)pWrite = pVgroup->vgId;
|
||||
cols++;
|
||||
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)&pVgroup->vgId, false);
|
||||
|
||||
SName name = {0};
|
||||
char db[TSDB_DB_NAME_LEN] = {0};
|
||||
tNameFromString(&name, pVgroup->dbName, T_NAME_ACCT|T_NAME_DB);
|
||||
tNameGetDbName(&name, db);
|
||||
char db[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
tNameFromString(&name, pVgroup->dbName, T_NAME_ACCT | T_NAME_DB);
|
||||
tNameGetDbName(&name, varDataVal(db));
|
||||
varDataSetLen(db, strlen(varDataVal(db)));
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
STR_TO_VARSTR(pWrite, db);
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)db, false);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int32_t *)pWrite = pVgroup->numOfTables;
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)&pVgroup->numOfTables, false);
|
||||
|
||||
//status
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
STR_TO_VARSTR(pWrite, "ready"); // TODO
|
||||
cols++;
|
||||
// status
|
||||
char buf[10] = {0};
|
||||
STR_TO_VARSTR(buf, "ready"); // TODO
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, buf, false);
|
||||
|
||||
//onlines
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int32_t *)pWrite = pVgroup->replica;
|
||||
cols++;
|
||||
// onlines
|
||||
int32_t onlines = pVgroup->replica;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)&onlines, false);
|
||||
|
||||
// default 3 replica
|
||||
for (int32_t i = 0; i < 3; ++i) {
|
||||
|
||||
for (int32_t i = 0; i < pVgroup->replica; ++i) {
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int16_t *)pWrite = pVgroup->vnodeGid[i].dnodeId;
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
if (i < pVgroup->replica) {
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)&pVgroup->vnodeGid[i].dnodeId, false);
|
||||
|
||||
const char *role = mndGetRoleStr(pVgroup->vnodeGid[i].role);
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, role, pShow->bytes[cols]);
|
||||
cols++;
|
||||
char buf1[20] = {0};
|
||||
const char *role = mndGetRoleStr(pVgroup->vnodeGid[i].role);
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(buf1, role, pShow->bytes[cols]);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)buf1, false);
|
||||
} else {
|
||||
colDataAppendNULL(pColInfo, numOfRows);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppendNULL(pColInfo, numOfRows);
|
||||
}
|
||||
}
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppendNULL(pColInfo, numOfRows);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppendNULL(pColInfo, numOfRows);
|
||||
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols);
|
||||
colDataAppendNULL(pColInfo, numOfRows);
|
||||
|
||||
numOfRows++;
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
}
|
||||
|
@ -623,8 +585,7 @@ static int32_t mndRetrieveVgroups(SNodeMsg *pReq, SShowObj *pShow, char *data, i
|
|||
mndReleaseDb(pMnode, pDb);
|
||||
}
|
||||
|
||||
mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow);
|
||||
pShow->numOfReads += numOfRows;
|
||||
pShow->numOfRows += numOfRows;
|
||||
return numOfRows;
|
||||
}
|
||||
|
||||
|
@ -653,12 +614,11 @@ int32_t mndGetVnodesNum(SMnode *pMnode, int32_t dnodeId) {
|
|||
return numOfVnodes;
|
||||
}
|
||||
|
||||
static int32_t mndRetrieveVnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) {
|
||||
static int32_t mndRetrieveVnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlock, int32_t rows) {
|
||||
SMnode *pMnode = pReq->pNode;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
int32_t numOfRows = 0;
|
||||
SVgObj *pVgroup = NULL;
|
||||
char *pWrite;
|
||||
int32_t cols = 0;
|
||||
// int32_t dnodeId = pShow->replica;
|
||||
|
||||
|
@ -670,30 +630,29 @@ static int32_t mndRetrieveVnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, in
|
|||
SVnodeGid *pVgid = &pVgroup->vnodeGid[i];
|
||||
cols = 0;
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(uint32_t *)pWrite = pVgroup->vgId;
|
||||
cols++;
|
||||
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)&pVgroup->vgId, false);
|
||||
|
||||
SName name = {0};
|
||||
char db[TSDB_DB_NAME_LEN] = {0};
|
||||
tNameFromString(&name, pVgroup->dbName, T_NAME_ACCT|T_NAME_DB);
|
||||
tNameGetDbName(&name, db);
|
||||
char db[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
tNameFromString(&name, pVgroup->dbName, T_NAME_ACCT | T_NAME_DB);
|
||||
tNameGetDbName(&name, varDataVal(db));
|
||||
varDataSetLen(db, strlen(varDataVal(db)));
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
STR_TO_VARSTR(pWrite, db);
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)db, false);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(uint32_t *)pWrite = 0; //todo: Tables
|
||||
cols++;
|
||||
uint32_t val = 0;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)&val, false);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
STR_TO_VARSTR(pWrite, mndGetRoleStr(pVgid->role));
|
||||
cols++;
|
||||
char buf[20] = {0};
|
||||
STR_TO_VARSTR(buf, mndGetRoleStr(pVgid->role));
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)buf, false);
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(uint32_t *)pWrite = pVgroup->replica; //onlines
|
||||
cols++;
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)&pVgroup->replica, false); // onlines
|
||||
|
||||
numOfRows++;
|
||||
}
|
||||
|
@ -701,8 +660,7 @@ static int32_t mndRetrieveVnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, in
|
|||
sdbRelease(pSdb, pVgroup);
|
||||
}
|
||||
|
||||
mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow);
|
||||
pShow->numOfReads += numOfRows;
|
||||
pShow->numOfRows += numOfRows;
|
||||
return numOfRows;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,10 +73,6 @@ int32_t qndProcessFetchMsg(SQnode *pQnode, SRpcMsg *pMsg) {
|
|||
return qWorkerProcessCancelMsg(pQnode, pQnode->pQuery, pMsg);
|
||||
case TDMT_VND_DROP_TASK:
|
||||
return qWorkerProcessDropMsg(pQnode, pQnode->pQuery, pMsg);
|
||||
case TDMT_VND_SHOW_TABLES:
|
||||
return qWorkerProcessShowMsg(pQnode, pQnode->pQuery, pMsg);
|
||||
case TDMT_VND_SHOW_TABLES_FETCH:
|
||||
// return vnodeGetTableList(pQnode, pMsg);
|
||||
case TDMT_VND_TABLE_META:
|
||||
// return vnodeGetTableMeta(pQnode, pMsg);
|
||||
case TDMT_VND_CONSUME:
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
#include "vnodeInt.h"
|
||||
|
||||
static int32_t vnodeGetTableList(SVnode *pVnode, SRpcMsg *pMsg);
|
||||
static int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg);
|
||||
|
||||
int vnodeQueryOpen(SVnode *pVnode) {
|
||||
|
@ -56,11 +55,6 @@ int vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) {
|
|||
return qWorkerProcessCancelMsg(pVnode, pVnode->pQuery, pMsg);
|
||||
case TDMT_VND_DROP_TASK:
|
||||
return qWorkerProcessDropMsg(pVnode, pVnode->pQuery, pMsg);
|
||||
case TDMT_VND_SHOW_TABLES:
|
||||
return qWorkerProcessShowMsg(pVnode, pVnode->pQuery, pMsg);
|
||||
case TDMT_VND_SHOW_TABLES_FETCH:
|
||||
return vnodeGetTableList(pVnode, pMsg);
|
||||
// return qWorkerProcessShowFetchMsg(pVnode->pMeta, pVnode->pQuery, pMsg);
|
||||
case TDMT_VND_TABLE_META:
|
||||
return vnodeGetTableMeta(pVnode, pMsg);
|
||||
case TDMT_VND_CONSUME:
|
||||
|
@ -206,74 +200,3 @@ _exit:
|
|||
tmsgSendRsp(&rpcMsg);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static void freeItemHelper(void *pItem) {
|
||||
char *p = *(char **)pItem;
|
||||
taosMemoryFree(p);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pVnode
|
||||
* @param pMsg
|
||||
* @param pRsp
|
||||
*/
|
||||
static int32_t vnodeGetTableList(SVnode *pVnode, SRpcMsg *pMsg) {
|
||||
SMTbCursor *pCur = metaOpenTbCursor(pVnode->pMeta);
|
||||
SArray *pArray = taosArrayInit(10, POINTER_BYTES);
|
||||
|
||||
char *name = NULL;
|
||||
int32_t totalLen = 0;
|
||||
int32_t numOfTables = 0;
|
||||
while ((name = metaTbCursorNext(pCur)) != NULL) {
|
||||
if (numOfTables < 10000) { // TODO: temp get tables of vnode, and should del when show tables commad ok.
|
||||
taosArrayPush(pArray, &name);
|
||||
totalLen += strlen(name);
|
||||
} else {
|
||||
taosMemoryFreeClear(name);
|
||||
}
|
||||
|
||||
numOfTables++;
|
||||
}
|
||||
|
||||
// TODO: temp debug, and should del when show tables command ok
|
||||
vInfo("====vgId:%d, numOfTables: %d", pVnode->vgId, numOfTables);
|
||||
if (numOfTables > 10000) {
|
||||
numOfTables = 10000;
|
||||
}
|
||||
|
||||
metaCloseTbCursor(pCur);
|
||||
|
||||
int32_t rowLen =
|
||||
(TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE) + 8 + 2 + (TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE) + 8 + 4;
|
||||
// int32_t numOfTables = (int32_t)taosArrayGetSize(pArray);
|
||||
|
||||
int32_t payloadLen = rowLen * numOfTables;
|
||||
// SVShowTablesFetchReq *pFetchReq = pMsg->pCont;
|
||||
|
||||
SVShowTablesFetchRsp *pFetchRsp = (SVShowTablesFetchRsp *)rpcMallocCont(sizeof(SVShowTablesFetchRsp) + payloadLen);
|
||||
memset(pFetchRsp, 0, sizeof(SVShowTablesFetchRsp) + payloadLen);
|
||||
|
||||
char *p = pFetchRsp->data;
|
||||
for (int32_t i = 0; i < numOfTables; ++i) {
|
||||
char *n = taosArrayGetP(pArray, i);
|
||||
STR_TO_VARSTR(p, n);
|
||||
|
||||
p += (TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE);
|
||||
// taosMemoryFree(n);
|
||||
}
|
||||
|
||||
pFetchRsp->numOfRows = htonl(numOfTables);
|
||||
pFetchRsp->precision = 0;
|
||||
|
||||
SRpcMsg rpcMsg = {
|
||||
.handle = pMsg->handle,
|
||||
.ahandle = pMsg->ahandle,
|
||||
.pCont = pFetchRsp,
|
||||
.contLen = sizeof(SVShowTablesFetchRsp) + payloadLen,
|
||||
.code = 0,
|
||||
};
|
||||
|
||||
tmsgSendRsp(&rpcMsg);
|
||||
taosArrayDestroyEx(pArray, freeItemHelper);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -451,13 +451,13 @@ typedef struct SSysTableScanInfo {
|
|||
|
||||
int32_t accountId;
|
||||
bool showRewrite;
|
||||
SNode* pCondition; // db_name filter condition, to discard data that are not in current database
|
||||
SNode *pCondition; // db_name filter condition, to discard data that are not in current database
|
||||
void *pCur; // cursor for iterate the local table meta store.
|
||||
SArray *scanCols; // SArray<int16_t> scan column id list
|
||||
|
||||
int32_t type; // show type, TODO remove it
|
||||
SName name;
|
||||
SSDataBlock* pRes;
|
||||
SSDataBlock *pRes;
|
||||
int32_t capacity;
|
||||
int64_t numOfBlocks; // extract basic running information.
|
||||
SLoadRemoteDataInfo loadInfo;
|
||||
|
|
|
@ -4007,10 +4007,9 @@ static int32_t doSendFetchDataRequest(SExchangeInfo* pExchangeInfo, SExecTaskInf
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
// TODO if only one or two columnss required, how to extract data?
|
||||
int32_t setSDataBlockFromFetchRsp(SSDataBlock* pRes, SLoadRemoteDataInfo* pLoadInfo, int32_t numOfRows,
|
||||
char* pData, int32_t compLen, int32_t numOfOutput, int64_t startTs,
|
||||
uint64_t* total, SArray* pColList) {
|
||||
// TODO if only one or two columns required, how to extract data?
|
||||
int32_t setSDataBlockFromFetchRsp(SSDataBlock* pRes, SLoadRemoteDataInfo* pLoadInfo, int32_t numOfRows, char* pData,
|
||||
int32_t compLen, int32_t numOfOutput, int64_t startTs, uint64_t* total, SArray* pColList) {
|
||||
blockDataEnsureCapacity(pRes, numOfRows);
|
||||
|
||||
if (pColList == NULL) { // data from other sources
|
||||
|
@ -4040,18 +4039,70 @@ int32_t setSDataBlockFromFetchRsp(SSDataBlock* pRes, SLoadRemoteDataInfo* pLoadI
|
|||
}
|
||||
} else { // extract data according to pColList
|
||||
ASSERT(numOfOutput == taosArrayGetSize(pColList));
|
||||
char* pStart = pData;
|
||||
|
||||
int32_t numOfCols = htonl(*(int32_t*)pStart);
|
||||
pStart += sizeof(int32_t);
|
||||
|
||||
SSysTableSchema* pSchema = (SSysTableSchema*)pStart;
|
||||
for(int32_t i = 0; i < numOfCols; ++i) {
|
||||
SSysTableSchema* p = (SSysTableSchema*)pStart;
|
||||
|
||||
p->colId = htons(p->colId);
|
||||
p->bytes = htonl(p->bytes);
|
||||
pStart += sizeof(SSysTableSchema);
|
||||
}
|
||||
|
||||
SSDataBlock block = {.pDataBlock = taosArrayInit(numOfCols, sizeof(SColumnInfoData)), .info.numOfCols = numOfCols};
|
||||
for(int32_t i = 0; i < numOfCols; ++i) {
|
||||
SColumnInfoData idata = {0};
|
||||
idata.info.type = pSchema[i].type;
|
||||
idata.info.bytes = pSchema[i].bytes;
|
||||
idata.info.colId = pSchema[i].colId;
|
||||
|
||||
taosArrayPush(block.pDataBlock, &idata);
|
||||
if (IS_VAR_DATA_TYPE(idata.info.type)) {
|
||||
block.info.hasVarCol = true;
|
||||
}
|
||||
}
|
||||
|
||||
blockDataEnsureCapacity(&block, numOfRows);
|
||||
|
||||
int32_t* colLen = (int32_t*) pStart;
|
||||
pStart += sizeof(int32_t) * numOfCols;
|
||||
|
||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||
colLen[i] = htonl(colLen[i]);
|
||||
ASSERT(colLen[i] >= 0);
|
||||
|
||||
SColumnInfoData* pColInfoData = taosArrayGet(block.pDataBlock, i);
|
||||
if (IS_VAR_DATA_TYPE(pColInfoData->info.type)) {
|
||||
pColInfoData->varmeta.length = colLen[i];
|
||||
pColInfoData->varmeta.allocLen = colLen[i];
|
||||
|
||||
memcpy(pColInfoData->varmeta.offset, pStart, sizeof(int32_t) * numOfRows);
|
||||
pStart += sizeof(int32_t) * numOfRows;
|
||||
|
||||
pColInfoData->pData = taosMemoryMalloc(colLen[i]);
|
||||
} else {
|
||||
memcpy(pColInfoData->nullbitmap, pStart, BitmapLen(numOfRows));
|
||||
pStart += BitmapLen(numOfRows);
|
||||
}
|
||||
|
||||
memcpy(pColInfoData->pData, pStart, colLen[i]);
|
||||
pStart += colLen[i];
|
||||
}
|
||||
|
||||
// data from mnode
|
||||
for (int32_t i = 0; i < numOfOutput; ++i) {
|
||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||
SColumnInfoData* pSrc = taosArrayGet(block.pDataBlock, i);
|
||||
|
||||
for (int32_t j = 0; j < numOfOutput; ++j) {
|
||||
int16_t colIndex = *(int16_t*)taosArrayGet(pColList, j);
|
||||
|
||||
if (colIndex - 1 == i) {
|
||||
SColumnInfoData* pColInfoData = taosArrayGet(pRes->pDataBlock, j);
|
||||
|
||||
for (int32_t k = 0; k < numOfRows; ++k) {
|
||||
colDataAppend(pColInfoData, k, pData, false);
|
||||
pData += pColInfoData->info.bytes;
|
||||
}
|
||||
colDataAssign(pColInfoData, pSrc, numOfRows);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -685,6 +685,7 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator, bool* newgroup) {
|
|||
|
||||
int64_t startTs = taosGetTimestampUs();
|
||||
|
||||
_retry:
|
||||
pInfo->req.type = pInfo->type;
|
||||
strncpy(pInfo->req.tb, tNameGetTableName(&pInfo->name), tListLen(pInfo->req.tb));
|
||||
if (pInfo->showRewrite) {
|
||||
|
@ -738,7 +739,12 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator, bool* newgroup) {
|
|||
setSDataBlockFromFetchRsp(pInfo->pRes, &pInfo->loadInfo, pTableRsp->numOfRows, pTableRsp->data, pTableRsp->compLen,
|
||||
pOperator->numOfOutput, startTs, NULL, pInfo->scanCols);
|
||||
|
||||
return doFilterResult(pInfo);
|
||||
doFilterResult(pInfo);
|
||||
if (pInfo->pRes->info.rows == 0) {
|
||||
goto _retry;
|
||||
}
|
||||
|
||||
return pInfo->pRes;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -756,12 +762,12 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* pSysTableReadHandle, SSDataB
|
|||
return NULL;
|
||||
}
|
||||
|
||||
pInfo->accountId = accountId;
|
||||
pInfo->accountId = accountId;
|
||||
pInfo->showRewrite = showRewrite;
|
||||
pInfo->pRes = pResBlock;
|
||||
pInfo->capacity = 4096;
|
||||
pInfo->pCondition = pCondition;
|
||||
pInfo->scanCols = colList;
|
||||
pInfo->pRes = pResBlock;
|
||||
pInfo->capacity = 4096;
|
||||
pInfo->pCondition = pCondition;
|
||||
pInfo->scanCols = colList;
|
||||
|
||||
// TODO remove it
|
||||
int32_t tableType = 0;
|
||||
|
@ -798,6 +804,8 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* pSysTableReadHandle, SSDataB
|
|||
tableType = TSDB_MGMT_TABLE_VGROUP;
|
||||
} else if (strncasecmp(name, TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED, tListLen(pName->tname)) == 0) {
|
||||
// tableType = TSDB_MGMT_TABLE_DIST;
|
||||
} else if (strncasecmp(name, TSDB_INS_TABLE_CLUSTER, tListLen(pName->tname)) == 0) {
|
||||
tableType = TSDB_MGMT_TABLE_CLUSTER;
|
||||
} else {
|
||||
ASSERT(0);
|
||||
}
|
||||
|
@ -835,15 +843,15 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* pSysTableReadHandle, SSDataB
|
|||
#endif
|
||||
}
|
||||
|
||||
pOperator->name = "SysTableScanOperator";
|
||||
pOperator->name = "SysTableScanOperator";
|
||||
pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN;
|
||||
pOperator->blockingOptr = false;
|
||||
pOperator->status = OP_NOT_OPENED;
|
||||
pOperator->info = pInfo;
|
||||
pOperator->numOfOutput = pResBlock->info.numOfCols;
|
||||
pOperator->getNextFn = doSysTableScan;
|
||||
pOperator->closeFn = destroySysScanOperator;
|
||||
pOperator->pTaskInfo = pTaskInfo;
|
||||
pOperator->status = OP_NOT_OPENED;
|
||||
pOperator->info = pInfo;
|
||||
pOperator->numOfOutput = pResBlock->info.numOfCols;
|
||||
pOperator->getNextFn = doSysTableScan;
|
||||
pOperator->closeFn = destroySysScanOperator;
|
||||
pOperator->pTaskInfo = pTaskInfo;
|
||||
|
||||
return pOperator;
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $d
|
|||
print ====> dataX_db
|
||||
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
|
||||
|
||||
if $rows != 2 then
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data0_db != db then # name
|
||||
|
|
|
@ -6,19 +6,19 @@ sql connect
|
|||
print =============== create database
|
||||
sql create database d1 vgroups 2
|
||||
sql show databases
|
||||
if $rows != 2 then
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data00 != d1 then
|
||||
if $data20 != d1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data02 != 2 then
|
||||
if $data22 != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data03 != 0 then
|
||||
if $data23 != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -40,7 +40,7 @@ endi
|
|||
print =============== drop database
|
||||
sql drop database d1
|
||||
sql show databases
|
||||
if $rows != 1 then
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -49,7 +49,7 @@ sql create database d2 vgroups 2
|
|||
sql create database d3 vgroups 3
|
||||
sql create database d4 vgroups 4
|
||||
sql show databases
|
||||
if $rows != 4 then
|
||||
if $rows != 5 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -111,19 +111,19 @@ print =============== drop database
|
|||
sql drop database d2
|
||||
sql drop database d3
|
||||
sql show databases
|
||||
if $rows != 2 then
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data00 != d4 then
|
||||
if $data20 != d4 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data02 != 4 then
|
||||
if $data22 != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data03 != 0 then
|
||||
if $data23 != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -154,7 +154,7 @@ system sh/exec.sh -n dnode1 -s start
|
|||
|
||||
print =============== show databases
|
||||
sql show databases
|
||||
if $rows != 2 then
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -33,15 +33,15 @@ sql show databases
|
|||
print rows: $rows
|
||||
print $data00 $data01 $data02 $data03
|
||||
print $data10 $data11 $data12 $data13
|
||||
if $rows != 2 then
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data00 != d1 then
|
||||
if $data20 != d1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data02 != 2 then # vgroups
|
||||
if $data22 != 2 then # vgroups
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -62,7 +62,7 @@ sql create table t2 (ts timestamp, i int);
|
|||
sql create table t3 (ts timestamp, i int);
|
||||
|
||||
sql show databases
|
||||
if $rows != 3 then
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -29,15 +29,15 @@ sql create table d1.t3 (ts timestamp, i int);
|
|||
sql create table d1.t4 (ts timestamp, i int);
|
||||
|
||||
sql show databases
|
||||
if $rows != 2 then
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data00 != d1 then
|
||||
if $data20 != d1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data02 != 2 then
|
||||
if $data22 != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -57,7 +57,7 @@ sql create table d2.t2 (ts timestamp, i int);
|
|||
sql create table d2.t3 (ts timestamp, i int);
|
||||
|
||||
sql show databases
|
||||
if $rows != 3 then
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -20,31 +20,31 @@ sql show databases
|
|||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
||||
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
|
||||
|
||||
if $rows != 2 then
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != $db then
|
||||
if $data20 != $db then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != 8 then
|
||||
if $data22 != 8 then
|
||||
return -1
|
||||
endi
|
||||
if $data03 != 0 then
|
||||
if $data23 != 0 then
|
||||
return -1
|
||||
endi
|
||||
if $data04 != 1 then
|
||||
if $data24 != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data06 != 2880 then
|
||||
if $data26 != 2880 then
|
||||
return -1
|
||||
endi
|
||||
if $data07 != 3650,3650,3650 then
|
||||
if $data27 != 3650,3650,3650 then
|
||||
return -1
|
||||
endi
|
||||
if $data08 != 32 then
|
||||
if $data28 != 32 then
|
||||
return -1
|
||||
endi
|
||||
if $data09 != 12 then
|
||||
if $data29 != 12 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -52,14 +52,14 @@ print =============== step2
|
|||
sql_error create database $db
|
||||
sql create database if not exists $db
|
||||
sql show databases
|
||||
if $rows != 2 then
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step3
|
||||
sql drop database $db
|
||||
sql show databases
|
||||
if $rows != 1 then
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -70,16 +70,16 @@ print =============== step5
|
|||
sql create database $db replica 1 days 21600 keep 2160000
|
||||
sql show databases
|
||||
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07
|
||||
if $data00 != $db then
|
||||
if $data20 != $db then
|
||||
return -1
|
||||
endi
|
||||
if $data03 != 0 then
|
||||
if $data23 != 0 then
|
||||
return -1
|
||||
endi
|
||||
if $data04 != 1 then
|
||||
if $data24 != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data06 != 21600 then
|
||||
if $data26 != 21600 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -314,7 +314,7 @@ endi
|
|||
|
||||
sql drop database $db
|
||||
sql show databases
|
||||
if $rows != 0 then
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ sql create database db
|
|||
sql show databases
|
||||
print rows: $rows
|
||||
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
|
||||
if $rows != 2 then
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data0_db != db then # name
|
||||
|
@ -112,6 +112,7 @@ if $data3_db != 0 then # ntables
|
|||
return -1
|
||||
endi
|
||||
if $data4_db != 1 then # replica
|
||||
print expect 1, actual: $data4_db
|
||||
return -1
|
||||
endi
|
||||
if $data5_db != 1 then # quorum
|
||||
|
|
|
@ -42,19 +42,19 @@ re-create1:
|
|||
sql create database d1 vgroups 2 -x re-create1
|
||||
|
||||
sql show databases
|
||||
if $rows != 2 then
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data00 != d1 then
|
||||
if $data20 != d1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data02 != 2 then
|
||||
if $data22 != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data03 != 0 then
|
||||
if $data23 != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -81,19 +81,19 @@ re-create2:
|
|||
sql create database d1 vgroups 5 -x re-create2
|
||||
|
||||
sql show databases
|
||||
if $rows != 2 then
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data00 != d1 then
|
||||
if $data20 != d1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data02 != 5 then
|
||||
if $data22 != 5 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data03 != 0 then
|
||||
if $data23 != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ sql create database d1 vgroups 4;
|
|||
sql create database d2;
|
||||
|
||||
sql show databases
|
||||
if $rows != 3 then
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -12,16 +12,16 @@ print rows: $rows
|
|||
print $data00 $data01
|
||||
print $data10 $data11
|
||||
print $data20 $data21
|
||||
if $rows != 3 then
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != database then
|
||||
if $data20 != database then
|
||||
return -1
|
||||
endi
|
||||
if $data10 != DataBase then
|
||||
if $data30 != DataBase then
|
||||
return -1
|
||||
endi
|
||||
if $data20 != information_schema then
|
||||
if $data00 != information_schema then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -206,16 +206,16 @@ print rows: $rows
|
|||
print $data00 $data01
|
||||
print $data10 $data11
|
||||
print $data20 $data21
|
||||
if $rows != 3 then
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != database then
|
||||
if $data20 != database then
|
||||
return -1
|
||||
endi
|
||||
if $data10 != DataBase then
|
||||
if $data30 != DataBase then
|
||||
return -1
|
||||
endi
|
||||
if $data20 != information_schema then
|
||||
if $data00 != information_schema then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ sql connect
|
|||
print =============== create database
|
||||
sql create database d0
|
||||
sql show databases
|
||||
if $rows != 2 then
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ sql connect
|
|||
print =============== create database
|
||||
sql create database d1
|
||||
sql show databases
|
||||
if $rows != 2 then
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ sql connect
|
|||
print =============== create database
|
||||
sql create database d0
|
||||
sql show databases
|
||||
if $rows != 2 then
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ print =============== create database
|
|||
sql create database $dbNamme vgroups 1
|
||||
sql show databases
|
||||
print $data00 $data01 $data02
|
||||
if $rows != 2 then
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ sql connect
|
|||
print =============== create database
|
||||
sql create database db
|
||||
sql show databases
|
||||
if $rows != 2 then
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ sql connect
|
|||
print =============== create database
|
||||
sql create database db
|
||||
sql show databases
|
||||
if $rows != 2 then
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -24,11 +24,6 @@ sql connect
|
|||
|
||||
print =============== create database
|
||||
sql create database db
|
||||
sql show databases
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql use db
|
||||
|
||||
print =============== create super table and child table
|
||||
|
|
|
@ -24,11 +24,6 @@ sql connect
|
|||
|
||||
print =============== create database
|
||||
sql create database db
|
||||
sql show databases
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql use db
|
||||
|
||||
print =============== create super table and child table
|
||||
|
@ -114,14 +109,14 @@ print ====> rows0: $data00, $data01, $data02, $data03, $data04, $data05, $data06
|
|||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 2 then
|
||||
if $data01 != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from ct1 limit 2 offset 1
|
||||
sql select * from ct1 limit 2 offset 7
|
||||
print ====> sql : select * from ct1 limit 2 offset 7
|
||||
print ====> rows: $rows
|
||||
if $rows != 2 then
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 8 then
|
||||
|
|
|
@ -25,7 +25,7 @@ sql connect
|
|||
print =============== create database
|
||||
sql create database db
|
||||
sql show databases
|
||||
if $rows != 2 then
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ step6:
|
|||
print =============== clear
|
||||
sql drop database $db
|
||||
sql show databases
|
||||
if $rows != 1 then
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -6,11 +6,6 @@ sql connect
|
|||
|
||||
print =============== create database
|
||||
sql create database d0
|
||||
sql show databases
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql use d0
|
||||
|
||||
print =============== create super table and child table
|
||||
|
|
|
@ -256,7 +256,7 @@ endi
|
|||
# $data0-11 != 1
|
||||
# $data1-11 != 14
|
||||
|
||||
print ====> select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1) from (select * from dev_001 where ts <'2020-05-20 0:0:0') session(ts,1d)
|
||||
#print ====> select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1) from (select * from dev_001 where ts <'2020-05-20 0:0:0') session(ts,1d)
|
||||
#sql select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1) from (select * from dev_001 where ts <'2020-05-20 0:0:0') session(ts,1d)
|
||||
#if $rows != 2 then
|
||||
# return -1
|
||||
|
|
|
@ -28,8 +28,8 @@ sql connect
|
|||
|
||||
# select */column from information_schema.xxxx; xxxx include:
|
||||
# dnodes, mnodes, modules, qnodes,
|
||||
# user_databases, user_functions, user_indexes, user_stables, user_streams,
|
||||
# user_tables, user_table_distributed, user_users, vgroups,
|
||||
# user_databases, user_functions, user_indexes, user_stables, user_streams,
|
||||
# user_tables, user_table_distributed, user_users, vgroups,
|
||||
|
||||
print =============== add dnode2 into cluster
|
||||
sql create dnode $hostname port 7200
|
||||
|
@ -53,7 +53,7 @@ endi
|
|||
#sql show modules
|
||||
#sql show qnodes
|
||||
sql show databases
|
||||
if $rows != 2 then
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
#sql show functions
|
||||
|
@ -90,7 +90,7 @@ endi
|
|||
#sql select * from information_schema.`modules`
|
||||
#sql select * from information_schema.`qnodes`
|
||||
sql select * from information_schema.user_databases
|
||||
if $rows != 2 then
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
#sql select * from information_schema.user_functions
|
||||
|
@ -151,7 +151,7 @@ endi
|
|||
#sql show modules
|
||||
#sql show qnodes
|
||||
sql show databases
|
||||
if $rows != 2 then
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
#sql show functions
|
||||
|
@ -188,7 +188,7 @@ endi
|
|||
#sql select * from information_schema.`modules`
|
||||
#sql select * from information_schema.`qnodes`
|
||||
sql select * from information_schema.user_databases
|
||||
if $rows != 2 then
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
#sql select * from information_schema.user_functions
|
||||
|
|
|
@ -6,13 +6,6 @@ sql connect
|
|||
|
||||
print =============== create database
|
||||
sql create database d1
|
||||
sql show databases
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print $data00 $data01 $data02
|
||||
|
||||
sql use d1
|
||||
|
||||
print =============== create super table, include column type for count/sum/min/max/first
|
||||
|
|
|
@ -199,7 +199,7 @@ print =============== step11
|
|||
print =============== clear
|
||||
sql drop database $db
|
||||
sql show databases
|
||||
if $rows != 1 then
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -206,7 +206,7 @@ print =============== step11
|
|||
print =============== clear
|
||||
sql drop database $db
|
||||
sql show databases
|
||||
if $rows != 1 then
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ system sh/cfg.sh -n dnode1 -c walLevel -v 1
|
|||
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
|
||||
sleep 2000
|
||||
sleep 1000
|
||||
sql connect
|
||||
|
||||
$dbPrefix = m_me_db
|
||||
|
@ -95,8 +95,8 @@ $i = 2
|
|||
$tb = $tbPrefix . $i
|
||||
sql insert into $tb values (now + 1m , 1 )
|
||||
|
||||
print sleep 8000
|
||||
sleep 8000
|
||||
print sleep 2000
|
||||
sleep 2000
|
||||
|
||||
print =============== step6
|
||||
|
||||
|
@ -130,7 +130,7 @@ endi
|
|||
|
||||
sql drop database $db
|
||||
sql show databases
|
||||
if $rows != 1 then
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ sql insert into d1.t2 values(now, 1);
|
|||
sql drop database d1;
|
||||
|
||||
sql show databases;
|
||||
if $rows != 1 then
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -49,7 +49,7 @@ endi
|
|||
sql drop database d2;
|
||||
|
||||
sql show databases;
|
||||
if $rows != 1 then
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -78,7 +78,7 @@ endi
|
|||
sql drop database d3;
|
||||
|
||||
sql show databases;
|
||||
if $rows != 1 then
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -106,7 +106,7 @@ endi
|
|||
sql drop database d4;
|
||||
|
||||
sql show databases;
|
||||
if $rows != 1 then
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -123,7 +123,7 @@ sql insert into d5.t1 values(now, 1);
|
|||
sql drop database d5;
|
||||
|
||||
sql show databases;
|
||||
if $rows != 1 then
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -27,8 +27,9 @@ while $m < 128
|
|||
$filter = ' . $tb
|
||||
$filter = $filter . '
|
||||
sql show stables like $filter
|
||||
# print sql : show stables like $filter ==> $rows
|
||||
print sql : show stables like $filter
|
||||
if $rows != 1 then
|
||||
print expect 1, actual: $rows
|
||||
return -1
|
||||
endi
|
||||
$m = $m + 1
|
||||
|
|
|
@ -174,7 +174,7 @@ print =============== step11
|
|||
print =============== clear
|
||||
sql drop database $db
|
||||
sql show databases
|
||||
if $rows != 1 then
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ endi
|
|||
print =============== create database
|
||||
sql create database d1
|
||||
sql show databases
|
||||
if $rows != 5 then
|
||||
if $rows != 6 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -50,10 +50,10 @@ endi
|
|||
|
||||
sql show databases
|
||||
print ===> $rows $data00 $data01 $data02 $data03
|
||||
if $rows != 2 then
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != tmqdb then
|
||||
if $data20 != tmqdb then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -36,12 +36,6 @@ sql connect
|
|||
$dbNamme = d0
|
||||
print =============== create database , vgroup 1
|
||||
sql create database $dbNamme vgroups 1
|
||||
sql show databases
|
||||
print $data00 $data01 $data02
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql use $dbNamme
|
||||
|
||||
print =============== create super table
|
||||
|
|
|
@ -43,35 +43,6 @@ loop_vgroups:
|
|||
print =============== create database $dbNamme vgroups $vgroups
|
||||
sql create database $dbNamme vgroups $vgroups
|
||||
sql show databases
|
||||
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
|
||||
print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19
|
||||
print $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29
|
||||
|
||||
if $loop_cnt == 0 then
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != 2 then # vgroups
|
||||
print vgroups: $data02
|
||||
return -1
|
||||
endi
|
||||
else
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 == d1 then
|
||||
if $data02 != 4 then # vgroups
|
||||
print vgroups: $data02
|
||||
return -1
|
||||
endi
|
||||
else
|
||||
if $data12 != 4 then # vgroups
|
||||
print vgroups: $data12
|
||||
return -1
|
||||
endi
|
||||
endi
|
||||
endi
|
||||
|
||||
sql use $dbNamme
|
||||
|
||||
print =============== create super table
|
||||
|
|
|
@ -42,36 +42,6 @@ $dbNamme = d0
|
|||
loop_vgroups:
|
||||
print =============== create database $dbNamme vgroups $vgroups
|
||||
sql create database $dbNamme vgroups $vgroups
|
||||
sql show databases
|
||||
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
|
||||
print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19
|
||||
print $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29
|
||||
|
||||
if $loop_cnt == 0 then
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != 2 then # vgroups
|
||||
print vgroups: $data02
|
||||
return -1
|
||||
endi
|
||||
else
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 == d1 then
|
||||
if $data02 != 4 then # vgroups
|
||||
print vgroups: $data02
|
||||
return -1
|
||||
endi
|
||||
else
|
||||
if $data12 != 4 then # vgroups
|
||||
print vgroups: $data12
|
||||
return -1
|
||||
endi
|
||||
endi
|
||||
endi
|
||||
|
||||
sql use $dbNamme
|
||||
|
||||
print =============== create super table
|
||||
|
|
|
@ -42,36 +42,6 @@ $dbNamme = d0
|
|||
loop_vgroups:
|
||||
print =============== create database $dbNamme vgroups $vgroups
|
||||
sql create database $dbNamme vgroups $vgroups
|
||||
sql show databases
|
||||
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
|
||||
print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19
|
||||
print $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29
|
||||
|
||||
if $loop_cnt == 0 then
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != 2 then # vgroups
|
||||
print vgroups: $data02
|
||||
return -1
|
||||
endi
|
||||
else
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 == d1 then
|
||||
if $data02 != 4 then # vgroups
|
||||
print vgroups: $data02
|
||||
return -1
|
||||
endi
|
||||
else
|
||||
if $data12 != 4 then # vgroups
|
||||
print vgroups: $data12
|
||||
return -1
|
||||
endi
|
||||
endi
|
||||
endi
|
||||
|
||||
sql use $dbNamme
|
||||
|
||||
print =============== create super table
|
||||
|
|
|
@ -42,36 +42,6 @@ $dbNamme = d0
|
|||
loop_vgroups:
|
||||
print =============== create database $dbNamme vgroups $vgroups
|
||||
sql create database $dbNamme vgroups $vgroups
|
||||
sql show databases
|
||||
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
|
||||
print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19
|
||||
print $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29
|
||||
|
||||
if $loop_cnt == 0 then
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != 2 then # vgroups
|
||||
print vgroups: $data02
|
||||
return -1
|
||||
endi
|
||||
else
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 == d1 then
|
||||
if $data02 != 4 then # vgroups
|
||||
print vgroups: $data02
|
||||
return -1
|
||||
endi
|
||||
else
|
||||
if $data12 != 4 then # vgroups
|
||||
print vgroups: $data12
|
||||
return -1
|
||||
endi
|
||||
endi
|
||||
endi
|
||||
|
||||
sql use $dbNamme
|
||||
|
||||
print =============== create super table
|
||||
|
|
|
@ -42,36 +42,6 @@ $dbNamme = d0
|
|||
loop_vgroups:
|
||||
print =============== create database $dbNamme vgroups $vgroups
|
||||
sql create database $dbNamme vgroups $vgroups
|
||||
sql show databases
|
||||
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
|
||||
print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19
|
||||
print $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29
|
||||
|
||||
if $loop_cnt == 0 then
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != 1 then # vgroups
|
||||
print vgroups: $data02
|
||||
return -1
|
||||
endi
|
||||
else
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 == d1 then
|
||||
if $data02 != 4 then # vgroups
|
||||
print vgroups: $data02
|
||||
return -1
|
||||
endi
|
||||
else
|
||||
if $data12 != 4 then # vgroups
|
||||
print vgroups: $data12
|
||||
return -1
|
||||
endi
|
||||
endi
|
||||
endi
|
||||
|
||||
sql use $dbNamme
|
||||
|
||||
print =============== create super table
|
||||
|
@ -197,6 +167,7 @@ system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamm
|
|||
print cmd result----> $system_content
|
||||
#if $system_content != @{consume success: 20000, 0}@ then
|
||||
if $system_content != $expect_result then
|
||||
print expect @{consume success: 20000, 0}@ , actual @system_content
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -42,36 +42,6 @@ $dbNamme = d0
|
|||
loop_vgroups:
|
||||
print =============== create database $dbNamme vgroups $vgroups
|
||||
sql create database $dbNamme vgroups $vgroups
|
||||
sql show databases
|
||||
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
|
||||
print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19
|
||||
print $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29
|
||||
|
||||
if $loop_cnt == 0 then
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != 1 then # vgroups
|
||||
print vgroups: $data02
|
||||
return -1
|
||||
endi
|
||||
else
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 == d1 then
|
||||
if $data02 != 4 then # vgroups
|
||||
print vgroups: $data02
|
||||
return -1
|
||||
endi
|
||||
else
|
||||
if $data12 != 4 then # vgroups
|
||||
print vgroups: $data12
|
||||
return -1
|
||||
endi
|
||||
endi
|
||||
endi
|
||||
|
||||
sql use $dbNamme
|
||||
|
||||
print =============== create super table
|
||||
|
|
|
@ -48,24 +48,24 @@ print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $d
|
|||
print $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29
|
||||
|
||||
if $loop_cnt == 0 then
|
||||
if $rows != 2 then
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != 1 then # vgroups
|
||||
if $data22 != 1 then # vgroups
|
||||
print vgroups: $data02
|
||||
return -1
|
||||
endi
|
||||
else
|
||||
if $rows != 3 then
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 == d1 then
|
||||
if $data02 != 4 then # vgroups
|
||||
if $data20 == d1 then
|
||||
if $data22 != 4 then # vgroups
|
||||
print vgroups: $data02
|
||||
return -1
|
||||
endi
|
||||
else
|
||||
if $data12 != 4 then # vgroups
|
||||
if $data32 != 4 then # vgroups
|
||||
print vgroups: $data12
|
||||
return -1
|
||||
endi
|
||||
|
|
|
@ -48,24 +48,24 @@ print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $d
|
|||
print $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29
|
||||
|
||||
if $loop_cnt == 0 then
|
||||
if $rows != 2 then
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != 1 then # vgroups
|
||||
if $data22 != 1 then # vgroups
|
||||
print vgroups: $data02
|
||||
return -1
|
||||
endi
|
||||
else
|
||||
if $rows != 3 then
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 == d1 then
|
||||
if $data02 != 4 then # vgroups
|
||||
if $data20 == d1 then
|
||||
if $data22 != 4 then # vgroups
|
||||
print vgroups: $data02
|
||||
return -1
|
||||
endi
|
||||
else
|
||||
if $data12 != 4 then # vgroups
|
||||
if $data32 != 4 then # vgroups
|
||||
print vgroups: $data12
|
||||
return -1
|
||||
endi
|
||||
|
|
Loading…
Reference in New Issue