Merge branch '3.0' into enh/TS-3812-3.0
This commit is contained in:
commit
3beb9c5c84
|
@ -125,7 +125,8 @@ typedef enum {
|
|||
|
||||
typedef enum {
|
||||
TAOS_NOTIFY_PASSVER = 0,
|
||||
TAOS_NOTIFY_WHITELIST_VER = 1
|
||||
TAOS_NOTIFY_WHITELIST_VER = 1,
|
||||
TAOS_NOTIFY_USER_DROPPED = 2,
|
||||
} TAOS_NOTIFY_TYPE;
|
||||
|
||||
#define RET_MSG_LENGTH 1024
|
||||
|
@ -240,6 +241,11 @@ DLL_EXPORT int taos_set_notify_cb(TAOS *taos, __taos_notify_fn_t fp, void *param
|
|||
typedef void (*__taos_async_whitelist_fn_t)(void *param, int code, TAOS *taos, int numOfWhiteLists, uint64_t* pWhiteLists);
|
||||
DLL_EXPORT void taos_fetch_whitelist_a(TAOS *taos, __taos_async_whitelist_fn_t fp, void *param);
|
||||
|
||||
typedef enum {
|
||||
TAOS_CONN_MODE_BI = 0,
|
||||
} TAOS_CONN_MODE;
|
||||
|
||||
DLL_EXPORT int taos_set_conn_mode(TAOS* taos, int mode, int value);
|
||||
/* --------------------------schemaless INTERFACE------------------------------- */
|
||||
|
||||
DLL_EXPORT TAOS_RES *taos_schemaless_insert(TAOS *taos, char *lines[], int numLines, int protocol, int precision);
|
||||
|
|
|
@ -959,7 +959,7 @@ typedef struct {
|
|||
int8_t superAuth;
|
||||
int8_t sysInfo;
|
||||
int8_t enable;
|
||||
int8_t reserve;
|
||||
int8_t dropped;
|
||||
SHashObj* createdDbs;
|
||||
SHashObj* readDbs;
|
||||
SHashObj* writeDbs;
|
||||
|
|
|
@ -186,177 +186,179 @@
|
|||
#define TK_SUBSCRIPTIONS 167
|
||||
#define TK_VNODES 168
|
||||
#define TK_ALIVE 169
|
||||
#define TK_LIKE 170
|
||||
#define TK_TBNAME 171
|
||||
#define TK_QTAGS 172
|
||||
#define TK_AS 173
|
||||
#define TK_INDEX 174
|
||||
#define TK_FUNCTION 175
|
||||
#define TK_INTERVAL 176
|
||||
#define TK_COUNT 177
|
||||
#define TK_LAST_ROW 178
|
||||
#define TK_META 179
|
||||
#define TK_ONLY 180
|
||||
#define TK_TOPIC 181
|
||||
#define TK_CONSUMER 182
|
||||
#define TK_GROUP 183
|
||||
#define TK_DESC 184
|
||||
#define TK_DESCRIBE 185
|
||||
#define TK_RESET 186
|
||||
#define TK_QUERY 187
|
||||
#define TK_CACHE 188
|
||||
#define TK_EXPLAIN 189
|
||||
#define TK_ANALYZE 190
|
||||
#define TK_VERBOSE 191
|
||||
#define TK_NK_BOOL 192
|
||||
#define TK_RATIO 193
|
||||
#define TK_NK_FLOAT 194
|
||||
#define TK_OUTPUTTYPE 195
|
||||
#define TK_AGGREGATE 196
|
||||
#define TK_BUFSIZE 197
|
||||
#define TK_LANGUAGE 198
|
||||
#define TK_REPLACE 199
|
||||
#define TK_STREAM 200
|
||||
#define TK_INTO 201
|
||||
#define TK_PAUSE 202
|
||||
#define TK_RESUME 203
|
||||
#define TK_TRIGGER 204
|
||||
#define TK_AT_ONCE 205
|
||||
#define TK_WINDOW_CLOSE 206
|
||||
#define TK_IGNORE 207
|
||||
#define TK_EXPIRED 208
|
||||
#define TK_FILL_HISTORY 209
|
||||
#define TK_UPDATE 210
|
||||
#define TK_SUBTABLE 211
|
||||
#define TK_UNTREATED 212
|
||||
#define TK_KILL 213
|
||||
#define TK_CONNECTION 214
|
||||
#define TK_TRANSACTION 215
|
||||
#define TK_BALANCE 216
|
||||
#define TK_VGROUP 217
|
||||
#define TK_LEADER 218
|
||||
#define TK_MERGE 219
|
||||
#define TK_REDISTRIBUTE 220
|
||||
#define TK_SPLIT 221
|
||||
#define TK_DELETE 222
|
||||
#define TK_INSERT 223
|
||||
#define TK_NULL 224
|
||||
#define TK_NK_QUESTION 225
|
||||
#define TK_NK_ARROW 226
|
||||
#define TK_ROWTS 227
|
||||
#define TK_QSTART 228
|
||||
#define TK_QEND 229
|
||||
#define TK_QDURATION 230
|
||||
#define TK_WSTART 231
|
||||
#define TK_WEND 232
|
||||
#define TK_WDURATION 233
|
||||
#define TK_IROWTS 234
|
||||
#define TK_ISFILLED 235
|
||||
#define TK_CAST 236
|
||||
#define TK_NOW 237
|
||||
#define TK_TODAY 238
|
||||
#define TK_TIMEZONE 239
|
||||
#define TK_CLIENT_VERSION 240
|
||||
#define TK_SERVER_VERSION 241
|
||||
#define TK_SERVER_STATUS 242
|
||||
#define TK_CURRENT_USER 243
|
||||
#define TK_CASE 244
|
||||
#define TK_WHEN 245
|
||||
#define TK_THEN 246
|
||||
#define TK_ELSE 247
|
||||
#define TK_BETWEEN 248
|
||||
#define TK_IS 249
|
||||
#define TK_NK_LT 250
|
||||
#define TK_NK_GT 251
|
||||
#define TK_NK_LE 252
|
||||
#define TK_NK_GE 253
|
||||
#define TK_NK_NE 254
|
||||
#define TK_MATCH 255
|
||||
#define TK_NMATCH 256
|
||||
#define TK_CONTAINS 257
|
||||
#define TK_IN 258
|
||||
#define TK_JOIN 259
|
||||
#define TK_INNER 260
|
||||
#define TK_SELECT 261
|
||||
#define TK_NK_HINT 262
|
||||
#define TK_DISTINCT 263
|
||||
#define TK_WHERE 264
|
||||
#define TK_PARTITION 265
|
||||
#define TK_BY 266
|
||||
#define TK_SESSION 267
|
||||
#define TK_STATE_WINDOW 268
|
||||
#define TK_EVENT_WINDOW 269
|
||||
#define TK_SLIDING 270
|
||||
#define TK_FILL 271
|
||||
#define TK_VALUE 272
|
||||
#define TK_VALUE_F 273
|
||||
#define TK_NONE 274
|
||||
#define TK_PREV 275
|
||||
#define TK_NULL_F 276
|
||||
#define TK_LINEAR 277
|
||||
#define TK_NEXT 278
|
||||
#define TK_HAVING 279
|
||||
#define TK_RANGE 280
|
||||
#define TK_EVERY 281
|
||||
#define TK_ORDER 282
|
||||
#define TK_SLIMIT 283
|
||||
#define TK_SOFFSET 284
|
||||
#define TK_LIMIT 285
|
||||
#define TK_OFFSET 286
|
||||
#define TK_ASC 287
|
||||
#define TK_NULLS 288
|
||||
#define TK_ABORT 289
|
||||
#define TK_AFTER 290
|
||||
#define TK_ATTACH 291
|
||||
#define TK_BEFORE 292
|
||||
#define TK_BEGIN 293
|
||||
#define TK_BITAND 294
|
||||
#define TK_BITNOT 295
|
||||
#define TK_BITOR 296
|
||||
#define TK_BLOCKS 297
|
||||
#define TK_CHANGE 298
|
||||
#define TK_COMMA 299
|
||||
#define TK_CONCAT 300
|
||||
#define TK_CONFLICT 301
|
||||
#define TK_COPY 302
|
||||
#define TK_DEFERRED 303
|
||||
#define TK_DELIMITERS 304
|
||||
#define TK_DETACH 305
|
||||
#define TK_DIVIDE 306
|
||||
#define TK_DOT 307
|
||||
#define TK_EACH 308
|
||||
#define TK_FAIL 309
|
||||
#define TK_FILE 310
|
||||
#define TK_FOR 311
|
||||
#define TK_GLOB 312
|
||||
#define TK_ID 313
|
||||
#define TK_IMMEDIATE 314
|
||||
#define TK_IMPORT 315
|
||||
#define TK_INITIALLY 316
|
||||
#define TK_INSTEAD 317
|
||||
#define TK_ISNULL 318
|
||||
#define TK_KEY 319
|
||||
#define TK_MODULES 320
|
||||
#define TK_NK_BITNOT 321
|
||||
#define TK_NK_SEMI 322
|
||||
#define TK_NOTNULL 323
|
||||
#define TK_OF 324
|
||||
#define TK_PLUS 325
|
||||
#define TK_PRIVILEGE 326
|
||||
#define TK_RAISE 327
|
||||
#define TK_RESTRICT 328
|
||||
#define TK_ROW 329
|
||||
#define TK_SEMI 330
|
||||
#define TK_STAR 331
|
||||
#define TK_STATEMENT 332
|
||||
#define TK_STRICT 333
|
||||
#define TK_STRING 334
|
||||
#define TK_TIMES 335
|
||||
#define TK_VALUES 336
|
||||
#define TK_VARIABLE 337
|
||||
#define TK_VIEW 338
|
||||
#define TK_WAL 339
|
||||
|
||||
#define TK_NORMAL 170
|
||||
#define TK_CHILD 171
|
||||
#define TK_LIKE 172
|
||||
#define TK_TBNAME 173
|
||||
#define TK_QTAGS 174
|
||||
#define TK_AS 175
|
||||
#define TK_SYSTEM 176
|
||||
#define TK_INDEX 177
|
||||
#define TK_FUNCTION 178
|
||||
#define TK_INTERVAL 179
|
||||
#define TK_COUNT 180
|
||||
#define TK_LAST_ROW 181
|
||||
#define TK_META 182
|
||||
#define TK_ONLY 183
|
||||
#define TK_TOPIC 184
|
||||
#define TK_CONSUMER 185
|
||||
#define TK_GROUP 186
|
||||
#define TK_DESC 187
|
||||
#define TK_DESCRIBE 188
|
||||
#define TK_RESET 189
|
||||
#define TK_QUERY 190
|
||||
#define TK_CACHE 191
|
||||
#define TK_EXPLAIN 192
|
||||
#define TK_ANALYZE 193
|
||||
#define TK_VERBOSE 194
|
||||
#define TK_NK_BOOL 195
|
||||
#define TK_RATIO 196
|
||||
#define TK_NK_FLOAT 197
|
||||
#define TK_OUTPUTTYPE 198
|
||||
#define TK_AGGREGATE 199
|
||||
#define TK_BUFSIZE 200
|
||||
#define TK_LANGUAGE 201
|
||||
#define TK_REPLACE 202
|
||||
#define TK_STREAM 203
|
||||
#define TK_INTO 204
|
||||
#define TK_PAUSE 205
|
||||
#define TK_RESUME 206
|
||||
#define TK_TRIGGER 207
|
||||
#define TK_AT_ONCE 208
|
||||
#define TK_WINDOW_CLOSE 209
|
||||
#define TK_IGNORE 210
|
||||
#define TK_EXPIRED 211
|
||||
#define TK_FILL_HISTORY 212
|
||||
#define TK_UPDATE 213
|
||||
#define TK_SUBTABLE 214
|
||||
#define TK_UNTREATED 215
|
||||
#define TK_KILL 216
|
||||
#define TK_CONNECTION 217
|
||||
#define TK_TRANSACTION 218
|
||||
#define TK_BALANCE 219
|
||||
#define TK_VGROUP 220
|
||||
#define TK_LEADER 221
|
||||
#define TK_MERGE 222
|
||||
#define TK_REDISTRIBUTE 223
|
||||
#define TK_SPLIT 224
|
||||
#define TK_DELETE 225
|
||||
#define TK_INSERT 226
|
||||
#define TK_NULL 227
|
||||
#define TK_NK_QUESTION 228
|
||||
#define TK_NK_ARROW 229
|
||||
#define TK_ROWTS 230
|
||||
#define TK_QSTART 231
|
||||
#define TK_QEND 232
|
||||
#define TK_QDURATION 233
|
||||
#define TK_WSTART 234
|
||||
#define TK_WEND 235
|
||||
#define TK_WDURATION 236
|
||||
#define TK_IROWTS 237
|
||||
#define TK_ISFILLED 238
|
||||
#define TK_CAST 239
|
||||
#define TK_NOW 240
|
||||
#define TK_TODAY 241
|
||||
#define TK_TIMEZONE 242
|
||||
#define TK_CLIENT_VERSION 243
|
||||
#define TK_SERVER_VERSION 244
|
||||
#define TK_SERVER_STATUS 245
|
||||
#define TK_CURRENT_USER 246
|
||||
#define TK_CASE 247
|
||||
#define TK_WHEN 248
|
||||
#define TK_THEN 249
|
||||
#define TK_ELSE 250
|
||||
#define TK_BETWEEN 251
|
||||
#define TK_IS 252
|
||||
#define TK_NK_LT 253
|
||||
#define TK_NK_GT 254
|
||||
#define TK_NK_LE 255
|
||||
#define TK_NK_GE 256
|
||||
#define TK_NK_NE 257
|
||||
#define TK_MATCH 258
|
||||
#define TK_NMATCH 259
|
||||
#define TK_CONTAINS 260
|
||||
#define TK_IN 261
|
||||
#define TK_JOIN 262
|
||||
#define TK_INNER 263
|
||||
#define TK_SELECT 264
|
||||
#define TK_NK_HINT 265
|
||||
#define TK_DISTINCT 266
|
||||
#define TK_WHERE 267
|
||||
#define TK_PARTITION 268
|
||||
#define TK_BY 269
|
||||
#define TK_SESSION 270
|
||||
#define TK_STATE_WINDOW 271
|
||||
#define TK_EVENT_WINDOW 272
|
||||
#define TK_SLIDING 273
|
||||
#define TK_FILL 274
|
||||
#define TK_VALUE 275
|
||||
#define TK_VALUE_F 276
|
||||
#define TK_NONE 277
|
||||
#define TK_PREV 278
|
||||
#define TK_NULL_F 279
|
||||
#define TK_LINEAR 280
|
||||
#define TK_NEXT 281
|
||||
#define TK_HAVING 282
|
||||
#define TK_RANGE 283
|
||||
#define TK_EVERY 284
|
||||
#define TK_ORDER 285
|
||||
#define TK_SLIMIT 286
|
||||
#define TK_SOFFSET 287
|
||||
#define TK_LIMIT 288
|
||||
#define TK_OFFSET 289
|
||||
#define TK_ASC 290
|
||||
#define TK_NULLS 291
|
||||
#define TK_ABORT 292
|
||||
#define TK_AFTER 293
|
||||
#define TK_ATTACH 294
|
||||
#define TK_BEFORE 295
|
||||
#define TK_BEGIN 296
|
||||
#define TK_BITAND 297
|
||||
#define TK_BITNOT 298
|
||||
#define TK_BITOR 299
|
||||
#define TK_BLOCKS 300
|
||||
#define TK_CHANGE 301
|
||||
#define TK_COMMA 302
|
||||
#define TK_CONCAT 303
|
||||
#define TK_CONFLICT 304
|
||||
#define TK_COPY 305
|
||||
#define TK_DEFERRED 306
|
||||
#define TK_DELIMITERS 307
|
||||
#define TK_DETACH 308
|
||||
#define TK_DIVIDE 309
|
||||
#define TK_DOT 310
|
||||
#define TK_EACH 311
|
||||
#define TK_FAIL 312
|
||||
#define TK_FILE 313
|
||||
#define TK_FOR 314
|
||||
#define TK_GLOB 315
|
||||
#define TK_ID 316
|
||||
#define TK_IMMEDIATE 317
|
||||
#define TK_IMPORT 318
|
||||
#define TK_INITIALLY 319
|
||||
#define TK_INSTEAD 320
|
||||
#define TK_ISNULL 321
|
||||
#define TK_KEY 322
|
||||
#define TK_MODULES 323
|
||||
#define TK_NK_BITNOT 324
|
||||
#define TK_NK_SEMI 325
|
||||
#define TK_NOTNULL 326
|
||||
#define TK_OF 327
|
||||
#define TK_PLUS 328
|
||||
#define TK_PRIVILEGE 329
|
||||
#define TK_RAISE 330
|
||||
#define TK_RESTRICT 331
|
||||
#define TK_ROW 332
|
||||
#define TK_SEMI 333
|
||||
#define TK_STAR 334
|
||||
#define TK_STATEMENT 335
|
||||
#define TK_STRICT 336
|
||||
#define TK_STRING 337
|
||||
#define TK_TIMES 338
|
||||
#define TK_VALUES 339
|
||||
#define TK_VARIABLE 340
|
||||
#define TK_VIEW 341
|
||||
#define TK_WAL 342
|
||||
|
||||
#define TK_NK_SPACE 600
|
||||
#define TK_NK_COMMENT 601
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
typedef struct SExplainCtx SExplainCtx;
|
||||
|
||||
int32_t qExecCommand(int64_t* pConnId, bool sysInfoUser, SNode *pStmt, SRetrieveTableRsp **pRsp);
|
||||
int32_t qExecCommand(int64_t* pConnId, bool sysInfoUser, SNode *pStmt, SRetrieveTableRsp **pRsp, int8_t biMode);
|
||||
|
||||
int32_t qExecStaticExplain(SQueryPlan *pDag, SRetrieveTableRsp **pRsp);
|
||||
int32_t qExecExplainBegin(SQueryPlan *pDag, SExplainCtx **pCtx, int64_t startTs);
|
||||
|
|
|
@ -273,6 +273,7 @@ typedef struct SShowStmt {
|
|||
SNode* pDbName; // SValueNode
|
||||
SNode* pTbName; // SValueNode
|
||||
EOperatorType tableCondType;
|
||||
EShowKind showKind; // show databases: user/system, show tables: normal/child, others NULL
|
||||
} SShowStmt;
|
||||
|
||||
typedef struct SShowCreateDatabaseStmt {
|
||||
|
|
|
@ -277,6 +277,14 @@ typedef enum ETimeLineMode {
|
|||
TIME_LINE_GLOBAL,
|
||||
} ETimeLineMode;
|
||||
|
||||
typedef enum EShowKind {
|
||||
SHOW_KIND_ALL = 1,
|
||||
SHOW_KIND_TABLES_NORMAL,
|
||||
SHOW_KIND_TABLES_CHILD,
|
||||
SHOW_KIND_DATABASES_USER,
|
||||
SHOW_KIND_DATABASES_SYSTEM
|
||||
} EShowKind;
|
||||
|
||||
typedef struct SFillNode {
|
||||
ENodeType type; // QUERY_NODE_FILL
|
||||
EFillMode mode;
|
||||
|
@ -519,6 +527,8 @@ void* nodesGetValueFromNode(SValueNode* pNode);
|
|||
int32_t nodesSetValueNodeValue(SValueNode* pNode, void* value);
|
||||
char* nodesGetStrValueFromNode(SValueNode* pNode);
|
||||
void nodesValueNodeToVariant(const SValueNode* pNode, SVariant* pVal);
|
||||
SValueNode* nodesMakeValueNodeFromString(char* literal);
|
||||
SValueNode* nodesMakeValueNodeFromBool(bool b);
|
||||
|
||||
char* nodesGetFillModeString(EFillMode mode);
|
||||
int32_t nodesMergeConds(SNode** pDst, SNodeList** pSrc);
|
||||
|
|
|
@ -64,6 +64,7 @@ typedef struct SParseContext {
|
|||
SArray* pTableMetaPos; // sql table pos => catalog data pos
|
||||
SArray* pTableVgroupPos; // sql table pos => catalog data pos
|
||||
int64_t allocatorId;
|
||||
int32_t biMode;
|
||||
} SParseContext;
|
||||
|
||||
int32_t qParseSql(SParseContext* pCxt, SQuery** pQuery);
|
||||
|
|
|
@ -133,7 +133,9 @@ typedef struct {
|
|||
int32_t ver;
|
||||
void* param;
|
||||
__taos_notify_fn_t fp;
|
||||
} SPassInfo;
|
||||
} STscNotifyInfo;
|
||||
|
||||
typedef STscNotifyInfo SPassInfo;
|
||||
|
||||
typedef struct {
|
||||
int64_t ver;
|
||||
|
@ -149,6 +151,8 @@ typedef struct STscObj {
|
|||
char sDetailVer[128];
|
||||
int8_t sysInfo;
|
||||
int8_t connType;
|
||||
int8_t dropped;
|
||||
int8_t biMode;
|
||||
int32_t acctId;
|
||||
uint32_t connId;
|
||||
int64_t id; // ref ID returned by taosAddRef
|
||||
|
@ -159,6 +163,7 @@ typedef struct STscObj {
|
|||
SHashObj* pRequests;
|
||||
SPassInfo passInfo;
|
||||
SWhiteListInfo whiteListInfo;
|
||||
STscNotifyInfo userDroppedInfo;
|
||||
} STscObj;
|
||||
|
||||
typedef struct STscDbg {
|
||||
|
|
|
@ -96,6 +96,19 @@ static int32_t hbUpdateUserAuthInfo(SAppHbMgr *pAppHbMgr, SUserAuthBatchRsp *bat
|
|||
}
|
||||
}
|
||||
|
||||
if (pRsp->dropped == 1) {
|
||||
if (atomic_val_compare_exchange_8(&pTscObj->dropped, 0, 1) == 0) {
|
||||
if (pTscObj->userDroppedInfo.fp) {
|
||||
SPassInfo *dropInfo = &pTscObj->userDroppedInfo;
|
||||
if (dropInfo->fp) {
|
||||
(*dropInfo->fp)(dropInfo->param, NULL, TAOS_NOTIFY_USER_DROPPED);
|
||||
}
|
||||
}
|
||||
}
|
||||
releaseTscObj(pReq->connKey.tscRid);
|
||||
continue;
|
||||
}
|
||||
|
||||
pTscObj->authVer = pRsp->version;
|
||||
|
||||
if (pTscObj->sysInfo != pRsp->sysInfo) {
|
||||
|
@ -768,6 +781,16 @@ int32_t hbQueryHbReqHandle(SClientHbKey *connKey, void *param, SClientHbReq *req
|
|||
SHbParam *hbParam = (SHbParam *)param;
|
||||
SCatalog *pCatalog = NULL;
|
||||
|
||||
STscObj *pTscObj = (STscObj *)acquireTscObj(connKey->tscRid);
|
||||
if (!pTscObj) {
|
||||
tscWarn("tscObj rid %" PRIx64 " not exist", connKey->tscRid);
|
||||
return TSDB_CODE_APP_ERROR;
|
||||
} else if (atomic_load_8(&pTscObj->dropped) == 1) {
|
||||
tscDebug("tscObj rid %" PRIx64 " user:%s dropped", connKey->tscRid, pTscObj->user);
|
||||
releaseTscObj(connKey->tscRid);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
if (hbParam->reqCnt == 0) {
|
||||
code = catalogGetHandle(hbParam->clusterId, &pCatalog);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
|
|
|
@ -297,7 +297,8 @@ int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery, SStmtC
|
|||
|
||||
int32_t execLocalCmd(SRequestObj* pRequest, SQuery* pQuery) {
|
||||
SRetrieveTableRsp* pRsp = NULL;
|
||||
int32_t code = qExecCommand(&pRequest->pTscObj->id, pRequest->pTscObj->sysInfo, pQuery->pRoot, &pRsp);
|
||||
int8_t biMode = atomic_load_8(&pRequest->pTscObj->biMode);
|
||||
int32_t code = qExecCommand(&pRequest->pTscObj->id, pRequest->pTscObj->sysInfo, pQuery->pRoot, &pRsp, biMode);
|
||||
if (TSDB_CODE_SUCCESS == code && NULL != pRsp) {
|
||||
code = setQueryResultFromRsp(&pRequest->body.resInfo, pRsp, false, true);
|
||||
}
|
||||
|
@ -335,7 +336,7 @@ void asyncExecLocalCmd(SRequestObj* pRequest, SQuery* pQuery) {
|
|||
return;
|
||||
}
|
||||
|
||||
int32_t code = qExecCommand(&pRequest->pTscObj->id, pRequest->pTscObj->sysInfo, pQuery->pRoot, &pRsp);
|
||||
int32_t code = qExecCommand(&pRequest->pTscObj->id, pRequest->pTscObj->sysInfo, pQuery->pRoot, &pRsp, atomic_load_8(&pRequest->pTscObj->biMode));
|
||||
if (TSDB_CODE_SUCCESS == code && NULL != pRsp) {
|
||||
code = setQueryResultFromRsp(&pRequest->body.resInfo, pRsp, false, true);
|
||||
}
|
||||
|
|
|
@ -147,6 +147,13 @@ int taos_set_notify_cb(TAOS *taos, __taos_notify_fn_t fp, void *param, int type)
|
|||
taosThreadMutexUnlock(&pObj->mutex);
|
||||
break;
|
||||
}
|
||||
case TAOS_NOTIFY_USER_DROPPED: {
|
||||
taosThreadMutexLock(&pObj->mutex);
|
||||
pObj->userDroppedInfo.fp = fp;
|
||||
pObj->userDroppedInfo.param = param;
|
||||
taosThreadMutexUnlock(&pObj->mutex);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
releaseTscObj(*(int64_t *)taos);
|
||||
|
@ -1166,6 +1173,8 @@ int32_t createParseContext(const SRequestObj *pRequest, SParseContext **pCxt) {
|
|||
.svrVer = pTscObj->sVer,
|
||||
.nodeOffline = (pTscObj->pAppInfo->onlineDnodes < pTscObj->pAppInfo->totalDnodes),
|
||||
.allocatorId = pRequest->allocatorRefId};
|
||||
int8_t biMode = atomic_load_8(&((STscObj *)pTscObj)->biMode);
|
||||
(*pCxt)->biMode = biMode;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1829,3 +1838,26 @@ int taos_stmt_close(TAOS_STMT *stmt) {
|
|||
|
||||
return stmtClose(stmt);
|
||||
}
|
||||
|
||||
int taos_set_conn_mode(TAOS* taos, int mode, int value) {
|
||||
if (taos == NULL) {
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
STscObj *pObj = acquireTscObj(*(int64_t *)taos);
|
||||
if (NULL == pObj) {
|
||||
terrno = TSDB_CODE_TSC_DISCONNECTED;
|
||||
tscError("invalid parameter for %s", __func__);
|
||||
return terrno;
|
||||
}
|
||||
switch (mode) {
|
||||
case TAOS_CONN_MODE_BI:
|
||||
atomic_store_8(&pObj->biMode, value);
|
||||
break;
|
||||
default:
|
||||
tscError("not supported mode.");
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -1698,7 +1698,7 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp)
|
|||
if (tEncodeI8(pEncoder, pRsp->superAuth) < 0) return -1;
|
||||
if (tEncodeI8(pEncoder, pRsp->sysInfo) < 0) return -1;
|
||||
if (tEncodeI8(pEncoder, pRsp->enable) < 0) return -1;
|
||||
if (tEncodeI8(pEncoder, pRsp->reserve) < 0) return -1;
|
||||
if (tEncodeI8(pEncoder, pRsp->dropped) < 0) return -1;
|
||||
if (tEncodeI32(pEncoder, pRsp->version) < 0) return -1;
|
||||
|
||||
int32_t numOfCreatedDbs = taosHashGetSize(pRsp->createdDbs);
|
||||
|
@ -1813,7 +1813,7 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs
|
|||
if (tDecodeI8(pDecoder, &pRsp->superAuth) < 0) goto _err;
|
||||
if (tDecodeI8(pDecoder, &pRsp->sysInfo) < 0) goto _err;
|
||||
if (tDecodeI8(pDecoder, &pRsp->enable) < 0) goto _err;
|
||||
if (tDecodeI8(pDecoder, &pRsp->reserve) < 0) goto _err;
|
||||
if (tDecodeI8(pDecoder, &pRsp->dropped) < 0) goto _err;
|
||||
if (tDecodeI32(pDecoder, &pRsp->version) < 0) goto _err;
|
||||
|
||||
int32_t numOfCreatedDbs = 0;
|
||||
|
|
|
@ -35,7 +35,6 @@ int32_t mndCheckTopicPrivilegeByName(SMnode *pMnode, const char *user, EOperType
|
|||
}
|
||||
|
||||
|
||||
// TODO: for community version use the commented version
|
||||
int32_t mndSetUserWhiteListRsp(SMnode *pMnode, SUserObj *pUser, SGetUserWhiteListRsp *pWhiteListRsp) {
|
||||
memcpy(pWhiteListRsp->user, pUser->user, TSDB_USER_LEN);
|
||||
pWhiteListRsp->numWhiteLists = 1;
|
||||
|
@ -44,6 +43,9 @@ int32_t mndSetUserWhiteListRsp(SMnode *pMnode, SUserObj *pUser, SGetUserWhiteLis
|
|||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
memset(pWhiteListRsp->pWhiteLists, 0, pWhiteListRsp->numWhiteLists * sizeof(SIpV4Range));
|
||||
|
||||
// if (tsEnableWhiteList) {
|
||||
// memcpy(pWhiteListRsp->user, pUser->user, TSDB_USER_LEN);
|
||||
// pWhiteListRsp->numWhiteLists = pUser->pIpWhiteList->num;
|
||||
// pWhiteListRsp->pWhiteLists = taosMemoryMalloc(pWhiteListRsp->numWhiteLists * sizeof(SIpV4Range));
|
||||
// if (pWhiteListRsp->pWhiteLists == NULL) {
|
||||
|
@ -51,6 +53,15 @@ int32_t mndSetUserWhiteListRsp(SMnode *pMnode, SUserObj *pUser, SGetUserWhiteLis
|
|||
// }
|
||||
// memcpy(pWhiteListRsp->pWhiteLists, pUser->pIpWhiteList->pIpRange,
|
||||
// pWhiteListRsp->numWhiteLists * sizeof(SIpV4Range));
|
||||
// } else {
|
||||
// memcpy(pWhiteListRsp->user, pUser->user, TSDB_USER_LEN);
|
||||
// pWhiteListRsp->numWhiteLists = 1;
|
||||
// pWhiteListRsp->pWhiteLists = taosMemoryMalloc(pWhiteListRsp->numWhiteLists * sizeof(SIpV4Range));
|
||||
// if (pWhiteListRsp->pWhiteLists == NULL) {
|
||||
// return TSDB_CODE_OUT_OF_MEMORY;
|
||||
// }
|
||||
// memset(pWhiteListRsp->pWhiteLists, 0, pWhiteListRsp->numWhiteLists * sizeof(SIpV4Range));
|
||||
// }
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2289,6 +2289,11 @@ int32_t mndValidateUserAuthInfo(SMnode *pMnode, SUserAuthVersion *pUsers, int32_
|
|||
for (int32_t i = 0; i < numOfUses; ++i) {
|
||||
SUserObj *pUser = mndAcquireUser(pMnode, pUsers[i].user);
|
||||
if (pUser == NULL) {
|
||||
if (TSDB_CODE_MND_USER_NOT_EXIST == terrno) {
|
||||
SGetUserAuthRsp rsp = {.dropped = 1};
|
||||
memcpy(rsp.user, pUsers[i].user, TSDB_USER_LEN);
|
||||
taosArrayPush(batchRsp.pArray, &rsp);
|
||||
}
|
||||
mError("user:%s, failed to auth user since %s", pUsers[i].user, terrstr());
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -975,6 +975,7 @@ void ctgFreeQNode(SCtgQNode* node);
|
|||
void ctgClearHandle(SCatalog* pCtg);
|
||||
void ctgFreeTbCacheImpl(SCtgTbCache* pCache, bool lock);
|
||||
int32_t ctgRemoveTbMeta(SCatalog* pCtg, SName* pTableName);
|
||||
int32_t ctgRemoveCacheUser(SCatalog* pCtg, const char* user);
|
||||
int32_t ctgGetTbHashVgroup(SCatalog* pCtg, SRequestConnInfo* pConn, const SName* pTableName, SVgroupInfo* pVgroup,
|
||||
bool* exists);
|
||||
SName* ctgGetFetchName(SArray* pNames, SCtgFetch* pFetch);
|
||||
|
|
|
@ -2243,6 +2243,10 @@ int32_t ctgOpUpdateUser(SCtgCacheOperation *operation) {
|
|||
|
||||
SCtgUserAuth *pUser = (SCtgUserAuth *)taosHashGet(pCtg->userCache, msg->userAuth.user, strlen(msg->userAuth.user));
|
||||
if (NULL == pUser) {
|
||||
if (msg->userAuth.dropped == 1) {
|
||||
goto _return;
|
||||
}
|
||||
|
||||
SCtgUserAuth userAuth = {0};
|
||||
|
||||
memcpy(&userAuth.userAuth, &msg->userAuth, sizeof(msg->userAuth));
|
||||
|
@ -2258,6 +2262,11 @@ int32_t ctgOpUpdateUser(SCtgCacheOperation *operation) {
|
|||
CTG_CACHE_NUM_INC(CTG_CI_USER, 1);
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
} else if (msg->userAuth.dropped == 1) {
|
||||
if (ctgRemoveCacheUser(pCtg, msg->userAuth.user) == 0) {
|
||||
CTG_CACHE_NUM_DEC(CTG_CI_USER, 1);
|
||||
}
|
||||
goto _return;
|
||||
}
|
||||
|
||||
CTG_LOCK(CTG_WRITE, &pUser->lock);
|
||||
|
|
|
@ -311,6 +311,22 @@ void ctgFreeHandleImpl(SCatalog* pCtg) {
|
|||
taosMemoryFree(pCtg);
|
||||
}
|
||||
|
||||
int32_t ctgRemoveCacheUser(SCatalog* pCtg, const char* user) {
|
||||
if (!pCtg || !user) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
SCtgUserAuth* pUser = (SCtgUserAuth*)taosHashGet(pCtg->userCache, user, strlen(user));
|
||||
if (pUser) {
|
||||
ctgFreeSCtgUserAuth(pUser);
|
||||
if (taosHashRemove(pCtg->userCache, user, strlen(user)) == 0) {
|
||||
return 0; // user found and removed
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void ctgFreeHandle(SCatalog* pCtg) {
|
||||
if (NULL == pCtg) {
|
||||
return;
|
||||
|
|
|
@ -88,8 +88,9 @@ static int32_t buildDescResultDataBlock(SSDataBlock** pOutput) {
|
|||
return code;
|
||||
}
|
||||
|
||||
static int32_t setDescResultIntoDataBlock(bool sysInfoUser, SSDataBlock* pBlock, int32_t numOfRows, STableMeta* pMeta) {
|
||||
blockDataEnsureCapacity(pBlock, numOfRows);
|
||||
static int32_t setDescResultIntoDataBlock(bool sysInfoUser, SSDataBlock* pBlock, int32_t numOfRows, STableMeta* pMeta, int8_t biMode) {
|
||||
int32_t blockCap = (biMode != 0) ? numOfRows + 1 : numOfRows;
|
||||
blockDataEnsureCapacity(pBlock, blockCap);
|
||||
pBlock->info.rows = 0;
|
||||
|
||||
// field
|
||||
|
@ -115,6 +116,17 @@ static int32_t setDescResultIntoDataBlock(bool sysInfoUser, SSDataBlock* pBlock,
|
|||
colDataSetVal(pCol4, pBlock->info.rows, buf, false);
|
||||
++(pBlock->info.rows);
|
||||
}
|
||||
if (pMeta->tableType == TSDB_SUPER_TABLE && biMode != 0) {
|
||||
STR_TO_VARSTR(buf, "tbname");
|
||||
colDataSetVal(pCol1, pBlock->info.rows, buf, false);
|
||||
STR_TO_VARSTR(buf, "VARCHAR");
|
||||
colDataSetVal(pCol2, pBlock->info.rows, buf, false);
|
||||
int32_t bytes = TSDB_TABLE_NAME_LEN - 1;
|
||||
colDataSetVal(pCol3, pBlock->info.rows, (const char*)&bytes, false);
|
||||
STR_TO_VARSTR(buf, "TAG");
|
||||
colDataSetVal(pCol4, pBlock->info.rows, buf, false);
|
||||
++(pBlock->info.rows);
|
||||
}
|
||||
if (pBlock->info.rows <= 0) {
|
||||
qError("no permission to view any columns");
|
||||
return TSDB_CODE_PAR_PERMISSION_DENIED;
|
||||
|
@ -122,14 +134,14 @@ static int32_t setDescResultIntoDataBlock(bool sysInfoUser, SSDataBlock* pBlock,
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t execDescribe(bool sysInfoUser, SNode* pStmt, SRetrieveTableRsp** pRsp) {
|
||||
static int32_t execDescribe(bool sysInfoUser, SNode* pStmt, SRetrieveTableRsp** pRsp, int8_t biMode) {
|
||||
SDescribeStmt* pDesc = (SDescribeStmt*)pStmt;
|
||||
int32_t numOfRows = TABLE_TOTAL_COL_NUM(pDesc->pMeta);
|
||||
|
||||
SSDataBlock* pBlock = NULL;
|
||||
int32_t code = buildDescResultDataBlock(&pBlock);
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = setDescResultIntoDataBlock(sysInfoUser, pBlock, numOfRows, pDesc->pMeta);
|
||||
code = setDescResultIntoDataBlock(sysInfoUser, pBlock, numOfRows, pDesc->pMeta, biMode);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = buildRetrieveTableRsp(pBlock, DESCRIBE_RESULT_COLS, pRsp);
|
||||
|
@ -926,10 +938,10 @@ static int32_t execSelectWithoutFrom(SSelectStmt* pSelect, SRetrieveTableRsp** p
|
|||
return code;
|
||||
}
|
||||
|
||||
int32_t qExecCommand(int64_t* pConnId, bool sysInfoUser, SNode* pStmt, SRetrieveTableRsp** pRsp) {
|
||||
int32_t qExecCommand(int64_t* pConnId, bool sysInfoUser, SNode* pStmt, SRetrieveTableRsp** pRsp, int8_t biMode) {
|
||||
switch (nodeType(pStmt)) {
|
||||
case QUERY_NODE_DESCRIBE_STMT:
|
||||
return execDescribe(sysInfoUser, pStmt, pRsp);
|
||||
return execDescribe(sysInfoUser, pStmt, pRsp, biMode);
|
||||
case QUERY_NODE_RESET_QUERY_CACHE_STMT:
|
||||
return execResetQueryCache();
|
||||
case QUERY_NODE_SHOW_CREATE_DATABASE_STMT:
|
||||
|
|
|
@ -2284,3 +2284,37 @@ const char* dataOrderStr(EDataOrderLevel order) {
|
|||
}
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
SValueNode* nodesMakeValueNodeFromString(char* literal) {
|
||||
int32_t lenStr = strlen(literal);
|
||||
SValueNode* pValNode = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE);
|
||||
if (pValNode) {
|
||||
pValNode->node.resType.type = TSDB_DATA_TYPE_VARCHAR;
|
||||
pValNode->node.resType.bytes = lenStr + VARSTR_HEADER_SIZE;
|
||||
char* p = taosMemoryMalloc(lenStr + 1 + VARSTR_HEADER_SIZE);
|
||||
if (p == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
varDataSetLen(p, lenStr);
|
||||
memcpy(varDataVal(p), literal, lenStr + 1);
|
||||
pValNode->datum.p = p;
|
||||
pValNode->literal = tstrdup(literal);
|
||||
pValNode->translate = true;
|
||||
pValNode->isDuration = false;
|
||||
pValNode->isNull = false;
|
||||
}
|
||||
return pValNode;
|
||||
}
|
||||
|
||||
SValueNode* nodesMakeValueNodeFromBool(bool b) {
|
||||
SValueNode* pValNode = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE);
|
||||
if (pValNode) {
|
||||
pValNode->node.resType.type = TSDB_DATA_TYPE_BOOL;
|
||||
pValNode->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes;
|
||||
nodesSetValueNodeValue(pValNode, &b);
|
||||
pValNode->translate = true;
|
||||
pValNode->isDuration = false;
|
||||
pValNode->isNull = false;
|
||||
}
|
||||
return pValNode;
|
||||
}
|
|
@ -87,6 +87,11 @@ typedef struct STokenPair {
|
|||
SToken second;
|
||||
} STokenPair;
|
||||
|
||||
typedef struct SShowTablesOption {
|
||||
EShowKind kind;
|
||||
SToken dbName;
|
||||
} SShowTablesOption;
|
||||
|
||||
extern SToken nil_token;
|
||||
|
||||
void initAstCreateContext(SParseContext* pParseCxt, SAstCreateContext* pCxt);
|
||||
|
@ -181,9 +186,11 @@ SNode* createAlterTableRenameCol(SAstCreateContext* pCxt, SNode* pRealTable, int
|
|||
SNode* createAlterTableSetTag(SAstCreateContext* pCxt, SNode* pRealTable, SToken* pTagName, SNode* pVal);
|
||||
SNode* setAlterSuperTableType(SNode* pStmt);
|
||||
SNode* createUseDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName);
|
||||
SNode* setShowKind(SAstCreateContext* pCxt, SNode* pStmt, EShowKind showKind);
|
||||
SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type);
|
||||
SNode* createShowStmtWithCond(SAstCreateContext* pCxt, ENodeType type, SNode* pDbName, SNode* pTbName,
|
||||
EOperatorType tableCondType);
|
||||
SNode* createShowTablesStmt(SAstCreateContext* pCxt, SShowTablesOption option, SNode* pTbName, EOperatorType tableCondType);
|
||||
SNode* createShowCreateDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName);
|
||||
SNode* createShowAliveStmt(SAstCreateContext* pCxt, SNode* pDbName, ENodeType type);
|
||||
SNode* createShowCreateTableStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pRealTable);
|
||||
|
|
|
@ -458,8 +458,13 @@ col_name(A) ::= column_name(B).
|
|||
cmd ::= SHOW DNODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); }
|
||||
cmd ::= SHOW USERS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); }
|
||||
cmd ::= SHOW USER PRIVILEGES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); }
|
||||
cmd ::= SHOW DATABASES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); }
|
||||
cmd ::= SHOW db_name_cond_opt(A) TABLES like_pattern_opt(B). { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, A, B, OP_TYPE_LIKE); }
|
||||
cmd ::= SHOW db_kind_opt(A) DATABASES. {
|
||||
pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT);
|
||||
setShowKind(pCxt, pCxt->pRootNode, A);
|
||||
}
|
||||
cmd ::= SHOW table_kind_db_name_cond_opt(A) TABLES like_pattern_opt(B). {
|
||||
pCxt->pRootNode = createShowTablesStmt(pCxt, A, B, OP_TYPE_LIKE);
|
||||
}
|
||||
cmd ::= SHOW db_name_cond_opt(A) STABLES like_pattern_opt(B). { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, A, B, OP_TYPE_LIKE); }
|
||||
cmd ::= SHOW db_name_cond_opt(A) VGROUPS. { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, A, NULL, OP_TYPE_LIKE); }
|
||||
cmd ::= SHOW MNODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); }
|
||||
|
@ -501,6 +506,18 @@ cmd ::= SHOW VNODES.
|
|||
cmd ::= SHOW db_name_cond_opt(A) ALIVE. { pCxt->pRootNode = createShowAliveStmt(pCxt, A, QUERY_NODE_SHOW_DB_ALIVE_STMT); }
|
||||
cmd ::= SHOW CLUSTER ALIVE. { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); }
|
||||
|
||||
%type table_kind_db_name_cond_opt { SShowTablesOption }
|
||||
%destructor table_kind_db_name_cond_opt { }
|
||||
table_kind_db_name_cond_opt(A) ::= . { A.kind = SHOW_KIND_ALL; A.dbName = nil_token; }
|
||||
table_kind_db_name_cond_opt(A) ::= table_kind(B). { A.kind = B; A.dbName = nil_token; }
|
||||
table_kind_db_name_cond_opt(A) ::= db_name(C) NK_DOT. { A.kind = SHOW_KIND_ALL; A.dbName = C; }
|
||||
table_kind_db_name_cond_opt(A) ::= table_kind(B) db_name(C) NK_DOT. { A.kind = B; A.dbName = C; }
|
||||
|
||||
%type table_kind { EShowKind }
|
||||
%destructor table_kind { }
|
||||
table_kind(A) ::= NORMAL. { A = SHOW_KIND_TABLES_NORMAL; }
|
||||
table_kind(A) ::= CHILD. { A = SHOW_KIND_TABLES_CHILD; }
|
||||
|
||||
db_name_cond_opt(A) ::= . { A = createDefaultDatabaseCondValue(pCxt); }
|
||||
db_name_cond_opt(A) ::= db_name(B) NK_DOT. { A = createIdentifierValueNode(pCxt, &B); }
|
||||
|
||||
|
@ -524,6 +541,12 @@ tag_item(A) ::= column_name(B).
|
|||
tag_item(A) ::= column_name(B) column_alias(C). { A = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &B), &C); }
|
||||
tag_item(A) ::= column_name(B) AS column_alias(C). { A = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &B), &C); }
|
||||
|
||||
%type db_kind_opt { EShowKind }
|
||||
%destructor db_kind_opt { }
|
||||
db_kind_opt(A) ::= . { A = SHOW_KIND_ALL; }
|
||||
db_kind_opt(A) ::= USER. { A = SHOW_KIND_DATABASES_USER; }
|
||||
db_kind_opt(A) ::= SYSTEM. { A = SHOW_KIND_DATABASES_SYSTEM; }
|
||||
|
||||
/************************************************ create index ********************************************************/
|
||||
cmd ::= CREATE SMA INDEX not_exists_opt(D)
|
||||
col_name(A) ON full_table_name(B) index_options(C). { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, D, A, B, NULL, C); }
|
||||
|
|
|
@ -1552,6 +1552,15 @@ SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type) {
|
|||
return (SNode*)pStmt;
|
||||
}
|
||||
|
||||
SNode* setShowKind(SAstCreateContext* pCxt, SNode* pStmt, EShowKind showKind) {
|
||||
if (pStmt == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
SShowStmt* pShow = (SShowStmt*)pStmt;
|
||||
pShow->showKind = showKind;
|
||||
return pStmt;
|
||||
}
|
||||
|
||||
SNode* createShowStmtWithCond(SAstCreateContext* pCxt, ENodeType type, SNode* pDbName, SNode* pTbName,
|
||||
EOperatorType tableCondType) {
|
||||
CHECK_PARSER_STATUS(pCxt);
|
||||
|
@ -1568,6 +1577,19 @@ SNode* createShowStmtWithCond(SAstCreateContext* pCxt, ENodeType type, SNode* pD
|
|||
return (SNode*)pStmt;
|
||||
}
|
||||
|
||||
SNode* createShowTablesStmt(SAstCreateContext* pCxt, SShowTablesOption option, SNode* pTbName, EOperatorType tableCondType) {
|
||||
CHECK_PARSER_STATUS(pCxt);
|
||||
SNode* pDbName = NULL;
|
||||
if (option.dbName.type == TK_NK_NIL) {
|
||||
pDbName = createDefaultDatabaseCondValue(pCxt);
|
||||
} else {
|
||||
pDbName = createIdentifierValueNode(pCxt, &option.dbName);
|
||||
}
|
||||
SNode* pStmt = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, pDbName, pTbName, tableCondType);
|
||||
setShowKind(pCxt, pStmt, option.kind);
|
||||
return pStmt;
|
||||
}
|
||||
|
||||
SNode* createShowCreateDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName) {
|
||||
CHECK_PARSER_STATUS(pCxt);
|
||||
if (!checkDbName(pCxt, pDbName, true)) {
|
||||
|
|
|
@ -57,6 +57,7 @@ static SKeyword keywordTable[] = {
|
|||
{"CACHESIZE", TK_CACHESIZE},
|
||||
{"CASE", TK_CASE},
|
||||
{"CAST", TK_CAST},
|
||||
{"CHILD", TK_CHILD},
|
||||
{"CLIENT_VERSION", TK_CLIENT_VERSION},
|
||||
{"CLUSTER", TK_CLUSTER},
|
||||
{"COLUMN", TK_COLUMN},
|
||||
|
@ -149,6 +150,7 @@ static SKeyword keywordTable[] = {
|
|||
{"MNODES", TK_MNODES},
|
||||
{"MODIFY", TK_MODIFY},
|
||||
{"MODULES", TK_MODULES},
|
||||
{"NORMAL", TK_NORMAL},
|
||||
{"NCHAR", TK_NCHAR},
|
||||
{"NEXT", TK_NEXT},
|
||||
{"NMATCH", TK_NMATCH},
|
||||
|
@ -224,6 +226,7 @@ static SKeyword keywordTable[] = {
|
|||
{"SUBSCRIPTIONS", TK_SUBSCRIPTIONS},
|
||||
{"SUBTABLE", TK_SUBTABLE},
|
||||
{"SYSINFO", TK_SYSINFO},
|
||||
{"SYSTEM", TK_SYSTEM},
|
||||
{"TABLE", TK_TABLE},
|
||||
{"TABLES", TK_TABLES},
|
||||
{"TABLE_PREFIX", TK_TABLE_PREFIX},
|
||||
|
|
|
@ -7997,12 +7997,12 @@ static const char* getTbNameColName(ENodeType type) {
|
|||
return (QUERY_NODE_SHOW_STABLES_STMT == type ? "stable_name" : "table_name");
|
||||
}
|
||||
|
||||
static int32_t createLogicCondNode(SNode* pCond1, SNode* pCond2, SNode** pCond) {
|
||||
static int32_t createLogicCondNode(SNode* pCond1, SNode* pCond2, SNode** pCond, ELogicConditionType logicCondType) {
|
||||
SLogicConditionNode* pCondition = (SLogicConditionNode*)nodesMakeNode(QUERY_NODE_LOGIC_CONDITION);
|
||||
if (NULL == pCondition) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
pCondition->condType = LOGIC_COND_TYPE_AND;
|
||||
pCondition->condType = logicCondType;
|
||||
pCondition->pParameterList = nodesMakeList();
|
||||
if (NULL == pCondition->pParameterList) {
|
||||
nodesDestroyNode((SNode*)pCondition);
|
||||
|
@ -8018,6 +8018,87 @@ static int32_t createLogicCondNode(SNode* pCond1, SNode* pCond2, SNode** pCond)
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t insertCondIntoSelectStmt(SSelectStmt* pSelect, SNode* pCond) {
|
||||
if (pSelect->pWhere == NULL) {
|
||||
pSelect->pWhere = pCond;
|
||||
} else {
|
||||
SNode* pWhere = NULL;
|
||||
createLogicCondNode(pSelect->pWhere, pCond, &pWhere, LOGIC_COND_TYPE_AND);
|
||||
pSelect->pWhere = pWhere;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t addShowUserDatabasesCond(SSelectStmt* pSelect) {
|
||||
SNode* pNameCond1 = NULL;
|
||||
SNode* pNameCond2 = NULL;
|
||||
SValueNode* pValNode1 = nodesMakeValueNodeFromString(TSDB_INFORMATION_SCHEMA_DB);
|
||||
SValueNode* pValNode2 = nodesMakeValueNodeFromString(TSDB_PERFORMANCE_SCHEMA_DB);
|
||||
createOperatorNode(OP_TYPE_NOT_EQUAL, "name", (SNode*)pValNode1, &pNameCond1);
|
||||
createOperatorNode(OP_TYPE_NOT_EQUAL, "name", (SNode*)pValNode2, &pNameCond2);
|
||||
nodesDestroyNode((SNode*)pValNode2);
|
||||
nodesDestroyNode((SNode*)pValNode1);
|
||||
SNode* pNameCond = NULL;
|
||||
createLogicCondNode(pNameCond1, pNameCond2, &pNameCond, LOGIC_COND_TYPE_AND);
|
||||
insertCondIntoSelectStmt(pSelect, pNameCond);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t addShowSystemDatabasesCond(SSelectStmt* pSelect) {
|
||||
SNode* pNameCond1 = NULL;
|
||||
SNode* pNameCond2 = NULL;
|
||||
SValueNode* pValNode1 = nodesMakeValueNodeFromString(TSDB_INFORMATION_SCHEMA_DB);
|
||||
SValueNode* pValNode2 = nodesMakeValueNodeFromString(TSDB_PERFORMANCE_SCHEMA_DB);
|
||||
createOperatorNode(OP_TYPE_EQUAL, "name", (SNode*)pValNode1, &pNameCond1);
|
||||
createOperatorNode(OP_TYPE_EQUAL, "name", (SNode*)pValNode2, &pNameCond2);
|
||||
nodesDestroyNode((SNode*)pValNode2);
|
||||
nodesDestroyNode((SNode*)pValNode1);
|
||||
SNode* pNameCond = NULL;
|
||||
createLogicCondNode(pNameCond1, pNameCond2, &pNameCond, LOGIC_COND_TYPE_OR);
|
||||
insertCondIntoSelectStmt(pSelect, pNameCond);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t addShowNormalTablesCond(SSelectStmt* pSelect) {
|
||||
SNode* pTypeCond = NULL;
|
||||
SValueNode* pValNode1 = nodesMakeValueNodeFromString("NORMAL_TABLE");
|
||||
createOperatorNode(OP_TYPE_EQUAL, "type", (SNode*)pValNode1, &pTypeCond);
|
||||
nodesDestroyNode((SNode*)pValNode1);
|
||||
insertCondIntoSelectStmt(pSelect, pTypeCond);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t addShowChildTablesCond(SSelectStmt* pSelect) {
|
||||
SNode* pTypeCond = NULL;
|
||||
SValueNode* pValNode1 = nodesMakeValueNodeFromString("CHILD_TABLE");
|
||||
createOperatorNode(OP_TYPE_EQUAL, "type", (SNode*)pValNode1, &pTypeCond);
|
||||
nodesDestroyNode((SNode*)pValNode1);
|
||||
insertCondIntoSelectStmt(pSelect, pTypeCond);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t addShowKindCond(const SShowStmt* pShow, SSelectStmt* pSelect) {
|
||||
if (pShow->type != QUERY_NODE_SHOW_DATABASES_STMT && pShow->type != QUERY_NODE_SHOW_TABLES_STMT ||
|
||||
pShow->showKind == SHOW_KIND_ALL) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
if (pShow->type == QUERY_NODE_SHOW_DATABASES_STMT) {
|
||||
if (pShow->showKind == SHOW_KIND_DATABASES_USER) {
|
||||
addShowUserDatabasesCond(pSelect);
|
||||
} else if (pShow->showKind == SHOW_KIND_DATABASES_SYSTEM) {
|
||||
addShowSystemDatabasesCond(pSelect);
|
||||
}
|
||||
} else if (pShow->type == QUERY_NODE_SHOW_TABLES_STMT) {
|
||||
if (pShow->showKind == SHOW_KIND_TABLES_NORMAL) {
|
||||
addShowNormalTablesCond(pSelect);
|
||||
} else if (pShow->showKind == SHOW_KIND_TABLES_CHILD) {
|
||||
addShowChildTablesCond(pSelect);
|
||||
}
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static int32_t createShowCondition(const SShowStmt* pShow, SSelectStmt* pSelect) {
|
||||
SNode* pDbCond = NULL;
|
||||
SNode* pTbCond = NULL;
|
||||
|
@ -8030,7 +8111,7 @@ static int32_t createShowCondition(const SShowStmt* pShow, SSelectStmt* pSelect)
|
|||
}
|
||||
|
||||
if (NULL != pDbCond && NULL != pTbCond) {
|
||||
if (TSDB_CODE_SUCCESS != createLogicCondNode(pDbCond, pTbCond, &pSelect->pWhere)) {
|
||||
if (TSDB_CODE_SUCCESS != createLogicCondNode(pDbCond, pTbCond, &pSelect->pWhere, LOGIC_COND_TYPE_AND)) {
|
||||
nodesDestroyNode(pDbCond);
|
||||
nodesDestroyNode(pTbCond);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
@ -8039,6 +8120,11 @@ static int32_t createShowCondition(const SShowStmt* pShow, SSelectStmt* pSelect)
|
|||
pSelect->pWhere = (NULL == pDbCond ? pTbCond : pDbCond);
|
||||
}
|
||||
|
||||
int32_t code = addShowKindCond(pShow, pSelect);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
return code;
|
||||
}
|
||||
|
||||
if (NULL != pShow->pDbName) {
|
||||
strcpy(((SRealTableNode*)pSelect->pFromTable)->qualDbName, ((SValueNode*)pShow->pDbName)->literal);
|
||||
}
|
||||
|
@ -8132,7 +8218,7 @@ static int32_t rewriteShowDnodeVariables(STranslateContext* pCxt, SQuery* pQuery
|
|||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
if (NULL != pLikeCond) {
|
||||
code = createLogicCondNode(pDnodeCond, pLikeCond, &pSelect->pWhere);
|
||||
code = createLogicCondNode(pDnodeCond, pLikeCond, &pSelect->pWhere, LOGIC_COND_TYPE_AND);
|
||||
} else {
|
||||
pSelect->pWhere = pDnodeCond;
|
||||
}
|
||||
|
@ -9451,6 +9537,11 @@ static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery) {
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t rewriteQueryForBI(STranslateContext* pParseCxt, SQuery* pQuery) {
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t translate(SParseContext* pParseCxt, SQuery* pQuery, SParseMetaCache* pMetaCache) {
|
||||
STranslateContext cxt = {0};
|
||||
|
||||
|
@ -9458,9 +9549,13 @@ int32_t translate(SParseContext* pParseCxt, SQuery* pQuery, SParseMetaCache* pMe
|
|||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = rewriteQuery(&cxt, pQuery);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code && pParseCxt->biMode != 0) {
|
||||
code = rewriteQueryForBI(&cxt, pQuery);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = translateQuery(&cxt, pQuery->pRoot);
|
||||
}
|
||||
|
||||
if (TSDB_CODE_SUCCESS == code && (cxt.pPrevRoot || cxt.pPostRoot)) {
|
||||
pQuery->pPrevRoot = cxt.pPrevRoot;
|
||||
pQuery->pPostRoot = cxt.pPostRoot;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1010,6 +1010,7 @@
|
|||
,,y,script,./test.sh -f tsim/query/emptyTsRange_scl.sim
|
||||
,,y,script,./test.sh -f tsim/query/partitionby.sim
|
||||
,,y,script,./test.sh -f tsim/query/tableCount.sim
|
||||
,,y,script,./test.sh -f tsim/query/show_db_table_kind.sim
|
||||
,,y,script,./test.sh -f tsim/query/tag_scan.sim
|
||||
,,y,script,./test.sh -f tsim/query/nullColSma.sim
|
||||
,,y,script,./test.sh -f tsim/query/bug3398.sim
|
||||
|
|
|
@ -47,8 +47,10 @@ typedef uint16_t VarDataLenT;
|
|||
void createUsers(TAOS *taos, const char *host, char *qstr);
|
||||
void passVerTestMulti(const char *host, char *qstr);
|
||||
void sysInfoTest(TAOS *taos, const char *host, char *qstr);
|
||||
void userDroppedTest(TAOS *taos, const char *host, char *qstr);
|
||||
|
||||
int nPassVerNotified = 0;
|
||||
int nUserDropped = 0;
|
||||
TAOS *taosu[nRoot] = {0};
|
||||
char users[nUser][USER_LEN] = {0};
|
||||
|
||||
|
@ -56,11 +58,16 @@ void __taos_notify_cb(void *param, void *ext, int type) {
|
|||
switch (type) {
|
||||
case TAOS_NOTIFY_PASSVER: {
|
||||
++nPassVerNotified;
|
||||
printf("%s:%d type:%d user:%s ver:%d\n", __func__, __LINE__, type, param ? (char *)param : "NULL", *(int *)ext);
|
||||
printf("%s:%d type:%d user:%s passVer:%d\n", __func__, __LINE__, type, param ? (char *)param : "NULL", *(int *)ext);
|
||||
break;
|
||||
}
|
||||
case TAOS_NOTIFY_USER_DROPPED: {
|
||||
++nUserDropped;
|
||||
printf("%s:%d type:%d user:%s dropped\n", __func__, __LINE__, type, param ? (char *)param : "NULL");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
printf("%s:%d unknown type:%d\n", __func__, __LINE__, type);
|
||||
printf("%s:%d unknown notify type:%d\n", __func__, __LINE__, type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -202,6 +209,7 @@ int main(int argc, char *argv[]) {
|
|||
createUsers(taos, argv[1], qstr);
|
||||
passVerTestMulti(argv[1], qstr);
|
||||
sysInfoTest(taos, argv[1], qstr);
|
||||
userDroppedTest(taos, argv[1], qstr);
|
||||
|
||||
taos_close(taos);
|
||||
taos_cleanup();
|
||||
|
@ -223,9 +231,9 @@ void createUsers(TAOS *taos, const char *host, char *qstr) {
|
|||
int code = taos_set_notify_cb(taosu[i], __taos_notify_cb, users[i], TAOS_NOTIFY_PASSVER);
|
||||
|
||||
if (code != 0) {
|
||||
fprintf(stderr, "failed to run: taos_set_notify_cb for user:%s since %d\n", users[i], code);
|
||||
fprintf(stderr, "failed to run: taos_set_notify_cb(TAOS_NOTIFY_PASSVER) for user:%s since %d\n", users[i], code);
|
||||
} else {
|
||||
fprintf(stderr, "success to run: taos_set_notify_cb for user:%s\n", users[i]);
|
||||
fprintf(stderr, "success to run: taos_set_notify_cb(TAOS_NOTIFY_PASSVER) for user:%s\n", users[i]);
|
||||
}
|
||||
|
||||
// alter pass for users
|
||||
|
@ -290,17 +298,19 @@ void passVerTestMulti(const char *host, char *qstr) {
|
|||
}
|
||||
|
||||
fprintf(stderr, "######## %s #########\n", __func__);
|
||||
if (nPassVerNotified >= nConn) {
|
||||
fprintf(stderr, ">>> succeed to get passVer notification since nNotify %d >= nConn %d\n", nPassVerNotified,
|
||||
if (nPassVerNotified == nConn) {
|
||||
fprintf(stderr, ">>> succeed to get passVer notification since nNotify %d == nConn %d\n", nPassVerNotified,
|
||||
nConn);
|
||||
} else {
|
||||
fprintf(stderr, ">>> failed to get passVer notification since nNotify %d < nConn %d\n", nPassVerNotified, nConn);
|
||||
fprintf(stderr, ">>> failed to get passVer notification since nNotify %d != nConn %d\n", nPassVerNotified, nConn);
|
||||
exit(1);
|
||||
}
|
||||
fprintf(stderr, "######## %s #########\n", __func__);
|
||||
// sleep(300);
|
||||
}
|
||||
|
||||
void sysInfoTest(TAOS *taosRoot, const char *host, char *qstr) {
|
||||
fprintf(stderr, "######## %s entry #########\n", __func__);
|
||||
TAOS *taos[nRoot] = {0};
|
||||
char userName[USER_LEN] = "user0";
|
||||
|
||||
|
@ -377,3 +387,55 @@ _REP:
|
|||
fprintf(stderr, ">>> succeed to run sysInfoTest\n");
|
||||
fprintf(stderr, "######## %s #########\n", __func__);
|
||||
}
|
||||
|
||||
void userDroppedTest(TAOS *taos, const char *host, char *qstr) {
|
||||
// users
|
||||
int nTestUsers = nUser;
|
||||
for (int i = 0; i < nTestUsers; ++i) {
|
||||
// sprintf(users[i], "user%d", i);
|
||||
taosu[i] = taos_connect(host, users[i], "taos", NULL, 0);
|
||||
if (taosu[i] == NULL) {
|
||||
printf("failed to connect to server, user:%s, reason:%s\n", users[i], "null taos" /*taos_errstr(taos)*/);
|
||||
exit(1);
|
||||
}
|
||||
int code = taos_set_notify_cb(taosu[i], __taos_notify_cb, users[i], TAOS_NOTIFY_USER_DROPPED);
|
||||
if (code != 0) {
|
||||
fprintf(stderr, "failed to run: taos_set_notify_cb:%d for user:%s since %d\n", TAOS_NOTIFY_USER_DROPPED, users[i],
|
||||
code);
|
||||
} else {
|
||||
fprintf(stderr, "success to run: taos_set_notify_cb:%d for user:%s\n", TAOS_NOTIFY_USER_DROPPED, users[i]);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < nTestUsers; ++i) {
|
||||
// drop user0 ... user${nUser}
|
||||
sprintf(qstr, "drop user %s", users[i]);
|
||||
queryDB(taos, qstr);
|
||||
}
|
||||
|
||||
// calculate the nUserDropped for users
|
||||
int nConn = nTestUsers;
|
||||
|
||||
for (int i = 0; i < 15; ++i) {
|
||||
printf("%s:%d [%d] second(s) elasped, user dropped notification received:%d, total:%d\n", __func__, __LINE__, i,
|
||||
nUserDropped, nConn);
|
||||
if (nUserDropped >= nConn) break;
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
for (int i = 0; i < nTestUsers; ++i) {
|
||||
taos_close(taosu[i]);
|
||||
printf("%s:%d close taosu[%d]\n", __func__, __LINE__, i);
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
fprintf(stderr, "######## %s #########\n", __func__);
|
||||
if (nUserDropped == nConn) {
|
||||
fprintf(stderr, ">>> succeed to get user dropped notification since nNotify %d == nConn %d\n", nUserDropped, nConn);
|
||||
} else {
|
||||
fprintf(stderr, ">>> failed to get user dropped notification since nNotify %d != nConn %d\n", nUserDropped, nConn);
|
||||
exit(1);
|
||||
}
|
||||
fprintf(stderr, "######## %s #########\n", __func__);
|
||||
// sleep(300);
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
system sh/stop_dnodes.sh
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sql connect
|
||||
|
||||
sql drop database if exists db1;
|
||||
sql create database db1 vgroups 3;
|
||||
sql create database db1;
|
||||
sql use db1;
|
||||
sql create stable sta (ts timestamp, f1 int, f2 binary(200)) tags(t1 int, t2 int, t3 int);
|
||||
sql create stable stb (ts timestamp, f1 int, f2 binary(200)) tags(t1 int, t2 int, t3 int);
|
||||
sql create table tba1 using sta tags(1, 1, 1);
|
||||
sql create table tba2 using sta tags(2, 2, 2);
|
||||
sql create table tba3 using sta tags(3, 3, 3);
|
||||
sql create table tba4 using sta tags(3, 3, 3);
|
||||
sql create table tba5 using sta tags(3, 3, 3);
|
||||
sql create table tba6 using sta tags(3, 3, 3);
|
||||
sql create table tba7 using sta tags(3, 3, 3);
|
||||
sql create table tba8 using sta tags(3, 3, 3);
|
||||
sql create table tbb1 using stb tags(4, 4, 4);
|
||||
sql create table tbb2 using stb tags(5, 5, 5);
|
||||
sql create table tbb3 using stb tags(6, 6, 6);
|
||||
sql create table tbb4 using stb tags(4, 4, 4);
|
||||
sql create table tbb5 using stb tags(5, 5, 5);
|
||||
sql create table tbb6 using stb tags(6, 6, 6);
|
||||
sql create table tbb7 using stb tags(7, 7, 7);
|
||||
sql create table tbb8 using stb tags(8, 8, 8);
|
||||
sql create table tbn1 (ts timestamp, f1 int);
|
||||
sql create database db2 vgroups 3;
|
||||
sql create database db2;
|
||||
sql use db2;
|
||||
sql create stable sta (ts timestamp, f1 int, f2 binary(200)) tags(t1 int, t2 int, t3 int);
|
||||
sql create stable stb (ts timestamp, f1 int, f2 binary(200)) tags(t1 int, t2 int, t3 int);
|
||||
sql create table tba1 using sta tags(1, 1, 1);
|
||||
sql create table tba2 using sta tags(2, 2, 2);
|
||||
sql create table tbb1 using stb tags(4, 4, 4);
|
||||
sql create table tbb2 using stb tags(5, 5, 5);
|
||||
sql create table tbb3 using stb tags(6, 6, 6);
|
||||
|
||||
sql show user databases;
|
||||
print $rows
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql show system databases;
|
||||
print $rows
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql show databases;
|
||||
print $rows
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql use db1
|
||||
|
||||
sql show tables
|
||||
print $rows
|
||||
if $rows != 17 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql show normal tables;
|
||||
print $rows
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
print $data00
|
||||
if $data00 != @tbn1@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql show child tables;
|
||||
print $rows
|
||||
if $rows != 16 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql show db2.tables;
|
||||
print $rows
|
||||
if $rows != 5 then
|
||||
return -1
|
||||
endi
|
||||
sql show normal db2.tables
|
||||
print $rows
|
||||
if $rows != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql show child db2.tables
|
||||
print $rows
|
||||
if $rows != 5 then
|
||||
return -1
|
||||
endi
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
Loading…
Reference in New Issue