[td-11818]support ip as the dnode name.
This commit is contained in:
parent
0c81df4cea
commit
6ab7c7e878
|
@ -177,14 +177,14 @@ TEST(testCase, create_dnode_Test) {
|
||||||
if (taos_errno(pRes) != 0) {
|
if (taos_errno(pRes) != 0) {
|
||||||
printf("error in create dnode, reason:%s\n", taos_errstr(pRes));
|
printf("error in create dnode, reason:%s\n", taos_errstr(pRes));
|
||||||
}
|
}
|
||||||
|
|
||||||
TAOS_FIELD* pFields = taos_fetch_fields(pRes);
|
|
||||||
ASSERT_TRUE(pFields == NULL);
|
|
||||||
|
|
||||||
int32_t numOfFields = taos_num_fields(pRes);
|
|
||||||
ASSERT_EQ(numOfFields, 0);
|
|
||||||
|
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
|
|
||||||
|
pRes = taos_query(pConn, "create dnode 1.1.1.1 port 9000");
|
||||||
|
if (taos_errno(pRes) != 0) {
|
||||||
|
printf("failed to create dnode, reason:%s\n", taos_errstr(pRes));
|
||||||
|
}
|
||||||
|
taos_free_result(pRes);
|
||||||
|
|
||||||
taos_close(pConn);
|
taos_close(pConn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -200,7 +200,8 @@ ifnotexists(X) ::= . { X.n = 0;}
|
||||||
|
|
||||||
/////////////////////////////////THE CREATE STATEMENT///////////////////////////////////////
|
/////////////////////////////////THE CREATE STATEMENT///////////////////////////////////////
|
||||||
//create option for dnode/db/user/account
|
//create option for dnode/db/user/account
|
||||||
cmd ::= CREATE DNODE ids(X) PORT ids(Y). { setDCLSqlElems(pInfo, TSDB_SQL_CREATE_DNODE, 2, &X, &Y);}
|
cmd ::= CREATE DNODE ids(X) PORT ids(Y). { setDCLSqlElems(pInfo, TSDB_SQL_CREATE_DNODE, 2, &X, &Y);}
|
||||||
|
cmd ::= CREATE DNODE IPTOKEN(X) PORT ids(Y). { setDCLSqlElems(pInfo, TSDB_SQL_CREATE_DNODE, 2, &X, &Y);}
|
||||||
cmd ::= CREATE ACCOUNT ids(X) PASS ids(Y) acct_optr(Z).
|
cmd ::= CREATE ACCOUNT ids(X) PASS ids(Y) acct_optr(Z).
|
||||||
{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &X, &Y, &Z);}
|
{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &X, &Y, &Z);}
|
||||||
cmd ::= CREATE DATABASE ifnotexists(Z) ids(X) db_optr(Y). { setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &X, &Y, &Z);}
|
cmd ::= CREATE DATABASE ifnotexists(Z) ids(X) db_optr(Y). { setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &X, &Y, &Z);}
|
||||||
|
|
|
@ -104,104 +104,104 @@
|
||||||
#define TK_IF 86
|
#define TK_IF 86
|
||||||
#define TK_EXISTS 87
|
#define TK_EXISTS 87
|
||||||
#define TK_PORT 88
|
#define TK_PORT 88
|
||||||
#define TK_AS 89
|
#define TK_IPTOKEN 89
|
||||||
#define TK_OUTPUTTYPE 90
|
#define TK_AS 90
|
||||||
#define TK_AGGREGATE 91
|
#define TK_OUTPUTTYPE 91
|
||||||
#define TK_BUFSIZE 92
|
#define TK_AGGREGATE 92
|
||||||
#define TK_PPS 93
|
#define TK_BUFSIZE 93
|
||||||
#define TK_TSERIES 94
|
#define TK_PPS 94
|
||||||
#define TK_DBS 95
|
#define TK_TSERIES 95
|
||||||
#define TK_STORAGE 96
|
#define TK_DBS 96
|
||||||
#define TK_QTIME 97
|
#define TK_STORAGE 97
|
||||||
#define TK_CONNS 98
|
#define TK_QTIME 98
|
||||||
#define TK_STATE 99
|
#define TK_CONNS 99
|
||||||
#define TK_COMMA 100
|
#define TK_STATE 100
|
||||||
#define TK_KEEP 101
|
#define TK_COMMA 101
|
||||||
#define TK_CACHE 102
|
#define TK_KEEP 102
|
||||||
#define TK_REPLICA 103
|
#define TK_CACHE 103
|
||||||
#define TK_QUORUM 104
|
#define TK_REPLICA 104
|
||||||
#define TK_DAYS 105
|
#define TK_QUORUM 105
|
||||||
#define TK_MINROWS 106
|
#define TK_DAYS 106
|
||||||
#define TK_MAXROWS 107
|
#define TK_MINROWS 107
|
||||||
#define TK_BLOCKS 108
|
#define TK_MAXROWS 108
|
||||||
#define TK_CTIME 109
|
#define TK_BLOCKS 109
|
||||||
#define TK_WAL 110
|
#define TK_CTIME 110
|
||||||
#define TK_FSYNC 111
|
#define TK_WAL 111
|
||||||
#define TK_COMP 112
|
#define TK_FSYNC 112
|
||||||
#define TK_PRECISION 113
|
#define TK_COMP 113
|
||||||
#define TK_UPDATE 114
|
#define TK_PRECISION 114
|
||||||
#define TK_CACHELAST 115
|
#define TK_UPDATE 115
|
||||||
#define TK_UNSIGNED 116
|
#define TK_CACHELAST 116
|
||||||
#define TK_TAGS 117
|
#define TK_UNSIGNED 117
|
||||||
#define TK_USING 118
|
#define TK_TAGS 118
|
||||||
#define TK_NULL 119
|
#define TK_USING 119
|
||||||
#define TK_NOW 120
|
#define TK_NULL 120
|
||||||
#define TK_SELECT 121
|
#define TK_NOW 121
|
||||||
#define TK_UNION 122
|
#define TK_SELECT 122
|
||||||
#define TK_ALL 123
|
#define TK_UNION 123
|
||||||
#define TK_DISTINCT 124
|
#define TK_ALL 124
|
||||||
#define TK_FROM 125
|
#define TK_DISTINCT 125
|
||||||
#define TK_VARIABLE 126
|
#define TK_FROM 126
|
||||||
#define TK_INTERVAL 127
|
#define TK_VARIABLE 127
|
||||||
#define TK_EVERY 128
|
#define TK_INTERVAL 128
|
||||||
#define TK_SESSION 129
|
#define TK_EVERY 129
|
||||||
#define TK_STATE_WINDOW 130
|
#define TK_SESSION 130
|
||||||
#define TK_FILL 131
|
#define TK_STATE_WINDOW 131
|
||||||
#define TK_SLIDING 132
|
#define TK_FILL 132
|
||||||
#define TK_ORDER 133
|
#define TK_SLIDING 133
|
||||||
#define TK_BY 134
|
#define TK_ORDER 134
|
||||||
#define TK_ASC 135
|
#define TK_BY 135
|
||||||
#define TK_GROUP 136
|
#define TK_ASC 136
|
||||||
#define TK_HAVING 137
|
#define TK_GROUP 137
|
||||||
#define TK_LIMIT 138
|
#define TK_HAVING 138
|
||||||
#define TK_OFFSET 139
|
#define TK_LIMIT 139
|
||||||
#define TK_SLIMIT 140
|
#define TK_OFFSET 140
|
||||||
#define TK_SOFFSET 141
|
#define TK_SLIMIT 141
|
||||||
#define TK_WHERE 142
|
#define TK_SOFFSET 142
|
||||||
#define TK_RESET 143
|
#define TK_WHERE 143
|
||||||
#define TK_QUERY 144
|
#define TK_RESET 144
|
||||||
#define TK_SYNCDB 145
|
#define TK_QUERY 145
|
||||||
#define TK_ADD 146
|
#define TK_SYNCDB 146
|
||||||
#define TK_COLUMN 147
|
#define TK_ADD 147
|
||||||
#define TK_MODIFY 148
|
#define TK_COLUMN 148
|
||||||
#define TK_TAG 149
|
#define TK_MODIFY 149
|
||||||
#define TK_CHANGE 150
|
#define TK_TAG 150
|
||||||
#define TK_SET 151
|
#define TK_CHANGE 151
|
||||||
#define TK_KILL 152
|
#define TK_SET 152
|
||||||
#define TK_CONNECTION 153
|
#define TK_KILL 153
|
||||||
#define TK_STREAM 154
|
#define TK_CONNECTION 154
|
||||||
#define TK_COLON 155
|
#define TK_STREAM 155
|
||||||
#define TK_ABORT 156
|
#define TK_COLON 156
|
||||||
#define TK_AFTER 157
|
#define TK_ABORT 157
|
||||||
#define TK_ATTACH 158
|
#define TK_AFTER 158
|
||||||
#define TK_BEFORE 159
|
#define TK_ATTACH 159
|
||||||
#define TK_BEGIN 160
|
#define TK_BEFORE 160
|
||||||
#define TK_CASCADE 161
|
#define TK_BEGIN 161
|
||||||
#define TK_CLUSTER 162
|
#define TK_CASCADE 162
|
||||||
#define TK_CONFLICT 163
|
#define TK_CLUSTER 163
|
||||||
#define TK_COPY 164
|
#define TK_CONFLICT 164
|
||||||
#define TK_DEFERRED 165
|
#define TK_COPY 165
|
||||||
#define TK_DELIMITERS 166
|
#define TK_DEFERRED 166
|
||||||
#define TK_DETACH 167
|
#define TK_DELIMITERS 167
|
||||||
#define TK_EACH 168
|
#define TK_DETACH 168
|
||||||
#define TK_END 169
|
#define TK_EACH 169
|
||||||
#define TK_EXPLAIN 170
|
#define TK_END 170
|
||||||
#define TK_FAIL 171
|
#define TK_EXPLAIN 171
|
||||||
#define TK_FOR 172
|
#define TK_FAIL 172
|
||||||
#define TK_IGNORE 173
|
#define TK_FOR 173
|
||||||
#define TK_IMMEDIATE 174
|
#define TK_IGNORE 174
|
||||||
#define TK_INITIALLY 175
|
#define TK_IMMEDIATE 175
|
||||||
#define TK_INSTEAD 176
|
#define TK_INITIALLY 176
|
||||||
#define TK_KEY 177
|
#define TK_INSTEAD 177
|
||||||
#define TK_OF 178
|
#define TK_KEY 178
|
||||||
#define TK_RAISE 179
|
#define TK_OF 179
|
||||||
#define TK_REPLACE 180
|
#define TK_RAISE 180
|
||||||
#define TK_RESTRICT 181
|
#define TK_REPLACE 181
|
||||||
#define TK_ROW 182
|
#define TK_RESTRICT 182
|
||||||
#define TK_STATEMENT 183
|
#define TK_ROW 183
|
||||||
#define TK_TRIGGER 184
|
#define TK_STATEMENT 184
|
||||||
#define TK_VIEW 185
|
#define TK_TRIGGER 185
|
||||||
#define TK_IPTOKEN 186
|
#define TK_VIEW 186
|
||||||
#define TK_SEMI 187
|
#define TK_SEMI 187
|
||||||
#define TK_NONE 188
|
#define TK_NONE 188
|
||||||
#define TK_PREV 189
|
#define TK_PREV 189
|
||||||
|
@ -216,6 +216,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define TK_SPACE 300
|
#define TK_SPACE 300
|
||||||
#define TK_COMMENT 301
|
#define TK_COMMENT 301
|
||||||
#define TK_ILLEGAL 302
|
#define TK_ILLEGAL 302
|
||||||
|
|
|
@ -388,7 +388,7 @@ SCreateDnodeMsg *buildCreateDnodeMsg(SSqlInfo* pInfo, int32_t* len, SMsgBuf* pMs
|
||||||
}
|
}
|
||||||
|
|
||||||
SToken* id = taosArrayGet(pInfo->pMiscInfo->a, 0);
|
SToken* id = taosArrayGet(pInfo->pMiscInfo->a, 0);
|
||||||
if (id->type != TK_ID) {
|
if (id->type != TK_ID && id->type != TK_IPTOKEN) {
|
||||||
buildInvalidOperationMsg(pMsgBuf, msg2);
|
buildInvalidOperationMsg(pMsgBuf, msg2);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -313,12 +313,8 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = tNameGetTableName(&name, pCreateTableInfo->tagdata.name);
|
const char* pStableName = tNameGetTableName(&name);
|
||||||
|
|
||||||
SArray* pValList = pCreateTableInfo->pTagVals;
|
SArray* pValList = pCreateTableInfo->pTagVals;
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t valSize = taosArrayGetSize(pValList);
|
size_t valSize = taosArrayGetSize(pValList);
|
||||||
STableMeta* pSuperTableMeta = NULL;
|
STableMeta* pSuperTableMeta = NULL;
|
||||||
|
@ -326,7 +322,7 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p
|
||||||
char dbName[TSDB_DB_FNAME_LEN] = {0};
|
char dbName[TSDB_DB_FNAME_LEN] = {0};
|
||||||
tNameGetFullDbName(&name, dbName);
|
tNameGetFullDbName(&name, dbName);
|
||||||
|
|
||||||
catalogGetTableMeta(pCtx->pCatalog, pCtx->pTransporter, &pCtx->mgmtEpSet, dbName, pCreateTableInfo->tagdata.name, &pSuperTableMeta);
|
catalogGetTableMeta(pCtx->pCatalog, pCtx->pTransporter, &pCtx->mgmtEpSet, dbName, pStableName, &pSuperTableMeta);
|
||||||
|
|
||||||
// too long tag values will return invalid sql, not be truncated automatically
|
// too long tag values will return invalid sql, not be truncated automatically
|
||||||
SSchema *pTagSchema = getTableTagSchema(pSuperTableMeta);
|
SSchema *pTagSchema = getTableTagSchema(pSuperTableMeta);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue