未验证 提交 ae511dcb 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #18578 from taosdata/fix/TS-2166-2.6V1

feat(mnode): support show cluster status command on 2.6
...@@ -4107,7 +4107,8 @@ int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { ...@@ -4107,7 +4107,8 @@ int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
*/ */
SShowInfo* pShowInfo = &pInfo->pMiscInfo->showOpt; SShowInfo* pShowInfo = &pInfo->pMiscInfo->showOpt;
int16_t showType = pShowInfo->showType; int16_t showType = pShowInfo->showType;
if (showType == TSDB_MGMT_TABLE_TABLE || showType == TSDB_MGMT_TABLE_METRIC || showType == TSDB_MGMT_TABLE_VGROUP) { if (showType == TSDB_MGMT_TABLE_TABLE || showType == TSDB_MGMT_TABLE_METRIC || showType == TSDB_MGMT_TABLE_VGROUP ||
showType == TSDB_MGMT_ALIVE_DB) {
// db prefix in tagCond, show table conds in payload // db prefix in tagCond, show table conds in payload
SStrToken* pDbPrefixToken = &pShowInfo->prefix; SStrToken* pDbPrefixToken = &pShowInfo->prefix;
if (pDbPrefixToken->type != 0) { if (pDbPrefixToken->type != 0) {
......
...@@ -436,6 +436,11 @@ do { \ ...@@ -436,6 +436,11 @@ do { \
#define TSDB_ARB_DUMMY_TIME 4765104000000 // 2121-01-01 00:00:00.000, :P #define TSDB_ARB_DUMMY_TIME 4765104000000 // 2121-01-01 00:00:00.000, :P
//define show cluster status and show db.status
#define SHOW_STATUS_NOT_AVAILABLE 0
#define SHOW_STATUS_AVAILABLE 1
#define SHOW_STATUS_HALF_AVAILABLE 2
typedef enum { typedef enum {
TAOS_QTYPE_RPC = 0, TAOS_QTYPE_RPC = 0,
TAOS_QTYPE_FWD = 1, TAOS_QTYPE_FWD = 1,
......
...@@ -163,6 +163,8 @@ enum _mgmt_table { ...@@ -163,6 +163,8 @@ enum _mgmt_table {
TSDB_MGMT_TABLE_CLUSTER, TSDB_MGMT_TABLE_CLUSTER,
TSDB_MGMT_TABLE_TP, TSDB_MGMT_TABLE_TP,
TSDB_MGMT_TABLE_FUNCTION, TSDB_MGMT_TABLE_FUNCTION,
TSDB_MGMT_ALIVE_DB, // show database status
TSDB_MGMT_ALIVE_CLUSTER, // show cluster status
TSDB_MGMT_TABLE_MAX, TSDB_MGMT_TABLE_MAX,
}; };
......
...@@ -88,139 +88,140 @@ ...@@ -88,139 +88,140 @@
#define TK_TABLES 70 #define TK_TABLES 70
#define TK_STABLES 71 #define TK_STABLES 71
#define TK_VGROUPS 72 #define TK_VGROUPS 72
#define TK_DROP 73 #define TK_ALIVE 73
#define TK_TOPIC 74 #define TK_CLUSTER 74
#define TK_FUNCTION 75 #define TK_DROP 75
#define TK_DNODE 76 #define TK_TOPIC 76
#define TK_USER 77 #define TK_FUNCTION 77
#define TK_ACCOUNT 78 #define TK_DNODE 78
#define TK_USE 79 #define TK_USER 79
#define TK_DESCRIBE 80 #define TK_ACCOUNT 80
#define TK_DESC 81 #define TK_USE 81
#define TK_ALTER 82 #define TK_DESCRIBE 82
#define TK_PASS 83 #define TK_DESC 83
#define TK_PRIVILEGE 84 #define TK_ALTER 84
#define TK_TAGS 85 #define TK_PASS 85
#define TK_LOCAL 86 #define TK_PRIVILEGE 86
#define TK_COMPACT 87 #define TK_TAGS 87
#define TK_LP 88 #define TK_LOCAL 88
#define TK_RP 89 #define TK_COMPACT 89
#define TK_IF 90 #define TK_LP 90
#define TK_EXISTS 91 #define TK_RP 91
#define TK_AS 92 #define TK_IF 92
#define TK_OUTPUTTYPE 93 #define TK_EXISTS 93
#define TK_AGGREGATE 94 #define TK_AS 94
#define TK_BUFSIZE 95 #define TK_OUTPUTTYPE 95
#define TK_PPS 96 #define TK_AGGREGATE 96
#define TK_TSERIES 97 #define TK_BUFSIZE 97
#define TK_DBS 98 #define TK_PPS 98
#define TK_STORAGE 99 #define TK_TSERIES 99
#define TK_QTIME 100 #define TK_DBS 100
#define TK_CONNS 101 #define TK_STORAGE 101
#define TK_STATE 102 #define TK_QTIME 102
#define TK_COMMA 103 #define TK_CONNS 103
#define TK_KEEP 104 #define TK_STATE 104
#define TK_CACHE 105 #define TK_COMMA 105
#define TK_REPLICA 106 #define TK_KEEP 106
#define TK_QUORUM 107 #define TK_CACHE 107
#define TK_DAYS 108 #define TK_REPLICA 108
#define TK_MINROWS 109 #define TK_QUORUM 109
#define TK_MAXROWS 110 #define TK_DAYS 110
#define TK_BLOCKS 111 #define TK_MINROWS 111
#define TK_CTIME 112 #define TK_MAXROWS 112
#define TK_WAL 113 #define TK_BLOCKS 113
#define TK_FSYNC 114 #define TK_CTIME 114
#define TK_COMP 115 #define TK_WAL 115
#define TK_PRECISION 116 #define TK_FSYNC 116
#define TK_UPDATE 117 #define TK_COMP 117
#define TK_CACHELAST 118 #define TK_PRECISION 118
#define TK_PARTITIONS 119 #define TK_UPDATE 119
#define TK_UNSIGNED 120 #define TK_CACHELAST 120
#define TK_USING 121 #define TK_PARTITIONS 121
#define TK_TO 122 #define TK_UNSIGNED 122
#define TK_SPLIT 123 #define TK_USING 123
#define TK_NULL 124 #define TK_TO 124
#define TK_NOW 125 #define TK_SPLIT 125
#define TK_VARIABLE 126 #define TK_NULL 126
#define TK_SELECT 127 #define TK_NOW 127
#define TK_UNION 128 #define TK_VARIABLE 128
#define TK_ALL 129 #define TK_SELECT 129
#define TK_DISTINCT 130 #define TK_UNION 130
#define TK_FROM 131 #define TK_ALL 131
#define TK_RANGE 132 #define TK_DISTINCT 132
#define TK_INTERVAL 133 #define TK_FROM 133
#define TK_EVERY 134 #define TK_RANGE 134
#define TK_SESSION 135 #define TK_INTERVAL 135
#define TK_STATE_WINDOW 136 #define TK_EVERY 136
#define TK_FILL 137 #define TK_SESSION 137
#define TK_SLIDING 138 #define TK_STATE_WINDOW 138
#define TK_ORDER 139 #define TK_FILL 139
#define TK_BY 140 #define TK_SLIDING 140
#define TK_ASC 141 #define TK_ORDER 141
#define TK_GROUP 142 #define TK_BY 142
#define TK_HAVING 143 #define TK_ASC 143
#define TK_LIMIT 144 #define TK_GROUP 144
#define TK_OFFSET 145 #define TK_HAVING 145
#define TK_SLIMIT 146 #define TK_LIMIT 146
#define TK_SOFFSET 147 #define TK_OFFSET 147
#define TK_WHERE 148 #define TK_SLIMIT 148
#define TK_TODAY 149 #define TK_SOFFSET 149
#define TK_RESET 150 #define TK_WHERE 150
#define TK_QUERY 151 #define TK_TODAY 151
#define TK_SYNCDB 152 #define TK_RESET 152
#define TK_ADD 153 #define TK_QUERY 153
#define TK_COLUMN 154 #define TK_SYNCDB 154
#define TK_MODIFY 155 #define TK_ADD 155
#define TK_TAG 156 #define TK_COLUMN 156
#define TK_CHANGE 157 #define TK_MODIFY 157
#define TK_SET 158 #define TK_TAG 158
#define TK_KILL 159 #define TK_CHANGE 159
#define TK_CONNECTION 160 #define TK_SET 160
#define TK_STREAM 161 #define TK_KILL 161
#define TK_COLON 162 #define TK_CONNECTION 162
#define TK_DELETE 163 #define TK_STREAM 163
#define TK_ABORT 164 #define TK_COLON 164
#define TK_AFTER 165 #define TK_DELETE 165
#define TK_ATTACH 166 #define TK_ABORT 166
#define TK_BEFORE 167 #define TK_AFTER 167
#define TK_BEGIN 168 #define TK_ATTACH 168
#define TK_CASCADE 169 #define TK_BEFORE 169
#define TK_CLUSTER 170 #define TK_BEGIN 170
#define TK_CONFLICT 171 #define TK_CASCADE 171
#define TK_COPY 172 #define TK_CONFLICT 172
#define TK_DEFERRED 173 #define TK_COPY 173
#define TK_DELIMITERS 174 #define TK_DEFERRED 174
#define TK_DETACH 175 #define TK_DELIMITERS 175
#define TK_EACH 176 #define TK_DETACH 176
#define TK_END 177 #define TK_EACH 177
#define TK_EXPLAIN 178 #define TK_END 178
#define TK_FAIL 179 #define TK_EXPLAIN 179
#define TK_FOR 180 #define TK_FAIL 180
#define TK_IGNORE 181 #define TK_FOR 181
#define TK_IMMEDIATE 182 #define TK_IGNORE 182
#define TK_INITIALLY 183 #define TK_IMMEDIATE 183
#define TK_INSTEAD 184 #define TK_INITIALLY 184
#define TK_KEY 185 #define TK_INSTEAD 185
#define TK_OF 186 #define TK_KEY 186
#define TK_RAISE 187 #define TK_OF 187
#define TK_REPLACE 188 #define TK_RAISE 188
#define TK_RESTRICT 189 #define TK_REPLACE 189
#define TK_ROW 190 #define TK_RESTRICT 190
#define TK_STATEMENT 191 #define TK_ROW 191
#define TK_TRIGGER 192 #define TK_STATEMENT 192
#define TK_VIEW 193 #define TK_TRIGGER 193
#define TK_IPTOKEN 194 #define TK_VIEW 194
#define TK_SEMI 195 #define TK_IPTOKEN 195
#define TK_NONE 196 #define TK_SEMI 196
#define TK_PREV 197 #define TK_NONE 197
#define TK_LINEAR 198 #define TK_PREV 198
#define TK_IMPORT 199 #define TK_LINEAR 199
#define TK_TBNAME 200 #define TK_IMPORT 200
#define TK_JOIN 201 #define TK_TBNAME 201
#define TK_INSERT 202 #define TK_JOIN 202
#define TK_INTO 203 #define TK_INSERT 203
#define TK_VALUES 204 #define TK_INTO 204
#define TK_FILE 205 #define TK_VALUES 205
#define TK_FILE 206
#define TK_SPACE 300 #define TK_SPACE 300
......
...@@ -105,11 +105,13 @@ SWords shellCommands[] = { ...@@ -105,11 +105,13 @@ SWords shellCommands[] = {
{"select current_user();", 0, 0, NULL}, {"select current_user();", 0, 0, NULL},
{"select database;", 0, 0, NULL}, {"select database;", 0, 0, NULL},
{"select server_version();", 0, 0, NULL}, {"select server_version();", 0, 0, NULL},
{"select server_status();", 0, 0, NULL},
{"set max_binary_display_width ", 0, 0, NULL}, {"set max_binary_display_width ", 0, 0, NULL},
{"show create database <db_name> \\G;", 0, 0, NULL}, {"show create database <db_name> \\G;", 0, 0, NULL},
{"show create stable <stb_name> \\G;", 0, 0, NULL}, {"show create stable <stb_name> \\G;", 0, 0, NULL},
{"show create table <tb_name> \\G;", 0, 0, NULL}, {"show create table <tb_name> \\G;", 0, 0, NULL},
{"show connections;", 0, 0, NULL}, {"show connections;", 0, 0, NULL},
{"show cluster alive;", 0, 0, NULL},
{"show databases;", 0, 0, NULL}, {"show databases;", 0, 0, NULL},
{"show dnodes;", 0, 0, NULL}, {"show dnodes;", 0, 0, NULL},
{"show functions;", 0, 0, NULL}, {"show functions;", 0, 0, NULL},
...@@ -125,6 +127,7 @@ SWords shellCommands[] = { ...@@ -125,6 +127,7 @@ SWords shellCommands[] = {
{"show users;", 0, 0, NULL}, {"show users;", 0, 0, NULL},
{"show variables;", 0, 0, NULL}, {"show variables;", 0, 0, NULL},
{"show vgroups;", 0, 0, NULL}, {"show vgroups;", 0, 0, NULL},
{"show <db_name> .alive;", 0, 0, NULL},
{"insert into <tb_name> values(", 0, 0, NULL}, {"insert into <tb_name> values(", 0, 0, NULL},
{"insert into <tb_name> using <stb_name> tags( <anyword> ) values(", 0, 0, NULL}, {"insert into <tb_name> using <stb_name> tags( <anyword> ) values(", 0, 0, NULL},
{"insert into <tb_name> using <stb_name> <anyword> values(", 0, 0, NULL}, {"insert into <tb_name> using <stb_name> <anyword> values(", 0, 0, NULL},
...@@ -401,7 +404,9 @@ void showHelp() { ...@@ -401,7 +404,9 @@ void showHelp() {
select current_user();\n\ select current_user();\n\
select database;\n\ select database;\n\
select server_version();\n\ select server_version();\n\
select server_status();\n\
set max_binary_display_width <width>; \n\ set max_binary_display_width <width>; \n\
show cluster alive;\n\
show create database <db_name>;\n\ show create database <db_name>;\n\
show create stable <stb_name>;\n\ show create stable <stb_name>;\n\
show create table <tb_name>;\n\ show create table <tb_name>;\n\
...@@ -421,6 +426,7 @@ void showHelp() { ...@@ -421,6 +426,7 @@ void showHelp() {
show users;\n\ show users;\n\
show variables;\n\ show variables;\n\
show vgroups;\n\ show vgroups;\n\
show <db_name>.alive;\n\
----- I ----- \n\ ----- I ----- \n\
insert into <tb_name> values(...) ;\n\ insert into <tb_name> values(...) ;\n\
----- U ----- \n\ ----- U ----- \n\
......
...@@ -110,6 +110,8 @@ static char *mnodeGetShowType(int32_t showType) { ...@@ -110,6 +110,8 @@ static char *mnodeGetShowType(int32_t showType) {
case TSDB_MGMT_TABLE_CLUSTER: return "show clusters"; case TSDB_MGMT_TABLE_CLUSTER: return "show clusters";
case TSDB_MGMT_TABLE_STREAMTABLES : return "show streamtables"; case TSDB_MGMT_TABLE_STREAMTABLES : return "show streamtables";
case TSDB_MGMT_TABLE_TP: return "show topics"; case TSDB_MGMT_TABLE_TP: return "show topics";
case TSDB_MGMT_ALIVE_DB: return "show database status";
case TSDB_MGMT_ALIVE_CLUSTER: return "show cluster status";
default: return "undefined"; default: return "undefined";
} }
} }
......
...@@ -58,6 +58,11 @@ static int32_t tsVgUpdateSize = 0; ...@@ -58,6 +58,11 @@ static int32_t tsVgUpdateSize = 0;
static int32_t mnodeAllocVgroupIdPool(SVgObj *pInputVgroup); static int32_t mnodeAllocVgroupIdPool(SVgObj *pInputVgroup);
static int32_t mnodeGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn); static int32_t mnodeGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn);
static int32_t mnodeRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, void *pConn); static int32_t mnodeRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, void *pConn);
// status
static int32_t mnodeGetAliveMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn);
static int32_t mnodeRetrieveAliveDb(SShowObj *pShow, char *data, int32_t rows, void *pConn);
static int32_t mnodeRetrieveAliveCluster(SShowObj *pShow, char *data, int32_t rows, void *pConn);
static void mnodeProcessCreateVnodeRsp(SRpcMsg *rpcMsg); static void mnodeProcessCreateVnodeRsp(SRpcMsg *rpcMsg);
static void mnodeProcessAlterVnodeRsp(SRpcMsg *rpcMsg); static void mnodeProcessAlterVnodeRsp(SRpcMsg *rpcMsg);
static void mnodeProcessCompactVnodeRsp(SRpcMsg *rpcMsg); static void mnodeProcessCompactVnodeRsp(SRpcMsg *rpcMsg);
...@@ -235,6 +240,15 @@ int32_t mnodeInitVgroups() { ...@@ -235,6 +240,15 @@ int32_t mnodeInitVgroups() {
mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_VGROUP, mnodeGetVgroupMeta); mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_VGROUP, mnodeGetVgroupMeta);
mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_VGROUP, mnodeRetrieveVgroups); mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_VGROUP, mnodeRetrieveVgroups);
mnodeAddShowFreeIterHandle(TSDB_MGMT_TABLE_VGROUP, mnodeCancelGetNextVgroup); mnodeAddShowFreeIterHandle(TSDB_MGMT_TABLE_VGROUP, mnodeCancelGetNextVgroup);
// cluster status
mnodeAddShowMetaHandle(TSDB_MGMT_ALIVE_CLUSTER, mnodeGetAliveMeta);
mnodeAddShowRetrieveHandle(TSDB_MGMT_ALIVE_CLUSTER, mnodeRetrieveAliveCluster);
mnodeAddShowFreeIterHandle(TSDB_MGMT_ALIVE_CLUSTER, mnodeCancelGetNextVgroup);
// db status
mnodeAddShowMetaHandle(TSDB_MGMT_ALIVE_DB, mnodeGetAliveMeta);
mnodeAddShowRetrieveHandle(TSDB_MGMT_ALIVE_DB, mnodeRetrieveAliveDb);
mnodeAddShowFreeIterHandle(TSDB_MGMT_ALIVE_DB, mnodeCancelGetNextVgroup);
mnodeAddPeerRspHandle(TSDB_MSG_TYPE_MD_CREATE_VNODE_RSP, mnodeProcessCreateVnodeRsp); mnodeAddPeerRspHandle(TSDB_MSG_TYPE_MD_CREATE_VNODE_RSP, mnodeProcessCreateVnodeRsp);
mnodeAddPeerRspHandle(TSDB_MSG_TYPE_MD_ALTER_VNODE_RSP, mnodeProcessAlterVnodeRsp); mnodeAddPeerRspHandle(TSDB_MSG_TYPE_MD_ALTER_VNODE_RSP, mnodeProcessAlterVnodeRsp);
mnodeAddPeerRspHandle(TSDB_MSG_TYPE_MD_COMPACT_VNODE_RSP, mnodeProcessCompactVnodeRsp); mnodeAddPeerRspHandle(TSDB_MSG_TYPE_MD_COMPACT_VNODE_RSP, mnodeProcessCompactVnodeRsp);
...@@ -779,6 +793,99 @@ static int32_t mnodeGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *p ...@@ -779,6 +793,99 @@ static int32_t mnodeGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *p
return 0; return 0;
} }
static int32_t mnodeGetAliveMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) {
SSchema *pSchema = pMeta->schema;
pShow->bytes[0] = sizeof(int32_t);
pSchema[0].type = TSDB_DATA_TYPE_INT;
strcpy(pSchema[0].name, "status");
pSchema[0].bytes = htons(pShow->bytes[0]);
pMeta->numOfColumns = htons(1);
pShow->numOfColumns = 1;
pShow->rowSize = sizeof(int32_t);
pShow->offset[0] = 0;
return 0;
}
static int32_t mnodeRetrieveAlive(SShowObj *pShow, char *data, int32_t rows, void *pConn, SDbObj* pDb) {
SVgObj *pVgroup = NULL;
int32_t nAvailble = 0;
int32_t nUnAvailble = 0;
int32_t numOfRows = 0;
// get status
while (numOfRows < rows) {
pShow->pIter = mnodeGetNextVgroup(pShow->pIter, &pVgroup);
if (pVgroup == NULL) break;
// if pDb is not null
if ( pDb && pVgroup->pDb != pDb) {
mnodeDecVgroupRef(pVgroup);
continue;
}
// status
if(pVgroup->status != TAOS_VG_STATUS_READY ) {
// vgroup is not ready
nUnAvailble ++;
continue;
}
// check master
bool master = false;
for (int32_t i = 0; i < pVgroup->numOfVnodes; ++i) {
if (pVgroup->vnodeGid[i].role == TAOS_SYNC_ROLE_MASTER) {
master = true;
break;
}
}
if (master)
nAvailble++;
else
nUnAvailble++;
// releae pVgroup ref
mnodeDecVgroupRef(pVgroup);
}
// set col data
int32_t status = 0;
if (nAvailble + nUnAvailble == 0 || nUnAvailble == 0) {
status = SHOW_STATUS_AVAILABLE;
} else if (nAvailble > 0 && nUnAvailble > 0) {
status = SHOW_STATUS_HALF_AVAILABLE;
} else {
status = SHOW_STATUS_NOT_AVAILABLE;
}
*(int32_t* )data = status;
pShow->numOfReads = 1;
return 1;
}
static int32_t mnodeRetrieveAliveCluster(SShowObj *pShow, char *data, int32_t rows, void *pConn) {
return mnodeRetrieveAlive(pShow, data, rows, pConn, NULL);
}
static int32_t mnodeRetrieveAliveDb(SShowObj *pShow, char *data, int32_t rows, void *pConn) {
SDbObj *pDb = mnodeGetDb(pShow->db);
if (pDb == NULL) return 0;
if (pDb->status != TSDB_DB_STATUS_READY) {
mError("db:%s, status:%d, in dropping", pDb->name, pDb->status);
mnodeDecDbRef(pDb);
return 0;
}
int32_t numOfRows = mnodeRetrieveAlive(pShow, data, rows, pConn, pDb);
mnodeDecDbRef(pDb);
return numOfRows;
}
static int32_t mnodeRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, void *pConn) { static int32_t mnodeRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, void *pConn) {
int32_t numOfRows = 0; int32_t numOfRows = 0;
SVgObj *pVgroup = NULL; SVgObj *pVgroup = NULL;
......
...@@ -127,6 +127,19 @@ cmd ::= SHOW dbPrefix(X) VGROUPS. { ...@@ -127,6 +127,19 @@ cmd ::= SHOW dbPrefix(X) VGROUPS. {
setShowOptions(pInfo, TSDB_MGMT_TABLE_VGROUP, &token, 0); setShowOptions(pInfo, TSDB_MGMT_TABLE_VGROUP, &token, 0);
} }
// show db.alive
cmd ::= SHOW dbPrefix(X) ALIVE. {
SStrToken token;
tSetDbName(&token, &X);
setShowOptions(pInfo, TSDB_MGMT_ALIVE_DB, &token, 0);
}
// show cluster alive
cmd ::= SHOW CLUSTER ALIVE. {
SStrToken token;
setShowOptions(pInfo, TSDB_MGMT_ALIVE_CLUSTER, &token, 0);
}
//drop configure for tables //drop configure for tables
cmd ::= DROP TABLE ifexists(Y) ids(X) cpxName(Z). { cmd ::= DROP TABLE ifexists(Y) ids(X) cpxName(Z). {
X.n += Z.n; X.n += Z.n;
......
...@@ -72,7 +72,7 @@ SSchema* tscGetColumnSchemaById(STableMeta* pTableMeta, int16_t colId) { ...@@ -72,7 +72,7 @@ SSchema* tscGetColumnSchemaById(STableMeta* pTableMeta, int16_t colId) {
} }
STableMeta* tscCreateTableMetaFromMsg(STableMetaMsg* pTableMetaMsg) { STableMeta* tscCreateTableMetaFromMsg(STableMetaMsg* pTableMetaMsg) {
assert(pTableMetaMsg != NULL && pTableMetaMsg->numOfColumns >= 2); assert(pTableMetaMsg != NULL && pTableMetaMsg->numOfColumns >= 1);
int32_t schemaSize = (pTableMetaMsg->numOfColumns + pTableMetaMsg->numOfTags) * sizeof(SSchema); int32_t schemaSize = (pTableMetaMsg->numOfColumns + pTableMetaMsg->numOfTags) * sizeof(SSchema);
STableMeta* pTableMeta = calloc(1, sizeof(STableMeta) + schemaSize); STableMeta* pTableMeta = calloc(1, sizeof(STableMeta) + schemaSize);
......
此差异已折叠。
...@@ -230,6 +230,8 @@ static SKeyword keywordTable[] = { ...@@ -230,6 +230,8 @@ static SKeyword keywordTable[] = {
{"CONTAINS", TK_CONTAINS}, {"CONTAINS", TK_CONTAINS},
{"TO", TK_TO}, {"TO", TK_TO},
{"SPLIT", TK_SPLIT}, {"SPLIT", TK_SPLIT},
{"ALIVE", TK_ALIVE},
{"CLUSTER", TK_CLUSTER},
{"DELETE", TK_DELETE} {"DELETE", TK_DELETE}
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册