Merge branch '3.0' into feature/3.0_liaohj
This commit is contained in:
commit
d6338ca773
|
@ -17,6 +17,7 @@
|
||||||
#define _TD_COMMON_EP_H_
|
#define _TD_COMMON_EP_H_
|
||||||
|
|
||||||
#include "tcommon.h"
|
#include "tcommon.h"
|
||||||
|
#include "tcompression.h"
|
||||||
#include "tmsg.h"
|
#include "tmsg.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -115,11 +116,11 @@ static FORCE_INLINE void colDataAppendNULL(SColumnInfoData* pColumnInfoData, uin
|
||||||
|
|
||||||
static FORCE_INLINE void colDataAppendNNULL(SColumnInfoData* pColumnInfoData, uint32_t start, size_t nRows) {
|
static FORCE_INLINE void colDataAppendNNULL(SColumnInfoData* pColumnInfoData, uint32_t start, size_t nRows) {
|
||||||
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
|
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
|
||||||
for(int32_t i = start; i < start + nRows; ++i) {
|
for (int32_t i = start; i < start + nRows; ++i) {
|
||||||
pColumnInfoData->varmeta.offset[i] = -1; // it is a null value of VAR type.
|
pColumnInfoData->varmeta.offset[i] = -1; // it is a null value of VAR type.
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for(int32_t i = start; i < start + nRows; ++i) {
|
for (int32_t i = start; i < start + nRows; ++i) {
|
||||||
colDataSetNull_f(pColumnInfoData->nullbitmap, i);
|
colDataSetNull_f(pColumnInfoData->nullbitmap, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,12 +204,58 @@ void blockDataCleanup(SSDataBlock* pDataBlock);
|
||||||
size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize);
|
size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize);
|
||||||
void* blockDataDestroy(SSDataBlock* pBlock);
|
void* blockDataDestroy(SSDataBlock* pBlock);
|
||||||
|
|
||||||
int32_t blockDataTrimFirstNRows(SSDataBlock *pBlock, size_t n);
|
int32_t blockDataTrimFirstNRows(SSDataBlock* pBlock, size_t n);
|
||||||
|
|
||||||
SSDataBlock* createOneDataBlock(const SSDataBlock* pDataBlock);
|
SSDataBlock* createOneDataBlock(const SSDataBlock* pDataBlock);
|
||||||
|
|
||||||
void blockDebugShowData(const SArray* dataBlocks);
|
void blockDebugShowData(const SArray* dataBlocks);
|
||||||
|
|
||||||
|
static FORCE_INLINE int32_t blockCompressColData(SColumnInfoData* pColRes, int32_t numOfRows, char* data,
|
||||||
|
int8_t compressed) {
|
||||||
|
int32_t colSize = colDataGetLength(pColRes, numOfRows);
|
||||||
|
return (*(tDataTypes[pColRes->info.type].compFunc))(pColRes->pData, colSize, numOfRows, data,
|
||||||
|
colSize + COMP_OVERFLOW_BYTES, compressed, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static FORCE_INLINE void blockCompressEncode(const SSDataBlock* pBlock, char* data, int32_t* dataLen, int32_t numOfCols,
|
||||||
|
int8_t needCompress) {
|
||||||
|
int32_t* colSizes = (int32_t*)data;
|
||||||
|
|
||||||
|
data += numOfCols * sizeof(int32_t);
|
||||||
|
*dataLen = (numOfCols * sizeof(int32_t));
|
||||||
|
|
||||||
|
int32_t numOfRows = pBlock->info.rows;
|
||||||
|
for (int32_t col = 0; col < numOfCols; ++col) {
|
||||||
|
SColumnInfoData* pColRes = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, col);
|
||||||
|
|
||||||
|
// copy the null bitmap
|
||||||
|
if (IS_VAR_DATA_TYPE(pColRes->info.type)) {
|
||||||
|
size_t metaSize = numOfRows * sizeof(int32_t);
|
||||||
|
memcpy(data, pColRes->varmeta.offset, metaSize);
|
||||||
|
data += metaSize;
|
||||||
|
(*dataLen) += metaSize;
|
||||||
|
} else {
|
||||||
|
int32_t len = BitmapLen(numOfRows);
|
||||||
|
memcpy(data, pColRes->nullbitmap, len);
|
||||||
|
data += len;
|
||||||
|
(*dataLen) += len;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (needCompress) {
|
||||||
|
colSizes[col] = blockCompressColData(pColRes, numOfRows, data, needCompress);
|
||||||
|
data += colSizes[col];
|
||||||
|
(*dataLen) += colSizes[col];
|
||||||
|
} else {
|
||||||
|
colSizes[col] = colDataGetLength(pColRes, numOfRows);
|
||||||
|
(*dataLen) += colSizes[col];
|
||||||
|
memmove(data, pColRes->pData, colSizes[col]);
|
||||||
|
data += colSizes[col];
|
||||||
|
}
|
||||||
|
|
||||||
|
colSizes[col] = htonl(colSizes[col]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1023,10 +1023,11 @@ int32_t tDeserializeSMCfgDnodeReq(void* buf, int32_t bufLen, SMCfgDnodeReq* pReq
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t dnodeId;
|
int32_t dnodeId;
|
||||||
} SMCreateMnodeReq, SMDropMnodeReq, SDDropMnodeReq;
|
} SMCreateMnodeReq, SMDropMnodeReq, SDDropMnodeReq, SMCreateQnodeReq, SMDropQnodeReq, SDCreateQnodeReq, SDDropQnodeReq, SMCreateSnodeReq, SMDropSnodeReq,
|
||||||
|
SDCreateSnodeReq, SDDropSnodeReq, SMCreateBnodeReq, SMDropBnodeReq, SDCreateBnodeReq, SDDropBnodeReq;
|
||||||
|
|
||||||
int32_t tSerializeSMCreateDropMnodeReq(void* buf, int32_t bufLen, SMCreateMnodeReq* pReq);
|
int32_t tSerializeSCreateDropMQSBNodeReq(void* buf, int32_t bufLen, SMCreateQnodeReq* pReq);
|
||||||
int32_t tDeserializeSMCreateDropMnodeReq(void* buf, int32_t bufLen, SMCreateMnodeReq* pReq);
|
int32_t tDeserializeSCreateDropMQSBNodeReq(void* buf, int32_t bufLen, SMCreateQnodeReq* pReq);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t dnodeId;
|
int32_t dnodeId;
|
||||||
|
@ -1037,14 +1038,6 @@ typedef struct {
|
||||||
int32_t tSerializeSDCreateMnodeReq(void* buf, int32_t bufLen, SDCreateMnodeReq* pReq);
|
int32_t tSerializeSDCreateMnodeReq(void* buf, int32_t bufLen, SDCreateMnodeReq* pReq);
|
||||||
int32_t tDeserializeSDCreateMnodeReq(void* buf, int32_t bufLen, SDCreateMnodeReq* pReq);
|
int32_t tDeserializeSDCreateMnodeReq(void* buf, int32_t bufLen, SDCreateMnodeReq* pReq);
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int32_t dnodeId;
|
|
||||||
} SMCreateQnodeReq, SMDropQnodeReq, SDCreateQnodeReq, SDDropQnodeReq, SMCreateSnodeReq, SMDropSnodeReq,
|
|
||||||
SDCreateSnodeReq, SDDropSnodeReq, SMCreateBnodeReq, SMDropBnodeReq, SDCreateBnodeReq, SDDropBnodeReq;
|
|
||||||
|
|
||||||
int32_t tSerializeSMCreateDropQSBNodeReq(void* buf, int32_t bufLen, SMCreateQnodeReq* pReq);
|
|
||||||
int32_t tDeserializeSMCreateDropQSBNodeReq(void* buf, int32_t bufLen, SMCreateQnodeReq* pReq);
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char sql[TSDB_SHOW_SQL_LEN];
|
char sql[TSDB_SHOW_SQL_LEN];
|
||||||
int32_t queryId;
|
int32_t queryId;
|
||||||
|
|
|
@ -59,164 +59,169 @@
|
||||||
#define TK_LOCAL 41
|
#define TK_LOCAL 41
|
||||||
#define TK_QNODE 42
|
#define TK_QNODE 42
|
||||||
#define TK_ON 43
|
#define TK_ON 43
|
||||||
#define TK_DATABASE 44
|
#define TK_BNODE 44
|
||||||
#define TK_USE 45
|
#define TK_SNODE 45
|
||||||
#define TK_IF 46
|
#define TK_MNODE 46
|
||||||
#define TK_NOT 47
|
#define TK_DATABASE 47
|
||||||
#define TK_EXISTS 48
|
#define TK_USE 48
|
||||||
#define TK_BLOCKS 49
|
#define TK_IF 49
|
||||||
#define TK_CACHE 50
|
#define TK_NOT 50
|
||||||
#define TK_CACHELAST 51
|
#define TK_EXISTS 51
|
||||||
#define TK_COMP 52
|
#define TK_BLOCKS 52
|
||||||
#define TK_DAYS 53
|
#define TK_CACHE 53
|
||||||
#define TK_NK_VARIABLE 54
|
#define TK_CACHELAST 54
|
||||||
#define TK_FSYNC 55
|
#define TK_COMP 55
|
||||||
#define TK_MAXROWS 56
|
#define TK_DAYS 56
|
||||||
#define TK_MINROWS 57
|
#define TK_NK_VARIABLE 57
|
||||||
#define TK_KEEP 58
|
#define TK_FSYNC 58
|
||||||
#define TK_PRECISION 59
|
#define TK_MAXROWS 59
|
||||||
#define TK_QUORUM 60
|
#define TK_MINROWS 60
|
||||||
#define TK_REPLICA 61
|
#define TK_KEEP 61
|
||||||
#define TK_TTL 62
|
#define TK_PRECISION 62
|
||||||
#define TK_WAL 63
|
#define TK_QUORUM 63
|
||||||
#define TK_VGROUPS 64
|
#define TK_REPLICA 64
|
||||||
#define TK_SINGLE_STABLE 65
|
#define TK_TTL 65
|
||||||
#define TK_STREAM_MODE 66
|
#define TK_WAL 66
|
||||||
#define TK_RETENTIONS 67
|
#define TK_VGROUPS 67
|
||||||
#define TK_NK_COMMA 68
|
#define TK_SINGLE_STABLE 68
|
||||||
#define TK_NK_COLON 69
|
#define TK_STREAM_MODE 69
|
||||||
#define TK_TABLE 70
|
#define TK_RETENTIONS 70
|
||||||
#define TK_NK_LP 71
|
#define TK_NK_COMMA 71
|
||||||
#define TK_NK_RP 72
|
#define TK_NK_COLON 72
|
||||||
#define TK_STABLE 73
|
#define TK_TABLE 73
|
||||||
#define TK_ADD 74
|
#define TK_NK_LP 74
|
||||||
#define TK_COLUMN 75
|
#define TK_NK_RP 75
|
||||||
#define TK_MODIFY 76
|
#define TK_STABLE 76
|
||||||
#define TK_RENAME 77
|
#define TK_ADD 77
|
||||||
#define TK_TAG 78
|
#define TK_COLUMN 78
|
||||||
#define TK_SET 79
|
#define TK_MODIFY 79
|
||||||
#define TK_NK_EQ 80
|
#define TK_RENAME 80
|
||||||
#define TK_USING 81
|
#define TK_TAG 81
|
||||||
#define TK_TAGS 82
|
#define TK_SET 82
|
||||||
#define TK_NK_DOT 83
|
#define TK_NK_EQ 83
|
||||||
#define TK_COMMENT 84
|
#define TK_USING 84
|
||||||
#define TK_BOOL 85
|
#define TK_TAGS 85
|
||||||
#define TK_TINYINT 86
|
#define TK_NK_DOT 86
|
||||||
#define TK_SMALLINT 87
|
#define TK_COMMENT 87
|
||||||
#define TK_INT 88
|
#define TK_BOOL 88
|
||||||
#define TK_INTEGER 89
|
#define TK_TINYINT 89
|
||||||
#define TK_BIGINT 90
|
#define TK_SMALLINT 90
|
||||||
#define TK_FLOAT 91
|
#define TK_INT 91
|
||||||
#define TK_DOUBLE 92
|
#define TK_INTEGER 92
|
||||||
#define TK_BINARY 93
|
#define TK_BIGINT 93
|
||||||
#define TK_TIMESTAMP 94
|
#define TK_FLOAT 94
|
||||||
#define TK_NCHAR 95
|
#define TK_DOUBLE 95
|
||||||
#define TK_UNSIGNED 96
|
#define TK_BINARY 96
|
||||||
#define TK_JSON 97
|
#define TK_TIMESTAMP 97
|
||||||
#define TK_VARCHAR 98
|
#define TK_NCHAR 98
|
||||||
#define TK_MEDIUMBLOB 99
|
#define TK_UNSIGNED 99
|
||||||
#define TK_BLOB 100
|
#define TK_JSON 100
|
||||||
#define TK_VARBINARY 101
|
#define TK_VARCHAR 101
|
||||||
#define TK_DECIMAL 102
|
#define TK_MEDIUMBLOB 102
|
||||||
#define TK_SMA 103
|
#define TK_BLOB 103
|
||||||
#define TK_ROLLUP 104
|
#define TK_VARBINARY 104
|
||||||
#define TK_FILE_FACTOR 105
|
#define TK_DECIMAL 105
|
||||||
#define TK_NK_FLOAT 106
|
#define TK_SMA 106
|
||||||
#define TK_DELAY 107
|
#define TK_ROLLUP 107
|
||||||
#define TK_SHOW 108
|
#define TK_FILE_FACTOR 108
|
||||||
#define TK_DATABASES 109
|
#define TK_NK_FLOAT 109
|
||||||
#define TK_TABLES 110
|
#define TK_DELAY 110
|
||||||
#define TK_STABLES 111
|
#define TK_SHOW 111
|
||||||
#define TK_MNODES 112
|
#define TK_DATABASES 112
|
||||||
#define TK_MODULES 113
|
#define TK_TABLES 113
|
||||||
#define TK_QNODES 114
|
#define TK_STABLES 114
|
||||||
#define TK_FUNCTIONS 115
|
#define TK_MNODES 115
|
||||||
#define TK_INDEXES 116
|
#define TK_MODULES 116
|
||||||
#define TK_FROM 117
|
#define TK_QNODES 117
|
||||||
#define TK_ACCOUNTS 118
|
#define TK_FUNCTIONS 118
|
||||||
#define TK_APPS 119
|
#define TK_INDEXES 119
|
||||||
#define TK_CONNECTIONS 120
|
#define TK_FROM 120
|
||||||
#define TK_LICENCE 121
|
#define TK_ACCOUNTS 121
|
||||||
#define TK_QUERIES 122
|
#define TK_APPS 122
|
||||||
#define TK_SCORES 123
|
#define TK_CONNECTIONS 123
|
||||||
#define TK_TOPICS 124
|
#define TK_LICENCE 124
|
||||||
#define TK_VARIABLES 125
|
#define TK_QUERIES 125
|
||||||
#define TK_LIKE 126
|
#define TK_SCORES 126
|
||||||
#define TK_INDEX 127
|
#define TK_TOPICS 127
|
||||||
#define TK_FULLTEXT 128
|
#define TK_VARIABLES 128
|
||||||
#define TK_FUNCTION 129
|
#define TK_BNODES 129
|
||||||
#define TK_INTERVAL 130
|
#define TK_SNODES 130
|
||||||
#define TK_TOPIC 131
|
#define TK_LIKE 131
|
||||||
#define TK_AS 132
|
#define TK_INDEX 132
|
||||||
#define TK_DESC 133
|
#define TK_FULLTEXT 133
|
||||||
#define TK_DESCRIBE 134
|
#define TK_FUNCTION 134
|
||||||
#define TK_RESET 135
|
#define TK_INTERVAL 135
|
||||||
#define TK_QUERY 136
|
#define TK_TOPIC 136
|
||||||
#define TK_EXPLAIN 137
|
#define TK_AS 137
|
||||||
#define TK_ANALYZE 138
|
#define TK_DESC 138
|
||||||
#define TK_VERBOSE 139
|
#define TK_DESCRIBE 139
|
||||||
#define TK_NK_BOOL 140
|
#define TK_RESET 140
|
||||||
#define TK_RATIO 141
|
#define TK_QUERY 141
|
||||||
#define TK_COMPACT 142
|
#define TK_EXPLAIN 142
|
||||||
#define TK_VNODES 143
|
#define TK_ANALYZE 143
|
||||||
#define TK_IN 144
|
#define TK_VERBOSE 144
|
||||||
#define TK_OUTPUTTYPE 145
|
#define TK_NK_BOOL 145
|
||||||
#define TK_AGGREGATE 146
|
#define TK_RATIO 146
|
||||||
#define TK_BUFSIZE 147
|
#define TK_COMPACT 147
|
||||||
#define TK_STREAM 148
|
#define TK_VNODES 148
|
||||||
#define TK_INTO 149
|
#define TK_IN 149
|
||||||
#define TK_KILL 150
|
#define TK_OUTPUTTYPE 150
|
||||||
#define TK_CONNECTION 151
|
#define TK_AGGREGATE 151
|
||||||
#define TK_MERGE 152
|
#define TK_BUFSIZE 152
|
||||||
#define TK_VGROUP 153
|
#define TK_STREAM 153
|
||||||
#define TK_REDISTRIBUTE 154
|
#define TK_INTO 154
|
||||||
#define TK_SPLIT 155
|
#define TK_KILL 155
|
||||||
#define TK_SYNCDB 156
|
#define TK_CONNECTION 156
|
||||||
#define TK_NULL 157
|
#define TK_MERGE 157
|
||||||
#define TK_FIRST 158
|
#define TK_VGROUP 158
|
||||||
#define TK_LAST 159
|
#define TK_REDISTRIBUTE 159
|
||||||
#define TK_NOW 160
|
#define TK_SPLIT 160
|
||||||
#define TK_ROWTS 161
|
#define TK_SYNCDB 161
|
||||||
#define TK_TBNAME 162
|
#define TK_NULL 162
|
||||||
#define TK_QSTARTTS 163
|
#define TK_FIRST 163
|
||||||
#define TK_QENDTS 164
|
#define TK_LAST 164
|
||||||
#define TK_WSTARTTS 165
|
#define TK_NOW 165
|
||||||
#define TK_WENDTS 166
|
#define TK_ROWTS 166
|
||||||
#define TK_WDURATION 167
|
#define TK_TBNAME 167
|
||||||
#define TK_BETWEEN 168
|
#define TK_QSTARTTS 168
|
||||||
#define TK_IS 169
|
#define TK_QENDTS 169
|
||||||
#define TK_NK_LT 170
|
#define TK_WSTARTTS 170
|
||||||
#define TK_NK_GT 171
|
#define TK_WENDTS 171
|
||||||
#define TK_NK_LE 172
|
#define TK_WDURATION 172
|
||||||
#define TK_NK_GE 173
|
#define TK_BETWEEN 173
|
||||||
#define TK_NK_NE 174
|
#define TK_IS 174
|
||||||
#define TK_MATCH 175
|
#define TK_NK_LT 175
|
||||||
#define TK_NMATCH 176
|
#define TK_NK_GT 176
|
||||||
#define TK_JOIN 177
|
#define TK_NK_LE 177
|
||||||
#define TK_INNER 178
|
#define TK_NK_GE 178
|
||||||
#define TK_SELECT 179
|
#define TK_NK_NE 179
|
||||||
#define TK_DISTINCT 180
|
#define TK_MATCH 180
|
||||||
#define TK_WHERE 181
|
#define TK_NMATCH 181
|
||||||
#define TK_PARTITION 182
|
#define TK_JOIN 182
|
||||||
#define TK_BY 183
|
#define TK_INNER 183
|
||||||
#define TK_SESSION 184
|
#define TK_SELECT 184
|
||||||
#define TK_STATE_WINDOW 185
|
#define TK_DISTINCT 185
|
||||||
#define TK_SLIDING 186
|
#define TK_WHERE 186
|
||||||
#define TK_FILL 187
|
#define TK_PARTITION 187
|
||||||
#define TK_VALUE 188
|
#define TK_BY 188
|
||||||
#define TK_NONE 189
|
#define TK_SESSION 189
|
||||||
#define TK_PREV 190
|
#define TK_STATE_WINDOW 190
|
||||||
#define TK_LINEAR 191
|
#define TK_SLIDING 191
|
||||||
#define TK_NEXT 192
|
#define TK_FILL 192
|
||||||
#define TK_GROUP 193
|
#define TK_VALUE 193
|
||||||
#define TK_HAVING 194
|
#define TK_NONE 194
|
||||||
#define TK_ORDER 195
|
#define TK_PREV 195
|
||||||
#define TK_SLIMIT 196
|
#define TK_LINEAR 196
|
||||||
#define TK_SOFFSET 197
|
#define TK_NEXT 197
|
||||||
#define TK_LIMIT 198
|
#define TK_GROUP 198
|
||||||
#define TK_OFFSET 199
|
#define TK_HAVING 199
|
||||||
#define TK_ASC 200
|
#define TK_ORDER 200
|
||||||
#define TK_NULLS 201
|
#define TK_SLIMIT 201
|
||||||
|
#define TK_SOFFSET 202
|
||||||
|
#define TK_LIMIT 203
|
||||||
|
#define TK_OFFSET 204
|
||||||
|
#define TK_ASC 205
|
||||||
|
#define TK_NULLS 206
|
||||||
|
|
||||||
#define TK_NK_SPACE 300
|
#define TK_NK_SPACE 300
|
||||||
#define TK_NK_COMMENT 301
|
#define TK_NK_COMMENT 301
|
||||||
|
|
|
@ -230,15 +230,15 @@ typedef struct SDropIndexStmt {
|
||||||
char tableName[TSDB_TABLE_NAME_LEN];
|
char tableName[TSDB_TABLE_NAME_LEN];
|
||||||
} SDropIndexStmt;
|
} SDropIndexStmt;
|
||||||
|
|
||||||
typedef struct SCreateQnodeStmt {
|
typedef struct SCreateComponentNodeStmt {
|
||||||
ENodeType type;
|
ENodeType type;
|
||||||
int32_t dnodeId;
|
int32_t dnodeId;
|
||||||
} SCreateQnodeStmt;
|
} SCreateComponentNodeStmt;
|
||||||
|
|
||||||
typedef struct SDropQnodeStmt {
|
typedef struct SDropComponentNodeStmt {
|
||||||
ENodeType type;
|
ENodeType type;
|
||||||
int32_t dnodeId;
|
int32_t dnodeId;
|
||||||
} SDropQnodeStmt;
|
} SDropComponentNodeStmt;
|
||||||
|
|
||||||
typedef struct SCreateTopicStmt {
|
typedef struct SCreateTopicStmt {
|
||||||
ENodeType type;
|
ENodeType type;
|
||||||
|
|
|
@ -105,6 +105,12 @@ typedef enum ENodeType {
|
||||||
QUERY_NODE_DROP_INDEX_STMT,
|
QUERY_NODE_DROP_INDEX_STMT,
|
||||||
QUERY_NODE_CREATE_QNODE_STMT,
|
QUERY_NODE_CREATE_QNODE_STMT,
|
||||||
QUERY_NODE_DROP_QNODE_STMT,
|
QUERY_NODE_DROP_QNODE_STMT,
|
||||||
|
QUERY_NODE_CREATE_BNODE_STMT,
|
||||||
|
QUERY_NODE_DROP_BNODE_STMT,
|
||||||
|
QUERY_NODE_CREATE_SNODE_STMT,
|
||||||
|
QUERY_NODE_DROP_SNODE_STMT,
|
||||||
|
QUERY_NODE_CREATE_MNODE_STMT,
|
||||||
|
QUERY_NODE_DROP_MNODE_STMT,
|
||||||
QUERY_NODE_CREATE_TOPIC_STMT,
|
QUERY_NODE_CREATE_TOPIC_STMT,
|
||||||
QUERY_NODE_DROP_TOPIC_STMT,
|
QUERY_NODE_DROP_TOPIC_STMT,
|
||||||
QUERY_NODE_ALTER_LOCAL_STMT,
|
QUERY_NODE_ALTER_LOCAL_STMT,
|
||||||
|
@ -142,6 +148,8 @@ typedef enum ENodeType {
|
||||||
QUERY_NODE_SHOW_SCORES_STMT,
|
QUERY_NODE_SHOW_SCORES_STMT,
|
||||||
QUERY_NODE_SHOW_TOPICS_STMT,
|
QUERY_NODE_SHOW_TOPICS_STMT,
|
||||||
QUERY_NODE_SHOW_VARIABLE_STMT,
|
QUERY_NODE_SHOW_VARIABLE_STMT,
|
||||||
|
QUERY_NODE_SHOW_BNODES_STMT,
|
||||||
|
QUERY_NODE_SHOW_SNODES_STMT,
|
||||||
QUERY_NODE_KILL_CONNECTION_STMT,
|
QUERY_NODE_KILL_CONNECTION_STMT,
|
||||||
QUERY_NODE_KILL_QUERY_STMT,
|
QUERY_NODE_KILL_QUERY_STMT,
|
||||||
|
|
||||||
|
|
|
@ -64,31 +64,35 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_RPC_INVALID_VERSION TAOS_DEF_ERROR_CODE(0, 0x0016)
|
#define TSDB_CODE_RPC_INVALID_VERSION TAOS_DEF_ERROR_CODE(0, 0x0016)
|
||||||
|
|
||||||
//common & util
|
//common & util
|
||||||
#define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0100)
|
#define TSDB_CODE_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0100)
|
||||||
#define TSDB_CODE_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0101)
|
#define TSDB_CODE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0101)
|
||||||
#define TSDB_CODE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0102)
|
#define TSDB_CODE_OUT_OF_SHM_MEM TAOS_DEF_ERROR_CODE(0, 0x0102)
|
||||||
#define TSDB_CODE_INVALID_PTR TAOS_DEF_ERROR_CODE(0, 0x0103)
|
#define TSDB_CODE_INVALID_SHM_ID TAOS_DEF_ERROR_CODE(0, 0x0103)
|
||||||
#define TSDB_CODE_MEMORY_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0104)
|
#define TSDB_CODE_INVALID_PTR TAOS_DEF_ERROR_CODE(0, 0x0104)
|
||||||
#define TSDB_CODE_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0106)
|
#define TSDB_CODE_INVALID_MSG TAOS_DEF_ERROR_CODE(0, 0x0105)
|
||||||
#define TSDB_CODE_CHECKSUM_ERROR TAOS_DEF_ERROR_CODE(0, 0x0107)
|
#define TSDB_CODE_INVALID_MSG_LEN TAOS_DEF_ERROR_CODE(0, 0x0106)
|
||||||
#define TSDB_CODE_INVALID_MSG TAOS_DEF_ERROR_CODE(0, 0x0108)
|
#define TSDB_CODE_INVALID_PARA TAOS_DEF_ERROR_CODE(0, 0x0107)
|
||||||
#define TSDB_CODE_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0109)
|
#define TSDB_CODE_INVALID_CFG TAOS_DEF_ERROR_CODE(0, 0x0108)
|
||||||
#define TSDB_CODE_INVALID_PARA TAOS_DEF_ERROR_CODE(0, 0x010A)
|
#define TSDB_CODE_INVALID_OPTION TAOS_DEF_ERROR_CODE(0, 0x0109)
|
||||||
#define TSDB_CODE_REPEAT_INIT TAOS_DEF_ERROR_CODE(0, 0x010B)
|
#define TSDB_CODE_INVALID_JSON_FORMAT TAOS_DEF_ERROR_CODE(0, 0x010A)
|
||||||
#define TSDB_CODE_CFG_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x010C)
|
#define TSDB_CODE_INVALID_VERSION_NUMBER TAOS_DEF_ERROR_CODE(0, 0x010B)
|
||||||
#define TSDB_CODE_INVALID_CFG TAOS_DEF_ERROR_CODE(0, 0x010D)
|
#define TSDB_CODE_INVALID_VERSION_STRING TAOS_DEF_ERROR_CODE(0, 0x010C)
|
||||||
#define TSDB_CODE_OUT_OF_SHM_MEM TAOS_DEF_ERROR_CODE(0, 0x010E)
|
#define TSDB_CODE_VERSION_NOT_COMPATIBLE TAOS_DEF_ERROR_CODE(0, 0x010D)
|
||||||
#define TSDB_CODE_INVALID_SHM_ID TAOS_DEF_ERROR_CODE(0, 0x010F)
|
#define TSDB_CODE_MEMORY_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x010E)
|
||||||
#define TSDB_CODE_REF_NO_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0110)
|
#define TSDB_CODE_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x010F)
|
||||||
#define TSDB_CODE_REF_FULL TAOS_DEF_ERROR_CODE(0, 0x0111)
|
#define TSDB_CODE_CHECKSUM_ERROR TAOS_DEF_ERROR_CODE(0, 0x0110)
|
||||||
#define TSDB_CODE_REF_ID_REMOVED TAOS_DEF_ERROR_CODE(0, 0x0112)
|
#define TSDB_CODE_COMPRESS_ERROR TAOS_DEF_ERROR_CODE(0, 0x0111)
|
||||||
#define TSDB_CODE_REF_INVALID_ID TAOS_DEF_ERROR_CODE(0, 0x0113)
|
#define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0112)
|
||||||
#define TSDB_CODE_REF_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0114)
|
#define TSDB_CODE_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0113)
|
||||||
#define TSDB_CODE_REF_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0115)
|
#define TSDB_CODE_CFG_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x0114)
|
||||||
#define TSDB_CODE_INVALID_VERSION_NUMBER TAOS_DEF_ERROR_CODE(0, 0x0120)
|
#define TSDB_CODE_REPEAT_INIT TAOS_DEF_ERROR_CODE(0, 0x0115)
|
||||||
#define TSDB_CODE_INVALID_VERSION_STRING TAOS_DEF_ERROR_CODE(0, 0x0121)
|
|
||||||
#define TSDB_CODE_VERSION_NOT_COMPATIBLE TAOS_DEF_ERROR_CODE(0, 0x0122)
|
#define TSDB_CODE_REF_NO_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0140)
|
||||||
#define TSDB_CODE_COMPRESS_ERROR TAOS_DEF_ERROR_CODE(0, 0x0123)
|
#define TSDB_CODE_REF_FULL TAOS_DEF_ERROR_CODE(0, 0x0141)
|
||||||
|
#define TSDB_CODE_REF_ID_REMOVED TAOS_DEF_ERROR_CODE(0, 0x0152)
|
||||||
|
#define TSDB_CODE_REF_INVALID_ID TAOS_DEF_ERROR_CODE(0, 0x0153)
|
||||||
|
#define TSDB_CODE_REF_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0154)
|
||||||
|
#define TSDB_CODE_REF_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0155)
|
||||||
|
|
||||||
//client
|
//client
|
||||||
#define TSDB_CODE_TSC_INVALID_OPERATION TAOS_DEF_ERROR_CODE(0, 0x0200)
|
#define TSDB_CODE_TSC_INVALID_OPERATION TAOS_DEF_ERROR_CODE(0, 0x0200)
|
||||||
|
@ -284,17 +288,9 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_MND_INVALID_SMA_OPTION TAOS_DEF_ERROR_CODE(0, 0x0402)
|
#define TSDB_CODE_MND_INVALID_SMA_OPTION TAOS_DEF_ERROR_CODE(0, 0x0402)
|
||||||
|
|
||||||
// dnode
|
// dnode
|
||||||
#define TSDB_CODE_DND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x04A0)
|
#define TSDB_CODE_NODE_OFFLINE TAOS_DEF_ERROR_CODE(0, 0x04A1)
|
||||||
#define TSDB_CODE_DND_OFFLINE TAOS_DEF_ERROR_CODE(0, 0x04A1)
|
|
||||||
#define TSDB_CODE_DND_INVALID_MSG_LEN TAOS_DEF_ERROR_CODE(0, 0x04A2)
|
|
||||||
#define TSDB_CODE_NODE_ALREADY_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x04A3)
|
#define TSDB_CODE_NODE_ALREADY_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x04A3)
|
||||||
#define TSDB_CODE_NODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x04A4)
|
#define TSDB_CODE_NODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x04A4)
|
||||||
#define TSDB_CODE_NODE_PARSE_FILE_ERROR TAOS_DEF_ERROR_CODE(0, 0x04A5)
|
|
||||||
#define TSDB_CODE_NODE_INVALID_OPTION TAOS_DEF_ERROR_CODE(0, 0x04A6)
|
|
||||||
#define TSDB_CODE_DND_VNODE_ALREADY_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x04A7)
|
|
||||||
#define TSDB_CODE_DND_VNODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x04A8)
|
|
||||||
#define TSDB_CODE_DND_VNODE_INVALID_OPTION TAOS_DEF_ERROR_CODE(0, 0x04A9)
|
|
||||||
#define TSDB_CODE_DND_VNODE_TOO_MANY_VNODES TAOS_DEF_ERROR_CODE(0, 0x04AA)
|
|
||||||
|
|
||||||
// vnode
|
// vnode
|
||||||
#define TSDB_CODE_VND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0500)
|
#define TSDB_CODE_VND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0500)
|
||||||
|
|
|
@ -110,6 +110,8 @@ extern const int32_t TYPE_BYTES[15];
|
||||||
#define TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED "user_table_distributed"
|
#define TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED "user_table_distributed"
|
||||||
#define TSDB_INS_TABLE_USER_USERS "user_users"
|
#define TSDB_INS_TABLE_USER_USERS "user_users"
|
||||||
#define TSDB_INS_TABLE_VGROUPS "vgroups"
|
#define TSDB_INS_TABLE_VGROUPS "vgroups"
|
||||||
|
#define TSDB_INS_TABLE_BNODES "bnodes"
|
||||||
|
#define TSDB_INS_TABLE_SNODES "snodes"
|
||||||
|
|
||||||
#define TSDB_INDEX_TYPE_SMA "SMA"
|
#define TSDB_INDEX_TYPE_SMA "SMA"
|
||||||
#define TSDB_INDEX_TYPE_FULLTEXT "FULLTEXT"
|
#define TSDB_INDEX_TYPE_FULLTEXT "FULLTEXT"
|
||||||
|
|
|
@ -1203,7 +1203,7 @@ int32_t tDeserializeSGetUserAuthRsp(void *buf, int32_t bufLen, SGetUserAuthRsp *
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tSerializeSMCreateDropQSBNodeReq(void *buf, int32_t bufLen, SMCreateQnodeReq *pReq) {
|
int32_t tSerializeSCreateDropMQSBNodeReq(void *buf, int32_t bufLen, SMCreateQnodeReq *pReq) {
|
||||||
SCoder encoder = {0};
|
SCoder encoder = {0};
|
||||||
tCoderInit(&encoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_ENCODER);
|
tCoderInit(&encoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_ENCODER);
|
||||||
|
|
||||||
|
@ -1216,7 +1216,7 @@ int32_t tSerializeSMCreateDropQSBNodeReq(void *buf, int32_t bufLen, SMCreateQnod
|
||||||
return tlen;
|
return tlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tDeserializeSMCreateDropQSBNodeReq(void *buf, int32_t bufLen, SMCreateQnodeReq *pReq) {
|
int32_t tDeserializeSCreateDropMQSBNodeReq(void *buf, int32_t bufLen, SMCreateQnodeReq *pReq) {
|
||||||
SCoder decoder = {0};
|
SCoder decoder = {0};
|
||||||
tCoderInit(&decoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_DECODER);
|
tCoderInit(&decoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_DECODER);
|
||||||
|
|
||||||
|
@ -1257,14 +1257,6 @@ int32_t tDeserializeSDropDnodeReq(void *buf, int32_t bufLen, SDropDnodeReq *pReq
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tSerializeSMCreateDropMnodeReq(void *buf, int32_t bufLen, SMCreateMnodeReq *pReq) {
|
|
||||||
return tSerializeSMCreateDropQSBNodeReq(buf, bufLen, (SMCreateQnodeReq *)pReq);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t tDeserializeSMCreateDropMnodeReq(void *buf, int32_t bufLen, SMCreateMnodeReq *pReq) {
|
|
||||||
return tDeserializeSMCreateDropQSBNodeReq(buf, bufLen, (SMCreateQnodeReq *)pReq);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t tSerializeSMCfgDnodeReq(void *buf, int32_t bufLen, SMCfgDnodeReq *pReq) {
|
int32_t tSerializeSMCfgDnodeReq(void *buf, int32_t bufLen, SMCfgDnodeReq *pReq) {
|
||||||
SCoder encoder = {0};
|
SCoder encoder = {0};
|
||||||
tCoderInit(&encoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_ENCODER);
|
tCoderInit(&encoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_ENCODER);
|
||||||
|
|
|
@ -16,8 +16,7 @@
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "bmInt.h"
|
#include "bmInt.h"
|
||||||
|
|
||||||
void bmGetMonitorInfo(SMgmtWrapper *pWrapper, SMonBmInfo *bmInfo) {
|
void bmGetMonitorInfo(SMgmtWrapper *pWrapper, SMonBmInfo *bmInfo) {}
|
||||||
}
|
|
||||||
|
|
||||||
int32_t bmProcessGetMonBmInfoReq(SMgmtWrapper *pWrapper, SNodeMsg *pReq) {
|
int32_t bmProcessGetMonBmInfoReq(SMgmtWrapper *pWrapper, SNodeMsg *pReq) {
|
||||||
SMonBmInfo bmInfo = {0};
|
SMonBmInfo bmInfo = {0};
|
||||||
|
@ -49,13 +48,13 @@ int32_t bmProcessCreateReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
||||||
SRpcMsg *pReq = &pMsg->rpcMsg;
|
SRpcMsg *pReq = &pMsg->rpcMsg;
|
||||||
|
|
||||||
SDCreateBnodeReq createReq = {0};
|
SDCreateBnodeReq createReq = {0};
|
||||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (createReq.dnodeId != pDnode->dnodeId) {
|
if (createReq.dnodeId != pDnode->dnodeId) {
|
||||||
terrno = TSDB_CODE_NODE_INVALID_OPTION;
|
terrno = TSDB_CODE_INVALID_OPTION;
|
||||||
dError("failed to create bnode since %s, input:%d cur:%d", terrstr(), createReq.dnodeId, pDnode->dnodeId);
|
dError("failed to create bnode since %s, input:%d cur:%d", terrstr(), createReq.dnodeId, pDnode->dnodeId);
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -68,13 +67,13 @@ int32_t bmProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
||||||
SRpcMsg *pReq = &pMsg->rpcMsg;
|
SRpcMsg *pReq = &pMsg->rpcMsg;
|
||||||
|
|
||||||
SDDropBnodeReq dropReq = {0};
|
SDDropBnodeReq dropReq = {0};
|
||||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dropReq.dnodeId != pDnode->dnodeId) {
|
if (dropReq.dnodeId != pDnode->dnodeId) {
|
||||||
terrno = TSDB_CODE_NODE_INVALID_OPTION;
|
terrno = TSDB_CODE_INVALID_OPTION;
|
||||||
dError("failed to drop bnode since %s", terrstr());
|
dError("failed to drop bnode since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "bmInt.h"
|
#include "bmInt.h"
|
||||||
|
|
||||||
static void bmSendErrorRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t code) {
|
static void bmSendErrorRsp(SNodeMsg *pMsg, int32_t code) {
|
||||||
SRpcMsg rpcRsp = {.handle = pMsg->rpcMsg.handle, .ahandle = pMsg->rpcMsg.ahandle, .code = code};
|
SRpcMsg rpcRsp = {.handle = pMsg->rpcMsg.handle, .ahandle = pMsg->rpcMsg.ahandle, .code = code};
|
||||||
tmsgSendRsp(&rpcRsp);
|
tmsgSendRsp(&rpcRsp);
|
||||||
|
|
||||||
|
@ -25,15 +25,17 @@ static void bmSendErrorRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t code)
|
||||||
taosFreeQitem(pMsg);
|
taosFreeQitem(pMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bmSendErrorRsps(SMgmtWrapper *pWrapper, STaosQall *qall, int32_t numOfMsgs, int32_t code) {
|
static void bmSendErrorRsps(STaosQall *qall, int32_t numOfMsgs, int32_t code) {
|
||||||
for (int32_t i = 0; i < numOfMsgs; ++i) {
|
for (int32_t i = 0; i < numOfMsgs; ++i) {
|
||||||
SNodeMsg *pMsg = NULL;
|
SNodeMsg *pMsg = NULL;
|
||||||
taosGetQitem(qall, (void **)&pMsg);
|
taosGetQitem(qall, (void **)&pMsg);
|
||||||
bmSendErrorRsp(pWrapper, pMsg, code);
|
if (pMsg != NULL) {
|
||||||
|
bmSendErrorRsp(pMsg, code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void bmSendRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t code) {
|
static inline void bmSendRsp(SNodeMsg *pMsg, int32_t code) {
|
||||||
SRpcMsg rsp = {.handle = pMsg->rpcMsg.handle,
|
SRpcMsg rsp = {.handle = pMsg->rpcMsg.handle,
|
||||||
.ahandle = pMsg->rpcMsg.ahandle,
|
.ahandle = pMsg->rpcMsg.ahandle,
|
||||||
.code = code,
|
.code = code,
|
||||||
|
@ -42,20 +44,22 @@ static inline void bmSendRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t cod
|
||||||
tmsgSendRsp(&rsp);
|
tmsgSendRsp(&rsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bmProcessMonQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
static void bmProcessMonitorQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
||||||
SBnodeMgmt *pMgmt = pInfo->ahandle;
|
SBnodeMgmt *pMgmt = pInfo->ahandle;
|
||||||
|
|
||||||
dTrace("msg:%p, get from bnode monitor queue", pMsg);
|
dTrace("msg:%p, get from bnode-monitor queue", pMsg);
|
||||||
SRpcMsg *pRpc = &pMsg->rpcMsg;
|
SRpcMsg *pRpc = &pMsg->rpcMsg;
|
||||||
int32_t code = -1;
|
int32_t code = -1;
|
||||||
|
|
||||||
if (pMsg->rpcMsg.msgType == TDMT_MON_BM_INFO) {
|
if (pMsg->rpcMsg.msgType == TDMT_MON_BM_INFO) {
|
||||||
code = bmProcessGetMonBmInfoReq(pMgmt->pWrapper, pMsg);
|
code = bmProcessGetMonBmInfoReq(pMgmt->pWrapper, pMsg);
|
||||||
|
} else {
|
||||||
|
terrno = TSDB_CODE_MSG_NOT_PROCESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pRpc->msgType & 1U) {
|
if (pRpc->msgType & 1U) {
|
||||||
if (code != 0 && terrno != 0) code = terrno;
|
if (code != 0 && terrno != 0) code = terrno;
|
||||||
bmSendRsp(pMgmt->pWrapper, pMsg, code);
|
bmSendRsp(pMsg, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code));
|
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code));
|
||||||
|
@ -64,21 +68,22 @@ static void bmProcessMonQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) {
|
static void bmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) {
|
||||||
SBnodeMgmt *pMgmt = pInfo->ahandle;
|
SBnodeMgmt *pMgmt = pInfo->ahandle;
|
||||||
SMgmtWrapper *pWrapper = pMgmt->pWrapper;
|
|
||||||
|
|
||||||
SArray *pArray = taosArrayInit(numOfMsgs, sizeof(SNodeMsg *));
|
SArray *pArray = taosArrayInit(numOfMsgs, sizeof(SNodeMsg *));
|
||||||
if (pArray == NULL) {
|
if (pArray == NULL) {
|
||||||
bmSendErrorRsps(pWrapper, qall, numOfMsgs, TSDB_CODE_OUT_OF_MEMORY);
|
bmSendErrorRsps(qall, numOfMsgs, TSDB_CODE_OUT_OF_MEMORY);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < numOfMsgs; ++i) {
|
for (int32_t i = 0; i < numOfMsgs; ++i) {
|
||||||
SNodeMsg *pMsg = NULL;
|
SNodeMsg *pMsg = NULL;
|
||||||
taosGetQitem(qall, (void **)&pMsg);
|
taosGetQitem(qall, (void **)&pMsg);
|
||||||
dTrace("msg:%p, will be processed in bnode queue", pMsg);
|
if (pMsg != NULL) {
|
||||||
if (taosArrayPush(pArray, &pMsg) == NULL) {
|
dTrace("msg:%p, get from bnode-write queue", pMsg);
|
||||||
bmSendErrorRsp(pWrapper, pMsg, TSDB_CODE_OUT_OF_MEMORY);
|
if (taosArrayPush(pArray, &pMsg) == NULL) {
|
||||||
|
bmSendErrorRsp(pMsg, TSDB_CODE_OUT_OF_MEMORY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,9 +91,11 @@ static void bmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
|
||||||
|
|
||||||
for (size_t i = 0; i < numOfMsgs; i++) {
|
for (size_t i = 0; i < numOfMsgs; i++) {
|
||||||
SNodeMsg *pMsg = *(SNodeMsg **)taosArrayGet(pArray, i);
|
SNodeMsg *pMsg = *(SNodeMsg **)taosArrayGet(pArray, i);
|
||||||
dTrace("msg:%p, is freed", pMsg);
|
if (pMsg != NULL) {
|
||||||
rpcFreeCont(pMsg->rpcMsg.pCont);
|
dTrace("msg:%p, is freed", pMsg);
|
||||||
taosFreeQitem(pMsg);
|
rpcFreeCont(pMsg->rpcMsg.pCont);
|
||||||
|
taosFreeQitem(pMsg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
taosArrayDestroy(pArray);
|
taosArrayDestroy(pArray);
|
||||||
}
|
}
|
||||||
|
@ -120,12 +127,12 @@ int32_t bmStartWorker(SBnodeMgmt *pMgmt) {
|
||||||
|
|
||||||
if (tsMultiProcess) {
|
if (tsMultiProcess) {
|
||||||
SSingleWorkerCfg mCfg = {
|
SSingleWorkerCfg mCfg = {
|
||||||
.min = 1, .max = 1, .name = "bnode-monitor", .fp = (FItem)bmProcessMonQueue, .param = pMgmt};
|
.min = 1, .max = 1, .name = "bnode-monitor", .fp = (FItem)bmProcessMonitorQueue, .param = pMgmt};
|
||||||
if (tSingleWorkerInit(&pMgmt->monitorWorker, &mCfg) != 0) {
|
if (tSingleWorkerInit(&pMgmt->monitorWorker, &mCfg) != 0) {
|
||||||
dError("failed to start bnode-monitor worker since %s", terrstr());
|
dError("failed to start bnode-monitor worker since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dDebug("bnode workers are initialized");
|
dDebug("bnode workers are initialized");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -21,7 +21,7 @@ static bool dmIsEpChanged(SDnodeMgmt *pMgmt, int32_t dnodeId, const char *ep);
|
||||||
static void dmResetDnodes(SDnodeMgmt *pMgmt, SArray *dnodeEps);
|
static void dmResetDnodes(SDnodeMgmt *pMgmt, SArray *dnodeEps);
|
||||||
|
|
||||||
int32_t dmReadFile(SDnodeMgmt *pMgmt) {
|
int32_t dmReadFile(SDnodeMgmt *pMgmt) {
|
||||||
int32_t code = TSDB_CODE_NODE_PARSE_FILE_ERROR;
|
int32_t code = TSDB_CODE_INVALID_JSON_FORMAT;
|
||||||
int32_t len = 0;
|
int32_t len = 0;
|
||||||
int32_t maxLen = 256 * 1024;
|
int32_t maxLen = 256 * 1024;
|
||||||
char *content = taosMemoryCalloc(1, maxLen + 1);
|
char *content = taosMemoryCalloc(1, maxLen + 1);
|
||||||
|
|
|
@ -90,7 +90,7 @@ static int32_t dndNewProc(SMgmtWrapper *pWrapper, EDndType n) {
|
||||||
|
|
||||||
static void dndProcessProcHandle(void *handle) {
|
static void dndProcessProcHandle(void *handle) {
|
||||||
dWarn("handle:%p, the child process dies and send an offline rsp", handle);
|
dWarn("handle:%p, the child process dies and send an offline rsp", handle);
|
||||||
SRpcMsg rpcMsg = {.handle = handle, .code = TSDB_CODE_DND_OFFLINE};
|
SRpcMsg rpcMsg = {.handle = handle, .code = TSDB_CODE_NODE_OFFLINE};
|
||||||
rpcSendResponse(&rpcMsg);
|
rpcSendResponse(&rpcMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#define MAXLEN 1024
|
#define MAXLEN 1024
|
||||||
|
|
||||||
int32_t dndReadFile(SMgmtWrapper *pWrapper, bool *pDeployed) {
|
int32_t dndReadFile(SMgmtWrapper *pWrapper, bool *pDeployed) {
|
||||||
int32_t code = TSDB_CODE_NODE_PARSE_FILE_ERROR;
|
int32_t code = TSDB_CODE_INVALID_JSON_FORMAT;
|
||||||
int64_t len = 0;
|
int64_t len = 0;
|
||||||
char content[MAXLEN + 1] = {0};
|
char content[MAXLEN + 1] = {0};
|
||||||
cJSON *root = NULL;
|
cJSON *root = NULL;
|
||||||
|
@ -159,7 +159,7 @@ int32_t dndReadShmFile(SDnode *pDnode) {
|
||||||
if (taosReadFile(pFile, content, MAXLEN) > 0) {
|
if (taosReadFile(pFile, content, MAXLEN) > 0) {
|
||||||
root = cJSON_Parse(content);
|
root = cJSON_Parse(content);
|
||||||
if (root == NULL) {
|
if (root == NULL) {
|
||||||
terrno = TSDB_CODE_NODE_PARSE_FILE_ERROR;
|
terrno = TSDB_CODE_INVALID_JSON_FORMAT;
|
||||||
dError("failed to read %s since invalid json format", file);
|
dError("failed to read %s since invalid json format", file);
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,7 @@ static void dndProcessMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet) {
|
||||||
|
|
||||||
if (isReq && pMsg->pCont == NULL) {
|
if (isReq && pMsg->pCont == NULL) {
|
||||||
dError("req:%s not processed since its empty, handle:%p app:%p", TMSG_INFO(msgType), pMsg->handle, pMsg->ahandle);
|
dError("req:%s not processed since its empty, handle:%p app:%p", TMSG_INFO(msgType), pMsg->handle, pMsg->ahandle);
|
||||||
SRpcMsg rspMsg = {.handle = pMsg->handle, .code = TSDB_CODE_DND_INVALID_MSG_LEN, .ahandle = pMsg->ahandle};
|
SRpcMsg rspMsg = {.handle = pMsg->handle, .code = TSDB_CODE_INVALID_MSG_LEN, .ahandle = pMsg->ahandle};
|
||||||
rpcSendResponse(&rspMsg);
|
rpcSendResponse(&rspMsg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -338,7 +338,7 @@ int32_t dndInitMsgHandle(SDnode *pDnode) {
|
||||||
|
|
||||||
static int32_t dndSendRpcReq(STransMgmt *pMgmt, const SEpSet *pEpSet, SRpcMsg *pReq) {
|
static int32_t dndSendRpcReq(STransMgmt *pMgmt, const SEpSet *pEpSet, SRpcMsg *pReq) {
|
||||||
if (pMgmt->clientRpc == NULL) {
|
if (pMgmt->clientRpc == NULL) {
|
||||||
terrno = TSDB_CODE_DND_OFFLINE;
|
terrno = TSDB_CODE_NODE_OFFLINE;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,7 +359,7 @@ static void dndSendRpcRsp(SMgmtWrapper *pWrapper, const SRpcMsg *pRsp) {
|
||||||
|
|
||||||
static int32_t dndSendReq(SMgmtWrapper *pWrapper, const SEpSet *pEpSet, SRpcMsg *pReq) {
|
static int32_t dndSendReq(SMgmtWrapper *pWrapper, const SEpSet *pEpSet, SRpcMsg *pReq) {
|
||||||
if (dndGetStatus(pWrapper->pDnode) != DND_STAT_RUNNING) {
|
if (dndGetStatus(pWrapper->pDnode) != DND_STAT_RUNNING) {
|
||||||
terrno = TSDB_CODE_DND_OFFLINE;
|
terrno = TSDB_CODE_NODE_OFFLINE;
|
||||||
dError("failed to send rpc msg since %s, handle:%p", terrstr(), pReq->handle);
|
dError("failed to send rpc msg since %s, handle:%p", terrstr(), pReq->handle);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include "mmInt.h"
|
#include "mmInt.h"
|
||||||
|
|
||||||
int32_t mmReadFile(SMnodeMgmt *pMgmt, bool *pDeployed) {
|
int32_t mmReadFile(SMnodeMgmt *pMgmt, bool *pDeployed) {
|
||||||
int32_t code = TSDB_CODE_NODE_PARSE_FILE_ERROR;
|
int32_t code = TSDB_CODE_INVALID_JSON_FORMAT;
|
||||||
int32_t len = 0;
|
int32_t len = 0;
|
||||||
int32_t maxLen = 4096;
|
int32_t maxLen = 4096;
|
||||||
char *content = taosMemoryCalloc(1, maxLen + 1);
|
char *content = taosMemoryCalloc(1, maxLen + 1);
|
||||||
|
|
|
@ -57,7 +57,7 @@ int32_t mmProcessCreateReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (createReq.replica <= 1 || createReq.dnodeId != pDnode->dnodeId) {
|
if (createReq.replica <= 1 || createReq.dnodeId != pDnode->dnodeId) {
|
||||||
terrno = TSDB_CODE_NODE_INVALID_OPTION;
|
terrno = TSDB_CODE_INVALID_OPTION;
|
||||||
dError("failed to create mnode since %s", terrstr());
|
dError("failed to create mnode since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -70,13 +70,13 @@ int32_t mmProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
||||||
SRpcMsg *pReq = &pMsg->rpcMsg;
|
SRpcMsg *pReq = &pMsg->rpcMsg;
|
||||||
|
|
||||||
SDDropMnodeReq dropReq = {0};
|
SDDropMnodeReq dropReq = {0};
|
||||||
if (tDeserializeSMCreateDropMnodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dropReq.dnodeId != pDnode->dnodeId) {
|
if (dropReq.dnodeId != pDnode->dnodeId) {
|
||||||
terrno = TSDB_CODE_NODE_INVALID_OPTION;
|
terrno = TSDB_CODE_INVALID_OPTION;
|
||||||
dError("failed to drop mnode since %s", terrstr());
|
dError("failed to drop mnode since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -95,7 +95,7 @@ int32_t mmProcessAlterReq(SMnodeMgmt *pMgmt, SNodeMsg *pMsg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (alterReq.dnodeId != pDnode->dnodeId) {
|
if (alterReq.dnodeId != pDnode->dnodeId) {
|
||||||
terrno = TSDB_CODE_NODE_INVALID_OPTION;
|
terrno = TSDB_CODE_INVALID_OPTION;
|
||||||
dError("failed to alter mnode since %s", terrstr());
|
dError("failed to alter mnode since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -16,8 +16,7 @@
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "qmInt.h"
|
#include "qmInt.h"
|
||||||
|
|
||||||
void qmGetMonitorInfo(SMgmtWrapper *pWrapper, SMonQmInfo *qmInfo) {
|
void qmGetMonitorInfo(SMgmtWrapper *pWrapper, SMonQmInfo *qmInfo) {}
|
||||||
}
|
|
||||||
|
|
||||||
int32_t qmProcessGetMonQmInfoReq(SMgmtWrapper *pWrapper, SNodeMsg *pReq) {
|
int32_t qmProcessGetMonQmInfoReq(SMgmtWrapper *pWrapper, SNodeMsg *pReq) {
|
||||||
SMonQmInfo qmInfo = {0};
|
SMonQmInfo qmInfo = {0};
|
||||||
|
@ -49,14 +48,14 @@ int32_t qmProcessCreateReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
||||||
SRpcMsg *pReq = &pMsg->rpcMsg;
|
SRpcMsg *pReq = &pMsg->rpcMsg;
|
||||||
|
|
||||||
SDCreateQnodeReq createReq = {0};
|
SDCreateQnodeReq createReq = {0};
|
||||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (createReq.dnodeId != pDnode->dnodeId) {
|
if (createReq.dnodeId != pDnode->dnodeId) {
|
||||||
terrno = TSDB_CODE_NODE_INVALID_OPTION;
|
terrno = TSDB_CODE_INVALID_OPTION;
|
||||||
dError("failed to create qnode since %s, input:%d cur:%d", terrstr(), createReq.dnodeId, pDnode->dnodeId);
|
dError("failed to create qnode since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
return qmOpen(pWrapper);
|
return qmOpen(pWrapper);
|
||||||
|
@ -68,13 +67,13 @@ int32_t qmProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
||||||
SRpcMsg *pReq = &pMsg->rpcMsg;
|
SRpcMsg *pReq = &pMsg->rpcMsg;
|
||||||
|
|
||||||
SDDropQnodeReq dropReq = {0};
|
SDDropQnodeReq dropReq = {0};
|
||||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dropReq.dnodeId != pDnode->dnodeId) {
|
if (dropReq.dnodeId != pDnode->dnodeId) {
|
||||||
terrno = TSDB_CODE_NODE_INVALID_OPTION;
|
terrno = TSDB_CODE_INVALID_OPTION;
|
||||||
dError("failed to drop qnode since %s", terrstr());
|
dError("failed to drop qnode since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "qmInt.h"
|
#include "qmInt.h"
|
||||||
|
|
||||||
static inline void qmSendRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t code) {
|
static inline void qmSendRsp(SNodeMsg *pMsg, int32_t code) {
|
||||||
SRpcMsg rsp = {.handle = pMsg->rpcMsg.handle,
|
SRpcMsg rsp = {.handle = pMsg->rpcMsg.handle,
|
||||||
.ahandle = pMsg->rpcMsg.ahandle,
|
.ahandle = pMsg->rpcMsg.ahandle,
|
||||||
.code = code,
|
.code = code,
|
||||||
|
@ -25,20 +25,22 @@ static inline void qmSendRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t cod
|
||||||
tmsgSendRsp(&rsp);
|
tmsgSendRsp(&rsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qmProcessMonQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
static void qmProcessMonitorQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
||||||
SQnodeMgmt *pMgmt = pInfo->ahandle;
|
SQnodeMgmt *pMgmt = pInfo->ahandle;
|
||||||
|
|
||||||
dTrace("msg:%p, get from qnode monitor queue", pMsg);
|
dTrace("msg:%p, get from qnode-monitor queue", pMsg);
|
||||||
SRpcMsg *pRpc = &pMsg->rpcMsg;
|
SRpcMsg *pRpc = &pMsg->rpcMsg;
|
||||||
int32_t code = -1;
|
int32_t code = -1;
|
||||||
|
|
||||||
if (pMsg->rpcMsg.msgType == TDMT_MON_SM_INFO) {
|
if (pMsg->rpcMsg.msgType == TDMT_MON_SM_INFO) {
|
||||||
code = qmProcessGetMonQmInfoReq(pMgmt->pWrapper, pMsg);
|
code = qmProcessGetMonQmInfoReq(pMgmt->pWrapper, pMsg);
|
||||||
|
} else {
|
||||||
|
terrno = TSDB_CODE_MSG_NOT_PROCESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pRpc->msgType & 1U) {
|
if (pRpc->msgType & 1U) {
|
||||||
if (code != 0 && terrno != 0) code = terrno;
|
if (code != 0 && terrno != 0) code = terrno;
|
||||||
qmSendRsp(pMgmt->pWrapper, pMsg, code);
|
qmSendRsp(pMsg, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code));
|
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code));
|
||||||
|
@ -49,10 +51,12 @@ static void qmProcessMonQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
||||||
static void qmProcessQueryQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
static void qmProcessQueryQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
||||||
SQnodeMgmt *pMgmt = pInfo->ahandle;
|
SQnodeMgmt *pMgmt = pInfo->ahandle;
|
||||||
|
|
||||||
dTrace("msg:%p, will be processed in qnode-query queue", pMsg);
|
dTrace("msg:%p, get from qnode-query queue", pMsg);
|
||||||
int32_t code = qndProcessQueryMsg(pMgmt->pQnode, &pMsg->rpcMsg);
|
SRpcMsg *pRpc = &pMsg->rpcMsg;
|
||||||
if (code != 0) {
|
int32_t code = qndProcessQueryMsg(pMgmt->pQnode, pRpc);
|
||||||
qmSendRsp(pMgmt->pWrapper, pMsg, code);
|
|
||||||
|
if (pRpc->msgType & 1U && code != 0) {
|
||||||
|
qmSendRsp(pMsg, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code));
|
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code));
|
||||||
|
@ -63,10 +67,12 @@ static void qmProcessQueryQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
||||||
static void qmProcessFetchQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
static void qmProcessFetchQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
||||||
SQnodeMgmt *pMgmt = pInfo->ahandle;
|
SQnodeMgmt *pMgmt = pInfo->ahandle;
|
||||||
|
|
||||||
dTrace("msg:%p, will be processed in qnode-fetch queue", pMsg);
|
dTrace("msg:%p, get from qnode-fetch queue", pMsg);
|
||||||
int32_t code = qndProcessFetchMsg(pMgmt->pQnode, &pMsg->rpcMsg);
|
SRpcMsg *pRpc = &pMsg->rpcMsg;
|
||||||
if (code != 0) {
|
int32_t code = qndProcessFetchMsg(pMgmt->pQnode, pRpc);
|
||||||
qmSendRsp(pMgmt->pWrapper, pMsg, code);
|
|
||||||
|
if (pRpc->msgType & 1U && code != 0) {
|
||||||
|
qmSendRsp(pMsg, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code));
|
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code));
|
||||||
|
@ -92,11 +98,8 @@ int32_t qmProcessFetchMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t qmProcessMonitorMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
int32_t qmProcessMonitorMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
||||||
SQnodeMgmt *pMgmt = pWrapper->pMgmt;
|
SQnodeMgmt *pMgmt = pWrapper->pMgmt;
|
||||||
SSingleWorker *pWorker = &pMgmt->monitorWorker;
|
qmPutMsgToWorker(&pMgmt->monitorWorker, pMsg);
|
||||||
|
|
||||||
dTrace("msg:%p, put into worker:%s", pMsg, pWorker->name);
|
|
||||||
taosWriteQitem(pWorker->queue, pMsg);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,6 +128,7 @@ int32_t qmPutMsgToFetchQueue(SMgmtWrapper *pWrapper, SRpcMsg *pRpc) {
|
||||||
int32_t qmGetQueueSize(SMgmtWrapper *pWrapper, int32_t vgId, EQueueType qtype) {
|
int32_t qmGetQueueSize(SMgmtWrapper *pWrapper, int32_t vgId, EQueueType qtype) {
|
||||||
int32_t size = -1;
|
int32_t size = -1;
|
||||||
SQnodeMgmt *pMgmt = pWrapper->pMgmt;
|
SQnodeMgmt *pMgmt = pWrapper->pMgmt;
|
||||||
|
|
||||||
switch (qtype) {
|
switch (qtype) {
|
||||||
case QUERY_QUEUE:
|
case QUERY_QUEUE:
|
||||||
size = taosQueueSize(pMgmt->queryWorker.queue);
|
size = taosQueueSize(pMgmt->queryWorker.queue);
|
||||||
|
@ -164,7 +168,7 @@ int32_t qmStartWorker(SQnodeMgmt *pMgmt) {
|
||||||
|
|
||||||
if (tsMultiProcess) {
|
if (tsMultiProcess) {
|
||||||
SSingleWorkerCfg mCfg = {
|
SSingleWorkerCfg mCfg = {
|
||||||
.min = 1, .max = 1, .name = "qnode-monitor", .fp = (FItem)qmProcessMonQueue, .param = pMgmt};
|
.min = 1, .max = 1, .name = "qnode-monitor", .fp = (FItem)qmProcessMonitorQueue, .param = pMgmt};
|
||||||
if (tSingleWorkerInit(&pMgmt->monitorWorker, &mCfg) != 0) {
|
if (tSingleWorkerInit(&pMgmt->monitorWorker, &mCfg) != 0) {
|
||||||
dError("failed to start qnode-monitor worker since %s", terrstr());
|
dError("failed to start qnode-monitor worker since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -48,14 +48,14 @@ int32_t smProcessCreateReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
||||||
SRpcMsg *pReq = &pMsg->rpcMsg;
|
SRpcMsg *pReq = &pMsg->rpcMsg;
|
||||||
|
|
||||||
SDCreateSnodeReq createReq = {0};
|
SDCreateSnodeReq createReq = {0};
|
||||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (createReq.dnodeId != pDnode->dnodeId) {
|
if (createReq.dnodeId != pDnode->dnodeId) {
|
||||||
terrno = TSDB_CODE_NODE_INVALID_OPTION;
|
terrno = TSDB_CODE_INVALID_OPTION;
|
||||||
dError("failed to create snode since %s, input:%d cur:%d", terrstr(), createReq.dnodeId, pDnode->dnodeId);
|
dError("failed to create snode since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
return smOpen(pWrapper);
|
return smOpen(pWrapper);
|
||||||
|
@ -67,13 +67,13 @@ int32_t smProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
||||||
SRpcMsg *pReq = &pMsg->rpcMsg;
|
SRpcMsg *pReq = &pMsg->rpcMsg;
|
||||||
|
|
||||||
SDDropSnodeReq dropReq = {0};
|
SDDropSnodeReq dropReq = {0};
|
||||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dropReq.dnodeId != pDnode->dnodeId) {
|
if (dropReq.dnodeId != pDnode->dnodeId) {
|
||||||
terrno = TSDB_CODE_NODE_INVALID_OPTION;
|
terrno = TSDB_CODE_INVALID_OPTION;
|
||||||
dError("failed to drop snode since %s", terrstr());
|
dError("failed to drop snode since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "smInt.h"
|
#include "smInt.h"
|
||||||
|
|
||||||
static inline void smSendRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t code) {
|
static inline void smSendRsp(SNodeMsg *pMsg, int32_t code) {
|
||||||
SRpcMsg rsp = {.handle = pMsg->rpcMsg.handle,
|
SRpcMsg rsp = {.handle = pMsg->rpcMsg.handle,
|
||||||
.ahandle = pMsg->rpcMsg.ahandle,
|
.ahandle = pMsg->rpcMsg.ahandle,
|
||||||
.code = code,
|
.code = code,
|
||||||
|
@ -28,17 +28,19 @@ static inline void smSendRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t cod
|
||||||
static void smProcessMonitorQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
static void smProcessMonitorQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
||||||
SSnodeMgmt *pMgmt = pInfo->ahandle;
|
SSnodeMgmt *pMgmt = pInfo->ahandle;
|
||||||
|
|
||||||
dTrace("msg:%p, get from snode monitor queue", pMsg);
|
dTrace("msg:%p, get from snode-monitor queue", pMsg);
|
||||||
SRpcMsg *pRpc = &pMsg->rpcMsg;
|
SRpcMsg *pRpc = &pMsg->rpcMsg;
|
||||||
int32_t code = -1;
|
int32_t code = -1;
|
||||||
|
|
||||||
if (pMsg->rpcMsg.msgType == TDMT_MON_SM_INFO) {
|
if (pMsg->rpcMsg.msgType == TDMT_MON_SM_INFO) {
|
||||||
code = smProcessGetMonSmInfoReq(pMgmt->pWrapper, pMsg);
|
code = smProcessGetMonSmInfoReq(pMgmt->pWrapper, pMsg);
|
||||||
|
} else {
|
||||||
|
terrno = TSDB_CODE_MSG_NOT_PROCESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pRpc->msgType & 1U) {
|
if (pRpc->msgType & 1U) {
|
||||||
if (code != 0 && terrno != 0) code = terrno;
|
if (code != 0 && terrno != 0) code = terrno;
|
||||||
smSendRsp(pMgmt->pWrapper, pMsg, code);
|
smSendRsp(pMsg, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code));
|
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code));
|
||||||
|
@ -53,7 +55,7 @@ static void smProcessUniqueQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t num
|
||||||
SNodeMsg *pMsg = NULL;
|
SNodeMsg *pMsg = NULL;
|
||||||
taosGetQitem(qall, (void **)&pMsg);
|
taosGetQitem(qall, (void **)&pMsg);
|
||||||
|
|
||||||
dTrace("msg:%p, will be processed in snode unique queue", pMsg);
|
dTrace("msg:%p, get from snode-unique queue", pMsg);
|
||||||
sndProcessUMsg(pMgmt->pSnode, &pMsg->rpcMsg);
|
sndProcessUMsg(pMgmt->pSnode, &pMsg->rpcMsg);
|
||||||
|
|
||||||
dTrace("msg:%p, is freed", pMsg);
|
dTrace("msg:%p, is freed", pMsg);
|
||||||
|
@ -65,7 +67,7 @@ static void smProcessUniqueQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t num
|
||||||
static void smProcessSharedQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
static void smProcessSharedQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
||||||
SSnodeMgmt *pMgmt = pInfo->ahandle;
|
SSnodeMgmt *pMgmt = pInfo->ahandle;
|
||||||
|
|
||||||
dTrace("msg:%p, will be processed in snode shared queue", pMsg);
|
dTrace("msg:%p, get from snode-shared queue", pMsg);
|
||||||
sndProcessSMsg(pMgmt->pSnode, &pMsg->rpcMsg);
|
sndProcessSMsg(pMgmt->pSnode, &pMsg->rpcMsg);
|
||||||
|
|
||||||
dTrace("msg:%p, is freed", pMsg);
|
dTrace("msg:%p, is freed", pMsg);
|
||||||
|
@ -88,7 +90,6 @@ int32_t smStartWorker(SSnodeMgmt *pMgmt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SMultiWorkerCfg cfg = {.max = 1, .name = "snode-unique", .fp = smProcessUniqueQueue, .param = pMgmt};
|
SMultiWorkerCfg cfg = {.max = 1, .name = "snode-unique", .fp = smProcessUniqueQueue, .param = pMgmt};
|
||||||
|
|
||||||
if (tMultiWorkerInit(pUniqueWorker, &cfg) != 0) {
|
if (tMultiWorkerInit(pUniqueWorker, &cfg) != 0) {
|
||||||
dError("failed to start snode-unique worker since %s", terrstr());
|
dError("failed to start snode-unique worker since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -193,7 +194,7 @@ int32_t smProcessSharedMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t smProcessExecMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
int32_t smProcessExecMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
||||||
int32_t workerType = smGetSWTypeFromMsg(&pMsg->rpcMsg);
|
int32_t workerType = smGetSWTypeFromMsg(&pMsg->rpcMsg);
|
||||||
if (workerType == SND_WORKER_TYPE__SHARED) {
|
if (workerType == SND_WORKER_TYPE__SHARED) {
|
||||||
return smProcessSharedMsg(pWrapper, pMsg);
|
return smProcessSharedMsg(pWrapper, pMsg);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -33,22 +33,22 @@ TEST_F(DndTestBnode, 01_Create_Bnode) {
|
||||||
SDCreateBnodeReq createReq = {0};
|
SDCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_INVALID_OPTION);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
SDCreateBnodeReq createReq = {0};
|
SDCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -59,9 +59,9 @@ TEST_F(DndTestBnode, 01_Create_Bnode) {
|
||||||
SDCreateBnodeReq createReq = {0};
|
SDCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -74,9 +74,9 @@ TEST_F(DndTestBnode, 01_Create_Bnode) {
|
||||||
SDCreateBnodeReq createReq = {0};
|
SDCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_ALREADY_DEPLOYED);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_ALREADY_DEPLOYED);
|
||||||
|
@ -88,22 +88,22 @@ TEST_F(DndTestBnode, 02_Drop_Bnode) {
|
||||||
SDDropBnodeReq dropReq = {0};
|
SDDropBnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_INVALID_OPTION);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
SDDropBnodeReq dropReq = {0};
|
SDDropBnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 1;
|
dropReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -114,9 +114,9 @@ TEST_F(DndTestBnode, 02_Drop_Bnode) {
|
||||||
SDDropBnodeReq dropReq = {0};
|
SDDropBnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 1;
|
dropReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -129,9 +129,9 @@ TEST_F(DndTestBnode, 02_Drop_Bnode) {
|
||||||
SDDropBnodeReq dropReq = {0};
|
SDDropBnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 1;
|
dropReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -142,9 +142,9 @@ TEST_F(DndTestBnode, 02_Drop_Bnode) {
|
||||||
SDCreateBnodeReq createReq = {0};
|
SDCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
|
|
@ -96,7 +96,7 @@ TEST_F(DndTestMnode, 02_Alter_Mnode) {
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_ALTER_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_ALTER_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_INVALID_OPTION);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -113,7 +113,7 @@ TEST_F(DndTestMnode, 02_Alter_Mnode) {
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_ALTER_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_ALTER_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_INVALID_OPTION);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -139,22 +139,22 @@ TEST_F(DndTestMnode, 03_Drop_Mnode) {
|
||||||
SDDropMnodeReq dropReq = {0};
|
SDDropMnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_INVALID_OPTION);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
SDDropMnodeReq dropReq = {0};
|
SDDropMnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 1;
|
dropReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -165,9 +165,9 @@ TEST_F(DndTestMnode, 03_Drop_Mnode) {
|
||||||
SDDropMnodeReq dropReq = {0};
|
SDDropMnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 1;
|
dropReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
|
|
@ -30,22 +30,22 @@ TEST_F(DndTestQnode, 01_Create_Qnode) {
|
||||||
SDCreateQnodeReq createReq = {0};
|
SDCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_INVALID_OPTION);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
SDCreateQnodeReq createReq = {0};
|
SDCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -56,9 +56,9 @@ TEST_F(DndTestQnode, 01_Create_Qnode) {
|
||||||
SDCreateQnodeReq createReq = {0};
|
SDCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -71,9 +71,9 @@ TEST_F(DndTestQnode, 01_Create_Qnode) {
|
||||||
SDCreateQnodeReq createReq = {0};
|
SDCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -86,22 +86,22 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
|
||||||
SDDropQnodeReq dropReq = {0};
|
SDDropQnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_INVALID_OPTION);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
SDDropQnodeReq dropReq = {0};
|
SDDropQnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 1;
|
dropReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -112,9 +112,9 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
|
||||||
SDDropQnodeReq dropReq = {0};
|
SDDropQnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 1;
|
dropReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -127,9 +127,9 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
|
||||||
SDDropQnodeReq dropReq = {0};
|
SDDropQnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 1;
|
dropReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -140,9 +140,9 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
|
||||||
SDCreateQnodeReq createReq = {0};
|
SDCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
|
|
@ -30,22 +30,22 @@ TEST_F(DndTestSnode, 01_Create_Snode) {
|
||||||
SDCreateSnodeReq createReq = {0};
|
SDCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_INVALID_OPTION);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
SDCreateSnodeReq createReq = {0};
|
SDCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -56,9 +56,9 @@ TEST_F(DndTestSnode, 01_Create_Snode) {
|
||||||
SDCreateSnodeReq createReq = {0};
|
SDCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -71,9 +71,9 @@ TEST_F(DndTestSnode, 01_Create_Snode) {
|
||||||
SDCreateSnodeReq createReq = {0};
|
SDCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -86,22 +86,22 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
|
||||||
SDDropSnodeReq dropReq = {0};
|
SDDropSnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_INVALID_OPTION);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
SDDropSnodeReq dropReq = {0};
|
SDDropSnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 1;
|
dropReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -112,9 +112,9 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
|
||||||
SDDropSnodeReq dropReq = {0};
|
SDDropSnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 1;
|
dropReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -127,9 +127,9 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
|
||||||
SDDropSnodeReq dropReq = {0};
|
SDDropSnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 1;
|
dropReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -140,9 +140,9 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
|
||||||
SDCreateSnodeReq createReq = {0};
|
SDCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
|
|
@ -67,7 +67,7 @@ TEST_F(DndTestVnode, 01_Create_Vnode) {
|
||||||
ASSERT_EQ(pRsp->code, 0);
|
ASSERT_EQ(pRsp->code, 0);
|
||||||
test.Restart();
|
test.Restart();
|
||||||
} else {
|
} else {
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_DND_VNODE_ALREADY_DEPLOYED);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_ALREADY_DEPLOYED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,7 @@ TEST_F(DndTestVnode, 06_Drop_Vnode) {
|
||||||
ASSERT_EQ(pRsp->code, 0);
|
ASSERT_EQ(pRsp->code, 0);
|
||||||
test.Restart();
|
test.Restart();
|
||||||
} else {
|
} else {
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_DND_VNODE_NOT_DEPLOYED);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_NOT_DEPLOYED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -45,7 +45,7 @@ SVnodeObj **vmGetVnodesFromHash(SVnodesMgmt *pMgmt, int32_t *numOfVnodes) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t vmGetVnodesFromFile(SVnodesMgmt *pMgmt, SWrapperCfg **ppCfgs, int32_t *numOfVnodes) {
|
int32_t vmGetVnodesFromFile(SVnodesMgmt *pMgmt, SWrapperCfg **ppCfgs, int32_t *numOfVnodes) {
|
||||||
int32_t code = TSDB_CODE_NODE_PARSE_FILE_ERROR;
|
int32_t code = TSDB_CODE_INVALID_JSON_FORMAT;
|
||||||
int32_t len = 0;
|
int32_t len = 0;
|
||||||
int32_t maxLen = 30000;
|
int32_t maxLen = 30000;
|
||||||
char *content = taosMemoryCalloc(1, maxLen + 1);
|
char *content = taosMemoryCalloc(1, maxLen + 1);
|
||||||
|
|
|
@ -139,7 +139,7 @@ int32_t vmProcessCreateVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) {
|
||||||
tFreeSCreateVnodeReq(&createReq);
|
tFreeSCreateVnodeReq(&createReq);
|
||||||
dDebug("vgId:%d, already exist", createReq.vgId);
|
dDebug("vgId:%d, already exist", createReq.vgId);
|
||||||
vmReleaseVnode(pMgmt, pVnode);
|
vmReleaseVnode(pMgmt, pVnode);
|
||||||
terrno = TSDB_CODE_DND_VNODE_ALREADY_DEPLOYED;
|
terrno = TSDB_CODE_NODE_ALREADY_DEPLOYED;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ int32_t vmProcessDropVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) {
|
||||||
SVnodeObj *pVnode = vmAcquireVnode(pMgmt, vgId);
|
SVnodeObj *pVnode = vmAcquireVnode(pMgmt, vgId);
|
||||||
if (pVnode == NULL) {
|
if (pVnode == NULL) {
|
||||||
dDebug("vgId:%d, failed to drop since %s", vgId, terrstr());
|
dDebug("vgId:%d, failed to drop since %s", vgId, terrstr());
|
||||||
terrno = TSDB_CODE_DND_VNODE_NOT_DEPLOYED;
|
terrno = TSDB_CODE_NODE_NOT_DEPLOYED;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,17 +21,17 @@
|
||||||
#include "mndTrans.h"
|
#include "mndTrans.h"
|
||||||
#include "mndUser.h"
|
#include "mndUser.h"
|
||||||
|
|
||||||
#define TSDB_BNODE_VER_NUMBER 1
|
#define BNODE_VER_NUMBER 1
|
||||||
#define TSDB_BNODE_RESERVE_SIZE 64
|
#define BNODE_RESERVE_SIZE 64
|
||||||
|
|
||||||
static SSdbRaw *mndBnodeActionEncode(SBnodeObj *pObj);
|
static SSdbRaw *mndBnodeActionEncode(SBnodeObj *pObj);
|
||||||
static SSdbRow *mndBnodeActionDecode(SSdbRaw *pRaw);
|
static SSdbRow *mndBnodeActionDecode(SSdbRaw *pRaw);
|
||||||
static int32_t mndBnodeActionInsert(SSdb *pSdb, SBnodeObj *pObj);
|
static int32_t mndBnodeActionInsert(SSdb *pSdb, SBnodeObj *pObj);
|
||||||
static int32_t mndBnodeActionDelete(SSdb *pSdb, SBnodeObj *pObj);
|
|
||||||
static int32_t mndBnodeActionUpdate(SSdb *pSdb, SBnodeObj *pOld, SBnodeObj *pNew);
|
static int32_t mndBnodeActionUpdate(SSdb *pSdb, SBnodeObj *pOld, SBnodeObj *pNew);
|
||||||
|
static int32_t mndBnodeActionDelete(SSdb *pSdb, SBnodeObj *pObj);
|
||||||
static int32_t mndProcessCreateBnodeReq(SNodeMsg *pReq);
|
static int32_t mndProcessCreateBnodeReq(SNodeMsg *pReq);
|
||||||
static int32_t mndProcessDropBnodeReq(SNodeMsg *pReq);
|
|
||||||
static int32_t mndProcessCreateBnodeRsp(SNodeMsg *pRsp);
|
static int32_t mndProcessCreateBnodeRsp(SNodeMsg *pRsp);
|
||||||
|
static int32_t mndProcessDropBnodeReq(SNodeMsg *pReq);
|
||||||
static int32_t mndProcessDropBnodeRsp(SNodeMsg *pRsp);
|
static int32_t mndProcessDropBnodeRsp(SNodeMsg *pRsp);
|
||||||
static int32_t mndGetBnodeMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta);
|
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, char *data, int32_t rows);
|
||||||
|
@ -75,18 +75,18 @@ static void mndReleaseBnode(SMnode *pMnode, SBnodeObj *pObj) {
|
||||||
static SSdbRaw *mndBnodeActionEncode(SBnodeObj *pObj) {
|
static SSdbRaw *mndBnodeActionEncode(SBnodeObj *pObj) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
SSdbRaw *pRaw = sdbAllocRaw(SDB_BNODE, TSDB_BNODE_VER_NUMBER, sizeof(SBnodeObj) + TSDB_BNODE_RESERVE_SIZE);
|
SSdbRaw *pRaw = sdbAllocRaw(SDB_BNODE, BNODE_VER_NUMBER, sizeof(SBnodeObj) + BNODE_RESERVE_SIZE);
|
||||||
if (pRaw == NULL) goto BNODE_ENCODE_OVER;
|
if (pRaw == NULL) goto _OVER;
|
||||||
|
|
||||||
int32_t dataPos = 0;
|
int32_t dataPos = 0;
|
||||||
SDB_SET_INT32(pRaw, dataPos, pObj->id, BNODE_ENCODE_OVER)
|
SDB_SET_INT32(pRaw, dataPos, pObj->id, _OVER)
|
||||||
SDB_SET_INT64(pRaw, dataPos, pObj->createdTime, BNODE_ENCODE_OVER)
|
SDB_SET_INT64(pRaw, dataPos, pObj->createdTime, _OVER)
|
||||||
SDB_SET_INT64(pRaw, dataPos, pObj->updateTime, BNODE_ENCODE_OVER)
|
SDB_SET_INT64(pRaw, dataPos, pObj->updateTime, _OVER)
|
||||||
SDB_SET_RESERVE(pRaw, dataPos, TSDB_BNODE_RESERVE_SIZE, BNODE_ENCODE_OVER)
|
SDB_SET_RESERVE(pRaw, dataPos, BNODE_RESERVE_SIZE, _OVER)
|
||||||
|
|
||||||
terrno = 0;
|
terrno = 0;
|
||||||
|
|
||||||
BNODE_ENCODE_OVER:
|
_OVER:
|
||||||
if (terrno != 0) {
|
if (terrno != 0) {
|
||||||
mError("bnode:%d, failed to encode to raw:%p since %s", pObj->id, pRaw, terrstr());
|
mError("bnode:%d, failed to encode to raw:%p since %s", pObj->id, pRaw, terrstr());
|
||||||
sdbFreeRaw(pRaw);
|
sdbFreeRaw(pRaw);
|
||||||
|
@ -101,28 +101,28 @@ static SSdbRow *mndBnodeActionDecode(SSdbRaw *pRaw) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
int8_t sver = 0;
|
int8_t sver = 0;
|
||||||
if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto BNODE_DECODE_OVER;
|
if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER;
|
||||||
|
|
||||||
if (sver != TSDB_BNODE_VER_NUMBER) {
|
if (sver != BNODE_VER_NUMBER) {
|
||||||
terrno = TSDB_CODE_SDB_INVALID_DATA_VER;
|
terrno = TSDB_CODE_SDB_INVALID_DATA_VER;
|
||||||
goto BNODE_DECODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSdbRow *pRow = sdbAllocRow(sizeof(SBnodeObj));
|
SSdbRow *pRow = sdbAllocRow(sizeof(SBnodeObj));
|
||||||
if (pRow == NULL) goto BNODE_DECODE_OVER;
|
if (pRow == NULL) goto _OVER;
|
||||||
|
|
||||||
SBnodeObj *pObj = sdbGetRowObj(pRow);
|
SBnodeObj *pObj = sdbGetRowObj(pRow);
|
||||||
if (pObj == NULL) goto BNODE_DECODE_OVER;
|
if (pObj == NULL) goto _OVER;
|
||||||
|
|
||||||
int32_t dataPos = 0;
|
int32_t dataPos = 0;
|
||||||
SDB_GET_INT32(pRaw, dataPos, &pObj->id, BNODE_DECODE_OVER)
|
SDB_GET_INT32(pRaw, dataPos, &pObj->id, _OVER)
|
||||||
SDB_GET_INT64(pRaw, dataPos, &pObj->createdTime, BNODE_DECODE_OVER)
|
SDB_GET_INT64(pRaw, dataPos, &pObj->createdTime, _OVER)
|
||||||
SDB_GET_INT64(pRaw, dataPos, &pObj->updateTime, BNODE_DECODE_OVER)
|
SDB_GET_INT64(pRaw, dataPos, &pObj->updateTime, _OVER)
|
||||||
SDB_GET_RESERVE(pRaw, dataPos, TSDB_BNODE_RESERVE_SIZE, BNODE_DECODE_OVER)
|
SDB_GET_RESERVE(pRaw, dataPos, BNODE_RESERVE_SIZE, _OVER)
|
||||||
|
|
||||||
terrno = 0;
|
terrno = 0;
|
||||||
|
|
||||||
BNODE_DECODE_OVER:
|
_OVER:
|
||||||
if (terrno != 0) {
|
if (terrno != 0) {
|
||||||
mError("bnode:%d, failed to decode from raw:%p since %s", pObj->id, pRaw, terrstr());
|
mError("bnode:%d, failed to decode from raw:%p since %s", pObj->id, pRaw, terrstr());
|
||||||
taosMemoryFreeClear(pRow);
|
taosMemoryFreeClear(pRow);
|
||||||
|
@ -189,13 +189,13 @@ static int32_t mndSetCreateBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
||||||
SDCreateBnodeReq createReq = {0};
|
SDCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = pDnode->id;
|
createReq.dnodeId = pDnode->id;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void *pReq = taosMemoryMalloc(contLen);
|
void *pReq = taosMemoryMalloc(contLen);
|
||||||
if (pReq == NULL) {
|
if (pReq == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
STransAction action = {0};
|
STransAction action = {0};
|
||||||
action.epSet = mndGetDnodeEpset(pDnode);
|
action.epSet = mndGetDnodeEpset(pDnode);
|
||||||
|
@ -216,13 +216,13 @@ static int32_t mndSetCreateBnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
||||||
SDDropBnodeReq dropReq = {0};
|
SDDropBnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = pDnode->id;
|
dropReq.dnodeId = pDnode->id;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void *pReq = taosMemoryMalloc(contLen);
|
void *pReq = taosMemoryMalloc(contLen);
|
||||||
if (pReq == NULL) {
|
if (pReq == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
STransAction action = {0};
|
STransAction action = {0};
|
||||||
action.epSet = mndGetDnodeEpset(pDnode);
|
action.epSet = mndGetDnodeEpset(pDnode);
|
||||||
|
@ -248,19 +248,19 @@ static int32_t mndCreateBnode(SMnode *pMnode, SNodeMsg *pReq, SDnodeObj *pDnode,
|
||||||
bnodeObj.updateTime = bnodeObj.createdTime;
|
bnodeObj.updateTime = bnodeObj.createdTime;
|
||||||
|
|
||||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_TYPE_CREATE_BNODE, &pReq->rpcMsg);
|
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_TYPE_CREATE_BNODE, &pReq->rpcMsg);
|
||||||
if (pTrans == NULL) goto CREATE_BNODE_OVER;
|
if (pTrans == NULL) goto _OVER;
|
||||||
|
|
||||||
mDebug("trans:%d, used to create bnode:%d", pTrans->id, pCreate->dnodeId);
|
mDebug("trans:%d, used to create bnode:%d", pTrans->id, pCreate->dnodeId);
|
||||||
if (mndSetCreateBnodeRedoLogs(pTrans, &bnodeObj) != 0) goto CREATE_BNODE_OVER;
|
if (mndSetCreateBnodeRedoLogs(pTrans, &bnodeObj) != 0) goto _OVER;
|
||||||
if (mndSetCreateBnodeUndoLogs(pTrans, &bnodeObj) != 0) goto CREATE_BNODE_OVER;
|
if (mndSetCreateBnodeUndoLogs(pTrans, &bnodeObj) != 0) goto _OVER;
|
||||||
if (mndSetCreateBnodeCommitLogs(pTrans, &bnodeObj) != 0) goto CREATE_BNODE_OVER;
|
if (mndSetCreateBnodeCommitLogs(pTrans, &bnodeObj) != 0) goto _OVER;
|
||||||
if (mndSetCreateBnodeRedoActions(pTrans, pDnode, &bnodeObj) != 0) goto CREATE_BNODE_OVER;
|
if (mndSetCreateBnodeRedoActions(pTrans, pDnode, &bnodeObj) != 0) goto _OVER;
|
||||||
if (mndSetCreateBnodeUndoActions(pTrans, pDnode, &bnodeObj) != 0) goto CREATE_BNODE_OVER;
|
if (mndSetCreateBnodeUndoActions(pTrans, pDnode, &bnodeObj) != 0) goto _OVER;
|
||||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto CREATE_BNODE_OVER;
|
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
||||||
|
|
||||||
code = 0;
|
code = 0;
|
||||||
|
|
||||||
CREATE_BNODE_OVER:
|
_OVER:
|
||||||
mndTransDrop(pTrans);
|
mndTransDrop(pTrans);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -273,9 +273,9 @@ static int32_t mndProcessCreateBnodeReq(SNodeMsg *pReq) {
|
||||||
SUserObj *pUser = NULL;
|
SUserObj *pUser = NULL;
|
||||||
SMCreateBnodeReq createReq = {0};
|
SMCreateBnodeReq createReq = {0};
|
||||||
|
|
||||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &createReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &createReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
goto CREATE_BNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
mDebug("bnode:%d, start to create", createReq.dnodeId);
|
mDebug("bnode:%d, start to create", createReq.dnodeId);
|
||||||
|
@ -283,31 +283,31 @@ static int32_t mndProcessCreateBnodeReq(SNodeMsg *pReq) {
|
||||||
pObj = mndAcquireBnode(pMnode, createReq.dnodeId);
|
pObj = mndAcquireBnode(pMnode, createReq.dnodeId);
|
||||||
if (pObj != NULL) {
|
if (pObj != NULL) {
|
||||||
terrno = TSDB_CODE_MND_BNODE_ALREADY_EXIST;
|
terrno = TSDB_CODE_MND_BNODE_ALREADY_EXIST;
|
||||||
goto CREATE_BNODE_OVER;
|
goto _OVER;
|
||||||
} else if (terrno != TSDB_CODE_MND_BNODE_NOT_EXIST) {
|
} else if (terrno != TSDB_CODE_MND_BNODE_NOT_EXIST) {
|
||||||
goto CREATE_BNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
pDnode = mndAcquireDnode(pMnode, createReq.dnodeId);
|
pDnode = mndAcquireDnode(pMnode, createReq.dnodeId);
|
||||||
if (pDnode == NULL) {
|
if (pDnode == NULL) {
|
||||||
terrno = TSDB_CODE_MND_DNODE_NOT_EXIST;
|
terrno = TSDB_CODE_MND_DNODE_NOT_EXIST;
|
||||||
goto CREATE_BNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
pUser = mndAcquireUser(pMnode, pReq->user);
|
pUser = mndAcquireUser(pMnode, pReq->user);
|
||||||
if (pUser == NULL) {
|
if (pUser == NULL) {
|
||||||
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
||||||
goto CREATE_BNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mndCheckNodeAuth(pUser)) {
|
if (mndCheckNodeAuth(pUser)) {
|
||||||
goto CREATE_BNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = mndCreateBnode(pMnode, pReq, pDnode, &createReq);
|
code = mndCreateBnode(pMnode, pReq, pDnode, &createReq);
|
||||||
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||||
|
|
||||||
CREATE_BNODE_OVER:
|
_OVER:
|
||||||
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
||||||
mError("bnode:%d, failed to create since %s", createReq.dnodeId, terrstr());
|
mError("bnode:%d, failed to create since %s", createReq.dnodeId, terrstr());
|
||||||
}
|
}
|
||||||
|
@ -315,7 +315,6 @@ CREATE_BNODE_OVER:
|
||||||
mndReleaseBnode(pMnode, pObj);
|
mndReleaseBnode(pMnode, pObj);
|
||||||
mndReleaseDnode(pMnode, pDnode);
|
mndReleaseDnode(pMnode, pDnode);
|
||||||
mndReleaseUser(pMnode, pUser);
|
mndReleaseUser(pMnode, pUser);
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,13 +338,13 @@ static int32_t mndSetDropBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SBn
|
||||||
SDDropBnodeReq dropReq = {0};
|
SDDropBnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = pDnode->id;
|
dropReq.dnodeId = pDnode->id;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void *pReq = taosMemoryMalloc(contLen);
|
void *pReq = taosMemoryMalloc(contLen);
|
||||||
if (pReq == NULL) {
|
if (pReq == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
STransAction action = {0};
|
STransAction action = {0};
|
||||||
action.epSet = mndGetDnodeEpset(pDnode);
|
action.epSet = mndGetDnodeEpset(pDnode);
|
||||||
|
@ -366,17 +365,17 @@ static int32_t mndDropBnode(SMnode *pMnode, SNodeMsg *pReq, SBnodeObj *pObj) {
|
||||||
int32_t code = -1;
|
int32_t code = -1;
|
||||||
|
|
||||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_TYPE_DROP_BNODE, &pReq->rpcMsg);
|
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_TYPE_DROP_BNODE, &pReq->rpcMsg);
|
||||||
if (pTrans == NULL) goto DROP_BNODE_OVER;
|
if (pTrans == NULL) goto _OVER;
|
||||||
|
|
||||||
mDebug("trans:%d, used to drop bnode:%d", pTrans->id, pObj->id);
|
mDebug("trans:%d, used to drop bnode:%d", pTrans->id, pObj->id);
|
||||||
if (mndSetDropBnodeRedoLogs(pTrans, pObj) != 0) goto DROP_BNODE_OVER;
|
if (mndSetDropBnodeRedoLogs(pTrans, pObj) != 0) goto _OVER;
|
||||||
if (mndSetDropBnodeCommitLogs(pTrans, pObj) != 0) goto DROP_BNODE_OVER;
|
if (mndSetDropBnodeCommitLogs(pTrans, pObj) != 0) goto _OVER;
|
||||||
if (mndSetDropBnodeRedoActions(pTrans, pObj->pDnode, pObj) != 0) goto DROP_BNODE_OVER;
|
if (mndSetDropBnodeRedoActions(pTrans, pObj->pDnode, pObj) != 0) goto _OVER;
|
||||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto DROP_BNODE_OVER;
|
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
||||||
|
|
||||||
code = 0;
|
code = 0;
|
||||||
|
|
||||||
DROP_BNODE_OVER:
|
_OVER:
|
||||||
mndTransDrop(pTrans);
|
mndTransDrop(pTrans);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -388,37 +387,37 @@ static int32_t mndProcessDropBnodeReq(SNodeMsg *pReq) {
|
||||||
SBnodeObj *pObj = NULL;
|
SBnodeObj *pObj = NULL;
|
||||||
SMDropBnodeReq dropReq = {0};
|
SMDropBnodeReq dropReq = {0};
|
||||||
|
|
||||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
goto DROP_BNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
mDebug("bnode:%d, start to drop", dropReq.dnodeId);
|
mDebug("bnode:%d, start to drop", dropReq.dnodeId);
|
||||||
|
|
||||||
if (dropReq.dnodeId <= 0) {
|
if (dropReq.dnodeId <= 0) {
|
||||||
terrno = TSDB_CODE_SDB_APP_ERROR;
|
terrno = TSDB_CODE_SDB_APP_ERROR;
|
||||||
goto DROP_BNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
pObj = mndAcquireBnode(pMnode, dropReq.dnodeId);
|
pObj = mndAcquireBnode(pMnode, dropReq.dnodeId);
|
||||||
if (pObj == NULL) {
|
if (pObj == NULL) {
|
||||||
goto DROP_BNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
pUser = mndAcquireUser(pMnode, pReq->user);
|
pUser = mndAcquireUser(pMnode, pReq->user);
|
||||||
if (pUser == NULL) {
|
if (pUser == NULL) {
|
||||||
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
||||||
goto DROP_BNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mndCheckNodeAuth(pUser)) {
|
if (mndCheckNodeAuth(pUser)) {
|
||||||
goto DROP_BNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = mndDropBnode(pMnode, pReq, pObj);
|
code = mndDropBnode(pMnode, pReq, pObj);
|
||||||
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||||
|
|
||||||
DROP_BNODE_OVER:
|
_OVER:
|
||||||
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
||||||
mError("bnode:%d, failed to drop since %s", dropReq.dnodeId, terrstr());
|
mError("bnode:%d, failed to drop since %s", dropReq.dnodeId, terrstr());
|
||||||
}
|
}
|
||||||
|
|
|
@ -379,7 +379,7 @@ static int32_t mndSetCreateDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
|
||||||
action.pCont = pReq;
|
action.pCont = pReq;
|
||||||
action.contLen = contLen;
|
action.contLen = contLen;
|
||||||
action.msgType = TDMT_DND_CREATE_VNODE;
|
action.msgType = TDMT_DND_CREATE_VNODE;
|
||||||
action.acceptableCode = TSDB_CODE_DND_VNODE_ALREADY_DEPLOYED;
|
action.acceptableCode = TSDB_CODE_NODE_ALREADY_DEPLOYED;
|
||||||
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
||||||
taosMemoryFree(pReq);
|
taosMemoryFree(pReq);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -410,7 +410,7 @@ static int32_t mndSetCreateDbUndoActions(SMnode *pMnode, STrans *pTrans, SDbObj
|
||||||
action.pCont = pReq;
|
action.pCont = pReq;
|
||||||
action.contLen = contLen;
|
action.contLen = contLen;
|
||||||
action.msgType = TDMT_DND_DROP_VNODE;
|
action.msgType = TDMT_DND_DROP_VNODE;
|
||||||
action.acceptableCode = TSDB_CODE_DND_VNODE_NOT_DEPLOYED;
|
action.acceptableCode = TSDB_CODE_NODE_NOT_DEPLOYED;
|
||||||
if (mndTransAppendUndoAction(pTrans, &action) != 0) {
|
if (mndTransAppendUndoAction(pTrans, &action) != 0) {
|
||||||
taosMemoryFree(pReq);
|
taosMemoryFree(pReq);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -878,7 +878,7 @@ static int32_t mndBuildDropVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *
|
||||||
action.pCont = pReq;
|
action.pCont = pReq;
|
||||||
action.contLen = contLen;
|
action.contLen = contLen;
|
||||||
action.msgType = TDMT_DND_DROP_VNODE;
|
action.msgType = TDMT_DND_DROP_VNODE;
|
||||||
action.acceptableCode = TSDB_CODE_DND_VNODE_NOT_DEPLOYED;
|
action.acceptableCode = TSDB_CODE_NODE_NOT_DEPLOYED;
|
||||||
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
||||||
taosMemoryFree(pReq);
|
taosMemoryFree(pReq);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -551,7 +551,7 @@ static int32_t mndProcessDropDnodeReq(SNodeMsg *pReq) {
|
||||||
SDnodeObj *pDnode = NULL;
|
SDnodeObj *pDnode = NULL;
|
||||||
SMDropMnodeReq dropReq = {0};
|
SMDropMnodeReq dropReq = {0};
|
||||||
|
|
||||||
if (tDeserializeSMCreateDropMnodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
goto DROP_DNODE_OVER;
|
goto DROP_DNODE_OVER;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,17 @@ static const SInfosTableSchema modulesSchema[] = {
|
||||||
};
|
};
|
||||||
static const SInfosTableSchema qnodesSchema[] = {
|
static const SInfosTableSchema qnodesSchema[] = {
|
||||||
{.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
{.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||||
{.name = "endpoint", .bytes = 134, .type = TSDB_DATA_TYPE_BINARY},
|
{.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
|
{.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 = "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 = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||||
};
|
};
|
||||||
static const SInfosTableSchema bnodesSchema[] = {
|
static const SInfosTableSchema bnodesSchema[] = {
|
||||||
|
@ -196,6 +206,7 @@ static const SInfosTableMeta infosMeta[] = {
|
||||||
{TSDB_INS_TABLE_QNODES, qnodesSchema, tListLen(qnodesSchema)},
|
{TSDB_INS_TABLE_QNODES, qnodesSchema, tListLen(qnodesSchema)},
|
||||||
{TSDB_INS_TABLE_BNODES, bnodesSchema, tListLen(bnodesSchema)},
|
{TSDB_INS_TABLE_BNODES, bnodesSchema, tListLen(bnodesSchema)},
|
||||||
{TSDB_INS_TABLE_CLUSTER, clusterSchema, tListLen(clusterSchema)},
|
{TSDB_INS_TABLE_CLUSTER, clusterSchema, tListLen(clusterSchema)},
|
||||||
|
{TSDB_INS_TABLE_SNODES, snodesSchema, tListLen(snodesSchema)},
|
||||||
{TSDB_INS_TABLE_USER_DATABASES, userDBSchema, tListLen(userDBSchema)},
|
{TSDB_INS_TABLE_USER_DATABASES, userDBSchema, tListLen(userDBSchema)},
|
||||||
{TSDB_INS_TABLE_USER_FUNCTIONS, userFuncSchema, tListLen(userFuncSchema)},
|
{TSDB_INS_TABLE_USER_FUNCTIONS, userFuncSchema, tListLen(userFuncSchema)},
|
||||||
{TSDB_INS_TABLE_USER_INDEXES, userIdxSchema, tListLen(userIdxSchema)},
|
{TSDB_INS_TABLE_USER_INDEXES, userIdxSchema, tListLen(userIdxSchema)},
|
||||||
|
|
|
@ -386,7 +386,7 @@ static int32_t mndProcessCreateMnodeReq(SNodeMsg *pReq) {
|
||||||
SUserObj *pUser = NULL;
|
SUserObj *pUser = NULL;
|
||||||
SMCreateMnodeReq createReq = {0};
|
SMCreateMnodeReq createReq = {0};
|
||||||
|
|
||||||
if (tDeserializeSMCreateDropMnodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &createReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &createReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
goto CREATE_MNODE_OVER;
|
goto CREATE_MNODE_OVER;
|
||||||
}
|
}
|
||||||
|
@ -507,9 +507,9 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
|
||||||
|
|
||||||
SDDropMnodeReq dropReq = {0};
|
SDDropMnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = pObj->id;
|
dropReq.dnodeId = pObj->id;
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void *pReq = taosMemoryMalloc(contLen);
|
void *pReq = taosMemoryMalloc(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
action.epSet = mndGetDnodeEpset(pDnode);
|
action.epSet = mndGetDnodeEpset(pDnode);
|
||||||
action.pCont = pReq;
|
action.pCont = pReq;
|
||||||
|
@ -552,7 +552,7 @@ static int32_t mndProcessDropMnodeReq(SNodeMsg *pReq) {
|
||||||
SMnodeObj *pObj = NULL;
|
SMnodeObj *pObj = NULL;
|
||||||
SMDropMnodeReq dropReq = {0};
|
SMDropMnodeReq dropReq = {0};
|
||||||
|
|
||||||
if (tDeserializeSMCreateDropMnodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
goto DROP_MNODE_OVER;
|
goto DROP_MNODE_OVER;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,21 +21,21 @@
|
||||||
#include "mndTrans.h"
|
#include "mndTrans.h"
|
||||||
#include "mndUser.h"
|
#include "mndUser.h"
|
||||||
|
|
||||||
#define TSDB_QNODE_VER_NUMBER 1
|
#define QNODE_VER_NUMBER 1
|
||||||
#define TSDB_QNODE_RESERVE_SIZE 64
|
#define QNODE_RESERVE_SIZE 64
|
||||||
|
|
||||||
static SSdbRaw *mndQnodeActionEncode(SQnodeObj *pObj);
|
static SSdbRaw *mndQnodeActionEncode(SQnodeObj *pObj);
|
||||||
static SSdbRow *mndQnodeActionDecode(SSdbRaw *pRaw);
|
static SSdbRow *mndQnodeActionDecode(SSdbRaw *pRaw);
|
||||||
static int32_t mndQnodeActionInsert(SSdb *pSdb, SQnodeObj *pObj);
|
static int32_t mndQnodeActionInsert(SSdb *pSdb, SQnodeObj *pObj);
|
||||||
static int32_t mndQnodeActionDelete(SSdb *pSdb, SQnodeObj *pObj);
|
|
||||||
static int32_t mndQnodeActionUpdate(SSdb *pSdb, SQnodeObj *pOld, SQnodeObj *pNew);
|
static int32_t mndQnodeActionUpdate(SSdb *pSdb, SQnodeObj *pOld, SQnodeObj *pNew);
|
||||||
|
static int32_t mndQnodeActionDelete(SSdb *pSdb, SQnodeObj *pObj);
|
||||||
static int32_t mndProcessCreateQnodeReq(SNodeMsg *pReq);
|
static int32_t mndProcessCreateQnodeReq(SNodeMsg *pReq);
|
||||||
static int32_t mndProcessDropQnodeReq(SNodeMsg *pReq);
|
|
||||||
static int32_t mndProcessCreateQnodeRsp(SNodeMsg *pRsp);
|
static int32_t mndProcessCreateQnodeRsp(SNodeMsg *pRsp);
|
||||||
|
static int32_t mndProcessDropQnodeReq(SNodeMsg *pReq);
|
||||||
static int32_t mndProcessDropQnodeRsp(SNodeMsg *pRsp);
|
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, char *data, int32_t rows);
|
||||||
static void mndCancelGetNextQnode(SMnode *pMnode, void *pIter);
|
static void mndCancelGetNextQnode(SMnode *pMnode, void *pIter);
|
||||||
static int32_t mndProcessQnodeListReq(SNodeMsg *pReq);
|
|
||||||
|
|
||||||
int32_t mndInitQnode(SMnode *pMnode) {
|
int32_t mndInitQnode(SMnode *pMnode) {
|
||||||
SSdbTable table = {.sdbType = SDB_QNODE,
|
SSdbTable table = {.sdbType = SDB_QNODE,
|
||||||
|
@ -48,9 +48,9 @@ int32_t mndInitQnode(SMnode *pMnode) {
|
||||||
|
|
||||||
mndSetMsgHandle(pMnode, TDMT_MND_CREATE_QNODE, mndProcessCreateQnodeReq);
|
mndSetMsgHandle(pMnode, TDMT_MND_CREATE_QNODE, mndProcessCreateQnodeReq);
|
||||||
mndSetMsgHandle(pMnode, TDMT_MND_DROP_QNODE, mndProcessDropQnodeReq);
|
mndSetMsgHandle(pMnode, TDMT_MND_DROP_QNODE, mndProcessDropQnodeReq);
|
||||||
mndSetMsgHandle(pMnode, TDMT_MND_QNODE_LIST, mndProcessQnodeListReq);
|
|
||||||
mndSetMsgHandle(pMnode, TDMT_DND_CREATE_QNODE_RSP, mndProcessCreateQnodeRsp);
|
mndSetMsgHandle(pMnode, TDMT_DND_CREATE_QNODE_RSP, mndProcessCreateQnodeRsp);
|
||||||
mndSetMsgHandle(pMnode, TDMT_DND_DROP_QNODE_RSP, mndProcessDropQnodeRsp);
|
mndSetMsgHandle(pMnode, TDMT_DND_DROP_QNODE_RSP, mndProcessDropQnodeRsp);
|
||||||
|
mndSetMsgHandle(pMnode, TDMT_MND_QNODE_LIST, mndProcessQnodeListReq);
|
||||||
|
|
||||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_QNODE, mndRetrieveQnodes);
|
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_QNODE, mndRetrieveQnodes);
|
||||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_QNODE, mndCancelGetNextQnode);
|
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_QNODE, mndCancelGetNextQnode);
|
||||||
|
@ -76,18 +76,18 @@ static void mndReleaseQnode(SMnode *pMnode, SQnodeObj *pObj) {
|
||||||
static SSdbRaw *mndQnodeActionEncode(SQnodeObj *pObj) {
|
static SSdbRaw *mndQnodeActionEncode(SQnodeObj *pObj) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
SSdbRaw *pRaw = sdbAllocRaw(SDB_QNODE, TSDB_QNODE_VER_NUMBER, sizeof(SQnodeObj) + TSDB_QNODE_RESERVE_SIZE);
|
SSdbRaw *pRaw = sdbAllocRaw(SDB_QNODE, QNODE_VER_NUMBER, sizeof(SQnodeObj) + QNODE_RESERVE_SIZE);
|
||||||
if (pRaw == NULL) goto QNODE_ENCODE_OVER;
|
if (pRaw == NULL) goto _OVER;
|
||||||
|
|
||||||
int32_t dataPos = 0;
|
int32_t dataPos = 0;
|
||||||
SDB_SET_INT32(pRaw, dataPos, pObj->id, QNODE_ENCODE_OVER)
|
SDB_SET_INT32(pRaw, dataPos, pObj->id, _OVER)
|
||||||
SDB_SET_INT64(pRaw, dataPos, pObj->createdTime, QNODE_ENCODE_OVER)
|
SDB_SET_INT64(pRaw, dataPos, pObj->createdTime, _OVER)
|
||||||
SDB_SET_INT64(pRaw, dataPos, pObj->updateTime, QNODE_ENCODE_OVER)
|
SDB_SET_INT64(pRaw, dataPos, pObj->updateTime, _OVER)
|
||||||
SDB_SET_RESERVE(pRaw, dataPos, TSDB_QNODE_RESERVE_SIZE, QNODE_ENCODE_OVER)
|
SDB_SET_RESERVE(pRaw, dataPos, QNODE_RESERVE_SIZE, _OVER)
|
||||||
|
|
||||||
terrno = 0;
|
terrno = 0;
|
||||||
|
|
||||||
QNODE_ENCODE_OVER:
|
_OVER:
|
||||||
if (terrno != 0) {
|
if (terrno != 0) {
|
||||||
mError("qnode:%d, failed to encode to raw:%p since %s", pObj->id, pRaw, terrstr());
|
mError("qnode:%d, failed to encode to raw:%p since %s", pObj->id, pRaw, terrstr());
|
||||||
sdbFreeRaw(pRaw);
|
sdbFreeRaw(pRaw);
|
||||||
|
@ -102,28 +102,28 @@ static SSdbRow *mndQnodeActionDecode(SSdbRaw *pRaw) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
int8_t sver = 0;
|
int8_t sver = 0;
|
||||||
if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto QNODE_DECODE_OVER;
|
if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER;
|
||||||
|
|
||||||
if (sver != TSDB_QNODE_VER_NUMBER) {
|
if (sver != QNODE_VER_NUMBER) {
|
||||||
terrno = TSDB_CODE_SDB_INVALID_DATA_VER;
|
terrno = TSDB_CODE_SDB_INVALID_DATA_VER;
|
||||||
goto QNODE_DECODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSdbRow *pRow = sdbAllocRow(sizeof(SQnodeObj));
|
SSdbRow *pRow = sdbAllocRow(sizeof(SQnodeObj));
|
||||||
if (pRow == NULL) goto QNODE_DECODE_OVER;
|
if (pRow == NULL) goto _OVER;
|
||||||
|
|
||||||
SQnodeObj *pObj = sdbGetRowObj(pRow);
|
SQnodeObj *pObj = sdbGetRowObj(pRow);
|
||||||
if (pObj == NULL) goto QNODE_DECODE_OVER;
|
if (pObj == NULL) goto _OVER;
|
||||||
|
|
||||||
int32_t dataPos = 0;
|
int32_t dataPos = 0;
|
||||||
SDB_GET_INT32(pRaw, dataPos, &pObj->id, QNODE_DECODE_OVER)
|
SDB_GET_INT32(pRaw, dataPos, &pObj->id, _OVER)
|
||||||
SDB_GET_INT64(pRaw, dataPos, &pObj->createdTime, QNODE_DECODE_OVER)
|
SDB_GET_INT64(pRaw, dataPos, &pObj->createdTime, _OVER)
|
||||||
SDB_GET_INT64(pRaw, dataPos, &pObj->updateTime, QNODE_DECODE_OVER)
|
SDB_GET_INT64(pRaw, dataPos, &pObj->updateTime, _OVER)
|
||||||
SDB_GET_RESERVE(pRaw, dataPos, TSDB_QNODE_RESERVE_SIZE, QNODE_DECODE_OVER)
|
SDB_GET_RESERVE(pRaw, dataPos, QNODE_RESERVE_SIZE, _OVER)
|
||||||
|
|
||||||
terrno = 0;
|
terrno = 0;
|
||||||
|
|
||||||
QNODE_DECODE_OVER:
|
_OVER:
|
||||||
if (terrno != 0) {
|
if (terrno != 0) {
|
||||||
mError("qnode:%d, failed to decode from raw:%p since %s", pObj->id, pRaw, terrstr());
|
mError("qnode:%d, failed to decode from raw:%p since %s", pObj->id, pRaw, terrstr());
|
||||||
taosMemoryFreeClear(pRow);
|
taosMemoryFreeClear(pRow);
|
||||||
|
@ -190,13 +190,13 @@ static int32_t mndSetCreateQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
||||||
SDCreateQnodeReq createReq = {0};
|
SDCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = pDnode->id;
|
createReq.dnodeId = pDnode->id;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void *pReq = taosMemoryMalloc(contLen);
|
void *pReq = taosMemoryMalloc(contLen);
|
||||||
if (pReq == NULL) {
|
if (pReq == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
STransAction action = {0};
|
STransAction action = {0};
|
||||||
action.epSet = mndGetDnodeEpset(pDnode);
|
action.epSet = mndGetDnodeEpset(pDnode);
|
||||||
|
@ -217,13 +217,13 @@ static int32_t mndSetCreateQnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
||||||
SDDropQnodeReq dropReq = {0};
|
SDDropQnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = pDnode->id;
|
dropReq.dnodeId = pDnode->id;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void *pReq = taosMemoryMalloc(contLen);
|
void *pReq = taosMemoryMalloc(contLen);
|
||||||
if (pReq == NULL) {
|
if (pReq == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
STransAction action = {0};
|
STransAction action = {0};
|
||||||
action.epSet = mndGetDnodeEpset(pDnode);
|
action.epSet = mndGetDnodeEpset(pDnode);
|
||||||
|
@ -249,19 +249,19 @@ static int32_t mndCreateQnode(SMnode *pMnode, SNodeMsg *pReq, SDnodeObj *pDnode,
|
||||||
qnodeObj.updateTime = qnodeObj.createdTime;
|
qnodeObj.updateTime = qnodeObj.createdTime;
|
||||||
|
|
||||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_TYPE_CREATE_QNODE, &pReq->rpcMsg);
|
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_TYPE_CREATE_QNODE, &pReq->rpcMsg);
|
||||||
if (pTrans == NULL) goto CREATE_QNODE_OVER;
|
if (pTrans == NULL) goto _OVER;
|
||||||
|
|
||||||
mDebug("trans:%d, used to create qnode:%d", pTrans->id, pCreate->dnodeId);
|
mDebug("trans:%d, used to create qnode:%d", pTrans->id, pCreate->dnodeId);
|
||||||
if (mndSetCreateQnodeRedoLogs(pTrans, &qnodeObj) != 0) goto CREATE_QNODE_OVER;
|
if (mndSetCreateQnodeRedoLogs(pTrans, &qnodeObj) != 0) goto _OVER;
|
||||||
if (mndSetCreateQnodeUndoLogs(pTrans, &qnodeObj) != 0) goto CREATE_QNODE_OVER;
|
if (mndSetCreateQnodeUndoLogs(pTrans, &qnodeObj) != 0) goto _OVER;
|
||||||
if (mndSetCreateQnodeCommitLogs(pTrans, &qnodeObj) != 0) goto CREATE_QNODE_OVER;
|
if (mndSetCreateQnodeCommitLogs(pTrans, &qnodeObj) != 0) goto _OVER;
|
||||||
if (mndSetCreateQnodeRedoActions(pTrans, pDnode, &qnodeObj) != 0) goto CREATE_QNODE_OVER;
|
if (mndSetCreateQnodeRedoActions(pTrans, pDnode, &qnodeObj) != 0) goto _OVER;
|
||||||
if (mndSetCreateQnodeUndoActions(pTrans, pDnode, &qnodeObj) != 0) goto CREATE_QNODE_OVER;
|
if (mndSetCreateQnodeUndoActions(pTrans, pDnode, &qnodeObj) != 0) goto _OVER;
|
||||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto CREATE_QNODE_OVER;
|
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
||||||
|
|
||||||
code = 0;
|
code = 0;
|
||||||
|
|
||||||
CREATE_QNODE_OVER:
|
_OVER:
|
||||||
mndTransDrop(pTrans);
|
mndTransDrop(pTrans);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -274,9 +274,9 @@ static int32_t mndProcessCreateQnodeReq(SNodeMsg *pReq) {
|
||||||
SUserObj *pUser = NULL;
|
SUserObj *pUser = NULL;
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
|
|
||||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &createReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &createReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
goto CREATE_QNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
mDebug("qnode:%d, start to create", createReq.dnodeId);
|
mDebug("qnode:%d, start to create", createReq.dnodeId);
|
||||||
|
@ -284,31 +284,31 @@ static int32_t mndProcessCreateQnodeReq(SNodeMsg *pReq) {
|
||||||
pObj = mndAcquireQnode(pMnode, createReq.dnodeId);
|
pObj = mndAcquireQnode(pMnode, createReq.dnodeId);
|
||||||
if (pObj != NULL) {
|
if (pObj != NULL) {
|
||||||
terrno = TSDB_CODE_MND_QNODE_ALREADY_EXIST;
|
terrno = TSDB_CODE_MND_QNODE_ALREADY_EXIST;
|
||||||
goto CREATE_QNODE_OVER;
|
goto _OVER;
|
||||||
} else if (terrno != TSDB_CODE_MND_QNODE_NOT_EXIST) {
|
} else if (terrno != TSDB_CODE_MND_QNODE_NOT_EXIST) {
|
||||||
goto CREATE_QNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
pDnode = mndAcquireDnode(pMnode, createReq.dnodeId);
|
pDnode = mndAcquireDnode(pMnode, createReq.dnodeId);
|
||||||
if (pDnode == NULL) {
|
if (pDnode == NULL) {
|
||||||
terrno = TSDB_CODE_MND_DNODE_NOT_EXIST;
|
terrno = TSDB_CODE_MND_DNODE_NOT_EXIST;
|
||||||
goto CREATE_QNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
pUser = mndAcquireUser(pMnode, pReq->user);
|
pUser = mndAcquireUser(pMnode, pReq->user);
|
||||||
if (pUser == NULL) {
|
if (pUser == NULL) {
|
||||||
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
||||||
goto CREATE_QNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mndCheckNodeAuth(pUser)) {
|
if (mndCheckNodeAuth(pUser)) {
|
||||||
goto CREATE_QNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = mndCreateQnode(pMnode, pReq, pDnode, &createReq);
|
code = mndCreateQnode(pMnode, pReq, pDnode, &createReq);
|
||||||
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||||
|
|
||||||
CREATE_QNODE_OVER:
|
_OVER:
|
||||||
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
||||||
mError("qnode:%d, failed to create since %s", createReq.dnodeId, terrstr());
|
mError("qnode:%d, failed to create since %s", createReq.dnodeId, terrstr());
|
||||||
}
|
}
|
||||||
|
@ -316,7 +316,6 @@ CREATE_QNODE_OVER:
|
||||||
mndReleaseQnode(pMnode, pObj);
|
mndReleaseQnode(pMnode, pObj);
|
||||||
mndReleaseDnode(pMnode, pDnode);
|
mndReleaseDnode(pMnode, pDnode);
|
||||||
mndReleaseUser(pMnode, pUser);
|
mndReleaseUser(pMnode, pUser);
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,13 +339,13 @@ static int32_t mndSetDropQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SQn
|
||||||
SDDropQnodeReq dropReq = {0};
|
SDDropQnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = pDnode->id;
|
dropReq.dnodeId = pDnode->id;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void *pReq = taosMemoryMalloc(contLen);
|
void *pReq = taosMemoryMalloc(contLen);
|
||||||
if (pReq == NULL) {
|
if (pReq == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
STransAction action = {0};
|
STransAction action = {0};
|
||||||
action.epSet = mndGetDnodeEpset(pDnode);
|
action.epSet = mndGetDnodeEpset(pDnode);
|
||||||
|
@ -367,17 +366,17 @@ static int32_t mndDropQnode(SMnode *pMnode, SNodeMsg *pReq, SQnodeObj *pObj) {
|
||||||
int32_t code = -1;
|
int32_t code = -1;
|
||||||
|
|
||||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_TYPE_DROP_QNODE, &pReq->rpcMsg);
|
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_TYPE_DROP_QNODE, &pReq->rpcMsg);
|
||||||
if (pTrans == NULL) goto DROP_QNODE_OVER;
|
if (pTrans == NULL) goto _OVER;
|
||||||
|
|
||||||
mDebug("trans:%d, used to drop qnode:%d", pTrans->id, pObj->id);
|
mDebug("trans:%d, used to drop qnode:%d", pTrans->id, pObj->id);
|
||||||
if (mndSetDropQnodeRedoLogs(pTrans, pObj) != 0) goto DROP_QNODE_OVER;
|
if (mndSetDropQnodeRedoLogs(pTrans, pObj) != 0) goto _OVER;
|
||||||
if (mndSetDropQnodeCommitLogs(pTrans, pObj) != 0) goto DROP_QNODE_OVER;
|
if (mndSetDropQnodeCommitLogs(pTrans, pObj) != 0) goto _OVER;
|
||||||
if (mndSetDropQnodeRedoActions(pTrans, pObj->pDnode, pObj) != 0) goto DROP_QNODE_OVER;
|
if (mndSetDropQnodeRedoActions(pTrans, pObj->pDnode, pObj) != 0) goto _OVER;
|
||||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto DROP_QNODE_OVER;
|
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
||||||
|
|
||||||
code = 0;
|
code = 0;
|
||||||
|
|
||||||
DROP_QNODE_OVER:
|
_OVER:
|
||||||
mndTransDrop(pTrans);
|
mndTransDrop(pTrans);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -389,37 +388,37 @@ static int32_t mndProcessDropQnodeReq(SNodeMsg *pReq) {
|
||||||
SQnodeObj *pObj = NULL;
|
SQnodeObj *pObj = NULL;
|
||||||
SMDropQnodeReq dropReq = {0};
|
SMDropQnodeReq dropReq = {0};
|
||||||
|
|
||||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
goto DROP_QNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
mDebug("qnode:%d, start to drop", dropReq.dnodeId);
|
mDebug("qnode:%d, start to drop", dropReq.dnodeId);
|
||||||
|
|
||||||
if (dropReq.dnodeId <= 0) {
|
if (dropReq.dnodeId <= 0) {
|
||||||
terrno = TSDB_CODE_SDB_APP_ERROR;
|
terrno = TSDB_CODE_SDB_APP_ERROR;
|
||||||
goto DROP_QNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
pObj = mndAcquireQnode(pMnode, dropReq.dnodeId);
|
pObj = mndAcquireQnode(pMnode, dropReq.dnodeId);
|
||||||
if (pObj == NULL) {
|
if (pObj == NULL) {
|
||||||
goto DROP_QNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
pUser = mndAcquireUser(pMnode, pReq->user);
|
pUser = mndAcquireUser(pMnode, pReq->user);
|
||||||
if (pUser == NULL) {
|
if (pUser == NULL) {
|
||||||
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
||||||
goto DROP_QNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mndCheckNodeAuth(pUser)) {
|
if (mndCheckNodeAuth(pUser)) {
|
||||||
goto DROP_QNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = mndDropQnode(pMnode, pReq, pObj);
|
code = mndDropQnode(pMnode, pReq, pObj);
|
||||||
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||||
|
|
||||||
DROP_QNODE_OVER:
|
_OVER:
|
||||||
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
||||||
mError("qnode:%d, failed to drop since %s", dropReq.dnodeId, terrstr());
|
mError("qnode:%d, failed to drop since %s", dropReq.dnodeId, terrstr());
|
||||||
}
|
}
|
||||||
|
@ -431,37 +430,36 @@ DROP_QNODE_OVER:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndProcessQnodeListReq(SNodeMsg *pReq) {
|
static int32_t mndProcessQnodeListReq(SNodeMsg *pReq) {
|
||||||
int32_t code = -1;
|
int32_t code = -1;
|
||||||
SQnodeListReq qlistReq = {0};
|
int32_t numOfRows = 0;
|
||||||
int32_t numOfRows = 0;
|
SMnode *pMnode = pReq->pNode;
|
||||||
SMnode *pMnode = pReq->pNode;
|
SSdb *pSdb = pMnode->pSdb;
|
||||||
SSdb *pSdb = pMnode->pSdb;
|
SQnodeObj *pObj = NULL;
|
||||||
SQnodeObj *pObj = NULL;
|
SQnodeListReq qlistReq = {0};
|
||||||
SQnodeListRsp qlistRsp = {0};
|
SQnodeListRsp qlistRsp = {0};
|
||||||
|
|
||||||
if (tDeserializeSQnodeListReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &qlistReq) != 0) {
|
if (tDeserializeSQnodeListReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &qlistReq) != 0) {
|
||||||
mError("invalid qnode list msg");
|
mError("failed to parse qnode list req");
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
goto QNODE_LIST_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
qlistRsp.epSetList = taosArrayInit(5, sizeof(SEpSet));
|
qlistRsp.epSetList = taosArrayInit(5, sizeof(SEpSet));
|
||||||
if (NULL == qlistRsp.epSetList) {
|
if (NULL == qlistRsp.epSetList) {
|
||||||
mError("taosArrayInit epSet failed");
|
mError("failed to alloc epSet while process qnode list req");
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto QNODE_LIST_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
void *pIter = sdbFetch(pSdb, SDB_QNODE, NULL, (void **)&pObj);
|
void *pIter = sdbFetch(pSdb, SDB_QNODE, NULL, (void **)&pObj);
|
||||||
if (pIter == NULL) break;
|
if (pIter == NULL) break;
|
||||||
|
|
||||||
SEpSet epSet = {0};
|
SEpSet epSet = {.numOfEps = 1};
|
||||||
strcpy(epSet.eps[0].fqdn, pObj->pDnode->fqdn);
|
tstrncpy(epSet.eps[0].fqdn, pObj->pDnode->fqdn, TSDB_FQDN_LEN);
|
||||||
epSet.eps[0].port = pObj->pDnode->port;
|
epSet.eps[0].port = pObj->pDnode->port;
|
||||||
epSet.numOfEps = 1;
|
|
||||||
|
|
||||||
taosArrayPush(qlistRsp.epSetList, &epSet);
|
(void)taosArrayPush(qlistRsp.epSetList, &epSet);
|
||||||
|
|
||||||
numOfRows++;
|
numOfRows++;
|
||||||
sdbRelease(pSdb, pObj);
|
sdbRelease(pSdb, pObj);
|
||||||
|
@ -475,19 +473,17 @@ static int32_t mndProcessQnodeListReq(SNodeMsg *pReq) {
|
||||||
void *pRsp = taosMemoryMalloc(rspLen);
|
void *pRsp = taosMemoryMalloc(rspLen);
|
||||||
if (pRsp == NULL) {
|
if (pRsp == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto QNODE_LIST_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
tSerializeSQnodeListRsp(pRsp, rspLen, &qlistRsp);
|
tSerializeSQnodeListRsp(pRsp, rspLen, &qlistRsp);
|
||||||
|
|
||||||
pReq->rspLen = rspLen;
|
pReq->rspLen = rspLen;
|
||||||
pReq->pRsp = pRsp;
|
pReq->pRsp = pRsp;
|
||||||
code = 0;
|
code = 0;
|
||||||
|
|
||||||
QNODE_LIST_OVER:
|
_OVER:
|
||||||
|
|
||||||
tFreeSQnodeListRsp(&qlistRsp);
|
tFreeSQnodeListRsp(&qlistRsp);
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,17 +21,17 @@
|
||||||
#include "mndTrans.h"
|
#include "mndTrans.h"
|
||||||
#include "mndUser.h"
|
#include "mndUser.h"
|
||||||
|
|
||||||
#define TSDB_SNODE_VER_NUMBER 1
|
#define SNODE_VER_NUMBER 1
|
||||||
#define TSDB_SNODE_RESERVE_SIZE 64
|
#define SNODE_RESERVE_SIZE 64
|
||||||
|
|
||||||
static SSdbRaw *mndSnodeActionEncode(SSnodeObj *pObj);
|
static SSdbRaw *mndSnodeActionEncode(SSnodeObj *pObj);
|
||||||
static SSdbRow *mndSnodeActionDecode(SSdbRaw *pRaw);
|
static SSdbRow *mndSnodeActionDecode(SSdbRaw *pRaw);
|
||||||
static int32_t mndSnodeActionInsert(SSdb *pSdb, SSnodeObj *pObj);
|
static int32_t mndSnodeActionInsert(SSdb *pSdb, SSnodeObj *pObj);
|
||||||
static int32_t mndSnodeActionDelete(SSdb *pSdb, SSnodeObj *pObj);
|
|
||||||
static int32_t mndSnodeActionUpdate(SSdb *pSdb, SSnodeObj *pOld, SSnodeObj *pNew);
|
static int32_t mndSnodeActionUpdate(SSdb *pSdb, SSnodeObj *pOld, SSnodeObj *pNew);
|
||||||
|
static int32_t mndSnodeActionDelete(SSdb *pSdb, SSnodeObj *pObj);
|
||||||
static int32_t mndProcessCreateSnodeReq(SNodeMsg *pReq);
|
static int32_t mndProcessCreateSnodeReq(SNodeMsg *pReq);
|
||||||
static int32_t mndProcessDropSnodeReq(SNodeMsg *pReq);
|
|
||||||
static int32_t mndProcessCreateSnodeRsp(SNodeMsg *pRsp);
|
static int32_t mndProcessCreateSnodeRsp(SNodeMsg *pRsp);
|
||||||
|
static int32_t mndProcessDropSnodeReq(SNodeMsg *pReq);
|
||||||
static int32_t mndProcessDropSnodeRsp(SNodeMsg *pRsp);
|
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, char *data, int32_t rows);
|
||||||
static void mndCancelGetNextSnode(SMnode *pMnode, void *pIter);
|
static void mndCancelGetNextSnode(SMnode *pMnode, void *pIter);
|
||||||
|
@ -59,11 +59,9 @@ int32_t mndInitSnode(SMnode *pMnode) {
|
||||||
void mndCleanupSnode(SMnode *pMnode) {}
|
void mndCleanupSnode(SMnode *pMnode) {}
|
||||||
|
|
||||||
SEpSet mndAcquireEpFromSnode(SMnode *pMnode, const SSnodeObj *pSnode) {
|
SEpSet mndAcquireEpFromSnode(SMnode *pMnode, const SSnodeObj *pSnode) {
|
||||||
SEpSet epSet;
|
SEpSet epSet = {.numOfEps = 1, .inUse = 0};
|
||||||
memcpy(epSet.eps->fqdn, pSnode->pDnode->fqdn, 128);
|
memcpy(epSet.eps[0].fqdn, pSnode->pDnode->fqdn, TSDB_FQDN_LEN);
|
||||||
epSet.eps->port = pSnode->pDnode->port;
|
epSet.eps[0].port = pSnode->pDnode->port;
|
||||||
epSet.numOfEps = 1;
|
|
||||||
epSet.inUse = 0;
|
|
||||||
return epSet;
|
return epSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,18 +81,18 @@ static void mndReleaseSnode(SMnode *pMnode, SSnodeObj *pObj) {
|
||||||
static SSdbRaw *mndSnodeActionEncode(SSnodeObj *pObj) {
|
static SSdbRaw *mndSnodeActionEncode(SSnodeObj *pObj) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
SSdbRaw *pRaw = sdbAllocRaw(SDB_SNODE, TSDB_SNODE_VER_NUMBER, sizeof(SSnodeObj) + TSDB_SNODE_RESERVE_SIZE);
|
SSdbRaw *pRaw = sdbAllocRaw(SDB_SNODE, SNODE_VER_NUMBER, sizeof(SSnodeObj) + SNODE_RESERVE_SIZE);
|
||||||
if (pRaw == NULL) goto SNODE_ENCODE_OVER;
|
if (pRaw == NULL) goto _OVER;
|
||||||
|
|
||||||
int32_t dataPos = 0;
|
int32_t dataPos = 0;
|
||||||
SDB_SET_INT32(pRaw, dataPos, pObj->id, SNODE_ENCODE_OVER)
|
SDB_SET_INT32(pRaw, dataPos, pObj->id, _OVER)
|
||||||
SDB_SET_INT64(pRaw, dataPos, pObj->createdTime, SNODE_ENCODE_OVER)
|
SDB_SET_INT64(pRaw, dataPos, pObj->createdTime, _OVER)
|
||||||
SDB_SET_INT64(pRaw, dataPos, pObj->updateTime, SNODE_ENCODE_OVER)
|
SDB_SET_INT64(pRaw, dataPos, pObj->updateTime, _OVER)
|
||||||
SDB_SET_RESERVE(pRaw, dataPos, TSDB_SNODE_RESERVE_SIZE, SNODE_ENCODE_OVER)
|
SDB_SET_RESERVE(pRaw, dataPos, SNODE_RESERVE_SIZE, _OVER)
|
||||||
|
|
||||||
terrno = 0;
|
terrno = 0;
|
||||||
|
|
||||||
SNODE_ENCODE_OVER:
|
_OVER:
|
||||||
if (terrno != 0) {
|
if (terrno != 0) {
|
||||||
mError("snode:%d, failed to encode to raw:%p since %s", pObj->id, pRaw, terrstr());
|
mError("snode:%d, failed to encode to raw:%p since %s", pObj->id, pRaw, terrstr());
|
||||||
sdbFreeRaw(pRaw);
|
sdbFreeRaw(pRaw);
|
||||||
|
@ -109,28 +107,28 @@ static SSdbRow *mndSnodeActionDecode(SSdbRaw *pRaw) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
int8_t sver = 0;
|
int8_t sver = 0;
|
||||||
if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto SNODE_DECODE_OVER;
|
if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER;
|
||||||
|
|
||||||
if (sver != TSDB_SNODE_VER_NUMBER) {
|
if (sver != SNODE_VER_NUMBER) {
|
||||||
terrno = TSDB_CODE_SDB_INVALID_DATA_VER;
|
terrno = TSDB_CODE_SDB_INVALID_DATA_VER;
|
||||||
goto SNODE_DECODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSdbRow *pRow = sdbAllocRow(sizeof(SSnodeObj));
|
SSdbRow *pRow = sdbAllocRow(sizeof(SSnodeObj));
|
||||||
if (pRow == NULL) goto SNODE_DECODE_OVER;
|
if (pRow == NULL) goto _OVER;
|
||||||
|
|
||||||
SSnodeObj *pObj = sdbGetRowObj(pRow);
|
SSnodeObj *pObj = sdbGetRowObj(pRow);
|
||||||
if (pObj == NULL) goto SNODE_DECODE_OVER;
|
if (pObj == NULL) goto _OVER;
|
||||||
|
|
||||||
int32_t dataPos = 0;
|
int32_t dataPos = 0;
|
||||||
SDB_GET_INT32(pRaw, dataPos, &pObj->id, SNODE_DECODE_OVER)
|
SDB_GET_INT32(pRaw, dataPos, &pObj->id, _OVER)
|
||||||
SDB_GET_INT64(pRaw, dataPos, &pObj->createdTime, SNODE_DECODE_OVER)
|
SDB_GET_INT64(pRaw, dataPos, &pObj->createdTime, _OVER)
|
||||||
SDB_GET_INT64(pRaw, dataPos, &pObj->updateTime, SNODE_DECODE_OVER)
|
SDB_GET_INT64(pRaw, dataPos, &pObj->updateTime, _OVER)
|
||||||
SDB_GET_RESERVE(pRaw, dataPos, TSDB_SNODE_RESERVE_SIZE, SNODE_DECODE_OVER)
|
SDB_GET_RESERVE(pRaw, dataPos, SNODE_RESERVE_SIZE, _OVER)
|
||||||
|
|
||||||
terrno = 0;
|
terrno = 0;
|
||||||
|
|
||||||
SNODE_DECODE_OVER:
|
_OVER:
|
||||||
if (terrno != 0) {
|
if (terrno != 0) {
|
||||||
mError("snode:%d, failed to decode from raw:%p since %s", pObj->id, pRaw, terrstr());
|
mError("snode:%d, failed to decode from raw:%p since %s", pObj->id, pRaw, terrstr());
|
||||||
taosMemoryFreeClear(pRow);
|
taosMemoryFreeClear(pRow);
|
||||||
|
@ -197,13 +195,13 @@ static int32_t mndSetCreateSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
||||||
SDCreateSnodeReq createReq = {0};
|
SDCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = pDnode->id;
|
createReq.dnodeId = pDnode->id;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void *pReq = taosMemoryMalloc(contLen);
|
void *pReq = taosMemoryMalloc(contLen);
|
||||||
if (pReq == NULL) {
|
if (pReq == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
STransAction action = {0};
|
STransAction action = {0};
|
||||||
action.epSet = mndGetDnodeEpset(pDnode);
|
action.epSet = mndGetDnodeEpset(pDnode);
|
||||||
|
@ -224,13 +222,13 @@ static int32_t mndSetCreateSnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
||||||
SDDropSnodeReq dropReq = {0};
|
SDDropSnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = pDnode->id;
|
dropReq.dnodeId = pDnode->id;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void *pReq = taosMemoryMalloc(contLen);
|
void *pReq = taosMemoryMalloc(contLen);
|
||||||
if (pReq == NULL) {
|
if (pReq == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
STransAction action = {0};
|
STransAction action = {0};
|
||||||
action.epSet = mndGetDnodeEpset(pDnode);
|
action.epSet = mndGetDnodeEpset(pDnode);
|
||||||
|
@ -256,20 +254,20 @@ static int32_t mndCreateSnode(SMnode *pMnode, SNodeMsg *pReq, SDnodeObj *pDnode,
|
||||||
snodeObj.updateTime = snodeObj.createdTime;
|
snodeObj.updateTime = snodeObj.createdTime;
|
||||||
|
|
||||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_TYPE_CREATE_SNODE, &pReq->rpcMsg);
|
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_TYPE_CREATE_SNODE, &pReq->rpcMsg);
|
||||||
if (pTrans == NULL) goto CREATE_SNODE_OVER;
|
if (pTrans == NULL) goto _OVER;
|
||||||
|
|
||||||
mDebug("trans:%d, used to create snode:%d", pTrans->id, pCreate->dnodeId);
|
mDebug("trans:%d, used to create snode:%d", pTrans->id, pCreate->dnodeId);
|
||||||
|
|
||||||
if (mndSetCreateSnodeRedoLogs(pTrans, &snodeObj) != 0) goto CREATE_SNODE_OVER;
|
if (mndSetCreateSnodeRedoLogs(pTrans, &snodeObj) != 0) goto _OVER;
|
||||||
if (mndSetCreateSnodeUndoLogs(pTrans, &snodeObj) != 0) goto CREATE_SNODE_OVER;
|
if (mndSetCreateSnodeUndoLogs(pTrans, &snodeObj) != 0) goto _OVER;
|
||||||
if (mndSetCreateSnodeCommitLogs(pTrans, &snodeObj) != 0) goto CREATE_SNODE_OVER;
|
if (mndSetCreateSnodeCommitLogs(pTrans, &snodeObj) != 0) goto _OVER;
|
||||||
if (mndSetCreateSnodeRedoActions(pTrans, pDnode, &snodeObj) != 0) goto CREATE_SNODE_OVER;
|
if (mndSetCreateSnodeRedoActions(pTrans, pDnode, &snodeObj) != 0) goto _OVER;
|
||||||
if (mndSetCreateSnodeUndoActions(pTrans, pDnode, &snodeObj) != 0) goto CREATE_SNODE_OVER;
|
if (mndSetCreateSnodeUndoActions(pTrans, pDnode, &snodeObj) != 0) goto _OVER;
|
||||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto CREATE_SNODE_OVER;
|
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
||||||
|
|
||||||
code = 0;
|
code = 0;
|
||||||
|
|
||||||
CREATE_SNODE_OVER:
|
_OVER:
|
||||||
mndTransDrop(pTrans);
|
mndTransDrop(pTrans);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -282,9 +280,9 @@ static int32_t mndProcessCreateSnodeReq(SNodeMsg *pReq) {
|
||||||
SUserObj *pUser = NULL;
|
SUserObj *pUser = NULL;
|
||||||
SMCreateSnodeReq createReq = {0};
|
SMCreateSnodeReq createReq = {0};
|
||||||
|
|
||||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &createReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &createReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
goto CREATE_SNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
mDebug("snode:%d, start to create", createReq.dnodeId);
|
mDebug("snode:%d, start to create", createReq.dnodeId);
|
||||||
|
@ -292,31 +290,31 @@ static int32_t mndProcessCreateSnodeReq(SNodeMsg *pReq) {
|
||||||
pObj = mndAcquireSnode(pMnode, createReq.dnodeId);
|
pObj = mndAcquireSnode(pMnode, createReq.dnodeId);
|
||||||
if (pObj != NULL) {
|
if (pObj != NULL) {
|
||||||
terrno = TSDB_CODE_MND_SNODE_ALREADY_EXIST;
|
terrno = TSDB_CODE_MND_SNODE_ALREADY_EXIST;
|
||||||
goto CREATE_SNODE_OVER;
|
goto _OVER;
|
||||||
} else if (terrno != TSDB_CODE_MND_SNODE_NOT_EXIST) {
|
} else if (terrno != TSDB_CODE_MND_SNODE_NOT_EXIST) {
|
||||||
goto CREATE_SNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
pDnode = mndAcquireDnode(pMnode, createReq.dnodeId);
|
pDnode = mndAcquireDnode(pMnode, createReq.dnodeId);
|
||||||
if (pDnode == NULL) {
|
if (pDnode == NULL) {
|
||||||
terrno = TSDB_CODE_MND_DNODE_NOT_EXIST;
|
terrno = TSDB_CODE_MND_DNODE_NOT_EXIST;
|
||||||
goto CREATE_SNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
pUser = mndAcquireUser(pMnode, pReq->user);
|
pUser = mndAcquireUser(pMnode, pReq->user);
|
||||||
if (pUser == NULL) {
|
if (pUser == NULL) {
|
||||||
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
||||||
goto CREATE_SNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mndCheckNodeAuth(pUser)) {
|
if (mndCheckNodeAuth(pUser)) {
|
||||||
goto CREATE_SNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = mndCreateSnode(pMnode, pReq, pDnode, &createReq);
|
code = mndCreateSnode(pMnode, pReq, pDnode, &createReq);
|
||||||
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||||
|
|
||||||
CREATE_SNODE_OVER:
|
_OVER:
|
||||||
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
||||||
mError("snode:%d, failed to create since %s", createReq.dnodeId, terrstr());
|
mError("snode:%d, failed to create since %s", createReq.dnodeId, terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -325,7 +323,6 @@ CREATE_SNODE_OVER:
|
||||||
mndReleaseSnode(pMnode, pObj);
|
mndReleaseSnode(pMnode, pObj);
|
||||||
mndReleaseDnode(pMnode, pDnode);
|
mndReleaseDnode(pMnode, pDnode);
|
||||||
mndReleaseUser(pMnode, pUser);
|
mndReleaseUser(pMnode, pUser);
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,13 +346,13 @@ static int32_t mndSetDropSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SSn
|
||||||
SDDropSnodeReq dropReq = {0};
|
SDDropSnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = pDnode->id;
|
dropReq.dnodeId = pDnode->id;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void *pReq = taosMemoryMalloc(contLen);
|
void *pReq = taosMemoryMalloc(contLen);
|
||||||
if (pReq == NULL) {
|
if (pReq == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
STransAction action = {0};
|
STransAction action = {0};
|
||||||
action.epSet = mndGetDnodeEpset(pDnode);
|
action.epSet = mndGetDnodeEpset(pDnode);
|
||||||
|
@ -376,18 +373,18 @@ static int32_t mndDropSnode(SMnode *pMnode, SNodeMsg *pReq, SSnodeObj *pObj) {
|
||||||
int32_t code = -1;
|
int32_t code = -1;
|
||||||
|
|
||||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_TYPE_DROP_SNODE, &pReq->rpcMsg);
|
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_TYPE_DROP_SNODE, &pReq->rpcMsg);
|
||||||
if (pTrans == NULL) goto DROP_SNODE_OVER;
|
if (pTrans == NULL) goto _OVER;
|
||||||
|
|
||||||
mDebug("trans:%d, used to drop snode:%d", pTrans->id, pObj->id);
|
mDebug("trans:%d, used to drop snode:%d", pTrans->id, pObj->id);
|
||||||
|
|
||||||
if (mndSetDropSnodeRedoLogs(pTrans, pObj) != 0) goto DROP_SNODE_OVER;
|
if (mndSetDropSnodeRedoLogs(pTrans, pObj) != 0) goto _OVER;
|
||||||
if (mndSetDropSnodeCommitLogs(pTrans, pObj) != 0) goto DROP_SNODE_OVER;
|
if (mndSetDropSnodeCommitLogs(pTrans, pObj) != 0) goto _OVER;
|
||||||
if (mndSetDropSnodeRedoActions(pTrans, pObj->pDnode, pObj) != 0) goto DROP_SNODE_OVER;
|
if (mndSetDropSnodeRedoActions(pTrans, pObj->pDnode, pObj) != 0) goto _OVER;
|
||||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto DROP_SNODE_OVER;
|
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
||||||
|
|
||||||
code = 0;
|
code = 0;
|
||||||
|
|
||||||
DROP_SNODE_OVER:
|
_OVER:
|
||||||
mndTransDrop(pTrans);
|
mndTransDrop(pTrans);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -399,37 +396,37 @@ static int32_t mndProcessDropSnodeReq(SNodeMsg *pReq) {
|
||||||
SSnodeObj *pObj = NULL;
|
SSnodeObj *pObj = NULL;
|
||||||
SMDropSnodeReq dropReq = {0};
|
SMDropSnodeReq dropReq = {0};
|
||||||
|
|
||||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
goto DROP_SNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
mDebug("snode:%d, start to drop", dropReq.dnodeId);
|
mDebug("snode:%d, start to drop", dropReq.dnodeId);
|
||||||
|
|
||||||
if (dropReq.dnodeId <= 0) {
|
if (dropReq.dnodeId <= 0) {
|
||||||
terrno = TSDB_CODE_SDB_APP_ERROR;
|
terrno = TSDB_CODE_SDB_APP_ERROR;
|
||||||
goto DROP_SNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
pObj = mndAcquireSnode(pMnode, dropReq.dnodeId);
|
pObj = mndAcquireSnode(pMnode, dropReq.dnodeId);
|
||||||
if (pObj == NULL) {
|
if (pObj == NULL) {
|
||||||
goto DROP_SNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
pUser = mndAcquireUser(pMnode, pReq->user);
|
pUser = mndAcquireUser(pMnode, pReq->user);
|
||||||
if (pUser == NULL) {
|
if (pUser == NULL) {
|
||||||
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
||||||
goto DROP_SNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mndCheckNodeAuth(pUser)) {
|
if (mndCheckNodeAuth(pUser)) {
|
||||||
goto DROP_SNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = mndDropSnode(pMnode, pReq, pObj);
|
code = mndDropSnode(pMnode, pReq, pObj);
|
||||||
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||||
|
|
||||||
DROP_SNODE_OVER:
|
_OVER:
|
||||||
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
||||||
mError("snode:%d, failed to drop since %s", dropReq.dnodeId, terrstr());
|
mError("snode:%d, failed to drop since %s", dropReq.dnodeId, terrstr());
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,9 +55,9 @@ TEST_F(MndTestBnode, 02_Create_Bnode) {
|
||||||
SMCreateBnodeReq createReq = {0};
|
SMCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -68,9 +68,9 @@ TEST_F(MndTestBnode, 02_Create_Bnode) {
|
||||||
SMCreateBnodeReq createReq = {0};
|
SMCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -90,9 +90,9 @@ TEST_F(MndTestBnode, 02_Create_Bnode) {
|
||||||
SMCreateBnodeReq createReq = {0};
|
SMCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -124,9 +124,9 @@ TEST_F(MndTestBnode, 03_Drop_Bnode) {
|
||||||
SMCreateBnodeReq createReq = {0};
|
SMCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -148,9 +148,9 @@ TEST_F(MndTestBnode, 03_Drop_Bnode) {
|
||||||
SMDropBnodeReq dropReq = {0};
|
SMDropBnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -169,9 +169,9 @@ TEST_F(MndTestBnode, 03_Drop_Bnode) {
|
||||||
SMDropBnodeReq dropReq = {0};
|
SMDropBnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -185,9 +185,9 @@ TEST_F(MndTestBnode, 03_Create_Bnode_Rollback) {
|
||||||
SMCreateBnodeReq createReq = {0};
|
SMCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
server2.Stop();
|
server2.Stop();
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||||
|
@ -200,9 +200,9 @@ TEST_F(MndTestBnode, 03_Create_Bnode_Rollback) {
|
||||||
SMCreateBnodeReq createReq = {0};
|
SMCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -214,9 +214,9 @@ TEST_F(MndTestBnode, 03_Create_Bnode_Rollback) {
|
||||||
SMDropBnodeReq dropReq = {0};
|
SMDropBnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -235,9 +235,9 @@ TEST_F(MndTestBnode, 03_Create_Bnode_Rollback) {
|
||||||
SMCreateBnodeReq createReq = {0};
|
SMCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -255,9 +255,9 @@ TEST_F(MndTestBnode, 04_Drop_Bnode_Rollback) {
|
||||||
SMDropBnodeReq dropReq = {0};
|
SMDropBnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
server2.Stop();
|
server2.Stop();
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen);
|
||||||
|
@ -270,9 +270,9 @@ TEST_F(MndTestBnode, 04_Drop_Bnode_Rollback) {
|
||||||
SMCreateBnodeReq createReq = {0};
|
SMCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -284,9 +284,9 @@ TEST_F(MndTestBnode, 04_Drop_Bnode_Rollback) {
|
||||||
SMDropBnodeReq dropReq = {0};
|
SMDropBnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -305,9 +305,9 @@ TEST_F(MndTestBnode, 04_Drop_Bnode_Rollback) {
|
||||||
SMCreateBnodeReq createReq = {0};
|
SMCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
|
|
@ -63,9 +63,9 @@ TEST_F(MndTestMnode, 02_Create_Mnode_Invalid_Id) {
|
||||||
SMCreateMnodeReq createReq = {0};
|
SMCreateMnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -78,9 +78,9 @@ TEST_F(MndTestMnode, 03_Create_Mnode_Invalid_Id) {
|
||||||
SMCreateMnodeReq createReq = {0};
|
SMCreateMnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -114,9 +114,9 @@ TEST_F(MndTestMnode, 04_Create_Mnode) {
|
||||||
SMCreateMnodeReq createReq = {0};
|
SMCreateMnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -143,9 +143,9 @@ TEST_F(MndTestMnode, 04_Create_Mnode) {
|
||||||
SMDropMnodeReq dropReq = {0};
|
SMDropMnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -167,9 +167,9 @@ TEST_F(MndTestMnode, 04_Create_Mnode) {
|
||||||
SMDropMnodeReq dropReq = {0};
|
SMDropMnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -183,9 +183,9 @@ TEST_F(MndTestMnode, 03_Create_Mnode_Rollback) {
|
||||||
SMCreateMnodeReq createReq = {0};
|
SMCreateMnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
server2.Stop();
|
server2.Stop();
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
||||||
|
@ -198,9 +198,9 @@ TEST_F(MndTestMnode, 03_Create_Mnode_Rollback) {
|
||||||
SMCreateMnodeReq createReq = {0};
|
SMCreateMnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -212,9 +212,9 @@ TEST_F(MndTestMnode, 03_Create_Mnode_Rollback) {
|
||||||
SMDropMnodeReq dropReq = {0};
|
SMDropMnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -233,9 +233,9 @@ TEST_F(MndTestMnode, 03_Create_Mnode_Rollback) {
|
||||||
SMCreateMnodeReq createReq = {0};
|
SMCreateMnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -253,9 +253,9 @@ TEST_F(MndTestMnode, 04_Drop_Mnode_Rollback) {
|
||||||
SMDropMnodeReq dropReq = {0};
|
SMDropMnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
server2.Stop();
|
server2.Stop();
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_MNODE, pReq, contLen);
|
||||||
|
@ -268,9 +268,9 @@ TEST_F(MndTestMnode, 04_Drop_Mnode_Rollback) {
|
||||||
SMCreateMnodeReq createReq = {0};
|
SMCreateMnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -282,9 +282,9 @@ TEST_F(MndTestMnode, 04_Drop_Mnode_Rollback) {
|
||||||
SMDropMnodeReq dropReq = {0};
|
SMDropMnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -303,9 +303,9 @@ TEST_F(MndTestMnode, 04_Drop_Mnode_Rollback) {
|
||||||
SMCreateMnodeReq createReq = {0};
|
SMCreateMnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
|
|
@ -55,9 +55,9 @@ TEST_F(MndTestQnode, 02_Create_Qnode) {
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -68,9 +68,9 @@ TEST_F(MndTestQnode, 02_Create_Qnode) {
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -90,9 +90,9 @@ TEST_F(MndTestQnode, 02_Create_Qnode) {
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -124,9 +124,9 @@ TEST_F(MndTestQnode, 03_Drop_Qnode) {
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -148,9 +148,9 @@ TEST_F(MndTestQnode, 03_Drop_Qnode) {
|
||||||
SMDropQnodeReq dropReq = {0};
|
SMDropQnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -169,9 +169,9 @@ TEST_F(MndTestQnode, 03_Drop_Qnode) {
|
||||||
SMDropQnodeReq dropReq = {0};
|
SMDropQnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -185,9 +185,9 @@ TEST_F(MndTestQnode, 03_Create_Qnode_Rollback) {
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
server2.Stop();
|
server2.Stop();
|
||||||
taosMsleep(1000);
|
taosMsleep(1000);
|
||||||
|
@ -203,9 +203,9 @@ TEST_F(MndTestQnode, 03_Create_Qnode_Rollback) {
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -217,9 +217,9 @@ TEST_F(MndTestQnode, 03_Create_Qnode_Rollback) {
|
||||||
SMDropQnodeReq dropReq = {0};
|
SMDropQnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -239,9 +239,9 @@ TEST_F(MndTestQnode, 03_Create_Qnode_Rollback) {
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -258,9 +258,9 @@ TEST_F(MndTestQnode, 04_Drop_Qnode_Rollback) {
|
||||||
SMDropQnodeReq dropReq = {0};
|
SMDropQnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
server2.Stop();
|
server2.Stop();
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_QNODE, pReq, contLen);
|
||||||
|
@ -273,9 +273,9 @@ TEST_F(MndTestQnode, 04_Drop_Qnode_Rollback) {
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_SDB_OBJ_DROPPING);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_SDB_OBJ_DROPPING);
|
||||||
|
@ -286,9 +286,9 @@ TEST_F(MndTestQnode, 04_Drop_Qnode_Rollback) {
|
||||||
SMDropQnodeReq dropReq = {0};
|
SMDropQnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -307,9 +307,9 @@ TEST_F(MndTestQnode, 04_Drop_Qnode_Rollback) {
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
if (pRsp->code == 0) break;
|
if (pRsp->code == 0) break;
|
||||||
|
|
|
@ -55,9 +55,9 @@ TEST_F(MndTestSnode, 02_Create_Snode) {
|
||||||
SMCreateSnodeReq createReq = {0};
|
SMCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -68,9 +68,9 @@ TEST_F(MndTestSnode, 02_Create_Snode) {
|
||||||
SMCreateSnodeReq createReq = {0};
|
SMCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -90,9 +90,9 @@ TEST_F(MndTestSnode, 02_Create_Snode) {
|
||||||
SMCreateSnodeReq createReq = {0};
|
SMCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -124,9 +124,9 @@ TEST_F(MndTestSnode, 03_Drop_Snode) {
|
||||||
SMCreateSnodeReq createReq = {0};
|
SMCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -148,9 +148,9 @@ TEST_F(MndTestSnode, 03_Drop_Snode) {
|
||||||
SMDropSnodeReq dropReq = {0};
|
SMDropSnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -169,9 +169,9 @@ TEST_F(MndTestSnode, 03_Drop_Snode) {
|
||||||
SMDropSnodeReq dropReq = {0};
|
SMDropSnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -185,9 +185,9 @@ TEST_F(MndTestSnode, 03_Create_Snode_Rollback) {
|
||||||
SMCreateSnodeReq createReq = {0};
|
SMCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
server2.Stop();
|
server2.Stop();
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
||||||
|
@ -200,9 +200,9 @@ TEST_F(MndTestSnode, 03_Create_Snode_Rollback) {
|
||||||
SMCreateSnodeReq createReq = {0};
|
SMCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -214,9 +214,9 @@ TEST_F(MndTestSnode, 03_Create_Snode_Rollback) {
|
||||||
SMDropSnodeReq dropReq = {0};
|
SMDropSnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -235,9 +235,9 @@ TEST_F(MndTestSnode, 03_Create_Snode_Rollback) {
|
||||||
SMCreateSnodeReq createReq = {0};
|
SMCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -255,9 +255,9 @@ TEST_F(MndTestSnode, 04_Drop_Snode_Rollback) {
|
||||||
SMDropSnodeReq dropReq = {0};
|
SMDropSnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
server2.Stop();
|
server2.Stop();
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_SNODE, pReq, contLen);
|
||||||
|
@ -270,9 +270,9 @@ TEST_F(MndTestSnode, 04_Drop_Snode_Rollback) {
|
||||||
SMCreateSnodeReq createReq = {0};
|
SMCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -284,9 +284,9 @@ TEST_F(MndTestSnode, 04_Drop_Snode_Rollback) {
|
||||||
SMDropSnodeReq dropReq = {0};
|
SMDropSnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -305,9 +305,9 @@ TEST_F(MndTestSnode, 04_Drop_Snode_Rollback) {
|
||||||
SMCreateSnodeReq createReq = {0};
|
SMCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
|
|
@ -136,9 +136,9 @@ TEST_F(MndTestTrans, 02_Create_Qnode1_Crash) {
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -155,9 +155,9 @@ TEST_F(MndTestTrans, 02_Create_Qnode1_Crash) {
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -194,9 +194,9 @@ TEST_F(MndTestTrans, 03_Create_Qnode2_Crash) {
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
server2.Stop();
|
server2.Stop();
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||||
|
@ -249,9 +249,9 @@ TEST_F(MndTestTrans, 03_Create_Qnode2_Crash) {
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -274,9 +274,9 @@ TEST_F(MndTestTrans, 03_Create_Qnode2_Crash) {
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
|
|
@ -296,7 +296,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
STqTopic* pTopic = NULL;
|
STqTopic* pTopic = NULL;
|
||||||
int sz = taosArrayGetSize(pConsumer->topics);
|
int32_t sz = taosArrayGetSize(pConsumer->topics);
|
||||||
for (int32_t i = 0; i < sz; i++) {
|
for (int32_t i = 0; i < sz; i++) {
|
||||||
STqTopic* topic = taosArrayGet(pConsumer->topics, i);
|
STqTopic* topic = taosArrayGet(pConsumer->topics, i);
|
||||||
// TODO race condition
|
// TODO race condition
|
||||||
|
@ -316,7 +316,8 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
vDebug("poll topic %s from consumer %ld (epoch %d) vg %d", pTopic->topicName, consumerId, pReq->epoch, pTq->pVnode->vgId);
|
vDebug("poll topic %s from consumer %ld (epoch %d) vg %d", pTopic->topicName, consumerId, pReq->epoch,
|
||||||
|
pTq->pVnode->vgId);
|
||||||
|
|
||||||
rsp.reqOffset = pReq->currentOffset;
|
rsp.reqOffset = pReq->currentOffset;
|
||||||
rsp.skipLogNum = 0;
|
rsp.skipLogNum = 0;
|
||||||
|
@ -326,7 +327,8 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
|
||||||
// TODO
|
// TODO
|
||||||
consumerEpoch = atomic_load_32(&pConsumer->epoch);
|
consumerEpoch = atomic_load_32(&pConsumer->epoch);
|
||||||
if (consumerEpoch > reqEpoch) {
|
if (consumerEpoch > reqEpoch) {
|
||||||
vDebug("tmq poll: consumer %ld (epoch %d) vg %d offset %ld, found new consumer epoch %d discard req epoch %d", consumerId, pReq->epoch, pTq->pVnode->vgId, fetchOffset, consumerEpoch, reqEpoch);
|
vDebug("tmq poll: consumer %ld (epoch %d) vg %d offset %ld, found new consumer epoch %d discard req epoch %d",
|
||||||
|
consumerId, pReq->epoch, pTq->pVnode->vgId, fetchOffset, consumerEpoch, reqEpoch);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
SWalReadHead* pHead;
|
SWalReadHead* pHead;
|
||||||
|
@ -334,10 +336,12 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
|
||||||
// TODO: no more log, set timer to wait blocking time
|
// TODO: no more log, set timer to wait blocking time
|
||||||
// if data inserted during waiting, launch query and
|
// if data inserted during waiting, launch query and
|
||||||
// response to user
|
// response to user
|
||||||
vDebug("tmq poll: consumer %ld (epoch %d) vg %d offset %ld, no more log to return", consumerId, pReq->epoch, pTq->pVnode->vgId, fetchOffset);
|
vDebug("tmq poll: consumer %ld (epoch %d) vg %d offset %ld, no more log to return", consumerId, pReq->epoch,
|
||||||
|
pTq->pVnode->vgId, fetchOffset);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
vDebug("tmq poll: consumer %ld (epoch %d) iter log, vg %d offset %ld msgType %d", consumerId, pReq->epoch, pTq->pVnode->vgId, fetchOffset, pHead->msgType);
|
vDebug("tmq poll: consumer %ld (epoch %d) iter log, vg %d offset %ld msgType %d", consumerId, pReq->epoch,
|
||||||
|
pTq->pVnode->vgId, fetchOffset, pHead->msgType);
|
||||||
/*int8_t pos = fetchOffset % TQ_BUFFER_SIZE;*/
|
/*int8_t pos = fetchOffset % TQ_BUFFER_SIZE;*/
|
||||||
/*pHead = pTopic->pReadhandle->pHead;*/
|
/*pHead = pTopic->pReadhandle->pHead;*/
|
||||||
if (pHead->msgType == TDMT_VND_SUBMIT) {
|
if (pHead->msgType == TDMT_VND_SUBMIT) {
|
||||||
|
@ -361,7 +365,8 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosArrayGetSize(pRes) == 0) {
|
if (taosArrayGetSize(pRes) == 0) {
|
||||||
vDebug("tmq poll: consumer %ld (epoch %d) iter log, vg %d skip log %ld since not wanted", consumerId, pReq->epoch, pTq->pVnode->vgId, fetchOffset);
|
vDebug("tmq poll: consumer %ld (epoch %d) iter log, vg %d skip log %ld since not wanted", consumerId,
|
||||||
|
pReq->epoch, pTq->pVnode->vgId, fetchOffset);
|
||||||
fetchOffset++;
|
fetchOffset++;
|
||||||
rsp.skipLogNum++;
|
rsp.skipLogNum++;
|
||||||
taosArrayDestroy(pRes);
|
taosArrayDestroy(pRes);
|
||||||
|
@ -390,7 +395,8 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
|
||||||
pMsg->pCont = buf;
|
pMsg->pCont = buf;
|
||||||
pMsg->contLen = tlen;
|
pMsg->contLen = tlen;
|
||||||
pMsg->code = 0;
|
pMsg->code = 0;
|
||||||
vDebug("vg %d offset %ld msgType %d from consumer %ld (epoch %d) actual rsp", pTq->pVnode->vgId, fetchOffset, pHead->msgType, consumerId, pReq->epoch);
|
vDebug("vg %d offset %ld msgType %d from consumer %ld (epoch %d) actual rsp", pTq->pVnode->vgId, fetchOffset,
|
||||||
|
pHead->msgType, consumerId, pReq->epoch);
|
||||||
tmsgSendRsp(pMsg);
|
tmsgSendRsp(pMsg);
|
||||||
taosMemoryFree(pHead);
|
taosMemoryFree(pHead);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -421,7 +427,8 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
|
||||||
pMsg->contLen = tlen;
|
pMsg->contLen = tlen;
|
||||||
pMsg->code = 0;
|
pMsg->code = 0;
|
||||||
tmsgSendRsp(pMsg);
|
tmsgSendRsp(pMsg);
|
||||||
vDebug("vg %d offset %ld from consumer %ld (epoch %d) not rsp", pTq->pVnode->vgId, fetchOffset, consumerId, pReq->epoch);
|
vDebug("vg %d offset %ld from consumer %ld (epoch %d) not rsp", pTq->pVnode->vgId, fetchOffset, consumerId,
|
||||||
|
pReq->epoch);
|
||||||
/*}*/
|
/*}*/
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -432,7 +439,7 @@ int32_t tqProcessRebReq(STQ* pTq, char* msg) {
|
||||||
terrno = TSDB_CODE_SUCCESS;
|
terrno = TSDB_CODE_SUCCESS;
|
||||||
tDecodeSMqMVRebReq(msg, &req);
|
tDecodeSMqMVRebReq(msg, &req);
|
||||||
|
|
||||||
vDebug("vg %d set from consumer %ld to consumer %ld", req.vgId, req.oldConsumerId ,req.newConsumerId);
|
vDebug("vg %d set from consumer %ld to consumer %ld", req.vgId, req.oldConsumerId, req.newConsumerId);
|
||||||
STqConsumer* pConsumer = tqHandleGet(pTq->tqMeta, req.oldConsumerId);
|
STqConsumer* pConsumer = tqHandleGet(pTq->tqMeta, req.oldConsumerId);
|
||||||
ASSERT(pConsumer);
|
ASSERT(pConsumer);
|
||||||
ASSERT(pConsumer->consumerId == req.oldConsumerId);
|
ASSERT(pConsumer->consumerId == req.oldConsumerId);
|
||||||
|
|
|
@ -18,14 +18,14 @@
|
||||||
#include "executorimpl.h"
|
#include "executorimpl.h"
|
||||||
#include "planner.h"
|
#include "planner.h"
|
||||||
#include "tcompression.h"
|
#include "tcompression.h"
|
||||||
|
#include "tdatablock.h"
|
||||||
#include "tglobal.h"
|
#include "tglobal.h"
|
||||||
#include "tqueue.h"
|
#include "tqueue.h"
|
||||||
#include "tdatablock.h"
|
|
||||||
|
|
||||||
typedef struct SDataDispatchBuf {
|
typedef struct SDataDispatchBuf {
|
||||||
int32_t useSize;
|
int32_t useSize;
|
||||||
int32_t allocSize;
|
int32_t allocSize;
|
||||||
char* pData;
|
char* pData;
|
||||||
} SDataDispatchBuf;
|
} SDataDispatchBuf;
|
||||||
|
|
||||||
typedef struct SDataCacheEntry {
|
typedef struct SDataCacheEntry {
|
||||||
|
@ -36,26 +36,25 @@ typedef struct SDataCacheEntry {
|
||||||
} SDataCacheEntry;
|
} SDataCacheEntry;
|
||||||
|
|
||||||
typedef struct SDataDispatchHandle {
|
typedef struct SDataDispatchHandle {
|
||||||
SDataSinkHandle sink;
|
SDataSinkHandle sink;
|
||||||
SDataSinkManager* pManager;
|
SDataSinkManager* pManager;
|
||||||
SDataBlockDescNode* pSchema;
|
SDataBlockDescNode* pSchema;
|
||||||
STaosQueue* pDataBlocks;
|
STaosQueue* pDataBlocks;
|
||||||
SDataDispatchBuf nextOutput;
|
SDataDispatchBuf nextOutput;
|
||||||
int32_t status;
|
int32_t status;
|
||||||
bool queryEnd;
|
bool queryEnd;
|
||||||
uint64_t useconds;
|
uint64_t useconds;
|
||||||
TdThreadMutex mutex;
|
TdThreadMutex mutex;
|
||||||
} SDataDispatchHandle;
|
} SDataDispatchHandle;
|
||||||
|
|
||||||
static bool needCompress(const SSDataBlock* pData, const SDataBlockDescNode* pSchema) {
|
static bool needCompress(const SSDataBlock* pData, int32_t numOfCols) {
|
||||||
if (tsCompressColData < 0 || 0 == pData->info.rows) {
|
if (tsCompressColData < 0 || 0 == pData->info.rows) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t numOfCols = LIST_LENGTH(pSchema->pSlots);
|
|
||||||
for (int32_t col = 0; col < numOfCols; ++col) {
|
for (int32_t col = 0; col < numOfCols; ++col) {
|
||||||
SColumnInfoData* pColRes = taosArrayGet(pData->pDataBlock, col);
|
SColumnInfoData* pColRes = taosArrayGet(pData->pDataBlock, col);
|
||||||
int32_t colSize = pColRes->info.bytes * pData->info.rows;
|
int32_t colSize = pColRes->info.bytes * pData->info.rows;
|
||||||
if (NEEDTO_COMPRESS_QUERY(colSize)) {
|
if (NEEDTO_COMPRESS_QUERY(colSize)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -64,51 +63,6 @@ static bool needCompress(const SSDataBlock* pData, const SDataBlockDescNode* pSc
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t compressColData(SColumnInfoData *pColRes, int32_t numOfRows, char *data, int8_t compressed) {
|
|
||||||
int32_t colSize = colDataGetLength(pColRes, numOfRows);
|
|
||||||
return (*(tDataTypes[pColRes->info.type].compFunc))(
|
|
||||||
pColRes->pData, colSize, numOfRows, data, colSize + COMP_OVERFLOW_BYTES, compressed, NULL, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void copyData(const SInputData* pInput, const SDataBlockDescNode* pSchema, char* data, int8_t compressed, int32_t * dataLen) {
|
|
||||||
int32_t numOfCols = LIST_LENGTH(pSchema->pSlots);
|
|
||||||
int32_t * colSizes = (int32_t*)data;
|
|
||||||
|
|
||||||
data += numOfCols * sizeof(int32_t);
|
|
||||||
*dataLen = (numOfCols * sizeof(int32_t));
|
|
||||||
|
|
||||||
int32_t numOfRows = pInput->pData->info.rows;
|
|
||||||
for (int32_t col = 0; col < numOfCols; ++col) {
|
|
||||||
SColumnInfoData* pColRes = taosArrayGet(pInput->pData->pDataBlock, col);
|
|
||||||
|
|
||||||
// copy the null bitmap
|
|
||||||
if (IS_VAR_DATA_TYPE(pColRes->info.type)) {
|
|
||||||
size_t metaSize = numOfRows * sizeof(int32_t);
|
|
||||||
memcpy(data, pColRes->varmeta.offset, metaSize);
|
|
||||||
data += metaSize;
|
|
||||||
(*dataLen) += metaSize;
|
|
||||||
} else {
|
|
||||||
int32_t len = BitmapLen(numOfRows);
|
|
||||||
memcpy(data, pColRes->nullbitmap, len);
|
|
||||||
data += len;
|
|
||||||
(*dataLen) += len;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (compressed) {
|
|
||||||
colSizes[col] = compressColData(pColRes, numOfRows, data, compressed);
|
|
||||||
data += colSizes[col];
|
|
||||||
(*dataLen) += colSizes[col];
|
|
||||||
} else {
|
|
||||||
colSizes[col] = colDataGetLength(pColRes, numOfRows);
|
|
||||||
(*dataLen) += colSizes[col];
|
|
||||||
memmove(data, pColRes->pData, colSizes[col]);
|
|
||||||
data += colSizes[col];
|
|
||||||
}
|
|
||||||
|
|
||||||
colSizes[col] = htonl(colSizes[col]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// data format:
|
// data format:
|
||||||
// +----------------+--------------------------------------+-------------+-----------+-------------+-----------+
|
// +----------------+--------------------------------------+-------------+-----------+-------------+-----------+
|
||||||
// |SDataCacheEntry | column#1 length, column#2 length ... | col1 bitmap | col1 data | col2 bitmap | col2 data | ....
|
// |SDataCacheEntry | column#1 length, column#2 length ... | col1 bitmap | col1 data | col2 bitmap | col2 data | ....
|
||||||
|
@ -117,16 +71,17 @@ static void copyData(const SInputData* pInput, const SDataBlockDescNode* pSchema
|
||||||
// The length of bitmap is decided by number of rows of this data block, and the length of each column data is
|
// The length of bitmap is decided by number of rows of this data block, and the length of each column data is
|
||||||
// recorded in the first segment, next to the struct header
|
// recorded in the first segment, next to the struct header
|
||||||
static void toDataCacheEntry(const SDataDispatchHandle* pHandle, const SInputData* pInput, SDataDispatchBuf* pBuf) {
|
static void toDataCacheEntry(const SDataDispatchHandle* pHandle, const SInputData* pInput, SDataDispatchBuf* pBuf) {
|
||||||
|
int32_t numOfCols = LIST_LENGTH(pHandle->pSchema->pSlots);
|
||||||
|
|
||||||
SDataCacheEntry* pEntry = (SDataCacheEntry*)pBuf->pData;
|
SDataCacheEntry* pEntry = (SDataCacheEntry*)pBuf->pData;
|
||||||
pEntry->compressed = (int8_t)needCompress(pInput->pData, pHandle->pSchema);
|
pEntry->compressed = (int8_t)needCompress(pInput->pData, numOfCols);
|
||||||
pEntry->numOfRows = pInput->pData->info.rows;
|
pEntry->numOfRows = pInput->pData->info.rows;
|
||||||
pEntry->dataLen = 0;
|
pEntry->dataLen = 0;
|
||||||
|
|
||||||
pBuf->useSize = sizeof(SRetrieveTableRsp);
|
pBuf->useSize = sizeof(SRetrieveTableRsp);
|
||||||
copyData(pInput, pHandle->pSchema, pEntry->data, pEntry->compressed, &pEntry->dataLen);
|
blockCompressEncode(pInput->pData, pEntry->data, &pEntry->dataLen, numOfCols, pEntry->compressed);
|
||||||
|
|
||||||
pEntry->dataLen = pEntry->dataLen;
|
pBuf->useSize += pEntry->dataLen;
|
||||||
pBuf->useSize += pEntry->dataLen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool allocBuf(SDataDispatchHandle* pDispatcher, const SInputData* pInput, SDataDispatchBuf* pBuf) {
|
static bool allocBuf(SDataDispatchHandle* pDispatcher, const SInputData* pInput, SDataDispatchBuf* pBuf) {
|
||||||
|
@ -140,7 +95,7 @@ static bool allocBuf(SDataDispatchHandle* pDispatcher, const SInputData* pInput,
|
||||||
// NOTE: there are four bytes of an integer more than the required buffer space.
|
// NOTE: there are four bytes of an integer more than the required buffer space.
|
||||||
// struct size + data payload + length for each column + bitmap length
|
// struct size + data payload + length for each column + bitmap length
|
||||||
pBuf->allocSize = sizeof(SRetrieveTableRsp) + blockDataGetSerialMetaSize(pInput->pData) +
|
pBuf->allocSize = sizeof(SRetrieveTableRsp) + blockDataGetSerialMetaSize(pInput->pData) +
|
||||||
ceil(blockDataGetSerialRowSize(pInput->pData) * pInput->pData->info.rows);
|
ceil(blockDataGetSerialRowSize(pInput->pData) * pInput->pData->info.rows);
|
||||||
|
|
||||||
pBuf->pData = taosMemoryMalloc(pBuf->allocSize);
|
pBuf->pData = taosMemoryMalloc(pBuf->allocSize);
|
||||||
if (pBuf->pData == NULL) {
|
if (pBuf->pData == NULL) {
|
||||||
|
@ -153,8 +108,9 @@ static bool allocBuf(SDataDispatchHandle* pDispatcher, const SInputData* pInput,
|
||||||
static int32_t updateStatus(SDataDispatchHandle* pDispatcher) {
|
static int32_t updateStatus(SDataDispatchHandle* pDispatcher) {
|
||||||
taosThreadMutexLock(&pDispatcher->mutex);
|
taosThreadMutexLock(&pDispatcher->mutex);
|
||||||
int32_t blockNums = taosQueueSize(pDispatcher->pDataBlocks);
|
int32_t blockNums = taosQueueSize(pDispatcher->pDataBlocks);
|
||||||
int32_t status = (0 == blockNums ? DS_BUF_EMPTY :
|
int32_t status =
|
||||||
(blockNums < pDispatcher->pManager->cfg.maxDataBlockNumPerQuery ? DS_BUF_LOW : DS_BUF_FULL));
|
(0 == blockNums ? DS_BUF_EMPTY
|
||||||
|
: (blockNums < pDispatcher->pManager->cfg.maxDataBlockNumPerQuery ? DS_BUF_LOW : DS_BUF_FULL));
|
||||||
pDispatcher->status = status;
|
pDispatcher->status = status;
|
||||||
taosThreadMutexUnlock(&pDispatcher->mutex);
|
taosThreadMutexUnlock(&pDispatcher->mutex);
|
||||||
return status;
|
return status;
|
||||||
|
@ -169,7 +125,7 @@ static int32_t getStatus(SDataDispatchHandle* pDispatcher) {
|
||||||
|
|
||||||
static int32_t putDataBlock(SDataSinkHandle* pHandle, const SInputData* pInput, bool* pContinue) {
|
static int32_t putDataBlock(SDataSinkHandle* pHandle, const SInputData* pInput, bool* pContinue) {
|
||||||
SDataDispatchHandle* pDispatcher = (SDataDispatchHandle*)pHandle;
|
SDataDispatchHandle* pDispatcher = (SDataDispatchHandle*)pHandle;
|
||||||
SDataDispatchBuf* pBuf = taosAllocateQitem(sizeof(SDataDispatchBuf));
|
SDataDispatchBuf* pBuf = taosAllocateQitem(sizeof(SDataDispatchBuf));
|
||||||
if (NULL == pBuf || !allocBuf(pDispatcher, pInput, pBuf)) {
|
if (NULL == pBuf || !allocBuf(pDispatcher, pInput, pBuf)) {
|
||||||
return TSDB_CODE_QRY_OUT_OF_MEMORY;
|
return TSDB_CODE_QRY_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
@ -200,7 +156,7 @@ static void getDataLength(SDataSinkHandle* pHandle, int32_t* pLen, bool* pQueryE
|
||||||
memcpy(&pDispatcher->nextOutput, pBuf, sizeof(SDataDispatchBuf));
|
memcpy(&pDispatcher->nextOutput, pBuf, sizeof(SDataDispatchBuf));
|
||||||
taosFreeQitem(pBuf);
|
taosFreeQitem(pBuf);
|
||||||
*pLen = ((SDataCacheEntry*)(pDispatcher->nextOutput.pData))->dataLen;
|
*pLen = ((SDataCacheEntry*)(pDispatcher->nextOutput.pData))->dataLen;
|
||||||
*pQueryEnd = pDispatcher->queryEnd;
|
*pQueryEnd = pDispatcher->queryEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t getDataBlock(SDataSinkHandle* pHandle, SOutputData* pOutput) {
|
static int32_t getDataBlock(SDataSinkHandle* pHandle, SOutputData* pOutput) {
|
||||||
|
|
|
@ -4535,6 +4535,7 @@ static void appendOneRowToDataBlock(SSDataBlock* pBlock, STupleHandle* pTupleHan
|
||||||
|
|
||||||
SSDataBlock* getSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock, int32_t capacity) {
|
SSDataBlock* getSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock, int32_t capacity) {
|
||||||
blockDataCleanup(pDataBlock);
|
blockDataCleanup(pDataBlock);
|
||||||
|
blockDataEnsureCapacity(pDataBlock, capacity);
|
||||||
|
|
||||||
blockDataEnsureCapacity(pDataBlock, capacity);
|
blockDataEnsureCapacity(pDataBlock, capacity);
|
||||||
|
|
||||||
|
|
|
@ -783,6 +783,10 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* pSysTableReadHandle, SSDataB
|
||||||
tableType = TSDB_MGMT_TABLE_MODULE;
|
tableType = TSDB_MGMT_TABLE_MODULE;
|
||||||
} else if (strncasecmp(name, TSDB_INS_TABLE_QNODES, tListLen(pName->tname)) == 0) {
|
} else if (strncasecmp(name, TSDB_INS_TABLE_QNODES, tListLen(pName->tname)) == 0) {
|
||||||
tableType = TSDB_MGMT_TABLE_QNODE;
|
tableType = TSDB_MGMT_TABLE_QNODE;
|
||||||
|
} else if (strncasecmp(name, TSDB_INS_TABLE_SNODES, tListLen(pName->tname)) == 0) {
|
||||||
|
tableType = TSDB_MGMT_TABLE_SNODE;
|
||||||
|
} else if (strncasecmp(name, TSDB_INS_TABLE_BNODES, tListLen(pName->tname)) == 0) {
|
||||||
|
tableType = TSDB_MGMT_TABLE_BNODE;
|
||||||
} else if (strncasecmp(name, TSDB_INS_TABLE_USER_FUNCTIONS, tListLen(pName->tname)) == 0) {
|
} else if (strncasecmp(name, TSDB_INS_TABLE_USER_FUNCTIONS, tListLen(pName->tname)) == 0) {
|
||||||
tableType = TSDB_MGMT_TABLE_FUNC;
|
tableType = TSDB_MGMT_TABLE_FUNC;
|
||||||
} else if (strncasecmp(name, TSDB_INS_TABLE_USER_INDEXES, tListLen(pName->tname)) == 0) {
|
} else if (strncasecmp(name, TSDB_INS_TABLE_USER_INDEXES, tListLen(pName->tname)) == 0) {
|
||||||
|
|
|
@ -106,7 +106,6 @@ static SNode* columnNodeCopy(const SColumnNode* pSrc, SColumnNode* pDst) {
|
||||||
COPY_CHAR_ARRAY_FIELD(tableName);
|
COPY_CHAR_ARRAY_FIELD(tableName);
|
||||||
COPY_CHAR_ARRAY_FIELD(tableAlias);
|
COPY_CHAR_ARRAY_FIELD(tableAlias);
|
||||||
COPY_CHAR_ARRAY_FIELD(colName);
|
COPY_CHAR_ARRAY_FIELD(colName);
|
||||||
// CLONE_NODE_FIELD(pProjectRef);
|
|
||||||
COPY_SCALAR_FIELD(dataBlockId);
|
COPY_SCALAR_FIELD(dataBlockId);
|
||||||
COPY_SCALAR_FIELD(slotId);
|
COPY_SCALAR_FIELD(slotId);
|
||||||
return (SNode*)pDst;
|
return (SNode*)pDst;
|
||||||
|
|
|
@ -170,6 +170,10 @@ const char* nodesNodeName(ENodeType type) {
|
||||||
return "LogicExchange";
|
return "LogicExchange";
|
||||||
case QUERY_NODE_LOGIC_PLAN_WINDOW:
|
case QUERY_NODE_LOGIC_PLAN_WINDOW:
|
||||||
return "LogicWindow";
|
return "LogicWindow";
|
||||||
|
case QUERY_NODE_LOGIC_PLAN_SORT:
|
||||||
|
return "LogicSort";
|
||||||
|
case QUERY_NODE_LOGIC_PLAN_PARTITION:
|
||||||
|
return "LogicPartition";
|
||||||
case QUERY_NODE_LOGIC_SUBPLAN:
|
case QUERY_NODE_LOGIC_SUBPLAN:
|
||||||
return "LogicSubplan";
|
return "LogicSubplan";
|
||||||
case QUERY_NODE_LOGIC_PLAN:
|
case QUERY_NODE_LOGIC_PLAN:
|
||||||
|
@ -530,6 +534,30 @@ static int32_t jsonToLogicProjectNode(const SJson* pJson, void* pObj) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char* jkSortLogicPlanSortKeys = "SortKeys";
|
||||||
|
|
||||||
|
static int32_t logicSortNodeToJson(const void* pObj, SJson* pJson) {
|
||||||
|
const SSortLogicNode* pNode = (const SSortLogicNode*)pObj;
|
||||||
|
|
||||||
|
int32_t code = logicPlanNodeToJson(pObj, pJson);
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
code = nodeListToJson(pJson, jkSortLogicPlanSortKeys, pNode->pSortKeys);
|
||||||
|
}
|
||||||
|
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t jsonToLogicSortNode(const SJson* pJson, void* pObj) {
|
||||||
|
SSortLogicNode* pNode = (SSortLogicNode*)pObj;
|
||||||
|
|
||||||
|
int32_t code = jsonToLogicPlanNode(pJson, pObj);
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
code = jsonToNodeList(pJson, jkSortLogicPlanSortKeys, &pNode->pSortKeys);
|
||||||
|
}
|
||||||
|
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
static const char* jkJoinLogicPlanJoinType = "JoinType";
|
static const char* jkJoinLogicPlanJoinType = "JoinType";
|
||||||
static const char* jkJoinLogicPlanOnConditions = "OnConditions";
|
static const char* jkJoinLogicPlanOnConditions = "OnConditions";
|
||||||
|
|
||||||
|
@ -2468,6 +2496,9 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
|
||||||
case QUERY_NODE_LOGIC_PLAN_PROJECT:
|
case QUERY_NODE_LOGIC_PLAN_PROJECT:
|
||||||
return logicProjectNodeToJson(pObj, pJson);
|
return logicProjectNodeToJson(pObj, pJson);
|
||||||
case QUERY_NODE_LOGIC_PLAN_VNODE_MODIF:
|
case QUERY_NODE_LOGIC_PLAN_VNODE_MODIF:
|
||||||
|
break;
|
||||||
|
case QUERY_NODE_LOGIC_PLAN_SORT:
|
||||||
|
return logicSortNodeToJson(pObj, pJson);
|
||||||
case QUERY_NODE_LOGIC_SUBPLAN:
|
case QUERY_NODE_LOGIC_SUBPLAN:
|
||||||
case QUERY_NODE_LOGIC_PLAN:
|
case QUERY_NODE_LOGIC_PLAN:
|
||||||
break;
|
break;
|
||||||
|
@ -2527,16 +2558,8 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
|
||||||
return jsonToFunctionNode(pJson, pObj);
|
return jsonToFunctionNode(pJson, pObj);
|
||||||
case QUERY_NODE_REAL_TABLE:
|
case QUERY_NODE_REAL_TABLE:
|
||||||
return jsonToRealTableNode(pJson, pObj);
|
return jsonToRealTableNode(pJson, pObj);
|
||||||
// case QUERY_NODE_TEMP_TABLE:
|
|
||||||
// case QUERY_NODE_JOIN_TABLE:
|
|
||||||
// break;
|
|
||||||
// case QUERY_NODE_GROUPING_SET:
|
|
||||||
// return jsonToGroupingSetNode(pJson, pObj);
|
|
||||||
case QUERY_NODE_ORDER_BY_EXPR:
|
case QUERY_NODE_ORDER_BY_EXPR:
|
||||||
return jsonToOrderByExprNode(pJson, pObj);
|
return jsonToOrderByExprNode(pJson, pObj);
|
||||||
// case QUERY_NODE_LIMIT:
|
|
||||||
// case QUERY_NODE_STATE_WINDOW:
|
|
||||||
// case QUERY_NODE_SESSION_WINDOW:
|
|
||||||
case QUERY_NODE_INTERVAL_WINDOW:
|
case QUERY_NODE_INTERVAL_WINDOW:
|
||||||
return jsonToIntervalWindowNode(pJson, pObj);
|
return jsonToIntervalWindowNode(pJson, pObj);
|
||||||
case QUERY_NODE_NODE_LIST:
|
case QUERY_NODE_NODE_LIST:
|
||||||
|
@ -2545,28 +2568,22 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
|
||||||
return jsonToFillNode(pJson, pObj);
|
return jsonToFillNode(pJson, pObj);
|
||||||
case QUERY_NODE_TARGET:
|
case QUERY_NODE_TARGET:
|
||||||
return jsonToTargetNode(pJson, pObj);
|
return jsonToTargetNode(pJson, pObj);
|
||||||
// case QUERY_NODE_RAW_EXPR:
|
|
||||||
// break;
|
|
||||||
case QUERY_NODE_DATABLOCK_DESC:
|
case QUERY_NODE_DATABLOCK_DESC:
|
||||||
return jsonToDataBlockDescNode(pJson, pObj);
|
return jsonToDataBlockDescNode(pJson, pObj);
|
||||||
case QUERY_NODE_SLOT_DESC:
|
case QUERY_NODE_SLOT_DESC:
|
||||||
return jsonToSlotDescNode(pJson, pObj);
|
return jsonToSlotDescNode(pJson, pObj);
|
||||||
case QUERY_NODE_DOWNSTREAM_SOURCE:
|
case QUERY_NODE_DOWNSTREAM_SOURCE:
|
||||||
return jsonToDownstreamSourceNode(pJson, pObj);
|
return jsonToDownstreamSourceNode(pJson, pObj);
|
||||||
// case QUERY_NODE_SET_OPERATOR:
|
|
||||||
// break;
|
|
||||||
case QUERY_NODE_SELECT_STMT:
|
case QUERY_NODE_SELECT_STMT:
|
||||||
return jsonToSelectStmt(pJson, pObj);
|
return jsonToSelectStmt(pJson, pObj);
|
||||||
case QUERY_NODE_CREATE_TOPIC_STMT:
|
case QUERY_NODE_CREATE_TOPIC_STMT:
|
||||||
return jsonToCreateTopicStmt(pJson, pObj);
|
return jsonToCreateTopicStmt(pJson, pObj);
|
||||||
case QUERY_NODE_LOGIC_PLAN_SCAN:
|
case QUERY_NODE_LOGIC_PLAN_SCAN:
|
||||||
return jsonToLogicScanNode(pJson, pObj);
|
return jsonToLogicScanNode(pJson, pObj);
|
||||||
// case QUERY_NODE_LOGIC_PLAN_JOIN:
|
|
||||||
// return jsonToLogicJoinNode(pJson, pObj);
|
|
||||||
// case QUERY_NODE_LOGIC_PLAN_AGG:
|
|
||||||
// return jsonToLogicAggNode(pJson, pObj);
|
|
||||||
case QUERY_NODE_LOGIC_PLAN_PROJECT:
|
case QUERY_NODE_LOGIC_PLAN_PROJECT:
|
||||||
return jsonToLogicProjectNode(pJson, pObj);
|
return jsonToLogicProjectNode(pJson, pObj);
|
||||||
|
case QUERY_NODE_LOGIC_PLAN_SORT:
|
||||||
|
return jsonToLogicSortNode(pJson, pObj);
|
||||||
case QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN:
|
case QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN:
|
||||||
return jsonToPhysiTagScanNode(pJson, pObj);
|
return jsonToPhysiTagScanNode(pJson, pObj);
|
||||||
case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN:
|
case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN:
|
||||||
|
|
|
@ -39,8 +39,12 @@ int32_t nodesNodeToSQL(SNode *pNode, char *buf, int32_t bufSize, int32_t *len) {
|
||||||
} else if (colNode->tableName[0]) {
|
} else if (colNode->tableName[0]) {
|
||||||
*len += snprintf(buf + *len, bufSize - *len, "`%s`.", colNode->tableName);
|
*len += snprintf(buf + *len, bufSize - *len, "`%s`.", colNode->tableName);
|
||||||
}
|
}
|
||||||
|
|
||||||
*len += snprintf(buf + *len, bufSize - *len, "`%s`", colNode->colName);
|
if (colNode->tableAlias[0]) {
|
||||||
|
*len += snprintf(buf + *len, bufSize - *len, "`%s`", colNode->colName);
|
||||||
|
} else {
|
||||||
|
*len += snprintf(buf + *len, bufSize - *len, "%s", colNode->colName);
|
||||||
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,9 +127,15 @@ SNodeptr nodesMakeNode(ENodeType type) {
|
||||||
case QUERY_NODE_DROP_INDEX_STMT:
|
case QUERY_NODE_DROP_INDEX_STMT:
|
||||||
return makeNode(type, sizeof(SDropIndexStmt));
|
return makeNode(type, sizeof(SDropIndexStmt));
|
||||||
case QUERY_NODE_CREATE_QNODE_STMT:
|
case QUERY_NODE_CREATE_QNODE_STMT:
|
||||||
return makeNode(type, sizeof(SCreateQnodeStmt));
|
case QUERY_NODE_CREATE_BNODE_STMT:
|
||||||
|
case QUERY_NODE_CREATE_SNODE_STMT:
|
||||||
|
case QUERY_NODE_CREATE_MNODE_STMT:
|
||||||
|
return makeNode(type, sizeof(SCreateComponentNodeStmt));
|
||||||
case QUERY_NODE_DROP_QNODE_STMT:
|
case QUERY_NODE_DROP_QNODE_STMT:
|
||||||
return makeNode(type, sizeof(SDropQnodeStmt));
|
case QUERY_NODE_DROP_BNODE_STMT:
|
||||||
|
case QUERY_NODE_DROP_SNODE_STMT:
|
||||||
|
case QUERY_NODE_DROP_MNODE_STMT:
|
||||||
|
return makeNode(type, sizeof(SDropComponentNodeStmt));
|
||||||
case QUERY_NODE_CREATE_TOPIC_STMT:
|
case QUERY_NODE_CREATE_TOPIC_STMT:
|
||||||
return makeNode(type, sizeof(SCreateTopicStmt));
|
return makeNode(type, sizeof(SCreateTopicStmt));
|
||||||
case QUERY_NODE_DROP_TOPIC_STMT:
|
case QUERY_NODE_DROP_TOPIC_STMT:
|
||||||
|
@ -152,6 +158,8 @@ SNodeptr nodesMakeNode(ENodeType type) {
|
||||||
case QUERY_NODE_SHOW_FUNCTIONS_STMT:
|
case QUERY_NODE_SHOW_FUNCTIONS_STMT:
|
||||||
case QUERY_NODE_SHOW_INDEXES_STMT:
|
case QUERY_NODE_SHOW_INDEXES_STMT:
|
||||||
case QUERY_NODE_SHOW_STREAMS_STMT:
|
case QUERY_NODE_SHOW_STREAMS_STMT:
|
||||||
|
case QUERY_NODE_SHOW_BNODES_STMT:
|
||||||
|
case QUERY_NODE_SHOW_SNODES_STMT:
|
||||||
return makeNode(type, sizeof(SShowStmt));
|
return makeNode(type, sizeof(SShowStmt));
|
||||||
case QUERY_NODE_LOGIC_PLAN_SCAN:
|
case QUERY_NODE_LOGIC_PLAN_SCAN:
|
||||||
return makeNode(type, sizeof(SScanLogicNode));
|
return makeNode(type, sizeof(SScanLogicNode));
|
||||||
|
@ -991,12 +999,18 @@ typedef struct SCollectColumnsCxt {
|
||||||
int32_t errCode;
|
int32_t errCode;
|
||||||
const char* pTableAlias;
|
const char* pTableAlias;
|
||||||
SNodeList* pCols;
|
SNodeList* pCols;
|
||||||
SHashObj* pColIdHash;
|
SHashObj* pColHash;
|
||||||
} SCollectColumnsCxt;
|
} SCollectColumnsCxt;
|
||||||
|
|
||||||
static EDealRes doCollect(SCollectColumnsCxt* pCxt, int32_t id, SNode* pNode) {
|
static EDealRes doCollect(SCollectColumnsCxt* pCxt, SColumnNode* pCol, SNode* pNode) {
|
||||||
if (NULL == taosHashGet(pCxt->pColIdHash, &id, sizeof(id))) {
|
char name[TSDB_TABLE_NAME_LEN + TSDB_COL_NAME_LEN];
|
||||||
pCxt->errCode = taosHashPut(pCxt->pColIdHash, &id, sizeof(id), NULL, 0);
|
int32_t len = 0;
|
||||||
|
if ('\0' == pCol->tableAlias[0]) {
|
||||||
|
len = sprintf(name, "%s", pCol->colName);
|
||||||
|
}
|
||||||
|
len = sprintf(name, "%s.%s", pCol->tableAlias, pCol->colName);
|
||||||
|
if (NULL == taosHashGet(pCxt->pColHash, name, len)) {
|
||||||
|
pCxt->errCode = taosHashPut(pCxt->pColHash, name, len, NULL, 0);
|
||||||
if (TSDB_CODE_SUCCESS == pCxt->errCode) {
|
if (TSDB_CODE_SUCCESS == pCxt->errCode) {
|
||||||
pCxt->errCode = nodesListAppend(pCxt->pCols, pNode);
|
pCxt->errCode = nodesListAppend(pCxt->pCols, pNode);
|
||||||
}
|
}
|
||||||
|
@ -1009,9 +1023,8 @@ static EDealRes collectColumns(SNode* pNode, void* pContext) {
|
||||||
SCollectColumnsCxt* pCxt = (SCollectColumnsCxt*)pContext;
|
SCollectColumnsCxt* pCxt = (SCollectColumnsCxt*)pContext;
|
||||||
if (QUERY_NODE_COLUMN == nodeType(pNode)) {
|
if (QUERY_NODE_COLUMN == nodeType(pNode)) {
|
||||||
SColumnNode* pCol = (SColumnNode*)pNode;
|
SColumnNode* pCol = (SColumnNode*)pNode;
|
||||||
int32_t colId = pCol->colId;
|
|
||||||
if (NULL == pCxt->pTableAlias || 0 == strcmp(pCxt->pTableAlias, pCol->tableAlias)) {
|
if (NULL == pCxt->pTableAlias || 0 == strcmp(pCxt->pTableAlias, pCol->tableAlias)) {
|
||||||
return doCollect(pCxt, colId, pNode);
|
return doCollect(pCxt, pCol, pNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return DEAL_RES_CONTINUE;
|
return DEAL_RES_CONTINUE;
|
||||||
|
@ -1026,14 +1039,14 @@ int32_t nodesCollectColumns(SSelectStmt* pSelect, ESqlClause clause, const char*
|
||||||
.errCode = TSDB_CODE_SUCCESS,
|
.errCode = TSDB_CODE_SUCCESS,
|
||||||
.pTableAlias = pTableAlias,
|
.pTableAlias = pTableAlias,
|
||||||
.pCols = nodesMakeList(),
|
.pCols = nodesMakeList(),
|
||||||
.pColIdHash = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK)
|
.pColHash = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK)
|
||||||
};
|
};
|
||||||
if (NULL == cxt.pCols || NULL == cxt.pColIdHash) {
|
if (NULL == cxt.pCols || NULL == cxt.pColHash) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
nodesWalkSelectStmt(pSelect, clause, collectColumns, &cxt);
|
nodesWalkSelectStmt(pSelect, clause, collectColumns, &cxt);
|
||||||
taosHashCleanup(cxt.pColIdHash);
|
taosHashCleanup(cxt.pColHash);
|
||||||
if (TSDB_CODE_SUCCESS != cxt.errCode) {
|
if (TSDB_CODE_SUCCESS != cxt.errCode) {
|
||||||
nodesClearList(cxt.pCols);
|
nodesClearList(cxt.pCols);
|
||||||
return cxt.errCode;
|
return cxt.errCode;
|
||||||
|
|
|
@ -150,8 +150,8 @@ SNode* createAlterDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, const
|
||||||
SNode* createCreateIndexStmt(SAstCreateContext* pCxt, EIndexType type, bool ignoreExists, SToken* pIndexName, SToken* pTableName, SNodeList* pCols, SNode* pOptions);
|
SNode* createCreateIndexStmt(SAstCreateContext* pCxt, EIndexType type, bool ignoreExists, SToken* pIndexName, SToken* pTableName, SNodeList* pCols, SNode* pOptions);
|
||||||
SNode* createIndexOption(SAstCreateContext* pCxt, SNodeList* pFuncs, SNode* pInterval, SNode* pOffset, SNode* pSliding);
|
SNode* createIndexOption(SAstCreateContext* pCxt, SNodeList* pFuncs, SNode* pInterval, SNode* pOffset, SNode* pSliding);
|
||||||
SNode* createDropIndexStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken* pIndexName, SToken* pTableName);
|
SNode* createDropIndexStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken* pIndexName, SToken* pTableName);
|
||||||
SNode* createCreateQnodeStmt(SAstCreateContext* pCxt, const SToken* pDnodeId);
|
SNode* createCreateComponentNodeStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pDnodeId);
|
||||||
SNode* createDropQnodeStmt(SAstCreateContext* pCxt, const SToken* pDnodeId);
|
SNode* createDropComponentNodeStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pDnodeId);
|
||||||
SNode* createCreateTopicStmt(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pTopicName, SNode* pQuery, const SToken* pSubscribeDbName);
|
SNode* createCreateTopicStmt(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pTopicName, SNode* pQuery, const SToken* pSubscribeDbName);
|
||||||
SNode* createDropTopicStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pTopicName);
|
SNode* createDropTopicStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pTopicName);
|
||||||
SNode* createAlterLocalStmt(SAstCreateContext* pCxt, const SToken* pConfig, const SToken* pValue);
|
SNode* createAlterLocalStmt(SAstCreateContext* pCxt, const SToken* pConfig, const SToken* pValue);
|
||||||
|
|
|
@ -109,8 +109,20 @@ cmd ::= ALTER LOCAL NK_STRING(A).
|
||||||
cmd ::= ALTER LOCAL NK_STRING(A) NK_STRING(B). { pCxt->pRootNode = createAlterLocalStmt(pCxt, &A, &B); }
|
cmd ::= ALTER LOCAL NK_STRING(A) NK_STRING(B). { pCxt->pRootNode = createAlterLocalStmt(pCxt, &A, &B); }
|
||||||
|
|
||||||
/************************************************ create/drop qnode ***************************************************/
|
/************************************************ create/drop qnode ***************************************************/
|
||||||
cmd ::= CREATE QNODE ON DNODE NK_INTEGER(A). { pCxt->pRootNode = createCreateQnodeStmt(pCxt, &A); }
|
cmd ::= CREATE QNODE ON DNODE NK_INTEGER(A). { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_QNODE_STMT, &A); }
|
||||||
cmd ::= DROP QNODE ON DNODE NK_INTEGER(A). { pCxt->pRootNode = createDropQnodeStmt(pCxt, &A); }
|
cmd ::= DROP QNODE ON DNODE NK_INTEGER(A). { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_QNODE_STMT, &A); }
|
||||||
|
|
||||||
|
/************************************************ create/drop bnode ***************************************************/
|
||||||
|
cmd ::= CREATE BNODE ON DNODE NK_INTEGER(A). { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_BNODE_STMT, &A); }
|
||||||
|
cmd ::= DROP BNODE ON DNODE NK_INTEGER(A). { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_BNODE_STMT, &A); }
|
||||||
|
|
||||||
|
/************************************************ create/drop snode ***************************************************/
|
||||||
|
cmd ::= CREATE SNODE ON DNODE NK_INTEGER(A). { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_SNODE_STMT, &A); }
|
||||||
|
cmd ::= DROP SNODE ON DNODE NK_INTEGER(A). { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_SNODE_STMT, &A); }
|
||||||
|
|
||||||
|
/************************************************ create/drop mnode ***************************************************/
|
||||||
|
cmd ::= CREATE MNODE ON DNODE NK_INTEGER(A). { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_MNODE_STMT, &A); }
|
||||||
|
cmd ::= DROP MNODE ON DNODE NK_INTEGER(A). { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &A); }
|
||||||
|
|
||||||
/************************************************ create/drop/show/use database ***************************************/
|
/************************************************ create/drop/show/use database ***************************************/
|
||||||
cmd ::= CREATE DATABASE not_exists_opt(A) db_name(B) db_options(C). { pCxt->pRootNode = createCreateDatabaseStmt(pCxt, A, &B, C); }
|
cmd ::= CREATE DATABASE not_exists_opt(A) db_name(B) db_options(C). { pCxt->pRootNode = createCreateDatabaseStmt(pCxt, A, &B, C); }
|
||||||
|
@ -327,6 +339,8 @@ cmd ::= SHOW QUERIES.
|
||||||
cmd ::= SHOW SCORES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT, NULL, NULL); }
|
cmd ::= SHOW SCORES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT, NULL, NULL); }
|
||||||
cmd ::= SHOW TOPICS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT, NULL, NULL); }
|
cmd ::= SHOW TOPICS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT, NULL, NULL); }
|
||||||
cmd ::= SHOW VARIABLES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLE_STMT, NULL, NULL); }
|
cmd ::= SHOW VARIABLES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLE_STMT, NULL, NULL); }
|
||||||
|
cmd ::= SHOW BNODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT, NULL, NULL); }
|
||||||
|
cmd ::= SHOW SNODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT, NULL, NULL); }
|
||||||
|
|
||||||
db_name_cond_opt(A) ::= . { A = createDefaultDatabaseCondValue(pCxt); }
|
db_name_cond_opt(A) ::= . { A = createDefaultDatabaseCondValue(pCxt); }
|
||||||
db_name_cond_opt(A) ::= db_name(B) NK_DOT. { A = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B); }
|
db_name_cond_opt(A) ::= db_name(B) NK_DOT. { A = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B); }
|
||||||
|
@ -714,10 +728,7 @@ select_list(A) ::= select_sublist(B).
|
||||||
select_sublist(A) ::= select_item(B). { A = createNodeList(pCxt, B); }
|
select_sublist(A) ::= select_item(B). { A = createNodeList(pCxt, B); }
|
||||||
select_sublist(A) ::= select_sublist(B) NK_COMMA select_item(C). { A = addNodeToList(pCxt, B, C); }
|
select_sublist(A) ::= select_sublist(B) NK_COMMA select_item(C). { A = addNodeToList(pCxt, B, C); }
|
||||||
|
|
||||||
select_item(A) ::= common_expression(B). {
|
select_item(A) ::= common_expression(B). { A = releaseRawExprNode(pCxt, B); }
|
||||||
SToken t = getTokenFromRawExprNode(pCxt, B);
|
|
||||||
A = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, B), &t);
|
|
||||||
}
|
|
||||||
select_item(A) ::= common_expression(B) column_alias(C). { A = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, B), &C); }
|
select_item(A) ::= common_expression(B) column_alias(C). { A = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, B), &C); }
|
||||||
select_item(A) ::= common_expression(B) AS column_alias(C). { A = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, B), &C); }
|
select_item(A) ::= common_expression(B) AS column_alias(C). { A = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, B), &C); }
|
||||||
select_item(A) ::= table_name(B) NK_DOT NK_STAR(C). { A = createColumnNode(pCxt, &B, &C); }
|
select_item(A) ::= table_name(B) NK_DOT NK_STAR(C). { A = createColumnNode(pCxt, &B, &C); }
|
||||||
|
|
|
@ -205,9 +205,11 @@ SNode* createRawExprNodeExt(SAstCreateContext* pCxt, const SToken* pStart, const
|
||||||
|
|
||||||
SNode* releaseRawExprNode(SAstCreateContext* pCxt, SNode* pNode) {
|
SNode* releaseRawExprNode(SAstCreateContext* pCxt, SNode* pNode) {
|
||||||
CHECK_RAW_EXPR_NODE(pNode);
|
CHECK_RAW_EXPR_NODE(pNode);
|
||||||
SNode* tmp = ((SRawExprNode*)pNode)->pNode;
|
SRawExprNode* pRawExpr = (SRawExprNode*)pNode;
|
||||||
|
SNode* pExpr = pRawExpr->pNode;
|
||||||
|
strncpy(((SExprNode*)pExpr)->aliasName, pRawExpr->p, pRawExpr->n);
|
||||||
taosMemoryFreeClear(pNode);
|
taosMemoryFreeClear(pNode);
|
||||||
return tmp;
|
return pExpr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SToken getTokenFromRawExprNode(SAstCreateContext* pCxt, SNode* pNode) {
|
SToken getTokenFromRawExprNode(SAstCreateContext* pCxt, SNode* pNode) {
|
||||||
|
@ -1034,15 +1036,15 @@ SNode* createDropIndexStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken
|
||||||
return (SNode*)pStmt;
|
return (SNode*)pStmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
SNode* createCreateQnodeStmt(SAstCreateContext* pCxt, const SToken* pDnodeId) {
|
SNode* createCreateComponentNodeStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pDnodeId) {
|
||||||
SCreateQnodeStmt* pStmt = nodesMakeNode(QUERY_NODE_CREATE_QNODE_STMT);
|
SCreateComponentNodeStmt* pStmt = nodesMakeNode(type);
|
||||||
CHECK_OUT_OF_MEM(pStmt);
|
CHECK_OUT_OF_MEM(pStmt);
|
||||||
pStmt->dnodeId = strtol(pDnodeId->z, NULL, 10);;
|
pStmt->dnodeId = strtol(pDnodeId->z, NULL, 10);;
|
||||||
return (SNode*)pStmt;
|
return (SNode*)pStmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
SNode* createDropQnodeStmt(SAstCreateContext* pCxt, const SToken* pDnodeId) {
|
SNode* createDropComponentNodeStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pDnodeId) {
|
||||||
SDropQnodeStmt* pStmt = nodesMakeNode(QUERY_NODE_DROP_QNODE_STMT);
|
SDropComponentNodeStmt* pStmt = nodesMakeNode(type);
|
||||||
CHECK_OUT_OF_MEM(pStmt);
|
CHECK_OUT_OF_MEM(pStmt);
|
||||||
pStmt->dnodeId = strtol(pDnodeId->z, NULL, 10);;
|
pStmt->dnodeId = strtol(pDnodeId->z, NULL, 10);;
|
||||||
return (SNode*)pStmt;
|
return (SNode*)pStmt;
|
||||||
|
|
|
@ -43,6 +43,8 @@ static SKeyword keywordTable[] = {
|
||||||
{"BINARY", TK_BINARY},
|
{"BINARY", TK_BINARY},
|
||||||
{"BIGINT", TK_BIGINT},
|
{"BIGINT", TK_BIGINT},
|
||||||
{"BLOCKS", TK_BLOCKS},
|
{"BLOCKS", TK_BLOCKS},
|
||||||
|
{"BNODE", TK_BNODE},
|
||||||
|
{"BNODES", TK_BNODES},
|
||||||
{"BOOL", TK_BOOL},
|
{"BOOL", TK_BOOL},
|
||||||
{"BUFSIZE", TK_BUFSIZE},
|
{"BUFSIZE", TK_BUFSIZE},
|
||||||
{"BY", TK_BY},
|
{"BY", TK_BY},
|
||||||
|
@ -106,6 +108,7 @@ static SKeyword keywordTable[] = {
|
||||||
{"MAXROWS", TK_MAXROWS},
|
{"MAXROWS", TK_MAXROWS},
|
||||||
{"MINROWS", TK_MINROWS},
|
{"MINROWS", TK_MINROWS},
|
||||||
{"MINUS", TK_MINUS},
|
{"MINUS", TK_MINUS},
|
||||||
|
{"MNODE", TK_MNODE},
|
||||||
{"MNODES", TK_MNODES},
|
{"MNODES", TK_MNODES},
|
||||||
{"MODIFY", TK_MODIFY},
|
{"MODIFY", TK_MODIFY},
|
||||||
{"MODULES", TK_MODULES},
|
{"MODULES", TK_MODULES},
|
||||||
|
@ -152,6 +155,8 @@ static SKeyword keywordTable[] = {
|
||||||
{"SLIMIT", TK_SLIMIT},
|
{"SLIMIT", TK_SLIMIT},
|
||||||
{"SMA", TK_SMA},
|
{"SMA", TK_SMA},
|
||||||
{"SMALLINT", TK_SMALLINT},
|
{"SMALLINT", TK_SMALLINT},
|
||||||
|
{"SNODE", TK_SNODE},
|
||||||
|
{"SNODES", TK_SNODES},
|
||||||
{"SOFFSET", TK_SOFFSET},
|
{"SOFFSET", TK_SOFFSET},
|
||||||
{"STABLE", TK_STABLE},
|
{"STABLE", TK_STABLE},
|
||||||
{"STABLES", TK_STABLES},
|
{"STABLES", TK_STABLES},
|
||||||
|
|
|
@ -2034,7 +2034,23 @@ static int32_t translateDropIndex(STranslateContext* pCxt, SDropIndexStmt* pStmt
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t translateCreateQnode(STranslateContext* pCxt, SCreateQnodeStmt* pStmt) {
|
static int16_t getCreateComponentNodeMsgType(ENodeType type) {
|
||||||
|
switch (type) {
|
||||||
|
case QUERY_NODE_CREATE_QNODE_STMT:
|
||||||
|
return TDMT_MND_CREATE_QNODE;
|
||||||
|
case QUERY_NODE_CREATE_BNODE_STMT:
|
||||||
|
return TDMT_MND_CREATE_BNODE;
|
||||||
|
case QUERY_NODE_CREATE_SNODE_STMT:
|
||||||
|
return TDMT_MND_CREATE_SNODE;
|
||||||
|
case QUERY_NODE_CREATE_MNODE_STMT:
|
||||||
|
return TDMT_MND_CREATE_MNODE;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t translateCreateComponentNode(STranslateContext* pCxt, SCreateComponentNodeStmt* pStmt) {
|
||||||
SMCreateQnodeReq createReq = { .dnodeId = pStmt->dnodeId };
|
SMCreateQnodeReq createReq = { .dnodeId = pStmt->dnodeId };
|
||||||
|
|
||||||
pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo));
|
pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo));
|
||||||
|
@ -2042,18 +2058,34 @@ static int32_t translateCreateQnode(STranslateContext* pCxt, SCreateQnodeStmt* p
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
|
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
|
||||||
pCxt->pCmdMsg->msgType = TDMT_DND_CREATE_QNODE;
|
pCxt->pCmdMsg->msgType = getCreateComponentNodeMsgType(nodeType(pStmt));
|
||||||
pCxt->pCmdMsg->msgLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
pCxt->pCmdMsg->msgLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
|
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
|
||||||
if (NULL == pCxt->pCmdMsg->pMsg) {
|
if (NULL == pCxt->pCmdMsg->pMsg) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
tSerializeSMCreateDropQSBNodeReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &createReq);
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t translateDropQnode(STranslateContext* pCxt, SDropQnodeStmt* pStmt) {
|
static int16_t getDropComponentNodeMsgType(ENodeType type) {
|
||||||
|
switch (type) {
|
||||||
|
case QUERY_NODE_DROP_QNODE_STMT:
|
||||||
|
return TDMT_MND_DROP_QNODE;
|
||||||
|
case QUERY_NODE_DROP_BNODE_STMT:
|
||||||
|
return TDMT_MND_DROP_BNODE;
|
||||||
|
case QUERY_NODE_DROP_SNODE_STMT:
|
||||||
|
return TDMT_MND_DROP_SNODE;
|
||||||
|
case QUERY_NODE_DROP_MNODE_STMT:
|
||||||
|
return TDMT_MND_DROP_MNODE;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t translateDropComponentNode(STranslateContext* pCxt, SDropComponentNodeStmt* pStmt) {
|
||||||
SDDropQnodeReq dropReq = { .dnodeId = pStmt->dnodeId };
|
SDDropQnodeReq dropReq = { .dnodeId = pStmt->dnodeId };
|
||||||
|
|
||||||
pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo));
|
pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo));
|
||||||
|
@ -2061,13 +2093,13 @@ static int32_t translateDropQnode(STranslateContext* pCxt, SDropQnodeStmt* pStmt
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
|
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
|
||||||
pCxt->pCmdMsg->msgType = TDMT_DND_DROP_QNODE;
|
pCxt->pCmdMsg->msgType = getDropComponentNodeMsgType(nodeType(pStmt));
|
||||||
pCxt->pCmdMsg->msgLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
pCxt->pCmdMsg->msgLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
|
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
|
||||||
if (NULL == pCxt->pCmdMsg->pMsg) {
|
if (NULL == pCxt->pCmdMsg->pMsg) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
tSerializeSMCreateDropQSBNodeReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &dropReq);
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -2226,10 +2258,16 @@ static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) {
|
||||||
code = translateDropIndex(pCxt, (SDropIndexStmt*)pNode);
|
code = translateDropIndex(pCxt, (SDropIndexStmt*)pNode);
|
||||||
break;
|
break;
|
||||||
case QUERY_NODE_CREATE_QNODE_STMT:
|
case QUERY_NODE_CREATE_QNODE_STMT:
|
||||||
code = translateCreateQnode(pCxt, (SCreateQnodeStmt*)pNode);
|
case QUERY_NODE_CREATE_BNODE_STMT:
|
||||||
|
case QUERY_NODE_CREATE_SNODE_STMT:
|
||||||
|
case QUERY_NODE_CREATE_MNODE_STMT:
|
||||||
|
code = translateCreateComponentNode(pCxt, (SCreateComponentNodeStmt*)pNode);
|
||||||
break;
|
break;
|
||||||
case QUERY_NODE_DROP_QNODE_STMT:
|
case QUERY_NODE_DROP_QNODE_STMT:
|
||||||
code = translateDropQnode(pCxt, (SDropQnodeStmt*)pNode);
|
case QUERY_NODE_DROP_BNODE_STMT:
|
||||||
|
case QUERY_NODE_DROP_SNODE_STMT:
|
||||||
|
case QUERY_NODE_DROP_MNODE_STMT:
|
||||||
|
code = translateDropComponentNode(pCxt, (SDropComponentNodeStmt*)pNode);
|
||||||
break;
|
break;
|
||||||
case QUERY_NODE_CREATE_TOPIC_STMT:
|
case QUERY_NODE_CREATE_TOPIC_STMT:
|
||||||
code = translateCreateTopic(pCxt, (SCreateTopicStmt*)pNode);
|
code = translateCreateTopic(pCxt, (SCreateTopicStmt*)pNode);
|
||||||
|
@ -2385,6 +2423,10 @@ static const char* getSysTableName(ENodeType type) {
|
||||||
return TSDB_INS_TABLE_USER_INDEXES;
|
return TSDB_INS_TABLE_USER_INDEXES;
|
||||||
case QUERY_NODE_SHOW_STREAMS_STMT:
|
case QUERY_NODE_SHOW_STREAMS_STMT:
|
||||||
return TSDB_INS_TABLE_USER_STREAMS;
|
return TSDB_INS_TABLE_USER_STREAMS;
|
||||||
|
case QUERY_NODE_SHOW_BNODES_STMT:
|
||||||
|
return TSDB_INS_TABLE_BNODES;
|
||||||
|
case QUERY_NODE_SHOW_SNODES_STMT:
|
||||||
|
return TSDB_INS_TABLE_SNODES;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2898,6 +2940,8 @@ static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
case QUERY_NODE_SHOW_FUNCTIONS_STMT:
|
case QUERY_NODE_SHOW_FUNCTIONS_STMT:
|
||||||
case QUERY_NODE_SHOW_INDEXES_STMT:
|
case QUERY_NODE_SHOW_INDEXES_STMT:
|
||||||
case QUERY_NODE_SHOW_STREAMS_STMT:
|
case QUERY_NODE_SHOW_STREAMS_STMT:
|
||||||
|
case QUERY_NODE_SHOW_BNODES_STMT:
|
||||||
|
case QUERY_NODE_SHOW_SNODES_STMT:
|
||||||
code = rewriteShow(pCxt, pQuery);
|
code = rewriteShow(pCxt, pQuery);
|
||||||
break;
|
break;
|
||||||
case QUERY_NODE_CREATE_TABLE_STMT:
|
case QUERY_NODE_CREATE_TABLE_STMT:
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -648,6 +648,48 @@ TEST_F(ParserTest, dropQnode) {
|
||||||
ASSERT_TRUE(run());
|
ASSERT_TRUE(run());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(ParserTest, createBnode) {
|
||||||
|
setDatabase("root", "test");
|
||||||
|
|
||||||
|
bind("create bnode on dnode 1");
|
||||||
|
ASSERT_TRUE(run());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(ParserTest, dropBnode) {
|
||||||
|
setDatabase("root", "test");
|
||||||
|
|
||||||
|
bind("drop bnode on dnode 1");
|
||||||
|
ASSERT_TRUE(run());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(ParserTest, createSnode) {
|
||||||
|
setDatabase("root", "test");
|
||||||
|
|
||||||
|
bind("create snode on dnode 1");
|
||||||
|
ASSERT_TRUE(run());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(ParserTest, dropSnode) {
|
||||||
|
setDatabase("root", "test");
|
||||||
|
|
||||||
|
bind("drop snode on dnode 1");
|
||||||
|
ASSERT_TRUE(run());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(ParserTest, createMnode) {
|
||||||
|
setDatabase("root", "test");
|
||||||
|
|
||||||
|
bind("create mnode on dnode 1");
|
||||||
|
ASSERT_TRUE(run());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(ParserTest, dropMnode) {
|
||||||
|
setDatabase("root", "test");
|
||||||
|
|
||||||
|
bind("drop mnode on dnode 1");
|
||||||
|
ASSERT_TRUE(run());
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(ParserTest, createTopic) {
|
TEST_F(ParserTest, createTopic) {
|
||||||
setDatabase("root", "test");
|
setDatabase("root", "test");
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,9 @@ static EDealRes doNameExpr(SNode* pNode, void* pContext) {
|
||||||
case QUERY_NODE_OPERATOR:
|
case QUERY_NODE_OPERATOR:
|
||||||
case QUERY_NODE_LOGIC_CONDITION:
|
case QUERY_NODE_LOGIC_CONDITION:
|
||||||
case QUERY_NODE_FUNCTION: {
|
case QUERY_NODE_FUNCTION: {
|
||||||
sprintf(((SExprNode*)pNode)->aliasName, "#expr_%p", pNode);
|
if ('\0' == ((SExprNode*)pNode)->aliasName[0]) {
|
||||||
|
sprintf(((SExprNode*)pNode)->aliasName, "#expr_%p", pNode);
|
||||||
|
}
|
||||||
return DEAL_RES_IGNORE_CHILD;
|
return DEAL_RES_IGNORE_CHILD;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -259,6 +259,16 @@ TEST_F(PlannerTest, orderBy) {
|
||||||
ASSERT_TRUE(run());
|
ASSERT_TRUE(run());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(PlannerTest, groupByOrderBy) {
|
||||||
|
setDatabase("root", "test");
|
||||||
|
|
||||||
|
bind("select count(*), sum(c1) from t1 order by sum(c1)");
|
||||||
|
ASSERT_TRUE(run());
|
||||||
|
|
||||||
|
bind("select count(*), sum(c1) a from t1 order by a");
|
||||||
|
ASSERT_TRUE(run());
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(PlannerTest, distinct) {
|
TEST_F(PlannerTest, distinct) {
|
||||||
setDatabase("root", "test");
|
setDatabase("root", "test");
|
||||||
|
|
||||||
|
|
|
@ -247,14 +247,50 @@ int32_t vectorConvertImpl(const SScalarParam* pIn, SScalarParam* pOut) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool value = 0;
|
bool value = 0;
|
||||||
GET_TYPED_DATA(value, int64_t, inType, colDataGetData(pInputCol, i));
|
GET_TYPED_DATA(value, bool, inType, colDataGetData(pInputCol, i));
|
||||||
colDataAppendInt8(pOutputCol, i, (int8_t*) &value);
|
colDataAppendInt8(pOutputCol, i, (int8_t *)&value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TSDB_DATA_TYPE_TINYINT: {
|
||||||
|
for (int32_t i = 0; i < pIn->numOfRows; ++i) {
|
||||||
|
if (colDataIsNull_f(pInputCol->nullbitmap, i)) {
|
||||||
|
colDataAppendNULL(pOutputCol, i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int8_t value = 0;
|
||||||
|
GET_TYPED_DATA(value, int8_t, inType, colDataGetData(pInputCol, i));
|
||||||
|
colDataAppendInt8(pOutputCol, i, (int8_t *)&value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TSDB_DATA_TYPE_SMALLINT:{
|
||||||
|
for (int32_t i = 0; i < pIn->numOfRows; ++i) {
|
||||||
|
if (colDataIsNull_f(pInputCol->nullbitmap, i)) {
|
||||||
|
colDataAppendNULL(pOutputCol, i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int16_t value = 0;
|
||||||
|
GET_TYPED_DATA(value, int16_t, inType, colDataGetData(pInputCol, i));
|
||||||
|
colDataAppendInt16(pOutputCol, i, (int16_t *)&value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TSDB_DATA_TYPE_INT:{
|
||||||
|
for (int32_t i = 0; i < pIn->numOfRows; ++i) {
|
||||||
|
if (colDataIsNull_f(pInputCol->nullbitmap, i)) {
|
||||||
|
colDataAppendNULL(pOutputCol, i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t value = 0;
|
||||||
|
GET_TYPED_DATA(value, int32_t, inType, colDataGetData(pInputCol, i));
|
||||||
|
colDataAppendInt32(pOutputCol, i, (int32_t *)&value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TSDB_DATA_TYPE_TINYINT:
|
|
||||||
case TSDB_DATA_TYPE_SMALLINT:
|
|
||||||
case TSDB_DATA_TYPE_INT:
|
|
||||||
case TSDB_DATA_TYPE_BIGINT:
|
case TSDB_DATA_TYPE_BIGINT:
|
||||||
case TSDB_DATA_TYPE_TIMESTAMP: {
|
case TSDB_DATA_TYPE_TIMESTAMP: {
|
||||||
for (int32_t i = 0; i < pIn->numOfRows; ++i) {
|
for (int32_t i = 0; i < pIn->numOfRows; ++i) {
|
||||||
|
@ -265,14 +301,50 @@ int32_t vectorConvertImpl(const SScalarParam* pIn, SScalarParam* pOut) {
|
||||||
|
|
||||||
int64_t value = 0;
|
int64_t value = 0;
|
||||||
GET_TYPED_DATA(value, int64_t, inType, colDataGetData(pInputCol, i));
|
GET_TYPED_DATA(value, int64_t, inType, colDataGetData(pInputCol, i));
|
||||||
colDataAppendInt64(pOutputCol, i, &value);
|
colDataAppendInt64(pOutputCol, i, (int64_t *)&value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TSDB_DATA_TYPE_UTINYINT:
|
case TSDB_DATA_TYPE_UTINYINT:{
|
||||||
case TSDB_DATA_TYPE_USMALLINT:
|
for (int32_t i = 0; i < pIn->numOfRows; ++i) {
|
||||||
case TSDB_DATA_TYPE_UINT:
|
if (colDataIsNull_f(pInputCol->nullbitmap, i)) {
|
||||||
case TSDB_DATA_TYPE_UBIGINT:
|
colDataAppendNULL(pOutputCol, i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t value = 0;
|
||||||
|
GET_TYPED_DATA(value, uint8_t, inType, colDataGetData(pInputCol, i));
|
||||||
|
colDataAppendInt8(pOutputCol, i, (int8_t *)&value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TSDB_DATA_TYPE_USMALLINT:{
|
||||||
|
for (int32_t i = 0; i < pIn->numOfRows; ++i) {
|
||||||
|
if (colDataIsNull_f(pInputCol->nullbitmap, i)) {
|
||||||
|
colDataAppendNULL(pOutputCol, i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t value = 0;
|
||||||
|
GET_TYPED_DATA(value, uint16_t, inType, colDataGetData(pInputCol, i));
|
||||||
|
colDataAppendInt16(pOutputCol, i, (int16_t *)&value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TSDB_DATA_TYPE_UINT:{
|
||||||
|
for (int32_t i = 0; i < pIn->numOfRows; ++i) {
|
||||||
|
if (colDataIsNull_f(pInputCol->nullbitmap, i)) {
|
||||||
|
colDataAppendNULL(pOutputCol, i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t value = 0;
|
||||||
|
GET_TYPED_DATA(value, uint32_t, inType, colDataGetData(pInputCol, i));
|
||||||
|
colDataAppendInt32(pOutputCol, i, (int32_t *)&value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TSDB_DATA_TYPE_UBIGINT: {
|
||||||
for (int32_t i = 0; i < pIn->numOfRows; ++i) {
|
for (int32_t i = 0; i < pIn->numOfRows; ++i) {
|
||||||
if (colDataIsNull_f(pInputCol->nullbitmap, i)) {
|
if (colDataIsNull_f(pInputCol->nullbitmap, i)) {
|
||||||
colDataAppendNULL(pOutputCol, i);
|
colDataAppendNULL(pOutputCol, i);
|
||||||
|
@ -284,8 +356,21 @@ int32_t vectorConvertImpl(const SScalarParam* pIn, SScalarParam* pOut) {
|
||||||
colDataAppendInt64(pOutputCol, i, (int64_t*)&value);
|
colDataAppendInt64(pOutputCol, i, (int64_t*)&value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TSDB_DATA_TYPE_FLOAT:
|
}
|
||||||
case TSDB_DATA_TYPE_DOUBLE:
|
case TSDB_DATA_TYPE_FLOAT:{
|
||||||
|
for (int32_t i = 0; i < pIn->numOfRows; ++i) {
|
||||||
|
if (colDataIsNull_f(pInputCol->nullbitmap, i)) {
|
||||||
|
colDataAppendNULL(pOutputCol, i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
float value = 0;
|
||||||
|
GET_TYPED_DATA(value, float, inType, colDataGetData(pInputCol, i));
|
||||||
|
colDataAppendFloat(pOutputCol, i, (float*)&value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TSDB_DATA_TYPE_DOUBLE: {
|
||||||
for (int32_t i = 0; i < pIn->numOfRows; ++i) {
|
for (int32_t i = 0; i < pIn->numOfRows; ++i) {
|
||||||
if (colDataIsNull_f(pInputCol->nullbitmap, i)) {
|
if (colDataIsNull_f(pInputCol->nullbitmap, i)) {
|
||||||
colDataAppendNULL(pOutputCol, i);
|
colDataAppendNULL(pOutputCol, i);
|
||||||
|
@ -294,9 +379,10 @@ int32_t vectorConvertImpl(const SScalarParam* pIn, SScalarParam* pOut) {
|
||||||
|
|
||||||
double value = 0;
|
double value = 0;
|
||||||
GET_TYPED_DATA(value, double, inType, colDataGetData(pInputCol, i));
|
GET_TYPED_DATA(value, double, inType, colDataGetData(pInputCol, i));
|
||||||
colDataAppendDouble(pOutputCol, i, &value);
|
colDataAppendDouble(pOutputCol, i, (double*)&value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
sclError("invalid convert output type:%d", outType);
|
sclError("invalid convert output type:%d", outType);
|
||||||
return TSDB_CODE_QRY_APP_ERROR;
|
return TSDB_CODE_QRY_APP_ERROR;
|
||||||
|
|
|
@ -1211,7 +1211,7 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead, SRpcReqConte
|
||||||
rpcSendReqToServer(pRpc, pContext);
|
rpcSendReqToServer(pRpc, pContext);
|
||||||
rpcFreeCont(rpcMsg.pCont);
|
rpcFreeCont(rpcMsg.pCont);
|
||||||
} else if (pHead->code == TSDB_CODE_RPC_NOT_READY || pHead->code == TSDB_CODE_APP_NOT_READY ||
|
} else if (pHead->code == TSDB_CODE_RPC_NOT_READY || pHead->code == TSDB_CODE_APP_NOT_READY ||
|
||||||
pHead->code == TSDB_CODE_DND_OFFLINE) {
|
pHead->code == TSDB_CODE_NODE_OFFLINE) {
|
||||||
pContext->code = pHead->code;
|
pContext->code = pHead->code;
|
||||||
rpcProcessConnError(pContext, NULL);
|
rpcProcessConnError(pContext, NULL);
|
||||||
rpcFreeCont(rpcMsg.pCont);
|
rpcFreeCont(rpcMsg.pCont);
|
||||||
|
|
|
@ -70,21 +70,29 @@ TAOS_DEFINE_ERROR(TSDB_CODE_RPC_FQDN_ERROR, "Unable to resolve FQD
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_INVALID_VERSION, "Invalid app version")
|
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_INVALID_VERSION, "Invalid app version")
|
||||||
|
|
||||||
//common & util
|
//common & util
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_OPS_NOT_SUPPORT, "Operation not supported")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_OUT_OF_MEMORY, "Out of Memory")
|
TAOS_DEFINE_ERROR(TSDB_CODE_OUT_OF_MEMORY, "Out of Memory")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_OUT_OF_RANGE, "Out of range")
|
TAOS_DEFINE_ERROR(TSDB_CODE_OUT_OF_RANGE, "Out of range")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_OUT_OF_SHM_MEM, "Out of Shared memory")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_SHM_ID, "Invalid SHM ID")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_PTR, "Invalid pointer")
|
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_PTR, "Invalid pointer")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_MSG, "Invalid message")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_MSG_LEN, "Invalid message len")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_PARA, "Invalid parameters")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_CFG, "Invalid config option")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_OPTION, "Invalid option")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_JSON_FORMAT, "Invalid json format")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_VERSION_NUMBER, "Invalid version number")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_VERSION_STRING, "Invalid version string")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_VERSION_NOT_COMPATIBLE, "Version not compatible")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MEMORY_CORRUPTED, "Memory corrupted")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MEMORY_CORRUPTED, "Memory corrupted")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_FILE_CORRUPTED, "Data file corrupted")
|
TAOS_DEFINE_ERROR(TSDB_CODE_FILE_CORRUPTED, "Data file corrupted")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_CHECKSUM_ERROR, "Checksum error")
|
TAOS_DEFINE_ERROR(TSDB_CODE_CHECKSUM_ERROR, "Checksum error")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_MSG, "Invalid message")
|
TAOS_DEFINE_ERROR(TSDB_CODE_COMPRESS_ERROR, "Failed to compress msg")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_OPS_NOT_SUPPORT, "Operation not supported")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MSG_NOT_PROCESSED, "Message not processed")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MSG_NOT_PROCESSED, "Message not processed")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_PARA, "Invalid parameters")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_REPEAT_INIT, "Repeat initialization")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_CFG_NOT_FOUND, "Config not found")
|
TAOS_DEFINE_ERROR(TSDB_CODE_CFG_NOT_FOUND, "Config not found")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_CFG, "Invalid config option")
|
TAOS_DEFINE_ERROR(TSDB_CODE_REPEAT_INIT, "Repeat initialization")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_OUT_OF_SHM_MEM, "Out of Share memory")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_SHM_ID, "Invalid SHM ID")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_REF_NO_MEMORY, "Ref out of memory")
|
TAOS_DEFINE_ERROR(TSDB_CODE_REF_NO_MEMORY, "Ref out of memory")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_REF_FULL, "too many Ref Objs")
|
TAOS_DEFINE_ERROR(TSDB_CODE_REF_FULL, "too many Ref Objs")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_REF_ID_REMOVED, "Ref ID is removed")
|
TAOS_DEFINE_ERROR(TSDB_CODE_REF_ID_REMOVED, "Ref ID is removed")
|
||||||
|
@ -92,11 +100,6 @@ TAOS_DEFINE_ERROR(TSDB_CODE_REF_INVALID_ID, "Invalid Ref ID")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_REF_ALREADY_EXIST, "Ref is already there")
|
TAOS_DEFINE_ERROR(TSDB_CODE_REF_ALREADY_EXIST, "Ref is already there")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_REF_NOT_EXIST, "Ref is not there")
|
TAOS_DEFINE_ERROR(TSDB_CODE_REF_NOT_EXIST, "Ref is not there")
|
||||||
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_VERSION_NUMBER, "Invalid version number")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_VERSION_STRING, "Invalid version string")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_VERSION_NOT_COMPATIBLE, "Version not compatible")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_COMPRESS_ERROR, "Failed to compress msg")
|
|
||||||
|
|
||||||
//client
|
//client
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_TSC_INVALID_OPERATION, "Invalid operation")
|
TAOS_DEFINE_ERROR(TSDB_CODE_TSC_INVALID_OPERATION, "Invalid operation")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_TSC_INVALID_QHANDLE, "Invalid qhandle")
|
TAOS_DEFINE_ERROR(TSDB_CODE_TSC_INVALID_QHANDLE, "Invalid qhandle")
|
||||||
|
@ -277,17 +280,9 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_SMA_NOT_EXIST, "SMA does not exist")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_SMA_OPTION, "Invalid sma option")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_SMA_OPTION, "Invalid sma option")
|
||||||
|
|
||||||
// dnode
|
// dnode
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_DND_ACTION_IN_PROGRESS, "Action in progress")
|
TAOS_DEFINE_ERROR(TSDB_CODE_NODE_OFFLINE, "Node is offline")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_DND_OFFLINE, "Dnode is offline")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_DND_INVALID_MSG_LEN, "Invalid message length")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_NODE_ALREADY_DEPLOYED, "Node already deployed")
|
TAOS_DEFINE_ERROR(TSDB_CODE_NODE_ALREADY_DEPLOYED, "Node already deployed")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_NODE_NOT_DEPLOYED, "Node not deployed")
|
TAOS_DEFINE_ERROR(TSDB_CODE_NODE_NOT_DEPLOYED, "Node not deployed")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_NODE_PARSE_FILE_ERROR, "Invalid json format")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_NODE_INVALID_OPTION, "Invalid node option")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_DND_VNODE_ALREADY_DEPLOYED, "Vnode already deployed")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_DND_VNODE_NOT_DEPLOYED, "Vnode not deployed")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_DND_VNODE_INVALID_OPTION, "Vnode option invalid")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_DND_VNODE_TOO_MANY_VNODES, "Too many vnodes")
|
|
||||||
|
|
||||||
// vnode
|
// vnode
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_VND_ACTION_IN_PROGRESS, "Action in progress")
|
TAOS_DEFINE_ERROR(TSDB_CODE_VND_ACTION_IN_PROGRESS, "Action in progress")
|
||||||
|
|
|
@ -33,6 +33,15 @@
|
||||||
./test.sh -f tsim/query/scalarFunction.sim
|
./test.sh -f tsim/query/scalarFunction.sim
|
||||||
./test.sh -f tsim/query/charScalarFunction.sim
|
./test.sh -f tsim/query/charScalarFunction.sim
|
||||||
|
|
||||||
|
# ---- qnode
|
||||||
|
./test.sh -f tsim/qnode/basic1.sim
|
||||||
|
|
||||||
|
# ---- snode
|
||||||
|
./test.sh -f tsim/snode/basic1.sim
|
||||||
|
|
||||||
|
# ---- bnode
|
||||||
|
./test.sh -f tsim/bnode/basic1.sim
|
||||||
|
|
||||||
# ---- show
|
# ---- show
|
||||||
./test.sh -f tsim/show/basic.sim
|
./test.sh -f tsim/show/basic.sim
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,135 @@
|
||||||
|
system sh/stop_dnodes.sh
|
||||||
|
system sh/deploy.sh -n dnode1 -i 1
|
||||||
|
system sh/deploy.sh -n dnode2 -i 2
|
||||||
|
system sh/exec.sh -n dnode1 -s start
|
||||||
|
system sh/exec.sh -n dnode2 -s start
|
||||||
|
sql connect
|
||||||
|
|
||||||
|
print =============== show dnodes
|
||||||
|
sql show dnodes;
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql show mnodes;
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data02 != master then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== create dnodes
|
||||||
|
sql create dnode $hostname port 7200
|
||||||
|
sleep 2000
|
||||||
|
|
||||||
|
sql show dnodes;
|
||||||
|
if $rows != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data10 != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print $data02
|
||||||
|
if $data02 != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data12 != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data04 != ready then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data14 != ready then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql show mnodes;
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data02 != master then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== create drop bnode 1
|
||||||
|
sql create bnode on dnode 1
|
||||||
|
sql show bnodes
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql_error create bnode on dnode 1
|
||||||
|
|
||||||
|
sql drop bnode on dnode 1
|
||||||
|
sql show bnodes
|
||||||
|
if $rows != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql_error drop bnode on dnode 1
|
||||||
|
|
||||||
|
print =============== create drop bnode 2
|
||||||
|
sql create bnode on dnode 2
|
||||||
|
sql show bnodes
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data00 != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql_error create bnode on dnode 2
|
||||||
|
|
||||||
|
sql drop bnode on dnode 2
|
||||||
|
sql show bnodes
|
||||||
|
if $rows != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql_error drop bnode on dnode 2
|
||||||
|
|
||||||
|
print =============== create drop bnodes
|
||||||
|
sql create bnode on dnode 1
|
||||||
|
sql create bnode on dnode 2
|
||||||
|
sql show bnodes
|
||||||
|
if $rows != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== restart
|
||||||
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
||||||
|
system sh/exec.sh -n dnode1 -s start
|
||||||
|
system sh/exec.sh -n dnode2 -s start
|
||||||
|
|
||||||
|
sleep 2000
|
||||||
|
sql show bnodes
|
||||||
|
if $rows != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
|
@ -0,0 +1,135 @@
|
||||||
|
system sh/stop_dnodes.sh
|
||||||
|
system sh/deploy.sh -n dnode1 -i 1
|
||||||
|
system sh/deploy.sh -n dnode2 -i 2
|
||||||
|
system sh/exec.sh -n dnode1 -s start
|
||||||
|
system sh/exec.sh -n dnode2 -s start
|
||||||
|
sql connect
|
||||||
|
|
||||||
|
print =============== show dnodes
|
||||||
|
sql show dnodes;
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql show mnodes;
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data02 != master then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== create dnodes
|
||||||
|
sql create dnode $hostname port 7200
|
||||||
|
sleep 2000
|
||||||
|
|
||||||
|
sql show dnodes;
|
||||||
|
if $rows != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data10 != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print $data02
|
||||||
|
if $data02 != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data12 != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data04 != ready then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data14 != ready then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql show mnodes;
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data02 != master then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== create drop qnode 1
|
||||||
|
sql create qnode on dnode 1
|
||||||
|
sql show qnodes
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql_error create qnode on dnode 1
|
||||||
|
|
||||||
|
sql drop qnode on dnode 1
|
||||||
|
sql show qnodes
|
||||||
|
if $rows != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql_error drop qnode on dnode 1
|
||||||
|
|
||||||
|
print =============== create drop qnode 2
|
||||||
|
sql create qnode on dnode 2
|
||||||
|
sql show qnodes
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data00 != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql_error create qnode on dnode 2
|
||||||
|
|
||||||
|
sql drop qnode on dnode 2
|
||||||
|
sql show qnodes
|
||||||
|
if $rows != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql_error drop qnode on dnode 2
|
||||||
|
|
||||||
|
print =============== create drop qnodes
|
||||||
|
sql create qnode on dnode 1
|
||||||
|
sql create qnode on dnode 2
|
||||||
|
sql show qnodes
|
||||||
|
if $rows != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== restart
|
||||||
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
||||||
|
system sh/exec.sh -n dnode1 -s start
|
||||||
|
system sh/exec.sh -n dnode2 -s start
|
||||||
|
|
||||||
|
sleep 2000
|
||||||
|
sql show qnodes
|
||||||
|
if $rows != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
|
@ -0,0 +1,135 @@
|
||||||
|
system sh/stop_dnodes.sh
|
||||||
|
system sh/deploy.sh -n dnode1 -i 1
|
||||||
|
system sh/deploy.sh -n dnode2 -i 2
|
||||||
|
system sh/exec.sh -n dnode1 -s start
|
||||||
|
system sh/exec.sh -n dnode2 -s start
|
||||||
|
sql connect
|
||||||
|
|
||||||
|
print =============== show dnodes
|
||||||
|
sql show dnodes;
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql show mnodes;
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data02 != master then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== create dnodes
|
||||||
|
sql create dnode $hostname port 7200
|
||||||
|
sleep 2000
|
||||||
|
|
||||||
|
sql show dnodes;
|
||||||
|
if $rows != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data10 != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print $data02
|
||||||
|
if $data02 != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data12 != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data04 != ready then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data14 != ready then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql show mnodes;
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data02 != master then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== create drop qnode 1
|
||||||
|
sql create qnode on dnode 1
|
||||||
|
sql show qnodes
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql_error create qnode on dnode 1
|
||||||
|
|
||||||
|
sql drop qnode on dnode 1
|
||||||
|
sql show qnodes
|
||||||
|
if $rows != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql_error drop qnode on dnode 1
|
||||||
|
|
||||||
|
print =============== create drop qnode 2
|
||||||
|
sql create qnode on dnode 2
|
||||||
|
sql show qnodes
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data00 != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql_error create qnode on dnode 2
|
||||||
|
|
||||||
|
sql drop qnode on dnode 2
|
||||||
|
sql show qnodes
|
||||||
|
if $rows != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql_error drop qnode on dnode 2
|
||||||
|
|
||||||
|
print =============== create drop qnodes
|
||||||
|
sql create qnode on dnode 1
|
||||||
|
sql create qnode on dnode 2
|
||||||
|
sql show qnodes
|
||||||
|
if $rows != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== restart
|
||||||
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
||||||
|
system sh/exec.sh -n dnode1 -s start
|
||||||
|
system sh/exec.sh -n dnode2 -s start
|
||||||
|
|
||||||
|
sleep 2000
|
||||||
|
sql show qnodes
|
||||||
|
if $rows != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
Loading…
Reference in New Issue