feat: sql command 'show vnodes' and database option 'sst_trigger'
This commit is contained in:
parent
c06503d865
commit
594e4b376e
|
@ -784,6 +784,7 @@ typedef struct {
|
||||||
int64_t walRetentionSize;
|
int64_t walRetentionSize;
|
||||||
int32_t walRollPeriod;
|
int32_t walRollPeriod;
|
||||||
int64_t walSegmentSize;
|
int64_t walSegmentSize;
|
||||||
|
int32_t sstTrigger;
|
||||||
} SCreateDbReq;
|
} SCreateDbReq;
|
||||||
|
|
||||||
int32_t tSerializeSCreateDbReq(void* buf, int32_t bufLen, SCreateDbReq* pReq);
|
int32_t tSerializeSCreateDbReq(void* buf, int32_t bufLen, SCreateDbReq* pReq);
|
||||||
|
@ -805,6 +806,7 @@ typedef struct {
|
||||||
int8_t strict;
|
int8_t strict;
|
||||||
int8_t cacheLast;
|
int8_t cacheLast;
|
||||||
int8_t replications;
|
int8_t replications;
|
||||||
|
int32_t sstTrigger;
|
||||||
} SAlterDbReq;
|
} SAlterDbReq;
|
||||||
|
|
||||||
int32_t tSerializeSAlterDbReq(void* buf, int32_t bufLen, SAlterDbReq* pReq);
|
int32_t tSerializeSAlterDbReq(void* buf, int32_t bufLen, SAlterDbReq* pReq);
|
||||||
|
@ -2069,9 +2071,9 @@ int32_t tDeserializeSVCreateTbBatchRsp(void* buf, int32_t bufLen, SVCreateTbBatc
|
||||||
|
|
||||||
// TDMT_VND_DROP_TABLE =================
|
// TDMT_VND_DROP_TABLE =================
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char* name;
|
char* name;
|
||||||
uint64_t suid; // for tmq in wal format
|
uint64_t suid; // for tmq in wal format
|
||||||
int8_t igNotExists;
|
int8_t igNotExists;
|
||||||
} SVDropTbReq;
|
} SVDropTbReq;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -102,224 +102,225 @@
|
||||||
#define TK_WAL_RETENTION_SIZE 84
|
#define TK_WAL_RETENTION_SIZE 84
|
||||||
#define TK_WAL_ROLL_PERIOD 85
|
#define TK_WAL_ROLL_PERIOD 85
|
||||||
#define TK_WAL_SEGMENT_SIZE 86
|
#define TK_WAL_SEGMENT_SIZE 86
|
||||||
#define TK_NK_COLON 87
|
#define TK_SST_TRIGGER 87
|
||||||
#define TK_TABLE 88
|
#define TK_NK_COLON 88
|
||||||
#define TK_NK_LP 89
|
#define TK_TABLE 89
|
||||||
#define TK_NK_RP 90
|
#define TK_NK_LP 90
|
||||||
#define TK_STABLE 91
|
#define TK_NK_RP 91
|
||||||
#define TK_ADD 92
|
#define TK_STABLE 92
|
||||||
#define TK_COLUMN 93
|
#define TK_ADD 93
|
||||||
#define TK_MODIFY 94
|
#define TK_COLUMN 94
|
||||||
#define TK_RENAME 95
|
#define TK_MODIFY 95
|
||||||
#define TK_TAG 96
|
#define TK_RENAME 96
|
||||||
#define TK_SET 97
|
#define TK_TAG 97
|
||||||
#define TK_NK_EQ 98
|
#define TK_SET 98
|
||||||
#define TK_USING 99
|
#define TK_NK_EQ 99
|
||||||
#define TK_TAGS 100
|
#define TK_USING 100
|
||||||
#define TK_COMMENT 101
|
#define TK_TAGS 101
|
||||||
#define TK_BOOL 102
|
#define TK_COMMENT 102
|
||||||
#define TK_TINYINT 103
|
#define TK_BOOL 103
|
||||||
#define TK_SMALLINT 104
|
#define TK_TINYINT 104
|
||||||
#define TK_INT 105
|
#define TK_SMALLINT 105
|
||||||
#define TK_INTEGER 106
|
#define TK_INT 106
|
||||||
#define TK_BIGINT 107
|
#define TK_INTEGER 107
|
||||||
#define TK_FLOAT 108
|
#define TK_BIGINT 108
|
||||||
#define TK_DOUBLE 109
|
#define TK_FLOAT 109
|
||||||
#define TK_BINARY 110
|
#define TK_DOUBLE 110
|
||||||
#define TK_TIMESTAMP 111
|
#define TK_BINARY 111
|
||||||
#define TK_NCHAR 112
|
#define TK_TIMESTAMP 112
|
||||||
#define TK_UNSIGNED 113
|
#define TK_NCHAR 113
|
||||||
#define TK_JSON 114
|
#define TK_UNSIGNED 114
|
||||||
#define TK_VARCHAR 115
|
#define TK_JSON 115
|
||||||
#define TK_MEDIUMBLOB 116
|
#define TK_VARCHAR 116
|
||||||
#define TK_BLOB 117
|
#define TK_MEDIUMBLOB 117
|
||||||
#define TK_VARBINARY 118
|
#define TK_BLOB 118
|
||||||
#define TK_DECIMAL 119
|
#define TK_VARBINARY 119
|
||||||
#define TK_MAX_DELAY 120
|
#define TK_DECIMAL 120
|
||||||
#define TK_WATERMARK 121
|
#define TK_MAX_DELAY 121
|
||||||
#define TK_ROLLUP 122
|
#define TK_WATERMARK 122
|
||||||
#define TK_TTL 123
|
#define TK_ROLLUP 123
|
||||||
#define TK_SMA 124
|
#define TK_TTL 124
|
||||||
#define TK_FIRST 125
|
#define TK_SMA 125
|
||||||
#define TK_LAST 126
|
#define TK_FIRST 126
|
||||||
#define TK_SHOW 127
|
#define TK_LAST 127
|
||||||
#define TK_DATABASES 128
|
#define TK_SHOW 128
|
||||||
#define TK_TABLES 129
|
#define TK_DATABASES 129
|
||||||
#define TK_STABLES 130
|
#define TK_TABLES 130
|
||||||
#define TK_MNODES 131
|
#define TK_STABLES 131
|
||||||
#define TK_MODULES 132
|
#define TK_MNODES 132
|
||||||
#define TK_QNODES 133
|
#define TK_MODULES 133
|
||||||
#define TK_FUNCTIONS 134
|
#define TK_QNODES 134
|
||||||
#define TK_INDEXES 135
|
#define TK_FUNCTIONS 135
|
||||||
#define TK_ACCOUNTS 136
|
#define TK_INDEXES 136
|
||||||
#define TK_APPS 137
|
#define TK_ACCOUNTS 137
|
||||||
#define TK_CONNECTIONS 138
|
#define TK_APPS 138
|
||||||
#define TK_LICENCES 139
|
#define TK_CONNECTIONS 139
|
||||||
#define TK_GRANTS 140
|
#define TK_LICENCES 140
|
||||||
#define TK_QUERIES 141
|
#define TK_GRANTS 141
|
||||||
#define TK_SCORES 142
|
#define TK_QUERIES 142
|
||||||
#define TK_TOPICS 143
|
#define TK_SCORES 143
|
||||||
#define TK_VARIABLES 144
|
#define TK_TOPICS 144
|
||||||
#define TK_BNODES 145
|
#define TK_VARIABLES 145
|
||||||
#define TK_SNODES 146
|
#define TK_BNODES 146
|
||||||
#define TK_CLUSTER 147
|
#define TK_SNODES 147
|
||||||
#define TK_TRANSACTIONS 148
|
#define TK_CLUSTER 148
|
||||||
#define TK_DISTRIBUTED 149
|
#define TK_TRANSACTIONS 149
|
||||||
#define TK_CONSUMERS 150
|
#define TK_DISTRIBUTED 150
|
||||||
#define TK_SUBSCRIPTIONS 151
|
#define TK_CONSUMERS 151
|
||||||
#define TK_LIKE 152
|
#define TK_SUBSCRIPTIONS 152
|
||||||
#define TK_INDEX 153
|
#define TK_VNODES 153
|
||||||
#define TK_FUNCTION 154
|
#define TK_LIKE 154
|
||||||
#define TK_INTERVAL 155
|
#define TK_INDEX 155
|
||||||
#define TK_TOPIC 156
|
#define TK_FUNCTION 156
|
||||||
#define TK_AS 157
|
#define TK_INTERVAL 157
|
||||||
#define TK_WITH 158
|
#define TK_TOPIC 158
|
||||||
#define TK_META 159
|
#define TK_AS 159
|
||||||
#define TK_CONSUMER 160
|
#define TK_WITH 160
|
||||||
#define TK_GROUP 161
|
#define TK_META 161
|
||||||
#define TK_DESC 162
|
#define TK_CONSUMER 162
|
||||||
#define TK_DESCRIBE 163
|
#define TK_GROUP 163
|
||||||
#define TK_RESET 164
|
#define TK_DESC 164
|
||||||
#define TK_QUERY 165
|
#define TK_DESCRIBE 165
|
||||||
#define TK_CACHE 166
|
#define TK_RESET 166
|
||||||
#define TK_EXPLAIN 167
|
#define TK_QUERY 167
|
||||||
#define TK_ANALYZE 168
|
#define TK_CACHE 168
|
||||||
#define TK_VERBOSE 169
|
#define TK_EXPLAIN 169
|
||||||
#define TK_NK_BOOL 170
|
#define TK_ANALYZE 170
|
||||||
#define TK_RATIO 171
|
#define TK_VERBOSE 171
|
||||||
#define TK_NK_FLOAT 172
|
#define TK_NK_BOOL 172
|
||||||
#define TK_OUTPUTTYPE 173
|
#define TK_RATIO 173
|
||||||
#define TK_AGGREGATE 174
|
#define TK_NK_FLOAT 174
|
||||||
#define TK_BUFSIZE 175
|
#define TK_OUTPUTTYPE 175
|
||||||
#define TK_STREAM 176
|
#define TK_AGGREGATE 176
|
||||||
#define TK_INTO 177
|
#define TK_BUFSIZE 177
|
||||||
#define TK_TRIGGER 178
|
#define TK_STREAM 178
|
||||||
#define TK_AT_ONCE 179
|
#define TK_INTO 179
|
||||||
#define TK_WINDOW_CLOSE 180
|
#define TK_TRIGGER 180
|
||||||
#define TK_IGNORE 181
|
#define TK_AT_ONCE 181
|
||||||
#define TK_EXPIRED 182
|
#define TK_WINDOW_CLOSE 182
|
||||||
#define TK_KILL 183
|
#define TK_IGNORE 183
|
||||||
#define TK_CONNECTION 184
|
#define TK_EXPIRED 184
|
||||||
#define TK_TRANSACTION 185
|
#define TK_KILL 185
|
||||||
#define TK_BALANCE 186
|
#define TK_CONNECTION 186
|
||||||
#define TK_VGROUP 187
|
#define TK_TRANSACTION 187
|
||||||
#define TK_MERGE 188
|
#define TK_BALANCE 188
|
||||||
#define TK_REDISTRIBUTE 189
|
#define TK_VGROUP 189
|
||||||
#define TK_SPLIT 190
|
#define TK_MERGE 190
|
||||||
#define TK_DELETE 191
|
#define TK_REDISTRIBUTE 191
|
||||||
#define TK_INSERT 192
|
#define TK_SPLIT 192
|
||||||
#define TK_NULL 193
|
#define TK_DELETE 193
|
||||||
#define TK_NK_QUESTION 194
|
#define TK_INSERT 194
|
||||||
#define TK_NK_ARROW 195
|
#define TK_NULL 195
|
||||||
#define TK_ROWTS 196
|
#define TK_NK_QUESTION 196
|
||||||
#define TK_TBNAME 197
|
#define TK_NK_ARROW 197
|
||||||
#define TK_QSTART 198
|
#define TK_ROWTS 198
|
||||||
#define TK_QEND 199
|
#define TK_TBNAME 199
|
||||||
#define TK_QDURATION 200
|
#define TK_QSTART 200
|
||||||
#define TK_WSTART 201
|
#define TK_QEND 201
|
||||||
#define TK_WEND 202
|
#define TK_QDURATION 202
|
||||||
#define TK_WDURATION 203
|
#define TK_WSTART 203
|
||||||
#define TK_CAST 204
|
#define TK_WEND 204
|
||||||
#define TK_NOW 205
|
#define TK_WDURATION 205
|
||||||
#define TK_TODAY 206
|
#define TK_CAST 206
|
||||||
#define TK_TIMEZONE 207
|
#define TK_NOW 207
|
||||||
#define TK_CLIENT_VERSION 208
|
#define TK_TODAY 208
|
||||||
#define TK_SERVER_VERSION 209
|
#define TK_TIMEZONE 209
|
||||||
#define TK_SERVER_STATUS 210
|
#define TK_CLIENT_VERSION 210
|
||||||
#define TK_CURRENT_USER 211
|
#define TK_SERVER_VERSION 211
|
||||||
#define TK_COUNT 212
|
#define TK_SERVER_STATUS 212
|
||||||
#define TK_LAST_ROW 213
|
#define TK_CURRENT_USER 213
|
||||||
#define TK_BETWEEN 214
|
#define TK_COUNT 214
|
||||||
#define TK_IS 215
|
#define TK_LAST_ROW 215
|
||||||
#define TK_NK_LT 216
|
#define TK_BETWEEN 216
|
||||||
#define TK_NK_GT 217
|
#define TK_IS 217
|
||||||
#define TK_NK_LE 218
|
#define TK_NK_LT 218
|
||||||
#define TK_NK_GE 219
|
#define TK_NK_GT 219
|
||||||
#define TK_NK_NE 220
|
#define TK_NK_LE 220
|
||||||
#define TK_MATCH 221
|
#define TK_NK_GE 221
|
||||||
#define TK_NMATCH 222
|
#define TK_NK_NE 222
|
||||||
#define TK_CONTAINS 223
|
#define TK_MATCH 223
|
||||||
#define TK_IN 224
|
#define TK_NMATCH 224
|
||||||
#define TK_JOIN 225
|
#define TK_CONTAINS 225
|
||||||
#define TK_INNER 226
|
#define TK_IN 226
|
||||||
#define TK_SELECT 227
|
#define TK_JOIN 227
|
||||||
#define TK_DISTINCT 228
|
#define TK_INNER 228
|
||||||
#define TK_WHERE 229
|
#define TK_SELECT 229
|
||||||
#define TK_PARTITION 230
|
#define TK_DISTINCT 230
|
||||||
#define TK_BY 231
|
#define TK_WHERE 231
|
||||||
#define TK_SESSION 232
|
#define TK_PARTITION 232
|
||||||
#define TK_STATE_WINDOW 233
|
#define TK_BY 233
|
||||||
#define TK_SLIDING 234
|
#define TK_SESSION 234
|
||||||
#define TK_FILL 235
|
#define TK_STATE_WINDOW 235
|
||||||
#define TK_VALUE 236
|
#define TK_SLIDING 236
|
||||||
#define TK_NONE 237
|
#define TK_FILL 237
|
||||||
#define TK_PREV 238
|
#define TK_VALUE 238
|
||||||
#define TK_LINEAR 239
|
#define TK_NONE 239
|
||||||
#define TK_NEXT 240
|
#define TK_PREV 240
|
||||||
#define TK_HAVING 241
|
#define TK_LINEAR 241
|
||||||
#define TK_RANGE 242
|
#define TK_NEXT 242
|
||||||
#define TK_EVERY 243
|
#define TK_HAVING 243
|
||||||
#define TK_ORDER 244
|
#define TK_RANGE 244
|
||||||
#define TK_SLIMIT 245
|
#define TK_EVERY 245
|
||||||
#define TK_SOFFSET 246
|
#define TK_ORDER 246
|
||||||
#define TK_LIMIT 247
|
#define TK_SLIMIT 247
|
||||||
#define TK_OFFSET 248
|
#define TK_SOFFSET 248
|
||||||
#define TK_ASC 249
|
#define TK_LIMIT 249
|
||||||
#define TK_NULLS 250
|
#define TK_OFFSET 250
|
||||||
#define TK_ABORT 251
|
#define TK_ASC 251
|
||||||
#define TK_AFTER 252
|
#define TK_NULLS 252
|
||||||
#define TK_ATTACH 253
|
#define TK_ABORT 253
|
||||||
#define TK_BEFORE 254
|
#define TK_AFTER 254
|
||||||
#define TK_BEGIN 255
|
#define TK_ATTACH 255
|
||||||
#define TK_BITAND 256
|
#define TK_BEFORE 256
|
||||||
#define TK_BITNOT 257
|
#define TK_BEGIN 257
|
||||||
#define TK_BITOR 258
|
#define TK_BITAND 258
|
||||||
#define TK_BLOCKS 259
|
#define TK_BITNOT 259
|
||||||
#define TK_CHANGE 260
|
#define TK_BITOR 260
|
||||||
#define TK_COMMA 261
|
#define TK_BLOCKS 261
|
||||||
#define TK_COMPACT 262
|
#define TK_CHANGE 262
|
||||||
#define TK_CONCAT 263
|
#define TK_COMMA 263
|
||||||
#define TK_CONFLICT 264
|
#define TK_COMPACT 264
|
||||||
#define TK_COPY 265
|
#define TK_CONCAT 265
|
||||||
#define TK_DEFERRED 266
|
#define TK_CONFLICT 266
|
||||||
#define TK_DELIMITERS 267
|
#define TK_COPY 267
|
||||||
#define TK_DETACH 268
|
#define TK_DEFERRED 268
|
||||||
#define TK_DIVIDE 269
|
#define TK_DELIMITERS 269
|
||||||
#define TK_DOT 270
|
#define TK_DETACH 270
|
||||||
#define TK_EACH 271
|
#define TK_DIVIDE 271
|
||||||
#define TK_END 272
|
#define TK_DOT 272
|
||||||
#define TK_FAIL 273
|
#define TK_EACH 273
|
||||||
#define TK_FILE 274
|
#define TK_END 274
|
||||||
#define TK_FOR 275
|
#define TK_FAIL 275
|
||||||
#define TK_GLOB 276
|
#define TK_FILE 276
|
||||||
#define TK_ID 277
|
#define TK_FOR 277
|
||||||
#define TK_IMMEDIATE 278
|
#define TK_GLOB 278
|
||||||
#define TK_IMPORT 279
|
#define TK_ID 279
|
||||||
#define TK_INITIALLY 280
|
#define TK_IMMEDIATE 280
|
||||||
#define TK_INSTEAD 281
|
#define TK_IMPORT 281
|
||||||
#define TK_ISNULL 282
|
#define TK_INITIALLY 282
|
||||||
#define TK_KEY 283
|
#define TK_INSTEAD 283
|
||||||
#define TK_NK_BITNOT 284
|
#define TK_ISNULL 284
|
||||||
#define TK_NK_SEMI 285
|
#define TK_KEY 285
|
||||||
#define TK_NOTNULL 286
|
#define TK_NK_BITNOT 286
|
||||||
#define TK_OF 287
|
#define TK_NK_SEMI 287
|
||||||
#define TK_PLUS 288
|
#define TK_NOTNULL 288
|
||||||
#define TK_PRIVILEGE 289
|
#define TK_OF 289
|
||||||
#define TK_RAISE 290
|
#define TK_PLUS 290
|
||||||
#define TK_REPLACE 291
|
#define TK_PRIVILEGE 291
|
||||||
#define TK_RESTRICT 292
|
#define TK_RAISE 292
|
||||||
#define TK_ROW 293
|
#define TK_REPLACE 293
|
||||||
#define TK_SEMI 294
|
#define TK_RESTRICT 294
|
||||||
#define TK_STAR 295
|
#define TK_ROW 295
|
||||||
#define TK_STATEMENT 296
|
#define TK_SEMI 296
|
||||||
#define TK_STRING 297
|
#define TK_STAR 297
|
||||||
#define TK_TIMES 298
|
#define TK_STATEMENT 298
|
||||||
#define TK_UPDATE 299
|
#define TK_STRING 299
|
||||||
#define TK_VALUES 300
|
#define TK_TIMES 300
|
||||||
#define TK_VARIABLE 301
|
#define TK_UPDATE 301
|
||||||
#define TK_VIEW 302
|
#define TK_VALUES 302
|
||||||
#define TK_VNODES 303
|
#define TK_VARIABLE 303
|
||||||
#define TK_WAL 304
|
#define TK_VIEW 304
|
||||||
|
#define TK_WAL 305
|
||||||
|
|
||||||
#define TK_NK_SPACE 300
|
#define TK_NK_SPACE 300
|
||||||
#define TK_NK_COMMENT 301
|
#define TK_NK_COMMENT 301
|
||||||
|
|
|
@ -81,6 +81,7 @@ typedef struct SDatabaseOptions {
|
||||||
bool walRetentionPeriodIsSet;
|
bool walRetentionPeriodIsSet;
|
||||||
bool walRetentionSizeIsSet;
|
bool walRetentionSizeIsSet;
|
||||||
bool walRollPeriodIsSet;
|
bool walRollPeriodIsSet;
|
||||||
|
int32_t sstTrigger;
|
||||||
} SDatabaseOptions;
|
} SDatabaseOptions;
|
||||||
|
|
||||||
typedef struct SCreateDatabaseStmt {
|
typedef struct SCreateDatabaseStmt {
|
||||||
|
@ -271,6 +272,12 @@ typedef struct SShowDnodeVariablesStmt {
|
||||||
SNode* pDnodeId;
|
SNode* pDnodeId;
|
||||||
} SShowDnodeVariablesStmt;
|
} SShowDnodeVariablesStmt;
|
||||||
|
|
||||||
|
typedef struct SShowVnodesStmt {
|
||||||
|
ENodeType type;
|
||||||
|
SNode* pDnodeId;
|
||||||
|
SNode* pDnodeEndpoint;
|
||||||
|
} SShowVnodesStmt;
|
||||||
|
|
||||||
typedef enum EIndexType { INDEX_TYPE_SMA = 1, INDEX_TYPE_FULLTEXT } EIndexType;
|
typedef enum EIndexType { INDEX_TYPE_SMA = 1, INDEX_TYPE_FULLTEXT } EIndexType;
|
||||||
|
|
||||||
typedef struct SIndexOptions {
|
typedef struct SIndexOptions {
|
||||||
|
|
|
@ -183,12 +183,12 @@ typedef enum ENodeType {
|
||||||
QUERY_NODE_SHOW_DNODE_VARIABLES_STMT,
|
QUERY_NODE_SHOW_DNODE_VARIABLES_STMT,
|
||||||
QUERY_NODE_SHOW_TRANSACTIONS_STMT,
|
QUERY_NODE_SHOW_TRANSACTIONS_STMT,
|
||||||
QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT,
|
QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT,
|
||||||
|
QUERY_NODE_SHOW_VNODES_STMT,
|
||||||
QUERY_NODE_SHOW_CREATE_DATABASE_STMT,
|
QUERY_NODE_SHOW_CREATE_DATABASE_STMT,
|
||||||
QUERY_NODE_SHOW_CREATE_TABLE_STMT,
|
QUERY_NODE_SHOW_CREATE_TABLE_STMT,
|
||||||
QUERY_NODE_SHOW_CREATE_STABLE_STMT,
|
QUERY_NODE_SHOW_CREATE_STABLE_STMT,
|
||||||
QUERY_NODE_SHOW_TABLE_DISTRIBUTED_STMT,
|
QUERY_NODE_SHOW_TABLE_DISTRIBUTED_STMT,
|
||||||
QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT,
|
QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT,
|
||||||
QUERY_NODE_SHOW_VNODES_STMT,
|
|
||||||
QUERY_NODE_SHOW_SCORES_STMT,
|
QUERY_NODE_SHOW_SCORES_STMT,
|
||||||
QUERY_NODE_KILL_CONNECTION_STMT,
|
QUERY_NODE_KILL_CONNECTION_STMT,
|
||||||
QUERY_NODE_KILL_QUERY_STMT,
|
QUERY_NODE_KILL_QUERY_STMT,
|
||||||
|
|
|
@ -359,6 +359,9 @@ typedef enum ELogicConditionType {
|
||||||
#define TSDB_DB_SCHEMALESS_ON 1
|
#define TSDB_DB_SCHEMALESS_ON 1
|
||||||
#define TSDB_DB_SCHEMALESS_OFF 0
|
#define TSDB_DB_SCHEMALESS_OFF 0
|
||||||
#define TSDB_DEFAULT_DB_SCHEMALESS TSDB_DB_SCHEMALESS_OFF
|
#define TSDB_DEFAULT_DB_SCHEMALESS TSDB_DB_SCHEMALESS_OFF
|
||||||
|
#define TSDB_MIN_SST_TRIGGER 1
|
||||||
|
#define TSDB_MAX_SST_TRIGGER 128
|
||||||
|
#define TSDB_DEFAULT_SST_TRIGGER 8
|
||||||
|
|
||||||
#define TSDB_DB_MIN_WAL_RETENTION_PERIOD -1
|
#define TSDB_DB_MIN_WAL_RETENTION_PERIOD -1
|
||||||
#define TSDB_REP_DEF_DB_WAL_RET_PERIOD 0
|
#define TSDB_REP_DEF_DB_WAL_RET_PERIOD 0
|
||||||
|
|
|
@ -256,6 +256,13 @@ static const SSysDbTableSchema subscriptionSchema[] = {
|
||||||
{.name = "consumer_id", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = false},
|
{.name = "consumer_id", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = false},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const SSysDbTableSchema vnodesSchema[] = {
|
||||||
|
{.name = "dnode_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
|
||||||
|
{.name = "dnode_endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
||||||
|
{.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
|
||||||
|
{.name = "status", .bytes = 20 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = true},
|
||||||
|
};
|
||||||
|
|
||||||
static const SSysTableMeta infosMeta[] = {
|
static const SSysTableMeta infosMeta[] = {
|
||||||
{TSDB_INS_TABLE_DNODES, dnodesSchema, tListLen(dnodesSchema), true},
|
{TSDB_INS_TABLE_DNODES, dnodesSchema, tListLen(dnodesSchema), true},
|
||||||
{TSDB_INS_TABLE_MNODES, mnodesSchema, tListLen(mnodesSchema), true},
|
{TSDB_INS_TABLE_MNODES, mnodesSchema, tListLen(mnodesSchema), true},
|
||||||
|
@ -279,6 +286,7 @@ static const SSysTableMeta infosMeta[] = {
|
||||||
{TSDB_INS_TABLE_TOPICS, topicSchema, tListLen(topicSchema), false},
|
{TSDB_INS_TABLE_TOPICS, topicSchema, tListLen(topicSchema), false},
|
||||||
{TSDB_INS_TABLE_SUBSCRIPTIONS, subscriptionSchema, tListLen(subscriptionSchema), false},
|
{TSDB_INS_TABLE_SUBSCRIPTIONS, subscriptionSchema, tListLen(subscriptionSchema), false},
|
||||||
{TSDB_INS_TABLE_STREAMS, streamSchema, tListLen(streamSchema), false},
|
{TSDB_INS_TABLE_STREAMS, streamSchema, tListLen(streamSchema), false},
|
||||||
|
{TSDB_INS_TABLE_VNODES, vnodesSchema, tListLen(vnodesSchema), true},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const SSysDbTableSchema connectionsSchema[] = {
|
static const SSysDbTableSchema connectionsSchema[] = {
|
||||||
|
|
|
@ -2024,6 +2024,7 @@ int32_t tSerializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq) {
|
||||||
if (tEncodeI64(&encoder, pReq->walRetentionSize) < 0) return -1;
|
if (tEncodeI64(&encoder, pReq->walRetentionSize) < 0) return -1;
|
||||||
if (tEncodeI32(&encoder, pReq->walRollPeriod) < 0) return -1;
|
if (tEncodeI32(&encoder, pReq->walRollPeriod) < 0) return -1;
|
||||||
if (tEncodeI64(&encoder, pReq->walSegmentSize) < 0) return -1;
|
if (tEncodeI64(&encoder, pReq->walSegmentSize) < 0) return -1;
|
||||||
|
if (tEncodeI32(&encoder, pReq->sstTrigger) < 0) return -1;
|
||||||
if (tEncodeI8(&encoder, pReq->ignoreExist) < 0) return -1;
|
if (tEncodeI8(&encoder, pReq->ignoreExist) < 0) return -1;
|
||||||
if (tEncodeI32(&encoder, pReq->numOfRetensions) < 0) return -1;
|
if (tEncodeI32(&encoder, pReq->numOfRetensions) < 0) return -1;
|
||||||
for (int32_t i = 0; i < pReq->numOfRetensions; ++i) {
|
for (int32_t i = 0; i < pReq->numOfRetensions; ++i) {
|
||||||
|
@ -2070,6 +2071,7 @@ int32_t tDeserializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq)
|
||||||
if (tDecodeI64(&decoder, &pReq->walRetentionSize) < 0) return -1;
|
if (tDecodeI64(&decoder, &pReq->walRetentionSize) < 0) return -1;
|
||||||
if (tDecodeI32(&decoder, &pReq->walRollPeriod) < 0) return -1;
|
if (tDecodeI32(&decoder, &pReq->walRollPeriod) < 0) return -1;
|
||||||
if (tDecodeI64(&decoder, &pReq->walSegmentSize) < 0) return -1;
|
if (tDecodeI64(&decoder, &pReq->walSegmentSize) < 0) return -1;
|
||||||
|
if (tDecodeI32(&decoder, &pReq->sstTrigger) < 0) return -1;
|
||||||
if (tDecodeI8(&decoder, &pReq->ignoreExist) < 0) return -1;
|
if (tDecodeI8(&decoder, &pReq->ignoreExist) < 0) return -1;
|
||||||
if (tDecodeI32(&decoder, &pReq->numOfRetensions) < 0) return -1;
|
if (tDecodeI32(&decoder, &pReq->numOfRetensions) < 0) return -1;
|
||||||
pReq->pRetensions = taosArrayInit(pReq->numOfRetensions, sizeof(SRetention));
|
pReq->pRetensions = taosArrayInit(pReq->numOfRetensions, sizeof(SRetention));
|
||||||
|
@ -2120,6 +2122,7 @@ int32_t tSerializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) {
|
||||||
if (tEncodeI8(&encoder, pReq->strict) < 0) return -1;
|
if (tEncodeI8(&encoder, pReq->strict) < 0) return -1;
|
||||||
if (tEncodeI8(&encoder, pReq->cacheLast) < 0) return -1;
|
if (tEncodeI8(&encoder, pReq->cacheLast) < 0) return -1;
|
||||||
if (tEncodeI8(&encoder, pReq->replications) < 0) return -1;
|
if (tEncodeI8(&encoder, pReq->replications) < 0) return -1;
|
||||||
|
if (tEncodeI32(&encoder, pReq->sstTrigger) < 0) return -1;
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
int32_t tlen = encoder.pos;
|
||||||
|
@ -2146,6 +2149,7 @@ int32_t tDeserializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) {
|
||||||
if (tDecodeI8(&decoder, &pReq->strict) < 0) return -1;
|
if (tDecodeI8(&decoder, &pReq->strict) < 0) return -1;
|
||||||
if (tDecodeI8(&decoder, &pReq->cacheLast) < 0) return -1;
|
if (tDecodeI8(&decoder, &pReq->cacheLast) < 0) return -1;
|
||||||
if (tDecodeI8(&decoder, &pReq->replications) < 0) return -1;
|
if (tDecodeI8(&decoder, &pReq->replications) < 0) return -1;
|
||||||
|
if (tDecodeI32(&decoder, &pReq->sstTrigger) < 0) return -1;
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
|
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
|
|
|
@ -59,7 +59,8 @@ typedef enum EDatabaseOptionType {
|
||||||
DB_OPTION_WAL_RETENTION_PERIOD,
|
DB_OPTION_WAL_RETENTION_PERIOD,
|
||||||
DB_OPTION_WAL_RETENTION_SIZE,
|
DB_OPTION_WAL_RETENTION_SIZE,
|
||||||
DB_OPTION_WAL_ROLL_PERIOD,
|
DB_OPTION_WAL_ROLL_PERIOD,
|
||||||
DB_OPTION_WAL_SEGMENT_SIZE
|
DB_OPTION_WAL_SEGMENT_SIZE,
|
||||||
|
DB_OPTION_SST_TRIGGER
|
||||||
} EDatabaseOptionType;
|
} EDatabaseOptionType;
|
||||||
|
|
||||||
typedef enum ETableOptionType {
|
typedef enum ETableOptionType {
|
||||||
|
@ -170,6 +171,7 @@ SNode* createShowCreateDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName);
|
||||||
SNode* createShowCreateTableStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pRealTable);
|
SNode* createShowCreateTableStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pRealTable);
|
||||||
SNode* createShowTableDistributedStmt(SAstCreateContext* pCxt, SNode* pRealTable);
|
SNode* createShowTableDistributedStmt(SAstCreateContext* pCxt, SNode* pRealTable);
|
||||||
SNode* createShowDnodeVariablesStmt(SAstCreateContext* pCxt, SNode* pDnodeId);
|
SNode* createShowDnodeVariablesStmt(SAstCreateContext* pCxt, SNode* pDnodeId);
|
||||||
|
SNode* createShowVnodesStmt(SAstCreateContext* pCxt, SNode* pDnodeId, SNode* pDnodeEndpoint);
|
||||||
SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword, int8_t sysinfo);
|
SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword, int8_t sysinfo);
|
||||||
SNode* createAlterUserStmt(SAstCreateContext* pCxt, SToken* pUserName, int8_t alterType, const SToken* pVal);
|
SNode* createAlterUserStmt(SAstCreateContext* pCxt, SToken* pUserName, int8_t alterType, const SToken* pVal);
|
||||||
SNode* createDropUserStmt(SAstCreateContext* pCxt, SToken* pUserName);
|
SNode* createDropUserStmt(SAstCreateContext* pCxt, SToken* pUserName);
|
||||||
|
|
|
@ -207,6 +207,7 @@ db_options(A) ::= db_options(B) WAL_RETENTION_SIZE NK_MINUS(D) NK_INTEGER(C).
|
||||||
}
|
}
|
||||||
db_options(A) ::= db_options(B) WAL_ROLL_PERIOD NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_WAL_ROLL_PERIOD, &C); }
|
db_options(A) ::= db_options(B) WAL_ROLL_PERIOD NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_WAL_ROLL_PERIOD, &C); }
|
||||||
db_options(A) ::= db_options(B) WAL_SEGMENT_SIZE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_WAL_SEGMENT_SIZE, &C); }
|
db_options(A) ::= db_options(B) WAL_SEGMENT_SIZE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_WAL_SEGMENT_SIZE, &C); }
|
||||||
|
db_options(A) ::= db_options(B) SST_TRIGGER NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_SST_TRIGGER, &C); }
|
||||||
|
|
||||||
alter_db_options(A) ::= alter_db_option(B). { A = createAlterDatabaseOptions(pCxt); A = setAlterDatabaseOption(pCxt, A, &B); }
|
alter_db_options(A) ::= alter_db_option(B). { A = createAlterDatabaseOptions(pCxt); A = setAlterDatabaseOption(pCxt, A, &B); }
|
||||||
alter_db_options(A) ::= alter_db_options(B) alter_db_option(C). { A = setAlterDatabaseOption(pCxt, B, &C); }
|
alter_db_options(A) ::= alter_db_options(B) alter_db_option(C). { A = setAlterDatabaseOption(pCxt, B, &C); }
|
||||||
|
@ -223,6 +224,7 @@ alter_db_option(A) ::= KEEP variable_list(B).
|
||||||
//alter_db_option(A) ::= REPLICA NK_INTEGER(B). { A.type = DB_OPTION_REPLICA; A.val = B; }
|
//alter_db_option(A) ::= REPLICA NK_INTEGER(B). { A.type = DB_OPTION_REPLICA; A.val = B; }
|
||||||
//alter_db_option(A) ::= STRICT NK_STRING(B). { A.type = DB_OPTION_STRICT; A.val = B; }
|
//alter_db_option(A) ::= STRICT NK_STRING(B). { A.type = DB_OPTION_STRICT; A.val = B; }
|
||||||
alter_db_option(A) ::= WAL_LEVEL NK_INTEGER(B). { A.type = DB_OPTION_WAL; A.val = B; }
|
alter_db_option(A) ::= WAL_LEVEL NK_INTEGER(B). { A.type = DB_OPTION_WAL; A.val = B; }
|
||||||
|
alter_db_option(A) ::= SST_TRIGGER NK_INTEGER(B). { A.type = DB_OPTION_SST_TRIGGER; A.val = B; }
|
||||||
|
|
||||||
%type integer_list { SNodeList* }
|
%type integer_list { SNodeList* }
|
||||||
%destructor integer_list { nodesDestroyList($$); }
|
%destructor integer_list { nodesDestroyList($$); }
|
||||||
|
@ -410,6 +412,8 @@ cmd ::= SHOW TABLE DISTRIBUTED full_table_name(A).
|
||||||
cmd ::= SHOW CONSUMERS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); }
|
cmd ::= SHOW CONSUMERS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); }
|
||||||
cmd ::= SHOW SUBSCRIPTIONS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); }
|
cmd ::= SHOW SUBSCRIPTIONS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); }
|
||||||
cmd ::= SHOW TAGS FROM table_name_cond(A) from_db_opt(B). { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, B, A, OP_TYPE_EQUAL); }
|
cmd ::= SHOW TAGS FROM table_name_cond(A) from_db_opt(B). { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, B, A, OP_TYPE_EQUAL); }
|
||||||
|
cmd ::= SHOW VNODES NK_INTEGER(A). { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &A), NULL); }
|
||||||
|
cmd ::= SHOW VNODES NK_STRING(A). { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, createValueNode(pCxt, TSDB_DATA_TYPE_VARCHAR, &A)); }
|
||||||
|
|
||||||
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); }
|
||||||
|
@ -997,4 +1001,4 @@ null_ordering_opt(A) ::= NULLS LAST.
|
||||||
|
|
||||||
%fallback ABORT AFTER ATTACH BEFORE BEGIN BITAND BITNOT BITOR BLOCKS CHANGE COMMA COMPACT CONCAT CONFLICT COPY DEFERRED DELIMITERS DETACH DIVIDE DOT EACH END FAIL
|
%fallback ABORT AFTER ATTACH BEFORE BEGIN BITAND BITNOT BITOR BLOCKS CHANGE COMMA COMPACT CONCAT CONFLICT COPY DEFERRED DELIMITERS DETACH DIVIDE DOT EACH END FAIL
|
||||||
FILE FOR GLOB ID IMMEDIATE IMPORT INITIALLY INSTEAD ISNULL KEY NK_BITNOT NK_SEMI NOTNULL OF PLUS PRIVILEGE RAISE REPLACE RESTRICT ROW SEMI STAR STATEMENT STRING
|
FILE FOR GLOB ID IMMEDIATE IMPORT INITIALLY INSTEAD ISNULL KEY NK_BITNOT NK_SEMI NOTNULL OF PLUS PRIVILEGE RAISE REPLACE RESTRICT ROW SEMI STAR STATEMENT STRING
|
||||||
TIMES UPDATE VALUES VARIABLE VIEW VNODES WAL.
|
TIMES UPDATE VALUES VARIABLE VIEW WAL.
|
||||||
|
|
|
@ -835,6 +835,7 @@ SNode* createDefaultDatabaseOptions(SAstCreateContext* pCxt) {
|
||||||
pOptions->schemaless = TSDB_DEFAULT_DB_SCHEMALESS;
|
pOptions->schemaless = TSDB_DEFAULT_DB_SCHEMALESS;
|
||||||
updateWalOptionsDefault(pOptions);
|
updateWalOptionsDefault(pOptions);
|
||||||
pOptions->walSegmentSize = TSDB_DEFAULT_DB_WAL_SEGMENT_SIZE;
|
pOptions->walSegmentSize = TSDB_DEFAULT_DB_WAL_SEGMENT_SIZE;
|
||||||
|
pOptions->sstTrigger = TSDB_DEFAULT_SST_TRIGGER;
|
||||||
return (SNode*)pOptions;
|
return (SNode*)pOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -866,6 +867,7 @@ SNode* createAlterDatabaseOptions(SAstCreateContext* pCxt) {
|
||||||
pOptions->walRetentionSize = -1;
|
pOptions->walRetentionSize = -1;
|
||||||
pOptions->walRollPeriod = -1;
|
pOptions->walRollPeriod = -1;
|
||||||
pOptions->walSegmentSize = -1;
|
pOptions->walSegmentSize = -1;
|
||||||
|
pOptions->sstTrigger = -1;
|
||||||
return (SNode*)pOptions;
|
return (SNode*)pOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -949,6 +951,9 @@ SNode* setDatabaseOption(SAstCreateContext* pCxt, SNode* pOptions, EDatabaseOpti
|
||||||
case DB_OPTION_WAL_SEGMENT_SIZE:
|
case DB_OPTION_WAL_SEGMENT_SIZE:
|
||||||
pDbOptions->walSegmentSize = taosStr2Int32(((SToken*)pVal)->z, NULL, 10);
|
pDbOptions->walSegmentSize = taosStr2Int32(((SToken*)pVal)->z, NULL, 10);
|
||||||
break;
|
break;
|
||||||
|
case DB_OPTION_SST_TRIGGER:
|
||||||
|
pDbOptions->sstTrigger = taosStr2Int32(((SToken*)pVal)->z, NULL, 10);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1333,6 +1338,15 @@ SNode* createShowDnodeVariablesStmt(SAstCreateContext* pCxt, SNode* pDnodeId) {
|
||||||
return (SNode*)pStmt;
|
return (SNode*)pStmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SNode* createShowVnodesStmt(SAstCreateContext* pCxt, SNode* pDnodeId, SNode* pDnodeEndpoint) {
|
||||||
|
CHECK_PARSER_STATUS(pCxt);
|
||||||
|
SShowVnodesStmt* pStmt = (SShowVnodesStmt*)nodesMakeNode(QUERY_NODE_SHOW_VNODES_STMT);
|
||||||
|
CHECK_OUT_OF_MEM(pStmt);
|
||||||
|
pStmt->pDnodeId = pDnodeId;
|
||||||
|
pStmt->pDnodeEndpoint = pDnodeEndpoint;
|
||||||
|
return (SNode*)pStmt;
|
||||||
|
}
|
||||||
|
|
||||||
SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword, int8_t sysinfo) {
|
SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword, int8_t sysinfo) {
|
||||||
CHECK_PARSER_STATUS(pCxt);
|
CHECK_PARSER_STATUS(pCxt);
|
||||||
char password[TSDB_USET_PASSWORD_LEN] = {0};
|
char password[TSDB_USET_PASSWORD_LEN] = {0};
|
||||||
|
|
|
@ -463,6 +463,11 @@ static int32_t collectMetaKeyFromShowDnodeVariables(SCollectMetaKeyCxt* pCxt, SS
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t collectMetaKeyFromShowVnodes(SCollectMetaKeyCxt* pCxt, SShowVnodesStmt* pStmt) {
|
||||||
|
return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_VNODES,
|
||||||
|
pCxt->pMetaCache);
|
||||||
|
}
|
||||||
|
|
||||||
static int32_t collectMetaKeyFromShowCreateDatabase(SCollectMetaKeyCxt* pCxt, SShowCreateDatabaseStmt* pStmt) {
|
static int32_t collectMetaKeyFromShowCreateDatabase(SCollectMetaKeyCxt* pCxt, SShowCreateDatabaseStmt* pStmt) {
|
||||||
return reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache);
|
return reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache);
|
||||||
}
|
}
|
||||||
|
@ -603,6 +608,8 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) {
|
||||||
return collectMetaKeyFromShowVariables(pCxt, (SShowStmt*)pStmt);
|
return collectMetaKeyFromShowVariables(pCxt, (SShowStmt*)pStmt);
|
||||||
case QUERY_NODE_SHOW_DNODE_VARIABLES_STMT:
|
case QUERY_NODE_SHOW_DNODE_VARIABLES_STMT:
|
||||||
return collectMetaKeyFromShowDnodeVariables(pCxt, (SShowDnodeVariablesStmt*)pStmt);
|
return collectMetaKeyFromShowDnodeVariables(pCxt, (SShowDnodeVariablesStmt*)pStmt);
|
||||||
|
case QUERY_NODE_SHOW_VNODES_STMT:
|
||||||
|
return collectMetaKeyFromShowVnodes(pCxt, (SShowVnodesStmt*)pStmt);
|
||||||
case QUERY_NODE_SHOW_CREATE_DATABASE_STMT:
|
case QUERY_NODE_SHOW_CREATE_DATABASE_STMT:
|
||||||
return collectMetaKeyFromShowCreateDatabase(pCxt, (SShowCreateDatabaseStmt*)pStmt);
|
return collectMetaKeyFromShowCreateDatabase(pCxt, (SShowCreateDatabaseStmt*)pStmt);
|
||||||
case QUERY_NODE_SHOW_CREATE_TABLE_STMT:
|
case QUERY_NODE_SHOW_CREATE_TABLE_STMT:
|
||||||
|
|
|
@ -187,6 +187,7 @@ static SKeyword keywordTable[] = {
|
||||||
{"SNODES", TK_SNODES},
|
{"SNODES", TK_SNODES},
|
||||||
{"SOFFSET", TK_SOFFSET},
|
{"SOFFSET", TK_SOFFSET},
|
||||||
{"SPLIT", TK_SPLIT},
|
{"SPLIT", TK_SPLIT},
|
||||||
|
{"SST_TRIGGER", TK_SST_TRIGGER},
|
||||||
{"STABLE", TK_STABLE},
|
{"STABLE", TK_STABLE},
|
||||||
{"STABLES", TK_STABLES},
|
{"STABLES", TK_STABLES},
|
||||||
{"STATE", TK_STATE},
|
{"STATE", TK_STATE},
|
||||||
|
@ -228,6 +229,7 @@ static SKeyword keywordTable[] = {
|
||||||
{"VERBOSE", TK_VERBOSE},
|
{"VERBOSE", TK_VERBOSE},
|
||||||
{"VGROUP", TK_VGROUP},
|
{"VGROUP", TK_VGROUP},
|
||||||
{"VGROUPS", TK_VGROUPS},
|
{"VGROUPS", TK_VGROUPS},
|
||||||
|
{"VNODES", TK_VNODES},
|
||||||
{"WAL_FSYNC_PERIOD", TK_WAL_FSYNC_PERIOD},
|
{"WAL_FSYNC_PERIOD", TK_WAL_FSYNC_PERIOD},
|
||||||
{"WAL_LEVEL", TK_WAL_LEVEL},
|
{"WAL_LEVEL", TK_WAL_LEVEL},
|
||||||
{"WAL_RETENTION_PERIOD", TK_WAL_RETENTION_PERIOD},
|
{"WAL_RETENTION_PERIOD", TK_WAL_RETENTION_PERIOD},
|
||||||
|
|
|
@ -245,6 +245,12 @@ static const SSysTableShowAdapter sysTableShowAdapter[] = {
|
||||||
.numOfShowCols = 1,
|
.numOfShowCols = 1,
|
||||||
.pShowCols = {"*"}
|
.pShowCols = {"*"}
|
||||||
},
|
},
|
||||||
|
{ .showType = QUERY_NODE_SHOW_VNODES_STMT,
|
||||||
|
.pDbName = TSDB_INFORMATION_SCHEMA_DB,
|
||||||
|
.pTableName = TSDB_INS_TABLE_VNODES,
|
||||||
|
.numOfShowCols = 1,
|
||||||
|
.pShowCols = {"*"}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
|
@ -3476,6 +3482,7 @@ static int32_t buildCreateDbReq(STranslateContext* pCxt, SCreateDatabaseStmt* pS
|
||||||
pReq->walRetentionSize = pStmt->pOptions->walRetentionSize;
|
pReq->walRetentionSize = pStmt->pOptions->walRetentionSize;
|
||||||
pReq->walRollPeriod = pStmt->pOptions->walRollPeriod;
|
pReq->walRollPeriod = pStmt->pOptions->walRollPeriod;
|
||||||
pReq->walSegmentSize = pStmt->pOptions->walSegmentSize;
|
pReq->walSegmentSize = pStmt->pOptions->walSegmentSize;
|
||||||
|
pReq->sstTrigger = pStmt->pOptions->sstTrigger;
|
||||||
pReq->ignoreExist = pStmt->ignoreExists;
|
pReq->ignoreExist = pStmt->ignoreExists;
|
||||||
return buildCreateDbRetentions(pStmt->pOptions->pRetentions, pReq);
|
return buildCreateDbRetentions(pStmt->pOptions->pRetentions, pReq);
|
||||||
}
|
}
|
||||||
|
@ -3760,6 +3767,9 @@ static int32_t checkDatabaseOptions(STranslateContext* pCxt, const char* pDbName
|
||||||
code =
|
code =
|
||||||
checkDbRangeOption(pCxt, "walSegmentSize", pOptions->walSegmentSize, TSDB_DB_MIN_WAL_SEGMENT_SIZE, INT32_MAX);
|
checkDbRangeOption(pCxt, "walSegmentSize", pOptions->walSegmentSize, TSDB_DB_MIN_WAL_SEGMENT_SIZE, INT32_MAX);
|
||||||
}
|
}
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
code = checkDbRangeOption(pCxt, "sstTrigger", pOptions->sstTrigger, TSDB_MIN_SST_TRIGGER, TSDB_MAX_SST_TRIGGER);
|
||||||
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = checkOptionsDependency(pCxt, pDbName, pOptions);
|
code = checkOptionsDependency(pCxt, pDbName, pOptions);
|
||||||
}
|
}
|
||||||
|
@ -3833,6 +3843,7 @@ static void buildAlterDbReq(STranslateContext* pCxt, SAlterDatabaseStmt* pStmt,
|
||||||
pReq->cacheLast = pStmt->pOptions->cacheModel;
|
pReq->cacheLast = pStmt->pOptions->cacheModel;
|
||||||
pReq->cacheLastSize = pStmt->pOptions->cacheLastSize;
|
pReq->cacheLastSize = pStmt->pOptions->cacheLastSize;
|
||||||
pReq->replications = pStmt->pOptions->replica;
|
pReq->replications = pStmt->pOptions->replica;
|
||||||
|
pReq->sstTrigger = pStmt->pOptions->sstTrigger;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5837,6 +5848,25 @@ static int32_t rewriteShowDnodeVariables(STranslateContext* pCxt, SQuery* pQuery
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t rewriteShowVnodes(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
|
SShowVnodesStmt* pShow = (SShowVnodesStmt*)(pQuery->pRoot);
|
||||||
|
SSelectStmt* pStmt = NULL;
|
||||||
|
int32_t code = createSelectStmtForShow(QUERY_NODE_SHOW_VNODES_STMT, &pStmt);
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
if (NULL != pShow->pDnodeId) {
|
||||||
|
code = createOperatorNode(OP_TYPE_EQUAL, "dnode_id", pShow->pDnodeId, &pStmt->pWhere);
|
||||||
|
} else {
|
||||||
|
code = createOperatorNode(OP_TYPE_EQUAL, "dnode_endpoint", pShow->pDnodeEndpoint, &pStmt->pWhere);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
pQuery->showRewrite = true;
|
||||||
|
nodesDestroyNode(pQuery->pRoot);
|
||||||
|
pQuery->pRoot = (SNode*)pStmt;
|
||||||
|
}
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
static SNode* createBlockDistInfoFunc() {
|
static SNode* createBlockDistInfoFunc() {
|
||||||
SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION);
|
SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION);
|
||||||
if (NULL == pFunc) {
|
if (NULL == pFunc) {
|
||||||
|
@ -6408,7 +6438,8 @@ typedef struct SVgroupDropTableBatch {
|
||||||
char dbName[TSDB_DB_NAME_LEN];
|
char dbName[TSDB_DB_NAME_LEN];
|
||||||
} SVgroupDropTableBatch;
|
} SVgroupDropTableBatch;
|
||||||
|
|
||||||
static void addDropTbReqIntoVgroup(SHashObj* pVgroupHashmap, SDropTableClause* pClause, SVgroupInfo* pVgInfo, uint64_t suid) {
|
static void addDropTbReqIntoVgroup(SHashObj* pVgroupHashmap, SDropTableClause* pClause, SVgroupInfo* pVgInfo,
|
||||||
|
uint64_t suid) {
|
||||||
SVDropTbReq req = {.name = pClause->tableName, .suid = suid, .igNotExists = pClause->ignoreNotExists};
|
SVDropTbReq req = {.name = pClause->tableName, .suid = suid, .igNotExists = pClause->ignoreNotExists};
|
||||||
SVgroupDropTableBatch* pTableBatch = taosHashGet(pVgroupHashmap, &pVgInfo->vgId, sizeof(pVgInfo->vgId));
|
SVgroupDropTableBatch* pTableBatch = taosHashGet(pVgroupHashmap, &pVgInfo->vgId, sizeof(pVgInfo->vgId));
|
||||||
if (NULL == pTableBatch) {
|
if (NULL == pTableBatch) {
|
||||||
|
@ -6946,6 +6977,9 @@ static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
case QUERY_NODE_SHOW_DNODE_VARIABLES_STMT:
|
case QUERY_NODE_SHOW_DNODE_VARIABLES_STMT:
|
||||||
code = rewriteShowDnodeVariables(pCxt, pQuery);
|
code = rewriteShowDnodeVariables(pCxt, pQuery);
|
||||||
break;
|
break;
|
||||||
|
case QUERY_NODE_SHOW_VNODES_STMT:
|
||||||
|
code = rewriteShowVnodes(pCxt, pQuery);
|
||||||
|
break;
|
||||||
case QUERY_NODE_SHOW_TABLE_DISTRIBUTED_STMT:
|
case QUERY_NODE_SHOW_TABLE_DISTRIBUTED_STMT:
|
||||||
code = rewriteShowTableDist(pCxt, pQuery);
|
code = rewriteShowTableDist(pCxt, pQuery);
|
||||||
break;
|
break;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -32,100 +32,59 @@
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void generateInformationSchema(MockCatalogService* mcs) {
|
void generateInformationSchema(MockCatalogService* mcs) {
|
||||||
{
|
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_DNODES, TSDB_SYSTEM_TABLE, 1)
|
||||||
ITableBuilder& builder =
|
.addColumn("endpoint", TSDB_DATA_TYPE_BINARY, TSDB_EP_LEN)
|
||||||
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_DNODES, TSDB_SYSTEM_TABLE, 1)
|
.done();
|
||||||
.addColumn("endpoint", TSDB_DATA_TYPE_BINARY, TSDB_EP_LEN);
|
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_MNODES, TSDB_SYSTEM_TABLE, 1)
|
||||||
builder.done();
|
.addColumn("endpoint", TSDB_DATA_TYPE_BINARY, TSDB_EP_LEN)
|
||||||
}
|
.done();
|
||||||
{
|
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_MODULES, TSDB_SYSTEM_TABLE, 1)
|
||||||
ITableBuilder& builder =
|
.addColumn("endpoint", TSDB_DATA_TYPE_BINARY, TSDB_EP_LEN)
|
||||||
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_MNODES, TSDB_SYSTEM_TABLE, 1)
|
.done();
|
||||||
.addColumn("endpoint", TSDB_DATA_TYPE_BINARY, TSDB_EP_LEN);
|
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_QNODES, TSDB_SYSTEM_TABLE, 1)
|
||||||
builder.done();
|
.addColumn("endpoint", TSDB_DATA_TYPE_BINARY, TSDB_EP_LEN)
|
||||||
}
|
.done();
|
||||||
{
|
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_DATABASES, TSDB_SYSTEM_TABLE, 1)
|
||||||
ITableBuilder& builder =
|
.addColumn("name", TSDB_DATA_TYPE_BINARY, TSDB_DB_NAME_LEN)
|
||||||
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_MODULES, TSDB_SYSTEM_TABLE, 1)
|
.done();
|
||||||
.addColumn("endpoint", TSDB_DATA_TYPE_BINARY, TSDB_EP_LEN);
|
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_FUNCTIONS, TSDB_SYSTEM_TABLE, 1)
|
||||||
builder.done();
|
.addColumn("name", TSDB_DATA_TYPE_BINARY, TSDB_FUNC_NAME_LEN)
|
||||||
}
|
.done();
|
||||||
{
|
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_INDEXES, TSDB_SYSTEM_TABLE, 3)
|
||||||
ITableBuilder& builder =
|
.addColumn("index_name", TSDB_DATA_TYPE_BINARY, TSDB_TABLE_NAME_LEN)
|
||||||
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_QNODES, TSDB_SYSTEM_TABLE, 1)
|
.addColumn("db_name", TSDB_DATA_TYPE_BINARY, TSDB_DB_NAME_LEN)
|
||||||
.addColumn("endpoint", TSDB_DATA_TYPE_BINARY, TSDB_EP_LEN);
|
.addColumn("table_name", TSDB_DATA_TYPE_BINARY, TSDB_TABLE_NAME_LEN)
|
||||||
builder.done();
|
.done();
|
||||||
}
|
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_STABLES, TSDB_SYSTEM_TABLE, 2)
|
||||||
{
|
.addColumn("db_name", TSDB_DATA_TYPE_BINARY, TSDB_DB_NAME_LEN)
|
||||||
ITableBuilder& builder =
|
.addColumn("stable_name", TSDB_DATA_TYPE_BINARY, TSDB_TABLE_NAME_LEN)
|
||||||
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_DATABASES, TSDB_SYSTEM_TABLE, 1)
|
.done();
|
||||||
.addColumn("name", TSDB_DATA_TYPE_BINARY, TSDB_DB_NAME_LEN);
|
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_TABLES, TSDB_SYSTEM_TABLE, 2)
|
||||||
builder.done();
|
.addColumn("db_name", TSDB_DATA_TYPE_BINARY, TSDB_DB_NAME_LEN)
|
||||||
}
|
.addColumn("table_name", TSDB_DATA_TYPE_BINARY, TSDB_TABLE_NAME_LEN)
|
||||||
{
|
.done();
|
||||||
ITableBuilder& builder =
|
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_TABLE_DISTRIBUTED, TSDB_SYSTEM_TABLE, 1)
|
||||||
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_FUNCTIONS, TSDB_SYSTEM_TABLE, 1)
|
.addColumn("db_name", TSDB_DATA_TYPE_BINARY, TSDB_DB_NAME_LEN)
|
||||||
.addColumn("name", TSDB_DATA_TYPE_BINARY, TSDB_FUNC_NAME_LEN);
|
.done();
|
||||||
builder.done();
|
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_USERS, TSDB_SYSTEM_TABLE, 1)
|
||||||
}
|
.addColumn("name", TSDB_DATA_TYPE_BINARY, TSDB_USER_LEN)
|
||||||
{
|
.done();
|
||||||
ITableBuilder& builder =
|
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_VGROUPS, TSDB_SYSTEM_TABLE, 1)
|
||||||
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_INDEXES, TSDB_SYSTEM_TABLE, 3)
|
.addColumn("db_name", TSDB_DATA_TYPE_BINARY, TSDB_DB_NAME_LEN)
|
||||||
.addColumn("index_name", TSDB_DATA_TYPE_BINARY, TSDB_TABLE_NAME_LEN)
|
.done();
|
||||||
.addColumn("db_name", TSDB_DATA_TYPE_BINARY, TSDB_DB_NAME_LEN)
|
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_CONFIGS, TSDB_SYSTEM_TABLE, 1)
|
||||||
.addColumn("table_name", TSDB_DATA_TYPE_BINARY, TSDB_TABLE_NAME_LEN);
|
.addColumn("name", TSDB_DATA_TYPE_BINARY, TSDB_CONFIG_OPTION_LEN)
|
||||||
builder.done();
|
.done();
|
||||||
}
|
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_DNODE_VARIABLES, TSDB_SYSTEM_TABLE, 1)
|
||||||
{
|
.addColumn("dnode_id", TSDB_DATA_TYPE_INT)
|
||||||
ITableBuilder& builder =
|
.done();
|
||||||
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_STABLES, TSDB_SYSTEM_TABLE, 2)
|
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_CLUSTER, TSDB_SYSTEM_TABLE, 1)
|
||||||
.addColumn("db_name", TSDB_DATA_TYPE_BINARY, TSDB_DB_NAME_LEN)
|
.addColumn("name", TSDB_DATA_TYPE_BINARY, TSDB_CLUSTER_ID_LEN)
|
||||||
.addColumn("stable_name", TSDB_DATA_TYPE_BINARY, TSDB_TABLE_NAME_LEN);
|
.done();
|
||||||
builder.done();
|
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_VNODES, TSDB_SYSTEM_TABLE, 2)
|
||||||
}
|
.addColumn("dnode_id", TSDB_DATA_TYPE_INT)
|
||||||
{
|
.addColumn("dnode_endpoint", TSDB_DATA_TYPE_BINARY, TSDB_EP_LEN)
|
||||||
ITableBuilder& builder =
|
.done();
|
||||||
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_TABLES, TSDB_SYSTEM_TABLE, 2)
|
|
||||||
.addColumn("db_name", TSDB_DATA_TYPE_BINARY, TSDB_DB_NAME_LEN)
|
|
||||||
.addColumn("table_name", TSDB_DATA_TYPE_BINARY, TSDB_TABLE_NAME_LEN);
|
|
||||||
builder.done();
|
|
||||||
}
|
|
||||||
{
|
|
||||||
ITableBuilder& builder =
|
|
||||||
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_TABLE_DISTRIBUTED, TSDB_SYSTEM_TABLE, 1)
|
|
||||||
.addColumn("db_name", TSDB_DATA_TYPE_BINARY, TSDB_DB_NAME_LEN);
|
|
||||||
builder.done();
|
|
||||||
}
|
|
||||||
{
|
|
||||||
ITableBuilder& builder =
|
|
||||||
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_USERS, TSDB_SYSTEM_TABLE, 1)
|
|
||||||
.addColumn("name", TSDB_DATA_TYPE_BINARY, TSDB_USER_LEN);
|
|
||||||
builder.done();
|
|
||||||
}
|
|
||||||
{
|
|
||||||
ITableBuilder& builder =
|
|
||||||
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_VGROUPS, TSDB_SYSTEM_TABLE, 1)
|
|
||||||
.addColumn("db_name", TSDB_DATA_TYPE_BINARY, TSDB_DB_NAME_LEN);
|
|
||||||
builder.done();
|
|
||||||
}
|
|
||||||
{
|
|
||||||
ITableBuilder& builder =
|
|
||||||
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_CONFIGS, TSDB_SYSTEM_TABLE, 1)
|
|
||||||
.addColumn("name", TSDB_DATA_TYPE_BINARY, TSDB_CONFIG_OPTION_LEN);
|
|
||||||
builder.done();
|
|
||||||
}
|
|
||||||
{
|
|
||||||
ITableBuilder& builder =
|
|
||||||
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_DNODE_VARIABLES, TSDB_SYSTEM_TABLE, 1)
|
|
||||||
.addColumn("dnode_id", TSDB_DATA_TYPE_INT);
|
|
||||||
builder.done();
|
|
||||||
}
|
|
||||||
{
|
|
||||||
ITableBuilder& builder =
|
|
||||||
mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_CLUSTER, TSDB_SYSTEM_TABLE, 1)
|
|
||||||
.addColumn("name", TSDB_DATA_TYPE_BINARY, TSDB_CLUSTER_ID_LEN);
|
|
||||||
builder.done();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void generatePerformanceSchema(MockCatalogService* mcs) {
|
void generatePerformanceSchema(MockCatalogService* mcs) {
|
||||||
|
|
|
@ -88,6 +88,7 @@ TEST_F(ParserInitialATest, alterDnode) {
|
||||||
* | REPLICA int_value -- todo: enum 1, 3, default 1, unit replica
|
* | REPLICA int_value -- todo: enum 1, 3, default 1, unit replica
|
||||||
* | STRICT {'off' | 'on'} -- todo: default 'off'
|
* | STRICT {'off' | 'on'} -- todo: default 'off'
|
||||||
* | WAL_LEVEL int_value -- enum 1, 2, default 1
|
* | WAL_LEVEL int_value -- enum 1, 2, default 1
|
||||||
|
* | SST_TRIGGER int_value -- rang [1, 128], default 8
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
TEST_F(ParserInitialATest, alterDatabase) {
|
TEST_F(ParserInitialATest, alterDatabase) {
|
||||||
|
@ -112,6 +113,7 @@ TEST_F(ParserInitialATest, alterDatabase) {
|
||||||
expect.cacheLast = -1;
|
expect.cacheLast = -1;
|
||||||
expect.cacheLastSize = -1;
|
expect.cacheLastSize = -1;
|
||||||
expect.replications = -1;
|
expect.replications = -1;
|
||||||
|
expect.sstTrigger = -1;
|
||||||
};
|
};
|
||||||
auto setAlterDbBuffer = [&](int32_t buffer) { expect.buffer = buffer; };
|
auto setAlterDbBuffer = [&](int32_t buffer) { expect.buffer = buffer; };
|
||||||
auto setAlterDbPageSize = [&](int32_t pageSize) { expect.pageSize = pageSize; };
|
auto setAlterDbPageSize = [&](int32_t pageSize) { expect.pageSize = pageSize; };
|
||||||
|
@ -128,6 +130,7 @@ TEST_F(ParserInitialATest, alterDatabase) {
|
||||||
auto setAlterDbStrict = [&](int8_t strict) { expect.strict = strict; };
|
auto setAlterDbStrict = [&](int8_t strict) { expect.strict = strict; };
|
||||||
auto setAlterDbCacheModel = [&](int8_t cacheModel) { expect.cacheLast = cacheModel; };
|
auto setAlterDbCacheModel = [&](int8_t cacheModel) { expect.cacheLast = cacheModel; };
|
||||||
auto setAlterDbReplica = [&](int8_t replications) { expect.replications = replications; };
|
auto setAlterDbReplica = [&](int8_t replications) { expect.replications = replications; };
|
||||||
|
auto setAlterDbSstTrigger = [&](int8_t sstTrigger) { expect.sstTrigger = sstTrigger; };
|
||||||
|
|
||||||
setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) {
|
setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) {
|
||||||
ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_ALTER_DATABASE_STMT);
|
ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_ALTER_DATABASE_STMT);
|
||||||
|
@ -146,6 +149,7 @@ TEST_F(ParserInitialATest, alterDatabase) {
|
||||||
ASSERT_EQ(req.strict, expect.strict);
|
ASSERT_EQ(req.strict, expect.strict);
|
||||||
ASSERT_EQ(req.cacheLast, expect.cacheLast);
|
ASSERT_EQ(req.cacheLast, expect.cacheLast);
|
||||||
ASSERT_EQ(req.replications, expect.replications);
|
ASSERT_EQ(req.replications, expect.replications);
|
||||||
|
ASSERT_EQ(req.sstTrigger, expect.sstTrigger);
|
||||||
});
|
});
|
||||||
|
|
||||||
const int32_t MINUTE_PER_DAY = MILLISECOND_PER_DAY / MILLISECOND_PER_MINUTE;
|
const int32_t MINUTE_PER_DAY = MILLISECOND_PER_DAY / MILLISECOND_PER_MINUTE;
|
||||||
|
@ -157,7 +161,8 @@ TEST_F(ParserInitialATest, alterDatabase) {
|
||||||
setAlterDbFsync(200);
|
setAlterDbFsync(200);
|
||||||
setAlterDbWal(1);
|
setAlterDbWal(1);
|
||||||
setAlterDbCacheModel(TSDB_CACHE_MODEL_LAST_ROW);
|
setAlterDbCacheModel(TSDB_CACHE_MODEL_LAST_ROW);
|
||||||
run("ALTER DATABASE test CACHEMODEL 'last_row' CACHESIZE 32 WAL_FSYNC_PERIOD 200 KEEP 10 WAL_LEVEL 1");
|
setAlterDbSstTrigger(20);
|
||||||
|
run("ALTER DATABASE test CACHEMODEL 'last_row' CACHESIZE 32 WAL_FSYNC_PERIOD 200 KEEP 10 WAL_LEVEL 1 SST_TRIGGER 20");
|
||||||
clearAlterDbReq();
|
clearAlterDbReq();
|
||||||
|
|
||||||
initAlterDb("test");
|
initAlterDb("test");
|
||||||
|
@ -231,6 +236,8 @@ TEST_F(ParserInitialATest, alterDatabaseSemanticCheck) {
|
||||||
run("ALTER DATABASE test KEEP 1w", TSDB_CODE_PAR_INVALID_DB_OPTION);
|
run("ALTER DATABASE test KEEP 1w", TSDB_CODE_PAR_INVALID_DB_OPTION);
|
||||||
run("ALTER DATABASE test WAL_LEVEL 0", TSDB_CODE_PAR_INVALID_DB_OPTION);
|
run("ALTER DATABASE test WAL_LEVEL 0", TSDB_CODE_PAR_INVALID_DB_OPTION);
|
||||||
run("ALTER DATABASE test WAL_LEVEL 3", TSDB_CODE_PAR_INVALID_DB_OPTION);
|
run("ALTER DATABASE test WAL_LEVEL 3", TSDB_CODE_PAR_INVALID_DB_OPTION);
|
||||||
|
run("ALTER DATABASE test SST_TRIGGER 0", TSDB_CODE_PAR_INVALID_DB_OPTION);
|
||||||
|
run("ALTER DATABASE test SST_TRIGGER 129", TSDB_CODE_PAR_INVALID_DB_OPTION);
|
||||||
// Regardless of the specific sentence
|
// Regardless of the specific sentence
|
||||||
run("ALTER DATABASE db WAL_LEVEL 0 # td-14436", TSDB_CODE_PAR_SYNTAX_ERROR, PARSER_STAGE_PARSE);
|
run("ALTER DATABASE db WAL_LEVEL 0 # td-14436", TSDB_CODE_PAR_SYNTAX_ERROR, PARSER_STAGE_PARSE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,6 +115,7 @@ TEST_F(ParserInitialCTest, createDatabase) {
|
||||||
expect.walRetentionSize = TSDB_REP_DEF_DB_WAL_RET_SIZE;
|
expect.walRetentionSize = TSDB_REP_DEF_DB_WAL_RET_SIZE;
|
||||||
expect.walRollPeriod = TSDB_REP_DEF_DB_WAL_ROLL_PERIOD;
|
expect.walRollPeriod = TSDB_REP_DEF_DB_WAL_ROLL_PERIOD;
|
||||||
expect.walSegmentSize = TSDB_DEFAULT_DB_WAL_SEGMENT_SIZE;
|
expect.walSegmentSize = TSDB_DEFAULT_DB_WAL_SEGMENT_SIZE;
|
||||||
|
expect.sstTrigger = TSDB_DEFAULT_SST_TRIGGER;
|
||||||
};
|
};
|
||||||
|
|
||||||
auto setDbBufferFunc = [&](int32_t buffer) { expect.buffer = buffer; };
|
auto setDbBufferFunc = [&](int32_t buffer) { expect.buffer = buffer; };
|
||||||
|
@ -155,6 +156,7 @@ TEST_F(ParserInitialCTest, createDatabase) {
|
||||||
auto setDbWalRetentionSize = [&](int32_t walRetentionSize) { expect.walRetentionSize = walRetentionSize; };
|
auto setDbWalRetentionSize = [&](int32_t walRetentionSize) { expect.walRetentionSize = walRetentionSize; };
|
||||||
auto setDbWalRollPeriod = [&](int32_t walRollPeriod) { expect.walRollPeriod = walRollPeriod; };
|
auto setDbWalRollPeriod = [&](int32_t walRollPeriod) { expect.walRollPeriod = walRollPeriod; };
|
||||||
auto setDbWalSegmentSize = [&](int32_t walSegmentSize) { expect.walSegmentSize = walSegmentSize; };
|
auto setDbWalSegmentSize = [&](int32_t walSegmentSize) { expect.walSegmentSize = walSegmentSize; };
|
||||||
|
auto setDbSstTrigger = [&](int32_t sstTrigger) { expect.sstTrigger = sstTrigger; };
|
||||||
|
|
||||||
setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) {
|
setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) {
|
||||||
ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_CREATE_DATABASE_STMT);
|
ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_CREATE_DATABASE_STMT);
|
||||||
|
@ -185,7 +187,7 @@ TEST_F(ParserInitialCTest, createDatabase) {
|
||||||
ASSERT_EQ(req.walRetentionSize, expect.walRetentionSize);
|
ASSERT_EQ(req.walRetentionSize, expect.walRetentionSize);
|
||||||
ASSERT_EQ(req.walRollPeriod, expect.walRollPeriod);
|
ASSERT_EQ(req.walRollPeriod, expect.walRollPeriod);
|
||||||
ASSERT_EQ(req.walSegmentSize, expect.walSegmentSize);
|
ASSERT_EQ(req.walSegmentSize, expect.walSegmentSize);
|
||||||
// ASSERT_EQ(req.schemaless, expect.schemaless);
|
ASSERT_EQ(req.sstTrigger, expect.sstTrigger);
|
||||||
ASSERT_EQ(req.ignoreExist, expect.ignoreExist);
|
ASSERT_EQ(req.ignoreExist, expect.ignoreExist);
|
||||||
ASSERT_EQ(req.numOfRetensions, expect.numOfRetensions);
|
ASSERT_EQ(req.numOfRetensions, expect.numOfRetensions);
|
||||||
if (expect.numOfRetensions > 0) {
|
if (expect.numOfRetensions > 0) {
|
||||||
|
@ -233,6 +235,7 @@ TEST_F(ParserInitialCTest, createDatabase) {
|
||||||
setDbWalRetentionSize(-1);
|
setDbWalRetentionSize(-1);
|
||||||
setDbWalRollPeriod(10);
|
setDbWalRollPeriod(10);
|
||||||
setDbWalSegmentSize(20);
|
setDbWalSegmentSize(20);
|
||||||
|
setDbSstTrigger(16);
|
||||||
run("CREATE DATABASE IF NOT EXISTS wxy_db "
|
run("CREATE DATABASE IF NOT EXISTS wxy_db "
|
||||||
"BUFFER 64 "
|
"BUFFER 64 "
|
||||||
"CACHEMODEL 'last_value' "
|
"CACHEMODEL 'last_value' "
|
||||||
|
@ -256,7 +259,8 @@ TEST_F(ParserInitialCTest, createDatabase) {
|
||||||
"WAL_RETENTION_PERIOD -1 "
|
"WAL_RETENTION_PERIOD -1 "
|
||||||
"WAL_RETENTION_SIZE -1 "
|
"WAL_RETENTION_SIZE -1 "
|
||||||
"WAL_ROLL_PERIOD 10 "
|
"WAL_ROLL_PERIOD 10 "
|
||||||
"WAL_SEGMENT_SIZE 20");
|
"WAL_SEGMENT_SIZE 20 "
|
||||||
|
"SST_TRIGGER 16");
|
||||||
clearCreateDbReq();
|
clearCreateDbReq();
|
||||||
|
|
||||||
setCreateDbReqFunc("wxy_db", 1);
|
setCreateDbReqFunc("wxy_db", 1);
|
||||||
|
|
|
@ -218,7 +218,13 @@ TEST_F(ParserShowToUseTest, showVgroups) {
|
||||||
run("SHOW test.vgroups");
|
run("SHOW test.vgroups");
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo SHOW vnodes
|
TEST_F(ParserShowToUseTest, showVnodes) {
|
||||||
|
useDb("root", "test");
|
||||||
|
|
||||||
|
run("SHOW VNODES 1");
|
||||||
|
|
||||||
|
run("SHOW VNODES 'node1:7030'");
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(ParserShowToUseTest, splitVgroup) {
|
TEST_F(ParserShowToUseTest, splitVgroup) {
|
||||||
useDb("root", "test");
|
useDb("root", "test");
|
||||||
|
|
Loading…
Reference in New Issue