diff --git a/cmake/cmake.install b/cmake/cmake.install index b2421fac2598d03f271ec2c35896433b796f08a2..27edd8e27a3abd89cfe2cdc23a830292b4428764 100644 --- a/cmake/cmake.install +++ b/cmake/cmake.install @@ -13,6 +13,7 @@ ELSEIF (TD_WINDOWS) INSTALL(FILES ${TD_SOURCE_DIR}/packaging/cfg/taos.cfg DESTINATION cfg) INSTALL(FILES ${TD_SOURCE_DIR}/include/client/taos.h DESTINATION include) INSTALL(FILES ${TD_SOURCE_DIR}/include/util/taoserror.h DESTINATION include) + INSTALL(FILES ${TD_SOURCE_DIR}/include/libs/function/taosudf.h DESTINATION include) INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/taos.lib DESTINATION driver) INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/taos_static.lib DESTINATION driver) INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/taos.dll DESTINATION driver) diff --git a/docs/examples/java/src/main/java/com/taos/example/LineProtocolExample.java b/docs/examples/java/src/main/java/com/taos/example/LineProtocolExample.java index 990922b7a516bd32a7e299f5743bd1b5e321868a..09c3078e222c1da083c6ed0da19274b7772bba16 100644 --- a/docs/examples/java/src/main/java/com/taos/example/LineProtocolExample.java +++ b/docs/examples/java/src/main/java/com/taos/example/LineProtocolExample.java @@ -26,7 +26,7 @@ public class LineProtocolExample { private static void createDatabase(Connection conn) throws SQLException { try (Statement stmt = conn.createStatement()) { - // the default precision is ms (microsecond), but we use us(microsecond) here. + // the default precision is ms (millisecond), but we use us(microsecond) here. stmt.execute("CREATE DATABASE IF NOT EXISTS test PRECISION 'us'"); stmt.execute("USE test"); } diff --git a/include/client/taos.h b/include/client/taos.h index d31d5c582cd128db3b5217698a27dd92d8a3d108..79f567fc9a928a4e6622784c239ff77fd62334b9 100644 --- a/include/client/taos.h +++ b/include/client/taos.h @@ -131,10 +131,10 @@ DLL_EXPORT int taos_options(TSDB_OPTION option, const void *arg, ...); DLL_EXPORT setConfRet taos_set_config(const char *config); DLL_EXPORT int taos_init(void); DLL_EXPORT TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, uint16_t port); -DLL_EXPORT TAOS *taos_connect_auth(const char *ip, const char *user, const char *auth, const char *db, uint16_t port); -DLL_EXPORT void taos_close(TAOS *taos); +DLL_EXPORT TAOS *taos_connect_auth(const char *ip, const char *user, const char *auth, const char *db, uint16_t port); +DLL_EXPORT void taos_close(TAOS *taos); -const char *taos_data_type(int type); +const char *taos_data_type(int type); DLL_EXPORT TAOS_STMT *taos_stmt_init(TAOS *taos); DLL_EXPORT int taos_stmt_prepare(TAOS_STMT *stmt, const char *sql, unsigned long length); @@ -164,6 +164,7 @@ DLL_EXPORT TAOS_RES *taos_query(TAOS *taos, const char *sql); DLL_EXPORT TAOS_ROW taos_fetch_row(TAOS_RES *res); DLL_EXPORT int taos_result_precision(TAOS_RES *res); // get the time precision of result DLL_EXPORT void taos_free_result(TAOS_RES *res); +DLL_EXPORT void taos_kill_query(TAOS *taos); DLL_EXPORT int taos_field_count(TAOS_RES *res); DLL_EXPORT int taos_num_fields(TAOS_RES *res); DLL_EXPORT int taos_affected_rows(TAOS_RES *res); diff --git a/include/common/tcommon.h b/include/common/tcommon.h index 54044f7d895813662c8b84d9881aeefcfe5bfec1..c7ba618b255f1d43ef81568157b0fe2ceee58207 100644 --- a/include/common/tcommon.h +++ b/include/common/tcommon.h @@ -58,8 +58,8 @@ typedef enum EStreamType { STREAM_GET_ALL, STREAM_DELETE, STREAM_RETRIEVE, - STREAM_PUSH_DATA, - STREAM_PUSH_OVER, + STREAM_PULL_DATA, + STREAM_PULL_OVER, } EStreamType; typedef struct { diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 6ace51f58e8e2a2d56cb7f97294e54cab6887eaa..f5e068693ebc068a2f7370bcd355db3efe5a4c77 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -16,251 +16,255 @@ #ifndef _TD_COMMON_TOKEN_H_ #define _TD_COMMON_TOKEN_H_ -#define TK_OR 1 -#define TK_AND 2 -#define TK_UNION 3 -#define TK_ALL 4 -#define TK_MINUS 5 -#define TK_EXCEPT 6 -#define TK_INTERSECT 7 -#define TK_NK_BITAND 8 -#define TK_NK_BITOR 9 -#define TK_NK_LSHIFT 10 -#define TK_NK_RSHIFT 11 -#define TK_NK_PLUS 12 -#define TK_NK_MINUS 13 -#define TK_NK_STAR 14 -#define TK_NK_SLASH 15 -#define TK_NK_REM 16 -#define TK_NK_CONCAT 17 -#define TK_CREATE 18 -#define TK_ACCOUNT 19 -#define TK_NK_ID 20 -#define TK_PASS 21 -#define TK_NK_STRING 22 -#define TK_ALTER 23 -#define TK_PPS 24 -#define TK_TSERIES 25 -#define TK_STORAGE 26 -#define TK_STREAMS 27 -#define TK_QTIME 28 -#define TK_DBS 29 -#define TK_USERS 30 -#define TK_CONNS 31 -#define TK_STATE 32 -#define TK_USER 33 -#define TK_ENABLE 34 -#define TK_NK_INTEGER 35 -#define TK_SYSINFO 36 -#define TK_DROP 37 -#define TK_GRANT 38 -#define TK_ON 39 -#define TK_TO 40 -#define TK_REVOKE 41 -#define TK_FROM 42 -#define TK_NK_COMMA 43 -#define TK_READ 44 -#define TK_WRITE 45 -#define TK_NK_DOT 46 -#define TK_DNODE 47 -#define TK_PORT 48 -#define TK_DNODES 49 -#define TK_NK_IPTOKEN 50 -#define TK_LOCAL 51 -#define TK_QNODE 52 -#define TK_BNODE 53 -#define TK_SNODE 54 -#define TK_MNODE 55 -#define TK_DATABASE 56 -#define TK_USE 57 -#define TK_IF 58 -#define TK_NOT 59 -#define TK_EXISTS 60 -#define TK_BUFFER 61 -#define TK_CACHELAST 62 -#define TK_COMP 63 -#define TK_DURATION 64 -#define TK_NK_VARIABLE 65 -#define TK_FSYNC 66 -#define TK_MAXROWS 67 -#define TK_MINROWS 68 -#define TK_KEEP 69 -#define TK_PAGES 70 -#define TK_PAGESIZE 71 -#define TK_PRECISION 72 -#define TK_REPLICA 73 -#define TK_STRICT 74 -#define TK_WAL 75 -#define TK_VGROUPS 76 -#define TK_SINGLE_STABLE 77 -#define TK_RETENTIONS 78 -#define TK_SCHEMALESS 79 -#define TK_NK_COLON 80 -#define TK_TABLE 81 -#define TK_NK_LP 82 -#define TK_NK_RP 83 -#define TK_STABLE 84 -#define TK_ADD 85 -#define TK_COLUMN 86 -#define TK_MODIFY 87 -#define TK_RENAME 88 -#define TK_TAG 89 -#define TK_SET 90 -#define TK_NK_EQ 91 -#define TK_USING 92 -#define TK_TAGS 93 -#define TK_COMMENT 94 -#define TK_BOOL 95 -#define TK_TINYINT 96 -#define TK_SMALLINT 97 -#define TK_INT 98 -#define TK_INTEGER 99 -#define TK_BIGINT 100 -#define TK_FLOAT 101 -#define TK_DOUBLE 102 -#define TK_BINARY 103 -#define TK_TIMESTAMP 104 -#define TK_NCHAR 105 -#define TK_UNSIGNED 106 -#define TK_JSON 107 -#define TK_VARCHAR 108 -#define TK_MEDIUMBLOB 109 -#define TK_BLOB 110 -#define TK_VARBINARY 111 -#define TK_DECIMAL 112 -#define TK_MAX_DELAY 113 -#define TK_WATERMARK 114 -#define TK_ROLLUP 115 -#define TK_TTL 116 -#define TK_SMA 117 -#define TK_FIRST 118 -#define TK_LAST 119 -#define TK_SHOW 120 -#define TK_DATABASES 121 -#define TK_TABLES 122 -#define TK_STABLES 123 -#define TK_MNODES 124 -#define TK_MODULES 125 -#define TK_QNODES 126 -#define TK_FUNCTIONS 127 -#define TK_INDEXES 128 -#define TK_ACCOUNTS 129 -#define TK_APPS 130 -#define TK_CONNECTIONS 131 -#define TK_LICENCE 132 -#define TK_GRANTS 133 -#define TK_QUERIES 134 -#define TK_SCORES 135 -#define TK_TOPICS 136 -#define TK_VARIABLES 137 -#define TK_BNODES 138 -#define TK_SNODES 139 -#define TK_CLUSTER 140 -#define TK_TRANSACTIONS 141 -#define TK_DISTRIBUTED 142 -#define TK_CONSUMERS 143 -#define TK_SUBSCRIPTIONS 144 -#define TK_LIKE 145 -#define TK_INDEX 146 -#define TK_FUNCTION 147 -#define TK_INTERVAL 148 -#define TK_TOPIC 149 -#define TK_AS 150 -#define TK_WITH 151 -#define TK_META 152 -#define TK_CONSUMER 153 -#define TK_GROUP 154 -#define TK_DESC 155 -#define TK_DESCRIBE 156 -#define TK_RESET 157 -#define TK_QUERY 158 -#define TK_CACHE 159 -#define TK_EXPLAIN 160 -#define TK_ANALYZE 161 -#define TK_VERBOSE 162 -#define TK_NK_BOOL 163 -#define TK_RATIO 164 -#define TK_NK_FLOAT 165 -#define TK_COMPACT 166 -#define TK_VNODES 167 -#define TK_IN 168 -#define TK_OUTPUTTYPE 169 -#define TK_AGGREGATE 170 -#define TK_BUFSIZE 171 -#define TK_STREAM 172 -#define TK_INTO 173 -#define TK_TRIGGER 174 -#define TK_AT_ONCE 175 -#define TK_WINDOW_CLOSE 176 -#define TK_KILL 177 -#define TK_CONNECTION 178 -#define TK_TRANSACTION 179 -#define TK_BALANCE 180 -#define TK_VGROUP 181 -#define TK_MERGE 182 -#define TK_REDISTRIBUTE 183 -#define TK_SPLIT 184 -#define TK_SYNCDB 185 -#define TK_DELETE 186 -#define TK_NULL 187 -#define TK_NK_QUESTION 188 -#define TK_NK_ARROW 189 -#define TK_ROWTS 190 -#define TK_TBNAME 191 -#define TK_QSTARTTS 192 -#define TK_QENDTS 193 -#define TK_WSTARTTS 194 -#define TK_WENDTS 195 -#define TK_WDURATION 196 -#define TK_CAST 197 -#define TK_NOW 198 -#define TK_TODAY 199 -#define TK_TIMEZONE 200 -#define TK_COUNT 201 -#define TK_LAST_ROW 202 -#define TK_BETWEEN 203 -#define TK_IS 204 -#define TK_NK_LT 205 -#define TK_NK_GT 206 -#define TK_NK_LE 207 -#define TK_NK_GE 208 -#define TK_NK_NE 209 -#define TK_MATCH 210 -#define TK_NMATCH 211 -#define TK_CONTAINS 212 -#define TK_JOIN 213 -#define TK_INNER 214 -#define TK_SELECT 215 -#define TK_DISTINCT 216 -#define TK_WHERE 217 -#define TK_PARTITION 218 -#define TK_BY 219 -#define TK_SESSION 220 -#define TK_STATE_WINDOW 221 -#define TK_SLIDING 222 -#define TK_FILL 223 -#define TK_VALUE 224 -#define TK_NONE 225 -#define TK_PREV 226 -#define TK_LINEAR 227 -#define TK_NEXT 228 -#define TK_HAVING 229 -#define TK_RANGE 230 -#define TK_EVERY 231 -#define TK_ORDER 232 -#define TK_SLIMIT 233 -#define TK_SOFFSET 234 -#define TK_LIMIT 235 -#define TK_OFFSET 236 -#define TK_ASC 237 -#define TK_NULLS 238 -#define TK_ID 239 -#define TK_NK_BITNOT 240 -#define TK_INSERT 241 -#define TK_VALUES 242 -#define TK_IMPORT 243 -#define TK_NK_SEMI 244 -#define TK_FILE 245 +#define TK_OR 1 +#define TK_AND 2 +#define TK_UNION 3 +#define TK_ALL 4 +#define TK_MINUS 5 +#define TK_EXCEPT 6 +#define TK_INTERSECT 7 +#define TK_NK_BITAND 8 +#define TK_NK_BITOR 9 +#define TK_NK_LSHIFT 10 +#define TK_NK_RSHIFT 11 +#define TK_NK_PLUS 12 +#define TK_NK_MINUS 13 +#define TK_NK_STAR 14 +#define TK_NK_SLASH 15 +#define TK_NK_REM 16 +#define TK_NK_CONCAT 17 +#define TK_CREATE 18 +#define TK_ACCOUNT 19 +#define TK_NK_ID 20 +#define TK_PASS 21 +#define TK_NK_STRING 22 +#define TK_ALTER 23 +#define TK_PPS 24 +#define TK_TSERIES 25 +#define TK_STORAGE 26 +#define TK_STREAMS 27 +#define TK_QTIME 28 +#define TK_DBS 29 +#define TK_USERS 30 +#define TK_CONNS 31 +#define TK_STATE 32 +#define TK_USER 33 +#define TK_ENABLE 34 +#define TK_NK_INTEGER 35 +#define TK_SYSINFO 36 +#define TK_DROP 37 +#define TK_GRANT 38 +#define TK_ON 39 +#define TK_TO 40 +#define TK_REVOKE 41 +#define TK_FROM 42 +#define TK_NK_COMMA 43 +#define TK_READ 44 +#define TK_WRITE 45 +#define TK_NK_DOT 46 +#define TK_DNODE 47 +#define TK_PORT 48 +#define TK_DNODES 49 +#define TK_NK_IPTOKEN 50 +#define TK_LOCAL 51 +#define TK_QNODE 52 +#define TK_BNODE 53 +#define TK_SNODE 54 +#define TK_MNODE 55 +#define TK_DATABASE 56 +#define TK_USE 57 +#define TK_IF 58 +#define TK_NOT 59 +#define TK_EXISTS 60 +#define TK_BUFFER 61 +#define TK_CACHELAST 62 +#define TK_COMP 63 +#define TK_DURATION 64 +#define TK_NK_VARIABLE 65 +#define TK_FSYNC 66 +#define TK_MAXROWS 67 +#define TK_MINROWS 68 +#define TK_KEEP 69 +#define TK_PAGES 70 +#define TK_PAGESIZE 71 +#define TK_PRECISION 72 +#define TK_REPLICA 73 +#define TK_STRICT 74 +#define TK_WAL 75 +#define TK_VGROUPS 76 +#define TK_SINGLE_STABLE 77 +#define TK_RETENTIONS 78 +#define TK_SCHEMALESS 79 +#define TK_NK_COLON 80 +#define TK_TABLE 81 +#define TK_NK_LP 82 +#define TK_NK_RP 83 +#define TK_STABLE 84 +#define TK_ADD 85 +#define TK_COLUMN 86 +#define TK_MODIFY 87 +#define TK_RENAME 88 +#define TK_TAG 89 +#define TK_SET 90 +#define TK_NK_EQ 91 +#define TK_USING 92 +#define TK_TAGS 93 +#define TK_COMMENT 94 +#define TK_BOOL 95 +#define TK_TINYINT 96 +#define TK_SMALLINT 97 +#define TK_INT 98 +#define TK_INTEGER 99 +#define TK_BIGINT 100 +#define TK_FLOAT 101 +#define TK_DOUBLE 102 +#define TK_BINARY 103 +#define TK_TIMESTAMP 104 +#define TK_NCHAR 105 +#define TK_UNSIGNED 106 +#define TK_JSON 107 +#define TK_VARCHAR 108 +#define TK_MEDIUMBLOB 109 +#define TK_BLOB 110 +#define TK_VARBINARY 111 +#define TK_DECIMAL 112 +#define TK_MAX_DELAY 113 +#define TK_WATERMARK 114 +#define TK_ROLLUP 115 +#define TK_TTL 116 +#define TK_SMA 117 +#define TK_FIRST 118 +#define TK_LAST 119 +#define TK_SHOW 120 +#define TK_DATABASES 121 +#define TK_TABLES 122 +#define TK_STABLES 123 +#define TK_MNODES 124 +#define TK_MODULES 125 +#define TK_QNODES 126 +#define TK_FUNCTIONS 127 +#define TK_INDEXES 128 +#define TK_ACCOUNTS 129 +#define TK_APPS 130 +#define TK_CONNECTIONS 131 +#define TK_LICENCE 132 +#define TK_GRANTS 133 +#define TK_QUERIES 134 +#define TK_SCORES 135 +#define TK_TOPICS 136 +#define TK_VARIABLES 137 +#define TK_BNODES 138 +#define TK_SNODES 139 +#define TK_CLUSTER 140 +#define TK_TRANSACTIONS 141 +#define TK_DISTRIBUTED 142 +#define TK_CONSUMERS 143 +#define TK_SUBSCRIPTIONS 144 +#define TK_LIKE 145 +#define TK_INDEX 146 +#define TK_FUNCTION 147 +#define TK_INTERVAL 148 +#define TK_TOPIC 149 +#define TK_AS 150 +#define TK_WITH 151 +#define TK_META 152 +#define TK_CONSUMER 153 +#define TK_GROUP 154 +#define TK_DESC 155 +#define TK_DESCRIBE 156 +#define TK_RESET 157 +#define TK_QUERY 158 +#define TK_CACHE 159 +#define TK_EXPLAIN 160 +#define TK_ANALYZE 161 +#define TK_VERBOSE 162 +#define TK_NK_BOOL 163 +#define TK_RATIO 164 +#define TK_NK_FLOAT 165 +#define TK_COMPACT 166 +#define TK_VNODES 167 +#define TK_IN 168 +#define TK_OUTPUTTYPE 169 +#define TK_AGGREGATE 170 +#define TK_BUFSIZE 171 +#define TK_STREAM 172 +#define TK_INTO 173 +#define TK_TRIGGER 174 +#define TK_AT_ONCE 175 +#define TK_WINDOW_CLOSE 176 +#define TK_KILL 177 +#define TK_CONNECTION 178 +#define TK_TRANSACTION 179 +#define TK_BALANCE 180 +#define TK_VGROUP 181 +#define TK_MERGE 182 +#define TK_REDISTRIBUTE 183 +#define TK_SPLIT 184 +#define TK_SYNCDB 185 +#define TK_DELETE 186 +#define TK_NULL 187 +#define TK_NK_QUESTION 188 +#define TK_NK_ARROW 189 +#define TK_ROWTS 190 +#define TK_TBNAME 191 +#define TK_QSTARTTS 192 +#define TK_QENDTS 193 +#define TK_WSTARTTS 194 +#define TK_WENDTS 195 +#define TK_WDURATION 196 +#define TK_CAST 197 +#define TK_NOW 198 +#define TK_TODAY 199 +#define TK_TIMEZONE 200 +#define TK_CLIENT_VERSION 201 +#define TK_SERVER_VERSION 202 +#define TK_SERVER_STATUS 203 +#define TK_CURRENT_USER 204 +#define TK_COUNT 205 +#define TK_LAST_ROW 206 +#define TK_BETWEEN 207 +#define TK_IS 208 +#define TK_NK_LT 209 +#define TK_NK_GT 210 +#define TK_NK_LE 211 +#define TK_NK_GE 212 +#define TK_NK_NE 213 +#define TK_MATCH 214 +#define TK_NMATCH 215 +#define TK_CONTAINS 216 +#define TK_JOIN 217 +#define TK_INNER 218 +#define TK_SELECT 219 +#define TK_DISTINCT 220 +#define TK_WHERE 221 +#define TK_PARTITION 222 +#define TK_BY 223 +#define TK_SESSION 224 +#define TK_STATE_WINDOW 225 +#define TK_SLIDING 226 +#define TK_FILL 227 +#define TK_VALUE 228 +#define TK_NONE 229 +#define TK_PREV 230 +#define TK_LINEAR 231 +#define TK_NEXT 232 +#define TK_HAVING 233 +#define TK_RANGE 234 +#define TK_EVERY 235 +#define TK_ORDER 236 +#define TK_SLIMIT 237 +#define TK_SOFFSET 238 +#define TK_LIMIT 239 +#define TK_OFFSET 240 +#define TK_ASC 241 +#define TK_NULLS 242 +#define TK_ID 243 +#define TK_NK_BITNOT 244 +#define TK_INSERT 245 +#define TK_VALUES 246 +#define TK_IMPORT 247 +#define TK_NK_SEMI 248 +#define TK_FILE 249 #define TK_NK_SPACE 300 #define TK_NK_COMMENT 301 diff --git a/include/libs/catalog/catalog.h b/include/libs/catalog/catalog.h index 8482ae3f3de328c21fc6f8b8748fe65d7b99ce98..1d1849f24a72b33e2eff3ec23c8076b74f785206 100644 --- a/include/libs/catalog/catalog.h +++ b/include/libs/catalog/catalog.h @@ -147,14 +147,6 @@ int32_t catalogInit(SCatalogCfg* cfg); */ int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle); -/** - * Free a cluster's all catalog info, usually it's not necessary, until the application is closing. - * no current or future usage should be guaranteed by application - * @param pCatalog (input, NO more usage) - * @return error code - */ -void catalogFreeHandle(SCatalog* pCatalog); - int32_t catalogGetDBVgVersion(SCatalog* pCtg, const char* dbFName, int32_t* version, int64_t* dbId, int32_t* tableNum); /** diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h index 564c208c69cbc897092e61f3a965f6d5f134ecf7..6b4772dc2ed131f5d23f37baea1f7ad80ffa090b 100644 --- a/include/libs/executor/executor.h +++ b/include/libs/executor/executor.h @@ -133,12 +133,6 @@ int32_t qKillTask(qTaskInfo_t tinfo); */ int32_t qAsyncKillTask(qTaskInfo_t tinfo); -/** - * return whether query is completed or not - * @param tinfo - * @return - */ -int32_t qIsTaskCompleted(qTaskInfo_t tinfo); /** * destroy query info structure @@ -169,6 +163,15 @@ int32_t qSerializeTaskStatus(qTaskInfo_t tinfo, char** pOutput, int32_t* len); int32_t qDeserializeTaskStatus(qTaskInfo_t tinfo, const char* pInput, int32_t len); +/** + * return the scan info, in the form of tuple of two items, including table uid and current timestamp + * @param tinfo + * @param uid + * @param ts + * @return + */ +int32_t qGetStreamScanStatus(qTaskInfo_t tinfo, uint64_t* uid, int64_t* ts); + #ifdef __cplusplus } #endif diff --git a/include/libs/function/functionMgt.h b/include/libs/function/functionMgt.h index 1ed78750d180d2d5aca57294192bfb57621701dd..277fb78561dda4d1dec7b64546692bb2aa3410e2 100644 --- a/include/libs/function/functionMgt.h +++ b/include/libs/function/functionMgt.h @@ -105,7 +105,7 @@ typedef enum EFunctionType { // system function FUNCTION_TYPE_DATABASE = 3000, FUNCTION_TYPE_CLIENT_VERSION, - FUNCTION_TYPE_SERVER_SERSION, + FUNCTION_TYPE_SERVER_VERSION, FUNCTION_TYPE_SERVER_STATUS, FUNCTION_TYPE_CURRENT_USER, FUNCTION_TYPE_USER, @@ -193,6 +193,7 @@ bool fmIsForbidGroupByFunc(int32_t funcId); bool fmIsIntervalInterpoFunc(int32_t funcId); bool fmIsInterpFunc(int32_t funcId); bool fmIsLastRowFunc(int32_t funcId); +bool fmIsSystemInfoFunc(int32_t funcId); int32_t fmGetDistMethod(const SFunctionNode* pFunc, SFunctionNode** pPartialFunc, SFunctionNode** pMergeFunc); diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index 0bd917a9c693f4933cadda2baec843b999df4b1a..4671c8b81e1982558c50e8bb64263b7eed7733ad 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -103,6 +103,7 @@ typedef struct SIndefRowsFuncLogicNode { SLogicNode node; SNodeList* pFuncs; bool isTailFunc; + bool isUniqueFunc; } SIndefRowsFuncLogicNode; typedef struct SInterpFuncLogicNode { diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index 39c569acefa98bca8a70c96efe21fb076bff3450..9d84f2c32faeef632f771c503350449f4eaf9ffe 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -50,6 +50,7 @@ typedef struct SExprNode { char aliasName[TSDB_COL_NAME_LEN]; char userAlias[TSDB_COL_NAME_LEN]; SArray* pAssociation; + bool orderAlias; } SExprNode; typedef enum EColumnType { COLUMN_TYPE_COLUMN = 1, COLUMN_TYPE_TAG, COLUMN_TYPE_TBNAME } EColumnType; @@ -88,6 +89,7 @@ typedef struct SValueNode { bool isDuration; bool translate; bool notReserved; + bool isNull; int16_t placeholderNo; union { bool b; diff --git a/include/libs/planner/planner.h b/include/libs/planner/planner.h index b350837551551b7a113e8d24b17dd6d266ce183f..b4c75da1318771972bd05830e53eb59dcdba23ea 100644 --- a/include/libs/planner/planner.h +++ b/include/libs/planner/planner.h @@ -48,6 +48,8 @@ int32_t qCreateQueryPlan(SPlanContext* pCxt, SQueryPlan** pPlan, SArray* pExecNo // @pSource one execution location of this group of datasource subplans int32_t qSetSubplanExecutionNode(SSubplan* pSubplan, int32_t groupId, SDownstreamSourceNode* pSource); +void qClearSubplanExecutionNode(SSubplan* pSubplan); + // Convert to subplan to string for the scheduler to send to the executor int32_t qSubPlanToString(const SSubplan* pSubplan, char** pStr, int32_t* pLen); int32_t qStringToSubplan(const char* pStr, SSubplan** pSubplan); diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index 0b767e96f64e7f4528b51480d907b21ac2d0c2ad..9e8ce3ffb6d5b2149ff859ee288d57ee7f6c1907 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -271,19 +271,19 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t #define qDebug(...) \ do { \ if (qDebugFlag & DEBUG_DEBUG) { \ - taosPrintLog("QRY ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); \ + taosPrintLog("QRY ", DEBUG_DEBUG, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \ } \ } while (0) #define qTrace(...) \ do { \ if (qDebugFlag & DEBUG_TRACE) { \ - taosPrintLog("QRY ", DEBUG_TRACE, qDebugFlag, __VA_ARGS__); \ + taosPrintLog("QRY ", DEBUG_TRACE, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \ } \ } while (0) #define qDebugL(...) \ do { \ if (qDebugFlag & DEBUG_DEBUG) { \ - taosPrintLongString("QRY ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); \ + taosPrintLongString("QRY ", DEBUG_DEBUG, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \ } \ } while (0) diff --git a/include/libs/scheduler/scheduler.h b/include/libs/scheduler/scheduler.h index ecb21335b9cf9edb566c1861042fcaffd6da13c4..be3d16ab0d71ee5d20c8c79e330ef18cafee7ac4 100644 --- a/include/libs/scheduler/scheduler.h +++ b/include/libs/scheduler/scheduler.h @@ -69,18 +69,20 @@ typedef struct SSchdFetchParam { int32_t* code; } SSchdFetchParam; -typedef void (*schedulerExecCallback)(SQueryResult* pResult, void* param, int32_t code); -typedef void (*schedulerFetchCallback)(void* pResult, void* param, int32_t code); +typedef void (*schedulerExecFp)(SQueryResult* pResult, void* param, int32_t code); +typedef void (*schedulerFetchFp)(void* pResult, void* param, int32_t code); +typedef bool (*schedulerChkKillFp)(void* param); typedef struct SSchedulerReq { - bool *reqKilled; SRequestConnInfo *pConn; SArray *pNodeList; SQueryPlan *pDag; const char *sql; int64_t startTs; - schedulerExecCallback fp; - void* cbParam; + schedulerExecFp execFp; + void* execParam; + schedulerChkKillFp chkKillFp; + void* chkKillParam; } SSchedulerReq; @@ -110,7 +112,7 @@ int32_t schedulerExecJob(SSchedulerReq *pReq, int64_t *pJob, SQueryResult *pRes) */ int32_t schedulerFetchRows(int64_t job, void **data); -void schedulerAsyncFetchRows(int64_t job, schedulerFetchCallback fp, void* param); +void schedulerAsyncFetchRows(int64_t job, schedulerFetchFp fp, void* param); int32_t schedulerGetTasksStatus(int64_t job, SArray *pSub); diff --git a/include/libs/sync/syncTools.h b/include/libs/sync/syncTools.h index 5d892352d68638ddace5ba8191c19b6b25a02439..46f279ed851070fedc26213e58c9df0279b02f6c 100644 --- a/include/libs/sync/syncTools.h +++ b/include/libs/sync/syncTools.h @@ -324,6 +324,23 @@ void syncAppendEntriesPrint2(char* s, const SyncAppendEntries* pMsg); void syncAppendEntriesLog(const SyncAppendEntries* pMsg); void syncAppendEntriesLog2(char* s, const SyncAppendEntries* pMsg); +// --------------------------------------------- +typedef struct SyncAppendEntriesBatch { + uint32_t bytes; + int32_t vgId; + uint32_t msgType; + SRaftId srcId; + SRaftId destId; + // private data + SyncTerm term; + SyncIndex prevLogIndex; + SyncTerm prevLogTerm; + SyncIndex commitIndex; + SyncTerm privateTerm; + uint32_t dataLen; + char data[]; +} SyncAppendEntriesBatch; + // --------------------------------------------- typedef struct SyncAppendEntriesReply { uint32_t bytes; diff --git a/include/libs/transport/trpc.h b/include/libs/transport/trpc.h index 2b8c6a895e92e8fadbbce8f3dea1d5484ce37dec..8471aa8286da029f53587b258ab417362badf952 100644 --- a/include/libs/transport/trpc.h +++ b/include/libs/transport/trpc.h @@ -45,7 +45,7 @@ typedef struct SRpcHandleInfo { int32_t noResp; // has response or not(default 0, 0: resp, 1: no resp); int32_t persistHandle; // persist handle or not STraceId traceId; - // int64_t traceId; + int8_t hasEpSet; // app info void *ahandle; // app handle set by client @@ -123,7 +123,7 @@ void * rpcReallocCont(void *ptr, int32_t contLen); void rpcSendRequest(void *thandle, const SEpSet *pEpSet, SRpcMsg *pMsg, int64_t *rid); void rpcSendResponse(const SRpcMsg *pMsg); void rpcRegisterBrokenLinkArg(SRpcMsg *msg); -void rpcReleaseHandle(void *handle, int8_t type); // just release client conn to rpc instance, no close sock +void rpcReleaseHandle(void *handle, int8_t type); // just release conn to rpc instance, no close sock // These functions will not be called in the child process void rpcSendRedirectRsp(void *pConn, const SEpSet *pEpSet); diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 8565eea63bd310d9538e49c7f4214c3f243cbf40..08e09dca2f0bff30655ff20fe5ad67759fd1bd39 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -466,11 +466,11 @@ int32_t* taosGetErrno(); #define TSDB_CODE_CTG_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2400) #define TSDB_CODE_CTG_INVALID_INPUT TAOS_DEF_ERROR_CODE(0, 0x2401) #define TSDB_CODE_CTG_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x2402) -#define TSDB_CODE_CTG_MEM_ERROR TAOS_DEF_ERROR_CODE(0, 0x2403) -#define TSDB_CODE_CTG_SYS_ERROR TAOS_DEF_ERROR_CODE(0, 0x2404) -#define TSDB_CODE_CTG_DB_DROPPED TAOS_DEF_ERROR_CODE(0, 0x2405) -#define TSDB_CODE_CTG_OUT_OF_SERVICE TAOS_DEF_ERROR_CODE(0, 0x2406) -#define TSDB_CODE_CTG_VG_META_MISMATCH TAOS_DEF_ERROR_CODE(0, 0x2407) +#define TSDB_CODE_CTG_SYS_ERROR TAOS_DEF_ERROR_CODE(0, 0x2403) +#define TSDB_CODE_CTG_DB_DROPPED TAOS_DEF_ERROR_CODE(0, 0x2404) +#define TSDB_CODE_CTG_OUT_OF_SERVICE TAOS_DEF_ERROR_CODE(0, 0x2405) +#define TSDB_CODE_CTG_VG_META_MISMATCH TAOS_DEF_ERROR_CODE(0, 0x2406) +#define TSDB_CODE_CTG_EXIT TAOS_DEF_ERROR_CODE(0, 0x2407) //scheduler&qworker #define TSDB_CODE_SCH_STATUS_ERROR TAOS_DEF_ERROR_CODE(0, 0x2501) @@ -615,6 +615,7 @@ int32_t* taosGetErrno(); //rsma #define TSDB_CODE_RSMA_INVALID_ENV TAOS_DEF_ERROR_CODE(0, 0x3150) #define TSDB_CODE_RSMA_INVALID_STAT TAOS_DEF_ERROR_CODE(0, 0x3151) +#define TSDB_CODE_RSMA_QTASKINFO_CREATE TAOS_DEF_ERROR_CODE(0, 0x3152) //index #define TSDB_CODE_INDEX_REBUILDING TAOS_DEF_ERROR_CODE(0, 0x3200) diff --git a/packaging/check_package.sh b/packaging/check_package.sh index 81abff57a586d116ead0137f96697ece04250d6b..e728c6455abdb149d43a4e46d2b7730511b8800d 100644 --- a/packaging/check_package.sh +++ b/packaging/check_package.sh @@ -170,7 +170,7 @@ function check_lib_path() { function check_header_path() { # check all header - header_dir=("taos.h" "taosdef.h" "taoserror.h") + header_dir=("taos.h" "taosdef.h" "taoserror.h" "taosudf.h") for i in "${header_dir[@]}";do check_link ${inc_link_dir}/$i done diff --git a/packaging/deb/DEBIAN/prerm b/packaging/deb/DEBIAN/prerm index c01db74701f99e52cc45b589d8fe7b07c4c8afe1..501398f350de7013840056c3ee2a8252f961e496 100644 --- a/packaging/deb/DEBIAN/prerm +++ b/packaging/deb/DEBIAN/prerm @@ -29,6 +29,7 @@ else ${csudo}rm -f ${bin_link_dir}/taosdemo || : ${csudo}rm -f ${cfg_link_dir}/* || : ${csudo}rm -f ${inc_link_dir}/taos.h || : + ${csudo}rm -f ${inc_link_dir}/taosudf.h || : ${csudo}rm -f ${lib_link_dir}/libtaos.* || : ${csudo}rm -f ${log_link_dir} || : diff --git a/packaging/deb/makedeb.sh b/packaging/deb/makedeb.sh index 5a14aea4ec14d64913845cf7efb0615abd7b6f93..043c1456b8fc22e78e707a4f8bc0c0e5a86bae55 100755 --- a/packaging/deb/makedeb.sh +++ b/packaging/deb/makedeb.sh @@ -70,6 +70,7 @@ cp ${compile_dir}/build/lib/${libfile} ${pkg_dir}${install_home_pat cp ${compile_dir}/../include/client/taos.h ${pkg_dir}${install_home_path}/include cp ${compile_dir}/../include/common/taosdef.h ${pkg_dir}${install_home_path}/include cp ${compile_dir}/../include/util/taoserror.h ${pkg_dir}${install_home_path}/include +cp ${compile_dir}/../include/libs/function/taosudf.h ${pkg_dir}${install_home_path}/include cp -r ${top_dir}/examples/* ${pkg_dir}${install_home_path}/examples #cp -r ${top_dir}/src/connector/python ${pkg_dir}${install_home_path}/connector #cp -r ${top_dir}/src/connector/go ${pkg_dir}${install_home_path}/connector diff --git a/packaging/release.sh b/packaging/release.sh index 00a4ad7009d9b5293bc5b0ee0efd566159c69450..1d9f6dfc68088443e671aab6f6bb4c1c2909cef4 100755 --- a/packaging/release.sh +++ b/packaging/release.sh @@ -181,15 +181,9 @@ cd "${curr_dir}" # 2. cmake executable file compile_dir="${top_dir}/debug" -if [ -d ${compile_dir} ]; then - ${csudo}rm -rf ${compile_dir} -fi +${csudo}rm -rf ${compile_dir} -if [ "$osType" != "Darwin" ]; then - ${csudo}mkdir -p ${compile_dir} -else - mkdir -p ${compile_dir} -fi +mkdir -p ${compile_dir} cd ${compile_dir} if [[ "$allocator" == "jemalloc" ]]; then @@ -255,9 +249,9 @@ if [ "$osType" != "Darwin" ]; then echo "====do deb package for the ubuntu system====" output_dir="${top_dir}/debs" if [ -d ${output_dir} ]; then - ${csudo}rm -rf ${output_dir} + rm -rf ${output_dir} fi - ${csudo}mkdir -p ${output_dir} + mkdir -p ${output_dir} cd ${script_dir}/deb ${csudo}./makedeb.sh ${compile_dir} ${output_dir} ${verNumber} ${cpuType} ${osType} ${verMode} ${verType} @@ -280,9 +274,9 @@ if [ "$osType" != "Darwin" ]; then echo "====do rpm package for the centos system====" output_dir="${top_dir}/rpms" if [ -d ${output_dir} ]; then - ${csudo}rm -rf ${output_dir} + rm -rf ${output_dir} fi - ${csudo}mkdir -p ${output_dir} + mkdir -p ${output_dir} cd ${script_dir}/rpm ${csudo}./makerpm.sh ${compile_dir} ${output_dir} ${verNumber} ${cpuType} ${osType} ${verMode} ${verType} diff --git a/packaging/rpm/makerpm.sh b/packaging/rpm/makerpm.sh old mode 100644 new mode 100755 diff --git a/packaging/rpm/tdengine.spec b/packaging/rpm/tdengine.spec index d61d12932f219e16911a998125518205b91664d2..f440f72aa298daccfa2f60a6bacf0035d5d44f6a 100644 --- a/packaging/rpm/tdengine.spec +++ b/packaging/rpm/tdengine.spec @@ -77,6 +77,7 @@ cp %{_compiledir}/build/lib/${libfile} %{buildroot}%{homepath}/driv cp %{_compiledir}/../include/client/taos.h %{buildroot}%{homepath}/include cp %{_compiledir}/../include/common/taosdef.h %{buildroot}%{homepath}/include cp %{_compiledir}/../include/util/taoserror.h %{buildroot}%{homepath}/include +cp %{_compiledir}/../include/libs/function/taosudf.h %{buildroot}%{homepath}/include #cp -r %{_compiledir}/../src/connector/python %{buildroot}%{homepath}/connector #cp -r %{_compiledir}/../src/connector/go %{buildroot}%{homepath}/connector #cp -r %{_compiledir}/../src/connector/nodejs %{buildroot}%{homepath}/connector @@ -201,6 +202,7 @@ if [ $1 -eq 0 ];then ${csudo}rm -f ${inc_link_dir}/taos.h || : ${csudo}rm -f ${inc_link_dir}/taosdef.h || : ${csudo}rm -f ${inc_link_dir}/taoserror.h || : + ${csudo}rm -f ${inc_link_dir}/taosudf.h || : ${csudo}rm -f ${lib_link_dir}/libtaos.* || : ${csudo}rm -f ${log_link_dir} || : diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index d730cc0d8af8e3db0c16e4609138c0f63ac5329b..7c7d5477cfabdf532fe8c225c8ca9f351d4f7035 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -314,11 +314,12 @@ function install_jemalloc() { } function install_header() { - ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || : + ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/taosudf.h || : ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/* ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h + ${csudo}ln -s ${install_main_dir}/include/taosudf.h ${inc_link_dir}/taosudf.h } function add_newHostname_to_hosts() { diff --git a/packaging/tools/install_arbi.sh b/packaging/tools/install_arbi.sh index e3c63965d4beee31cea91d2f8fd84e3d2bdd00d3..28636401531e1e5f0c8eee4c1059303b0ac34612 100755 --- a/packaging/tools/install_arbi.sh +++ b/packaging/tools/install_arbi.sh @@ -115,11 +115,12 @@ function install_bin() { } function install_header() { - ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || : + ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/taosudf.h || : ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/* ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h + ${csudo}ln -s ${install_main_dir}/include/taosudf.h ${inc_link_dir}/taosudf.h } function install_jemalloc() { diff --git a/packaging/tools/install_client.sh b/packaging/tools/install_client.sh index 5f449e5d91122522d595eb2ccfb948aa4f8a66fe..0c86877c999e521f519fb303373827ffbaca6a30 100755 --- a/packaging/tools/install_client.sh +++ b/packaging/tools/install_client.sh @@ -148,11 +148,12 @@ function install_lib() { } function install_header() { - ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || : + ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/taosudf.h || : ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/* ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h + ${csudo}ln -s ${install_main_dir}/include/taosudf.h ${inc_link_dir}/taosudf.h } function install_jemalloc() { diff --git a/packaging/tools/make_install.sh b/packaging/tools/make_install.sh index 6726b3fe2da1bee3d7f35e2550fa4e23352cfc78..59be60f8fc362606542dd94956d4f99416131655 100755 --- a/packaging/tools/make_install.sh +++ b/packaging/tools/make_install.sh @@ -349,16 +349,17 @@ function install_lib() { function install_header() { if [ "$osType" != "Darwin" ]; then - ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || : - ${csudo}cp -f ${source_dir}/include/client/taos.h ${source_dir}/include/common/taosdef.h ${source_dir}/include/util/taoserror.h \ + ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/taosudf.h || : + ${csudo}cp -f ${source_dir}/include/client/taos.h ${source_dir}/include/common/taosdef.h ${source_dir}/include/util/taoserror.h ${source_dir}/include/libs/function/taosudf.h \ ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/* ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h + ${csudo}ln -s ${install_main_dir}/include/taosudf.h ${inc_link_dir}/taosudf.h else - ${csudo}cp -f ${source_dir}/include/client/taos.h ${source_dir}/include/common/taosdef.h ${source_dir}/include/util/taoserror.h \ + ${csudo}cp -f ${source_dir}/include/client/taos.h ${source_dir}/include/common/taosdef.h ${source_dir}/include/util/taoserror.h ${source_dir}/include/libs/function/taosudf.h \ ${install_main_dir}/include || - ${csudo}cp -f ${source_dir}/include/client/taos.h ${source_dir}/include/common/taosdef.h ${source_dir}/include/util/taoserror.h \ + ${csudo}cp -f ${source_dir}/include/client/taos.h ${source_dir}/include/common/taosdef.h ${source_dir}/include/util/taoserror.h ${source_dir}/include/libs/function/taosudf.h \ ${install_main_2_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/* || ${csudo}chmod 644 ${install_main_2_dir}/include/* diff --git a/packaging/tools/makearbi.sh b/packaging/tools/makearbi.sh index 65a6dae9a4d558da06a3f49bb9e6aa478c762916..cfae2b4a4643a375357630be21eb3ed635e7d37c 100755 --- a/packaging/tools/makearbi.sh +++ b/packaging/tools/makearbi.sh @@ -36,7 +36,7 @@ fi bin_files="${build_dir}/bin/tarbitrator ${script_dir}/remove_arbi.sh" install_files="${script_dir}/install_arbi.sh" -#header_files="${code_dir}/include/client/taos.h ${code_dir}/include/common/taosdef.h ${code_dir}/include/util/taoserror.h" +#header_files="${code_dir}/include/client/taos.h ${code_dir}/include/common/taosdef.h ${code_dir}/include/util/taoserror.h ${code_dir}/include/libs/function/taosudf.h" init_file_tarbitrator_deb=${script_dir}/../deb/tarbitratord init_file_tarbitrator_rpm=${script_dir}/../rpm/tarbitratord diff --git a/packaging/tools/makeclient.sh b/packaging/tools/makeclient.sh index 9e7f01300602ec01656c7862b2a918b5889a53b2..0f1080521e95eadeda32a4674bb5399759ade977 100755 --- a/packaging/tools/makeclient.sh +++ b/packaging/tools/makeclient.sh @@ -62,7 +62,7 @@ else lib_files="${build_dir}/lib/libtaos.${version}.dylib" fi -header_files="${code_dir}/include/client/taos.h ${code_dir}/include/common/taosdef.h ${code_dir}/include/util/taoserror.h" +header_files="${code_dir}/include/client/taos.h ${code_dir}/include/common/taosdef.h ${code_dir}/include/util/taoserror.h ${code_dir}/include/libs/function/taosudf.h" if [ "$dbName" != "taos" ]; then cfg_dir="${top_dir}/../enterprise/packaging/cfg" else diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh index d0fbf0c4d790e75d4d73bb958da3d7152551f611..0bc11b99b358f650386fc45f9f76aa00b8ec5ec8 100755 --- a/packaging/tools/makepkg.sh +++ b/packaging/tools/makepkg.sh @@ -93,7 +93,7 @@ else fi lib_files="${build_dir}/lib/libtaos.so.${version}" -header_files="${code_dir}/include/client/taos.h ${code_dir}/include/common/taosdef.h ${code_dir}/include/util/taoserror.h" +header_files="${code_dir}/include/client/taos.h ${code_dir}/include/common/taosdef.h ${code_dir}/include/util/taoserror.h ${code_dir}/include/libs/function/taosudf.h" if [ "$dbName" != "taos" ]; then cfg_dir="${top_dir}/../enterprise/packaging/cfg" diff --git a/packaging/tools/post.sh b/packaging/tools/post.sh index 93849dd4ebef00512854b4dfff8b57f4b44f7797..2d744233bafc8bc1787622a7158dbabfd492f5cd 100755 --- a/packaging/tools/post.sh +++ b/packaging/tools/post.sh @@ -81,10 +81,11 @@ function kill_taosd() { } function install_include() { - ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h|| : + ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/taosudf.h || : ${csudo}ln -s ${inc_dir}/taos.h ${inc_link_dir}/taos.h ${csudo}ln -s ${inc_dir}/taosdef.h ${inc_link_dir}/taosdef.h ${csudo}ln -s ${inc_dir}/taoserror.h ${inc_link_dir}/taoserror.h + ${csudo}ln -s ${inc_dir}/taosudf.h ${inc_link_dir}/taosudf.h } function install_lib() { diff --git a/packaging/tools/preun.sh b/packaging/tools/preun.sh index 2f35e41a48a438d86a7dc6ca71511ce967ba7ebf..8dee9da9889b33437e96c1ba11ae57947db1c738 100755 --- a/packaging/tools/preun.sh +++ b/packaging/tools/preun.sh @@ -128,6 +128,7 @@ ${csudo}rm -f ${cfg_link_dir}/*.new || : ${csudo}rm -f ${inc_link_dir}/taos.h || : ${csudo}rm -f ${inc_link_dir}/taosdef.h || : ${csudo}rm -f ${inc_link_dir}/taoserror.h || : +${csudo}rm -f ${inc_link_dir}/taosudf.h || : ${csudo}rm -f ${lib_link_dir}/libtaos.* || : ${csudo}rm -f ${lib64_link_dir}/libtaos.* || : diff --git a/packaging/tools/remove.sh b/packaging/tools/remove.sh index 3b043f44a330199640af34f550afa40c6e12e111..413de17ee6e7b3d4212531de5945e56d7953271f 100755 --- a/packaging/tools/remove.sh +++ b/packaging/tools/remove.sh @@ -84,6 +84,7 @@ function clean_header() { ${csudo} rm -f ${inc_link_dir}/taos.h || : ${csudo} rm -f ${inc_link_dir}/taosdef.h || : ${csudo} rm -f ${inc_link_dir}/taoserror.h || : + ${csudo} rm -f ${inc_link_dir}/taosudf.h || : } function clean_config() { diff --git a/packaging/tools/remove_arbi.sh b/packaging/tools/remove_arbi.sh index 0a1162cd7a6793d8542ad5079b8c8cce1659724a..c95c579d309257dcd41076fc69cd6b3a5d0032f1 100755 --- a/packaging/tools/remove_arbi.sh +++ b/packaging/tools/remove_arbi.sh @@ -59,6 +59,8 @@ function clean_header() { ${csudo}rm -f ${inc_link_dir}/taos.h || : ${csudo}rm -f ${inc_link_dir}/taosdef.h || : ${csudo}rm -f ${inc_link_dir}/taoserror.h || : + ${csudo}rm -f ${inc_link_dir}/taosudf.h || : + } function clean_log() { diff --git a/packaging/tools/remove_client.sh b/packaging/tools/remove_client.sh index f2cbccb45f738c058236e5625a86fc40c161f488..54f7a949f3abf34c49be63ffae5e43efdf773e8d 100755 --- a/packaging/tools/remove_client.sh +++ b/packaging/tools/remove_client.sh @@ -54,6 +54,7 @@ function clean_header() { ${csudo}rm -f ${inc_link_dir}/taos.h || : ${csudo}rm -f ${inc_link_dir}/taosdef.h || : ${csudo}rm -f ${inc_link_dir}/taoserror.h || : + ${csudo}rm -f ${inc_link_dir}/taosudf.h || : } function clean_config() { diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index 5ffc9ecae85022ac81d71a80b38ec3b66784cf4c..53292ed46a32bc270fb7a07a7d45353528ffde6a 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -65,7 +65,7 @@ enum { typedef struct SAppInstInfo SAppInstInfo; typedef struct { - char* key; + char* key; // statistics int32_t reportCnt; int32_t connKeyCnt; @@ -117,6 +117,7 @@ struct SAppInstInfo { uint64_t clusterId; void* pTransporter; SAppHbMgr* pAppHbMgr; + char* instKey; }; typedef struct SAppInfo { @@ -138,7 +139,7 @@ typedef struct STscObj { int8_t connType; int32_t acctId; uint32_t connId; - TAOS* id; // ref ID returned by taosAddRef + int64_t id; // ref ID returned by taosAddRef TdThreadMutex mutex; // used to protect the operation on db int32_t numOfReqs; // number of sqlObj bound to this connection SAppInstInfo* pAppInfo; @@ -182,7 +183,7 @@ typedef struct SRequestSendRecvBody { void* param; SDataBuf requestMsg; int64_t queryJob; // query job, created according to sql query DAG. - struct SQueryPlan* pDag; // the query dag, generated according to the sql statement. + int32_t subplanNum; SReqResultInfo resInfo; } SRequestSendRecvBody; @@ -299,6 +300,8 @@ void* createRequest(STscObj* pObj, int32_t type); void destroyRequest(SRequestObj* pRequest); SRequestObj* acquireRequest(int64_t rid); int32_t releaseRequest(int64_t rid); +int32_t removeRequest(int64_t rid); +void doDestroyRequest(void *p); char* getDbOfConnection(STscObj* pObj); void setConnectionDB(STscObj* pTscObj, const char* db); @@ -333,6 +336,8 @@ int hbHandleRsp(SClientHbBatchRsp* hbRsp); // cluster level SAppHbMgr* appHbMgrInit(SAppInstInfo* pAppInstInfo, char* key); void appHbMgrCleanup(void); +void hbRemoveAppHbMrg(SAppHbMgr **pAppHbMgr); +void closeAllRequests(SHashObj *pRequests); // conn level int hbRegisterConn(SAppHbMgr* pAppHbMgr, int64_t tscRefId, int64_t clusterId, int8_t connType); diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 8e0556125ab5f6c73fcf3cfe92defd2f2e4e5d78..d150d68c8dc3a78d394263f95462fa29b05061ae 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -37,10 +37,12 @@ int32_t clientConnRefPool = -1; static TdThreadOnce tscinit = PTHREAD_ONCE_INIT; volatile int32_t tscInitRes = 0; -static void registerRequest(SRequestObj *pRequest) { - STscObj *pTscObj = acquireTscObj(*(int64_t *)pRequest->pTscObj->id); - - assert(pTscObj != NULL); +static int32_t registerRequest(SRequestObj *pRequest) { + STscObj *pTscObj = acquireTscObj(pRequest->pTscObj->id); + if (NULL == pTscObj) { + terrno = TSDB_CODE_TSC_DISCONNECTED; + return terrno; + } // connection has been released already, abort creating request. pRequest->self = taosAddRef(clientReqRefPool, pRequest); @@ -54,8 +56,10 @@ static void registerRequest(SRequestObj *pRequest) { int32_t currentInst = atomic_add_fetch_64((int64_t *)&pSummary->currentRequests, 1); tscDebug("0x%" PRIx64 " new Request from connObj:0x%" PRIx64 ", current:%d, app current:%d, total:%d, reqId:0x%" PRIx64, - pRequest->self, *(int64_t *)pRequest->pTscObj->id, num, currentInst, total, pRequest->requestId); + pRequest->self, pRequest->pTscObj->id, num, currentInst, total, pRequest->requestId); } + + return TSDB_CODE_SUCCESS; } static void deregisterRequest(SRequestObj *pRequest) { @@ -70,26 +74,23 @@ static void deregisterRequest(SRequestObj *pRequest) { int64_t duration = taosGetTimestampUs() - pRequest->metric.start; tscDebug("0x%" PRIx64 " free Request from connObj: 0x%" PRIx64 ", reqId:0x%" PRIx64 " elapsed:%" PRIu64 " ms, current:%d, app current:%d", - pRequest->self, *(int64_t *)pTscObj->id, pRequest->requestId, duration / 1000, num, currentInst); - releaseTscObj(*(int64_t *)pTscObj->id); + pRequest->self, pTscObj->id, pRequest->requestId, duration / 1000, num, currentInst); + releaseTscObj(pTscObj->id); } // todo close the transporter properly -void closeTransporter(STscObj *pTscObj) { - if (pTscObj == NULL || pTscObj->pAppInfo->pTransporter == NULL) { +void closeTransporter(SAppInstInfo *pAppInfo) { + if (pAppInfo == NULL || pAppInfo->pTransporter == NULL) { return; } - tscDebug("free transporter:%p in connObj: 0x%" PRIx64, pTscObj->pAppInfo->pTransporter, *(int64_t *)pTscObj->id); - rpcClose(pTscObj->pAppInfo->pTransporter); + tscDebug("free transporter:%p in app inst %p", pAppInfo->pTransporter, pAppInfo); + rpcClose(pAppInfo->pTransporter); } static bool clientRpcRfp(int32_t code, tmsg_t msgType) { if (code == TSDB_CODE_RPC_REDIRECT || code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_NODE_NOT_DEPLOYED || code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_APP_NOT_READY) { - if (msgType == TDMT_VND_QUERY || msgType == TDMT_VND_FETCH) { - return false; - } return true; } else { return false; @@ -123,26 +124,46 @@ void closeAllRequests(SHashObj *pRequests) { while (pIter != NULL) { int64_t *rid = pIter; - releaseRequest(*rid); + removeRequest(*rid); pIter = taosHashIterate(pRequests, pIter); } } +void destroyAppInst(SAppInstInfo *pAppInfo) { + tscDebug("destroy app inst mgr %p", pAppInfo); + + taosThreadMutexLock(&appInfo.mutex); + + hbRemoveAppHbMrg(&pAppInfo->pAppHbMgr); + taosHashRemove(appInfo.pInstMap, pAppInfo->instKey, strlen(pAppInfo->instKey)); + + taosThreadMutexUnlock(&appInfo.mutex); + + taosMemoryFreeClear(pAppInfo->instKey); + closeTransporter(pAppInfo); + + taosThreadMutexLock(&pAppInfo->qnodeMutex); + taosArrayDestroy(pAppInfo->pQnodeList); + taosThreadMutexUnlock(&pAppInfo->qnodeMutex); + + taosMemoryFree(pAppInfo); +} + void destroyTscObj(void *pObj) { STscObj *pTscObj = pObj; - SClientHbKey connKey = {.tscRid = *(int64_t *)pTscObj->id, .connType = pTscObj->connType}; + SClientHbKey connKey = {.tscRid = pTscObj->id, .connType = pTscObj->connType}; hbDeregisterConn(pTscObj->pAppInfo->pAppHbMgr, connKey); int64_t connNum = atomic_sub_fetch_64(&pTscObj->pAppInfo->numOfConns, 1); closeAllRequests(pTscObj->pRequests); schedulerStopQueryHb(pTscObj->pAppInfo->pTransporter); + tscDebug("connObj 0x%" PRIx64 " p:%p destroyed, remain inst totalConn:%" PRId64, pTscObj->id, pTscObj, + pTscObj->pAppInfo->numOfConns); + if (0 == connNum) { - // TODO - // closeTransporter(pTscObj); + destroyAppInst(pTscObj->pAppInfo); } - tscDebug("connObj 0x%" PRIx64 " destroyed, totalConn:%" PRId64, *(int64_t *)pTscObj->id, - pTscObj->pAppInfo->numOfConns); taosThreadMutexDestroy(&pTscObj->mutex); taosMemoryFreeClear(pTscObj); } @@ -171,11 +192,12 @@ void *createTscObj(const char *user, const char *auth, const char *db, int32_t c } taosThreadMutexInit(&pObj->mutex, NULL); - pObj->id = taosMemoryMalloc(sizeof(int64_t)); - *(int64_t *)pObj->id = taosAddRef(clientConnRefPool, pObj); + pObj->id = taosAddRef(clientConnRefPool, pObj); pObj->schemalessType = 1; - tscDebug("connObj created, 0x%" PRIx64, *(int64_t *)pObj->id); + atomic_add_fetch_64(&pObj->pAppInfo->numOfConns, 1); + + tscDebug("connObj created, 0x%" PRIx64 ",p:%p", pObj->id, pObj); return pObj; } @@ -205,7 +227,10 @@ void *createRequest(STscObj *pObj, int32_t type) { pRequest->msgBufLen = ERROR_MSG_BUF_DEFAULT_SIZE; tsem_init(&pRequest->body.rspSem, 0, 0); - registerRequest(pRequest); + if (registerRequest(pRequest)) { + doDestroyRequest(pRequest); + return NULL; + } return pRequest; } @@ -227,12 +252,16 @@ void doFreeReqResultInfo(SReqResultInfo *pResInfo) { } } -static void doDestroyRequest(void *p) { +SRequestObj *acquireRequest(int64_t rid) { return (SRequestObj *)taosAcquireRef(clientReqRefPool, rid); } + +int32_t releaseRequest(int64_t rid) { return taosReleaseRef(clientReqRefPool, rid); } + +int32_t removeRequest(int64_t rid) { return taosRemoveRef(clientReqRefPool, rid); } + +void doDestroyRequest(void *p) { assert(p != NULL); SRequestObj *pRequest = (SRequestObj *)p; - assert(RID_VALID(pRequest->self)); - taosHashRemove(pRequest->pTscObj->pRequests, &pRequest->self, sizeof(pRequest->self)); if (pRequest->body.queryJob != 0) { @@ -244,14 +273,15 @@ static void doDestroyRequest(void *p) { taosMemoryFreeClear(pRequest->pDb); doFreeReqResultInfo(&pRequest->body.resInfo); - qDestroyQueryPlan(pRequest->body.pDag); taosArrayDestroy(pRequest->tableList); taosArrayDestroy(pRequest->dbList); destroyQueryExecRes(&pRequest->body.resInfo.execRes); - deregisterRequest(pRequest); + if (pRequest->self) { + deregisterRequest(pRequest); + } taosMemoryFreeClear(pRequest); } @@ -260,13 +290,9 @@ void destroyRequest(SRequestObj *pRequest) { return; } - taosRemoveRef(clientReqRefPool, pRequest->self); + removeRequest(pRequest->self); } -SRequestObj *acquireRequest(int64_t rid) { return (SRequestObj *)taosAcquireRef(clientReqRefPool, rid); } - -int32_t releaseRequest(int64_t rid) { return taosReleaseRef(clientReqRefPool, rid); } - void taos_init_imp(void) { // In the APIs of other program language, taos_cleanup is not available yet. // So, to make sure taos_cleanup will be invoked to clean up the allocated resource to suppress the valgrind warning. diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index 86562fea9787eae90de5c72ee247d377761fd626..2de630e181137f569e4e7e6b84a8ce4efddffdbc 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -66,25 +66,31 @@ static int32_t hbProcessDBInfoRsp(void *value, int32_t valueLen, struct SCatalog if (rsp->vgVersion < 0) { code = catalogRemoveDB(pCatalog, rsp->db, rsp->uid); } else { - SDBVgInfo vgInfo = {0}; - vgInfo.vgVersion = rsp->vgVersion; - vgInfo.hashMethod = rsp->hashMethod; - vgInfo.vgHash = taosHashInit(rsp->vgNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_ENTRY_LOCK); - if (NULL == vgInfo.vgHash) { + SDBVgInfo *vgInfo = taosMemoryCalloc(1, sizeof(SDBVgInfo)); + if (NULL == vgInfo) { + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + + vgInfo->vgVersion = rsp->vgVersion; + vgInfo->hashMethod = rsp->hashMethod; + vgInfo->vgHash = taosHashInit(rsp->vgNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_ENTRY_LOCK); + if (NULL == vgInfo->vgHash) { + taosMemoryFree(vgInfo); tscError("hash init[%d] failed", rsp->vgNum); return TSDB_CODE_TSC_OUT_OF_MEMORY; } for (int32_t j = 0; j < rsp->vgNum; ++j) { SVgroupInfo *pInfo = taosArrayGet(rsp->pVgroupInfos, j); - if (taosHashPut(vgInfo.vgHash, &pInfo->vgId, sizeof(int32_t), pInfo, sizeof(SVgroupInfo)) != 0) { + if (taosHashPut(vgInfo->vgHash, &pInfo->vgId, sizeof(int32_t), pInfo, sizeof(SVgroupInfo)) != 0) { tscError("hash push failed, errno:%d", errno); - taosHashCleanup(vgInfo.vgHash); + taosHashCleanup(vgInfo->vgHash); + taosMemoryFree(vgInfo); return TSDB_CODE_TSC_OUT_OF_MEMORY; } } - catalogUpdateDBVgInfo(pCatalog, rsp->db, rsp->uid, &vgInfo); + catalogUpdateDBVgInfo(pCatalog, rsp->db, rsp->uid, vgInfo); } if (code) { @@ -269,8 +275,11 @@ static int32_t hbAsyncCallBack(void *param, const SDataBuf *pMsg, int32_t code) int32_t rspNum = taosArrayGetSize(pRsp.rsps); + taosThreadMutexLock(&appInfo.mutex); + SAppInstInfo **pInst = taosHashGet(appInfo.pInstMap, key, strlen(key)); if (pInst == NULL || NULL == *pInst) { + taosThreadMutexUnlock(&appInfo.mutex); tscError("cluster not exist, key:%s", key); taosMemoryFreeClear(param); tFreeClientHbBatchRsp(&pRsp); @@ -294,6 +303,8 @@ static int32_t hbAsyncCallBack(void *param, const SDataBuf *pMsg, int32_t code) } } + taosThreadMutexUnlock(&appInfo.mutex); + tFreeClientHbBatchRsp(&pRsp); return code; @@ -320,7 +331,7 @@ int32_t hbBuildQueryDesc(SQueryHbReqBasic *hbBasic, STscObj *pObj) { desc.reqRid = pRequest->self; desc.stableQuery = pRequest->stableQuery; taosGetFqdn(desc.fqdn); - desc.subPlanNum = pRequest->body.pDag ? pRequest->body.pDag->numOfSubplans : 0; + desc.subPlanNum = pRequest->body.subplanNum; if (desc.subPlanNum) { desc.subDesc = taosArrayInit(desc.subPlanNum, sizeof(SQuerySubDesc)); @@ -790,22 +801,40 @@ SAppHbMgr *appHbMgrInit(SAppInstInfo *pAppInstInfo, char *key) { return pAppHbMgr; } +void hbFreeAppHbMgr(SAppHbMgr *pTarget) { + void *pIter = taosHashIterate(pTarget->activeInfo, NULL); + while (pIter != NULL) { + SClientHbReq *pOneReq = pIter; + tFreeClientHbReq(pOneReq); + pIter = taosHashIterate(pTarget->activeInfo, pIter); + } + taosHashCleanup(pTarget->activeInfo); + pTarget->activeInfo = NULL; + + taosMemoryFree(pTarget->key); + taosMemoryFree(pTarget); +} + +void hbRemoveAppHbMrg(SAppHbMgr **pAppHbMgr) { + taosThreadMutexLock(&clientHbMgr.lock); + int32_t mgrSize = taosArrayGetSize(clientHbMgr.appHbMgrs); + for (int32_t i = 0; i < mgrSize; ++i) { + SAppHbMgr *pItem = taosArrayGetP(clientHbMgr.appHbMgrs, i); + if (pItem == *pAppHbMgr) { + hbFreeAppHbMgr(*pAppHbMgr); + *pAppHbMgr = NULL; + taosArrayRemove(clientHbMgr.appHbMgrs, i); + break; + } + } + taosThreadMutexUnlock(&clientHbMgr.lock); +} + void appHbMgrCleanup(void) { int sz = taosArrayGetSize(clientHbMgr.appHbMgrs); for (int i = 0; i < sz; i++) { SAppHbMgr *pTarget = taosArrayGetP(clientHbMgr.appHbMgrs, i); - - void *pIter = taosHashIterate(pTarget->activeInfo, NULL); - while (pIter != NULL) { - SClientHbReq *pOneReq = pIter; - tFreeClientHbReq(pOneReq); - pIter = taosHashIterate(pTarget->activeInfo, pIter); - } - taosHashCleanup(pTarget->activeInfo); - pTarget->activeInfo = NULL; - - taosMemoryFree(pTarget->key); - taosMemoryFree(pTarget); + hbFreeAppHbMgr(pTarget); } } diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 489966b6369f6100f3867cb8f613e09f42062134..09fb73cfbaf4a67d379ab1b4f6b1fa6af52960b8 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -55,6 +55,18 @@ static char* getClusterKey(const char* user, const char* auth, const char* ip, i return strdup(key); } +bool chkRequestKilled(void* param) { + bool killed = false; + SRequestObj* pRequest = acquireRequest((int64_t)param); + if (NULL == pRequest || pRequest->killed) { + killed = true; + } + + releaseRequest((int64_t)param); + + return killed; +} + static STscObj* taosConnectImpl(const char* user, const char* auth, const char* db, __taos_async_fn_t fp, void* param, SAppInstInfo* pAppInfo, int connType); @@ -122,6 +134,9 @@ STscObj* taos_connect_internal(const char* ip, const char* user, const char* pas p->pTransporter = openTransporter(user, secretEncrypt, tsNumOfCores); p->pAppHbMgr = appHbMgrInit(p, key); taosHashPut(appInfo.pInstMap, key, strlen(key), &p, POINTER_BYTES); + p->instKey = key; + key = NULL; + tscDebug("new app inst mgr %p, user:%s, ip:%s, port:%d", p, user, ip, port); pInst = &p; } @@ -609,58 +624,6 @@ _return: return code; } -int32_t scheduleAsyncQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList) { - tsem_init(&schdRspSem, 0, 0); - - SQueryResult res = {.code = 0, .numOfRows = 0}; - SRequestConnInfo conn = {.pTrans = pRequest->pTscObj->pAppInfo->pTransporter, - .requestId = pRequest->requestId, - .requestObjRefId = pRequest->self}; - SSchedulerReq req = {.pConn = &conn, - .pNodeList = pNodeList, - .pDag = pDag, - .sql = pRequest->sqlstr, - .startTs = pRequest->metric.start, - .fp = schdExecCallback, - .cbParam = &res}; - - int32_t code = schedulerAsyncExecJob(&req, &pRequest->body.queryJob); - - pRequest->body.resInfo.execRes = res.res; - - while (true) { - if (code != TSDB_CODE_SUCCESS) { - if (pRequest->body.queryJob != 0) { - schedulerFreeJob(pRequest->body.queryJob, 0); - } - - pRequest->code = code; - terrno = code; - return pRequest->code; - } else { - tsem_wait(&schdRspSem); - - if (res.code) { - code = res.code; - } else { - break; - } - } - } - - if (TDMT_VND_SUBMIT == pRequest->type || TDMT_VND_CREATE_TABLE == pRequest->type) { - pRequest->body.resInfo.numOfRows = res.numOfRows; - - if (pRequest->body.queryJob != 0) { - schedulerFreeJob(pRequest->body.queryJob, 0); - } - } - - pRequest->code = res.code; - terrno = res.code; - return pRequest->code; -} - int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList) { void* pTransporter = pRequest->pTscObj->pAppInfo->pTransporter; @@ -669,13 +632,14 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList .requestId = pRequest->requestId, .requestObjRefId = pRequest->self}; SSchedulerReq req = {.pConn = &conn, - .pNodeList = pNodeList, - .pDag = pDag, - .sql = pRequest->sqlstr, - .startTs = pRequest->metric.start, - .fp = NULL, - .cbParam = NULL, - .reqKilled = &pRequest->killed}; + .pNodeList = pNodeList, + .pDag = pDag, + .sql = pRequest->sqlstr, + .startTs = pRequest->metric.start, + .execFp = NULL, + .execParam = NULL, + .chkKillFp = chkRequestKilled, + .chkKillParam = (void*)pRequest->self}; int32_t code = schedulerExecJob(&req, &pRequest->body.queryJob, &res); pRequest->body.resInfo.execRes = res.res; @@ -874,14 +838,18 @@ SRequestObj* launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, bool keepQue } break; case QUERY_EXEC_MODE_SCHEDULE: { - SArray* pMnodeList = taosArrayInit(4, sizeof(SQueryNodeLoad)); - code = getPlan(pRequest, pQuery, &pRequest->body.pDag, pMnodeList); - if (TSDB_CODE_SUCCESS == code && !pRequest->validateOnly) { - SArray* pNodeList = NULL; - buildSyncExecNodeList(pRequest, &pNodeList, pMnodeList); - - code = scheduleQuery(pRequest, pRequest->body.pDag, pNodeList); - taosArrayDestroy(pNodeList); + SArray* pMnodeList = taosArrayInit(4, sizeof(SQueryNodeLoad)); + SQueryPlan* pDag = NULL; + code = getPlan(pRequest, pQuery, &pDag, pMnodeList); + if (TSDB_CODE_SUCCESS == code) { + pRequest->body.subplanNum = pDag->numOfSubplans; + if (!pRequest->validateOnly) { + SArray* pNodeList = NULL; + buildSyncExecNodeList(pRequest, &pNodeList, pMnodeList); + + code = scheduleQuery(pRequest, pDag, pNodeList); + taosArrayDestroy(pNodeList); + } } taosArrayDestroy(pMnodeList); break; @@ -959,10 +927,13 @@ void launchAsyncQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaData* pResultM .pUser = pRequest->pTscObj->user}; SAppInstInfo* pAppInfo = getAppInfo(pRequest); - code = qCreateQueryPlan(&cxt, &pRequest->body.pDag, pMnodeList); + SQueryPlan* pDag = NULL; + code = qCreateQueryPlan(&cxt, &pDag, pMnodeList); if (code) { tscError("0x%" PRIx64 " failed to create query plan, code:%s 0x%" PRIx64, pRequest->self, tstrerror(code), pRequest->requestId); + } else { + pRequest->body.subplanNum = pDag->numOfSubplans; } if (TSDB_CODE_SUCCESS == code && !pRequest->validateOnly) { @@ -973,12 +944,13 @@ void launchAsyncQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaData* pResultM .pTrans = pAppInfo->pTransporter, .requestId = pRequest->requestId, .requestObjRefId = pRequest->self}; SSchedulerReq req = {.pConn = &conn, .pNodeList = pNodeList, - .pDag = pRequest->body.pDag, + .pDag = pDag, .sql = pRequest->sqlstr, .startTs = pRequest->metric.start, - .fp = schedulerExecCb, - .cbParam = pRequest, - .reqKilled = &pRequest->killed}; + .execFp = schedulerExecCb, + .execParam = pRequest, + .chkKillFp = chkRequestKilled, + .chkKillParam = (void*)pRequest->self}; code = schedulerAsyncExecJob(&req, &pRequest->body.queryJob); taosArrayDestroy(pNodeList); } else { @@ -1163,7 +1135,7 @@ STscObj* taosConnectImpl(const char* user, const char* auth, const char* db, __t taos_close_internal(pTscObj); pTscObj = NULL; } else { - tscDebug("0x%" PRIx64 " connection is opening, connId:%u, dnodeConn:%p, reqId:0x%" PRIx64, *(int64_t*)pTscObj->id, + tscDebug("0x%" PRIx64 " connection is opening, connId:%u, dnodeConn:%p, reqId:0x%" PRIx64, pTscObj->id, pTscObj->connId, pTscObj->pAppInfo->pTransporter, pRequest->requestId); destroyRequest(pRequest); } @@ -1326,7 +1298,9 @@ TAOS* taos_connect_auth(const char* ip, const char* user, const char* auth, cons STscObj* pObj = taos_connect_internal(ip, user, NULL, auth, db, port, CONN_TYPE__QUERY); if (pObj) { - return pObj->id; + int64_t* rid = taosMemoryCalloc(1, sizeof(int64_t)); + *rid = pObj->id; + return (TAOS*)rid; } return NULL; @@ -2001,17 +1975,26 @@ void syncCatalogFn(SMetaData* pResult, void* param, int32_t code) { void syncQueryFn(void* param, void* res, int32_t code) { SSyncQueryParam* pParam = param; pParam->pRequest = res; - pParam->pRequest->code = code; + if (pParam->pRequest) { + pParam->pRequest->code = code; + } tsem_post(&pParam->sem); } void taosAsyncQueryImpl(TAOS* taos, const char* sql, __taos_async_fn_t fp, void* param, bool validateOnly) { - STscObj* pTscObj = acquireTscObj(*(int64_t*)taos); + if (NULL == taos) { + terrno = TSDB_CODE_TSC_DISCONNECTED; + fp(param, NULL, terrno); + return; + } + + int64_t rid = *(int64_t*)taos; + STscObj* pTscObj = acquireTscObj(rid); if (pTscObj == NULL || sql == NULL || NULL == fp) { terrno = TSDB_CODE_INVALID_PARA; if (pTscObj) { - releaseTscObj(*(int64_t*)taos); + releaseTscObj(rid); } else { terrno = TSDB_CODE_TSC_DISCONNECTED; } @@ -2023,6 +2006,7 @@ void taosAsyncQueryImpl(TAOS* taos, const char* sql, __taos_async_fn_t fp, void* if (sqlLen > (size_t)TSDB_MAX_ALLOWED_SQL_LEN) { tscError("sql string exceeds max length:%d", TSDB_MAX_ALLOWED_SQL_LEN); terrno = TSDB_CODE_TSC_EXCEED_SQL_LIMIT; + releaseTscObj(rid); fp(param, NULL, terrno); return; @@ -2032,6 +2016,7 @@ void taosAsyncQueryImpl(TAOS* taos, const char* sql, __taos_async_fn_t fp, void* int32_t code = buildRequest(pTscObj, sql, sqlLen, &pRequest); if (code != TSDB_CODE_SUCCESS) { terrno = code; + releaseTscObj(rid); fp(param, NULL, terrno); return; } @@ -2040,6 +2025,7 @@ void taosAsyncQueryImpl(TAOS* taos, const char* sql, __taos_async_fn_t fp, void* pRequest->body.queryFp = fp; pRequest->body.param = param; doAsyncQuery(pRequest, false); + releaseTscObj(rid); } TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly) { @@ -2048,7 +2034,8 @@ TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly) { return NULL; } - STscObj* pTscObj = acquireTscObj(*(int64_t*)taos); + int64_t rid = *(int64_t*)taos; + STscObj* pTscObj = acquireTscObj(rid); if (pTscObj == NULL || sql == NULL) { terrno = TSDB_CODE_TSC_DISCONNECTED; return NULL; @@ -2058,16 +2045,16 @@ TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly) { SSyncQueryParam* param = taosMemoryCalloc(1, sizeof(SSyncQueryParam)); tsem_init(¶m->sem, 0, 0); - taosAsyncQueryImpl(taos, sql, syncQueryFn, param, validateOnly); + taosAsyncQueryImpl((TAOS*)&rid, sql, syncQueryFn, param, validateOnly); tsem_wait(¶m->sem); - releaseTscObj(*(int64_t*)taos); + releaseTscObj(rid); return param->pRequest; #else size_t sqlLen = strlen(sql); if (sqlLen > (size_t)TSDB_MAX_ALLOWED_SQL_LEN) { - releaseTscObj(*(int64_t*)taos); + releaseTscObj(rid); tscError("sql string exceeds max length:%d", TSDB_MAX_ALLOWED_SQL_LEN); terrno = TSDB_CODE_TSC_EXCEED_SQL_LIMIT; return NULL; @@ -2075,7 +2062,7 @@ TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly) { TAOS_RES* pRes = execQuery(pTscObj, sql, sqlLen, validateOnly); - releaseTscObj(*(int64_t*)taos); + releaseTscObj(rid); return pRes; #endif diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 90df3eb31a767453ca625fd52e2453a11c6aac6a..d8a9ce581a656934d50359ce9c19f82ddbeb6fdf 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -106,7 +106,9 @@ TAOS *taos_connect(const char *ip, const char *user, const char *pass, const cha STscObj *pObj = taos_connect_internal(ip, user, pass, NULL, db, port, CONN_TYPE__QUERY); if (pObj) { - return pObj->id; + int64_t *rid = taosMemoryCalloc(1, sizeof(int64_t)); + *rid = pObj->id; + return (TAOS*)rid; } return NULL; @@ -118,9 +120,9 @@ void taos_close_internal(void *taos) { } STscObj *pTscObj = (STscObj *)taos; - tscDebug("0x%" PRIx64 " try to close connection, numOfReq:%d", *(int64_t *)pTscObj->id, pTscObj->numOfReqs); + tscDebug("0x%" PRIx64 " try to close connection, numOfReq:%d", pTscObj->id, pTscObj->numOfReqs); - taosRemoveRef(clientConnRefPool, *(int64_t *)pTscObj->id); + taosRemoveRef(clientConnRefPool, pTscObj->id); } void taos_close(TAOS *taos) { @@ -190,6 +192,17 @@ void taos_free_result(TAOS_RES *res) { } } +void taos_kill_query(TAOS *taos) { + if (NULL == taos) { + return; + } + int64_t rid = *(int64_t*)taos; + + STscObj* pTscObj = acquireTscObj(rid); + closeAllRequests(pTscObj->pRequests); + releaseTscObj(rid); +} + int taos_field_count(TAOS_RES *res) { if (res == NULL || TD_RES_TMQ_META(res)) { return 0; @@ -725,6 +738,8 @@ int32_t createParseContext(const SRequestObj *pRequest, SParseContext **pCxt) { .schemalessType = pTscObj->schemalessType, .isSuperUser = (0 == strcmp(pTscObj->user, TSDB_DEFAULT_USER)), .async = true, + .svrVer = pTscObj->sVer, + .nodeOffline = (pTscObj->pAppInfo->onlineDnodes < pTscObj->pAppInfo->totalDnodes) }; return TSDB_CODE_SUCCESS; } @@ -891,6 +906,12 @@ void taos_unsubscribe(TAOS_SUB *tsub, int keepProgress) { } int taos_load_table_info(TAOS *taos, const char *tableNameList) { + if (NULL == taos) { + terrno = TSDB_CODE_TSC_DISCONNECTED; + return terrno; + } + + int64_t rid = *(int64_t*)taos; const int32_t MAX_TABLE_NAME_LENGTH = 12 * 1024 * 1024; // 12MB list int32_t code = 0; SRequestObj *pRequest = NULL; @@ -908,7 +929,7 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) { return TSDB_CODE_TSC_INVALID_OPERATION; } - STscObj *pTscObj = acquireTscObj(*(int64_t *)taos); + STscObj *pTscObj = acquireTscObj(rid); if (pTscObj == NULL) { terrno = TSDB_CODE_TSC_DISCONNECTED; return terrno; @@ -953,7 +974,7 @@ _return: taosArrayDestroy(catalogReq.pTableMeta); destroyRequest(pRequest); - releaseTscObj(*(int64_t *)taos); + releaseTscObj(rid); return code; } diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c index 94bd07a18a088f21bd5f71c6b1a7a62fab2a8918..e2b558e61f285854e11a78d32edd066cae3490c4 100644 --- a/source/client/src/clientMsgHandler.c +++ b/source/client/src/clientMsgHandler.c @@ -77,7 +77,7 @@ int32_t processConnectRsp(void* param, const SDataBuf* pMsg, int32_t code) { for (int32_t i = 0; i < connectRsp.epSet.numOfEps; ++i) { tscDebug("0x%" PRIx64 " epSet.fqdn[%d]:%s port:%d, connObj:0x%" PRIx64, pRequest->requestId, i, - connectRsp.epSet.eps[i].fqdn, connectRsp.epSet.eps[i].port, *(int64_t*)pTscObj->id); + connectRsp.epSet.eps[i].fqdn, connectRsp.epSet.eps[i].port, pTscObj->id); } pTscObj->connId = connectRsp.connId; @@ -87,11 +87,10 @@ int32_t processConnectRsp(void* param, const SDataBuf* pMsg, int32_t code) { // update the appInstInfo pTscObj->pAppInfo->clusterId = connectRsp.clusterId; - atomic_add_fetch_64(&pTscObj->pAppInfo->numOfConns, 1); pTscObj->connType = connectRsp.connType; - hbRegisterConn(pTscObj->pAppInfo->pAppHbMgr, *(int64_t*)pTscObj->id, connectRsp.clusterId, connectRsp.connType); + hbRegisterConn(pTscObj->pAppInfo->pAppHbMgr, pTscObj->id, connectRsp.clusterId, connectRsp.connType); // pRequest->body.resInfo.pRspMsg = pMsg->pData; tscDebug("0x%" PRIx64 " clusterId:%" PRId64 ", totalConn:%" PRId64, pRequest->requestId, connectRsp.clusterId, diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 7d2bf019d2f7a35aad42aaa6ae3405f89b26d5ce..1cb0e2d54bd184406cacac52d106bfdf8f5f2368 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -309,7 +309,7 @@ static int32_t smlApplySchemaAction(SSmlHandle *info, SSchemaAction *action) { case SCHEMA_ACTION_ADD_COLUMN: { int n = sprintf(result, "alter stable `%s` add column ", action->alterSTable.sTableName); smlBuildColumnDescription(action->alterSTable.field, result + n, capacity - n, &outBytes); - TAOS_RES *res = taos_query(info->taos->id, result); // TODO async doAsyncQuery + TAOS_RES *res = taos_query((TAOS*)&info->taos->id, result); // TODO async doAsyncQuery code = taos_errno(res); const char *errStr = taos_errstr(res); if (code != TSDB_CODE_SUCCESS) { @@ -323,7 +323,7 @@ static int32_t smlApplySchemaAction(SSmlHandle *info, SSchemaAction *action) { case SCHEMA_ACTION_ADD_TAG: { int n = sprintf(result, "alter stable `%s` add tag ", action->alterSTable.sTableName); smlBuildColumnDescription(action->alterSTable.field, result + n, capacity - n, &outBytes); - TAOS_RES *res = taos_query(info->taos->id, result); // TODO async doAsyncQuery + TAOS_RES *res = taos_query((TAOS*)&info->taos->id, result); // TODO async doAsyncQuery code = taos_errno(res); const char *errStr = taos_errstr(res); if (code != TSDB_CODE_SUCCESS) { @@ -337,7 +337,7 @@ static int32_t smlApplySchemaAction(SSmlHandle *info, SSchemaAction *action) { case SCHEMA_ACTION_CHANGE_COLUMN_SIZE: { int n = sprintf(result, "alter stable `%s` modify column ", action->alterSTable.sTableName); smlBuildColumnDescription(action->alterSTable.field, result + n, capacity - n, &outBytes); - TAOS_RES *res = taos_query(info->taos->id, result); // TODO async doAsyncQuery + TAOS_RES *res = taos_query((TAOS*)&info->taos->id, result); // TODO async doAsyncQuery code = taos_errno(res); if (code != TSDB_CODE_SUCCESS) { uError("SML:0x%" PRIx64 " apply schema action. error : %s", info->id, taos_errstr(res)); @@ -350,7 +350,7 @@ static int32_t smlApplySchemaAction(SSmlHandle *info, SSchemaAction *action) { case SCHEMA_ACTION_CHANGE_TAG_SIZE: { int n = sprintf(result, "alter stable `%s` modify tag ", action->alterSTable.sTableName); smlBuildColumnDescription(action->alterSTable.field, result + n, capacity - n, &outBytes); - TAOS_RES *res = taos_query(info->taos->id, result); // TODO async doAsyncQuery + TAOS_RES *res = taos_query((TAOS*)&info->taos->id, result); // TODO async doAsyncQuery code = taos_errno(res); if (code != TSDB_CODE_SUCCESS) { uError("SML:0x%" PRIx64 " apply schema action. error : %s", info->id, taos_errstr(res)); @@ -405,7 +405,7 @@ static int32_t smlApplySchemaAction(SSmlHandle *info, SSchemaAction *action) { pos--; ++freeBytes; outBytes = snprintf(pos, freeBytes, ")"); - TAOS_RES *res = taos_query(info->taos->id, result); + TAOS_RES *res = taos_query((TAOS*)&info->taos->id, result); code = taos_errno(res); if (code != TSDB_CODE_SUCCESS) { uError("SML:0x%" PRIx64 " apply schema action. error : %s", info->id, taos_errstr(res)); @@ -2436,7 +2436,13 @@ static void smlInsertCallback(void *param, void *res, int32_t code) { */ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int protocol, int precision) { - STscObj* pTscObj = acquireTscObj(*(int64_t*)taos); + if (NULL == taos) { + terrno = TSDB_CODE_TSC_DISCONNECTED; + return NULL; + } + + int64_t rid = *(int64_t*)taos; + STscObj* pTscObj = acquireTscObj(rid); if (NULL == pTscObj) { terrno = TSDB_CODE_TSC_DISCONNECTED; uError("SML:taos_schemaless_insert invalid taos"); @@ -2445,7 +2451,7 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr SRequestObj* request = (SRequestObj*)createRequest(pTscObj, TSDB_SQL_INSERT); if(!request){ - releaseTscObj(*(int64_t*)taos); + releaseTscObj(rid); uError("SML:taos_schemaless_insert error request is null"); return NULL; } @@ -2533,6 +2539,6 @@ end: // ((STscObj *)taos)->schemalessType = 0; pTscObj->schemalessType = 1; uDebug("resultend:%s", request->msgBuf); - releaseTscObj(*(int64_t*)taos); + releaseTscObj(rid); return (TAOS_RES*)request; } diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index dd9500e8d8d05a84875e8913f45ec211d4bc0187..7b142e3053663d5189ae16e79da20fd50b478f49 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -1663,8 +1663,8 @@ char* dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** pDataBuf) int32_t colNum = taosArrayGetSize(pDataBlock->pDataBlock); int32_t rows = pDataBlock->info.rows; int32_t len = 0; - len += snprintf(dumpBuf + len, size - len, "\n%s |block type %d |child id %d|\n", flag, - (int32_t)pDataBlock->info.type, pDataBlock->info.childId); + len += snprintf(dumpBuf + len, size - len, "\n%s |block type %d |child id %d|group id %lu|\n", flag, + (int32_t)pDataBlock->info.type, pDataBlock->info.childId, pDataBlock->info.groupId); for (int32_t j = 0; j < rows; j++) { len += snprintf(dumpBuf + len, size - len, "%s |", flag); for (int32_t k = 0; k < colNum; k++) { diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 8c1daae3fac228a69856ec86e4b7898ccb6713cf..78eccdf0cd6d3a6910383628fe84451ab70d4518 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -621,8 +621,8 @@ int32_t tDeserializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pR if (NULL == pReq->pFuncs) return -1; } for (int32_t i = 0; i < numOfFuncs; ++i) { - char *pFunc = NULL; - if (tDecodeCStrAlloc(&decoder, &pFunc) < 0) return -1; + char pFunc[TSDB_FUNC_NAME_LEN] = {0}; + if (tDecodeCStrTo(&decoder, pFunc) < 0) return -1; if (taosArrayPush(pReq->pFuncs, pFunc) == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; return -1; diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c index 5e1ef23f1c7819d524f99e72485e942a13ee9ecc..91ef292360b860301862dbeafc3926e061eb4e22 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c @@ -107,13 +107,7 @@ static void vmProcessSyncQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOf const STraceId *trace = &pMsg->info.traceId; dGTrace("vgId:%d, msg:%p get from vnode-sync queue", pVnode->vgId, pMsg); - int32_t code = vnodeProcessSyncReq(pVnode->pImpl, pMsg, NULL); - if (code != 0) { - if (terrno != 0) code = terrno; - dGError("vgId:%d, msg:%p failed to sync since %s", pVnode->vgId, pMsg, terrstr()); - vmSendRsp(pMsg, code); - } - + int32_t code = vnodeProcessSyncReq(pVnode->pImpl, pMsg, NULL); // no response here dGTrace("vgId:%d, msg:%p is freed, code:0x%x", pVnode->vgId, pMsg, code); rpcFreeCont(pMsg->pCont); taosFreeQitem(pMsg); diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c index 7e31cc3144838e17a6fdba04a8a8034557f49541..1c5d74bb947391c9b42a7c65973df6f750c0280e 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c +++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c @@ -251,9 +251,6 @@ static inline void dmReleaseHandle(SRpcHandleInfo *pHandle, int8_t type) { static bool rpcRfp(int32_t code, tmsg_t msgType) { if (code == TSDB_CODE_RPC_REDIRECT || code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_NODE_NOT_DEPLOYED || code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_APP_NOT_READY) { - if (msgType == TDMT_VND_QUERY || msgType == TDMT_VND_FETCH) { - return false; - } return true; } else { return false; @@ -264,7 +261,7 @@ int32_t dmInitClient(SDnode *pDnode) { SDnodeTrans *pTrans = &pDnode->trans; SRpcInit rpcInit = {0}; - rpcInit.label = "DND"; + rpcInit.label = "DND-C"; rpcInit.numOfThreads = 1; rpcInit.cfp = (RpcCfp)dmProcessRpcMsg; rpcInit.sessions = 1024; @@ -298,7 +295,7 @@ int32_t dmInitServer(SDnode *pDnode) { SRpcInit rpcInit = {0}; strncpy(rpcInit.localFqdn, tsLocalFqdn, strlen(tsLocalFqdn)); rpcInit.localPort = tsServerPort; - rpcInit.label = "DND"; + rpcInit.label = "DND-S"; rpcInit.numOfThreads = tsNumOfRpcThreads; rpcInit.cfp = (RpcCfp)dmProcessRpcMsg; rpcInit.sessions = tsMaxShellConns; diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index b66082dd98700dfea9e16102a9f9b0551c70ec39..fa9c8606bb9688643858598e68aa751d4876e6c4 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -15,7 +15,6 @@ #define _DEFAULT_SOURCE #include "mndAcct.h" -#include "mndPrivilege.h" #include "mndBnode.h" #include "mndCluster.h" #include "mndConsumer.h" @@ -27,6 +26,7 @@ #include "mndMnode.h" #include "mndOffset.h" #include "mndPerfSchema.h" +#include "mndPrivilege.h" #include "mndProfile.h" #include "mndQnode.h" #include "mndQuery.h" @@ -416,7 +416,7 @@ int32_t mndProcessSyncMsg(SRpcMsg *pMsg) { char *syncNodeStr = sync2SimpleStr(pMgmt->sync); static int64_t mndTick = 0; if (++mndTick % 10 == 1) { - mTrace("vgId:%d, sync heartbeat msg:%s, %s", syncGetVgId(pMgmt->sync), TMSG_INFO(pMsg->msgType), syncNodeStr); + mTrace("vgId:%d, sync trace msg:%s, %s", syncGetVgId(pMgmt->sync), TMSG_INFO(pMsg->msgType), syncNodeStr); } if (gRaftDetailLog) { char logBuf[512] = {0}; @@ -527,6 +527,11 @@ int32_t mndProcessSyncMsg(SRpcMsg *pMsg) { static int32_t mndCheckMnodeState(SRpcMsg *pMsg) { if (!IsReq(pMsg)) return 0; + if (pMsg->msgType == TDMT_VND_QUERY || pMsg->msgType == TDMT_VND_QUERY_CONTINUE || + pMsg->msgType == TDMT_VND_QUERY_HEARTBEAT || pMsg->msgType == TDMT_VND_FETCH || + pMsg->msgType == TDMT_VND_DROP_TASK) { + return 0; + } if (mndAcquireRpcRef(pMsg->info.node) == 0) return 0; if (pMsg->msgType == TDMT_MND_MQ_TIMER || pMsg->msgType == TDMT_MND_TELEM_TIMER || pMsg->msgType == TDMT_MND_TRANS_TIMER || pMsg->msgType == TDMT_MND_TTL_TIMER) { diff --git a/source/dnode/vnode/src/inc/sma.h b/source/dnode/vnode/src/inc/sma.h index 4b42ab526308f1aac34a5c9b4ad6de87ba60dd94..23ad70bad3020fd6fcef2e7ae384757e675c2e40 100644 --- a/source/dnode/vnode/src/inc/sma.h +++ b/source/dnode/vnode/src/inc/sma.h @@ -205,16 +205,16 @@ struct STFile { uint8_t state; }; -#define TD_FILE_F(tf) (&((tf)->f)) -#define TD_FILE_PFILE(tf) ((tf)->pFile) -#define TD_FILE_OPENED(tf) (TD_FILE_PFILE(tf) != NULL) -#define TD_FILE_FULL_NAME(tf) (TD_FILE_F(tf)->aname) -#define TD_FILE_REL_NAME(tf) (TD_FILE_F(tf)->rname) -#define TD_FILE_OPENED(tf) (TD_FILE_PFILE(tf) != NULL) -#define TD_FILE_CLOSED(tf) (!TD_FILE_OPENED(tf)) -#define TD_FILE_SET_CLOSED(f) (TD_FILE_PFILE(f) = NULL) -#define TD_FILE_SET_STATE(tf, s) ((tf)->state = (s)) -#define TD_FILE_DID(tf) (TD_FILE_F(tf)->did) +#define TD_TFILE_F(tf) (&((tf)->f)) +#define TD_TFILE_PFILE(tf) ((tf)->pFile) +#define TD_TFILE_OPENED(tf) (TD_TFILE_PFILE(tf) != NULL) +#define TD_TFILE_FULL_NAME(tf) (TD_TFILE_F(tf)->aname) +#define TD_TFILE_REL_NAME(tf) (TD_TFILE_F(tf)->rname) +#define TD_TFILE_OPENED(tf) (TD_TFILE_PFILE(tf) != NULL) +#define TD_TFILE_CLOSED(tf) (!TD_TFILE_OPENED(tf)) +#define TD_TFILE_SET_CLOSED(f) (TD_TFILE_PFILE(f) = NULL) +#define TD_TFILE_SET_STATE(tf, s) ((tf)->state = (s)) +#define TD_TFILE_DID(tf) (TD_TFILE_F(tf)->did) int32_t tdInitTFile(STFile *pTFile, STfs *pTfs, const char *fname); int32_t tdCreateTFile(STFile *pTFile, STfs *pTfs, bool updateHeader, int8_t fType); diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index 68ed6dde5142e67693924afd2cdc7fa57b4e984e..baead763ad46a48196ebf62c1e12f21d004e9511 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -64,6 +64,7 @@ typedef struct STsdbSnapshotReader STsdbSnapshotReader; #define VNODE_TQ_DIR "tq" #define VNODE_WAL_DIR "wal" #define VNODE_TSMA_DIR "tsma" +#define VNODE_RSMA_DIR "rsma" #define VNODE_RSMA0_DIR "tsdb" #define VNODE_RSMA1_DIR "rsma1" #define VNODE_RSMA2_DIR "rsma2" @@ -161,7 +162,6 @@ SSubmitReq* tdBlockToSubmit(const SArray* pBlocks, const STSchema* pSchema, bool // sma int32_t smaOpen(SVnode* pVnode); -int32_t smaClose(SSma* pSma); int32_t smaCloseEnv(SSma* pSma); int32_t smaCloseEx(SSma* pSma); diff --git a/source/dnode/vnode/src/sma/smaOpen.c b/source/dnode/vnode/src/sma/smaOpen.c index 88ed7426f7390d00d96d7559d1d7d3242142e00d..641b8c793433f683592a5031e0f17df0b56bb631 100644 --- a/source/dnode/vnode/src/sma/smaOpen.c +++ b/source/dnode/vnode/src/sma/smaOpen.c @@ -123,7 +123,7 @@ int32_t smaOpen(SVnode *pVnode) { } // restore the rsma -#if 0 +#if 1 if (rsmaRestore(pSma) < 0) { goto _err; } @@ -154,12 +154,6 @@ int32_t smaCloseEx(SSma *pSma) { return 0; } -int32_t smaClose(SSma *pSma) { - smaCloseEnv(pSma); - smaCloseEx(pSma); - return 0; -} - /** * @brief rsma env restore * diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c index e1e195f14cad8cf65c9d7ccdf233acba8b19b12b..a8c9ceb6311ef4aeae6572ce7c46a14ff3331b5a 100644 --- a/source/dnode/vnode/src/sma/smaRollup.c +++ b/source/dnode/vnode/src/sma/smaRollup.c @@ -17,11 +17,12 @@ #define RSMA_QTASKINFO_PERSIST_MS 7200000 #define RSMA_QTASKINFO_BUFSIZE 32768 +#define RSMA_QTASKINFO_HEAD_LEN (sizeof(int32_t) + sizeof(int8_t) + sizeof(int64_t)) // len + type + suid typedef enum { TD_QTASK_TMP_FILE = 0, TD_QTASK_CUR_FILE } TD_QTASK_FILE_T; static const char *tdQTaskInfoFname[] = {"qtaskinfo.t", "qtaskinfo"}; typedef struct SRSmaQTaskInfoItem SRSmaQTaskInfoItem; -typedef struct SRSmaQTaskFIter SRSmaQTaskFIter; +typedef struct SRSmaQTaskInfoIter SRSmaQTaskInfoIter; static int32_t tdUidStorePut(STbUidStore *pStore, tb_uid_t suid, tb_uid_t *uid); static int32_t tdUpdateTbUidListImpl(SSma *pSma, tb_uid_t *suid, SArray *tbUids); @@ -32,13 +33,17 @@ static int32_t tdExecuteRSmaImpl(SSma *pSma, const void *pMsg, int32_t inputType static void tdRSmaFetchTrigger(void *param, void *tmrId); static void tdRSmaPersistTrigger(void *param, void *tmrId); static void *tdRSmaPersistExec(void *param); -static void tdRSmaQTaskGetFName(int32_t vid, int8_t ftype, char *outputName); +static void tdRSmaQTaskInfoGetFName(int32_t vid, int8_t ftype, char *outputName); -static int32_t tdRSmaQTaskInfoIterInit(SRSmaQTaskFIter *pIter, STFile *pTFile); -static int32_t tdRSmaQTaskInfoIterNextBlock(SRSmaQTaskFIter *pIter, bool *isFinish); -static int32_t tdRSmaQTaskInfoIterNext(SRSmaQTaskFIter *pIter, SRSmaQTaskInfoItem *pItem, bool *isEnd); +static int32_t tdRSmaQTaskInfoIterInit(SRSmaQTaskInfoIter *pIter, STFile *pTFile); +static int32_t tdRSmaQTaskInfoIterNextBlock(SRSmaQTaskInfoIter *pIter, bool *isFinish); +static int32_t tdRSmaQTaskInfoRestore(SSma *pSma, SRSmaQTaskInfoIter *pIter); static int32_t tdRSmaQTaskInfoItemRestore(SSma *pSma, const SRSmaQTaskInfoItem *infoItem); +static int32_t tdRSmaRestoreQTaskInfoInit(SSma *pSma); +static int32_t tdRSmaRestoreQTaskInfoReload(SSma *pSma); +static int32_t tdRSmaRestoreTSDataReload(SSma *pSma); + struct SRSmaInfoItem { SRSmaInfo *pRsmaInfo; void *taskInfo; // qTaskInfo_t @@ -63,22 +68,23 @@ struct SRSmaQTaskInfoItem { void *qTaskInfo; }; -struct SRSmaQTaskFIter { +struct SRSmaQTaskInfoIter { STFile *pTFile; int64_t offset; int64_t fsize; int32_t nBytes; int32_t nAlloc; - char *buf; + char *pBuf; // ------------ + char *qBuf; // for iterator int32_t nBufPos; }; static FORCE_INLINE int32_t tdRSmaQTaskInfoContLen(int32_t lenWithHead) { - return lenWithHead - sizeof(int32_t) - sizeof(int8_t) - sizeof(int64_t); + return lenWithHead - RSMA_QTASKINFO_HEAD_LEN; } -static FORCE_INLINE void tdRSmaQTaskInfoIterDestroy(SRSmaQTaskFIter *pIter) { taosMemoryFreeClear(pIter->buf); } +static FORCE_INLINE void tdRSmaQTaskInfoIterDestroy(SRSmaQTaskInfoIter *pIter) { taosMemoryFreeClear(pIter->pBuf); } static FORCE_INLINE void tdFreeTaskHandle(qTaskInfo_t *taskHandle, int32_t vgId, int32_t level) { // Note: free/kill may in RC @@ -244,6 +250,7 @@ static int32_t tdSetRSmaInfoItemParams(SSma *pSma, SRSmaParam *param, SRSmaInfo pItem->pRsmaInfo = pRSmaInfo; pItem->taskInfo = qCreateStreamExecTaskInfo(param->qmsg[idx], pReadHandle); if (!pItem->taskInfo) { + terrno = TSDB_CODE_RSMA_QTASKINFO_CREATE; goto _err; } pItem->triggerStat = TASK_TRIGGER_STAT_INACTIVE; @@ -294,7 +301,7 @@ int32_t tdProcessRSmaCreateImpl(SSma *pSma, SRSmaParam *param, int64_t suid, con pRSmaInfo = taosHashGet(RSMA_INFO_HASH(pStat), &suid, sizeof(tb_uid_t)); if (pRSmaInfo) { - ASSERT(0); // TODO: free original pRSmaInfo is exists abnormally + ASSERT(0); // TODO: free original pRSmaInfo if exists abnormally smaDebug("vgId:%d, rsma info already exists for table %s, %" PRIi64, SMA_VID(pSma), tbName, suid); return TSDB_CODE_SUCCESS; } @@ -338,10 +345,10 @@ int32_t tdProcessRSmaCreateImpl(SSma *pSma, SRSmaParam *param, int64_t suid, con if (taosHashPut(RSMA_INFO_HASH(pStat), &suid, sizeof(tb_uid_t), &pRSmaInfo, sizeof(pRSmaInfo)) < 0) { goto _err; - } else { - smaDebug("vgId:%d, register rsma info succeed for suid:%" PRIi64, SMA_VID(pSma), suid); } + smaDebug("vgId:%d, register rsma info succeed for suid:%" PRIi64, SMA_VID(pSma), suid); + // start the persist timer if (TASK_TRIGGER_STAT_INIT == atomic_val_compare_exchange_8(RSMA_TRIGGER_STAT(pStat), TASK_TRIGGER_STAT_INIT, TASK_TRIGGER_STAT_ACTIVE)) { @@ -356,10 +363,9 @@ _err: } /** - * @brief Check and init qTaskInfo_t, only applicable to stable with SRSmaParam. + * @brief Check and init qTaskInfo_t, only applicable to stable with SRSmaParam currently * - * @param pTsdb - * @param pMeta + * @param pVnode * @param pReq * @return int32_t */ @@ -695,331 +701,172 @@ int32_t tdProcessRSmaSubmit(SSma *pSma, void *pMsg, int32_t inputType) { return TSDB_CODE_SUCCESS; } -static void tdRSmaQTaskGetFName(int32_t vid, int8_t ftype, char *outputName) { - tdGetVndFileName(vid, "rsma", tdQTaskInfoFname[ftype], outputName); -} - -static void *tdRSmaPersistExec(void *param) { - setThreadName("rsma-task-persist"); - SRSmaStat *pRSmaStat = param; - SSma *pSma = pRSmaStat->pSma; - STfs *pTfs = pSma->pVnode->pTfs; - int64_t toffset = 0; - bool isFileCreated = false; - - if (TASK_TRIGGER_STAT_CANCELLED == atomic_load_8(RSMA_TRIGGER_STAT(pRSmaStat))) { - goto _end; - } - - void *infoHash = taosHashIterate(RSMA_INFO_HASH(pRSmaStat), NULL); - if (!infoHash) { - goto _end; - } - - STFile tFile = {0}; - int32_t vid = SMA_VID(pSma); - - while (infoHash) { - SRSmaInfo *pRSmaInfo = *(SRSmaInfo **)infoHash; - -#if 0 - smaDebug("table %" PRIi64 " sleep 15s start ...", pRSmaInfo->items[0].pRsmaInfo->suid); - for (int32_t i = 15; i > 0; --i) { - taosSsleep(1); - smaDebug("table %" PRIi64 " countdown %d", pRSmaInfo->items[0].pRsmaInfo->suid, i); - } - smaDebug("table %" PRIi64 " sleep 15s end ...", pRSmaInfo->items[0].pRsmaInfo->suid); -#endif - for (int32_t i = 0; i < TSDB_RETENTION_L2; ++i) { - qTaskInfo_t taskInfo = pRSmaInfo->items[i].taskInfo; - if (!taskInfo) { - smaDebug("vgId:%d, table %" PRIi64 " level %d qTaskInfo is NULL", vid, pRSmaInfo->suid, i + 1); - continue; - } - char *pOutput = NULL; - int32_t len = 0; - int8_t type = (int8_t)(i + 1); - if (qSerializeTaskStatus(taskInfo, &pOutput, &len) < 0) { - smaError("vgId:%d, table %" PRIi64 " level %d serialize rsma task failed since %s", vid, pRSmaInfo->suid, i + 1, - terrstr(terrno)); - goto _err; - } else { - if (!pOutput) { - smaDebug("vgId:%d, table %" PRIi64 - " level %d serialize rsma task success but no output(len %d) and no need to persist", - vid, pRSmaInfo->suid, i + 1, len); - continue; - } else if (len <= 0) { - smaDebug("vgId:%d, table %" PRIi64 " level %d serialize rsma task success with len %d and no need to persist", - vid, pRSmaInfo->suid, i + 1, len); - taosMemoryFree(pOutput); - } - smaDebug("vgId:%d, table %" PRIi64 " level %d serialize rsma task success with len %d and need persist", vid, - pRSmaInfo->suid, i + 1, len); -#if 1 - if (qDeserializeTaskStatus(taskInfo, pOutput, len) < 0) { - smaError("vgId:%d, table %" PRIi64 "level %d deserialize rsma task failed since %s", vid, pRSmaInfo->suid, - i + 1, terrstr(terrno)); - } else { - smaDebug("vgId:%d, table %" PRIi64 " level %d deserialize rsma task success", vid, pRSmaInfo->suid, i + 1); - } -#endif - } - - if (!isFileCreated) { - char qTaskInfoFName[TSDB_FILENAME_LEN]; - tdRSmaQTaskGetFName(vid, TD_QTASK_TMP_FILE, qTaskInfoFName); - tdInitTFile(&tFile, pTfs, qTaskInfoFName); - tdCreateTFile(&tFile, pTfs, true, -1); - - isFileCreated = true; - } - len += (sizeof(len) + sizeof(type) + sizeof(pRSmaInfo->suid)); - tdAppendTFile(&tFile, &len, sizeof(len), &toffset); - tdAppendTFile(&tFile, &type, sizeof(type), &toffset); - tdAppendTFile(&tFile, &pRSmaInfo->suid, sizeof(pRSmaInfo->suid), &toffset); - tdAppendTFile(&tFile, pOutput, len, &toffset); - - taosMemoryFree(pOutput); - } - infoHash = taosHashIterate(RSMA_INFO_HASH(pRSmaStat), infoHash); - } -_normal: - if (isFileCreated) { - if (tdUpdateTFileHeader(&tFile) < 0) { - smaError("vgId:%d, failed to update tfile %s header since %s", vid, TD_FILE_FULL_NAME(&tFile), tstrerror(terrno)); - tdCloseTFile(&tFile); - tdRemoveTFile(&tFile); - goto _err; - } else { - smaDebug("vgId:%d, succeed to update tfile %s header", vid, TD_FILE_FULL_NAME(&tFile)); - } - - tdCloseTFile(&tFile); - - char newFName[TSDB_FILENAME_LEN]; - strncpy(newFName, TD_FILE_FULL_NAME(&tFile), TSDB_FILENAME_LEN); - char *pos = strstr(newFName, tdQTaskInfoFname[TD_QTASK_TMP_FILE]); - strncpy(pos, tdQTaskInfoFname[TD_QTASK_CUR_FILE], TSDB_FILENAME_LEN - POINTER_DISTANCE(pos, newFName)); - if (taosRenameFile(TD_FILE_FULL_NAME(&tFile), newFName) != 0) { - smaError("vgId:%d, failed to rename %s to %s", vid, TD_FILE_FULL_NAME(&tFile), newFName); - goto _err; - } else { - smaDebug("vgId:%d, succeed to rename %s to %s", vid, TD_FILE_FULL_NAME(&tFile), newFName); - } - } - goto _end; -_err: - if (isFileCreated) { - tdRemoveTFile(&tFile); - } -_end: - if (TASK_TRIGGER_STAT_INACTIVE == atomic_val_compare_exchange_8(RSMA_TRIGGER_STAT(pRSmaStat), - TASK_TRIGGER_STAT_INACTIVE, - TASK_TRIGGER_STAT_ACTIVE)) { - smaDebug("vgId:%d, persist task is active again", vid); - } else if (TASK_TRIGGER_STAT_CANCELLED == atomic_val_compare_exchange_8(RSMA_TRIGGER_STAT(pRSmaStat), - TASK_TRIGGER_STAT_CANCELLED, - TASK_TRIGGER_STAT_FINISHED)) { - smaDebug("vgId:%d, persist task is cancelled", vid); - } else { - smaWarn("vgId:%d, persist task in abnormal stat %" PRIi8, vid, atomic_load_8(RSMA_TRIGGER_STAT(pRSmaStat))); - ASSERT(0); - } - atomic_store_8(RSMA_RUNNING_STAT(pRSmaStat), 0); - taosThreadExit(NULL); - return NULL; -} - -static void tdRSmaPersistTask(SRSmaStat *pRSmaStat) { - TdThreadAttr thAttr; - taosThreadAttrInit(&thAttr); - taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_DETACHED); - TdThread tid; - - if (taosThreadCreate(&tid, &thAttr, tdRSmaPersistExec, pRSmaStat) != 0) { - if (TASK_TRIGGER_STAT_INACTIVE == atomic_val_compare_exchange_8(RSMA_TRIGGER_STAT(pRSmaStat), - TASK_TRIGGER_STAT_INACTIVE, - TASK_TRIGGER_STAT_ACTIVE)) { - smaDebug("persist task is active again"); - } else if (TASK_TRIGGER_STAT_CANCELLED == atomic_val_compare_exchange_8(RSMA_TRIGGER_STAT(pRSmaStat), - TASK_TRIGGER_STAT_CANCELLED, - TASK_TRIGGER_STAT_FINISHED)) { - smaDebug(" persist task is cancelled and set finished"); - } else { - smaWarn("persist task in abnormal stat %" PRIi8, atomic_load_8(RSMA_TRIGGER_STAT(pRSmaStat))); - ASSERT(0); - } - atomic_store_8(RSMA_RUNNING_STAT(pRSmaStat), 0); - } - - taosThreadAttrDestroy(&thAttr); -} - -/** - * @brief trigger to persist rsma qTaskInfo - * - * @param param - * @param tmrId - */ -static void tdRSmaPersistTrigger(void *param, void *tmrId) { - SRSmaStat *pRSmaStat = param; - int8_t tmrStat = - atomic_val_compare_exchange_8(RSMA_TRIGGER_STAT(pRSmaStat), TASK_TRIGGER_STAT_ACTIVE, TASK_TRIGGER_STAT_INACTIVE); - switch (tmrStat) { - case TASK_TRIGGER_STAT_ACTIVE: { - atomic_store_8(RSMA_RUNNING_STAT(pRSmaStat), 1); - if (TASK_TRIGGER_STAT_CANCELLED != atomic_val_compare_exchange_8(RSMA_TRIGGER_STAT(pRSmaStat), - TASK_TRIGGER_STAT_CANCELLED, - TASK_TRIGGER_STAT_FINISHED)) { - smaDebug("rsma persistence start since active"); - - // start persist task - tdRSmaPersistTask(pRSmaStat); - - taosTmrReset(tdRSmaPersistTrigger, RSMA_QTASKINFO_PERSIST_MS, pRSmaStat, pRSmaStat->tmrHandle, - &pRSmaStat->tmrId); - } else { - atomic_store_8(RSMA_RUNNING_STAT(pRSmaStat), 0); - } - } break; - case TASK_TRIGGER_STAT_CANCELLED: { - atomic_store_8(RSMA_TRIGGER_STAT(pRSmaStat), TASK_TRIGGER_STAT_FINISHED); - smaDebug("rsma persistence not start since cancelled and finished"); - } break; - case TASK_TRIGGER_STAT_INACTIVE: { - smaDebug("rsma persistence not start since inactive"); - } break; - case TASK_TRIGGER_STAT_INIT: { - smaDebug("rsma persistence not start since init"); - } break; - default: { - smaWarn("rsma persistence not start since unknown stat %" PRIi8, tmrStat); - ASSERT(0); - } break; - } -} - -int32_t tdProcessRSmaRestoreImpl(SSma *pSma) { +static int32_t tdRSmaRestoreQTaskInfoInit(SSma *pSma) { SVnode *pVnode = pSma->pVnode; - // step 1: iterate all stables to restore the rsma env - SArray *suidList = taosArrayInit(1, sizeof(tb_uid_t)); if (tsdbGetStbIdList(SMA_META(pSma), 0, suidList) < 0) { - smaError("vgId:%d, failed to restore rsma since get stb id list error: %s", TD_VID(pVnode), terrstr()); + taosArrayDestroy(suidList); + smaError("vgId:%d, failed to restore rsma env since get stb id list error: %s", TD_VID(pVnode), terrstr()); return TSDB_CODE_FAILED; } - if (taosArrayGetSize(suidList) == 0) { - smaDebug("vgId:%d no need to restore rsma since empty stb id list", TD_VID(pVnode)); + int32_t arrSize = taosArrayGetSize(suidList); + if (arrSize == 0) { + taosArrayDestroy(suidList); + smaDebug("vgId:%d, no need to restore rsma env since empty stb id list", TD_VID(pVnode)); return TSDB_CODE_SUCCESS; } SMetaReader mr = {0}; metaReaderInit(&mr, SMA_META(pSma), 0); - for (int32_t i = 0; i < taosArrayGetSize(suidList); ++i) { + for (int32_t i = 0; i < arrSize; ++i) { tb_uid_t suid = *(tb_uid_t *)taosArrayGet(suidList, i); - smaDebug("suid [%d] is %" PRIi64, i, suid); + smaDebug("vgId:%d, rsma restore, suid[%d] is %" PRIi64, TD_VID(pVnode), i, suid); if (metaGetTableEntryByUid(&mr, suid) < 0) { - smaError("vgId:%d failed to get table meta for %" PRIi64 " since %s", TD_VID(pVnode), suid, terrstr()); + smaError("vgId:%d, rsma restore, failed to get table meta for %" PRIi64 " since %s", TD_VID(pVnode), suid, + terrstr()); goto _err; } ASSERT(mr.me.type == TSDB_SUPER_TABLE); ASSERT(mr.me.uid == suid); if (TABLE_IS_ROLLUP(mr.me.flags)) { SRSmaParam *param = &mr.me.stbEntry.rsmaParam; - for (int i = 0; i < 2; ++i) { - smaDebug("vgId: %d table:%" PRIi64 " maxdelay[%d]:%" PRIi64 " watermark[%d]:%" PRIi64, TD_VID(pSma->pVnode), - suid, i, param->maxdelay[i], i, param->watermark[i]); + for (int i = 0; i < TSDB_RETENTION_L2; ++i) { + smaDebug("vgId:%d, rsma restore, table:%" PRIi64 " level:%d, maxdelay:%" PRIi64 " watermark:%" PRIi64 + " qmsgLen:%" PRIi32, + TD_VID(pVnode), suid, i, param->maxdelay[i], param->watermark[i], param->qmsgLen[i]); } if (tdProcessRSmaCreateImpl(pSma, &mr.me.stbEntry.rsmaParam, suid, mr.me.name) < 0) { - smaError("vgId:%d failed to retore rsma env for %" PRIi64 " since %s", TD_VID(pVnode), suid, terrstr()); + smaError("vgId:%d, rsma restore env failed for %" PRIi64 " since %s", TD_VID(pVnode), suid, terrstr()); goto _err; } + smaDebug("vgId:%d, rsma restore env success for %" PRIi64, TD_VID(pVnode), suid); } } - // step 2: retrieve qtaskinfo object from the rsma/qtaskinfo file and restore - STFile tFile = {0}; - char qTaskInfoFName[TSDB_FILENAME_LEN]; + metaReaderClear(&mr); + taosArrayDestroy(suidList); + + return TSDB_CODE_SUCCESS; +_err: + metaReaderClear(&mr); + taosArrayDestroy(suidList); + + return TSDB_CODE_FAILED; +} + +static int32_t tdRSmaRestoreQTaskInfoReload(SSma *pSma) { + SVnode *pVnode = pSma->pVnode; + STFile tFile = {0}; + char qTaskInfoFName[TSDB_FILENAME_LEN]; - tdRSmaQTaskGetFName(TD_VID(pVnode), TD_QTASK_CUR_FILE, qTaskInfoFName); + tdRSmaQTaskInfoGetFName(TD_VID(pVnode), TD_QTASK_CUR_FILE, qTaskInfoFName); if (tdInitTFile(&tFile, pVnode->pTfs, qTaskInfoFName) < 0) { goto _err; } + + if (!taosCheckExistFile(TD_TFILE_FULL_NAME(&tFile))) { + return TSDB_CODE_SUCCESS; + } + if (tdOpenTFile(&tFile, TD_FILE_READ) < 0) { goto _err; } - SRSmaQTaskFIter fIter = {0}; + + SRSmaQTaskInfoIter fIter = {0}; if (tdRSmaQTaskInfoIterInit(&fIter, &tFile) < 0) { + tdRSmaQTaskInfoIterDestroy(&fIter); + tdCloseTFile(&tFile); goto _err; } - SRSmaQTaskInfoItem infoItem = {0}; - bool isEnd = false; - int32_t code = 0; - while ((code = tdRSmaQTaskInfoIterNext(&fIter, &infoItem, &isEnd)) == 0) { - if (isEnd) { - break; - } - if ((code = tdRSmaQTaskInfoItemRestore(pSma, &infoItem)) < 0) { - break; - } + + if (tdRSmaQTaskInfoRestore(pSma, &fIter) < 0) { + tdRSmaQTaskInfoIterDestroy(&fIter); + tdCloseTFile(&tFile); + goto _err; } + tdRSmaQTaskInfoIterDestroy(&fIter); + tdCloseTFile(&tFile); + return TSDB_CODE_SUCCESS; +_err: + smaError("rsma restore, qtaskinfo reload failed since %s", terrstr()); + return TSDB_CODE_FAILED; +} - if (code < 0) { +/** + * @brief reload ts data from checkpoint + * + * @param pSma + * @return int32_t + */ +static int32_t tdRSmaRestoreTSDataReload(SSma *pSma) { + // TODO + return TSDB_CODE_SUCCESS; +_err: + smaError("rsma restore, ts data reload failed since %s", terrstr()); + return TSDB_CODE_FAILED; +} + +int32_t tdProcessRSmaRestoreImpl(SSma *pSma) { + // step 1: iterate all stables to restore the rsma env + if (tdRSmaRestoreQTaskInfoInit(pSma) < 0) { + goto _err; + } + + // step 2: retrieve qtaskinfo items from the persistence file(rsma/qtaskinfo) and restore + if (tdRSmaRestoreQTaskInfoReload(pSma) < 0) { + goto _err; + } + + // step 3: reload ts data from checkpoint + if (tdRSmaRestoreTSDataReload(pSma) < 0) { goto _err; } - metaReaderClear(&mr); - taosArrayDestroy(suidList); return TSDB_CODE_SUCCESS; _err: - ASSERT(0); - metaReaderClear(&mr); - taosArrayDestroy(suidList); - smaError("failed to restore rsma info since %s", terrstr()); + smaError("failed to restore rsma task since %s", terrstr()); return TSDB_CODE_FAILED; } -static int32_t tdRSmaQTaskInfoItemRestore(SSma *pSma, const SRSmaQTaskInfoItem *infoItem) { +static int32_t tdRSmaQTaskInfoItemRestore(SSma *pSma, const SRSmaQTaskInfoItem *pItem) { SRSmaStat *pStat = (SRSmaStat *)SMA_ENV_STAT((SSmaEnv *)pSma->pRSmaEnv); SRSmaInfo *pRSmaInfo = NULL; void *qTaskInfo = NULL; - pRSmaInfo = taosHashGet(RSMA_INFO_HASH(pStat), &infoItem->suid, sizeof(infoItem->suid)); + pRSmaInfo = taosHashGet(RSMA_INFO_HASH(pStat), &pItem->suid, sizeof(pItem->suid)); if (!pRSmaInfo || !(pRSmaInfo = *(SRSmaInfo **)pRSmaInfo)) { - smaDebug("vgId:%d, no restore as no rsma info for suid:%" PRIu64, SMA_VID(pSma), infoItem->suid); + smaDebug("vgId:%d, no restore as no rsma info for table:%" PRIu64, SMA_VID(pSma), pItem->suid); return TSDB_CODE_SUCCESS; } - if (infoItem->type == 1) { + if (pItem->type == 1) { qTaskInfo = pRSmaInfo->items[0].taskInfo; - } else if (infoItem->type == 2) { + } else if (pItem->type == 2) { qTaskInfo = pRSmaInfo->items[1].taskInfo; } else { ASSERT(0); } if (!qTaskInfo) { - smaDebug("vgId:%d, no restore as NULL rsma qTaskInfo for suid:%" PRIu64, SMA_VID(pSma), infoItem->suid); + smaDebug("vgId:%d, no restore as NULL rsma qTaskInfo for table:%" PRIu64, SMA_VID(pSma), pItem->suid); return TSDB_CODE_SUCCESS; } - if (qDeserializeTaskStatus(qTaskInfo, infoItem->qTaskInfo, infoItem->len) < 0) { - smaError("vgId:%d, restore rsma failed for suid:%" PRIi64 " level %d since %s", SMA_VID(pSma), infoItem->suid, - infoItem->type, terrstr(terrno)); + if (qDeserializeTaskStatus(qTaskInfo, pItem->qTaskInfo, pItem->len) < 0) { + smaError("vgId:%d, restore rsma task failed for table:%" PRIi64 " level %d since %s", SMA_VID(pSma), pItem->suid, + pItem->type, terrstr(terrno)); return TSDB_CODE_FAILED; } - smaDebug("vgId:%d, restore rsma success for suid:%" PRIi64 " level %d", SMA_VID(pSma), infoItem->suid, - infoItem->type); + smaDebug("vgId:%d, restore rsma task success for table:%" PRIi64 " level %d", SMA_VID(pSma), pItem->suid, pItem->type); return TSDB_CODE_SUCCESS; } -static int32_t tdRSmaQTaskInfoIterInit(SRSmaQTaskFIter *pIter, STFile *pTFile) { +static int32_t tdRSmaQTaskInfoIterInit(SRSmaQTaskInfoIter *pIter, STFile *pTFile) { memset(pIter, 0, sizeof(*pIter)); pIter->pTFile = pTFile; pIter->offset = TD_FILE_HEAD_SIZE; @@ -1038,16 +885,17 @@ static int32_t tdRSmaQTaskInfoIterInit(SRSmaQTaskFIter *pIter, STFile *pTFile) { pIter->nAlloc = TD_FILE_HEAD_SIZE; } - pIter->buf = taosMemoryMalloc(pIter->nAlloc); - if (!pIter->buf) { + pIter->pBuf = taosMemoryMalloc(pIter->nAlloc); + if (!pIter->pBuf) { terrno = TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_FAILED; } + pIter->qBuf = pIter->pBuf; return TSDB_CODE_SUCCESS; } -static int32_t tdRSmaQTaskInfoIterNextBlock(SRSmaQTaskFIter *pIter, bool *isFinish) { +static int32_t tdRSmaQTaskInfoIterNextBlock(SRSmaQTaskInfoIter *pIter, bool *isFinish) { STFile *pTFile = pIter->pTFile; int64_t nBytes = RSMA_QTASKINFO_BUFSIZE; @@ -1065,22 +913,23 @@ static int32_t tdRSmaQTaskInfoIterNextBlock(SRSmaQTaskFIter *pIter, bool *isFini return TSDB_CODE_FAILED; } - if (tdReadTFile(pTFile, pIter->buf, nBytes) != nBytes) { + if (tdReadTFile(pTFile, pIter->qBuf, nBytes) != nBytes) { ASSERT(0); return TSDB_CODE_FAILED; } int32_t infoLen = 0; - taosDecodeFixedI32(pIter->buf, &infoLen); + taosDecodeFixedI32(pIter->qBuf, &infoLen); if (infoLen > nBytes) { ASSERT(infoLen > RSMA_QTASKINFO_BUFSIZE); pIter->nAlloc = infoLen; - void *pBuf = taosMemoryRealloc(pIter->buf, infoLen); + void *pBuf = taosMemoryRealloc(pIter->pBuf, infoLen); if (!pBuf) { terrno = TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_FAILED; } - pIter->buf = pBuf; + pIter->pBuf = pBuf; + pIter->qBuf = pIter->pBuf; nBytes = infoLen; if (tdSeekTFile(pTFile, pIter->offset, SEEK_SET)) { @@ -1088,7 +937,7 @@ static int32_t tdRSmaQTaskInfoIterNextBlock(SRSmaQTaskFIter *pIter, bool *isFini return TSDB_CODE_FAILED; } - if (tdReadTFile(pTFile, pIter->buf, nBytes) != nBytes) { + if (tdReadTFile(pTFile, pIter->pBuf, nBytes) != nBytes) { ASSERT(0); return TSDB_CODE_FAILED; } @@ -1101,7 +950,7 @@ static int32_t tdRSmaQTaskInfoIterNextBlock(SRSmaQTaskFIter *pIter, bool *isFini return TSDB_CODE_SUCCESS; } -static int32_t tdRSmaQTaskInfoIterNext(SRSmaQTaskFIter *pIter, SRSmaQTaskInfoItem *pItem, bool *isEnd) { +static int32_t tdRSmaQTaskInfoRestore(SSma *pSma, SRSmaQTaskInfoIter *pIter) { while (1) { // block iter bool isFinish = false; @@ -1110,30 +959,39 @@ static int32_t tdRSmaQTaskInfoIterNext(SRSmaQTaskFIter *pIter, SRSmaQTaskInfoIte return TSDB_CODE_FAILED; } if (isFinish) { - *isEnd = true; return TSDB_CODE_SUCCESS; } // consume the block int32_t qTaskInfoLenWithHead = 0; - pIter->buf = taosDecodeFixedI32(pIter->buf, &qTaskInfoLenWithHead); - if (qTaskInfoLenWithHead < 0) { + pIter->qBuf = taosDecodeFixedI32(pIter->qBuf, &qTaskInfoLenWithHead); + if (qTaskInfoLenWithHead < RSMA_QTASKINFO_HEAD_LEN) { terrno = TSDB_CODE_TDB_FILE_CORRUPTED; return TSDB_CODE_FAILED; } + while (1) { if ((pIter->nBufPos + qTaskInfoLenWithHead) <= pIter->nBytes) { - pIter->buf = taosDecodeFixedI8(pIter->buf, &pItem->type); - pIter->buf = taosDecodeFixedI64(pIter->buf, &pItem->suid); - pItem->qTaskInfo = pIter->buf; - pItem->len = tdRSmaQTaskInfoContLen(qTaskInfoLenWithHead); + SRSmaQTaskInfoItem infoItem = {0}; + pIter->qBuf = taosDecodeFixedI8(pIter->qBuf, &infoItem.type); + pIter->qBuf = taosDecodeFixedI64(pIter->qBuf, &infoItem.suid); + infoItem.qTaskInfo = pIter->qBuf; + infoItem.len = tdRSmaQTaskInfoContLen(qTaskInfoLenWithHead); // do the restore job - printf("%s:%d ###### restore the qtask info offset:%" PRIi64 "\n", __func__, __LINE__, pIter->offset); + smaDebug("vgId:%d, restore the qtask info %s offset:%" PRIi64 "\n", SMA_VID(pSma), + TD_TFILE_FULL_NAME(pIter->pTFile), pIter->offset - pIter->nBytes + pIter->nBufPos); + tdRSmaQTaskInfoItemRestore(pSma, &infoItem); - pIter->buf = POINTER_SHIFT(pIter->buf, pItem->len); + pIter->qBuf = POINTER_SHIFT(pIter->qBuf, infoItem.len); pIter->nBufPos += qTaskInfoLenWithHead; - pIter->buf = taosDecodeFixedI32(pIter->buf, &qTaskInfoLenWithHead); + if ((pIter->nBufPos + RSMA_QTASKINFO_HEAD_LEN) >= pIter->nBytes) { + // prepare and load next block in the file + pIter->offset -= (pIter->nBytes - pIter->nBufPos); + break; + } + + pIter->qBuf = taosDecodeFixedI32(pIter->qBuf, &qTaskInfoLenWithHead); continue; } // prepare and load next block in the file @@ -1144,3 +1002,208 @@ static int32_t tdRSmaQTaskInfoIterNext(SRSmaQTaskFIter *pIter, SRSmaQTaskInfoIte return TSDB_CODE_SUCCESS; } + +static void tdRSmaQTaskInfoGetFName(int32_t vid, int8_t ftype, char *outputName) { + tdGetVndFileName(vid, VNODE_RSMA_DIR, tdQTaskInfoFname[ftype], outputName); +} + +static void *tdRSmaPersistExec(void *param) { + setThreadName("rsma-task-persist"); + SRSmaStat *pRSmaStat = param; + SSma *pSma = pRSmaStat->pSma; + STfs *pTfs = pSma->pVnode->pTfs; + int32_t vid = SMA_VID(pSma); + int64_t toffset = 0; + bool isFileCreated = false; + + if (TASK_TRIGGER_STAT_CANCELLED == atomic_load_8(RSMA_TRIGGER_STAT(pRSmaStat))) { + goto _end; + } + + void *infoHash = taosHashIterate(RSMA_INFO_HASH(pRSmaStat), NULL); + if (!infoHash) { + goto _end; + } + + STFile tFile = {0}; + while (infoHash) { + SRSmaInfo *pRSmaInfo = *(SRSmaInfo **)infoHash; + for (int32_t i = 0; i < TSDB_RETENTION_L2; ++i) { + qTaskInfo_t taskInfo = pRSmaInfo->items[i].taskInfo; + if (!taskInfo) { + smaDebug("vgId:%d, table %" PRIi64 " level %d qTaskInfo is NULL", vid, pRSmaInfo->suid, i + 1); + continue; + } + + char *pOutput = NULL; + int32_t len = 0; + int8_t type = (int8_t)(i + 1); + if (qSerializeTaskStatus(taskInfo, &pOutput, &len) < 0) { + smaError("vgId:%d, table %" PRIi64 " level %d serialize rsma task failed since %s", vid, pRSmaInfo->suid, i + 1, + terrstr(terrno)); + goto _err; + } + if (!pOutput || len <= 0) { + smaDebug("vgId:%d, table %" PRIi64 " level %d serialize rsma task success but no output(len %d), not persist", + vid, pRSmaInfo->suid, i + 1, len); + taosMemoryFreeClear(pOutput); + continue; + } + + smaDebug("vgId:%d, table %" PRIi64 " level %d serialize rsma task success with len %d, need persist", vid, + pRSmaInfo->suid, i + 1, len); +#if 0 + if (qDeserializeTaskStatus(taskInfo, pOutput, len) < 0) { + smaError("vgId:%d, table %" PRIi64 "level %d deserialize rsma task failed since %s", vid, pRSmaInfo->suid, + i + 1, terrstr(terrno)); + } else { + smaDebug("vgId:%d, table %" PRIi64 " level %d deserialize rsma task success", vid, pRSmaInfo->suid, i + 1); + } +#endif + + if (!isFileCreated) { + char qTaskInfoFName[TSDB_FILENAME_LEN]; + tdRSmaQTaskInfoGetFName(vid, TD_QTASK_TMP_FILE, qTaskInfoFName); + tdInitTFile(&tFile, pTfs, qTaskInfoFName); + tdCreateTFile(&tFile, pTfs, true, -1); + + isFileCreated = true; + } + + char tmpBuf[RSMA_QTASKINFO_HEAD_LEN] = {0}; + void *pTmpBuf = &tmpBuf; + int32_t headLen = 0; + headLen += taosEncodeFixedI32(&pTmpBuf, len + RSMA_QTASKINFO_HEAD_LEN); + headLen += taosEncodeFixedI8(&pTmpBuf, type); + headLen += taosEncodeFixedI64(&pTmpBuf, pRSmaInfo->suid); + + ASSERT(headLen <= RSMA_QTASKINFO_HEAD_LEN); + tdAppendTFile(&tFile, (void *)&tmpBuf, headLen, &toffset); + smaDebug("vgId:%d, table %" PRIi64 " level %d head part len:%d appended to offset:%" PRIi64, vid, pRSmaInfo->suid, + i + 1, headLen, toffset); + tdAppendTFile(&tFile, pOutput, len, &toffset); + smaDebug("vgId:%d, table %" PRIi64 " level %d body part len:%d appended to offset:%" PRIi64, vid, pRSmaInfo->suid, + i + 1, len, toffset); + + taosMemoryFree(pOutput); + } + + infoHash = taosHashIterate(RSMA_INFO_HASH(pRSmaStat), infoHash); + } +_normal: + if (isFileCreated) { + if (tdUpdateTFileHeader(&tFile) < 0) { + smaError("vgId:%d, failed to update tfile %s header since %s", vid, TD_TFILE_FULL_NAME(&tFile), + tstrerror(terrno)); + tdCloseTFile(&tFile); + tdRemoveTFile(&tFile); + goto _err; + } else { + smaDebug("vgId:%d, succeed to update tfile %s header", vid, TD_TFILE_FULL_NAME(&tFile)); + } + + tdCloseTFile(&tFile); + + char newFName[TSDB_FILENAME_LEN]; + strncpy(newFName, TD_TFILE_FULL_NAME(&tFile), TSDB_FILENAME_LEN); + char *pos = strstr(newFName, tdQTaskInfoFname[TD_QTASK_TMP_FILE]); + strncpy(pos, tdQTaskInfoFname[TD_QTASK_CUR_FILE], TSDB_FILENAME_LEN - POINTER_DISTANCE(pos, newFName)); + if (taosRenameFile(TD_TFILE_FULL_NAME(&tFile), newFName) != 0) { + smaError("vgId:%d, failed to rename %s to %s", vid, TD_TFILE_FULL_NAME(&tFile), newFName); + goto _err; + } else { + smaDebug("vgId:%d, succeed to rename %s to %s", vid, TD_TFILE_FULL_NAME(&tFile), newFName); + } + } + goto _end; +_err: + if (isFileCreated) { + tdRemoveTFile(&tFile); + } +_end: + if (TASK_TRIGGER_STAT_INACTIVE == atomic_val_compare_exchange_8(RSMA_TRIGGER_STAT(pRSmaStat), + TASK_TRIGGER_STAT_INACTIVE, + TASK_TRIGGER_STAT_ACTIVE)) { + smaDebug("vgId:%d, persist task is active again", vid); + } else if (TASK_TRIGGER_STAT_CANCELLED == atomic_val_compare_exchange_8(RSMA_TRIGGER_STAT(pRSmaStat), + TASK_TRIGGER_STAT_CANCELLED, + TASK_TRIGGER_STAT_FINISHED)) { + smaDebug("vgId:%d, persist task is cancelled", vid); + } else { + smaWarn("vgId:%d, persist task in abnormal stat %" PRIi8, vid, atomic_load_8(RSMA_TRIGGER_STAT(pRSmaStat))); + ASSERT(0); + } + atomic_store_8(RSMA_RUNNING_STAT(pRSmaStat), 0); + taosThreadExit(NULL); + return NULL; +} + +static void tdRSmaPersistTask(SRSmaStat *pRSmaStat) { + TdThreadAttr thAttr; + taosThreadAttrInit(&thAttr); + taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_DETACHED); + TdThread tid; + + if (taosThreadCreate(&tid, &thAttr, tdRSmaPersistExec, pRSmaStat) != 0) { + if (TASK_TRIGGER_STAT_INACTIVE == atomic_val_compare_exchange_8(RSMA_TRIGGER_STAT(pRSmaStat), + TASK_TRIGGER_STAT_INACTIVE, + TASK_TRIGGER_STAT_ACTIVE)) { + smaDebug("vgId:%d, persist task is active again", SMA_VID(pRSmaStat->pSma)); + } else if (TASK_TRIGGER_STAT_CANCELLED == atomic_val_compare_exchange_8(RSMA_TRIGGER_STAT(pRSmaStat), + TASK_TRIGGER_STAT_CANCELLED, + TASK_TRIGGER_STAT_FINISHED)) { + smaDebug("vgId:%d, persist task is cancelled and set finished", SMA_VID(pRSmaStat->pSma)); + } else { + smaWarn("vgId:%d, persist task in abnormal stat %" PRIi8, atomic_load_8(RSMA_TRIGGER_STAT(pRSmaStat)), + SMA_VID(pRSmaStat->pSma)); + ASSERT(0); + } + atomic_store_8(RSMA_RUNNING_STAT(pRSmaStat), 0); + } + + taosThreadAttrDestroy(&thAttr); +} + +/** + * @brief trigger to persist rsma qTaskInfo + * + * @param param + * @param tmrId + */ +static void tdRSmaPersistTrigger(void *param, void *tmrId) { + SRSmaStat *pRSmaStat = param; + + int8_t tmrStat = + atomic_val_compare_exchange_8(RSMA_TRIGGER_STAT(pRSmaStat), TASK_TRIGGER_STAT_ACTIVE, TASK_TRIGGER_STAT_INACTIVE); + switch (tmrStat) { + case TASK_TRIGGER_STAT_ACTIVE: { + atomic_store_8(RSMA_RUNNING_STAT(pRSmaStat), 1); + if (TASK_TRIGGER_STAT_CANCELLED != atomic_val_compare_exchange_8(RSMA_TRIGGER_STAT(pRSmaStat), + TASK_TRIGGER_STAT_CANCELLED, + TASK_TRIGGER_STAT_FINISHED)) { + smaDebug("vgId:%d, rsma persistence start since active", SMA_VID(pRSmaStat->pSma)); + + // start persist task + tdRSmaPersistTask(pRSmaStat); + + taosTmrReset(tdRSmaPersistTrigger, RSMA_QTASKINFO_PERSIST_MS, pRSmaStat, pRSmaStat->tmrHandle, + &pRSmaStat->tmrId); + } else { + atomic_store_8(RSMA_RUNNING_STAT(pRSmaStat), 0); + } + } break; + case TASK_TRIGGER_STAT_CANCELLED: { + atomic_store_8(RSMA_TRIGGER_STAT(pRSmaStat), TASK_TRIGGER_STAT_FINISHED); + smaDebug("rsma persistence not start since cancelled and finished"); + } break; + case TASK_TRIGGER_STAT_INACTIVE: { + smaDebug("rsma persistence not start since inactive"); + } break; + case TASK_TRIGGER_STAT_INIT: { + smaDebug("rsma persistence not start since init"); + } break; + default: { + smaWarn("rsma persistence not start since unknown stat %" PRIi8, tmrStat); + } break; + } +} diff --git a/source/dnode/vnode/src/sma/smaUtil.c b/source/dnode/vnode/src/sma/smaUtil.c index 1f60da0b0a168c686347dcda8ebbba5fd643fef2..5f78aadddf6fdbb98d0efab356d02090a1b381f5 100644 --- a/source/dnode/vnode/src/sma/smaUtil.c +++ b/source/dnode/vnode/src/sma/smaUtil.c @@ -22,7 +22,6 @@ #define TD_FILE_INIT_MAGIC 0xFFFFFFFF - static int32_t tdEncodeTFInfo(void **buf, STFInfo *pInfo); static void *tdDecodeTFInfo(void *buf, STFInfo *pInfo); @@ -46,7 +45,7 @@ static void *tdDecodeTFInfo(void *buf, STFInfo *pInfo) { } int64_t tdWriteTFile(STFile *pTFile, void *buf, int64_t nbyte) { - ASSERT(TD_FILE_OPENED(pTFile)); + ASSERT(TD_TFILE_OPENED(pTFile)); int64_t nwrite = taosWriteFile(pTFile->pFile, buf, nbyte); if (nwrite < nbyte) { @@ -58,9 +57,9 @@ int64_t tdWriteTFile(STFile *pTFile, void *buf, int64_t nbyte) { } int64_t tdSeekTFile(STFile *pTFile, int64_t offset, int whence) { - ASSERT(TD_FILE_OPENED(pTFile)); + ASSERT(TD_TFILE_OPENED(pTFile)); - int64_t loffset = taosLSeekFile(TD_FILE_PFILE(pTFile), offset, whence); + int64_t loffset = taosLSeekFile(TD_TFILE_PFILE(pTFile), offset, whence); if (loffset < 0) { terrno = TAOS_SYSTEM_ERROR(errno); return -1; @@ -70,12 +69,12 @@ int64_t tdSeekTFile(STFile *pTFile, int64_t offset, int whence) { } int64_t tdGetTFileSize(STFile *pTFile, int64_t *size) { - ASSERT(TD_FILE_OPENED(pTFile)); + ASSERT(TD_TFILE_OPENED(pTFile)); return taosFStatFile(pTFile->pFile, size, NULL); } int64_t tdReadTFile(STFile *pTFile, void *buf, int64_t nbyte) { - ASSERT(TD_FILE_OPENED(pTFile)); + ASSERT(TD_TFILE_OPENED(pTFile)); int64_t nread = taosReadFile(pTFile->pFile, buf, nbyte); if (nread < 0) { @@ -108,7 +107,7 @@ int32_t tdLoadTFileHeader(STFile *pTFile, STFInfo *pInfo) { char buf[TD_FILE_HEAD_SIZE] = "\0"; uint32_t _version; - ASSERT(TD_FILE_OPENED(pTFile)); + ASSERT(TD_TFILE_OPENED(pTFile)); if (tdSeekTFile(pTFile, 0, SEEK_SET) < 0) { return -1; @@ -133,7 +132,7 @@ void tdUpdateTFileMagic(STFile *pTFile, void *pCksm) { } int64_t tdAppendTFile(STFile *pTFile, void *buf, int64_t nbyte, int64_t *offset) { - ASSERT(TD_FILE_OPENED(pTFile)); + ASSERT(TD_TFILE_OPENED(pTFile)); int64_t toffset; @@ -141,6 +140,11 @@ int64_t tdAppendTFile(STFile *pTFile, void *buf, int64_t nbyte, int64_t *offset) return -1; } +#if 1 + smaDebug("append to file %s, offset:%" PRIi64 " + nbyte:%" PRIi64 " =%" PRIi64, TD_TFILE_FULL_NAME(pTFile), toffset, + nbyte, toffset + nbyte); +#endif + ASSERT(pTFile->info.fsize == toffset); if (offset) { @@ -157,9 +161,9 @@ int64_t tdAppendTFile(STFile *pTFile, void *buf, int64_t nbyte, int64_t *offset) } int32_t tdOpenTFile(STFile *pTFile, int flags) { - ASSERT(!TD_FILE_OPENED(pTFile)); + ASSERT(!TD_TFILE_OPENED(pTFile)); - pTFile->pFile = taosOpenFile(TD_FILE_FULL_NAME(pTFile), flags); + pTFile->pFile = taosOpenFile(TD_TFILE_FULL_NAME(pTFile), flags); if (pTFile->pFile == NULL) { terrno = TAOS_SYSTEM_ERROR(errno); return -1; @@ -169,9 +173,9 @@ int32_t tdOpenTFile(STFile *pTFile, int flags) { } void tdCloseTFile(STFile *pTFile) { - if (TD_FILE_OPENED(pTFile)) { + if (TD_TFILE_OPENED(pTFile)) { taosCloseFile(&pTFile->pFile); - TD_FILE_SET_CLOSED(pTFile); + TD_TFILE_SET_CLOSED(pTFile); } } @@ -183,8 +187,8 @@ int32_t tdInitTFile(STFile *pTFile, STfs *pTfs, const char *fname) { char fullname[TSDB_FILENAME_LEN]; SDiskID did = {0}; - TD_FILE_SET_STATE(pTFile, TD_FILE_STATE_OK); - TD_FILE_SET_CLOSED(pTFile); + TD_TFILE_SET_STATE(pTFile, TD_FILE_STATE_OK); + TD_TFILE_SET_CLOSED(pTFile); memset(&(pTFile->info), 0, sizeof(pTFile->info)); pTFile->info.magic = TD_FILE_INIT_MAGIC; @@ -202,18 +206,18 @@ int32_t tdInitTFile(STFile *pTFile, STfs *pTfs, const char *fname) { int32_t tdCreateTFile(STFile *pTFile, STfs *pTfs, bool updateHeader, int8_t fType) { ASSERT(pTFile->info.fsize == 0 && pTFile->info.magic == TD_FILE_INIT_MAGIC); - pTFile->pFile = taosOpenFile(TD_FILE_FULL_NAME(pTFile), TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); + pTFile->pFile = taosOpenFile(TD_TFILE_FULL_NAME(pTFile), TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); if (pTFile->pFile == NULL) { if (errno == ENOENT) { // Try to create directory recursively - char *s = strdup(TD_FILE_REL_NAME(pTFile)); - if (tfsMkdirRecurAt(pTfs, taosDirName(s), TD_FILE_DID(pTFile)) < 0) { + char *s = strdup(TD_TFILE_REL_NAME(pTFile)); + if (tfsMkdirRecurAt(pTfs, taosDirName(s), TD_TFILE_DID(pTFile)) < 0) { taosMemoryFreeClear(s); return -1; } taosMemoryFreeClear(s); - pTFile->pFile = taosOpenFile(TD_FILE_FULL_NAME(pTFile), TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); + pTFile->pFile = taosOpenFile(TD_TFILE_FULL_NAME(pTFile), TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); if (pTFile->pFile == NULL) { terrno = TAOS_SYSTEM_ERROR(errno); return -1; @@ -240,7 +244,7 @@ int32_t tdCreateTFile(STFile *pTFile, STfs *pTfs, bool updateHeader, int8_t fTyp return 0; } -int32_t tdRemoveTFile(STFile *pTFile) { return tfsRemoveFile(TD_FILE_F(pTFile)); } +int32_t tdRemoveTFile(STFile *pTFile) { return tfsRemoveFile(TD_TFILE_F(pTFile)); } // smaXXXUtil ================ // ... \ No newline at end of file diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index f36998d60618ef10f0eb32799ae4dadf48b3bfbd..ac36dbf774f50d81e9cbd90599cfbef7a4318df6 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -348,7 +348,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { SSubmitReq* pCont = (SSubmitReq*)&pHead->body; if (tqLogScanExec(pTq, &pHandle->execHandle, pCont, &dataRsp, workerId) < 0) { - ASSERT(0); + /*ASSERT(0);*/ } // TODO batch optimization: // TODO continue scan until meeting batch requirement @@ -358,11 +358,10 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { if (tqSendDataRsp(pTq, pMsg, pReq, &dataRsp) < 0) { code = -1; } - + goto OVER; } else { fetchVer++; } - goto OVER; } else { ASSERT(pHandle->fetchMeta); diff --git a/source/dnode/vnode/src/vnd/vnodeOpen.c b/source/dnode/vnode/src/vnd/vnodeOpen.c index 4d73dbc4062288e807a5c081a59b3c308dbc1d93..57d7386667a60939a8a199bb98a0f5119cda3987 100644 --- a/source/dnode/vnode/src/vnd/vnodeOpen.c +++ b/source/dnode/vnode/src/vnd/vnodeOpen.c @@ -152,14 +152,14 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) { return pVnode; _err: - if (pVnode->pSma) smaClose(pVnode->pSma); + if (pVnode->pSma) smaCloseEnv(pVnode->pSma); if (pVnode->pQuery) vnodeQueryClose(pVnode); if (pVnode->pTq) tqClose(pVnode->pTq); if (pVnode->pWal) walClose(pVnode->pWal); if (pVnode->pTsdb) tsdbClose(&pVnode->pTsdb); + if (pVnode->pSma) smaCloseEx(pVnode->pSma); if (pVnode->pMeta) metaClose(pVnode->pMeta); - tsem_destroy(&(pVnode->canCommit)); taosMemoryFree(pVnode); return NULL; diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index d27fcb4f039a1086fe255dc423dcbe81be557701..2ddeb8ba2b2891319c0847d5834f418aa4b82b22 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -136,7 +136,7 @@ int32_t vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRp if (vnodeProcessDropTbReq(pVnode, version, pReq, len, pRsp) < 0) goto _err; break; case TDMT_VND_DROP_TTL_TABLE: - if (vnodeProcessDropTtlTbReq(pVnode, version, pReq, len, pRsp) < 0) goto _err; + //if (vnodeProcessDropTtlTbReq(pVnode, version, pReq, len, pRsp) < 0) goto _err; break; case TDMT_VND_CREATE_SMA: { if (vnodeProcessCreateTSmaReq(pVnode, version, pReq, len, pRsp) < 0) goto _err; diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c index b998f401951380b15c95a1033a0c8281165dc2e9..e9b64389aa0e3c0c839849127577fe411d150c52 100644 --- a/source/dnode/vnode/src/vnd/vnodeSync.c +++ b/source/dnode/vnode/src/vnd/vnodeSync.c @@ -73,7 +73,7 @@ static int32_t vnodeSetStandBy(SVnode *pVnode) { vInfo("vgId:%d, set standby success", TD_VID(pVnode)); return 0; } else { - vError("vgId:%d, failed to set standby since %s", TD_VID(pVnode), terrstr()); + vError("vgId:%d, failed to set standby after leader transfer since %s", TD_VID(pVnode), terrstr()); return -1; } } @@ -243,7 +243,7 @@ int32_t vnodeProcessSyncReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { char *syncNodeStr = sync2SimpleStr(pVnode->sync); static int64_t vndTick = 0; if (++vndTick % 10 == 1) { - vGTrace("vgId:%d, sync heartbeat msg:%s, %s", syncGetVgId(pVnode->sync), TMSG_INFO(pMsg->msgType), syncNodeStr); + vGTrace("vgId:%d, sync trace msg:%s, %s", syncGetVgId(pVnode->sync), TMSG_INFO(pMsg->msgType), syncNodeStr); } if (gRaftDetailLog) { char logBuf[512] = {0}; diff --git a/source/libs/catalog/inc/catalogInt.h b/source/libs/catalog/inc/catalogInt.h index 74caa717b8e62b38ec87432cd9fefb86741a8392..a5768d9003a538602c74c28a6df21887a68a44f2 100644 --- a/source/libs/catalog/inc/catalogInt.h +++ b/source/libs/catalog/inc/catalogInt.h @@ -205,6 +205,7 @@ typedef struct SCtgJob { SArray* pTasks; int32_t taskDone; SMetaData jobRes; + int32_t jobResCode; int32_t taskIdx; SRWLatch taskLock; @@ -284,24 +285,26 @@ typedef struct SCtgApiStat { } SCtgApiStat; typedef struct SCtgRuntimeStat { - uint64_t qNum; - uint64_t qDoneNum; + uint64_t numOfOpAbort; + uint64_t numOfOpEnqueue; + uint64_t numOfOpDequeue; } SCtgRuntimeStat; typedef struct SCtgCacheStat { - uint64_t clusterNum; - uint64_t dbNum; - uint64_t tblNum; - uint64_t stblNum; - uint64_t userNum; - uint64_t vgHitNum; - uint64_t vgMissNum; - uint64_t tbMetaHitNum; - uint64_t tbMetaMissNum; - uint64_t tbIndexHitNum; - uint64_t tbIndexMissNum; - uint64_t userHitNum; - uint64_t userMissNum; + uint64_t numOfCluster; + uint64_t numOfDb; + uint64_t numOfTbl; + uint64_t numOfStb; + uint64_t numOfUser; + uint64_t numOfVgHit; + uint64_t numOfVgMiss; + uint64_t numOfMetaHit; + uint64_t numOfMetaMiss; + uint64_t numOfIndexHit; + uint64_t numOfIndexMiss; + uint64_t numOfUserHit; + uint64_t numOfUserMiss; + uint64_t numOfClear; } SCtgCacheStat; typedef struct SCatalogStat { @@ -371,6 +374,7 @@ typedef struct SCtgDropTbIndexMsg { typedef struct SCtgClearCacheMsg { SCatalog* pCtg; + bool freeCtg; } SCtgClearCacheMsg; typedef struct SCtgUpdateEpsetMsg { @@ -385,6 +389,7 @@ typedef struct SCtgCacheOperation { void *data; bool syncOp; tsem_t rspSem; + bool stopQueue; } SCtgCacheOperation; typedef struct SCtgQNode { @@ -394,6 +399,7 @@ typedef struct SCtgQNode { typedef struct SCtgQueue { SRWLatch qlock; + bool stopQueue; SCtgQNode *head; SCtgQNode *tail; tsem_t reqSem; @@ -513,8 +519,35 @@ typedef struct SCtgOperation { #define CTG_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; } return _code; } while (0) #define CTG_ERR_JRET(c) do { code = c; if (code != TSDB_CODE_SUCCESS) { terrno = code; goto _return; } } while (0) -#define CTG_API_LEAVE(c) do { int32_t __code = c; CTG_UNLOCK(CTG_READ, &gCtgMgmt.lock); CTG_API_DEBUG("CTG API leave %s", __FUNCTION__); CTG_RET(__code); } while (0) -#define CTG_API_ENTER() do { CTG_API_DEBUG("CTG API enter %s", __FUNCTION__); CTG_LOCK(CTG_READ, &gCtgMgmt.lock); if (atomic_load_8((int8_t*)&gCtgMgmt.exit)) { CTG_API_LEAVE(TSDB_CODE_CTG_OUT_OF_SERVICE); } } while (0) +#define CTG_API_LEAVE(c) do { \ + int32_t __code = c; \ + CTG_UNLOCK(CTG_READ, &gCtgMgmt.lock); \ + CTG_API_DEBUG("CTG API leave %s", __FUNCTION__); \ + CTG_RET(__code); \ +} while (0) + +#define CTG_API_ENTER() do { \ + CTG_API_DEBUG("CTG API enter %s", __FUNCTION__); \ + CTG_LOCK(CTG_READ, &gCtgMgmt.lock); \ + if (atomic_load_8((int8_t*)&gCtgMgmt.exit)) { \ + CTG_API_LEAVE(TSDB_CODE_CTG_OUT_OF_SERVICE); \ + } \ +} while (0) + + +#define CTG_API_LEAVE_NOLOCK(c) do { \ + int32_t __code = c; \ + CTG_API_DEBUG("CTG API leave %s", __FUNCTION__); \ + CTG_RET(__code); \ + } while (0) + +#define CTG_API_ENTER_NOLOCK() do { \ + CTG_API_DEBUG("CTG API enter %s", __FUNCTION__); \ + if (atomic_load_8((int8_t*)&gCtgMgmt.exit)) { \ + CTG_API_LEAVE_NOLOCK(TSDB_CODE_CTG_OUT_OF_SERVICE); \ + } \ +} while (0) + void ctgdShowTableMeta(SCatalog* pCtg, const char *tbName, STableMeta* p); void ctgdShowClusterCache(SCatalog* pCtg); @@ -547,7 +580,7 @@ int32_t ctgUpdateTbMetaEnqueue(SCatalog* pCtg, STableMetaOutput *output, bool sy int32_t ctgUpdateUserEnqueue(SCatalog* pCtg, SGetUserAuthRsp *pAuth, bool syncReq); int32_t ctgUpdateVgEpsetEnqueue(SCatalog* pCtg, char *dbFName, int32_t vgId, SEpSet* pEpSet); int32_t ctgUpdateTbIndexEnqueue(SCatalog* pCtg, STableIndex **pIndex, bool syncOp); -int32_t ctgClearCacheEnqueue(SCatalog* pCtg, bool syncOp); +int32_t ctgClearCacheEnqueue(SCatalog* pCtg, bool freeCtg, bool stopQueue, bool syncOp); int32_t ctgMetaRentInit(SCtgRentMgmt *mgmt, uint32_t rentSec, int8_t type); int32_t ctgMetaRentAdd(SCtgRentMgmt *mgmt, void *meta, int64_t id, int32_t size); int32_t ctgMetaRentGet(SCtgRentMgmt *mgmt, void **res, uint32_t *num, int32_t size); @@ -582,17 +615,18 @@ int32_t ctgGetTableCfgFromVnode(SCatalog* pCtg, SRequestConnInfo *pConn, const S int32_t ctgGetTableCfgFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const SName* pTableName, STableCfg **out, SCtgTask* pTask); int32_t ctgGetSvrVerFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, char **out, SCtgTask* pTask); -int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, const SCatalogReq* pReq, catalogCallback fp, void* param, int32_t* taskNum); +int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, const SCatalogReq* pReq, catalogCallback fp, void* param); int32_t ctgLaunchJob(SCtgJob *pJob); int32_t ctgMakeAsyncRes(SCtgJob *pJob); int32_t ctgLaunchSubTask(SCtgTask *pTask, CTG_TASK_TYPE type, ctgSubTaskCbFp fp, void* param); int32_t ctgGetTbCfgCb(SCtgTask *pTask); +void ctgFreeHandle(SCatalog* pCatalog); int32_t ctgCloneVgInfo(SDBVgInfo *src, SDBVgInfo **dst); int32_t ctgCloneMetaOutput(STableMetaOutput *output, STableMetaOutput **pOutput); int32_t ctgGenerateVgList(SCatalog *pCtg, SHashObj *vgHash, SArray** pList); void ctgFreeJob(void* job); -void ctgFreeHandle(SCatalog* pCtg); +void ctgFreeHandleImpl(SCatalog* pCtg); void ctgFreeVgInfo(SDBVgInfo *vgInfo); int32_t ctgGetVgInfoFromHashValue(SCatalog *pCtg, SDBVgInfo *dbInfo, const SName *pTableName, SVgroupInfo *pVgroup); void ctgResetTbMetaTask(SCtgTask* pTask); @@ -608,6 +642,8 @@ int32_t ctgUpdateSendTargetInfo(SMsgSendInfo *pMsgSendInfo, int32_t msgType, SCt int32_t ctgCloneTableIndex(SArray* pIndex, SArray** pRes); void ctgFreeSTableIndex(void *info); void ctgClearSubTaskRes(SCtgSubRes *pRes); +void ctgFreeQNode(SCtgQNode *node); +void ctgClearHandle(SCatalog* pCtg); extern SCatalogMgmt gCtgMgmt; diff --git a/source/libs/catalog/src/catalog.c b/source/libs/catalog/src/catalog.c index abead99cb01607a503595c9092c0701ace0660d1..3a7ad4a2d613c22eabbc134acaae1b59175004a1 100644 --- a/source/libs/catalog/src/catalog.c +++ b/source/libs/catalog/src/catalog.c @@ -99,7 +99,7 @@ int32_t ctgRefreshTbMeta(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgTbMetaCtx* STableMetaOutput* output = taosMemoryCalloc(1, sizeof(STableMetaOutput)); if (NULL == output) { ctgError("malloc %d failed", (int32_t)sizeof(STableMetaOutput)); - CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } if (CTG_FLAG_IS_SYS_DB(ctx->flag)) { @@ -264,7 +264,7 @@ int32_t ctgUpdateTbMeta(SCatalog* pCtg, STableMetaRsp* rspMsg, bool syncOp) { STableMetaOutput* output = taosMemoryCalloc(1, sizeof(STableMetaOutput)); if (NULL == output) { ctgError("malloc %d failed", (int32_t)sizeof(STableMetaOutput)); - CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } int32_t code = 0; @@ -442,7 +442,7 @@ int32_t ctgGetTbDistVgInfo(SCatalog* pCtg, SRequestConnInfo *pConn, SName* pTabl vgList = taosArrayInit(1, sizeof(SVgroupInfo)); if (NULL == vgList) { ctgError("taosArrayInit %d failed", (int32_t)sizeof(SVgroupInfo)); - CTG_ERR_JRET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); } if (NULL == taosArrayPush(vgList, &vgroupInfo)) { @@ -548,9 +548,11 @@ int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle) { CTG_ERR_RET(TSDB_CODE_CTG_INVALID_INPUT); } + CTG_API_ENTER(); + if (NULL == gCtgMgmt.pCluster) { qError("catalog cluster cache are not ready, clusterId:0x%" PRIx64, clusterId); - CTG_ERR_RET(TSDB_CODE_CTG_NOT_READY); + CTG_API_LEAVE(TSDB_CODE_CTG_NOT_READY); } int32_t code = 0; @@ -562,13 +564,13 @@ int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle) { if (ctg && (*ctg)) { *catalogHandle = *ctg; qDebug("got catalog handle from cache, clusterId:0x%" PRIx64 ", CTG:%p", clusterId, *ctg); - return TSDB_CODE_SUCCESS; + CTG_API_LEAVE(TSDB_CODE_SUCCESS); } clusterCtg = taosMemoryCalloc(1, sizeof(SCatalog)); if (NULL == clusterCtg) { qError("calloc %d failed", (int32_t)sizeof(SCatalog)); - CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); + CTG_API_LEAVE(TSDB_CODE_OUT_OF_MEMORY); } clusterCtg->clusterId = clusterId; @@ -580,13 +582,19 @@ int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle) { false, HASH_ENTRY_LOCK); if (NULL == clusterCtg->dbCache) { qError("taosHashInit %d dbCache failed", CTG_DEFAULT_CACHE_DB_NUMBER); - CTG_ERR_JRET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); + } + + clusterCtg->userCache = taosHashInit(gCtgMgmt.cfg.maxUserCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK); + if (NULL == clusterCtg->userCache) { + qError("taosHashInit %d user cache failed", gCtgMgmt.cfg.maxUserCacheNum); + CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); } code = taosHashPut(gCtgMgmt.pCluster, &clusterId, sizeof(clusterId), &clusterCtg, POINTER_BYTES); if (code) { if (HASH_NODE_EXIST(code)) { - ctgFreeHandle(clusterCtg); + ctgFreeHandleImpl(clusterCtg); continue; } @@ -601,34 +609,15 @@ int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle) { *catalogHandle = clusterCtg; - CTG_CACHE_STAT_INC(clusterNum, 1); + CTG_CACHE_STAT_INC(numOfCluster, 1); - return TSDB_CODE_SUCCESS; + CTG_API_LEAVE(TSDB_CODE_SUCCESS); _return: - ctgFreeHandle(clusterCtg); - - CTG_RET(code); -} + ctgFreeHandleImpl(clusterCtg); -void catalogFreeHandle(SCatalog* pCtg) { - if (NULL == pCtg) { - return; - } - - if (taosHashRemove(gCtgMgmt.pCluster, &pCtg->clusterId, sizeof(pCtg->clusterId))) { - ctgWarn("taosHashRemove from cluster failed, may already be freed, clusterId:0x%" PRIx64, pCtg->clusterId); - return; - } - - CTG_CACHE_STAT_DEC(clusterNum, 1); - - uint64_t clusterId = pCtg->clusterId; - - ctgFreeHandle(pCtg); - - ctgInfo("handle freed, culsterId:0x%" PRIx64, clusterId); + CTG_API_LEAVE(code); } int32_t catalogGetDBVgVersion(SCatalog* pCtg, const char* dbFName, int32_t* version, int64_t* dbId, int32_t* tableNum) { @@ -1008,7 +997,7 @@ int32_t catalogGetAllMeta(SCatalog* pCtg, SRequestConnInfo *pConn, const SCatalo pRsp->pTableMeta = taosArrayInit(tbNum, POINTER_BYTES); if (NULL == pRsp->pTableMeta) { ctgError("taosArrayInit %d failed", tbNum); - CTG_ERR_JRET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); } for (int32_t i = 0; i < tbNum; ++i) { @@ -1023,7 +1012,7 @@ int32_t catalogGetAllMeta(SCatalog* pCtg, SRequestConnInfo *pConn, const SCatalo if (NULL == taosArrayPush(pRsp->pTableMeta, &pTableMeta)) { ctgError("taosArrayPush failed, idx:%d", i); taosMemoryFreeClear(pTableMeta); - CTG_ERR_JRET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); } } } @@ -1058,14 +1047,9 @@ int32_t catalogAsyncGetAllMeta(SCatalog* pCtg, SRequestConnInfo *pConn, const SC CTG_API_LEAVE(TSDB_CODE_CTG_INVALID_INPUT); } - int32_t code = 0, taskNum = 0; + int32_t code = 0; SCtgJob *pJob = NULL; - CTG_ERR_JRET(ctgInitJob(pCtg, pConn, &pJob, pReq, fp, param, &taskNum)); - if (taskNum <= 0) { - SMetaData* pMetaData = taosMemoryCalloc(1, sizeof(SMetaData)); - fp(pMetaData, param, TSDB_CODE_SUCCESS); - CTG_API_LEAVE(TSDB_CODE_SUCCESS); - } + CTG_ERR_JRET(ctgInitJob(pCtg, pConn, &pJob, pReq, fp, param)); CTG_ERR_JRET(ctgLaunchJob(pJob)); @@ -1073,6 +1057,7 @@ int32_t catalogAsyncGetAllMeta(SCatalog* pCtg, SRequestConnInfo *pConn, const SC // *jobId = pJob->refId; _return: + if (pJob) { taosReleaseRef(gCtgMgmt.jobPool, pJob->refId); @@ -1142,12 +1127,14 @@ int32_t catalogGetExpiredUsers(SCatalog* pCtg, SUserAuthVersion** users, uint32_ } *num = taosHashGetSize(pCtg->userCache); - if (*num > 0) { - *users = taosMemoryCalloc(*num, sizeof(SUserAuthVersion)); - if (NULL == *users) { - ctgError("calloc %d userAuthVersion failed", *num); - CTG_API_LEAVE(TSDB_CODE_OUT_OF_MEMORY); - } + if (*num <= 0) { + CTG_API_LEAVE(TSDB_CODE_SUCCESS); + } + + *users = taosMemoryCalloc(*num, sizeof(SUserAuthVersion)); + if (NULL == *users) { + ctgError("calloc %d userAuthVersion failed", *num); + CTG_API_LEAVE(TSDB_CODE_OUT_OF_MEMORY); } uint32_t i = 0; @@ -1159,6 +1146,11 @@ int32_t catalogGetExpiredUsers(SCatalog* pCtg, SUserAuthVersion** users, uint32_ (*users)[i].user[len] = 0; (*users)[i].version = pAuth->version; ++i; + if (i >= *num) { + taosHashCancelIterate(pCtg->userCache, pAuth); + break; + } + pAuth = taosHashIterate(pCtg->userCache, pAuth); } @@ -1274,19 +1266,19 @@ int32_t catalogUpdateUserAuthInfo(SCatalog* pCtg, SGetUserAuthRsp* pAuth) { } int32_t catalogClearCache(void) { - CTG_API_ENTER(); + CTG_API_ENTER_NOLOCK(); qInfo("start to clear catalog cache"); if (NULL == gCtgMgmt.pCluster || atomic_load_8((int8_t*)&gCtgMgmt.exit)) { - CTG_API_LEAVE(TSDB_CODE_SUCCESS); + CTG_API_LEAVE_NOLOCK(TSDB_CODE_SUCCESS); } - int32_t code = ctgClearCacheEnqueue(NULL, true); + int32_t code = ctgClearCacheEnqueue(NULL, false, false, true); qInfo("clear catalog cache end, code: %s", tstrerror(code)); - CTG_API_LEAVE(code); + CTG_API_LEAVE_NOLOCK(code); } @@ -1299,32 +1291,12 @@ void catalogDestroy(void) { atomic_store_8((int8_t*)&gCtgMgmt.exit, true); - if (tsem_post(&gCtgMgmt.queue.reqSem)) { - qError("tsem_post failed, error:%s", tstrerror(TAOS_SYSTEM_ERROR(errno))); - } - - while (CTG_IS_LOCKED(&gCtgMgmt.lock)) { - taosUsleep(1); - } - - CTG_LOCK(CTG_WRITE, &gCtgMgmt.lock); - - SCatalog* pCtg = NULL; - void* pIter = taosHashIterate(gCtgMgmt.pCluster, NULL); - while (pIter) { - pCtg = *(SCatalog**)pIter; - - if (pCtg) { - catalogFreeHandle(pCtg); - } - - pIter = taosHashIterate(gCtgMgmt.pCluster, pIter); + if (!taosCheckCurrentInDll()) { + ctgClearCacheEnqueue(NULL, true, true, true); } taosHashCleanup(gCtgMgmt.pCluster); gCtgMgmt.pCluster = NULL; - if (CTG_IS_LOCKED(&gCtgMgmt.lock) == TD_RWLATCH_WRITE_FLAG_COPY) CTG_UNLOCK(CTG_WRITE, &gCtgMgmt.lock); - qInfo("catalog destroyed"); } diff --git a/source/libs/catalog/src/ctgAsync.c b/source/libs/catalog/src/ctgAsync.c index 18c95397dd8b725e262adc1ac8a89fff3a47777a..455f2bd6a760b008bd2c008a8510207e9f570a18 100644 --- a/source/libs/catalog/src/ctgAsync.c +++ b/source/libs/catalog/src/ctgAsync.c @@ -427,7 +427,7 @@ int32_t ctgInitTask(SCtgJob *pJob, CTG_TASK_TYPE type, void* param, int32_t *tas return TSDB_CODE_SUCCESS; } -int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, const SCatalogReq* pReq, catalogCallback fp, void* param, int32_t* taskNum) { +int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, const SCatalogReq* pReq, catalogCallback fp, void* param) { int32_t code = 0; int32_t tbMetaNum = (int32_t)taosArrayGetSize(pReq->pTableMeta); int32_t dbVgNum = (int32_t)taosArrayGetSize(pReq->pDbVgroup); @@ -443,11 +443,7 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, const int32_t tbIndexNum = (int32_t)taosArrayGetSize(pReq->pTableIndex); int32_t tbCfgNum = (int32_t)taosArrayGetSize(pReq->pTableCfg); - *taskNum = tbMetaNum + dbVgNum + udfNum + tbHashNum + qnodeNum + dnodeNum + svrVerNum + dbCfgNum + indexNum + userNum + dbInfoNum + tbIndexNum + tbCfgNum; - if (*taskNum <= 0) { - ctgDebug("Empty input for job, no need to retrieve meta, reqId:0x%" PRIx64, pConn->requestId); - return TSDB_CODE_SUCCESS; - } + int32_t taskNum = tbMetaNum + dbVgNum + udfNum + tbHashNum + qnodeNum + dnodeNum + svrVerNum + dbCfgNum + indexNum + userNum + dbInfoNum + tbIndexNum + tbCfgNum; *job = taosMemoryCalloc(1, sizeof(SCtgJob)); if (NULL == *job) { @@ -477,15 +473,15 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, const pJob->tbCfgNum = tbCfgNum; pJob->svrVerNum = svrVerNum; - pJob->pTasks = taosArrayInit(*taskNum, sizeof(SCtgTask)); + pJob->pTasks = taosArrayInit(taskNum, sizeof(SCtgTask)); if (NULL == pJob->pTasks) { - ctgError("taosArrayInit %d tasks failed", *taskNum); + ctgError("taosArrayInit %d tasks failed", taskNum); CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); } - if (pReq->forceUpdate) { - CTG_ERR_JRET(ctgHandleForceUpdate(pCtg, *taskNum, pJob, pReq)); + if (pReq->forceUpdate && taskNum) { + CTG_ERR_JRET(ctgHandleForceUpdate(pCtg, taskNum, pJob, pReq)); } for (int32_t i = 0; i < dbVgNum; ++i) { @@ -558,11 +554,12 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, const taosAcquireRef(gCtgMgmt.jobPool, pJob->refId); - qDebug("QID:0x%" PRIx64 ", jobId: 0x%" PRIx64 " initialized, task num %d, forceUpdate %d", pJob->queryId, pJob->refId, *taskNum, pReq->forceUpdate); + qDebug("QID:0x%" PRIx64 ", jobId: 0x%" PRIx64 " initialized, task num %d, forceUpdate %d", pJob->queryId, pJob->refId, taskNum, pReq->forceUpdate); return TSDB_CODE_SUCCESS; _return: + taosMemoryFreeClear(*job); CTG_RET(code); } @@ -763,7 +760,7 @@ int32_t ctgDumpSvrVer(SCtgTask* pTask) { return TSDB_CODE_SUCCESS; } -int32_t ctgInvokeSubCb(SCtgTask *pTask) { +int32_t ctgCallSubCb(SCtgTask *pTask) { int32_t code = 0; CTG_LOCK(CTG_WRITE, &pTask->lock); @@ -790,6 +787,15 @@ _return: CTG_RET(code); } +int32_t ctgCallUserCb(void* param) { + SCtgJob* pJob = (SCtgJob*)param; + + (*pJob->userFp)(&pJob->jobRes, pJob->userParam, pJob->jobResCode); + + taosRemoveRef(gCtgMgmt.jobPool, pJob->refId); + + return TSDB_CODE_SUCCESS; +} int32_t ctgHandleTaskEnd(SCtgTask* pTask, int32_t rspCode) { SCtgJob* pJob = pTask->pJob; @@ -804,7 +810,7 @@ int32_t ctgHandleTaskEnd(SCtgTask* pTask, int32_t rspCode) { pTask->code = rspCode; pTask->status = CTG_TASK_DONE; - ctgInvokeSubCb(pTask); + ctgCallSubCb(pTask); int32_t taskDone = atomic_add_fetch_32(&pJob->taskDone, 1); if (taskDone < taosArrayGetSize(pJob->pTasks)) { @@ -818,9 +824,12 @@ _return: qDebug("QID:0x%" PRIx64 " ctg call user callback with rsp %s", pJob->queryId, tstrerror(code)); - (*pJob->userFp)(&pJob->jobRes, pJob->userParam, code); + pJob->jobResCode = code; - taosRemoveRef(gCtgMgmt.jobPool, pJob->refId); + //taosSsleep(2); + //qDebug("QID:0x%" PRIx64 " ctg after sleep", pJob->queryId); + + taosAsyncExec(ctgCallUserCb, pJob, NULL); CTG_RET(code); } @@ -1697,6 +1706,12 @@ int32_t ctgLaunchJob(SCtgJob *pJob) { pTask->status = CTG_TASK_LAUNCHED; } + if (taskNum <= 0) { + qDebug("QID:0x%" PRIx64 " ctg call user callback with rsp %s", pJob->queryId, tstrerror(pJob->jobResCode)); + + taosAsyncExec(ctgCallUserCb, pJob, NULL); + } + return TSDB_CODE_SUCCESS; } diff --git a/source/libs/catalog/src/ctgCache.c b/source/libs/catalog/src/ctgCache.c index eeb627624b5b0eabb34df92f4362c0c1ddff18da..77c1e5b8b119d349e9fb83b8490123a4846c9cb6 100644 --- a/source/libs/catalog/src/ctgCache.c +++ b/source/libs/catalog/src/ctgCache.c @@ -214,7 +214,7 @@ int32_t ctgAcquireVgInfoFromCache(SCatalog* pCtg, const char *dbFName, SCtgDBCac *pCache = dbCache; - CTG_CACHE_STAT_INC(vgHitNum, 1); + CTG_CACHE_STAT_INC(numOfVgHit, 1); ctgDebug("Got db vgInfo from cache, dbFName:%s", dbFName); @@ -228,7 +228,7 @@ _return: *pCache = NULL; - CTG_CACHE_STAT_INC(vgMissNum, 1); + CTG_CACHE_STAT_INC(numOfVgMiss, 1); return TSDB_CODE_SUCCESS; } @@ -260,7 +260,7 @@ int32_t ctgAcquireTbMetaFromCache(SCatalog* pCtg, char *dbFName, char* tbName, S ctgDebug("tb %s meta got in cache, dbFName:%s", tbName, dbFName); - CTG_CACHE_STAT_INC(tbMetaHitNum, 1); + CTG_CACHE_STAT_INC(numOfMetaHit, 1); return TSDB_CODE_SUCCESS; @@ -268,7 +268,7 @@ _return: ctgReleaseTbMetaToCache(pCtg, dbCache, pCache); - CTG_CACHE_STAT_INC(tbMetaMissNum, 1); + CTG_CACHE_STAT_INC(numOfMetaMiss, 1); return TSDB_CODE_SUCCESS; } @@ -307,7 +307,7 @@ int32_t ctgAcquireStbMetaFromCache(SCatalog* pCtg, char *dbFName, uint64_t suid, ctgDebug("stb 0x%" PRIx64 " meta got in cache, dbFName:%s", suid, dbFName); - CTG_CACHE_STAT_INC(tbMetaHitNum, 1); + CTG_CACHE_STAT_INC(numOfMetaHit, 1); return TSDB_CODE_SUCCESS; @@ -315,7 +315,7 @@ _return: ctgReleaseTbMetaToCache(pCtg, dbCache, pCache); - CTG_CACHE_STAT_INC(tbMetaMissNum, 1); + CTG_CACHE_STAT_INC(numOfMetaMiss, 1); *pDb = NULL; *pTb = NULL; @@ -351,7 +351,7 @@ int32_t ctgAcquireTbIndexFromCache(SCatalog* pCtg, char *dbFName, char* tbName, ctgDebug("tb %s index got in cache, dbFName:%s", tbName, dbFName); - CTG_CACHE_STAT_INC(tbIndexHitNum, 1); + CTG_CACHE_STAT_INC(numOfIndexHit, 1); return TSDB_CODE_SUCCESS; @@ -359,7 +359,7 @@ _return: ctgReleaseTbIndexToCache(pCtg, dbCache, pCache); - CTG_CACHE_STAT_INC(tbIndexMissNum, 1); + CTG_CACHE_STAT_INC(numOfIndexMiss, 1); return TSDB_CODE_SUCCESS; } @@ -455,7 +455,7 @@ int32_t ctgReadTbMetaFromCache(SCatalog* pCtg, SCtgTbMetaCtx* ctx, STableMeta** *pTableMeta = taosMemoryRealloc(*pTableMeta, metaSize); if (NULL == *pTableMeta) { ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache); - CTG_ERR_JRET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); } memcpy(&(*pTableMeta)->sversion, &stbMeta->sversion, metaSize - sizeof(SCTableMeta)); @@ -583,11 +583,6 @@ _return: } int32_t ctgChkAuthFromCache(SCatalog* pCtg, char* user, char* dbFName, AUTH_TYPE type, bool *inCache, bool *pass) { - if (NULL == pCtg->userCache) { - ctgDebug("empty user auth cache, user:%s", user); - goto _return; - } - SCtgUserAuth *pUser = (SCtgUserAuth *)taosHashGet(pCtg->userCache, user, strlen(user)); if (NULL == pUser) { ctgDebug("user not in cache, user:%s", user); @@ -597,7 +592,7 @@ int32_t ctgChkAuthFromCache(SCatalog* pCtg, char* user, char* dbFName, AUTH_TYPE *inCache = true; ctgDebug("Got user from cache, user:%s", user); - CTG_CACHE_STAT_INC(userHitNum, 1); + CTG_CACHE_STAT_INC(numOfUserHit, 1); if (pUser->superUser) { *pass = true; @@ -626,7 +621,7 @@ int32_t ctgChkAuthFromCache(SCatalog* pCtg, char* user, char* dbFName, AUTH_TYPE _return: *inCache = false; - CTG_CACHE_STAT_INC(userMissNum, 1); + CTG_CACHE_STAT_INC(numOfUserMiss, 1); return TSDB_CODE_SUCCESS; } @@ -649,7 +644,7 @@ int32_t ctgEnqueue(SCatalog* pCtg, SCtgCacheOperation *operation) { SCtgQNode *node = taosMemoryCalloc(1, sizeof(SCtgQNode)); if (NULL == node) { qError("calloc %d failed", (int32_t)sizeof(SCtgQNode)); - CTG_RET(TSDB_CODE_CTG_MEM_ERROR); + CTG_RET(TSDB_CODE_OUT_OF_MEMORY); } if (operation->syncOp) { @@ -659,12 +654,18 @@ int32_t ctgEnqueue(SCatalog* pCtg, SCtgCacheOperation *operation) { node->op = operation; CTG_LOCK(CTG_WRITE, &gCtgMgmt.queue.qlock); + if (gCtgMgmt.queue.stopQueue) { + ctgFreeQNode(node); + CTG_UNLOCK(CTG_WRITE, &gCtgMgmt.queue.qlock); + CTG_RET(TSDB_CODE_CTG_EXIT); + } + gCtgMgmt.queue.stopQueue = operation->stopQueue; gCtgMgmt.queue.tail->next = node; gCtgMgmt.queue.tail = node; CTG_UNLOCK(CTG_WRITE, &gCtgMgmt.queue.qlock); CTG_QUEUE_INC(); - CTG_RT_STAT_INC(qNum, 1); + CTG_RT_STAT_INC(numOfOpEnqueue, 1); tsem_post(&gCtgMgmt.queue.reqSem); @@ -687,7 +688,7 @@ int32_t ctgDropDbCacheEnqueue(SCatalog* pCtg, const char *dbFName, int64_t dbId) SCtgDropDBMsg *msg = taosMemoryMalloc(sizeof(SCtgDropDBMsg)); if (NULL == msg) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropDBMsg)); - CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } char *p = strchr(dbFName, '.'); @@ -720,7 +721,7 @@ int32_t ctgDropDbVgroupEnqueue(SCatalog* pCtg, const char *dbFName, bool syncOp) SCtgDropDbVgroupMsg *msg = taosMemoryMalloc(sizeof(SCtgDropDbVgroupMsg)); if (NULL == msg) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropDbVgroupMsg)); - CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } char *p = strchr(dbFName, '.'); @@ -754,7 +755,7 @@ int32_t ctgDropStbMetaEnqueue(SCatalog* pCtg, const char *dbFName, int64_t dbId, SCtgDropStbMetaMsg *msg = taosMemoryMalloc(sizeof(SCtgDropStbMetaMsg)); if (NULL == msg) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropStbMetaMsg)); - CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } msg->pCtg = pCtg; @@ -786,7 +787,7 @@ int32_t ctgDropTbMetaEnqueue(SCatalog* pCtg, const char *dbFName, int64_t dbId, SCtgDropTblMetaMsg *msg = taosMemoryMalloc(sizeof(SCtgDropTblMetaMsg)); if (NULL == msg) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropTblMetaMsg)); - CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } msg->pCtg = pCtg; @@ -816,7 +817,7 @@ int32_t ctgUpdateVgroupEnqueue(SCatalog* pCtg, const char *dbFName, int64_t dbId if (NULL == msg) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateVgMsg)); ctgFreeVgInfo(dbInfo); - CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } char *p = strchr(dbFName, '.'); @@ -851,7 +852,7 @@ int32_t ctgUpdateTbMetaEnqueue(SCatalog* pCtg, STableMetaOutput *output, bool sy SCtgUpdateTbMetaMsg *msg = taosMemoryMalloc(sizeof(SCtgUpdateTbMetaMsg)); if (NULL == msg) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTbMetaMsg)); - CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } char *p = strchr(output->dbFName, '.'); @@ -883,7 +884,7 @@ int32_t ctgUpdateVgEpsetEnqueue(SCatalog* pCtg, char *dbFName, int32_t vgId, SEp SCtgUpdateEpsetMsg *msg = taosMemoryMalloc(sizeof(SCtgUpdateEpsetMsg)); if (NULL == msg) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateEpsetMsg)); - CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } msg->pCtg = pCtg; @@ -915,7 +916,7 @@ int32_t ctgUpdateUserEnqueue(SCatalog* pCtg, SGetUserAuthRsp *pAuth, bool syncOp SCtgUpdateUserMsg *msg = taosMemoryMalloc(sizeof(SCtgUpdateUserMsg)); if (NULL == msg) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateUserMsg)); - CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } msg->pCtg = pCtg; @@ -944,7 +945,7 @@ int32_t ctgUpdateTbIndexEnqueue(SCatalog* pCtg, STableIndex **pIndex, bool syncO SCtgUpdateTbIndexMsg *msg = taosMemoryMalloc(sizeof(SCtgUpdateTbIndexMsg)); if (NULL == msg) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTbIndexMsg)); - CTG_ERR_JRET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); } msg->pCtg = pCtg; @@ -975,7 +976,7 @@ int32_t ctgDropTbIndexEnqueue(SCatalog* pCtg, SName* pName, bool syncOp) { SCtgDropTbIndexMsg *msg = taosMemoryMalloc(sizeof(SCtgDropTbIndexMsg)); if (NULL == msg) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropTbIndexMsg)); - CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } msg->pCtg = pCtg; @@ -996,19 +997,21 @@ _return: } -int32_t ctgClearCacheEnqueue(SCatalog* pCtg, bool syncOp) { +int32_t ctgClearCacheEnqueue(SCatalog* pCtg, bool freeCtg, bool stopQueue, bool syncOp) { int32_t code = 0; SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation)); op->opId = CTG_OP_CLEAR_CACHE; op->syncOp = syncOp; + op->stopQueue = stopQueue; SCtgClearCacheMsg *msg = taosMemoryMalloc(sizeof(SCtgClearCacheMsg)); if (NULL == msg) { ctgError("malloc %d failed", (int32_t)sizeof(SCtgClearCacheMsg)); - CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } msg->pCtg = pCtg; + msg->freeCtg = freeCtg; op->data = msg; CTG_ERR_JRET(ctgEnqueue(pCtg, op)); @@ -1033,7 +1036,7 @@ int32_t ctgMetaRentInit(SCtgRentMgmt *mgmt, uint32_t rentSec, int8_t type) { mgmt->slots = taosMemoryCalloc(1, msgSize); if (NULL == mgmt->slots) { qError("calloc %d failed", (int32_t)msgSize); - CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } qDebug("meta rent initialized, type:%d, slotNum:%d", type, mgmt->slotNum); @@ -1053,13 +1056,13 @@ int32_t ctgMetaRentAdd(SCtgRentMgmt *mgmt, void *meta, int64_t id, int32_t size) slot->meta = taosArrayInit(CTG_DEFAULT_RENT_SLOT_SIZE, size); if (NULL == slot->meta) { qError("taosArrayInit %d failed, id:0x%"PRIx64", slot idx:%d, type:%d", CTG_DEFAULT_RENT_SLOT_SIZE, id, widx, mgmt->type); - CTG_ERR_JRET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); } } if (NULL == taosArrayPush(slot->meta, meta)) { qError("taosArrayPush meta to rent failed, id:0x%"PRIx64", slot idx:%d, type:%d", id, widx, mgmt->type); - CTG_ERR_JRET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); } slot->needSort = true; @@ -1080,7 +1083,7 @@ int32_t ctgMetaRentUpdate(SCtgRentMgmt *mgmt, void *meta, int64_t id, int32_t si CTG_LOCK(CTG_WRITE, &slot->lock); if (NULL == slot->meta) { - qError("empty meta slot, id:0x%"PRIx64", slot idx:%d, type:%d", id, widx, mgmt->type); + qDebug("empty meta slot, id:0x%"PRIx64", slot idx:%d, type:%d", id, widx, mgmt->type); CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR); } @@ -1177,7 +1180,7 @@ int32_t ctgMetaRentGetImpl(SCtgRentMgmt *mgmt, void **res, uint32_t *num, int32_ *res = taosMemoryMalloc(msize); if (NULL == *res) { qError("malloc %d failed", (int32_t)msize); - CTG_ERR_JRET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); } void *meta = taosArrayGet(slot->meta, 0); @@ -1227,13 +1230,13 @@ int32_t ctgAddNewDBCache(SCatalog *pCtg, const char *dbFName, uint64_t dbId) { newDBCache.tbCache = taosHashInit(gCtgMgmt.cfg.maxTblCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); if (NULL == newDBCache.tbCache) { ctgError("taosHashInit %d metaCache failed", gCtgMgmt.cfg.maxTblCacheNum); - CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } newDBCache.stbCache = taosHashInit(gCtgMgmt.cfg.maxTblCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), true, HASH_ENTRY_LOCK); if (NULL == newDBCache.stbCache) { ctgError("taosHashInit %d stbCache failed", gCtgMgmt.cfg.maxTblCacheNum); - CTG_ERR_JRET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); } code = taosHashPut(pCtg->dbCache, dbFName, strlen(dbFName), &newDBCache, sizeof(SCtgDBCache)); @@ -1244,10 +1247,10 @@ int32_t ctgAddNewDBCache(SCatalog *pCtg, const char *dbFName, uint64_t dbId) { } ctgError("taosHashPut db to cache failed, dbFName:%s", dbFName); - CTG_ERR_JRET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); } - CTG_CACHE_STAT_INC(dbNum, 1); + CTG_CACHE_STAT_INC(numOfDb, 1); SDbVgVersion vgVersion = {.dbId = newDBCache.dbId, .vgVersion = -1}; strncpy(vgVersion.dbFName, dbFName, sizeof(vgVersion.dbFName)); @@ -1308,7 +1311,7 @@ int32_t ctgRemoveDBFromCache(SCatalog* pCtg, SCtgDBCache *dbCache, const char* d CTG_ERR_RET(TSDB_CODE_CTG_DB_DROPPED); } - CTG_CACHE_STAT_DEC(dbNum, 1); + CTG_CACHE_STAT_DEC(numOfDb, 1); ctgInfo("db removed from cache, dbFName:%s, dbId:0x%"PRIx64, dbFName, dbId); return TSDB_CODE_SUCCESS; @@ -1405,7 +1408,7 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam if (taosHashRemove(dbCache->stbCache, &orig->suid, sizeof(orig->suid))) { ctgError("stb not exist in stbCache, dbFName:%s, stb:%s, suid:0x%"PRIx64, dbFName, tbName, orig->suid); } else { - CTG_CACHE_STAT_DEC(stblNum, 1); + CTG_CACHE_STAT_DEC(numOfStb, 1); ctgDebug("stb removed from stbCache, dbFName:%s, stb:%s, suid:0x%"PRIx64, dbFName, tbName, orig->suid); } @@ -1419,7 +1422,7 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam if (taosHashPut(dbCache->tbCache, tbName, strlen(tbName), &cache, sizeof(SCtgTbCache)) != 0) { taosMemoryFree(meta); ctgError("taosHashPut new tbCache failed, dbFName:%s, tbName:%s, tbType:%d", dbFName, tbName, meta->tableType); - CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } pCache = taosHashGet(dbCache->tbCache, tbName, strlen(tbName)); @@ -1429,7 +1432,7 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam } if (NULL == orig) { - CTG_CACHE_STAT_INC(tblNum, 1); + CTG_CACHE_STAT_INC(numOfTbl, 1); } ctgDebug("tbmeta updated to cache, dbFName:%s, tbName:%s, tbType:%d", dbFName, tbName, meta->tableType); @@ -1441,10 +1444,10 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam if (origSuid != meta->suid && taosHashPut(dbCache->stbCache, &meta->suid, sizeof(meta->suid), tbName, strlen(tbName) + 1) != 0) { ctgError("taosHashPut to stable cache failed, suid:0x%"PRIx64, meta->suid); - CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } - CTG_CACHE_STAT_INC(stblNum, 1); + CTG_CACHE_STAT_INC(numOfStb, 1); ctgDebug("stb 0x%" PRIx64 " updated to cache, dbFName:%s, tbName:%s, tbType:%d", meta->suid, dbFName, tbName, meta->tableType); @@ -1472,7 +1475,7 @@ int32_t ctgWriteTbIndexToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char* dbFNa ctgFreeSTableIndex(*index); taosMemoryFreeClear(*index); ctgError("taosHashPut new tbCache failed, tbName:%s", tbName); - CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } *index = NULL; @@ -1520,6 +1523,39 @@ _return: CTG_RET(code); } +void ctgClearAllInstance(void) { + SCatalog* pCtg = NULL; + + void* pIter = taosHashIterate(gCtgMgmt.pCluster, NULL); + while (pIter) { + pCtg = *(SCatalog**)pIter; + + if (pCtg) { + ctgClearHandle(pCtg); + } + + pIter = taosHashIterate(gCtgMgmt.pCluster, pIter); + } +} + +void ctgFreeAllInstance(void) { + SCatalog* pCtg = NULL; + + void* pIter = taosHashIterate(gCtgMgmt.pCluster, NULL); + while (pIter) { + pCtg = *(SCatalog**)pIter; + + if (pCtg) { + ctgFreeHandle(pCtg); + } + + pIter = taosHashIterate(gCtgMgmt.pCluster, pIter); + } + + taosHashClear(gCtgMgmt.pCluster); +} + + int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) { int32_t code = 0; SCtgUpdateVgMsg *msg = operation->data; @@ -1528,27 +1564,27 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) { SCatalog* pCtg = msg->pCtg; if (NULL == dbInfo->vgHash) { - return TSDB_CODE_SUCCESS; + goto _return; } if (dbInfo->vgVersion < 0 || taosHashGetSize(dbInfo->vgHash) <= 0) { ctgError("invalid db vgInfo, dbFName:%s, vgHash:%p, vgVersion:%d, vgHashSize:%d", dbFName, dbInfo->vgHash, dbInfo->vgVersion, taosHashGetSize(dbInfo->vgHash)); - CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_JRET(TSDB_CODE_APP_ERROR); } bool newAdded = false; SDbVgVersion vgVersion = {.dbId = msg->dbId, .vgVersion = dbInfo->vgVersion, .numOfTable = dbInfo->numOfTable}; SCtgDBCache *dbCache = NULL; - CTG_ERR_RET(ctgGetAddDBCache(msg->pCtg, dbFName, msg->dbId, &dbCache)); + CTG_ERR_JRET(ctgGetAddDBCache(msg->pCtg, dbFName, msg->dbId, &dbCache)); if (NULL == dbCache) { ctgInfo("conflict db update, ignore this update, dbFName:%s, dbId:0x%"PRIx64, dbFName, msg->dbId); - CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR); + CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR); } SCtgVgCache *vgCache = &dbCache->vgCache; - CTG_ERR_RET(ctgWLockVgInfo(msg->pCtg, dbCache)); + CTG_ERR_JRET(ctgWLockVgInfo(msg->pCtg, dbCache)); if (vgCache->vgInfo) { SDBVgInfo *vgInfo = vgCache->vgInfo; @@ -1557,14 +1593,14 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) { ctgDebug("db vgVer is old, dbFName:%s, vgVer:%d, curVer:%d", dbFName, dbInfo->vgVersion, vgInfo->vgVersion); ctgWUnlockVgInfo(dbCache); - return TSDB_CODE_SUCCESS; + goto _return; } if (dbInfo->vgVersion == vgInfo->vgVersion && dbInfo->numOfTable == vgInfo->numOfTable) { ctgDebug("no new db vgVer or numOfTable, dbFName:%s, vgVer:%d, numOfTable:%d", dbFName, dbInfo->vgVersion, dbInfo->numOfTable); ctgWUnlockVgInfo(dbCache); - return TSDB_CODE_SUCCESS; + goto _return; } ctgFreeVgInfo(vgInfo); @@ -1714,13 +1750,13 @@ int32_t ctgOpDropStbMeta(SCtgCacheOperation *operation) { if (taosHashRemove(dbCache->stbCache, &msg->suid, sizeof(msg->suid))) { ctgDebug("stb not exist in stbCache, may be removed, dbFName:%s, stb:%s, suid:0x%"PRIx64, msg->dbFName, msg->stbName, msg->suid); } else { - CTG_CACHE_STAT_DEC(stblNum, 1); + CTG_CACHE_STAT_DEC(numOfStb, 1); } if (taosHashRemove(dbCache->tbCache, msg->stbName, strlen(msg->stbName))) { ctgError("stb not exist in cache, dbFName:%s, stb:%s, suid:0x%"PRIx64, msg->dbFName, msg->stbName, msg->suid); } else { - CTG_CACHE_STAT_DEC(tblNum, 1); + CTG_CACHE_STAT_DEC(numOfTbl, 1); } ctgInfo("stb removed from cache, dbFName:%s, stbName:%s, suid:0x%"PRIx64, msg->dbFName, msg->stbName, msg->suid); @@ -1756,7 +1792,7 @@ int32_t ctgOpDropTbMeta(SCtgCacheOperation *operation) { ctgError("tb %s not exist in cache, dbFName:%s", msg->tbName, msg->dbFName); CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR); } else { - CTG_CACHE_STAT_DEC(tblNum, 1); + CTG_CACHE_STAT_DEC(numOfTbl, 1); } ctgDebug("table %s removed from cache, dbFName:%s", msg->tbName, msg->dbFName); @@ -1772,14 +1808,6 @@ int32_t ctgOpUpdateUser(SCtgCacheOperation *operation) { int32_t code = 0; SCtgUpdateUserMsg *msg = operation->data; SCatalog* pCtg = msg->pCtg; - - if (NULL == pCtg->userCache) { - pCtg->userCache = taosHashInit(gCtgMgmt.cfg.maxUserCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK); - if (NULL == pCtg->userCache) { - ctgError("taosHashInit %d user cache failed", gCtgMgmt.cfg.maxUserCacheNum); - CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); - } - } SCtgUserAuth *pUser = (SCtgUserAuth *)taosHashGet(pCtg->userCache, msg->userAuth.user, strlen(msg->userAuth.user)); if (NULL == pUser) { @@ -1937,49 +1965,59 @@ int32_t ctgOpClearCache(SCtgCacheOperation *operation) { SCtgClearCacheMsg *msg = operation->data; SCatalog* pCtg = msg->pCtg; + CTG_LOCK(CTG_WRITE, &gCtgMgmt.lock); + if (pCtg) { - catalogFreeHandle(pCtg); + if (msg->freeCtg) { + ctgFreeHandle(pCtg); + } else { + ctgClearHandle(pCtg); + } + goto _return; } - - void* pIter = taosHashIterate(gCtgMgmt.pCluster, NULL); - while (pIter) { - pCtg = *(SCatalog**)pIter; - if (pCtg) { - catalogFreeHandle(pCtg); - } - - pIter = taosHashIterate(gCtgMgmt.pCluster, pIter); + if (msg->freeCtg) { + ctgFreeAllInstance(); + } else { + ctgClearAllInstance(); } - taosHashClear(gCtgMgmt.pCluster); - _return: + + CTG_UNLOCK(CTG_WRITE, &gCtgMgmt.lock); taosMemoryFreeClear(msg); CTG_RET(code); } - -void ctgUpdateThreadUnexpectedStopped(void) { - if (!atomic_load_8((int8_t*)&gCtgMgmt.exit) && CTG_IS_LOCKED(&gCtgMgmt.lock) > 0) CTG_UNLOCK(CTG_READ, &gCtgMgmt.lock); -} - void ctgCleanupCacheQueue(void) { SCtgQNode *node = NULL; SCtgQNode *nodeNext = NULL; + SCtgCacheOperation *op = NULL; + bool stopQueue = false; while (true) { node = gCtgMgmt.queue.head->next; while (node) { if (node->op) { - taosMemoryFree(node->op->data); - if (node->op->syncOp) { - tsem_post(&node->op->rspSem); + op = node->op; + if (op->stopQueue) { + SCatalog *pCtg = ((SCtgUpdateMsgHeader *)op->data)->pCtg; + ctgDebug("process [%s] operation", gCtgCacheOperation[op->opId].name); + (*gCtgCacheOperation[op->opId].func)(op); + stopQueue = true; + CTG_RT_STAT_INC(numOfOpDequeue, 1); + } else { + taosMemoryFree(op->data); + CTG_RT_STAT_INC(numOfOpAbort, 1); + } + + if (op->syncOp) { + tsem_post(&op->rspSem); } else { - taosMemoryFree(node->op); + taosMemoryFree(op); } } @@ -1989,7 +2027,7 @@ void ctgCleanupCacheQueue(void) { node = nodeNext; } - if (CTG_IS_LOCKED(&gCtgMgmt.lock)) { + if (!stopQueue) { taosUsleep(1); } else { break; @@ -2002,22 +2040,15 @@ void ctgCleanupCacheQueue(void) { void* ctgUpdateThreadFunc(void* param) { setThreadName("catalog"); -#ifdef WINDOWS - if (taosCheckCurrentInDll()) { - atexit(ctgUpdateThreadUnexpectedStopped); - } -#endif + qInfo("catalog update thread started"); - CTG_LOCK(CTG_READ, &gCtgMgmt.lock); - while (true) { if (tsem_wait(&gCtgMgmt.queue.reqSem)) { qError("ctg tsem_wait failed, error:%s", tstrerror(TAOS_SYSTEM_ERROR(errno))); } if (atomic_load_8((int8_t*)&gCtgMgmt.exit)) { - CTG_UNLOCK(CTG_READ, &gCtgMgmt.lock); ctgCleanupCacheQueue(); break; } @@ -2034,7 +2065,7 @@ void* ctgUpdateThreadFunc(void* param) { tsem_post(&operation->rspSem); } - CTG_RT_STAT_INC(qDoneNum, 1); + CTG_RT_STAT_INC(numOfOpDequeue, 1); ctgdShowCacheInfo(); ctgdShowClusterCache(pCtg); diff --git a/source/libs/catalog/src/ctgDbg.c b/source/libs/catalog/src/ctgDbg.c index 5f54362d8e95d4637a734e308d03900060cff03c..9195747bee094dd433b83527d2da69c4a9f2a882 100644 --- a/source/libs/catalog/src/ctgDbg.c +++ b/source/libs/catalog/src/ctgDbg.c @@ -19,7 +19,7 @@ #include "catalogInt.h" extern SCatalogMgmt gCtgMgmt; -SCtgDebug gCTGDebug = {.cacheEnable = true}; +SCtgDebug gCTGDebug = {0}; void ctgdUserCallback(SMetaData* pResult, void* param, int32_t code) { ASSERT(*(int32_t*)param == 1); @@ -255,8 +255,8 @@ int32_t ctgdEnableDebug(char *option) { } int32_t ctgdGetStatNum(char *option, void *res) { - if (0 == strcasecmp(option, "runtime.qDoneNum")) { - *(uint64_t *)res = atomic_load_64(&gCtgMgmt.stat.runtime.qDoneNum); + if (0 == strcasecmp(option, "runtime.numOfOpDequeue")) { + *(uint64_t *)res = atomic_load_64(&gCtgMgmt.stat.runtime.numOfOpDequeue); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/catalog/src/ctgUtil.c b/source/libs/catalog/src/ctgUtil.c index 0c10b69a2dca97472940cda05fcc25fa8f2af165..21e78d49254b8658a1bcacc53ede5d0a75071d02 100644 --- a/source/libs/catalog/src/ctgUtil.c +++ b/source/libs/catalog/src/ctgUtil.c @@ -52,6 +52,10 @@ char *ctgTaskTypeStr(CTG_TASK_TYPE type) { } } +void ctgFreeQNode(SCtgQNode *node) { + //TODO +} + void ctgFreeSTableIndex(void *info) { if (NULL == info) { return; @@ -141,10 +145,10 @@ void ctgFreeStbMetaCache(SCtgDBCache *dbCache) { return; } - int32_t stblNum = taosHashGetSize(dbCache->stbCache); + int32_t stbNum = taosHashGetSize(dbCache->stbCache); taosHashCleanup(dbCache->stbCache); dbCache->stbCache = NULL; - CTG_CACHE_STAT_DEC(stblNum, stblNum); + CTG_CACHE_STAT_DEC(numOfStb, stbNum); } void ctgFreeTbCacheImpl(SCtgTbCache *pCache) { @@ -168,7 +172,7 @@ void ctgFreeTbCache(SCtgDBCache *dbCache) { } taosHashCleanup(dbCache->tbCache); dbCache->tbCache = NULL; - CTG_CACHE_STAT_DEC(tblNum, tblNum); + CTG_CACHE_STAT_DEC(numOfTbl, tblNum); } void ctgFreeVgInfo(SDBVgInfo *vgInfo) { @@ -198,45 +202,108 @@ void ctgFreeDbCache(SCtgDBCache *dbCache) { ctgFreeTbCache(dbCache); } +void ctgFreeInstDbCache(SHashObj* pDbCache) { + if (NULL == pDbCache) { + return; + } + + int32_t dbNum = taosHashGetSize(pDbCache); + + void *pIter = taosHashIterate(pDbCache, NULL); + while (pIter) { + SCtgDBCache *dbCache = pIter; + atomic_store_8(&dbCache->deleted, 1); + ctgFreeDbCache(dbCache); + + pIter = taosHashIterate(pDbCache, pIter); + } + + taosHashCleanup(pDbCache); + + CTG_CACHE_STAT_DEC(numOfDb, dbNum); +} -void ctgFreeHandle(SCatalog* pCtg) { +void ctgFreeInstUserCache(SHashObj* pUserCache) { + if (NULL == pUserCache) { + return; + } + + int32_t userNum = taosHashGetSize(pUserCache); + + void *pIter = taosHashIterate(pUserCache, NULL); + while (pIter) { + SCtgUserAuth *userCache = pIter; + ctgFreeSCtgUserAuth(userCache); + + pIter = taosHashIterate(pUserCache, pIter); + } + + taosHashCleanup(pUserCache); + + CTG_CACHE_STAT_DEC(numOfUser, userNum); +} + +void ctgFreeHandleImpl(SCatalog* pCtg) { ctgFreeMetaRent(&pCtg->dbRent); ctgFreeMetaRent(&pCtg->stbRent); - - if (pCtg->dbCache) { - int32_t dbNum = taosHashGetSize(pCtg->dbCache); - - void *pIter = taosHashIterate(pCtg->dbCache, NULL); - while (pIter) { - SCtgDBCache *dbCache = pIter; - atomic_store_8(&dbCache->deleted, 1); - ctgFreeDbCache(dbCache); - - pIter = taosHashIterate(pCtg->dbCache, pIter); - } - taosHashCleanup(pCtg->dbCache); - CTG_CACHE_STAT_DEC(dbNum, dbNum); + ctgFreeInstDbCache(pCtg->dbCache); + ctgFreeInstUserCache(pCtg->userCache); + + taosMemoryFree(pCtg); +} + + +void ctgFreeHandle(SCatalog* pCtg) { + if (NULL == pCtg) { + return; } - if (pCtg->userCache) { - int32_t userNum = taosHashGetSize(pCtg->userCache); + uint64_t clusterId = pCtg->clusterId; - void *pIter = taosHashIterate(pCtg->userCache, NULL); - while (pIter) { - SCtgUserAuth *userCache = pIter; - ctgFreeSCtgUserAuth(userCache); + ctgFreeMetaRent(&pCtg->dbRent); + ctgFreeMetaRent(&pCtg->stbRent); - pIter = taosHashIterate(pCtg->userCache, pIter); - } + ctgFreeInstDbCache(pCtg->dbCache); + ctgFreeInstUserCache(pCtg->userCache); - taosHashCleanup(pCtg->userCache); - CTG_CACHE_STAT_DEC(userNum, userNum); - } + CTG_CACHE_STAT_DEC(numOfCluster, 1); taosMemoryFree(pCtg); + + ctgInfo("handle freed, culsterId:0x%" PRIx64, clusterId); } +void ctgClearHandle(SCatalog* pCtg) { + if (NULL == pCtg) { + return; + } + + uint64_t clusterId = pCtg->clusterId; + + ctgFreeMetaRent(&pCtg->dbRent); + ctgFreeMetaRent(&pCtg->stbRent); + + ctgFreeInstDbCache(pCtg->dbCache); + ctgFreeInstUserCache(pCtg->userCache); + + ctgMetaRentInit(&pCtg->dbRent, gCtgMgmt.cfg.dbRentSec, CTG_RENT_DB); + ctgMetaRentInit(&pCtg->stbRent, gCtgMgmt.cfg.stbRentSec, CTG_RENT_STABLE); + + pCtg->dbCache = taosHashInit(gCtgMgmt.cfg.maxDBCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK); + if (NULL == pCtg->dbCache) { + qError("taosHashInit %d dbCache failed", CTG_DEFAULT_CACHE_DB_NUMBER); + } + + pCtg->userCache = taosHashInit(gCtgMgmt.cfg.maxUserCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK); + if (NULL == pCtg->userCache) { + ctgError("taosHashInit %d user cache failed", gCtgMgmt.cfg.maxUserCacheNum); + } + + CTG_CACHE_STAT_INC(numOfClear, 1); + + ctgInfo("handle cleared, culsterId:0x%" PRIx64, clusterId); +} void ctgFreeSUseDbOutput(SUseDbOutput* pOutput) { if (NULL == pOutput) { @@ -590,7 +657,7 @@ int32_t ctgGenerateVgList(SCatalog *pCtg, SHashObj *vgHash, SArray** pList) { vgList = taosArrayInit(vgNum, sizeof(SVgroupInfo)); if (NULL == vgList) { ctgError("taosArrayInit failed, num:%d", vgNum); - CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } void *pIter = taosHashIterate(vgHash, NULL); @@ -600,7 +667,7 @@ int32_t ctgGenerateVgList(SCatalog *pCtg, SHashObj *vgHash, SArray** pList) { if (NULL == taosArrayPush(vgList, vgInfo)) { ctgError("taosArrayPush failed, vgId:%d", vgInfo->vgId); taosHashCancelIterate(vgHash, pIter); - CTG_ERR_JRET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); } pIter = taosHashIterate(vgHash, pIter); @@ -717,7 +784,7 @@ int32_t ctgCloneVgInfo(SDBVgInfo *src, SDBVgInfo **dst) { *dst = taosMemoryMalloc(sizeof(SDBVgInfo)); if (NULL == *dst) { qError("malloc %d failed", (int32_t)sizeof(SDBVgInfo)); - CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } memcpy(*dst, src, sizeof(SDBVgInfo)); @@ -727,7 +794,7 @@ int32_t ctgCloneVgInfo(SDBVgInfo *src, SDBVgInfo **dst) { if (NULL == (*dst)->vgHash) { qError("taosHashInit %d failed", (int32_t)hashSize); taosMemoryFreeClear(*dst); - CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } int32_t *vgId = NULL; @@ -740,7 +807,7 @@ int32_t ctgCloneVgInfo(SDBVgInfo *src, SDBVgInfo **dst) { taosHashCancelIterate(src->vgHash, pIter); taosHashCleanup((*dst)->vgHash); taosMemoryFreeClear(*dst); - CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } pIter = taosHashIterate(src->vgHash, pIter); @@ -756,7 +823,7 @@ int32_t ctgCloneMetaOutput(STableMetaOutput *output, STableMetaOutput **pOutput) *pOutput = taosMemoryMalloc(sizeof(STableMetaOutput)); if (NULL == *pOutput) { qError("malloc %d failed", (int32_t)sizeof(STableMetaOutput)); - CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } memcpy(*pOutput, output, sizeof(STableMetaOutput)); @@ -767,7 +834,7 @@ int32_t ctgCloneMetaOutput(STableMetaOutput *output, STableMetaOutput **pOutput) if (NULL == (*pOutput)->tbMeta) { qError("malloc %d failed", (int32_t)sizeof(STableMetaOutput)); taosMemoryFreeClear(*pOutput); - CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } memcpy((*pOutput)->tbMeta, output->tbMeta, metaSize); diff --git a/source/libs/catalog/test/catalogTests.cpp b/source/libs/catalog/test/catalogTests.cpp index aab341544f764047fed14430e5d718f603fef080..3245fcd16a10fea26e3a98376d2319c6a63f26df 100644 --- a/source/libs/catalog/test/catalogTests.cpp +++ b/source/libs/catalog/test/catalogTests.cpp @@ -1386,7 +1386,7 @@ TEST(tableMeta, updateStbMeta) { while (true) { uint64_t n = 0; - ctgdGetStatNum("runtime.qDoneNum", (void *)&n); + ctgdGetStatNum("runtime.numOfOpDequeue", (void *)&n); if (n != 3) { taosMsleep(50); } else { @@ -1456,7 +1456,7 @@ TEST(refreshGetMeta, normal2normal) { while (true) { uint64_t n = 0; - ctgdGetStatNum("runtime.qDoneNum", (void *)&n); + ctgdGetStatNum("runtime.numOfOpDequeue", (void *)&n); if (n > 0) { break; } @@ -1535,7 +1535,7 @@ TEST(refreshGetMeta, normal2notexist) { while (true) { uint64_t n = 0; - ctgdGetStatNum("runtime.qDoneNum", (void *)&n); + ctgdGetStatNum("runtime.numOfOpDequeue", (void *)&n); if (n > 0) { break; } @@ -1609,7 +1609,7 @@ TEST(refreshGetMeta, normal2child) { while (true) { uint64_t n = 0; - ctgdGetStatNum("runtime.qDoneNum", (void *)&n); + ctgdGetStatNum("runtime.numOfOpDequeue", (void *)&n); if (n > 0) { break; } @@ -1693,7 +1693,7 @@ TEST(refreshGetMeta, stable2child) { while (true) { uint64_t n = 0; - ctgdGetStatNum("runtime.qDoneNum", (void *)&n); + ctgdGetStatNum("runtime.numOfOpDequeue", (void *)&n); if (n > 0) { break; } @@ -1778,7 +1778,7 @@ TEST(refreshGetMeta, stable2stable) { while (true) { uint64_t n = 0; - ctgdGetStatNum("runtime.qDoneNum", (void *)&n); + ctgdGetStatNum("runtime.numOfOpDequeue", (void *)&n); if (n > 0) { break; } @@ -1866,7 +1866,7 @@ TEST(refreshGetMeta, child2stable) { while (true) { uint64_t n = 0; - ctgdGetStatNum("runtime.qDoneNum", (void *)&n); + ctgdGetStatNum("runtime.numOfOpDequeue", (void *)&n); if (n > 0) { break; } @@ -2083,7 +2083,7 @@ TEST(dbVgroup, getSetDbVgroupCase) { while (true) { uint64_t n = 0; - ctgdGetStatNum("runtime.qDoneNum", (void *)&n); + ctgdGetStatNum("runtime.numOfOpDequeue", (void *)&n); if (n > 0) { break; } @@ -2109,7 +2109,7 @@ TEST(dbVgroup, getSetDbVgroupCase) { while (true) { uint64_t n = 0; - ctgdGetStatNum("runtime.qDoneNum", (void *)&n); + ctgdGetStatNum("runtime.numOfOpDequeue", (void *)&n); if (n != 3) { taosMsleep(50); } else { diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c index d6b6456515c2d9077139effcb712a69e6c754555..377df8f8ace3674e10f2f4619c1ee62f3c3c2435 100644 --- a/source/libs/command/src/command.c +++ b/source/libs/command/src/command.c @@ -19,7 +19,31 @@ #include "tglobal.h" extern SConfig* tsCfg; -static int32_t getSchemaBytes(const SSchema* pSchema) { + +static int32_t buildRetrieveTableRsp(SSDataBlock* pBlock, int32_t numOfCols, SRetrieveTableRsp** pRsp) { + size_t rspSize = sizeof(SRetrieveTableRsp) + blockGetEncodeSize(pBlock); + *pRsp = taosMemoryCalloc(1, rspSize); + if (NULL == *pRsp) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + (*pRsp)->useconds = 0; + (*pRsp)->completed = 1; + (*pRsp)->precision = 0; + (*pRsp)->compressed = 0; + (*pRsp)->compLen = 0; + (*pRsp)->numOfRows = htonl(pBlock->info.rows); + (*pRsp)->numOfCols = htonl(numOfCols); + + int32_t len = 0; + blockEncode(pBlock, (*pRsp)->data, &len, numOfCols, false); + ASSERT(len == rspSize - sizeof(SRetrieveTableRsp)); + + blockDataDestroy(pBlock); + return TSDB_CODE_SUCCESS; +} + +static int32_t getSchemaBytes(const SSchema* pSchema) { switch (pSchema->type) { case TSDB_DATA_TYPE_BINARY: return (pSchema->bytes - VARSTR_HEADER_SIZE); @@ -89,26 +113,7 @@ static int32_t execDescribe(SNode* pStmt, SRetrieveTableRsp** pRsp) { SSDataBlock* pBlock = buildDescResultDataBlock(); setDescResultIntoDataBlock(pBlock, numOfRows, pDesc->pMeta); - size_t rspSize = sizeof(SRetrieveTableRsp) + blockGetEncodeSize(pBlock); - *pRsp = taosMemoryCalloc(1, rspSize); - if (NULL == *pRsp) { - return TSDB_CODE_OUT_OF_MEMORY; - } - - (*pRsp)->useconds = 0; - (*pRsp)->completed = 1; - (*pRsp)->precision = 0; - (*pRsp)->compressed = 0; - (*pRsp)->compLen = 0; - (*pRsp)->numOfRows = htonl(numOfRows); - (*pRsp)->numOfCols = htonl(DESCRIBE_RESULT_COLS); - - int32_t len = 0; - blockEncode(pBlock, (*pRsp)->data, &len, DESCRIBE_RESULT_COLS, false); - ASSERT(len == rspSize - sizeof(SRetrieveTableRsp)); - - blockDataDestroy(pBlock); - return TSDB_CODE_SUCCESS; + return buildRetrieveTableRsp(pBlock, DESCRIBE_RESULT_COLS, pRsp); } static int32_t execResetQueryCache() { return catalogClearCache(); } @@ -236,27 +241,7 @@ static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbFName, S static int32_t execShowCreateDatabase(SShowCreateDatabaseStmt* pStmt, SRetrieveTableRsp** pRsp) { SSDataBlock* pBlock = buildCreateDBResultDataBlock(); setCreateDBResultIntoDataBlock(pBlock, pStmt->dbName, pStmt->pCfg); - - size_t rspSize = sizeof(SRetrieveTableRsp) + blockGetEncodeSize(pBlock); - *pRsp = taosMemoryCalloc(1, rspSize); - if (NULL == *pRsp) { - return TSDB_CODE_OUT_OF_MEMORY; - } - - (*pRsp)->useconds = 0; - (*pRsp)->completed = 1; - (*pRsp)->precision = 0; - (*pRsp)->compressed = 0; - (*pRsp)->compLen = 0; - (*pRsp)->numOfRows = htonl(1); - (*pRsp)->numOfCols = htonl(SHOW_CREATE_DB_RESULT_COLS); - - int32_t len = 0; - blockEncode(pBlock, (*pRsp)->data, &len, SHOW_CREATE_DB_RESULT_COLS, false); - ASSERT(len == rspSize - sizeof(SRetrieveTableRsp)); - - blockDataDestroy(pBlock); - return TSDB_CODE_SUCCESS; + return buildRetrieveTableRsp(pBlock, SHOW_CREATE_DB_RESULT_COLS, pRsp); } static SSDataBlock* buildCreateTbResultDataBlock() { @@ -481,27 +466,7 @@ static int32_t execShowCreateTable(SShowCreateTableStmt* pStmt, SRetrieveTableRs if (code) { return code; } - - size_t rspSize = sizeof(SRetrieveTableRsp) + blockGetEncodeSize(pBlock); - *pRsp = taosMemoryCalloc(1, rspSize); - if (NULL == *pRsp) { - return TSDB_CODE_OUT_OF_MEMORY; - } - - (*pRsp)->useconds = 0; - (*pRsp)->completed = 1; - (*pRsp)->precision = 0; - (*pRsp)->compressed = 0; - (*pRsp)->compLen = 0; - (*pRsp)->numOfRows = htonl(1); - (*pRsp)->numOfCols = htonl(SHOW_CREATE_TB_RESULT_COLS); - - int32_t len = 0; - blockEncode(pBlock, (*pRsp)->data, &len, SHOW_CREATE_TB_RESULT_COLS, false); - ASSERT(len == rspSize - sizeof(SRetrieveTableRsp)); - - blockDataDestroy(pBlock); - return TSDB_CODE_SUCCESS; + return buildRetrieveTableRsp(pBlock, SHOW_CREATE_TB_RESULT_COLS, pRsp); } static int32_t execShowCreateSTable(SShowCreateTableStmt* pStmt, SRetrieveTableRsp** pRsp) { @@ -579,29 +544,59 @@ static int32_t execShowLocalVariables(SRetrieveTableRsp** pRsp) { if (code) { return code; } + return buildRetrieveTableRsp(pBlock, SHOW_LOCAL_VARIABLES_RESULT_COLS, pRsp); +} - size_t rspSize = sizeof(SRetrieveTableRsp) + blockGetEncodeSize(pBlock); - *pRsp = taosMemoryCalloc(1, rspSize); - if (NULL == *pRsp) { +static int32_t createSelectResultDataBlock(SNodeList* pProjects, SSDataBlock** pOutput) { + SSDataBlock* pBlock = taosMemoryCalloc(1, sizeof(SSDataBlock)); + if (NULL == pBlock) { return TSDB_CODE_OUT_OF_MEMORY; } - (*pRsp)->useconds = 0; - (*pRsp)->completed = 1; - (*pRsp)->precision = 0; - (*pRsp)->compressed = 0; - (*pRsp)->compLen = 0; - (*pRsp)->numOfRows = htonl(pBlock->info.rows); - (*pRsp)->numOfCols = htonl(SHOW_LOCAL_VARIABLES_RESULT_COLS); + pBlock->pDataBlock = taosArrayInit(LIST_LENGTH(pProjects), sizeof(SColumnInfoData)); - int32_t len = 0; - blockEncode(pBlock, (*pRsp)->data, &len, SHOW_LOCAL_VARIABLES_RESULT_COLS, false); - ASSERT(len == rspSize - sizeof(SRetrieveTableRsp)); + SNode* pProj = NULL; + FOREACH(pProj, pProjects) { + SColumnInfoData infoData = {0}; + infoData.info.type = ((SExprNode*)pProj)->resType.type; + infoData.info.bytes = ((SExprNode*)pProj)->resType.bytes; + taosArrayPush(pBlock->pDataBlock, &infoData); + } + *pOutput = pBlock; + return TSDB_CODE_SUCCESS; +} + +int32_t buildSelectResultDataBlock(SNodeList* pProjects, SSDataBlock* pBlock) { + int32_t numOfCols = LIST_LENGTH(pProjects); + blockDataEnsureCapacity(pBlock, 1); + + int32_t index = 0; + SNode* pProj = NULL; + FOREACH(pProj, pProjects) { + if (((SValueNode*)pProj)->isNull) { + colDataAppend(taosArrayGet(pBlock->pDataBlock, index++), 0, NULL, true); + } else { + colDataAppend(taosArrayGet(pBlock->pDataBlock, index++), 0, nodesGetValueFromNode((SValueNode*)pProj), false); + } + } + + pBlock->info.rows = 1; - blockDataDestroy(pBlock); return TSDB_CODE_SUCCESS; } +static int32_t execSelectWithoutFrom(SSelectStmt* pSelect, SRetrieveTableRsp** pRsp) { + SSDataBlock* pBlock = NULL; + int32_t code = createSelectResultDataBlock(pSelect->pProjectionList, &pBlock); + if (TSDB_CODE_SUCCESS == code) { + code = buildSelectResultDataBlock(pSelect->pProjectionList, pBlock); + } + if (TSDB_CODE_SUCCESS == code) { + code = buildRetrieveTableRsp(pBlock, LIST_LENGTH(pSelect->pProjectionList), pRsp); + } + return code; +} + int32_t qExecCommand(SNode* pStmt, SRetrieveTableRsp** pRsp) { switch (nodeType(pStmt)) { case QUERY_NODE_DESCRIBE_STMT: @@ -618,6 +613,8 @@ int32_t qExecCommand(SNode* pStmt, SRetrieveTableRsp** pRsp) { return execAlterLocal((SAlterLocalStmt*)pStmt); case QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT: return execShowLocalVariables(pRsp); + case QUERY_NODE_SELECT_STMT: + return execSelectWithoutFrom((SSelectStmt*)pStmt, pRsp); default: break; } diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index 1cc3f9b874cafa35fdf887b266f203bf484d352c..6b5826bf886062d7aa4bf8f4837f5f2d23e924a1 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -253,18 +253,15 @@ typedef struct STableScanInfo { SReadHandle readHandle; SFileBlockLoadRecorder readRecorder; - int64_t numOfRows; SScanInfo scanInfo; int32_t scanTimes; SNode* pFilterNode; // filter info, which is push down by optimizer - SqlFunctionCtx* pCtx; // which belongs to the direct upstream operator operator query context - SResultRowInfo* pResultRowInfo; - int32_t* rowEntryInfoOffset; - SExprInfo* pExpr; + SqlFunctionCtx* pCtx; // which belongs to the direct upstream operator operator query context,todo: remove this by using SExprSup + int32_t* rowEntryInfoOffset; // todo: remove this by using SExprSup + SExprInfo* pExpr;// todo: remove this by using SExprSup + SSDataBlock* pResBlock; SArray* pColMatchInfo; - int32_t numOfOutput; - SExprSupp pseudoSup; SQueryTableDataCond cond; int32_t scanFlag; // table scan flag to denote if it is a repeat/reverse/main scan @@ -275,8 +272,13 @@ typedef struct STableScanInfo { int32_t curTWinIdx; int32_t currentGroupId; - uint64_t queryId; - uint64_t taskId; + uint64_t queryId; // todo remove it + uint64_t taskId; // todo remove it + + struct { + uint64_t uid; + int64_t t; + } scanStatus; } STableScanInfo; typedef struct STagScanInfo { @@ -321,31 +323,31 @@ typedef struct SessionWindowSupporter { } SessionWindowSupporter; typedef struct SStreamBlockScanInfo { + uint64_t tableUid; // queried super table uid + SExprInfo* pPseudoExpr; + int32_t numOfPseudoExpr; + int32_t primaryTsIndex; // primary time stamp slot id + SReadHandle readHandle; + SInterval interval; // if the upstream is an interval operator, the interval info is also kept here. + SArray* pColMatchInfo; // + SNode* pCondition; + SArray* pBlockLists; // multiple SSDatablock. SSDataBlock* pRes; // result SSDataBlock SSDataBlock* pUpdateRes; // update SSDataBlock int32_t updateResIndex; int32_t blockType; // current block type int32_t validBlockIndex; // Is current data has returned? - SColumnInfo* pCols; // the output column info uint64_t numOfExec; // execution times void* streamBlockReader;// stream block reader handle - SArray* pColMatchInfo; // - SNode* pCondition; + int32_t tsArrayIndex; SArray* tsArray; uint64_t groupId; SUpdateInfo* pUpdateInfo; - SExprInfo* pPseudoExpr; - int32_t numOfPseudoExpr; - - int32_t primaryTsIndex; // primary time stamp slot id - SReadHandle readHandle; - uint64_t tableUid; // queried super table uid EStreamScanMode scanMode; SOperatorInfo* pSnapshotReadOp; - SInterval interval; // if the upstream is an interval operator, the interval info is also kept here. SArray* childIds; SessionWindowSupporter sessionSup; bool assignBlockUid; // assign block uid to groupId, temporarily used for generating rollup SMA. @@ -416,6 +418,7 @@ typedef struct SIntervalAggOperatorInfo { STimeWindowAggSupp twAggSup; bool invertible; SArray* pPrevValues; // SArray used to keep the previous not null value for interpolation. + bool ignoreCloseWindow; } SIntervalAggOperatorInfo; typedef struct SStreamFinalIntervalOperatorInfo { @@ -437,6 +440,7 @@ typedef struct SStreamFinalIntervalOperatorInfo { SArray* pPullWins; // SPullWindowInfo int32_t pullIndex; SSDataBlock* pPullDataRes; + bool ignoreCloseWindow; } SStreamFinalIntervalOperatorInfo; typedef struct SAggOperatorInfo { @@ -574,6 +578,7 @@ typedef struct SStreamSessionAggOperatorInfo { SArray* pChildren; // cache for children's result; final stream operator SPhysiNode* pPhyNode; // create new child bool isFinal; + bool ignoreCloseWindow; } SStreamSessionAggOperatorInfo; typedef struct STimeSliceOperatorInfo { @@ -617,6 +622,7 @@ typedef struct SStreamStateAggOperatorInfo { void* pDelIterator; SArray* pScanWindow; SArray* pChildren; // cache for children's result; + bool ignoreCloseWindow; } SStreamStateAggOperatorInfo; typedef struct SSortedMergeOperatorInfo { @@ -683,7 +689,7 @@ int32_t appendDownstream(SOperatorInfo* p, SOperatorInfo** pDownstream, int32_t void initBasicInfo(SOptrBasicInfo* pInfo, SSDataBlock* pBlock); void cleanupBasicInfo(SOptrBasicInfo* pInfo); int32_t initExprSupp(SExprSupp* pSup, SExprInfo* pExprInfo, int32_t numOfExpr); -void cleanupExprSup(SExprSupp* pSup); +void cleanupExprSupp(SExprSupp* pSup); int32_t initAggInfo(SExprSupp *pSup, SAggSupporter* pAggSup, SExprInfo* pExprInfo, int32_t numOfCols, size_t keyBufSize, const char* pkey); void initResultSizeInfo(SOperatorInfo* pOperator, int32_t numOfRows); @@ -707,7 +713,7 @@ void destroyBasicOperatorInfo(void* param, int32_t numOfOutput); void appendOneRowToDataBlock(SSDataBlock* pBlock, STupleHandle* pTupleHandle); void setTbNameColData(void* pMeta, const SSDataBlock* pBlock, SColumnInfoData* pColInfoData, int32_t functionId); -void cleanupExecSupp(SExprSupp* pSupp); +int32_t doGetScanStatus(SOperatorInfo* pOperator, uint64_t* uid, int64_t* ts); SSDataBlock* loadNextDataBlock(void* param); diff --git a/source/libs/executor/src/executorMain.c b/source/libs/executor/src/executorMain.c index e4c0959185bb0e52de092164a49f9715d28c80c6..0871575d9521f14265e78b2c7f66dbb57b31f1c4 100644 --- a/source/libs/executor/src/executorMain.c +++ b/source/libs/executor/src/executorMain.c @@ -191,16 +191,6 @@ int32_t qAsyncKillTask(qTaskInfo_t qinfo) { return TSDB_CODE_SUCCESS; } -int32_t qIsTaskCompleted(qTaskInfo_t qinfo) { - SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)qinfo; - - if (pTaskInfo == NULL) { - return TSDB_CODE_QRY_INVALID_QHANDLE; - } - - return isTaskKilled(pTaskInfo); -} - void qDestroyTask(qTaskInfo_t qTaskHandle) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)qTaskHandle; qDebug("%s execTask completed, numOfRows:%" PRId64, GET_TASKID(pTaskInfo), pTaskInfo->pRoot->resultInfo.totalRows); @@ -242,3 +232,10 @@ int32_t qDeserializeTaskStatus(qTaskInfo_t tinfo, const char* pInput, int32_t le } +int32_t qGetStreamScanStatus(qTaskInfo_t tinfo, uint64_t* uid, int64_t* ts) { + SExecTaskInfo* pTaskInfo = (SExecTaskInfo*) tinfo; + + return TSDB_CODE_SUCCESS; +} + + diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 706fc875209ed4806b763d25eeb965fd21fb387c..95782ce0016a614eab97e53fc592ad569ea3af24 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -1033,7 +1033,7 @@ static uint32_t doFilterByBlockTimeWindow(STableScanInfo* pTableScanInfo, SSData SqlFunctionCtx* pCtx = pTableScanInfo->pCtx; uint32_t status = BLK_DATA_NOT_LOAD; - int32_t numOfOutput = pTableScanInfo->numOfOutput; + int32_t numOfOutput = 0;//pTableScanInfo->numOfOutput; for (int32_t i = 0; i < numOfOutput; ++i) { int32_t functionId = pCtx[i].functionId; int32_t colId = pTableScanInfo->pExpr[i].base.pParam[0].pCol->colId; @@ -2821,6 +2821,24 @@ int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t* order, int32_t* scan } } +int32_t doGetScanStatus(SOperatorInfo* pOperator, uint64_t* uid, int64_t* ts) { + int32_t type = pOperator->operatorType; + if (type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { + SStreamBlockScanInfo* pScanInfo = pOperator->info; + STableScanInfo* pSnapShotScanInfo = pScanInfo->pSnapshotReadOp->info; + *uid = pSnapShotScanInfo->scanStatus.uid; + *ts = pSnapShotScanInfo->scanStatus.t; + } else { + if (pOperator->pDownstream[0] == NULL) { + return TSDB_CODE_INVALID_PARA; + } else { + doGetScanStatus(pOperator->pDownstream[0], uid, ts); + } + } + + return TSDB_CODE_SUCCESS; +} + // this is a blocking operator static int32_t doOpenAggregateOptr(SOperatorInfo* pOperator) { if (OPTR_IS_OPENED(pOperator)) { @@ -3543,7 +3561,7 @@ static void destroyProjectOperatorInfo(void* param, int32_t numOfOutput) { taosArrayDestroy(pInfo->pPseudoColInfo); } -void cleanupExecSupp(SExprSupp* pSupp) { +void cleanupExprSupp(SExprSupp* pSupp) { destroySqlFunctionCtx(pSupp->pCtx, pSupp->numOfExprs); destroyExprInfo(pSupp->pExprInfo, pSupp->numOfExprs); @@ -3556,7 +3574,7 @@ static void destroyIndefinitOperatorInfo(void* param, int32_t numOfOutput) { taosArrayDestroy(pInfo->pPseudoColInfo); cleanupAggSup(&pInfo->aggSup); - cleanupExecSupp(&pInfo->scalarSup); + cleanupExprSupp(&pInfo->scalarSup); } void destroyExchangeOperatorInfo(void* param, int32_t numOfOutput) { diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c index 4e4aaba7f466595417b9878ebb367cd23ccf785e..0a14993c21233da11b9dba156215ab5ef34149b2 100644 --- a/source/libs/executor/src/groupoperator.c +++ b/source/libs/executor/src/groupoperator.c @@ -37,7 +37,7 @@ static void destroyGroupOperatorInfo(void* param, int32_t numOfOutput) { taosMemoryFreeClear(pInfo->keyBuf); taosArrayDestroy(pInfo->pGroupCols); taosArrayDestroy(pInfo->pGroupColVals); - cleanupExecSupp(&pInfo->scalarSup); + cleanupExprSupp(&pInfo->scalarSup); } static int32_t initGroupOptrInfo(SArray** pGroupColVals, int32_t* keyLen, char** keyBuf, const SArray* pGroupColList) { @@ -701,7 +701,7 @@ static void destroyPartitionOperatorInfo(void* param, int32_t numOfOutput) { taosHashCleanup(pInfo->pGroupSet); taosMemoryFree(pInfo->columnOffset); - cleanupExecSupp(&pInfo->scalarSup); + cleanupExprSupp(&pInfo->scalarSup); } SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SPartitionPhysiNode* pPartNode, SExecTaskInfo* pTaskInfo) { diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 8cfdb223132f3f9706a41e0234d82a92061cc538..ca4afdeb7fef74d2b8ec63a01af22e4b93740097 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -13,6 +13,7 @@ * along with this program. If not, see . */ +#include #include #include "filter.h" #include "function.h" @@ -413,6 +414,11 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator) { pTableScanInfo->readRecorder.elapsedTime += (taosGetTimestampUs() - st) / 1000.0; pOperator->cost.totalCost = pTableScanInfo->readRecorder.elapsedTime; + + // todo refactor + pTableScanInfo->scanStatus.uid = pBlock->info.uid; + pTableScanInfo->scanStatus.t = pBlock->info.window.ekey; + return pBlock; } return NULL; @@ -459,7 +465,7 @@ static SSDataBlock* doTableScanGroup(SOperatorInfo* pOperator) { int32_t total = pTableScanInfo->scanInfo.numOfAsc + pTableScanInfo->scanInfo.numOfDesc; if (pTableScanInfo->scanTimes < total) { if (pTableScanInfo->cond.order == TSDB_ORDER_ASC) { - prepareForDescendingScan(pTableScanInfo, pTableScanInfo->pCtx, pTableScanInfo->numOfOutput); + prepareForDescendingScan(pTableScanInfo, pTableScanInfo->pCtx, 0); tsdbResetReadHandle(pTableScanInfo->dataReader, &pTableScanInfo->cond, 0); pTableScanInfo->curTWinIdx = 0; } @@ -996,7 +1002,7 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) { SSDataBlock* pSDB = doDataScan(pInfo, pInfo->pPullDataRes, 0, &pInfo->pullDataResIndex); if (pSDB != NULL) { getUpdateDataBlock(pInfo, true, pSDB, NULL); - pSDB->info.type = STREAM_PUSH_DATA; + pSDB->info.type = STREAM_PULL_DATA; return pSDB; } pInfo->scanMode = STREAM_SCAN_FROM_DATAREADER; diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 6d287ef88752a6e0996b5968119a14a4dcff4596..95b16589eeb3f511130c31698c33de65db3e3507 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -813,6 +813,13 @@ static void removeResults(SArray* pWins, SArray* pUpdated) { } } +bool isOverdue(TSKEY ts, STimeWindowAggSupp* pSup) { + ASSERT(pSup->maxTs == INT64_MIN || pSup->maxTs > 0); + return pSup->maxTs != INT64_MIN && ts < pSup->maxTs - pSup->waterMark; +} + +bool isCloseWindow(STimeWindow* pWin, STimeWindowAggSupp* pSup) { return isOverdue(pWin->ekey, pSup); } + static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResultRowInfo, SSDataBlock* pBlock, int32_t scanFlag, SArray* pUpdated) { SIntervalAggOperatorInfo* pInfo = (SIntervalAggOperatorInfo*)pOperatorInfo->info; @@ -830,15 +837,15 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul STimeWindow win = getActiveTimeWindow(pInfo->aggSup.pResultBuf, pResultRowInfo, ts, &pInfo->interval, pInfo->interval.precision, &pInfo->win); + int32_t ret = TSDB_CODE_SUCCESS; + if (!pInfo->ignoreCloseWindow || !isCloseWindow(&win, &pInfo->twAggSup)) { + ret = setTimeWindowOutputBuf(pResultRowInfo, &win, (scanFlag == MAIN_SCAN), &pResult, tableGroupId, pSup->pCtx, + numOfOutput, pSup->rowEntryInfoOffset, &pInfo->aggSup, pTaskInfo); + if (ret != TSDB_CODE_SUCCESS || pResult == NULL) { + longjmp(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY); + } - int32_t ret = setTimeWindowOutputBuf(pResultRowInfo, &win, (scanFlag == MAIN_SCAN), &pResult, tableGroupId, - pSup->pCtx, numOfOutput, pSup->rowEntryInfoOffset, &pInfo->aggSup, pTaskInfo); - if (ret != TSDB_CODE_SUCCESS || pResult == NULL) { - longjmp(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY); - } - - if (pInfo->execModel == OPTR_EXEC_MODEL_STREAM) { - if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE) { + if (pInfo->execModel == OPTR_EXEC_MODEL_STREAM && pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE) { saveResultRow(pResult, tableGroupId, pUpdated); } } @@ -864,9 +871,11 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul doWindowBorderInterpolation(pInfo, pBlock, pResult, &win, startPos, forwardRows, pSup); } - updateTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &win, true); - doApplyFunctions(pTaskInfo, pSup->pCtx, &win, &pInfo->twAggSup.timeWindowData, startPos, forwardRows, tsCols, - pBlock->info.rows, numOfOutput, pInfo->order); + if (!pInfo->ignoreCloseWindow || !isCloseWindow(&win, &pInfo->twAggSup)) { + updateTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &win, true); + doApplyFunctions(pTaskInfo, pSup->pCtx, &win, &pInfo->twAggSup.timeWindowData, startPos, forwardRows, tsCols, + pBlock->info.rows, numOfOutput, pInfo->order); + } doCloseWindow(pResultRowInfo, pInfo, pResult); @@ -877,6 +886,12 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul if (startPos < 0) { break; } + if (pInfo->ignoreCloseWindow && isCloseWindow(&nextWin, &pInfo->twAggSup)) { + ekey = ascScan ? nextWin.ekey : nextWin.skey; + forwardRows = + getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, ekey, binarySearchForKey, NULL, pInfo->order); + continue; + } // null data, failed to allocate more memory buffer int32_t code = setTimeWindowOutputBuf(pResultRowInfo, &nextWin, (scanFlag == MAIN_SCAN), &pResult, tableGroupId, @@ -885,10 +900,8 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul longjmp(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY); } - if (pInfo->execModel == OPTR_EXEC_MODEL_STREAM) { - if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE) { - saveResultRow(pResult, tableGroupId, pUpdated); - } + if (pInfo->execModel == OPTR_EXEC_MODEL_STREAM && pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE) { + saveResultRow(pResult, tableGroupId, pUpdated); } ekey = ascScan ? nextWin.ekey : nextWin.skey; @@ -1291,11 +1304,6 @@ static int32_t getAllIntervalWindow(SHashObj* pHashMap, SArray* resWins) { return TSDB_CODE_SUCCESS; } -bool isCloseWindow(STimeWindow* pWin, STimeWindowAggSupp* pSup) { - ASSERT(pSup->maxTs == INT64_MIN || pSup->maxTs > 0); - return pSup->maxTs != INT64_MIN && pWin->ekey < pSup->maxTs - pSup->waterMark; -} - static int32_t closeIntervalWindow(SHashObj* pHashMap, STimeWindowAggSupp* pSup, SInterval* pInterval, SHashObj* pPullDataMap, SArray* closeWins) { void* pIte = NULL; @@ -1413,7 +1421,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) { doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf); pOperator->status = OP_RES_TO_RETURN; - + printDataBlock(pInfo->binfo.pRes, "single interval"); return pInfo->binfo.pRes->info.rows == 0 ? NULL : pInfo->binfo.pRes; } @@ -1524,6 +1532,7 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* pInfo->interval = *pInterval; pInfo->execModel = pTaskInfo->execModel; pInfo->twAggSup = *pTwAggSupp; + pInfo->ignoreCloseWindow = false; if (pPhyNode->window.pExprs != NULL) { int32_t numOfScalar = 0; @@ -2279,7 +2288,15 @@ static void doHashInterval(SOperatorInfo* pOperatorInfo, SSDataBlock* pSDataBloc STimeWindow nextWin = getActiveTimeWindow(pInfo->aggSup.pResultBuf, pResultRowInfo, ts, &pInfo->interval, pInfo->interval.precision, NULL); while (1) { - if (IS_FINAL_OP(pInfo) && isCloseWindow(&nextWin, &pInfo->twAggSup) && pInfo->pChildren) { + bool isClosed = isCloseWindow(&nextWin, &pInfo->twAggSup); + if (pInfo->ignoreCloseWindow && isClosed) { + startPos = getNexWindowPos(&pInfo->interval, &pSDataBlock->info, tsCols, startPos, nextWin.ekey, &nextWin); + if (startPos < 0) { + break; + } + continue; + } + if (IS_FINAL_OP(pInfo) && isClosed && pInfo->pChildren) { bool ignore = true; SWinRes winRes = { .ts = nextWin.skey, @@ -2299,14 +2316,14 @@ static void doHashInterval(SOperatorInfo* pOperatorInfo, SSDataBlock* pSDataBloc int32_t chId = getChildIndex(pSDataBlock); index = taosArraySearchIdx(chArray, &chId, compareInt32Val, TD_EQ); } - if (index != -1 && pSDataBlock->info.type == STREAM_PUSH_DATA) { + if (index != -1 && pSDataBlock->info.type == STREAM_PULL_DATA) { taosArrayRemove(chArray, index); if (taosArrayGetSize(chArray) == 0) { // pull data is over taosHashRemove(pInfo->pPullDataMap, &winRes, sizeof(SWinRes)); } } - if (index == -1 || pSDataBlock->info.type == STREAM_PUSH_DATA) { + if (index == -1 || pSDataBlock->info.type == STREAM_PULL_DATA) { ignore = false; } } @@ -2412,7 +2429,7 @@ static void doBuildPullDataBlock(SArray* array, int32_t* pIndex, SSDataBlock* pB blockDataUpdateTsWindow(pBlock, 0); } -void processPushEmpty(SSDataBlock* pBlock, SHashObj* pMap) { +void processPullOver(SSDataBlock* pBlock, SHashObj* pMap) { SColumnInfoData* pStartCol = taosArrayGet(pBlock->pDataBlock, 0); TSKEY* tsData = (TSKEY*)pStartCol->pData; SColumnInfoData* pGroupCol = taosArrayGet(pBlock->pDataBlock, 2); @@ -2490,7 +2507,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { printDataBlock(pBlock, IS_FINAL_OP(pInfo) ? "interval Final recv" : "interval Semi recv"); maxTs = TMAX(maxTs, pBlock->info.window.ekey); - if (pBlock->info.type == STREAM_NORMAL || pBlock->info.type == STREAM_PUSH_DATA || + if (pBlock->info.type == STREAM_NORMAL || pBlock->info.type == STREAM_PULL_DATA || pBlock->info.type == STREAM_INVALID) { pInfo->binfo.pRes->info.type = pBlock->info.type; } else if (pBlock->info.type == STREAM_CLEAR) { @@ -2527,8 +2544,8 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { break; } continue; - } else if (pBlock->info.type == STREAM_PUSH_OVER && IS_FINAL_OP(pInfo)) { - processPushEmpty(pBlock, pInfo->pPullDataMap); + } else if (pBlock->info.type == STREAM_PULL_OVER && IS_FINAL_OP(pInfo)) { + processPullOver(pBlock, pInfo->pPullDataMap); continue; } @@ -2690,6 +2707,7 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); pInfo->pPullDataMap = taosHashInit(64, hashFn, false, HASH_NO_LOCK); pInfo->pPullDataRes = createPullDataBlock(); + pInfo->ignoreCloseWindow = false; pOperator->operatorType = pPhyNode->type; pOperator->blocking = true; @@ -2836,6 +2854,7 @@ SOperatorInfo* createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPh pInfo->pChildren = NULL; pInfo->isFinal = false; pInfo->pPhyNode = pPhyNode; + pInfo->ignoreCloseWindow = false; pOperator->name = "StreamSessionWindowAggOperator"; pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION; @@ -2880,24 +2899,12 @@ static bool isInWindow(SResultWindowInfo* pWin, TSKEY ts, int64_t gap) { } static SResultWindowInfo* insertNewSessionWindow(SArray* pWinInfos, TSKEY ts, int32_t index) { - SResultWindowInfo win = { - .pos.offset = -1, - .pos.pageId = -1, - .win.skey = ts, - .win.ekey = ts, - .isOutput = false, - }; + SResultWindowInfo win = {.pos.offset = -1, .pos.pageId = -1, .win.skey = ts, .win.ekey = ts, .isOutput = false}; return taosArrayInsert(pWinInfos, index, &win); } static SResultWindowInfo* addNewSessionWindow(SArray* pWinInfos, TSKEY ts) { - SResultWindowInfo win = { - .pos.offset = -1, - .pos.pageId = -1, - .win.skey = ts, - .win.ekey = ts, - .isOutput = false, - }; + SResultWindowInfo win = {.pos.offset = -1, .pos.pageId = -1, .win.skey = ts, .win.ekey = ts, .isOutput = false}; return taosArrayPush(pWinInfos, &win); } @@ -3025,6 +3032,9 @@ static int32_t doOneWindowAggImpl(int32_t tsColId, SOptrBasicInfo* pBinfo, SStre updateTimeWindowInfo(pTimeWindowData, &pCurWin->win, false); doApplyFunctions(pTaskInfo, pSup->pCtx, &pCurWin->win, pTimeWindowData, startIndex, winRows, tsCols, pSDataBlock->info.rows, numOutput, TSDB_ORDER_ASC); + SFilePage* bufPage = getBufPage(pAggSup->pResultBuf, pCurWin->pos.pageId); + setBufPageDirty(bufPage, true); + releaseBufPage(pAggSup->pResultBuf, bufPage); return TSDB_CODE_SUCCESS; } @@ -3081,7 +3091,13 @@ void compactTimeWindow(SStreamSessionAggOperatorInfo* pInfo, int32_t startIndex, pWinInfo->isOutput = false; } taosArrayRemove(pInfo->streamAggSup.pCurWins, i); + SFilePage* tmpPage = getBufPage(pInfo->streamAggSup.pResultBuf, pWinInfo->pos.pageId); + releaseBufPage(pInfo->streamAggSup.pResultBuf, tmpPage); } + SFilePage* bufPage = getBufPage(pInfo->streamAggSup.pResultBuf, pCurWin->pos.pageId); + ASSERT(num > 0); + setBufPageDirty(bufPage, true); + releaseBufPage(pInfo->streamAggSup.pResultBuf, bufPage); } static void doStreamSessionAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBlock, SHashObj* pStUpdated, @@ -3101,22 +3117,23 @@ static void doStreamSessionAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSData SResultRow* pResult = NULL; int32_t winRows = 0; - if (pSDataBlock->pDataBlock != NULL) { - SColumnInfoData* pStartTsCol = taosArrayGet(pSDataBlock->pDataBlock, pInfo->primaryTsIndex); - startTsCols = (int64_t*)pStartTsCol->pData; - SColumnInfoData* pEndTsCol = NULL; - if (hasEndTs) { - pEndTsCol = taosArrayGet(pSDataBlock->pDataBlock, pInfo->endTsIndex); - } else { - pEndTsCol = taosArrayGet(pSDataBlock->pDataBlock, pInfo->primaryTsIndex); - } - endTsCols = (int64_t*)pEndTsCol->pData; + ASSERT(pSDataBlock->pDataBlock); + SColumnInfoData* pStartTsCol = taosArrayGet(pSDataBlock->pDataBlock, pInfo->primaryTsIndex); + startTsCols = (int64_t*)pStartTsCol->pData; + SColumnInfoData* pEndTsCol = NULL; + if (hasEndTs) { + pEndTsCol = taosArrayGet(pSDataBlock->pDataBlock, pInfo->endTsIndex); } else { - return; + pEndTsCol = taosArrayGet(pSDataBlock->pDataBlock, pInfo->primaryTsIndex); } + endTsCols = (int64_t*)pEndTsCol->pData; SStreamAggSupporter* pAggSup = &pInfo->streamAggSup; for (int32_t i = 0; i < pSDataBlock->info.rows;) { + if (pInfo->ignoreCloseWindow && isOverdue(endTsCols[i], &pInfo->twAggSup)) { + i++; + continue; + } int32_t winIndex = 0; SResultWindowInfo* pCurWin = getSessionTimeWindow(pAggSup, startTsCols[i], endTsCols[i], groupId, gap, &winIndex); winRows = @@ -3223,17 +3240,24 @@ static void rebuildTimeWindow(SStreamSessionAggOperatorInfo* pInfo, SArray* pWin index = 0; } for (int32_t k = index; k < chWinSize; k++) { - SResultWindowInfo* pcw = taosArrayGet(pChWins, k); - if (pParentWin->win.skey <= pcw->win.skey && pcw->win.ekey <= pParentWin->win.ekey) { + SResultWindowInfo* pChWin = taosArrayGet(pChWins, k); + if (pParentWin->win.skey <= pChWin->win.skey && pChWin->win.ekey <= pParentWin->win.ekey) { SResultRow* pChResult = NULL; - setWindowOutputBuf(pcw, &pChResult, pChild->exprSupp.pCtx, groupId, numOfOutput, + setWindowOutputBuf(pChWin, &pChResult, pChild->exprSupp.pCtx, groupId, numOfOutput, pChild->exprSupp.rowEntryInfoOffset, &pChInfo->streamAggSup, pTaskInfo); compactFunctions(pSup->pCtx, pChild->exprSupp.pCtx, numOfOutput, pTaskInfo); + SFilePage* bufPage = getBufPage(pInfo->streamAggSup.pResultBuf, pChWin->pos.pageId); + setBufPageDirty(bufPage, true); + releaseBufPage(pInfo->streamAggSup.pResultBuf, bufPage); continue; } break; } } + SFilePage* bufPage = getBufPage(pInfo->streamAggSup.pResultBuf, pParentWin->pos.pageId); + ASSERT(size > 0); + setBufPageDirty(bufPage, true); + releaseBufPage(pInfo->streamAggSup.pResultBuf, bufPage); } } @@ -3252,7 +3276,7 @@ int32_t closeSessionWindow(SHashObj* pHashMap, STimeWindowAggSupp* pTwSup, SArra for (int32_t i = 0; i < size; i++) { void* pWin = taosArrayGet(pWins, i); SResultWindowInfo* pSeWin = fn(pWin); - if (pSeWin->win.ekey < pTwSup->maxTs - pTwSup->waterMark) { + if (isCloseWindow(&pSeWin->win, pTwSup)) { if (!pSeWin->isClosed) { pSeWin->isClosed = true; if (pTwSup->calTrigger == STREAM_TRIGGER_WINDOW_CLOSE) { @@ -3763,6 +3787,10 @@ static void doStreamStateAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl SStreamAggSupporter* pAggSup = &pInfo->streamAggSup; SColumnInfoData* pKeyColInfo = taosArrayGet(pSDataBlock->pDataBlock, pInfo->stateCol.slotId); for (int32_t i = 0; i < pSDataBlock->info.rows; i += winRows) { + if (pInfo->ignoreCloseWindow && isOverdue(tsCols[i], &pInfo->twAggSup)) { + i++; + continue; + } char* pKeyData = colDataGetData(pKeyColInfo, i); int32_t winIndex = 0; bool allEqual = true; @@ -3913,6 +3941,7 @@ SOperatorInfo* createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhys pInfo->pDelRes->info.type = STREAM_DELETE; blockDataEnsureCapacity(pInfo->pDelRes, 64); pInfo->pChildren = NULL; + pInfo->ignoreCloseWindow = false; pOperator->name = "StreamStateAggOperator"; pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE; diff --git a/source/libs/function/inc/functionMgtInt.h b/source/libs/function/inc/functionMgtInt.h index 44e1e6f7b10285594c6a497365e42862e25e3d97..e1aca7ce008396b59fe2af354172cd367f548f69 100644 --- a/source/libs/function/inc/functionMgtInt.h +++ b/source/libs/function/inc/functionMgtInt.h @@ -46,6 +46,7 @@ extern "C" { #define FUNC_MGT_FORBID_STREAM_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(17) #define FUNC_MGT_FORBID_WINDOW_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(18) #define FUNC_MGT_FORBID_GROUP_BY_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(19) +#define FUNC_MGT_SYSTEM_INFO_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(20) #define FUNC_MGT_TEST_MASK(val, mask) (((val) & (mask)) != 0) diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 1ff1cbe8333b96ebcdadaf1150c203378a6f973b..97a339771d6fffa231353d51d8f21dbc7e30a34c 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -1379,6 +1379,20 @@ static bool validateTimezoneFormat(const SValueNode* pVal) { return true; } +void static addDbPrecisonParam(SNodeList* pList, uint8_t precision) { + SValueNode* pVal = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE); + pVal->literal = NULL; + pVal->isDuration = false; + pVal->translate = true; + pVal->node.resType.type = TSDB_DATA_TYPE_TINYINT; + pVal->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_TINYINT].bytes; + pVal->node.resType.precision = precision; + pVal->datum.i = (int64_t)precision; + pVal->typeData = (int64_t)precision; + + nodesListAppend(pList, (SNode*)pVal); +} + void static addTimezoneParam(SNodeList* pList) { char buf[6] = {0}; time_t t = taosTime(NULL); @@ -1462,6 +1476,10 @@ static int32_t translateTimeTruncate(SFunctionNode* pFunc, char* pErrBuf, int32_ return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); } + //add database precision as param + uint8_t dbPrec = pFunc->node.resType.precision; + addDbPrecisonParam(pFunc->pParameterList, dbPrec); + pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_TIMESTAMP].bytes, .type = TSDB_DATA_TYPE_TIMESTAMP}; return TSDB_CODE_SUCCESS; @@ -1486,6 +1504,10 @@ static int32_t translateTimeDiff(SFunctionNode* pFunc, char* pErrBuf, int32_t le } } + //add database precision as param + uint8_t dbPrec = pFunc->node.resType.precision; + addDbPrecisonParam(pFunc->pParameterList, dbPrec); + pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT}; return TSDB_CODE_SUCCESS; } @@ -1539,6 +1561,36 @@ static int32_t translateGroupKey(SFunctionNode* pFunc, char* pErrBuf, int32_t le return TSDB_CODE_SUCCESS; } +static int32_t translateDatabaseFunc(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + pFunc->node.resType = (SDataType){.bytes = TSDB_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR}; + return TSDB_CODE_SUCCESS; +} + +static int32_t translateClientVersionFunc(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + pFunc->node.resType = (SDataType){.bytes = TSDB_VERSION_LEN, .type = TSDB_DATA_TYPE_VARCHAR}; + return TSDB_CODE_SUCCESS; +} + +static int32_t translateServerVersionFunc(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + pFunc->node.resType = (SDataType){.bytes = TSDB_VERSION_LEN, .type = TSDB_DATA_TYPE_VARCHAR}; + return TSDB_CODE_SUCCESS; +} + +static int32_t translateServerStatusFunc(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_INT].bytes, .type = TSDB_DATA_TYPE_INT}; + return TSDB_CODE_SUCCESS; +} + +static int32_t translateCurrentUserFunc(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + pFunc->node.resType = (SDataType){.bytes = TSDB_USER_LEN, .type = TSDB_DATA_TYPE_VARCHAR}; + return TSDB_CODE_SUCCESS; +} + +static int32_t translateUserFunc(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + pFunc->node.resType = (SDataType){.bytes = TSDB_USER_LEN, .type = TSDB_DATA_TYPE_VARCHAR}; + return TSDB_CODE_SUCCESS; +} + // clang-format off const SBuiltinFuncDefinition funcMgtBuiltins[] = { { @@ -1891,7 +1943,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "first", .type = FUNCTION_TYPE_FIRST, - .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_TIMELINE_FUNC, + .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_TIMELINE_FUNC, .translateFunc = translateFirstLast, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, @@ -1904,7 +1956,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "_first_partial", .type = FUNCTION_TYPE_FIRST_PARTIAL, - .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_TIMELINE_FUNC, + .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_TIMELINE_FUNC, .translateFunc = translateFirstLastPartial, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, @@ -1915,7 +1967,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "_first_merge", .type = FUNCTION_TYPE_FIRST_MERGE, - .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_TIMELINE_FUNC, + .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_TIMELINE_FUNC, .translateFunc = translateFirstLastMerge, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, @@ -1926,7 +1978,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "last", .type = FUNCTION_TYPE_LAST, - .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_TIMELINE_FUNC, + .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_TIMELINE_FUNC, .translateFunc = translateFirstLast, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, @@ -1939,7 +1991,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "_last_partial", .type = FUNCTION_TYPE_LAST_PARTIAL, - .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_TIMELINE_FUNC, + .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_TIMELINE_FUNC, .translateFunc = translateFirstLastPartial, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, @@ -1950,7 +2002,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "_last_merge", .type = FUNCTION_TYPE_LAST_MERGE, - .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_TIMELINE_FUNC, + .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_TIMELINE_FUNC, .translateFunc = translateFirstLastMerge, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, @@ -2118,7 +2170,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "unique", .type = FUNCTION_TYPE_UNIQUE, - .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_TIMELINE_FUNC | + .classification = FUNC_MGT_SELECT_FUNC | FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_FORBID_WINDOW_FUNC | FUNC_MGT_FORBID_GROUP_BY_FUNC, .translateFunc = translateUnique, .getEnvFunc = getUniqueFuncEnv, @@ -2546,6 +2598,42 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .pPartialFunc = "_group_key", .pMergeFunc = "_group_key" }, + { + .name = "database", + .type = FUNCTION_TYPE_DATABASE, + .classification = FUNC_MGT_SYSTEM_INFO_FUNC | FUNC_MGT_SCALAR_FUNC, + .translateFunc = translateDatabaseFunc, + }, + { + .name = "client_version", + .type = FUNCTION_TYPE_CLIENT_VERSION, + .classification = FUNC_MGT_SYSTEM_INFO_FUNC | FUNC_MGT_SCALAR_FUNC, + .translateFunc = translateClientVersionFunc, + }, + { + .name = "server_version", + .type = FUNCTION_TYPE_SERVER_VERSION, + .classification = FUNC_MGT_SYSTEM_INFO_FUNC | FUNC_MGT_SCALAR_FUNC, + .translateFunc = translateServerVersionFunc, + }, + { + .name = "server_status", + .type = FUNCTION_TYPE_SERVER_STATUS, + .classification = FUNC_MGT_SYSTEM_INFO_FUNC | FUNC_MGT_SCALAR_FUNC, + .translateFunc = translateServerStatusFunc, + }, + { + .name = "current_user", + .type = FUNCTION_TYPE_CURRENT_USER, + .classification = FUNC_MGT_SYSTEM_INFO_FUNC | FUNC_MGT_SCALAR_FUNC, + .translateFunc = translateCurrentUserFunc, + }, + { + .name = "user", + .type = FUNCTION_TYPE_USER, + .classification = FUNC_MGT_SYSTEM_INFO_FUNC | FUNC_MGT_SCALAR_FUNC, + .translateFunc = translateUserFunc, + }, }; // clang-format on diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 06f24f39e75eaca29a3ca75fc2f698bb0773b83f..e40ab3784d415bedc6cc155e22edf063833162c0 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -2409,11 +2409,11 @@ int32_t apercentileCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) return TSDB_CODE_SUCCESS; } -int32_t getFirstLastInfoSize(int32_t resBytes) { return sizeof(SFirstLastRes) + resBytes + sizeof(int64_t); } +int32_t getFirstLastInfoSize(int32_t resBytes) { return sizeof(SFirstLastRes) + resBytes + sizeof(int64_t) + sizeof(STuplePos); } bool getFirstLastFuncEnv(SFunctionNode* pFunc, SFuncExecEnv* pEnv) { SColumnNode* pNode = (SColumnNode*)nodesListGetNode(pFunc->pParameterList, 0); - pEnv->calcMemSize = sizeof(SFirstLastRes) + pNode->node.resType.bytes + sizeof(int64_t); + pEnv->calcMemSize = getFirstLastInfoSize(pNode->node.resType.bytes); return true; } @@ -2491,9 +2491,17 @@ int32_t firstFunction(SqlFunctionCtx* pCtx) { } memcpy(pInfo->buf, data, bytes); *(TSKEY*)(pInfo->buf + bytes) = cts; + //handle selectivity + if (pCtx->subsidiaries.num > 0) { + STuplePos* pTuplePos = (STuplePos*)(pInfo->buf + bytes + sizeof(TSKEY)); + if (!pInfo->hasResult) { + saveTupleData(pCtx, i, pCtx->pSrcBlock, pTuplePos); + } else { + copyTupleData(pCtx, i, pCtx->pSrcBlock, pTuplePos); + } + } pInfo->hasResult = true; - // DO_UPDATE_TAG_COLUMNS(pCtx, ts); - + //DO_UPDATE_TAG_COLUMNS(pCtx, ts); pResInfo->numOfRes = 1; break; } @@ -2525,8 +2533,17 @@ int32_t firstFunction(SqlFunctionCtx* pCtx) { } memcpy(pInfo->buf, data, bytes); *(TSKEY*)(pInfo->buf + bytes) = cts; + //handle selectivity + if (pCtx->subsidiaries.num > 0) { + STuplePos* pTuplePos = (STuplePos*)(pInfo->buf + bytes + sizeof(TSKEY)); + if (!pInfo->hasResult) { + saveTupleData(pCtx, i, pCtx->pSrcBlock, pTuplePos); + } else { + copyTupleData(pCtx, i, pCtx->pSrcBlock, pTuplePos); + } + } pInfo->hasResult = true; - // DO_UPDATE_TAG_COLUMNS(pCtx, ts); + //DO_UPDATE_TAG_COLUMNS(pCtx, ts); pResInfo->numOfRes = 1; break; } @@ -2580,8 +2597,17 @@ int32_t lastFunction(SqlFunctionCtx* pCtx) { } memcpy(pInfo->buf, data, bytes); *(TSKEY*)(pInfo->buf + bytes) = cts; - // DO_UPDATE_TAG_COLUMNS(pCtx, ts); + //handle selectivity + if (pCtx->subsidiaries.num > 0) { + STuplePos* pTuplePos = (STuplePos*)(pInfo->buf + bytes + sizeof(TSKEY)); + if (!pInfo->hasResult) { + saveTupleData(pCtx, i, pCtx->pSrcBlock, pTuplePos); + } else { + copyTupleData(pCtx, i, pCtx->pSrcBlock, pTuplePos); + } + } pInfo->hasResult = true; + //DO_UPDATE_TAG_COLUMNS(pCtx, ts); pResInfo->numOfRes = 1; } break; @@ -2603,9 +2629,18 @@ int32_t lastFunction(SqlFunctionCtx* pCtx) { } memcpy(pInfo->buf, data, bytes); *(TSKEY*)(pInfo->buf + bytes) = cts; + //handle selectivity + if (pCtx->subsidiaries.num > 0) { + STuplePos* pTuplePos = (STuplePos*)(pInfo->buf + bytes + sizeof(TSKEY)); + if (!pInfo->hasResult) { + saveTupleData(pCtx, i, pCtx->pSrcBlock, pTuplePos); + } else { + copyTupleData(pCtx, i, pCtx->pSrcBlock, pTuplePos); + } + } pInfo->hasResult = true; pResInfo->numOfRes = 1; - // DO_UPDATE_TAG_COLUMNS(pCtx, ts); + //DO_UPDATE_TAG_COLUMNS(pCtx, ts); } break; } @@ -2615,7 +2650,10 @@ int32_t lastFunction(SqlFunctionCtx* pCtx) { return TSDB_CODE_SUCCESS; } -static void firstLastTransferInfo(SFirstLastRes* pInput, SFirstLastRes* pOutput, bool isFirst) { +static void firstLastTransferInfo(SqlFunctionCtx* pCtx, SFirstLastRes* pInput, SFirstLastRes* pOutput, bool isFirst) { + SInputColumnInfoData* pColInfo = &pCtx->input; + int32_t start = pColInfo->startRowIndex; + pOutput->bytes = pInput->bytes; TSKEY* tsIn = (TSKEY*)(pInput->buf + pInput->bytes); TSKEY* tsOut = (TSKEY*)(pOutput->buf + pInput->bytes); @@ -2632,7 +2670,17 @@ static void firstLastTransferInfo(SFirstLastRes* pInput, SFirstLastRes* pOutput, } *tsOut = *tsIn; memcpy(pOutput->buf, pInput->buf, pOutput->bytes); + //handle selectivity + STuplePos* pTuplePos = (STuplePos*)(pOutput->buf + pOutput->bytes + sizeof(TSKEY)); + if (pCtx->subsidiaries.num > 0) { + if (!pOutput->hasResult) { + saveTupleData(pCtx, start, pCtx->pSrcBlock, pTuplePos); + } else { + copyTupleData(pCtx, start, pCtx->pSrcBlock, pTuplePos); + } + } pOutput->hasResult = true; + return; } @@ -2647,7 +2695,7 @@ static int32_t firstLastFunctionMergeImpl(SqlFunctionCtx* pCtx, bool isFirstQuer char* data = colDataGetData(pCol, start); SFirstLastRes* pInputInfo = (SFirstLastRes*)varDataVal(data); - firstLastTransferInfo(pInputInfo, pInfo, isFirstQuery); + firstLastTransferInfo(pCtx, pInputInfo, pInfo, isFirstQuery); int32_t numOfElems = pInputInfo->hasResult ? 1 : 0; @@ -2669,6 +2717,9 @@ int32_t firstLastFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { SFirstLastRes* pRes = GET_ROWCELL_INTERBUF(pResInfo); colDataAppend(pCol, pBlock->info.rows, pRes->buf, pResInfo->isNullRes); + //handle selectivity + STuplePos* pTuplePos = (STuplePos*)(pRes->buf + pRes->bytes + sizeof(TSKEY)); + setSelectivityValue(pCtx, pBlock, pTuplePos, pBlock->info.rows); return pResInfo->numOfRes; } @@ -2687,6 +2738,9 @@ int32_t firstLastPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId); colDataAppend(pCol, pBlock->info.rows, res, false); + //handle selectivity + STuplePos* pTuplePos = (STuplePos*)(pRes->buf + pRes->bytes + sizeof(TSKEY)); + setSelectivityValue(pCtx, pBlock, pTuplePos, pBlock->info.rows); taosMemoryFree(res); return 1; @@ -3043,7 +3097,9 @@ void doAddIntoResult(SqlFunctionCtx* pCtx, void* pData, int32_t rowIndex, SSData pItem->uid = uid; // save the data of this tuple - saveTupleData(pCtx, rowIndex, pSrcBlock, &pItem->tuplePos); + if (pCtx->subsidiaries.num > 0) { + saveTupleData(pCtx, rowIndex, pSrcBlock, &pItem->tuplePos); + } // allocate the buffer and keep the data of this row into the new allocated buffer pEntryInfo->numOfRes++; @@ -3062,7 +3118,10 @@ void doAddIntoResult(SqlFunctionCtx* pCtx, void* pData, int32_t rowIndex, SSData pItem->uid = uid; // save the data of this tuple by over writing the old data - copyTupleData(pCtx, rowIndex, pSrcBlock, &pItem->tuplePos); + if (pCtx->subsidiaries.num > 0) { + copyTupleData(pCtx, rowIndex, pSrcBlock, &pItem->tuplePos); + } + taosheapadjust((void*)pItems, sizeof(STopBotResItem), 0, pEntryInfo->numOfRes - 1, (const void*)&type, topBotResComparFn, NULL, !isTopQuery); } @@ -5466,7 +5525,7 @@ int32_t groupKeyFunction(SqlFunctionCtx* pCtx) { int32_t startIndex = pInput->startRowIndex; - //escape rest of data blocks to avoid first entry be overwritten. + //escape rest of data blocks to avoid first entry to be overwritten. if (pInfo->hasResult) { goto _group_key_over; } diff --git a/source/libs/function/src/functionMgt.c b/source/libs/function/src/functionMgt.c index 5fcf5e239cc28d639eb2655d8d121c158d2cdec7..52edf8323279f4bcebb96262bcc92f8ef8c5a9b6 100644 --- a/source/libs/function/src/functionMgt.c +++ b/source/libs/function/src/functionMgt.c @@ -179,6 +179,8 @@ bool fmIsForbidWindowFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId bool fmIsForbidGroupByFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId, FUNC_MGT_FORBID_GROUP_BY_FUNC); } +bool fmIsSystemInfoFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId, FUNC_MGT_SYSTEM_INFO_FUNC); } + bool fmIsInterpFunc(int32_t funcId) { if (funcId < 0 || funcId >= funcMgtBuiltinsNum) { return false; diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index 9d8baf472b018b6d40976f3144ea6a8262ac5819..b372bf75fc88c537b98fd1aa3a57eda079ccfd3d 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -100,6 +100,7 @@ static int32_t exprNodeCopy(const SExprNode* pSrc, SExprNode* pDst) { COPY_OBJECT_FIELD(resType, sizeof(SDataType)); COPY_CHAR_ARRAY_FIELD(aliasName); COPY_CHAR_ARRAY_FIELD(userAlias); + COPY_SCALAR_FIELD(orderAlias); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index be6faa92cbfb109d936bfc99dc9ea64ecc03aec1..dc9d9b92ee8bb6414db9ce9b201cd9371d1acf77 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -1500,7 +1500,8 @@ typedef struct SCollectFuncsCxt { static EDealRes collectFuncs(SNode* pNode, void* pContext) { SCollectFuncsCxt* pCxt = (SCollectFuncsCxt*)pContext; - if (QUERY_NODE_FUNCTION == nodeType(pNode) && pCxt->classifier(((SFunctionNode*)pNode)->funcId)) { + if (QUERY_NODE_FUNCTION == nodeType(pNode) && pCxt->classifier(((SFunctionNode*)pNode)->funcId) && + !(((SExprNode*)pNode)->orderAlias)) { pCxt->errCode = nodesListStrictAppend(pCxt->pFuncs, nodesCloneNode(pNode)); return (TSDB_CODE_SUCCESS == pCxt->errCode ? DEAL_RES_IGNORE_CHILD : DEAL_RES_ERROR); } diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index a27d0e9164414af8f60459de35b7b672ce215fab..cb43bfef0e4c8d706889e73a0a2a71c53cecdde7 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -685,6 +685,12 @@ literal_func(A) ::= NOW(B). noarg_func(A) ::= NOW(B). { A = B; } noarg_func(A) ::= TODAY(B). { A = B; } noarg_func(A) ::= TIMEZONE(B). { A = B; } +noarg_func(A) ::= DATABASE(B). { A = B; } +noarg_func(A) ::= CLIENT_VERSION(B). { A = B; } +noarg_func(A) ::= SERVER_VERSION(B). { A = B; } +noarg_func(A) ::= SERVER_STATUS(B). { A = B; } +noarg_func(A) ::= CURRENT_USER(B). { A = B; } +noarg_func(A) ::= USER(B). { A = B; } %type star_func { SToken } %destructor star_func { } diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c index 5d34250444d88f64df4de049e77dd33dfb709558..044ec90a7f3ecf5865738b79a9625383e5110428 100644 --- a/source/libs/parser/src/parInsert.c +++ b/source/libs/parser/src/parInsert.c @@ -67,6 +67,13 @@ typedef struct SInsertParseContext { SParseMetaCache* pMetaCache; } SInsertParseContext; +typedef struct SInsertParseSyntaxCxt { + SParseContext* pComCxt; + char* pSql; + SMsgBuf msg; + SParseMetaCache* pMetaCache; +} SInsertParseSyntaxCxt; + typedef int32_t (*_row_append_fn_t)(SMsgBuf* pMsgBuf, const void* value, int32_t len, void* param); static uint8_t TRUE_VALUE = (uint8_t)TSDB_TRUE; @@ -1098,11 +1105,24 @@ static int32_t storeTableMeta(SInsertParseContext* pCxt, SHashObj* pHash, SName* return taosHashPut(pHash, pName, len, &pBackup, POINTER_BYTES); } +static int32_t skipUsingClause(SInsertParseSyntaxCxt* pCxt); + +// pSql -> stb_name [(tag1_name, ...)] TAGS (tag1_value, ...) +static int32_t ignoreAutoCreateTableClause(SInsertParseContext* pCxt) { + SToken sToken; + NEXT_TOKEN(pCxt->pSql, sToken); + SInsertParseSyntaxCxt cxt = {.pComCxt = pCxt->pComCxt, .pSql = pCxt->pSql, .msg = pCxt->msg, .pMetaCache = NULL}; + int32_t code = skipUsingClause(&cxt); + pCxt->pSql = cxt.pSql; + return code; +} + // pSql -> stb_name [(tag1_name, ...)] TAGS (tag1_value, ...) static int32_t parseUsingClause(SInsertParseContext* pCxt, SName* name, char* tbFName) { int32_t len = strlen(tbFName); STableMeta** pMeta = taosHashGet(pCxt->pSubTableHashObj, tbFName, len); if (NULL != pMeta) { + CHECK_CODE(ignoreAutoCreateTableClause(pCxt)); return cloneTableMeta(*pMeta, &pCxt->pTableMeta); } @@ -1522,13 +1542,6 @@ int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery, SParseMetaCache return code; } -typedef struct SInsertParseSyntaxCxt { - SParseContext* pComCxt; - char* pSql; - SMsgBuf msg; - SParseMetaCache* pMetaCache; -} SInsertParseSyntaxCxt; - static int32_t skipParentheses(SInsertParseSyntaxCxt* pCxt) { SToken sToken; int32_t expectRightParenthesis = 1; @@ -1757,7 +1770,7 @@ int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, char* tN } int32_t code = TSDB_CODE_SUCCESS; - SSchema* pSchema = pDataBlock->pTableMeta->schema; + SSchema* pSchema = getTableTagSchema(pDataBlock->pTableMeta); bool isJson = false; STag* pTag = NULL; diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index 6726bb7dfda60afcd1d099a5f5860267174d0cf5..7f5d742dc7efac8e5adb8eb4309ccf4187e24330 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -29,213 +29,217 @@ typedef struct SKeyword { // clang-format off // keywords in sql string static SKeyword keywordTable[] = { - {"ACCOUNT", TK_ACCOUNT}, - {"ACCOUNTS", TK_ACCOUNTS}, - {"ADD", TK_ADD}, - {"AGGREGATE", TK_AGGREGATE}, - {"ALL", TK_ALL}, - {"ALTER", TK_ALTER}, - {"ANALYZE", TK_ANALYZE}, - {"AND", TK_AND}, - {"APPS", TK_APPS}, - {"AS", TK_AS}, - {"ASC", TK_ASC}, - {"AT_ONCE", TK_AT_ONCE}, - {"BALANCE", TK_BALANCE}, - {"BETWEEN", TK_BETWEEN}, - {"BINARY", TK_BINARY}, - {"BIGINT", TK_BIGINT}, - {"BNODE", TK_BNODE}, - {"BNODES", TK_BNODES}, - {"BOOL", TK_BOOL}, - {"BUFFER", TK_BUFFER}, - {"BUFSIZE", TK_BUFSIZE}, - {"BY", TK_BY}, - {"CACHE", TK_CACHE}, - {"CACHELAST", TK_CACHELAST}, - {"CAST", TK_CAST}, - {"CLUSTER", TK_CLUSTER}, - {"COLUMN", TK_COLUMN}, - {"COMMENT", TK_COMMENT}, - {"COMP", TK_COMP}, - {"COMPACT", TK_COMPACT}, - {"CONNS", TK_CONNS}, - {"CONNECTION", TK_CONNECTION}, - {"CONNECTIONS", TK_CONNECTIONS}, - {"CONSUMER", TK_CONSUMER}, - {"CONSUMERS", TK_CONSUMERS}, - {"COUNT", TK_COUNT}, - {"CREATE", TK_CREATE}, - {"CONTAINS", TK_CONTAINS}, - {"DATABASE", TK_DATABASE}, - {"DATABASES", TK_DATABASES}, - {"DBS", TK_DBS}, - {"DELETE", TK_DELETE}, - {"DESC", TK_DESC}, - {"DESCRIBE", TK_DESCRIBE}, - {"DISTINCT", TK_DISTINCT}, - {"DISTRIBUTED", TK_DISTRIBUTED}, - {"DNODE", TK_DNODE}, - {"DNODES", TK_DNODES}, - {"DOUBLE", TK_DOUBLE}, - {"DROP", TK_DROP}, - {"DURATION", TK_DURATION}, - {"ENABLE", TK_ENABLE}, - {"EXISTS", TK_EXISTS}, - {"EXPLAIN", TK_EXPLAIN}, - {"EVERY", TK_EVERY}, - {"FILL", TK_FILL}, - {"FIRST", TK_FIRST}, - {"FLOAT", TK_FLOAT}, - {"FROM", TK_FROM}, - {"FSYNC", TK_FSYNC}, - {"FUNCTION", TK_FUNCTION}, - {"FUNCTIONS", TK_FUNCTIONS}, - {"GRANT", TK_GRANT}, - {"GRANTS", TK_GRANTS}, - {"GROUP", TK_GROUP}, - {"HAVING", TK_HAVING}, - {"IF", TK_IF}, - {"IMPORT", TK_IMPORT}, - {"IN", TK_IN}, - {"INDEX", TK_INDEX}, - {"INDEXES", TK_INDEXES}, - {"INNER", TK_INNER}, - {"INT", TK_INT}, - {"INSERT", TK_INSERT}, - {"INTEGER", TK_INTEGER}, - {"INTERVAL", TK_INTERVAL}, - {"INTO", TK_INTO}, - {"IS", TK_IS}, - {"JOIN", TK_JOIN}, - {"JSON", TK_JSON}, - {"KEEP", TK_KEEP}, - {"KILL", TK_KILL}, - {"LAST", TK_LAST}, - {"LAST_ROW", TK_LAST_ROW}, - {"LICENCE", TK_LICENCE}, - {"LIKE", TK_LIKE}, - {"LIMIT", TK_LIMIT}, - {"LINEAR", TK_LINEAR}, - {"LOCAL", TK_LOCAL}, - {"MATCH", TK_MATCH}, - {"MAXROWS", TK_MAXROWS}, - {"MAX_DELAY", TK_MAX_DELAY}, - {"MERGE", TK_MERGE}, - {"META", TK_META}, - {"MINROWS", TK_MINROWS}, - {"MINUS", TK_MINUS}, - {"MNODE", TK_MNODE}, - {"MNODES", TK_MNODES}, - {"MODIFY", TK_MODIFY}, - {"MODULES", TK_MODULES}, - {"NCHAR", TK_NCHAR}, - {"NEXT", TK_NEXT}, - {"NMATCH", TK_NMATCH}, - {"NONE", TK_NONE}, - {"NOT", TK_NOT}, - {"NOW", TK_NOW}, - {"NULL", TK_NULL}, - {"NULLS", TK_NULLS}, - {"OFFSET", TK_OFFSET}, - {"ON", TK_ON}, - {"OR", TK_OR}, - {"ORDER", TK_ORDER}, - {"OUTPUTTYPE", TK_OUTPUTTYPE}, - {"PARTITION", TK_PARTITION}, - {"PASS", TK_PASS}, - {"PAGES", TK_PAGES}, - {"PAGESIZE", TK_PAGESIZE}, - {"PORT", TK_PORT}, - {"PPS", TK_PPS}, - {"PRECISION", TK_PRECISION}, - // {"PRIVILEGE", TK_PRIVILEGE}, - {"PREV", TK_PREV}, - {"QNODE", TK_QNODE}, - {"QNODES", TK_QNODES}, - {"QTIME", TK_QTIME}, - {"QUERIES", TK_QUERIES}, - {"QUERY", TK_QUERY}, - {"RANGE", TK_RANGE}, - {"RATIO", TK_RATIO}, - {"READ", TK_READ}, - {"REDISTRIBUTE", TK_REDISTRIBUTE}, - {"RENAME", TK_RENAME}, - {"REPLICA", TK_REPLICA}, - {"RESET", TK_RESET}, - {"RETENTIONS", TK_RETENTIONS}, - {"REVOKE", TK_REVOKE}, - {"ROLLUP", TK_ROLLUP}, - {"SCHEMALESS", TK_SCHEMALESS}, - {"SCORES", TK_SCORES}, - {"SELECT", TK_SELECT}, - {"SESSION", TK_SESSION}, - {"SET", TK_SET}, - {"SHOW", TK_SHOW}, - {"SINGLE_STABLE", TK_SINGLE_STABLE}, - {"SLIDING", TK_SLIDING}, - {"SLIMIT", TK_SLIMIT}, - {"SMA", TK_SMA}, - {"SMALLINT", TK_SMALLINT}, - {"SNODE", TK_SNODE}, - {"SNODES", TK_SNODES}, - {"SOFFSET", TK_SOFFSET}, - {"SPLIT", TK_SPLIT}, - {"STABLE", TK_STABLE}, - {"STABLES", TK_STABLES}, - {"STATE", TK_STATE}, - {"STATE_WINDOW", TK_STATE_WINDOW}, - {"STORAGE", TK_STORAGE}, - {"STREAM", TK_STREAM}, - {"STREAMS", TK_STREAMS}, - {"STRICT", TK_STRICT}, - {"SUBSCRIPTIONS", TK_SUBSCRIPTIONS}, - {"SYNCDB", TK_SYNCDB}, - {"SYSINFO", TK_SYSINFO}, - {"TABLE", TK_TABLE}, - {"TABLES", TK_TABLES}, - {"TAG", TK_TAG}, - {"TAGS", TK_TAGS}, - {"TBNAME", TK_TBNAME}, - {"TIMESTAMP", TK_TIMESTAMP}, - {"TIMEZONE", TK_TIMEZONE}, - {"TINYINT", TK_TINYINT}, - {"TO", TK_TO}, - {"TODAY", TK_TODAY}, - {"TOPIC", TK_TOPIC}, - {"TOPICS", TK_TOPICS}, - {"TRANSACTION", TK_TRANSACTION}, - {"TRANSACTIONS", TK_TRANSACTIONS}, - {"TRIGGER", TK_TRIGGER}, - {"TSERIES", TK_TSERIES}, - {"TTL", TK_TTL}, - {"UNION", TK_UNION}, - {"UNSIGNED", TK_UNSIGNED}, - {"USE", TK_USE}, - {"USER", TK_USER}, - {"USERS", TK_USERS}, - {"USING", TK_USING}, - {"VALUE", TK_VALUE}, - {"VALUES", TK_VALUES}, - {"VARCHAR", TK_VARCHAR}, - {"VARIABLES", TK_VARIABLES}, - {"VERBOSE", TK_VERBOSE}, - {"VGROUP", TK_VGROUP}, - {"VGROUPS", TK_VGROUPS}, - {"VNODES", TK_VNODES}, - {"WAL", TK_WAL}, - {"WATERMARK", TK_WATERMARK}, - {"WHERE", TK_WHERE}, - {"WINDOW_CLOSE", TK_WINDOW_CLOSE}, - {"WITH", TK_WITH}, - {"WRITE", TK_WRITE}, - {"_C0", TK_ROWTS}, - {"_QENDTS", TK_QENDTS}, - {"_QSTARTTS", TK_QSTARTTS}, - {"_ROWTS", TK_ROWTS}, - {"_WDURATION", TK_WDURATION}, - {"_WENDTS", TK_WENDTS}, - {"_WSTARTTS", TK_WSTARTTS}, + {"ACCOUNT", TK_ACCOUNT}, + {"ACCOUNTS", TK_ACCOUNTS}, + {"ADD", TK_ADD}, + {"AGGREGATE", TK_AGGREGATE}, + {"ALL", TK_ALL}, + {"ALTER", TK_ALTER}, + {"ANALYZE", TK_ANALYZE}, + {"AND", TK_AND}, + {"APPS", TK_APPS}, + {"AS", TK_AS}, + {"ASC", TK_ASC}, + {"AT_ONCE", TK_AT_ONCE}, + {"BALANCE", TK_BALANCE}, + {"BETWEEN", TK_BETWEEN}, + {"BINARY", TK_BINARY}, + {"BIGINT", TK_BIGINT}, + {"BNODE", TK_BNODE}, + {"BNODES", TK_BNODES}, + {"BOOL", TK_BOOL}, + {"BUFFER", TK_BUFFER}, + {"BUFSIZE", TK_BUFSIZE}, + {"BY", TK_BY}, + {"CACHE", TK_CACHE}, + {"CACHELAST", TK_CACHELAST}, + {"CAST", TK_CAST}, + {"CLIENT_VERSION", TK_CLIENT_VERSION}, + {"CLUSTER", TK_CLUSTER}, + {"COLUMN", TK_COLUMN}, + {"COMMENT", TK_COMMENT}, + {"COMP", TK_COMP}, + {"COMPACT", TK_COMPACT}, + {"CONNS", TK_CONNS}, + {"CONNECTION", TK_CONNECTION}, + {"CONNECTIONS", TK_CONNECTIONS}, + {"CONSUMER", TK_CONSUMER}, + {"CONSUMERS", TK_CONSUMERS}, + {"CONTAINS", TK_CONTAINS}, + {"COUNT", TK_COUNT}, + {"CREATE", TK_CREATE}, + {"CURRENT_USER", TK_CURRENT_USER}, + {"DATABASE", TK_DATABASE}, + {"DATABASES", TK_DATABASES}, + {"DBS", TK_DBS}, + {"DELETE", TK_DELETE}, + {"DESC", TK_DESC}, + {"DESCRIBE", TK_DESCRIBE}, + {"DISTINCT", TK_DISTINCT}, + {"DISTRIBUTED", TK_DISTRIBUTED}, + {"DNODE", TK_DNODE}, + {"DNODES", TK_DNODES}, + {"DOUBLE", TK_DOUBLE}, + {"DROP", TK_DROP}, + {"DURATION", TK_DURATION}, + {"ENABLE", TK_ENABLE}, + {"EXISTS", TK_EXISTS}, + {"EXPLAIN", TK_EXPLAIN}, + {"EVERY", TK_EVERY}, + {"FILL", TK_FILL}, + {"FIRST", TK_FIRST}, + {"FLOAT", TK_FLOAT}, + {"FROM", TK_FROM}, + {"FSYNC", TK_FSYNC}, + {"FUNCTION", TK_FUNCTION}, + {"FUNCTIONS", TK_FUNCTIONS}, + {"GRANT", TK_GRANT}, + {"GRANTS", TK_GRANTS}, + {"GROUP", TK_GROUP}, + {"HAVING", TK_HAVING}, + {"IF", TK_IF}, + {"IMPORT", TK_IMPORT}, + {"IN", TK_IN}, + {"INDEX", TK_INDEX}, + {"INDEXES", TK_INDEXES}, + {"INNER", TK_INNER}, + {"INT", TK_INT}, + {"INSERT", TK_INSERT}, + {"INTEGER", TK_INTEGER}, + {"INTERVAL", TK_INTERVAL}, + {"INTO", TK_INTO}, + {"IS", TK_IS}, + {"JOIN", TK_JOIN}, + {"JSON", TK_JSON}, + {"KEEP", TK_KEEP}, + {"KILL", TK_KILL}, + {"LAST", TK_LAST}, + {"LAST_ROW", TK_LAST_ROW}, + {"LICENCE", TK_LICENCE}, + {"LIKE", TK_LIKE}, + {"LIMIT", TK_LIMIT}, + {"LINEAR", TK_LINEAR}, + {"LOCAL", TK_LOCAL}, + {"MATCH", TK_MATCH}, + {"MAXROWS", TK_MAXROWS}, + {"MAX_DELAY", TK_MAX_DELAY}, + {"MERGE", TK_MERGE}, + {"META", TK_META}, + {"MINROWS", TK_MINROWS}, + {"MINUS", TK_MINUS}, + {"MNODE", TK_MNODE}, + {"MNODES", TK_MNODES}, + {"MODIFY", TK_MODIFY}, + {"MODULES", TK_MODULES}, + {"NCHAR", TK_NCHAR}, + {"NEXT", TK_NEXT}, + {"NMATCH", TK_NMATCH}, + {"NONE", TK_NONE}, + {"NOT", TK_NOT}, + {"NOW", TK_NOW}, + {"NULL", TK_NULL}, + {"NULLS", TK_NULLS}, + {"OFFSET", TK_OFFSET}, + {"ON", TK_ON}, + {"OR", TK_OR}, + {"ORDER", TK_ORDER}, + {"OUTPUTTYPE", TK_OUTPUTTYPE}, + {"PARTITION", TK_PARTITION}, + {"PASS", TK_PASS}, + {"PAGES", TK_PAGES}, + {"PAGESIZE", TK_PAGESIZE}, + {"PORT", TK_PORT}, + {"PPS", TK_PPS}, + {"PRECISION", TK_PRECISION}, + // {"PRIVILEGE", TK_PRIVILEGE}, + {"PREV", TK_PREV}, + {"QNODE", TK_QNODE}, + {"QNODES", TK_QNODES}, + {"QTIME", TK_QTIME}, + {"QUERIES", TK_QUERIES}, + {"QUERY", TK_QUERY}, + {"RANGE", TK_RANGE}, + {"RATIO", TK_RATIO}, + {"READ", TK_READ}, + {"REDISTRIBUTE", TK_REDISTRIBUTE}, + {"RENAME", TK_RENAME}, + {"REPLICA", TK_REPLICA}, + {"RESET", TK_RESET}, + {"RETENTIONS", TK_RETENTIONS}, + {"REVOKE", TK_REVOKE}, + {"ROLLUP", TK_ROLLUP}, + {"SCHEMALESS", TK_SCHEMALESS}, + {"SCORES", TK_SCORES}, + {"SELECT", TK_SELECT}, + {"SERVER_STATUS", TK_SERVER_STATUS}, + {"SERVER_VERSION", TK_SERVER_VERSION}, + {"SESSION", TK_SESSION}, + {"SET", TK_SET}, + {"SHOW", TK_SHOW}, + {"SINGLE_STABLE", TK_SINGLE_STABLE}, + {"SLIDING", TK_SLIDING}, + {"SLIMIT", TK_SLIMIT}, + {"SMA", TK_SMA}, + {"SMALLINT", TK_SMALLINT}, + {"SNODE", TK_SNODE}, + {"SNODES", TK_SNODES}, + {"SOFFSET", TK_SOFFSET}, + {"SPLIT", TK_SPLIT}, + {"STABLE", TK_STABLE}, + {"STABLES", TK_STABLES}, + {"STATE", TK_STATE}, + {"STATE_WINDOW", TK_STATE_WINDOW}, + {"STORAGE", TK_STORAGE}, + {"STREAM", TK_STREAM}, + {"STREAMS", TK_STREAMS}, + {"STRICT", TK_STRICT}, + {"SUBSCRIPTIONS", TK_SUBSCRIPTIONS}, + {"SYNCDB", TK_SYNCDB}, + {"SYSINFO", TK_SYSINFO}, + {"TABLE", TK_TABLE}, + {"TABLES", TK_TABLES}, + {"TAG", TK_TAG}, + {"TAGS", TK_TAGS}, + {"TBNAME", TK_TBNAME}, + {"TIMESTAMP", TK_TIMESTAMP}, + {"TIMEZONE", TK_TIMEZONE}, + {"TINYINT", TK_TINYINT}, + {"TO", TK_TO}, + {"TODAY", TK_TODAY}, + {"TOPIC", TK_TOPIC}, + {"TOPICS", TK_TOPICS}, + {"TRANSACTION", TK_TRANSACTION}, + {"TRANSACTIONS", TK_TRANSACTIONS}, + {"TRIGGER", TK_TRIGGER}, + {"TSERIES", TK_TSERIES}, + {"TTL", TK_TTL}, + {"UNION", TK_UNION}, + {"UNSIGNED", TK_UNSIGNED}, + {"USE", TK_USE}, + {"USER", TK_USER}, + {"USERS", TK_USERS}, + {"USING", TK_USING}, + {"VALUE", TK_VALUE}, + {"VALUES", TK_VALUES}, + {"VARCHAR", TK_VARCHAR}, + {"VARIABLES", TK_VARIABLES}, + {"VERBOSE", TK_VERBOSE}, + {"VGROUP", TK_VGROUP}, + {"VGROUPS", TK_VGROUPS}, + {"VNODES", TK_VNODES}, + {"WAL", TK_WAL}, + {"WATERMARK", TK_WATERMARK}, + {"WHERE", TK_WHERE}, + {"WINDOW_CLOSE", TK_WINDOW_CLOSE}, + {"WITH", TK_WITH}, + {"WRITE", TK_WRITE}, + {"_C0", TK_ROWTS}, + {"_QENDTS", TK_QENDTS}, + {"_QSTARTTS", TK_QSTARTTS}, + {"_ROWTS", TK_ROWTS}, + {"_WDURATION", TK_WDURATION}, + {"_WENDTS", TK_WENDTS}, + {"_WSTARTTS", TK_WSTARTTS}, // {"ID", TK_ID}, // {"STRING", TK_STRING}, // {"EQ", TK_EQ}, diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 45240536e3398e7134e376377bedd9222d188130..521c733cebc81aca79f9c9e71dcef9cc6fae0ce5 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -35,8 +35,7 @@ typedef struct STranslateContext { SArray* pNsLevel; // element is SArray*, the element of this subarray is STableNode* int32_t currLevel; ESqlClause currClause; - SSelectStmt* pCurrSelectStmt; - SSetOperator* pCurrSetOperator; + SNode* pCurrStmt; SCmdMsgInfo* pCmdMsg; SHashObj* pDbs; SHashObj* pTables; @@ -397,6 +396,34 @@ static void destroyTranslateContext(STranslateContext* pCxt) { taosHashCleanup(pCxt->pTables); } +static bool isSelectStmt(SNode* pCurrStmt) { + return NULL != pCurrStmt && QUERY_NODE_SELECT_STMT == nodeType(pCurrStmt); +} + +static bool isSetOperator(SNode* pCurrStmt) { + return NULL != pCurrStmt && QUERY_NODE_SET_OPERATOR == nodeType(pCurrStmt); +} + +static SNodeList* getProjectListFromCurrStmt(SNode* pCurrStmt) { + if (isSelectStmt(pCurrStmt)) { + return ((SSelectStmt*)pCurrStmt)->pProjectionList; + } + if (isSetOperator(pCurrStmt)) { + return ((SSetOperator*)pCurrStmt)->pProjectionList; + } + return NULL; +} + +static uint8_t getPrecisionFromCurrStmt(SNode* pCurrStmt, uint8_t defaultVal) { + if (isSelectStmt(pCurrStmt)) { + return ((SSelectStmt*)pCurrStmt)->precision; + } + if (isSetOperator(pCurrStmt)) { + return ((SSetOperator*)pCurrStmt)->precision; + } + return defaultVal; +} + static bool isAliasColumn(const SNode* pNode) { return (QUERY_NODE_COLUMN == nodeType(pNode) && ('\0' == ((SColumnNode*)pNode)->tableAlias[0])); } @@ -426,7 +453,8 @@ static bool isVectorFunc(const SNode* pNode) { } static bool isDistinctOrderBy(STranslateContext* pCxt) { - return (SQL_CLAUSE_ORDER_BY == pCxt->currClause && pCxt->pCurrSelectStmt->isDistinct); + return (SQL_CLAUSE_ORDER_BY == pCxt->currClause && isSelectStmt(pCxt->pCurrStmt) && + ((SSelectStmt*)pCxt->pCurrStmt)->isDistinct); } static bool belongTable(const char* currentDb, const SColumnNode* pCol, const STableNode* pTable) { @@ -646,7 +674,7 @@ static EDealRes translateColumnWithoutPrefix(STranslateContext* pCxt, SColumnNod } if (!found) { if (isInternalPk) { - if (NULL != pCxt->pCurrSelectStmt && NULL != pCxt->pCurrSelectStmt->pWindow) { + if (isSelectStmt(pCxt->pCurrStmt) && NULL != ((SSelectStmt*)pCxt->pCurrStmt)->pWindow) { return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_NOT_ALLOWED_WIN_QUERY); } return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_INVALID_INTERNAL_PK); @@ -657,18 +685,8 @@ static EDealRes translateColumnWithoutPrefix(STranslateContext* pCxt, SColumnNod return DEAL_RES_CONTINUE; } -static SNodeList* getProjectListFromCxt(STranslateContext* pCxt) { - if (NULL != pCxt->pCurrSelectStmt) { - return pCxt->pCurrSelectStmt->pProjectionList; - } else if (NULL != pCxt->pCurrSetOperator) { - return pCxt->pCurrSetOperator->pProjectionList; - } else { - return NULL; - } -} - static EDealRes translateColumnUseAlias(STranslateContext* pCxt, SColumnNode** pCol, bool* pFound) { - SNodeList* pProjectionList = getProjectListFromCxt(pCxt); + SNodeList* pProjectionList = getProjectListFromCurrStmt(pCxt->pCurrStmt); SNode* pNode; FOREACH(pNode, pProjectionList) { SExprNode* pExpr = (SExprNode*)pNode; @@ -690,7 +708,7 @@ static EDealRes translateColumnUseAlias(STranslateContext* pCxt, SColumnNode** p } static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode** pCol) { - if (NULL != pCxt->pCurrSelectStmt && NULL == pCxt->pCurrSelectStmt->pFromTable) { + if (isSelectStmt(pCxt->pCurrStmt) && NULL == ((SSelectStmt*)pCxt->pCurrStmt)->pFromTable) { return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_INVALID_COLUMN, (*pCol)->colName); } @@ -708,7 +726,7 @@ static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode** pCol) { res = translateColumnUseAlias(pCxt, pCol, &found); } if (DEAL_RES_ERROR != res && !found) { - if (NULL != pCxt->pCurrSetOperator) { + if (isSetOperator(pCxt->pCurrStmt)) { res = generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_INVALID_COLUMN, (*pCol)->colName); } else { res = translateColumnWithoutPrefix(pCxt, pCol); @@ -760,9 +778,9 @@ static int32_t parseBoolFromValueNode(STranslateContext* pCxt, SValueNode* pVal) } static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SDataType targetDt) { - uint8_t precision = (NULL != pCxt->pCurrSelectStmt ? pCxt->pCurrSelectStmt->precision : targetDt.precision); + uint8_t precision = getPrecisionFromCurrStmt(pCxt->pCurrStmt, targetDt.precision); pVal->node.resType.precision = precision; - if (pVal->placeholderNo > 0) { + if (pVal->placeholderNo > 0 || pVal->isNull) { return DEAL_RES_CONTINUE; } if (pVal->isDuration) { @@ -1102,6 +1120,8 @@ static bool hasInvalidFuncNesting(SNodeList* pParameterList) { } static int32_t getFuncInfo(STranslateContext* pCxt, SFunctionNode* pFunc) { + // the time precision of the function execution environment + pFunc->node.resType.precision = getPrecisionFromCurrStmt(pCxt->pCurrStmt, TSDB_TIME_PRECISION_MILLI); int32_t code = fmGetFuncInfo(pFunc, pCxt->msgBuf.buf, pCxt->msgBuf.len); if (TSDB_CODE_FUNC_NOT_BUILTIN_FUNTION == code) { code = getUdfInfo(pCxt, pFunc); @@ -1119,7 +1139,7 @@ static int32_t translateAggFunc(STranslateContext* pCxt, SFunctionNode* pFunc) { if (hasInvalidFuncNesting(pFunc->pParameterList)) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_AGG_FUNC_NESTING); } - if (NULL != pCxt->pCurrSelectStmt && pCxt->pCurrSelectStmt->hasIndefiniteRowsFunc) { + if (isSelectStmt(pCxt->pCurrStmt) && ((SSelectStmt*)pCxt->pCurrStmt)->hasIndefiniteRowsFunc) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC); } @@ -1134,7 +1154,8 @@ static int32_t translateScanPseudoColumnFunc(STranslateContext* pCxt, SFunctionN return TSDB_CODE_SUCCESS; } if (0 == LIST_LENGTH(pFunc->pParameterList)) { - if (QUERY_NODE_REAL_TABLE != nodeType(pCxt->pCurrSelectStmt->pFromTable)) { + if (!isSelectStmt(pCxt->pCurrStmt) || + QUERY_NODE_REAL_TABLE != nodeType(((SSelectStmt*)pCxt->pCurrStmt)->pFromTable)) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TBNAME); } } else { @@ -1152,8 +1173,8 @@ static int32_t translateIndefiniteRowsFunc(STranslateContext* pCxt, SFunctionNod if (!fmIsIndefiniteRowsFunc(pFunc->funcId)) { return TSDB_CODE_SUCCESS; } - if (SQL_CLAUSE_SELECT != pCxt->currClause || pCxt->pCurrSelectStmt->hasIndefiniteRowsFunc || - pCxt->pCurrSelectStmt->hasAggFuncs) { + if (!isSelectStmt(pCxt->pCurrStmt) || SQL_CLAUSE_SELECT != pCxt->currClause || + ((SSelectStmt*)pCxt->pCurrStmt)->hasIndefiniteRowsFunc || ((SSelectStmt*)pCxt->pCurrStmt)->hasAggFuncs) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC); } if (hasInvalidFuncNesting(pFunc->pParameterList)) { @@ -1162,13 +1183,20 @@ static int32_t translateIndefiniteRowsFunc(STranslateContext* pCxt, SFunctionNod return TSDB_CODE_SUCCESS; } +static bool hasFillClause(SNode* pCurrStmt) { + if (!isSelectStmt(pCurrStmt)) { + return false; + } + SSelectStmt* pSelect = (SSelectStmt*)pCurrStmt; + return NULL != pSelect->pWindow && QUERY_NODE_INTERVAL_WINDOW == nodeType(pSelect->pWindow) && + NULL != ((SIntervalWindowNode*)pSelect->pWindow)->pFill; +} + static int32_t translateForbidFillFunc(STranslateContext* pCxt, SFunctionNode* pFunc) { if (!fmIsForbidFillFunc(pFunc->funcId)) { return TSDB_CODE_SUCCESS; } - if (NULL != pCxt->pCurrSelectStmt->pWindow && - QUERY_NODE_INTERVAL_WINDOW == nodeType(pCxt->pCurrSelectStmt->pWindow) && - NULL != ((SIntervalWindowNode*)pCxt->pCurrSelectStmt->pWindow)->pFill) { + if (hasFillClause(pCxt->pCurrStmt)) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_FILL_NOT_ALLOWED_FUNC, pFunc->functionName); } return TSDB_CODE_SUCCESS; @@ -1178,7 +1206,7 @@ static int32_t translateWindowPseudoColumnFunc(STranslateContext* pCxt, SFunctio if (!fmIsWindowPseudoColumnFunc(pFunc->funcId)) { return TSDB_CODE_SUCCESS; } - if (NULL == pCxt->pCurrSelectStmt->pWindow) { + if (!isSelectStmt(pCxt->pCurrStmt) || NULL == ((SSelectStmt*)pCxt->pCurrStmt)->pWindow) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_WINDOW_PC); } return TSDB_CODE_SUCCESS; @@ -1188,7 +1216,7 @@ static int32_t translateForbidWindowFunc(STranslateContext* pCxt, SFunctionNode* if (!fmIsForbidWindowFunc(pFunc->funcId)) { return TSDB_CODE_SUCCESS; } - if (NULL != pCxt->pCurrSelectStmt->pWindow) { + if (isSelectStmt(pCxt->pCurrStmt) && NULL != ((SSelectStmt*)pCxt->pCurrStmt)->pWindow) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_WINDOW_NOT_ALLOWED_FUNC, pFunc->functionName); } return TSDB_CODE_SUCCESS; @@ -1208,14 +1236,15 @@ static int32_t translateForbidGroupByFunc(STranslateContext* pCxt, SFunctionNode if (!fmIsForbidGroupByFunc(pFunc->funcId)) { return TSDB_CODE_SUCCESS; } - if (NULL != pCxt->pCurrSelectStmt->pGroupByList) { + if (isSelectStmt(pCxt->pCurrStmt) && NULL != ((SSelectStmt*)pCxt->pCurrStmt)->pGroupByList) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_GROUP_BY_NOT_ALLOWED_FUNC, pFunc->functionName); } return TSDB_CODE_SUCCESS; } -static void setFuncClassification(SSelectStmt* pSelect, SFunctionNode* pFunc) { - if (NULL != pSelect) { +static void setFuncClassification(SNode* pCurrStmt, SFunctionNode* pFunc) { + if (NULL != pCurrStmt && QUERY_NODE_SELECT_STMT == nodeType(pCurrStmt)) { + SSelectStmt* pSelect = (SSelectStmt*)pCurrStmt; pSelect->hasAggFuncs = pSelect->hasAggFuncs ? true : fmIsAggFunc(pFunc->funcId); pSelect->hasRepeatScanFuncs = pSelect->hasRepeatScanFuncs ? true : fmIsRepeatScanFunc(pFunc->funcId); pSelect->hasIndefiniteRowsFunc = pSelect->hasIndefiniteRowsFunc ? true : fmIsIndefiniteRowsFunc(pFunc->funcId); @@ -1226,41 +1255,138 @@ static void setFuncClassification(SSelectStmt* pSelect, SFunctionNode* pFunc) { } } -static EDealRes translateFunction(STranslateContext* pCxt, SFunctionNode* pFunc) { - SNode* pParam = NULL; - FOREACH(pParam, pFunc->pParameterList) { - if (isMultiResFunc(pParam)) { - return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)pParam)->aliasName); +static int32_t rewriteSystemInfoFuncImpl(STranslateContext* pCxt, char* pLiteral, SNode** pNode) { + SValueNode* pVal = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE); + if (NULL == pVal) { + return TSDB_CODE_OUT_OF_MEMORY; + } + strcpy(pVal->node.aliasName, ((SExprNode*)*pNode)->aliasName); + pVal->node.resType = ((SExprNode*)*pNode)->resType; + if (NULL == pLiteral) { + pVal->isNull = true; + } else { + pVal->literal = pLiteral; + } + if (DEAL_RES_ERROR != translateValue(pCxt, pVal)) { + *pNode = (SNode*)pVal; + } else { + nodesDestroyNode((SNode*)pVal); + } + return pCxt->errCode; +} + +static int32_t rewriteDatabaseFunc(STranslateContext* pCxt, SNode** pNode) { + char* pCurrDb = NULL; + if (NULL != pCxt->pParseCxt->db) { + pCurrDb = taosMemoryStrDup((void*)pCxt->pParseCxt->db); + if (NULL == pCurrDb) { + return TSDB_CODE_OUT_OF_MEMORY; } } + return rewriteSystemInfoFuncImpl(pCxt, pCurrDb, pNode); +} - pCxt->errCode = getFuncInfo(pCxt, pFunc); - if (TSDB_CODE_SUCCESS == pCxt->errCode) { - pCxt->errCode = translateAggFunc(pCxt, pFunc); +static int32_t rewriteClentVersionFunc(STranslateContext* pCxt, SNode** pNode) { + char* pVer = taosMemoryStrDup((void*)version); + if (NULL == pVer) { + return TSDB_CODE_OUT_OF_MEMORY; } - if (TSDB_CODE_SUCCESS == pCxt->errCode) { - pCxt->errCode = translateScanPseudoColumnFunc(pCxt, pFunc); + return rewriteSystemInfoFuncImpl(pCxt, pVer, pNode); +} + +static int32_t rewriteServerVersionFunc(STranslateContext* pCxt, SNode** pNode) { + char* pVer = taosMemoryStrDup((void*)pCxt->pParseCxt->svrVer); + if (NULL == pVer) { + return TSDB_CODE_OUT_OF_MEMORY; } - if (TSDB_CODE_SUCCESS == pCxt->errCode) { - pCxt->errCode = translateIndefiniteRowsFunc(pCxt, pFunc); + return rewriteSystemInfoFuncImpl(pCxt, pVer, pNode); +} + +static int32_t rewriteServerStatusFunc(STranslateContext* pCxt, SNode** pNode) { + if (pCxt->pParseCxt->nodeOffline) { + return TSDB_CODE_RPC_NETWORK_UNAVAIL; } - if (TSDB_CODE_SUCCESS == pCxt->errCode) { - pCxt->errCode = translateForbidFillFunc(pCxt, pFunc); + char* pStatus = taosMemoryStrDup((void*)"1"); + return rewriteSystemInfoFuncImpl(pCxt, pStatus, pNode); +} + +static int32_t rewriteUserFunc(STranslateContext* pCxt, SNode** pNode) { + char userConn[TSDB_USER_LEN + 1 + TSDB_FQDN_LEN] = {0}; // format 'user@host' + int32_t len = snprintf(userConn, sizeof(userConn), "%s@", pCxt->pParseCxt->pUser); + taosGetFqdn(userConn + len); + char* pUserConn = taosMemoryStrDup((void*)userConn); + if (NULL == pUserConn) { + return TSDB_CODE_OUT_OF_MEMORY; } - if (TSDB_CODE_SUCCESS == pCxt->errCode) { - pCxt->errCode = translateWindowPseudoColumnFunc(pCxt, pFunc); + return rewriteSystemInfoFuncImpl(pCxt, pUserConn, pNode); +} + +static int32_t rewriteSystemInfoFunc(STranslateContext* pCxt, SNode** pNode) { + switch (((SFunctionNode*)*pNode)->funcType) { + case FUNCTION_TYPE_DATABASE: + return rewriteDatabaseFunc(pCxt, pNode); + case FUNCTION_TYPE_CLIENT_VERSION: + return rewriteClentVersionFunc(pCxt, pNode); + case FUNCTION_TYPE_SERVER_VERSION: + return rewriteServerVersionFunc(pCxt, pNode); + case FUNCTION_TYPE_SERVER_STATUS: + return rewriteServerStatusFunc(pCxt, pNode); + case FUNCTION_TYPE_CURRENT_USER: + case FUNCTION_TYPE_USER: + return rewriteUserFunc(pCxt, pNode); + default: + break; } - if (TSDB_CODE_SUCCESS == pCxt->errCode) { - pCxt->errCode = translateForbidWindowFunc(pCxt, pFunc); + return TSDB_CODE_PAR_INTERNAL_ERROR; +} + +static int32_t translateNoramlFunction(STranslateContext* pCxt, SFunctionNode* pFunc) { + int32_t code = translateAggFunc(pCxt, pFunc); + if (TSDB_CODE_SUCCESS == code) { + code = translateScanPseudoColumnFunc(pCxt, pFunc); } - if (TSDB_CODE_SUCCESS == pCxt->errCode) { - pCxt->errCode = translateForbidStreamFunc(pCxt, pFunc); + if (TSDB_CODE_SUCCESS == code) { + code = translateIndefiniteRowsFunc(pCxt, pFunc); } - if (TSDB_CODE_SUCCESS == pCxt->errCode) { - pCxt->errCode = translateForbidGroupByFunc(pCxt, pFunc); + if (TSDB_CODE_SUCCESS == code) { + code = translateForbidFillFunc(pCxt, pFunc); + } + if (TSDB_CODE_SUCCESS == code) { + code = translateWindowPseudoColumnFunc(pCxt, pFunc); + } + if (TSDB_CODE_SUCCESS == code) { + code = translateForbidWindowFunc(pCxt, pFunc); + } + if (TSDB_CODE_SUCCESS == code) { + code = translateForbidStreamFunc(pCxt, pFunc); } + if (TSDB_CODE_SUCCESS == code) { + code = translateForbidGroupByFunc(pCxt, pFunc); + } + if (TSDB_CODE_SUCCESS == code) { + setFuncClassification(pCxt->pCurrStmt, pFunc); + } + return code; +} + +static int32_t translateFunctionImpl(STranslateContext* pCxt, SFunctionNode** pFunc) { + if (fmIsSystemInfoFunc((*pFunc)->funcId)) { + return rewriteSystemInfoFunc(pCxt, (SNode**)pFunc); + } + return translateNoramlFunction(pCxt, *pFunc); +} + +static EDealRes translateFunction(STranslateContext* pCxt, SFunctionNode** pFunc) { + SNode* pParam = NULL; + FOREACH(pParam, (*pFunc)->pParameterList) { + if (isMultiResFunc(pParam)) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)pParam)->aliasName); + } + } + + pCxt->errCode = getFuncInfo(pCxt, *pFunc); if (TSDB_CODE_SUCCESS == pCxt->errCode) { - setFuncClassification(pCxt->pCurrSelectStmt, pFunc); + pCxt->errCode = translateFunctionImpl(pCxt, pFunc); } return TSDB_CODE_SUCCESS == pCxt->errCode ? DEAL_RES_CONTINUE : DEAL_RES_ERROR; } @@ -1285,7 +1411,7 @@ static EDealRes doTranslateExpr(SNode** pNode, void* pContext) { case QUERY_NODE_OPERATOR: return translateOperator(pCxt, (SOperatorNode**)pNode); case QUERY_NODE_FUNCTION: - return translateFunction(pCxt, (SFunctionNode*)*pNode); + return translateFunction(pCxt, (SFunctionNode**)pNode); case QUERY_NODE_LOGIC_CONDITION: return translateLogicCond(pCxt, (SLogicConditionNode*)*pNode); case QUERY_NODE_TEMP_TABLE: @@ -1308,9 +1434,9 @@ static int32_t translateExprList(STranslateContext* pCxt, SNodeList* pList) { static SNodeList* getGroupByList(STranslateContext* pCxt) { if (isDistinctOrderBy(pCxt)) { - return pCxt->pCurrSelectStmt->pProjectionList; + return ((SSelectStmt*)pCxt->pCurrStmt)->pProjectionList; } - return pCxt->pCurrSelectStmt->pGroupByList; + return ((SSelectStmt*)pCxt->pCurrStmt)->pGroupByList; } static SNode* getGroupByNode(SNode* pNode) { @@ -1348,32 +1474,13 @@ static EDealRes rewriteColToSelectValFunc(STranslateContext* pCxt, SNode** pNode } if (TSDB_CODE_SUCCESS == pCxt->errCode) { *pNode = (SNode*)pFunc; - pCxt->pCurrSelectStmt->hasSelectValFunc = true; + ((SSelectStmt*)pCxt->pCurrStmt)->hasSelectValFunc = true; } else { nodesDestroyNode((SNode*)pFunc); } return TSDB_CODE_SUCCESS == pCxt->errCode ? DEAL_RES_IGNORE_CHILD : DEAL_RES_ERROR; } -static EDealRes rewriteExprToGroupKeyFunc(STranslateContext* pCxt, SNode** pNode) { - SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); - if (NULL == pFunc) { - pCxt->errCode = TSDB_CODE_OUT_OF_MEMORY; - return DEAL_RES_ERROR; - } - - strcpy(pFunc->functionName, "_group_key"); - strcpy(pFunc->node.aliasName, ((SExprNode*)*pNode)->aliasName); - pCxt->errCode = nodesListMakeAppend(&pFunc->pParameterList, *pNode); - if (TSDB_CODE_SUCCESS == pCxt->errCode) { - *pNode = (SNode*)pFunc; - pCxt->errCode = fmGetFuncInfo(pFunc, pCxt->msgBuf.buf, pCxt->msgBuf.len); - } - pCxt->pCurrSelectStmt->hasAggFuncs = true; - - return (TSDB_CODE_SUCCESS == pCxt->errCode ? DEAL_RES_IGNORE_CHILD : DEAL_RES_ERROR); -} - static EDealRes doCheckExprForGroupBy(SNode** pNode, void* pContext) { SCheckExprForGroupByCxt* pCxt = (SCheckExprForGroupByCxt*)pContext; if (!nodesIsExprNode(*pNode) || isAliasColumn(*pNode)) { @@ -1393,7 +1500,13 @@ static EDealRes doCheckExprForGroupBy(SNode** pNode, void* pContext) { SNode* pGroupNode = NULL; FOREACH(pGroupNode, getGroupByList(pCxt->pTranslateCxt)) { if (nodesEqualNode(getGroupByNode(pGroupNode), *pNode)) { - return rewriteExprToGroupKeyFunc(pCxt->pTranslateCxt, pNode); + return DEAL_RES_IGNORE_CHILD; + } + } + SNode* pPartKey = NULL; + FOREACH(pPartKey, ((SSelectStmt*)pCxt->pTranslateCxt->pCurrStmt)->pPartitionByList) { + if (nodesEqualNode(pPartKey, *pNode)) { + return DEAL_RES_IGNORE_CHILD; } } if (isScanPseudoColumnFunc(*pNode) || QUERY_NODE_COLUMN == nodeType(*pNode)) { @@ -1451,25 +1564,6 @@ static int32_t rewriteColsToSelectValFunc(STranslateContext* pCxt, SSelectStmt* return pCxt->errCode; } -static EDealRes rewriteExprsToGroupKeyFuncImpl(SNode** pNode, void* pContext) { - STranslateContext* pCxt = pContext; - SNode* pPartKey = NULL; - FOREACH(pPartKey, pCxt->pCurrSelectStmt->pPartitionByList) { - if (nodesEqualNode(pPartKey, *pNode)) { - return rewriteExprToGroupKeyFunc(pCxt, pNode); - } - } - return DEAL_RES_CONTINUE; -} - -static int32_t rewriteExprsToGroupKeyFunc(STranslateContext* pCxt, SSelectStmt* pSelect) { - nodesRewriteExprs(pSelect->pProjectionList, rewriteExprsToGroupKeyFuncImpl, pCxt); - if (TSDB_CODE_SUCCESS == pCxt->errCode && !pSelect->isDistinct) { - nodesRewriteExprs(pSelect->pOrderByList, rewriteExprsToGroupKeyFuncImpl, pCxt); - } - return pCxt->errCode; -} - typedef struct CheckAggColCoexistCxt { STranslateContext* pTranslateCxt; bool existAggFunc; @@ -1495,7 +1589,7 @@ static EDealRes doCheckAggColCoexist(SNode* pNode, void* pContext) { return DEAL_RES_IGNORE_CHILD; } SNode* pPartKey = NULL; - FOREACH(pPartKey, pCxt->pTranslateCxt->pCurrSelectStmt->pPartitionByList) { + FOREACH(pPartKey, ((SSelectStmt*)pCxt->pTranslateCxt->pCurrStmt)->pPartitionByList) { if (nodesEqualNode(pPartKey, pNode)) { return DEAL_RES_IGNORE_CHILD; } @@ -1529,9 +1623,6 @@ static int32_t checkAggColCoexist(STranslateContext* pCxt, SSelectStmt* pSelect) if (cxt.existIndefiniteRowsFunc && cxt.existCol) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC); } - if (cxt.existAggFunc && NULL != pSelect->pPartitionByList) { - return rewriteExprsToGroupKeyFunc(pCxt, pSelect); - } return TSDB_CODE_SUCCESS; } @@ -1662,7 +1753,8 @@ static uint8_t getStmtPrecision(SNode* pStmt) { static bool stmtIsSingleTable(SNode* pStmt) { if (QUERY_NODE_SELECT_STMT == nodeType(pStmt)) { - return ((STableNode*)((SSelectStmt*)pStmt)->pFromTable)->singleTable; + SSelectStmt* pSelect = (SSelectStmt*)pStmt; + return NULL == pSelect->pFromTable || ((STableNode*)pSelect->pFromTable)->singleTable; } return false; } @@ -1690,8 +1782,8 @@ static int32_t setTableIndex(STranslateContext* pCxt, SName* pName, SRealTableNo if (pCxt->createStream || QUERY_SMA_OPTIMIZE_DISABLE == tsQuerySmaOptimize) { return TSDB_CODE_SUCCESS; } - if (NULL != pCxt->pCurrSelectStmt && NULL != pCxt->pCurrSelectStmt->pWindow && - QUERY_NODE_INTERVAL_WINDOW == nodeType(pCxt->pCurrSelectStmt->pWindow)) { + if (isSelectStmt(pCxt->pCurrStmt) && NULL != ((SSelectStmt*)pCxt->pCurrStmt)->pWindow && + QUERY_NODE_INTERVAL_WINDOW == nodeType(((SSelectStmt*)pCxt->pCurrStmt)->pWindow)) { return getTableIndex(pCxt, pName, &pRealTable->pSmaIndexes); } return TSDB_CODE_SUCCESS; @@ -2404,58 +2496,10 @@ static EDealRes rewriteSeletcValueFunc(STranslateContext* pCxt, SNode** pNode) { nodesDestroyNode(*pNode); *pNode = (SNode*)pFirst; pCxt->errCode = fmGetFuncInfo(pFirst, pCxt->msgBuf.buf, pCxt->msgBuf.len); - pCxt->pCurrSelectStmt->hasAggFuncs = true; + ((SSelectStmt*)pCxt->pCurrStmt)->hasAggFuncs = true; return TSDB_CODE_SUCCESS == pCxt->errCode ? DEAL_RES_IGNORE_CHILD : DEAL_RES_ERROR; } -static EDealRes rewriteUniqueFunc(SNode** pNode, void* pContext) { - SRwriteUniqueCxt* pCxt = pContext; - if (QUERY_NODE_FUNCTION == nodeType(*pNode)) { - SFunctionNode* pFunc = (SFunctionNode*)*pNode; - if (FUNCTION_TYPE_UNIQUE == pFunc->funcType) { - SNode* pExpr = nodesListGetNode(pFunc->pParameterList, 0); - NODES_CLEAR_LIST(pFunc->pParameterList); - strcpy(((SExprNode*)pExpr)->aliasName, ((SExprNode*)*pNode)->aliasName); - nodesDestroyNode(*pNode); - *pNode = pExpr; - pCxt->pExpr = pExpr; - return DEAL_RES_IGNORE_CHILD; - } else if (FUNCTION_TYPE_SELECT_VALUE == pFunc->funcType) { - return rewriteSeletcValueFunc(pCxt->pTranslateCxt, pNode); - } - } - return DEAL_RES_CONTINUE; -} - -static SNode* createGroupingSet(SNode* pExpr) { - SGroupingSetNode* pGroupingSet = (SGroupingSetNode*)nodesMakeNode(QUERY_NODE_GROUPING_SET); - if (NULL == pGroupingSet) { - return NULL; - } - pGroupingSet->groupingSetType = GP_TYPE_NORMAL; - if (TSDB_CODE_SUCCESS != nodesListMakeStrictAppend(&pGroupingSet->pParameterList, nodesCloneNode(pExpr))) { - nodesDestroyNode((SNode*)pGroupingSet); - return NULL; - } - return (SNode*)pGroupingSet; -} - -// from: select unique(expr), col1 + col2 from t where_clause partition_by_clause order_by_clause ... -// to: select expr, first(col1) + first(col2) from t where_clause partition_by_clause group by expr order_by_clause ... -static int32_t rewriteUniqueStmt(STranslateContext* pCxt, SSelectStmt* pSelect) { - if (!pSelect->hasUniqueFunc) { - return TSDB_CODE_SUCCESS; - } - - SRwriteUniqueCxt cxt = {.pTranslateCxt = pCxt, .pExpr = NULL}; - nodesRewriteExprs(pSelect->pProjectionList, rewriteUniqueFunc, &cxt); - if (TSDB_CODE_SUCCESS == cxt.pTranslateCxt->errCode) { - cxt.pTranslateCxt->errCode = nodesListMakeStrictAppend(&pSelect->pGroupByList, createGroupingSet(cxt.pExpr)); - } - pSelect->hasIndefiniteRowsFunc = false; - return cxt.pTranslateCxt->errCode; -} - typedef struct SReplaceOrderByAliasCxt { STranslateContext* pTranslateCxt; SNodeList* pProjectionList; @@ -2474,6 +2518,7 @@ static EDealRes replaceOrderByAliasImpl(SNode** pNode, void* pContext) { pCxt->pTranslateCxt->errCode = TSDB_CODE_OUT_OF_MEMORY; return DEAL_RES_ERROR; } + ((SExprNode*)pNew)->orderAlias = true; nodesDestroyNode(*pNode); *pNode = pNew; return DEAL_RES_CONTINUE; @@ -2490,13 +2535,13 @@ static int32_t replaceOrderByAlias(STranslateContext* pCxt, SNodeList* pProjecti } static int32_t translateSelectWithoutFrom(STranslateContext* pCxt, SSelectStmt* pSelect) { - pCxt->pCurrSelectStmt = pSelect; + pCxt->pCurrStmt = (SNode*)pSelect; pCxt->currClause = SQL_CLAUSE_SELECT; return translateExprList(pCxt, pSelect->pProjectionList); } static int32_t translateSelectFrom(STranslateContext* pCxt, SSelectStmt* pSelect) { - pCxt->pCurrSelectStmt = pSelect; + pCxt->pCurrStmt = (SNode*)pSelect; int32_t code = translateFrom(pCxt, pSelect->pFromTable); if (TSDB_CODE_SUCCESS == code) { pSelect->precision = ((STableNode*)pSelect->pFromTable)->precision; @@ -2529,9 +2574,6 @@ static int32_t translateSelectFrom(STranslateContext* pCxt, SSelectStmt* pSelect if (TSDB_CODE_SUCCESS == code) { code = translateInterp(pCxt, pSelect); } - if (TSDB_CODE_SUCCESS == code) { - code = rewriteUniqueStmt(pCxt, pSelect); - } if (TSDB_CODE_SUCCESS == code) { code = rewriteTimelineFunc(pCxt, pSelect); } @@ -2623,8 +2665,7 @@ static int32_t translateSetOperOrderBy(STranslateContext* pCxt, SSetOperator* pS if (TSDB_CODE_SUCCESS == code) { if (other) { pCxt->currClause = SQL_CLAUSE_ORDER_BY; - pCxt->pCurrSelectStmt = NULL; - pCxt->pCurrSetOperator = pSetOperator; + pCxt->pCurrStmt = (SNode*)pSetOperator; code = translateExprList(pCxt, pSetOperator->pOrderByList); } } @@ -4504,12 +4545,12 @@ static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) { static int32_t translateSubquery(STranslateContext* pCxt, SNode* pNode) { ++(pCxt->currLevel); - ESqlClause currClause = pCxt->currClause; - SSelectStmt* pCurrStmt = pCxt->pCurrSelectStmt; - int32_t code = translateQuery(pCxt, pNode); + ESqlClause currClause = pCxt->currClause; + SNode* pCurrStmt = pCxt->pCurrStmt; + int32_t code = translateQuery(pCxt, pNode); --(pCxt->currLevel); pCxt->currClause = currClause; - pCxt->pCurrSelectStmt = pCurrStmt; + pCxt->pCurrStmt = pCurrStmt; return code; } @@ -5961,6 +6002,11 @@ static int32_t setRefreshMate(STranslateContext* pCxt, SQuery* pQuery) { static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery) { switch (nodeType(pQuery->pRoot)) { case QUERY_NODE_SELECT_STMT: + if (NULL == ((SSelectStmt*)pQuery->pRoot)->pFromTable) { + pQuery->execMode = QUERY_EXEC_MODE_LOCAL; + pQuery->haveResultSet = true; + break; + } case QUERY_NODE_SET_OPERATOR: case QUERY_NODE_EXPLAIN_STMT: pQuery->execMode = QUERY_EXEC_MODE_SCHEDULE; diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 225d163f5370ea659401eeedee33b73bff1fcba1..5eb9c722677ebe992aa95d42b7b0d4fb4493a4de 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -104,26 +104,26 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 370 +#define YYNOCODE 374 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - ENullOrder yy77; - SAlterOption yy85; - int32_t yy100; - SToken yy109; - EOrder yy178; - int64_t yy209; - int8_t yy323; - SNodeList* yy404; - bool yy437; - EOperatorType yy440; - SNode* yy452; - SDataType yy504; - EJoinType yy532; - EFillMode yy614; + SNodeList* yy24; + SDataType yy48; + bool yy97; + SAlterOption yy189; + int32_t yy244; + EFillMode yy250; + EJoinType yy596; + EOrder yy598; + int8_t yy619; + SNode* yy652; + ENullOrder yy653; + SToken yy657; + EOperatorType yy700; + int64_t yy701; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -140,16 +140,16 @@ typedef union { #define ParseCTX_STORE #define YYFALLBACK 1 #define YYNSTATE 653 -#define YYNRULE 477 -#define YYNTOKEN 246 +#define YYNRULE 483 +#define YYNTOKEN 250 #define YY_MAX_SHIFT 652 -#define YY_MIN_SHIFTREDUCE 947 -#define YY_MAX_SHIFTREDUCE 1423 -#define YY_ERROR_ACTION 1424 -#define YY_ACCEPT_ACTION 1425 -#define YY_NO_ACTION 1426 -#define YY_MIN_REDUCE 1427 -#define YY_MAX_REDUCE 1903 +#define YY_MIN_SHIFTREDUCE 953 +#define YY_MAX_SHIFTREDUCE 1435 +#define YY_ERROR_ACTION 1436 +#define YY_ACCEPT_ACTION 1437 +#define YY_NO_ACTION 1438 +#define YY_MIN_REDUCE 1439 +#define YY_MAX_REDUCE 1921 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -216,623 +216,679 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (2208) +#define YY_ACTTAB_COUNT (2489) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 422, 1661, 423, 1462, 430, 1730, 423, 1462, 317, 1881, - /* 10 */ 141, 1425, 39, 37, 1518, 373, 1727, 69, 1552, 1550, - /* 20 */ 326, 1428, 1230, 1880, 379, 1730, 1367, 1878, 334, 1727, - /* 30 */ 115, 140, 1254, 1439, 1743, 1228, 1727, 338, 566, 1556, - /* 40 */ 1606, 1608, 101, 1723, 1729, 100, 99, 98, 97, 96, - /* 50 */ 95, 94, 93, 92, 570, 1881, 1723, 1729, 61, 14, - /* 60 */ 1309, 296, 1761, 1723, 1729, 1236, 1254, 570, 1761, 156, - /* 70 */ 550, 566, 343, 1878, 570, 1713, 519, 549, 39, 37, - /* 80 */ 1360, 427, 1, 504, 1255, 1230, 326, 1252, 1230, 33, - /* 90 */ 32, 439, 530, 40, 38, 36, 35, 34, 1228, 1743, - /* 100 */ 43, 1228, 151, 1774, 649, 520, 87, 1744, 552, 1746, - /* 110 */ 1747, 548, 1881, 570, 518, 1600, 1814, 69, 1301, 1302, - /* 120 */ 298, 1810, 60, 1881, 1255, 14, 156, 1761, 1236, 1881, - /* 130 */ 1878, 1236, 1881, 567, 567, 547, 60, 156, 526, 1557, - /* 140 */ 1713, 1878, 549, 157, 111, 161, 158, 1878, 2, 101, - /* 150 */ 1878, 460, 100, 99, 98, 97, 96, 95, 94, 93, - /* 160 */ 92, 1561, 1561, 1231, 1394, 1229, 119, 649, 1774, 604, - /* 170 */ 649, 287, 1744, 552, 1746, 1747, 548, 546, 570, 543, - /* 180 */ 1786, 1323, 1129, 1130, 1301, 1302, 1450, 1234, 1235, 534, - /* 190 */ 1283, 1284, 1286, 1287, 1288, 1289, 1290, 545, 568, 1298, - /* 200 */ 1299, 1300, 1303, 1285, 1328, 166, 117, 295, 1829, 1252, - /* 210 */ 40, 38, 36, 35, 34, 159, 405, 1427, 1236, 417, - /* 220 */ 528, 153, 1822, 1823, 567, 1827, 1231, 1713, 1229, 1231, - /* 230 */ 67, 1229, 1826, 66, 1384, 377, 390, 1285, 418, 27, - /* 240 */ 392, 110, 109, 108, 107, 106, 105, 104, 103, 102, - /* 250 */ 1234, 1235, 1561, 1234, 1235, 159, 1283, 1284, 1286, 1287, - /* 260 */ 1288, 1289, 1290, 545, 568, 1298, 1299, 1300, 1303, 159, - /* 270 */ 383, 512, 1382, 1383, 1385, 1386, 33, 32, 39, 37, - /* 280 */ 40, 38, 36, 35, 34, 1254, 326, 608, 1230, 1533, - /* 290 */ 1087, 593, 592, 591, 1091, 590, 1093, 1094, 589, 1096, - /* 300 */ 586, 1228, 1102, 583, 1104, 1105, 580, 577, 11, 10, - /* 310 */ 416, 22, 566, 411, 410, 409, 408, 407, 404, 403, - /* 320 */ 402, 401, 400, 396, 395, 394, 393, 387, 386, 385, - /* 330 */ 384, 1236, 381, 380, 39, 37, 1743, 1253, 310, 30, - /* 340 */ 240, 997, 326, 996, 1230, 33, 32, 209, 8, 40, - /* 350 */ 38, 36, 35, 34, 474, 473, 458, 1228, 1731, 472, - /* 360 */ 980, 1256, 116, 469, 1761, 567, 468, 467, 466, 1727, - /* 370 */ 649, 998, 550, 60, 42, 73, 111, 1713, 596, 549, - /* 380 */ 535, 14, 497, 465, 1301, 1302, 311, 1236, 309, 308, - /* 390 */ 1335, 462, 412, 1561, 530, 464, 1723, 1729, 515, 479, - /* 400 */ 984, 985, 1881, 1449, 2, 1774, 1440, 570, 87, 1744, - /* 410 */ 552, 1746, 1747, 548, 489, 570, 1879, 463, 1814, 567, - /* 420 */ 1878, 567, 298, 1810, 84, 553, 649, 1492, 201, 1231, - /* 430 */ 378, 1229, 382, 329, 1881, 607, 1658, 120, 170, 169, - /* 440 */ 1301, 1302, 482, 1448, 1713, 1553, 476, 1561, 156, 1561, - /* 450 */ 490, 200, 1878, 1234, 1235, 1546, 1283, 1284, 1286, 1287, - /* 460 */ 1288, 1289, 1290, 545, 568, 1298, 1299, 1300, 1303, 330, - /* 470 */ 521, 516, 39, 37, 1304, 421, 55, 138, 425, 54, - /* 480 */ 326, 159, 1230, 567, 1713, 1231, 1563, 1229, 474, 473, - /* 490 */ 1881, 231, 1420, 472, 397, 1228, 116, 469, 526, 1519, - /* 500 */ 468, 467, 466, 526, 156, 58, 159, 159, 1878, 1234, - /* 510 */ 1235, 1561, 1283, 1284, 1286, 1287, 1288, 1289, 1290, 545, - /* 520 */ 568, 1298, 1299, 1300, 1303, 1236, 119, 39, 37, 1607, - /* 530 */ 1608, 119, 567, 364, 1257, 326, 1447, 1230, 984, 985, - /* 540 */ 33, 32, 9, 398, 40, 38, 36, 35, 34, 202, - /* 550 */ 1228, 33, 32, 366, 362, 40, 38, 36, 35, 34, - /* 560 */ 1561, 567, 429, 1743, 649, 425, 117, 336, 997, 1446, - /* 570 */ 996, 117, 438, 1657, 1419, 138, 305, 1713, 1301, 1302, - /* 580 */ 1236, 154, 1822, 1823, 1563, 1827, 155, 1822, 1823, 1561, - /* 590 */ 1827, 1761, 602, 39, 37, 235, 567, 9, 998, 550, - /* 600 */ 1445, 326, 1444, 1230, 1713, 464, 549, 1558, 71, 304, - /* 610 */ 1713, 129, 128, 599, 598, 597, 1228, 567, 506, 649, - /* 620 */ 471, 470, 1479, 1231, 1561, 1229, 1374, 463, 1690, 36, - /* 630 */ 35, 34, 1774, 1301, 1302, 288, 1744, 552, 1746, 1747, - /* 640 */ 548, 1713, 570, 1713, 475, 1561, 1236, 1234, 1235, 1049, - /* 650 */ 1283, 1284, 1286, 1287, 1288, 1289, 1290, 545, 568, 1298, - /* 660 */ 1299, 1300, 1303, 2, 212, 567, 567, 33, 32, 1254, - /* 670 */ 567, 40, 38, 36, 35, 34, 498, 502, 1231, 1051, - /* 680 */ 1229, 564, 33, 32, 1651, 649, 40, 38, 36, 35, - /* 690 */ 34, 620, 618, 1561, 1561, 168, 1834, 1355, 1561, 1301, - /* 700 */ 1302, 1538, 1234, 1235, 1548, 1283, 1284, 1286, 1287, 1288, - /* 710 */ 1289, 1290, 545, 568, 1298, 1299, 1300, 1303, 299, 60, - /* 720 */ 567, 33, 32, 652, 339, 40, 38, 36, 35, 34, - /* 730 */ 1544, 565, 138, 299, 532, 205, 1613, 262, 567, 1539, - /* 740 */ 488, 1563, 1268, 331, 1231, 1443, 1229, 1613, 1561, 256, - /* 750 */ 1321, 149, 1611, 486, 337, 484, 642, 638, 634, 630, - /* 760 */ 260, 244, 1743, 1611, 1537, 1321, 1561, 1442, 1234, 1235, - /* 770 */ 1441, 1283, 1284, 1286, 1287, 1288, 1289, 1290, 545, 568, - /* 780 */ 1298, 1299, 1300, 1303, 138, 85, 1713, 139, 254, 553, - /* 790 */ 1761, 1438, 273, 1564, 1359, 602, 1268, 439, 550, 372, - /* 800 */ 1659, 371, 567, 1713, 1322, 549, 271, 57, 1713, 1829, - /* 810 */ 56, 1713, 544, 340, 129, 128, 599, 598, 597, 1322, - /* 820 */ 1437, 563, 604, 1212, 1213, 1656, 171, 1327, 305, 1613, - /* 830 */ 1561, 1774, 1713, 1825, 88, 1744, 552, 1746, 1747, 548, - /* 840 */ 1285, 570, 1327, 1489, 1814, 1612, 1436, 1435, 319, 1810, - /* 850 */ 1894, 60, 159, 211, 78, 1701, 7, 595, 1434, 1849, - /* 860 */ 1433, 1713, 29, 324, 1316, 1317, 1318, 1319, 1320, 1324, - /* 870 */ 1325, 1326, 245, 246, 1204, 1554, 204, 29, 324, 1316, - /* 880 */ 1317, 1318, 1319, 1320, 1324, 1325, 1326, 1713, 1713, 86, - /* 890 */ 33, 32, 513, 1432, 40, 38, 36, 35, 34, 1713, - /* 900 */ 1743, 1713, 352, 1431, 626, 625, 624, 341, 1829, 623, - /* 910 */ 622, 621, 121, 616, 615, 614, 613, 612, 611, 610, - /* 920 */ 609, 131, 605, 619, 64, 63, 376, 1430, 1761, 165, - /* 930 */ 208, 542, 1824, 304, 1713, 370, 529, 333, 332, 600, - /* 940 */ 537, 1713, 1604, 549, 1713, 601, 294, 1244, 1604, 360, - /* 950 */ 1239, 358, 354, 350, 162, 345, 267, 457, 72, 1591, - /* 960 */ 1237, 1743, 193, 367, 195, 191, 223, 194, 1713, 1774, - /* 970 */ 1536, 1474, 88, 1744, 552, 1746, 1747, 548, 197, 570, - /* 980 */ 199, 196, 1814, 198, 159, 1472, 319, 1810, 152, 1761, - /* 990 */ 1236, 52, 501, 477, 11, 10, 1238, 529, 491, 50, - /* 1000 */ 232, 1762, 1713, 83, 549, 26, 1358, 480, 505, 1842, - /* 1010 */ 1733, 33, 32, 80, 28, 40, 38, 36, 35, 34, - /* 1020 */ 33, 32, 1743, 342, 40, 38, 36, 35, 34, 571, - /* 1030 */ 1774, 1355, 137, 88, 1744, 552, 1746, 1747, 548, 1381, - /* 1040 */ 570, 1422, 1423, 1814, 1463, 1601, 1735, 319, 1810, 152, - /* 1050 */ 1761, 1845, 216, 41, 527, 234, 237, 239, 550, 1313, - /* 1060 */ 41, 5, 41, 1713, 602, 549, 242, 344, 3, 1252, - /* 1070 */ 1843, 123, 347, 351, 126, 127, 50, 1743, 306, 1049, - /* 1080 */ 1242, 575, 126, 129, 128, 599, 598, 597, 1245, 1468, - /* 1090 */ 1240, 1774, 218, 1329, 88, 1744, 552, 1746, 1747, 548, - /* 1100 */ 1291, 570, 1180, 127, 1814, 1761, 247, 112, 319, 1810, - /* 1110 */ 1894, 559, 1248, 550, 253, 1080, 266, 307, 1713, 1872, - /* 1120 */ 549, 1108, 1112, 568, 1298, 1299, 1241, 1196, 126, 263, - /* 1130 */ 1743, 1021, 399, 538, 1653, 167, 406, 644, 1258, 1743, - /* 1140 */ 414, 413, 415, 1119, 419, 1261, 1774, 1117, 431, 88, - /* 1150 */ 1744, 552, 1746, 1747, 548, 420, 570, 1743, 1761, 1814, - /* 1160 */ 428, 1022, 174, 319, 1810, 1894, 550, 1761, 130, 1260, - /* 1170 */ 433, 1713, 176, 549, 1833, 550, 432, 1262, 434, 179, - /* 1180 */ 1713, 181, 549, 1259, 437, 1761, 459, 183, 530, 436, - /* 1190 */ 68, 440, 186, 550, 461, 91, 1551, 530, 1713, 1774, - /* 1200 */ 549, 190, 280, 1744, 552, 1746, 1747, 548, 1774, 570, - /* 1210 */ 1547, 280, 1744, 552, 1746, 1747, 548, 192, 570, 132, - /* 1220 */ 133, 1549, 1743, 1545, 134, 135, 1774, 297, 1881, 89, - /* 1230 */ 1744, 552, 1746, 1747, 548, 1695, 570, 1881, 1743, 1814, - /* 1240 */ 264, 203, 158, 1813, 1810, 492, 1878, 1743, 493, 496, - /* 1250 */ 1761, 156, 1257, 206, 499, 1878, 503, 316, 550, 210, - /* 1260 */ 514, 1846, 509, 1713, 556, 549, 1761, 1856, 214, 511, - /* 1270 */ 217, 318, 6, 517, 550, 1761, 523, 510, 1836, 1713, - /* 1280 */ 224, 549, 508, 550, 507, 1855, 1355, 118, 1713, 226, - /* 1290 */ 549, 1774, 222, 227, 89, 1744, 552, 1746, 1747, 548, - /* 1300 */ 1743, 570, 146, 225, 1814, 1256, 1830, 1774, 541, 1810, - /* 1310 */ 142, 1744, 552, 1746, 1747, 548, 1774, 570, 44, 89, - /* 1320 */ 1744, 552, 1746, 1747, 548, 539, 570, 1877, 1761, 1814, - /* 1330 */ 188, 536, 320, 18, 1811, 124, 550, 233, 236, 228, - /* 1340 */ 1795, 1713, 125, 549, 144, 554, 555, 1897, 533, 456, - /* 1350 */ 452, 448, 444, 187, 1743, 531, 1895, 1694, 1663, 557, - /* 1360 */ 540, 328, 560, 1743, 561, 249, 251, 238, 562, 1774, - /* 1370 */ 265, 77, 283, 1744, 552, 1746, 1747, 548, 70, 570, - /* 1380 */ 1562, 185, 1761, 79, 573, 268, 1534, 645, 259, 1605, - /* 1390 */ 550, 1761, 646, 648, 51, 1713, 145, 549, 289, 550, - /* 1400 */ 272, 291, 290, 270, 1713, 1707, 549, 1706, 62, 1705, - /* 1410 */ 346, 522, 348, 1743, 1702, 349, 1223, 1224, 323, 163, - /* 1420 */ 353, 1700, 355, 1774, 1743, 356, 142, 1744, 552, 1746, - /* 1430 */ 1747, 548, 1774, 570, 357, 288, 1744, 552, 1746, 1747, - /* 1440 */ 548, 1761, 570, 184, 177, 1699, 182, 359, 1698, 547, - /* 1450 */ 435, 361, 1761, 1697, 1713, 363, 549, 1696, 365, 1680, - /* 1460 */ 550, 164, 368, 369, 1199, 1713, 1198, 549, 1674, 175, - /* 1470 */ 1673, 374, 1896, 375, 1672, 1671, 1743, 1168, 1646, 325, - /* 1480 */ 1645, 1644, 1774, 65, 1643, 287, 1744, 552, 1746, 1747, - /* 1490 */ 548, 1642, 570, 1774, 1787, 1641, 288, 1744, 552, 1746, - /* 1500 */ 1747, 548, 1640, 570, 1761, 1639, 388, 389, 1638, 391, - /* 1510 */ 1637, 1636, 550, 1635, 1634, 1633, 1632, 1713, 1631, 549, - /* 1520 */ 1630, 1629, 1628, 1627, 1626, 1625, 1624, 122, 1623, 1743, - /* 1530 */ 1622, 327, 1621, 1620, 1619, 1618, 1617, 1616, 1743, 1170, - /* 1540 */ 1615, 1614, 1491, 1459, 150, 1774, 172, 1743, 288, 1744, - /* 1550 */ 552, 1746, 1747, 548, 1458, 570, 1688, 1761, 113, 987, - /* 1560 */ 986, 1682, 1670, 1669, 180, 550, 1761, 1655, 1540, 173, - /* 1570 */ 1713, 1490, 549, 424, 550, 1761, 1488, 426, 114, 1713, - /* 1580 */ 1486, 549, 1484, 550, 1482, 441, 178, 443, 1713, 1471, - /* 1590 */ 549, 442, 445, 1470, 447, 449, 1455, 1542, 1774, 1743, - /* 1600 */ 446, 274, 1744, 552, 1746, 1747, 548, 1774, 570, 451, - /* 1610 */ 275, 1744, 552, 1746, 1747, 548, 1774, 570, 453, 276, - /* 1620 */ 1744, 552, 1746, 1747, 548, 1015, 570, 1761, 450, 49, - /* 1630 */ 455, 1122, 454, 1123, 1541, 550, 1048, 1047, 1046, 1045, - /* 1640 */ 1713, 1743, 549, 617, 1480, 1042, 1041, 1040, 189, 619, - /* 1650 */ 312, 1475, 313, 1473, 478, 314, 481, 1454, 483, 1453, - /* 1660 */ 485, 1743, 1452, 487, 1687, 90, 1206, 1681, 1774, 1761, - /* 1670 */ 494, 282, 1744, 552, 1746, 1747, 548, 550, 570, 1668, - /* 1680 */ 1666, 136, 1713, 1743, 549, 1667, 1665, 1664, 15, 1761, - /* 1690 */ 4, 1408, 41, 47, 10, 23, 213, 550, 1396, 207, - /* 1700 */ 143, 53, 1713, 215, 549, 1380, 219, 221, 24, 220, - /* 1710 */ 1774, 1761, 1373, 284, 1744, 552, 1746, 1747, 548, 550, - /* 1720 */ 570, 500, 495, 315, 1713, 74, 549, 1733, 16, 1352, - /* 1730 */ 1774, 25, 46, 277, 1744, 552, 1746, 1747, 548, 1743, - /* 1740 */ 570, 1351, 230, 147, 17, 1407, 1413, 321, 1743, 1412, - /* 1750 */ 1411, 1402, 1774, 322, 19, 285, 1744, 552, 1746, 1747, - /* 1760 */ 548, 1314, 570, 148, 1276, 1293, 31, 1761, 160, 1662, - /* 1770 */ 1654, 250, 1732, 1292, 241, 550, 1761, 45, 1378, 551, - /* 1780 */ 1713, 12, 549, 558, 550, 13, 20, 21, 243, 1713, - /* 1790 */ 248, 549, 80, 255, 1246, 75, 572, 574, 1743, 1295, - /* 1800 */ 252, 76, 1777, 569, 1101, 48, 335, 1743, 1774, 578, - /* 1810 */ 1109, 278, 1744, 552, 1746, 1747, 548, 1774, 570, 576, - /* 1820 */ 286, 1744, 552, 1746, 1747, 548, 1761, 570, 1106, 1103, - /* 1830 */ 579, 581, 582, 584, 550, 1761, 587, 1097, 585, 1713, - /* 1840 */ 1095, 549, 588, 550, 1100, 1099, 1086, 1098, 1713, 594, - /* 1850 */ 549, 1118, 257, 1114, 1013, 81, 603, 1743, 82, 59, - /* 1860 */ 1037, 606, 258, 1035, 1055, 1034, 1743, 1774, 1033, 1032, - /* 1870 */ 279, 1744, 552, 1746, 1747, 548, 1774, 570, 1031, 292, - /* 1880 */ 1744, 552, 1746, 1747, 548, 1761, 570, 1030, 1029, 1028, - /* 1890 */ 1050, 1052, 1025, 550, 1761, 1024, 1023, 1020, 1713, 1019, - /* 1900 */ 549, 1018, 550, 1487, 627, 628, 629, 1713, 1485, 549, - /* 1910 */ 631, 633, 1483, 635, 1481, 632, 637, 636, 1743, 639, - /* 1920 */ 640, 641, 1469, 643, 977, 1451, 1774, 1743, 261, 293, - /* 1930 */ 1744, 552, 1746, 1747, 548, 1774, 570, 647, 1755, 1744, - /* 1940 */ 552, 1746, 1747, 548, 650, 570, 1761, 1426, 1232, 269, - /* 1950 */ 651, 1426, 1426, 1426, 550, 1761, 1426, 1426, 1426, 1713, - /* 1960 */ 1426, 549, 1426, 550, 1426, 1426, 1426, 1426, 1713, 1426, - /* 1970 */ 549, 1426, 1426, 1426, 1426, 1426, 1426, 1426, 1426, 1426, - /* 1980 */ 1743, 1426, 1426, 1426, 1426, 1426, 1426, 1774, 1426, 1743, - /* 1990 */ 1754, 1744, 552, 1746, 1747, 548, 1774, 570, 1743, 1753, - /* 2000 */ 1744, 552, 1746, 1747, 548, 1426, 570, 1743, 1761, 1426, - /* 2010 */ 526, 1426, 1426, 1426, 1426, 1426, 550, 1761, 1426, 1426, - /* 2020 */ 1426, 1713, 1426, 549, 1426, 550, 1761, 1426, 1426, 1426, - /* 2030 */ 1713, 1426, 549, 1426, 550, 1761, 1426, 1426, 119, 1713, - /* 2040 */ 1426, 549, 1426, 550, 1426, 1426, 1426, 1426, 1713, 1774, - /* 2050 */ 549, 1426, 302, 1744, 552, 1746, 1747, 548, 1774, 570, - /* 2060 */ 530, 301, 1744, 552, 1746, 1747, 548, 1774, 570, 1426, - /* 2070 */ 303, 1744, 552, 1746, 1747, 548, 1774, 570, 117, 300, - /* 2080 */ 1744, 552, 1746, 1747, 548, 1743, 570, 1426, 1426, 1426, - /* 2090 */ 1426, 1426, 1426, 229, 1822, 525, 1426, 524, 1426, 526, - /* 2100 */ 1881, 1426, 1426, 1426, 1426, 1426, 1426, 1426, 1426, 1426, - /* 2110 */ 1426, 1426, 1426, 1761, 158, 1426, 1426, 1426, 1878, 1426, - /* 2120 */ 1426, 550, 1426, 1426, 1426, 1426, 1713, 119, 549, 1426, - /* 2130 */ 1426, 1426, 1426, 1426, 1426, 1426, 1426, 1426, 1426, 1426, - /* 2140 */ 1426, 1426, 1426, 1426, 1426, 1426, 1426, 1426, 1426, 530, - /* 2150 */ 1426, 1426, 1426, 1426, 1774, 1426, 1426, 281, 1744, 552, - /* 2160 */ 1746, 1747, 548, 1426, 570, 1426, 1426, 117, 1426, 1426, - /* 2170 */ 1426, 1426, 1426, 1426, 1426, 1426, 1426, 1426, 1426, 1426, - /* 2180 */ 1426, 1426, 229, 1822, 525, 1426, 524, 1426, 1426, 1881, - /* 2190 */ 1426, 1426, 1426, 1426, 1426, 1426, 1426, 1426, 1426, 1426, - /* 2200 */ 1426, 1426, 1426, 156, 1426, 1426, 1426, 1878, + /* 0 */ 567, 422, 1437, 423, 1474, 1742, 1673, 430, 317, 423, + /* 10 */ 1474, 111, 39, 37, 1504, 140, 1739, 1451, 460, 69, + /* 20 */ 326, 1440, 1236, 1742, 488, 151, 334, 526, 1573, 1564, + /* 30 */ 1261, 566, 115, 1311, 1739, 1234, 1847, 486, 1612, 484, + /* 40 */ 1739, 1568, 101, 1735, 1741, 100, 99, 98, 97, 96, + /* 50 */ 95, 94, 93, 92, 570, 119, 1306, 1625, 1755, 14, + /* 60 */ 1844, 1735, 1741, 343, 331, 1242, 373, 1735, 1741, 39, + /* 70 */ 37, 1372, 570, 1623, 566, 474, 473, 326, 570, 1236, + /* 80 */ 472, 1847, 1, 116, 469, 553, 1773, 468, 467, 466, + /* 90 */ 1311, 1625, 1234, 329, 529, 117, 1670, 567, 337, 1725, + /* 100 */ 1462, 549, 504, 1899, 649, 1843, 1899, 1623, 111, 528, + /* 110 */ 153, 1840, 1841, 1306, 1845, 465, 14, 156, 1313, 1314, + /* 120 */ 156, 1896, 1242, 1439, 1896, 1573, 1480, 1786, 1135, 1136, + /* 130 */ 88, 1756, 552, 1758, 1759, 548, 42, 570, 78, 2, + /* 140 */ 1832, 1725, 1899, 209, 319, 1828, 152, 110, 109, 108, + /* 150 */ 107, 106, 105, 104, 103, 102, 156, 439, 232, 1566, + /* 160 */ 1896, 649, 1501, 1237, 141, 1235, 505, 1860, 1530, 60, + /* 170 */ 520, 73, 474, 473, 644, 1313, 1314, 472, 1743, 338, + /* 180 */ 116, 469, 1618, 1620, 468, 467, 466, 1240, 1241, 1739, + /* 190 */ 1289, 1290, 1292, 1293, 1294, 1295, 1296, 545, 568, 1304, + /* 200 */ 1305, 1307, 1308, 1309, 1310, 1312, 1315, 33, 32, 245, + /* 210 */ 246, 40, 38, 36, 35, 34, 1735, 1741, 421, 159, + /* 220 */ 1237, 425, 1235, 626, 625, 624, 341, 570, 623, 622, + /* 230 */ 621, 121, 616, 615, 614, 613, 612, 611, 610, 609, + /* 240 */ 131, 605, 1262, 986, 1240, 1241, 61, 1289, 1290, 1292, + /* 250 */ 1293, 1294, 1295, 1296, 545, 568, 1304, 1305, 1307, 1308, + /* 260 */ 1309, 1310, 1312, 1315, 39, 37, 566, 1236, 60, 490, + /* 270 */ 304, 1396, 326, 159, 1236, 40, 38, 36, 35, 34, + /* 280 */ 1234, 1261, 1406, 990, 991, 1311, 84, 1234, 1093, 593, + /* 290 */ 592, 591, 1097, 590, 1099, 1100, 589, 1102, 586, 120, + /* 300 */ 1108, 583, 1110, 1111, 580, 577, 159, 1565, 1306, 1899, + /* 310 */ 1242, 14, 512, 1394, 1395, 1397, 1398, 1242, 602, 1551, + /* 320 */ 379, 39, 37, 156, 60, 1755, 604, 1896, 43, 326, + /* 330 */ 1003, 1236, 1002, 1260, 2, 330, 60, 129, 128, 599, + /* 340 */ 598, 597, 1311, 138, 1234, 458, 336, 1259, 372, 649, + /* 350 */ 371, 526, 1575, 1773, 138, 1899, 649, 296, 1549, 339, + /* 360 */ 1004, 550, 244, 1575, 1899, 1306, 1725, 138, 549, 1898, + /* 370 */ 1313, 1314, 231, 1896, 1242, 1899, 1575, 439, 157, 119, + /* 380 */ 33, 32, 1896, 530, 40, 38, 36, 35, 34, 1897, + /* 390 */ 1379, 8, 567, 1896, 1786, 1663, 1260, 87, 1756, 552, + /* 400 */ 1758, 1759, 548, 161, 570, 159, 168, 1832, 1237, 364, + /* 410 */ 1235, 298, 1828, 649, 1773, 1237, 604, 1235, 515, 117, + /* 420 */ 1573, 83, 519, 1899, 1218, 1219, 1242, 1313, 1314, 366, + /* 430 */ 362, 80, 1240, 1241, 154, 1840, 1841, 158, 1845, 1240, + /* 440 */ 1241, 1896, 1289, 1290, 1292, 1293, 1294, 1295, 1296, 545, + /* 450 */ 568, 1304, 1305, 1307, 1308, 1309, 1310, 1312, 1315, 101, + /* 460 */ 518, 159, 100, 99, 98, 97, 96, 95, 94, 93, + /* 470 */ 92, 427, 1237, 159, 1235, 33, 32, 1258, 26, 40, + /* 480 */ 38, 36, 35, 34, 33, 32, 412, 1321, 40, 38, + /* 490 */ 36, 35, 34, 1260, 521, 516, 1240, 1241, 596, 1289, + /* 500 */ 1290, 1292, 1293, 1294, 1295, 1296, 545, 568, 1304, 1305, + /* 510 */ 1307, 1308, 1309, 1310, 1312, 1315, 39, 37, 1316, 567, + /* 520 */ 202, 30, 240, 567, 326, 607, 1236, 1432, 159, 1461, + /* 530 */ 377, 1460, 170, 169, 378, 1745, 1003, 1311, 1002, 1234, + /* 540 */ 497, 1459, 28, 36, 35, 34, 7, 1573, 33, 32, + /* 550 */ 1386, 1573, 40, 38, 36, 35, 34, 33, 32, 1755, + /* 560 */ 1306, 40, 38, 36, 35, 34, 1004, 1291, 1458, 1242, + /* 570 */ 1725, 1747, 1725, 39, 37, 1755, 1619, 1620, 479, 71, + /* 580 */ 304, 326, 1725, 1236, 33, 32, 9, 1773, 40, 38, + /* 590 */ 36, 35, 34, 489, 1311, 550, 1234, 138, 69, 567, + /* 600 */ 1725, 567, 549, 1773, 11, 10, 1576, 201, 649, 1725, + /* 610 */ 382, 529, 397, 1431, 166, 1457, 1725, 1306, 549, 22, + /* 620 */ 1569, 482, 1313, 1314, 1550, 476, 1242, 1573, 1786, 1573, + /* 630 */ 200, 89, 1756, 552, 1758, 1759, 548, 429, 570, 67, + /* 640 */ 425, 1832, 66, 9, 1786, 1831, 1828, 88, 1756, 552, + /* 650 */ 1758, 1759, 548, 1055, 570, 55, 1725, 1832, 54, 526, + /* 660 */ 1562, 319, 1828, 152, 1291, 649, 1335, 1237, 1558, 1235, + /* 670 */ 33, 32, 1456, 1455, 40, 38, 36, 35, 34, 1313, + /* 680 */ 1314, 1548, 600, 1057, 1861, 1616, 1347, 119, 1454, 1340, + /* 690 */ 1453, 1240, 1241, 1450, 1289, 1290, 1292, 1293, 1294, 1295, + /* 700 */ 1296, 545, 568, 1304, 1305, 1307, 1308, 1309, 1310, 1312, + /* 710 */ 1315, 471, 470, 1725, 1725, 33, 32, 1371, 602, 40, + /* 720 */ 38, 36, 35, 34, 1237, 1367, 1235, 117, 27, 1725, + /* 730 */ 1449, 1725, 1448, 1447, 1725, 310, 1446, 129, 128, 599, + /* 740 */ 598, 597, 155, 1840, 1841, 1274, 1845, 1669, 1240, 1241, + /* 750 */ 305, 1289, 1290, 1292, 1293, 1294, 1295, 1296, 545, 568, + /* 760 */ 1304, 1305, 1307, 1308, 1309, 1310, 1312, 1315, 39, 37, + /* 770 */ 295, 1725, 1258, 1725, 1725, 602, 326, 1725, 1236, 405, + /* 780 */ 464, 1847, 417, 311, 1445, 309, 308, 1668, 462, 1311, + /* 790 */ 305, 1234, 464, 1263, 129, 128, 599, 598, 597, 390, + /* 800 */ 58, 418, 463, 392, 567, 1842, 620, 618, 553, 567, + /* 810 */ 1260, 567, 1306, 567, 463, 398, 567, 1444, 567, 1671, + /* 820 */ 438, 1242, 1570, 1713, 1702, 1725, 1443, 498, 1755, 502, + /* 830 */ 534, 567, 1573, 383, 1625, 990, 991, 1573, 2, 1573, + /* 840 */ 267, 1573, 564, 1603, 1573, 537, 1573, 33, 32, 1560, + /* 850 */ 1624, 40, 38, 36, 35, 34, 1773, 137, 1725, 1573, + /* 860 */ 649, 608, 601, 1545, 550, 1616, 1556, 1725, 1442, 1725, + /* 870 */ 352, 549, 1491, 416, 1313, 1314, 411, 410, 409, 408, + /* 880 */ 407, 404, 403, 402, 401, 400, 396, 395, 394, 393, + /* 890 */ 387, 386, 385, 384, 475, 381, 380, 1786, 299, 1245, + /* 900 */ 88, 1756, 552, 1758, 1759, 548, 567, 570, 208, 1725, + /* 910 */ 1832, 1852, 1367, 1486, 319, 1828, 1912, 565, 188, 1237, + /* 920 */ 205, 1235, 1274, 212, 544, 1867, 193, 619, 195, 191, + /* 930 */ 1333, 194, 144, 1370, 1573, 477, 72, 456, 452, 448, + /* 940 */ 444, 187, 197, 1240, 1241, 196, 1289, 1290, 1292, 1293, + /* 950 */ 1294, 1295, 1296, 545, 568, 1304, 1305, 1307, 1308, 1309, + /* 960 */ 1310, 1312, 1315, 139, 567, 567, 70, 367, 273, 185, + /* 970 */ 52, 501, 595, 50, 199, 256, 340, 198, 1484, 542, + /* 980 */ 216, 1291, 271, 57, 1334, 1452, 56, 1531, 11, 10, + /* 990 */ 513, 235, 1573, 1573, 1434, 1435, 41, 41, 457, 41, + /* 1000 */ 480, 242, 171, 123, 126, 127, 491, 1339, 223, 1244, + /* 1010 */ 1027, 33, 32, 1393, 1774, 40, 38, 36, 35, 34, + /* 1020 */ 218, 342, 1475, 50, 575, 535, 126, 60, 127, 1248, + /* 1030 */ 526, 184, 177, 532, 182, 1613, 1341, 1297, 435, 1186, + /* 1040 */ 1028, 247, 538, 559, 253, 1086, 29, 324, 1328, 1329, + /* 1050 */ 1330, 1331, 1332, 1336, 1337, 1338, 112, 175, 119, 126, + /* 1060 */ 527, 1863, 299, 266, 1114, 86, 1118, 234, 1125, 5, + /* 1070 */ 3, 237, 239, 344, 1258, 347, 351, 306, 1055, 307, + /* 1080 */ 530, 263, 1202, 399, 167, 1665, 406, 414, 413, 419, + /* 1090 */ 1264, 415, 420, 428, 1333, 1267, 1123, 431, 117, 130, + /* 1100 */ 64, 63, 376, 432, 1266, 165, 174, 1325, 1755, 176, + /* 1110 */ 433, 370, 1268, 229, 1840, 525, 434, 524, 179, 436, + /* 1120 */ 1899, 1265, 294, 181, 183, 360, 68, 358, 354, 350, + /* 1130 */ 162, 345, 437, 186, 158, 440, 1773, 459, 1896, 1247, + /* 1140 */ 1707, 461, 91, 1563, 550, 297, 190, 1559, 1334, 1725, + /* 1150 */ 192, 549, 132, 264, 133, 203, 1561, 492, 1557, 134, + /* 1160 */ 135, 1755, 206, 493, 159, 499, 530, 503, 210, 1263, + /* 1170 */ 514, 1339, 1874, 316, 1864, 556, 496, 1786, 1873, 6, + /* 1180 */ 87, 1756, 552, 1758, 1759, 548, 1854, 570, 509, 1773, + /* 1190 */ 1832, 214, 511, 523, 298, 1828, 217, 550, 510, 508, + /* 1200 */ 146, 318, 1725, 1755, 549, 517, 1899, 224, 222, 225, + /* 1210 */ 29, 324, 1328, 1329, 1330, 1331, 1332, 1336, 1337, 1338, + /* 1220 */ 156, 507, 227, 1367, 1896, 118, 1262, 44, 539, 536, + /* 1230 */ 1786, 1773, 1848, 88, 1756, 552, 1758, 1759, 548, 550, + /* 1240 */ 570, 226, 228, 1832, 1725, 18, 549, 319, 1828, 1912, + /* 1250 */ 333, 332, 320, 1813, 560, 561, 1915, 1895, 1890, 249, + /* 1260 */ 1250, 533, 233, 236, 124, 540, 554, 555, 238, 125, + /* 1270 */ 1706, 1311, 1786, 1243, 251, 88, 1756, 552, 1758, 1759, + /* 1280 */ 548, 1755, 570, 265, 1675, 1832, 562, 557, 328, 319, + /* 1290 */ 1828, 1912, 79, 77, 1306, 1617, 1574, 573, 1546, 268, + /* 1300 */ 1851, 645, 646, 1242, 259, 648, 145, 289, 1755, 1773, + /* 1310 */ 51, 291, 290, 270, 272, 1719, 1718, 550, 62, 1717, + /* 1320 */ 1714, 346, 1725, 348, 549, 349, 1229, 1230, 163, 353, + /* 1330 */ 1712, 355, 356, 357, 1711, 359, 1773, 1710, 361, 530, + /* 1340 */ 1709, 1708, 571, 363, 550, 365, 1692, 368, 164, 1725, + /* 1350 */ 1786, 549, 1205, 280, 1756, 552, 1758, 1759, 548, 369, + /* 1360 */ 570, 1204, 1686, 1685, 374, 375, 530, 1684, 1683, 1174, + /* 1370 */ 1658, 1657, 1656, 65, 1655, 1654, 1755, 1786, 1653, 1899, + /* 1380 */ 280, 1756, 552, 1758, 1759, 548, 1652, 570, 1651, 388, + /* 1390 */ 389, 1650, 391, 158, 1649, 1648, 1647, 1896, 1646, 1645, + /* 1400 */ 1644, 1251, 1643, 1246, 1773, 1176, 1899, 1642, 1641, 1640, + /* 1410 */ 1639, 1638, 550, 1637, 1636, 122, 1635, 1725, 1755, 549, + /* 1420 */ 156, 1634, 1633, 1632, 1896, 1254, 1631, 1630, 1629, 1628, + /* 1430 */ 1627, 1626, 1503, 1471, 172, 424, 568, 1304, 1305, 1307, + /* 1440 */ 1308, 1309, 1310, 1755, 150, 1786, 1773, 1021, 89, 1756, + /* 1450 */ 552, 1758, 1759, 548, 547, 570, 113, 993, 1832, 1725, + /* 1460 */ 992, 549, 541, 1828, 426, 1470, 1700, 1694, 1682, 1681, + /* 1470 */ 1667, 1773, 180, 1552, 173, 114, 178, 1502, 1500, 550, + /* 1480 */ 526, 443, 442, 441, 1725, 1498, 549, 1786, 445, 447, + /* 1490 */ 287, 1756, 552, 1758, 1759, 548, 546, 570, 543, 1804, + /* 1500 */ 1755, 446, 1496, 450, 1494, 454, 449, 1483, 119, 453, + /* 1510 */ 1482, 451, 1786, 189, 455, 142, 1756, 552, 1758, 1759, + /* 1520 */ 548, 1467, 570, 1554, 1129, 1128, 1553, 1054, 1773, 49, + /* 1530 */ 530, 1053, 1052, 1051, 617, 1048, 550, 619, 1492, 312, + /* 1540 */ 1047, 1725, 1487, 549, 1046, 1485, 313, 314, 117, 481, + /* 1550 */ 478, 1466, 1465, 483, 485, 1464, 487, 1755, 1699, 90, + /* 1560 */ 531, 1913, 53, 229, 1840, 525, 1212, 524, 1693, 1786, + /* 1570 */ 1899, 494, 89, 1756, 552, 1758, 1759, 548, 1755, 570, + /* 1580 */ 1680, 1678, 1832, 1679, 156, 1773, 207, 1829, 1896, 136, + /* 1590 */ 495, 315, 1677, 550, 1676, 1408, 500, 4, 1725, 41, + /* 1600 */ 549, 45, 15, 215, 23, 47, 1773, 220, 25, 213, + /* 1610 */ 46, 1392, 506, 1385, 550, 143, 16, 219, 24, 1725, + /* 1620 */ 221, 549, 1745, 74, 230, 147, 1786, 1364, 17, 288, + /* 1630 */ 1756, 552, 1758, 1759, 548, 1755, 570, 1420, 13, 1419, + /* 1640 */ 1363, 321, 1425, 1414, 1424, 1423, 322, 1786, 10, 1326, + /* 1650 */ 283, 1756, 552, 1758, 1759, 548, 19, 570, 1755, 1282, + /* 1660 */ 1299, 148, 160, 1773, 31, 551, 1674, 1298, 12, 20, + /* 1670 */ 21, 550, 241, 1390, 1666, 243, 1725, 248, 549, 75, + /* 1680 */ 558, 250, 76, 252, 1744, 255, 1773, 1789, 80, 522, + /* 1690 */ 1301, 1252, 572, 574, 550, 1115, 569, 335, 578, 1725, + /* 1700 */ 1755, 549, 48, 576, 1786, 1112, 579, 142, 1756, 552, + /* 1710 */ 1758, 1759, 548, 323, 570, 1109, 1755, 581, 582, 584, + /* 1720 */ 587, 1092, 594, 1103, 1101, 585, 588, 1786, 1773, 1107, + /* 1730 */ 288, 1756, 552, 1758, 1759, 548, 547, 570, 81, 1106, + /* 1740 */ 1105, 1725, 82, 549, 1773, 1124, 59, 257, 1120, 1019, + /* 1750 */ 603, 1104, 550, 1914, 1043, 606, 258, 1725, 1061, 549, + /* 1760 */ 1041, 1036, 1040, 1039, 1038, 1037, 1755, 1035, 1034, 1786, + /* 1770 */ 1058, 325, 287, 1756, 552, 1758, 1759, 548, 1056, 570, + /* 1780 */ 1031, 1805, 1030, 1029, 1026, 1786, 1025, 1024, 288, 1756, + /* 1790 */ 552, 1758, 1759, 548, 1773, 570, 652, 1499, 627, 629, + /* 1800 */ 628, 1497, 550, 631, 632, 633, 1495, 1725, 635, 549, + /* 1810 */ 262, 636, 1493, 637, 639, 641, 640, 1481, 643, 983, + /* 1820 */ 1463, 327, 261, 1755, 149, 647, 1438, 1238, 650, 642, + /* 1830 */ 638, 634, 630, 260, 1438, 1786, 269, 1438, 288, 1756, + /* 1840 */ 552, 1758, 1759, 548, 651, 570, 1438, 1438, 1438, 1438, + /* 1850 */ 1438, 1773, 1438, 1438, 1438, 1438, 1438, 1438, 85, 550, + /* 1860 */ 1438, 254, 1438, 1438, 1725, 1438, 549, 1438, 1438, 1438, + /* 1870 */ 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, + /* 1880 */ 1438, 1438, 1438, 1438, 1755, 1438, 1438, 1438, 1438, 1438, + /* 1890 */ 1438, 1438, 1786, 1438, 563, 274, 1756, 552, 1758, 1759, + /* 1900 */ 548, 1755, 570, 1438, 1438, 1438, 1438, 1438, 1438, 1438, + /* 1910 */ 1438, 1438, 1773, 1438, 1438, 1438, 1438, 1438, 1438, 1438, + /* 1920 */ 550, 1438, 1438, 1438, 1438, 1725, 211, 549, 1438, 1773, + /* 1930 */ 1438, 1438, 1438, 1438, 1438, 1438, 1438, 550, 1438, 1438, + /* 1940 */ 1438, 1438, 1725, 1755, 549, 1438, 1438, 1210, 1438, 204, + /* 1950 */ 1438, 1438, 1438, 1786, 1755, 1438, 275, 1756, 552, 1758, + /* 1960 */ 1759, 548, 1438, 570, 1438, 1755, 1438, 1438, 1438, 1438, + /* 1970 */ 1786, 1773, 1438, 276, 1756, 552, 1758, 1759, 548, 550, + /* 1980 */ 570, 1438, 1773, 1438, 1725, 1438, 549, 1438, 1438, 1438, + /* 1990 */ 550, 1438, 1438, 1773, 1438, 1725, 1438, 549, 1438, 1438, + /* 2000 */ 1438, 550, 1438, 1438, 1438, 1438, 1725, 1755, 549, 1438, + /* 2010 */ 1438, 1438, 1786, 1438, 1438, 282, 1756, 552, 1758, 1759, + /* 2020 */ 548, 1438, 570, 1786, 1438, 1755, 284, 1756, 552, 1758, + /* 2030 */ 1759, 548, 1438, 570, 1786, 1773, 1438, 277, 1756, 552, + /* 2040 */ 1758, 1759, 548, 550, 570, 1438, 1438, 1438, 1725, 1755, + /* 2050 */ 549, 1438, 1438, 1773, 1438, 1438, 1438, 1438, 1438, 1438, + /* 2060 */ 1438, 550, 1438, 1438, 1438, 1438, 1725, 1438, 549, 1438, + /* 2070 */ 1438, 1438, 1438, 1438, 1438, 1438, 1786, 1773, 1438, 285, + /* 2080 */ 1756, 552, 1758, 1759, 548, 550, 570, 1438, 1438, 1438, + /* 2090 */ 1725, 1438, 549, 1438, 1786, 1438, 1438, 278, 1756, 552, + /* 2100 */ 1758, 1759, 548, 1438, 570, 1755, 1438, 1438, 1438, 1438, + /* 2110 */ 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1786, 1438, + /* 2120 */ 1438, 286, 1756, 552, 1758, 1759, 548, 1438, 570, 1438, + /* 2130 */ 1438, 1438, 1438, 1773, 1438, 1438, 1438, 1438, 1438, 1438, + /* 2140 */ 1438, 550, 1438, 1438, 1438, 1438, 1725, 1438, 549, 1438, + /* 2150 */ 1438, 1438, 1438, 1438, 1438, 1755, 1438, 1438, 1438, 1438, + /* 2160 */ 1438, 1438, 1438, 1438, 1438, 1438, 1755, 1438, 1438, 1438, + /* 2170 */ 1438, 1438, 1438, 1438, 1786, 1438, 1438, 279, 1756, 552, + /* 2180 */ 1758, 1759, 548, 1773, 570, 1438, 1438, 1438, 1438, 1438, + /* 2190 */ 1438, 550, 1438, 1438, 1773, 1438, 1725, 1438, 549, 1438, + /* 2200 */ 1438, 1438, 550, 1438, 1438, 1438, 1438, 1725, 1755, 549, + /* 2210 */ 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1755, + /* 2220 */ 1438, 1438, 1438, 1438, 1786, 1438, 1438, 292, 1756, 552, + /* 2230 */ 1758, 1759, 548, 1755, 570, 1786, 1773, 1438, 293, 1756, + /* 2240 */ 552, 1758, 1759, 548, 550, 570, 1438, 1773, 1438, 1725, + /* 2250 */ 1438, 549, 1438, 1438, 1438, 550, 1438, 1438, 1438, 1438, + /* 2260 */ 1725, 1773, 549, 1438, 1438, 1438, 1438, 1438, 1438, 550, + /* 2270 */ 1438, 1438, 1438, 1438, 1725, 1438, 549, 1786, 1438, 1438, + /* 2280 */ 1767, 1756, 552, 1758, 1759, 548, 1438, 570, 1786, 1755, + /* 2290 */ 1438, 1766, 1756, 552, 1758, 1759, 548, 1438, 570, 1438, + /* 2300 */ 1438, 1438, 1786, 1755, 1438, 1765, 1756, 552, 1758, 1759, + /* 2310 */ 548, 1438, 570, 1438, 1438, 1438, 1438, 1773, 1438, 1438, + /* 2320 */ 1438, 1438, 1438, 1438, 1438, 550, 1438, 1438, 1438, 1438, + /* 2330 */ 1725, 1773, 549, 1438, 1438, 1438, 1438, 1438, 1438, 550, + /* 2340 */ 1438, 1438, 1438, 1438, 1725, 1438, 549, 1438, 1438, 1438, + /* 2350 */ 1438, 1438, 1438, 1755, 1438, 1438, 1438, 1438, 1786, 1438, + /* 2360 */ 1438, 302, 1756, 552, 1758, 1759, 548, 1438, 570, 1438, + /* 2370 */ 1438, 1438, 1786, 1438, 1438, 301, 1756, 552, 1758, 1759, + /* 2380 */ 548, 1773, 570, 1438, 1438, 1438, 1438, 1438, 1438, 550, + /* 2390 */ 1438, 1438, 1438, 1438, 1725, 1755, 549, 1438, 1438, 1438, + /* 2400 */ 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1755, + /* 2410 */ 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, + /* 2420 */ 1438, 1438, 1786, 1773, 1438, 303, 1756, 552, 1758, 1759, + /* 2430 */ 548, 550, 570, 1438, 1438, 1438, 1725, 1773, 549, 1438, + /* 2440 */ 1438, 1438, 1438, 1438, 1438, 550, 1438, 1438, 1438, 1438, + /* 2450 */ 1725, 1438, 549, 1438, 1438, 1438, 1438, 1438, 1438, 1438, + /* 2460 */ 1438, 1438, 1438, 1438, 1786, 1438, 1438, 300, 1756, 552, + /* 2470 */ 1758, 1759, 548, 1438, 570, 1438, 1438, 1438, 1786, 1438, + /* 2480 */ 1438, 281, 1756, 552, 1758, 1759, 548, 1438, 570, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 253, 0, 255, 256, 253, 279, 255, 256, 282, 347, - /* 10 */ 262, 246, 12, 13, 266, 307, 290, 261, 279, 278, - /* 20 */ 20, 0, 22, 361, 257, 279, 14, 365, 282, 290, - /* 30 */ 274, 248, 20, 250, 249, 35, 290, 288, 20, 283, - /* 40 */ 291, 292, 21, 317, 318, 24, 25, 26, 27, 28, - /* 50 */ 29, 30, 31, 32, 328, 347, 317, 318, 4, 59, - /* 60 */ 14, 294, 277, 317, 318, 65, 20, 328, 277, 361, - /* 70 */ 285, 20, 307, 365, 328, 290, 285, 292, 12, 13, - /* 80 */ 14, 14, 82, 307, 20, 22, 20, 20, 22, 8, - /* 90 */ 9, 58, 307, 12, 13, 14, 15, 16, 35, 249, - /* 100 */ 82, 35, 276, 318, 104, 20, 321, 322, 323, 324, - /* 110 */ 325, 326, 347, 328, 323, 289, 331, 261, 118, 119, - /* 120 */ 335, 336, 82, 347, 20, 59, 361, 277, 65, 347, - /* 130 */ 365, 65, 347, 257, 257, 285, 82, 361, 257, 283, - /* 140 */ 290, 365, 292, 361, 268, 268, 361, 365, 82, 21, - /* 150 */ 365, 275, 24, 25, 26, 27, 28, 29, 30, 31, - /* 160 */ 32, 285, 285, 163, 83, 165, 285, 104, 318, 58, - /* 170 */ 104, 321, 322, 323, 324, 325, 326, 327, 328, 329, - /* 180 */ 330, 145, 118, 119, 118, 119, 249, 187, 188, 43, + /* 0 */ 261, 257, 250, 259, 260, 283, 0, 257, 286, 259, + /* 10 */ 260, 272, 12, 13, 0, 252, 294, 254, 279, 265, + /* 20 */ 20, 0, 22, 283, 21, 280, 286, 261, 289, 283, + /* 30 */ 20, 20, 278, 33, 294, 35, 323, 34, 293, 36, + /* 40 */ 294, 287, 21, 321, 322, 24, 25, 26, 27, 28, + /* 50 */ 29, 30, 31, 32, 332, 289, 56, 281, 253, 59, + /* 60 */ 347, 321, 322, 311, 288, 65, 311, 321, 322, 12, + /* 70 */ 13, 14, 332, 297, 20, 61, 62, 20, 332, 22, + /* 80 */ 66, 323, 82, 69, 70, 296, 281, 73, 74, 75, + /* 90 */ 33, 281, 35, 304, 289, 329, 307, 261, 288, 294, + /* 100 */ 253, 296, 311, 351, 104, 347, 351, 297, 272, 343, + /* 110 */ 344, 345, 346, 56, 348, 279, 59, 365, 118, 119, + /* 120 */ 365, 369, 65, 0, 369, 289, 0, 322, 118, 119, + /* 130 */ 325, 326, 327, 328, 329, 330, 82, 332, 263, 82, + /* 140 */ 335, 294, 351, 56, 339, 340, 341, 24, 25, 26, + /* 150 */ 27, 28, 29, 30, 31, 32, 365, 58, 353, 284, + /* 160 */ 369, 104, 0, 163, 266, 165, 361, 362, 270, 82, + /* 170 */ 20, 84, 61, 62, 48, 118, 119, 66, 283, 292, + /* 180 */ 69, 70, 295, 296, 73, 74, 75, 187, 188, 294, /* 190 */ 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - /* 200 */ 200, 201, 202, 191, 168, 56, 325, 18, 319, 20, - /* 210 */ 12, 13, 14, 15, 16, 215, 27, 0, 65, 30, - /* 220 */ 339, 340, 341, 342, 257, 344, 163, 290, 165, 163, - /* 230 */ 81, 165, 343, 84, 187, 268, 47, 191, 49, 203, - /* 240 */ 51, 24, 25, 26, 27, 28, 29, 30, 31, 32, - /* 250 */ 187, 188, 285, 187, 188, 215, 190, 191, 192, 193, - /* 260 */ 194, 195, 196, 197, 198, 199, 200, 201, 202, 215, - /* 270 */ 81, 224, 225, 226, 227, 228, 8, 9, 12, 13, - /* 280 */ 12, 13, 14, 15, 16, 20, 20, 265, 22, 267, - /* 290 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - /* 300 */ 105, 35, 107, 108, 109, 110, 111, 112, 1, 2, - /* 310 */ 121, 43, 20, 124, 125, 126, 127, 128, 129, 130, - /* 320 */ 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, - /* 330 */ 141, 65, 143, 144, 12, 13, 249, 20, 37, 332, - /* 340 */ 333, 20, 20, 22, 22, 8, 9, 56, 82, 12, - /* 350 */ 13, 14, 15, 16, 61, 62, 35, 35, 279, 66, - /* 360 */ 4, 20, 69, 70, 277, 257, 73, 74, 75, 290, - /* 370 */ 104, 50, 285, 82, 82, 84, 268, 290, 93, 292, - /* 380 */ 234, 59, 311, 275, 118, 119, 85, 65, 87, 88, - /* 390 */ 83, 90, 76, 285, 307, 94, 317, 318, 148, 4, - /* 400 */ 44, 45, 347, 249, 82, 318, 250, 328, 321, 322, - /* 410 */ 323, 324, 325, 326, 19, 328, 361, 116, 331, 257, - /* 420 */ 365, 257, 335, 336, 259, 292, 104, 0, 33, 163, - /* 430 */ 268, 165, 268, 300, 347, 65, 303, 272, 122, 123, - /* 440 */ 118, 119, 47, 249, 290, 280, 51, 285, 361, 285, - /* 450 */ 307, 56, 365, 187, 188, 278, 190, 191, 192, 193, - /* 460 */ 194, 195, 196, 197, 198, 199, 200, 201, 202, 269, - /* 470 */ 220, 221, 12, 13, 14, 254, 81, 277, 257, 84, - /* 480 */ 20, 215, 22, 257, 290, 163, 286, 165, 61, 62, - /* 490 */ 347, 150, 155, 66, 268, 35, 69, 70, 257, 266, - /* 500 */ 73, 74, 75, 257, 361, 3, 215, 215, 365, 187, - /* 510 */ 188, 285, 190, 191, 192, 193, 194, 195, 196, 197, - /* 520 */ 198, 199, 200, 201, 202, 65, 285, 12, 13, 291, - /* 530 */ 292, 285, 257, 158, 20, 20, 249, 22, 44, 45, - /* 540 */ 8, 9, 82, 268, 12, 13, 14, 15, 16, 114, - /* 550 */ 35, 8, 9, 178, 179, 12, 13, 14, 15, 16, - /* 560 */ 285, 257, 254, 249, 104, 257, 325, 269, 20, 249, - /* 570 */ 22, 325, 268, 302, 237, 277, 305, 290, 118, 119, - /* 580 */ 65, 340, 341, 342, 286, 344, 340, 341, 342, 285, - /* 590 */ 344, 277, 94, 12, 13, 368, 257, 82, 50, 285, - /* 600 */ 249, 20, 249, 22, 290, 94, 292, 268, 173, 174, - /* 610 */ 290, 113, 114, 115, 116, 117, 35, 257, 304, 104, - /* 620 */ 263, 264, 0, 163, 285, 165, 83, 116, 268, 14, - /* 630 */ 15, 16, 318, 118, 119, 321, 322, 323, 324, 325, - /* 640 */ 326, 290, 328, 290, 22, 285, 65, 187, 188, 35, - /* 650 */ 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - /* 660 */ 200, 201, 202, 82, 150, 257, 257, 8, 9, 20, - /* 670 */ 257, 12, 13, 14, 15, 16, 268, 268, 163, 65, - /* 680 */ 165, 268, 8, 9, 285, 104, 12, 13, 14, 15, - /* 690 */ 16, 263, 264, 285, 285, 296, 213, 214, 285, 118, - /* 700 */ 119, 0, 187, 188, 278, 190, 191, 192, 193, 194, - /* 710 */ 195, 196, 197, 198, 199, 200, 201, 202, 59, 82, - /* 720 */ 257, 8, 9, 19, 269, 12, 13, 14, 15, 16, - /* 730 */ 278, 268, 277, 59, 232, 278, 277, 33, 257, 0, - /* 740 */ 21, 286, 83, 284, 163, 249, 165, 277, 285, 268, - /* 750 */ 91, 47, 293, 34, 284, 36, 52, 53, 54, 55, - /* 760 */ 56, 113, 249, 293, 0, 91, 285, 249, 187, 188, - /* 770 */ 249, 190, 191, 192, 193, 194, 195, 196, 197, 198, - /* 780 */ 199, 200, 201, 202, 277, 81, 290, 18, 84, 292, - /* 790 */ 277, 249, 23, 286, 4, 94, 83, 58, 285, 162, - /* 800 */ 303, 164, 257, 290, 145, 292, 37, 38, 290, 319, - /* 810 */ 41, 290, 278, 268, 113, 114, 115, 116, 117, 145, - /* 820 */ 249, 117, 58, 175, 176, 302, 57, 168, 305, 277, - /* 830 */ 285, 318, 290, 343, 321, 322, 323, 324, 325, 326, - /* 840 */ 191, 328, 168, 0, 331, 293, 249, 249, 335, 336, - /* 850 */ 337, 82, 215, 149, 259, 0, 39, 278, 249, 346, - /* 860 */ 249, 290, 203, 204, 205, 206, 207, 208, 209, 210, - /* 870 */ 211, 212, 113, 114, 170, 280, 172, 203, 204, 205, - /* 880 */ 206, 207, 208, 209, 210, 211, 212, 290, 290, 120, - /* 890 */ 8, 9, 359, 249, 12, 13, 14, 15, 16, 290, - /* 900 */ 249, 290, 47, 249, 61, 62, 63, 64, 319, 66, - /* 910 */ 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - /* 920 */ 77, 78, 79, 43, 155, 156, 157, 249, 277, 160, - /* 930 */ 56, 59, 343, 174, 290, 166, 285, 12, 13, 287, - /* 940 */ 43, 290, 290, 292, 290, 287, 177, 22, 290, 180, - /* 950 */ 35, 182, 183, 184, 185, 186, 270, 258, 84, 273, - /* 960 */ 35, 249, 86, 83, 86, 89, 354, 89, 290, 318, - /* 970 */ 0, 0, 321, 322, 323, 324, 325, 326, 86, 328, - /* 980 */ 86, 89, 331, 89, 215, 0, 335, 336, 337, 277, - /* 990 */ 65, 150, 151, 22, 1, 2, 35, 285, 314, 43, - /* 1000 */ 349, 277, 290, 82, 292, 2, 216, 22, 357, 358, - /* 1010 */ 46, 8, 9, 92, 2, 12, 13, 14, 15, 16, - /* 1020 */ 8, 9, 249, 258, 12, 13, 14, 15, 16, 104, - /* 1030 */ 318, 214, 150, 321, 322, 323, 324, 325, 326, 83, - /* 1040 */ 328, 118, 119, 331, 256, 289, 82, 335, 336, 337, - /* 1050 */ 277, 320, 43, 43, 345, 362, 362, 362, 285, 187, - /* 1060 */ 43, 217, 43, 290, 94, 292, 43, 316, 348, 20, - /* 1070 */ 358, 43, 257, 47, 43, 43, 43, 249, 315, 35, - /* 1080 */ 165, 43, 43, 113, 114, 115, 116, 117, 163, 0, - /* 1090 */ 165, 318, 83, 83, 321, 322, 323, 324, 325, 326, - /* 1100 */ 83, 328, 83, 43, 331, 277, 83, 43, 335, 336, - /* 1110 */ 337, 83, 187, 285, 83, 83, 83, 263, 290, 346, - /* 1120 */ 292, 83, 83, 198, 199, 200, 165, 161, 43, 309, - /* 1130 */ 249, 35, 257, 236, 257, 42, 297, 48, 20, 249, - /* 1140 */ 145, 295, 295, 83, 257, 20, 318, 83, 313, 321, - /* 1150 */ 322, 323, 324, 325, 326, 251, 328, 249, 277, 331, - /* 1160 */ 251, 65, 261, 335, 336, 337, 285, 277, 83, 20, - /* 1170 */ 306, 290, 261, 292, 346, 285, 292, 20, 308, 261, - /* 1180 */ 290, 261, 292, 20, 298, 277, 251, 261, 307, 306, - /* 1190 */ 261, 257, 261, 285, 277, 257, 277, 307, 290, 318, - /* 1200 */ 292, 277, 321, 322, 323, 324, 325, 326, 318, 328, - /* 1210 */ 277, 321, 322, 323, 324, 325, 326, 277, 328, 277, - /* 1220 */ 277, 277, 249, 277, 277, 277, 318, 251, 347, 321, - /* 1230 */ 322, 323, 324, 325, 326, 290, 328, 347, 249, 331, - /* 1240 */ 313, 259, 361, 335, 336, 171, 365, 249, 312, 292, - /* 1250 */ 277, 361, 20, 259, 257, 365, 257, 306, 285, 259, - /* 1260 */ 223, 320, 290, 290, 222, 292, 277, 353, 301, 290, - /* 1270 */ 301, 290, 229, 290, 285, 277, 154, 231, 356, 290, - /* 1280 */ 352, 292, 230, 285, 218, 353, 214, 285, 290, 350, - /* 1290 */ 292, 318, 355, 316, 321, 322, 323, 324, 325, 326, - /* 1300 */ 249, 328, 353, 351, 331, 20, 319, 318, 335, 336, - /* 1310 */ 321, 322, 323, 324, 325, 326, 318, 328, 42, 321, - /* 1320 */ 322, 323, 324, 325, 326, 235, 328, 364, 277, 331, - /* 1330 */ 33, 233, 238, 82, 336, 301, 285, 363, 363, 338, - /* 1340 */ 334, 290, 301, 292, 47, 290, 290, 369, 364, 52, - /* 1350 */ 53, 54, 55, 56, 249, 366, 367, 290, 290, 290, - /* 1360 */ 364, 290, 147, 249, 299, 285, 259, 363, 298, 318, - /* 1370 */ 273, 259, 321, 322, 323, 324, 325, 326, 81, 328, - /* 1380 */ 285, 84, 277, 82, 281, 257, 267, 36, 259, 290, - /* 1390 */ 285, 277, 252, 251, 310, 290, 305, 292, 271, 285, - /* 1400 */ 247, 271, 271, 260, 290, 0, 292, 0, 42, 0, - /* 1410 */ 73, 360, 35, 249, 0, 181, 35, 35, 304, 35, - /* 1420 */ 181, 0, 35, 318, 249, 35, 321, 322, 323, 324, - /* 1430 */ 325, 326, 318, 328, 181, 321, 322, 323, 324, 325, - /* 1440 */ 326, 277, 328, 146, 147, 0, 149, 181, 0, 285, - /* 1450 */ 153, 35, 277, 0, 290, 22, 292, 0, 35, 0, - /* 1460 */ 285, 82, 168, 167, 165, 290, 163, 292, 0, 172, - /* 1470 */ 0, 159, 367, 158, 0, 0, 249, 46, 0, 304, - /* 1480 */ 0, 0, 318, 142, 0, 321, 322, 323, 324, 325, - /* 1490 */ 326, 0, 328, 318, 330, 0, 321, 322, 323, 324, - /* 1500 */ 325, 326, 0, 328, 277, 0, 137, 35, 0, 137, - /* 1510 */ 0, 0, 285, 0, 0, 0, 0, 290, 0, 292, - /* 1520 */ 0, 0, 0, 0, 0, 0, 0, 42, 0, 249, - /* 1530 */ 0, 304, 0, 0, 0, 0, 0, 0, 249, 22, - /* 1540 */ 0, 0, 0, 0, 43, 318, 42, 249, 321, 322, - /* 1550 */ 323, 324, 325, 326, 0, 328, 0, 277, 39, 14, - /* 1560 */ 14, 0, 0, 0, 154, 285, 277, 0, 0, 40, - /* 1570 */ 290, 0, 292, 46, 285, 277, 0, 46, 39, 290, - /* 1580 */ 0, 292, 0, 285, 0, 35, 39, 39, 290, 0, - /* 1590 */ 292, 47, 35, 0, 39, 35, 0, 0, 318, 249, - /* 1600 */ 47, 321, 322, 323, 324, 325, 326, 318, 328, 39, - /* 1610 */ 321, 322, 323, 324, 325, 326, 318, 328, 35, 321, - /* 1620 */ 322, 323, 324, 325, 326, 60, 328, 277, 47, 91, - /* 1630 */ 39, 22, 47, 35, 0, 285, 35, 35, 35, 35, - /* 1640 */ 290, 249, 292, 43, 0, 35, 35, 35, 89, 43, - /* 1650 */ 22, 0, 22, 0, 49, 22, 35, 0, 35, 0, - /* 1660 */ 35, 249, 0, 22, 0, 20, 35, 0, 318, 277, - /* 1670 */ 22, 321, 322, 323, 324, 325, 326, 285, 328, 0, - /* 1680 */ 0, 169, 290, 249, 292, 0, 0, 0, 219, 277, - /* 1690 */ 43, 35, 43, 43, 2, 82, 82, 285, 83, 147, - /* 1700 */ 82, 150, 290, 83, 292, 83, 82, 46, 82, 43, - /* 1710 */ 318, 277, 83, 321, 322, 323, 324, 325, 326, 285, - /* 1720 */ 328, 152, 150, 150, 290, 82, 292, 46, 219, 83, - /* 1730 */ 318, 43, 43, 321, 322, 323, 324, 325, 326, 249, - /* 1740 */ 328, 83, 46, 46, 43, 35, 83, 35, 249, 35, - /* 1750 */ 35, 83, 318, 35, 43, 321, 322, 323, 324, 325, - /* 1760 */ 326, 187, 328, 46, 22, 83, 82, 277, 46, 0, - /* 1770 */ 0, 39, 46, 83, 83, 285, 277, 213, 83, 189, - /* 1780 */ 290, 82, 292, 148, 285, 219, 82, 82, 82, 290, - /* 1790 */ 82, 292, 92, 46, 22, 82, 93, 35, 249, 83, - /* 1800 */ 146, 82, 82, 82, 106, 82, 35, 249, 318, 35, - /* 1810 */ 83, 321, 322, 323, 324, 325, 326, 318, 328, 82, - /* 1820 */ 321, 322, 323, 324, 325, 326, 277, 328, 83, 83, - /* 1830 */ 82, 35, 82, 35, 285, 277, 35, 83, 82, 290, - /* 1840 */ 83, 292, 82, 285, 106, 106, 22, 106, 290, 94, - /* 1850 */ 292, 35, 43, 22, 60, 82, 59, 249, 82, 82, - /* 1860 */ 35, 80, 43, 35, 65, 35, 249, 318, 35, 35, - /* 1870 */ 321, 322, 323, 324, 325, 326, 318, 328, 35, 321, - /* 1880 */ 322, 323, 324, 325, 326, 277, 328, 22, 35, 35, - /* 1890 */ 35, 65, 35, 285, 277, 35, 35, 35, 290, 35, - /* 1900 */ 292, 35, 285, 0, 35, 47, 39, 290, 0, 292, - /* 1910 */ 35, 39, 0, 35, 0, 47, 39, 47, 249, 35, - /* 1920 */ 47, 39, 0, 35, 35, 0, 318, 249, 22, 321, - /* 1930 */ 322, 323, 324, 325, 326, 318, 328, 21, 321, 322, - /* 1940 */ 323, 324, 325, 326, 21, 328, 277, 370, 22, 22, - /* 1950 */ 20, 370, 370, 370, 285, 277, 370, 370, 370, 290, - /* 1960 */ 370, 292, 370, 285, 370, 370, 370, 370, 290, 370, - /* 1970 */ 292, 370, 370, 370, 370, 370, 370, 370, 370, 370, - /* 1980 */ 249, 370, 370, 370, 370, 370, 370, 318, 370, 249, - /* 1990 */ 321, 322, 323, 324, 325, 326, 318, 328, 249, 321, - /* 2000 */ 322, 323, 324, 325, 326, 370, 328, 249, 277, 370, - /* 2010 */ 257, 370, 370, 370, 370, 370, 285, 277, 370, 370, - /* 2020 */ 370, 290, 370, 292, 370, 285, 277, 370, 370, 370, - /* 2030 */ 290, 370, 292, 370, 285, 277, 370, 370, 285, 290, - /* 2040 */ 370, 292, 370, 285, 370, 370, 370, 370, 290, 318, - /* 2050 */ 292, 370, 321, 322, 323, 324, 325, 326, 318, 328, - /* 2060 */ 307, 321, 322, 323, 324, 325, 326, 318, 328, 370, - /* 2070 */ 321, 322, 323, 324, 325, 326, 318, 328, 325, 321, - /* 2080 */ 322, 323, 324, 325, 326, 249, 328, 370, 370, 370, - /* 2090 */ 370, 370, 370, 340, 341, 342, 370, 344, 370, 257, - /* 2100 */ 347, 370, 370, 370, 370, 370, 370, 370, 370, 370, - /* 2110 */ 370, 370, 370, 277, 361, 370, 370, 370, 365, 370, - /* 2120 */ 370, 285, 370, 370, 370, 370, 290, 285, 292, 370, - /* 2130 */ 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, - /* 2140 */ 370, 370, 370, 370, 370, 370, 370, 370, 370, 307, - /* 2150 */ 370, 370, 370, 370, 318, 370, 370, 321, 322, 323, - /* 2160 */ 324, 325, 326, 370, 328, 370, 370, 325, 370, 370, - /* 2170 */ 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, - /* 2180 */ 370, 370, 340, 341, 342, 370, 344, 370, 370, 347, - /* 2190 */ 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, - /* 2200 */ 370, 370, 370, 361, 370, 370, 370, 365, + /* 200 */ 200, 201, 202, 203, 204, 205, 206, 8, 9, 113, + /* 210 */ 114, 12, 13, 14, 15, 16, 321, 322, 258, 219, + /* 220 */ 163, 261, 165, 61, 62, 63, 64, 332, 66, 67, + /* 230 */ 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + /* 240 */ 78, 79, 20, 4, 187, 188, 4, 190, 191, 192, + /* 250 */ 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, + /* 260 */ 203, 204, 205, 206, 12, 13, 20, 22, 82, 311, + /* 270 */ 174, 187, 20, 219, 22, 12, 13, 14, 15, 16, + /* 280 */ 35, 20, 83, 44, 45, 33, 263, 35, 95, 96, + /* 290 */ 97, 98, 99, 100, 101, 102, 103, 104, 105, 276, + /* 300 */ 107, 108, 109, 110, 111, 112, 219, 284, 56, 351, + /* 310 */ 65, 59, 228, 229, 230, 231, 232, 65, 94, 0, + /* 320 */ 261, 12, 13, 365, 82, 253, 58, 369, 82, 20, + /* 330 */ 20, 22, 22, 20, 82, 273, 82, 113, 114, 115, + /* 340 */ 116, 117, 33, 281, 35, 35, 273, 20, 162, 104, + /* 350 */ 164, 261, 290, 281, 281, 351, 104, 298, 0, 273, + /* 360 */ 50, 289, 113, 290, 351, 56, 294, 281, 296, 365, + /* 370 */ 118, 119, 150, 369, 65, 351, 290, 58, 365, 289, + /* 380 */ 8, 9, 369, 311, 12, 13, 14, 15, 16, 365, + /* 390 */ 14, 82, 261, 369, 322, 289, 20, 325, 326, 327, + /* 400 */ 328, 329, 330, 272, 332, 219, 300, 335, 163, 158, + /* 410 */ 165, 339, 340, 104, 281, 163, 58, 165, 148, 329, + /* 420 */ 289, 82, 289, 351, 175, 176, 65, 118, 119, 178, + /* 430 */ 179, 92, 187, 188, 344, 345, 346, 365, 348, 187, + /* 440 */ 188, 369, 190, 191, 192, 193, 194, 195, 196, 197, + /* 450 */ 198, 199, 200, 201, 202, 203, 204, 205, 206, 21, + /* 460 */ 327, 219, 24, 25, 26, 27, 28, 29, 30, 31, + /* 470 */ 32, 14, 163, 219, 165, 8, 9, 20, 2, 12, + /* 480 */ 13, 14, 15, 16, 8, 9, 76, 14, 12, 13, + /* 490 */ 14, 15, 16, 20, 224, 225, 187, 188, 93, 190, + /* 500 */ 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, + /* 510 */ 201, 202, 203, 204, 205, 206, 12, 13, 14, 261, + /* 520 */ 114, 336, 337, 261, 20, 65, 22, 155, 219, 253, + /* 530 */ 272, 253, 122, 123, 272, 46, 20, 33, 22, 35, + /* 540 */ 315, 253, 2, 14, 15, 16, 39, 289, 8, 9, + /* 550 */ 83, 289, 12, 13, 14, 15, 16, 8, 9, 253, + /* 560 */ 56, 12, 13, 14, 15, 16, 50, 191, 253, 65, + /* 570 */ 294, 82, 294, 12, 13, 253, 295, 296, 4, 173, + /* 580 */ 174, 20, 294, 22, 8, 9, 82, 281, 12, 13, + /* 590 */ 14, 15, 16, 19, 33, 289, 35, 281, 265, 261, + /* 600 */ 294, 261, 296, 281, 1, 2, 290, 33, 104, 294, + /* 610 */ 272, 289, 272, 241, 56, 253, 294, 56, 296, 43, + /* 620 */ 287, 47, 118, 119, 0, 51, 65, 289, 322, 289, + /* 630 */ 56, 325, 326, 327, 328, 329, 330, 258, 332, 81, + /* 640 */ 261, 335, 84, 82, 322, 339, 340, 325, 326, 327, + /* 650 */ 328, 329, 330, 35, 332, 81, 294, 335, 84, 261, + /* 660 */ 282, 339, 340, 341, 191, 104, 145, 163, 282, 165, + /* 670 */ 8, 9, 253, 253, 12, 13, 14, 15, 16, 118, + /* 680 */ 119, 0, 291, 65, 362, 294, 83, 289, 253, 168, + /* 690 */ 253, 187, 188, 253, 190, 191, 192, 193, 194, 195, + /* 700 */ 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, + /* 710 */ 206, 267, 268, 294, 294, 8, 9, 4, 94, 12, + /* 720 */ 13, 14, 15, 16, 163, 218, 165, 329, 207, 294, + /* 730 */ 253, 294, 253, 253, 294, 37, 253, 113, 114, 115, + /* 740 */ 116, 117, 344, 345, 346, 83, 348, 306, 187, 188, + /* 750 */ 309, 190, 191, 192, 193, 194, 195, 196, 197, 198, + /* 760 */ 199, 200, 201, 202, 203, 204, 205, 206, 12, 13, + /* 770 */ 18, 294, 20, 294, 294, 94, 20, 294, 22, 27, + /* 780 */ 94, 323, 30, 85, 253, 87, 88, 306, 90, 33, + /* 790 */ 309, 35, 94, 20, 113, 114, 115, 116, 117, 47, + /* 800 */ 3, 49, 116, 51, 261, 347, 267, 268, 296, 261, + /* 810 */ 20, 261, 56, 261, 116, 272, 261, 253, 261, 307, + /* 820 */ 272, 65, 272, 0, 272, 294, 253, 272, 253, 272, + /* 830 */ 43, 261, 289, 81, 281, 44, 45, 289, 82, 289, + /* 840 */ 274, 289, 272, 277, 289, 43, 289, 8, 9, 282, + /* 850 */ 297, 12, 13, 14, 15, 16, 281, 150, 294, 289, + /* 860 */ 104, 269, 291, 271, 289, 294, 282, 294, 253, 294, + /* 870 */ 47, 296, 0, 121, 118, 119, 124, 125, 126, 127, + /* 880 */ 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + /* 890 */ 138, 139, 140, 141, 22, 143, 144, 322, 59, 35, + /* 900 */ 325, 326, 327, 328, 329, 330, 261, 332, 56, 294, + /* 910 */ 335, 217, 218, 0, 339, 340, 341, 272, 33, 163, + /* 920 */ 282, 165, 83, 150, 282, 350, 86, 43, 86, 89, + /* 930 */ 91, 89, 47, 220, 289, 22, 84, 52, 53, 54, + /* 940 */ 55, 56, 86, 187, 188, 89, 190, 191, 192, 193, + /* 950 */ 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, + /* 960 */ 204, 205, 206, 18, 261, 261, 81, 83, 23, 84, + /* 970 */ 150, 151, 282, 43, 86, 272, 272, 89, 0, 59, + /* 980 */ 43, 191, 37, 38, 145, 254, 41, 270, 1, 2, + /* 990 */ 363, 372, 289, 289, 118, 119, 43, 43, 262, 43, + /* 1000 */ 22, 43, 57, 43, 43, 43, 318, 168, 358, 35, + /* 1010 */ 35, 8, 9, 83, 281, 12, 13, 14, 15, 16, + /* 1020 */ 83, 262, 260, 43, 43, 238, 43, 82, 43, 165, + /* 1030 */ 261, 146, 147, 236, 149, 293, 83, 83, 153, 83, + /* 1040 */ 65, 83, 240, 83, 83, 83, 207, 208, 209, 210, + /* 1050 */ 211, 212, 213, 214, 215, 216, 43, 172, 289, 43, + /* 1060 */ 349, 324, 59, 83, 83, 120, 83, 366, 83, 221, + /* 1070 */ 352, 366, 366, 320, 20, 261, 47, 319, 35, 267, + /* 1080 */ 311, 313, 161, 261, 42, 261, 301, 145, 299, 261, + /* 1090 */ 20, 299, 255, 255, 91, 20, 83, 317, 329, 83, + /* 1100 */ 155, 156, 157, 296, 20, 160, 265, 187, 253, 265, + /* 1110 */ 310, 166, 20, 344, 345, 346, 312, 348, 265, 310, + /* 1120 */ 351, 20, 177, 265, 265, 180, 265, 182, 183, 184, + /* 1130 */ 185, 186, 302, 265, 365, 261, 281, 255, 369, 165, + /* 1140 */ 294, 281, 261, 281, 289, 255, 281, 281, 145, 294, + /* 1150 */ 281, 296, 281, 317, 281, 263, 281, 171, 281, 281, + /* 1160 */ 281, 253, 263, 316, 219, 261, 311, 261, 263, 20, + /* 1170 */ 227, 168, 357, 310, 324, 226, 296, 322, 357, 233, + /* 1180 */ 325, 326, 327, 328, 329, 330, 360, 332, 294, 281, + /* 1190 */ 335, 305, 294, 154, 339, 340, 305, 289, 235, 234, + /* 1200 */ 357, 294, 294, 253, 296, 294, 351, 356, 359, 355, + /* 1210 */ 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + /* 1220 */ 365, 222, 320, 218, 369, 289, 20, 42, 239, 237, + /* 1230 */ 322, 281, 323, 325, 326, 327, 328, 329, 330, 289, + /* 1240 */ 332, 354, 342, 335, 294, 82, 296, 339, 340, 341, + /* 1250 */ 12, 13, 242, 338, 147, 303, 373, 368, 350, 289, + /* 1260 */ 22, 368, 367, 367, 305, 368, 294, 294, 367, 305, + /* 1270 */ 294, 33, 322, 35, 263, 325, 326, 327, 328, 329, + /* 1280 */ 330, 253, 332, 277, 294, 335, 302, 294, 294, 339, + /* 1290 */ 340, 341, 82, 263, 56, 294, 289, 285, 271, 261, + /* 1300 */ 350, 36, 256, 65, 263, 255, 309, 275, 253, 281, + /* 1310 */ 314, 275, 275, 264, 251, 0, 0, 289, 42, 0, + /* 1320 */ 0, 73, 294, 35, 296, 181, 35, 35, 35, 181, + /* 1330 */ 0, 35, 35, 181, 0, 181, 281, 0, 35, 311, + /* 1340 */ 0, 0, 104, 22, 289, 35, 0, 168, 82, 294, + /* 1350 */ 322, 296, 165, 325, 326, 327, 328, 329, 330, 167, + /* 1360 */ 332, 163, 0, 0, 159, 158, 311, 0, 0, 46, + /* 1370 */ 0, 0, 0, 142, 0, 0, 253, 322, 0, 351, + /* 1380 */ 325, 326, 327, 328, 329, 330, 0, 332, 0, 137, + /* 1390 */ 35, 0, 137, 365, 0, 0, 0, 369, 0, 0, + /* 1400 */ 0, 163, 0, 165, 281, 22, 351, 0, 0, 0, + /* 1410 */ 0, 0, 289, 0, 0, 42, 0, 294, 253, 296, + /* 1420 */ 365, 0, 0, 0, 369, 187, 0, 0, 0, 0, + /* 1430 */ 0, 0, 0, 0, 42, 46, 198, 199, 200, 201, + /* 1440 */ 202, 203, 204, 253, 43, 322, 281, 60, 325, 326, + /* 1450 */ 327, 328, 329, 330, 289, 332, 39, 14, 335, 294, + /* 1460 */ 14, 296, 339, 340, 46, 0, 0, 0, 0, 0, + /* 1470 */ 0, 281, 154, 0, 40, 39, 39, 0, 0, 289, + /* 1480 */ 261, 39, 47, 35, 294, 0, 296, 322, 35, 39, + /* 1490 */ 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + /* 1500 */ 253, 47, 0, 47, 0, 47, 35, 0, 289, 35, + /* 1510 */ 0, 39, 322, 89, 39, 325, 326, 327, 328, 329, + /* 1520 */ 330, 0, 332, 0, 35, 22, 0, 35, 281, 91, + /* 1530 */ 311, 35, 35, 35, 43, 35, 289, 43, 0, 22, + /* 1540 */ 35, 294, 0, 296, 35, 0, 22, 22, 329, 35, + /* 1550 */ 49, 0, 0, 35, 35, 0, 22, 253, 0, 20, + /* 1560 */ 370, 371, 150, 344, 345, 346, 35, 348, 0, 322, + /* 1570 */ 351, 22, 325, 326, 327, 328, 329, 330, 253, 332, + /* 1580 */ 0, 0, 335, 0, 365, 281, 147, 340, 369, 169, + /* 1590 */ 150, 150, 0, 289, 0, 83, 152, 43, 294, 43, + /* 1600 */ 296, 217, 223, 83, 82, 43, 281, 43, 43, 82, + /* 1610 */ 43, 83, 308, 83, 289, 82, 223, 82, 82, 294, + /* 1620 */ 46, 296, 46, 82, 46, 46, 322, 83, 43, 325, + /* 1630 */ 326, 327, 328, 329, 330, 253, 332, 35, 223, 35, + /* 1640 */ 83, 35, 83, 83, 35, 35, 35, 322, 2, 187, + /* 1650 */ 325, 326, 327, 328, 329, 330, 43, 332, 253, 22, + /* 1660 */ 83, 46, 46, 281, 82, 189, 0, 83, 82, 82, + /* 1670 */ 82, 289, 83, 83, 0, 82, 294, 82, 296, 82, + /* 1680 */ 148, 39, 82, 146, 46, 46, 281, 82, 92, 364, + /* 1690 */ 83, 22, 93, 35, 289, 83, 82, 35, 35, 294, + /* 1700 */ 253, 296, 82, 82, 322, 83, 82, 325, 326, 327, + /* 1710 */ 328, 329, 330, 308, 332, 83, 253, 35, 82, 35, + /* 1720 */ 35, 22, 94, 83, 83, 82, 82, 322, 281, 106, + /* 1730 */ 325, 326, 327, 328, 329, 330, 289, 332, 82, 106, + /* 1740 */ 106, 294, 82, 296, 281, 35, 82, 43, 22, 60, + /* 1750 */ 59, 106, 289, 371, 35, 80, 43, 294, 65, 296, + /* 1760 */ 35, 22, 35, 35, 35, 35, 253, 35, 35, 322, + /* 1770 */ 65, 308, 325, 326, 327, 328, 329, 330, 35, 332, + /* 1780 */ 35, 334, 35, 35, 35, 322, 35, 35, 325, 326, + /* 1790 */ 327, 328, 329, 330, 281, 332, 19, 0, 35, 39, + /* 1800 */ 47, 0, 289, 35, 47, 39, 0, 294, 35, 296, + /* 1810 */ 33, 47, 0, 39, 35, 39, 47, 0, 35, 35, + /* 1820 */ 0, 308, 22, 253, 47, 21, 374, 22, 21, 52, + /* 1830 */ 53, 54, 55, 56, 374, 322, 22, 374, 325, 326, + /* 1840 */ 327, 328, 329, 330, 20, 332, 374, 374, 374, 374, + /* 1850 */ 374, 281, 374, 374, 374, 374, 374, 374, 81, 289, + /* 1860 */ 374, 84, 374, 374, 294, 374, 296, 374, 374, 374, + /* 1870 */ 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, + /* 1880 */ 374, 374, 374, 374, 253, 374, 374, 374, 374, 374, + /* 1890 */ 374, 374, 322, 374, 117, 325, 326, 327, 328, 329, + /* 1900 */ 330, 253, 332, 374, 374, 374, 374, 374, 374, 374, + /* 1910 */ 374, 374, 281, 374, 374, 374, 374, 374, 374, 374, + /* 1920 */ 289, 374, 374, 374, 374, 294, 149, 296, 374, 281, + /* 1930 */ 374, 374, 374, 374, 374, 374, 374, 289, 374, 374, + /* 1940 */ 374, 374, 294, 253, 296, 374, 374, 170, 374, 172, + /* 1950 */ 374, 374, 374, 322, 253, 374, 325, 326, 327, 328, + /* 1960 */ 329, 330, 374, 332, 374, 253, 374, 374, 374, 374, + /* 1970 */ 322, 281, 374, 325, 326, 327, 328, 329, 330, 289, + /* 1980 */ 332, 374, 281, 374, 294, 374, 296, 374, 374, 374, + /* 1990 */ 289, 374, 374, 281, 374, 294, 374, 296, 374, 374, + /* 2000 */ 374, 289, 374, 374, 374, 374, 294, 253, 296, 374, + /* 2010 */ 374, 374, 322, 374, 374, 325, 326, 327, 328, 329, + /* 2020 */ 330, 374, 332, 322, 374, 253, 325, 326, 327, 328, + /* 2030 */ 329, 330, 374, 332, 322, 281, 374, 325, 326, 327, + /* 2040 */ 328, 329, 330, 289, 332, 374, 374, 374, 294, 253, + /* 2050 */ 296, 374, 374, 281, 374, 374, 374, 374, 374, 374, + /* 2060 */ 374, 289, 374, 374, 374, 374, 294, 374, 296, 374, + /* 2070 */ 374, 374, 374, 374, 374, 374, 322, 281, 374, 325, + /* 2080 */ 326, 327, 328, 329, 330, 289, 332, 374, 374, 374, + /* 2090 */ 294, 374, 296, 374, 322, 374, 374, 325, 326, 327, + /* 2100 */ 328, 329, 330, 374, 332, 253, 374, 374, 374, 374, + /* 2110 */ 374, 374, 374, 374, 374, 374, 374, 374, 322, 374, + /* 2120 */ 374, 325, 326, 327, 328, 329, 330, 374, 332, 374, + /* 2130 */ 374, 374, 374, 281, 374, 374, 374, 374, 374, 374, + /* 2140 */ 374, 289, 374, 374, 374, 374, 294, 374, 296, 374, + /* 2150 */ 374, 374, 374, 374, 374, 253, 374, 374, 374, 374, + /* 2160 */ 374, 374, 374, 374, 374, 374, 253, 374, 374, 374, + /* 2170 */ 374, 374, 374, 374, 322, 374, 374, 325, 326, 327, + /* 2180 */ 328, 329, 330, 281, 332, 374, 374, 374, 374, 374, + /* 2190 */ 374, 289, 374, 374, 281, 374, 294, 374, 296, 374, + /* 2200 */ 374, 374, 289, 374, 374, 374, 374, 294, 253, 296, + /* 2210 */ 374, 374, 374, 374, 374, 374, 374, 374, 374, 253, + /* 2220 */ 374, 374, 374, 374, 322, 374, 374, 325, 326, 327, + /* 2230 */ 328, 329, 330, 253, 332, 322, 281, 374, 325, 326, + /* 2240 */ 327, 328, 329, 330, 289, 332, 374, 281, 374, 294, + /* 2250 */ 374, 296, 374, 374, 374, 289, 374, 374, 374, 374, + /* 2260 */ 294, 281, 296, 374, 374, 374, 374, 374, 374, 289, + /* 2270 */ 374, 374, 374, 374, 294, 374, 296, 322, 374, 374, + /* 2280 */ 325, 326, 327, 328, 329, 330, 374, 332, 322, 253, + /* 2290 */ 374, 325, 326, 327, 328, 329, 330, 374, 332, 374, + /* 2300 */ 374, 374, 322, 253, 374, 325, 326, 327, 328, 329, + /* 2310 */ 330, 374, 332, 374, 374, 374, 374, 281, 374, 374, + /* 2320 */ 374, 374, 374, 374, 374, 289, 374, 374, 374, 374, + /* 2330 */ 294, 281, 296, 374, 374, 374, 374, 374, 374, 289, + /* 2340 */ 374, 374, 374, 374, 294, 374, 296, 374, 374, 374, + /* 2350 */ 374, 374, 374, 253, 374, 374, 374, 374, 322, 374, + /* 2360 */ 374, 325, 326, 327, 328, 329, 330, 374, 332, 374, + /* 2370 */ 374, 374, 322, 374, 374, 325, 326, 327, 328, 329, + /* 2380 */ 330, 281, 332, 374, 374, 374, 374, 374, 374, 289, + /* 2390 */ 374, 374, 374, 374, 294, 253, 296, 374, 374, 374, + /* 2400 */ 374, 374, 374, 374, 374, 374, 374, 374, 374, 253, + /* 2410 */ 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, + /* 2420 */ 374, 374, 322, 281, 374, 325, 326, 327, 328, 329, + /* 2430 */ 330, 289, 332, 374, 374, 374, 294, 281, 296, 374, + /* 2440 */ 374, 374, 374, 374, 374, 289, 374, 374, 374, 374, + /* 2450 */ 294, 374, 296, 374, 374, 374, 374, 374, 374, 374, + /* 2460 */ 374, 374, 374, 374, 322, 374, 374, 325, 326, 327, + /* 2470 */ 328, 329, 330, 374, 332, 374, 374, 374, 322, 374, + /* 2480 */ 374, 325, 326, 327, 328, 329, 330, 374, 332, }; #define YY_SHIFT_COUNT (652) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (1930) +#define YY_SHIFT_MAX (1824) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 769, 0, 0, 66, 322, 322, 322, 322, 266, 266, - /* 10 */ 322, 322, 460, 515, 581, 515, 515, 515, 515, 515, - /* 20 */ 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, - /* 30 */ 515, 515, 515, 515, 515, 515, 515, 515, 515, 515, - /* 40 */ 515, 515, 292, 292, 18, 18, 18, 925, 925, 925, - /* 50 */ 925, 637, 291, 40, 51, 51, 356, 356, 54, 64, - /* 60 */ 40, 40, 51, 51, 51, 51, 51, 51, 51, 51, - /* 70 */ 33, 51, 51, 51, 85, 104, 265, 51, 51, 265, - /* 80 */ 51, 265, 265, 265, 51, 111, 189, 659, 674, 674, - /* 90 */ 128, 293, 63, 63, 63, 63, 63, 63, 63, 63, - /* 100 */ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, - /* 110 */ 63, 301, 64, 67, 67, 739, 614, 341, 341, 341, - /* 120 */ 764, 614, 317, 104, 1, 1, 265, 265, 153, 153, - /* 130 */ 285, 370, 195, 195, 195, 195, 195, 195, 195, 704, - /* 140 */ 21, 427, 337, 47, 321, 435, 250, 12, 46, 548, - /* 150 */ 494, 511, 514, 483, 817, 483, 502, 502, 502, 790, - /* 160 */ 649, 844, 1049, 1026, 1044, 966, 1049, 1049, 1093, 995, - /* 170 */ 995, 1049, 1118, 1118, 1125, 33, 104, 33, 1149, 1157, - /* 180 */ 33, 1149, 33, 1163, 33, 33, 1049, 33, 1118, 265, - /* 190 */ 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, - /* 200 */ 1049, 1118, 153, 1125, 111, 1074, 104, 111, 1049, 1049, - /* 210 */ 1149, 111, 1232, 153, 1037, 1042, 153, 1037, 1042, 153, - /* 220 */ 153, 265, 1043, 1122, 1037, 1046, 1052, 1066, 844, 1072, - /* 230 */ 317, 1285, 1276, 1090, 1098, 1094, 1090, 1098, 1090, 1098, - /* 240 */ 1251, 1042, 153, 153, 153, 153, 153, 1042, 153, 1215, - /* 250 */ 317, 1163, 111, 285, 111, 317, 1301, 153, 370, 1049, - /* 260 */ 111, 1351, 1118, 2208, 2208, 2208, 2208, 2208, 2208, 2208, - /* 270 */ 843, 1297, 217, 395, 81, 268, 543, 1003, 1012, 882, - /* 280 */ 713, 532, 532, 532, 532, 532, 532, 532, 532, 701, - /* 290 */ 970, 498, 198, 198, 375, 149, 316, 719, 307, 36, - /* 300 */ 615, 615, 615, 615, 648, 759, 855, 880, 876, 878, - /* 310 */ 892, 894, 622, 971, 985, 874, 841, 956, 1009, 993, - /* 320 */ 923, 146, 897, 1010, 872, 1017, 964, 1019, 1023, 1028, - /* 330 */ 1031, 1032, 915, 961, 1033, 1038, 1039, 1060, 1064, 1085, - /* 340 */ 921, 1096, 1089, 1405, 1407, 1366, 1409, 1337, 1414, 1377, - /* 350 */ 1234, 1381, 1382, 1384, 1239, 1421, 1387, 1390, 1253, 1445, - /* 360 */ 1266, 1448, 1416, 1453, 1433, 1457, 1423, 1459, 1379, 1294, - /* 370 */ 1296, 1299, 1303, 1468, 1470, 1312, 1315, 1474, 1475, 1431, - /* 380 */ 1478, 1480, 1481, 1341, 1484, 1491, 1495, 1502, 1505, 1369, - /* 390 */ 1472, 1508, 1372, 1510, 1511, 1513, 1514, 1515, 1516, 1518, - /* 400 */ 1520, 1521, 1522, 1523, 1524, 1525, 1526, 1485, 1528, 1530, - /* 410 */ 1532, 1533, 1534, 1535, 1517, 1536, 1537, 1540, 1541, 1542, - /* 420 */ 1543, 1504, 1519, 1501, 1545, 1527, 1546, 1531, 1554, 1529, - /* 430 */ 1539, 1556, 1561, 1562, 1547, 1410, 1563, 1567, 1568, 1565, - /* 440 */ 1571, 1576, 1550, 1544, 1548, 1580, 1557, 1553, 1555, 1582, - /* 450 */ 1560, 1581, 1570, 1584, 1583, 1585, 1591, 1589, 1593, 1596, - /* 460 */ 1597, 1538, 1559, 1598, 1609, 1634, 1601, 1602, 1603, 1604, - /* 470 */ 1600, 1606, 1610, 1611, 1612, 1644, 1628, 1651, 1630, 1605, - /* 480 */ 1653, 1633, 1621, 1657, 1623, 1659, 1625, 1662, 1641, 1645, - /* 490 */ 1664, 1551, 1631, 1667, 1512, 1648, 1572, 1552, 1679, 1680, - /* 500 */ 1573, 1569, 1685, 1686, 1687, 1647, 1649, 1469, 1613, 1615, - /* 510 */ 1614, 1620, 1650, 1622, 1618, 1624, 1626, 1629, 1666, 1661, - /* 520 */ 1681, 1643, 1688, 1509, 1646, 1658, 1696, 1564, 1689, 1697, - /* 530 */ 1663, 1701, 1566, 1668, 1656, 1710, 1712, 1714, 1715, 1718, - /* 540 */ 1668, 1692, 1574, 1711, 1682, 1684, 1690, 1717, 1699, 1704, - /* 550 */ 1722, 1742, 1590, 1705, 1691, 1695, 1706, 1769, 1708, 1635, - /* 560 */ 1713, 1770, 1732, 1654, 1719, 1700, 1726, 1747, 1720, 1716, - /* 570 */ 1721, 1772, 1723, 1703, 1727, 1762, 1771, 1737, 1745, 1774, - /* 580 */ 1748, 1746, 1796, 1750, 1754, 1798, 1756, 1757, 1801, 1760, - /* 590 */ 1698, 1738, 1739, 1741, 1824, 1755, 1773, 1776, 1816, 1777, - /* 600 */ 1809, 1809, 1831, 1794, 1797, 1825, 1799, 1781, 1819, 1828, - /* 610 */ 1830, 1833, 1834, 1843, 1865, 1853, 1854, 1826, 1600, 1855, - /* 620 */ 1606, 1857, 1860, 1861, 1862, 1864, 1866, 1903, 1869, 1858, - /* 630 */ 1867, 1908, 1875, 1868, 1872, 1912, 1878, 1870, 1877, 1914, - /* 640 */ 1884, 1873, 1882, 1922, 1888, 1889, 1925, 1906, 1916, 1926, - /* 650 */ 1927, 1923, 1930, + /* 0 */ 945, 0, 0, 57, 252, 252, 252, 252, 309, 309, + /* 10 */ 252, 252, 504, 561, 756, 561, 561, 561, 561, 561, + /* 20 */ 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, + /* 30 */ 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, + /* 40 */ 561, 561, 54, 54, 246, 246, 246, 1238, 1238, 1238, + /* 50 */ 1238, 186, 87, 254, 11, 11, 239, 239, 242, 10, + /* 60 */ 254, 254, 11, 11, 11, 11, 11, 11, 11, 11, + /* 70 */ 99, 11, 11, 11, 150, 261, 313, 11, 11, 313, + /* 80 */ 11, 313, 313, 313, 11, 268, 752, 839, 1003, 1003, + /* 90 */ 438, 111, 245, 245, 245, 245, 245, 245, 245, 245, + /* 100 */ 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, + /* 110 */ 245, 698, 10, 457, 457, 319, 618, 222, 222, 222, + /* 120 */ 358, 618, 327, 261, 6, 6, 313, 313, 361, 361, + /* 130 */ 405, 460, 193, 193, 193, 193, 193, 193, 193, 1777, + /* 140 */ 21, 14, 372, 84, 310, 406, 270, 376, 473, 516, + /* 150 */ 791, 686, 773, 694, 507, 694, 797, 797, 797, 713, + /* 160 */ 790, 848, 1054, 1029, 1043, 921, 1054, 1054, 1042, 942, + /* 170 */ 942, 1054, 1070, 1070, 1075, 99, 261, 99, 1084, 1092, + /* 180 */ 99, 1084, 99, 1101, 99, 99, 1054, 99, 1070, 313, + /* 190 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, + /* 200 */ 1054, 1070, 361, 1075, 268, 986, 261, 268, 1054, 1054, + /* 210 */ 1084, 268, 1149, 361, 943, 949, 361, 943, 949, 361, + /* 220 */ 361, 313, 946, 1039, 943, 963, 965, 999, 848, 1005, + /* 230 */ 327, 1206, 1185, 989, 992, 1010, 989, 992, 989, 992, + /* 240 */ 1163, 949, 361, 361, 361, 361, 361, 949, 361, 1107, + /* 250 */ 327, 1101, 268, 405, 268, 327, 1210, 361, 460, 1054, + /* 260 */ 268, 1265, 1070, 2489, 2489, 2489, 2489, 2489, 2489, 2489, + /* 270 */ 162, 885, 123, 574, 199, 576, 467, 476, 540, 707, + /* 280 */ 662, 549, 549, 549, 549, 549, 549, 549, 549, 624, + /* 290 */ 681, 224, 263, 263, 251, 558, 410, 3, 603, 521, + /* 300 */ 529, 529, 529, 529, 249, 96, 823, 884, 840, 842, + /* 310 */ 856, 888, 872, 913, 978, 852, 820, 930, 937, 987, + /* 320 */ 876, 787, 802, 953, 920, 954, 489, 956, 958, 960, + /* 330 */ 961, 962, 864, 974, 980, 981, 983, 985, 1013, 1016, + /* 340 */ 339, 975, 126, 1315, 1316, 1276, 1319, 1248, 1320, 1288, + /* 350 */ 1144, 1291, 1292, 1293, 1148, 1330, 1296, 1297, 1152, 1334, + /* 360 */ 1154, 1337, 1303, 1340, 1321, 1341, 1310, 1346, 1266, 1179, + /* 370 */ 1192, 1187, 1198, 1362, 1363, 1205, 1207, 1367, 1368, 1323, + /* 380 */ 1370, 1371, 1372, 1231, 1374, 1375, 1378, 1386, 1388, 1252, + /* 390 */ 1355, 1391, 1255, 1394, 1395, 1396, 1398, 1399, 1400, 1402, + /* 400 */ 1407, 1408, 1409, 1410, 1411, 1413, 1414, 1373, 1416, 1421, + /* 410 */ 1422, 1423, 1426, 1427, 1383, 1428, 1429, 1430, 1431, 1432, + /* 420 */ 1433, 1392, 1417, 1401, 1443, 1389, 1446, 1418, 1465, 1434, + /* 430 */ 1436, 1466, 1467, 1468, 1437, 1318, 1469, 1470, 1473, 1387, + /* 440 */ 1477, 1478, 1448, 1435, 1442, 1485, 1453, 1454, 1450, 1502, + /* 450 */ 1471, 1456, 1472, 1504, 1474, 1458, 1475, 1507, 1510, 1521, + /* 460 */ 1523, 1438, 1424, 1489, 1503, 1526, 1492, 1496, 1497, 1498, + /* 470 */ 1491, 1494, 1500, 1505, 1509, 1538, 1517, 1542, 1524, 1501, + /* 480 */ 1545, 1525, 1514, 1551, 1518, 1552, 1519, 1555, 1534, 1539, + /* 490 */ 1558, 1412, 1531, 1568, 1420, 1549, 1440, 1439, 1580, 1581, + /* 500 */ 1441, 1444, 1583, 1592, 1594, 1554, 1556, 1379, 1522, 1512, + /* 510 */ 1527, 1520, 1562, 1528, 1533, 1535, 1536, 1530, 1564, 1574, + /* 520 */ 1576, 1541, 1565, 1393, 1544, 1557, 1578, 1384, 1567, 1579, + /* 530 */ 1559, 1585, 1415, 1560, 1602, 1604, 1606, 1609, 1610, 1611, + /* 540 */ 1560, 1646, 1462, 1613, 1577, 1582, 1584, 1615, 1586, 1587, + /* 550 */ 1616, 1637, 1476, 1588, 1589, 1590, 1593, 1666, 1595, 1532, + /* 560 */ 1597, 1674, 1642, 1537, 1600, 1596, 1638, 1639, 1605, 1607, + /* 570 */ 1614, 1669, 1620, 1599, 1612, 1658, 1662, 1621, 1622, 1663, + /* 580 */ 1624, 1632, 1682, 1636, 1640, 1684, 1643, 1641, 1685, 1644, + /* 590 */ 1623, 1633, 1634, 1645, 1699, 1628, 1656, 1660, 1710, 1664, + /* 600 */ 1704, 1704, 1726, 1689, 1691, 1719, 1693, 1675, 1713, 1725, + /* 610 */ 1727, 1728, 1729, 1730, 1739, 1732, 1733, 1705, 1491, 1743, + /* 620 */ 1494, 1745, 1747, 1748, 1749, 1751, 1752, 1797, 1763, 1753, + /* 630 */ 1760, 1801, 1768, 1757, 1766, 1806, 1773, 1764, 1774, 1812, + /* 640 */ 1779, 1769, 1776, 1817, 1783, 1784, 1820, 1800, 1804, 1805, + /* 650 */ 1814, 1807, 1824, }; #define YY_REDUCE_COUNT (269) -#define YY_REDUCE_MIN (-338) -#define YY_REDUCE_MAX (1842) +#define YY_REDUCE_MIN (-287) +#define YY_REDUCE_MAX (2156) static const short yy_reduce_ofst[] = { - /* 0 */ -235, -215, 87, 651, 712, 513, 773, 828, 881, 890, - /* 10 */ 908, 973, -150, 989, 998, 314, 1051, 1105, 1114, 1164, - /* 20 */ 1175, 1227, 1280, 1289, 1298, 1350, 1392, 1412, 1434, 1490, - /* 30 */ 1499, 1549, 1558, 1608, 1617, 1669, 1678, 1731, 1740, 1749, - /* 40 */ 1758, 1836, 1753, 1842, -119, 241, 246, -274, -254, -261, - /* 50 */ 79, -292, -224, 143, -124, 108, -253, -249, -338, -251, - /* 60 */ -218, 55, -123, -33, 162, 164, 226, 275, 304, 339, - /* 70 */ -244, 360, 408, 409, -209, 133, 200, 413, 463, 459, - /* 80 */ 481, 298, 470, 455, 545, 165, -233, 7, 7, 7, - /* 90 */ -217, -252, -63, 154, 194, 287, 320, 351, 353, 496, - /* 100 */ 518, 521, 542, 571, 597, 598, 609, 611, 644, 654, - /* 110 */ 678, -174, 238, 221, 308, -144, 357, -111, 490, 589, - /* 120 */ 595, 428, 399, 497, 271, 523, 507, 552, 652, 658, - /* 130 */ 686, 22, -259, 177, 426, 452, 457, 534, 579, 71, - /* 140 */ 156, 233, 227, 533, 699, 684, 612, 724, 724, 765, - /* 150 */ 788, 756, 731, 709, 709, 709, 693, 694, 695, 720, - /* 160 */ 724, 751, 815, 763, 854, 820, 875, 877, 839, 846, - /* 170 */ 847, 887, 904, 909, 835, 901, 884, 911, 864, 870, - /* 180 */ 918, 883, 920, 886, 926, 929, 934, 931, 935, 917, - /* 190 */ 919, 924, 933, 940, 942, 943, 944, 946, 947, 948, - /* 200 */ 938, 976, 945, 927, 982, 936, 957, 994, 997, 999, - /* 210 */ 951, 1000, 941, 972, 914, 967, 979, 932, 969, 981, - /* 220 */ 983, 724, 922, 937, 949, 928, 952, 939, 977, 709, - /* 230 */ 1002, 987, 1001, 963, 974, 978, 984, 975, 996, 1004, - /* 240 */ 1006, 1034, 1055, 1056, 1067, 1068, 1069, 1041, 1071, 1065, - /* 250 */ 1080, 1070, 1107, 1097, 1112, 1095, 1103, 1099, 1119, 1128, - /* 260 */ 1129, 1140, 1142, 1084, 1091, 1127, 1130, 1131, 1143, 1153, + /* 0 */ -248, 72, 855, -195, 322, 575, 908, 950, 1028, 1055, + /* 10 */ 306, 1123, 1165, 1190, 1247, 1304, 1325, 1382, 1405, 1447, + /* 20 */ 1463, 1513, 1570, 1631, 1648, 1690, 1701, 1712, 1754, 1772, + /* 30 */ 1796, 1852, 1902, 1913, 1955, 1966, 1980, 2036, 2050, 2100, + /* 40 */ 2142, 2156, 769, 1219, -234, 90, 398, -278, -260, -254, + /* 50 */ -105, -245, -209, -42, -261, -164, -256, -250, 4, -113, + /* 60 */ 13, 24, 131, 258, 262, 338, 340, 543, 548, 550, + /* 70 */ -246, 552, 555, 557, 133, -211, 62, 570, 645, -224, + /* 80 */ 703, 73, -190, 86, 704, 23, 59, 185, 185, 185, + /* 90 */ -237, -102, -153, 276, 278, 288, 315, 362, 419, 420, + /* 100 */ 435, 437, 440, 477, 479, 480, 483, 531, 564, 573, + /* 110 */ 615, -255, 281, -40, 379, 333, 444, -287, -242, 458, + /* 120 */ -125, 539, 106, 512, 441, 481, 316, 553, 391, 571, + /* 130 */ 566, 592, 378, 386, 567, 584, 638, 642, 690, 225, + /* 140 */ 731, 717, 619, 627, 736, 688, 650, 733, 733, 759, + /* 150 */ 762, 742, 737, 711, 711, 711, 701, 705, 706, 718, + /* 160 */ 733, 753, 814, 758, 812, 768, 822, 824, 785, 789, + /* 170 */ 792, 828, 837, 838, 780, 841, 807, 844, 800, 804, + /* 180 */ 853, 809, 858, 830, 859, 861, 874, 868, 882, 860, + /* 190 */ 862, 865, 866, 869, 871, 873, 875, 877, 878, 879, + /* 200 */ 881, 890, 846, 836, 892, 847, 880, 899, 904, 906, + /* 210 */ 863, 905, 850, 894, 815, 886, 898, 821, 891, 907, + /* 220 */ 911, 733, 826, 849, 843, 851, 854, 887, 902, 711, + /* 230 */ 936, 909, 900, 889, 895, 883, 893, 896, 897, 901, + /* 240 */ 915, 959, 972, 973, 976, 990, 993, 964, 994, 952, + /* 250 */ 970, 984, 1011, 1006, 1030, 1007, 1012, 1001, 1027, 1038, + /* 260 */ 1041, 1046, 1050, 996, 997, 1032, 1036, 1037, 1049, 1063, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 10 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 20 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 30 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 40 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 50 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 60 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 70 */ 1496, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 80 */ 1424, 1424, 1424, 1424, 1424, 1494, 1647, 1424, 1816, 1424, - /* 90 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 100 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 110 */ 1424, 1424, 1424, 1424, 1424, 1496, 1424, 1828, 1828, 1828, - /* 120 */ 1494, 1424, 1424, 1424, 1691, 1691, 1424, 1424, 1424, 1424, - /* 130 */ 1590, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1683, - /* 140 */ 1424, 1424, 1898, 1424, 1424, 1689, 1852, 1424, 1424, 1424, - /* 150 */ 1424, 1543, 1844, 1820, 1834, 1821, 1883, 1883, 1883, 1837, - /* 160 */ 1424, 1848, 1424, 1424, 1424, 1675, 1424, 1424, 1652, 1649, - /* 170 */ 1649, 1424, 1424, 1424, 1424, 1496, 1424, 1496, 1424, 1424, - /* 180 */ 1496, 1424, 1496, 1424, 1496, 1496, 1424, 1496, 1424, 1424, - /* 190 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 200 */ 1424, 1424, 1424, 1424, 1494, 1685, 1424, 1494, 1424, 1424, - /* 210 */ 1424, 1494, 1424, 1424, 1859, 1857, 1424, 1859, 1857, 1424, - /* 220 */ 1424, 1424, 1871, 1867, 1859, 1875, 1873, 1850, 1848, 1834, - /* 230 */ 1424, 1424, 1818, 1889, 1885, 1901, 1889, 1885, 1889, 1885, - /* 240 */ 1424, 1857, 1424, 1424, 1424, 1424, 1424, 1857, 1424, 1424, - /* 250 */ 1424, 1424, 1494, 1424, 1494, 1424, 1559, 1424, 1424, 1424, - /* 260 */ 1494, 1456, 1424, 1677, 1691, 1593, 1593, 1593, 1497, 1429, - /* 270 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 280 */ 1424, 1760, 1870, 1869, 1792, 1791, 1790, 1788, 1759, 1424, - /* 290 */ 1424, 1555, 1758, 1757, 1424, 1424, 1424, 1424, 1424, 1424, - /* 300 */ 1751, 1752, 1750, 1749, 1424, 1424, 1424, 1424, 1424, 1424, - /* 310 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1817, - /* 320 */ 1424, 1886, 1890, 1424, 1424, 1424, 1734, 1424, 1424, 1424, - /* 330 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 340 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 350 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 360 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 370 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 380 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 390 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 400 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 410 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 420 */ 1424, 1424, 1424, 1461, 1424, 1424, 1424, 1424, 1424, 1424, - /* 430 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 440 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 450 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 460 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 470 */ 1524, 1523, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 480 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 490 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 500 */ 1424, 1424, 1424, 1424, 1424, 1841, 1851, 1424, 1424, 1424, - /* 510 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 520 */ 1734, 1424, 1868, 1424, 1827, 1823, 1424, 1424, 1819, 1424, - /* 530 */ 1424, 1884, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 540 */ 1424, 1812, 1424, 1785, 1424, 1424, 1424, 1424, 1424, 1424, - /* 550 */ 1424, 1424, 1745, 1424, 1424, 1424, 1424, 1695, 1424, 1424, - /* 560 */ 1424, 1424, 1424, 1424, 1424, 1424, 1733, 1424, 1776, 1424, - /* 570 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1587, 1424, 1424, - /* 580 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 590 */ 1572, 1570, 1569, 1568, 1424, 1565, 1424, 1424, 1424, 1424, - /* 600 */ 1596, 1595, 1424, 1424, 1424, 1424, 1424, 1424, 1516, 1424, - /* 610 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1507, 1424, - /* 620 */ 1506, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 630 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 640 */ 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, - /* 650 */ 1424, 1424, 1424, + /* 0 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 10 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 20 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 30 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 40 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 50 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 60 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 70 */ 1508, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 80 */ 1436, 1436, 1436, 1436, 1436, 1506, 1659, 1436, 1834, 1436, + /* 90 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 100 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 110 */ 1436, 1436, 1436, 1436, 1436, 1508, 1436, 1846, 1846, 1846, + /* 120 */ 1506, 1436, 1436, 1436, 1703, 1703, 1436, 1436, 1436, 1436, + /* 130 */ 1602, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1695, + /* 140 */ 1436, 1436, 1916, 1436, 1436, 1701, 1870, 1436, 1436, 1436, + /* 150 */ 1436, 1555, 1862, 1838, 1852, 1839, 1901, 1901, 1901, 1855, + /* 160 */ 1436, 1866, 1436, 1436, 1436, 1687, 1436, 1436, 1664, 1661, + /* 170 */ 1661, 1436, 1436, 1436, 1436, 1508, 1436, 1508, 1436, 1436, + /* 180 */ 1508, 1436, 1508, 1436, 1508, 1508, 1436, 1508, 1436, 1436, + /* 190 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 200 */ 1436, 1436, 1436, 1436, 1506, 1697, 1436, 1506, 1436, 1436, + /* 210 */ 1436, 1506, 1436, 1436, 1877, 1875, 1436, 1877, 1875, 1436, + /* 220 */ 1436, 1436, 1889, 1885, 1877, 1893, 1891, 1868, 1866, 1852, + /* 230 */ 1436, 1436, 1836, 1907, 1903, 1919, 1907, 1903, 1907, 1903, + /* 240 */ 1436, 1875, 1436, 1436, 1436, 1436, 1436, 1875, 1436, 1436, + /* 250 */ 1436, 1436, 1506, 1436, 1506, 1436, 1571, 1436, 1436, 1436, + /* 260 */ 1506, 1468, 1436, 1689, 1703, 1605, 1605, 1605, 1509, 1441, + /* 270 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 280 */ 1436, 1772, 1888, 1887, 1810, 1809, 1808, 1806, 1771, 1436, + /* 290 */ 1436, 1567, 1770, 1769, 1436, 1436, 1436, 1436, 1436, 1436, + /* 300 */ 1763, 1764, 1762, 1761, 1436, 1436, 1436, 1436, 1436, 1436, + /* 310 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1835, + /* 320 */ 1436, 1904, 1908, 1436, 1436, 1436, 1746, 1436, 1436, 1436, + /* 330 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 340 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 350 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 360 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 370 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 380 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 390 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 400 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 410 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 420 */ 1436, 1436, 1436, 1473, 1436, 1436, 1436, 1436, 1436, 1436, + /* 430 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 440 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 450 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 460 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 470 */ 1536, 1535, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 480 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 490 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 500 */ 1436, 1436, 1436, 1436, 1436, 1859, 1869, 1436, 1436, 1436, + /* 510 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 520 */ 1746, 1436, 1886, 1436, 1845, 1841, 1436, 1436, 1837, 1436, + /* 530 */ 1436, 1902, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 540 */ 1436, 1830, 1436, 1803, 1436, 1436, 1436, 1436, 1436, 1436, + /* 550 */ 1436, 1436, 1757, 1436, 1436, 1436, 1436, 1707, 1436, 1436, + /* 560 */ 1436, 1436, 1436, 1436, 1436, 1436, 1745, 1436, 1788, 1436, + /* 570 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1599, 1436, 1436, + /* 580 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 590 */ 1584, 1582, 1581, 1580, 1436, 1577, 1436, 1436, 1436, 1436, + /* 600 */ 1608, 1607, 1436, 1436, 1436, 1436, 1436, 1436, 1528, 1436, + /* 610 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1519, 1436, + /* 620 */ 1518, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 630 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 640 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, + /* 650 */ 1436, 1436, 1436, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1053,6 +1109,10 @@ static const YYCODETYPE yyFallback[] = { 0, /* NOW => nothing */ 0, /* TODAY => nothing */ 0, /* TIMEZONE => nothing */ + 0, /* CLIENT_VERSION => nothing */ + 0, /* SERVER_VERSION => nothing */ + 0, /* SERVER_STATUS => nothing */ + 0, /* CURRENT_USER => nothing */ 0, /* COUNT => nothing */ 0, /* LAST_ROW => nothing */ 0, /* BETWEEN => nothing */ @@ -1092,12 +1152,12 @@ static const YYCODETYPE yyFallback[] = { 0, /* ASC => nothing */ 0, /* NULLS => nothing */ 0, /* ID => nothing */ - 239, /* NK_BITNOT => ID */ - 239, /* INSERT => ID */ - 239, /* VALUES => ID */ - 239, /* IMPORT => ID */ - 239, /* NK_SEMI => ID */ - 239, /* FILE => ID */ + 243, /* NK_BITNOT => ID */ + 243, /* INSERT => ID */ + 243, /* VALUES => ID */ + 243, /* IMPORT => ID */ + 243, /* NK_SEMI => ID */ + 243, /* FILE => ID */ }; #endif /* YYFALLBACK */ @@ -1386,175 +1446,179 @@ static const char *const yyTokenName[] = { /* 198 */ "NOW", /* 199 */ "TODAY", /* 200 */ "TIMEZONE", - /* 201 */ "COUNT", - /* 202 */ "LAST_ROW", - /* 203 */ "BETWEEN", - /* 204 */ "IS", - /* 205 */ "NK_LT", - /* 206 */ "NK_GT", - /* 207 */ "NK_LE", - /* 208 */ "NK_GE", - /* 209 */ "NK_NE", - /* 210 */ "MATCH", - /* 211 */ "NMATCH", - /* 212 */ "CONTAINS", - /* 213 */ "JOIN", - /* 214 */ "INNER", - /* 215 */ "SELECT", - /* 216 */ "DISTINCT", - /* 217 */ "WHERE", - /* 218 */ "PARTITION", - /* 219 */ "BY", - /* 220 */ "SESSION", - /* 221 */ "STATE_WINDOW", - /* 222 */ "SLIDING", - /* 223 */ "FILL", - /* 224 */ "VALUE", - /* 225 */ "NONE", - /* 226 */ "PREV", - /* 227 */ "LINEAR", - /* 228 */ "NEXT", - /* 229 */ "HAVING", - /* 230 */ "RANGE", - /* 231 */ "EVERY", - /* 232 */ "ORDER", - /* 233 */ "SLIMIT", - /* 234 */ "SOFFSET", - /* 235 */ "LIMIT", - /* 236 */ "OFFSET", - /* 237 */ "ASC", - /* 238 */ "NULLS", - /* 239 */ "ID", - /* 240 */ "NK_BITNOT", - /* 241 */ "INSERT", - /* 242 */ "VALUES", - /* 243 */ "IMPORT", - /* 244 */ "NK_SEMI", - /* 245 */ "FILE", - /* 246 */ "cmd", - /* 247 */ "account_options", - /* 248 */ "alter_account_options", - /* 249 */ "literal", - /* 250 */ "alter_account_option", - /* 251 */ "user_name", - /* 252 */ "sysinfo_opt", - /* 253 */ "privileges", - /* 254 */ "priv_level", - /* 255 */ "priv_type_list", - /* 256 */ "priv_type", - /* 257 */ "db_name", - /* 258 */ "dnode_endpoint", - /* 259 */ "not_exists_opt", - /* 260 */ "db_options", - /* 261 */ "exists_opt", - /* 262 */ "alter_db_options", - /* 263 */ "integer_list", - /* 264 */ "variable_list", - /* 265 */ "retention_list", - /* 266 */ "alter_db_option", - /* 267 */ "retention", - /* 268 */ "full_table_name", - /* 269 */ "column_def_list", - /* 270 */ "tags_def_opt", - /* 271 */ "table_options", - /* 272 */ "multi_create_clause", - /* 273 */ "tags_def", - /* 274 */ "multi_drop_clause", - /* 275 */ "alter_table_clause", - /* 276 */ "alter_table_options", - /* 277 */ "column_name", - /* 278 */ "type_name", - /* 279 */ "signed_literal", - /* 280 */ "create_subtable_clause", - /* 281 */ "specific_tags_opt", - /* 282 */ "literal_list", - /* 283 */ "drop_table_clause", - /* 284 */ "col_name_list", - /* 285 */ "table_name", - /* 286 */ "column_def", - /* 287 */ "duration_list", - /* 288 */ "rollup_func_list", - /* 289 */ "alter_table_option", - /* 290 */ "duration_literal", - /* 291 */ "rollup_func_name", - /* 292 */ "function_name", - /* 293 */ "col_name", - /* 294 */ "db_name_cond_opt", - /* 295 */ "like_pattern_opt", - /* 296 */ "table_name_cond", - /* 297 */ "from_db_opt", - /* 298 */ "index_name", - /* 299 */ "index_options", - /* 300 */ "func_list", - /* 301 */ "sliding_opt", - /* 302 */ "sma_stream_opt", - /* 303 */ "func", - /* 304 */ "expression_list", - /* 305 */ "stream_options", - /* 306 */ "topic_name", - /* 307 */ "query_expression", - /* 308 */ "cgroup_name", - /* 309 */ "analyze_opt", - /* 310 */ "explain_options", - /* 311 */ "agg_func_opt", - /* 312 */ "bufsize_opt", - /* 313 */ "stream_name", - /* 314 */ "into_opt", - /* 315 */ "dnode_list", - /* 316 */ "where_clause_opt", - /* 317 */ "signed", - /* 318 */ "literal_func", - /* 319 */ "table_alias", - /* 320 */ "column_alias", - /* 321 */ "expression", - /* 322 */ "pseudo_column", - /* 323 */ "column_reference", - /* 324 */ "function_expression", - /* 325 */ "subquery", - /* 326 */ "star_func", - /* 327 */ "star_func_para_list", - /* 328 */ "noarg_func", - /* 329 */ "other_para_list", - /* 330 */ "star_func_para", - /* 331 */ "predicate", - /* 332 */ "compare_op", - /* 333 */ "in_op", - /* 334 */ "in_predicate_value", - /* 335 */ "boolean_value_expression", - /* 336 */ "boolean_primary", - /* 337 */ "common_expression", - /* 338 */ "from_clause_opt", - /* 339 */ "table_reference_list", - /* 340 */ "table_reference", - /* 341 */ "table_primary", - /* 342 */ "joined_table", - /* 343 */ "alias_opt", - /* 344 */ "parenthesized_joined_table", - /* 345 */ "join_type", - /* 346 */ "search_condition", - /* 347 */ "query_specification", - /* 348 */ "set_quantifier_opt", - /* 349 */ "select_list", - /* 350 */ "partition_by_clause_opt", - /* 351 */ "range_opt", - /* 352 */ "every_opt", - /* 353 */ "fill_opt", - /* 354 */ "twindow_clause_opt", - /* 355 */ "group_by_clause_opt", - /* 356 */ "having_clause_opt", - /* 357 */ "select_sublist", - /* 358 */ "select_item", - /* 359 */ "fill_mode", - /* 360 */ "group_by_list", - /* 361 */ "query_expression_body", - /* 362 */ "order_by_clause_opt", - /* 363 */ "slimit_clause_opt", - /* 364 */ "limit_clause_opt", - /* 365 */ "query_primary", - /* 366 */ "sort_specification_list", - /* 367 */ "sort_specification", - /* 368 */ "ordering_specification_opt", - /* 369 */ "null_ordering_opt", + /* 201 */ "CLIENT_VERSION", + /* 202 */ "SERVER_VERSION", + /* 203 */ "SERVER_STATUS", + /* 204 */ "CURRENT_USER", + /* 205 */ "COUNT", + /* 206 */ "LAST_ROW", + /* 207 */ "BETWEEN", + /* 208 */ "IS", + /* 209 */ "NK_LT", + /* 210 */ "NK_GT", + /* 211 */ "NK_LE", + /* 212 */ "NK_GE", + /* 213 */ "NK_NE", + /* 214 */ "MATCH", + /* 215 */ "NMATCH", + /* 216 */ "CONTAINS", + /* 217 */ "JOIN", + /* 218 */ "INNER", + /* 219 */ "SELECT", + /* 220 */ "DISTINCT", + /* 221 */ "WHERE", + /* 222 */ "PARTITION", + /* 223 */ "BY", + /* 224 */ "SESSION", + /* 225 */ "STATE_WINDOW", + /* 226 */ "SLIDING", + /* 227 */ "FILL", + /* 228 */ "VALUE", + /* 229 */ "NONE", + /* 230 */ "PREV", + /* 231 */ "LINEAR", + /* 232 */ "NEXT", + /* 233 */ "HAVING", + /* 234 */ "RANGE", + /* 235 */ "EVERY", + /* 236 */ "ORDER", + /* 237 */ "SLIMIT", + /* 238 */ "SOFFSET", + /* 239 */ "LIMIT", + /* 240 */ "OFFSET", + /* 241 */ "ASC", + /* 242 */ "NULLS", + /* 243 */ "ID", + /* 244 */ "NK_BITNOT", + /* 245 */ "INSERT", + /* 246 */ "VALUES", + /* 247 */ "IMPORT", + /* 248 */ "NK_SEMI", + /* 249 */ "FILE", + /* 250 */ "cmd", + /* 251 */ "account_options", + /* 252 */ "alter_account_options", + /* 253 */ "literal", + /* 254 */ "alter_account_option", + /* 255 */ "user_name", + /* 256 */ "sysinfo_opt", + /* 257 */ "privileges", + /* 258 */ "priv_level", + /* 259 */ "priv_type_list", + /* 260 */ "priv_type", + /* 261 */ "db_name", + /* 262 */ "dnode_endpoint", + /* 263 */ "not_exists_opt", + /* 264 */ "db_options", + /* 265 */ "exists_opt", + /* 266 */ "alter_db_options", + /* 267 */ "integer_list", + /* 268 */ "variable_list", + /* 269 */ "retention_list", + /* 270 */ "alter_db_option", + /* 271 */ "retention", + /* 272 */ "full_table_name", + /* 273 */ "column_def_list", + /* 274 */ "tags_def_opt", + /* 275 */ "table_options", + /* 276 */ "multi_create_clause", + /* 277 */ "tags_def", + /* 278 */ "multi_drop_clause", + /* 279 */ "alter_table_clause", + /* 280 */ "alter_table_options", + /* 281 */ "column_name", + /* 282 */ "type_name", + /* 283 */ "signed_literal", + /* 284 */ "create_subtable_clause", + /* 285 */ "specific_tags_opt", + /* 286 */ "literal_list", + /* 287 */ "drop_table_clause", + /* 288 */ "col_name_list", + /* 289 */ "table_name", + /* 290 */ "column_def", + /* 291 */ "duration_list", + /* 292 */ "rollup_func_list", + /* 293 */ "alter_table_option", + /* 294 */ "duration_literal", + /* 295 */ "rollup_func_name", + /* 296 */ "function_name", + /* 297 */ "col_name", + /* 298 */ "db_name_cond_opt", + /* 299 */ "like_pattern_opt", + /* 300 */ "table_name_cond", + /* 301 */ "from_db_opt", + /* 302 */ "index_name", + /* 303 */ "index_options", + /* 304 */ "func_list", + /* 305 */ "sliding_opt", + /* 306 */ "sma_stream_opt", + /* 307 */ "func", + /* 308 */ "expression_list", + /* 309 */ "stream_options", + /* 310 */ "topic_name", + /* 311 */ "query_expression", + /* 312 */ "cgroup_name", + /* 313 */ "analyze_opt", + /* 314 */ "explain_options", + /* 315 */ "agg_func_opt", + /* 316 */ "bufsize_opt", + /* 317 */ "stream_name", + /* 318 */ "into_opt", + /* 319 */ "dnode_list", + /* 320 */ "where_clause_opt", + /* 321 */ "signed", + /* 322 */ "literal_func", + /* 323 */ "table_alias", + /* 324 */ "column_alias", + /* 325 */ "expression", + /* 326 */ "pseudo_column", + /* 327 */ "column_reference", + /* 328 */ "function_expression", + /* 329 */ "subquery", + /* 330 */ "star_func", + /* 331 */ "star_func_para_list", + /* 332 */ "noarg_func", + /* 333 */ "other_para_list", + /* 334 */ "star_func_para", + /* 335 */ "predicate", + /* 336 */ "compare_op", + /* 337 */ "in_op", + /* 338 */ "in_predicate_value", + /* 339 */ "boolean_value_expression", + /* 340 */ "boolean_primary", + /* 341 */ "common_expression", + /* 342 */ "from_clause_opt", + /* 343 */ "table_reference_list", + /* 344 */ "table_reference", + /* 345 */ "table_primary", + /* 346 */ "joined_table", + /* 347 */ "alias_opt", + /* 348 */ "parenthesized_joined_table", + /* 349 */ "join_type", + /* 350 */ "search_condition", + /* 351 */ "query_specification", + /* 352 */ "set_quantifier_opt", + /* 353 */ "select_list", + /* 354 */ "partition_by_clause_opt", + /* 355 */ "range_opt", + /* 356 */ "every_opt", + /* 357 */ "fill_opt", + /* 358 */ "twindow_clause_opt", + /* 359 */ "group_by_clause_opt", + /* 360 */ "having_clause_opt", + /* 361 */ "select_sublist", + /* 362 */ "select_item", + /* 363 */ "fill_mode", + /* 364 */ "group_by_list", + /* 365 */ "query_expression_body", + /* 366 */ "order_by_clause_opt", + /* 367 */ "slimit_clause_opt", + /* 368 */ "limit_clause_opt", + /* 369 */ "query_primary", + /* 370 */ "sort_specification_list", + /* 371 */ "sort_specification", + /* 372 */ "ordering_specification_opt", + /* 373 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1915,130 +1979,136 @@ static const char *const yyRuleName[] = { /* 350 */ "noarg_func ::= NOW", /* 351 */ "noarg_func ::= TODAY", /* 352 */ "noarg_func ::= TIMEZONE", - /* 353 */ "star_func ::= COUNT", - /* 354 */ "star_func ::= FIRST", - /* 355 */ "star_func ::= LAST", - /* 356 */ "star_func ::= LAST_ROW", - /* 357 */ "star_func_para_list ::= NK_STAR", - /* 358 */ "star_func_para_list ::= other_para_list", - /* 359 */ "other_para_list ::= star_func_para", - /* 360 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 361 */ "star_func_para ::= expression", - /* 362 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 363 */ "predicate ::= expression compare_op expression", - /* 364 */ "predicate ::= expression BETWEEN expression AND expression", - /* 365 */ "predicate ::= expression NOT BETWEEN expression AND expression", - /* 366 */ "predicate ::= expression IS NULL", - /* 367 */ "predicate ::= expression IS NOT NULL", - /* 368 */ "predicate ::= expression in_op in_predicate_value", - /* 369 */ "compare_op ::= NK_LT", - /* 370 */ "compare_op ::= NK_GT", - /* 371 */ "compare_op ::= NK_LE", - /* 372 */ "compare_op ::= NK_GE", - /* 373 */ "compare_op ::= NK_NE", - /* 374 */ "compare_op ::= NK_EQ", - /* 375 */ "compare_op ::= LIKE", - /* 376 */ "compare_op ::= NOT LIKE", - /* 377 */ "compare_op ::= MATCH", - /* 378 */ "compare_op ::= NMATCH", - /* 379 */ "compare_op ::= CONTAINS", - /* 380 */ "in_op ::= IN", - /* 381 */ "in_op ::= NOT IN", - /* 382 */ "in_predicate_value ::= NK_LP expression_list NK_RP", - /* 383 */ "boolean_value_expression ::= boolean_primary", - /* 384 */ "boolean_value_expression ::= NOT boolean_primary", - /* 385 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 386 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 387 */ "boolean_primary ::= predicate", - /* 388 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 389 */ "common_expression ::= expression", - /* 390 */ "common_expression ::= boolean_value_expression", - /* 391 */ "from_clause_opt ::=", - /* 392 */ "from_clause_opt ::= FROM table_reference_list", - /* 393 */ "table_reference_list ::= table_reference", - /* 394 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 395 */ "table_reference ::= table_primary", - /* 396 */ "table_reference ::= joined_table", - /* 397 */ "table_primary ::= table_name alias_opt", - /* 398 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 399 */ "table_primary ::= subquery alias_opt", - /* 400 */ "table_primary ::= parenthesized_joined_table", - /* 401 */ "alias_opt ::=", - /* 402 */ "alias_opt ::= table_alias", - /* 403 */ "alias_opt ::= AS table_alias", - /* 404 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 405 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 406 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 407 */ "join_type ::=", - /* 408 */ "join_type ::= INNER", - /* 409 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", - /* 410 */ "set_quantifier_opt ::=", - /* 411 */ "set_quantifier_opt ::= DISTINCT", - /* 412 */ "set_quantifier_opt ::= ALL", - /* 413 */ "select_list ::= NK_STAR", - /* 414 */ "select_list ::= select_sublist", - /* 415 */ "select_sublist ::= select_item", - /* 416 */ "select_sublist ::= select_sublist NK_COMMA select_item", - /* 417 */ "select_item ::= common_expression", - /* 418 */ "select_item ::= common_expression column_alias", - /* 419 */ "select_item ::= common_expression AS column_alias", - /* 420 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 421 */ "where_clause_opt ::=", - /* 422 */ "where_clause_opt ::= WHERE search_condition", - /* 423 */ "partition_by_clause_opt ::=", - /* 424 */ "partition_by_clause_opt ::= PARTITION BY expression_list", - /* 425 */ "twindow_clause_opt ::=", - /* 426 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 427 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", - /* 428 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 429 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 430 */ "sliding_opt ::=", - /* 431 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 432 */ "fill_opt ::=", - /* 433 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 434 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 435 */ "fill_mode ::= NONE", - /* 436 */ "fill_mode ::= PREV", - /* 437 */ "fill_mode ::= NULL", - /* 438 */ "fill_mode ::= LINEAR", - /* 439 */ "fill_mode ::= NEXT", - /* 440 */ "group_by_clause_opt ::=", - /* 441 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 442 */ "group_by_list ::= expression", - /* 443 */ "group_by_list ::= group_by_list NK_COMMA expression", - /* 444 */ "having_clause_opt ::=", - /* 445 */ "having_clause_opt ::= HAVING search_condition", - /* 446 */ "range_opt ::=", - /* 447 */ "range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP", - /* 448 */ "every_opt ::=", - /* 449 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 450 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 451 */ "query_expression_body ::= query_primary", - /* 452 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", - /* 453 */ "query_expression_body ::= query_expression_body UNION query_expression_body", - /* 454 */ "query_primary ::= query_specification", - /* 455 */ "query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP", - /* 456 */ "order_by_clause_opt ::=", - /* 457 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 458 */ "slimit_clause_opt ::=", - /* 459 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 460 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 461 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 462 */ "limit_clause_opt ::=", - /* 463 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 464 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 465 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 466 */ "subquery ::= NK_LP query_expression NK_RP", - /* 467 */ "search_condition ::= common_expression", - /* 468 */ "sort_specification_list ::= sort_specification", - /* 469 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 470 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", - /* 471 */ "ordering_specification_opt ::=", - /* 472 */ "ordering_specification_opt ::= ASC", - /* 473 */ "ordering_specification_opt ::= DESC", - /* 474 */ "null_ordering_opt ::=", - /* 475 */ "null_ordering_opt ::= NULLS FIRST", - /* 476 */ "null_ordering_opt ::= NULLS LAST", + /* 353 */ "noarg_func ::= DATABASE", + /* 354 */ "noarg_func ::= CLIENT_VERSION", + /* 355 */ "noarg_func ::= SERVER_VERSION", + /* 356 */ "noarg_func ::= SERVER_STATUS", + /* 357 */ "noarg_func ::= CURRENT_USER", + /* 358 */ "noarg_func ::= USER", + /* 359 */ "star_func ::= COUNT", + /* 360 */ "star_func ::= FIRST", + /* 361 */ "star_func ::= LAST", + /* 362 */ "star_func ::= LAST_ROW", + /* 363 */ "star_func_para_list ::= NK_STAR", + /* 364 */ "star_func_para_list ::= other_para_list", + /* 365 */ "other_para_list ::= star_func_para", + /* 366 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 367 */ "star_func_para ::= expression", + /* 368 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 369 */ "predicate ::= expression compare_op expression", + /* 370 */ "predicate ::= expression BETWEEN expression AND expression", + /* 371 */ "predicate ::= expression NOT BETWEEN expression AND expression", + /* 372 */ "predicate ::= expression IS NULL", + /* 373 */ "predicate ::= expression IS NOT NULL", + /* 374 */ "predicate ::= expression in_op in_predicate_value", + /* 375 */ "compare_op ::= NK_LT", + /* 376 */ "compare_op ::= NK_GT", + /* 377 */ "compare_op ::= NK_LE", + /* 378 */ "compare_op ::= NK_GE", + /* 379 */ "compare_op ::= NK_NE", + /* 380 */ "compare_op ::= NK_EQ", + /* 381 */ "compare_op ::= LIKE", + /* 382 */ "compare_op ::= NOT LIKE", + /* 383 */ "compare_op ::= MATCH", + /* 384 */ "compare_op ::= NMATCH", + /* 385 */ "compare_op ::= CONTAINS", + /* 386 */ "in_op ::= IN", + /* 387 */ "in_op ::= NOT IN", + /* 388 */ "in_predicate_value ::= NK_LP expression_list NK_RP", + /* 389 */ "boolean_value_expression ::= boolean_primary", + /* 390 */ "boolean_value_expression ::= NOT boolean_primary", + /* 391 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 392 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 393 */ "boolean_primary ::= predicate", + /* 394 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 395 */ "common_expression ::= expression", + /* 396 */ "common_expression ::= boolean_value_expression", + /* 397 */ "from_clause_opt ::=", + /* 398 */ "from_clause_opt ::= FROM table_reference_list", + /* 399 */ "table_reference_list ::= table_reference", + /* 400 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 401 */ "table_reference ::= table_primary", + /* 402 */ "table_reference ::= joined_table", + /* 403 */ "table_primary ::= table_name alias_opt", + /* 404 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 405 */ "table_primary ::= subquery alias_opt", + /* 406 */ "table_primary ::= parenthesized_joined_table", + /* 407 */ "alias_opt ::=", + /* 408 */ "alias_opt ::= table_alias", + /* 409 */ "alias_opt ::= AS table_alias", + /* 410 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 411 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 412 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 413 */ "join_type ::=", + /* 414 */ "join_type ::= INNER", + /* 415 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", + /* 416 */ "set_quantifier_opt ::=", + /* 417 */ "set_quantifier_opt ::= DISTINCT", + /* 418 */ "set_quantifier_opt ::= ALL", + /* 419 */ "select_list ::= NK_STAR", + /* 420 */ "select_list ::= select_sublist", + /* 421 */ "select_sublist ::= select_item", + /* 422 */ "select_sublist ::= select_sublist NK_COMMA select_item", + /* 423 */ "select_item ::= common_expression", + /* 424 */ "select_item ::= common_expression column_alias", + /* 425 */ "select_item ::= common_expression AS column_alias", + /* 426 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 427 */ "where_clause_opt ::=", + /* 428 */ "where_clause_opt ::= WHERE search_condition", + /* 429 */ "partition_by_clause_opt ::=", + /* 430 */ "partition_by_clause_opt ::= PARTITION BY expression_list", + /* 431 */ "twindow_clause_opt ::=", + /* 432 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 433 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", + /* 434 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 435 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 436 */ "sliding_opt ::=", + /* 437 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 438 */ "fill_opt ::=", + /* 439 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 440 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 441 */ "fill_mode ::= NONE", + /* 442 */ "fill_mode ::= PREV", + /* 443 */ "fill_mode ::= NULL", + /* 444 */ "fill_mode ::= LINEAR", + /* 445 */ "fill_mode ::= NEXT", + /* 446 */ "group_by_clause_opt ::=", + /* 447 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 448 */ "group_by_list ::= expression", + /* 449 */ "group_by_list ::= group_by_list NK_COMMA expression", + /* 450 */ "having_clause_opt ::=", + /* 451 */ "having_clause_opt ::= HAVING search_condition", + /* 452 */ "range_opt ::=", + /* 453 */ "range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP", + /* 454 */ "every_opt ::=", + /* 455 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 456 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 457 */ "query_expression_body ::= query_primary", + /* 458 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", + /* 459 */ "query_expression_body ::= query_expression_body UNION query_expression_body", + /* 460 */ "query_primary ::= query_specification", + /* 461 */ "query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP", + /* 462 */ "order_by_clause_opt ::=", + /* 463 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 464 */ "slimit_clause_opt ::=", + /* 465 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 466 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 467 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 468 */ "limit_clause_opt ::=", + /* 469 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 470 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 471 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 472 */ "subquery ::= NK_LP query_expression NK_RP", + /* 473 */ "search_condition ::= common_expression", + /* 474 */ "sort_specification_list ::= sort_specification", + /* 475 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 476 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", + /* 477 */ "ordering_specification_opt ::=", + /* 478 */ "ordering_specification_opt ::= ASC", + /* 479 */ "ordering_specification_opt ::= DESC", + /* 480 */ "null_ordering_opt ::=", + /* 481 */ "null_ordering_opt ::= NULLS FIRST", + /* 482 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -2165,182 +2235,182 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 246: /* cmd */ - case 249: /* literal */ - case 260: /* db_options */ - case 262: /* alter_db_options */ - case 267: /* retention */ - case 268: /* full_table_name */ - case 271: /* table_options */ - case 275: /* alter_table_clause */ - case 276: /* alter_table_options */ - case 279: /* signed_literal */ - case 280: /* create_subtable_clause */ - case 283: /* drop_table_clause */ - case 286: /* column_def */ - case 290: /* duration_literal */ - case 291: /* rollup_func_name */ - case 293: /* col_name */ - case 294: /* db_name_cond_opt */ - case 295: /* like_pattern_opt */ - case 296: /* table_name_cond */ - case 297: /* from_db_opt */ - case 299: /* index_options */ - case 301: /* sliding_opt */ - case 302: /* sma_stream_opt */ - case 303: /* func */ - case 305: /* stream_options */ - case 307: /* query_expression */ - case 310: /* explain_options */ - case 314: /* into_opt */ - case 316: /* where_clause_opt */ - case 317: /* signed */ - case 318: /* literal_func */ - case 321: /* expression */ - case 322: /* pseudo_column */ - case 323: /* column_reference */ - case 324: /* function_expression */ - case 325: /* subquery */ - case 330: /* star_func_para */ - case 331: /* predicate */ - case 334: /* in_predicate_value */ - case 335: /* boolean_value_expression */ - case 336: /* boolean_primary */ - case 337: /* common_expression */ - case 338: /* from_clause_opt */ - case 339: /* table_reference_list */ - case 340: /* table_reference */ - case 341: /* table_primary */ - case 342: /* joined_table */ - case 344: /* parenthesized_joined_table */ - case 346: /* search_condition */ - case 347: /* query_specification */ - case 351: /* range_opt */ - case 352: /* every_opt */ - case 353: /* fill_opt */ - case 354: /* twindow_clause_opt */ - case 356: /* having_clause_opt */ - case 358: /* select_item */ - case 361: /* query_expression_body */ - case 363: /* slimit_clause_opt */ - case 364: /* limit_clause_opt */ - case 365: /* query_primary */ - case 367: /* sort_specification */ + case 250: /* cmd */ + case 253: /* literal */ + case 264: /* db_options */ + case 266: /* alter_db_options */ + case 271: /* retention */ + case 272: /* full_table_name */ + case 275: /* table_options */ + case 279: /* alter_table_clause */ + case 280: /* alter_table_options */ + case 283: /* signed_literal */ + case 284: /* create_subtable_clause */ + case 287: /* drop_table_clause */ + case 290: /* column_def */ + case 294: /* duration_literal */ + case 295: /* rollup_func_name */ + case 297: /* col_name */ + case 298: /* db_name_cond_opt */ + case 299: /* like_pattern_opt */ + case 300: /* table_name_cond */ + case 301: /* from_db_opt */ + case 303: /* index_options */ + case 305: /* sliding_opt */ + case 306: /* sma_stream_opt */ + case 307: /* func */ + case 309: /* stream_options */ + case 311: /* query_expression */ + case 314: /* explain_options */ + case 318: /* into_opt */ + case 320: /* where_clause_opt */ + case 321: /* signed */ + case 322: /* literal_func */ + case 325: /* expression */ + case 326: /* pseudo_column */ + case 327: /* column_reference */ + case 328: /* function_expression */ + case 329: /* subquery */ + case 334: /* star_func_para */ + case 335: /* predicate */ + case 338: /* in_predicate_value */ + case 339: /* boolean_value_expression */ + case 340: /* boolean_primary */ + case 341: /* common_expression */ + case 342: /* from_clause_opt */ + case 343: /* table_reference_list */ + case 344: /* table_reference */ + case 345: /* table_primary */ + case 346: /* joined_table */ + case 348: /* parenthesized_joined_table */ + case 350: /* search_condition */ + case 351: /* query_specification */ + case 355: /* range_opt */ + case 356: /* every_opt */ + case 357: /* fill_opt */ + case 358: /* twindow_clause_opt */ + case 360: /* having_clause_opt */ + case 362: /* select_item */ + case 365: /* query_expression_body */ + case 367: /* slimit_clause_opt */ + case 368: /* limit_clause_opt */ + case 369: /* query_primary */ + case 371: /* sort_specification */ { - nodesDestroyNode((yypminor->yy452)); + nodesDestroyNode((yypminor->yy652)); } break; - case 247: /* account_options */ - case 248: /* alter_account_options */ - case 250: /* alter_account_option */ - case 312: /* bufsize_opt */ + case 251: /* account_options */ + case 252: /* alter_account_options */ + case 254: /* alter_account_option */ + case 316: /* bufsize_opt */ { } break; - case 251: /* user_name */ - case 254: /* priv_level */ - case 257: /* db_name */ - case 258: /* dnode_endpoint */ - case 277: /* column_name */ - case 285: /* table_name */ - case 292: /* function_name */ - case 298: /* index_name */ - case 306: /* topic_name */ - case 308: /* cgroup_name */ - case 313: /* stream_name */ - case 319: /* table_alias */ - case 320: /* column_alias */ - case 326: /* star_func */ - case 328: /* noarg_func */ - case 343: /* alias_opt */ + case 255: /* user_name */ + case 258: /* priv_level */ + case 261: /* db_name */ + case 262: /* dnode_endpoint */ + case 281: /* column_name */ + case 289: /* table_name */ + case 296: /* function_name */ + case 302: /* index_name */ + case 310: /* topic_name */ + case 312: /* cgroup_name */ + case 317: /* stream_name */ + case 323: /* table_alias */ + case 324: /* column_alias */ + case 330: /* star_func */ + case 332: /* noarg_func */ + case 347: /* alias_opt */ { } break; - case 252: /* sysinfo_opt */ + case 256: /* sysinfo_opt */ { } break; - case 253: /* privileges */ - case 255: /* priv_type_list */ - case 256: /* priv_type */ + case 257: /* privileges */ + case 259: /* priv_type_list */ + case 260: /* priv_type */ { } break; - case 259: /* not_exists_opt */ - case 261: /* exists_opt */ - case 309: /* analyze_opt */ - case 311: /* agg_func_opt */ - case 348: /* set_quantifier_opt */ + case 263: /* not_exists_opt */ + case 265: /* exists_opt */ + case 313: /* analyze_opt */ + case 315: /* agg_func_opt */ + case 352: /* set_quantifier_opt */ { } break; - case 263: /* integer_list */ - case 264: /* variable_list */ - case 265: /* retention_list */ - case 269: /* column_def_list */ - case 270: /* tags_def_opt */ - case 272: /* multi_create_clause */ - case 273: /* tags_def */ - case 274: /* multi_drop_clause */ - case 281: /* specific_tags_opt */ - case 282: /* literal_list */ - case 284: /* col_name_list */ - case 287: /* duration_list */ - case 288: /* rollup_func_list */ - case 300: /* func_list */ - case 304: /* expression_list */ - case 315: /* dnode_list */ - case 327: /* star_func_para_list */ - case 329: /* other_para_list */ - case 349: /* select_list */ - case 350: /* partition_by_clause_opt */ - case 355: /* group_by_clause_opt */ - case 357: /* select_sublist */ - case 360: /* group_by_list */ - case 362: /* order_by_clause_opt */ - case 366: /* sort_specification_list */ + case 267: /* integer_list */ + case 268: /* variable_list */ + case 269: /* retention_list */ + case 273: /* column_def_list */ + case 274: /* tags_def_opt */ + case 276: /* multi_create_clause */ + case 277: /* tags_def */ + case 278: /* multi_drop_clause */ + case 285: /* specific_tags_opt */ + case 286: /* literal_list */ + case 288: /* col_name_list */ + case 291: /* duration_list */ + case 292: /* rollup_func_list */ + case 304: /* func_list */ + case 308: /* expression_list */ + case 319: /* dnode_list */ + case 331: /* star_func_para_list */ + case 333: /* other_para_list */ + case 353: /* select_list */ + case 354: /* partition_by_clause_opt */ + case 359: /* group_by_clause_opt */ + case 361: /* select_sublist */ + case 364: /* group_by_list */ + case 366: /* order_by_clause_opt */ + case 370: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy404)); + nodesDestroyList((yypminor->yy24)); } break; - case 266: /* alter_db_option */ - case 289: /* alter_table_option */ + case 270: /* alter_db_option */ + case 293: /* alter_table_option */ { } break; - case 278: /* type_name */ + case 282: /* type_name */ { } break; - case 332: /* compare_op */ - case 333: /* in_op */ + case 336: /* compare_op */ + case 337: /* in_op */ { } break; - case 345: /* join_type */ + case 349: /* join_type */ { } break; - case 359: /* fill_mode */ + case 363: /* fill_mode */ { } break; - case 368: /* ordering_specification_opt */ + case 372: /* ordering_specification_opt */ { } break; - case 369: /* null_ordering_opt */ + case 373: /* null_ordering_opt */ { } @@ -2639,483 +2709,489 @@ static const struct { YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ signed char nrhs; /* Negative of the number of RHS symbols in the rule */ } yyRuleInfo[] = { - { 246, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ - { 246, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ - { 247, 0 }, /* (2) account_options ::= */ - { 247, -3 }, /* (3) account_options ::= account_options PPS literal */ - { 247, -3 }, /* (4) account_options ::= account_options TSERIES literal */ - { 247, -3 }, /* (5) account_options ::= account_options STORAGE literal */ - { 247, -3 }, /* (6) account_options ::= account_options STREAMS literal */ - { 247, -3 }, /* (7) account_options ::= account_options QTIME literal */ - { 247, -3 }, /* (8) account_options ::= account_options DBS literal */ - { 247, -3 }, /* (9) account_options ::= account_options USERS literal */ - { 247, -3 }, /* (10) account_options ::= account_options CONNS literal */ - { 247, -3 }, /* (11) account_options ::= account_options STATE literal */ - { 248, -1 }, /* (12) alter_account_options ::= alter_account_option */ - { 248, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ - { 250, -2 }, /* (14) alter_account_option ::= PASS literal */ - { 250, -2 }, /* (15) alter_account_option ::= PPS literal */ - { 250, -2 }, /* (16) alter_account_option ::= TSERIES literal */ - { 250, -2 }, /* (17) alter_account_option ::= STORAGE literal */ - { 250, -2 }, /* (18) alter_account_option ::= STREAMS literal */ - { 250, -2 }, /* (19) alter_account_option ::= QTIME literal */ - { 250, -2 }, /* (20) alter_account_option ::= DBS literal */ - { 250, -2 }, /* (21) alter_account_option ::= USERS literal */ - { 250, -2 }, /* (22) alter_account_option ::= CONNS literal */ - { 250, -2 }, /* (23) alter_account_option ::= STATE literal */ - { 246, -6 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ - { 246, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ - { 246, -5 }, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ - { 246, -5 }, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ - { 246, -3 }, /* (28) cmd ::= DROP USER user_name */ - { 252, 0 }, /* (29) sysinfo_opt ::= */ - { 252, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */ - { 246, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */ - { 246, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */ - { 253, -1 }, /* (33) privileges ::= ALL */ - { 253, -1 }, /* (34) privileges ::= priv_type_list */ - { 255, -1 }, /* (35) priv_type_list ::= priv_type */ - { 255, -3 }, /* (36) priv_type_list ::= priv_type_list NK_COMMA priv_type */ - { 256, -1 }, /* (37) priv_type ::= READ */ - { 256, -1 }, /* (38) priv_type ::= WRITE */ - { 254, -3 }, /* (39) priv_level ::= NK_STAR NK_DOT NK_STAR */ - { 254, -3 }, /* (40) priv_level ::= db_name NK_DOT NK_STAR */ - { 246, -3 }, /* (41) cmd ::= CREATE DNODE dnode_endpoint */ - { 246, -5 }, /* (42) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ - { 246, -3 }, /* (43) cmd ::= DROP DNODE NK_INTEGER */ - { 246, -3 }, /* (44) cmd ::= DROP DNODE dnode_endpoint */ - { 246, -4 }, /* (45) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - { 246, -5 }, /* (46) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - { 246, -4 }, /* (47) cmd ::= ALTER ALL DNODES NK_STRING */ - { 246, -5 }, /* (48) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - { 258, -1 }, /* (49) dnode_endpoint ::= NK_STRING */ - { 258, -1 }, /* (50) dnode_endpoint ::= NK_ID */ - { 258, -1 }, /* (51) dnode_endpoint ::= NK_IPTOKEN */ - { 246, -3 }, /* (52) cmd ::= ALTER LOCAL NK_STRING */ - { 246, -4 }, /* (53) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - { 246, -5 }, /* (54) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - { 246, -5 }, /* (55) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - { 246, -5 }, /* (56) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - { 246, -5 }, /* (57) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - { 246, -5 }, /* (58) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - { 246, -5 }, /* (59) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - { 246, -5 }, /* (60) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - { 246, -5 }, /* (61) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - { 246, -5 }, /* (62) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - { 246, -4 }, /* (63) cmd ::= DROP DATABASE exists_opt db_name */ - { 246, -2 }, /* (64) cmd ::= USE db_name */ - { 246, -4 }, /* (65) cmd ::= ALTER DATABASE db_name alter_db_options */ - { 259, -3 }, /* (66) not_exists_opt ::= IF NOT EXISTS */ - { 259, 0 }, /* (67) not_exists_opt ::= */ - { 261, -2 }, /* (68) exists_opt ::= IF EXISTS */ - { 261, 0 }, /* (69) exists_opt ::= */ - { 260, 0 }, /* (70) db_options ::= */ - { 260, -3 }, /* (71) db_options ::= db_options BUFFER NK_INTEGER */ - { 260, -3 }, /* (72) db_options ::= db_options CACHELAST NK_INTEGER */ - { 260, -3 }, /* (73) db_options ::= db_options COMP NK_INTEGER */ - { 260, -3 }, /* (74) db_options ::= db_options DURATION NK_INTEGER */ - { 260, -3 }, /* (75) db_options ::= db_options DURATION NK_VARIABLE */ - { 260, -3 }, /* (76) db_options ::= db_options FSYNC NK_INTEGER */ - { 260, -3 }, /* (77) db_options ::= db_options MAXROWS NK_INTEGER */ - { 260, -3 }, /* (78) db_options ::= db_options MINROWS NK_INTEGER */ - { 260, -3 }, /* (79) db_options ::= db_options KEEP integer_list */ - { 260, -3 }, /* (80) db_options ::= db_options KEEP variable_list */ - { 260, -3 }, /* (81) db_options ::= db_options PAGES NK_INTEGER */ - { 260, -3 }, /* (82) db_options ::= db_options PAGESIZE NK_INTEGER */ - { 260, -3 }, /* (83) db_options ::= db_options PRECISION NK_STRING */ - { 260, -3 }, /* (84) db_options ::= db_options REPLICA NK_INTEGER */ - { 260, -3 }, /* (85) db_options ::= db_options STRICT NK_INTEGER */ - { 260, -3 }, /* (86) db_options ::= db_options WAL NK_INTEGER */ - { 260, -3 }, /* (87) db_options ::= db_options VGROUPS NK_INTEGER */ - { 260, -3 }, /* (88) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - { 260, -3 }, /* (89) db_options ::= db_options RETENTIONS retention_list */ - { 260, -3 }, /* (90) db_options ::= db_options SCHEMALESS NK_INTEGER */ - { 262, -1 }, /* (91) alter_db_options ::= alter_db_option */ - { 262, -2 }, /* (92) alter_db_options ::= alter_db_options alter_db_option */ - { 266, -2 }, /* (93) alter_db_option ::= BUFFER NK_INTEGER */ - { 266, -2 }, /* (94) alter_db_option ::= CACHELAST NK_INTEGER */ - { 266, -2 }, /* (95) alter_db_option ::= FSYNC NK_INTEGER */ - { 266, -2 }, /* (96) alter_db_option ::= KEEP integer_list */ - { 266, -2 }, /* (97) alter_db_option ::= KEEP variable_list */ - { 266, -2 }, /* (98) alter_db_option ::= PAGES NK_INTEGER */ - { 266, -2 }, /* (99) alter_db_option ::= REPLICA NK_INTEGER */ - { 266, -2 }, /* (100) alter_db_option ::= STRICT NK_INTEGER */ - { 266, -2 }, /* (101) alter_db_option ::= WAL NK_INTEGER */ - { 263, -1 }, /* (102) integer_list ::= NK_INTEGER */ - { 263, -3 }, /* (103) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - { 264, -1 }, /* (104) variable_list ::= NK_VARIABLE */ - { 264, -3 }, /* (105) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - { 265, -1 }, /* (106) retention_list ::= retention */ - { 265, -3 }, /* (107) retention_list ::= retention_list NK_COMMA retention */ - { 267, -3 }, /* (108) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - { 246, -9 }, /* (109) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - { 246, -3 }, /* (110) cmd ::= CREATE TABLE multi_create_clause */ - { 246, -9 }, /* (111) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - { 246, -3 }, /* (112) cmd ::= DROP TABLE multi_drop_clause */ - { 246, -4 }, /* (113) cmd ::= DROP STABLE exists_opt full_table_name */ - { 246, -3 }, /* (114) cmd ::= ALTER TABLE alter_table_clause */ - { 246, -3 }, /* (115) cmd ::= ALTER STABLE alter_table_clause */ - { 275, -2 }, /* (116) alter_table_clause ::= full_table_name alter_table_options */ - { 275, -5 }, /* (117) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - { 275, -4 }, /* (118) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - { 275, -5 }, /* (119) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - { 275, -5 }, /* (120) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - { 275, -5 }, /* (121) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - { 275, -4 }, /* (122) alter_table_clause ::= full_table_name DROP TAG column_name */ - { 275, -5 }, /* (123) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - { 275, -5 }, /* (124) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - { 275, -6 }, /* (125) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ - { 272, -1 }, /* (126) multi_create_clause ::= create_subtable_clause */ - { 272, -2 }, /* (127) multi_create_clause ::= multi_create_clause create_subtable_clause */ - { 280, -10 }, /* (128) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP table_options */ - { 274, -1 }, /* (129) multi_drop_clause ::= drop_table_clause */ - { 274, -2 }, /* (130) multi_drop_clause ::= multi_drop_clause drop_table_clause */ - { 283, -2 }, /* (131) drop_table_clause ::= exists_opt full_table_name */ - { 281, 0 }, /* (132) specific_tags_opt ::= */ - { 281, -3 }, /* (133) specific_tags_opt ::= NK_LP col_name_list NK_RP */ - { 268, -1 }, /* (134) full_table_name ::= table_name */ - { 268, -3 }, /* (135) full_table_name ::= db_name NK_DOT table_name */ - { 269, -1 }, /* (136) column_def_list ::= column_def */ - { 269, -3 }, /* (137) column_def_list ::= column_def_list NK_COMMA column_def */ - { 286, -2 }, /* (138) column_def ::= column_name type_name */ - { 286, -4 }, /* (139) column_def ::= column_name type_name COMMENT NK_STRING */ - { 278, -1 }, /* (140) type_name ::= BOOL */ - { 278, -1 }, /* (141) type_name ::= TINYINT */ - { 278, -1 }, /* (142) type_name ::= SMALLINT */ - { 278, -1 }, /* (143) type_name ::= INT */ - { 278, -1 }, /* (144) type_name ::= INTEGER */ - { 278, -1 }, /* (145) type_name ::= BIGINT */ - { 278, -1 }, /* (146) type_name ::= FLOAT */ - { 278, -1 }, /* (147) type_name ::= DOUBLE */ - { 278, -4 }, /* (148) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - { 278, -1 }, /* (149) type_name ::= TIMESTAMP */ - { 278, -4 }, /* (150) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - { 278, -2 }, /* (151) type_name ::= TINYINT UNSIGNED */ - { 278, -2 }, /* (152) type_name ::= SMALLINT UNSIGNED */ - { 278, -2 }, /* (153) type_name ::= INT UNSIGNED */ - { 278, -2 }, /* (154) type_name ::= BIGINT UNSIGNED */ - { 278, -1 }, /* (155) type_name ::= JSON */ - { 278, -4 }, /* (156) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - { 278, -1 }, /* (157) type_name ::= MEDIUMBLOB */ - { 278, -1 }, /* (158) type_name ::= BLOB */ - { 278, -4 }, /* (159) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - { 278, -1 }, /* (160) type_name ::= DECIMAL */ - { 278, -4 }, /* (161) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - { 278, -6 }, /* (162) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { 270, 0 }, /* (163) tags_def_opt ::= */ - { 270, -1 }, /* (164) tags_def_opt ::= tags_def */ - { 273, -4 }, /* (165) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - { 271, 0 }, /* (166) table_options ::= */ - { 271, -3 }, /* (167) table_options ::= table_options COMMENT NK_STRING */ - { 271, -3 }, /* (168) table_options ::= table_options MAX_DELAY duration_list */ - { 271, -3 }, /* (169) table_options ::= table_options WATERMARK duration_list */ - { 271, -5 }, /* (170) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - { 271, -3 }, /* (171) table_options ::= table_options TTL NK_INTEGER */ - { 271, -5 }, /* (172) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - { 276, -1 }, /* (173) alter_table_options ::= alter_table_option */ - { 276, -2 }, /* (174) alter_table_options ::= alter_table_options alter_table_option */ - { 289, -2 }, /* (175) alter_table_option ::= COMMENT NK_STRING */ - { 289, -2 }, /* (176) alter_table_option ::= TTL NK_INTEGER */ - { 287, -1 }, /* (177) duration_list ::= duration_literal */ - { 287, -3 }, /* (178) duration_list ::= duration_list NK_COMMA duration_literal */ - { 288, -1 }, /* (179) rollup_func_list ::= rollup_func_name */ - { 288, -3 }, /* (180) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - { 291, -1 }, /* (181) rollup_func_name ::= function_name */ - { 291, -1 }, /* (182) rollup_func_name ::= FIRST */ - { 291, -1 }, /* (183) rollup_func_name ::= LAST */ - { 284, -1 }, /* (184) col_name_list ::= col_name */ - { 284, -3 }, /* (185) col_name_list ::= col_name_list NK_COMMA col_name */ - { 293, -1 }, /* (186) col_name ::= column_name */ - { 246, -2 }, /* (187) cmd ::= SHOW DNODES */ - { 246, -2 }, /* (188) cmd ::= SHOW USERS */ - { 246, -2 }, /* (189) cmd ::= SHOW DATABASES */ - { 246, -4 }, /* (190) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - { 246, -4 }, /* (191) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - { 246, -3 }, /* (192) cmd ::= SHOW db_name_cond_opt VGROUPS */ - { 246, -2 }, /* (193) cmd ::= SHOW MNODES */ - { 246, -2 }, /* (194) cmd ::= SHOW MODULES */ - { 246, -2 }, /* (195) cmd ::= SHOW QNODES */ - { 246, -2 }, /* (196) cmd ::= SHOW FUNCTIONS */ - { 246, -5 }, /* (197) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - { 246, -2 }, /* (198) cmd ::= SHOW STREAMS */ - { 246, -2 }, /* (199) cmd ::= SHOW ACCOUNTS */ - { 246, -2 }, /* (200) cmd ::= SHOW APPS */ - { 246, -2 }, /* (201) cmd ::= SHOW CONNECTIONS */ - { 246, -2 }, /* (202) cmd ::= SHOW LICENCE */ - { 246, -2 }, /* (203) cmd ::= SHOW GRANTS */ - { 246, -4 }, /* (204) cmd ::= SHOW CREATE DATABASE db_name */ - { 246, -4 }, /* (205) cmd ::= SHOW CREATE TABLE full_table_name */ - { 246, -4 }, /* (206) cmd ::= SHOW CREATE STABLE full_table_name */ - { 246, -2 }, /* (207) cmd ::= SHOW QUERIES */ - { 246, -2 }, /* (208) cmd ::= SHOW SCORES */ - { 246, -2 }, /* (209) cmd ::= SHOW TOPICS */ - { 246, -2 }, /* (210) cmd ::= SHOW VARIABLES */ - { 246, -3 }, /* (211) cmd ::= SHOW LOCAL VARIABLES */ - { 246, -4 }, /* (212) cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ - { 246, -2 }, /* (213) cmd ::= SHOW BNODES */ - { 246, -2 }, /* (214) cmd ::= SHOW SNODES */ - { 246, -2 }, /* (215) cmd ::= SHOW CLUSTER */ - { 246, -2 }, /* (216) cmd ::= SHOW TRANSACTIONS */ - { 246, -4 }, /* (217) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - { 246, -2 }, /* (218) cmd ::= SHOW CONSUMERS */ - { 246, -2 }, /* (219) cmd ::= SHOW SUBSCRIPTIONS */ - { 294, 0 }, /* (220) db_name_cond_opt ::= */ - { 294, -2 }, /* (221) db_name_cond_opt ::= db_name NK_DOT */ - { 295, 0 }, /* (222) like_pattern_opt ::= */ - { 295, -2 }, /* (223) like_pattern_opt ::= LIKE NK_STRING */ - { 296, -1 }, /* (224) table_name_cond ::= table_name */ - { 297, 0 }, /* (225) from_db_opt ::= */ - { 297, -2 }, /* (226) from_db_opt ::= FROM db_name */ - { 246, -8 }, /* (227) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ - { 246, -4 }, /* (228) cmd ::= DROP INDEX exists_opt index_name */ - { 299, -10 }, /* (229) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - { 299, -12 }, /* (230) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ - { 300, -1 }, /* (231) func_list ::= func */ - { 300, -3 }, /* (232) func_list ::= func_list NK_COMMA func */ - { 303, -4 }, /* (233) func ::= function_name NK_LP expression_list NK_RP */ - { 302, 0 }, /* (234) sma_stream_opt ::= */ - { 302, -3 }, /* (235) sma_stream_opt ::= stream_options WATERMARK duration_literal */ - { 302, -3 }, /* (236) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ - { 246, -6 }, /* (237) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ - { 246, -7 }, /* (238) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ - { 246, -9 }, /* (239) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ - { 246, -7 }, /* (240) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ - { 246, -9 }, /* (241) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ - { 246, -4 }, /* (242) cmd ::= DROP TOPIC exists_opt topic_name */ - { 246, -7 }, /* (243) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - { 246, -2 }, /* (244) cmd ::= DESC full_table_name */ - { 246, -2 }, /* (245) cmd ::= DESCRIBE full_table_name */ - { 246, -3 }, /* (246) cmd ::= RESET QUERY CACHE */ - { 246, -4 }, /* (247) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ - { 309, 0 }, /* (248) analyze_opt ::= */ - { 309, -1 }, /* (249) analyze_opt ::= ANALYZE */ - { 310, 0 }, /* (250) explain_options ::= */ - { 310, -3 }, /* (251) explain_options ::= explain_options VERBOSE NK_BOOL */ - { 310, -3 }, /* (252) explain_options ::= explain_options RATIO NK_FLOAT */ - { 246, -6 }, /* (253) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ - { 246, -10 }, /* (254) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ - { 246, -4 }, /* (255) cmd ::= DROP FUNCTION exists_opt function_name */ - { 311, 0 }, /* (256) agg_func_opt ::= */ - { 311, -1 }, /* (257) agg_func_opt ::= AGGREGATE */ - { 312, 0 }, /* (258) bufsize_opt ::= */ - { 312, -2 }, /* (259) bufsize_opt ::= BUFSIZE NK_INTEGER */ - { 246, -8 }, /* (260) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ - { 246, -4 }, /* (261) cmd ::= DROP STREAM exists_opt stream_name */ - { 314, 0 }, /* (262) into_opt ::= */ - { 314, -2 }, /* (263) into_opt ::= INTO full_table_name */ - { 305, 0 }, /* (264) stream_options ::= */ - { 305, -3 }, /* (265) stream_options ::= stream_options TRIGGER AT_ONCE */ - { 305, -3 }, /* (266) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - { 305, -4 }, /* (267) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - { 305, -3 }, /* (268) stream_options ::= stream_options WATERMARK duration_literal */ - { 246, -3 }, /* (269) cmd ::= KILL CONNECTION NK_INTEGER */ - { 246, -3 }, /* (270) cmd ::= KILL QUERY NK_STRING */ - { 246, -3 }, /* (271) cmd ::= KILL TRANSACTION NK_INTEGER */ - { 246, -2 }, /* (272) cmd ::= BALANCE VGROUP */ - { 246, -4 }, /* (273) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - { 246, -4 }, /* (274) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - { 246, -3 }, /* (275) cmd ::= SPLIT VGROUP NK_INTEGER */ - { 315, -2 }, /* (276) dnode_list ::= DNODE NK_INTEGER */ - { 315, -3 }, /* (277) dnode_list ::= dnode_list DNODE NK_INTEGER */ - { 246, -3 }, /* (278) cmd ::= SYNCDB db_name REPLICA */ - { 246, -4 }, /* (279) cmd ::= DELETE FROM full_table_name where_clause_opt */ - { 246, -1 }, /* (280) cmd ::= query_expression */ - { 249, -1 }, /* (281) literal ::= NK_INTEGER */ - { 249, -1 }, /* (282) literal ::= NK_FLOAT */ - { 249, -1 }, /* (283) literal ::= NK_STRING */ - { 249, -1 }, /* (284) literal ::= NK_BOOL */ - { 249, -2 }, /* (285) literal ::= TIMESTAMP NK_STRING */ - { 249, -1 }, /* (286) literal ::= duration_literal */ - { 249, -1 }, /* (287) literal ::= NULL */ - { 249, -1 }, /* (288) literal ::= NK_QUESTION */ - { 290, -1 }, /* (289) duration_literal ::= NK_VARIABLE */ - { 317, -1 }, /* (290) signed ::= NK_INTEGER */ - { 317, -2 }, /* (291) signed ::= NK_PLUS NK_INTEGER */ - { 317, -2 }, /* (292) signed ::= NK_MINUS NK_INTEGER */ - { 317, -1 }, /* (293) signed ::= NK_FLOAT */ - { 317, -2 }, /* (294) signed ::= NK_PLUS NK_FLOAT */ - { 317, -2 }, /* (295) signed ::= NK_MINUS NK_FLOAT */ - { 279, -1 }, /* (296) signed_literal ::= signed */ - { 279, -1 }, /* (297) signed_literal ::= NK_STRING */ - { 279, -1 }, /* (298) signed_literal ::= NK_BOOL */ - { 279, -2 }, /* (299) signed_literal ::= TIMESTAMP NK_STRING */ - { 279, -1 }, /* (300) signed_literal ::= duration_literal */ - { 279, -1 }, /* (301) signed_literal ::= NULL */ - { 279, -1 }, /* (302) signed_literal ::= literal_func */ - { 282, -1 }, /* (303) literal_list ::= signed_literal */ - { 282, -3 }, /* (304) literal_list ::= literal_list NK_COMMA signed_literal */ - { 257, -1 }, /* (305) db_name ::= NK_ID */ - { 285, -1 }, /* (306) table_name ::= NK_ID */ - { 277, -1 }, /* (307) column_name ::= NK_ID */ - { 292, -1 }, /* (308) function_name ::= NK_ID */ - { 319, -1 }, /* (309) table_alias ::= NK_ID */ - { 320, -1 }, /* (310) column_alias ::= NK_ID */ - { 251, -1 }, /* (311) user_name ::= NK_ID */ - { 298, -1 }, /* (312) index_name ::= NK_ID */ - { 306, -1 }, /* (313) topic_name ::= NK_ID */ - { 313, -1 }, /* (314) stream_name ::= NK_ID */ - { 308, -1 }, /* (315) cgroup_name ::= NK_ID */ - { 321, -1 }, /* (316) expression ::= literal */ - { 321, -1 }, /* (317) expression ::= pseudo_column */ - { 321, -1 }, /* (318) expression ::= column_reference */ - { 321, -1 }, /* (319) expression ::= function_expression */ - { 321, -1 }, /* (320) expression ::= subquery */ - { 321, -3 }, /* (321) expression ::= NK_LP expression NK_RP */ - { 321, -2 }, /* (322) expression ::= NK_PLUS expression */ - { 321, -2 }, /* (323) expression ::= NK_MINUS expression */ - { 321, -3 }, /* (324) expression ::= expression NK_PLUS expression */ - { 321, -3 }, /* (325) expression ::= expression NK_MINUS expression */ - { 321, -3 }, /* (326) expression ::= expression NK_STAR expression */ - { 321, -3 }, /* (327) expression ::= expression NK_SLASH expression */ - { 321, -3 }, /* (328) expression ::= expression NK_REM expression */ - { 321, -3 }, /* (329) expression ::= column_reference NK_ARROW NK_STRING */ - { 321, -3 }, /* (330) expression ::= expression NK_BITAND expression */ - { 321, -3 }, /* (331) expression ::= expression NK_BITOR expression */ - { 304, -1 }, /* (332) expression_list ::= expression */ - { 304, -3 }, /* (333) expression_list ::= expression_list NK_COMMA expression */ - { 323, -1 }, /* (334) column_reference ::= column_name */ - { 323, -3 }, /* (335) column_reference ::= table_name NK_DOT column_name */ - { 322, -1 }, /* (336) pseudo_column ::= ROWTS */ - { 322, -1 }, /* (337) pseudo_column ::= TBNAME */ - { 322, -3 }, /* (338) pseudo_column ::= table_name NK_DOT TBNAME */ - { 322, -1 }, /* (339) pseudo_column ::= QSTARTTS */ - { 322, -1 }, /* (340) pseudo_column ::= QENDTS */ - { 322, -1 }, /* (341) pseudo_column ::= WSTARTTS */ - { 322, -1 }, /* (342) pseudo_column ::= WENDTS */ - { 322, -1 }, /* (343) pseudo_column ::= WDURATION */ - { 324, -4 }, /* (344) function_expression ::= function_name NK_LP expression_list NK_RP */ - { 324, -4 }, /* (345) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - { 324, -6 }, /* (346) function_expression ::= CAST NK_LP expression AS type_name NK_RP */ - { 324, -1 }, /* (347) function_expression ::= literal_func */ - { 318, -3 }, /* (348) literal_func ::= noarg_func NK_LP NK_RP */ - { 318, -1 }, /* (349) literal_func ::= NOW */ - { 328, -1 }, /* (350) noarg_func ::= NOW */ - { 328, -1 }, /* (351) noarg_func ::= TODAY */ - { 328, -1 }, /* (352) noarg_func ::= TIMEZONE */ - { 326, -1 }, /* (353) star_func ::= COUNT */ - { 326, -1 }, /* (354) star_func ::= FIRST */ - { 326, -1 }, /* (355) star_func ::= LAST */ - { 326, -1 }, /* (356) star_func ::= LAST_ROW */ - { 327, -1 }, /* (357) star_func_para_list ::= NK_STAR */ - { 327, -1 }, /* (358) star_func_para_list ::= other_para_list */ - { 329, -1 }, /* (359) other_para_list ::= star_func_para */ - { 329, -3 }, /* (360) other_para_list ::= other_para_list NK_COMMA star_func_para */ - { 330, -1 }, /* (361) star_func_para ::= expression */ - { 330, -3 }, /* (362) star_func_para ::= table_name NK_DOT NK_STAR */ - { 331, -3 }, /* (363) predicate ::= expression compare_op expression */ - { 331, -5 }, /* (364) predicate ::= expression BETWEEN expression AND expression */ - { 331, -6 }, /* (365) predicate ::= expression NOT BETWEEN expression AND expression */ - { 331, -3 }, /* (366) predicate ::= expression IS NULL */ - { 331, -4 }, /* (367) predicate ::= expression IS NOT NULL */ - { 331, -3 }, /* (368) predicate ::= expression in_op in_predicate_value */ - { 332, -1 }, /* (369) compare_op ::= NK_LT */ - { 332, -1 }, /* (370) compare_op ::= NK_GT */ - { 332, -1 }, /* (371) compare_op ::= NK_LE */ - { 332, -1 }, /* (372) compare_op ::= NK_GE */ - { 332, -1 }, /* (373) compare_op ::= NK_NE */ - { 332, -1 }, /* (374) compare_op ::= NK_EQ */ - { 332, -1 }, /* (375) compare_op ::= LIKE */ - { 332, -2 }, /* (376) compare_op ::= NOT LIKE */ - { 332, -1 }, /* (377) compare_op ::= MATCH */ - { 332, -1 }, /* (378) compare_op ::= NMATCH */ - { 332, -1 }, /* (379) compare_op ::= CONTAINS */ - { 333, -1 }, /* (380) in_op ::= IN */ - { 333, -2 }, /* (381) in_op ::= NOT IN */ - { 334, -3 }, /* (382) in_predicate_value ::= NK_LP expression_list NK_RP */ - { 335, -1 }, /* (383) boolean_value_expression ::= boolean_primary */ - { 335, -2 }, /* (384) boolean_value_expression ::= NOT boolean_primary */ - { 335, -3 }, /* (385) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 335, -3 }, /* (386) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 336, -1 }, /* (387) boolean_primary ::= predicate */ - { 336, -3 }, /* (388) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 337, -1 }, /* (389) common_expression ::= expression */ - { 337, -1 }, /* (390) common_expression ::= boolean_value_expression */ - { 338, 0 }, /* (391) from_clause_opt ::= */ - { 338, -2 }, /* (392) from_clause_opt ::= FROM table_reference_list */ - { 339, -1 }, /* (393) table_reference_list ::= table_reference */ - { 339, -3 }, /* (394) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 340, -1 }, /* (395) table_reference ::= table_primary */ - { 340, -1 }, /* (396) table_reference ::= joined_table */ - { 341, -2 }, /* (397) table_primary ::= table_name alias_opt */ - { 341, -4 }, /* (398) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 341, -2 }, /* (399) table_primary ::= subquery alias_opt */ - { 341, -1 }, /* (400) table_primary ::= parenthesized_joined_table */ - { 343, 0 }, /* (401) alias_opt ::= */ - { 343, -1 }, /* (402) alias_opt ::= table_alias */ - { 343, -2 }, /* (403) alias_opt ::= AS table_alias */ - { 344, -3 }, /* (404) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 344, -3 }, /* (405) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 342, -6 }, /* (406) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 345, 0 }, /* (407) join_type ::= */ - { 345, -1 }, /* (408) join_type ::= INNER */ - { 347, -12 }, /* (409) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - { 348, 0 }, /* (410) set_quantifier_opt ::= */ - { 348, -1 }, /* (411) set_quantifier_opt ::= DISTINCT */ - { 348, -1 }, /* (412) set_quantifier_opt ::= ALL */ - { 349, -1 }, /* (413) select_list ::= NK_STAR */ - { 349, -1 }, /* (414) select_list ::= select_sublist */ - { 357, -1 }, /* (415) select_sublist ::= select_item */ - { 357, -3 }, /* (416) select_sublist ::= select_sublist NK_COMMA select_item */ - { 358, -1 }, /* (417) select_item ::= common_expression */ - { 358, -2 }, /* (418) select_item ::= common_expression column_alias */ - { 358, -3 }, /* (419) select_item ::= common_expression AS column_alias */ - { 358, -3 }, /* (420) select_item ::= table_name NK_DOT NK_STAR */ - { 316, 0 }, /* (421) where_clause_opt ::= */ - { 316, -2 }, /* (422) where_clause_opt ::= WHERE search_condition */ - { 350, 0 }, /* (423) partition_by_clause_opt ::= */ - { 350, -3 }, /* (424) partition_by_clause_opt ::= PARTITION BY expression_list */ - { 354, 0 }, /* (425) twindow_clause_opt ::= */ - { 354, -6 }, /* (426) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 354, -4 }, /* (427) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ - { 354, -6 }, /* (428) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 354, -8 }, /* (429) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 301, 0 }, /* (430) sliding_opt ::= */ - { 301, -4 }, /* (431) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 353, 0 }, /* (432) fill_opt ::= */ - { 353, -4 }, /* (433) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 353, -6 }, /* (434) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 359, -1 }, /* (435) fill_mode ::= NONE */ - { 359, -1 }, /* (436) fill_mode ::= PREV */ - { 359, -1 }, /* (437) fill_mode ::= NULL */ - { 359, -1 }, /* (438) fill_mode ::= LINEAR */ - { 359, -1 }, /* (439) fill_mode ::= NEXT */ - { 355, 0 }, /* (440) group_by_clause_opt ::= */ - { 355, -3 }, /* (441) group_by_clause_opt ::= GROUP BY group_by_list */ - { 360, -1 }, /* (442) group_by_list ::= expression */ - { 360, -3 }, /* (443) group_by_list ::= group_by_list NK_COMMA expression */ - { 356, 0 }, /* (444) having_clause_opt ::= */ - { 356, -2 }, /* (445) having_clause_opt ::= HAVING search_condition */ - { 351, 0 }, /* (446) range_opt ::= */ - { 351, -6 }, /* (447) range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ - { 352, 0 }, /* (448) every_opt ::= */ - { 352, -4 }, /* (449) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - { 307, -4 }, /* (450) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 361, -1 }, /* (451) query_expression_body ::= query_primary */ - { 361, -4 }, /* (452) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ - { 361, -3 }, /* (453) query_expression_body ::= query_expression_body UNION query_expression_body */ - { 365, -1 }, /* (454) query_primary ::= query_specification */ - { 365, -6 }, /* (455) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ - { 362, 0 }, /* (456) order_by_clause_opt ::= */ - { 362, -3 }, /* (457) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 363, 0 }, /* (458) slimit_clause_opt ::= */ - { 363, -2 }, /* (459) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 363, -4 }, /* (460) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 363, -4 }, /* (461) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 364, 0 }, /* (462) limit_clause_opt ::= */ - { 364, -2 }, /* (463) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 364, -4 }, /* (464) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 364, -4 }, /* (465) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 325, -3 }, /* (466) subquery ::= NK_LP query_expression NK_RP */ - { 346, -1 }, /* (467) search_condition ::= common_expression */ - { 366, -1 }, /* (468) sort_specification_list ::= sort_specification */ - { 366, -3 }, /* (469) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 367, -3 }, /* (470) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ - { 368, 0 }, /* (471) ordering_specification_opt ::= */ - { 368, -1 }, /* (472) ordering_specification_opt ::= ASC */ - { 368, -1 }, /* (473) ordering_specification_opt ::= DESC */ - { 369, 0 }, /* (474) null_ordering_opt ::= */ - { 369, -2 }, /* (475) null_ordering_opt ::= NULLS FIRST */ - { 369, -2 }, /* (476) null_ordering_opt ::= NULLS LAST */ + { 250, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ + { 250, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ + { 251, 0 }, /* (2) account_options ::= */ + { 251, -3 }, /* (3) account_options ::= account_options PPS literal */ + { 251, -3 }, /* (4) account_options ::= account_options TSERIES literal */ + { 251, -3 }, /* (5) account_options ::= account_options STORAGE literal */ + { 251, -3 }, /* (6) account_options ::= account_options STREAMS literal */ + { 251, -3 }, /* (7) account_options ::= account_options QTIME literal */ + { 251, -3 }, /* (8) account_options ::= account_options DBS literal */ + { 251, -3 }, /* (9) account_options ::= account_options USERS literal */ + { 251, -3 }, /* (10) account_options ::= account_options CONNS literal */ + { 251, -3 }, /* (11) account_options ::= account_options STATE literal */ + { 252, -1 }, /* (12) alter_account_options ::= alter_account_option */ + { 252, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ + { 254, -2 }, /* (14) alter_account_option ::= PASS literal */ + { 254, -2 }, /* (15) alter_account_option ::= PPS literal */ + { 254, -2 }, /* (16) alter_account_option ::= TSERIES literal */ + { 254, -2 }, /* (17) alter_account_option ::= STORAGE literal */ + { 254, -2 }, /* (18) alter_account_option ::= STREAMS literal */ + { 254, -2 }, /* (19) alter_account_option ::= QTIME literal */ + { 254, -2 }, /* (20) alter_account_option ::= DBS literal */ + { 254, -2 }, /* (21) alter_account_option ::= USERS literal */ + { 254, -2 }, /* (22) alter_account_option ::= CONNS literal */ + { 254, -2 }, /* (23) alter_account_option ::= STATE literal */ + { 250, -6 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ + { 250, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ + { 250, -5 }, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ + { 250, -5 }, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ + { 250, -3 }, /* (28) cmd ::= DROP USER user_name */ + { 256, 0 }, /* (29) sysinfo_opt ::= */ + { 256, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */ + { 250, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */ + { 250, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */ + { 257, -1 }, /* (33) privileges ::= ALL */ + { 257, -1 }, /* (34) privileges ::= priv_type_list */ + { 259, -1 }, /* (35) priv_type_list ::= priv_type */ + { 259, -3 }, /* (36) priv_type_list ::= priv_type_list NK_COMMA priv_type */ + { 260, -1 }, /* (37) priv_type ::= READ */ + { 260, -1 }, /* (38) priv_type ::= WRITE */ + { 258, -3 }, /* (39) priv_level ::= NK_STAR NK_DOT NK_STAR */ + { 258, -3 }, /* (40) priv_level ::= db_name NK_DOT NK_STAR */ + { 250, -3 }, /* (41) cmd ::= CREATE DNODE dnode_endpoint */ + { 250, -5 }, /* (42) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ + { 250, -3 }, /* (43) cmd ::= DROP DNODE NK_INTEGER */ + { 250, -3 }, /* (44) cmd ::= DROP DNODE dnode_endpoint */ + { 250, -4 }, /* (45) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + { 250, -5 }, /* (46) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + { 250, -4 }, /* (47) cmd ::= ALTER ALL DNODES NK_STRING */ + { 250, -5 }, /* (48) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + { 262, -1 }, /* (49) dnode_endpoint ::= NK_STRING */ + { 262, -1 }, /* (50) dnode_endpoint ::= NK_ID */ + { 262, -1 }, /* (51) dnode_endpoint ::= NK_IPTOKEN */ + { 250, -3 }, /* (52) cmd ::= ALTER LOCAL NK_STRING */ + { 250, -4 }, /* (53) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + { 250, -5 }, /* (54) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + { 250, -5 }, /* (55) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + { 250, -5 }, /* (56) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + { 250, -5 }, /* (57) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + { 250, -5 }, /* (58) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + { 250, -5 }, /* (59) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + { 250, -5 }, /* (60) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + { 250, -5 }, /* (61) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + { 250, -5 }, /* (62) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + { 250, -4 }, /* (63) cmd ::= DROP DATABASE exists_opt db_name */ + { 250, -2 }, /* (64) cmd ::= USE db_name */ + { 250, -4 }, /* (65) cmd ::= ALTER DATABASE db_name alter_db_options */ + { 263, -3 }, /* (66) not_exists_opt ::= IF NOT EXISTS */ + { 263, 0 }, /* (67) not_exists_opt ::= */ + { 265, -2 }, /* (68) exists_opt ::= IF EXISTS */ + { 265, 0 }, /* (69) exists_opt ::= */ + { 264, 0 }, /* (70) db_options ::= */ + { 264, -3 }, /* (71) db_options ::= db_options BUFFER NK_INTEGER */ + { 264, -3 }, /* (72) db_options ::= db_options CACHELAST NK_INTEGER */ + { 264, -3 }, /* (73) db_options ::= db_options COMP NK_INTEGER */ + { 264, -3 }, /* (74) db_options ::= db_options DURATION NK_INTEGER */ + { 264, -3 }, /* (75) db_options ::= db_options DURATION NK_VARIABLE */ + { 264, -3 }, /* (76) db_options ::= db_options FSYNC NK_INTEGER */ + { 264, -3 }, /* (77) db_options ::= db_options MAXROWS NK_INTEGER */ + { 264, -3 }, /* (78) db_options ::= db_options MINROWS NK_INTEGER */ + { 264, -3 }, /* (79) db_options ::= db_options KEEP integer_list */ + { 264, -3 }, /* (80) db_options ::= db_options KEEP variable_list */ + { 264, -3 }, /* (81) db_options ::= db_options PAGES NK_INTEGER */ + { 264, -3 }, /* (82) db_options ::= db_options PAGESIZE NK_INTEGER */ + { 264, -3 }, /* (83) db_options ::= db_options PRECISION NK_STRING */ + { 264, -3 }, /* (84) db_options ::= db_options REPLICA NK_INTEGER */ + { 264, -3 }, /* (85) db_options ::= db_options STRICT NK_INTEGER */ + { 264, -3 }, /* (86) db_options ::= db_options WAL NK_INTEGER */ + { 264, -3 }, /* (87) db_options ::= db_options VGROUPS NK_INTEGER */ + { 264, -3 }, /* (88) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + { 264, -3 }, /* (89) db_options ::= db_options RETENTIONS retention_list */ + { 264, -3 }, /* (90) db_options ::= db_options SCHEMALESS NK_INTEGER */ + { 266, -1 }, /* (91) alter_db_options ::= alter_db_option */ + { 266, -2 }, /* (92) alter_db_options ::= alter_db_options alter_db_option */ + { 270, -2 }, /* (93) alter_db_option ::= BUFFER NK_INTEGER */ + { 270, -2 }, /* (94) alter_db_option ::= CACHELAST NK_INTEGER */ + { 270, -2 }, /* (95) alter_db_option ::= FSYNC NK_INTEGER */ + { 270, -2 }, /* (96) alter_db_option ::= KEEP integer_list */ + { 270, -2 }, /* (97) alter_db_option ::= KEEP variable_list */ + { 270, -2 }, /* (98) alter_db_option ::= PAGES NK_INTEGER */ + { 270, -2 }, /* (99) alter_db_option ::= REPLICA NK_INTEGER */ + { 270, -2 }, /* (100) alter_db_option ::= STRICT NK_INTEGER */ + { 270, -2 }, /* (101) alter_db_option ::= WAL NK_INTEGER */ + { 267, -1 }, /* (102) integer_list ::= NK_INTEGER */ + { 267, -3 }, /* (103) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + { 268, -1 }, /* (104) variable_list ::= NK_VARIABLE */ + { 268, -3 }, /* (105) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + { 269, -1 }, /* (106) retention_list ::= retention */ + { 269, -3 }, /* (107) retention_list ::= retention_list NK_COMMA retention */ + { 271, -3 }, /* (108) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + { 250, -9 }, /* (109) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + { 250, -3 }, /* (110) cmd ::= CREATE TABLE multi_create_clause */ + { 250, -9 }, /* (111) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + { 250, -3 }, /* (112) cmd ::= DROP TABLE multi_drop_clause */ + { 250, -4 }, /* (113) cmd ::= DROP STABLE exists_opt full_table_name */ + { 250, -3 }, /* (114) cmd ::= ALTER TABLE alter_table_clause */ + { 250, -3 }, /* (115) cmd ::= ALTER STABLE alter_table_clause */ + { 279, -2 }, /* (116) alter_table_clause ::= full_table_name alter_table_options */ + { 279, -5 }, /* (117) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + { 279, -4 }, /* (118) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + { 279, -5 }, /* (119) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + { 279, -5 }, /* (120) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + { 279, -5 }, /* (121) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + { 279, -4 }, /* (122) alter_table_clause ::= full_table_name DROP TAG column_name */ + { 279, -5 }, /* (123) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + { 279, -5 }, /* (124) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + { 279, -6 }, /* (125) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + { 276, -1 }, /* (126) multi_create_clause ::= create_subtable_clause */ + { 276, -2 }, /* (127) multi_create_clause ::= multi_create_clause create_subtable_clause */ + { 284, -10 }, /* (128) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP table_options */ + { 278, -1 }, /* (129) multi_drop_clause ::= drop_table_clause */ + { 278, -2 }, /* (130) multi_drop_clause ::= multi_drop_clause drop_table_clause */ + { 287, -2 }, /* (131) drop_table_clause ::= exists_opt full_table_name */ + { 285, 0 }, /* (132) specific_tags_opt ::= */ + { 285, -3 }, /* (133) specific_tags_opt ::= NK_LP col_name_list NK_RP */ + { 272, -1 }, /* (134) full_table_name ::= table_name */ + { 272, -3 }, /* (135) full_table_name ::= db_name NK_DOT table_name */ + { 273, -1 }, /* (136) column_def_list ::= column_def */ + { 273, -3 }, /* (137) column_def_list ::= column_def_list NK_COMMA column_def */ + { 290, -2 }, /* (138) column_def ::= column_name type_name */ + { 290, -4 }, /* (139) column_def ::= column_name type_name COMMENT NK_STRING */ + { 282, -1 }, /* (140) type_name ::= BOOL */ + { 282, -1 }, /* (141) type_name ::= TINYINT */ + { 282, -1 }, /* (142) type_name ::= SMALLINT */ + { 282, -1 }, /* (143) type_name ::= INT */ + { 282, -1 }, /* (144) type_name ::= INTEGER */ + { 282, -1 }, /* (145) type_name ::= BIGINT */ + { 282, -1 }, /* (146) type_name ::= FLOAT */ + { 282, -1 }, /* (147) type_name ::= DOUBLE */ + { 282, -4 }, /* (148) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + { 282, -1 }, /* (149) type_name ::= TIMESTAMP */ + { 282, -4 }, /* (150) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + { 282, -2 }, /* (151) type_name ::= TINYINT UNSIGNED */ + { 282, -2 }, /* (152) type_name ::= SMALLINT UNSIGNED */ + { 282, -2 }, /* (153) type_name ::= INT UNSIGNED */ + { 282, -2 }, /* (154) type_name ::= BIGINT UNSIGNED */ + { 282, -1 }, /* (155) type_name ::= JSON */ + { 282, -4 }, /* (156) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + { 282, -1 }, /* (157) type_name ::= MEDIUMBLOB */ + { 282, -1 }, /* (158) type_name ::= BLOB */ + { 282, -4 }, /* (159) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + { 282, -1 }, /* (160) type_name ::= DECIMAL */ + { 282, -4 }, /* (161) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + { 282, -6 }, /* (162) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + { 274, 0 }, /* (163) tags_def_opt ::= */ + { 274, -1 }, /* (164) tags_def_opt ::= tags_def */ + { 277, -4 }, /* (165) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + { 275, 0 }, /* (166) table_options ::= */ + { 275, -3 }, /* (167) table_options ::= table_options COMMENT NK_STRING */ + { 275, -3 }, /* (168) table_options ::= table_options MAX_DELAY duration_list */ + { 275, -3 }, /* (169) table_options ::= table_options WATERMARK duration_list */ + { 275, -5 }, /* (170) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + { 275, -3 }, /* (171) table_options ::= table_options TTL NK_INTEGER */ + { 275, -5 }, /* (172) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + { 280, -1 }, /* (173) alter_table_options ::= alter_table_option */ + { 280, -2 }, /* (174) alter_table_options ::= alter_table_options alter_table_option */ + { 293, -2 }, /* (175) alter_table_option ::= COMMENT NK_STRING */ + { 293, -2 }, /* (176) alter_table_option ::= TTL NK_INTEGER */ + { 291, -1 }, /* (177) duration_list ::= duration_literal */ + { 291, -3 }, /* (178) duration_list ::= duration_list NK_COMMA duration_literal */ + { 292, -1 }, /* (179) rollup_func_list ::= rollup_func_name */ + { 292, -3 }, /* (180) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + { 295, -1 }, /* (181) rollup_func_name ::= function_name */ + { 295, -1 }, /* (182) rollup_func_name ::= FIRST */ + { 295, -1 }, /* (183) rollup_func_name ::= LAST */ + { 288, -1 }, /* (184) col_name_list ::= col_name */ + { 288, -3 }, /* (185) col_name_list ::= col_name_list NK_COMMA col_name */ + { 297, -1 }, /* (186) col_name ::= column_name */ + { 250, -2 }, /* (187) cmd ::= SHOW DNODES */ + { 250, -2 }, /* (188) cmd ::= SHOW USERS */ + { 250, -2 }, /* (189) cmd ::= SHOW DATABASES */ + { 250, -4 }, /* (190) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + { 250, -4 }, /* (191) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + { 250, -3 }, /* (192) cmd ::= SHOW db_name_cond_opt VGROUPS */ + { 250, -2 }, /* (193) cmd ::= SHOW MNODES */ + { 250, -2 }, /* (194) cmd ::= SHOW MODULES */ + { 250, -2 }, /* (195) cmd ::= SHOW QNODES */ + { 250, -2 }, /* (196) cmd ::= SHOW FUNCTIONS */ + { 250, -5 }, /* (197) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + { 250, -2 }, /* (198) cmd ::= SHOW STREAMS */ + { 250, -2 }, /* (199) cmd ::= SHOW ACCOUNTS */ + { 250, -2 }, /* (200) cmd ::= SHOW APPS */ + { 250, -2 }, /* (201) cmd ::= SHOW CONNECTIONS */ + { 250, -2 }, /* (202) cmd ::= SHOW LICENCE */ + { 250, -2 }, /* (203) cmd ::= SHOW GRANTS */ + { 250, -4 }, /* (204) cmd ::= SHOW CREATE DATABASE db_name */ + { 250, -4 }, /* (205) cmd ::= SHOW CREATE TABLE full_table_name */ + { 250, -4 }, /* (206) cmd ::= SHOW CREATE STABLE full_table_name */ + { 250, -2 }, /* (207) cmd ::= SHOW QUERIES */ + { 250, -2 }, /* (208) cmd ::= SHOW SCORES */ + { 250, -2 }, /* (209) cmd ::= SHOW TOPICS */ + { 250, -2 }, /* (210) cmd ::= SHOW VARIABLES */ + { 250, -3 }, /* (211) cmd ::= SHOW LOCAL VARIABLES */ + { 250, -4 }, /* (212) cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ + { 250, -2 }, /* (213) cmd ::= SHOW BNODES */ + { 250, -2 }, /* (214) cmd ::= SHOW SNODES */ + { 250, -2 }, /* (215) cmd ::= SHOW CLUSTER */ + { 250, -2 }, /* (216) cmd ::= SHOW TRANSACTIONS */ + { 250, -4 }, /* (217) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + { 250, -2 }, /* (218) cmd ::= SHOW CONSUMERS */ + { 250, -2 }, /* (219) cmd ::= SHOW SUBSCRIPTIONS */ + { 298, 0 }, /* (220) db_name_cond_opt ::= */ + { 298, -2 }, /* (221) db_name_cond_opt ::= db_name NK_DOT */ + { 299, 0 }, /* (222) like_pattern_opt ::= */ + { 299, -2 }, /* (223) like_pattern_opt ::= LIKE NK_STRING */ + { 300, -1 }, /* (224) table_name_cond ::= table_name */ + { 301, 0 }, /* (225) from_db_opt ::= */ + { 301, -2 }, /* (226) from_db_opt ::= FROM db_name */ + { 250, -8 }, /* (227) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ + { 250, -4 }, /* (228) cmd ::= DROP INDEX exists_opt index_name */ + { 303, -10 }, /* (229) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + { 303, -12 }, /* (230) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ + { 304, -1 }, /* (231) func_list ::= func */ + { 304, -3 }, /* (232) func_list ::= func_list NK_COMMA func */ + { 307, -4 }, /* (233) func ::= function_name NK_LP expression_list NK_RP */ + { 306, 0 }, /* (234) sma_stream_opt ::= */ + { 306, -3 }, /* (235) sma_stream_opt ::= stream_options WATERMARK duration_literal */ + { 306, -3 }, /* (236) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ + { 250, -6 }, /* (237) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ + { 250, -7 }, /* (238) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ + { 250, -9 }, /* (239) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ + { 250, -7 }, /* (240) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ + { 250, -9 }, /* (241) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ + { 250, -4 }, /* (242) cmd ::= DROP TOPIC exists_opt topic_name */ + { 250, -7 }, /* (243) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + { 250, -2 }, /* (244) cmd ::= DESC full_table_name */ + { 250, -2 }, /* (245) cmd ::= DESCRIBE full_table_name */ + { 250, -3 }, /* (246) cmd ::= RESET QUERY CACHE */ + { 250, -4 }, /* (247) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ + { 313, 0 }, /* (248) analyze_opt ::= */ + { 313, -1 }, /* (249) analyze_opt ::= ANALYZE */ + { 314, 0 }, /* (250) explain_options ::= */ + { 314, -3 }, /* (251) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 314, -3 }, /* (252) explain_options ::= explain_options RATIO NK_FLOAT */ + { 250, -6 }, /* (253) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ + { 250, -10 }, /* (254) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + { 250, -4 }, /* (255) cmd ::= DROP FUNCTION exists_opt function_name */ + { 315, 0 }, /* (256) agg_func_opt ::= */ + { 315, -1 }, /* (257) agg_func_opt ::= AGGREGATE */ + { 316, 0 }, /* (258) bufsize_opt ::= */ + { 316, -2 }, /* (259) bufsize_opt ::= BUFSIZE NK_INTEGER */ + { 250, -8 }, /* (260) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ + { 250, -4 }, /* (261) cmd ::= DROP STREAM exists_opt stream_name */ + { 318, 0 }, /* (262) into_opt ::= */ + { 318, -2 }, /* (263) into_opt ::= INTO full_table_name */ + { 309, 0 }, /* (264) stream_options ::= */ + { 309, -3 }, /* (265) stream_options ::= stream_options TRIGGER AT_ONCE */ + { 309, -3 }, /* (266) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + { 309, -4 }, /* (267) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + { 309, -3 }, /* (268) stream_options ::= stream_options WATERMARK duration_literal */ + { 250, -3 }, /* (269) cmd ::= KILL CONNECTION NK_INTEGER */ + { 250, -3 }, /* (270) cmd ::= KILL QUERY NK_STRING */ + { 250, -3 }, /* (271) cmd ::= KILL TRANSACTION NK_INTEGER */ + { 250, -2 }, /* (272) cmd ::= BALANCE VGROUP */ + { 250, -4 }, /* (273) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + { 250, -4 }, /* (274) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + { 250, -3 }, /* (275) cmd ::= SPLIT VGROUP NK_INTEGER */ + { 319, -2 }, /* (276) dnode_list ::= DNODE NK_INTEGER */ + { 319, -3 }, /* (277) dnode_list ::= dnode_list DNODE NK_INTEGER */ + { 250, -3 }, /* (278) cmd ::= SYNCDB db_name REPLICA */ + { 250, -4 }, /* (279) cmd ::= DELETE FROM full_table_name where_clause_opt */ + { 250, -1 }, /* (280) cmd ::= query_expression */ + { 253, -1 }, /* (281) literal ::= NK_INTEGER */ + { 253, -1 }, /* (282) literal ::= NK_FLOAT */ + { 253, -1 }, /* (283) literal ::= NK_STRING */ + { 253, -1 }, /* (284) literal ::= NK_BOOL */ + { 253, -2 }, /* (285) literal ::= TIMESTAMP NK_STRING */ + { 253, -1 }, /* (286) literal ::= duration_literal */ + { 253, -1 }, /* (287) literal ::= NULL */ + { 253, -1 }, /* (288) literal ::= NK_QUESTION */ + { 294, -1 }, /* (289) duration_literal ::= NK_VARIABLE */ + { 321, -1 }, /* (290) signed ::= NK_INTEGER */ + { 321, -2 }, /* (291) signed ::= NK_PLUS NK_INTEGER */ + { 321, -2 }, /* (292) signed ::= NK_MINUS NK_INTEGER */ + { 321, -1 }, /* (293) signed ::= NK_FLOAT */ + { 321, -2 }, /* (294) signed ::= NK_PLUS NK_FLOAT */ + { 321, -2 }, /* (295) signed ::= NK_MINUS NK_FLOAT */ + { 283, -1 }, /* (296) signed_literal ::= signed */ + { 283, -1 }, /* (297) signed_literal ::= NK_STRING */ + { 283, -1 }, /* (298) signed_literal ::= NK_BOOL */ + { 283, -2 }, /* (299) signed_literal ::= TIMESTAMP NK_STRING */ + { 283, -1 }, /* (300) signed_literal ::= duration_literal */ + { 283, -1 }, /* (301) signed_literal ::= NULL */ + { 283, -1 }, /* (302) signed_literal ::= literal_func */ + { 286, -1 }, /* (303) literal_list ::= signed_literal */ + { 286, -3 }, /* (304) literal_list ::= literal_list NK_COMMA signed_literal */ + { 261, -1 }, /* (305) db_name ::= NK_ID */ + { 289, -1 }, /* (306) table_name ::= NK_ID */ + { 281, -1 }, /* (307) column_name ::= NK_ID */ + { 296, -1 }, /* (308) function_name ::= NK_ID */ + { 323, -1 }, /* (309) table_alias ::= NK_ID */ + { 324, -1 }, /* (310) column_alias ::= NK_ID */ + { 255, -1 }, /* (311) user_name ::= NK_ID */ + { 302, -1 }, /* (312) index_name ::= NK_ID */ + { 310, -1 }, /* (313) topic_name ::= NK_ID */ + { 317, -1 }, /* (314) stream_name ::= NK_ID */ + { 312, -1 }, /* (315) cgroup_name ::= NK_ID */ + { 325, -1 }, /* (316) expression ::= literal */ + { 325, -1 }, /* (317) expression ::= pseudo_column */ + { 325, -1 }, /* (318) expression ::= column_reference */ + { 325, -1 }, /* (319) expression ::= function_expression */ + { 325, -1 }, /* (320) expression ::= subquery */ + { 325, -3 }, /* (321) expression ::= NK_LP expression NK_RP */ + { 325, -2 }, /* (322) expression ::= NK_PLUS expression */ + { 325, -2 }, /* (323) expression ::= NK_MINUS expression */ + { 325, -3 }, /* (324) expression ::= expression NK_PLUS expression */ + { 325, -3 }, /* (325) expression ::= expression NK_MINUS expression */ + { 325, -3 }, /* (326) expression ::= expression NK_STAR expression */ + { 325, -3 }, /* (327) expression ::= expression NK_SLASH expression */ + { 325, -3 }, /* (328) expression ::= expression NK_REM expression */ + { 325, -3 }, /* (329) expression ::= column_reference NK_ARROW NK_STRING */ + { 325, -3 }, /* (330) expression ::= expression NK_BITAND expression */ + { 325, -3 }, /* (331) expression ::= expression NK_BITOR expression */ + { 308, -1 }, /* (332) expression_list ::= expression */ + { 308, -3 }, /* (333) expression_list ::= expression_list NK_COMMA expression */ + { 327, -1 }, /* (334) column_reference ::= column_name */ + { 327, -3 }, /* (335) column_reference ::= table_name NK_DOT column_name */ + { 326, -1 }, /* (336) pseudo_column ::= ROWTS */ + { 326, -1 }, /* (337) pseudo_column ::= TBNAME */ + { 326, -3 }, /* (338) pseudo_column ::= table_name NK_DOT TBNAME */ + { 326, -1 }, /* (339) pseudo_column ::= QSTARTTS */ + { 326, -1 }, /* (340) pseudo_column ::= QENDTS */ + { 326, -1 }, /* (341) pseudo_column ::= WSTARTTS */ + { 326, -1 }, /* (342) pseudo_column ::= WENDTS */ + { 326, -1 }, /* (343) pseudo_column ::= WDURATION */ + { 328, -4 }, /* (344) function_expression ::= function_name NK_LP expression_list NK_RP */ + { 328, -4 }, /* (345) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + { 328, -6 }, /* (346) function_expression ::= CAST NK_LP expression AS type_name NK_RP */ + { 328, -1 }, /* (347) function_expression ::= literal_func */ + { 322, -3 }, /* (348) literal_func ::= noarg_func NK_LP NK_RP */ + { 322, -1 }, /* (349) literal_func ::= NOW */ + { 332, -1 }, /* (350) noarg_func ::= NOW */ + { 332, -1 }, /* (351) noarg_func ::= TODAY */ + { 332, -1 }, /* (352) noarg_func ::= TIMEZONE */ + { 332, -1 }, /* (353) noarg_func ::= DATABASE */ + { 332, -1 }, /* (354) noarg_func ::= CLIENT_VERSION */ + { 332, -1 }, /* (355) noarg_func ::= SERVER_VERSION */ + { 332, -1 }, /* (356) noarg_func ::= SERVER_STATUS */ + { 332, -1 }, /* (357) noarg_func ::= CURRENT_USER */ + { 332, -1 }, /* (358) noarg_func ::= USER */ + { 330, -1 }, /* (359) star_func ::= COUNT */ + { 330, -1 }, /* (360) star_func ::= FIRST */ + { 330, -1 }, /* (361) star_func ::= LAST */ + { 330, -1 }, /* (362) star_func ::= LAST_ROW */ + { 331, -1 }, /* (363) star_func_para_list ::= NK_STAR */ + { 331, -1 }, /* (364) star_func_para_list ::= other_para_list */ + { 333, -1 }, /* (365) other_para_list ::= star_func_para */ + { 333, -3 }, /* (366) other_para_list ::= other_para_list NK_COMMA star_func_para */ + { 334, -1 }, /* (367) star_func_para ::= expression */ + { 334, -3 }, /* (368) star_func_para ::= table_name NK_DOT NK_STAR */ + { 335, -3 }, /* (369) predicate ::= expression compare_op expression */ + { 335, -5 }, /* (370) predicate ::= expression BETWEEN expression AND expression */ + { 335, -6 }, /* (371) predicate ::= expression NOT BETWEEN expression AND expression */ + { 335, -3 }, /* (372) predicate ::= expression IS NULL */ + { 335, -4 }, /* (373) predicate ::= expression IS NOT NULL */ + { 335, -3 }, /* (374) predicate ::= expression in_op in_predicate_value */ + { 336, -1 }, /* (375) compare_op ::= NK_LT */ + { 336, -1 }, /* (376) compare_op ::= NK_GT */ + { 336, -1 }, /* (377) compare_op ::= NK_LE */ + { 336, -1 }, /* (378) compare_op ::= NK_GE */ + { 336, -1 }, /* (379) compare_op ::= NK_NE */ + { 336, -1 }, /* (380) compare_op ::= NK_EQ */ + { 336, -1 }, /* (381) compare_op ::= LIKE */ + { 336, -2 }, /* (382) compare_op ::= NOT LIKE */ + { 336, -1 }, /* (383) compare_op ::= MATCH */ + { 336, -1 }, /* (384) compare_op ::= NMATCH */ + { 336, -1 }, /* (385) compare_op ::= CONTAINS */ + { 337, -1 }, /* (386) in_op ::= IN */ + { 337, -2 }, /* (387) in_op ::= NOT IN */ + { 338, -3 }, /* (388) in_predicate_value ::= NK_LP expression_list NK_RP */ + { 339, -1 }, /* (389) boolean_value_expression ::= boolean_primary */ + { 339, -2 }, /* (390) boolean_value_expression ::= NOT boolean_primary */ + { 339, -3 }, /* (391) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 339, -3 }, /* (392) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 340, -1 }, /* (393) boolean_primary ::= predicate */ + { 340, -3 }, /* (394) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 341, -1 }, /* (395) common_expression ::= expression */ + { 341, -1 }, /* (396) common_expression ::= boolean_value_expression */ + { 342, 0 }, /* (397) from_clause_opt ::= */ + { 342, -2 }, /* (398) from_clause_opt ::= FROM table_reference_list */ + { 343, -1 }, /* (399) table_reference_list ::= table_reference */ + { 343, -3 }, /* (400) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 344, -1 }, /* (401) table_reference ::= table_primary */ + { 344, -1 }, /* (402) table_reference ::= joined_table */ + { 345, -2 }, /* (403) table_primary ::= table_name alias_opt */ + { 345, -4 }, /* (404) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 345, -2 }, /* (405) table_primary ::= subquery alias_opt */ + { 345, -1 }, /* (406) table_primary ::= parenthesized_joined_table */ + { 347, 0 }, /* (407) alias_opt ::= */ + { 347, -1 }, /* (408) alias_opt ::= table_alias */ + { 347, -2 }, /* (409) alias_opt ::= AS table_alias */ + { 348, -3 }, /* (410) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 348, -3 }, /* (411) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 346, -6 }, /* (412) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 349, 0 }, /* (413) join_type ::= */ + { 349, -1 }, /* (414) join_type ::= INNER */ + { 351, -12 }, /* (415) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + { 352, 0 }, /* (416) set_quantifier_opt ::= */ + { 352, -1 }, /* (417) set_quantifier_opt ::= DISTINCT */ + { 352, -1 }, /* (418) set_quantifier_opt ::= ALL */ + { 353, -1 }, /* (419) select_list ::= NK_STAR */ + { 353, -1 }, /* (420) select_list ::= select_sublist */ + { 361, -1 }, /* (421) select_sublist ::= select_item */ + { 361, -3 }, /* (422) select_sublist ::= select_sublist NK_COMMA select_item */ + { 362, -1 }, /* (423) select_item ::= common_expression */ + { 362, -2 }, /* (424) select_item ::= common_expression column_alias */ + { 362, -3 }, /* (425) select_item ::= common_expression AS column_alias */ + { 362, -3 }, /* (426) select_item ::= table_name NK_DOT NK_STAR */ + { 320, 0 }, /* (427) where_clause_opt ::= */ + { 320, -2 }, /* (428) where_clause_opt ::= WHERE search_condition */ + { 354, 0 }, /* (429) partition_by_clause_opt ::= */ + { 354, -3 }, /* (430) partition_by_clause_opt ::= PARTITION BY expression_list */ + { 358, 0 }, /* (431) twindow_clause_opt ::= */ + { 358, -6 }, /* (432) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 358, -4 }, /* (433) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ + { 358, -6 }, /* (434) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 358, -8 }, /* (435) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 305, 0 }, /* (436) sliding_opt ::= */ + { 305, -4 }, /* (437) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 357, 0 }, /* (438) fill_opt ::= */ + { 357, -4 }, /* (439) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 357, -6 }, /* (440) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 363, -1 }, /* (441) fill_mode ::= NONE */ + { 363, -1 }, /* (442) fill_mode ::= PREV */ + { 363, -1 }, /* (443) fill_mode ::= NULL */ + { 363, -1 }, /* (444) fill_mode ::= LINEAR */ + { 363, -1 }, /* (445) fill_mode ::= NEXT */ + { 359, 0 }, /* (446) group_by_clause_opt ::= */ + { 359, -3 }, /* (447) group_by_clause_opt ::= GROUP BY group_by_list */ + { 364, -1 }, /* (448) group_by_list ::= expression */ + { 364, -3 }, /* (449) group_by_list ::= group_by_list NK_COMMA expression */ + { 360, 0 }, /* (450) having_clause_opt ::= */ + { 360, -2 }, /* (451) having_clause_opt ::= HAVING search_condition */ + { 355, 0 }, /* (452) range_opt ::= */ + { 355, -6 }, /* (453) range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ + { 356, 0 }, /* (454) every_opt ::= */ + { 356, -4 }, /* (455) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + { 311, -4 }, /* (456) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 365, -1 }, /* (457) query_expression_body ::= query_primary */ + { 365, -4 }, /* (458) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ + { 365, -3 }, /* (459) query_expression_body ::= query_expression_body UNION query_expression_body */ + { 369, -1 }, /* (460) query_primary ::= query_specification */ + { 369, -6 }, /* (461) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ + { 366, 0 }, /* (462) order_by_clause_opt ::= */ + { 366, -3 }, /* (463) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 367, 0 }, /* (464) slimit_clause_opt ::= */ + { 367, -2 }, /* (465) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 367, -4 }, /* (466) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 367, -4 }, /* (467) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 368, 0 }, /* (468) limit_clause_opt ::= */ + { 368, -2 }, /* (469) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 368, -4 }, /* (470) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 368, -4 }, /* (471) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 329, -3 }, /* (472) subquery ::= NK_LP query_expression NK_RP */ + { 350, -1 }, /* (473) search_condition ::= common_expression */ + { 370, -1 }, /* (474) sort_specification_list ::= sort_specification */ + { 370, -3 }, /* (475) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 371, -3 }, /* (476) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ + { 372, 0 }, /* (477) ordering_specification_opt ::= */ + { 372, -1 }, /* (478) ordering_specification_opt ::= ASC */ + { 372, -1 }, /* (479) ordering_specification_opt ::= DESC */ + { 373, 0 }, /* (480) null_ordering_opt ::= */ + { 373, -2 }, /* (481) null_ordering_opt ::= NULLS FIRST */ + { 373, -2 }, /* (482) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -3204,11 +3280,11 @@ static YYACTIONTYPE yy_reduce( YYMINORTYPE yylhsminor; case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,247,&yymsp[0].minor); + yy_destructor(yypParser,251,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,248,&yymsp[0].minor); + yy_destructor(yypParser,252,&yymsp[0].minor); break; case 2: /* account_options ::= */ { } @@ -3222,20 +3298,20 @@ static YYACTIONTYPE yy_reduce( case 9: /* account_options ::= account_options USERS literal */ yytestcase(yyruleno==9); case 10: /* account_options ::= account_options CONNS literal */ yytestcase(yyruleno==10); case 11: /* account_options ::= account_options STATE literal */ yytestcase(yyruleno==11); -{ yy_destructor(yypParser,247,&yymsp[-2].minor); +{ yy_destructor(yypParser,251,&yymsp[-2].minor); { } - yy_destructor(yypParser,249,&yymsp[0].minor); + yy_destructor(yypParser,253,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,250,&yymsp[0].minor); +{ yy_destructor(yypParser,254,&yymsp[0].minor); { } } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,248,&yymsp[-1].minor); +{ yy_destructor(yypParser,252,&yymsp[-1].minor); { } - yy_destructor(yypParser,250,&yymsp[0].minor); + yy_destructor(yypParser,254,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -3249,72 +3325,72 @@ static YYACTIONTYPE yy_reduce( case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22); case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); { } - yy_destructor(yypParser,249,&yymsp[0].minor); + yy_destructor(yypParser,253,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy109, &yymsp[-1].minor.yy0, yymsp[0].minor.yy323); } +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy657, &yymsp[-1].minor.yy0, yymsp[0].minor.yy619); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy109, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy657, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 26: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy109, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy657, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } break; case 27: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy109, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy657, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } break; case 28: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy109); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy657); } break; case 29: /* sysinfo_opt ::= */ -{ yymsp[1].minor.yy323 = 1; } +{ yymsp[1].minor.yy619 = 1; } break; case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ -{ yymsp[-1].minor.yy323 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy619 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } break; case 31: /* cmd ::= GRANT privileges ON priv_level TO user_name */ -{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy209, &yymsp[-2].minor.yy109, &yymsp[0].minor.yy109); } +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy701, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy657); } break; case 32: /* cmd ::= REVOKE privileges ON priv_level FROM user_name */ -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy209, &yymsp[-2].minor.yy109, &yymsp[0].minor.yy109); } +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy701, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy657); } break; case 33: /* privileges ::= ALL */ -{ yymsp[0].minor.yy209 = PRIVILEGE_TYPE_ALL; } +{ yymsp[0].minor.yy701 = PRIVILEGE_TYPE_ALL; } break; case 34: /* privileges ::= priv_type_list */ case 35: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==35); -{ yylhsminor.yy209 = yymsp[0].minor.yy209; } - yymsp[0].minor.yy209 = yylhsminor.yy209; +{ yylhsminor.yy701 = yymsp[0].minor.yy701; } + yymsp[0].minor.yy701 = yylhsminor.yy701; break; case 36: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -{ yylhsminor.yy209 = yymsp[-2].minor.yy209 | yymsp[0].minor.yy209; } - yymsp[-2].minor.yy209 = yylhsminor.yy209; +{ yylhsminor.yy701 = yymsp[-2].minor.yy701 | yymsp[0].minor.yy701; } + yymsp[-2].minor.yy701 = yylhsminor.yy701; break; case 37: /* priv_type ::= READ */ -{ yymsp[0].minor.yy209 = PRIVILEGE_TYPE_READ; } +{ yymsp[0].minor.yy701 = PRIVILEGE_TYPE_READ; } break; case 38: /* priv_type ::= WRITE */ -{ yymsp[0].minor.yy209 = PRIVILEGE_TYPE_WRITE; } +{ yymsp[0].minor.yy701 = PRIVILEGE_TYPE_WRITE; } break; case 39: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -{ yylhsminor.yy109 = yymsp[-2].minor.yy0; } - yymsp[-2].minor.yy109 = yylhsminor.yy109; +{ yylhsminor.yy657 = yymsp[-2].minor.yy0; } + yymsp[-2].minor.yy657 = yylhsminor.yy657; break; case 40: /* priv_level ::= db_name NK_DOT NK_STAR */ -{ yylhsminor.yy109 = yymsp[-2].minor.yy109; } - yymsp[-2].minor.yy109 = yylhsminor.yy109; +{ yylhsminor.yy657 = yymsp[-2].minor.yy657; } + yymsp[-2].minor.yy657 = yylhsminor.yy657; break; case 41: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy109, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy657, NULL); } break; case 42: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy109, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy0); } break; case 43: /* cmd ::= DROP DNODE NK_INTEGER */ { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy0); } break; case 44: /* cmd ::= DROP DNODE dnode_endpoint */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy109); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy657); } break; case 45: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -3345,12 +3421,18 @@ static YYACTIONTYPE yy_reduce( case 350: /* noarg_func ::= NOW */ yytestcase(yyruleno==350); case 351: /* noarg_func ::= TODAY */ yytestcase(yyruleno==351); case 352: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==352); - case 353: /* star_func ::= COUNT */ yytestcase(yyruleno==353); - case 354: /* star_func ::= FIRST */ yytestcase(yyruleno==354); - case 355: /* star_func ::= LAST */ yytestcase(yyruleno==355); - case 356: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==356); -{ yylhsminor.yy109 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy109 = yylhsminor.yy109; + case 353: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==353); + case 354: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==354); + case 355: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==355); + case 356: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==356); + case 357: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==357); + case 358: /* noarg_func ::= USER */ yytestcase(yyruleno==358); + case 359: /* star_func ::= COUNT */ yytestcase(yyruleno==359); + case 360: /* star_func ::= FIRST */ yytestcase(yyruleno==360); + case 361: /* star_func ::= LAST */ yytestcase(yyruleno==361); + case 362: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==362); +{ yylhsminor.yy657 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy657 = yylhsminor.yy657; break; case 52: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -3383,156 +3465,156 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } break; case 62: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy437, &yymsp[-1].minor.yy109, yymsp[0].minor.yy452); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy97, &yymsp[-1].minor.yy657, yymsp[0].minor.yy652); } break; case 63: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy437, &yymsp[0].minor.yy109); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy97, &yymsp[0].minor.yy657); } break; case 64: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy109); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy657); } break; case 65: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy109, yymsp[0].minor.yy452); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy657, yymsp[0].minor.yy652); } break; case 66: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy437 = true; } +{ yymsp[-2].minor.yy97 = true; } break; case 67: /* not_exists_opt ::= */ case 69: /* exists_opt ::= */ yytestcase(yyruleno==69); case 248: /* analyze_opt ::= */ yytestcase(yyruleno==248); case 256: /* agg_func_opt ::= */ yytestcase(yyruleno==256); - case 410: /* set_quantifier_opt ::= */ yytestcase(yyruleno==410); -{ yymsp[1].minor.yy437 = false; } + case 416: /* set_quantifier_opt ::= */ yytestcase(yyruleno==416); +{ yymsp[1].minor.yy97 = false; } break; case 68: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy437 = true; } +{ yymsp[-1].minor.yy97 = true; } break; case 70: /* db_options ::= */ -{ yymsp[1].minor.yy452 = createDefaultDatabaseOptions(pCxt); } +{ yymsp[1].minor.yy652 = createDefaultDatabaseOptions(pCxt); } break; case 71: /* db_options ::= db_options BUFFER NK_INTEGER */ -{ yylhsminor.yy452 = setDatabaseOption(pCxt, yymsp[-2].minor.yy452, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 72: /* db_options ::= db_options CACHELAST NK_INTEGER */ -{ yylhsminor.yy452 = setDatabaseOption(pCxt, yymsp[-2].minor.yy452, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 73: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy452 = setDatabaseOption(pCxt, yymsp[-2].minor.yy452, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 74: /* db_options ::= db_options DURATION NK_INTEGER */ case 75: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==75); -{ yylhsminor.yy452 = setDatabaseOption(pCxt, yymsp[-2].minor.yy452, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 76: /* db_options ::= db_options FSYNC NK_INTEGER */ -{ yylhsminor.yy452 = setDatabaseOption(pCxt, yymsp[-2].minor.yy452, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 77: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy452 = setDatabaseOption(pCxt, yymsp[-2].minor.yy452, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 78: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy452 = setDatabaseOption(pCxt, yymsp[-2].minor.yy452, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 79: /* db_options ::= db_options KEEP integer_list */ case 80: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==80); -{ yylhsminor.yy452 = setDatabaseOption(pCxt, yymsp[-2].minor.yy452, DB_OPTION_KEEP, yymsp[0].minor.yy404); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_KEEP, yymsp[0].minor.yy24); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 81: /* db_options ::= db_options PAGES NK_INTEGER */ -{ yylhsminor.yy452 = setDatabaseOption(pCxt, yymsp[-2].minor.yy452, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 82: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -{ yylhsminor.yy452 = setDatabaseOption(pCxt, yymsp[-2].minor.yy452, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 83: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy452 = setDatabaseOption(pCxt, yymsp[-2].minor.yy452, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 84: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy452 = setDatabaseOption(pCxt, yymsp[-2].minor.yy452, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 85: /* db_options ::= db_options STRICT NK_INTEGER */ -{ yylhsminor.yy452 = setDatabaseOption(pCxt, yymsp[-2].minor.yy452, DB_OPTION_STRICT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_STRICT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 86: /* db_options ::= db_options WAL NK_INTEGER */ -{ yylhsminor.yy452 = setDatabaseOption(pCxt, yymsp[-2].minor.yy452, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 87: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy452 = setDatabaseOption(pCxt, yymsp[-2].minor.yy452, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 88: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy452 = setDatabaseOption(pCxt, yymsp[-2].minor.yy452, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 89: /* db_options ::= db_options RETENTIONS retention_list */ -{ yylhsminor.yy452 = setDatabaseOption(pCxt, yymsp[-2].minor.yy452, DB_OPTION_RETENTIONS, yymsp[0].minor.yy404); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_RETENTIONS, yymsp[0].minor.yy24); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 90: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -{ yylhsminor.yy452 = setDatabaseOption(pCxt, yymsp[-2].minor.yy452, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 91: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy452 = createAlterDatabaseOptions(pCxt); yylhsminor.yy452 = setAlterDatabaseOption(pCxt, yylhsminor.yy452, &yymsp[0].minor.yy85); } - yymsp[0].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createAlterDatabaseOptions(pCxt); yylhsminor.yy652 = setAlterDatabaseOption(pCxt, yylhsminor.yy652, &yymsp[0].minor.yy189); } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 92: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy452 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy452, &yymsp[0].minor.yy85); } - yymsp[-1].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy652, &yymsp[0].minor.yy189); } + yymsp[-1].minor.yy652 = yylhsminor.yy652; break; case 93: /* alter_db_option ::= BUFFER NK_INTEGER */ -{ yymsp[-1].minor.yy85.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy85.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy189.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } break; case 94: /* alter_db_option ::= CACHELAST NK_INTEGER */ -{ yymsp[-1].minor.yy85.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy85.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy189.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } break; case 95: /* alter_db_option ::= FSYNC NK_INTEGER */ -{ yymsp[-1].minor.yy85.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy85.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy189.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } break; case 96: /* alter_db_option ::= KEEP integer_list */ case 97: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==97); -{ yymsp[-1].minor.yy85.type = DB_OPTION_KEEP; yymsp[-1].minor.yy85.pList = yymsp[0].minor.yy404; } +{ yymsp[-1].minor.yy189.type = DB_OPTION_KEEP; yymsp[-1].minor.yy189.pList = yymsp[0].minor.yy24; } break; case 98: /* alter_db_option ::= PAGES NK_INTEGER */ -{ yymsp[-1].minor.yy85.type = DB_OPTION_PAGES; yymsp[-1].minor.yy85.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy189.type = DB_OPTION_PAGES; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } break; case 99: /* alter_db_option ::= REPLICA NK_INTEGER */ -{ yymsp[-1].minor.yy85.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy85.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy189.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } break; case 100: /* alter_db_option ::= STRICT NK_INTEGER */ -{ yymsp[-1].minor.yy85.type = DB_OPTION_STRICT; yymsp[-1].minor.yy85.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy189.type = DB_OPTION_STRICT; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } break; case 101: /* alter_db_option ::= WAL NK_INTEGER */ -{ yymsp[-1].minor.yy85.type = DB_OPTION_WAL; yymsp[-1].minor.yy85.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy189.type = DB_OPTION_WAL; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } break; case 102: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy404 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy404 = yylhsminor.yy404; +{ yylhsminor.yy24 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy24 = yylhsminor.yy24; break; case 103: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ case 277: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==277); -{ yylhsminor.yy404 = addNodeToList(pCxt, yymsp[-2].minor.yy404, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy404 = yylhsminor.yy404; +{ yylhsminor.yy24 = addNodeToList(pCxt, yymsp[-2].minor.yy24, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; case 104: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy404 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy404 = yylhsminor.yy404; +{ yylhsminor.yy24 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy24 = yylhsminor.yy24; break; case 105: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -{ yylhsminor.yy404 = addNodeToList(pCxt, yymsp[-2].minor.yy404, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy404 = yylhsminor.yy404; +{ yylhsminor.yy24 = addNodeToList(pCxt, yymsp[-2].minor.yy24, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; case 106: /* retention_list ::= retention */ case 126: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==126); @@ -3542,11 +3624,11 @@ static YYACTIONTYPE yy_reduce( case 184: /* col_name_list ::= col_name */ yytestcase(yyruleno==184); case 231: /* func_list ::= func */ yytestcase(yyruleno==231); case 303: /* literal_list ::= signed_literal */ yytestcase(yyruleno==303); - case 359: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==359); - case 415: /* select_sublist ::= select_item */ yytestcase(yyruleno==415); - case 468: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==468); -{ yylhsminor.yy404 = createNodeList(pCxt, yymsp[0].minor.yy452); } - yymsp[0].minor.yy404 = yylhsminor.yy404; + case 365: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==365); + case 421: /* select_sublist ::= select_item */ yytestcase(yyruleno==421); + case 474: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==474); +{ yylhsminor.yy24 = createNodeList(pCxt, yymsp[0].minor.yy652); } + yymsp[0].minor.yy24 = yylhsminor.yy24; break; case 107: /* retention_list ::= retention_list NK_COMMA retention */ case 137: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==137); @@ -3554,252 +3636,252 @@ static YYACTIONTYPE yy_reduce( case 185: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==185); case 232: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==232); case 304: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==304); - case 360: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==360); - case 416: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==416); - case 469: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==469); -{ yylhsminor.yy404 = addNodeToList(pCxt, yymsp[-2].minor.yy404, yymsp[0].minor.yy452); } - yymsp[-2].minor.yy404 = yylhsminor.yy404; + case 366: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==366); + case 422: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==422); + case 475: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==475); +{ yylhsminor.yy24 = addNodeToList(pCxt, yymsp[-2].minor.yy24, yymsp[0].minor.yy652); } + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; case 108: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ -{ yylhsminor.yy452 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 109: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 111: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==111); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy437, yymsp[-5].minor.yy452, yymsp[-3].minor.yy404, yymsp[-1].minor.yy404, yymsp[0].minor.yy452); } +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy97, yymsp[-5].minor.yy652, yymsp[-3].minor.yy24, yymsp[-1].minor.yy24, yymsp[0].minor.yy652); } break; case 110: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy404); } +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy24); } break; case 112: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy404); } +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy24); } break; case 113: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy437, yymsp[0].minor.yy452); } +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy97, yymsp[0].minor.yy652); } break; case 114: /* cmd ::= ALTER TABLE alter_table_clause */ case 115: /* cmd ::= ALTER STABLE alter_table_clause */ yytestcase(yyruleno==115); case 280: /* cmd ::= query_expression */ yytestcase(yyruleno==280); -{ pCxt->pRootNode = yymsp[0].minor.yy452; } +{ pCxt->pRootNode = yymsp[0].minor.yy652; } break; case 116: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy452 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy452, yymsp[0].minor.yy452); } - yymsp[-1].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy652, yymsp[0].minor.yy652); } + yymsp[-1].minor.yy652 = yylhsminor.yy652; break; case 117: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy452 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy452, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy109, yymsp[0].minor.yy504); } - yymsp[-4].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy652, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy657, yymsp[0].minor.yy48); } + yymsp[-4].minor.yy652 = yylhsminor.yy652; break; case 118: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy452 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy452, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy109); } - yymsp[-3].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy652, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy657); } + yymsp[-3].minor.yy652 = yylhsminor.yy652; break; case 119: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy452 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy452, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy109, yymsp[0].minor.yy504); } - yymsp[-4].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy652, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy657, yymsp[0].minor.yy48); } + yymsp[-4].minor.yy652 = yylhsminor.yy652; break; case 120: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy452 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy452, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy109, &yymsp[0].minor.yy109); } - yymsp[-4].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy652, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy657, &yymsp[0].minor.yy657); } + yymsp[-4].minor.yy652 = yylhsminor.yy652; break; case 121: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy452 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy452, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy109, yymsp[0].minor.yy504); } - yymsp[-4].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy652, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy657, yymsp[0].minor.yy48); } + yymsp[-4].minor.yy652 = yylhsminor.yy652; break; case 122: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy452 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy452, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy109); } - yymsp[-3].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy652, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy657); } + yymsp[-3].minor.yy652 = yylhsminor.yy652; break; case 123: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy452 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy452, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy109, yymsp[0].minor.yy504); } - yymsp[-4].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy652, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy657, yymsp[0].minor.yy48); } + yymsp[-4].minor.yy652 = yylhsminor.yy652; break; case 124: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy452 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy452, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy109, &yymsp[0].minor.yy109); } - yymsp[-4].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy652, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy657, &yymsp[0].minor.yy657); } + yymsp[-4].minor.yy652 = yylhsminor.yy652; break; case 125: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ -{ yylhsminor.yy452 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy452, &yymsp[-2].minor.yy109, yymsp[0].minor.yy452); } - yymsp[-5].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy652, &yymsp[-2].minor.yy657, yymsp[0].minor.yy652); } + yymsp[-5].minor.yy652 = yylhsminor.yy652; break; case 127: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ case 130: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==130); -{ yylhsminor.yy404 = addNodeToList(pCxt, yymsp[-1].minor.yy404, yymsp[0].minor.yy452); } - yymsp[-1].minor.yy404 = yylhsminor.yy404; +{ yylhsminor.yy24 = addNodeToList(pCxt, yymsp[-1].minor.yy24, yymsp[0].minor.yy652); } + yymsp[-1].minor.yy24 = yylhsminor.yy24; break; case 128: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP table_options */ -{ yylhsminor.yy452 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy437, yymsp[-8].minor.yy452, yymsp[-6].minor.yy452, yymsp[-5].minor.yy404, yymsp[-2].minor.yy404, yymsp[0].minor.yy452); } - yymsp[-9].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy97, yymsp[-8].minor.yy652, yymsp[-6].minor.yy652, yymsp[-5].minor.yy24, yymsp[-2].minor.yy24, yymsp[0].minor.yy652); } + yymsp[-9].minor.yy652 = yylhsminor.yy652; break; case 131: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy452 = createDropTableClause(pCxt, yymsp[-1].minor.yy437, yymsp[0].minor.yy452); } - yymsp[-1].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createDropTableClause(pCxt, yymsp[-1].minor.yy97, yymsp[0].minor.yy652); } + yymsp[-1].minor.yy652 = yylhsminor.yy652; break; case 132: /* specific_tags_opt ::= */ case 163: /* tags_def_opt ::= */ yytestcase(yyruleno==163); - case 423: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==423); - case 440: /* group_by_clause_opt ::= */ yytestcase(yyruleno==440); - case 456: /* order_by_clause_opt ::= */ yytestcase(yyruleno==456); -{ yymsp[1].minor.yy404 = NULL; } + case 429: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==429); + case 446: /* group_by_clause_opt ::= */ yytestcase(yyruleno==446); + case 462: /* order_by_clause_opt ::= */ yytestcase(yyruleno==462); +{ yymsp[1].minor.yy24 = NULL; } break; case 133: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */ -{ yymsp[-2].minor.yy404 = yymsp[-1].minor.yy404; } +{ yymsp[-2].minor.yy24 = yymsp[-1].minor.yy24; } break; case 134: /* full_table_name ::= table_name */ -{ yylhsminor.yy452 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy109, NULL); } - yymsp[0].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy657, NULL); } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 135: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy452 = createRealTableNode(pCxt, &yymsp[-2].minor.yy109, &yymsp[0].minor.yy109, NULL); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createRealTableNode(pCxt, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy657, NULL); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 138: /* column_def ::= column_name type_name */ -{ yylhsminor.yy452 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy109, yymsp[0].minor.yy504, NULL); } - yymsp[-1].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy657, yymsp[0].minor.yy48, NULL); } + yymsp[-1].minor.yy652 = yylhsminor.yy652; break; case 139: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy452 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy109, yymsp[-2].minor.yy504, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy657, yymsp[-2].minor.yy48, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy652 = yylhsminor.yy652; break; case 140: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_BOOL); } +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_BOOL); } break; case 141: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_TINYINT); } +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; case 142: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_SMALLINT); } +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; case 143: /* type_name ::= INT */ case 144: /* type_name ::= INTEGER */ yytestcase(yyruleno==144); -{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_INT); } +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_INT); } break; case 145: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_BIGINT); } +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; case 146: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_FLOAT); } +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; case 147: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_DOUBLE); } +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; case 148: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy504 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; case 149: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; case 150: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy504 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; case 151: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy504 = createDataType(TSDB_DATA_TYPE_UTINYINT); } +{ yymsp[-1].minor.yy48 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; case 152: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy504 = createDataType(TSDB_DATA_TYPE_USMALLINT); } +{ yymsp[-1].minor.yy48 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; case 153: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy504 = createDataType(TSDB_DATA_TYPE_UINT); } +{ yymsp[-1].minor.yy48 = createDataType(TSDB_DATA_TYPE_UINT); } break; case 154: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy504 = createDataType(TSDB_DATA_TYPE_UBIGINT); } +{ yymsp[-1].minor.yy48 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; case 155: /* type_name ::= JSON */ -{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_JSON); } +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_JSON); } break; case 156: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy504 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; case 157: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; case 158: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_BLOB); } +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_BLOB); } break; case 159: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy504 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; case 160: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy504 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 161: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy504 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-3].minor.yy48 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 162: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy504 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-5].minor.yy48 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 164: /* tags_def_opt ::= tags_def */ - case 358: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==358); - case 414: /* select_list ::= select_sublist */ yytestcase(yyruleno==414); -{ yylhsminor.yy404 = yymsp[0].minor.yy404; } - yymsp[0].minor.yy404 = yylhsminor.yy404; + case 364: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==364); + case 420: /* select_list ::= select_sublist */ yytestcase(yyruleno==420); +{ yylhsminor.yy24 = yymsp[0].minor.yy24; } + yymsp[0].minor.yy24 = yylhsminor.yy24; break; case 165: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ -{ yymsp[-3].minor.yy404 = yymsp[-1].minor.yy404; } +{ yymsp[-3].minor.yy24 = yymsp[-1].minor.yy24; } break; case 166: /* table_options ::= */ -{ yymsp[1].minor.yy452 = createDefaultTableOptions(pCxt); } +{ yymsp[1].minor.yy652 = createDefaultTableOptions(pCxt); } break; case 167: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy452 = setTableOption(pCxt, yymsp[-2].minor.yy452, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = setTableOption(pCxt, yymsp[-2].minor.yy652, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 168: /* table_options ::= table_options MAX_DELAY duration_list */ -{ yylhsminor.yy452 = setTableOption(pCxt, yymsp[-2].minor.yy452, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy404); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = setTableOption(pCxt, yymsp[-2].minor.yy652, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy24); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 169: /* table_options ::= table_options WATERMARK duration_list */ -{ yylhsminor.yy452 = setTableOption(pCxt, yymsp[-2].minor.yy452, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy404); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = setTableOption(pCxt, yymsp[-2].minor.yy652, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy24); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 170: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -{ yylhsminor.yy452 = setTableOption(pCxt, yymsp[-4].minor.yy452, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy404); } - yymsp[-4].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = setTableOption(pCxt, yymsp[-4].minor.yy652, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy24); } + yymsp[-4].minor.yy652 = yylhsminor.yy652; break; case 171: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy452 = setTableOption(pCxt, yymsp[-2].minor.yy452, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = setTableOption(pCxt, yymsp[-2].minor.yy652, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 172: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy452 = setTableOption(pCxt, yymsp[-4].minor.yy452, TABLE_OPTION_SMA, yymsp[-1].minor.yy404); } - yymsp[-4].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = setTableOption(pCxt, yymsp[-4].minor.yy652, TABLE_OPTION_SMA, yymsp[-1].minor.yy24); } + yymsp[-4].minor.yy652 = yylhsminor.yy652; break; case 173: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy452 = createAlterTableOptions(pCxt); yylhsminor.yy452 = setTableOption(pCxt, yylhsminor.yy452, yymsp[0].minor.yy85.type, &yymsp[0].minor.yy85.val); } - yymsp[0].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createAlterTableOptions(pCxt); yylhsminor.yy652 = setTableOption(pCxt, yylhsminor.yy652, yymsp[0].minor.yy189.type, &yymsp[0].minor.yy189.val); } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 174: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy452 = setTableOption(pCxt, yymsp[-1].minor.yy452, yymsp[0].minor.yy85.type, &yymsp[0].minor.yy85.val); } - yymsp[-1].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = setTableOption(pCxt, yymsp[-1].minor.yy652, yymsp[0].minor.yy189.type, &yymsp[0].minor.yy189.val); } + yymsp[-1].minor.yy652 = yylhsminor.yy652; break; case 175: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy85.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy85.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy189.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } break; case 176: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy85.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy85.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy189.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } break; case 177: /* duration_list ::= duration_literal */ case 332: /* expression_list ::= expression */ yytestcase(yyruleno==332); -{ yylhsminor.yy404 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy452)); } - yymsp[0].minor.yy404 = yylhsminor.yy404; +{ yylhsminor.yy24 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy652)); } + yymsp[0].minor.yy24 = yylhsminor.yy24; break; case 178: /* duration_list ::= duration_list NK_COMMA duration_literal */ case 333: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==333); -{ yylhsminor.yy404 = addNodeToList(pCxt, yymsp[-2].minor.yy404, releaseRawExprNode(pCxt, yymsp[0].minor.yy452)); } - yymsp[-2].minor.yy404 = yylhsminor.yy404; +{ yylhsminor.yy24 = addNodeToList(pCxt, yymsp[-2].minor.yy24, releaseRawExprNode(pCxt, yymsp[0].minor.yy652)); } + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; case 181: /* rollup_func_name ::= function_name */ -{ yylhsminor.yy452 = createFunctionNode(pCxt, &yymsp[0].minor.yy109, NULL); } - yymsp[0].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createFunctionNode(pCxt, &yymsp[0].minor.yy657, NULL); } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 182: /* rollup_func_name ::= FIRST */ case 183: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==183); -{ yylhsminor.yy452 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 186: /* col_name ::= column_name */ -{ yylhsminor.yy452 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy109); } - yymsp[0].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy657); } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 187: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } @@ -3811,13 +3893,13 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); } break; case 190: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy452, yymsp[0].minor.yy452, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy652, yymsp[0].minor.yy652, OP_TYPE_LIKE); } break; case 191: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy452, yymsp[0].minor.yy452, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy652, yymsp[0].minor.yy652, OP_TYPE_LIKE); } break; case 192: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy452, NULL, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy652, NULL, OP_TYPE_LIKE); } break; case 193: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } @@ -3832,7 +3914,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } break; case 197: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy452, yymsp[-1].minor.yy452, OP_TYPE_EQUAL); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy652, yymsp[-1].minor.yy652, OP_TYPE_EQUAL); } break; case 198: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } @@ -3851,13 +3933,13 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCE_STMT); } break; case 204: /* cmd ::= SHOW CREATE DATABASE db_name */ -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy109); } +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy657); } break; case 205: /* cmd ::= SHOW CREATE TABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy452); } +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy652); } break; case 206: /* cmd ::= SHOW CREATE STABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy452); } +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy652); } break; case 207: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } @@ -3890,7 +3972,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } break; case 217: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy452); } +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy652); } break; case 218: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } @@ -3900,150 +3982,150 @@ static YYACTIONTYPE yy_reduce( break; case 220: /* db_name_cond_opt ::= */ case 225: /* from_db_opt ::= */ yytestcase(yyruleno==225); -{ yymsp[1].minor.yy452 = createDefaultDatabaseCondValue(pCxt); } +{ yymsp[1].minor.yy652 = createDefaultDatabaseCondValue(pCxt); } break; case 221: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy452 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy109); } - yymsp[-1].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy657); } + yymsp[-1].minor.yy652 = yylhsminor.yy652; break; case 222: /* like_pattern_opt ::= */ case 262: /* into_opt ::= */ yytestcase(yyruleno==262); - case 391: /* from_clause_opt ::= */ yytestcase(yyruleno==391); - case 421: /* where_clause_opt ::= */ yytestcase(yyruleno==421); - case 425: /* twindow_clause_opt ::= */ yytestcase(yyruleno==425); - case 430: /* sliding_opt ::= */ yytestcase(yyruleno==430); - case 432: /* fill_opt ::= */ yytestcase(yyruleno==432); - case 444: /* having_clause_opt ::= */ yytestcase(yyruleno==444); - case 446: /* range_opt ::= */ yytestcase(yyruleno==446); - case 448: /* every_opt ::= */ yytestcase(yyruleno==448); - case 458: /* slimit_clause_opt ::= */ yytestcase(yyruleno==458); - case 462: /* limit_clause_opt ::= */ yytestcase(yyruleno==462); -{ yymsp[1].minor.yy452 = NULL; } + case 397: /* from_clause_opt ::= */ yytestcase(yyruleno==397); + case 427: /* where_clause_opt ::= */ yytestcase(yyruleno==427); + case 431: /* twindow_clause_opt ::= */ yytestcase(yyruleno==431); + case 436: /* sliding_opt ::= */ yytestcase(yyruleno==436); + case 438: /* fill_opt ::= */ yytestcase(yyruleno==438); + case 450: /* having_clause_opt ::= */ yytestcase(yyruleno==450); + case 452: /* range_opt ::= */ yytestcase(yyruleno==452); + case 454: /* every_opt ::= */ yytestcase(yyruleno==454); + case 464: /* slimit_clause_opt ::= */ yytestcase(yyruleno==464); + case 468: /* limit_clause_opt ::= */ yytestcase(yyruleno==468); +{ yymsp[1].minor.yy652 = NULL; } break; case 223: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy452 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; case 224: /* table_name_cond ::= table_name */ -{ yylhsminor.yy452 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy109); } - yymsp[0].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy657); } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 226: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy452 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy109); } +{ yymsp[-1].minor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy657); } break; case 227: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy437, &yymsp[-3].minor.yy109, &yymsp[-1].minor.yy109, NULL, yymsp[0].minor.yy452); } +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy97, &yymsp[-3].minor.yy657, &yymsp[-1].minor.yy657, NULL, yymsp[0].minor.yy652); } break; case 228: /* cmd ::= DROP INDEX exists_opt index_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy437, &yymsp[0].minor.yy109); } +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy97, &yymsp[0].minor.yy657); } break; case 229: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-9].minor.yy452 = createIndexOption(pCxt, yymsp[-7].minor.yy404, releaseRawExprNode(pCxt, yymsp[-3].minor.yy452), NULL, yymsp[-1].minor.yy452, yymsp[0].minor.yy452); } +{ yymsp[-9].minor.yy652 = createIndexOption(pCxt, yymsp[-7].minor.yy24, releaseRawExprNode(pCxt, yymsp[-3].minor.yy652), NULL, yymsp[-1].minor.yy652, yymsp[0].minor.yy652); } break; case 230: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-11].minor.yy452 = createIndexOption(pCxt, yymsp[-9].minor.yy404, releaseRawExprNode(pCxt, yymsp[-5].minor.yy452), releaseRawExprNode(pCxt, yymsp[-3].minor.yy452), yymsp[-1].minor.yy452, yymsp[0].minor.yy452); } +{ yymsp[-11].minor.yy652 = createIndexOption(pCxt, yymsp[-9].minor.yy24, releaseRawExprNode(pCxt, yymsp[-5].minor.yy652), releaseRawExprNode(pCxt, yymsp[-3].minor.yy652), yymsp[-1].minor.yy652, yymsp[0].minor.yy652); } break; case 233: /* func ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy452 = createFunctionNode(pCxt, &yymsp[-3].minor.yy109, yymsp[-1].minor.yy404); } - yymsp[-3].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createFunctionNode(pCxt, &yymsp[-3].minor.yy657, yymsp[-1].minor.yy24); } + yymsp[-3].minor.yy652 = yylhsminor.yy652; break; case 234: /* sma_stream_opt ::= */ case 264: /* stream_options ::= */ yytestcase(yyruleno==264); -{ yymsp[1].minor.yy452 = createStreamOptions(pCxt); } +{ yymsp[1].minor.yy652 = createStreamOptions(pCxt); } break; case 235: /* sma_stream_opt ::= stream_options WATERMARK duration_literal */ case 268: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==268); -{ ((SStreamOptions*)yymsp[-2].minor.yy452)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy452); yylhsminor.yy452 = yymsp[-2].minor.yy452; } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ ((SStreamOptions*)yymsp[-2].minor.yy652)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy652); yylhsminor.yy652 = yymsp[-2].minor.yy652; } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 236: /* sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy452)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy452); yylhsminor.yy452 = yymsp[-2].minor.yy452; } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ ((SStreamOptions*)yymsp[-2].minor.yy652)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy652); yylhsminor.yy652 = yymsp[-2].minor.yy652; } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 237: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy437, &yymsp[-2].minor.yy109, yymsp[0].minor.yy452); } +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy97, &yymsp[-2].minor.yy657, yymsp[0].minor.yy652); } break; case 238: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy437, &yymsp[-3].minor.yy109, &yymsp[0].minor.yy109, false); } +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy97, &yymsp[-3].minor.yy657, &yymsp[0].minor.yy657, false); } break; case 239: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy437, &yymsp[-5].minor.yy109, &yymsp[0].minor.yy109, true); } +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy97, &yymsp[-5].minor.yy657, &yymsp[0].minor.yy657, true); } break; case 240: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy437, &yymsp[-3].minor.yy109, yymsp[0].minor.yy452, false); } +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy97, &yymsp[-3].minor.yy657, yymsp[0].minor.yy652, false); } break; case 241: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy437, &yymsp[-5].minor.yy109, yymsp[0].minor.yy452, true); } +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy97, &yymsp[-5].minor.yy657, yymsp[0].minor.yy652, true); } break; case 242: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy437, &yymsp[0].minor.yy109); } +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy97, &yymsp[0].minor.yy657); } break; case 243: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy437, &yymsp[-2].minor.yy109, &yymsp[0].minor.yy109); } +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy97, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy657); } break; case 244: /* cmd ::= DESC full_table_name */ case 245: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==245); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy452); } +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy652); } break; case 246: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; case 247: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy437, yymsp[-1].minor.yy452, yymsp[0].minor.yy452); } +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy97, yymsp[-1].minor.yy652, yymsp[0].minor.yy652); } break; case 249: /* analyze_opt ::= ANALYZE */ case 257: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==257); - case 411: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==411); -{ yymsp[0].minor.yy437 = true; } + case 417: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==417); +{ yymsp[0].minor.yy97 = true; } break; case 250: /* explain_options ::= */ -{ yymsp[1].minor.yy452 = createDefaultExplainOptions(pCxt); } +{ yymsp[1].minor.yy652 = createDefaultExplainOptions(pCxt); } break; case 251: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy452 = setExplainVerbose(pCxt, yymsp[-2].minor.yy452, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = setExplainVerbose(pCxt, yymsp[-2].minor.yy652, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 252: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy452 = setExplainRatio(pCxt, yymsp[-2].minor.yy452, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = setExplainRatio(pCxt, yymsp[-2].minor.yy652, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 253: /* cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ -{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy404); } +{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy24); } break; case 254: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy437, yymsp[-8].minor.yy437, &yymsp[-5].minor.yy109, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy504, yymsp[0].minor.yy100); } +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy97, yymsp[-8].minor.yy97, &yymsp[-5].minor.yy657, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy48, yymsp[0].minor.yy244); } break; case 255: /* cmd ::= DROP FUNCTION exists_opt function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy437, &yymsp[0].minor.yy109); } +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy97, &yymsp[0].minor.yy657); } break; case 258: /* bufsize_opt ::= */ -{ yymsp[1].minor.yy100 = 0; } +{ yymsp[1].minor.yy244 = 0; } break; case 259: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ -{ yymsp[-1].minor.yy100 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy244 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } break; case 260: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-5].minor.yy437, &yymsp[-4].minor.yy109, yymsp[-2].minor.yy452, yymsp[-3].minor.yy452, yymsp[0].minor.yy452); } +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-5].minor.yy97, &yymsp[-4].minor.yy657, yymsp[-2].minor.yy652, yymsp[-3].minor.yy652, yymsp[0].minor.yy652); } break; case 261: /* cmd ::= DROP STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy437, &yymsp[0].minor.yy109); } +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy97, &yymsp[0].minor.yy657); } break; case 263: /* into_opt ::= INTO full_table_name */ - case 392: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==392); - case 422: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==422); - case 445: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==445); -{ yymsp[-1].minor.yy452 = yymsp[0].minor.yy452; } + case 398: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==398); + case 428: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==428); + case 451: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==451); +{ yymsp[-1].minor.yy652 = yymsp[0].minor.yy652; } break; case 265: /* stream_options ::= stream_options TRIGGER AT_ONCE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy452)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy452 = yymsp[-2].minor.yy452; } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ ((SStreamOptions*)yymsp[-2].minor.yy652)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy652 = yymsp[-2].minor.yy652; } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 266: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy452)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy452 = yymsp[-2].minor.yy452; } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ ((SStreamOptions*)yymsp[-2].minor.yy652)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy652 = yymsp[-2].minor.yy652; } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 267: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-3].minor.yy452)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy452)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy452); yylhsminor.yy452 = yymsp[-3].minor.yy452; } - yymsp[-3].minor.yy452 = yylhsminor.yy452; +{ ((SStreamOptions*)yymsp[-3].minor.yy652)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy652)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy652); yylhsminor.yy652 = yymsp[-3].minor.yy652; } + yymsp[-3].minor.yy652 = yylhsminor.yy652; break; case 269: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } @@ -4061,39 +4143,39 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; case 274: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy404); } +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy24); } break; case 275: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; case 276: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy404 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +{ yymsp[-1].minor.yy24 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; case 278: /* cmd ::= SYNCDB db_name REPLICA */ -{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy109); } +{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy657); } break; case 279: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy452, yymsp[0].minor.yy452); } +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy652, yymsp[0].minor.yy652); } break; case 281: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy452 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 282: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy452 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 283: /* literal ::= NK_STRING */ -{ yylhsminor.yy452 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 284: /* literal ::= NK_BOOL */ -{ yylhsminor.yy452 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 285: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy452 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy652 = yylhsminor.yy652; break; case 286: /* literal ::= duration_literal */ case 296: /* signed_literal ::= signed */ yytestcase(yyruleno==296); @@ -4103,173 +4185,173 @@ static YYACTIONTYPE yy_reduce( case 319: /* expression ::= function_expression */ yytestcase(yyruleno==319); case 320: /* expression ::= subquery */ yytestcase(yyruleno==320); case 347: /* function_expression ::= literal_func */ yytestcase(yyruleno==347); - case 383: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==383); - case 387: /* boolean_primary ::= predicate */ yytestcase(yyruleno==387); - case 389: /* common_expression ::= expression */ yytestcase(yyruleno==389); - case 390: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==390); - case 393: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==393); - case 395: /* table_reference ::= table_primary */ yytestcase(yyruleno==395); - case 396: /* table_reference ::= joined_table */ yytestcase(yyruleno==396); - case 400: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==400); - case 451: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==451); - case 454: /* query_primary ::= query_specification */ yytestcase(yyruleno==454); -{ yylhsminor.yy452 = yymsp[0].minor.yy452; } - yymsp[0].minor.yy452 = yylhsminor.yy452; + case 389: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==389); + case 393: /* boolean_primary ::= predicate */ yytestcase(yyruleno==393); + case 395: /* common_expression ::= expression */ yytestcase(yyruleno==395); + case 396: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==396); + case 399: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==399); + case 401: /* table_reference ::= table_primary */ yytestcase(yyruleno==401); + case 402: /* table_reference ::= joined_table */ yytestcase(yyruleno==402); + case 406: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==406); + case 457: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==457); + case 460: /* query_primary ::= query_specification */ yytestcase(yyruleno==460); +{ yylhsminor.yy652 = yymsp[0].minor.yy652; } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 287: /* literal ::= NULL */ -{ yylhsminor.yy452 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 288: /* literal ::= NK_QUESTION */ -{ yylhsminor.yy452 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 289: /* duration_literal ::= NK_VARIABLE */ -{ yylhsminor.yy452 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 290: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy452 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 291: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy452 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 292: /* signed ::= NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy452 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy452 = yylhsminor.yy452; + yymsp[-1].minor.yy652 = yylhsminor.yy652; break; case 293: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy452 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 294: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy452 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; case 295: /* signed ::= NK_MINUS NK_FLOAT */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy452 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy452 = yylhsminor.yy452; + yymsp[-1].minor.yy652 = yylhsminor.yy652; break; case 297: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy452 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 298: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy452 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 299: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy452 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; case 300: /* signed_literal ::= duration_literal */ case 302: /* signed_literal ::= literal_func */ yytestcase(yyruleno==302); - case 361: /* star_func_para ::= expression */ yytestcase(yyruleno==361); - case 417: /* select_item ::= common_expression */ yytestcase(yyruleno==417); - case 467: /* search_condition ::= common_expression */ yytestcase(yyruleno==467); -{ yylhsminor.yy452 = releaseRawExprNode(pCxt, yymsp[0].minor.yy452); } - yymsp[0].minor.yy452 = yylhsminor.yy452; + case 367: /* star_func_para ::= expression */ yytestcase(yyruleno==367); + case 423: /* select_item ::= common_expression */ yytestcase(yyruleno==423); + case 473: /* search_condition ::= common_expression */ yytestcase(yyruleno==473); +{ yylhsminor.yy652 = releaseRawExprNode(pCxt, yymsp[0].minor.yy652); } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 301: /* signed_literal ::= NULL */ -{ yylhsminor.yy452 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 321: /* expression ::= NK_LP expression NK_RP */ - case 388: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==388); -{ yylhsminor.yy452 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy452)); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; + case 394: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==394); +{ yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy652)); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 322: /* expression ::= NK_PLUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy452); - yylhsminor.yy452 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy452)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); + yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy652)); } - yymsp[-1].minor.yy452 = yylhsminor.yy452; + yymsp[-1].minor.yy652 = yylhsminor.yy652; break; case 323: /* expression ::= NK_MINUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy452); - yylhsminor.yy452 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy452), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); + yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy652), NULL)); } - yymsp[-1].minor.yy452 = yylhsminor.yy452; + yymsp[-1].minor.yy652 = yylhsminor.yy652; break; case 324: /* expression ::= expression NK_PLUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy452); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy452); - yylhsminor.yy452 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), releaseRawExprNode(pCxt, yymsp[0].minor.yy452))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); + yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 325: /* expression ::= expression NK_MINUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy452); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy452); - yylhsminor.yy452 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), releaseRawExprNode(pCxt, yymsp[0].minor.yy452))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); + yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 326: /* expression ::= expression NK_STAR expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy452); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy452); - yylhsminor.yy452 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), releaseRawExprNode(pCxt, yymsp[0].minor.yy452))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); + yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 327: /* expression ::= expression NK_SLASH expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy452); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy452); - yylhsminor.yy452 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), releaseRawExprNode(pCxt, yymsp[0].minor.yy452))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); + yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 328: /* expression ::= expression NK_REM expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy452); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy452); - yylhsminor.yy452 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), releaseRawExprNode(pCxt, yymsp[0].minor.yy452))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); + yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 329: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy452); - yylhsminor.yy452 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); + yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 330: /* expression ::= expression NK_BITAND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy452); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy452); - yylhsminor.yy452 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), releaseRawExprNode(pCxt, yymsp[0].minor.yy452))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); + yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 331: /* expression ::= expression NK_BITOR expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy452); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy452); - yylhsminor.yy452 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), releaseRawExprNode(pCxt, yymsp[0].minor.yy452))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); + yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 334: /* column_reference ::= column_name */ -{ yylhsminor.yy452 = createRawExprNode(pCxt, &yymsp[0].minor.yy109, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy109)); } - yymsp[0].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createRawExprNode(pCxt, &yymsp[0].minor.yy657, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy657)); } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 335: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy452 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy109, &yymsp[0].minor.yy109, createColumnNode(pCxt, &yymsp[-2].minor.yy109, &yymsp[0].minor.yy109)); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy657, createColumnNode(pCxt, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy657)); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 336: /* pseudo_column ::= ROWTS */ case 337: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==337); @@ -4279,319 +4361,319 @@ static YYACTIONTYPE yy_reduce( case 342: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==342); case 343: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==343); case 349: /* literal_func ::= NOW */ yytestcase(yyruleno==349); -{ yylhsminor.yy452 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 338: /* pseudo_column ::= table_name NK_DOT TBNAME */ -{ yylhsminor.yy452 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy109, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy109)))); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy657)))); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 344: /* function_expression ::= function_name NK_LP expression_list NK_RP */ case 345: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==345); -{ yylhsminor.yy452 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy109, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy109, yymsp[-1].minor.yy404)); } - yymsp[-3].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy657, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy657, yymsp[-1].minor.yy24)); } + yymsp[-3].minor.yy652 = yylhsminor.yy652; break; case 346: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */ -{ yylhsminor.yy452 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy452), yymsp[-1].minor.yy504)); } - yymsp[-5].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy652), yymsp[-1].minor.yy48)); } + yymsp[-5].minor.yy652 = yylhsminor.yy652; break; case 348: /* literal_func ::= noarg_func NK_LP NK_RP */ -{ yylhsminor.yy452 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy109, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy109, NULL)); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; +{ yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy657, NULL)); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; - case 357: /* star_func_para_list ::= NK_STAR */ -{ yylhsminor.yy404 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy404 = yylhsminor.yy404; + case 363: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy24 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy24 = yylhsminor.yy24; break; - case 362: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 420: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==420); -{ yylhsminor.yy452 = createColumnNode(pCxt, &yymsp[-2].minor.yy109, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; + case 368: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 426: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==426); +{ yylhsminor.yy652 = createColumnNode(pCxt, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; - case 363: /* predicate ::= expression compare_op expression */ - case 368: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==368); + case 369: /* predicate ::= expression compare_op expression */ + case 374: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==374); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy452); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy452); - yylhsminor.yy452 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy440, releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), releaseRawExprNode(pCxt, yymsp[0].minor.yy452))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); + yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy700, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; - case 364: /* predicate ::= expression BETWEEN expression AND expression */ + case 370: /* predicate ::= expression BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy452); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy452); - yylhsminor.yy452 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy452), releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), releaseRawExprNode(pCxt, yymsp[0].minor.yy452))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy652); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); + yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy652), releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); } - yymsp[-4].minor.yy452 = yylhsminor.yy452; + yymsp[-4].minor.yy652 = yylhsminor.yy652; break; - case 365: /* predicate ::= expression NOT BETWEEN expression AND expression */ + case 371: /* predicate ::= expression NOT BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy452); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy452); - yylhsminor.yy452 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy452), releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), releaseRawExprNode(pCxt, yymsp[0].minor.yy452))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy652); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); + yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy652), releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); } - yymsp[-5].minor.yy452 = yylhsminor.yy452; + yymsp[-5].minor.yy652 = yylhsminor.yy652; break; - case 366: /* predicate ::= expression IS NULL */ + case 372: /* predicate ::= expression IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy452); - yylhsminor.yy452 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); + yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), NULL)); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; - case 367: /* predicate ::= expression IS NOT NULL */ + case 373: /* predicate ::= expression IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy452); - yylhsminor.yy452 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy452), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy652); + yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy652), NULL)); } - yymsp[-3].minor.yy452 = yylhsminor.yy452; + yymsp[-3].minor.yy652 = yylhsminor.yy652; break; - case 369: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy440 = OP_TYPE_LOWER_THAN; } + case 375: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy700 = OP_TYPE_LOWER_THAN; } break; - case 370: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy440 = OP_TYPE_GREATER_THAN; } + case 376: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy700 = OP_TYPE_GREATER_THAN; } break; - case 371: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy440 = OP_TYPE_LOWER_EQUAL; } + case 377: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy700 = OP_TYPE_LOWER_EQUAL; } break; - case 372: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy440 = OP_TYPE_GREATER_EQUAL; } + case 378: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy700 = OP_TYPE_GREATER_EQUAL; } break; - case 373: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy440 = OP_TYPE_NOT_EQUAL; } + case 379: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy700 = OP_TYPE_NOT_EQUAL; } break; - case 374: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy440 = OP_TYPE_EQUAL; } + case 380: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy700 = OP_TYPE_EQUAL; } break; - case 375: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy440 = OP_TYPE_LIKE; } + case 381: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy700 = OP_TYPE_LIKE; } break; - case 376: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy440 = OP_TYPE_NOT_LIKE; } + case 382: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy700 = OP_TYPE_NOT_LIKE; } break; - case 377: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy440 = OP_TYPE_MATCH; } + case 383: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy700 = OP_TYPE_MATCH; } break; - case 378: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy440 = OP_TYPE_NMATCH; } + case 384: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy700 = OP_TYPE_NMATCH; } break; - case 379: /* compare_op ::= CONTAINS */ -{ yymsp[0].minor.yy440 = OP_TYPE_JSON_CONTAINS; } + case 385: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy700 = OP_TYPE_JSON_CONTAINS; } break; - case 380: /* in_op ::= IN */ -{ yymsp[0].minor.yy440 = OP_TYPE_IN; } + case 386: /* in_op ::= IN */ +{ yymsp[0].minor.yy700 = OP_TYPE_IN; } break; - case 381: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy440 = OP_TYPE_NOT_IN; } + case 387: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy700 = OP_TYPE_NOT_IN; } break; - case 382: /* in_predicate_value ::= NK_LP expression_list NK_RP */ -{ yylhsminor.yy452 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy404)); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; + case 388: /* in_predicate_value ::= NK_LP expression_list NK_RP */ +{ yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy24)); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; - case 384: /* boolean_value_expression ::= NOT boolean_primary */ + case 390: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy452); - yylhsminor.yy452 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy452), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); + yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy652), NULL)); } - yymsp[-1].minor.yy452 = yylhsminor.yy452; + yymsp[-1].minor.yy652 = yylhsminor.yy652; break; - case 385: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 391: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy452); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy452); - yylhsminor.yy452 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), releaseRawExprNode(pCxt, yymsp[0].minor.yy452))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); + yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; - case 386: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 392: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy452); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy452); - yylhsminor.yy452 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), releaseRawExprNode(pCxt, yymsp[0].minor.yy452))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); + yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; - case 394: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy452 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy452, yymsp[0].minor.yy452, NULL); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; + case 400: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy652 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy652, yymsp[0].minor.yy652, NULL); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; - case 397: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy452 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy109, &yymsp[0].minor.yy109); } - yymsp[-1].minor.yy452 = yylhsminor.yy452; + case 403: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy652 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy657, &yymsp[0].minor.yy657); } + yymsp[-1].minor.yy652 = yylhsminor.yy652; break; - case 398: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy452 = createRealTableNode(pCxt, &yymsp[-3].minor.yy109, &yymsp[-1].minor.yy109, &yymsp[0].minor.yy109); } - yymsp[-3].minor.yy452 = yylhsminor.yy452; + case 404: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy652 = createRealTableNode(pCxt, &yymsp[-3].minor.yy657, &yymsp[-1].minor.yy657, &yymsp[0].minor.yy657); } + yymsp[-3].minor.yy652 = yylhsminor.yy652; break; - case 399: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy452 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy452), &yymsp[0].minor.yy109); } - yymsp[-1].minor.yy452 = yylhsminor.yy452; + case 405: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy652 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy652), &yymsp[0].minor.yy657); } + yymsp[-1].minor.yy652 = yylhsminor.yy652; break; - case 401: /* alias_opt ::= */ -{ yymsp[1].minor.yy109 = nil_token; } + case 407: /* alias_opt ::= */ +{ yymsp[1].minor.yy657 = nil_token; } break; - case 402: /* alias_opt ::= table_alias */ -{ yylhsminor.yy109 = yymsp[0].minor.yy109; } - yymsp[0].minor.yy109 = yylhsminor.yy109; + case 408: /* alias_opt ::= table_alias */ +{ yylhsminor.yy657 = yymsp[0].minor.yy657; } + yymsp[0].minor.yy657 = yylhsminor.yy657; break; - case 403: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy109 = yymsp[0].minor.yy109; } + case 409: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy657 = yymsp[0].minor.yy657; } break; - case 404: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 405: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==405); -{ yymsp[-2].minor.yy452 = yymsp[-1].minor.yy452; } + case 410: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 411: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==411); +{ yymsp[-2].minor.yy652 = yymsp[-1].minor.yy652; } break; - case 406: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy452 = createJoinTableNode(pCxt, yymsp[-4].minor.yy532, yymsp[-5].minor.yy452, yymsp[-2].minor.yy452, yymsp[0].minor.yy452); } - yymsp[-5].minor.yy452 = yylhsminor.yy452; + case 412: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy652 = createJoinTableNode(pCxt, yymsp[-4].minor.yy596, yymsp[-5].minor.yy652, yymsp[-2].minor.yy652, yymsp[0].minor.yy652); } + yymsp[-5].minor.yy652 = yylhsminor.yy652; break; - case 407: /* join_type ::= */ -{ yymsp[1].minor.yy532 = JOIN_TYPE_INNER; } + case 413: /* join_type ::= */ +{ yymsp[1].minor.yy596 = JOIN_TYPE_INNER; } break; - case 408: /* join_type ::= INNER */ -{ yymsp[0].minor.yy532 = JOIN_TYPE_INNER; } + case 414: /* join_type ::= INNER */ +{ yymsp[0].minor.yy596 = JOIN_TYPE_INNER; } break; - case 409: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + case 415: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ { - yymsp[-11].minor.yy452 = createSelectStmt(pCxt, yymsp[-10].minor.yy437, yymsp[-9].minor.yy404, yymsp[-8].minor.yy452); - yymsp[-11].minor.yy452 = addWhereClause(pCxt, yymsp[-11].minor.yy452, yymsp[-7].minor.yy452); - yymsp[-11].minor.yy452 = addPartitionByClause(pCxt, yymsp[-11].minor.yy452, yymsp[-6].minor.yy404); - yymsp[-11].minor.yy452 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy452, yymsp[-2].minor.yy452); - yymsp[-11].minor.yy452 = addGroupByClause(pCxt, yymsp[-11].minor.yy452, yymsp[-1].minor.yy404); - yymsp[-11].minor.yy452 = addHavingClause(pCxt, yymsp[-11].minor.yy452, yymsp[0].minor.yy452); - yymsp[-11].minor.yy452 = addRangeClause(pCxt, yymsp[-11].minor.yy452, yymsp[-5].minor.yy452); - yymsp[-11].minor.yy452 = addEveryClause(pCxt, yymsp[-11].minor.yy452, yymsp[-4].minor.yy452); - yymsp[-11].minor.yy452 = addFillClause(pCxt, yymsp[-11].minor.yy452, yymsp[-3].minor.yy452); + yymsp[-11].minor.yy652 = createSelectStmt(pCxt, yymsp[-10].minor.yy97, yymsp[-9].minor.yy24, yymsp[-8].minor.yy652); + yymsp[-11].minor.yy652 = addWhereClause(pCxt, yymsp[-11].minor.yy652, yymsp[-7].minor.yy652); + yymsp[-11].minor.yy652 = addPartitionByClause(pCxt, yymsp[-11].minor.yy652, yymsp[-6].minor.yy24); + yymsp[-11].minor.yy652 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy652, yymsp[-2].minor.yy652); + yymsp[-11].minor.yy652 = addGroupByClause(pCxt, yymsp[-11].minor.yy652, yymsp[-1].minor.yy24); + yymsp[-11].minor.yy652 = addHavingClause(pCxt, yymsp[-11].minor.yy652, yymsp[0].minor.yy652); + yymsp[-11].minor.yy652 = addRangeClause(pCxt, yymsp[-11].minor.yy652, yymsp[-5].minor.yy652); + yymsp[-11].minor.yy652 = addEveryClause(pCxt, yymsp[-11].minor.yy652, yymsp[-4].minor.yy652); + yymsp[-11].minor.yy652 = addFillClause(pCxt, yymsp[-11].minor.yy652, yymsp[-3].minor.yy652); } break; - case 412: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy437 = false; } + case 418: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy97 = false; } break; - case 413: /* select_list ::= NK_STAR */ -{ yymsp[0].minor.yy404 = NULL; } + case 419: /* select_list ::= NK_STAR */ +{ yymsp[0].minor.yy24 = NULL; } break; - case 418: /* select_item ::= common_expression column_alias */ -{ yylhsminor.yy452 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy452), &yymsp[0].minor.yy109); } - yymsp[-1].minor.yy452 = yylhsminor.yy452; + case 424: /* select_item ::= common_expression column_alias */ +{ yylhsminor.yy652 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy652), &yymsp[0].minor.yy657); } + yymsp[-1].minor.yy652 = yylhsminor.yy652; break; - case 419: /* select_item ::= common_expression AS column_alias */ -{ yylhsminor.yy452 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), &yymsp[0].minor.yy109); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; + case 425: /* select_item ::= common_expression AS column_alias */ +{ yylhsminor.yy652 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), &yymsp[0].minor.yy657); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; - case 424: /* partition_by_clause_opt ::= PARTITION BY expression_list */ - case 441: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==441); - case 457: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==457); -{ yymsp[-2].minor.yy404 = yymsp[0].minor.yy404; } + case 430: /* partition_by_clause_opt ::= PARTITION BY expression_list */ + case 447: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==447); + case 463: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==463); +{ yymsp[-2].minor.yy24 = yymsp[0].minor.yy24; } break; - case 426: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -{ yymsp[-5].minor.yy452 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy452), releaseRawExprNode(pCxt, yymsp[-1].minor.yy452)); } + case 432: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +{ yymsp[-5].minor.yy652 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy652), releaseRawExprNode(pCxt, yymsp[-1].minor.yy652)); } break; - case 427: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ -{ yymsp[-3].minor.yy452 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy452)); } + case 433: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ +{ yymsp[-3].minor.yy652 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy652)); } break; - case 428: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy452 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy452), NULL, yymsp[-1].minor.yy452, yymsp[0].minor.yy452); } + case 434: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy652 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy652), NULL, yymsp[-1].minor.yy652, yymsp[0].minor.yy652); } break; - case 429: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy452 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy452), releaseRawExprNode(pCxt, yymsp[-3].minor.yy452), yymsp[-1].minor.yy452, yymsp[0].minor.yy452); } + case 435: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy652 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy652), releaseRawExprNode(pCxt, yymsp[-3].minor.yy652), yymsp[-1].minor.yy652, yymsp[0].minor.yy652); } break; - case 431: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - case 449: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==449); -{ yymsp[-3].minor.yy452 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy452); } + case 437: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + case 455: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==455); +{ yymsp[-3].minor.yy652 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy652); } break; - case 433: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy452 = createFillNode(pCxt, yymsp[-1].minor.yy614, NULL); } + case 439: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy652 = createFillNode(pCxt, yymsp[-1].minor.yy250, NULL); } break; - case 434: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy452 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy404)); } + case 440: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy652 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy24)); } break; - case 435: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy614 = FILL_MODE_NONE; } + case 441: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy250 = FILL_MODE_NONE; } break; - case 436: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy614 = FILL_MODE_PREV; } + case 442: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy250 = FILL_MODE_PREV; } break; - case 437: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy614 = FILL_MODE_NULL; } + case 443: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy250 = FILL_MODE_NULL; } break; - case 438: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy614 = FILL_MODE_LINEAR; } + case 444: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy250 = FILL_MODE_LINEAR; } break; - case 439: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy614 = FILL_MODE_NEXT; } + case 445: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy250 = FILL_MODE_NEXT; } break; - case 442: /* group_by_list ::= expression */ -{ yylhsminor.yy404 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy452))); } - yymsp[0].minor.yy404 = yylhsminor.yy404; + case 448: /* group_by_list ::= expression */ +{ yylhsminor.yy24 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); } + yymsp[0].minor.yy24 = yylhsminor.yy24; break; - case 443: /* group_by_list ::= group_by_list NK_COMMA expression */ -{ yylhsminor.yy404 = addNodeToList(pCxt, yymsp[-2].minor.yy404, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy452))); } - yymsp[-2].minor.yy404 = yylhsminor.yy404; + case 449: /* group_by_list ::= group_by_list NK_COMMA expression */ +{ yylhsminor.yy24 = addNodeToList(pCxt, yymsp[-2].minor.yy24, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); } + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; - case 447: /* range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ -{ yymsp[-5].minor.yy452 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy452), releaseRawExprNode(pCxt, yymsp[-1].minor.yy452)); } + case 453: /* range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ +{ yymsp[-5].minor.yy652 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy652), releaseRawExprNode(pCxt, yymsp[-1].minor.yy652)); } break; - case 450: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 456: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy452 = addOrderByClause(pCxt, yymsp[-3].minor.yy452, yymsp[-2].minor.yy404); - yylhsminor.yy452 = addSlimitClause(pCxt, yylhsminor.yy452, yymsp[-1].minor.yy452); - yylhsminor.yy452 = addLimitClause(pCxt, yylhsminor.yy452, yymsp[0].minor.yy452); + yylhsminor.yy652 = addOrderByClause(pCxt, yymsp[-3].minor.yy652, yymsp[-2].minor.yy24); + yylhsminor.yy652 = addSlimitClause(pCxt, yylhsminor.yy652, yymsp[-1].minor.yy652); + yylhsminor.yy652 = addLimitClause(pCxt, yylhsminor.yy652, yymsp[0].minor.yy652); } - yymsp[-3].minor.yy452 = yylhsminor.yy452; + yymsp[-3].minor.yy652 = yylhsminor.yy652; break; - case 452: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ -{ yylhsminor.yy452 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy452, yymsp[0].minor.yy452); } - yymsp[-3].minor.yy452 = yylhsminor.yy452; + case 458: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ +{ yylhsminor.yy652 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy652, yymsp[0].minor.yy652); } + yymsp[-3].minor.yy652 = yylhsminor.yy652; break; - case 453: /* query_expression_body ::= query_expression_body UNION query_expression_body */ -{ yylhsminor.yy452 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy452, yymsp[0].minor.yy452); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; + case 459: /* query_expression_body ::= query_expression_body UNION query_expression_body */ +{ yylhsminor.yy652 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy652, yymsp[0].minor.yy652); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; - case 455: /* query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ -{ yymsp[-5].minor.yy452 = yymsp[-4].minor.yy452; } - yy_destructor(yypParser,362,&yymsp[-3].minor); - yy_destructor(yypParser,363,&yymsp[-2].minor); - yy_destructor(yypParser,364,&yymsp[-1].minor); + case 461: /* query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ +{ yymsp[-5].minor.yy652 = yymsp[-4].minor.yy652; } + yy_destructor(yypParser,366,&yymsp[-3].minor); + yy_destructor(yypParser,367,&yymsp[-2].minor); + yy_destructor(yypParser,368,&yymsp[-1].minor); break; - case 459: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 463: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==463); -{ yymsp[-1].minor.yy452 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 465: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 469: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==469); +{ yymsp[-1].minor.yy652 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 460: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 464: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==464); -{ yymsp[-3].minor.yy452 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 466: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 470: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==470); +{ yymsp[-3].minor.yy652 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 461: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 465: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==465); -{ yymsp[-3].minor.yy452 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 467: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 471: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==471); +{ yymsp[-3].minor.yy652 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 466: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy452 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy452); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; + case 472: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy652); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; - case 470: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy452 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy452), yymsp[-1].minor.yy178, yymsp[0].minor.yy77); } - yymsp[-2].minor.yy452 = yylhsminor.yy452; + case 476: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy652 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), yymsp[-1].minor.yy598, yymsp[0].minor.yy653); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; - case 471: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy178 = ORDER_ASC; } + case 477: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy598 = ORDER_ASC; } break; - case 472: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy178 = ORDER_ASC; } + case 478: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy598 = ORDER_ASC; } break; - case 473: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy178 = ORDER_DESC; } + case 479: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy598 = ORDER_DESC; } break; - case 474: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy77 = NULL_ORDER_DEFAULT; } + case 480: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy653 = NULL_ORDER_DEFAULT; } break; - case 475: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy77 = NULL_ORDER_FIRST; } + case 481: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy653 = NULL_ORDER_FIRST; } break; - case 476: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy77 = NULL_ORDER_LAST; } + case 482: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy653 = NULL_ORDER_LAST; } break; default: break; diff --git a/source/libs/parser/test/parInsertTest.cpp b/source/libs/parser/test/parInsertTest.cpp index 3ebf9a417b437aee072a2286439d94927cd61398..22a1be25794e4c0ee19fd136cfc17586aea66c3c 100644 --- a/source/libs/parser/test/parInsertTest.cpp +++ b/source/libs/parser/test/parInsertTest.cpp @@ -265,6 +265,11 @@ TEST_F(InsertTest, autoCreateTableTest) { "insert into st1s1 using st1 (tag1, tag2) tags(1, 'wxy') values (now, 1, \"beijing\")" "(now+1s, 2, \"shanghai\")(now+2s, 3, \"guangzhou\")"); ASSERT_EQ(runAsync(), TSDB_CODE_SUCCESS); + + bind( + "insert into st1s1 using st1 tags(1, 'wxy', now) values (now, 1, \"beijing\")" + "st1s1 using st1 tags(1, 'wxy', now) values (now+1s, 2, \"shanghai\")"); + ASSERT_EQ(run(), TSDB_CODE_SUCCESS); } TEST_F(InsertTest, toleranceTest) { diff --git a/source/libs/parser/test/parSelectTest.cpp b/source/libs/parser/test/parSelectTest.cpp index f8b8dc58fcd15f574308661dbd803bae58489bf1..4ca2dec29925ab6eee7c7da66a501e0c6fe86a5f 100644 --- a/source/libs/parser/test/parSelectTest.cpp +++ b/source/libs/parser/test/parSelectTest.cpp @@ -232,8 +232,6 @@ TEST_F(ParserSelectTest, groupBySemanticCheck) { run("SELECT COUNT(*) cnt, c1 FROM t1 WHERE c1 > 0", TSDB_CODE_PAR_NOT_SINGLE_GROUP); run("SELECT COUNT(*) cnt, c2 FROM t1 WHERE c1 > 0 GROUP BY c1", TSDB_CODE_PAR_GROUPBY_LACK_EXPRESSION); - run("SELECT COUNT(*) cnt, c2 FROM t1 WHERE c1 > 0 PARTITION BY c2 GROUP BY c1", - TSDB_CODE_PAR_GROUPBY_LACK_EXPRESSION); } TEST_F(ParserSelectTest, orderBy) { @@ -425,6 +423,18 @@ TEST_F(ParserSelectTest, withoutFrom) { useDb("root", "test"); run("SELECT 1"); + + run("SELECT DATABASE()"); + + run("SELECT CLIENT_VERSION()"); + + run("SELECT SERVER_VERSION()"); + + run("SELECT SERVER_STATUS()"); + + run("SELECT CURRENT_USER()"); + + run("SELECT USER()"); } } // namespace ParserTest diff --git a/source/libs/parser/test/parTestUtil.cpp b/source/libs/parser/test/parTestUtil.cpp index 663f456cb8b17487dd4b81481ce93dae096d4130..2b312642cd65e6bd3fce71f613d79c76f21945f8 100644 --- a/source/libs/parser/test/parTestUtil.cpp +++ b/source/libs/parser/test/parTestUtil.cpp @@ -203,6 +203,7 @@ class ParserTestBaseImpl { pCxt->pMsg = stmtEnv_.msgBuf_.data(); pCxt->msgLen = stmtEnv_.msgBuf_.max_size(); pCxt->async = async; + pCxt->svrVer = "3.0.0.0"; } void doParse(SParseContext* pCxt, SQuery** pQuery) { diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index 396a7b61935023ac987d6771c41bfe3451960663..ef8b109b62c6bc943d46b4c6b09716fad098e4a5 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -437,6 +437,33 @@ static SColumnNode* createColumnByExpr(const char* pStmtName, SExprNode* pExpr) return pCol; } +static SNode* createGroupingSetNode(SNode* pExpr) { + SGroupingSetNode* pGroupingSet = (SGroupingSetNode*)nodesMakeNode(QUERY_NODE_GROUPING_SET); + if (NULL == pGroupingSet) { + return NULL; + } + pGroupingSet->groupingSetType = GP_TYPE_NORMAL; + if (TSDB_CODE_SUCCESS != nodesListMakeStrictAppend(&pGroupingSet->pParameterList, nodesCloneNode(pExpr))) { + nodesDestroyNode((SNode*)pGroupingSet); + return NULL; + } + return (SNode*)pGroupingSet; +} + +static int32_t createGroupKeysFromPartKeys(SNodeList* pPartKeys, SNodeList** pOutput) { + SNodeList* pGroupKeys = NULL; + SNode* pPartKey = NULL; + FOREACH(pPartKey, pPartKeys) { + int32_t code = nodesListMakeStrictAppend(&pGroupKeys, createGroupingSetNode(pPartKey)); + if (TSDB_CODE_SUCCESS != code) { + nodesDestroyList(pGroupKeys); + return code; + } + } + *pOutput = pGroupKeys; + return TSDB_CODE_SUCCESS; +} + static int32_t createAggLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, SLogicNode** pLogicNode) { if (!pSelect->hasAggFuncs && NULL == pSelect->pGroupByList) { return TSDB_CODE_SUCCESS; @@ -459,10 +486,18 @@ static int32_t createAggLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, code = rewriteExprsForSelect(pAgg->pAggFuncs, pSelect, SQL_CLAUSE_GROUP_BY); } + if (NULL != pSelect->pPartitionByList) { + code = createGroupKeysFromPartKeys(pSelect->pPartitionByList, &pAgg->pGroupKeys); + } + if (NULL != pSelect->pGroupByList) { - pAgg->pGroupKeys = nodesCloneList(pSelect->pGroupByList); - if (NULL == pAgg->pGroupKeys) { - code = TSDB_CODE_OUT_OF_MEMORY; + if (NULL != pAgg->pGroupKeys) { + code = nodesListStrictAppendList(pAgg->pGroupKeys, nodesCloneList(pSelect->pGroupByList)); + } else { + pAgg->pGroupKeys = nodesCloneList(pSelect->pGroupByList); + if (NULL == pAgg->pGroupKeys) { + code = TSDB_CODE_OUT_OF_MEMORY; + } } } @@ -508,6 +543,7 @@ static int32_t createIndefRowsFuncLogicNode(SLogicPlanContext* pCxt, SSelectStmt } pIdfRowsFunc->isTailFunc = pSelect->hasTailFunc; + pIdfRowsFunc->isUniqueFunc = pSelect->hasUniqueFunc; // indefinite rows functions and _select_values functions int32_t code = nodesCollectFuncs(pSelect, SQL_CLAUSE_SELECT, fmIsVectorFunc, &pIdfRowsFunc->pFuncs); @@ -809,7 +845,8 @@ static int32_t createProjectLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSel } static int32_t createPartitionLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, SLogicNode** pLogicNode) { - if (NULL == pSelect->pPartitionByList) { + if (NULL == pSelect->pPartitionByList || (pSelect->hasAggFuncs && NULL == pSelect->pWindow) || + NULL != pSelect->pGroupByList) { return TSDB_CODE_SUCCESS; } diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index 638e3f5604668fb292740d88c0a5870aa85689a4..b5b53f00a0ccda7d84495dc456cc38fdf93fb50c 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -276,7 +276,8 @@ static int32_t pushDownCondOptAppendCond(SNode** pCond, SNode** pAdditionalCond) } int32_t code = TSDB_CODE_SUCCESS; - if (QUERY_NODE_LOGIC_CONDITION == nodeType(*pCond)) { + if (QUERY_NODE_LOGIC_CONDITION == nodeType(*pCond) && + LOGIC_COND_TYPE_AND == ((SLogicConditionNode*)*pCond)->condType) { code = nodesListAppend(((SLogicConditionNode*)*pCond)->pParameterList, *pAdditionalCond); if (TSDB_CODE_SUCCESS == code) { *pAdditionalCond = NULL; @@ -987,6 +988,7 @@ static int32_t smaIndexOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pLogi code = smaIndexOptApplyIndex(pLogicSubplan, pScan, pIndex, pSmaCols, wstrartIndex); taosArrayDestroyEx(pScan->pSmaIndexes, smaIndexOptDestroySmaIndex); pScan->pSmaIndexes = NULL; + pCxt->optimized = true; break; } } @@ -1033,12 +1035,30 @@ static SNodeList* partTagsGetPartKeys(SLogicNode* pNode) { } } +static SNodeList* partTagsGetFuncs(SLogicNode* pNode) { + if (QUERY_NODE_LOGIC_PLAN_PARTITION == nodeType(pNode)) { + return NULL; + } else { + return ((SAggLogicNode*)pNode)->pAggFuncs; + } +} + +static bool partTagsOptAreSupportedFuncs(SNodeList* pFuncs) { + SNode* pFunc = NULL; + FOREACH(pFunc, pFuncs) { + if (fmIsIndefiniteRowsFunc(((SFunctionNode*)pFunc)->funcId) && !fmIsSelectFunc(((SFunctionNode*)pFunc)->funcId)) { + return false; + } + } + return true; +} + static bool partTagsOptMayBeOptimized(SLogicNode* pNode) { if (!partTagsIsOptimizableNode(pNode)) { return false; } - return !partTagsOptHasCol(partTagsGetPartKeys(pNode)); + return !partTagsOptHasCol(partTagsGetPartKeys(pNode)) && partTagsOptAreSupportedFuncs(partTagsGetFuncs(pNode)); } static EDealRes partTagsOptRebuildTbanmeImpl(SNode** pNode, void* pContext) { @@ -1064,6 +1084,64 @@ static int32_t partTagsOptRebuildTbanme(SNodeList* pPartKeys) { return code; } +// todo refact: just to mask compilation warnings +static void partTagsSetAlias(char* pAlias, int32_t len, const char* pTableAlias, const char* pColName) { + snprintf(pAlias, len, "%s.%s", pTableAlias, pColName); +} + +static SNode* partTagsCreateWrapperFunc(const char* pFuncName, SNode* pNode) { + SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); + if (NULL == pFunc) { + return NULL; + } + + strcpy(pFunc->functionName, pFuncName); + if (QUERY_NODE_COLUMN == nodeType(pNode)) { + SColumnNode* pCol = (SColumnNode*)pNode; + partTagsSetAlias(pFunc->node.aliasName, sizeof(pFunc->node.aliasName), pCol->tableAlias, pCol->colName); + } else { + strcpy(pFunc->node.aliasName, ((SExprNode*)pNode)->aliasName); + } + int32_t code = nodesListMakeStrictAppend(&pFunc->pParameterList, nodesCloneNode(pNode)); + if (TSDB_CODE_SUCCESS == code) { + code = fmGetFuncInfo(pFunc, NULL, 0); + } + + if (TSDB_CODE_SUCCESS != code) { + nodesDestroyNode((SNode*)pFunc); + return NULL; + } + + return (SNode*)pFunc; +} + +static bool partTagsHasIndefRowsSelectFunc(SNodeList* pFuncs) { + SNode* pFunc = NULL; + FOREACH(pFunc, pFuncs) { + if (fmIsIndefiniteRowsFunc(((SFunctionNode*)pFunc)->funcId)) { + return true; + } + } + return false; +} + +static int32_t partTagsRewriteGroupTagsToFuncs(SNodeList* pGroupTags, SNodeList* pAggFuncs) { + bool hasIndefRowsSelectFunc = partTagsHasIndefRowsSelectFunc(pAggFuncs); + int32_t code = TSDB_CODE_SUCCESS; + SNode* pNode = NULL; + FOREACH(pNode, pGroupTags) { + if (hasIndefRowsSelectFunc) { + code = nodesListStrictAppend(pAggFuncs, partTagsCreateWrapperFunc("_select_value", pNode)); + } else { + code = nodesListStrictAppend(pAggFuncs, partTagsCreateWrapperFunc("_group_key", pNode)); + } + if (TSDB_CODE_SUCCESS != code) { + break; + } + } + return code; +} + static int32_t partTagsOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan) { SLogicNode* pNode = optFindPossibleNode(pLogicSubplan->pNode, partTagsOptMayBeOptimized); if (NULL == pNode) { @@ -1080,15 +1158,17 @@ static int32_t partTagsOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSub nodesDestroyNode((SNode*)pNode); } } else { - SNode* pGroupKey = NULL; - FOREACH(pGroupKey, ((SAggLogicNode*)pNode)->pGroupKeys) { + SAggLogicNode* pAgg = (SAggLogicNode*)pNode; + SNode* pGroupKey = NULL; + FOREACH(pGroupKey, pAgg->pGroupKeys) { code = nodesListMakeStrictAppend( &pScan->pGroupTags, nodesCloneNode(nodesListGetNode(((SGroupingSetNode*)pGroupKey)->pParameterList, 0))); if (TSDB_CODE_SUCCESS != code) { break; } } - NODES_DESTORY_LIST(((SAggLogicNode*)pNode)->pGroupKeys); + NODES_DESTORY_LIST(pAgg->pGroupKeys); + code = partTagsRewriteGroupTagsToFuncs(pScan->pGroupTags, pAgg->pAggFuncs); } if (TSDB_CODE_SUCCESS == code) { code = partTagsOptRebuildTbanme(pScan->pGroupTags); @@ -1125,7 +1205,8 @@ static bool eliminateProjOptMayBeOptimized(SLogicNode* pNode) { } SProjectLogicNode* pProjectNode = (SProjectLogicNode*)pNode; - if (NULL != pProjectNode->node.pLimit || NULL != pProjectNode->node.pSlimit) { + if (NULL != pProjectNode->node.pLimit || NULL != pProjectNode->node.pSlimit || + NULL != pProjectNode->node.pConditions) { return false; } @@ -1163,6 +1244,7 @@ static int32_t eliminateProjOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* NODES_CLEAR_LIST(pProjectNode->node.pChildren); nodesDestroyNode((SNode*)pProjectNode); } + pCxt->optimized = true; return code; } @@ -1306,6 +1388,7 @@ static int32_t rewriteTailOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pL nodesDestroyNode((SNode*)pSort); nodesDestroyNode((SNode*)pProject); } + pCxt->optimized = true; return code; } @@ -1344,6 +1427,7 @@ static int32_t eliminateSetOpOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pSetOpNode->pChildren = NULL; ERASE_NODE(pSetOpNode->pParent->pChildren); + pCxt->optimized = true; return TSDB_CODE_SUCCESS; } } @@ -1360,15 +1444,192 @@ static int32_t eliminateSetOpOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLo return eliminateSetOpOptimizeImpl(pCxt, pLogicSubplan, pSetOpNode); } -//=================================================================================================================== +static bool rewriteUniqueOptMayBeOptimized(SLogicNode* pNode) { + return QUERY_NODE_LOGIC_PLAN_INDEF_ROWS_FUNC == nodeType(pNode) && ((SIndefRowsFuncLogicNode*)pNode)->isUniqueFunc; +} + +static SNode* rewriteUniqueOptCreateGroupingSet(SNode* pExpr) { + SGroupingSetNode* pGroupingSet = (SGroupingSetNode*)nodesMakeNode(QUERY_NODE_GROUPING_SET); + if (NULL == pGroupingSet) { + return NULL; + } + pGroupingSet->groupingSetType = GP_TYPE_NORMAL; + SExprNode* pGroupExpr = (SExprNode*)nodesCloneNode(pExpr); + if (TSDB_CODE_SUCCESS != nodesListMakeStrictAppend(&pGroupingSet->pParameterList, (SNode*)pGroupExpr)) { + nodesDestroyNode((SNode*)pGroupingSet); + return NULL; + } + return (SNode*)pGroupingSet; +} + +static SNode* rewriteUniqueOptCreateFirstFunc(SFunctionNode* pSelectValue, SNode* pCol) { + SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); + if (NULL == pFunc) { + return NULL; + } + + strcpy(pFunc->functionName, "first"); + if (NULL != pSelectValue) { + strcpy(pFunc->node.aliasName, pSelectValue->node.aliasName); + } else { + snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName), "%s.%p", pFunc->functionName, pFunc); + } + int32_t code = nodesListMakeStrictAppend(&pFunc->pParameterList, nodesCloneNode(pCol)); + if (TSDB_CODE_SUCCESS == code) { + code = fmGetFuncInfo(pFunc, NULL, 0); + } + + if (TSDB_CODE_SUCCESS != code) { + nodesDestroyNode((SNode*)pFunc); + return NULL; + } + + return (SNode*)pFunc; +} + +static int32_t rewriteUniqueOptCreateAgg(SIndefRowsFuncLogicNode* pIndef, SLogicNode** pOutput) { + SAggLogicNode* pAgg = (SAggLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_AGG); + if (NULL == pAgg) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + TSWAP(pAgg->node.pChildren, pIndef->node.pChildren); + pAgg->node.precision = pIndef->node.precision; + + int32_t code = TSDB_CODE_SUCCESS; + bool hasSelectPrimaryKey = false; + SNode* pPrimaryKey = NULL; + SNode* pNode = NULL; + FOREACH(pNode, pIndef->pFuncs) { + SFunctionNode* pFunc = (SFunctionNode*)pNode; + SNode* pExpr = nodesListGetNode(pFunc->pParameterList, 0); + if (FUNCTION_TYPE_UNIQUE == pFunc->funcType) { + pPrimaryKey = nodesListGetNode(pFunc->pParameterList, 1); + code = nodesListMakeStrictAppend(&pAgg->pGroupKeys, rewriteUniqueOptCreateGroupingSet(pExpr)); + } else if (PRIMARYKEY_TIMESTAMP_COL_ID == ((SColumnNode*)pExpr)->colId) { // _select_value(ts) => first(ts) + hasSelectPrimaryKey = true; + code = nodesListMakeStrictAppend(&pAgg->pAggFuncs, rewriteUniqueOptCreateFirstFunc(pFunc, pExpr)); + } else { // _select_value(other_col) + code = nodesListMakeStrictAppend(&pAgg->pAggFuncs, nodesCloneNode(pNode)); + } + if (TSDB_CODE_SUCCESS != code) { + break; + } + } + + if (TSDB_CODE_SUCCESS == code) { + code = createColumnByRewriteExprs(pAgg->pGroupKeys, &pAgg->node.pTargets); + } + if (TSDB_CODE_SUCCESS == code && NULL != pAgg->pAggFuncs) { + code = createColumnByRewriteExprs(pAgg->pAggFuncs, &pAgg->node.pTargets); + } + + if (TSDB_CODE_SUCCESS == code && !hasSelectPrimaryKey && NULL != pAgg->pAggFuncs) { + code = nodesListMakeStrictAppend(&pAgg->pAggFuncs, rewriteUniqueOptCreateFirstFunc(NULL, pPrimaryKey)); + } + + if (TSDB_CODE_SUCCESS == code) { + *pOutput = (SLogicNode*)pAgg; + } else { + nodesDestroyNode((SNode*)pAgg); + } + return code; +} + +static SNode* rewriteUniqueOptCreateProjectCol(SFunctionNode* pFunc) { + SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN); + if (NULL == pCol) { + return NULL; + } + + pCol->node.resType = pFunc->node.resType; + if (FUNCTION_TYPE_UNIQUE == pFunc->funcType) { + SExprNode* pExpr = (SExprNode*)nodesListGetNode(pFunc->pParameterList, 0); + if (QUERY_NODE_COLUMN == nodeType(pExpr)) { + strcpy(pCol->tableAlias, ((SColumnNode*)pExpr)->tableAlias); + strcpy(pCol->colName, ((SColumnNode*)pExpr)->colName); + } else { + strcpy(pCol->colName, pExpr->aliasName); + } + } else { + strcpy(pCol->colName, pFunc->node.aliasName); + } + strcpy(pCol->node.aliasName, pFunc->node.aliasName); + + return (SNode*)pCol; +} + +static int32_t rewriteUniqueOptCreateProject(SIndefRowsFuncLogicNode* pIndef, SLogicNode** pOutput) { + SProjectLogicNode* pProject = (SProjectLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_PROJECT); + if (NULL == pProject) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + TSWAP(pProject->node.pTargets, pIndef->node.pTargets); + pProject->node.precision = pIndef->node.precision; + + int32_t code = TSDB_CODE_SUCCESS; + SNode* pNode = NULL; + FOREACH(pNode, pIndef->pFuncs) { + code = nodesListMakeStrictAppend(&pProject->pProjections, rewriteUniqueOptCreateProjectCol((SFunctionNode*)pNode)); + if (TSDB_CODE_SUCCESS != code) { + break; + } + } + + if (TSDB_CODE_SUCCESS == code) { + *pOutput = (SLogicNode*)pProject; + } else { + nodesDestroyNode((SNode*)pProject); + } + return code; +} + +static int32_t rewriteUniqueOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan, + SIndefRowsFuncLogicNode* pIndef) { + SLogicNode* pAgg = NULL; + SLogicNode* pProject = NULL; + int32_t code = rewriteUniqueOptCreateAgg(pIndef, &pAgg); + if (TSDB_CODE_SUCCESS == code) { + code = rewriteUniqueOptCreateProject(pIndef, &pProject); + } + if (TSDB_CODE_SUCCESS == code) { + code = nodesListMakeAppend(&pProject->pChildren, (SNode*)pAgg); + pAgg->pParent = pProject; + pAgg = NULL; + } + if (TSDB_CODE_SUCCESS == code) { + code = replaceLogicNode(pLogicSubplan, (SLogicNode*)pIndef, pProject); + } + if (TSDB_CODE_SUCCESS == code) { + nodesDestroyNode((SNode*)pIndef); + } else { + nodesDestroyNode((SNode*)pAgg); + nodesDestroyNode((SNode*)pProject); + } + pCxt->optimized = true; + return code; +} + +static int32_t rewriteUniqueOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan) { + SIndefRowsFuncLogicNode* pIndef = + (SIndefRowsFuncLogicNode*)optFindPossibleNode(pLogicSubplan->pNode, rewriteUniqueOptMayBeOptimized); + + if (NULL == pIndef) { + return TSDB_CODE_SUCCESS; + } + + return rewriteUniqueOptimizeImpl(pCxt, pLogicSubplan, pIndef); +} + // merge projects static bool mergeProjectsMayBeOptimized(SLogicNode* pNode) { if (QUERY_NODE_LOGIC_PLAN_PROJECT != nodeType(pNode) || 1 != LIST_LENGTH(pNode->pChildren)) { return false; } - SLogicNode *pChild = (SLogicNode*)nodesListGetNode(pNode->pChildren, 0); + SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pNode->pChildren, 0); if (QUERY_NODE_LOGIC_PLAN_PROJECT != nodeType(pChild) || 1 < LIST_LENGTH(pChild->pChildren) || - NULL != pChild->pConditions || NULL != pNode->pLimit || NULL != pNode->pSlimit) { + NULL != pChild->pConditions || NULL != pChild->pLimit || NULL != pChild->pSlimit) { return false; } return true; @@ -1376,12 +1637,12 @@ static bool mergeProjectsMayBeOptimized(SLogicNode* pNode) { typedef struct SMergeProjectionsContext { SProjectLogicNode* pChildProj; - int32_t errCode; + int32_t errCode; } SMergeProjectionsContext; static EDealRes mergeProjectionsExpr(SNode** pNode, void* pContext) { SMergeProjectionsContext* pCxt = pContext; - SProjectLogicNode* pChildProj = pCxt->pChildProj; + SProjectLogicNode* pChildProj = pCxt->pChildProj; if (QUERY_NODE_COLUMN == nodeType(*pNode)) { SNode* pTarget; FOREACH(pTarget, ((SLogicNode*)pChildProj)->pTargets) { @@ -1406,7 +1667,7 @@ static EDealRes mergeProjectionsExpr(SNode** pNode, void* pContext) { } static int32_t mergeProjectsOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan, SLogicNode* pSelfNode) { - SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pSelfNode->pChildren, 0); + SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pSelfNode->pChildren, 0); SMergeProjectionsContext cxt = {.pChildProj = (SProjectLogicNode*)pChild, .errCode = TSDB_CODE_SUCCESS}; nodesRewriteExprs(((SProjectLogicNode*)pSelfNode)->pProjections, mergeProjectionsExpr, &cxt); @@ -1425,6 +1686,7 @@ static int32_t mergeProjectsOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* NODES_CLEAR_LIST(pChild->pChildren); } nodesDestroyNode((SNode*)pChild); + pCxt->optimized = true; return code; } @@ -1447,23 +1709,37 @@ static const SOptimizeRule optimizeRuleSet[] = { {.pName = "MergeProjects", .optimizeFunc = mergeProjectsOptimize}, {.pName = "EliminateProject", .optimizeFunc = eliminateProjOptimize}, {.pName = "EliminateSetOperator", .optimizeFunc = eliminateSetOpOptimize}, - {.pName = "RewriteTail", .optimizeFunc = rewriteTailOptimize} + {.pName = "RewriteTail", .optimizeFunc = rewriteTailOptimize}, + {.pName = "RewriteUnique", .optimizeFunc = rewriteUniqueOptimize} }; // clang-format on static const int32_t optimizeRuleNum = (sizeof(optimizeRuleSet) / sizeof(SOptimizeRule)); +static void dumpLogicSubplan(const char* pRuleName, SLogicSubplan* pSubplan) { + char* pStr = NULL; + nodesNodeToString((SNode*)pSubplan, false, &pStr, NULL); + qDebugL("apply optimize %s rule: %s", pRuleName, pStr); + taosMemoryFree(pStr); +} + static int32_t applyOptimizeRule(SPlanContext* pCxt, SLogicSubplan* pLogicSubplan) { SOptimizeContext cxt = {.pPlanCxt = pCxt, .optimized = false}; + bool optimized = false; do { - cxt.optimized = false; + optimized = false; for (int32_t i = 0; i < optimizeRuleNum; ++i) { + cxt.optimized = false; int32_t code = optimizeRuleSet[i].optimizeFunc(&cxt, pLogicSubplan); if (TSDB_CODE_SUCCESS != code) { return code; } + if (cxt.optimized) { + optimized = true; + dumpLogicSubplan(optimizeRuleSet[i].pName, pLogicSubplan); + } } - } while (cxt.optimized); + } while (optimized); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c index 49ab50f9132aa0393c55282bdcc55c4f6d0c1d12..9d23df5bda67f6c3768f98063eb406e1da9a822b 100644 --- a/source/libs/planner/src/planSpliter.c +++ b/source/libs/planner/src/planSpliter.c @@ -1237,7 +1237,7 @@ static const int32_t splitRuleNum = (sizeof(splitRuleSet) / sizeof(SSplitRule)); static void dumpLogicSubplan(const char* pRuleName, SLogicSubplan* pSubplan) { char* pStr = NULL; nodesNodeToString((SNode*)pSubplan, false, &pStr, NULL); - qDebugL("apply %s rule: %s", pRuleName, pStr); + qDebugL("apply split %s rule: %s", pRuleName, pStr); taosMemoryFree(pStr); } diff --git a/source/libs/planner/src/planner.c b/source/libs/planner/src/planner.c index e75c8375fb766a662b87c8e5c7e43af28a45b097..f3174ce70a14f335c945ba2f539deb85c1285d0b 100644 --- a/source/libs/planner/src/planner.c +++ b/source/libs/planner/src/planner.c @@ -85,6 +85,23 @@ int32_t qSetSubplanExecutionNode(SSubplan* subplan, int32_t groupId, SDownstream return setSubplanExecutionNode(subplan->pNode, groupId, pSource); } +static void clearSubplanExecutionNode(SPhysiNode* pNode) { + if (QUERY_NODE_PHYSICAL_PLAN_EXCHANGE == nodeType(pNode)) { + SExchangePhysiNode* pExchange = (SExchangePhysiNode*)pNode; + NODES_DESTORY_LIST(pExchange->pSrcEndPoints); + } else if (QUERY_NODE_PHYSICAL_PLAN_MERGE == nodeType(pNode)) { + SMergePhysiNode* pMerge = (SMergePhysiNode*)pNode; + pMerge->numOfChannels = LIST_LENGTH(pMerge->node.pChildren); + SNode* pChild = NULL; + FOREACH(pChild, pMerge->node.pChildren) { NODES_DESTORY_LIST(((SExchangePhysiNode*)pChild)->pSrcEndPoints); } + } + + SNode* pChild = NULL; + FOREACH(pChild, pNode->pChildren) { clearSubplanExecutionNode((SPhysiNode*)pChild); } +} + +void qClearSubplanExecutionNode(SSubplan* pSubplan) { clearSubplanExecutionNode(pSubplan->pNode); } + int32_t qSubPlanToString(const SSubplan* pSubplan, char** pStr, int32_t* pLen) { if (SUBPLAN_TYPE_MODIFY == pSubplan->subplanType && NULL == pSubplan->pNode) { SDataInserterNode* insert = (SDataInserterNode*)pSubplan->pDataSink; diff --git a/source/libs/planner/test/planBasicTest.cpp b/source/libs/planner/test/planBasicTest.cpp index 8c19b52a09515531e01f5210bd9fb92870587c2a..ff725c444e108e41a9f755ff69642f7faf8bdd0c 100644 --- a/source/libs/planner/test/planBasicTest.cpp +++ b/source/libs/planner/test/planBasicTest.cpp @@ -56,6 +56,8 @@ TEST_F(PlanBasicTest, uniqueFunc) { run("SELECT UNIQUE(c2 + 10) FROM t1 WHERE c1 > 10"); + run("SELECT UNIQUE(c2 + 10), c2 FROM t1 WHERE c1 > 10"); + run("SELECT UNIQUE(c2 + 10), ts, c2 FROM t1 WHERE c1 > 10"); run("SELECT UNIQUE(c1) a FROM t1 ORDER BY a"); @@ -75,6 +77,8 @@ TEST_F(PlanBasicTest, tailFunc) { run("SELECT TAIL(c2 + 10, 10, 80) FROM t1 WHERE c1 > 10 LIMIT 5"); run("SELECT TAIL(c2 + 10, 10, 80) FROM t1 WHERE c1 > 10 PARTITION BY c1 LIMIT 5"); + + run("SELECT TAIL(c1, 2, 1) FROM st1s1 UNION ALL SELECT c1 FROM st1s2"); } TEST_F(PlanBasicTest, interpFunc) { @@ -97,6 +101,16 @@ TEST_F(PlanBasicTest, lastRowFunc) { run("SELECT LAST_ROW(c1) FROM st1"); } +TEST_F(PlanBasicTest, sampleFunc) { + useDb("root", "test"); + + run("SELECT SAMPLE(c1, 10) FROM t1"); + + run("SELECT SAMPLE(c1, 10) FROM st1"); + + run("SELECT SAMPLE(c1, 10) FROM st1 PARTITION BY TBNAME"); +} + TEST_F(PlanBasicTest, withoutFrom) { useDb("root", "test"); diff --git a/source/libs/planner/test/planOptimizeTest.cpp b/source/libs/planner/test/planOptimizeTest.cpp index 9bd95a79f98d5212db3a50d11a40cad665c65871..6a9a711daceb4ebf9fc9f7256d03496c0a7bedaf 100644 --- a/source/libs/planner/test/planOptimizeTest.cpp +++ b/source/libs/planner/test/planOptimizeTest.cpp @@ -20,7 +20,7 @@ using namespace std; class PlanOptimizeTest : public PlannerTestBase {}; -TEST_F(PlanOptimizeTest, optimizeScanData) { +TEST_F(PlanOptimizeTest, scanPath) { useDb("root", "test"); run("SELECT COUNT(*) FROM t1"); @@ -32,7 +32,7 @@ TEST_F(PlanOptimizeTest, optimizeScanData) { run("SELECT PERCENTILE(c1, 40), COUNT(*) FROM t1"); } -TEST_F(PlanOptimizeTest, ConditionPushDown) { +TEST_F(PlanOptimizeTest, pushDownCondition) { useDb("root", "test"); run("SELECT ts, c1 FROM st1 WHERE tag1 > 4"); @@ -42,9 +42,11 @@ TEST_F(PlanOptimizeTest, ConditionPushDown) { run("SELECT ts, c1 FROM st1 WHERE tag1 > 4 AND tag2 = 'hello'"); run("SELECT ts, c1 FROM st1 WHERE tag1 > 4 AND tag2 = 'hello' AND c1 > 10"); + + run("SELECT ts, c1 FROM (SELECT * FROM st1) WHERE tag1 > 4"); } -TEST_F(PlanOptimizeTest, orderByPrimaryKey) { +TEST_F(PlanOptimizeTest, sortPrimaryKey) { useDb("root", "test"); run("SELECT c1 FROM t1 ORDER BY ts"); diff --git a/source/libs/planner/test/planTestUtil.cpp b/source/libs/planner/test/planTestUtil.cpp index d54859c296a927707321aca9084ed2b8354c83b6..d19e277a7d5608711c31612262415fa4cff3b10a 100644 --- a/source/libs/planner/test/planTestUtil.cpp +++ b/source/libs/planner/test/planTestUtil.cpp @@ -310,6 +310,7 @@ class PlannerTestBaseImpl { cxt.sqlLen = stmtEnv_.sql_.length(); cxt.pMsg = stmtEnv_.msgBuf_.data(); cxt.msgLen = stmtEnv_.msgBuf_.max_size(); + cxt.svrVer = "3.0.0.0"; DO_WITH_THROW(qParseSql, &cxt, pQuery); if (prepare) { diff --git a/source/libs/qcom/src/queryUtil.c b/source/libs/qcom/src/queryUtil.c index bee0461e58d30ca5933c20642f0c2a727ceab900..9ba149a33bbe516de0b39c58918e90fb046636d5 100644 --- a/source/libs/qcom/src/queryUtil.c +++ b/source/libs/qcom/src/queryUtil.c @@ -420,7 +420,7 @@ int32_t cloneDbVgInfo(SDBVgInfo* pSrc, SDBVgInfo** pDst) { taosHashCancelIterate(pSrc->vgHash, pIter); taosHashCleanup((*pDst)->vgHash); taosMemoryFreeClear(*pDst); - return TSDB_CODE_CTG_MEM_ERROR; + return TSDB_CODE_OUT_OF_MEMORY; } pIter = taosHashIterate(pSrc->vgHash, pIter); diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index 75a9bc3809632f88601f8628add9aed4b8365cf4..cef8ff707564558835c57cefb59515858d2e2688 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -936,6 +936,25 @@ EDealRes sclCalcWalker(SNode* pNode, void* pContext) { return DEAL_RES_ERROR; } +int32_t sclExtendResRows(SScalarParam *pDst, SScalarParam *pSrc, SArray *pBlockList) { + SSDataBlock* pb = taosArrayGetP(pBlockList, 0); + SScalarParam *pLeft = taosMemoryCalloc(1, sizeof(SScalarParam)); + if (NULL == pLeft) { + sclError("calloc %d failed", (int32_t)sizeof(SScalarParam)); + SCL_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); + } + + pLeft->numOfRows = pb->info.rows; + colInfoDataEnsureCapacity(pDst->columnData, pb->info.rows); + + _bin_scalar_fn_t OperatorFn = getBinScalarOperatorFn(OP_TYPE_ASSIGN); + OperatorFn(pLeft, pSrc, pDst, TSDB_ORDER_ASC); + + taosMemoryFree(pLeft); + + return TSDB_CODE_SUCCESS; +} + int32_t scalarCalculateConstants(SNode *pNode, SNode **pRes) { if (NULL == pNode) { SCL_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); @@ -983,9 +1002,14 @@ int32_t scalarCalculate(SNode *pNode, SArray *pBlockList, SScalarParam *pDst) { SCL_ERR_JRET(TSDB_CODE_QRY_APP_ERROR); } - colInfoDataEnsureCapacity(pDst->columnData, res->numOfRows); - colDataAssign(pDst->columnData, res->columnData, res->numOfRows, NULL); - pDst->numOfRows = res->numOfRows; + if (1 == res->numOfRows) { + SCL_ERR_JRET(sclExtendResRows(pDst, res, pBlockList)); + } else { + colInfoDataEnsureCapacity(pDst->columnData, res->numOfRows); + colDataAssign(pDst->columnData, res->columnData, res->numOfRows, NULL); + pDst->numOfRows = res->numOfRows; + } + taosHashRemove(ctx.pRes, (void *)&pNode, POINTER_BYTES); } diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index 80bebafef2f5bebc6e923b236267ca1ab410b2b3..b7c171db2ea320af3b558bf1792fa58718491260 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -1192,10 +1192,10 @@ int32_t toJsonFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOu int32_t timeTruncateFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { int32_t type = GET_PARAM_TYPE(&pInput[0]); - int32_t timePrec = GET_PARAM_PRECISON(&pInput[0]); - int64_t timeUnit, timeVal = 0; + int64_t timeUnit, timePrec, timeVal = 0; GET_TYPED_DATA(timeUnit, int64_t, GET_PARAM_TYPE(&pInput[1]), pInput[1].columnData->pData); + GET_TYPED_DATA(timePrec, int64_t, GET_PARAM_TYPE(&pInput[2]), pInput[2].columnData->pData); int64_t factor = (timePrec == TSDB_TIME_PRECISION_MILLI) ? 1000 : (timePrec == TSDB_TIME_PRECISION_MICRO ? 1000000 : 1000000000); @@ -1380,10 +1380,12 @@ int32_t timeTruncateFunction(SScalarParam *pInput, int32_t inputNum, SScalarPara } int32_t timeDiffFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { - int32_t timePrec = GET_PARAM_PRECISON(&pInput[0]); - int64_t timeUnit = -1, timeVal[2] = {0}; - if (inputNum == 3) { + int64_t timeUnit = -1, timePrec, timeVal[2] = {0}; + if (inputNum == 4) { GET_TYPED_DATA(timeUnit, int64_t, GET_PARAM_TYPE(&pInput[2]), pInput[2].columnData->pData); + GET_TYPED_DATA(timePrec, int64_t, GET_PARAM_TYPE(&pInput[3]), pInput[3].columnData->pData); + } else { + GET_TYPED_DATA(timePrec, int64_t, GET_PARAM_TYPE(&pInput[2]), pInput[2].columnData->pData); } int32_t numOfRows = 0; diff --git a/source/libs/scheduler/inc/schedulerInt.h b/source/libs/scheduler/inc/schedulerInt.h index 6b2570c5b70132032c7df84107aa2b294b79233a..5998ab6965d1d5b0f5ccd350d30bb6a3f79b657f 100644 --- a/source/libs/scheduler/inc/schedulerInt.h +++ b/source/libs/scheduler/inc/schedulerInt.h @@ -99,8 +99,8 @@ typedef struct SSchStat { typedef struct SSchResInfo { SQueryResult* queryRes; void** fetchRes; - schedulerExecCallback execFp; - schedulerFetchCallback fetchFp; + schedulerExecFp execFp; + schedulerFetchFp fetchFp; void* userParam; } SSchResInfo; @@ -204,39 +204,38 @@ typedef struct { } SSchOpStatus; typedef struct SSchJob { - int64_t refId; - uint64_t queryId; - SSchJobAttr attr; - int32_t levelNum; - int32_t taskNum; - SRequestConnInfo conn; - SArray *nodeList; // qnode/vnode list, SArray - SArray *levels; // starting from 0. SArray - SNodeList *subPlans; // subplan pointer copied from DAG, no need to free it in scheduler - - SArray *dataSrcTasks; // SArray - int32_t levelIdx; - SEpSet dataSrcEps; - SHashObj *taskList; - SHashObj *execTasks; // executing tasks, key:taskid, value:SQueryTask* - SHashObj *succTasks; // succeed tasks, key:taskid, value:SQueryTask* - SHashObj *failTasks; // failed tasks, key:taskid, value:SQueryTask* - SHashObj *flowCtrl; // key is ep, element is SSchFlowControl - - SExplainCtx *explainCtx; - int8_t status; - SQueryNodeAddr resNode; - tsem_t rspSem; - SSchOpStatus opStatus; - bool *reqKilled; - SSchTask *fetchTask; - int32_t errCode; - SRWLatch resLock; - SQueryExecRes execRes; - void *resData; //TODO free it or not - int32_t resNumOfRows; - SSchResInfo userRes; - const char *sql; + int64_t refId; + uint64_t queryId; + SSchJobAttr attr; + int32_t levelNum; + int32_t taskNum; + SRequestConnInfo conn; + SArray *nodeList; // qnode/vnode list, SArray + SArray *levels; // starting from 0. SArray + SQueryPlan *pDag; + + SArray *dataSrcTasks; // SArray + int32_t levelIdx; + SEpSet dataSrcEps; + SHashObj *taskList; + SHashObj *execTasks; // executing and executed tasks, key:taskid, value:SQueryTask* + SHashObj *flowCtrl; // key is ep, element is SSchFlowControl + + SExplainCtx *explainCtx; + int8_t status; + SQueryNodeAddr resNode; + tsem_t rspSem; + SSchOpStatus opStatus; + schedulerChkKillFp chkKillFp; + void* chkKillParam; + SSchTask *fetchTask; + int32_t errCode; + SRWLatch resLock; + SQueryExecRes execRes; + void *resData; //TODO free it or not + int32_t resNumOfRows; + SSchResInfo userRes; + const char *sql; SQueryProfileSummary summary; } SSchJob; @@ -334,13 +333,13 @@ extern SSchedulerMgmt schMgmt; #define SCH_UNLOCK(type, _lock) (SCH_READ == (type) ? taosRUnLockLatch(_lock) : taosWUnLockLatch(_lock)) -void schDeregisterTaskHb(SSchJob *pJob, SSchTask *pTask); -void schCleanClusterHb(void* pTrans); +void schDeregisterTaskHb(SSchJob *pJob, SSchTask *pTask); +void schCleanClusterHb(void* pTrans); int32_t schLaunchTask(SSchJob *job, SSchTask *task); int32_t schBuildAndSendMsg(SSchJob *job, SSchTask *task, SQueryNodeAddr *addr, int32_t msgType); SSchJob *schAcquireJob(int64_t refId); int32_t schReleaseJob(int64_t refId); -void schFreeFlowCtrl(SSchJob *pJob); +void schFreeFlowCtrl(SSchJob *pJob); int32_t schChkJobNeedFlowCtrl(SSchJob *pJob, SSchLevel *pLevel); int32_t schDecTaskFlowQuota(SSchJob *pJob, SSchTask *pTask); int32_t schCheckIncTaskFlowQuota(SSchJob *pJob, SSchTask *pTask, bool *enough); @@ -351,38 +350,40 @@ int32_t schProcessOnTaskFailure(SSchJob *pJob, SSchTask *pTask, int32_t errCode) int32_t schBuildAndSendHbMsg(SQueryNodeEpId *nodeEpId, SArray* taskAction); int32_t schCloneSMsgSendInfo(void *src, void **dst); int32_t schValidateAndBuildJob(SQueryPlan *pDag, SSchJob *pJob); -void schFreeJobImpl(void *job); +void schFreeJobImpl(void *job); int32_t schMakeHbRpcCtx(SSchJob *pJob, SSchTask *pTask, SRpcCtx *pCtx); int32_t schEnsureHbConnection(SSchJob *pJob, SSchTask *pTask); int32_t schUpdateHbConnection(SQueryNodeEpId *epId, SSchTrans *trans); int32_t schHandleHbCallback(void *param, const SDataBuf *pMsg, int32_t code); -void schFreeRpcCtx(SRpcCtx *pCtx); +void schFreeRpcCtx(SRpcCtx *pCtx); int32_t schGetCallbackFp(int32_t msgType, __async_send_cb_fn_t *fp); -bool schJobNeedToStop(SSchJob *pJob, int8_t *pStatus); +bool schJobNeedToStop(SSchJob *pJob, int8_t *pStatus); int32_t schProcessOnTaskSuccess(SSchJob *pJob, SSchTask *pTask); int32_t schSaveJobQueryRes(SSchJob *pJob, SQueryTableRsp *rsp); int32_t schProcessOnExplainDone(SSchJob *pJob, SSchTask *pTask, SRetrieveTableRsp *pRsp); -void schProcessOnDataFetched(SSchJob *job); +void schProcessOnDataFetched(SSchJob *job); int32_t schGetTaskInJob(SSchJob *pJob, uint64_t taskId, SSchTask **pTask); -void schFreeRpcCtxVal(const void *arg); +void schFreeRpcCtxVal(const void *arg); int32_t schMakeBrokenLinkVal(SSchJob *pJob, SSchTask *pTask, SRpcBrokenlinkVal *brokenVal, bool isHb); int32_t schAppendTaskExecNode(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, int32_t execIdx); int32_t schExecStaticExplainJob(SSchedulerReq *pReq, int64_t *job, bool sync); -int32_t schExecJobImpl(SSchedulerReq *pReq, int64_t *job, SQueryResult* pRes, bool sync); +int32_t schExecJobImpl(SSchedulerReq *pReq, SSchJob *pJob, bool sync); int32_t schUpdateJobStatus(SSchJob *pJob, int8_t newStatus); int32_t schCancelJob(SSchJob *pJob); int32_t schProcessOnJobDropped(SSchJob *pJob, int32_t errCode); uint64_t schGenTaskId(void); -void schCloseJobRef(void); +void schCloseJobRef(void); int32_t schExecJob(SSchedulerReq *pReq, int64_t *pJob, SQueryResult *pRes); int32_t schAsyncExecJob(SSchedulerReq *pReq, int64_t *pJob); int32_t schFetchRows(SSchJob *pJob); int32_t schAsyncFetchRows(SSchJob *pJob); int32_t schUpdateTaskHandle(SSchJob *pJob, SSchTask *pTask, bool dropExecNode, void *handle, int32_t execIdx); int32_t schProcessOnTaskStatusRsp(SQueryNodeEpId* pEpId, SArray* pStatusList); -void schFreeSMsgSendInfo(SMsgSendInfo *msgSendInfo); -char* schGetOpStr(SCH_OP_TYPE type); +void schFreeSMsgSendInfo(SMsgSendInfo *msgSendInfo); +char* schGetOpStr(SCH_OP_TYPE type); int32_t schBeginOperation(SSchJob *pJob, SCH_OP_TYPE type, bool sync); +int32_t schInitJob(SSchedulerReq *pReq, SSchJob **pSchJob); +int32_t schSetJobQueryRes(SSchJob* pJob, SQueryResult* pRes); #ifdef __cplusplus diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index 72809e1f93f7cc827ce41036ba5ed5dcf8734e86..bd3a944c3f9c00a18fd7c462552008e79c99a509 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -42,7 +42,7 @@ int32_t schInitTask(SSchJob *pJob, SSchTask *pTask, SSubplan *pPlan, SSchLevel * return TSDB_CODE_SUCCESS; } -int32_t schInitJob(SSchedulerReq *pReq, SSchJob **pSchJob, SQueryResult* pRes, bool syncSchedule) { +int32_t schInitJob(SSchedulerReq *pReq, SSchJob **pSchJob) { int32_t code = 0; int64_t refId = -1; SSchJob *pJob = taosMemoryCalloc(1, sizeof(SSchJob)); @@ -54,12 +54,15 @@ int32_t schInitJob(SSchedulerReq *pReq, SSchJob **pSchJob, SQueryResult* pRes, b pJob->attr.explainMode = pReq->pDag->explainInfo.mode; pJob->conn = *pReq->pConn; pJob->sql = pReq->sql; - pJob->reqKilled = pReq->reqKilled; - pJob->userRes.queryRes = pRes; - pJob->userRes.execFp = pReq->fp; - pJob->userRes.userParam = pReq->cbParam; - - if (pReq->pNodeList != NULL) { + pJob->pDag = pReq->pDag; + pJob->chkKillFp = pReq->chkKillFp; + pJob->chkKillParam = pReq->chkKillParam; + pJob->userRes.execFp = pReq->execFp; + pJob->userRes.userParam = pReq->execParam; + + if (pReq->pNodeList == NULL || taosArrayGetSize(pReq->pNodeList) <= 0) { + qDebug("QID:0x%" PRIx64 " input exec nodeList is empty", pReq->pDag->queryId); + } else { pJob->nodeList = taosArrayDup(pReq->pNodeList); } @@ -83,20 +86,6 @@ int32_t schInitJob(SSchedulerReq *pReq, SSchJob **pSchJob, SQueryResult* pRes, b SCH_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); } - pJob->succTasks = - taosHashInit(pReq->pDag->numOfSubplans, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), false, HASH_ENTRY_LOCK); - if (NULL == pJob->succTasks) { - SCH_JOB_ELOG("taosHashInit %d succTasks failed", pReq->pDag->numOfSubplans); - SCH_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); - } - - pJob->failTasks = - taosHashInit(pReq->pDag->numOfSubplans, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), false, HASH_ENTRY_LOCK); - if (NULL == pJob->failTasks) { - SCH_JOB_ELOG("taosHashInit %d failTasks failed", pReq->pDag->numOfSubplans); - SCH_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); - } - tsem_init(&pJob->rspSem, 0, 0); refId = taosAddRef(schMgmt.jobRef, pJob); @@ -194,7 +183,7 @@ FORCE_INLINE bool schJobNeedToStop(SSchJob *pJob, int8_t *pStatus) { *pStatus = status; } - if (*pJob->reqKilled) { + if ((*pJob->chkKillFp)(pJob->chkKillParam)) { schUpdateJobStatus(pJob, JOB_TASK_STATUS_DROPPING); schUpdateJobErrCode(pJob, TSDB_CODE_TSC_QUERY_KILLED); @@ -547,8 +536,6 @@ int32_t schValidateAndBuildJob(SQueryPlan *pDag, SSchJob *pJob) { pJob->levelNum = levelNum; pJob->levelIdx = levelNum - 1; - pJob->subPlans = pDag->pSubplans; - SSchLevel level = {0}; SNodeListNode *plans = NULL; int32_t taskNum = 0; @@ -724,6 +711,7 @@ int32_t schPushTaskToExecList(SSchJob *pJob, SSchTask *pTask) { return TSDB_CODE_SUCCESS; } +/* int32_t schMoveTaskToSuccList(SSchJob *pJob, SSchTask *pTask, bool *moved) { if (0 != taosHashRemove(pJob->execTasks, &pTask->taskId, sizeof(pTask->taskId))) { SCH_TASK_WLOG("remove task from execTask list failed, may not exist, status:%s", SCH_GET_TASK_STATUS_STR(pTask)); @@ -801,6 +789,7 @@ int32_t schMoveTaskToExecList(SSchJob *pJob, SSchTask *pTask, bool *moved) { return TSDB_CODE_SUCCESS; } +*/ int32_t schTaskCheckSetRetry(SSchJob *pJob, SSchTask *pTask, int32_t errCode, bool *needRetry) { int8_t status = 0; @@ -1047,9 +1036,7 @@ int32_t schProcessOnTaskFailure(SSchJob *pJob, SSchTask *pTask, int32_t errCode) if (!needRetry) { SCH_TASK_ELOG("task failed and no more retry, code:%s", tstrerror(errCode)); - if (SCH_GET_TASK_STATUS(pTask) == JOB_TASK_STATUS_EXECUTING) { - SCH_ERR_JRET(schMoveTaskToFailList(pJob, pTask, &moved)); - } else { + if (SCH_GET_TASK_STATUS(pTask) != JOB_TASK_STATUS_EXECUTING) { SCH_TASK_ELOG("task not in executing list, status:%s", SCH_GET_TASK_STATUS_STR(pTask)); SCH_ERR_JRET(TSDB_CODE_SCH_STATUS_ERROR); } @@ -1115,8 +1102,6 @@ int32_t schProcessOnTaskSuccess(SSchJob *pJob, SSchTask *pTask) { SCH_LOG_TASK_END_TS(pTask); - SCH_ERR_JRET(schMoveTaskToSuccList(pJob, pTask, &moved)); - SCH_SET_TASK_STATUS(pTask, JOB_TASK_STATUS_PARTIAL_SUCCEED); SCH_ERR_JRET(schRecordTaskSucceedNode(pJob, pTask)); @@ -1150,8 +1135,6 @@ int32_t schProcessOnTaskSuccess(SSchJob *pJob, SSchTask *pTask) { pJob->fetchTask = pTask; - SCH_ERR_JRET(schMoveTaskToExecList(pJob, pTask, &moved)); - SCH_RET(schProcessOnJobPartialSuccess(pJob)); } @@ -1466,8 +1449,8 @@ void schDropTaskInHashList(SSchJob *pJob, SHashObj *list) { void schDropJobAllTasks(SSchJob *pJob) { schDropTaskInHashList(pJob, pJob->execTasks); - schDropTaskInHashList(pJob, pJob->succTasks); - schDropTaskInHashList(pJob, pJob->failTasks); +// schDropTaskInHashList(pJob, pJob->succTasks); +// schDropTaskInHashList(pJob, pJob->failTasks); } int32_t schCancelJob(SSchJob *pJob) { @@ -1491,8 +1474,6 @@ void schFreeJobImpl(void *job) { schDropJobAllTasks(pJob); - pJob->subPlans = NULL; // it is a reference to pDag->pSubplans - int32_t numOfLevels = taosArrayGetSize(pJob->levels); for (int32_t i = 0; i < numOfLevels; ++i) { SSchLevel *pLevel = taosArrayGet(pJob->levels, i); @@ -1509,8 +1490,8 @@ void schFreeJobImpl(void *job) { schFreeFlowCtrl(pJob); taosHashCleanup(pJob->execTasks); - taosHashCleanup(pJob->failTasks); - taosHashCleanup(pJob->succTasks); +// taosHashCleanup(pJob->failTasks); +// taosHashCleanup(pJob->succTasks); taosHashCleanup(pJob->taskList); taosArrayDestroy(pJob->levels); @@ -1521,6 +1502,8 @@ void schFreeJobImpl(void *job) { destroyQueryExecRes(&pJob->execRes); + qDestroyQueryPlan(pJob->pDag); + taosMemoryFreeClear(pJob->userRes.queryRes); taosMemoryFreeClear(pJob->resData); taosMemoryFree(pJob); @@ -1533,88 +1516,11 @@ void schFreeJobImpl(void *job) { } } -int32_t schExecJobImpl(SSchedulerReq *pReq, int64_t *job, SQueryResult* pRes, bool sync) { - if (pReq->pNodeList == NULL || taosArrayGetSize(pReq->pNodeList) <= 0) { - qDebug("QID:0x%" PRIx64 " input exec nodeList is empty", pReq->pDag->queryId); - } - - int32_t code = 0; - SSchJob *pJob = NULL; - SCH_ERR_JRET(schInitJob(pReq, &pJob, pRes, sync)); - - qDebug("QID:0x%" PRIx64 " sch job refId 0x%"PRIx64 " started", pReq->pDag->queryId, pJob->refId); - *job = pJob->refId; - - SCH_ERR_JRET(schBeginOperation(pJob, SCH_OP_EXEC, sync)); - - code = schLaunchJob(pJob); - - if (sync) { - SCH_JOB_DLOG("will wait for rsp now, job status:%s", SCH_GET_JOB_STATUS_STR(pJob)); - tsem_wait(&pJob->rspSem); - - schEndOperation(pJob); - } else if (code) { - schPostJobRes(pJob, SCH_OP_EXEC); - } - - SCH_JOB_DLOG("job exec done, job status:%s, jobId:0x%" PRIx64, SCH_GET_JOB_STATUS_STR(pJob), pJob->refId); - - schReleaseJob(pJob->refId); - - SCH_RET(code); - -_return: - - if (!sync) { - pReq->fp(NULL, pReq->cbParam, code); - } - - schReleaseJob(pJob->refId); - - SCH_RET(code); -} - -int32_t schExecJob(SSchedulerReq *pReq, int64_t *pJob, SQueryResult *pRes) { - int32_t code = 0; - - *pJob = 0; - - if (EXPLAIN_MODE_STATIC == pReq->pDag->explainInfo.mode) { - SCH_ERR_JRET(schExecStaticExplainJob(pReq, pJob, true)); - } else { - SCH_ERR_JRET(schExecJobImpl(pReq, pJob, NULL, true)); - } - -_return: - - if (*pJob) { - SSchJob *job = schAcquireJob(*pJob); - schSetJobQueryRes(job, pRes); - schReleaseJob(*pJob); - } - - return code; -} - -int32_t schAsyncExecJob(SSchedulerReq *pReq, int64_t *pJob) { - int32_t code = 0; - - *pJob = 0; - - if (EXPLAIN_MODE_STATIC == pReq->pDag->explainInfo.mode) { - SCH_RET(schExecStaticExplainJob(pReq, pJob, false)); - } - - SCH_ERR_RET(schExecJobImpl(pReq, pJob, NULL, false)); - - return code; -} - -int32_t schExecStaticExplainJob(SSchedulerReq *pReq, int64_t *job, bool sync) { +int32_t schLaunchStaticExplainJob(SSchedulerReq *pReq, SSchJob *pJob, bool sync) { qDebug("QID:0x%" PRIx64 " job started", pReq->pDag->queryId); int32_t code = 0; +/* SSchJob *pJob = taosMemoryCalloc(1, sizeof(SSchJob)); if (NULL == pJob) { qError("QID:0x%" PRIx64 " calloc %d failed", pReq->pDag->queryId, (int32_t)sizeof(SSchJob)); @@ -1625,10 +1531,10 @@ int32_t schExecStaticExplainJob(SSchedulerReq *pReq, int64_t *job, bool sync) { pJob->sql = pReq->sql; pJob->reqKilled = pReq->reqKilled; + pJob->pDag = pReq->pDag; pJob->attr.queryJob = true; pJob->attr.explainMode = pReq->pDag->explainInfo.mode; pJob->queryId = pReq->pDag->queryId; - pJob->subPlans = pReq->pDag->pSubplans; pJob->userRes.execFp = pReq->fp; pJob->userRes.userParam = pReq->cbParam; @@ -1637,11 +1543,14 @@ int32_t schExecStaticExplainJob(SSchedulerReq *pReq, int64_t *job, bool sync) { code = schBeginOperation(pJob, SCH_OP_EXEC, sync); if (code) { pReq->fp(NULL, pReq->cbParam, code); + schFreeJobImpl(pJob); SCH_ERR_RET(code); } - +*/ + SCH_ERR_JRET(qExecStaticExplain(pReq->pDag, (SRetrieveTableRsp **)&pJob->resData)); +/* int64_t refId = taosAddRef(schMgmt.jobRef, pJob); if (refId < 0) { SCH_JOB_ELOG("taosAddRef job failed, error:%s", tstrerror(terrno)); @@ -1656,10 +1565,10 @@ int32_t schExecStaticExplainJob(SSchedulerReq *pReq, int64_t *job, bool sync) { pJob->refId = refId; SCH_JOB_DLOG("job refId:0x%" PRIx64, pJob->refId); +*/ pJob->status = JOB_TASK_STATUS_PARTIAL_SUCCEED; - *job = pJob->refId; SCH_JOB_DLOG("job exec done, job status:%s", SCH_GET_JOB_STATUS_STR(pJob)); if (!sync) { @@ -1668,7 +1577,7 @@ int32_t schExecStaticExplainJob(SSchedulerReq *pReq, int64_t *job, bool sync) { schEndOperation(pJob); } - schReleaseJob(pJob->refId); +// schReleaseJob(pJob->refId); SCH_RET(code); @@ -1676,7 +1585,7 @@ _return: schEndOperation(pJob); if (!sync) { - pReq->fp(NULL, pReq->cbParam, code); + pReq->execFp(NULL, pReq->execParam, code); } schFreeJobImpl(pJob); @@ -1715,3 +1624,39 @@ int32_t schAsyncFetchRows(SSchJob *pJob) { } +int32_t schExecJobImpl(SSchedulerReq *pReq, SSchJob *pJob, bool sync) { + int32_t code = 0; + + qDebug("QID:0x%" PRIx64 " sch job refId 0x%"PRIx64 " started", pReq->pDag->queryId, pJob->refId); + + SCH_ERR_JRET(schBeginOperation(pJob, SCH_OP_EXEC, sync)); + + if (EXPLAIN_MODE_STATIC == pReq->pDag->explainInfo.mode) { + code = schLaunchStaticExplainJob(pReq, pJob, sync); + } else { + code = schLaunchJob(pJob); + if (sync) { + SCH_JOB_DLOG("will wait for rsp now, job status:%s", SCH_GET_JOB_STATUS_STR(pJob)); + tsem_wait(&pJob->rspSem); + + schEndOperation(pJob); + } else if (code) { + schPostJobRes(pJob, SCH_OP_EXEC); + } + } + + SCH_JOB_DLOG("job exec done, job status:%s, jobId:0x%" PRIx64, SCH_GET_JOB_STATUS_STR(pJob), pJob->refId); + + SCH_RET(code); + +_return: + + if (!sync) { + pReq->execFp(NULL, pReq->execParam, code); + } + + SCH_RET(code); +} + + + diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index 57a405ffa3ffd524e7203a2935a4135ec3bd5208..74ddc89b40026ff93e5d6ac2fe280e5f600098fa 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -67,33 +67,53 @@ int32_t schedulerInit(SSchedulerCfg *cfg) { return TSDB_CODE_SUCCESS; } -int32_t schedulerExecJob(SSchedulerReq *pReq, int64_t *pJob, SQueryResult *pRes) { +int32_t schedulerExecJob(SSchedulerReq *pReq, int64_t *pJobId, SQueryResult *pRes) { qDebug("scheduler sync exec job start"); + + int32_t code = 0; + SSchJob *pJob = NULL; + SCH_ERR_JRET(schInitJob(pReq, &pJob)); + + *pJobId = pJob->refId; - if (NULL == pReq || NULL == pJob || NULL == pRes) { - SCH_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); + SCH_ERR_JRET(schExecJobImpl(pReq, pJob, true)); + +_return: + + if (code && NULL == pJob) { + qDestroyQueryPlan(pReq->pDag); + } + + if (pJob) { + schSetJobQueryRes(pJob, pRes); + schReleaseJob(pJob->refId); } - SCH_RET(schExecJob(pReq, pJob, pRes)); + return code; } -int32_t schedulerAsyncExecJob(SSchedulerReq *pReq, int64_t *pJob) { +int32_t schedulerAsyncExecJob(SSchedulerReq *pReq, int64_t *pJobId) { qDebug("scheduler async exec job start"); - int32_t code = 0; - if (NULL == pReq || NULL == pJob) { - SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); - } + int32_t code = 0; + SSchJob *pJob = NULL; + SCH_ERR_JRET(schInitJob(pReq, &pJob)); + + *pJobId = pJob->refId; - schAsyncExecJob(pReq, pJob); + SCH_ERR_JRET(schExecJobImpl(pReq, pJob, false)); _return: - if (code != TSDB_CODE_SUCCESS) { - pReq->fp(NULL, pReq->cbParam, code); + if (code && NULL == pJob) { + qDestroyQueryPlan(pReq->pDag); + } + + if (pJob) { + schReleaseJob(pJob->refId); } - SCH_RET(code); + return code; } int32_t schedulerFetchRows(int64_t job, void **pData) { @@ -120,7 +140,7 @@ int32_t schedulerFetchRows(int64_t job, void **pData) { SCH_RET(code); } -void schedulerAsyncFetchRows(int64_t job, schedulerFetchCallback fp, void* param) { +void schedulerAsyncFetchRows(int64_t job, schedulerFetchFp fp, void* param) { qDebug("scheduler async fetch rows start"); int32_t code = 0; diff --git a/source/libs/scheduler/test/schedulerTests.cpp b/source/libs/scheduler/test/schedulerTests.cpp index e5cc3cd48188f51ad9431c3e21027292998213ad..b372ee3ead42141ce8f132d49301cd183a59e752 100644 --- a/source/libs/scheduler/test/schedulerTests.cpp +++ b/source/libs/scheduler/test/schedulerTests.cpp @@ -511,8 +511,8 @@ void* schtRunJobThread(void *aa) { req.pNodeList = qnodeList; req.pDag = &dag; req.sql = "select * from tb"; - req.fp = schtQueryCb; - req.cbParam = &queryDone; + req.execFp = schtQueryCb; + req.execParam = &queryDone; code = schedulerAsyncExecJob(&req, &queryJobRefId); assert(code == 0); @@ -663,8 +663,8 @@ TEST(queryTest, normalCase) { req.pNodeList = qnodeList; req.pDag = &dag; req.sql = "select * from tb"; - req.fp = schtQueryCb; - req.cbParam = &queryDone; + req.execFp = schtQueryCb; + req.execParam = &queryDone; code = schedulerAsyncExecJob(&req, &job); ASSERT_EQ(code, 0); @@ -767,8 +767,8 @@ TEST(queryTest, readyFirstCase) { req.pNodeList = qnodeList; req.pDag = &dag; req.sql = "select * from tb"; - req.fp = schtQueryCb; - req.cbParam = &queryDone; + req.execFp = schtQueryCb; + req.execParam = &queryDone; code = schedulerAsyncExecJob(&req, &job); ASSERT_EQ(code, 0); @@ -874,8 +874,8 @@ TEST(queryTest, flowCtrlCase) { req.pNodeList = qnodeList; req.pDag = &dag; req.sql = "select * from tb"; - req.fp = schtQueryCb; - req.cbParam = &queryDone; + req.execFp = schtQueryCb; + req.execParam = &queryDone; code = schedulerAsyncExecJob(&req, &job); ASSERT_EQ(code, 0); @@ -987,8 +987,8 @@ TEST(insertTest, normalCase) { req.pNodeList = qnodeList; req.pDag = &dag; req.sql = "insert into tb values(now,1)"; - req.fp = schtQueryCb; - req.cbParam = NULL; + req.execFp = schtQueryCb; + req.execParam = NULL; code = schedulerExecJob(&req, &insertJobRefId, &res); ASSERT_EQ(code, 0); diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c index 3aee636ac939e7ded62a03d1142c2f4d5d5cf7bd..b3be35fba317b8219242109ec7f40079d2d7f1df 100644 --- a/source/libs/stream/src/streamExec.c +++ b/source/libs/stream/src/streamExec.c @@ -49,7 +49,7 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, void* data, SArray* pRes) SStreamDataBlock* pRetrieveBlock = (SStreamDataBlock*)data; ASSERT(taosArrayGetSize(pRetrieveBlock->blocks) == 1); assignOneDataBlock(&block, taosArrayGet(pRetrieveBlock->blocks, 0)); - block.info.type = STREAM_PUSH_OVER; + block.info.type = STREAM_PULL_OVER; block.info.childId = pTask->selfChildId; taosArrayPush(pRes, &block); } diff --git a/source/libs/sync/inc/syncInt.h b/source/libs/sync/inc/syncInt.h index d351dc50f435867a44cbc73608432c019dc6fa15..d58ae83dd37c641a0fc8a5bafba9b58a497a2e2a 100644 --- a/source/libs/sync/inc/syncInt.h +++ b/source/libs/sync/inc/syncInt.h @@ -221,7 +221,6 @@ void syncNodeVoteForSelf(SSyncNode* pSyncNode); // snapshot -------------- bool syncNodeHasSnapshot(SSyncNode* pSyncNode); -bool syncNodeIsIndexInSnapshot(SSyncNode* pSyncNode, SyncIndex index); SyncIndex syncNodeGetLastIndex(SSyncNode* pSyncNode); SyncTerm syncNodeGetLastTerm(SSyncNode* pSyncNode); diff --git a/source/libs/sync/src/syncAppendEntries.c b/source/libs/sync/src/syncAppendEntries.c index ba3dd66550c08900fa0b525eba78a2f21413db34..a10b81d16579b7e7adb38ff23aef1ebe9be01170 100644 --- a/source/libs/sync/src/syncAppendEntries.c +++ b/source/libs/sync/src/syncAppendEntries.c @@ -860,7 +860,9 @@ int32_t syncNodeOnAppendEntriesSnapshotCb(SSyncNode* ths, SyncAppendEntries* pMs } code = ths->pLogStore->syncLogAppendEntry(ths->pLogStore, pAppendEntry); - ASSERT(code == 0); + if (code != 0) { + return -1; + } // pre commit code = syncNodePreCommit(ths, pAppendEntry); @@ -971,7 +973,9 @@ int32_t syncNodeOnAppendEntriesSnapshotCb(SSyncNode* ths, SyncAppendEntries* pMs ASSERT(pAppendEntry != NULL); code = ths->pLogStore->syncLogAppendEntry(ths->pLogStore, pAppendEntry); - ASSERT(code == 0); + if (code != 0) { + return -1; + } // pre commit code = syncNodePreCommit(ths, pAppendEntry); diff --git a/source/libs/sync/src/syncElection.c b/source/libs/sync/src/syncElection.c index 738b17b9cb6fd4cc7ebf2304c3e6afe162c6c0aa..816430b5b54bf0052014866d21aa5109eb2aa48c 100644 --- a/source/libs/sync/src/syncElection.c +++ b/source/libs/sync/src/syncElection.c @@ -75,7 +75,11 @@ int32_t syncNodeElect(SSyncNode* pSyncNode) { if (pSyncNode->state == TAOS_SYNC_STATE_FOLLOWER) { syncNodeFollower2Candidate(pSyncNode); } - ASSERT(pSyncNode->state == TAOS_SYNC_STATE_CANDIDATE); + + if (pSyncNode->state != TAOS_SYNC_STATE_CANDIDATE) { + syncNodeErrorLog(pSyncNode, "not candidate, can not elect"); + return -1; + } // start election raftStoreNextTerm(pSyncNode->pRaftStore); diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 60f6ca7e7bd7dd2cbcb694c159df2c9897ad2eb8..d32153e5ed711a732ad38e2c21f7edb91bc6e105 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -698,7 +698,7 @@ int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak) { } else { ret = -1; terrno = TSDB_CODE_SYN_NOT_LEADER; - sError("syncPropose not leader, %s", syncUtilState2String(pSyncNode->state)); + sError("sync propose not leader, %s", syncUtilState2String(pSyncNode->state)); goto _END; } @@ -1414,46 +1414,59 @@ void syncNodeErrorLog(const SSyncNode* pSyncNode, char* str) { int32_t userStrLen = strlen(str); SSnapshot snapshot = {.data = NULL, .lastApplyIndex = -1, .lastApplyTerm = 0}; - if (pSyncNode->pFsm->FpGetSnapshotInfo != NULL) { + if (pSyncNode->pFsm != NULL && pSyncNode->pFsm->FpGetSnapshotInfo != NULL) { pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot); } - SyncIndex logLastIndex = pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore); - SyncIndex logBeginIndex = pSyncNode->pLogStore->syncLogBeginIndex(pSyncNode->pLogStore); + + SyncIndex logLastIndex = SYNC_INDEX_INVALID; + SyncIndex logBeginIndex = SYNC_INDEX_INVALID; + if (pSyncNode->pLogStore != NULL) { + logLastIndex = pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore); + logBeginIndex = pSyncNode->pLogStore->syncLogBeginIndex(pSyncNode->pLogStore); + } + + char* pCfgStr = syncCfg2SimpleStr(&(pSyncNode->pRaftCfg->cfg)); + char* printStr = ""; + if (pCfgStr != NULL) { + printStr = pCfgStr; + } if (userStrLen < 256) { - char logBuf[128 + 256]; + char logBuf[256 + 256]; if (pSyncNode != NULL && pSyncNode->pRaftCfg != NULL && pSyncNode->pRaftStore != NULL) { snprintf(logBuf, sizeof(logBuf), "vgId:%d, sync %s %s, term:%lu, commit:%ld, beginlog:%ld, lastlog:%ld, lastsnapshot:%ld, standby:%d, " "replica-num:%d, " - "lconfig:%ld, changing:%d", + "lconfig:%ld, changing:%d, restore:%d, %s", pSyncNode->vgId, syncUtilState2String(pSyncNode->state), str, pSyncNode->pRaftStore->currentTerm, pSyncNode->commitIndex, logBeginIndex, logLastIndex, snapshot.lastApplyIndex, pSyncNode->pRaftCfg->isStandBy, pSyncNode->replicaNum, pSyncNode->pRaftCfg->lastConfigIndex, - pSyncNode->changing); + pSyncNode->changing, pSyncNode->restoreFinish, printStr); } else { snprintf(logBuf, sizeof(logBuf), "%s", str); } sError("%s", logBuf); } else { - int len = 128 + userStrLen; + int len = 256 + userStrLen; char* s = (char*)taosMemoryMalloc(len); if (pSyncNode != NULL && pSyncNode->pRaftCfg != NULL && pSyncNode->pRaftStore != NULL) { snprintf(s, len, "vgId:%d, sync %s %s, term:%lu, commit:%ld, beginlog:%ld, lastlog:%ld, lastsnapshot:%ld, standby:%d, " "replica-num:%d, " - "lconfig:%ld, changing:%d", + "lconfig:%ld, changing:%d, restore:%d, %s", pSyncNode->vgId, syncUtilState2String(pSyncNode->state), str, pSyncNode->pRaftStore->currentTerm, pSyncNode->commitIndex, logBeginIndex, logLastIndex, snapshot.lastApplyIndex, pSyncNode->pRaftCfg->isStandBy, pSyncNode->replicaNum, pSyncNode->pRaftCfg->lastConfigIndex, - pSyncNode->changing); + pSyncNode->changing, pSyncNode->restoreFinish, printStr); } else { snprintf(s, len, "%s", str); } sError("%s", s); taosMemoryFree(s); } + + taosMemoryFree(pCfgStr); } char* syncNode2SimpleStr(const SSyncNode* pSyncNode) { @@ -1475,18 +1488,6 @@ char* syncNode2SimpleStr(const SSyncNode* pSyncNode) { pSyncNode->commitIndex, logBeginIndex, logLastIndex, snapshot.lastApplyIndex, pSyncNode->pRaftCfg->isStandBy, pSyncNode->replicaNum, pSyncNode->pRaftCfg->lastConfigIndex, pSyncNode->changing, pSyncNode->restoreFinish); - /* - snprintf(s, len, - "syncNode: vgId:%d, term:%lu, commit:%ld, state:%d %s, standby:%d, " - "lc:%lu, " - "lc-user:%lu, " - "ems:%d, replica-num:%d, restore:%d, changing:%d", - pSyncNode->vgId, pSyncNode->pRaftStore->currentTerm, pSyncNode->commitIndex, pSyncNode->state, - syncUtilState2String(pSyncNode->state), pSyncNode->pRaftCfg->isStandBy, pSyncNode->electTimerLogicClock, - pSyncNode->electTimerLogicClockUser, pSyncNode->electTimerMS, pSyncNode->replicaNum, - pSyncNode->restoreFinish, pSyncNode->changing); - */ - return s; } @@ -1922,6 +1923,8 @@ void syncNodeVoteForSelf(SSyncNode* pSyncNode) { } // snapshot -------------- + +// return if has a snapshot bool syncNodeHasSnapshot(SSyncNode* pSyncNode) { bool ret = false; SSnapshot snapshot = {.data = NULL, .lastApplyIndex = -1, .lastApplyTerm = 0, .lastConfigIndex = -1}; @@ -1934,21 +1937,10 @@ bool syncNodeHasSnapshot(SSyncNode* pSyncNode) { return ret; } -#if 0 -bool syncNodeIsIndexInSnapshot(SSyncNode* pSyncNode, SyncIndex index) { - ASSERT(syncNodeHasSnapshot(pSyncNode)); - ASSERT(pSyncNode->pFsm->FpGetSnapshotInfo != NULL); - ASSERT(index >= SYNC_INDEX_BEGIN); - - SSnapshot snapshot; - pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot); - bool b = (index <= snapshot.lastApplyIndex); - return b; -} -#endif - +// return max(logLastIndex, snapshotLastIndex) +// if no snapshot and log, return -1 SyncIndex syncNodeGetLastIndex(SSyncNode* pSyncNode) { - SSnapshot snapshot = {.data = NULL, .lastApplyIndex = -1, .lastApplyTerm = 0}; + SSnapshot snapshot = {.data = NULL, .lastApplyIndex = -1, .lastApplyTerm = 0, .lastConfigIndex = -1}; if (pSyncNode->pFsm->FpGetSnapshotInfo != NULL) { pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot); } @@ -1958,6 +1950,8 @@ SyncIndex syncNodeGetLastIndex(SSyncNode* pSyncNode) { return lastIndex; } +// return the last term of snapshot and log +// if error, return SYNC_TERM_INVALID (by syncLogLastTerm) SyncTerm syncNodeGetLastTerm(SSyncNode* pSyncNode) { SyncTerm lastTerm = 0; if (syncNodeHasSnapshot(pSyncNode)) { @@ -1989,11 +1983,14 @@ int32_t syncNodeGetLastIndexTerm(SSyncNode* pSyncNode, SyncIndex* pLastIndex, Sy return 0; } +// return append-entries first try index SyncIndex syncNodeSyncStartIndex(SSyncNode* pSyncNode) { SyncIndex syncStartIndex = syncNodeGetLastIndex(pSyncNode) + 1; return syncStartIndex; } +// if index > 0, return index - 1 +// else, return -1 SyncIndex syncNodeGetPreIndex(SSyncNode* pSyncNode, SyncIndex index) { SyncIndex preIndex = index - 1; if (preIndex < SYNC_INDEX_INVALID) { @@ -2003,21 +2000,10 @@ SyncIndex syncNodeGetPreIndex(SSyncNode* pSyncNode, SyncIndex index) { return preIndex; } -/* -SyncIndex syncNodeGetPreIndex(SSyncNode* pSyncNode, SyncIndex index) { - ASSERT(index >= SYNC_INDEX_BEGIN); - - SyncIndex syncStartIndex = syncNodeSyncStartIndex(pSyncNode); - if (index > syncStartIndex) { - syncNodeLog3("syncNodeGetPreIndex", pSyncNode); - ASSERT(0); - } - - SyncIndex preIndex = index - 1; - return preIndex; -} -*/ - +// if index < 0, return SYNC_TERM_INVALID +// if index == 0, return 0 +// if index > 0, return preTerm +// if error, return SYNC_TERM_INVALID SyncTerm syncNodeGetPreTerm(SSyncNode* pSyncNode, SyncIndex index) { if (index < SYNC_INDEX_BEGIN) { return SYNC_TERM_INVALID; @@ -2055,112 +2041,6 @@ SyncTerm syncNodeGetPreTerm(SSyncNode* pSyncNode, SyncIndex index) { return SYNC_TERM_INVALID; } -#if 0 -SyncTerm syncNodeGetPreTerm(SSyncNode* pSyncNode, SyncIndex index) { - ASSERT(index >= SYNC_INDEX_BEGIN); - - SyncIndex syncStartIndex = syncNodeSyncStartIndex(pSyncNode); - if (index > syncStartIndex) { - syncNodeLog3("syncNodeGetPreTerm", pSyncNode); - ASSERT(0); - } - - if (index == SYNC_INDEX_BEGIN) { - return 0; - } - - SyncTerm preTerm = 0; - SyncIndex preIndex = index - 1; - SSyncRaftEntry* pPreEntry = NULL; - int32_t code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, preIndex, &pPreEntry); - if (code == 0) { - ASSERT(pPreEntry != NULL); - preTerm = pPreEntry->term; - taosMemoryFree(pPreEntry); - return preTerm; - } else { - if (terrno == TSDB_CODE_WAL_LOG_NOT_EXIST) { - SSnapshot snapshot = {.data = NULL, .lastApplyIndex = -1, .lastApplyTerm = 0, .lastConfigIndex = -1}; - if (pSyncNode->pFsm->FpGetSnapshotInfo != NULL) { - pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot); - if (snapshot.lastApplyIndex == preIndex) { - return snapshot.lastApplyTerm; - } - } - } - } - - ASSERT(0); - return -1; -} -#endif - -#if 0 -SyncTerm syncNodeGetPreTerm(SSyncNode* pSyncNode, SyncIndex index) { - ASSERT(index >= SYNC_INDEX_BEGIN); - - SyncIndex syncStartIndex = syncNodeSyncStartIndex(pSyncNode); - if (index > syncStartIndex) { - syncNodeLog3("syncNodeGetPreTerm", pSyncNode); - ASSERT(0); - } - - if (index == SYNC_INDEX_BEGIN) { - return 0; - } - - SyncTerm preTerm = 0; - if (syncNodeHasSnapshot(pSyncNode)) { - // has snapshot - SSnapshot snapshot = {.data = NULL, .lastApplyIndex = -1, .lastApplyTerm = 0, .lastConfigIndex = -1}; - if (pSyncNode->pFsm->FpGetSnapshotInfo != NULL) { - pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot); - } - - if (index > snapshot.lastApplyIndex + 1) { - // should be log preTerm - SSyncRaftEntry* pPreEntry = NULL; - int32_t code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, index - 1, &pPreEntry); - ASSERT(code == 0); - ASSERT(pPreEntry != NULL); - - preTerm = pPreEntry->term; - taosMemoryFree(pPreEntry); - - } else if (index == snapshot.lastApplyIndex + 1) { - preTerm = snapshot.lastApplyTerm; - - } else { - // maybe snapshot change - sError("sync get pre term, bad scene. index:%ld", index); - logStoreLog2("sync get pre term, bad scene", pSyncNode->pLogStore); - - SSyncRaftEntry* pPreEntry = NULL; - int32_t code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, index - 1, &pPreEntry); - ASSERT(code == 0); - ASSERT(pPreEntry != NULL); - - preTerm = pPreEntry->term; - taosMemoryFree(pPreEntry); - } - - } else { - // no snapshot - ASSERT(index > SYNC_INDEX_BEGIN); - - SSyncRaftEntry* pPreEntry = NULL; - int32_t code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, index - 1, &pPreEntry); - ASSERT(code == 0); - ASSERT(pPreEntry != NULL); - - preTerm = pPreEntry->term; - taosMemoryFree(pPreEntry); - } - - return preTerm; -} -#endif - // get pre index and term of "index" int32_t syncNodeGetPreIndexTerm(SSyncNode* pSyncNode, SyncIndex index, SyncIndex* pPreIndex, SyncTerm* pPreTerm) { *pPreIndex = syncNodeGetPreIndex(pSyncNode, index); @@ -2350,8 +2230,8 @@ static int32_t syncNodeAppendNoop(SSyncNode* ths) { ASSERT(pEntry != NULL); if (ths->state == TAOS_SYNC_STATE_LEADER) { - // ths->pLogStore->appendEntry(ths->pLogStore, pEntry); - ths->pLogStore->syncLogAppendEntry(ths->pLogStore, pEntry); + int32_t code = ths->pLogStore->syncLogAppendEntry(ths->pLogStore, pEntry); + ASSERT(code == 0); syncNodeReplicate(ths); } @@ -2405,6 +2285,7 @@ int32_t syncNodeOnPingReplyCb(SSyncNode* ths, SyncPingReply* pMsg) { // int32_t syncNodeOnClientRequestCb(SSyncNode* ths, SyncClientRequest* pMsg, SyncIndex* pRetIndex) { int32_t ret = 0; + int32_t code = 0; syncClientRequestLog2("==syncNodeOnClientRequestCb==", pMsg); SyncIndex index = ths->pLogStore->syncLogWriteIndex(ths->pLogStore); @@ -2413,18 +2294,24 @@ int32_t syncNodeOnClientRequestCb(SSyncNode* ths, SyncClientRequest* pMsg, SyncI ASSERT(pEntry != NULL); if (ths->state == TAOS_SYNC_STATE_LEADER) { - // ths->pLogStore->appendEntry(ths->pLogStore, pEntry); - ths->pLogStore->syncLogAppendEntry(ths->pLogStore, pEntry); + // append entry + code = ths->pLogStore->syncLogAppendEntry(ths->pLogStore, pEntry); + if (code != 0) { + // del resp mgr, call FpCommitCb + ASSERT(0); + return -1; + } - // start replicate right now! - syncNodeReplicate(ths); + // if mulit replica, start replicate right now + if (ths->replicaNum > 1) { + syncNodeReplicate(ths); + } // pre commit SRpcMsg rpcMsg; syncEntry2OriginalRpc(pEntry, &rpcMsg); if (ths->pFsm != NULL) { - // if (ths->pFsm->FpPreCommitCb != NULL && pEntry->originalRpcType != TDMT_SYNC_NOOP) { if (ths->pFsm->FpPreCommitCb != NULL && syncUtilUserPreCommit(pEntry->originalRpcType)) { SFsmCbMeta cbMeta = {0}; cbMeta.index = pEntry->index; @@ -2438,8 +2325,10 @@ int32_t syncNodeOnClientRequestCb(SSyncNode* ths, SyncClientRequest* pMsg, SyncI } rpcFreeCont(rpcMsg.pCont); - // only myself, maybe commit - syncMaybeAdvanceCommitIndex(ths); + // if only myself, maybe commit right now + if (ths->replicaNum == 1) { + syncMaybeAdvanceCommitIndex(ths); + } } else { // pre commit @@ -2447,7 +2336,6 @@ int32_t syncNodeOnClientRequestCb(SSyncNode* ths, SyncClientRequest* pMsg, SyncI syncEntry2OriginalRpc(pEntry, &rpcMsg); if (ths->pFsm != NULL) { - // if (ths->pFsm->FpPreCommitCb != NULL && pEntry->originalRpcType != TDMT_SYNC_NOOP) { if (ths->pFsm->FpPreCommitCb != NULL && syncUtilUserPreCommit(pEntry->originalRpcType)) { SFsmCbMeta cbMeta = {0}; cbMeta.index = pEntry->index; diff --git a/source/libs/sync/src/syncRaftCfg.c b/source/libs/sync/src/syncRaftCfg.c index 9d16bed6c1331a4fef152e82b3e55507c832db2d..43890c196ceb1d49ba645782aa7b079d93a333fb 100644 --- a/source/libs/sync/src/syncRaftCfg.c +++ b/source/libs/sync/src/syncRaftCfg.c @@ -101,7 +101,7 @@ cJSON *syncCfg2Json(SSyncCfg *pSyncCfg) { char *syncCfg2Str(SSyncCfg *pSyncCfg) { cJSON *pJson = syncCfg2Json(pSyncCfg); - char * serialized = cJSON_Print(pJson); + char *serialized = cJSON_Print(pJson); cJSON_Delete(pJson); return serialized; } @@ -109,7 +109,7 @@ char *syncCfg2Str(SSyncCfg *pSyncCfg) { char *syncCfg2SimpleStr(SSyncCfg *pSyncCfg) { if (pSyncCfg != NULL) { int32_t len = 512; - char * s = taosMemoryMalloc(len); + char *s = taosMemoryMalloc(len); memset(s, 0, len); snprintf(s, len, "{replica-num:%d, my-index:%d, ", pSyncCfg->replicaNum, pSyncCfg->myIndex); @@ -205,7 +205,7 @@ cJSON *raftCfg2Json(SRaftCfg *pRaftCfg) { char *raftCfg2Str(SRaftCfg *pRaftCfg) { cJSON *pJson = raftCfg2Json(pRaftCfg); - char * serialized = cJSON_Print(pJson); + char *serialized = cJSON_Print(pJson); cJSON_Delete(pJson); return serialized; } @@ -214,7 +214,16 @@ int32_t raftCfgCreateFile(SSyncCfg *pCfg, SRaftCfgMeta meta, const char *path) { ASSERT(pCfg != NULL); TdFilePtr pFile = taosOpenFile(path, TD_FILE_CREATE | TD_FILE_WRITE); - ASSERT(pFile != NULL); + if (pFile == NULL) { + int32_t err = terrno; + const char *errStr = tstrerror(err); + int32_t sysErr = errno; + const char *sysErrStr = strerror(errno); + sError("create raft cfg file error, err:%d %X, msg:%s, syserr:%d, sysmsg:%s", err, err, errStr, sysErr, sysErrStr); + ASSERT(0); + + return -1; + } SRaftCfg raftCfg; raftCfg.cfg = *pCfg; @@ -271,7 +280,7 @@ int32_t raftCfgFromJson(const cJSON *pRoot, SRaftCfg *pRaftCfg) { (pRaftCfg->configIndexArr)[i] = atoll(pIndex->valuestring); } - cJSON * pJsonSyncCfg = cJSON_GetObjectItem(pJson, "SSyncCfg"); + cJSON *pJsonSyncCfg = cJSON_GetObjectItem(pJson, "SSyncCfg"); int32_t code = syncCfgFromJson(pJsonSyncCfg, &(pRaftCfg->cfg)); ASSERT(code == 0); diff --git a/source/libs/sync/src/syncRaftLog.c b/source/libs/sync/src/syncRaftLog.c index d84c576714f056e1d48272f929c27dad9d92ba6f..a02689262973133550012fc06a07a602e9f55974 100644 --- a/source/libs/sync/src/syncRaftLog.c +++ b/source/libs/sync/src/syncRaftLog.c @@ -17,24 +17,27 @@ #include "syncRaftCfg.h" #include "syncRaftStore.h" -// refactor, log[0 .. n] ==> log[m .. n] -static int32_t raftLogRestoreFromSnapshot(struct SSyncLogStore* pLogStore, SyncIndex snapshotIndex); -// static int32_t raftLogSetBeginIndex(struct SSyncLogStore* pLogStore, SyncIndex beginIndex); +//------------------------------- +// log[m .. n] + +// public function +static int32_t raftLogRestoreFromSnapshot(struct SSyncLogStore* pLogStore, SyncIndex snapshotIndex); static SyncIndex raftLogBeginIndex(struct SSyncLogStore* pLogStore); static SyncIndex raftLogEndIndex(struct SSyncLogStore* pLogStore); static SyncIndex raftLogWriteIndex(struct SSyncLogStore* pLogStore); static bool raftLogIsEmpty(struct SSyncLogStore* pLogStore); static int32_t raftLogEntryCount(struct SSyncLogStore* pLogStore); - static SyncIndex raftLogLastIndex(struct SSyncLogStore* pLogStore); static SyncTerm raftLogLastTerm(struct SSyncLogStore* pLogStore); static int32_t raftLogAppendEntry(struct SSyncLogStore* pLogStore, SSyncRaftEntry* pEntry); static int32_t raftLogGetEntry(struct SSyncLogStore* pLogStore, SyncIndex index, SSyncRaftEntry** ppEntry); static int32_t raftLogTruncate(struct SSyncLogStore* pLogStore, SyncIndex fromIndex); +// private function static int32_t raftLogGetLastEntry(SSyncLogStore* pLogStore, SSyncRaftEntry** ppLastEntry); //------------------------------- +// log[0 .. n] static SSyncRaftEntry* logStoreGetLastEntry(SSyncLogStore* pLogStore); static SyncIndex logStoreLastIndex(SSyncLogStore* pLogStore); static SyncTerm logStoreLastTerm(SSyncLogStore* pLogStore); @@ -44,28 +47,86 @@ static int32_t logStoreTruncate(SSyncLogStore* pLogStore, SyncIndex from static int32_t logStoreUpdateCommitIndex(SSyncLogStore* pLogStore, SyncIndex index); static SyncIndex logStoreGetCommitIndex(SSyncLogStore* pLogStore); -// refactor, log[0 .. n] ==> log[m .. n] -/* -static int32_t raftLogSetBeginIndex(struct SSyncLogStore* pLogStore, SyncIndex beginIndex) { - // if beginIndex == 0, donot need call this funciton - ASSERT(beginIndex > 0); +//------------------------------- +SSyncLogStore* logStoreCreate(SSyncNode* pSyncNode) { + SSyncLogStore* pLogStore = taosMemoryMalloc(sizeof(SSyncLogStore)); + ASSERT(pLogStore != NULL); + + pLogStore->data = taosMemoryMalloc(sizeof(SSyncLogStoreData)); + ASSERT(pLogStore->data != NULL); SSyncLogStoreData* pData = pLogStore->data; - SWal* pWal = pData->pWal; - sTrace("vgId:%d, reset wal begin index:%ld", pData->pSyncNode->vgId, beginIndex); + pData->pSyncNode = pSyncNode; + pData->pWal = pSyncNode->pWal; + ASSERT(pData->pWal != NULL); - pData->beginIndex = beginIndex; - walRestoreFromSnapshot(pWal, beginIndex - 1); - return 0; + taosThreadMutexInit(&(pData->mutex), NULL); + pData->pWalHandle = walOpenReadHandle(pData->pWal); + ASSERT(pData->pWalHandle != NULL); + + pLogStore->appendEntry = logStoreAppendEntry; + pLogStore->getEntry = logStoreGetEntry; + pLogStore->truncate = logStoreTruncate; + pLogStore->getLastIndex = logStoreLastIndex; + pLogStore->getLastTerm = logStoreLastTerm; + pLogStore->updateCommitIndex = logStoreUpdateCommitIndex; + pLogStore->getCommitIndex = logStoreGetCommitIndex; + + pLogStore->syncLogRestoreFromSnapshot = raftLogRestoreFromSnapshot; + pLogStore->syncLogBeginIndex = raftLogBeginIndex; + pLogStore->syncLogEndIndex = raftLogEndIndex; + pLogStore->syncLogIsEmpty = raftLogIsEmpty; + pLogStore->syncLogEntryCount = raftLogEntryCount; + pLogStore->syncLogLastIndex = raftLogLastIndex; + pLogStore->syncLogLastTerm = raftLogLastTerm; + pLogStore->syncLogAppendEntry = raftLogAppendEntry; + pLogStore->syncLogGetEntry = raftLogGetEntry; + pLogStore->syncLogTruncate = raftLogTruncate; + pLogStore->syncLogWriteIndex = raftLogWriteIndex; + + return pLogStore; +} + +void logStoreDestory(SSyncLogStore* pLogStore) { + if (pLogStore != NULL) { + SSyncLogStoreData* pData = pLogStore->data; + + taosThreadMutexLock(&(pData->mutex)); + if (pData->pWalHandle != NULL) { + walCloseReadHandle(pData->pWalHandle); + pData->pWalHandle = NULL; + } + taosThreadMutexUnlock(&(pData->mutex)); + taosThreadMutexDestroy(&(pData->mutex)); + + taosMemoryFree(pLogStore->data); + taosMemoryFree(pLogStore); + } } -*/ +//------------------------------- +// log[m .. n] static int32_t raftLogRestoreFromSnapshot(struct SSyncLogStore* pLogStore, SyncIndex snapshotIndex) { ASSERT(snapshotIndex >= 0); SSyncLogStoreData* pData = pLogStore->data; SWal* pWal = pData->pWal; - walRestoreFromSnapshot(pWal, snapshotIndex); + int32_t code = walRestoreFromSnapshot(pWal, snapshotIndex); + if (code != 0) { + int32_t err = terrno; + const char* errStr = tstrerror(err); + int32_t sysErr = errno; + const char* sysErrStr = strerror(errno); + + char logBuf[128]; + snprintf(logBuf, sizeof(logBuf), + "wal restore from snapshot error, index:%ld, err:%d %X, msg:%s, syserr:%d, sysmsg:%s", snapshotIndex, err, + err, errStr, sysErr, sysErrStr); + syncNodeErrorLog(pData->pSyncNode, logBuf); + + return -1; + } + return 0; } @@ -91,18 +152,6 @@ static int32_t raftLogEntryCount(struct SSyncLogStore* pLogStore) { return count > 0 ? count : 0; } -#if 0 -static bool raftLogInRange(struct SSyncLogStore* pLogStore, SyncIndex index) { - SyncIndex beginIndex = raftLogBeginIndex(pLogStore); - SyncIndex endIndex = raftLogEndIndex(pLogStore); - if (index >= beginIndex && index <= endIndex) { - return true; - } else { - return false; - } -} -#endif - static SyncIndex raftLogLastIndex(struct SSyncLogStore* pLogStore) { SyncIndex lastIndex; SSyncLogStoreData* pData = pLogStore->data; @@ -119,6 +168,9 @@ static SyncIndex raftLogWriteIndex(struct SSyncLogStore* pLogStore) { return lastVer + 1; } +// if success, return last term +// if not log, return 0 +// if error, return SYNC_TERM_INVALID static SyncTerm raftLogLastTerm(struct SSyncLogStore* pLogStore) { SSyncLogStoreData* pData = pLogStore->data; SWal* pWal = pData->pWal; @@ -127,34 +179,18 @@ static SyncTerm raftLogLastTerm(struct SSyncLogStore* pLogStore) { } else { SSyncRaftEntry* pLastEntry; int32_t code = raftLogGetLastEntry(pLogStore, &pLastEntry); - ASSERT(code == 0); - ASSERT(pLastEntry != NULL); - - SyncTerm lastTerm = pLastEntry->term; - taosMemoryFree(pLastEntry); - return lastTerm; - } - - return 0; -} - -/* -static SyncTerm raftLogLastTerm(struct SSyncLogStore* pLogStore) { - SyncTerm lastTerm = 0; - if (raftLogEntryCount(pLogStore) == 0) { - lastTerm = 0; - } else { - SSyncRaftEntry* pLastEntry; - int32_t code = raftLogGetLastEntry(pLogStore, &pLastEntry); - ASSERT(code == 0); - if (pLastEntry != NULL) { - lastTerm = pLastEntry->term; + if (code == 0 && pLastEntry != NULL) { + SyncTerm lastTerm = pLastEntry->term; taosMemoryFree(pLastEntry); + return lastTerm; + } else { + return SYNC_TERM_INVALID; } } - return lastTerm; + + // can not be here! + return SYNC_TERM_INVALID; } -*/ static int32_t raftLogAppendEntry(struct SSyncLogStore* pLogStore, SSyncRaftEntry* pEntry) { SSyncLogStoreData* pData = pLogStore->data; @@ -187,63 +223,21 @@ static int32_t raftLogAppendEntry(struct SSyncLogStore* pLogStore, SSyncRaftEntr ASSERT(0); } - walFsync(pWal, true); + // walFsync(pWal, true); - char eventLog[128]; - snprintf(eventLog, sizeof(eventLog), "write index:%ld, type:%s,%d, type2:%s,%d", pEntry->index, - TMSG_INFO(pEntry->msgType), pEntry->msgType, TMSG_INFO(pEntry->originalRpcType), pEntry->originalRpcType); - syncNodeEventLog(pData->pSyncNode, eventLog); - - return code; -} - -#if 0 -static int32_t raftLogGetEntry(struct SSyncLogStore* pLogStore, SyncIndex index, SSyncRaftEntry** ppEntry) { - SSyncLogStoreData* pData = pLogStore->data; - SWal* pWal = pData->pWal; - int32_t code; - - *ppEntry = NULL; - if (raftLogInRange(pLogStore, index)) { - SWalReadHandle* pWalHandle = walOpenReadHandle(pWal); - ASSERT(pWalHandle != NULL); - - code = walReadWithHandle(pWalHandle, index); - if (code != 0) { - int32_t err = terrno; - const char* errStr = tstrerror(err); - int32_t linuxErr = errno; - const char* linuxErrMsg = strerror(errno); - sError("raftLogGetEntry error, err:%d %X, msg:%s, linuxErr:%d, linuxErrMsg:%s", err, err, errStr, linuxErr, - linuxErrMsg); - ASSERT(0); - walCloseReadHandle(pWalHandle); - return code; - } - - *ppEntry = syncEntryBuild(pWalHandle->pHead->head.bodyLen); - ASSERT(*ppEntry != NULL); - (*ppEntry)->msgType = TDMT_SYNC_CLIENT_REQUEST; - (*ppEntry)->originalRpcType = pWalHandle->pHead->head.msgType; - (*ppEntry)->seqNum = pWalHandle->pHead->head.syncMeta.seqNum; - (*ppEntry)->isWeak = pWalHandle->pHead->head.syncMeta.isWeek; - (*ppEntry)->term = pWalHandle->pHead->head.syncMeta.term; - (*ppEntry)->index = index; - ASSERT((*ppEntry)->dataLen == pWalHandle->pHead->head.bodyLen); - memcpy((*ppEntry)->data, pWalHandle->pHead->head.body, pWalHandle->pHead->head.bodyLen); - - // need to hold, do not new every time!! - walCloseReadHandle(pWalHandle); - - } else { - // index not in range - code = 0; - } + do { + char eventLog[128]; + snprintf(eventLog, sizeof(eventLog), "write index:%ld, type:%s,%d, type2:%s,%d", pEntry->index, + TMSG_INFO(pEntry->msgType), pEntry->msgType, TMSG_INFO(pEntry->originalRpcType), pEntry->originalRpcType); + syncNodeEventLog(pData->pSyncNode, eventLog); + } while (0); return code; } -#endif +// entry found, return 0 +// entry not found, return -1, terrno = TSDB_CODE_WAL_LOG_NOT_EXIST +// other error, return -1 static int32_t raftLogGetEntry(struct SSyncLogStore* pLogStore, SyncIndex index, SSyncRaftEntry** ppEntry) { SSyncLogStoreData* pData = pLogStore->data; SWal* pWal = pData->pWal; @@ -254,6 +248,7 @@ static int32_t raftLogGetEntry(struct SSyncLogStore* pLogStore, SyncIndex index, // SWalReadHandle* pWalHandle = walOpenReadHandle(pWal); SWalReadHandle* pWalHandle = pData->pWalHandle; if (pWalHandle == NULL) { + terrno = TSDB_CODE_SYN_INTERNAL_ERROR; return -1; } @@ -325,6 +320,9 @@ static int32_t raftLogTruncate(struct SSyncLogStore* pLogStore, SyncIndex fromIn return code; } +// entry found, return 0 +// entry not found, return -1, terrno = TSDB_CODE_WAL_LOG_NOT_EXIST +// other error, return -1 static int32_t raftLogGetLastEntry(SSyncLogStore* pLogStore, SSyncRaftEntry** ppLastEntry) { SSyncLogStoreData* pData = pLogStore->data; SWal* pWal = pData->pWal; @@ -336,98 +334,16 @@ static int32_t raftLogGetLastEntry(SSyncLogStore* pLogStore, SSyncRaftEntry** pp return -1; } else { SyncIndex lastIndex = raftLogLastIndex(pLogStore); - int32_t code = raftLogGetEntry(pLogStore, lastIndex, ppLastEntry); + ASSERT(lastIndex >= SYNC_INDEX_BEGIN); + int32_t code = raftLogGetEntry(pLogStore, lastIndex, ppLastEntry); return code; } return -1; } -/* -static int32_t raftLogGetLastEntry(SSyncLogStore* pLogStore, SSyncRaftEntry** ppLastEntry) { - *ppLastEntry = NULL; - if (raftLogEntryCount(pLogStore) == 0) { - return 0; - } - SyncIndex lastIndex = raftLogLastIndex(pLogStore); - int32_t code = raftLogGetEntry(pLogStore, lastIndex, ppLastEntry); - return code; -} -*/ - -//------------------------------- -SSyncLogStore* logStoreCreate(SSyncNode* pSyncNode) { - SSyncLogStore* pLogStore = taosMemoryMalloc(sizeof(SSyncLogStore)); - ASSERT(pLogStore != NULL); - - pLogStore->data = taosMemoryMalloc(sizeof(SSyncLogStoreData)); - ASSERT(pLogStore->data != NULL); - - SSyncLogStoreData* pData = pLogStore->data; - pData->pSyncNode = pSyncNode; - pData->pWal = pSyncNode->pWal; - ASSERT(pData->pWal != NULL); - - taosThreadMutexInit(&(pData->mutex), NULL); - pData->pWalHandle = walOpenReadHandle(pData->pWal); - ASSERT(pData->pWalHandle != NULL); - - /* - SyncIndex firstVer = walGetFirstVer(pData->pWal); - SyncIndex lastVer = walGetLastVer(pData->pWal); - if (firstVer >= 0) { - pData->beginIndex = firstVer; - } else if (firstVer == -1) { - pData->beginIndex = lastVer + 1; - } else { - ASSERT(0); - } - */ - - pLogStore->appendEntry = logStoreAppendEntry; - pLogStore->getEntry = logStoreGetEntry; - pLogStore->truncate = logStoreTruncate; - pLogStore->getLastIndex = logStoreLastIndex; - pLogStore->getLastTerm = logStoreLastTerm; - pLogStore->updateCommitIndex = logStoreUpdateCommitIndex; - pLogStore->getCommitIndex = logStoreGetCommitIndex; - - // pLogStore->syncLogSetBeginIndex = raftLogSetBeginIndex; - pLogStore->syncLogRestoreFromSnapshot = raftLogRestoreFromSnapshot; - pLogStore->syncLogBeginIndex = raftLogBeginIndex; - pLogStore->syncLogEndIndex = raftLogEndIndex; - pLogStore->syncLogIsEmpty = raftLogIsEmpty; - pLogStore->syncLogEntryCount = raftLogEntryCount; - pLogStore->syncLogLastIndex = raftLogLastIndex; - pLogStore->syncLogLastTerm = raftLogLastTerm; - pLogStore->syncLogAppendEntry = raftLogAppendEntry; - pLogStore->syncLogGetEntry = raftLogGetEntry; - pLogStore->syncLogTruncate = raftLogTruncate; - pLogStore->syncLogWriteIndex = raftLogWriteIndex; - - // pLogStore->syncLogInRange = raftLogInRange; - - return pLogStore; -} - -void logStoreDestory(SSyncLogStore* pLogStore) { - if (pLogStore != NULL) { - SSyncLogStoreData* pData = pLogStore->data; - - taosThreadMutexLock(&(pData->mutex)); - if (pData->pWalHandle != NULL) { - walCloseReadHandle(pData->pWalHandle); - pData->pWalHandle = NULL; - } - taosThreadMutexUnlock(&(pData->mutex)); - taosThreadMutexDestroy(&(pData->mutex)); - - taosMemoryFree(pLogStore->data); - taosMemoryFree(pLogStore); - } -} - //------------------------------- +// log[0 .. n] int32_t logStoreAppendEntry(SSyncLogStore* pLogStore, SSyncRaftEntry* pEntry) { SSyncLogStoreData* pData = pLogStore->data; SWal* pWal = pData->pWal; @@ -455,7 +371,7 @@ int32_t logStoreAppendEntry(SSyncLogStore* pLogStore, SSyncRaftEntry* pEntry) { ASSERT(0); } - walFsync(pWal, true); + // walFsync(pWal, true); char eventLog[128]; snprintf(eventLog, sizeof(eventLog), "old write index:%ld, type:%s,%d, type2:%s,%d", pEntry->index, @@ -593,55 +509,6 @@ SSyncRaftEntry* logStoreGetLastEntry(SSyncLogStore* pLogStore) { return pEntry; } -/* -cJSON* logStore2Json(SSyncLogStore* pLogStore) { - char u64buf[128] = {0}; - SSyncLogStoreData* pData = (SSyncLogStoreData*)pLogStore->data; - cJSON* pRoot = cJSON_CreateObject(); - - if (pData != NULL && pData->pWal != NULL) { - snprintf(u64buf, sizeof(u64buf), "%p", pData->pSyncNode); - cJSON_AddStringToObject(pRoot, "pSyncNode", u64buf); - snprintf(u64buf, sizeof(u64buf), "%p", pData->pWal); - cJSON_AddStringToObject(pRoot, "pWal", u64buf); - - snprintf(u64buf, sizeof(u64buf), "%ld", pData->beginIndex); - cJSON_AddStringToObject(pRoot, "beginIndex", u64buf); - - SyncIndex endIndex = raftLogEndIndex(pLogStore); - snprintf(u64buf, sizeof(u64buf), "%ld", endIndex); - cJSON_AddStringToObject(pRoot, "endIndex", u64buf); - - int32_t count = raftLogEntryCount(pLogStore); - cJSON_AddNumberToObject(pRoot, "entryCount", count); - - snprintf(u64buf, sizeof(u64buf), "%ld", raftLogWriteIndex(pLogStore)); - cJSON_AddStringToObject(pRoot, "WriteIndex", u64buf); - - snprintf(u64buf, sizeof(u64buf), "%d", raftLogIsEmpty(pLogStore)); - cJSON_AddStringToObject(pRoot, "IsEmpty", u64buf); - - snprintf(u64buf, sizeof(u64buf), "%ld", raftLogLastIndex(pLogStore)); - cJSON_AddStringToObject(pRoot, "LastIndex", u64buf); - snprintf(u64buf, sizeof(u64buf), "%lu", raftLogLastTerm(pLogStore)); - cJSON_AddStringToObject(pRoot, "LastTerm", u64buf); - - cJSON* pEntries = cJSON_CreateArray(); - cJSON_AddItemToObject(pRoot, "pEntries", pEntries); - - for (SyncIndex i = pData->beginIndex; i <= endIndex; ++i) { - SSyncRaftEntry* pEntry = logStoreGetEntry(pLogStore, i); - cJSON_AddItemToArray(pEntries, syncEntry2Json(pEntry)); - syncEntryDestory(pEntry); - } - } - - cJSON* pJson = cJSON_CreateObject(); - cJSON_AddItemToObject(pJson, "SSyncLogStore", pRoot); - return pJson; -} -*/ - cJSON* logStore2Json(SSyncLogStore* pLogStore) { char u64buf[128] = {0}; SSyncLogStoreData* pData = (SSyncLogStoreData*)pLogStore->data; diff --git a/source/libs/sync/src/syncRequestVote.c b/source/libs/sync/src/syncRequestVote.c index 95dec6cb831b884f4380ffee2097b0971a003702..d272e0175f472670e367271f994f516b5e821a30 100644 --- a/source/libs/sync/src/syncRequestVote.c +++ b/source/libs/sync/src/syncRequestVote.c @@ -156,6 +156,10 @@ static bool syncNodeOnRequestVoteLogOK(SSyncNode* pSyncNode, SyncRequestVote* pM SyncTerm myLastTerm = syncNodeGetLastTerm(pSyncNode); SyncIndex myLastIndex = syncNodeGetLastIndex(pSyncNode); + if (myLastTerm == SYNC_TERM_INVALID) { + return false; + } + if (pMsg->lastLogTerm > myLastTerm) { return true; } diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c index 7b15be2d1484ec401cd59123e0336a1f82dd6268..70f3801e61e881332b20b38d0ff5922b044663e7 100644 --- a/source/libs/sync/src/syncSnapshot.c +++ b/source/libs/sync/src/syncSnapshot.c @@ -363,8 +363,9 @@ char *snapshotSender2SimpleStr(SSyncSnapshotSender *pSender, char *event) { uint16_t port; syncUtilU642Addr(destId.addr, host, sizeof(host), &port); - snprintf(s, len, "%s %p laindex:%ld laterm:%lu lcindex:%ld seq:%d ack:%d finish:%d pterm:%lu replica-index:%d %s:%d", - event, pSender, pSender->snapshot.lastApplyIndex, pSender->snapshot.lastApplyTerm, + snprintf(s, len, + "%s {%p laindex:%ld laterm:%lu lcindex:%ld seq:%d ack:%d finish:%d pterm:%lu replica-index:%d %s:%d}", event, + pSender, pSender->snapshot.lastApplyIndex, pSender->snapshot.lastApplyTerm, pSender->snapshot.lastConfigIndex, pSender->seq, pSender->ack, pSender->finish, pSender->privateTerm, pSender->replicaIndex, host, port); @@ -507,32 +508,51 @@ void snapshotReceiverStop(SSyncSnapshotReceiver *pReceiver) { } while (0); } -static void snapshotReceiverFinish(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pMsg) { +static int32_t snapshotReceiverFinish(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pMsg) { ASSERT(pMsg->seq == SYNC_SNAPSHOT_SEQ_END); + int32_t code = 0; if (pReceiver->pWriter != NULL) { - int32_t code = 0; + // write data if (pMsg->dataLen > 0) { code = pReceiver->pSyncNode->pFsm->FpSnapshotDoWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, pMsg->data, pMsg->dataLen); - ASSERT(code == 0); + if (code != 0) { + syncNodeErrorLog(pReceiver->pSyncNode, "snapshot write error"); + return -1; + } + } + + // reset wal + code = + pReceiver->pSyncNode->pLogStore->syncLogRestoreFromSnapshot(pReceiver->pSyncNode->pLogStore, pMsg->lastIndex); + if (code != 0) { + syncNodeErrorLog(pReceiver->pSyncNode, "wal restore from snapshot error"); + return -1; } + // update commit index + if (pReceiver->snapshot.lastApplyIndex > pReceiver->pSyncNode->commitIndex) { + pReceiver->pSyncNode->commitIndex = pReceiver->snapshot.lastApplyIndex; + } + + // stop writer code = pReceiver->pSyncNode->pFsm->FpSnapshotStopWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, true); - ASSERT(code == 0); + if (code != 0) { + syncNodeErrorLog(pReceiver->pSyncNode, "snapshot stop writer true error"); + ASSERT(0); + return -1; + } pReceiver->pWriter = NULL; - } - pReceiver->ack = SYNC_SNAPSHOT_SEQ_END; + // update progress + pReceiver->ack = SYNC_SNAPSHOT_SEQ_END; - // update commit index - if (pReceiver->snapshot.lastApplyIndex > pReceiver->pSyncNode->commitIndex) { - pReceiver->pSyncNode->commitIndex = pReceiver->snapshot.lastApplyIndex; + } else { + syncNodeErrorLog(pReceiver->pSyncNode, "snapshot stop writer true error"); + return -1; } - // reset wal - pReceiver->pSyncNode->pLogStore->syncLogRestoreFromSnapshot(pReceiver->pSyncNode->pLogStore, pMsg->lastIndex); - // event log do { SSnapshot snapshot; @@ -541,6 +561,8 @@ static void snapshotReceiverFinish(SSyncSnapshotReceiver *pReceiver, SyncSnapsho syncNodeEventLog(pReceiver->pSyncNode, eventLog); taosMemoryFree(eventLog); } while (0); + + return 0; } static void snapshotReceiverGotData(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pMsg) { @@ -629,7 +651,7 @@ char *snapshotReceiver2SimpleStr(SSyncSnapshotReceiver *pReceiver, char *event) uint16_t port; syncUtilU642Addr(fromId.addr, host, sizeof(host), &port); - snprintf(s, len, "%s %p start:%d ack:%d term:%lu pterm:%lu from:%s:%d laindex:%ld laterm:%lu lcindex:%ld", event, + snprintf(s, len, "%s {%p start:%d ack:%d term:%lu pterm:%lu from:%s:%d laindex:%ld laterm:%lu lcindex:%ld}", event, pReceiver, pReceiver->start, pReceiver->ack, pReceiver->term, pReceiver->privateTerm, host, port, pReceiver->snapshot.lastApplyIndex, pReceiver->snapshot.lastApplyTerm, pReceiver->snapshot.lastConfigIndex); @@ -641,6 +663,7 @@ int32_t syncNodeOnSnapshotSendCb(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) { // get receiver SSyncSnapshotReceiver *pReceiver = pSyncNode->pNewNodeReceiver; bool needRsp = false; + int32_t code = 0; // state, term, seq/ack if (pSyncNode->state == TAOS_SYNC_STATE_FOLLOWER) { @@ -652,8 +675,10 @@ int32_t syncNodeOnSnapshotSendCb(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) { } else if (pMsg->seq == SYNC_SNAPSHOT_SEQ_END) { // end, finish FSM - snapshotReceiverFinish(pReceiver, pMsg); - snapshotReceiverStop(pReceiver); + code = snapshotReceiverFinish(pReceiver, pMsg); + if (code == 0) { + snapshotReceiverStop(pReceiver); + } needRsp = true; // maybe update lastconfig @@ -682,7 +707,16 @@ int32_t syncNodeOnSnapshotSendCb(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) { needRsp = true; } else { - ASSERT(0); + // error log + do { + char logBuf[96]; + snprintf(logBuf, sizeof(logBuf), "snapshot receiver recv error seq:%d, my ack:%d", pMsg->seq, pReceiver->ack); + char *eventLog = snapshotReceiver2SimpleStr(pReceiver, logBuf); + syncNodeErrorLog(pSyncNode, eventLog); + taosMemoryFree(eventLog); + } while (0); + + return -1; } // send ack @@ -762,9 +796,10 @@ int32_t syncNodeOnSnapshotRspCb(SSyncNode *pSyncNode, SyncSnapshotRsp *pMsg) { snapshotReSend(pSender); } else { + // error log do { - char logBuf[64]; - snprintf(logBuf, sizeof(logBuf), "error ack, recv ack:%d, my seq:%d", pMsg->ack, pSender->seq); + char logBuf[96]; + snprintf(logBuf, sizeof(logBuf), "snapshot sender recv error ack:%d, my seq:%d", pMsg->ack, pSender->seq); char *eventLog = snapshotSender2SimpleStr(pSender, logBuf); syncNodeErrorLog(pSyncNode, eventLog); taosMemoryFree(eventLog); diff --git a/source/libs/transport/inc/transComm.h b/source/libs/transport/inc/transComm.h index 55db0b129a1cfb7f35984b8720fb7d5b35311e70..b06d541b759bf5b19519b9eaad5053c9b998bff0 100644 --- a/source/libs/transport/inc/transComm.h +++ b/source/libs/transport/inc/transComm.h @@ -148,6 +148,7 @@ typedef struct { char release : 2; char secured : 2; char spi : 2; + char hasEpSet : 2; // contain epset or not, 0(default): no epset, 1: contain epset char user[TSDB_UNI_LEN]; STraceId traceId; @@ -252,7 +253,7 @@ int transAsyncSend(SAsyncPool* pool, queue* mq); do { \ if (id > 0) { \ tTrace("handle step1"); \ - SExHandle* exh2 = transAcquireExHandle(refMgt, id); \ + SExHandle* exh2 = transAcquireExHandle(id); \ if (exh2 == NULL || id != exh2->refId) { \ tTrace("handle %p except, may already freed, ignore msg, ref1: %" PRIu64 ", ref2 : %" PRIu64 "", exh1, \ exh2 ? exh2->refId : 0, id); \ @@ -260,7 +261,7 @@ int transAsyncSend(SAsyncPool* pool, queue* mq); } \ } else if (id == 0) { \ tTrace("handle step2"); \ - SExHandle* exh2 = transAcquireExHandle(refMgt, id); \ + SExHandle* exh2 = transAcquireExHandle(id); \ if (exh2 == NULL || id == exh2->refId) { \ tTrace("handle %p except, may already freed, ignore msg, ref1: %" PRIu64 ", ref2 : %" PRIu64 "", exh1, id, \ exh2 ? exh2->refId : 0); \ @@ -273,6 +274,7 @@ int transAsyncSend(SAsyncPool* pool, queue* mq); goto _return2; \ } \ } while (0) + int transInitBuffer(SConnBuffer* buf); int transClearBuffer(SConnBuffer* buf); int transDestroyBuffer(SConnBuffer* buf); @@ -294,7 +296,6 @@ void transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pMsg, STra void transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pMsg, STransMsg* pRsp); void transSendResponse(const STransMsg* msg); void transRegisterMsg(const STransMsg* msg); -int transGetConnInfo(void* thandle, STransHandleInfo* pInfo); void transSetDefaultAddr(void* shandle, const char* ip, const char* fqdn); void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* shandle); @@ -377,26 +378,25 @@ typedef struct SDelayQueue { uv_loop_t* loop; } SDelayQueue; -int transDQCreate(uv_loop_t* loop, SDelayQueue** queue); - +int transDQCreate(uv_loop_t* loop, SDelayQueue** queue); void transDQDestroy(SDelayQueue* queue); +int transDQSched(SDelayQueue* queue, void (*func)(void* arg), void* arg, uint64_t timeoutMs); -int transDQSched(SDelayQueue* queue, void (*func)(void* arg), void* arg, uint64_t timeoutMs); - -// void transPrintEpSet(SEpSet* pEpSet); bool transEpSetIsEqual(SEpSet* a, SEpSet* b); /* * init global func */ void transThreadOnce(); -void transInitEnv(); +void transInit(); +void transCleanup(); + int32_t transOpenExHandleMgt(int size); -void transCloseExHandleMgt(int32_t mgt); -int64_t transAddExHandle(int32_t mgt, void* p); -int32_t transRemoveExHandle(int32_t mgt, int64_t refId); -SExHandle* transAcquireExHandle(int32_t mgt, int64_t refId); -int32_t transReleaseExHandle(int32_t mgt, int64_t refId); +void transCloseExHandleMgt(); +int64_t transAddExHandle(void* p); +int32_t transRemoveExHandle(int64_t refId); +SExHandle* transAcquireExHandle(int64_t refId); +int32_t transReleaseExHandle(int64_t refId); void transDestoryExHandle(void* handle); #ifdef __cplusplus diff --git a/source/libs/transport/src/trans.c b/source/libs/transport/src/trans.c index cc2e95cfb3c65b2e31d0671d9d4f581db19a3881..936cfe870d5cdce83b9dc3e14d22d4e13d86f731 100644 --- a/source/libs/transport/src/trans.c +++ b/source/libs/transport/src/trans.c @@ -36,7 +36,7 @@ static int32_t transValidLocalFqdn(const char* localFqdn, uint32_t* ip) { return 0; } void* rpcOpen(const SRpcInit* pInit) { - transInitEnv(); + rpcInit(); SRpcInfo* pRpc = taosMemoryCalloc(1, sizeof(SRpcInfo)); if (pRpc == NULL) { @@ -82,8 +82,8 @@ void rpcClose(void* arg) { tInfo("start to close rpc"); SRpcInfo* pRpc = (SRpcInfo*)arg; (*taosCloseHandle[pRpc->connType])(pRpc->tcphandle); - transCloseExHandleMgt(pRpc->refMgt); taosMemoryFree(pRpc); + tInfo("finish to close rpc"); return; } @@ -141,7 +141,9 @@ void rpcSendRecv(void* shandle, SEpSet* pEpSet, SRpcMsg* pMsg, SRpcMsg* pRsp) { } void rpcSendResponse(const SRpcMsg* pMsg) { transSendResponse(pMsg); } -int32_t rpcGetConnInfo(void* thandle, SRpcConnInfo* pInfo) { return transGetConnInfo((void*)thandle, pInfo); } + +int32_t rpcGetConnInfo(void* thandle, SRpcConnInfo* pInfo) { return 0; } + void rpcRefHandle(void* handle, int8_t type) { assert(type == TAOS_CONN_SERVER || type == TAOS_CONN_CLIENT); @@ -165,11 +167,11 @@ void rpcSetDefaultAddr(void* thandle, const char* ip, const char* fqdn) { } int32_t rpcInit() { - // impl later + transInit(); return 0; } void rpcCleanup(void) { - // impl later + transCleanup(); return; } diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index aba2e6957b51c62765fc155333e060e7804bd3de..2836bc294926312590345c6cadc9a2716d1cc0f0 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -15,9 +15,6 @@ #ifdef USE_UV #include "transComm.h" -static int32_t transSCliInst = 0; -static int32_t refMgt = 0; - typedef struct SCliConn { T_REF_DECLARE() uv_connect_t connReq; @@ -312,6 +309,7 @@ void cliHandleResp(SCliConn* conn) { transMsg.msgType = pHead->msgType; transMsg.info.ahandle = NULL; transMsg.info.traceId = pHead->traceId; + transMsg.info.hasEpSet = pHead->hasEpSet; SCliMsg* pMsg = NULL; STransConnCtx* pCtx = NULL; @@ -319,8 +317,9 @@ void cliHandleResp(SCliConn* conn) { if (CONN_NO_PERSIST_BY_APP(conn)) { pMsg = transQueuePop(&conn->cliMsgs); - pCtx = pMsg->ctx; - transMsg.info.ahandle = pCtx->ahandle; + + pCtx = pMsg ? pMsg->ctx : NULL; + transMsg.info.ahandle = pCtx ? pCtx->ahandle : NULL; tDebug("%s conn %p get ahandle %p, persist: 0", CONN_GET_INST_LABEL(conn), conn, transMsg.info.ahandle); } else { uint64_t ahandle = (uint64_t)pHead->ahandle; @@ -466,8 +465,7 @@ void* destroyConnPool(void* pool) { SConnList* connList = taosHashIterate((SHashObj*)pool, NULL); while (connList != NULL) { while (!QUEUE_IS_EMPTY(&connList->conn)) { - queue* h = QUEUE_HEAD(&connList->conn); - // QUEUE_REMOVE(h); + queue* h = QUEUE_HEAD(&connList->conn); SCliConn* c = QUEUE_DATA(h, SCliConn, conn); cliDestroyConn(c, true); } @@ -503,12 +501,13 @@ static SCliConn* getConnFromPool(void* pool, char* ip, uint32_t port) { } static void allocConnRef(SCliConn* conn, bool update) { if (update) { - transRemoveExHandle(refMgt, conn->refId); + transRemoveExHandle(conn->refId); + conn->refId = -1; } SExHandle* exh = taosMemoryCalloc(1, sizeof(SExHandle)); exh->handle = conn; exh->pThrd = conn->hostThrd; - exh->refId = transAddExHandle(refMgt, exh); + exh->refId = transAddExHandle(exh); conn->refId = exh->refId; } static void addConnToPool(void* pool, SCliConn* conn) { @@ -602,14 +601,26 @@ static void cliDestroyConn(SCliConn* conn, bool clear) { tTrace("%s conn %p remove from conn pool", CONN_GET_INST_LABEL(conn), conn); QUEUE_REMOVE(&conn->conn); QUEUE_INIT(&conn->conn); - transRemoveExHandle(refMgt, conn->refId); + transRemoveExHandle(conn->refId); + conn->refId = -1; + if (clear) { - uv_close((uv_handle_t*)conn->stream, cliDestroy); + if (!uv_is_closing((uv_handle_t*)conn->stream)) { + uv_close((uv_handle_t*)conn->stream, cliDestroy); + } else { + cliDestroy((uv_handle_t*)conn->stream); + } } } static void cliDestroy(uv_handle_t* handle) { + if (uv_handle_get_type(handle) != UV_TCP || handle->data == NULL) { + return; + } + SCliConn* conn = handle->data; + transRemoveExHandle(conn->refId); taosMemoryFree(conn->ip); + conn->stream->data = NULL; taosMemoryFree(conn->stream); transCtxCleanup(&conn->ctx); transQueueDestroy(&conn->cliMsgs); @@ -735,7 +746,7 @@ static void cliHandleQuit(SCliMsg* pMsg, SCliThrd* pThrd) { } static void cliHandleRelease(SCliMsg* pMsg, SCliThrd* pThrd) { int64_t refId = (int64_t)(pMsg->msg.info.handle); - SExHandle* exh = transAcquireExHandle(refMgt, refId); + SExHandle* exh = transAcquireExHandle(refId); if (exh == NULL) { tDebug("%" PRId64 " already release", refId); } @@ -761,7 +772,7 @@ SCliConn* cliGetConn(SCliMsg* pMsg, SCliThrd* pThrd, bool* ignore) { SCliConn* conn = NULL; int64_t refId = (int64_t)(pMsg->msg.info.handle); if (refId != 0) { - SExHandle* exh = transAcquireExHandle(refMgt, refId); + SExHandle* exh = transAcquireExHandle(refId); if (exh == NULL) { *ignore = true; destroyCmsg(pMsg); @@ -769,7 +780,7 @@ SCliConn* cliGetConn(SCliMsg* pMsg, SCliThrd* pThrd, bool* ignore) { // assert(0); } else { conn = exh->handle; - transReleaseExHandle(refMgt, refId); + transReleaseExHandle(refId); } return conn; }; @@ -899,10 +910,6 @@ void* transInitClient(uint32_t ip, uint32_t port, char* label, int numOfThreads, } cli->pThreadObj[i] = pThrd; } - int ref = atomic_add_fetch_32(&transSCliInst, 1); - if (ref == 1) { - refMgt = transOpenExHandleMgt(50000); - } return cli; } @@ -971,7 +978,7 @@ void cliSendQuit(SCliThrd* thrd) { } void cliWalkCb(uv_handle_t* handle, void* arg) { if (!uv_is_closing(handle)) { - uv_close(handle, NULL); + uv_close(handle, cliDestroy); } } @@ -1014,6 +1021,23 @@ void cliCompareAndSwap(int8_t* val, int8_t exp, int8_t newVal) { *val = newVal; } } + +bool cliTryToExtractEpSet(STransMsg* pResp, SEpSet* dst) { + if (pResp == NULL || pResp->info.hasEpSet == 0) { + return false; + } + tDeserializeSEpSet(pResp->pCont, pResp->contLen, dst); + int32_t tlen = tSerializeSEpSet(NULL, 0, dst); + + int32_t bufLen = pResp->contLen - tlen; + char* buf = rpcMallocCont(bufLen); + + memcpy(buf, (char*)pResp->pCont + tlen, bufLen); + + pResp->pCont = buf; + pResp->contLen = bufLen; + return true; +} int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { SCliThrd* pThrd = pConn->hostThrd; STrans* pTransInst = pThrd->pTransInst; @@ -1058,6 +1082,12 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { } STraceId* trace = &pResp->info.traceId; + + if (cliTryToExtractEpSet(pResp, &pCtx->epSet)) { + char tbuf[256] = {0}; + EPSET_DEBUG_STR(&pCtx->epSet, tbuf); + tGTrace("%s conn %p extract epset from msg", CONN_GET_INST_LABEL(pConn), pConn); + } if (pCtx->pSem != NULL) { tGTrace("%s conn %p(sync) handle resp", CONN_GET_INST_LABEL(pConn), pConn); if (pCtx->pRsp == NULL) { @@ -1086,10 +1116,6 @@ void transCloseClient(void* arg) { } taosMemoryFree(cli->pThreadObj); taosMemoryFree(cli); - int ref = atomic_sub_fetch_32(&transSCliInst, 1); - if (ref == 0) { - transCloseExHandleMgt(refMgt); - } } void transRefCliHandle(void* handle) { if (handle == NULL) { @@ -1111,12 +1137,12 @@ void transUnrefCliHandle(void* handle) { } SCliThrd* transGetWorkThrdFromHandle(int64_t handle) { SCliThrd* pThrd = NULL; - SExHandle* exh = transAcquireExHandle(refMgt, handle); + SExHandle* exh = transAcquireExHandle(handle); if (exh == NULL) { return NULL; } pThrd = exh->pThrd; - transReleaseExHandle(refMgt, handle); + transReleaseExHandle(handle); return pThrd; } SCliThrd* transGetWorkThrd(STrans* trans, int64_t handle) { diff --git a/source/libs/transport/src/transComm.c b/source/libs/transport/src/transComm.c index fbe0951a4655148301d4b7351fd1010ac400bd45..85a45ec921ae872a4ad736f15115cdd5d32397f1 100644 --- a/source/libs/transport/src/transComm.c +++ b/source/libs/transport/src/transComm.c @@ -16,7 +16,9 @@ #include "transComm.h" -// static TdThreadOnce transModuleInit = PTHREAD_ONCE_INIT; +static TdThreadOnce transModuleInit = PTHREAD_ONCE_INIT; + +static int32_t refMgt; int transAuthenticateMsg(void* pMsg, int msgLen, void* pAuth, void* pKey) { T_MD5_CTX context; @@ -478,35 +480,47 @@ bool transEpSetIsEqual(SEpSet* a, SEpSet* b) { return true; } -void transInitEnv() { - // +static void transInitEnv() { + refMgt = transOpenExHandleMgt(50000); uv_os_setenv("UV_TCP_SINGLE_ACCEPT", "1"); } +static void transDestroyEnv() { + // close ref + transCloseExHandleMgt(refMgt); +} +void transInit() { + // init env + taosThreadOnce(&transModuleInit, transInitEnv); +} +void transCleanup() { + // clean env + transDestroyEnv(); +} int32_t transOpenExHandleMgt(int size) { // added into once later return taosOpenRef(size, transDestoryExHandle); } -void transCloseExHandleMgt(int32_t mgt) { +void transCloseExHandleMgt() { // close ref - taosCloseRef(mgt); + taosCloseRef(refMgt); } -int64_t transAddExHandle(int32_t mgt, void* p) { +int64_t transAddExHandle(void* p) { // acquire extern handle - return taosAddRef(mgt, p); + return taosAddRef(refMgt, p); } -int32_t transRemoveExHandle(int32_t mgt, int64_t refId) { +int32_t transRemoveExHandle(int64_t refId) { // acquire extern handle - return taosRemoveRef(mgt, refId); + return taosRemoveRef(refMgt, refId); } -SExHandle* transAcquireExHandle(int32_t mgt, int64_t refId) { +SExHandle* transAcquireExHandle(int64_t refId) { // acquire extern handle - return (SExHandle*)taosAcquireRef(mgt, refId); + return (SExHandle*)taosAcquireRef(refMgt, refId); } -int32_t transReleaseExHandle(int32_t mgt, int64_t refId) { +int32_t transReleaseExHandle(int64_t refId) { // release extern handle - return taosReleaseRef(mgt, refId); + return taosReleaseRef(refMgt, refId); } void transDestoryExHandle(void* handle) { if (handle == NULL) { diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index 08363b3c7c81f0c90e61841baf1b1cfe729b103a..dfc6de644205b0dfd7ed09a028f19f8bbd4e679d 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -19,9 +19,7 @@ static TdThreadOnce transModuleInit = PTHREAD_ONCE_INIT; -static char* notify = "a"; -static int32_t tranSSvrInst = 0; -static int32_t refMgt = 0; +static char* notify = "a"; typedef struct { int notifyCount; // @@ -142,16 +140,6 @@ static void uvHandleRegister(SSvrMsg* msg, SWorkThrd* thrd); static void (*transAsyncHandle[])(SSvrMsg* msg, SWorkThrd* thrd) = {uvHandleResp, uvHandleQuit, uvHandleRelease, uvHandleRegister, NULL}; -static int32_t exHandlesMgt; - -// void uvInitEnv(); -// void uvOpenExHandleMgt(int size); -// void uvCloseExHandleMgt(); -// int64_t uvAddExHandle(void* p); -// int32_t uvRemoveExHandle(int64_t refId); -// int32_t uvReleaseExHandle(int64_t refId); -// void uvDestoryExHandle(void* handle); -// SExHandle* uvAcquireExHandle(int64_t refId); static void uvDestroyConn(uv_handle_t* handle); @@ -274,7 +262,7 @@ static void uvHandleReq(SSvrConn* pConn) { // 2. once send out data, cli conn released to conn pool immediately // 3. not mixed with persist transMsg.info.ahandle = (void*)pHead->ahandle; - transMsg.info.handle = (void*)transAcquireExHandle(refMgt, pConn->refId); + transMsg.info.handle = (void*)transAcquireExHandle(pConn->refId); transMsg.info.refId = pConn->refId; transMsg.info.traceId = pHead->traceId; @@ -292,7 +280,7 @@ static void uvHandleReq(SSvrConn* pConn) { pConnInfo->clientPort = ntohs(pConn->addr.sin_port); tstrncpy(pConnInfo->user, pConn->user, sizeof(pConnInfo->user)); - transReleaseExHandle(refMgt, pConn->refId); + transReleaseExHandle(pConn->refId); STrans* pTransInst = pConn->pTransInst; (*pTransInst->cfp)(pTransInst->parent, &transMsg, NULL); @@ -345,21 +333,12 @@ void uvOnTimeoutCb(uv_timer_t* handle) { void uvOnSendCb(uv_write_t* req, int status) { SSvrConn* conn = req->data; - // transClearBuffer(&conn->readBuf); if (status == 0) { tTrace("conn %p data already was written on stream", conn); if (!transQueueEmpty(&conn->srvMsgs)) { SSvrMsg* msg = transQueuePop(&conn->srvMsgs); - // if (msg->type == Release && conn->status != ConnNormal) { - // conn->status = ConnNormal; - // transUnrefSrvHandle(conn); - // reallocConnRef(conn); - // destroySmsg(msg); - // transQueueClear(&conn->srvMsgs); - // return; - //} destroySmsg(msg); - // send second data, just use for push + // send cached data if (!transQueueEmpty(&conn->srvMsgs)) { msg = (SSvrMsg*)transQueueGet(&conn->srvMsgs, 0); if (msg->type == Register && conn->status == ConnAcquire) { @@ -383,6 +362,7 @@ void uvOnSendCb(uv_write_t* req, int status) { } } } + transUnrefSrvHandle(conn); } else { tError("conn %p failed to write data, %s", conn, uv_err_name(status)); conn->broken = true; @@ -396,7 +376,6 @@ static void uvOnPipeWriteCb(uv_write_t* req, int status) { tError("fail to dispatch conn to work thread"); } uv_close((uv_handle_t*)req->data, uvFreeCb); - // taosMemoryFree(req->data); taosMemoryFree(req); } @@ -410,6 +389,7 @@ static void uvPrepareSendData(SSvrMsg* smsg, uv_buf_t* wb) { STransMsgHead* pHead = transHeadFromCont(pMsg->pCont); pHead->ahandle = (uint64_t)pMsg->info.ahandle; pHead->traceId = pMsg->info.traceId; + pHead->hasEpSet = pMsg->info.hasEpSet; if (pConn->status == ConnNormal) { pHead->msgType = pConn->inType + 1; @@ -422,6 +402,7 @@ static void uvPrepareSendData(SSvrMsg* smsg, uv_buf_t* wb) { transUnrefSrvHandle(pConn); } else { pHead->msgType = pMsg->msgType; + // set up resp msg type if (pHead->msgType == 0 && transMsgLenFromCont(pMsg->contLen) == sizeof(STransMsgHead)) pHead->msgType = pConn->inType + 1; } @@ -444,11 +425,15 @@ static void uvPrepareSendData(SSvrMsg* smsg, uv_buf_t* wb) { } static void uvStartSendRespInternal(SSvrMsg* smsg) { + SSvrConn* pConn = smsg->pConn; + if (pConn->broken) { + return; + } + uv_buf_t wb; uvPrepareSendData(smsg, &wb); - SSvrConn* pConn = smsg->pConn; - // uv_timer_stop(&pConn->pTimer); + transRefSrvHandle(pConn); uv_write(&pConn->pWriter, (uv_stream_t*)pConn->pTcp, &wb, 1, uvOnSendCb); } static void uvStartSendResp(SSvrMsg* smsg) { @@ -523,15 +508,15 @@ void uvWorkerAsyncCb(uv_async_t* handle) { SExHandle* exh1 = transMsg.info.handle; int64_t refId = transMsg.info.refId; - SExHandle* exh2 = transAcquireExHandle(refMgt, refId); + SExHandle* exh2 = transAcquireExHandle(refId); if (exh2 == NULL || exh1 != exh2) { tTrace("handle except msg %p, ignore it", exh1); - transReleaseExHandle(refMgt, refId); + transReleaseExHandle(refId); destroySmsg(msg); continue; } msg->pConn = exh1->handle; - transReleaseExHandle(refMgt, refId); + transReleaseExHandle(refId); (*transAsyncHandle[msg->type])(msg, pThrd); } } @@ -773,8 +758,8 @@ static SSvrConn* createConn(void* hThrd) { SExHandle* exh = taosMemoryMalloc(sizeof(SExHandle)); exh->handle = pConn; exh->pThrd = pThrd; - exh->refId = transAddExHandle(refMgt, exh); - transAcquireExHandle(refMgt, exh->refId); + exh->refId = transAddExHandle(exh); + transAcquireExHandle(exh->refId); pConn->refId = exh->refId; transRefSrvHandle(pConn); @@ -789,11 +774,12 @@ static void destroyConn(SSvrConn* conn, bool clear) { transDestroyBuffer(&conn->readBuf); if (clear) { - tTrace("conn %p to be destroyed", conn); - // uv_shutdown_t* req = taosMemoryMalloc(sizeof(uv_shutdown_t)); - uv_close((uv_handle_t*)conn->pTcp, uvDestroyConn); - // uv_close(conn->pTcp) - // uv_shutdown(req, (uv_stream_t*)conn->pTcp, uvShutDownCb); + if (!uv_is_closing((uv_handle_t*)conn->pTcp)) { + tTrace("conn %p to be destroyed", conn); + uv_close((uv_handle_t*)conn->pTcp, uvDestroyConn); + } else { + uvDestroyConn((uv_handle_t*)conn->pTcp); + } } } static void destroyConnRegArg(SSvrConn* conn) { @@ -803,14 +789,14 @@ static void destroyConnRegArg(SSvrConn* conn) { } } static int reallocConnRef(SSvrConn* conn) { - transReleaseExHandle(refMgt, conn->refId); - transRemoveExHandle(refMgt, conn->refId); + transReleaseExHandle(conn->refId); + transRemoveExHandle(conn->refId); // avoid app continue to send msg on invalid handle SExHandle* exh = taosMemoryMalloc(sizeof(SExHandle)); exh->handle = conn; exh->pThrd = conn->hostThrd; - exh->refId = transAddExHandle(refMgt, exh); - transAcquireExHandle(refMgt, exh->refId); + exh->refId = transAddExHandle(exh); + transAcquireExHandle(exh->refId); conn->refId = exh->refId; return 0; @@ -822,11 +808,10 @@ static void uvDestroyConn(uv_handle_t* handle) { } SWorkThrd* thrd = conn->hostThrd; - transReleaseExHandle(refMgt, conn->refId); - transRemoveExHandle(refMgt, conn->refId); + transReleaseExHandle(conn->refId); + transRemoveExHandle(conn->refId); tDebug("%s conn %p destroy", transLabel(thrd->pTransInst), conn); - // uv_timer_stop(&conn->pTimer); transQueueDestroy(&conn->srvMsgs); QUEUE_REMOVE(&conn->queue); @@ -871,12 +856,6 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads, srv->port = port; uv_loop_init(srv->loop); - // taosThreadOnce(&transModuleInit, uvInitEnv); - int ref = atomic_add_fetch_32(&tranSSvrInst, 1); - if (ref == 1) { - refMgt = transOpenExHandleMgt(50000); - } - assert(0 == uv_pipe_init(srv->loop, &srv->pipeListen, 0)); #ifdef WINDOWS char pipeName[64]; @@ -1028,11 +1007,6 @@ void transCloseServer(void* arg) { taosMemoryFree(srv->pipe); taosMemoryFree(srv); - - int ref = atomic_sub_fetch_32(&tranSSvrInst, 1); - if (ref == 0) { - transCloseExHandleMgt(refMgt); - } } void transRefSrvHandle(void* handle) { @@ -1071,11 +1045,11 @@ void transReleaseSrvHandle(void* handle) { tTrace("%s conn %p start to release", transLabel(pThrd->pTransInst), exh->handle); transAsyncSend(pThrd->asyncPool, &m->q); - transReleaseExHandle(refMgt, refId); + transReleaseExHandle(refId); return; _return1: tTrace("handle %p failed to send to release handle", exh); - transReleaseExHandle(refMgt, refId); + transReleaseExHandle(refId); return; _return2: tTrace("handle %p failed to send to release handle", exh); @@ -1100,12 +1074,12 @@ void transSendResponse(const STransMsg* msg) { STraceId* trace = (STraceId*)&msg->info.traceId; tGTrace("conn %p start to send resp (1/2)", exh->handle); transAsyncSend(pThrd->asyncPool, &m->q); - transReleaseExHandle(refMgt, refId); + transReleaseExHandle(refId); return; _return1: tTrace("handle %p failed to send resp", exh); rpcFreeCont(msg->pCont); - transReleaseExHandle(refMgt, refId); + transReleaseExHandle(refId); return; _return2: tTrace("handle %p failed to send resp", exh); @@ -1129,19 +1103,17 @@ void transRegisterMsg(const STransMsg* msg) { tTrace("%s conn %p start to register brokenlink callback", transLabel(pThrd->pTransInst), exh->handle); transAsyncSend(pThrd->asyncPool, &m->q); - transReleaseExHandle(refMgt, refId); + transReleaseExHandle(refId); return; _return1: tTrace("handle %p failed to register brokenlink", exh); rpcFreeCont(msg->pCont); - transReleaseExHandle(refMgt, refId); + transReleaseExHandle(refId); return; _return2: tTrace("handle %p failed to register brokenlink", exh); rpcFreeCont(msg->pCont); } -int transGetConnInfo(void* thandle, STransHandleInfo* pConnInfo) { return -1; } - #endif diff --git a/source/os/src/osSocket.c b/source/os/src/osSocket.c index b0e07ff01031075179f11253f439fc3233fb571f..f0dd5b974d9d90c373af2cc636a8f434c9a27159 100644 --- a/source/os/src/osSocket.c +++ b/source/os/src/osSocket.c @@ -925,10 +925,24 @@ uint32_t taosGetIpv4FromFqdn(const char *fqdn) { } int32_t taosGetFqdn(char *fqdn) { +#ifdef WINDOWS + // Initialize Winsock + WSADATA wsaData; + int iResult; + iResult = WSAStartup(MAKEWORD(2, 2), &wsaData); + if (iResult != 0) { + // printf("WSAStartup failed: %d\n", iResult); + return 1; + } +#endif char hostname[1024]; hostname[1023] = '\0'; if (gethostname(hostname, 1023) == -1) { - // printf("failed to get hostname, reason:%s", strerror(errno)); +#ifdef WINDOWS + printf("failed to get hostname, reason:%s", strerror(WSAGetLastError())); +#else + printf("failed to get hostname, reason:%s", strerror(errno)); +#endif assert(0); return -1; } diff --git a/source/util/src/terror.c b/source/util/src/terror.c index fa10fc26dd7cf3817e70cb00fb76ceb4522dadf3..96f0fb21caf37dc2a7713b162b0732d9e40e1130 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -453,11 +453,12 @@ TAOS_DEFINE_ERROR(TSDB_CODE_FS_NO_VALID_DISK, "tfs no valid disk") TAOS_DEFINE_ERROR(TSDB_CODE_CTG_INTERNAL_ERROR, "catalog internal error") TAOS_DEFINE_ERROR(TSDB_CODE_CTG_INVALID_INPUT, "invalid catalog input parameters") TAOS_DEFINE_ERROR(TSDB_CODE_CTG_NOT_READY, "catalog is not ready") -TAOS_DEFINE_ERROR(TSDB_CODE_CTG_MEM_ERROR, "catalog memory error") +TAOS_DEFINE_ERROR(TSDB_CODE_OUT_OF_MEMORY, "catalog memory error") TAOS_DEFINE_ERROR(TSDB_CODE_CTG_SYS_ERROR, "catalog system error") TAOS_DEFINE_ERROR(TSDB_CODE_CTG_DB_DROPPED, "Database is dropped") TAOS_DEFINE_ERROR(TSDB_CODE_CTG_OUT_OF_SERVICE, "catalog is out of service") TAOS_DEFINE_ERROR(TSDB_CODE_CTG_VG_META_MISMATCH, "table meta and vgroup mismatch") +TAOS_DEFINE_ERROR(TSDB_CODE_CTG_EXIT, "catalog exit") //scheduler TAOS_DEFINE_ERROR(TSDB_CODE_SCH_STATUS_ERROR, "scheduler status error") @@ -581,10 +582,10 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TSMA_INVALID_PTR, "Invalid tsma pointe TAOS_DEFINE_ERROR(TSDB_CODE_TSMA_INVALID_PARA, "Invalid tsma parameters") TAOS_DEFINE_ERROR(TSDB_CODE_TSMA_NO_INDEX_IN_CACHE, "No tsma index in cache") - //rsma TAOS_DEFINE_ERROR(TSDB_CODE_RSMA_INVALID_ENV, "Invalid rsma env") TAOS_DEFINE_ERROR(TSDB_CODE_RSMA_INVALID_STAT, "Invalid rsma state") +TAOS_DEFINE_ERROR(TSDB_CODE_RSMA_QTASKINFO_CREATE, "Rsma qtaskinfo creation error") //tq TAOS_DEFINE_ERROR(TSDB_CODE_TQ_NO_COMMITTED_OFFSET, "No committed offset") diff --git a/tests/pytest/a.sh b/tests/pytest/a.sh new file mode 100755 index 0000000000000000000000000000000000000000..cf6157980d68d031053a278276029c242302df39 --- /dev/null +++ b/tests/pytest/a.sh @@ -0,0 +1,13 @@ +#!/bin/bash +for i in {1..100} +do + echo $i + python3 ./test.py -f query/nestedQuery/nestedQuery_datacheck.py >>log 2>&1 + if [ $? -eq 0 ] + then + echo success + else + echo failed + break + fi +done diff --git a/tests/pytest/util/cluster.py b/tests/pytest/util/cluster.py index 21cad4c5bb2f5a5fc2b3a492e7298a4ff29115d8..efa83323a44f0c5c9bcde2efc022b9f5f14c5643 100644 --- a/tests/pytest/util/cluster.py +++ b/tests/pytest/util/cluster.py @@ -26,7 +26,7 @@ class ClusterDnodes(TDDnodes): class ConfigureyCluster: """This will create defined number of dnodes and create a cluster. at the same time, it will return TDDnodes list: dnodes, """ - hostname= socket.gethostname() + hostname = socket.gethostname() def __init__(self): self.dnodes = [] @@ -86,7 +86,13 @@ class ConfigureyCluster: time.sleep(1) else: tdLog.exit("create cluster with %d dnode but check dnode not ready within 5s ! "%self.dnodeNums) - + def checkConnectStatus(self,dnodeNo,hostname=hostname): + dnodeNo = int(dnodeNo) + tdLog.info("check dnode-%d connection"%(dnodeNo+1)) + hostname = socket.gethostname() + port = 6030 + dnodeNo*100 + connectToDnode = tdCom.newcon(host=hostname,port=port) + return connectToDnode cluster = ConfigureyCluster() \ No newline at end of file diff --git a/tests/pytest/util/common.py b/tests/pytest/util/common.py index e9db4a5da3bd740ea8936ab3a1a9dfe9ef9afd5e..6caf5624a415fe6bdb163b73ad6ddf28708ba0d4 100644 --- a/tests/pytest/util/common.py +++ b/tests/pytest/util/common.py @@ -379,6 +379,11 @@ class TDCom: tdLog.info("cfgPath: %s" % cfgPath) return cfgPath + def newcon(self,host='localhost',port=6030,user='root',password='taosdata'): + con=taos.connect(host=host, user=user, password=password, port=port) + print(con) + return con + def newcur(self,host='localhost',port=6030,user='root',password='taosdata'): cfgPath = self.getClientCfgPath() con=taos.connect(host=host, user=user, password=password, config=cfgPath, port=port) diff --git a/tests/script/api/batchprepare.c b/tests/script/api/batchprepare.c index 0e7030b230cc73ba2a79222ccdeda03ac02160f9..b31c39718ca9addbf4e8e2980d57665bb3d19156 100644 --- a/tests/script/api/batchprepare.c +++ b/tests/script/api/batchprepare.c @@ -915,7 +915,7 @@ int32_t prepareInsertData(BindData *data) { data->colNum = 0; data->colTypes = taosMemoryCalloc(30, sizeof(int32_t)); data->sql = taosMemoryCalloc(1, 1024); - data->pBind = taosMemoryCalloc((allRowNum/gCurCase->bindRowNum)*gCurCase->bindColNum, sizeof(TAOS_MULTI_BIND)); + data->pBind = taosMemoryCalloc((int32_t)(allRowNum/gCurCase->bindRowNum)*gCurCase->bindColNum, sizeof(TAOS_MULTI_BIND)); data->pTags = taosMemoryCalloc(gCurCase->tblNum*gCurCase->bindTagNum, sizeof(TAOS_MULTI_BIND)); data->tsData = taosMemoryMalloc(allRowNum * sizeof(int64_t)); data->boolData = taosMemoryMalloc(allRowNum * sizeof(bool)); @@ -932,7 +932,7 @@ int32_t prepareInsertData(BindData *data) { data->binaryData = taosMemoryMalloc(allRowNum * gVarCharSize); data->binaryLen = taosMemoryMalloc(allRowNum * sizeof(int32_t)); if (gCurCase->bindNullNum) { - data->isNull = taosMemoryCalloc(allRowNum, sizeof(char)); + data->isNull = taosMemoryCalloc((int32_t)allRowNum, sizeof(char)); } for (int32_t i = 0; i < allRowNum; ++i) { @@ -950,7 +950,7 @@ int32_t prepareInsertData(BindData *data) { data->doubleData[i] = (double)(i+1); memset(data->binaryData + gVarCharSize * i, 'a'+i%26, gVarCharLen); if (gCurCase->bindNullNum) { - data->isNull[i] = i % 2; + data->isNull[i] = (char)(i % 2); } data->binaryLen[i] = gVarCharLen; } @@ -979,7 +979,7 @@ int32_t prepareQueryCondData(BindData *data, int32_t tblIdx) { data->colNum = 0; data->colTypes = taosMemoryCalloc(30, sizeof(int32_t)); data->sql = taosMemoryCalloc(1, 1024); - data->pBind = taosMemoryCalloc(bindNum*gCurCase->bindColNum, sizeof(TAOS_MULTI_BIND)); + data->pBind = taosMemoryCalloc((int32_t)bindNum*gCurCase->bindColNum, sizeof(TAOS_MULTI_BIND)); data->tsData = taosMemoryMalloc(bindNum * sizeof(int64_t)); data->boolData = taosMemoryMalloc(bindNum * sizeof(bool)); data->tinyData = taosMemoryMalloc(bindNum * sizeof(int8_t)); @@ -995,7 +995,7 @@ int32_t prepareQueryCondData(BindData *data, int32_t tblIdx) { data->binaryData = taosMemoryMalloc(bindNum * gVarCharSize); data->binaryLen = taosMemoryMalloc(bindNum * sizeof(int32_t)); if (gCurCase->bindNullNum) { - data->isNull = taosMemoryCalloc(bindNum, sizeof(char)); + data->isNull = taosMemoryCalloc((int32_t)bindNum, sizeof(char)); } for (int32_t i = 0; i < bindNum; ++i) { @@ -1013,7 +1013,7 @@ int32_t prepareQueryCondData(BindData *data, int32_t tblIdx) { data->doubleData[i] = (double)(tblIdx*gCurCase->rowNum + rand() % gCurCase->rowNum); memset(data->binaryData + gVarCharSize * i, 'a'+i%26, gVarCharLen); if (gCurCase->bindNullNum) { - data->isNull[i] = i % 2; + data->isNull[i] = (char)(i % 2); } data->binaryLen[i] = gVarCharLen; } @@ -1036,7 +1036,7 @@ int32_t prepareQueryMiscData(BindData *data, int32_t tblIdx) { data->colNum = 0; data->colTypes = taosMemoryCalloc(30, sizeof(int32_t)); data->sql = taosMemoryCalloc(1, 1024); - data->pBind = taosMemoryCalloc(bindNum*gCurCase->bindColNum, sizeof(TAOS_MULTI_BIND)); + data->pBind = taosMemoryCalloc((int32_t)bindNum*gCurCase->bindColNum, sizeof(TAOS_MULTI_BIND)); data->tsData = taosMemoryMalloc(bindNum * sizeof(int64_t)); data->boolData = taosMemoryMalloc(bindNum * sizeof(bool)); data->tinyData = taosMemoryMalloc(bindNum * sizeof(int8_t)); @@ -1052,7 +1052,7 @@ int32_t prepareQueryMiscData(BindData *data, int32_t tblIdx) { data->binaryData = taosMemoryMalloc(bindNum * gVarCharSize); data->binaryLen = taosMemoryMalloc(bindNum * sizeof(int32_t)); if (gCurCase->bindNullNum) { - data->isNull = taosMemoryCalloc(bindNum, sizeof(char)); + data->isNull = taosMemoryCalloc((int32_t)bindNum, sizeof(char)); } for (int32_t i = 0; i < bindNum; ++i) { @@ -1070,7 +1070,7 @@ int32_t prepareQueryMiscData(BindData *data, int32_t tblIdx) { data->doubleData[i] = (double)(tblIdx*gCurCase->rowNum + rand() % gCurCase->rowNum); memset(data->binaryData + gVarCharSize * i, 'a'+i%26, gVarCharLen); if (gCurCase->bindNullNum) { - data->isNull[i] = i % 2; + data->isNull[i] = (char)(i % 2); } data->binaryLen[i] = gVarCharLen; } @@ -1279,7 +1279,7 @@ void bpCheckQueryResult(TAOS_STMT *stmt, TAOS *taos, char *stmtSql, TAOS_MULTI_B } memcpy(&sql[len], p, (int64_t)s - (int64_t)p); - len += (int64_t)s - (int64_t)p; + len += (int32_t)((int64_t)s - (int64_t)p); if (bind[i].is_null && bind[i].is_null[0]) { bpAppendValueString(sql, TSDB_DATA_TYPE_NULL, NULL, 0, &len); @@ -2669,7 +2669,7 @@ int main(int argc, char *argv[]) { TAOS *taos = NULL; - srand(time(NULL)); + srand((unsigned int)time(NULL)); // connect to server if (argc < 2) { diff --git a/tests/script/api/makefile b/tests/script/api/makefile index 46a172cc3af4bb05a209b47f54b1c9624328670d..1f725f17c95217fabbd2d40166a8af19e3df1a52 100644 --- a/tests/script/api/makefile +++ b/tests/script/api/makefile @@ -12,6 +12,7 @@ all: $(TARGET) exe: gcc $(CFLAGS) ./batchprepare.c -o $(ROOT)batchprepare $(LFLAGS) + gcc $(CFLAGS) ./stopquery.c -o $(ROOT)stopquery $(LFLAGS) clean: rm $(ROOT)batchprepare diff --git a/tests/script/api/stopquery.c b/tests/script/api/stopquery.c new file mode 100644 index 0000000000000000000000000000000000000000..4c7964c98350f1d24bb6c76ffdb5aef5746e1933 --- /dev/null +++ b/tests/script/api/stopquery.c @@ -0,0 +1,434 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +// TAOS asynchronous API example +// this example opens multiple tables, insert/retrieve multiple tables +// it is used by TAOS internally for one performance testing +// to compiple: gcc -o asyncdemo asyncdemo.c -ltaos + +#include +#include +#include +#include +#include +#include +#include "taos.h" + + +int points = 5; +int numOfTables = 3; +int tablesInsertProcessed = 0; +int tablesSelectProcessed = 0; +int64_t st, et; + +char hostName[128]; +char dbName[128]; +char tbName[128]; +int32_t runTimes = 10000; + +typedef struct { + int id; + TAOS *taos; + char name[16]; + time_t timeStamp; + int value; + int rowsInserted; + int rowsTried; + int rowsRetrieved; +} STable; + +typedef struct SSP_CB_PARAM { + TAOS *taos; + bool fetch; + int32_t *end; +} SSP_CB_PARAM; + +#define CASE_ENTER() do { printf("enter case %s\n", __FUNCTION__); } while (0) +#define CASE_LEAVE() do { printf("leave case %s, runTimes %d\n", __FUNCTION__, runTimes); } while (0) + +static void sqExecSQL(TAOS *taos, char *command) { + int i; + int32_t code = -1; + + TAOS_RES *pSql = taos_query(taos, command); + code = taos_errno(pSql); + if (code != 0) { + fprintf(stderr, "Failed to run %s, reason: %s\n", command, taos_errstr(pSql)); + taos_free_result(pSql); + taos_close(taos); + taos_cleanup(); + exit(EXIT_FAILURE); + } + + taos_free_result(pSql); +} + +static void sqExecSQLE(TAOS *taos, char *command) { + int i; + int32_t code = -1; + + TAOS_RES *pSql = taos_query(taos, command); + + taos_free_result(pSql); +} + + +void sqExit(char* prefix, const char* errMsg) { + fprintf(stderr, "%s error: %s\n", prefix, errMsg); + exit(1); +} + +void sqStopFetchCb(void *param, TAOS_RES *pRes, int numOfRows) { + SSP_CB_PARAM *qParam = (SSP_CB_PARAM *)param; + taos_stop_query(pRes); + taos_free_result(pRes); + + *qParam->end = 1; +} + +void sqStopQueryCb(void *param, TAOS_RES *pRes, int code) { + SSP_CB_PARAM *qParam = (SSP_CB_PARAM *)param; + if (code == 0 && pRes) { + if (qParam->fetch) { + taos_fetch_rows_a(pRes, sqStopFetchCb, param); + } else { + taos_stop_query(pRes); + taos_free_result(pRes); + *qParam->end = 1; + } + } else { + sqExit("select", taos_errstr(pRes)); + } +} + +void sqFreeFetchCb(void *param, TAOS_RES *pRes, int numOfRows) { + SSP_CB_PARAM *qParam = (SSP_CB_PARAM *)param; + taos_free_result(pRes); + + *qParam->end = 1; +} + +void sqFreeQueryCb(void *param, TAOS_RES *pRes, int code) { + SSP_CB_PARAM *qParam = (SSP_CB_PARAM *)param; + if (code == 0 && pRes) { + if (qParam->fetch) { + taos_fetch_rows_a(pRes, sqFreeFetchCb, param); + } else { + taos_free_result(pRes); + *qParam->end = 1; + } + } else { + sqExit("select", taos_errstr(pRes)); + } +} + + +void sqCloseFetchCb(void *param, TAOS_RES *pRes, int numOfRows) { + SSP_CB_PARAM *qParam = (SSP_CB_PARAM *)param; + taos_close(qParam->taos); + + *qParam->end = 1; +} + +void sqCloseQueryCb(void *param, TAOS_RES *pRes, int code) { + SSP_CB_PARAM *qParam = (SSP_CB_PARAM *)param; + if (code == 0 && pRes) { + if (qParam->fetch) { + taos_fetch_rows_a(pRes, sqFreeFetchCb, param); + } else { + taos_close(qParam->taos); + *qParam->end = 1; + } + } else { + sqExit("select", taos_errstr(pRes)); + } +} + +int sqSyncStopQuery(bool fetch) { + CASE_ENTER(); + for (int32_t i = 0; i < runTimes; ++i) { + char sql[1024] = {0}; + int32_t code = 0; + TAOS *taos = taos_connect(hostName, "root", "taosdata", NULL, 0); + if (taos == NULL) sqExit("taos_connect", taos_errstr(NULL)); + + sprintf(sql, "reset query cache"); + sqExecSQL(taos, sql); + + sprintf(sql, "use %s", dbName); + sqExecSQL(taos, sql); + + sprintf(sql, "select * from %s", tbName); + TAOS_RES* pRes = taos_query(taos, sql); + code = taos_errno(pRes); + if (code) { + sqExit("taos_query", taos_errstr(pRes)); + } + + if (fetch) { + taos_fetch_row(pRes); + } + + taos_stop_query(pRes); + taos_free_result(pRes); + + taos_close(taos); + } + CASE_LEAVE(); +} + +int sqAsyncStopQuery(bool fetch) { + CASE_ENTER(); + for (int32_t i = 0; i < runTimes; ++i) { + char sql[1024] = {0}; + int32_t code = 0; + TAOS *taos = taos_connect(hostName, "root", "taosdata", NULL, 0); + if (taos == NULL) sqExit("taos_connect", taos_errstr(NULL)); + + sprintf(sql, "reset query cache"); + sqExecSQL(taos, sql); + + sprintf(sql, "use %s", dbName); + sqExecSQL(taos, sql); + + sprintf(sql, "select * from %s", tbName); + + int32_t qEnd = 0; + SSP_CB_PARAM param = {0}; + param.fetch = fetch; + param.end = &qEnd; + taos_query_a(taos, sql, sqStopQueryCb, ¶m); + while (0 == qEnd) { + usleep(5000); + } + + taos_close(taos); + } + CASE_LEAVE(); +} + +int sqSyncFreeQuery(bool fetch) { + CASE_ENTER(); + for (int32_t i = 0; i < runTimes; ++i) { + char sql[1024] = {0}; + int32_t code = 0; + TAOS *taos = taos_connect(hostName, "root", "taosdata", NULL, 0); + if (taos == NULL) sqExit("taos_connect", taos_errstr(NULL)); + + sprintf(sql, "reset query cache"); + sqExecSQL(taos, sql); + + sprintf(sql, "use %s", dbName); + sqExecSQL(taos, sql); + + sprintf(sql, "select * from %s", tbName); + TAOS_RES* pRes = taos_query(taos, sql); + code = taos_errno(pRes); + if (code) { + sqExit("taos_query", taos_errstr(pRes)); + } + + if (fetch) { + taos_fetch_row(pRes); + } + + taos_free_result(pRes); + taos_close(taos); + } + CASE_LEAVE(); +} + +int sqAsyncFreeQuery(bool fetch) { + CASE_ENTER(); + for (int32_t i = 0; i < runTimes; ++i) { + char sql[1024] = {0}; + int32_t code = 0; + TAOS *taos = taos_connect(hostName, "root", "taosdata", NULL, 0); + if (taos == NULL) sqExit("taos_connect", taos_errstr(NULL)); + + sprintf(sql, "reset query cache"); + sqExecSQL(taos, sql); + + sprintf(sql, "use %s", dbName); + sqExecSQL(taos, sql); + + sprintf(sql, "select * from %s", tbName); + + int32_t qEnd = 0; + SSP_CB_PARAM param = {0}; + param.fetch = fetch; + param.end = &qEnd; + taos_query_a(taos, sql, sqFreeQueryCb, ¶m); + while (0 == qEnd) { + usleep(5000); + } + + taos_close(taos); + } + CASE_LEAVE(); +} + +int sqSyncCloseQuery(bool fetch) { + CASE_ENTER(); + for (int32_t i = 0; i < runTimes; ++i) { + char sql[1024] = {0}; + int32_t code = 0; + TAOS *taos = taos_connect(hostName, "root", "taosdata", NULL, 0); + if (taos == NULL) sqExit("taos_connect", taos_errstr(NULL)); + + sprintf(sql, "reset query cache"); + sqExecSQL(taos, sql); + + sprintf(sql, "use %s", dbName); + sqExecSQL(taos, sql); + + sprintf(sql, "select * from %s", tbName); + TAOS_RES* pRes = taos_query(taos, sql); + code = taos_errno(pRes); + if (code) { + sqExit("taos_query", taos_errstr(pRes)); + } + + if (fetch) { + taos_fetch_row(pRes); + } + + taos_close(taos); + } + CASE_LEAVE(); +} + +int sqAsyncCloseQuery(bool fetch) { + CASE_ENTER(); + for (int32_t i = 0; i < runTimes; ++i) { + char sql[1024] = {0}; + int32_t code = 0; + TAOS *taos = taos_connect(hostName, "root", "taosdata", NULL, 0); + if (taos == NULL) sqExit("taos_connect", taos_errstr(NULL)); + + sprintf(sql, "reset query cache"); + sqExecSQL(taos, sql); + + sprintf(sql, "use %s", dbName); + sqExecSQL(taos, sql); + + sprintf(sql, "select * from %s", tbName); + + int32_t qEnd = 0; + SSP_CB_PARAM param = {0}; + param.fetch = fetch; + param.end = &qEnd; + taos_query_a(taos, sql, sqFreeQueryCb, ¶m); + while (0 == qEnd) { + usleep(5000); + } + } + CASE_LEAVE(); +} + +void *syncQueryThreadFp(void *arg) { + SSP_CB_PARAM* qParam = (SSP_CB_PARAM*)arg; + char sql[1024] = {0}; + int32_t code = 0; + TAOS *taos = taos_connect(hostName, "root", "taosdata", NULL, 0); + if (taos == NULL) sqExit("taos_connect", taos_errstr(NULL)); + + qParam->taos = taos; + + sprintf(sql, "reset query cache"); + sqExecSQLE(taos, sql); + + sprintf(sql, "use %s", dbName); + sqExecSQLE(taos, sql); + + sprintf(sql, "select * from %s", tbName); + TAOS_RES* pRes = taos_query(taos, sql); + + if (qParam->fetch) { + taos_fetch_row(pRes); + } + + taos_free_result(pRes); +} + +void *closeThreadFp(void *arg) { + SSP_CB_PARAM* qParam = (SSP_CB_PARAM*)arg; + while (true) { + if (qParam->taos) { + usleep(rand() % 10000); + taos_close(qParam->taos); + break; + } + usleep(1); + } +} + + +int sqConSyncCloseQuery(bool fetch) { + CASE_ENTER(); + pthread_t qid, cid; + for (int32_t i = 0; i < runTimes; ++i) { + SSP_CB_PARAM param = {0}; + param.fetch = fetch; + pthread_create(&qid, NULL, syncQueryThreadFp, (void*)¶m); + pthread_create(&cid, NULL, closeThreadFp, (void*)¶m); + + pthread_join(qid, NULL); + pthread_join(cid, NULL); + } + CASE_LEAVE(); +} + +void sqRunAllCase(void) { +/* + sqSyncStopQuery(false); + sqSyncStopQuery(true); + sqAsyncStopQuery(false); + sqAsyncStopQuery(true); + + sqSyncFreeQuery(false); + sqSyncFreeQuery(true); + sqAsyncFreeQuery(false); + sqAsyncFreeQuery(true); + + sqSyncCloseQuery(false); + sqSyncCloseQuery(true); + sqAsyncCloseQuery(false); + sqAsyncCloseQuery(true); +*/ + sqConSyncCloseQuery(false); + sqConSyncCloseQuery(true); + +} + + +int main(int argc, char *argv[]) { + if (argc != 4) { + printf("usage: %s server-ip dbname tablename\n", argv[0]); + exit(0); + } + + srand((unsigned int)time(NULL)); + + strcpy(hostName, argv[1]); + strcpy(dbName, argv[2]); + strcpy(tbName, argv[3]); + + sqRunAllCase(); + + return 0; +} + + diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index ab5117ced81396934a1614b06ac3d972dc292bf3..cc114ac55f09730fc33fe1a762ab8ddca36d55f6 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -8,21 +8,35 @@ ./test.sh -f tsim/user/privilege_sysinfo.sim ## ---- db -./test.sh -f tsim/db/create_all_options.sim ./test.sh -f tsim/db/alter_option.sim ./test.sh -f tsim/db/alter_replica_13.sim -#./test.sh -f tsim/db/alter_replica_31.sim +./test.sh -f tsim/db/alter_replica_31.sim ./test.sh -f tsim/db/basic1.sim ./test.sh -f tsim/db/basic2.sim ./test.sh -f tsim/db/basic3.sim ./test.sh -f tsim/db/basic6.sim ./test.sh -f tsim/db/basic7.sim +#./test.sh -f tsim/db/commit.sim +./test.sh -f tsim/db/create_all_options.sim +#./test.sh -f tsim/db/delete_part.sim +#./test.sh -f tsim/db/delete.sim ./test.sh -f tsim/db/error1.sim ./test.sh -f tsim/db/taosdlog.sim # ---- dnode ./test.sh -f tsim/dnode/balance_replica1.sim -#./test.sh -f tsim/dnode/balance_replica3.sim +./test.sh -f tsim/dnode/balance_replica3.sim +./test.sh -f tsim/dnode/balance1.sim +./test.sh -f tsim/dnode/balance2.sim +./test.sh -f tsim/dnode/balance3.sim +./test.sh -f tsim/dnode/balancex.sim +#./test.sh -f tsim/dnode/cluster_alter.sim +#./test.sh -f tsim/dnode/cluster_balance1.sim +#./test.sh -f tsim/dnode/cluster_balance2.sim +#./test.sh -f tsim/dnode/cluster_balance3.sim +#./test.sh -f tsim/dnode/cluster_cache.sim +#./test.sh -f tsim/dnode/cluster_flowctrl.sim +#./test.sh -f tsim/dnode/cluster_vgroup100.sim ./test.sh -f tsim/dnode/create_dnode.sim ./test.sh -f tsim/dnode/drop_dnode_has_mnode.sim ./test.sh -f tsim/dnode/drop_dnode_has_qnode_snode.sim @@ -30,11 +44,13 @@ ./test.sh -f tsim/dnode/drop_dnode_has_vnode_replica3.sim ./test.sh -f tsim/dnode/drop_dnode_has_multi_vnode_replica1.sim ./test.sh -f tsim/dnode/drop_dnode_has_multi_vnode_replica3.sim +./test.sh -f tsim/dnode/offline_reason.sim ./test.sh -f tsim/dnode/redistribute_vgroup_replica1.sim ./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim ./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim ./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v2.sim ./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v3.sim +./test.sh -f tsim/dnode/vnode_clean.sim # ---- insert ./test.sh -f tsim/insert/basic0.sim @@ -72,7 +88,7 @@ ./test.sh -f tsim/mnode/basic2.sim ./test.sh -f tsim/mnode/basic3.sim ./test.sh -f tsim/mnode/basic4.sim -#./test.sh -f tsim/mnode/basic5.sim +./test.sh -f tsim/mnode/basic5.sim # ---- show ./test.sh -f tsim/show/basic.sim @@ -97,7 +113,6 @@ ./test.sh -f tsim/stream/schedSnode.sim ./test.sh -f tsim/stream/windowClose.sim - # ---- transaction ./test.sh -f tsim/trans/lossdata1.sim ./test.sh -f tsim/trans/create_db.sim @@ -156,6 +171,19 @@ # --- valgrind ./test.sh -f tsim/valgrind/checkError.sim -v +# --- vnode +#./test.sh -f tsim/vnode/replica3_basic.sim +#./test.sh -f tsim/vnode/replica3_repeat.sim +./test.sh -f tsim/vnode/replica3_vgroup.sim +#./test.sh -f tsim/vnode/replica3_many.sim +#./test.sh -f tsim/vnode/replica3_import.sim +./test.sh -f tsim/vnode/stable_balance_replica1.sim +./test.sh -f tsim/vnode/stable_dnode2_stop.sim +./test.sh -f tsim/vnode/stable_dnode2.sim +./test.sh -f tsim/vnode/stable_dnode3.sim +./test.sh -f tsim/vnode/stable_replica3_dnode6.sim +./test.sh -f tsim/vnode/stable_replica3_vnode3.sim + # --- sync ./test.sh -f tsim/sync/3Replica1VgElect.sim ./test.sh -f tsim/sync/3Replica5VgElect.sim diff --git a/tests/script/sh/exec.bat b/tests/script/sh/exec.bat index 0f3d0dcf49ddfd38f73ddc3c994944bb37e5b8e3..e4c998c25b1f0d38f02c793b4b01755cd113b362 100644 --- a/tests/script/sh/exec.bat +++ b/tests/script/sh/exec.bat @@ -6,6 +6,7 @@ if %1 == -n set NODE_NAME=%2 if %1 == -s set EXEC_OPTON=%2 if %3 == -n set NODE_NAME=%4 if %3 == -s set EXEC_OPTON=%4 +if "%5" == "-x" set EXEC_SIGNAL=%6 rem echo NODE_NAME: %NODE_NAME% rem echo NODE: %EXEC_OPTON% @@ -39,7 +40,7 @@ rem echo TAOS_LOG: %TAOS_LOG% if %EXEC_OPTON% == start ( rm -rf %TAOS_LOG% echo start %TAOSD% -c %CFG_DIR% - start %TAOSD% -c %CFG_DIR% + mintty -h never %TAOSD% -c %CFG_DIR% set /a check_num=0 :check_online sleep 1 @@ -58,13 +59,25 @@ if %EXEC_OPTON% == stop ( rem echo wmic process where "name='taosd.exe' and CommandLine like '%%%NODE_NAME%%%'" list INSTANCE rem wmic process where "name='taosd.exe' and CommandLine like '%%%NODE_NAME%%%'" call terminate > NUL 2>&1 - for /f "tokens=1 skip=1" %%A in ( - 'wmic process where "name='taosd.exe' and CommandLine like '%%%NODE_NAME%%%'" get processId ' - ) do ( - rem echo taskkill /IM %%A - taskkill /IM %%A > NUL 2>&1 + for /f "tokens=2" %%A in ('wmic process where "name='taosd.exe' and CommandLine like '%%%NODE_NAME%%%'" get processId ^| xargs echo') do ( + for /f "tokens=1" %%B in ('ps ^| grep %%A') do ( + if "%EXEC_SIGNAL%" == "SIGKILL" ( + kill -9 %%B + ) else ( + kill -INT %%B + call :check_offline + ) + ) goto :finish ) ) +:finish +goto :eof -:finish \ No newline at end of file +:check_offline +sleep 1 +for /f "tokens=2" %%C in ('wmic process where "name='taosd.exe' and CommandLine like '%%%NODE_NAME%%%'" get processId ^| xargs echo') do ( + echo check taosd offline + goto :check_offline +) +goto :eof \ No newline at end of file diff --git a/tests/script/sh/move_dnode.sh b/tests/script/sh/move_dnode.sh deleted file mode 100755 index d3650c18ad0f49185ce1e1268273b8a44e3cdc14..0000000000000000000000000000000000000000 --- a/tests/script/sh/move_dnode.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash - -echo "Executing move_dnode.sh" - -UNAME_BIN=`which uname` -OS_TYPE=`$UNAME_BIN` - -SCRIPT_DIR=`dirname $0` -cd $SCRIPT_DIR/../ -SCRIPT_DIR=`pwd` -echo "SCRIPT_DIR: $SCRIPT_DIR" - -IN_TDINTERNAL="community" -if [[ "$SCRIPT_DIR" == *"$IN_TDINTERNAL"* ]]; then - cd ../../.. -else - cd ../../ -fi - -TAOS_DIR=`pwd` -TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1` - -if [[ "$OS_TYPE" != "Darwin" ]]; then - cut_opt="--field=" -else - cut_opt="-f " -fi - -if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then - BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3` -else - BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2` -fi - -BUILD_DIR=$TAOS_DIR/$BIN_DIR/build - -SIM_DIR=$TAOS_DIR/sim - -NODE_DIR=$SIM_DIR/$NODE_NAME - -if [ -d "$SIM_DIR/$2" ];then - rm -rf $SIM_DIR/$2 -fi -mv $SIM_DIR/$1 $SIM_DIR/$2 - -if [[ $2 =~ "dnode2" ]];then - sed -i 's/serverPort 7100/serverPort 7200/g' $SIM_DIR/$2/cfg/taos.cfg - sed -i 's/dnode1/dnode2/g' $SIM_DIR/$2/cfg/taos.cfg - sed -i 's/7100/7200/g' $SIM_DIR/$2/data/dnode/dnodeEps.json -elif [[ $2 =~ "dnode4" ]];then - sed -i 's/serverPort 7100/serverPort 7400/g' $SIM_DIR/$2/cfg/taos.cfg - sed -i 's/dnode1/dnode4/g' $SIM_DIR/$2/cfg/taos.cfg - sed -i 's/7100/7400/g' $SIM_DIR/dnode2/data/dnode/dnodeEps.json - sed -i 's/7100/7400/g' $SIM_DIR/dnode3/data/dnode/dnodeEps.json - sed -i 's/7100/7400/g' $SIM_DIR/$2/data/dnode/dnodeEps.json -fi diff --git a/tests/script/test-all.bat b/tests/script/test-all.bat index 1c698449c6614094cbdab86af873412c08f31f64..f771f8fcb6541720bd6b9ee68f297a8d443cde93 100644 --- a/tests/script/test-all.bat +++ b/tests/script/test-all.bat @@ -62,7 +62,5 @@ goto :eof :CheckSkipCase set skipCase=false -if "%*" == "./test.sh -f tsim/query/scalarFunction.sim" ( set skipCase=true ) -if "%*" == "./test.sh -f tsim/stream/distributeInterval0.sim" ( set skipCase=true ) -if "%*" == "./test.sh -f tsim/sma/rsmaCreateInsertQuery.sim" ( set skipCase=true ) +@REM if "%*" == "./test.sh -f tsim/query/scalarFunction.sim" ( set skipCase=true ) :goto eof \ No newline at end of file diff --git a/tests/script/unique/arbitrator/check_cluster_cfg_para.sim b/tests/script/tsim/backup/arbitrator/check_cluster_cfg_para.sim similarity index 100% rename from tests/script/unique/arbitrator/check_cluster_cfg_para.sim rename to tests/script/tsim/backup/arbitrator/check_cluster_cfg_para.sim diff --git a/tests/script/unique/arbitrator/dn2_mn1_cache_file_sync.sim b/tests/script/tsim/backup/arbitrator/dn2_mn1_cache_file_sync.sim similarity index 100% rename from tests/script/unique/arbitrator/dn2_mn1_cache_file_sync.sim rename to tests/script/tsim/backup/arbitrator/dn2_mn1_cache_file_sync.sim diff --git a/tests/script/unique/arbitrator/dn2_mn1_cache_file_sync_second.sim b/tests/script/tsim/backup/arbitrator/dn2_mn1_cache_file_sync_second.sim similarity index 100% rename from tests/script/unique/arbitrator/dn2_mn1_cache_file_sync_second.sim rename to tests/script/tsim/backup/arbitrator/dn2_mn1_cache_file_sync_second.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_full_createTableFail.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_full_createTableFail.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_full_createTableFail.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_full_createTableFail.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_full_dropDnodeFail.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_full_dropDnodeFail.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_full_dropDnodeFail.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_full_dropDnodeFail.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_multiCreateDropTable.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_multiCreateDropTable.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_multiCreateDropTable.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_multiCreateDropTable.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_r2_vnode_delDir.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_r2_vnode_delDir.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_r2_vnode_delDir.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_r2_vnode_delDir.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_r3_vnode_delDir.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_r3_vnode_delDir.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_r3_vnode_delDir.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_r3_vnode_delDir.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_replica_change.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_replica_change.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_replica_change.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_replica_change.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_replica_change_dropDnod.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_replica_change_dropDnod.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_replica_change_dropDnod.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_replica_change_dropDnod.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_stopDnode_timeout.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_stopDnode_timeout.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_stopDnode_timeout.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_stopDnode_timeout.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_change.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_change.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_vnode_change.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_change.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_corruptFile_online.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_corruptFile_online.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_createErrData_online.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_createErrData_online.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_vnode_createErrData_online.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_createErrData_online.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_delDir.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_delDir.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_vnode_delDir.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_delDir.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_nomaster.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_nomaster.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_vnode_nomaster.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_nomaster.sim diff --git a/tests/script/unique/arbitrator/dn3_mn2_killDnode.sim b/tests/script/tsim/backup/arbitrator/dn3_mn2_killDnode.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn2_killDnode.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn2_killDnode.sim diff --git a/tests/script/unique/arbitrator/insert_duplicationTs.sim b/tests/script/tsim/backup/arbitrator/insert_duplicationTs.sim similarity index 100% rename from tests/script/unique/arbitrator/insert_duplicationTs.sim rename to tests/script/tsim/backup/arbitrator/insert_duplicationTs.sim diff --git a/tests/script/unique/arbitrator/offline_replica2_alterTable_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica2_alterTable_online.sim similarity index 100% rename from tests/script/unique/arbitrator/offline_replica2_alterTable_online.sim rename to tests/script/tsim/backup/arbitrator/offline_replica2_alterTable_online.sim diff --git a/tests/script/unique/arbitrator/offline_replica2_alterTag_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica2_alterTag_online.sim similarity index 100% rename from tests/script/unique/arbitrator/offline_replica2_alterTag_online.sim rename to tests/script/tsim/backup/arbitrator/offline_replica2_alterTag_online.sim diff --git a/tests/script/unique/arbitrator/offline_replica2_createTable_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica2_createTable_online.sim similarity index 100% rename from tests/script/unique/arbitrator/offline_replica2_createTable_online.sim rename to tests/script/tsim/backup/arbitrator/offline_replica2_createTable_online.sim diff --git a/tests/script/unique/arbitrator/offline_replica2_dropDb_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica2_dropDb_online.sim similarity index 100% rename from tests/script/unique/arbitrator/offline_replica2_dropDb_online.sim rename to tests/script/tsim/backup/arbitrator/offline_replica2_dropDb_online.sim diff --git a/tests/script/unique/arbitrator/offline_replica2_dropTable_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica2_dropTable_online.sim similarity index 100% rename from tests/script/unique/arbitrator/offline_replica2_dropTable_online.sim rename to tests/script/tsim/backup/arbitrator/offline_replica2_dropTable_online.sim diff --git a/tests/script/unique/arbitrator/offline_replica3_alterTable_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica3_alterTable_online.sim similarity index 100% rename from tests/script/unique/arbitrator/offline_replica3_alterTable_online.sim rename to tests/script/tsim/backup/arbitrator/offline_replica3_alterTable_online.sim diff --git a/tests/script/unique/arbitrator/offline_replica3_alterTag_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica3_alterTag_online.sim similarity index 100% rename from tests/script/unique/arbitrator/offline_replica3_alterTag_online.sim rename to tests/script/tsim/backup/arbitrator/offline_replica3_alterTag_online.sim diff --git a/tests/script/unique/arbitrator/offline_replica3_createTable_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica3_createTable_online.sim similarity index 100% rename from tests/script/unique/arbitrator/offline_replica3_createTable_online.sim rename to tests/script/tsim/backup/arbitrator/offline_replica3_createTable_online.sim diff --git a/tests/script/unique/arbitrator/offline_replica3_dropDb_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica3_dropDb_online.sim similarity index 100% rename from tests/script/unique/arbitrator/offline_replica3_dropDb_online.sim rename to tests/script/tsim/backup/arbitrator/offline_replica3_dropDb_online.sim diff --git a/tests/script/unique/arbitrator/offline_replica3_dropTable_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica3_dropTable_online.sim similarity index 100% rename from tests/script/unique/arbitrator/offline_replica3_dropTable_online.sim rename to tests/script/tsim/backup/arbitrator/offline_replica3_dropTable_online.sim diff --git a/tests/script/unique/arbitrator/replica_changeWithArbitrator.sim b/tests/script/tsim/backup/arbitrator/replica_changeWithArbitrator.sim similarity index 100% rename from tests/script/unique/arbitrator/replica_changeWithArbitrator.sim rename to tests/script/tsim/backup/arbitrator/replica_changeWithArbitrator.sim diff --git a/tests/script/unique/arbitrator/sync_replica2_alterTable_add.sim b/tests/script/tsim/backup/arbitrator/sync_replica2_alterTable_add.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica2_alterTable_add.sim rename to tests/script/tsim/backup/arbitrator/sync_replica2_alterTable_add.sim diff --git a/tests/script/unique/arbitrator/sync_replica2_alterTable_drop.sim b/tests/script/tsim/backup/arbitrator/sync_replica2_alterTable_drop.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica2_alterTable_drop.sim rename to tests/script/tsim/backup/arbitrator/sync_replica2_alterTable_drop.sim diff --git a/tests/script/unique/arbitrator/sync_replica2_dropDb.sim b/tests/script/tsim/backup/arbitrator/sync_replica2_dropDb.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica2_dropDb.sim rename to tests/script/tsim/backup/arbitrator/sync_replica2_dropDb.sim diff --git a/tests/script/unique/arbitrator/sync_replica2_dropTable.sim b/tests/script/tsim/backup/arbitrator/sync_replica2_dropTable.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica2_dropTable.sim rename to tests/script/tsim/backup/arbitrator/sync_replica2_dropTable.sim diff --git a/tests/script/unique/arbitrator/sync_replica3_alterTable_add.sim b/tests/script/tsim/backup/arbitrator/sync_replica3_alterTable_add.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica3_alterTable_add.sim rename to tests/script/tsim/backup/arbitrator/sync_replica3_alterTable_add.sim diff --git a/tests/script/unique/arbitrator/sync_replica3_alterTable_drop.sim b/tests/script/tsim/backup/arbitrator/sync_replica3_alterTable_drop.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica3_alterTable_drop.sim rename to tests/script/tsim/backup/arbitrator/sync_replica3_alterTable_drop.sim diff --git a/tests/script/unique/arbitrator/sync_replica3_createTable.sim b/tests/script/tsim/backup/arbitrator/sync_replica3_createTable.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica3_createTable.sim rename to tests/script/tsim/backup/arbitrator/sync_replica3_createTable.sim diff --git a/tests/script/unique/arbitrator/sync_replica3_dnodeChang_DropAddAlterTableDropDb.sim b/tests/script/tsim/backup/arbitrator/sync_replica3_dnodeChang_DropAddAlterTableDropDb.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica3_dnodeChang_DropAddAlterTableDropDb.sim rename to tests/script/tsim/backup/arbitrator/sync_replica3_dnodeChang_DropAddAlterTableDropDb.sim diff --git a/tests/script/unique/arbitrator/sync_replica3_dropDb.sim b/tests/script/tsim/backup/arbitrator/sync_replica3_dropDb.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica3_dropDb.sim rename to tests/script/tsim/backup/arbitrator/sync_replica3_dropDb.sim diff --git a/tests/script/unique/arbitrator/sync_replica3_dropTable.sim b/tests/script/tsim/backup/arbitrator/sync_replica3_dropTable.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica3_dropTable.sim rename to tests/script/tsim/backup/arbitrator/sync_replica3_dropTable.sim diff --git a/tests/script/unique/arbitrator/sync_replica_alterTable_background_add.sim b/tests/script/tsim/backup/arbitrator/sync_replica_alterTable_background_add.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica_alterTable_background_add.sim rename to tests/script/tsim/backup/arbitrator/sync_replica_alterTable_background_add.sim diff --git a/tests/script/unique/arbitrator/sync_replica_alterTable_background_drop.sim b/tests/script/tsim/backup/arbitrator/sync_replica_alterTable_background_drop.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica_alterTable_background_drop.sim rename to tests/script/tsim/backup/arbitrator/sync_replica_alterTable_background_drop.sim diff --git a/tests/script/unique/arbitrator/sync_replica_createTable_background_add.sim b/tests/script/tsim/backup/arbitrator/sync_replica_createTable_background_add.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica_createTable_background_add.sim rename to tests/script/tsim/backup/arbitrator/sync_replica_createTable_background_add.sim diff --git a/tests/script/unique/arbitrator/sync_replica_dropDb_background.sim b/tests/script/tsim/backup/arbitrator/sync_replica_dropDb_background.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica_dropDb_background.sim rename to tests/script/tsim/backup/arbitrator/sync_replica_dropDb_background.sim diff --git a/tests/script/unique/arbitrator/sync_replica_dropTable_background.sim b/tests/script/tsim/backup/arbitrator/sync_replica_dropTable_background.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica_dropTable_background.sim rename to tests/script/tsim/backup/arbitrator/sync_replica_dropTable_background.sim diff --git a/tests/script/unique/cluster/client1_0.sim b/tests/script/tsim/backup/cluster/client1_0.sim similarity index 100% rename from tests/script/unique/cluster/client1_0.sim rename to tests/script/tsim/backup/cluster/client1_0.sim diff --git a/tests/script/unique/cluster/client1_1.sim b/tests/script/tsim/backup/cluster/client1_1.sim similarity index 100% rename from tests/script/unique/cluster/client1_1.sim rename to tests/script/tsim/backup/cluster/client1_1.sim diff --git a/tests/script/unique/cluster/client1_2.sim b/tests/script/tsim/backup/cluster/client1_2.sim similarity index 100% rename from tests/script/unique/cluster/client1_2.sim rename to tests/script/tsim/backup/cluster/client1_2.sim diff --git a/tests/script/unique/cluster/client1_3.sim b/tests/script/tsim/backup/cluster/client1_3.sim similarity index 100% rename from tests/script/unique/cluster/client1_3.sim rename to tests/script/tsim/backup/cluster/client1_3.sim diff --git a/tests/script/unique/cluster/client2_0.sim b/tests/script/tsim/backup/cluster/client2_0.sim similarity index 100% rename from tests/script/unique/cluster/client2_0.sim rename to tests/script/tsim/backup/cluster/client2_0.sim diff --git a/tests/script/unique/cluster/client2_1.sim b/tests/script/tsim/backup/cluster/client2_1.sim similarity index 100% rename from tests/script/unique/cluster/client2_1.sim rename to tests/script/tsim/backup/cluster/client2_1.sim diff --git a/tests/script/unique/cluster/client2_2.sim b/tests/script/tsim/backup/cluster/client2_2.sim similarity index 100% rename from tests/script/unique/cluster/client2_2.sim rename to tests/script/tsim/backup/cluster/client2_2.sim diff --git a/tests/script/unique/cluster/client2_3.sim b/tests/script/tsim/backup/cluster/client2_3.sim similarity index 100% rename from tests/script/unique/cluster/client2_3.sim rename to tests/script/tsim/backup/cluster/client2_3.sim diff --git a/tests/script/unique/cluster/client3.sim b/tests/script/tsim/backup/cluster/client3.sim similarity index 100% rename from tests/script/unique/cluster/client3.sim rename to tests/script/tsim/backup/cluster/client3.sim diff --git a/tests/script/unique/cluster/client4.sim b/tests/script/tsim/backup/cluster/client4.sim similarity index 100% rename from tests/script/unique/cluster/client4.sim rename to tests/script/tsim/backup/cluster/client4.sim diff --git a/tests/script/unique/cluster/client5.sim b/tests/script/tsim/backup/cluster/client5.sim similarity index 100% rename from tests/script/unique/cluster/client5.sim rename to tests/script/tsim/backup/cluster/client5.sim diff --git a/tests/script/unique/cluster/cluster_main.sim b/tests/script/tsim/backup/cluster/cluster_main.sim similarity index 100% rename from tests/script/unique/cluster/cluster_main.sim rename to tests/script/tsim/backup/cluster/cluster_main.sim diff --git a/tests/script/unique/cluster/cluster_main0.sim b/tests/script/tsim/backup/cluster/cluster_main0.sim similarity index 100% rename from tests/script/unique/cluster/cluster_main0.sim rename to tests/script/tsim/backup/cluster/cluster_main0.sim diff --git a/tests/script/unique/cluster/cluster_main1.sim b/tests/script/tsim/backup/cluster/cluster_main1.sim similarity index 100% rename from tests/script/unique/cluster/cluster_main1.sim rename to tests/script/tsim/backup/cluster/cluster_main1.sim diff --git a/tests/script/unique/cluster/cluster_main2.sim b/tests/script/tsim/backup/cluster/cluster_main2.sim similarity index 100% rename from tests/script/unique/cluster/cluster_main2.sim rename to tests/script/tsim/backup/cluster/cluster_main2.sim diff --git a/tests/script/unique/cluster/main1_client1_0.sim b/tests/script/tsim/backup/cluster/main1_client1_0.sim similarity index 100% rename from tests/script/unique/cluster/main1_client1_0.sim rename to tests/script/tsim/backup/cluster/main1_client1_0.sim diff --git a/tests/script/unique/cluster/main1_client1_1.sim b/tests/script/tsim/backup/cluster/main1_client1_1.sim similarity index 100% rename from tests/script/unique/cluster/main1_client1_1.sim rename to tests/script/tsim/backup/cluster/main1_client1_1.sim diff --git a/tests/script/unique/cluster/main1_client1_2.sim b/tests/script/tsim/backup/cluster/main1_client1_2.sim similarity index 100% rename from tests/script/unique/cluster/main1_client1_2.sim rename to tests/script/tsim/backup/cluster/main1_client1_2.sim diff --git a/tests/script/unique/cluster/main1_client1_3.sim b/tests/script/tsim/backup/cluster/main1_client1_3.sim similarity index 100% rename from tests/script/unique/cluster/main1_client1_3.sim rename to tests/script/tsim/backup/cluster/main1_client1_3.sim diff --git a/tests/script/unique/cluster/main1_client4.sim b/tests/script/tsim/backup/cluster/main1_client4.sim similarity index 100% rename from tests/script/unique/cluster/main1_client4.sim rename to tests/script/tsim/backup/cluster/main1_client4.sim diff --git a/tests/script/unique/cluster/main2_client1_0.sim b/tests/script/tsim/backup/cluster/main2_client1_0.sim similarity index 100% rename from tests/script/unique/cluster/main2_client1_0.sim rename to tests/script/tsim/backup/cluster/main2_client1_0.sim diff --git a/tests/script/unique/cluster/main2_client1_1.sim b/tests/script/tsim/backup/cluster/main2_client1_1.sim similarity index 100% rename from tests/script/unique/cluster/main2_client1_1.sim rename to tests/script/tsim/backup/cluster/main2_client1_1.sim diff --git a/tests/script/unique/cluster/main2_client1_2.sim b/tests/script/tsim/backup/cluster/main2_client1_2.sim similarity index 100% rename from tests/script/unique/cluster/main2_client1_2.sim rename to tests/script/tsim/backup/cluster/main2_client1_2.sim diff --git a/tests/script/unique/cluster/main2_client1_3.sim b/tests/script/tsim/backup/cluster/main2_client1_3.sim similarity index 100% rename from tests/script/unique/cluster/main2_client1_3.sim rename to tests/script/tsim/backup/cluster/main2_client1_3.sim diff --git a/tests/script/unique/cluster/main2_client2_0.sim b/tests/script/tsim/backup/cluster/main2_client2_0.sim similarity index 100% rename from tests/script/unique/cluster/main2_client2_0.sim rename to tests/script/tsim/backup/cluster/main2_client2_0.sim diff --git a/tests/script/unique/cluster/main2_client2_1.sim b/tests/script/tsim/backup/cluster/main2_client2_1.sim similarity index 100% rename from tests/script/unique/cluster/main2_client2_1.sim rename to tests/script/tsim/backup/cluster/main2_client2_1.sim diff --git a/tests/script/unique/cluster/main2_client2_2.sim b/tests/script/tsim/backup/cluster/main2_client2_2.sim similarity index 100% rename from tests/script/unique/cluster/main2_client2_2.sim rename to tests/script/tsim/backup/cluster/main2_client2_2.sim diff --git a/tests/script/unique/cluster/main2_client2_3.sim b/tests/script/tsim/backup/cluster/main2_client2_3.sim similarity index 100% rename from tests/script/unique/cluster/main2_client2_3.sim rename to tests/script/tsim/backup/cluster/main2_client2_3.sim diff --git a/tests/script/unique/clusterSimCase/client-01.sim b/tests/script/tsim/backup/clusterSimCase/client-01.sim similarity index 100% rename from tests/script/unique/clusterSimCase/client-01.sim rename to tests/script/tsim/backup/clusterSimCase/client-01.sim diff --git a/tests/script/unique/clusterSimCase/client-02.sim b/tests/script/tsim/backup/clusterSimCase/client-02.sim similarity index 100% rename from tests/script/unique/clusterSimCase/client-02.sim rename to tests/script/tsim/backup/clusterSimCase/client-02.sim diff --git a/tests/script/unique/clusterSimCase/client-03.sim b/tests/script/tsim/backup/clusterSimCase/client-03.sim similarity index 100% rename from tests/script/unique/clusterSimCase/client-03.sim rename to tests/script/tsim/backup/clusterSimCase/client-03.sim diff --git a/tests/script/unique/clusterSimCase/client-04.sim b/tests/script/tsim/backup/clusterSimCase/client-04.sim similarity index 100% rename from tests/script/unique/clusterSimCase/client-04.sim rename to tests/script/tsim/backup/clusterSimCase/client-04.sim diff --git a/tests/script/unique/clusterSimCase/client-05.sim b/tests/script/tsim/backup/clusterSimCase/client-05.sim similarity index 100% rename from tests/script/unique/clusterSimCase/client-05.sim rename to tests/script/tsim/backup/clusterSimCase/client-05.sim diff --git a/tests/script/unique/clusterSimCase/client-06.sim b/tests/script/tsim/backup/clusterSimCase/client-06.sim similarity index 100% rename from tests/script/unique/clusterSimCase/client-06.sim rename to tests/script/tsim/backup/clusterSimCase/client-06.sim diff --git a/tests/script/unique/clusterSimCase/client-07.sim b/tests/script/tsim/backup/clusterSimCase/client-07.sim similarity index 100% rename from tests/script/unique/clusterSimCase/client-07.sim rename to tests/script/tsim/backup/clusterSimCase/client-07.sim diff --git a/tests/script/unique/clusterSimCase/client-08.sim b/tests/script/tsim/backup/clusterSimCase/client-08.sim similarity index 100% rename from tests/script/unique/clusterSimCase/client-08.sim rename to tests/script/tsim/backup/clusterSimCase/client-08.sim diff --git a/tests/script/unique/clusterSimCase/cluster_main.sim b/tests/script/tsim/backup/clusterSimCase/cluster_main.sim similarity index 100% rename from tests/script/unique/clusterSimCase/cluster_main.sim rename to tests/script/tsim/backup/clusterSimCase/cluster_main.sim diff --git a/tests/script/tsim/db/alter_replica_31.sim b/tests/script/tsim/db/alter_replica_31.sim index cbd4183b5e7cdb49c1335693c8d49c0d4c82839d..e9a295820c611089bf56d0cb47dcc189f9c3f0a9 100644 --- a/tests/script/tsim/db/alter_replica_31.sim +++ b/tests/script/tsim/db/alter_replica_31.sim @@ -89,13 +89,13 @@ step2: endi sql show db.vgroups print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 -if $data(2)[3] != 4 then +if $data(2)[3] != 2 then return -1 endi if $data(2)[5] != 3 then return -1 endi -if $data(2)[7] != 2 then +if $data(2)[7] != 4 then return -1 endi if $data(2)[4] == leader then @@ -118,7 +118,7 @@ sql insert into db.ctb values(now, 1, "2") sql show db.vgroups print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 -sleep 1000 +sleep 100 sql select * from db.ctb print ===> $data00 $data01 $data02 $data03 $data04 $data05 @@ -126,10 +126,9 @@ if $rows != 1 then return -1 endi -sleep 3000 - print ============= step3: alter database sql alter database db replica 1 +$hasleader = 0 $x = 0 step3: @@ -144,18 +143,20 @@ print ===> rows: $rows if $rows != 1 then goto step3 endi -if $data(2)[3] != 4 then - goto step3 +if $data(2)[4] == leader then + $hasleader = 1 endi -if $data(2)[5] != NULL then - goto step3 +if $data(2)[6] == leader then + $hasleader = 1 +endi +if $data(2)[8] == leader then + $hasleader = 1 endi -if $data(2)[7] != NULL then +if $hasleader != 1 then goto step3 endi print ============= step5: stop dnode 2 -return sql select * from db.stb if $rows != 1 then return -1 diff --git a/tests/script/unique/db/back_insert.sim b/tests/script/tsim/db/back_insert.sim similarity index 100% rename from tests/script/unique/db/back_insert.sim rename to tests/script/tsim/db/back_insert.sim diff --git a/tests/script/tsim/db/basic7.sim b/tests/script/tsim/db/basic7.sim index 73651eed2f5dbf06c35d4b553d963bd610f6c97a..9b809c35f09c28dc81cefedb24e3bd507d792f34 100644 --- a/tests/script/tsim/db/basic7.sim +++ b/tests/script/tsim/db/basic7.sim @@ -44,4 +44,4 @@ if $rows != 0 then return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/unique/db/commit.sim b/tests/script/tsim/db/commit.sim similarity index 100% rename from tests/script/unique/db/commit.sim rename to tests/script/tsim/db/commit.sim diff --git a/tests/script/unique/db/delete.sim b/tests/script/tsim/db/delete.sim similarity index 100% rename from tests/script/unique/db/delete.sim rename to tests/script/tsim/db/delete.sim diff --git a/tests/script/unique/db/delete_part.sim b/tests/script/tsim/db/delete_part.sim similarity index 100% rename from tests/script/unique/db/delete_part.sim rename to tests/script/tsim/db/delete_part.sim diff --git a/tests/script/unique/dnode/balance1.sim b/tests/script/tsim/dnode/balance1.sim similarity index 54% rename from tests/script/unique/dnode/balance1.sim rename to tests/script/tsim/dnode/balance1.sim index 8743204a03e06d0aefc66b2f70cbdc111e317237..6471529a1e708838bcd047da63435ae04683ece5 100644 --- a/tests/script/unique/dnode/balance1.sim +++ b/tests/script/tsim/dnode/balance1.sim @@ -1,40 +1,18 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode4 -c wallevel -v 2 - -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode4 -c wallevel -v 2 - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode2 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode3 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode4 -c supportVnodes -v 4 print ========== step1 system sh/exec.sh -n dnode1 -s start sql connect -sql create database d1 +sql create database d1 vgroups 1 sql create table d1.t1 (t timestamp, i int) sql insert into d1.t1 values(now+1s, 15) sql insert into d1.t1 values(now+2s, 14) @@ -43,35 +21,49 @@ sql insert into d1.t1 values(now+4s, 12) sql insert into d1.t1 values(now+5s, 11) sql show dnodes -print dnode1 openVnodes $data2_1 -if $data2_1 != 1 then +print dnode1 openVnodes $data(1)[2] +if $data(1)[2] != 1 then return -1 endi print ========== step2 -sql create dnode $hostname2 +sql create dnode $hostname port 7200 system sh/exec.sh -n dnode2 -s start $x = 0 -show2: +step2: $x = $x + 1 sleep 1000 - if $x == 20 then + if $x == 10 then + print ====> dnode not ready! return -1 endi - sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -if $data2_1 != 0 then - goto show2 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +if $rows != 2 then + return -1 +endi +if $data(1)[4] != ready then + goto step2 +endi +if $data(2)[4] != ready then + goto step2 +endi + +sql balance vgroup +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(2)[2] +if $data(1)[2] != 0 then + return -1 endi -if $data2_2 != 1 then - goto show2 +if $data(2)[2] != 1 then + return -1 endi print ========== step3 -sql create database d2 +sql create database d2 vgroups 1 sql create table d2.t2 (t timestamp, i int) sql insert into d2.t2 values(now+1s, 25) sql insert into d2.t2 values(now+2s, 24) @@ -80,69 +72,67 @@ sql insert into d2.t2 values(now+4s, 22) sql insert into d2.t2 values(now+5s, 21) sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -if $data2_1 != 0 then +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(2)[2] +if $data(1)[2] != 0 then return -1 endi -if $data2_2 != 2 then +if $data(2)[2] != 2 then return -1 endi print ========== step4 -sql drop dnode $hostname2 - -$x = 0 -show4: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi - +sql drop dnode 2 sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -if $data2_1 != 2 then - goto show4 -endi -if $data2_2 != null then - goto show4 +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(2)[2] +if $data(1)[2] != 2 then + return -1 endi -if $rows != 1 then - goto show4 +if $data(2)[2] != null then + return -1 endi system sh/exec.sh -n dnode2 -s stop -x SIGINT print ========== step5 -sql create dnode $hostname3 +sql create dnode $hostname port 7300 system sh/exec.sh -n dnode3 -s start $x = 0 -show5: +step5: $x = $x + 1 sleep 1000 - if $x == 30 then + if $x == 10 then + print ====> dnode not ready! return -1 endi - sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -if $data2_1 != 0 then - goto show5 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +if $rows != 2 then + return -1 endi -if $data2_2 != null then - goto show5 +if $data(1)[4] != ready then + goto step5 endi -if $data2_3 != 2 then - goto show5 +if $data(3)[4] != ready then + goto step5 +endi + +sql balance vgroup +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(3)[2] +if $data(1)[2] != 1 then + return -1 +endi +if $data(3)[2] != 1 then + return -1 endi print ========== step6 -sql create database d3 +sql create database d3 vgroups 1 sql create table d3.t3 (t timestamp, i int) sql insert into d3.t3 values(now+1s, 35) sql insert into d3.t3 values(now+2s, 34) @@ -151,52 +141,46 @@ sql insert into d3.t3 values(now+4s, 32) sql insert into d3.t3 values(now+5s, 31) sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 - -if $data2_1 != 0 then +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(3)[2] +if $data(1)[2] != 1 then return -1 endi -if $data2_2 != null then - return -1 -endi -if $data2_3 != 3 then +if $data(3)[2] != 2 then return -1 endi print ========== step7 -sql create dnode $hostname4 +sql create dnode $hostname port 7400 system sh/exec.sh -n dnode4 -s start $x = 0 -show7: +step7: $x = $x + 1 sleep 1000 - if $x == 20 then - return -1 + if $x == 10 then + print ====> dnode not ready! + return -1 endi - sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_1 != 0 then - goto show7 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +if $rows != 3 then + return -1 endi -if $data2_2 != null then - goto show7 +if $data(1)[4] != ready then + goto step7 endi -if $data2_3 != 2 then - goto show7 +if $data(3)[4] != ready then + goto step7 endi -if $data2_4 != 1 then - goto show7 +if $data(4)[4] != ready then + goto step7 endi print ========== step8 -sql create database d4 +sql create database d4 vgroups 1 sql create table d4.t4 (t timestamp, i int) sql insert into d4.t4 values(now+1s, 45) sql insert into d4.t4 values(now+2s, 44) @@ -205,56 +189,32 @@ sql insert into d4.t4 values(now+4s, 42) sql insert into d4.t4 values(now+5s, 41) sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 - -if $data2_1 != 0 then +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(3)[2] +print dnode2 openVnodes $data(4)[2] +if $data(1)[2] != 1 then return -1 endi -if $data2_2 != null then +if $data(3)[2] != 2 then return -1 endi -if $data2_3 != 2 then - return -1 -endi -if $data2_4 != 2 then +if $data(4)[2] != 1 then return -1 endi print ========== step9 -sql drop dnode $hostname3 - -$x = 0 -show9: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi - +sql drop dnode 3 sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 - -if $data2_1 != 0 then - goto show9 -endi -if $data2_2 != null then - goto show9 -endi -if $data2_3 != null then - goto show9 +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(4)[2] +if $data(1)[2] != 2 then + return -1 endi -if $data2_4 != 4 then - goto show9 +if $data(4)[2] != 2 then + return -1 endi system sh/exec.sh -n dnode3 -s stop -x SIGINT - sql reset query cache sleep 100 diff --git a/tests/script/tsim/dnode/balance2.sim b/tests/script/tsim/dnode/balance2.sim new file mode 100644 index 0000000000000000000000000000000000000000..5da9a659f3ca57c4dd195d0fcbd0f8557974dfb0 --- /dev/null +++ b/tests/script/tsim/dnode/balance2.sim @@ -0,0 +1,280 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 +system sh/deploy.sh -n dnode3 -i 3 +system sh/deploy.sh -n dnode4 -i 4 +system sh/deploy.sh -n dnode5 -i 5 +system sh/cfg.sh -n dnode1 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode2 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode3 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode4 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode5 -c supportVnodes -v 4 + +print ========== step1 +system sh/exec.sh -n dnode1 -s start +sql connect + +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 +system sh/exec.sh -n dnode2 -s start +system sh/exec.sh -n dnode3 -s start + +$x = 0 +step1: + $x = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +if $rows != 3 then + return -1 +endi +if $data(1)[4] != ready then + goto step1 +endi +if $data(2)[4] != ready then + goto step1 +endi +if $data(3)[4] != ready then + goto step1 +endi + +print ========== step2 +sql create database d1 replica 3 vgroups 1 +sql create table d1.t1 (t timestamp, i int) +sql insert into d1.t1 values(now+1s, 15) +sql insert into d1.t1 values(now+2s, 14) +sql insert into d1.t1 values(now+3s, 13) +sql insert into d1.t1 values(now+4s, 12) +sql insert into d1.t1 values(now+5s, 11) + +sql create database d2 replica 3 vgroups 1 +sql create table d2.t2 (t timestamp, i int) +sql insert into d2.t2 values(now+1s, 25) +sql insert into d2.t2 values(now+2s, 24) +sql insert into d2.t2 values(now+3s, 23) +sql insert into d2.t2 values(now+4s, 22) +sql insert into d2.t2 values(now+5s, 21) + +sql create database d3 replica 3 vgroups 1 +sql create table d3.t3 (t timestamp, i int) +sql insert into d3.t3 values(now+1s, 35) +sql insert into d3.t3 values(now+2s, 34) +sql insert into d3.t3 values(now+3s, 33) +sql insert into d3.t3 values(now+4s, 32) +sql insert into d3.t3 values(now+5s, 31) + +sql create database d4 replica 3 vgroups 1 +sql create table d4.t4 (t timestamp, i int) +sql insert into d4.t4 values(now+1s, 45) +sql insert into d4.t4 values(now+2s, 44) +sql insert into d4.t4 values(now+3s, 43) +sql insert into d4.t4 values(now+4s, 42) +sql insert into d4.t4 values(now+5s, 41) + +print ========== step2.1 +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(2)[2] +print dnode3 openVnodes $data(3)[2] +if $data(1)[2] != 4 then + return -1 +endi +if $data(2)[2] != 4 then + return -1 +endi +if $data(3)[2] != 4 then + return -1 +endi + +print ========== step3 +sql create dnode $hostname port 7400 +sql create dnode $hostname port 7500 +system sh/exec.sh -n dnode4 -s start +system sh/exec.sh -n dnode5 -s start + +$x = 0 +step3: + $x = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 +print ===> $data40 $data41 $data42 $data43 $data44 $data45 +if $rows != 5 then + return -1 +endi +if $data(1)[4] != ready then + goto step3 +endi +if $data(2)[4] != ready then + goto step3 +endi +if $data(3)[4] != ready then + goto step3 +endi +if $data(4)[4] != ready then + goto step3 +endi +if $data(5)[4] != ready then + goto step3 +endi + +sql balance vgroup +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode3 openVnodes $data(2)[2] +print dnode3 openVnodes $data(3)[2] +print dnode4 openVnodes $data(4)[2] +print dnode5 openVnodes $data(5)[2] +if $data(1)[2] != 2 then + return -1 +endi +if $data(2)[2] != 3 then + return -1 +endi +if $data(3)[2] != 3 then + return -1 +endi +if $data(4)[2] != 2 then + return -1 +endi +if $data(5)[2] != 2 then + return -1 +endi + +print ========== step4 +sql drop dnode 2 +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode3 openVnodes $data(3)[2] +print dnode4 openVnodes $data(4)[2] +print dnode5 openVnodes $data(5)[2] +if $data(1)[2] != 2 then + return -1 +endi +if $data(3)[2] != 3 then + return -1 +endi +if $data(4)[2] != 4 then + return -1 +endi +if $data(5)[2] != 3 then + return -1 +endi + +system sh/exec.sh -n dnode2 -s stop -x SIGINT + +print ========== step5 +sql drop dnode 3 +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode3 openVnodes $data(3)[2] +print dnode4 openVnodes $data(4)[2] +print dnode5 openVnodes $data(5)[2] +if $data(1)[2] != 4 then + return -1 +endi +if $data(3)[2] != null then + return -1 +endi +if $data(4)[2] != 4 then + return -1 +endi +if $data(5)[2] != 4 then + return -1 +endi + +sql reset query cache +sleep 100 +system sh/exec.sh -n dnode3 -s stop -x SIGINT + +print ========== step6 +sql select * from d1.t1 order by t desc +print $data01 $data11 $data21 $data31 $data41 +if $data01 != 11 then + return -1 +endi +if $data11 != 12 then + return -1 +endi +if $data21 != 13 then + return -1 +endi +if $data31 != 14 then + return -1 +endi +if $data41 != 15 then + return -1 +endi + +sql select * from d2.t2 order by t desc +print $data01 $data11 $data21 $data31 $data41 +if $data01 != 21 then + return -1 +endi +if $data11 != 22 then + return -1 +endi +if $data21 != 23 then + return -1 +endi +if $data31 != 24 then + return -1 +endi +if $data41 != 25 then + return -1 +endi + +sql select * from d3.t3 order by t desc +print $data01 $data11 $data21 $data31 $data41 +if $data01 != 31 then + return -1 +endi +if $data11 != 32 then + return -1 +endi +if $data21 != 33 then + return -1 +endi +if $data31 != 34 then + return -1 +endi +if $data41 != 35 then + return -1 +endi + +sql select * from d4.t4 order by t desc +print $data01 $data11 $data21 $data31 $data41 +if $data01 != 41 then + return -1 +endi +if $data11 != 42 then + return -1 +endi +if $data21 != 43 then + return -1 +endi +if $data31 != 44 then + return -1 +endi +if $data41 != 45 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec.sh -n dnode3 -s stop -x SIGINT +system sh/exec.sh -n dnode4 -s stop -x SIGINT +system sh/exec.sh -n dnode5 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/dnode/balance3.sim b/tests/script/tsim/dnode/balance3.sim new file mode 100644 index 0000000000000000000000000000000000000000..f26c0eaa21c5126c93187688ab6f12176f19fd78 --- /dev/null +++ b/tests/script/tsim/dnode/balance3.sim @@ -0,0 +1,394 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 +system sh/deploy.sh -n dnode3 -i 3 +system sh/deploy.sh -n dnode4 -i 4 +system sh/deploy.sh -n dnode5 -i 5 +system sh/deploy.sh -n dnode6 -i 6 +system sh/cfg.sh -n dnode1 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode2 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode3 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode4 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode5 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode6 -c supportVnodes -v 4 + +print ========== step1 +system sh/exec.sh -n dnode1 -s start +sql connect + +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 +sql create dnode $hostname port 7400 +system sh/exec.sh -n dnode2 -s start +system sh/exec.sh -n dnode3 -s start +system sh/exec.sh -n dnode4 -s start + +$x = 0 +step10: + $x = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 +if $rows != 4 then + return -1 +endi +if $data(1)[4] != ready then + goto step10 +endi +if $data(2)[4] != ready then + goto step10 +endi +if $data(3)[4] != ready then + goto step10 +endi +if $data(4)[4] != ready then + goto step10 +endi + +sql create database d1 replica 3 vgroups 1 +$x = 0 +step11: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show d1.vgroups +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $rows != 1 then + return -1 +endi +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step11 +endi + +sql create database d2 replica 3 vgroups 1 +$x = 0 +step12: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> d2 not ready! + return -1 + endi +sql show d2.vgroups +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $rows != 1 then + return -1 +endi +if $data(3)[4] == leader then + $leaderExist = 1 +endi +if $data(3)[6] == leader then + $leaderExist = 1 +endi +if $data(3)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step12 +endi + +sql create table d1.t1 (t timestamp, i int) +sql insert into d1.t1 values(now+1s, 15) +sql insert into d1.t1 values(now+2s, 14) +sql insert into d1.t1 values(now+3s, 13) +sql insert into d1.t1 values(now+4s, 12) +sql insert into d1.t1 values(now+5s, 11) + +sql create table d2.t2 (t timestamp, i int) +sql insert into d2.t2 values(now+1s, 25) +sql insert into d2.t2 values(now+2s, 24) +sql insert into d2.t2 values(now+3s, 23) +sql insert into d2.t2 values(now+4s, 22) +sql insert into d2.t2 values(now+5s, 21) + +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(2)[2] +print dnode3 openVnodes $data(3)[2] +print dnode4 openVnodes $data(4)[2] +if $data(1)[2] != 0 then + return -1 +endi +if $data(2)[2] != 2 then + return -1 +endi +if $data(3)[2] != 2 then + return -1 +endi +if $data(4)[2] != 2 then + return -1 +endi + +print ========== step2 +sql drop dnode 2 +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(2)[2] +print dnode3 openVnodes $data(3)[2] +print dnode4 openVnodes $data(4)[2] +if $data(1)[2] != 2 then + return -1 +endi +if $data(2)[2] != null then + return -1 +endi +if $data(3)[2] != 2 then + return -1 +endi +if $data(4)[2] != 2 then + return -1 +endi + +system sh/exec.sh -n dnode2 -s stop -x SIGINT + +print ========== step3 +sql create dnode $hostname port 7500 +system sh/exec.sh -n dnode5 -s start + +$x = 0 +step3: + $x = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 +if $rows != 4 then + return -1 +endi +if $data(1)[4] != ready then + goto step3 +endi +if $data(3)[4] != ready then + goto step3 +endi +if $data(4)[4] != ready then + goto step3 +endi +if $data(5)[4] != ready then + goto step3 +endi + +sql balance vgroup +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode3 openVnodes $data(3)[2] +print dnode4 openVnodes $data(4)[2] +print dnode5 openVnodes $data(5)[2] +if $data(1)[2] != 1 then + return -1 +endi +if $data(3)[2] != 2 then + return -1 +endi +if $data(4)[2] != 2 then + return -1 +endi +if $data(5)[2] != 1 then + return -1 +endi + +print ========== step4 +sql create database d3 replica 3 vgroups 1 +sql create table d3.t3 (t timestamp, i int) +sql insert into d3.t3 values(now+1s, 35) +sql insert into d3.t3 values(now+2s, 34) +sql insert into d3.t3 values(now+3s, 33) +sql insert into d3.t3 values(now+4s, 32) +sql insert into d3.t3 values(now+5s, 31) + +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode3 openVnodes $data(3)[2] +print dnode4 openVnodes $data(4)[2] +print dnode5 openVnodes $data(5)[2] +if $data(1)[2] != 1 then + return -1 +endi +if $data(3)[2] != 3 then + return -1 +endi +if $data(4)[2] != 3 then + return -1 +endi +if $data(5)[2] != 2 then + return -1 +endi + +print ========== step5 +sql create dnode $hostname port 7600 +system sh/exec.sh -n dnode6 -s start + +$x = 0 +step5: + $x = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 +print ===> $data40 $data41 $data42 $data43 $data44 $data45 +if $rows != 5 then + return -1 +endi +if $data(1)[4] != ready then + goto step5 +endi +if $data(3)[4] != ready then + goto step5 +endi +if $data(4)[4] != ready then + goto step5 +endi +if $data(5)[4] != ready then + goto step5 +endi +if $data(6)[4] != ready then + goto step5 +endi + +sql balance vgroup +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode3 openVnodes $data(3)[2] +print dnode4 openVnodes $data(4)[2] +print dnode5 openVnodes $data(5)[2] +print dnode5 openVnodes $data(6)[2] +if $data(1)[2] != 1 then + return -1 +endi +if $data(3)[2] != 2 then + return -1 +endi +if $data(4)[2] != 2 then + return -1 +endi +if $data(5)[2] != 2 then + return -1 +endi +if $data(6)[2] != 2 then + return -1 +endi + +print ========== step6 +sql drop dnode 3 +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode3 openVnodes $data(3)[2] +print dnode4 openVnodes $data(4)[2] +print dnode5 openVnodes $data(5)[2] +print dnode5 openVnodes $data(6)[2] +if $data(1)[2] != 2 then + return -1 +endi +if $data(3)[2] != null then + return -1 +endi +if $data(4)[2] != 2 then + return -1 +endi +if $data(5)[2] != 3 then + return -1 +endi +if $data(6)[2] != 2 then + return -1 +endi + +system sh/exec.sh -n dnode3 -s stop -x SIGINT +sql reset query cache +sleep 100 + +print ========== step7 +sql select * from d1.t1 order by t desc +print $data01 $data11 $data21 $data31 $data41 +if $data01 != 11 then + return -1 +endi +if $data11 != 12 then + return -1 +endi +if $data21 != 13 then + return -1 +endi +if $data31 != 14 then + return -1 +endi +if $data41 != 15 then + return -1 +endi + +sql select * from d2.t2 order by t desc +print $data01 $data11 $data21 $data31 $data41 +if $data01 != 21 then + return -1 +endi +if $data11 != 22 then + return -1 +endi +if $data21 != 23 then + return -1 +endi +if $data31 != 24 then + return -1 +endi +if $data41 != 25 then + return -1 +endi + +sql select * from d3.t3 order by t desc +print $data01 $data11 $data21 $data31 $data41 +if $data01 != 31 then + return -1 +endi +if $data11 != 32 then + return -1 +endi +if $data21 != 33 then + return -1 +endi +if $data31 != 34 then + return -1 +endi +if $data41 != 35 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec.sh -n dnode3 -s stop -x SIGINT +system sh/exec.sh -n dnode4 -s stop -x SIGINT +system sh/exec.sh -n dnode5 -s stop -x SIGINT +system sh/exec.sh -n dnode6 -s stop -x SIGINT +system sh/exec.sh -n dnode7 -s stop -x SIGINT +system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/dnode/balance_replica3.sim b/tests/script/tsim/dnode/balance_replica3.sim index b8996e259dac5d9eb64bda08eb19adf288cb986b..276621cfcc5a3ba228100d937583dbe5079f6d49 100644 --- a/tests/script/tsim/dnode/balance_replica3.sim +++ b/tests/script/tsim/dnode/balance_replica3.sim @@ -347,10 +347,7 @@ if $leaderExist != 1 then goto step65 endi - - print =============== step7: select data - sql show d1.tables print rows $rows if $rows != 6 then diff --git a/tests/script/unique/dnode/remove1.sim b/tests/script/tsim/dnode/balancex.sim similarity index 51% rename from tests/script/unique/dnode/remove1.sim rename to tests/script/tsim/dnode/balancex.sim index 25e0846129da4dfed1ffcafa9815d16848771ad7..124ccbebba75c06d1320e51dbcd8b81a890c55a9 100644 --- a/tests/script/unique/dnode/remove1.sim +++ b/tests/script/tsim/dnode/balancex.sim @@ -1,30 +1,18 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c wallevel -v 1 -system sh/cfg.sh -n dnode2 -c wallevel -v 1 -system sh/cfg.sh -n dnode3 -c wallevel -v 1 -system sh/cfg.sh -n dnode4 -c wallevel -v 1 - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode2 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode3 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode4 -c supportVnodes -v 4 print ========== step1 system sh/exec.sh -n dnode1 -s start sql connect -sql create database d1 +sql create database d1 vgroups 1 sql create table d1.t1 (t timestamp, i int) sql insert into d1.t1 values(now+1s, 15) sql insert into d1.t1 values(now+2s, 14) @@ -32,7 +20,7 @@ sql insert into d1.t1 values(now+3s, 13) sql insert into d1.t1 values(now+4s, 12) sql insert into d1.t1 values(now+5s, 11) -sql create database d2 +sql create database d2 vgroups 1 sql create table d2.t2 (t timestamp, i int) sql insert into d2.t2 values(now+1s, 25) sql insert into d2.t2 values(now+2s, 24) @@ -41,36 +29,59 @@ sql insert into d2.t2 values(now+4s, 22) sql insert into d2.t2 values(now+5s, 21) sql show dnodes -print dnode1 openVnodes $data2_1 -if $data2_1 != 2 then +print dnode1 openVnodes $data(1)[2] +if $data(1)[2] != 2 then return -1 endi print ========== step2 -sql create dnode $hostname2 +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 system sh/exec.sh -n dnode2 -s start +system sh/exec.sh -n dnode3 -s start + $x = 0 -step2: +step2: $x = $x + 1 sleep 1000 if $x == 10 then + print ====> dnode not ready! return -1 endi - sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +if $rows != 3 then + return -1 +endi +if $data(1)[4] != ready then + goto step2 +endi +if $data(2)[4] != ready then goto step2 endi -if $data4_2 != ready then +if $data(3)[4] != ready then goto step2 endi -sql create database d3 replica 2 +sql balance vgroup +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(2)[2] +print dnode2 openVnodes $data(3)[2] +if $data(1)[2] != 0 then + return -1 +endi +if $data(2)[2] != 1 then + return -1 +endi +if $data(3)[2] != 1 then + return -1 +endi + +print ========== step3 +sql create database d3 replica 3 vgroups 1 sql create table d3.t3 (t timestamp, i int) sql insert into d3.t3 values(now+1s, 35) sql insert into d3.t3 values(now+2s, 34) @@ -78,90 +89,96 @@ sql insert into d3.t3 values(now+3s, 33) sql insert into d3.t3 values(now+4s, 32) sql insert into d3.t3 values(now+5s, 31) -$x = 0 -show2: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi - sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -if $data2_1 != 1 then - goto show2 +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(2)[2] +print dnode2 openVnodes $data(3)[2] +if $data(1)[2] != 1 then + return -1 +endi +if $data(2)[2] != 2 then + return -1 endi -if $data2_2 != 3 then - goto show2 +if $data(3)[2] != 2 then + return -1 endi print ========== step3 +sql create dnode $hostname port 7400 +system sh/exec.sh -n dnode4 -s start $x = 0 -show3: +step3: $x = $x + 1 sleep 1000 - if $x == 20 then - return -1 + if $x == 10 then + print ====> dnode not ready! + return -1 endi - sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 - -print ========== step4 -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start -sql drop dnode $hostname2 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 +if $rows != 4 then + return -1 +endi +if $data(1)[4] != ready then + goto step3 +endi +if $data(2)[4] != ready then + goto step3 +endi +if $data(3)[4] != ready then + goto step3 +endi +if $data(4)[4] != ready then + goto step3 +endi -$x = 0 -show4: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - +sql balance vgroup sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -if $data2_2 != null then - goto show4 +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(2)[2] +print dnode2 openVnodes $data(3)[2] +print dnode2 openVnodes $data(4)[2] +if $data(1)[2] != 0 then + return -1 +endi +if $data(2)[2] != 2 then + return -1 +endi +if $data(3)[2] != 2 then + return -1 +endi +if $data(4)[2] != 1 then + return -1 endi - -system sh/exec.sh -n dnode2 -s stop -x SIGINT print ========== step5 -sql create dnode $hostname4 -system sh/exec.sh -n dnode4 -s start - -$x = 0 -show5: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi +sql drop dnode 2 sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_1 != 0 then - goto show5 +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(2)[2] +print dnode2 openVnodes $data(3)[2] +print dnode2 openVnodes $data(4)[2] +if $data(1)[2] != 1 then + return -1 endi -if $data2_2 != null then - goto show5 +if $data(2)[2] != null then + return -1 endi -if $data2_3 != 2 then - goto show5 +if $data(3)[2] != 2 then + return -1 endi -if $data2_4 != 2 then - goto show5 +if $data(4)[2] != 2 then + return -1 endi +system sh/exec.sh -n dnode2 -s stop -x SIGINT +sql reset query cache +sleep 100 + print ========== step6 sql select * from d1.t1 order by t desc print $data01 $data11 $data21 $data31 $data41 @@ -224,4 +241,4 @@ system sh/exec.sh -n dnode4 -s stop -x SIGINT system sh/exec.sh -n dnode5 -s stop -x SIGINT system sh/exec.sh -n dnode6 -s stop -x SIGINT system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT +system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/cluster/alter.sim b/tests/script/tsim/dnode/cluster_alter.sim similarity index 100% rename from tests/script/unique/cluster/alter.sim rename to tests/script/tsim/dnode/cluster_alter.sim diff --git a/tests/script/unique/cluster/balance1.sim b/tests/script/tsim/dnode/cluster_balance1.sim similarity index 100% rename from tests/script/unique/cluster/balance1.sim rename to tests/script/tsim/dnode/cluster_balance1.sim diff --git a/tests/script/unique/cluster/balance2.sim b/tests/script/tsim/dnode/cluster_balance2.sim similarity index 100% rename from tests/script/unique/cluster/balance2.sim rename to tests/script/tsim/dnode/cluster_balance2.sim diff --git a/tests/script/unique/cluster/balance3.sim b/tests/script/tsim/dnode/cluster_balance3.sim similarity index 100% rename from tests/script/unique/cluster/balance3.sim rename to tests/script/tsim/dnode/cluster_balance3.sim diff --git a/tests/script/unique/cluster/cache.sim b/tests/script/tsim/dnode/cluster_cache.sim similarity index 100% rename from tests/script/unique/cluster/cache.sim rename to tests/script/tsim/dnode/cluster_cache.sim diff --git a/tests/script/unique/cluster/flowctrl.sim b/tests/script/tsim/dnode/cluster_flowctrl.sim similarity index 100% rename from tests/script/unique/cluster/flowctrl.sim rename to tests/script/tsim/dnode/cluster_flowctrl.sim diff --git a/tests/script/unique/cluster/vgroup100.sim b/tests/script/tsim/dnode/cluster_vgroup100.sim similarity index 100% rename from tests/script/unique/cluster/vgroup100.sim rename to tests/script/tsim/dnode/cluster_vgroup100.sim diff --git a/tests/script/tsim/dnode/drop_dnode_has_multi_vnode_replica1.sim b/tests/script/tsim/dnode/drop_dnode_has_multi_vnode_replica1.sim index 15ad13b6fa4208d4cac3eca5ad5427328d09ea6b..20eac3836c73a94459ecede82b49231aceda5c63 100644 --- a/tests/script/tsim/dnode/drop_dnode_has_multi_vnode_replica1.sim +++ b/tests/script/tsim/dnode/drop_dnode_has_multi_vnode_replica1.sim @@ -124,6 +124,8 @@ if $data(5)[3] != 3 then return -1 endi +sql reset query cache + print =============== step4: select data sql show d1.tables if $rows != 1 then diff --git a/tests/script/tsim/dnode/offline_reason.sim b/tests/script/tsim/dnode/offline_reason.sim new file mode 100644 index 0000000000000000000000000000000000000000..3c6fff8b595b67dc7bc2db45a16d1de57c2879d8 --- /dev/null +++ b/tests/script/tsim/dnode/offline_reason.sim @@ -0,0 +1,161 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 + +print ========== step1 +system sh/exec.sh -n dnode1 -s start +sql connect +sql create dnode $hostname port 7200 + +sql show dnodes +print dnode1 off: $data(1)[6] +print dnode2 off: $data(2)[6] + +if $data(2)[6] != @status not received@ then + return -1 +endi + +print ========== step2 +system sh/exec.sh -n dnode2 -s start + +$x = 0 +step2: + $x = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +if $rows != 2 then + return -1 +endi +if $data(1)[4] != ready then + goto step2 +endi +if $data(2)[4] != ready then + goto step2 +endi + +print ========== step3 +system sh/exec.sh -n dnode2 -s stop + +$x = 0 +step3: + $x = $x + 1 + sleep 1000 + if $x == 10 then + return -1 + endi +sql show dnodes +print dnode1 off: $data(1)[6] +print dnode2 off: $data(2)[6] +if $data(2)[6] != @status msg timeout@ then + goto step3 +endi + +print ========== step4 +sql drop dnode 2 +sql show dnodes +if $rows != 1 then + return -1 +endi + +print ========== step5 +system sh/exec.sh -n dnode2 -s start +sql create dnode $hostname port 7200 + +$x = 0 +step5: + $x = $x + 1 + sleep 1000 + if $x == 10 then + return -1 + endi + +sql show dnodes +print dnode1 off: $data(1)[6] +print dnode2 off: $data(3)[6] +if $data(3)[6] != @dnodeId not match@ then + goto step5 +endi + +print ========== step6 +system sh/deploy.sh -n dnode4 -i 4 +system sh/cfg.sh -n dnode4 -c statusInterval -v 4 +system sh/exec.sh -n dnode4 -s start +sql create dnode $hostname port 7400 + +$x = 0 +step6: + $x = $x + 1 + sleep 1000 + if $x == 10 then + return -1 + endi + +sql show dnodes +print dnode1 off: $data(1)[6] +print dnode2 off: $data(3)[6] +print dnode3 off: $data(4)[6] +if $data(4)[6] != @interval not match@ then + goto step6 +endi + +print ========== step7 +system sh/deploy.sh -n dnode5 -i 5 +system sh/cfg.sh -n dnode5 -c locale -v zn_CH.UTF-8 +system sh/exec.sh -n dnode5 -s start +sql create dnode $hostname port 7500 + +$x = 0 +step7: + $x = $x + 1 + sleep 1000 + if $x == 10 then + return -1 + endi + +sql show dnodes +print dnode1 off: $data(1)[6] +print dnode3 off: $data(3)[6] +print dnode4 off: $data(4)[6] +print dnode5 off: $data(5)[6] +if $data(5)[6] != @locale not match@ then + goto step7 +endi + +print ========== step8 +system sh/deploy.sh -n dnode6 -i 6 +system sh/cfg.sh -n dnode6 -c charset -v UTF-16 +system sh/exec.sh -n dnode6 -s start +sql create dnode $hostname port 7600 + +$x = 0 +step8: + $x = $x + 1 + sleep 1000 + if $x == 10 then + return -1 + endi + +sql show dnodes +print dnode1 off: $data(1)[6] +print dnode3 off: $data(3)[6] +print dnode4 off: $data(4)[6] +print dnode5 off: $data(5)[6] +print dnode6 off: $data(6)[6] +if $data(6)[6] != @charset not match@ then + goto step8 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec.sh -n dnode3 -s stop -x SIGINT +system sh/exec.sh -n dnode4 -s stop -x SIGINT +system sh/exec.sh -n dnode5 -s stop -x SIGINT +system sh/exec.sh -n dnode6 -s stop -x SIGINT +system sh/exec.sh -n dnode7 -s stop -x SIGINT +system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/vnode_clean.sim b/tests/script/tsim/dnode/vnode_clean.sim similarity index 54% rename from tests/script/unique/dnode/vnode_clean.sim rename to tests/script/tsim/dnode/vnode_clean.sim index 76311a6cacb2d2c06ff4125b689d3782c3e0dc98..9fcf9451c1fe9b6bda313a25391740feedb441ae 100644 --- a/tests/script/unique/dnode/vnode_clean.sim +++ b/tests/script/tsim/dnode/vnode_clean.sim @@ -1,30 +1,14 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c wallevel -v 1 -system sh/cfg.sh -n dnode2 -c wallevel -v 1 -system sh/cfg.sh -n dnode3 -c wallevel -v 1 -system sh/cfg.sh -n dnode4 -c wallevel -v 1 - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4 - print ========== step1 system sh/exec.sh -n dnode1 -s start sql connect -sql create database d1 +sql create database d1 vgroups 1 sql create table d1.t1 (t timestamp, i int) sql insert into d1.t1 values(now+1s, 15) sql insert into d1.t1 values(now+2s, 14) @@ -33,34 +17,49 @@ sql insert into d1.t1 values(now+4s, 12) sql insert into d1.t1 values(now+5s, 11) sql show dnodes -print dnode1 openVnodes $data2_1 -if $data2_1 != 1 then +print dnode1 openVnodes $data(1)[2] +if $data(1)[2] != 1 then return -1 endi print ========== step2 -sql create dnode $hostname2 +sql create dnode $hostname port 7200 system sh/exec.sh -n dnode2 -s start $x = 0 -show2: +step2: $x = $x + 1 sleep 1000 - if $x == 20 then - return -1 + if $x == 10 then + print ====> dnode not ready! + return -1 endi sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -if $data2_1 != 0 then - goto show2 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +if $rows != 2 then + return -1 endi -if $data2_2 != 1 then - goto show2 +if $data(1)[4] != ready then + goto step2 +endi +if $data(2)[4] != ready then + goto step2 +endi + +sql balance vgroup +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(2)[2] +if $data(1)[2] != 0 then + return -1 +endi +if $data(2)[2] != 1 then + return -1 endi print ========== step3 -sql create database d2 +sql create database d2 vgroups 1 sql create table d2.t2 (t timestamp, i int) sql insert into d2.t2 values(now+1s, 25) @@ -69,65 +68,68 @@ sql insert into d2.t2 values(now+3s, 23) sql insert into d2.t2 values(now+4s, 22) sql insert into d2.t2 values(now+5s, 21) -$x = 0 sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -if $data2_1 != 0 then +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(2)[2] +if $data(1)[2] != 0 then return -1 endi -if $data2_2 != 2 then +if $data(2)[2] != 2 then return -1 endi print ========== step4 -sql drop dnode $hostname2 - -$x = 0 -show4: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi +sql drop dnode 2 sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -if $data2_1 != 2 then - goto show4 -endi -if $data2_2 != null then - goto show4 +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(2)[2] +if $data(1)[2] != 2 then + return -1 endi -if $rows != 1 then - goto show4 +if $data(2)[2] != null then + return -1 endi system sh/exec.sh -n dnode2 -s stop -x SIGINT print ========== step5 -sql create dnode $hostname3 +sql create dnode $hostname port 7300 system sh/exec.sh -n dnode3 -s start $x = 0 -show5: +step5: $x = $x + 1 sleep 1000 - if $x == 40 then - return -1 + if $x == 10 then + print ====> dnode not ready! + return -1 endi sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode3 openVnodes $data2_3 -if $data2_1 != 0 then - goto show5 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +if $rows != 2 then + return -1 +endi +if $data(1)[4] != ready then + goto step5 +endi +if $data(3)[4] != ready then + goto step5 +endi + +sql balance vgroup +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(3)[2] +if $data(1)[2] != 1 then + return -1 endi -if $data2_3 != 2 then - goto show5 +if $data(3)[2] != 1 then + return -1 endi print ========== step6 -sql create database d3 +sql create database d3 vgroups 1 sql create table d3.t3 (t timestamp, i int) sql insert into d3.t3 values(now+1s, 35) sql insert into d3.t3 values(now+2s, 34) @@ -136,43 +138,61 @@ sql insert into d3.t3 values(now+4s, 32) sql insert into d3.t3 values(now+5s, 31) sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_3 -if $data2_1 != 0 then +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(3)[2] +if $data(1)[2] != 1 then return -1 endi -if $data2_3 != 3 then +if $data(3)[2] != 2 then return -1 endi print ========== step7 -sql create dnode $hostname4 +sql create dnode $hostname port 7400 system sh/exec.sh -n dnode4 -s start $x = 0 -show7: +step7: $x = $x + 1 sleep 1000 - if $x == 40 then + if $x == 10 then + print ====> dnode not ready! return -1 endi - sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_1 != 0 then - goto show7 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +if $rows != 3 then + return -1 +endi +if $data(1)[4] != ready then + goto step7 endi -if $data2_3 != 2 then - goto show7 +if $data(3)[4] != ready then + goto step7 endi -if $data2_4 != 1 then - goto show7 +if $data(4)[4] != ready then + goto step7 +endi + +sql balance vgroup +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(3)[2] +print dnode2 openVnodes $data(4)[2] +if $data(1)[2] != 0 then + return -1 +endi +if $data(3)[2] != 2 then + return -1 +endi +if $data(4)[2] != 1 then + return -1 endi print ========== step8 -sql create database d4 +sql create database d4 vgroups 1 sql create table d4.t4 (t timestamp, i int) sql insert into d4.t4 values(now+1s, 45) sql insert into d4.t4 values(now+2s, 44) @@ -180,53 +200,39 @@ sql insert into d4.t4 values(now+3s, 43) sql insert into d4.t4 values(now+4s, 42) sql insert into d4.t4 values(now+5s, 41) -$x = 0 -show8: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_1 != 0 then - goto show8 +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(3)[2] +print dnode2 openVnodes $data(4)[2] +if $data(1)[2] != 0 then + return -1 endi -if $data2_3 != 2 then - goto show8 +if $data(3)[2] != 2 then + return -1 endi -if $data2_4 != 2 then - goto show8 +if $data(4)[2] != 2 then + return -1 endi print ========== step9 -sql drop dnode $hostname3 - -$x = 0 -show9: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - +sql drop dnode 3 sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_1 != 0 then - goto show9 +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(3)[2] +print dnode2 openVnodes $data(4)[2] +if $data(1)[2] != 1 then + return -1 endi -if $data2_3 != null then - goto show9 +if $data(3)[2] != null then + return -1 endi -if $data2_4 != 4 then - goto show9 +if $data(4)[2] != 3 then + return -1 endi -system sh/exec.sh -n dnode3 -s stop +system sh/exec.sh -n dnode3 -s stop -x SIGINT +sql reset query cache +sleep 100 print ========== step10 sql select * from d1.t1 order by t desc diff --git a/tests/script/unique/vnode/back_insert.sim b/tests/script/tsim/vnode/back_insert.sim similarity index 100% rename from tests/script/unique/vnode/back_insert.sim rename to tests/script/tsim/vnode/back_insert.sim diff --git a/tests/script/unique/vnode/back_insert_many.sim b/tests/script/tsim/vnode/back_insert_many.sim similarity index 100% rename from tests/script/unique/vnode/back_insert_many.sim rename to tests/script/tsim/vnode/back_insert_many.sim diff --git a/tests/script/tsim/vnode/replica3_basic.sim b/tests/script/tsim/vnode/replica3_basic.sim new file mode 100644 index 0000000000000000000000000000000000000000..f7dd5dd13633fb080cb46e2731695b8c2c649eec --- /dev/null +++ b/tests/script/tsim/vnode/replica3_basic.sim @@ -0,0 +1,368 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 +system sh/deploy.sh -n dnode3 -i 3 + +print ========== step0 +system sh/exec.sh -n dnode1 -s start +sql connect + +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 +system sh/exec.sh -n dnode2 -s start +system sh/exec.sh -n dnode3 -s start + +$x = 0 +step01: + $x = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +if $rows != 3 then + return -1 +endi +if $data(1)[4] != ready then + goto step01 +endi +if $data(2)[4] != ready then + goto step01 +endi +if $data(3)[4] != ready then + goto step01 +endi + +sql create mnode on dnode 2 +sql create mnode on dnode 3 + +$x = 0 +step02: + $x = $x + 1 + sleep 1000 + if $x == 20 then + return -1 + endi +sql show mnodes +print $data(1)[0] $data(1)[1] $data(1)[2] +print $data(2)[0] $data(2)[1] $data(2)[2] +print $data(3)[0] $data(3)[1] $data(3)[2] + +if $rows != 3 then + return -1 +endi +if $data(1)[0] != 1 then + return -1 +endi +if $data(1)[2] != leader then + return -1 +endi +if $data(2)[0] != 2 then + return -1 +endi +if $data(2)[2] != follower then + goto step02 +endi +if $data(3)[0] != 3 then + return -1 +endi +if $data(3)[2] != follower then + goto step02 +endi + +$N = 10 +$table = table_r3 +$db = db1 + +print =================== step 1 +sql create database $db replica 3 vgroups 1 +sql use $db + +$x = 0 +step1: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show vgroups -x step1 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step1 +endi + +sql use $db +sql create table $table (ts timestamp, speed int) + +print =================== step2 +$x = 1 +$y = $x + $N +$expect = $N +while $x < $y + $ms = $x . m + sql insert into $table values (now + $ms , $x ) + $x = $x + 1 +endw + +sql select * from $table +print sql select * from $table -> $rows points +if $rows != $expect then + return -1 +endi + +print =================== step3 +system sh/exec.sh -n dnode2 -s stop +$x = 0 +step3: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show vgroups -x step3 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step3 +endi + +$y = $x + $N +$expect = $N * 2 +while $x < $y + $ms = $x . m + sql insert into $table values (now + $ms , $x ) + $x = $x + 1 +endw + +print sql select * from $table -> $rows points +#if $rows != $expect then +# return -1 +#endi + +print =================== step4 +system sh/exec.sh -n dnode2 -s start +$x = 0 +step4: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show vgroups -x step4 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step4 +endi + +$y = $x + $N +$expect = $N * 3 +while $x < $y + $ms = $x . m + sql insert into $table values (now + $ms , $x ) + $x = $x + 1 +endw + +sql select * from $table +print sql select * from $table -> $rows points +#if $rows != $expect then +# return -1 +#endi + +print =================== step5 +system sh/exec.sh -n dnode3 -s stop +$x = 0 +step5: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show vgroups -x step5 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step5 +endi + +$y = $x + $N +$expect = $N * 4 +while $x < $y + $ms = $x . m + sql insert into $table values (now + $ms , 10) + $x = $x + 1 +endw + +sql select * from $table +print sql select * from $table -> $rows points +#if $rows != $expect then +# return -1 +#endi + +print =================== step6 +system sh/exec.sh -n dnode3 -s start +$x = 0 +step6: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show vgroups -x step6 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step6 +endi + +$y = $x + $N +$expect = $N * 5 +while $x < $y +$ms = $x . m +sql insert into $table values (now + $ms , $x ) +$x = $x + 1 +endw + +sql select * from $table +print sql select * from $table -> $rows points +#if $rows != $expect then +# return -1 +#endi + +print =================== step7 +system sh/exec.sh -n dnode1 -s stop +$x = 0 +step7: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show vgroups -x step7 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step7 +endi + +$y = $x + $N +$expect = $N * 6 +while $x < $y +$ms = $x . m +sql insert into $table values (now + $ms , 10) +$x = $x + 1 +endw + +sql select * from $table +print sql select * from $table -> $rows points +#if $rows != $expect then +# return -1 +#endi + +print =================== step 8 +system sh/exec.sh -n dnode1 -s start +$x = 0 +step8: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show vgroups -x step8 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step8 +endi + +$y = $x + $N +$expect = $N * 7 +while $x < $y + $ms = $x . m + sql insert into $table values (now + $ms , 10) + $x = $x + 1 +endw + +print sql select * from $table -> $rows points +#if $rows != $expect then +# return -1 +#endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec.sh -n dnode3 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/vnode/replica3_import.sim b/tests/script/tsim/vnode/replica3_import.sim new file mode 100644 index 0000000000000000000000000000000000000000..d1e73b9f27e58d3cb9068af43fdd73ed9ac1562e --- /dev/null +++ b/tests/script/tsim/vnode/replica3_import.sim @@ -0,0 +1,338 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 +system sh/deploy.sh -n dnode3 -i 3 +system sh/deploy.sh -n dnode4 -i 4 +system sh/deploy.sh -n dnode5 -i 5 +system sh/deploy.sh -n dnode6 -i 6 +system sh/cfg.sh -n dnode1 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode2 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode3 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode4 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode5 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode6 -c supportVnodes -v 4 + +print ========== step1 +system sh/exec.sh -n dnode1 -s start +sql connect + +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 +sql create dnode $hostname port 7400 +system sh/exec.sh -n dnode2 -s start +system sh/exec.sh -n dnode3 -s start +system sh/exec.sh -n dnode4 -s start + +$x = 0 +stepa: + $x = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 +if $rows != 4 then + return -1 +endi +if $data(1)[4] != ready then + goto stepa +endi +if $data(2)[4] != ready then + goto stepa +endi +if $data(3)[4] != ready then + goto stepa +endi +if $data(4)[4] != ready then + goto stepa +endi + +sql create database ir3db replica 3 duration 7 vgroups 1 +sql use ir3db +$x = 0 +stepb: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show vgroups +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $rows != 1 then + return -1 +endi +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto stepb +endi + +sql create table tb(ts timestamp, i bigint) + +print ================= step1 +sql insert into tb values(1520000010000, 1520000010000) +sql select * from tb; +print $rows +if $rows != 1 then + return -1 +endi + +print ================= step2 +sql insert into tb values(1520000008000, 1520000008000) +print $rows +sql select * from tb; +if $rows != 2 then + return -1 +endi + +print ================= step3 +sql insert into tb values(1520000020000, 1520000020000) +sql select * from tb; +print $rows +if $rows != 3 then + return -1 +endi + +print ================= step4 +sql insert into tb values(1520000009000, 1520000009000) +sql insert into tb values(1520000015000, 1520000015000) +sql insert into tb values(1520000030000, 1520000030000) +sql select * from tb; +print $rows +if $rows != 6 then + return -1 +endi + +print ================= step5 +sql insert into tb values(1520000008000, 1520000008000) +sql insert into tb values(1520000014000, 1520000014000) +sql insert into tb values(1520000025000, 1520000025000) +sql insert into tb values(1520000040000, 1520000040000) +sql select * from tb; +print $rows +if $rows != 9 then + return -1 +endi + +print ================= step6 +sql insert into tb values(1520000007000, 1520000007000) +sql insert into tb values(1520000012000, 1520000012000) +sql insert into tb values(1520000023000, 1520000023000) +sql insert into tb values(1520000034000, 1520000034000) +sql insert into tb values(1520000050000, 1520000050000) +sql select * from tb; +print $rows +if $rows != 14 then + return -1 +endi + +print ================== step7 +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s start +$x = 0 +step7: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show vgroups -x step7 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step7 +endi + +print ================= step7 +sql insert into tb values(1520000007001, 1520000007001) +sql insert into tb values(1520000012001, 1520000012001) +sql insert into tb values(1520000023001, 1520000023001) +sql insert into tb values(1520000034001, 1520000034001) +sql insert into tb values(1520000050001, 1520000050001) +sql select * from tb; +print $rows +if $rows != 19 then + print expect 19, actual: $rows + return -1 +endi + +print ================= step8 +sql insert into tb values(1520000008002, 1520000008002) +sql insert into tb values(1520000014002, 1520000014002) +sql insert into tb values(1520000025002, 1520000025002) +sql insert into tb values(1520000060000, 1520000060000) +sql select * from tb; +print $rows +if $rows != 23 then + return -1 +endi + +print ================= step9 +sql insert into tb values(1517408000000, 1517408000000) +sql insert into tb values(1518272000000, 1518272000000) +sql insert into tb values(1519136000000, 1519136000000) +sql insert into tb values(1519568000000, 1519568000000) +sql insert into tb values(1519654400000, 1519654400000) +sql insert into tb values(1519827200000, 1519827200000) +sql insert into tb values(1520345600000, 1520345600000) +sql insert into tb values(1520691200000, 1520691200000) +sql insert into tb values(1520864000000, 1520864000000) +sql insert into tb values(1521900800000, 1521900800000) +sql insert into tb values(1523110400000, 1523110400000) +sql insert into tb values(1521382400000, 1521382400000) +sql select * from tb; +print $rows +if $rows != 35 then + return -1 +endi + +print ================= step10 +system sh/exec.sh -n dnode3 -s stop -x SIGINT +system sh/exec.sh -n dnode3 -s start +$x = 0 +step10: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show vgroups -x step10 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step10 +endi + +sql select * from tb; +print $rows +if $rows != 35 then + return -1 +endi + +print ================= step11 +sql insert into tb values(1515680000000, 1) (1515852800000, 2) (1516025600000, 3) (1516198400000, 4) (1516371200000, 5) +sql select * from tb; +if $rows != 40 then + return -1 +endi + +print ================= step12 +sql insert into tb values(1518358400000, 6) (1518444800000, 7) (1518531200000, 8) (1518617600000, 9) (1518704000000, 10) (1518790400000, 11) (1518876800000, 12) (1518963200000, 13) (1519049600000, 14) +sql select * from tb; +print $rows +if $rows != 49 then + return -1 +endi + +print ================= step13 +system sh/exec.sh -n dnode4 -s stop -x SIGINT +system sh/exec.sh -n dnode4 -s start +$x = 0 +step13: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show vgroups -x step13 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step13 +endi + +print ================= step14 +sql insert into tb values(1515852800001, -48) +sql insert into tb values(1516716800000, -38) +sql insert into tb values(1517580800000, -28) + +sql select * from tb; +print $rows +if $rows != 52 then + return -1 +endi + +print ================= step15 +system sh/exec.sh -n dnode3 -s stop -x SIGINT +system sh/exec.sh -n dnode3 -s start +$x = 0 +step15: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show vgroups -x step15 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step15 +endi + +sql select * from tb; +if $rows != 52 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec.sh -n dnode3 -s stop -x SIGINT +system sh/exec.sh -n dnode4 -s stop -x SIGINT +system sh/exec.sh -n dnode5 -s stop -x SIGINT +system sh/exec.sh -n dnode6 -s stop -x SIGINT +system sh/exec.sh -n dnode7 -s stop -x SIGINT +system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/vnode/replica3_many.sim b/tests/script/tsim/vnode/replica3_many.sim new file mode 100644 index 0000000000000000000000000000000000000000..4fd3e39fdf718c0f77a70d48f6da9742a3be8795 --- /dev/null +++ b/tests/script/tsim/vnode/replica3_many.sim @@ -0,0 +1,248 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 +system sh/deploy.sh -n dnode3 -i 3 +system sh/deploy.sh -n dnode4 -i 4 + +print ========== step0 +system sh/exec.sh -n dnode1 -s start +sql connect + +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 +sql create dnode $hostname port 7400 +system sh/exec.sh -n dnode2 -s start +system sh/exec.sh -n dnode3 -s start +system sh/exec.sh -n dnode4 -s start + +$x = 0 +step0: + $x = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 +if $rows != 4 then + return -1 +endi +if $data(1)[4] != ready then + goto step0 +endi +if $data(2)[4] != ready then + goto step0 +endi +if $data(3)[4] != ready then + goto step0 +endi +if $data(4)[4] != ready then + goto step0 +endi + +print ========= step1 +sql create database db1 replica 3 vgroups 1 +sql create database db2 replica 3 vgroups 1 +sql create database db3 replica 3 vgroups 1 +sql create database db4 replica 3 vgroups 1 + +print =============== step12 wait vgroup2 +$x = 0 +step12: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show d1.vgroups +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $rows != 1 then + return -1 +endi +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step12 +endi + +print =============== step13 wait vgroup3 +$x = 0 +step13: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show d1.vgroups +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $rows != 1 then + return -1 +endi +if $data(3)[4] == leader then + $leaderExist = 1 +endi +if $data(3)[6] == leader then + $leaderExist = 1 +endi +if $data(3)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step13 +endi + +print =============== step14 wait vgroup4 +$x = 0 +step14: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show d1.vgroups +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $data(4)[4] == leader then + $leaderExist = 1 +endi +if $data(4)[6] == leader then + $leaderExist = 1 +endi +if $data(4)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step14 +endi + +print =============== step15 wait vgroup5 +$x = 0 +step15: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show d1.vgroups +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $data(4)[4] == leader then + $leaderExist = 1 +endi +if $data(4)[6] == leader then + $leaderExist = 1 +endi +if $data(4)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step15 +endi + +print =============== step16: create table +sql create table db1.tb1 (ts timestamp, i int) +sql create table db2.tb2 (ts timestamp, i int) +sql create table db3.tb3 (ts timestamp, i int) +sql create table db4.tb4 (ts timestamp, i int) +sql insert into db1.tb1 values(now, 1) +sql insert into db2.tb2 values(now, 1) +sql insert into db3.tb3 values(now, 1) +sql insert into db4.tb4 values(now, 1) + +sql select count(*) from db1.tb1 +$lastRows1 = $rows +sql select count(*) from db2.tb2 +$lastRows2 = $rows +sql select count(*) from db3.tb3 +$lastRows3 = $rows +sql select count(*) from db4.tb4 +$lastRows4 = $rows + +print ======== step2 +run_back tsim/vnode/back_insert_many.sim +sleep 3000 + +$x = 0 +loop: + +print ======== step3 +system sh/exec.sh -n dnode2 -s stop +sleep 3000 +system sh/exec.sh -n dnode2 -s start +sleep 3000 + +print ======== step4 +system sh/exec.sh -n dnode3 -s stop +sleep 3000 +system sh/exec.sh -n dnode3 -s start +sleep 3000 + +print ======== step5 +system sh/exec.sh -n dnode2 -s stop +sleep 3000 +system sh/exec.sh -n dnode2 -s start +sleep 3000 + +print ======== step6 +sql select count(*) from db1.tb1 +print select count(*) from db1.tb1 ==> $data00 $lastRows1 +if $data00 <= $lastRows1 then + return -1 +endi +$lastRows1 = $data00 + +sql select count(*) from db2.tb2 +print select count(*) from db2.tb2 ==> $data00 $lastRows2 +if $data00 <= $lastRows2 then + return -1 +endi +$lastRows2 = $data00 + +sql select count(*) from db3.tb3 +print select count(*) from db3.tb3 ==> $data00 $lastRows3 +if $data00 <= $lastRows3 then + return -1 +endi +$lastRows3 = $data00 + +sql select count(*) from db4.tb4 +print select count(*) from db4.tb4 ==> $data00 $lastRows4 +if $data00 <= $lastRows4 then + return -1 +endi +$lastRows4 = $data00 + +print ======== step7 + +print ======== loop Times $x + +if $x < 2 then + $x = $x + 1 + goto loop +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec.sh -n dnode3 -s stop -x SIGINT +system sh/exec.sh -n dnode4 -s stop -x SIGINT +system sh/exec.sh -n dnode5 -s stop -x SIGINT +system sh/exec.sh -n dnode6 -s stop -x SIGINT +system sh/exec.sh -n dnode7 -s stop -x SIGINT +system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/vnode/replica3_repeat.sim b/tests/script/tsim/vnode/replica3_repeat.sim similarity index 58% rename from tests/script/unique/vnode/replica3_repeat.sim rename to tests/script/tsim/vnode/replica3_repeat.sim index 636bc64f89948a8bd4ec0d3dc9dc2a1b10f50e00..741913927757532909ca7597f1f11b3d93f8f196 100644 --- a/tests/script/unique/vnode/replica3_repeat.sim +++ b/tests/script/tsim/vnode/replica3_repeat.sim @@ -1,77 +1,84 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode4 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 +print ========== step0 system sh/exec.sh -n dnode1 -s start - sql connect -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 + +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 +sql create dnode $hostname port 7400 system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start system sh/exec.sh -n dnode4 -s start - $x = 0 -step1: +step0: $x = $x + 1 sleep 1000 if $x == 10 then + print ====> dnode not ready! return -1 endi - sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step1 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 +if $rows != 4 then + return -1 endi -if $data4_2 != ready then - goto step1 +if $data(1)[4] != ready then + goto step0 endi -if $data4_3 != ready then - goto step1 +if $data(2)[4] != ready then + goto step0 endi -if $data4_4 != ready then - goto step1 +if $data(3)[4] != ready then + goto step0 +endi +if $data(4)[4] != ready then + goto step0 endi -sql show mnodes -print mnode1 $data2_1 -print mnode1 $data2_2 -print mnode1 $data2_3 -if $data2_1 != master then +print ========= step1 +sql create database db replica 3 vgroups 1 +$x = 0 +step1: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show db.vgroups +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +if $rows != 4 then + return -1 +endi +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then goto step1 endi -print ========= step1 -sql create database db replica 3 sql create table db.tb (ts timestamp, i int) sql insert into db.tb values(now, 1) sql select count(*) from db.tb $lastRows = $rows print ======== step2 -run_back unique/vnode/back_insert.sim +run_back tsim/vnode/back_insert.sim sleep 2000 print ======== step3 diff --git a/tests/script/tsim/vnode/replica3_vgroup.sim b/tests/script/tsim/vnode/replica3_vgroup.sim new file mode 100644 index 0000000000000000000000000000000000000000..746a9d67ae2199cf72b6876ef014b707b31b1ce7 --- /dev/null +++ b/tests/script/tsim/vnode/replica3_vgroup.sim @@ -0,0 +1,129 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 +system sh/deploy.sh -n dnode3 -i 3 +system sh/deploy.sh -n dnode4 -i 4 + +print ========== step0 +system sh/exec.sh -n dnode1 -s start +sql connect + +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 +sql create dnode $hostname port 7400 +system sh/exec.sh -n dnode2 -s start +system sh/exec.sh -n dnode3 -s start +system sh/exec.sh -n dnode4 -s start + +$x = 0 +step0: + $x = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 +if $rows != 4 then + return -1 +endi +if $data(1)[4] != ready then + goto step0 +endi +if $data(2)[4] != ready then + goto step0 +endi +if $data(3)[4] != ready then + goto step0 +endi +if $data(4)[4] != ready then + goto step0 +endi + +$N = 10 +$table = table_r3 +$db = db1 + +print =================== step 1 +sql create database $db replica 3 vgroups 2 +sql use $db + +$x = 0 +step1: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show vgroups +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19 +if $rows != 2 then + return -1 +endi +$leaderExist = 0 +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step1 +endi +$leaderExist = 0 +if $data(3)[4] == leader then + $leaderExist = 1 +endi +if $data(3)[6] == leader then + $leaderExist = 1 +endi +if $data(3)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step1 +endi + +sql create table st (ts timestamp, speed int) tags (t1 int) + +$tbPre = m +$N = 300 +$x = 0 +$y = $x + $N +while $x < $y + $table = $tbPre . $x + sql create table $table using st tags ( $x ) + $ms = $x . m + sql insert into $table values (now + $ms , $x ) + $x = $x + 1 +endw + +#print =================== step2 +$x = -500 +$y = $x + $N +while $x < $y + $ms = $x . m + sql insert into $table values (now $ms , $x ) + $x = $x + 1 +endw + +$expect = $N + 1 +sql select * from $table +print sql select * from $table -> $rows points expect $expect +if $rows != $expect then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec.sh -n dnode3 -s stop -x SIGINT +system sh/exec.sh -n dnode4 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/stable/balance_replica1.sim b/tests/script/tsim/vnode/stable_balance_replica1.sim similarity index 60% rename from tests/script/unique/stable/balance_replica1.sim rename to tests/script/tsim/vnode/stable_balance_replica1.sim index 3ea158eb39c0d560900b34d5465fc1ef12a4b42f..dfc8de516040ee5835de2874d209d2f830e3b9e4 100644 --- a/tests/script/unique/stable/balance_replica1.sim +++ b/tests/script/tsim/vnode/stable_balance_replica1.sim @@ -1,16 +1,12 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 -system sh/cfg.sh -n dnode1 -c statusInterval -v 1 -system sh/cfg.sh -n dnode2 -c statusInterval -v 1 -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 +system sh/deploy.sh -n dnode3 -i 3 +system sh/deploy.sh -n dnode4 -i 4 +system sh/cfg.sh -n dnode1 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode2 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode3 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode4 -c supportVnodes -v 4 $dbPrefix = br1_db $tbPrefix = br1_tb @@ -29,7 +25,7 @@ $db = $dbPrefix $mt = $mtPrefix $st = $stPrefix . $i -sql create database $db +sql create database $db vgroups 4 sql use $db sql create table $mt (ts timestamp, tbcol int, tbcol2 float) TAGS(tgcol int) @@ -54,51 +50,47 @@ endw sleep 100 print =============== step2 - -$x = 0 -show1: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi -sql show dnodes -x show1 -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode2Vnodes = $data2_2 -print dnode2 $dnode2Vnodes - -if $dnode1Vnodes != 4 then - goto show1 -endi -if $dnode2Vnodes != null then - goto show1 +sql show dnodes +print dnode1 openVnodes $data(1)[2] +if $data(1)[2] != 4 then + return -1 endi + print =============== step3 start dnode2 -sql create dnode $hostname2 +sql create dnode $hostname port 7200 system sh/exec.sh -n dnode2 -s start -sleep 8000 $x = 0 -show2: +step3: $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 + sleep 1000 + if $x == 10 then + print ====> dnode not ready! + return -1 endi -sql show dnodes -x show2 -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode2Vnodes = $data2_2 -print dnode2 $dnode2Vnodes - -if $dnode1Vnodes != 2 then - goto show2 +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +if $rows != 2 then + return -1 endi -if $dnode2Vnodes != 2 then - goto show2 +if $data(1)[4] != ready then + goto step3 +endi +if $data(2)[4] != ready then + goto step3 endi +sql balance vgroup +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(2)[2] +if $data(1)[2] != 2 then + return -1 +endi +if $data(2)[2] != 2 then + return -1 +endi print =============== step4 $i = 1 diff --git a/tests/script/unique/stable/dnode2.sim b/tests/script/tsim/vnode/stable_dnode2.sim similarity index 73% rename from tests/script/unique/stable/dnode2.sim rename to tests/script/tsim/vnode/stable_dnode2.sim index 3ca8c4ee20bb74890da8f42c73521186306e3097..c29d9607061d2500410cc5cc49275d4eb93ab6b8 100644 --- a/tests/script/unique/stable/dnode2.sim +++ b/tests/script/tsim/vnode/stable_dnode2.sim @@ -1,28 +1,40 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/cfg.sh -n dnode2 -c walLevel -v 1 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 +system sh/deploy.sh -n dnode3 -i 3 +system sh/deploy.sh -n dnode4 -i 4 +system sh/cfg.sh -n dnode1 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode2 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode3 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode4 -c supportVnodes -v 4 + +print ========== step1 system sh/exec.sh -n dnode1 -s start - sql connect -sql create dnode $hostname2 +sql create dnode $hostname port 7200 system sh/exec.sh -n dnode2 -s start $x = 0 -createDnode: +step1: $x = $x + 1 sleep 1000 - if $x == 20 then - return -1 + if $x == 10 then + print ====> dnode not ready! + return -1 endi -sql show dnodes; -if $data4_2 == offline then - goto createDnode -endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +if $rows != 2 then + return -1 +endi +if $data(1)[4] != ready then + goto step1 +endi +if $data(2)[4] != ready then + goto step1 +endi print ======================== dnode1 start @@ -38,7 +50,7 @@ $i = 0 $db = $dbPrefix . $i $mt = $mtPrefix . $i -sql create database $db +sql create database $db vgroups 3 sql use $db sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) @@ -97,20 +109,20 @@ if $data00 != $rowNum then endi print =============== step5 -sql select count(tbcol) as b from $tb interval(1m) +sql select _wstartts, count(tbcol) as b from $tb interval(1m) print ===> $data01 if $data01 != 1 then return -1 endi -sql select count(tbcol) as b from $tb interval(1d) +sql select _wstartts, count(tbcol) as b from $tb interval(1d) print ===> $data01 if $data01 != $rowNum then return -1 endi print =============== step6 -sql select count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) +sql select _wstartts, count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) print ===> $data01 if $data01 != 1 then return -1 @@ -152,13 +164,13 @@ if $data00 != 25 then endi print =============== step9 -sql select count(tbcol) as b from $mt interval(1m) +sql select _wstartts, count(tbcol) as b from $mt interval(1m) print ===> $data01 if $data01 != 10 then return -1 endi -sql select count(tbcol) as b from $mt interval(1d) +sql select _wstartts, count(tbcol) as b from $mt interval(1d) print ===> $data01 if $data01 != 200 then return -1 @@ -175,20 +187,10 @@ if $rows != $tbNum then return -1 endi -print =============== step11 -sql select count(tbcol) as b from $mt where ts <= 1519833840000 interval(1m) group by tgcol -print ===> $data01 -if $data01 != 1 then - return -1 -endi -if $rows != 50 then - return -1 -endi - print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi @@ -196,7 +198,4 @@ system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec.sh -n dnode3 -s stop -x SIGINT system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode5 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/stable/dnode2_stop.sim b/tests/script/tsim/vnode/stable_dnode2_stop.sim similarity index 64% rename from tests/script/unique/stable/dnode2_stop.sim rename to tests/script/tsim/vnode/stable_dnode2_stop.sim index c10f04338d894106a6a543a872af69da9e49bae5..113cf27e17aa23112ec6c2a088a0a8cb5f1d7b8a 100644 --- a/tests/script/unique/stable/dnode2_stop.sim +++ b/tests/script/tsim/vnode/stable_dnode2_stop.sim @@ -1,27 +1,40 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 +system sh/deploy.sh -n dnode3 -i 3 +system sh/deploy.sh -n dnode4 -i 4 +system sh/cfg.sh -n dnode1 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode2 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode3 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode4 -c supportVnodes -v 4 + +print ========== step1 system sh/exec.sh -n dnode1 -s start - sql connect -sql create dnode $hostname2 + +sql create dnode $hostname port 7200 system sh/exec.sh -n dnode2 -s start $x = 0 -createDnode: +step1: $x = $x + 1 sleep 1000 - if $x == 20 then - return -1 + if $x == 10 then + print ====> dnode not ready! + return -1 endi -sql show dnodes; -if $data4_2 == offline then - goto createDnode -endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +if $rows != 2 then + return -1 +endi +if $data(1)[4] != ready then + goto step1 +endi +if $data(2)[4] != ready then + goto step1 +endi print ======================== dnode1 start @@ -43,7 +56,7 @@ $i = 0 $db = $dbPrefix . $i $mt = $mtPrefix . $i -sql create database $db +sql create database $db vgroups 3 sql use $db sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) @@ -72,7 +85,6 @@ endi sleep 100 system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 3000 print =============== step2 sql select count(*) from $mt -x step2 @@ -84,7 +96,27 @@ sql select count(tbcol) from $mt -x step21 step21: system sh/exec.sh -n dnode2 -s start -sleep 3000 + +$x = 0 +dnode2: + $x = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +if $rows != 2 then + return -1 +endi +if $data(1)[4] != ready then + goto dnode2 +endi +if $data(2)[4] != ready then + goto dnode2 +endi print =============== step3 sql select count(tbcol) as c from $mt where ts <= 1519833840000 @@ -106,13 +138,13 @@ if $data00 != 25 then endi print =============== step4 -sql select count(tbcol) as b from $mt interval(1m) +sql select _wstartts, count(tbcol) as b from $mt interval(1m) print ===> $data01 if $data01 != 10 then return -1 endi -sql select count(tbcol) as b from $mt interval(1d) +sql select _wstartts, count(tbcol) as b from $mt interval(1d) print ===> $data01 if $data01 != 200 then return -1 @@ -129,28 +161,14 @@ if $rows != $tbNum then return -1 endi -print =============== step6 -sql select count(tbcol) as b from $mt where ts <= 1519833840000 interval(1m) group by tgcol -print ===> $data01 -if $data01 != 1 then - return -1 -endi -if $rows != 50 then - return -1 -endi - print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode4 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/stable/replica2_vnode3.sim b/tests/script/tsim/vnode/stable_dnode3.sim similarity index 70% rename from tests/script/unique/stable/replica2_vnode3.sim rename to tests/script/tsim/vnode/stable_dnode3.sim index 47d45c3d3d7d7a4e32cf94fd8cf4d7dcb0b53477..ae777b994251b380d373e724ab677e2d3beeca9f 100644 --- a/tests/script/unique/stable/replica2_vnode3.sim +++ b/tests/script/tsim/vnode/stable_dnode3.sim @@ -1,33 +1,50 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 +system sh/deploy.sh -n dnode3 -i 3 +system sh/deploy.sh -n dnode4 -i 4 +system sh/cfg.sh -n dnode1 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode2 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode3 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode4 -c supportVnodes -v 4 + +print ========== step1 system sh/exec.sh -n dnode1 -s start - sql connect -sql create dnode $hostname2 + +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 system sh/exec.sh -n dnode2 -s start +system sh/exec.sh -n dnode3 -s start $x = 0 -createDnode: +step1: $x = $x + 1 sleep 1000 - if $x == 20 then - return -1 + if $x == 10 then + print ====> dnode not ready! + return -1 endi -sql show dnodes; -if $data4_2 == offline then - goto createDnode -endi - +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +if $rows != 3 then + return -1 +endi +if $data(1)[4] != ready then + goto step1 +endi +if $data(2)[4] != ready then + goto step1 +endi +if $data(3)[4] != ready then + goto step1 +endi + print ======================== dnode1 start - -$dbPrefix = r2v3_db -$tbPrefix = r2v3_tb -$mtPrefix = r2v3_mt +$dbPrefix = d3_db +$tbPrefix = d3_tb +$mtPrefix = d3_mt $tbNum = 10 $rowNum = 20 $totalNum = 200 @@ -37,7 +54,7 @@ $i = 0 $db = $dbPrefix . $i $mt = $mtPrefix . $i -sql create database $db replica 2 +sql create database $db vgroups 3 sql use $db sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) @@ -46,7 +63,7 @@ while $i < $tbNum $tb = $tbPrefix . $i sql create table $tb using $mt tags( $i ) - $x = 0 + $x = 0 while $x < $rowNum $val = $x * 60000 $ms = 1519833600000 + $val @@ -94,20 +111,20 @@ if $data00 != $rowNum then endi print =============== step5 -sql select count(tbcol) as b from $tb interval(1m) +sql select _wstartts, count(tbcol) as b from $tb interval(1m) print ===> $data01 if $data01 != 1 then return -1 endi -sql select count(tbcol) as b from $tb interval(1d) +sql select _wstartts, count(tbcol) as b from $tb interval(1d) print ===> $data01 if $data01 != $rowNum then return -1 endi print =============== step6 -sql select count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) +sql select _wstartts, count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) print ===> $data01 if $data01 != 1 then return -1 @@ -149,13 +166,13 @@ if $data00 != 25 then endi print =============== step9 -sql select count(tbcol) as b from $mt interval(1m) +sql select _wstartts, count(tbcol) as b from $mt interval(1m) print ===> $data01 if $data01 != 10 then return -1 endi -sql select count(tbcol) as b from $mt interval(1d) +sql select _wstartts, count(tbcol) as b from $mt interval(1d) print ===> $data01 if $data01 != 200 then return -1 @@ -172,20 +189,10 @@ if $rows != $tbNum then return -1 endi -print =============== step11 -sql select count(tbcol) as b from $mt where ts <= 1519833840000 interval(1m) group by tgcol -print ===> $data01 -if $data01 != 1 then - return -1 -endi -if $rows != 50 then - return -1 -endi -return print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi @@ -193,7 +200,3 @@ system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec.sh -n dnode3 -s stop -x SIGINT system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/stable/replica3_dnode6.sim b/tests/script/tsim/vnode/stable_replica3_dnode6.sim similarity index 66% rename from tests/script/unique/stable/replica3_dnode6.sim rename to tests/script/tsim/vnode/stable_replica3_dnode6.sim index eeffb86cdbeefaeaf351ec5be3743e53136692ec..aea5b88fedd9e943752f5e597b1a6dc96cbee61e 100644 --- a/tests/script/unique/stable/replica3_dnode6.sim +++ b/tests/script/tsim/vnode/stable_replica3_dnode6.sim @@ -5,29 +5,22 @@ system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 system sh/deploy.sh -n dnode5 -i 5 system sh/deploy.sh -n dnode6 -i 6 - -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 -system sh/cfg.sh -n dnode5 -c walLevel -v 2 -system sh/cfg.sh -n dnode6 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode5 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode6 -c maxtablesPerVnode -v 4 - +system sh/cfg.sh -n dnode1 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode2 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode3 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode4 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode5 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode6 -c supportVnodes -v 4 + +print ========== step1 system sh/exec.sh -n dnode1 -s start sql connect -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -sql create dnode $hostname5 -sql create dnode $hostname6 +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 +sql create dnode $hostname port 7400 +sql create dnode $hostname port 7500 +sql create dnode $hostname port 7600 system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start system sh/exec.sh -n dnode4 -s start @@ -35,31 +28,41 @@ system sh/exec.sh -n dnode5 -s start system sh/exec.sh -n dnode6 -s start $x = 0 -createDnode: +step10: $x = $x + 1 sleep 1000 - if $x == 20 then - return -1 + if $x == 10 then + print ====> dnode not ready! + return -1 endi -sql show dnodes; -if $data4_2 == offline then - goto createDnode -endi -if $data4_3 == offline then - goto createDnode -endi -if $data4_4 == offline then - goto createDnode -endi -if $data4_5 == offline then - goto createDnode -endi -if $data4_6 == offline then - goto createDnode -endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 +if $rows != 6 then + return -1 +endi +if $data(1)[4] != ready then + goto step10 +endi +if $data(2)[4] != ready then + goto step10 +endi +if $data(3)[4] != ready then + goto step10 +endi +if $data(4)[4] != ready then + goto step10 +endi +if $data(5)[4] != ready then + goto step10 +endi +if $data(6)[4] != ready then + goto step10 +endi print ======================== dnode1 start - $dbPrefix = r3d6_db $tbPrefix = r3d6_tb $mtPrefix = r3d6_mt @@ -78,7 +81,7 @@ $i = 0 $db = $dbPrefix . $i $mt = $mtPrefix . $i -sql create database $db replica 3 +sql create database $db replica 3 vgroups 3 sql use $db sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) @@ -137,20 +140,20 @@ if $data00 != $rowNum then endi print =============== step5 -sql select count(tbcol) as b from $tb interval(1m) +sql select _wstartts, count(tbcol) as b from $tb interval(1m) print ===> $data01 if $data01 != 1 then return -1 endi -sql select count(tbcol) as b from $tb interval(1d) +sql select _wstartts, count(tbcol) as b from $tb interval(1d) print ===> $data01 if $data01 != $rowNum then return -1 endi print =============== step6 -sql select count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) +sql select _wstartts, count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) print ===> $data01 if $data01 != 1 then return -1 @@ -192,13 +195,13 @@ if $data00 != 25 then endi print =============== step9 -#sql select count(tbcol) as b from $mt interval(1m) +#sql select _wstartts, count(tbcol) as b from $mt interval(1m) #print ===> $data01 #if $data01 != 10 then # return -1 #endi -sql select count(tbcol) as b from $mt interval(1d) +sql select _wstartts, count(tbcol) as b from $mt interval(1d) print ===> $data01 if $data01 != 200 then return -1 @@ -215,23 +218,6 @@ if $rows != $tbNum then return -1 endi -print =============== step11 -sql select count(tbcol) as b from $mt where ts <= 1519833840000 interval(1m) group by tgcol -print ===> $data01 -if $data01 != 1 then - return -1 -endi -if $rows != 50 then - return -1 -endi -return -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi - system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec.sh -n dnode3 -s stop -x SIGINT diff --git a/tests/script/unique/stable/replica3_vnode3.sim b/tests/script/tsim/vnode/stable_replica3_vnode3.sim similarity index 68% rename from tests/script/unique/stable/replica3_vnode3.sim rename to tests/script/tsim/vnode/stable_replica3_vnode3.sim index bc700b7dda1cf95c96f16907fa207cd0c47819d1..8137b087f52b1585681da5aad8a3b9e0925eb5f0 100644 --- a/tests/script/unique/stable/replica3_vnode3.sim +++ b/tests/script/tsim/vnode/stable_replica3_vnode3.sim @@ -1,47 +1,58 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 +system sh/deploy.sh -n dnode5 -i 5 +system sh/deploy.sh -n dnode6 -i 6 +system sh/cfg.sh -n dnode1 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode2 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode3 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode4 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode5 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode6 -c supportVnodes -v 4 + +print ========== step1 system sh/exec.sh -n dnode1 -s start - sql connect -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 +sql create dnode $hostname port 7400 system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start system sh/exec.sh -n dnode4 -s start + $x = 0 -createDnode: +step10: $x = $x + 1 sleep 1000 - if $x == 20 then - return -1 + if $x == 10 then + print ====> dnode not ready! + return -1 endi -sql show dnodes; -if $data4_2 == offline then - goto createDnode -endi -if $data4_3 == offline then - goto createDnode -endi -if $data4_4 == offline then - goto createDnode -endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 +if $rows != 4 then + return -1 +endi +if $data(1)[4] != ready then + goto step10 +endi +if $data(2)[4] != ready then + goto step10 +endi +if $data(3)[4] != ready then + goto step10 +endi +if $data(4)[4] != ready then + goto step10 +endi print ======================== dnode1 start - $dbPrefix = r3v3_db $tbPrefix = r3v3_tb $mtPrefix = r3v3_mt @@ -54,7 +65,7 @@ $i = 0 $db = $dbPrefix . $i $mt = $mtPrefix . $i -sql create database $db replica 3 +sql create database $db replica 3 vgroups 3 sql use $db sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) @@ -113,20 +124,20 @@ if $data00 != $rowNum then endi print =============== step5 -sql select count(tbcol) as b from $tb interval(1m) +sql select _wstartts, count(tbcol) as b from $tb interval(1m) print ===> $data01 if $data01 != 1 then return -1 endi -sql select count(tbcol) as b from $tb interval(1d) +sql select _wstartts, count(tbcol) as b from $tb interval(1d) print ===> $data01 if $data01 != $rowNum then return -1 endi print =============== step6 -sql select count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) +sql select _wstartts, count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) print ===> $data01 if $data01 != 1 then return -1 @@ -169,13 +180,13 @@ if $data00 != 25 then endi print =============== step9 -sql select count(tbcol) as b from $mt interval(1m) +sql select _wstartts, count(tbcol) as b from $mt interval(1m) print ===> $data01 if $data01 != 10 then return -1 endi -sql select count(tbcol) as b from $mt interval(1d) +sql select _wstartts, count(tbcol) as b from $mt interval(1d) print ===> $data01 if $data01 != 200 then return -1 @@ -192,23 +203,6 @@ if $rows != $tbNum then return -1 endi -print =============== step11 -sql select count(tbcol) as b from $mt where ts <= 1519833840000 interval(1m) group by tgcol -print ===> $data01 -if $data01 != 1 then - return -1 -endi -if $rows != 50 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi - system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec.sh -n dnode3 -s stop -x SIGINT diff --git a/tests/script/unique/arbitrator/testSuite.sim b/tests/script/unique/arbitrator/testSuite.sim deleted file mode 100644 index 127a320e53db686a8109505d3299715edaa262e4..0000000000000000000000000000000000000000 --- a/tests/script/unique/arbitrator/testSuite.sim +++ /dev/null @@ -1,41 +0,0 @@ -run unique/arbitrator/check_cluster_cfg_para.sim -run unique/arbitrator/dn2_mn1_cache_file_sync.sim -run unique/arbitrator/dn3_mn1_full_createTableFail.sim -run unique/arbitrator/dn3_mn1_full_dropDnodeFail.sim -run unique/arbitrator/dn3_mn1_multiCreateDropTable.sim -run unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim -run unique/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim -run unique/arbitrator/dn3_mn1_replica_change_dropDnod.sim -run unique/arbitrator/dn3_mn1_replica_change.sim -run unique/arbitrator/dn3_mn1_stopDnode_timeout.sim -run unique/arbitrator/dn3_mn1_vnode_change.sim -run unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim -run unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim -run unique/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim -run unique/arbitrator/dn3_mn1_vnode_delDir.sim -run unique/arbitrator/dn3_mn1_r2_vnode_delDir.sim -run unique/arbitrator/dn3_mn1_r3_vnode_delDir.sim -run unique/arbitrator/dn3_mn1_vnode_nomaster.sim -run unique/arbitrator/dn3_mn2_killDnode.sim -run unique/arbitrator/insert_duplicationTs.sim -run unique/arbitrator/offline_replica2_alterTable_online.sim -run unique/arbitrator/offline_replica2_alterTag_online.sim -run unique/arbitrator/offline_replica2_createTable_online.sim -run unique/arbitrator/offline_replica2_dropDb_online.sim -run unique/arbitrator/offline_replica2_dropTable_online.sim -run unique/arbitrator/offline_replica3_alterTable_online.sim -run unique/arbitrator/offline_replica3_alterTag_online.sim -run unique/arbitrator/offline_replica3_createTable_online.sim -run unique/arbitrator/offline_replica3_dropDb_online.sim -run unique/arbitrator/offline_replica3_dropTable_online.sim -run unique/arbitrator/replica_changeWithArbitrator.sim -run unique/arbitrator/sync_replica2_alterTable_add.sim -run unique/arbitrator/sync_replica2_alterTable_drop.sim -run unique/arbitrator/sync_replica3_createTable.sim -run unique/arbitrator/sync_replica3_dnodeChang_DropAddAlterTableDropDb.sim -run unique/arbitrator/sync_replica2_dropDb.sim -run unique/arbitrator/sync_replica2_dropTable.sim -run unique/arbitrator/sync_replica3_alterTable_add.sim -run unique/arbitrator/sync_replica3_alterTable_drop.sim -run unique/arbitrator/sync_replica3_dropDb.sim -run unique/arbitrator/sync_replica3_dropTable.sim diff --git a/tests/script/unique/big/balance.sim b/tests/script/unique/big/balance.sim deleted file mode 100644 index f20939d458d512472cb822b44b5af0b378347017..0000000000000000000000000000000000000000 --- a/tests/script/unique/big/balance.sim +++ /dev/null @@ -1,399 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 4 -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 1000 - -system sh/deploy.sh -n dnode2 -i 2 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 4 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 1000 - -system sh/deploy.sh -n dnode3 -i 3 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 4 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 1000 - -system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 4 -system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 1000 - -system sh/deploy.sh -n dnode5 -i 5 -system sh/cfg.sh -n dnode5 -c maxVgroupsPerDb -v 4 -system sh/cfg.sh -n dnode5 -c maxTablesPerVnode -v 1000 - -print =============== prepare data -system sh/exec.sh -n dnode1 -s start -sql connect - -$i = 0 -$tbNum = 4000 -$rowNum = 1 -$totalNum = 4000 * $rowNum - -sql create database db -sql use db -sql create table mt (ts timestamp, tbcol int, tbcol2 float) TAGS(tgcol int) - -$i = 0 -$tbPrefix = t -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using mt tags( $i ) - $i = $i + 1 -endw - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql insert into $tb values (now, $i , $i ) - - $i = $i + 1 -endw - -print ========== step0 -sql show db.tables -if $rows != 4000 then - return -1 -endi - -sql select count(*) from t10 -print select count(*) from t10 $data00 expect $rowNum -if $data00 != $rowNum then - return -1 -endi - -sql select count(*) from t1010 -print select count(*) from t1010 $data00 expect $rowNum -if $data00 != $rowNum then - return -1 -endi - -sql select count(*) from t2010 -print select count(*) from t2010 $data00 expect $rowNum -if $data00 != $rowNum then - return -1 -endi - -sql select count(*) from t3010 -print select count(*) from t3010 $data00 expect $rowNum -if $data00 != $rowNum then - return -1 -endi - -sql select count(*) from mt -print select count(*) from mt $data00 expect $rowNum -if $data00 != $totalNum then - return -1 -endi - -print ========== step1 -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -show1: - $x = $x + 1 - sleep 1000 - if $x == 30 then - return -1 - endi - -sql show dnodes -print dnode1 openvnodes $data2_1 -print dnode2 openvnodes $data2_2 -if $data2_1 != 2 then - goto show1 -endi -if $data2_2 != 2 then - goto show1 -endi - -sql reset query cache -sleep 100 - -sql select count(*) from t10 -print select count(*) from t10 $data00 expect $rowNum -if $data00 != $rowNum then - goto show1 -endi - -sql select count(*) from t1010 -print select count(*) from t1010 $data00 expect $rowNum -if $data00 != $rowNum then - goto show1 -endi - -sql select count(*) from t2010 -print select count(*) from t2010 $data00 expect $rowNum -if $data00 != $rowNum then - goto show1 -endi - -sql select count(*) from t3010 -print select count(*) from t3010 $data00 expect $rowNum -if $data00 != $rowNum then - goto show1 -endi - -sql select count(*) from mt -print select count(*) from mt $data00 expect $rowNum -if $data00 != $totalNum then - goto show1 -endi - -print ========== step2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start - -print ========== step3 -sql drop dnode $hostname2 - -$x = 0 -show3: - $x = $x + 1 - sleep 1000 - if $x == 30 then - return -1 - endi - -sql show dnodes -print dnode1 freeVnodes $data2_1 -print dnode2 freeVnodes $data2_2 -print dnode3 freeVnodes $data2_3 -if $data2_1 != 2 then - goto show3 -endi -if $data2_2 != null then - goto show3 -endi -if $data2_3 != 2 then - goto show3 -endi - -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -sql reset query cache -sleep 100 - -sql select count(*) from t10 -print select count(*) from t10 $data00 expect $rowNum -if $data00 != $rowNum then - return -1 -endi - -sql select count(*) from t1010 -print select count(*) from t1010 $data00 expect $rowNum -if $data00 != $rowNum then - return -1 -endi - -sql select count(*) from t2010 -print select count(*) from t2010 $data00 expect $rowNum -if $data00 != $rowNum then - return -1 -endi - -sql select count(*) from t3010 -print select count(*) from t3010 $data00 expect $rowNum -if $data00 != $rowNum then - return -1 -endi - -sql select count(*) from mt -print select count(*) from mt $data00 expect $rowNum -if $data00 != $totalNum then - return -1 -endi - -print ========== step4 -sql drop dnode $hostname3 - -$x = 0 -show4: - $x = $x + 1 - sleep 1000 - if $x == 30 then - return -1 - endi - -sql show dnodes -print dnode1 freeVnodes $data2_1 -print dnode3 freeVnodes $data2_3 -if $data2_1 != 4 then - goto show4 -endi -if $data2_3 != null then - goto show4 -endi - -system sh/exec.sh -n dnode3 -s stop -x SIGINT - -sql reset query cache -sleep 100 - -sql select count(*) from t10 -print select count(*) from t10 $data00 expect $rowNum -if $data00 != $rowNum then - return -1 -endi - -sql select count(*) from t1010 -print select count(*) from t1010 $data00 expect $rowNum -if $data00 != $rowNum then - return -1 -endi - -sql select count(*) from t2010 -print select count(*) from t2010 $data00 expect $rowNum -if $data00 != $rowNum then - return -1 -endi - -sql select count(*) from t3010 -print select count(*) from t3010 $data00 expect $rowNum -if $data00 != $rowNum then - return -1 -endi - -sql select count(*) from mt -print select count(*) from mt $data00 expect $rowNum -if $data00 != $totalNum then - return -1 -endi - -print ========== step5 -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname4 - -$x = 0 -step5: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_4 != ready then - goto step5 -endi - -sql alter database db replica 2 - -$x = 0 -show5: - $x = $x + 1 - sleep 1000 - if $x == 30 then - return -1 - endi - -sql show dnodes -print dnode1 freeVnodes $data2_1 -print dnode4 freeVnodes $data2_4 -if $data2_1 != 4 then - goto show5 -endi -if $data2_4 != 4 then - goto show5 -endi - -sql reset query cache -sleep 100 - -sql select count(*) from t10 -print select count(*) from t10 $data00 expect $rowNum -if $data00 != $rowNum then - goto show5 -endi - -sql select count(*) from t1010 -print select count(*) from t1010 $data00 expect $rowNum -if $data00 != $rowNum then - goto show5 -endi - -sql select count(*) from t2010 -print select count(*) from t2010 $data00 expect $rowNum -if $data00 != $rowNum then - goto show5 -endi - -sql select count(*) from t3010 -print select count(*) from t3010 $data00 expect $rowNum -if $data00 != $rowNum then - goto show5 -endi - -sql select count(*) from mt -print select count(*) from mt $data00 expect $rowNum -if $data00 != $totalNum then - goto show5 -endi - -print ========== step6 -sql alter database db replica 1 - -$x = 0 -show6: - $x = $x + 1 - sleep 1000 - if $x == 30 then - return -1 - endi - -sql show dnodes -print dnode1 freeVnodes $data2_1 -print dnode4 freeVnodes $data2_4 -if $data2_1 != 2 then - goto show6 -endi -if $data2_4 != 2 then - goto show6 -endi - -sql reset query cache -sleep 100 - -sql select count(*) from t10 -print select count(*) from t10 $data00 expect $rowNum -if $data00 != $rowNum then - goto show5 -endi - -sql select count(*) from t1010 -print select count(*) from t1010 $data00 expect $rowNum -if $data00 != $rowNum then - goto show5 -endi - -sql select count(*) from t2010 -print select count(*) from t2010 $data00 expect $rowNum -if $data00 != $rowNum then - goto show5 -endi - -sql select count(*) from t3010 -print select count(*) from t3010 $data00 expect $rowNum -if $data00 != $rowNum then - goto show5 -endi - -sql select count(*) from mt -print select count(*) from mt $data00 expect $rowNum -if $data00 != $totalNum then - goto show5 -endi - - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/big/maxvnodes.sim b/tests/script/unique/big/maxvnodes.sim deleted file mode 100644 index 10dbc8bbff1a7be19791b75d77c705ffb060e48a..0000000000000000000000000000000000000000 --- a/tests/script/unique/big/maxvnodes.sim +++ /dev/null @@ -1,89 +0,0 @@ -system sh/stop_dnodes.sh - -$totalVnodes = 20 -$minVnodes = 10 -$maxVnodes = 10 -$maxTables = 4 -$totalRows = $totalVnodes * $maxTables - -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v $totalVnodes -system sh/cfg.sh -n dnode1 -c balanceInterval -v 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v $totalVnodes -system sh/cfg.sh -n dnode2 -c balanceInterval -v 1 - -print ========== prepare data -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect -sql create database db blocks 3 cache 1 -sql use db - -print ========== step1 -sql create table mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$x = 0 -while $x < $totalRows - $tb = t . $x - sql create table $tb using mt tags( $x ) - sql insert into $tb values (now, $x ) - $x = $x + 1 -endw - -print ========== step2 -sql select * from mt -if $rows != $totalRows then - return -1 -endi - -sql select count(*) from mt -if $data00 != $totalRows then - return -1 -endi - -print ========== step3 -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -show3: - $x = $x + 1 - sleep 2000 - if $x == 1000 then - return -1 - endi - -sql show dnodes -print dnode1 openvnodes $data2_1 -print dnode2 openvnodes $data2_2 -if $data2_1 != $minVnodes then - goto show3 -endi -if $data2_2 != $maxVnodes then - goto show3 -endi - -print ========== step4 -sql select * from mt -if $rows != $totalRows then - return -1 -endi - -sql select count(*) from mt -if $data00 != $totalRows then - return -1 -endi - -return - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/big/restartSpeed.sim b/tests/script/unique/big/restartSpeed.sim deleted file mode 100644 index bdc4a8678b2c0e766e644a69cd709ecb2cd85268..0000000000000000000000000000000000000000 --- a/tests/script/unique/big/restartSpeed.sim +++ /dev/null @@ -1,41 +0,0 @@ -system sh/stop_dnodes.sh - -$totalVnodes = 20 -$minVnodes = 10 -$maxVnodes = 10 -$maxTables = 4 -$totalRows = $totalVnodes * $maxTables - -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/deploy.sh -n dnode2 -i 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 - - -print ========== prepare data -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect -sql create database db blocks 3 cache 1 -sql use db - -print ========== step1 -sql create table mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$x = 0 -while $x < $totalRows - $tb = t . $x - sql create table $tb using mt tags( $x ) - sql insert into $tb values (now, $x ) - $x = $x + 1 -endw - - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/big/tcp.sim b/tests/script/unique/big/tcp.sim deleted file mode 100644 index b282e2e2223d89dde7cf6ce364b31537593a6cb4..0000000000000000000000000000000000000000 --- a/tests/script/unique/big/tcp.sim +++ /dev/null @@ -1,113 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 30000 - -system sh/cfg.sh -n dnode1 -c dDebugFlag -v 131 -system sh/cfg.sh -n dnode1 -c mDebugFlag -v 131 -system sh/cfg.sh -n dnode1 -c sdbDebugFlag -v 131 -system sh/cfg.sh -n dnode1 -c rpcDebugFlag -v 131 -system sh/cfg.sh -n dnode1 -c cDebugFlag -v 131 -system sh/cfg.sh -n dnode1 -c gcDebugFlag -v 131 -system sh/cfg.sh -n dnode1 -c adminDebugFlag -v 131 -system sh/cfg.sh -n dnode1 -c httpDebugFlag -v 135 -system sh/cfg.sh -n dnode1 -c debugFlag -v 131 - -system sh/exec.sh -n dnode1 -s start -sql connect -print ======================== dnode1 start - -$dbPrefix = db -$tbPrefix = tb -$mtPrefix = mt -$tbNum = 22000 -$rowNum = 10 - -print =============== step1 -$i = 0 -$db = $dbPrefix -$mt = $mtPrefix - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int, tbcol2 float) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $i = $i + 1 -endw - -print =============== step2 -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql insert into $tb values (now, $i , $i ) - - $i = $i + 1000 -endw - -$i = 0 -while $i < 5 - print =============== step3 $i - sql select count(*) from $mt - print ===> $data00 $data01 - if $rows != 1 then - return -1 - endi - if $data00 != 22 then - return -1 - endi - - print =============== step4 $i - sql select * from $mt - print ===> $data00 $data01 - if $rows != 22 then - return -1 - endi - - $i = $i + 1 -endw - -print =============== step3 -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql insert into $tb values (now, $i , $i ) - - $i = $i + 1000 -endw - -$i = 0 -while $i < 5 - print =============== step5 $i - sql select count(*) from $mt where tgcol < 20200 - print ===> $data00 $data01 - if $rows != 1 then - return -1 - endi - if $data00 != 42 then - return -1 - endi - - print =============== step6 $i - sql select * from $mt where tgcol < 20200 - print ===> $data00 $data01 - if $rows != 42 then - return -1 - endi - - $i = $i + 1 -endw - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT diff --git a/tests/script/unique/big/testSuite.sim b/tests/script/unique/big/testSuite.sim deleted file mode 100644 index 2cead5626a5f5dd53ffbc30a0a8502ee70da25d1..0000000000000000000000000000000000000000 --- a/tests/script/unique/big/testSuite.sim +++ /dev/null @@ -1,3 +0,0 @@ -run unique/big/balance.sim -run unique/big/maxvnodes.sim -run unique/big/tcp.sim diff --git a/tests/script/unique/cluster/testSuite.sim b/tests/script/unique/cluster/testSuite.sim deleted file mode 100644 index 9657558c12a0a47441127f64a25541ebc15390e6..0000000000000000000000000000000000000000 --- a/tests/script/unique/cluster/testSuite.sim +++ /dev/null @@ -1,4 +0,0 @@ -run unique/cluster/balance1.sim -run unique/cluster/balance2.sim -run unique/cluster/balance3.sim -run unique/cluster/cache.sim diff --git a/tests/script/unique/column/replica3.sim b/tests/script/unique/column/replica3.sim deleted file mode 100644 index 2d6c194ef806022f7ff5a81d9f906365c49cd197..0000000000000000000000000000000000000000 --- a/tests/script/unique/column/replica3.sim +++ /dev/null @@ -1,43 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3 - -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start - -sql create database db replica 3 -sql use db -sql create table db.mt (ts timestamp, f1 float, f2 float, f3 float, f4 float, f5 float, f6 float, f7 float, f8 float, f9 float, f10 float) tags (t1 int, t2 int) -sql create table db.tb1 using db.mt tags(1, 2) -sleep 3001 - -$x = 1000 -while $x < 1010 - sql insert into tb1 values (now+1s , $x , $x , $x , $x , $x , $x , $x , $x , $x , $x ) - $x = $x + 1 -endw - -sql_error create database d1 replica 2 wallevel 0 -sql_error create database d2 replica 1 wallevel 0 -sql_error alter database d2 replica 2 - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/column/testSuite.sim b/tests/script/unique/column/testSuite.sim deleted file mode 100644 index 8663e9f30518e1092bc63b60e429753fc7ad8712..0000000000000000000000000000000000000000 --- a/tests/script/unique/column/testSuite.sim +++ /dev/null @@ -1 +0,0 @@ -run unique/column/replica3.sim diff --git a/tests/script/unique/db/replica_add12.sim b/tests/script/unique/db/replica_add12.sim deleted file mode 100644 index d46187e4456acbd39c7b1f7689388af156d04f85..0000000000000000000000000000000000000000 --- a/tests/script/unique/db/replica_add12.sim +++ /dev/null @@ -1,349 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode4 -c wallevel -v 2 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 1 - -print ========= start dnodes -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start - -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi - -sql show mnodes -print mnode1 $data2_1 -print mnode1 $data2_2 -print mnode1 $data2_3 -if $data2_1 != master then - goto step1 -endi -if $data2_2 != null then - goto step1 -endi -if $data2_3 != null then - goto step1 -endi - -print ======== step1 -sql create database d1 replica 1 -sql create database d2 replica 1 -sql create database d3 replica 1 -sql create database d4 replica 1 - -sql create table d1.t1 (ts timestamp, i int) -sql create table d2.t2 (ts timestamp, i int) -sql create table d3.t3 (ts timestamp, i int) -sql create table d4.t4 (ts timestamp, i int) - -sql insert into d1.t1 values(now, 1) -sql insert into d2.t2 values(now, 1) -sql insert into d3.t3 values(now, 1) -sql insert into d4.t4 values(now, 1) - -sql select * from d1.t1 -if $rows != 1 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 1 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 1 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 1 then - return -1 -endi - -sql show dnodes -print dnode1 ==> openVnodes: $data2_1 -print dnode2 ==> openVnodes: $data2_2 -print dnode3 ==> openVnodes: $data2_3 - -if $data2_1 != 0 then - return -1 -endi - -if $data2_2 != 2 then - return -1 -endi - -if $data2_3 != 2 then - return -1 -endi - -print ======== step2 -sql alter database d1 replica 2 -sql alter database d2 replica 2 -sql alter database d3 replica 2 -sql alter database d4 replica 2 - -$x = 0 -a1: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a1 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a1 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a1 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a1 -endi - -print ======== step3 -sql show dnodes -print dnode1 ==> openVnodes: $data2_1 -print dnode2 ==> openVnodes: $data2_2 -print dnode3 ==> openVnodes: $data2_3 - -if $data2_1 != 0 then - return -1 -endi - -if $data2_2 != 4 then - return -1 -endi - -if $data2_3 != 4 then - return -1 -endi - -print ======== step4 -sql insert into d1.t1 values(now, 2) -sql insert into d2.t2 values(now, 2) -sql insert into d3.t3 values(now, 2) -sql insert into d4.t4 values(now, 2) - -sql select * from d1.t1 -if $rows != 2 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 2 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 2 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 2 then - return -1 -endi - -sql reset query cache -sleep 200 - -print ========= step5 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sql select * from d1.t1 -x s51 -s51: -#sql insert into d1.t1 values(now, 3) -x s52 -s52: - -print ========= step6 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -step6: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step6 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step6 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step6 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step6 -endi - -sql insert into d1.t1 values(now, 3) -x step6 -sql insert into d2.t2 values(now, 3) -x step6 -sql insert into d3.t3 values(now, 3) -x step6 -sql insert into d4.t4 values(now, 3) -x step6 - -sql select * from d1.t1 -if $rows != 3 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 3 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 3 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 3 then - return -1 -endi - -print ========= step61 -system sh/exec.sh -n dnode3 -s stop -x SIGINT -#sql insert into d1.t1 values(now, 3) -x s61 -s61: - -sql select * from d2.t2 -x s62 -s62: - -print ========= step7 -system sh/exec.sh -n dnode3 -s start - -$x = 0 -step7: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step7 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step7 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step7 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step7 -endi - -sql insert into d1.t1 values(now, 5) -x step7 -sql insert into d2.t2 values(now, 5) -x step7 -sql insert into d3.t3 values(now, 5) -x step7 -sql insert into d4.t4 values(now, 5) -x step7 - -sql select * from d1.t1 -if $rows != 4 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 4 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 4 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 4 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/db/replica_add13.sim b/tests/script/unique/db/replica_add13.sim deleted file mode 100644 index 13a5c9783228761c2b431f9bb1f571c29c05f080..0000000000000000000000000000000000000000 --- a/tests/script/unique/db/replica_add13.sim +++ /dev/null @@ -1,419 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode4 -c wallevel -v 2 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 1 - -print ========= start dnodes -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start -sql create dnode $hostname4 -system sh/exec.sh -n dnode4 -s start - -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi -if $data4_4 != ready then - goto step1 -endi - -sql show mnodes -print mnode1 $data2_1 -print mnode1 $data2_2 -print mnode1 $data2_3 -if $data2_1 != master then - goto step1 -endi - -print ======== step1 -sql create database d1 replica 1 -sql create database d2 replica 1 -sql create database d3 replica 1 -sql create database d4 replica 1 - -sql create table d1.t1 (ts timestamp, i int) -sql create table d2.t2 (ts timestamp, i int) -sql create table d3.t3 (ts timestamp, i int) -sql create table d4.t4 (ts timestamp, i int) - -sql insert into d1.t1 values(1589529000011, 1) -sql insert into d2.t2 values(1589529000021, 1) -sql insert into d3.t3 values(1589529000031, 1) -sql insert into d4.t4 values(1589529000041, 1) - -sql select * from d1.t1 -if $rows != 1 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 1 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 1 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 1 then - return -1 -endi - -print ======== step2 -sql alter database d1 replica 3 -sql alter database d2 replica 3 -sql alter database d3 replica 3 -sql alter database d4 replica 3 - -$x = 0 -a1: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto a1 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto a1 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto a1 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto a1 -endi - -print ======== step3 -sql show dnodes -print dnode1 ==> openVnodes: $data2_1 -print dnode2 ==> openVnodes: $data2_2 -print dnode3 ==> openVnodes: $data2_3 -print dnode4 ==> openVnodes: $data2_4 - -if $data2_1 != 0 then - return -1 -endi - -if $data2_2 != 4 then - return -1 -endi - -if $data2_3 != 4 then - return -1 -endi - -if $data2_3 != 4 then - return -1 -endi - -print ======== step4 -sql insert into d1.t1 values(1589529000012, 2) -sql insert into d2.t2 values(1589529000022, 2) -sql insert into d3.t3 values(1589529000032, 2) -sql insert into d4.t4 values(1589529000042, 2) - -sql select * from d1.t1 -if $rows != 2 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 2 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 2 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 2 then - return -1 -endi - -print ========= step5 -sql reset query cache -sleep 100 -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -sql insert into d1.t1 values(1589529000013, 3) -sql insert into d2.t2 values(1589529000023, 3) -sql insert into d3.t3 values(1589529000033, 3) -sql insert into d4.t4 values(1589529000043, 3) - -sql select * from d1.t1 -if $rows != 3 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 3 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 3 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 3 then - return -1 -endi - -print ========= step6 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -step6: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step6 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step6 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step6 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step6 -endi - -system sh/exec.sh -n dnode3 -s stop -x SIGINT - -sql insert into d1.t1 values(1589529000014, 4) -sql insert into d2.t2 values(1589529000024, 4) -sql insert into d3.t3 values(1589529000034, 4) -sql insert into d4.t4 values(1589529000044, 4) - -sql select * from d1.t1 -print select * from d1.t1 $rows -if $rows != 4 then - return -1 -endi - -sql select * from d2.t2 -print select * from d2.t2 $rows -if $rows != 4 then - return -1 -endi - -sql select * from d3.t3 -print select * from d3.t3 $rows -if $rows != 4 then - return -1 -endi - -sql select * from d4.t4 -print select * from d4.t4 $rows -if $rows != 4 then - return -1 -endi - -print ========= step7 -system sh/exec.sh -n dnode3 -s start - -$x = 0 -step7: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step7 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step7 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step7 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step7 -endi - -system sh/exec.sh -n dnode4 -s stop -x SIGINT - -sql insert into d1.t1 values(1589529000015, 5) -sql insert into d2.t2 values(1589529000025, 5) -sql insert into d3.t3 values(1589529000035, 5) -sql insert into d4.t4 values(1589529000045, 5) - -sql select * from d1.t1 -if $rows != 5 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 5 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 5 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 5 then - return -1 -endi - -print ========= step8 -system sh/exec.sh -n dnode4 -s start - -$x = 0 -step8: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step8 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step8 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step8 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step8 -endi - -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -sql insert into d1.t1 values(1589529000016, 6) -sql insert into d2.t2 values(1589529000026, 6) -sql insert into d3.t3 values(1589529000036, 6) -sql insert into d4.t4 values(1589529000046, 6) - -sql select * from d1.t1 -if $rows != 6 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 6 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 6 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 6 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/db/replica_add23.sim b/tests/script/unique/db/replica_add23.sim deleted file mode 100644 index ac0bd6d9d7b09065c832fb8ad0698b97a9f94853..0000000000000000000000000000000000000000 --- a/tests/script/unique/db/replica_add23.sim +++ /dev/null @@ -1,416 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode4 -c wallevel -v 2 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 1 - -print ========= start dnodes -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start -sql create dnode $hostname4 -system sh/exec.sh -n dnode4 -s start - - -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi -if $data4_4 != ready then - goto step1 -endi - -sql show mnodes -print mnode1 $data2_1 -print mnode1 $data2_2 -print mnode1 $data2_3 -if $data2_1 != master then - goto step1 -endi - -print ======== step1 -sql create database d1 replica 2 -sql create database d2 replica 2 -sql create database d3 replica 2 -sql create database d4 replica 2 - -sql create table d1.t1 (ts timestamp, i int) -sql create table d2.t2 (ts timestamp, i int) -sql create table d3.t3 (ts timestamp, i int) -sql create table d4.t4 (ts timestamp, i int) - -sql insert into d1.t1 values(1588262400001, 1) -sql insert into d2.t2 values(1588262400001, 1) -sql insert into d3.t3 values(1588262400001, 1) -sql insert into d4.t4 values(1588262400001, 1) - -sql select * from d1.t1 -if $rows != 1 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 1 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 1 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 1 then - return -1 -endi - -print ======== step2 -sql alter database d1 replica 3 -sql alter database d2 replica 3 -sql alter database d3 replica 3 -sql alter database d4 replica 3 - -$x = 0 -a1: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto a1 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto a1 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto a1 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto a1 -endi - -print ======== step3 -sql show dnodes -print dnode1 ==> openVnodes: $data2_1 -print dnode2 ==> openVnodes: $data2_2 -print dnode3 ==> openVnodes: $data2_3 -print dnode4 ==> openVnodes: $data2_4 - -if $data2_1 != 0 then - return -1 -endi - -if $data2_2 != 4 then - return -1 -endi - -if $data2_3 != 4 then - return -1 -endi - -if $data2_3 != 4 then - return -1 -endi - -print ======== step4 -sql insert into d1.t1 values(1588262400002, 2) -sql insert into d2.t2 values(1588262400002, 2) -sql insert into d3.t3 values(1588262400002, 2) -sql insert into d4.t4 values(1588262400002, 2) - -sql select * from d1.t1 -if $rows != 2 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 2 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 2 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 2 then - return -1 -endi - -sql reset query cache -sleep 100 - -print ========= step5 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sql insert into d1.t1 values(1588262400003, 3) -sql insert into d2.t2 values(1588262400003, 3) -sql insert into d3.t3 values(1588262400003, 3) -sql insert into d4.t4 values(1588262400003, 3) - -sql select * from d1.t1 -if $rows != 3 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 3 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 3 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 3 then - return -1 -endi - -print ========= step6 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -step6: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step6 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step6 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step6 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step6 -endi - -system sh/exec.sh -n dnode3 -s stop -x SIGINT - -sql insert into d1.t1 values(1588262400004, 4) -sql insert into d2.t2 values(1588262400004, 4) -sql insert into d3.t3 values(1588262400004, 4) -sql insert into d4.t4 values(1588262400004, 4) - -sql select * from d1.t1 -if $rows != 4 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 4 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 4 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 4 then - return -1 -endi - -print ========= step7 -system sh/exec.sh -n dnode3 -s start - -$x = 0 -step7: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step7 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step7 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step7 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step7 -endi - -system sh/exec.sh -n dnode4 -s stop -x SIGINT - -sql insert into d1.t1 values(1588262400005, 5) -sql insert into d2.t2 values(1588262400005, 5) -sql insert into d3.t3 values(1588262400005, 5) -sql insert into d4.t4 values(1588262400005, 5) - -sql select * from d1.t1 -if $rows != 5 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 5 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 5 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 5 then - return -1 -endi - -print ========= step8 -system sh/exec.sh -n dnode4 -s start - -$x = 0 -step8: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step8 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step8 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step8 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step8 -endi - -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -sql insert into d1.t1 values(1588262400006, 6) -sql insert into d2.t2 values(1588262400006, 6) -sql insert into d3.t3 values(1588262400006, 6) -sql insert into d4.t4 values(1588262400006, 6) - -sql select * from d1.t1 -if $rows != 6 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 6 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 6 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 6 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/db/replica_part.sim b/tests/script/unique/db/replica_part.sim deleted file mode 100644 index 9880ec666c8543676c406c843d14235a09ae13ee..0000000000000000000000000000000000000000 --- a/tests/script/unique/db/replica_part.sim +++ /dev/null @@ -1,306 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 - -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 1 - -print ========= start dnodes -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start - -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi - -sql show mnodes -print mnode1 $data2_1 -print mnode1 $data2_2 -print mnode1 $data2_3 -if $data2_1 != master then - goto step1 -endi - -print ======== step1 -sql create database d1 replica 3 -sql create database d2 replica 3 -sql create database d3 replica 3 -sql create database d4 replica 3 - -sql create table d1.t1 (ts timestamp, i int) -sql create table d2.t2 (ts timestamp, i int) -sql create table d3.t3 (ts timestamp, i int) -sql create table d4.t4 (ts timestamp, i int) - -sql insert into d2.t2 values(now, 1) -sql insert into d1.t1 values(now, 1) -sql insert into d3.t3 values(now, 1) -sql insert into d4.t4 values(now, 1) - -sql select * from d1.t1 -if $rows != 1 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 1 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 1 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 1 then - return -1 -endi - -print ========= step2 alter db -sql alter database d1 replica 2 -sql alter database d2 replica 2 -sql alter database d3 replica 2 -sql alter database d4 replica 2 - -$x = 0 -a1: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a1 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a1 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a1 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a1 -endi - -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -print ========= step3 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -step3: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step3 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step3 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step3 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step3 -endi - -print ========= step4 -sql insert into d1.t1 values(now, 2) -sql insert into d2.t2 values(now, 2) -sql insert into d3.t3 values(now, 2) -sql insert into d4.t4 values(now, 2) - -sql select * from d1.t1 -if $rows != 2 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 2 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 2 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 2 then - return -1 -endi - -print ========= step5 -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -sql reset query cache -sleep 100 - -sql insert into d1.t1 values(now, 3) -x s1 -s1: -#sql insert into d2.t2 values(now, 3) -x s2 -#s2: -#sql insert into d3.t3 values(now, 3) -x s3 -#s3: -#sql insert into d4.t4 values(now, 3) -x s4 -#s4: - -print ========= step6 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -step6: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step6 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step6 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step6 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step6 -endi - -system sh/exec.sh -n dnode3 -s stop -x SIGINT - -#sql insert into d1.t1 values(now, 4) -x s5 -#s5: -sql insert into d2.t2 values(now, 4) -x s6 -s6: -#sql insert into d3.t3 values(now, 4) -x s7 -#s7: -#sql insert into d4.t4 values(now, 4) -x s8 -#s8: - -print ========= step7 -system sh/exec.sh -n dnode3 -s start - -$x = 0 -step7: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step7 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step7 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step7 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step7 -endi - -sql insert into d1.t1 values(now, 5) -sql insert into d2.t2 values(now, 5) -sql insert into d3.t3 values(now, 5) -sql insert into d4.t4 values(now, 5) - -sql select * from d1.t1 -sql select * from d2.t2 -sql select * from d3.t3 -sql select * from d4.t4 - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/db/replica_reduce21.sim b/tests/script/unique/db/replica_reduce21.sim deleted file mode 100644 index d3a76485f81616497a8c4859aafefda7ef371c01..0000000000000000000000000000000000000000 --- a/tests/script/unique/db/replica_reduce21.sim +++ /dev/null @@ -1,187 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 - -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 1 - -print ========= start dnodes -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi - -sql show mnodes -print mnode1 $data2_1 -print mnode1 $data2_2 -if $data2_1 != master then - goto step1 -endi - -print ======== step1 -sql create database d1 replica 2 -sql create database d2 replica 2 -sql create database d3 replica 2 -sql create database d4 replica 2 - -sql create table d1.t1 (ts timestamp, i int) -sql create table d2.t2 (ts timestamp, i int) -sql create table d3.t3 (ts timestamp, i int) -sql create table d4.t4 (ts timestamp, i int) - -sql insert into d2.t2 values(now, 1) -sql insert into d1.t1 values(now, 1) -sql insert into d3.t3 values(now, 1) -sql insert into d4.t4 values(now, 1) -sleep 1000 - -sql select * from d1.t1 -if $rows != 1 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 1 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 1 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 1 then - return -1 -endi - -print ======== step2 create d5 -sql create database d5 replica 1 - -print ========= step3 alter d1 -sql alter database d1 replica 1 - -$x = 0 -a1: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 1 then - goto a1 -endi - - -print ========= step4 query d1 -sql insert into d1.t1 values(now, 2) -sql select * from d1.t1 -if $rows != 2 then - return -1 -endi - -print ========= step5 query d5 -sql create table d5.t5 (ts timestamp, i int) -sql insert into d5.t5 values(now, 1); -sql select * from d5.t5 -if $rows != 1 then - return -1 -endi -return -print ========= step7 drop d1 -sql drop database d1 -sql reset query cache -sleep 100 - -print ========= step8 -sql insert into d5.t5 values(now, 2) -sql insert into d2.t2 values(now, 2) -sql insert into d3.t3 values(now, 2) -sql insert into d4.t4 values(now, 2) - -sql select * from d5.t5 -if $rows != 2 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 2 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 2 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 2 then - return -1 -endi - -print ======== step9 stop dnode2 -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -sql insert into d5.t5 values(now, 3) -sql insert into d2.t2 values(now, 3) -sql insert into d3.t3 values(now, 3) -sql insert into d4.t4 values(now, 3) - -sql select * from d5.t5 -if $rows != 3 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 3 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 3 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 3 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/db/replica_reduce31.sim b/tests/script/unique/db/replica_reduce31.sim deleted file mode 100644 index 5350bcc78c327ae9eb35f24e6d01901cebfb7a07..0000000000000000000000000000000000000000 --- a/tests/script/unique/db/replica_reduce31.sim +++ /dev/null @@ -1,327 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 - -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 1 - -print ========= start dnodes -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start - -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi - -sql show mnodes -print mnode1 $data2_1 -print mnode1 $data2_2 -print mnode1 $data2_3 -if $data2_1 != master then - goto step1 -endi - -print ======== step1 -sql create database d1 replica 3 -sql create database d2 replica 3 -sql create database d3 replica 3 -sql create database d4 replica 3 - -sql create table d1.t1 (ts timestamp, i int) -sql create table d2.t2 (ts timestamp, i int) -sql create table d3.t3 (ts timestamp, i int) -sql create table d4.t4 (ts timestamp, i int) - -sql insert into d1.t1 values(now, 1) -sql insert into d2.t2 values(now, 1) -sql insert into d3.t3 values(now, 1) -sql insert into d4.t4 values(now, 1) - -sql select * from d1.t1 -if $rows != 1 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 1 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 1 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 1 then - return -1 -endi - -print ========= step2 alter db -sql_error alter database d1 replica 1 -sql_error alter database d2 replica 1 -sql_error alter database d3 replica 1 -sql_error alter database d4 replica 1 -sql alter database d1 replica 2 -sql alter database d2 replica 2 -sql alter database d3 replica 2 -sql alter database d4 replica 2 - -$x = 0 -a2: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a2 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a2 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a2 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a2 -endi - -sql alter database d1 replica 1 -sql alter database d2 replica 1 -sql alter database d3 replica 1 -sql alter database d4 replica 1 - -$x = 0 -a1: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 1 then - goto a1 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 1 then - goto a1 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 1 then - goto a1 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 1 then - goto a1 -endi - -sql show dnodes -print $data00 $data01 $data02 $data03 -print $data10 $data11 $data12 $data13 -print $data20 $data21 $data22 $data23 - -if $data02 != 0 then - goto a1 -endi -if $data12 != 2 then - goto a1 -endi -if $data22 != 2 then - goto a1 -endi - -print ========= step3 -sql reset query cache -sleep 100 - -sql insert into d1.t1 values(now, 2) -sql insert into d2.t2 values(now, 2) -sql insert into d3.t3 values(now, 2) -sql insert into d4.t4 values(now, 2) - -sql select * from d1.t1 -if $rows != 2 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 2 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 2 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 2 then - return -1 -endi - -print ========= step4 alter db -sql alter database d1 replica 2 -sql alter database d2 replica 2 -sql alter database d3 replica 2 -sql alter database d4 replica 2 - -$x = 0 -step4: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step4 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step4 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step4 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step4 -endi - -sql insert into d1.t1 values(now, 3) -sql insert into d2.t2 values(now, 3) -sql insert into d3.t3 values(now, 3) -sql insert into d4.t4 values(now, 3) - -sql select * from d1.t1 -if $rows != 3 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 3 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 3 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 3 then - return -1 -endi - -print ========= step4 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sql reset query cache -sleep 100 - -#sql insert into d1.t1 values(now, 4) -x step1 -#step1: -#sql insert into d2.t2 values(now, 4) -x step2 -#step2: -#sql insert into d3.t3 values(now, 4) -x step3 -#step3: -#sql insert into d4.t4 values(now, 4) -x step4 -#step4: - -print ========= step5 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s stop -x SIGINT - -#sql insert into d1.t1 values(now, 5) -x step5 -#step5: -#sql insert into d2.t2 values(now, 5) -x step6 -#step6: -#sql insert into d3.t3 values(now, 5) -x step7 -#step7: -#sql insert into d4.t4 values(now, 5) -x step8 -#step8: - -print ========= step6 -system sh/exec.sh -n dnode3 -s start - -sql insert into d1.t1 values(now, 6) -sql insert into d2.t2 values(now, 6) -sql insert into d3.t3 values(now, 6) -sql insert into d4.t4 values(now, 6) - -sql select * from d1.t1 -sql select * from d2.t2 -sql select * from d3.t3 -sql select * from d4.t4 - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/db/replica_reduce32.sim b/tests/script/unique/db/replica_reduce32.sim deleted file mode 100644 index ead265d5d54bd415d12147e5b61b04fcc5d7544f..0000000000000000000000000000000000000000 --- a/tests/script/unique/db/replica_reduce32.sim +++ /dev/null @@ -1,294 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 - -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 1 - -print ========= start dnodes -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start - -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi - -sql show mnodes -print mnode1 $data2_1 -print mnode1 $data2_2 -print mnode1 $data2_3 -if $data2_1 != master then - goto step1 -endi -if $data2_2 != null then - goto step1 -endi -if $data2_3 != null then - goto step1 -endi - -print ======== step1 -sql create database d1 replica 3 -sql create database d2 replica 3 -sql create database d3 replica 3 -sql create database d4 replica 3 - -sql create table d1.t1 (ts timestamp, i int) -sql create table d2.t2 (ts timestamp, i int) -sql create table d3.t3 (ts timestamp, i int) -sql create table d4.t4 (ts timestamp, i int) - -sql insert into d2.t2 values(now, 1) -sql insert into d1.t1 values(now, 1) -sql insert into d3.t3 values(now, 1) -sql insert into d4.t4 values(now, 1) - -sql select * from d1.t1 -if $rows != 1 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 1 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 1 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 1 then - return -1 -endi - -print ========= step2 alter db -sql alter database d1 replica 2 -sql alter database d2 replica 2 -sql alter database d3 replica 2 -sql alter database d4 replica 2 - -$x = 0 -a1: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a1 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a1 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a1 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a1 -endi - -print ========= step3 -sql insert into d1.t1 values(now, 2) -sql insert into d2.t2 values(now, 2) -sql insert into d3.t3 values(now, 2) -sql insert into d4.t4 values(now, 2) - -sql select * from d1.t1 -if $rows != 2 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 2 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 2 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 2 then - return -1 -endi - -sql reset query cache -sleep 200 - -print ========= step4 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 3000 - -sql insert into d1.t1 values(now, 3) -x s41 -s41: -sql insert into d2.t2 values(now, 3) -x s42 -s42: -sql insert into d3.t3 values(now, 3) -x s43 -s43: -sql insert into d4.t4 values(now, 3) -x s44 -s44: - -sql select * from d1.t1 -x s45 -s45: -sql select * from d2.t2 -x s46 -s46: -sql select * from d3.t3 -x s47 -s47: -sql select * from d4.t4 -x s48 -s48: - -print ========= step5 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -step5: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step5 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step5 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step5 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step5 -endi - -system sh/exec.sh -n dnode3 -s stop -x SIGINT -sql reset query cache -sleep 100 - -sql_error insert into d1.t1 values(now, 3) -x s51 -s51: -sql_error insert into d2.t2 values(now, 3) -x s52 -s52: -sql_error insert into d3.t3 values(now, 3) -x s53 -s53: -sql_error insert into d4.t4 values(now, 3) -x s54 -s54: - -print ========= step6 -system sh/exec.sh -n dnode3 -s start -$x = 0 -step6: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step6 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step6 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step6 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step6 -endi - -sql insert into d1.t1 values(now, 5) -sql insert into d2.t2 values(now, 5) -sql insert into d3.t3 values(now, 5) -sql insert into d4.t4 values(now, 5) -sleep 1000 - -sql select * from d1.t1 -print d1.t1 $rows - -sql select * from d2.t2 -print d2.t2 $rows - -sql select * from d3.t3 -print d3.t3 $rows - -sql select * from d4.t4 -print d4.t4 $rows - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/db/testSuite.sim b/tests/script/unique/db/testSuite.sim deleted file mode 100644 index adc1883a71c32d0b18e17a994f32e7ddd9577e9b..0000000000000000000000000000000000000000 --- a/tests/script/unique/db/testSuite.sim +++ /dev/null @@ -1,10 +0,0 @@ -run unique/db/commit.sim -run unique/db/delete.sim -run unique/db/replica_add12.sim -run unique/db/replica_add13.sim -run unique/db/replica_add23.sim -run unique/db/replica_reduce21.sim -run unique/db/replica_reduce32.sim -run unique/db/replica_reduce31.sim -run unique/db/replica_part.sim -run unique/db/delete_part.sim diff --git a/tests/script/unique/dnode/alternativeRole.sim b/tests/script/unique/dnode/alternativeRole.sim deleted file mode 100644 index 14a6e92f064f6077d549ad2c48c5ada3da83995a..0000000000000000000000000000000000000000 --- a/tests/script/unique/dnode/alternativeRole.sim +++ /dev/null @@ -1,97 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 0 - -system sh/cfg.sh -n dnode1 -c wallevel -v 1 -system sh/cfg.sh -n dnode2 -c wallevel -v 1 -system sh/cfg.sh -n dnode3 -c wallevel -v 1 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3 - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4 - - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start -sleep 5000 - -sql show dnodes -print dnode1 $data5_1 -print dnode1 $data5_2 -print dnode1 $data5_3 - -if $data5_1 != mnode then - return -1 -endi -if $data5_2 != vnode then - return -1 -endi -if $data5_3 != any then - return -1 -endi - -sql show mnodes -print dnode1 ==> $data2_1 -print dnode2 ==> $data2_2 -print dnode3 ==> $data2_3 -if $data2_1 != master then - return -1 -endi -if $data2_2 != null then - return -1 -endi -if $data2_3 != slave then - return -1 -endi - -print ========== step2 -sql create database d1 -sql create table d1.t1 (ts timestamp, i int) -sql create table d1.t2 (ts timestamp, i int) -sql create table d1.t3 (ts timestamp, i int) -sql create table d1.t4 (ts timestamp, i int) -sql create table d1.t5 (ts timestamp, i int) -sql create table d1.t6 (ts timestamp, i int) -sql create table d1.t7 (ts timestamp, i int) -sql create table d1.t8 (ts timestamp, i int) - -sql show dnodes -print dnode1 $data2_1 -print dnode2 $data2_2 -print dnode3 $data2_3 - -if $data2_1 != 0 then - return -1 -endi -if $data2_2 != 1 then - return -1 -endi -if $data2_3 != 1 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/balance2.sim b/tests/script/unique/dnode/balance2.sim deleted file mode 100644 index 4c67e20c3eb5e65b0bacf0aafc3d9dc1a53d5ac3..0000000000000000000000000000000000000000 --- a/tests/script/unique/dnode/balance2.sim +++ /dev/null @@ -1,306 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 -system sh/deploy.sh -n dnode5 -i 5 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode5 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode5 -c maxTablesPerVnode -v 4 - -system sh/cfg.sh -n dnode1 -c wallevel -v 1 -system sh/cfg.sh -n dnode2 -c wallevel -v 1 -system sh/cfg.sh -n dnode3 -c wallevel -v 1 -system sh/cfg.sh -n dnode4 -c wallevel -v 1 -system sh/cfg.sh -n dnode5 -c wallevel -v 1 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect - -sql create dnode $hostname2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi - -sql create database d1 replica 2 -sql create table d1.t1 (t timestamp, i int) -sql insert into d1.t1 values(now+1s, 15) -sql insert into d1.t1 values(now+2s, 14) -sql insert into d1.t1 values(now+3s, 13) -sql insert into d1.t1 values(now+4s, 12) -sql insert into d1.t1 values(now+5s, 11) - -sql create database d2 replica 2 -sql create table d2.t2 (t timestamp, i int) -sql insert into d2.t2 values(now+1s, 25) -sql insert into d2.t2 values(now+2s, 24) -sql insert into d2.t2 values(now+3s, 23) -sql insert into d2.t2 values(now+4s, 22) -sql insert into d2.t2 values(now+5s, 21) - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -if $data2_1 != 0 then - return -1 -endi -if $data2_2 != 2 then - return -1 -endi -if $data2_3 != 2 then - return -1 -endi - -print ========== step2 -sql drop dnode $hostname2 - -$x = 0 -show2: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -if $data2_1 != 2 then - goto show2 -endi -if $data2_2 != null then - goto show2 -endi -if $data2_3 != 2 then - goto show2 -endi - -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -print ========== step3 -sql create dnode $hostname4 -system sh/exec.sh -n dnode4 -s start - -$x = 0 -show3: - $x = $x + 1 - sleep 2000 - if $x == 20 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_1 != 0 then - goto show3 -endi -if $data2_2 != null then - goto show3 -endi -if $data2_3 != 2 then - goto show3 -endi -if $data2_4 != 2 then - goto show3 -endi - -print ========== step4 -sql create database d3 replica 2 -sql create table d3.t3 (t timestamp, i int) -sql insert into d3.t3 values(now+1s, 35) -sql insert into d3.t3 values(now+2s, 34) -sql insert into d3.t3 values(now+3s, 33) -sql insert into d3.t3 values(now+4s, 32) -sql insert into d3.t3 values(now+5s, 31) - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_1 != 0 then - return -1 -endi -if $data2_2 != null then - return -1 -endi -if $data2_3 != 3 then - return -1 -endi -if $data2_4 != 3 then - return -1 -endi - -print ========== step5 -sql create dnode $hostname5 -system sh/exec.sh -n dnode5 -s start - -$x = 0 -show5: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -print dnode5 openVnodes $data2_5 -if $data2_1 != 0 then - goto show5 -endi -if $data2_2 != null then - goto show5 -endi -if $data2_3 != 2 then - goto show5 -endi -if $data2_4 != 2 then - goto show5 -endi -if $data2_5 != 2 then - goto show5 -endi - -print ========== step6 -sql drop dnode $hostname3 - -$x = 0 -show6: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -print dnode5 openVnodes $data2_5 -if $data2_1 != 0 then - goto show6 -endi -if $data2_2 != null then - goto show6 -endi -if $data2_3 != null then - goto show6 -endi -if $data2_4 != 3 then - goto show6 -endi -if $data2_5 != 3 then - goto show6 -endi - -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sql reset query cache -sleep 100 - -print ========== step7 -sql select * from d1.t1 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 11 then - return -1 -endi -if $data11 != 12 then - return -1 -endi -if $data21 != 13 then - return -1 -endi -if $data31 != 14 then - return -1 -endi -if $data41 != 15 then - return -1 -endi - -sql select * from d2.t2 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 21 then - return -1 -endi -if $data11 != 22 then - return -1 -endi -if $data21 != 23 then - return -1 -endi -if $data31 != 24 then - return -1 -endi -if $data41 != 25 then - return -1 -endi - -sql select * from d3.t3 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 31 then - return -1 -endi -if $data11 != 32 then - return -1 -endi -if $data21 != 33 then - return -1 -endi -if $data31 != 34 then - return -1 -endi -if $data41 != 35 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/balance3.sim b/tests/script/unique/dnode/balance3.sim deleted file mode 100644 index f5558d504e34608eafb2a076a8739024e13dcff2..0000000000000000000000000000000000000000 --- a/tests/script/unique/dnode/balance3.sim +++ /dev/null @@ -1,337 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 -system sh/deploy.sh -n dnode5 -i 5 -system sh/deploy.sh -n dnode6 -i 6 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode5 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode6 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c wallevel -v 1 -system sh/cfg.sh -n dnode2 -c wallevel -v 1 -system sh/cfg.sh -n dnode3 -c wallevel -v 1 -system sh/cfg.sh -n dnode4 -c wallevel -v 1 -system sh/cfg.sh -n dnode5 -c wallevel -v 1 -system sh/cfg.sh -n dnode6 -c wallevel -v 1 - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode5 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode6 -c maxTablesPerVnode -v 4 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect - -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi -if $data4_4 != ready then - goto step1 -endi - -sql create database d1 replica 3 -sql create table d1.t1 (t timestamp, i int) -sql insert into d1.t1 values(now+1s, 15) -sql insert into d1.t1 values(now+2s, 14) -sql insert into d1.t1 values(now+3s, 13) -sql insert into d1.t1 values(now+4s, 12) -sql insert into d1.t1 values(now+5s, 11) - -sql create database d2 replica 3 -sql create table d2.t2 (t timestamp, i int) -sql insert into d2.t2 values(now+1s, 25) -sql insert into d2.t2 values(now+2s, 24) -sql insert into d2.t2 values(now+3s, 23) -sql insert into d2.t2 values(now+4s, 22) -sql insert into d2.t2 values(now+5s, 21) - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 - -if $data2_1 != 0 then - return -1 -endi -if $data2_2 != 2 then - return -1 -endi -if $data2_3 != 2 then - return -1 -endi -if $data2_4 != 2 then - return -1 -endi - -print ========== step2 -sql drop dnode $hostname2 - -$x = 0 -show2: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 - -if $data2_1 != 2 then - goto show2 -endi -if $data2_2 != null then - goto show2 -endi -if $data2_3 != 2 then - goto show2 -endi -if $data2_4 != 2 then - goto show2 -endi - -system sh/exec.sh -n dnode2 -s stop -x SIGINT -print ========== step -sql create dnode $hostname5 -system sh/exec.sh -n dnode5 -s start - -$x = 0 -show3: - $x = $x + 1 - sleep 1000 - if $x == 60 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -print dnode5 openVnodes $data2_5 - -if $data2_1 != 0 then - goto show3 -endi -if $data2_2 != null then - goto show3 -endi -if $data2_3 != 2 then - goto show3 -endi -if $data2_4 != 2 then - goto show3 -endi -if $data2_5 != 2 then - goto show3 -endi - -print ========== step4 -sql create database d3 replica 3 -sql create table d3.t3 (t timestamp, i int) -sql insert into d3.t3 values(now+1s, 35) -sql insert into d3.t3 values(now+2s, 34) -sql insert into d3.t3 values(now+3s, 33) -sql insert into d3.t3 values(now+4s, 32) -sql insert into d3.t3 values(now+5s, 31) - -$x = 0 -show4: - $x = $x + 1 - sleep 1000 - if $x == 30 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -print dnode5 openVnodes $data2_5 - -if $data2_1 != 0 then - goto show4 -endi -if $data2_2 != null then - goto show4 -endi -if $data2_3 != 3 then - goto show4 -endi -if $data2_4 != 3 then - goto show4 -endi -if $data2_5 != 3 then - goto show4 -endi - -print ========== step5 -sql create dnode $hostname6 -system sh/exec.sh -n dnode6 -s start - -$x = 0 -show5: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode6 openVnodes $data2_6 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -print dnode5 openVnodes $data2_5 - -if $data2_1 != 0 then - goto show5 -endi -if $data2_6 != 2 then - goto show5 -endi - -sleep 8000 - -print ========== step6 -sql drop dnode $hostname3 - -$x = 0 -show6: - $x = $x + 1 - sleep 1000 - if $x == 30 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode6 openVnodes $data2_6 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -print dnode5 openVnodes $data2_5 - -if $data2_1 != 0 then - goto show6 -endi -if $data2_6 != 3 then - goto show6 -endi -if $data2_3 != null then - goto show6 -endi -if $data2_4 != 3 then - goto show6 -endi -if $data2_5 != 3 then - goto show6 -endi - -system sh/exec.sh -n dnode3 -s stop -x SIGINT -sql reset query cache -sleep 100 - -print ========== step7 -sql select * from d1.t1 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 11 then - return -1 -endi -if $data11 != 12 then - return -1 -endi -if $data21 != 13 then - return -1 -endi -if $data31 != 14 then - return -1 -endi -if $data41 != 15 then - return -1 -endi - -sql select * from d2.t2 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 21 then - return -1 -endi -if $data11 != 22 then - return -1 -endi -if $data21 != 23 then - return -1 -endi -if $data31 != 24 then - return -1 -endi -if $data41 != 25 then - return -1 -endi - -sql select * from d3.t3 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 31 then - return -1 -endi -if $data11 != 32 then - return -1 -endi -if $data21 != 33 then - return -1 -endi -if $data31 != 34 then - return -1 -endi -if $data41 != 35 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/balancex.sim b/tests/script/unique/dnode/balancex.sim deleted file mode 100644 index d2c738ee97ff8432999125abfd63d253b0546a91..0000000000000000000000000000000000000000 --- a/tests/script/unique/dnode/balancex.sim +++ /dev/null @@ -1,215 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c wallevel -v 1 -system sh/cfg.sh -n dnode2 -c wallevel -v 1 -system sh/cfg.sh -n dnode3 -c wallevel -v 1 -system sh/cfg.sh -n dnode4 -c wallevel -v 1 - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect -sleep 2000 - -sql create database d1 -sql create table d1.t1 (t timestamp, i int) -sql insert into d1.t1 values(now+1s, 15) -sql insert into d1.t1 values(now+2s, 14) -sql insert into d1.t1 values(now+3s, 13) -sql insert into d1.t1 values(now+4s, 12) -sql insert into d1.t1 values(now+5s, 11) - -sql create database d2 -sql create table d2.t2 (t timestamp, i int) -sql insert into d2.t2 values(now+1s, 25) -sql insert into d2.t2 values(now+2s, 24) -sql insert into d2.t2 values(now+3s, 23) -sql insert into d2.t2 values(now+4s, 22) -sql insert into d2.t2 values(now+5s, 21) - -sql show dnodes -print dnode1 openVnodes $data2_1 -if $data2_1 != 2 then - return -1 -endi - -print ========== step2 -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -show2: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -if $data2_1 != 0 then - goto show2 -endi -if $data2_2 != 2 then - goto show2 -endi - -print ========== step3 -sql create database d3 replica 2 -sql create table d3.t3 (t timestamp, i int) -sql insert into d3.t3 values(now+1s, 35) -sql insert into d3.t3 values(now+2s, 34) -sql insert into d3.t3 values(now+3s, 33) -sql insert into d3.t3 values(now+4s, 32) -sql insert into d3.t3 values(now+5s, 31) - -$x = 0 -show3: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -if $data2_1 != 1 then - goto show3 -endi -if $data2_2 != 3 then - goto show3 -endi - -print ========== step3 -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start - -$x = 0 -show4: - $x = $x + 1 - sleep 2000 - if $x == 20 then - return -1 - endi -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -if $data2_1 != 0 then - goto show4 -endi -if $data2_2 != 2 then - goto show4 -endi -if $data2_3 != 2 then - goto show4 -endi - -print ========== step5 -sql drop dnode $hostname2 - -$x = 0 -show5: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -if $data2_1 != 1 then - goto show5 -endi -if $data2_2 != null then - goto show5 -endi -if $data2_3 != 3 then - goto show5 -endi - -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 3000 - -sql reset query cache -sleep 1000 - -print ========== step6 -sql select * from d1.t1 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 11 then - return -1 -endi -if $data11 != 12 then - return -1 -endi -if $data21 != 13 then - return -1 -endi -if $data31 != 14 then - return -1 -endi -if $data41 != 15 then - return -1 -endi - -sql select * from d2.t2 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 21 then - return -1 -endi -if $data11 != 22 then - return -1 -endi -if $data21 != 23 then - return -1 -endi -if $data31 != 24 then - return -1 -endi -if $data41 != 25 then - return -1 -endi - -sql select * from d3.t3 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 31 then - return -1 -endi -if $data11 != 32 then - return -1 -endi -if $data21 != 33 then - return -1 -endi -if $data31 != 34 then - return -1 -endi -if $data41 != 35 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/data1.sim b/tests/script/unique/dnode/data1.sim deleted file mode 100644 index 75a484abb60c1e09a7c96f8f03902ea4f0f40aa1..0000000000000000000000000000000000000000 --- a/tests/script/unique/dnode/data1.sim +++ /dev/null @@ -1,137 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode4 -c wallevel -v 2 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect -sleep 2000 - -print ========== step2 -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start -sql create dnode $hostname4 -system sh/exec.sh -n dnode4 -s start - -$x = 0 -show2: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_1 != 0 then - goto show2 -endi -if $data2_2 != 0 then - goto show2 -endi -if $data2_3 != 0 then - goto show2 -endi -if $data2_4 != 0 then - goto show2 -endi - -print ========== step3 -sql create database d1 replica 3 -sql create table d1.t1 (t timestamp, i int) -sql insert into d1.t1 values(now+1s, 35) -sql insert into d1.t1 values(now+2s, 34) -sql insert into d1.t1 values(now+3s, 33) -sql insert into d1.t1 values(now+4s, 32) -sql insert into d1.t1 values(now+5s, 31) - -$x = 0 -show3: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_1 != 0 then - goto show3 -endi -if $data2_2 != 1 then - goto show3 -endi -if $data2_3 != 1 then - goto show3 -endi -if $data2_4 != 1 then - goto show3 -endi - -print ========== step4 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT - -print ========== step5 -system_content rm -rf ../../../sim/dnode4/data/vnode/vnode2/tsdb/data - -print ========== step6 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sleep 10000 - -print ========== step7 -sql select * from d1.t1 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 31 then - return -1 -endi -if $data11 != 32 then - return -1 -endi -if $data21 != 33 then - return -1 -endi -if $data31 != 34 then - return -1 -endi -if $data41 != 35 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/datatrans_1node.sim b/tests/script/unique/dnode/datatrans_1node.sim deleted file mode 100644 index a156c32672cf2936c0b69fe10242744d2dd235a3..0000000000000000000000000000000000000000 --- a/tests/script/unique/dnode/datatrans_1node.sim +++ /dev/null @@ -1,53 +0,0 @@ - -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/exec.sh -n dnode1 -s start - -sleep 2000 -sql connect - -print =============== step1 -sql drop database -x step1 -step1: -sql create database db -sql use db -sql create table m1 (ts timestamp, speed int) - -print =============== step 2 -$x = 0 -while $x < 10 - $cc = $x * 60000 - $ms = 1601481600000 + $cc - - sql insert into m1 values ($ms , $x ) - $x = $x + 1 -endw - -sql select * from m1 - -print $rows points data are retrieved -if $rows != 10 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT - -print =============== step 3 -system sh/move_dnode.sh dnode1 dnode2 -system sh/exec.sh -n dnode2 -s start - - -print =============== step 4 -sleep 2000 -sql connect - -sql select * from db.m1 - -print $rows points data are retrieved -if $rows != 10 then - return -1 -endi - -system sh/exec.sh -n dnode2 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/datatrans_3node.sim b/tests/script/unique/dnode/datatrans_3node.sim deleted file mode 100644 index 7948eb6d3a4317ab3d829a874ced71d9f290d641..0000000000000000000000000000000000000000 --- a/tests/script/unique/dnode/datatrans_3node.sim +++ /dev/null @@ -1,91 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 - - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 - - -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 2 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 - - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 - - - - -print ============== step1: start dnode1 -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3 and add into cluster , then create database with replica 2, and create table, insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sleep 2000 - -# create table -sql drop database -x step1 -step1: -sql create database db -sql use db -sql create table m1 (ts timestamp, speed int) - -# insert data -$x = 0 -while $x < 10 - $cc = $x * 60000 - $ms = 1601481600000 + $cc - - sql insert into m1 values ($ms , $x ) - $x = $x + 1 -endw - -sql select * from m1 - -print $rows points data are retrieved -if $rows != 10 then - return -1 -endi - -print ============== step3: stop cluster , then move_dnode1 ,start cluster -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT - -system sh/move_dnode.sh dnode1 dnode4 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start - -print =============== step 4 -sleep 2000 -sql connect - -sql select * from db.m1 - -print $rows points data are retrieved -if $rows != 10 then - return -1 -endi - -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/datatrans_3node_2.sim b/tests/script/unique/dnode/datatrans_3node_2.sim deleted file mode 100644 index 844afc5b02f7de4e41d545ad546b9ec41943b18f..0000000000000000000000000000000000000000 --- a/tests/script/unique/dnode/datatrans_3node_2.sim +++ /dev/null @@ -1,91 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 - - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 - - -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 2 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 - - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 - - - - -print ============== step1: start dnode1 -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3 and add into cluster , then create database with replica 2, and create table, insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sleep 2000 - -# create table -sql drop database -x step1 -step1: -sql create database db replica 2 -sql use db -sql create table m1 (ts timestamp, speed int) - -# insert data -$x = 0 -while $x < 10 - $cc = $x * 60000 - $ms = 1601481600000 + $cc - - sql insert into m1 values ($ms , $x ) - $x = $x + 1 -endw - -sql select * from m1 - -print $rows points data are retrieved -if $rows != 10 then - return -1 -endi - -print ============== step3: stop cluster , then move_dnode1 ,start cluster -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT - -system sh/move_dnode.sh dnode1 dnode4 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start - -print =============== step 4 -sleep 2000 -sql connect - -sql select * from db.m1 - -print $rows points data are retrieved -if $rows != 10 then - return -1 -endi - -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/lossdata.sim b/tests/script/unique/dnode/lossdata.sim deleted file mode 100644 index 89ba7169708eedb21c663a5e4fe0f897d42c5f43..0000000000000000000000000000000000000000 --- a/tests/script/unique/dnode/lossdata.sim +++ /dev/null @@ -1,165 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 -system sh/deploy.sh -n dnode5 -i 5 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode5 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode5 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode5 -c maxTablesPerVnode -v 4 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect - -sql create dnode $hostname2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi - -print ========== step2 - -sql create database d1 replica 2 -sql create table d1.t1 (t timestamp, i int) - -print ========== step2.1 - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 - -if $data2_1 != 0 then - return -1 -endi -if $data2_2 != 1 then - return -1 -endi -if $data2_3 != 1 then - return -1 -endi - -print ========== step3 -sql create dnode $hostname4 -system sh/exec.sh -n dnode4 -s start - -$x = 0 -show3: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 - -if $data2_2 != 1 then - goto show3 -endi -if $data2_3 != 1 then - goto show3 -endi -if $data2_4 != 0 then - goto show3 -endi - -sql show d1.vgroups; -print d1.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 - -print ========== step4 -sql drop dnode $hostname3 - -$i = 0 -$rowNum = 10000 - -while $i < $rowNum - $ts = 1500000000000 + $i - sql insert into d1.t1 values( $ts , $i ) - - $i = $i + 1 -endw - -print insert $rowNum finished - -$x = 0 -show4: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -print dnode5 openVnodes $data2_5 - -if $data2_2 != 1 then - goto show4 -endi -if $data2_3 != null then - goto show4 -endi -if $data2_4 != 1 then - goto show4 -endi - -system sh/exec.sh -n dnode3 -s stop -x SIGINT - -print ========== step5 -sql select count(*) from d1.t1 -print select count(*) from d1.t1 ==> $data00 -if $data00 != $rowNum then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/m2.sim b/tests/script/unique/dnode/m2.sim deleted file mode 100644 index 5fdf3b740081e74024f02616483af2c943d47eb9..0000000000000000000000000000000000000000 --- a/tests/script/unique/dnode/m2.sim +++ /dev/null @@ -1,367 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 -system sh/deploy.sh -n dnode5 -i 5 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode5 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode5 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode5 -c maxTablesPerVnode -v 4 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect - -sql create dnode $hostname2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi - -print ========== step2 - -sql create database d1 replica 2 -sql create table d1.t1 (t timestamp, i int) -sql insert into d1.t1 values(now+1s, 15) -sql insert into d1.t1 values(now+2s, 14) -sql insert into d1.t1 values(now+3s, 13) -sql insert into d1.t1 values(now+4s, 12) -sql insert into d1.t1 values(now+5s, 11) - -sql create database d2 replica 2 -sql create table d2.t2 (t timestamp, i int) -sql insert into d2.t2 values(now+1s, 25) -sql insert into d2.t2 values(now+2s, 24) -sql insert into d2.t2 values(now+3s, 23) -sql insert into d2.t2 values(now+4s, 22) -sql insert into d2.t2 values(now+5s, 21) - -sql create database d3 replica 2 -sql create table d3.t3 (t timestamp, i int) -sql insert into d3.t3 values(now+1s, 35) -sql insert into d3.t3 values(now+2s, 34) -sql insert into d3.t3 values(now+3s, 33) -sql insert into d3.t3 values(now+4s, 32) -sql insert into d3.t3 values(now+5s, 31) - -sql create database d4 replica 2 -sql create table d4.t4 (t timestamp, i int) -sql insert into d4.t4 values(now+1s, 45) -sql insert into d4.t4 values(now+2s, 44) -sql insert into d4.t4 values(now+3s, 43) -sql insert into d4.t4 values(now+4s, 42) -sql insert into d4.t4 values(now+5s, 41) - -print ========== step2.1 - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 - -if $data2_1 != 0 then - return -1 -endi -if $data2_2 != 4 then - return -1 -endi -if $data2_3 != 4 then - return -1 -endi - -sql show d1.vgroups; -print d1.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 - -sql show d2.vgroups; -print d2.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 - -sql show d3.vgroups; -print d3.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 - -sql show d4.vgroups; -print d4.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 - -print ========== step3 -sql create dnode $hostname4 -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname5 -system sh/exec.sh -n dnode5 -s start - - -$x = 0 -show3: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -print dnode5 openVnodes $data2_5 - -if $data2_2 != 2 then - goto show3 -endi -if $data2_3 != 2 then - goto show3 -endi -if $data2_4 != 2 then - goto show3 -endi -if $data2_5 != 2 then - goto show3 -endi - -sql show d1.vgroups; -print d1.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data03 != 2 then - goto show3 -endi - -sql show d2.vgroups; -print d2.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data03 != 2 then - goto show3 -endi - -sql show d3.vgroups; -print d3.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data03 != 2 then - goto show3 -endi - -sql show d4.vgroups; -print d4.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data03 != 2 then - goto show3 -endi - -print ========== step4 -sql drop dnode $hostname2 - -$x = 0 -show4: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -print dnode5 openVnodes $data2_5 - -if $data2_2 != null then - goto show4 -endi - -sql show d1.vgroups; -print d1.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data03 != 2 then - goto show4 -endi - -sql show d2.vgroups; -print d2.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data03 != 2 then - goto show4 -endi - -sql show d3.vgroups; -print d3.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data03 != 2 then - goto show4 -endi - -sql show d4.vgroups; -print d4.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data03 != 2 then - goto show4 -endi - -sql reset query cache -sleep 100 -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -print ========== step5 -sql drop dnode $hostname3 - -$x = 0 -show5: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -print dnode5 openVnodes $data2_5 - -if $data2_2 != null then - goto show5 -endi -if $data2_3 != null then - goto show5 -endi -if $data2_4 != 4 then - goto show5 -endi -if $data2_5 != 4 then - goto show4 -endi - -sql show d1.vgroups; -print d1.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data03 != 2 then - goto show5 -endi - -sql show d2.vgroups; -print d2.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data03 != 2 then - goto show5 -endi - -sql show d3.vgroups; -print d3.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data03 != 2 then - goto show5 -endi - -sql show d4.vgroups; -print d4.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data03 != 2 then - goto show5 -endi - -sql reset query cache -sleep 100 -system sh/exec.sh -n dnode3 -s stop -x SIGINT - -print ========== step6 -sql select * from d1.t1 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 11 then - return -1 -endi -if $data11 != 12 then - return -1 -endi -if $data21 != 13 then - return -1 -endi -if $data31 != 14 then - return -1 -endi -if $data41 != 15 then - return -1 -endi - -sql select * from d2.t2 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 21 then - return -1 -endi -if $data11 != 22 then - return -1 -endi -if $data21 != 23 then - return -1 -endi -if $data31 != 24 then - return -1 -endi -if $data41 != 25 then - return -1 -endi - -sql select * from d3.t3 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 31 then - return -1 -endi -if $data11 != 32 then - return -1 -endi -if $data21 != 33 then - return -1 -endi -if $data31 != 34 then - return -1 -endi -if $data41 != 35 then - return -1 -endi - -sql select * from d4.t4 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 41 then - return -1 -endi -if $data11 != 42 then - return -1 -endi -if $data21 != 43 then - return -1 -endi -if $data31 != 44 then - return -1 -endi -if $data41 != 45 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/m3.sim b/tests/script/unique/dnode/m3.sim deleted file mode 100644 index 5850147d045d4e58fc8b700bcbb7d70318f0420a..0000000000000000000000000000000000000000 --- a/tests/script/unique/dnode/m3.sim +++ /dev/null @@ -1,359 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 -system sh/deploy.sh -n dnode5 -i 5 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode5 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode5 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode5 -c maxTablesPerVnode -v 4 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect - -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi -if $data4_4 != ready then - goto step1 -endi - -print ========== step2 - -sql create database d1 replica 3 -sql create table d1.t1 (t timestamp, i int) -sql insert into d1.t1 values(now+1s, 15) -sql insert into d1.t1 values(now+2s, 14) -sql insert into d1.t1 values(now+3s, 13) -sql insert into d1.t1 values(now+4s, 12) -sql insert into d1.t1 values(now+5s, 11) - -sql create database d2 replica 3 -sql create table d2.t2 (t timestamp, i int) -sql insert into d2.t2 values(now+1s, 25) -sql insert into d2.t2 values(now+2s, 24) -sql insert into d2.t2 values(now+3s, 23) -sql insert into d2.t2 values(now+4s, 22) -sql insert into d2.t2 values(now+5s, 21) - -sql create database d3 replica 3 -sql create table d3.t3 (t timestamp, i int) -sql insert into d3.t3 values(now+1s, 35) -sql insert into d3.t3 values(now+2s, 34) -sql insert into d3.t3 values(now+3s, 33) -sql insert into d3.t3 values(now+4s, 32) -sql insert into d3.t3 values(now+5s, 31) - -sql create database d4 replica 3 -sql create table d4.t4 (t timestamp, i int) -sql insert into d4.t4 values(now+1s, 45) -sql insert into d4.t4 values(now+2s, 44) -sql insert into d4.t4 values(now+3s, 43) -sql insert into d4.t4 values(now+4s, 42) -sql insert into d4.t4 values(now+5s, 41) - -print ========== step2.1 - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 - -if $data2_1 != 0 then - return -1 -endi -if $data2_2 != 4 then - return -1 -endi -if $data2_3 != 4 then - return -1 -endi -if $data2_4 != 4 then - return -1 -endi - -sql show d1.vgroups; -print d1.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data04 != 4 then - return -1 -endi - -sql show d2.vgroups; -print d2.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data04 != 3 then - return -1 -endi - -sql show d3.vgroups; -print d3.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data04 != 2 then - return -1 -endi - -sql show d4.vgroups; -print d4.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data04 != 4 then - return -1 -endi - -print ========== step3 -sql create dnode $hostname5 -system sh/exec.sh -n dnode5 -s start - -$x = 0 -show3: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -print dnode5 openVnodes $data2_5 - -if $data2_2 != 3 then - goto show3 -endi -if $data2_3 != 3 then - goto show3 -endi -if $data2_4 != 3 then - goto show3 -endi -if $data2_5 != 3 then - goto show3 -endi - -sql show d1.vgroups; -print d1.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data04 != 5 then - return -1 -endi -if $data03 != 3 then - goto show3 -endi - -sql show d2.vgroups; -print d2.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data04 != 5 then - return -1 -endi -if $data03 != 3 then - goto show3 -endi - -sql show d3.vgroups; -print d3.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data04 != 2 then - return -1 -endi -if $data03 != 3 then - goto show3 -endi - -sql show d4.vgroups; -print d4.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data04 != 4 then - return -1 -endi -if $data03 != 3 then - goto show3 -endi - -print ========== step4 -sql drop dnode $hostname2 - -$x = 0 -show4: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -print dnode5 openVnodes $data2_5 - -if $data2_2 != null then - goto show4 -endi -if $data2_3 != 4 then - goto show4 -endi -if $data2_4 != 4 then - goto show4 -endi -if $data2_5 != 4 then - goto show4 -endi - -sql show d1.vgroups; -print d1.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data04 != 5 then - return -1 -endi -if $data03 != 3 then - goto show4 -endi - -sql show d2.vgroups; -print d2.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data04 != 3 then - return -1 -endi -if $data03 != 3 then - goto show4 -endi - -sql show d3.vgroups; -print d3.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data04 != 4 then - return -1 -endi -if $data03 != 3 then - goto show4 -endi - -sql show d4.vgroups; -print d4.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data04 != 4 then - return -1 -endi -if $data03 != 3 then - goto show4 -endi - -sql reset query cache -sleep 100 - -print ========== step5 -sql select * from d1.t1 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 11 then - return -1 -endi -if $data11 != 12 then - return -1 -endi -if $data21 != 13 then - return -1 -endi -if $data31 != 14 then - return -1 -endi -if $data41 != 15 then - return -1 -endi - -sql select * from d2.t2 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 21 then - return -1 -endi -if $data11 != 22 then - return -1 -endi -if $data21 != 23 then - return -1 -endi -if $data31 != 24 then - return -1 -endi -if $data41 != 25 then - return -1 -endi - -sql select * from d3.t3 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 31 then - return -1 -endi -if $data11 != 32 then - return -1 -endi -if $data21 != 33 then - return -1 -endi -if $data31 != 34 then - return -1 -endi -if $data41 != 35 then - return -1 -endi - -sql select * from d4.t4 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 41 then - return -1 -endi -if $data11 != 42 then - return -1 -endi -if $data21 != 43 then - return -1 -endi -if $data31 != 44 then - return -1 -endi -if $data41 != 45 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/monitor_bug.sim b/tests/script/unique/dnode/monitor_bug.sim deleted file mode 100644 index 60c6524d9ce70c549cbea2964768888bf0d72fcb..0000000000000000000000000000000000000000 --- a/tests/script/unique/dnode/monitor_bug.sim +++ /dev/null @@ -1,77 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c wallevel -v 1 -system sh/cfg.sh -n dnode2 -c wallevel -v 1 - -system sh/cfg.sh -n dnode1 -c monitor -v 1 -system sh/cfg.sh -n dnode2 -c monitor -v 0 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect -sleep 3000 - -sql show dnodes -print dnode1 openVnodes $data2_1 -if $data2_1 > 2 then - return -1 -endi - -print ========== step2 -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -show2: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -if $data2_1 != 0 then - goto show2 -endi -if $data2_2 > 2 then - goto show2 -endi - -print ========== step3 -sql show log.tables - -print $data00 -print $data10 -print $data20 -print $data30 -print $data40 -print $data50 - -if $rows > 5 then - return -1 -endi - -print ========== step4 -sql select * from log.dn1 -print $rows -$rows1 = $rows - -sleep 2000 -sql select * from log.dn1 -print $rows -$rows2 = $rows - -if $rows2 <= $rows1 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/offline1.sim b/tests/script/unique/dnode/offline1.sim deleted file mode 100644 index 9bbd14cf07891583711f8298c09da24d9fae4df4..0000000000000000000000000000000000000000 --- a/tests/script/unique/dnode/offline1.sim +++ /dev/null @@ -1,77 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 - -system sh/cfg.sh -n dnode1 -c offlineThreshold -v 10 -system sh/cfg.sh -n dnode2 -c offlineThreshold -v 10 -system sh/cfg.sh -n dnode3 -c offlineThreshold -v 10 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 5 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 5 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 5 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c wallevel -v 1 -system sh/cfg.sh -n dnode2 -c wallevel -v 1 -system sh/cfg.sh -n dnode3 -c wallevel -v 1 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -sleep 2000 - -sql show dnodes -print dnode1 $data4_1 -print dnode1 $data4_2 - -if $data4_1 != ready then - return -1 -endi -if $data4_2 != ready then - return -1 -endi - -print ========== step2 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 8000 - -sql show dnodes -print dnode1 $data4_1 -print dnode1 $data4_2 - -if $data4_1 != ready then - return -1 -endi -if $data4_2 == ready then - return -1 -endi - -print ========== step3 -sleep 10000 - -sql show dnodes -print dnode1 $data4_1 -print dnode1 $data4_2 - -if $data4_1 != ready then - return -1 -endi -if $data4_2 != null then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/offline2.sim b/tests/script/unique/dnode/offline2.sim deleted file mode 100644 index 711488cf3f4dc2aebd1980c6615291b0e88dc825..0000000000000000000000000000000000000000 --- a/tests/script/unique/dnode/offline2.sim +++ /dev/null @@ -1,126 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 - -system sh/cfg.sh -n dnode1 -c offlineThreshold -v 10 -system sh/cfg.sh -n dnode2 -c offlineThreshold -v 10 -system sh/cfg.sh -n dnode3 -c offlineThreshold -v 10 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 5 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 5 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 5 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 - - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4 - - -system sh/cfg.sh -n dnode1 -c wallevel -v 1 -system sh/cfg.sh -n dnode2 -c wallevel -v 1 -system sh/cfg.sh -n dnode3 -c wallevel -v 1 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -sleep 2000 - -sql create database d1 replica 2 -sql create table d1.t1(ts timestamp, i int) -sql insert into d1.t1 values(1588262400001, 1) - -sql show dnodes -print dnode1 $data4_1 -print dnode1 $data4_2 - -if $data4_1 != ready then - return -1 -endi -if $data4_2 != ready then - return -1 -endi - -print ========== step2 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 8000 - -sql show dnodes -print dnode1 $data4_1 -print dnode1 $data4_2 - -if $data4_1 != ready then - return -1 -endi -if $data4_2 == ready then - return -1 -endi - -print ========== step3 -sleep 10000 - -sql show dnodes -print dnode1 $data4_1 -print dnode1 $data4_2 - -if $data4_1 != ready then - return -1 -endi -if $data4_2 != dropping then - return -1 -endi - -print ========== step4 -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode2 -s start -sql drop dnode $hostname2 - -sleep 3000 -$x = 0 -show4: - $x = $x + 1 - sleep 3000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -if $data4_1 != ready then - goto show4 -endi -if $data4_2 != null then - goto show4 -endi -if $data4_3 != ready then - goto show4 -endi - -print ======================== step5 -sql reset query cache -sleep 1000 - -sql select * from d1.t1 -if $rows != 1 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/offline3.sim b/tests/script/unique/dnode/offline3.sim deleted file mode 100644 index 93c75e3b13333d55aea7cb2417413a14a1c13e62..0000000000000000000000000000000000000000 --- a/tests/script/unique/dnode/offline3.sim +++ /dev/null @@ -1,111 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c offlineThreshold -v 3 -system sh/cfg.sh -n dnode2 -c offlineThreshold -v 3 -system sh/cfg.sh -n dnode3 -c offlineThreshold -v 3 -system sh/cfg.sh -n dnode4 -c offlineThreshold -v 3 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 300 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 300 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 300 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 300 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start -sql create dnode $hostname4 -system sh/exec.sh -n dnode4 -s start - -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi -if $data4_4 != ready then - goto step1 -endi - -sql show mnodes -print mnode1 $data2_1 -if $data2_1 != master then - goto step1 -endi - -print ========== step2 -sql create database db replica 3 -sql use db -sql create table tb (ts timestamp, value int) -sql insert into tb values (now, 1) -sql insert into tb values (now, 2) - -sql show vgroups; -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 - -print ========== step2 -system sh/exec.sh -n dnode4 -s stop -x SIGINT - -$x = 0 -step2: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show vgroups; -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step2 -endi -if $data4_2 != ready then - goto step2 -endi -if $data4_3 != ready then - goto step2 -endi -if $data4_4 != null then - goto step2 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/reason.sim b/tests/script/unique/dnode/reason.sim deleted file mode 100644 index c685b1129d924131d38e60369d97924250b3ad66..0000000000000000000000000000000000000000 --- a/tests/script/unique/dnode/reason.sim +++ /dev/null @@ -1,203 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 - -sql show dnodes -print dnode1 off: $data7_1 -print dnode2 off: $data7_2 -if $data7_2 != @status not received@ then - return -1 -endi - -print ========== step2 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi - -print ========== step3 -system sh/exec.sh -n dnode2 -s stop - -$x = 0 -step3: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi -sql show dnodes -print dnode1 off: $data7_1 -print dnode2 off: $data7_2 -if $data7_2 != @status msg timeout@ then - goto step3 -endi - -print ========== step4 -sql drop dnode $hostname2 -$x = 0 -step4: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -if $rows != 1 then - goto step4 -endi - -print ========== step5 -system sh/exec.sh -n dnode2 -s start -sql create dnode $hostname2 - -$x = 0 -step5: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 off: $data7_1 -print dnode2 off: $data7_3 -if $data7_3 != @dnodeId not match@ then - goto step5 -endi - -print ========== step6 -system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 3 -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname4 - -$x = 0 -step6: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 off: $data7_1 -print dnode4 off: $data7_4 -if $data7_4 != @mnEqualVn not match@ then - goto step6 -endi - -print ========== step7 -system sh/deploy.sh -n dnode5 -i 5 -system sh/cfg.sh -n dnode5 -c statusInterval -v 3 -system sh/exec.sh -n dnode5 -s start -sql create dnode $hostname5 - -$x = 0 -step7: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 off: $data7_1 -print dnode5 off: $data7_5 -if $data7_5 != @interval not match@ then - goto step7 -endi - -print ========== step8 -system sh/deploy.sh -n dnode6 -i 6 -system sh/cfg.sh -n dnode6 -c balance -v 0 -system sh/exec.sh -n dnode6 -s start -sql create dnode $hostname6 - -$x = 0 -step8: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 off: $data7_1 -print dnode6 off: $data7_6 -if $data7_6 != @balance not match@ then - goto step8 -endi - -print ========== step9 -system sh/deploy.sh -n dnode7 -i 7 -system sh/cfg.sh -n dnode7 -c maxTablesPerVnode -v 3000 -system sh/exec.sh -n dnode7 -s start -sql create dnode $hostname7 - -$x = 0 -step9: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 off: $data7_1 -print dnode7 off: $data7_7 -if $data7_7 != @maxTabPerVn not match@ then - goto step9 -endi - -print ========== step10 -system sh/deploy.sh -n dnode8 -i 8 -system sh/cfg.sh -n dnode8 -c maxVgroupsPerDb -v 3 -system sh/exec.sh -n dnode8 -s start -sql create dnode $hostname8 - -$x = 0 -step10: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 off: $data7_1 -print dnode8 off: $data7_8 -if $data7_8 != @maxVgPerDb not match@ then - goto step10 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/remove2.sim b/tests/script/unique/dnode/remove2.sim deleted file mode 100644 index 1d707bc4a319ce0dbc5bd66b9cff52318c25aa8d..0000000000000000000000000000000000000000 --- a/tests/script/unique/dnode/remove2.sim +++ /dev/null @@ -1,204 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode4 -c wallevel -v 2 - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect - -sql create database d1 -sql create table d1.t1 (t timestamp, i int) -sql insert into d1.t1 values(1588262400001, 15) -sql insert into d1.t1 values(1588262400002, 14) -sql insert into d1.t1 values(1588262400003, 13) -sql insert into d1.t1 values(1588262400004, 12) -sql insert into d1.t1 values(1588262400005, 11) - -sql create database d2 -sql create table d2.t2 (t timestamp, i int) -sql insert into d2.t2 values(1588262400001, 25) -sql insert into d2.t2 values(1588262400002, 24) -sql insert into d2.t2 values(1588262400003, 23) -sql insert into d2.t2 values(1588262400004, 22) -sql insert into d2.t2 values(1588262400005, 21) - -sql show dnodes -print dnode1 openVnodes $data2_1 -if $data2_1 != 2 then - return -1 -endi - -print ========== step2 -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -$x = 0 -step2: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step2 -endi -if $data4_2 != ready then - goto step2 -endi - -sql create database d3 replica 2 -sql create table d3.t3 (t timestamp, i int) -sql insert into d3.t3 values(1588262400001, 35) -sql insert into d3.t3 values(1588262400002, 34) -sql insert into d3.t3 values(1588262400003, 33) -sql insert into d3.t3 values(1588262400004, 32) -sql insert into d3.t3 values(1588262400005, 31) - -$x = 0 -show2: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -if $data2_1 != 1 then - goto show2 -endi -if $data2_2 != 3 then - goto show2 -endi - -print ========== step3 -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 - -print ========== step4 -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start - -$x = 0 -step4: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -# wait dnode3 create first vgroup in dnode-status msg -if $data2_3 != 1 then - goto step4 -endi - -print ============ step 4.1 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -step4.1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_2 != ready then - goto step4.1 -endi - -sql drop dnode $hostname2 - -$x = 0 -show4: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -if $data2_1 != 1 then - goto show4 -endi -if $data2_2 != null then - goto show4 -endi -if $data2_3 != 3 then - goto show4 -endi - -print ========== step5 -sql select * from d1.t1 order by t desc -print $data01 $data11 $data21 $data31 $data41 - -sql select * from d2.t2 order by t desc -print $data01 $data11 $data21 $data31 $data41 - -sql select * from d3.t3 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 31 then - return -1 -endi -if $data11 != 32 then - return -1 -endi -if $data21 != 33 then - return -1 -endi -if $data31 != 34 then - return -1 -endi -if $data41 != 35 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT diff --git a/tests/script/unique/dnode/simple.sim b/tests/script/unique/dnode/simple.sim deleted file mode 100644 index 38d8c08d75b4201fd4375afe50a83d8757ac0120..0000000000000000000000000000000000000000 --- a/tests/script/unique/dnode/simple.sim +++ /dev/null @@ -1,147 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect - -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start -sleep 2000 - -sql create database d1 replica 2 -sql create table d1.t1 (t timestamp, i int) -sql insert into d1.t1 values(now+1s, 15) -sql insert into d1.t1 values(now+2s, 14) -sql insert into d1.t1 values(now+3s, 13) -sql insert into d1.t1 values(now+4s, 12) -sql insert into d1.t1 values(now+5s, 11) - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_1 != 0 then - return -1 -endi -if $data2_2 != 1 then - return -1 -endi -if $data2_3 != 1 then - return -1 -endi -if $data2_4 != null then - return -1 -endi - -print ========== step2 -sql create dnode $hostname4 -system sh/exec.sh -n dnode4 -s start -sleep 2000 - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_1 != 0 then - return -1 -endi -if $data2_2 != 1 then - return -1 -endi -if $data2_3 != 1 then - return -1 -endi -if $data2_4 != 0 then - return -1 -endi - -print ========== step3 -sql drop dnode $hostname2 - -$x = 0 -show3: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_1 != 0 then - goto show3 -endi -if $data2_2 != null then - goto show3 -endi -if $data2_3 != 1 then - goto show3 -endi -if $data2_4 != 1 then - goto show3 -endi - -print ========== step4 -sql drop dnode $hostname3 - -$x = 0 -show4: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_1 != 1 then - goto show4 -endi -if $data2_2 != null then - goto show4 -endi -if $data2_3 != null then - goto show4 -endi -if $data2_4 != 1 then - goto show4 -endi - -print ========== step5 -sql select * from d1.t1 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 11 then - return -1 -endi -if $data11 != 12 then - return -1 -endi -if $data21 != 13 then - return -1 -endi -if $data31 != 14 then - return -1 -endi -if $data41 != 15 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT diff --git a/tests/script/unique/dnode/testSuite.sim b/tests/script/unique/dnode/testSuite.sim deleted file mode 100644 index ecd43cc224136deaa615fb04f0e6c21fa8ee50d5..0000000000000000000000000000000000000000 --- a/tests/script/unique/dnode/testSuite.sim +++ /dev/null @@ -1,9 +0,0 @@ -run unique/dnode/balance1.sim -run unique/dnode/balance2.sim -run unique/dnode/balance3.sim -run unique/dnode/balancex.sim -run unique/dnode/offline1.sim -run unique/dnode/offline2.sim -run unique/dnode/remove1.sim -run unique/dnode/remove2.sim -run unique/dnode/vnode_clean.sim diff --git a/tests/script/unique/import/replica2.sim b/tests/script/unique/import/replica2.sim deleted file mode 100644 index 387567fc82d3204d6e622fc7707627b9c7e552bc..0000000000000000000000000000000000000000 --- a/tests/script/unique/import/replica2.sim +++ /dev/null @@ -1,300 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 10 - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 2000 - -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -print ========= start dnode1 -system sh/exec.sh -n dnode1 -s start -sql connect - -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi - -sql create database ir2db replica 2 duration 7 -sql use ir2db -sql create table tb(ts timestamp, i bigint) - -print ================= step1 -sql import into tb values(1520000010000, 1520000010000) -sql select * from tb; -print $rows -if $rows != 1 then - return -1 -endi - -print ================= step2 -sql insert into tb values(1520000008000, 1520000008000) -print $rows -sql select * from tb; -if $rows != 2 then - return -1 -endi - -print ================= step3 -sql insert into tb values(1520000020000, 1520000020000) -sql select * from tb; -print $rows -if $rows != 3 then - return -1 -endi - -print ================= step4 -sql import into tb values(1520000009000, 1520000009000) -sql import into tb values(1520000015000, 1520000015000) -sql import into tb values(1520000030000, 1520000030000) -sql select * from tb; -print $rows -if $rows != 6 then - return -1 -endi - -print ================= step5 -sql insert into tb values(1520000008000, 1520000008000) -sql insert into tb values(1520000014000, 1520000014000) -sql insert into tb values(1520000025000, 1520000025000) -sql insert into tb values(1520000040000, 1520000040000) -sql select * from tb; -print $rows -if $rows != 9 then - return -1 -endi - -print ================= step6 -sql import into tb values(1520000007000, 1520000007000) -sql import into tb values(1520000012000, 1520000012000) -sql import into tb values(1520000023000, 1520000023000) -sql import into tb values(1520000034000, 1520000034000) -sql import into tb values(1520000050000, 1520000050000) -sql select * from tb; -print $rows -if $rows != 14 then - return -1 -endi - -print ================== dnode restart -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode1 -s start - -$x = 0 -a1: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a1 -endi - -sql select * from tb; -if $rows != 14 then - return -1 -endi - -print ================= step7 -sql import into tb values(1520000007001, 1520000007001) -sql import into tb values(1520000012001, 1520000012001) -sql import into tb values(1520000023001, 1520000023001) -sql import into tb values(1520000034001, 1520000034001) -sql import into tb values(1520000050001, 1520000050001) -sql select * from tb; -print $rows -if $rows != 19 then - print expect 19, actual: $rows - return -1 -endi - -print ================= step8 -sql insert into tb values(1520000008002, 1520000008002) -sql insert into tb values(1520000014002, 1520000014002) -sql insert into tb values(1520000025002, 1520000025002) -sql insert into tb values(1520000060000, 1520000060000) -sql select * from tb; -print $rows -if $rows != 23 then - return -1 -endi - -print ================= step9 -#1520000000000 -#sql import into tb values(now-30d, 7003) -#sql import into tb values(now-20d, 34003) -#sql import into tb values(now-10d, 34003) -#sql import into tb values(now-5d, 34003) -#sql import into tb values(now+1d, 50001) -#sql import into tb values(now+2d, 50001) -#sql import into tb values(now+6d, 50001) -#sql import into tb values(now+8d, 50002) -#sql import into tb values(now+10d, 50003) -#sql import into tb values(now+12d, 50004) -#sql import into tb values(now+14d, 50001) -#sql import into tb values(now+16d, 500051) - -sql import into tb values(1517408000000, 1517408000000) -sql import into tb values(1518272000000, 1518272000000) -sql import into tb values(1519136000000, 1519136000000) -sql import into tb values(1519568000000, 1519568000000) -sql import into tb values(1519654400000, 1519654400000) -sql import into tb values(1519827200000, 1519827200000) -sql import into tb values(1520345600000, 1520345600000) -sql import into tb values(1520691200000, 1520691200000) -sql import into tb values(1520864000000, 1520864000000) -sql import into tb values(1521900800000, 1521900800000) -sql import into tb values(1523110400000, 1523110400000) -sql import into tb values(1521382400000, 1521382400000) -sql select * from tb; -print $rows -if $rows != 35 then - return -1 -endi - -print ================= step10 -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode1 -s start - -$x = 0 -a2: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a2 -endi - -sql select * from tb; -print $rows -if $rows != 35 then - return -1 -endi - -print ================= step11 - -#sql import into tb values(now-50d, 7003) (now-48d, 7003) (now-46d, 7003) (now-44d, 7003) (now-42d, 7003) -sql import into tb values(1515680000000, 1) (1515852800000, 2) (1516025600000, 3) (1516198400000, 4) (1516371200000, 5) -sql select * from tb; -if $rows != 40 then - return -1 -endi - -print ================= step12 -#1520000000000 -#sql import into tb values(now-19d, -19) (now-18d, -18) (now-17d, -17) (now-16d, -16) (now-15d, -15) (now-14d, -14) (now-13d, -13) (now-12d, -12) (now-11d, -11) -sql import into tb values(1518358400000, 6) (1518444800000, 7) (1518531200000, 8) (1518617600000, 9) (1518704000000, 10) (1518790400000, 11) (1518876800000, 12) (1518963200000, 13) (1519049600000, 14) -sql select * from tb; -print $rows -if $rows != 49 then - return -1 -endi - -print ================= step13 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s start -$x = 0 -a3: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a3 -endi - -print ================= step14 -#1520000000000 -#sql import into tb values(now-48d, -48) -#sql import into tb values(now-38d, -38) -#sql import into tb values(now-28d, -28) - -sql import into tb values(1515852800001, -48) -sql import into tb values(1516716800000, -38) -sql import into tb values(1517580800000, -28) - -sql select * from tb; -if $rows != 52 then - return -1 -endi - -print ================= step15 -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode1 -s start -$x = 0 -a4: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a4 -endi - -sql select * from tb; -if $rows != 52 then - goto a4 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/import/replica3.sim b/tests/script/unique/import/replica3.sim deleted file mode 100644 index 5c1b8b89322e579c7dc8474e74e6d0acbde4cec5..0000000000000000000000000000000000000000 --- a/tests/script/unique/import/replica3.sim +++ /dev/null @@ -1,291 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 10 - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 2000 - -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -print ========= start dnode1 -system sh/exec.sh -n dnode1 -s start -sql connect - -sql create dnode $hostname2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start - -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi - -sql create database ir3db replica 3 duration 7 -sql use ir3db -sql create table tb(ts timestamp, i bigint) - -print ================= step1 -sql import into tb values(1520000010000, 1520000010000) -sql select * from tb; -print $rows -if $rows != 1 then - return -1 -endi - -print ================= step2 -sql insert into tb values(1520000008000, 1520000008000) -print $rows -sql select * from tb; -if $rows != 2 then - return -1 -endi - -print ================= step3 -sql insert into tb values(1520000020000, 1520000020000) -sql select * from tb; -print $rows -if $rows != 3 then - return -1 -endi - -print ================= step4 -sql import into tb values(1520000009000, 1520000009000) -sql import into tb values(1520000015000, 1520000015000) -sql import into tb values(1520000030000, 1520000030000) -sql select * from tb; -print $rows -if $rows != 6 then - return -1 -endi - -print ================= step5 -sql insert into tb values(1520000008000, 1520000008000) -sql insert into tb values(1520000014000, 1520000014000) -sql insert into tb values(1520000025000, 1520000025000) -sql insert into tb values(1520000040000, 1520000040000) -sql select * from tb; -print $rows -if $rows != 9 then - return -1 -endi - -print ================= step6 -sql import into tb values(1520000007000, 1520000007000) -sql import into tb values(1520000012000, 1520000012000) -sql import into tb values(1520000023000, 1520000023000) -sql import into tb values(1520000034000, 1520000034000) -sql import into tb values(1520000050000, 1520000050000) -sql select * from tb; -print $rows -if $rows != 14 then - return -1 -endi - -print ================== dnode restart -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode1 -s start -$x = 0 -a4: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi -sql show vgroups -print online vnodes $data03 -if $data03 != 3 then - goto a4 -endi - -sql select * from tb; -if $rows != 14 then - return -1 -endi - -print ================= step7 -sql import into tb values(1520000007001, 1520000007001) -sql import into tb values(1520000012001, 1520000012001) -sql import into tb values(1520000023001, 1520000023001) -sql import into tb values(1520000034001, 1520000034001) -sql import into tb values(1520000050001, 1520000050001) -sql select * from tb; -print $rows -if $rows != 19 then - print expect 19, actual: $rows - return -1 -endi - -print ================= step8 -sql insert into tb values(1520000008002, 1520000008002) -sql insert into tb values(1520000014002, 1520000014002) -sql insert into tb values(1520000025002, 1520000025002) -sql insert into tb values(1520000060000, 1520000060000) -sql select * from tb; -print $rows -if $rows != 23 then - return -1 -endi - -print ================= step9 -#1520000000000 -#sql import into tb values(now-30d, 7003) -#sql import into tb values(now-20d, 34003) -#sql import into tb values(now-10d, 34003) -#sql import into tb values(now-5d, 34003) -#sql import into tb values(now+1d, 50001) -#sql import into tb values(now+2d, 50001) -#sql import into tb values(now+6d, 50001) -#sql import into tb values(now+8d, 50002) -#sql import into tb values(now+10d, 50003) -#sql import into tb values(now+12d, 50004) -#sql import into tb values(now+14d, 50001) -#sql import into tb values(now+16d, 500051) - -sql import into tb values(1517408000000, 1517408000000) -sql import into tb values(1518272000000, 1518272000000) -sql import into tb values(1519136000000, 1519136000000) -sql import into tb values(1519568000000, 1519568000000) -sql import into tb values(1519654400000, 1519654400000) -sql import into tb values(1519827200000, 1519827200000) -sql import into tb values(1520345600000, 1520345600000) -sql import into tb values(1520691200000, 1520691200000) -sql import into tb values(1520864000000, 1520864000000) -sql import into tb values(1521900800000, 1521900800000) -sql import into tb values(1523110400000, 1523110400000) -sql import into tb values(1521382400000, 1521382400000) -sql select * from tb; -print $rows -if $rows != 35 then - return -1 -endi - -print ================= step10 -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode1 -s start - -$x = 0 -step10: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi -sql show vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step10 -endi - -sql select * from tb; -print $rows -if $rows != 35 then - return -1 -endi - -print ================= step11 - -#sql import into tb values(now-50d, 7003) (now-48d, 7003) (now-46d, 7003) (now-44d, 7003) (now-42d, 7003) -sql import into tb values(1515680000000, 1) (1515852800000, 2) (1516025600000, 3) (1516198400000, 4) (1516371200000, 5) -sql select * from tb; -if $rows != 40 then - return -1 -endi - -print ================= step12 -#1520000000000 -#sql import into tb values(now-19d, -19) (now-18d, -18) (now-17d, -17) (now-16d, -16) (now-15d, -15) (now-14d, -14) (now-13d, -13) (now-12d, -12) (now-11d, -11) -sql import into tb values(1518358400000, 6) (1518444800000, 7) (1518531200000, 8) (1518617600000, 9) (1518704000000, 10) (1518790400000, 11) (1518876800000, 12) (1518963200000, 13) (1519049600000, 14) -sql select * from tb; -print $rows -if $rows != 49 then - return -1 -endi - -print ================= step13 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 3000 -system sh/exec.sh -n dnode2 -s start -sleep 3000 - -print ================= step14 -#1520000000000 -#sql import into tb values(now-48d, -48) -#sql import into tb values(now-38d, -38) -#sql import into tb values(now-28d, -28) - -sql import into tb values(1515852800001, -48) -sql import into tb values(1516716800000, -38) -sql import into tb values(1517580800000, -28) - -sql select * from tb; -if $rows != 52 then - return -1 -endi - -print ================= step15 -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s start -$x = 0 -step15: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi -sql show vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step15 -endi - -sql select * from tb; -if $rows != 52 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/import/testSuite.sim b/tests/script/unique/import/testSuite.sim deleted file mode 100644 index 8be358ce17ee864538c47137630520cd3e69c337..0000000000000000000000000000000000000000 --- a/tests/script/unique/import/testSuite.sim +++ /dev/null @@ -1,2 +0,0 @@ -run unique/import/replica2.sim -run unique/import/replica3.sim \ No newline at end of file diff --git a/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeDir.sim b/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeDir.sim deleted file mode 100644 index e5f2928748896a2aaa811ddc76bfb16b9626bf1d..0000000000000000000000000000000000000000 --- a/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeDir.sim +++ /dev/null @@ -1,275 +0,0 @@ -# Test case describe: dnode1/dnode2 include mnode and vnode roles -# step 1: start dnode1/dnode2, and added into cluster -# step 2: create db(repl = 2), table, insert data, -# step 4: stop dnode1, remove its mnode dir, and copy mnode dir of dnode2 to dnode1 -# step 5: restart dnode1, waiting sync end -# step 6: stop dnode2, reset query cache, and query - -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -#system sh/deploy.sh -n dnode3 -i 3 -#system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 2 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 2 -#system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -#system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 - -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -#system sh/cfg.sh -n dnode3 -c walLevel -v 2 -#system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -#system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -#system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 0 -system sh/cfg.sh -n dnode2 -c role -v 0 -#system sh/cfg.sh -n dnode3 -c role -v 2 -#system sh/cfg.sh -n dnode4 -c role -v 2 - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -#system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -#system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 -#system sh/cfg.sh -n dnode5 -c maxtablesPerVnode -v 4 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -#system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1/dnode2 and add into cluster -system sh/exec.sh -n dnode1 -s start -system sh/exec.sh -n dnode2 -s start -sleep 1000 -sql connect -sleep 1000 -sql create dnode $hostname2 -sleep 1000 - -print ============== step2: create database with replica 2, and create table, insert data -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -sql create database $db replica 2 cache 1 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 double) tags(t1 int) -$rowNum = 1200 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1577808000000 # 2020-01-01 00:00:00.000 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print rows:$rows data00:$data00 totalRows:$totalRows -if $rows != 1 then - return -1 -endi - -if $data00 != $totalRows then - return -1 -endi - - -print ============== step3: insert old data(now-15d) and new data(now+15d), control data rows in order to save in cache, not falling disc -sql insert into $tb values ( now - 20d , -20 ) -sql insert into $tb values ( now - 40d , -40 ) -$totalRows = $totalRows + 2 - -print ============== step4: stop dnode1 -system sh/exec.sh -n dnode1 -s stop -x SIGINT - -$loopCnt = 0 -wait_dnode1_offline: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode1_offline -endi -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 - -if $dnode1Status != offline then - sleep 2000 - goto wait_dnode1_offline -endi -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode1_offline -endi - -# check using select -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -#sql show vgroups -#print show vgroups: -#print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -#print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -#print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 - -print ============== step5: remove the mnode dir of dnode1, then copy the monde dir of dnode2 -system_content rm -rf ../../../sim/dnode1/data/mnode -system_content cp -rf ../../../sim/dnode2/data/mnode ../../../sim/dnode1/data/ - -print ============== step6: restart dnode1, waiting sync end -system sh/exec.sh -n dnode1 -s start -sleep 1000 - -$loopCnt = 0 -wait_dnode1_ready: -$loopCnt = $loopCnt + 1 -if $loopCnt == 20 then - return -1 -endi - -sql show dnodes -x wait_dnode1_ready -if $rows != 3 then - sleep 2000 - goto wait_dnode1_ready -endi -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 - -if $dnode1Status != ready then - sleep 2000 - goto wait_dnode1_ready -endi -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode1_ready -endi - -$loopCnt = 0 -wait_dnode1_vgroup_slave: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 3 then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4 $data5_4 $data6_4 $data7_4 $data8_4 $data9_4 - -if $data5_4 != master then - print $data5_4 - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $data5_3 != slave then -print $data5_2 - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $data5_2 != master then -print $data5_3 - sleep 2000 - goto wait_dnode1_vgroup_slave -endi - -if $data7_4 != slave then - print $data7_4 - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $data7_3 != master then - print $data7_3 - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $data7_2 != slave then - print $data7_2 - sleep 2000 - goto wait_dnode1_vgroup_slave -endi - -print ============== step7: stop dnode2 -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -$loopCnt = 0 -wait_dnode2_offline: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode2_offline -endi -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 - -if $dnode1Status != ready then - sleep 2000 - goto wait_dnode2_offline -endi -if $dnode2Status != offline then - sleep 2000 - goto wait_dnode2_offline -endi - -sql reset query cache - -# check using select -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim b/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim deleted file mode 100644 index 8d063020e73be449bc95463e966d9081b0cd5be5..0000000000000000000000000000000000000000 --- a/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim +++ /dev/null @@ -1,271 +0,0 @@ -# Test case describe: dnode1/dnode2 include mnode and vnode roles -# step 1: start dnode1/dnode2, and added into cluster -# step 2: create db(repl = 2), table, insert data, -# step 4: stop dnode1, remove its mnode and vnode dir, and copy mnode and vnode dir of dnode2 to dnode1 -# step 5: restart dnode1, waiting sync end -# step 6: stop dnode2, reset query cache, and query - -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -#system sh/deploy.sh -n dnode3 -i 3 -#system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 2 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 2 -#system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -#system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 - -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -#system sh/cfg.sh -n dnode3 -c walLevel -v 2 -#system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -#system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -#system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 0 -system sh/cfg.sh -n dnode2 -c role -v 0 -#system sh/cfg.sh -n dnode3 -c role -v 2 -#system sh/cfg.sh -n dnode4 -c role -v 2 - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -#system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -#system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 -#system sh/cfg.sh -n dnode5 -c maxtablesPerVnode -v 4 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -#system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1/dnode2 and add into cluster -system sh/exec.sh -n dnode1 -s start -system sh/exec.sh -n dnode2 -s start -sleep 1000 -sql connect -sleep 1000 -sql create dnode $hostname2 -sleep 1000 - -print ============== step2: create database with replica 2, and create table, insert data -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -sql create database $db replica 2 cache 1 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 double) tags(t1 int) -$rowNum = 1200 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1577808000000 # 2020-01-01 00:00:00.000 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print rows:$rows data00:$data00 totalRows:$totalRows -if $rows != 1 then - return -1 -endi - -if $data00 != $totalRows then - return -1 -endi - - -print ============== step3: insert old data(now-15d) and new data(now+15d), control data rows in order to save in cache, not falling disc -sql insert into $tb values ( now - 20d , -20 ) -sql insert into $tb values ( now - 40d , -40 ) -$totalRows = $totalRows + 2 - -print ============== step4: stop dnode1 -system sh/exec.sh -n dnode1 -s stop -x SIGINT - -$loopCnt = 0 -wait_dnode1_offline: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode1_offline -endi -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 - -if $dnode1Status != offline then - sleep 2000 - goto wait_dnode1_offline -endi -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode1_offline -endi - -# check using select -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -#sql show vgroups -#print show vgroups: -#print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -#print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -#print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 - -print ============== step5: remove the mnode dir of dnode1, then copy the monde dir of dnode2 -system_content rm -rf ../../../sim/dnode1/data/vnode -system_content rm -rf ../../../sim/dnode1/data/mnode -system_content cp -rf ../../../sim/dnode2/data/vnode ../../../sim/dnode1/data/ -system_content cp -rf ../../../sim/dnode2/data/mnode ../../../sim/dnode1/data/ - -print ============== step6: restart dnode1, waiting sync end -system sh/exec.sh -n dnode1 -s start -sleep 1000 - -$loopCnt = 0 -wait_dnode1_ready: -$loopCnt = $loopCnt + 1 -if $loopCnt == 20 then - return -1 -endi - -sql show dnodes -x wait_dnode1_ready -if $rows != 3 then - sleep 2000 - goto wait_dnode1_ready -endi -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 - -if $dnode1Status != ready then - sleep 2000 - goto wait_dnode1_ready -endi -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode1_ready -endi - -$loopCnt = 0 -wait_dnode1_vgroup_slave: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 3 then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4 $data5_4 $data6_4 $data7_4 $data8_4 $data9_4 - -if $data5_4 != master then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $data5_3 != slave then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $data5_2 != master then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi - -if $data7_4 != slave then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $data7_3 != master then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $data7_2 != slave then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi - -print ============== step7: stop dnode2 -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -$loopCnt = 0 -wait_dnode2_offline: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode2_offline -endi -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 - -if $dnode1Status != ready then - sleep 2000 - goto wait_dnode2_offline -endi -if $dnode2Status != offline then - sleep 2000 - goto wait_dnode2_offline -endi - -sql reset query cache - -# check using select -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir_stopAll_starAll.sim b/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir_stopAll_starAll.sim deleted file mode 100644 index 69e83a2c0091394b2babf76a592ab80a95ae3e6a..0000000000000000000000000000000000000000 --- a/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir_stopAll_starAll.sim +++ /dev/null @@ -1,205 +0,0 @@ -# Test case describe: dnode1/dnode2 include mnode and vnode roles -# step 1: start dnode1/dnode2, and added into cluster -# step 2: create db(repl = 2), table, insert data, -# step 4: stop dnode1, remove its mnode and vnode dir, and copy mnode and vnode dir of dnode2 to dnode1 -# step 5: restart dnode1, waiting sync end -# step 6: stop dnode2, reset query cache, and query - -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -#system sh/deploy.sh -n dnode3 -i 3 -#system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 2 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 2 -#system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -#system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 - -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -#system sh/cfg.sh -n dnode3 -c walLevel -v 2 -#system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -#system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -#system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 0 -system sh/cfg.sh -n dnode2 -c role -v 0 -#system sh/cfg.sh -n dnode3 -c role -v 2 -#system sh/cfg.sh -n dnode4 -c role -v 2 - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -#system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -#system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 -#system sh/cfg.sh -n dnode5 -c maxtablesPerVnode -v 4 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -#system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1/dnode2 and add into cluster -system sh/exec.sh -n dnode1 -s start -system sh/exec.sh -n dnode2 -s start -sleep 1000 -sql connect -sleep 1000 -sql create dnode $hostname2 -sleep 1000 - -print ============== step2: create database with replica 2, and create table, insert data -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -sql create database $db replica 2 cache 1 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 double) tags(t1 int) -$rowNum = 1200 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1577808000000 # 2020-01-01 00:00:00.000 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print rows:$rows data00:$data00 totalRows:$totalRows -if $rows != 1 then - return -1 -endi - -if $data00 != $totalRows then - return -1 -endi - - -print ============== step3: insert old data(now-15d) and new data(now+15d), control data rows in order to save in cache, not falling disc -sql insert into $tb values ( now - 20d , -20 ) -sql insert into $tb values ( now - 40d , -40 ) -$totalRows = $totalRows + 2 - -print ============== step4: stop dnode1 -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -print ============== step5: remove the mnode dir of dnode1, then copy the monde dir of dnode2 -system_content rm -rf ../../../sim/dnode1/data/vnode -system_content rm -rf ../../../sim/dnode1/data/mnode -system_content cp -rf ../../../sim/dnode2/data/vnode ../../../sim/dnode1/data/ -system_content cp -rf ../../../sim/dnode2/data/mnode ../../../sim/dnode1/data/ - -print ============== step6: restart dnode1/dnode2 -system sh/exec.sh -n dnode1 -s start -system sh/exec.sh -n dnode2 -s start -sleep 1000 -sql connect -sql use $db - -$loopCnt = 0 -wait_dnode1_ready: -$loopCnt = $loopCnt + 1 -if $loopCnt == 20 then - return -1 -endi - -sql show dnodes -x wait_dnode1_ready -if $rows != 3 then - sleep 2000 - goto wait_dnode1_ready -endi -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 - -if $dnode1Status != ready then - sleep 2000 - goto wait_dnode1_ready -endi -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode1_ready -endi - -$loopCnt = 0 -wait_dnode1_vgroup_slave: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 3 then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4 $data5_4 $data6_4 $data7_4 $data8_4 $data9_4 -$d2v2status = $data5_4 -$d2v3status = $data5_2 -$d2v4status = $data5_3 - -$d1v2status = $data7_4 -$d1v3status = $data7_2 -$d1v4status = $data7_3 - -if $d2v2status != master then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $d2v3status != master then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $d2v4status != master then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi - -if $d1v2status != slave then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $d1v3status != slave then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $d1v4status != slave then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi - -sql reset query cache - -# check using select -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi \ No newline at end of file diff --git a/tests/script/unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim b/tests/script/unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim deleted file mode 100644 index 8f837b7e477ab801b296b32ddcf9a5c683c351f0..0000000000000000000000000000000000000000 --- a/tests/script/unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim +++ /dev/null @@ -1,269 +0,0 @@ -# Test case describe: dnode1/dnode2 include mnode and vnode roles -# step 1: start dnode1/dnode2, and added into cluster -# step 2: create db(repl = 2), table, insert data, -# step 4: stop dnode1, remove its vnode dir, and copy vnode dir of dnode2 to dnode1 -# step 5: restart dnode1, waiting sync end -# step 6: stop dnode2, reset query cache, and query - -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -#system sh/deploy.sh -n dnode3 -i 3 -#system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 2 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 2 -#system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -#system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 - -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -#system sh/cfg.sh -n dnode3 -c walLevel -v 2 -#system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -#system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -#system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 0 -system sh/cfg.sh -n dnode2 -c role -v 0 -#system sh/cfg.sh -n dnode3 -c role -v 2 -#system sh/cfg.sh -n dnode4 -c role -v 2 - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -#system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -#system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 -#system sh/cfg.sh -n dnode5 -c maxtablesPerVnode -v 4 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -#system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1/dnode2 and add into cluster -system sh/exec.sh -n dnode1 -s start -system sh/exec.sh -n dnode2 -s start -sleep 1000 -sql connect -sleep 1000 -sql create dnode $hostname2 -sleep 1000 - -print ============== step2: create database with replica 2, and create table, insert data -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -sql create database $db replica 2 cache 1 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 double) tags(t1 int) -$rowNum = 1200 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1577808000000 # 2020-01-01 00:00:00.000 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print rows:$rows data00:$data00 totalRows:$totalRows -if $rows != 1 then - return -1 -endi - -if $data00 != $totalRows then - return -1 -endi - - -print ============== step3: insert old data(now-15d) and new data(now+15d), control data rows in order to save in cache, not falling disc -sql insert into $tb values ( now - 20d , -20 ) -sql insert into $tb values ( now - 40d , -40 ) -$totalRows = $totalRows + 2 - -print ============== step4: stop dnode1 -system sh/exec.sh -n dnode1 -s stop -x SIGINT - -$loopCnt = 0 -wait_dnode1_offline: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode1_offline -endi -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 - -if $dnode1Status != offline then - sleep 2000 - goto wait_dnode1_offline -endi -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode1_offline -endi - -# check using select -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -#sql show vgroups -#print show vgroups: -#print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -#print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -#print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 - -print ============== step5: remove the mnode dir of dnode1, then copy the monde dir of dnode2 -system_content rm -rf ../../../sim/dnode1/data/vnode -system_content cp -rf ../../../sim/dnode2/data/vnode ../../../sim/dnode1/data/ - -print ============== step6: restart dnode1, waiting sync end -system sh/exec.sh -n dnode1 -s start -sleep 1000 - -$loopCnt = 0 -wait_dnode1_ready: -$loopCnt = $loopCnt + 1 -if $loopCnt == 20 then - return -1 -endi - -sql show dnodes -x wait_dnode1_ready -if $rows != 3 then - sleep 2000 - goto wait_dnode1_ready -endi -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 - -if $dnode1Status != ready then - sleep 2000 - goto wait_dnode1_ready -endi -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode1_ready -endi - -$loopCnt = 0 -wait_dnode1_vgroup_slave: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 3 then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4 $data5_4 $data6_4 $data7_4 $data8_4 $data9_4 - -if $data5_4 != master then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $data5_3 != slave then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $data5_2 != master then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi - -if $data7_4 != slave then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $data7_3 != master then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $data7_2 != slave then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi - -print ============== step7: stop dnode2 -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -$loopCnt = 0 -wait_dnode2_offline: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode2_offline -endi -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 - -if $dnode1Status != ready then - sleep 2000 - goto wait_dnode2_offline -endi -if $dnode2Status != offline then - sleep 2000 - goto wait_dnode2_offline -endi - -sql reset query cache - -# check using select -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/stable/dnode3.sim b/tests/script/unique/stable/dnode3.sim deleted file mode 100644 index d0708c81542f13634466053d7159c119687dfa04..0000000000000000000000000000000000000000 --- a/tests/script/unique/stable/dnode3.sim +++ /dev/null @@ -1,229 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/cfg.sh -n dnode2 -c walLevel -v 1 -system sh/cfg.sh -n dnode3 -c walLevel -v 1 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -system sh/exec.sh -n dnode1 -s start - -sql connect - -sql create dnode $hostname2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start - -$x = 0 -createDnode: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi -sql show dnodes; -if $data4_2 == offline then - goto createDnode -endi -if $data4_3 == offline then - goto createDnode -endi - - -print ======================== dnode1 start - -$dbPrefix = d3_db -$tbPrefix = d3_tb -$mtPrefix = d3_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $val = $x * 60000 - $ms = 1519833600000 + $val - sql insert into $tb values ($ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sql show vgroups -print vgroups ==> $rows -if $rows != 3 then - return -1 -endi - -sql show dnodes -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode2Vnodes = $data2_2 -print dnode2 $dnode2Vnodes -$dnode3Vnodes = $data2_3 -print dnode3 $dnode3Vnodes - -if $dnode1Vnodes != 1 then - return -1 -endi -if $dnode2Vnodes != 1 then - return -1 -endi -if $dnode3Vnodes != 1 then - return -1 -endi - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select count(*) from $tb -print ===> $data00 -if $data00 != $rowNum then - return -1 -endi - -sql select count(tbcol) from $tb -print ===> $data00 -if $data00 != $rowNum then - return -1 -endi - -print =============== step3 -sql select count(tbcol) from $tb where ts <= 1519833840000 -print ===> $data00 -if $data00 != 5 then - return -1 -endi - -print =============== step4 -sql select count(tbcol) as b from $tb -print ===> $data00 -if $data00 != $rowNum then - return -1 -endi - -print =============== step5 -sql select count(tbcol) as b from $tb interval(1m) -print ===> $data01 -if $data01 != 1 then - return -1 -endi - -sql select count(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != $rowNum then - return -1 -endi - -print =============== step6 -sql select count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) -print ===> $data01 -if $data01 != 1 then - return -1 -endi -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select count(*) from $mt -print ===> $data00 -if $data00 != $totalNum then - return -1 -endi - -sql select count(tbcol) from $mt -print ===> $data00 -if $data00 != $totalNum then - return -1 -endi - -print =============== step8 -sql select count(tbcol) as c from $mt where ts <= 1519833840000 -print ===> $data00 -if $data00 != 50 then - return -1 -endi - -sql select count(tbcol) as c from $mt where tgcol < 5 -print ===> $data00 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol) as c from $mt where tgcol < 5 and ts <= 1519833840000 -print ===> $data00 -if $data00 != 25 then - return -1 -endi - -print =============== step9 -sql select count(tbcol) as b from $mt interval(1m) -print ===> $data01 -if $data01 != 10 then - return -1 -endi - -sql select count(tbcol) as b from $mt interval(1d) -print ===> $data01 -if $data01 != 200 then - return -1 -endi - -print =============== step10 -sql select count(tbcol) as b from $mt group by tgcol -print ===> $data00 -if $data00 != $rowNum then - return -1 -endi - -if $rows != $tbNum then - return -1 -endi - -print =============== step11 -sql select count(tbcol) as b from $mt where ts <= 1519833840000 interval(1m) group by tgcol -print ===> $data01 -if $data01 != 1 then - return -1 -endi -if $rows != 50 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/stable/replica2_dnode4.sim b/tests/script/unique/stable/replica2_dnode4.sim deleted file mode 100644 index 4f8211d5d4b7ec5cbee3bee8104d0842346978d6..0000000000000000000000000000000000000000 --- a/tests/script/unique/stable/replica2_dnode4.sim +++ /dev/null @@ -1,218 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 -system sh/exec.sh -n dnode1 -s start - -sql connect - -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start - -$x = 0 -createDnode: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi -sql show dnodes; -if $data4_2 == offline then - goto createDnode -endi -if $data4_3 == offline then - goto createDnode -endi -if $data4_4 == offline then - goto createDnode -endi - -print ======================== dnode1 start - -$dbPrefix = r2d4_db -$tbPrefix = r2d4_tb -$mtPrefix = r2d4_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db replica 2 -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $val = $x * 60000 - $ms = 1519833600000 + $val - sql insert into $tb values ($ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sql show vgroups -print vgroups ==> $rows -if $rows != 3 then - return -1 -endi - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select count(*) from $tb -print ===> $data00 -if $data00 != $rowNum then - return -1 -endi - -sql select count(tbcol) from $tb -print ===> $data00 -if $data00 != $rowNum then - return -1 -endi - -print =============== step3 -sql select count(tbcol) from $tb where ts <= 1519833840000 -print ===> $data00 -if $data00 != 5 then - return -1 -endi - -print =============== step4 -sql select count(tbcol) as b from $tb -print ===> $data00 -if $data00 != $rowNum then - return -1 -endi - -print =============== step5 -sql select count(tbcol) as b from $tb interval(1m) -print ===> $data01 -if $data01 != 1 then - return -1 -endi - -sql select count(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != $rowNum then - return -1 -endi - -print =============== step6 -sql select count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) -print ===> $data01 -if $data01 != 1 then - return -1 -endi -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select count(*) from $mt -print ===> $data00 -if $data00 != $totalNum then - return -1 -endi - -sql select count(tbcol) from $mt -print ===> $data00 -if $data00 != $totalNum then - return -1 -endi - -print =============== step8 -sql select count(tbcol) as c from $mt where ts <= 1519833840000 -print ===> $data00 -if $data00 != 50 then - return -1 -endi - -sql select count(tbcol) as c from $mt where tgcol < 5 -print ===> $data00 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol) as c from $mt where tgcol < 5 and ts <= 1519833840000 -print ===> $data00 -if $data00 != 25 then - return -1 -endi - -print =============== step9 -sql select count(tbcol) as b from $mt interval(1m) -print ===> $data01 -if $data01 != 10 then - return -1 -endi - -sql select count(tbcol) as b from $mt interval(1d) -print ===> $data01 -if $data01 != 200 then - return -1 -endi - -print =============== step10 -sql select count(tbcol) as b from $mt group by tgcol -print ===> $data00 -if $data00 != $rowNum then - return -1 -endi - -if $rows != $tbNum then - return -1 -endi - -print =============== step11 -sql select count(tbcol) as b from $mt where ts <= 1519833840000 interval(1m) group by tgcol -print ===> $data01 -if $data01 != 1 then - return -1 -endi -if $rows != 50 then - return -1 -endi -return -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/stable/testSuite.sim b/tests/script/unique/stable/testSuite.sim deleted file mode 100644 index 2e3ab31a44201f8e01fd70d8a0b2dffe8f51d7df..0000000000000000000000000000000000000000 --- a/tests/script/unique/stable/testSuite.sim +++ /dev/null @@ -1,8 +0,0 @@ -run unique/metrics/balance_replica1.sim -run unique/metrics/dnode2_stop.sim -run unique/metrics/dnode2.sim -run unique/metrics/dnode3.sim -run unique/metrics/replica2_dnode4.sim -run unique/metrics/replica2_vnode3.sim -run unique/metrics/replica3_dnode6.sim -run unique/metrics/replica3_vnode3.sim \ No newline at end of file diff --git a/tests/script/unique/vnode/backup/replica4.sim b/tests/script/unique/vnode/backup/replica4.sim deleted file mode 100644 index c0ff267c734b58e1f198932c86e78c817625981e..0000000000000000000000000000000000000000 --- a/tests/script/unique/vnode/backup/replica4.sim +++ /dev/null @@ -1,220 +0,0 @@ -system sh/stop_dnodes.sh - - - - - - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/cfg.sh -n dnode2 -c walLevel -v 1 -system sh/cfg.sh -n dnode3 -c walLevel -v 1 -system sh/cfg.sh -n dnode4 -c walLevel -v 1 - -system sh/exec.sh -n dnode1 -s start -$x = 0 -connectTbase: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi -sql connect -x connectTbase - -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 - -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sleep 3001 - -$N = 10 -$table = table_r4 -$db = db1 - -print =================== step 1 - -$x = 0 -created: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi -sql create database $db replica 4 -x created -sql use $db - -$x = 0 -create1: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi -sql create table $table (ts timestamp, speed int) -x create1 -sleep 3001 - -print =================== step 2 -$x = 1 -$y = $x + $N -$expect = $N -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 3 -system sh/exec.sh -n dnode2 -s stop -sleep 2000 -$y = $x + $N -$expect = $N * 2 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 4 -system sh/exec.sh -n dnode2 -s start -sleep 2000 -$y = $x + $N -$expect = $N * 3 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 5 -system sh/exec.sh -n dnode3 -s stop -sleep 2000 -$y = $x + $N -$expect = $N * 4 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , 10) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 6 -system sh/exec.sh -n dnode3 -s start -sleep 2000 -$y = $x + $N -$expect = $N * 5 -while $x < $y -$ms = $x . m -sql insert into $table values (now + $ms , $x ) -$x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then -return -1 -endi - - -print =================== step 7 -system sh/exec.sh -n dnode4 -s stop -sleep 2000 -$y = $x + $N -$expect = $N * 6 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , 10) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 8 -system sh/exec.sh -n dnode4 -s start -sleep 2000 -$y = $x + $N -$expect = $N * 7 -while $x < $y -$ms = $x . m -sql insert into $table values (now + $ms , $x ) -$x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then -return -1 -endi - -print =================== step 9 -system sh/exec.sh -n dnode1 -s stop -sleep 2000 -$y = $x + $N -$expect = $N * 8 -while $x < $y -$ms = $x . m -sql insert into $table values (now + $ms , 10) -$x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then -return -1 -endi - -print =================== step 10 -system sh/exec.sh -n dnode1 -s start -sleep 2000 -$y = $x + $N -$expect = $N * 9 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , 10) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -system sh/exec.sh -n dnode2 -s stop -system sh/exec.sh -n dnode3 -s stop -system sh/exec.sh -n dnode4 -s stop - diff --git a/tests/script/unique/vnode/backup/replica5.sim b/tests/script/unique/vnode/backup/replica5.sim deleted file mode 100644 index 1223cf6b585f7affeb40e2f625a3f6cbd79dae80..0000000000000000000000000000000000000000 --- a/tests/script/unique/vnode/backup/replica5.sim +++ /dev/null @@ -1,263 +0,0 @@ -system sh/stop_dnodes.sh - - - - - - - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 -system sh/deploy.sh -n dnode5 -i 5 - -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/cfg.sh -n dnode2 -c walLevel -v 1 -system sh/cfg.sh -n dnode3 -c walLevel -v 1 -system sh/cfg.sh -n dnode4 -c walLevel -v 1 -system sh/cfg.sh -n dnode5 -c walLevel -v 1 - -system sh/exec.sh -n dnode1 -s start - -$x = 0 -connectTbase: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi -sql connect -x connectTbase - -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -sql create dnode $hostname5 - -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -system sh/exec.sh -n dnode5 -s start -sleep 3001 - -$N = 10 -$table = table_r5 -$db = db1 - -print =================== step 1 - -$x = 0 -created: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi -sql create database $db replica 5 -x created -sql use $db - -$x = 0 -create1: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi -sql create table $table (ts timestamp, speed int) -x create1 - -sleep 3001 - -print =================== step 2 -$x = 1 -$y = $x + $N -$expect = $N -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 3 -system sh/exec.sh -n dnode2 -s stop -sleep 2000 -$y = $x + $N -$expect = $N * 2 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 4 -system sh/exec.sh -n dnode2 -s start -sleep 2000 -$y = $x + $N -$expect = $N * 3 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 5 -system sh/exec.sh -n dnode3 -s stop -sleep 2000 -$y = $x + $N -$expect = $N * 4 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , 10) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 6 -system sh/exec.sh -n dnode3 -s start -sleep 2000 -$y = $x + $N -$expect = $N * 5 -while $x < $y -$ms = $x . m -sql insert into $table values (now + $ms , $x ) -$x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then -return -1 -endi - - -print =================== step 7 -system sh/exec.sh -n dnode4 -s stop -sleep 2000 -$y = $x + $N -$expect = $N * 6 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , 10) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 8 -system sh/exec.sh -n dnode4 -s start -sleep 2000 -$y = $x + $N -$expect = $N * 7 -while $x < $y -$ms = $x . m -sql insert into $table values (now + $ms , $x ) -$x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then -return -1 -endi - - -print =================== step 9 -system sh/exec.sh -n dnode5 -s stop -sleep 2000 -$y = $x + $N -$expect = $N * 8 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , 10) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 10 -system sh/exec.sh -n dnode5 -s start -sleep 2000 -$y = $x + $N -$expect = $N * 9 -while $x < $y -$ms = $x . m -sql insert into $table values (now + $ms , $x ) -$x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then -return -1 -endi - -print =================== step 11 -system sh/exec.sh -n dnode1 -s stop -sleep 2000 -$y = $x + $N -$expect = $N * 10 -while $x < $y -$ms = $x . m -sql insert into $table values (now + $ms , 10) -$x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then -return -1 -endi - -print =================== step 12 -system sh/exec.sh -n dnode1 -s start -sleep 2000 -$y = $x + $N -$expect = $N * 11 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , 10) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -system sh/exec.sh -n dnode2 -s stop -system sh/exec.sh -n dnode3 -s stop -system sh/exec.sh -n dnode4 -s stop -system sh/exec.sh -n dnode5 -s stop - diff --git a/tests/script/unique/vnode/many.sim b/tests/script/unique/vnode/many.sim deleted file mode 100644 index a9298b1cf275c24ab6ebe7fea9387a51d6d044ba..0000000000000000000000000000000000000000 --- a/tests/script/unique/vnode/many.sim +++ /dev/null @@ -1,147 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode4 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 -system sh/exec.sh -n dnode1 -s start - -sql connect -sql create dnode $hostname2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi - -sql show mnodes -print mnode1 $data2_1 -print mnode1 $data2_2 -print mnode1 $data2_3 -if $data2_1 != master then - goto step1 -endi - -print ========= step1 -sql create database db1 replica 2 -sql create database db2 replica 2 -sql create database db3 replica 2 -sql create database db4 replica 2 -sql create table db1.tb1 (ts timestamp, i int) -sql create table db2.tb2 (ts timestamp, i int) -sql create table db3.tb3 (ts timestamp, i int) -sql create table db4.tb4 (ts timestamp, i int) -sql insert into db1.tb1 values(now, 1) -sql insert into db2.tb2 values(now, 1) -sql insert into db3.tb3 values(now, 1) -sql insert into db4.tb4 values(now, 1) - -sql select count(*) from db1.tb1 -$lastRows1 = $rows -sql select count(*) from db2.tb2 -$lastRows2 = $rows -sql select count(*) from db3.tb3 -$lastRows3 = $rows -sql select count(*) from db4.tb4 -$lastRows4 = $rows - -print ======== step2 -run_back unique/vnode/back_insert_many.sim -sleep 3000 - -print ======== step3 - -$x = 0 -loop: - -print ======== step4 -system sh/exec.sh -n dnode3 -s stop -sleep 3000 -system sh/exec.sh -n dnode3 -s start -sleep 3000 - -print ======== step5 -system sh/exec.sh -n dnode2 -s stop -sleep 3000 -system sh/exec.sh -n dnode2 -s start -sleep 3000 - -print ======== step6 -sql select count(*) from db1.tb1 -print select count(*) from db1.tb1 ==> $data00 $lastRows1 -if $data00 <= $lastRows1 then - return -1 -endi -$lastRows1 = $data00 - -sql select count(*) from db2.tb2 -print select count(*) from db2.tb2 ==> $data00 $lastRows2 -if $data00 <= $lastRows2 then - return -1 -endi -$lastRows2 = $data00 - -sql select count(*) from db3.tb3 -print select count(*) from db3.tb3 ==> $data00 $lastRows3 -if $data00 <= $lastRows3 then - return -1 -endi -$lastRows3 = $data00 - -sql select count(*) from db4.tb4 -print select count(*) from db4.tb4 ==> $data00 $lastRows4 -if $data00 <= $lastRows4 then - return -1 -endi -$lastRows4 = $data00 - -print ======== step7 - -print ======== loop Times $x - -if $x < 2 then - $x = $x + 1 - goto loop -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/vnode/replica2_a_large.sim b/tests/script/unique/vnode/replica2_a_large.sim deleted file mode 100644 index 6f318038454a171445600e37d17852b2c2de835e..0000000000000000000000000000000000000000 --- a/tests/script/unique/vnode/replica2_a_large.sim +++ /dev/null @@ -1,103 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode4 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode1 -c debugFlag -v 131 -system sh/cfg.sh -n dnode2 -c debugFlag -v 131 -system sh/cfg.sh -n dnode3 -c debugFlag -v 131 -system sh/cfg.sh -n dnode4 -c debugFlag -v 131 -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -sql create dnode $hostname2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode2 -s start -t -system sh/exec.sh -n dnode3 -s start -t -sleep 2000 - -print ========= step1 -sql create database db replica 2 -#sql create table db.tb1 (ts timestamp, i int) -#sql create table db.tb2 (ts timestamp, i int) -#sql create table db.tb3 (ts timestamp, i int) -#sql create table db.tb4 (ts timestamp, i int) -#sql insert into db.tb1 values(now, 1) -#sql select count(*) from db.tb1 - -sql create database db replica 2 -sql create table db.tb (ts timestamp, i int) -sql insert into db.tb values(now, 1) -sql select count(*) from db.tb -$lastRows = $rows - -print ======== step2 -#run_back unique/vnode/back_insert_many.sim -run_back unique/vnode/back_insert.sim -sleep 2000 - -print ======== step3 - -$x = 0 -loop: - -print ======== step4 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 10000 -system sh/exec.sh -n dnode2 -s start -t -sleep 10000 - -print ======== step5 -system sh/exec.sh -n dnode3 -s stop -x SIGINT -sleep 10000 -system sh/exec.sh -n dnode3 -s start -t -sleep 10000 - -print ======== step6 -#sql select count(*) from db.tb1 -#print select count(*) from db.tb1 ==> $data00 $lastRows -sql select count(*) from db.tb -print select count(*) from db.tb ==> $data00 $lastRows -if $data00 <= $lastRows then - return -1 -endi - -print ======== step7 -$lastRows = $data00 -print ======== loop Times $x - -if $x < 10 then - $x = $x + 1 - goto loop -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/vnode/replica2_basic2.sim b/tests/script/unique/vnode/replica2_basic2.sim deleted file mode 100644 index c081f878dda513a3b11c9546db4dad31c3d2c5ff..0000000000000000000000000000000000000000 --- a/tests/script/unique/vnode/replica2_basic2.sim +++ /dev/null @@ -1,223 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode4 -c wallevel -v 2 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 - -print ========= start dnodes -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect -sql create dnode $hostname2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -sleep 2000 - -sql reset query cache - -print ========= step1 -sql create database d1 replica 2 -sql create database d2 replica 2 -sql create database d3 replica 2 -sql create database d4 replica 2 - -sql create table d1.t1 (ts timestamp, i int) -sql create table d2.t2 (ts timestamp, i int) -sql create table d3.t3 (ts timestamp, i int) -sql create table d4.t4 (ts timestamp, i int) - -sql insert into d1.t1 values(now, 1) -sql insert into d2.t2 values(now, 1) -sql insert into d3.t3 values(now, 1) -sql insert into d4.t4 values(now, 1) - -sql select * from d1.t1 -if $rows != 1 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 1 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 1 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 1 then - return -1 -endi - -sql show dnodes -print dnode1 ==> openVnodes: $data2_1 -print dnode2 ==> openVnodes: $data2_2 -print dnode3 ==> openVnodes: $data2_3 - -if $data2_1 != 0 then - return -1 -endi - -if $data2_2 != 4 then - return -1 -endi - -if $data2_3 != 4 then - return -1 -endi - -if $data4_1 != ready then - print dnode1 status should ready but is $data4_1 - return -1 -endi - -if $data4_2 != ready then - return -1 -endi - -if $data4_3 != ready then - return -1 -endi - -print ========= step2 -sql insert into d1.t1 values(now, 2) -sql insert into d2.t2 values(now, 2) -sql insert into d3.t3 values(now, 2) -sql insert into d4.t4 values(now, 2) - -sql select * from d1.t1 -if $rows != 2 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 2 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 2 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 2 then - return -1 -endi - -print ========= step3 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 3000 - -#sql insert into d1.t1 values(now, 3) -#sql insert into d2.t2 values(now, 3) -#sql insert into d3.t3 values(now, 3) -#sql insert into d4.t4 values(now, 3) - -#sql select * from d1.t1 -#if $rows != 2 then -# return -1 -#endi - -#sql select * from d2.t2 -#if $rows != 2 then -# return -1 -#endi - -#sql select * from d3.t3 -#if $rows != 2 then -# return -1 -#endi - -#sql select * from d4.t4 -#if $rows != 2 then -# return -1 -#endi - -print ========= step4 -system sh/exec.sh -n dnode2 -s start -sleep 3000 -system sh/exec.sh -n dnode3 -s stop -x SIGINT -sleep 3000 - -#sql insert into d1.t1 values(now, 4) -#sql insert into d2.t2 values(now, 4) -#sql insert into d3.t3 values(now, 4) -#sql insert into d4.t4 values(now, 4) - -#sql select * from d1.t1 -#if $rows != 2 then -# return -1 -#endi - -#sql select * from d2.t2 -#if $rows != 2 then -# return -1 -#endi - -#sql select * from d3.t3 -#if $rows != 2 then -# return -1 -#endi - -#sql select * from d4.t4 -#if $rows != 2 then -# return -1 -#endi - -print ========= step5 -system sh/exec.sh -n dnode3 -s start -sleep 3000 - -sql insert into d1.t1 values(now, 5) -sql insert into d2.t2 values(now, 5) -sql insert into d3.t3 values(now, 5) -sql insert into d4.t4 values(now, 5) - -sql select * from d1.t1 -if $rows != 3 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 3 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 3 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 3 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/vnode/replica2_repeat.sim b/tests/script/unique/vnode/replica2_repeat.sim deleted file mode 100644 index ac68d591648b2dd66f3fdda8c70b0af40c814459..0000000000000000000000000000000000000000 --- a/tests/script/unique/vnode/replica2_repeat.sim +++ /dev/null @@ -1,110 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode4 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 -system sh/exec.sh -n dnode1 -s start - -sql connect -sql create dnode $hostname2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start - -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi - -sql show mnodes -print mnode1 $data2_1 -print mnode1 $data2_2 -print mnode1 $data2_3 -if $data2_1 != master then - goto step1 -endi - -print ========= step1 -sql create database db replica 2 -sql create table db.tb (ts timestamp, i int) -sql insert into db.tb values(now, 1) -sql select count(*) from db.tb -$lastRows = $rows - -print ======== step2 -run_back unique/vnode/back_insert.sim -sleep 2000 - -print ======== step3 - -$x = 0 -loop: - -print ======== step4 -system sh/exec.sh -n dnode2 -s stop -sleep 3000 -system sh/exec.sh -n dnode2 -s start -sleep 3000 - -print ======== step5 -system sh/exec.sh -n dnode3 -s stop -sleep 3000 -system sh/exec.sh -n dnode3 -s start -sleep 3000 - -print ======== step6 -sql select count(*) from db.tb -print select count(*) from db.tb ==> $data00 $lastRows -if $data00 <= $lastRows then - return -1 -endi - -print ======== step7 -$lastRows = $data00 -print ======== loop Times $x - -if $x < 2 then - $x = $x + 1 - goto loop -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/vnode/replica3_basic.sim b/tests/script/unique/vnode/replica3_basic.sim deleted file mode 100644 index 0ff42b523b8982c85bd84bb251715585a66137fc..0000000000000000000000000000000000000000 --- a/tests/script/unique/vnode/replica3_basic.sim +++ /dev/null @@ -1,233 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3 - -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start - -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi - -sql show mnodes -print mnode1 $data2_1 -print mnode1 $data2_2 -print mnode1 $data2_3 -if $data2_1 != master then - goto step1 -endi -if $data2_2 != slave then - goto step1 -endi -if $data2_3 != slave then - goto step1 -endi - -$N = 10 -$table = table_r3 -$db = db1 - -print =================== step 1 - -sql create database $db replica 3 -sql use $db -sql create table $table (ts timestamp, speed int) -sleep 3001 - -print =================== step 2 -$x = 1 -$y = $x + $N -$expect = $N -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 3 -system sh/exec.sh -n dnode2 -s stop -sleep 2000 -$y = $x + $N -$expect = $N * 2 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 4 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -step4: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show db1.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step4 -endi - -$y = $x + $N -$expect = $N * 3 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 5 -system sh/exec.sh -n dnode3 -s stop -$y = $x + $N -$expect = $N * 4 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , 10) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 6 -system sh/exec.sh -n dnode3 -s start - -$x = 0 -step6: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show db1.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step6 -endi - -$y = $x + $N -$expect = $N * 5 -while $x < $y -$ms = $x . m -sql insert into $table values (now + $ms , $x ) -$x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then -return -1 -endi - -print =================== step 7 -system sh/exec.sh -n dnode1 -s stop -$y = $x + $N -$expect = $N * 6 -while $x < $y -$ms = $x . m -sql insert into $table values (now + $ms , 10) -$x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then -return -1 -endi - -print =================== step 8 -system sh/exec.sh -n dnode1 -s start - -$x = 0 -step8: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show db1.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step8 -endi - -$y = $x + $N -$expect = $N * 7 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , 10) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/vnode/replica3_vgroup.sim b/tests/script/unique/vnode/replica3_vgroup.sim deleted file mode 100644 index de4c48eca5683fc7599d545e2887ae8d2c073b82..0000000000000000000000000000000000000000 --- a/tests/script/unique/vnode/replica3_vgroup.sim +++ /dev/null @@ -1,71 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3 - -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -sleep 2000 - -$N = 10 -$table = table_r3 -$db = db1 - -sleep 2000 - -print =================== step 1 - -sql create database $db replica 3 -sql use $db -sql create table st (ts timestamp, speed int) tags (t1 int) -sleep 3001 - - -$tbPre = m -$N = 300 -$x = 0 -$y = $x + $N -while $x < $y - $table = $tbPre . $x - sql create table $table using st tags ( $x ) - $ms = $x . m - sql insert into $table values (now + $ms , $x ) - $x = $x + 1 -endw - - -#print =================== step 2 -$x = -500 -$y = $x + $N -while $x < $y - $ms = $x . m - sql insert into $table values (now $ms , $x ) - $x = $x + 1 -endw - -$expect = $N + 1 -sql select * from $table -print sql select * from $table -> $rows points expect $expect -if $rows != $expect then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/vnode/testSuite.sim b/tests/script/unique/vnode/testSuite.sim deleted file mode 100644 index 3a9db66beb77d29b7d6bcb68d070edd91c97e199..0000000000000000000000000000000000000000 --- a/tests/script/unique/vnode/testSuite.sim +++ /dev/null @@ -1,6 +0,0 @@ -run unique/vnode/many.sim -run unique/vnode/replica2_basic2.sim -run unique/vnode/replica2_repeat.sim -run unique/vnode/replica3_basic.sim -run unique/vnode/replica3_repeat.sim -run unique/vnode/replica3_vgroup.sim diff --git a/tests/script/windows/alter/metrics.sim b/tests/script/windows/alter/metrics.sim deleted file mode 100644 index 7dfda05bd0b0849fa6cbdb27e064113ad2fec595..0000000000000000000000000000000000000000 --- a/tests/script/windows/alter/metrics.sim +++ /dev/null @@ -1,769 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -print ======== step1 -sql create database d2 -sql use d2 -sql create table mt (ts timestamp, a int) TAGS (t int) -sql create table tb using mt tags (1) -sql insert into tb values(now-28d, -28) -sql insert into tb values(now-27d, -27) -sql insert into tb values(now-26d, -26) -sql select * from tb -if $rows != 3 then - return -1 -endi -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != t then - return -1 -endi -if $data21 != INT then - return -1 -endi - -print ======== step2 -sql alter table mt add column b smallint -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != t then - return -1 -endi -if $data31 != INT then - return -1 -endi - -print ======== step3 -sql alter table mt add column c tinyint -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != c then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi -if $data40 != t then - return -1 -endi -if $data41 != INT then - return -1 -endi - -print ======== step4 -sql alter table mt add column d int -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != c then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi -if $data40 != d then - return -1 -endi -if $data41 != INT then - return -1 -endi -if $data50 != t then - return -1 -endi -if $data51 != INT then - return -1 -endi - -print ======== step5 -sql alter table mt add column e bigint -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != c then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi -if $data40 != d then - return -1 -endi -if $data41 != INT then - return -1 -endi -if $data50 != e then - return -1 -endi -if $data51 != BIGINT then - return -1 -endi -if $data60 != t then - return -1 -endi -if $data61 != INT then - return -1 -endi - -print ======== step6 -sql alter table mt add column f float -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != c then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi -if $data40 != d then - return -1 -endi -if $data41 != INT then - return -1 -endi -if $data50 != e then - return -1 -endi -if $data51 != BIGINT then - return -1 -endi -if $data60 != f then - return -1 -endi -if $data61 != FLOAT then - return -1 -endi -if $data70 != t then - return -1 -endi -if $data71 != INT then - return -1 -endi - -print ======== step7 -sql alter table mt add column g double -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != c then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi -if $data40 != d then - return -1 -endi -if $data41 != INT then - return -1 -endi -if $data50 != e then - return -1 -endi -if $data51 != BIGINT then - return -1 -endi -if $data60 != f then - return -1 -endi -if $data61 != FLOAT then - return -1 -endi -if $data70 != g then - return -1 -endi -if $data71 != DOUBLE then - return -1 -endi -if $data80 != t then - return -1 -endi -if $data81 != INT then - return -1 -endi - -print ======== step8 -sql alter table mt add column h binary(10) -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != c then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi -if $data40 != d then - return -1 -endi -if $data41 != INT then - return -1 -endi -if $data50 != e then - return -1 -endi -if $data51 != BIGINT then - return -1 -endi -if $data60 != f then - return -1 -endi -if $data61 != FLOAT then - return -1 -endi -if $data70 != g then - return -1 -endi -if $data71 != DOUBLE then - return -1 -endi -if $data80 != h then - return -1 -endi -if $data81 != BINARY then - return -1 -endi -if $data82 != 10 then - return -1 -endi -if $data90 != t then - return -1 -endi -if $data91 != INT then - return -1 -endi - -print ======== step9 -print ======== step10 -system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 -system sh/exec.sh -n dnode1 -s start -sleep 3000 - -sql use d2 -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != c then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi -if $data40 != d then - return -1 -endi -if $data41 != INT then - return -1 -endi -if $data50 != e then - return -1 -endi -if $data51 != BIGINT then - return -1 -endi -if $data60 != f then - return -1 -endi -if $data61 != FLOAT then - return -1 -endi -if $data70 != g then - return -1 -endi -if $data71 != DOUBLE then - return -1 -endi -if $data80 != h then - return -1 -endi -if $data81 != BINARY then - return -1 -endi -if $data82 != 10 then - return -1 -endi -if $data90 != t then - return -1 -endi -if $data91 != INT then - return -1 -endi - -print ======== step11 -#sql alter table mt drop column a -x step111 -# return -1 -#step111: - -#sql alter table mt drop column ts -x step112 -# return -1 -#step112: - -#sql alter table mt drop column cdfg -x step113 -# return -1 -#step113: - -#sql alter table mt add column a -x step114 -# return -1 -#step114: - -#sql alter table mt add column b -x step115 -# return -1 -#step115: - -print ======== step12 -sql alter table mt drop column b -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != c then - return -1 -endi -if $data21 != TINYINT then - return -1 -endi -if $data30 != d then - return -1 -endi -if $data31 != INT then - return -1 -endi -if $data40 != e then - return -1 -endi -if $data41 != BIGINT then - return -1 -endi -if $data50 != f then - return -1 -endi -if $data51 != FLOAT then - return -1 -endi -if $data60 != g then - return -1 -endi -if $data61 != DOUBLE then - return -1 -endi -if $data70 != h then - return -1 -endi -if $data71 != BINARY then - return -1 -endi -if $data72 != 10 then - return -1 -endi -if $data80 != t then - return -1 -endi -if $data81 != INT then - return -1 -endi - -print ======== step13 -sql alter table mt drop column c -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != d then - return -1 -endi -if $data21 != INT then - return -1 -endi -if $data30 != e then - return -1 -endi -if $data31 != BIGINT then - return -1 -endi -if $data40 != f then - return -1 -endi -if $data41 != FLOAT then - return -1 -endi -if $data50 != g then - return -1 -endi -if $data51 != DOUBLE then - return -1 -endi -if $data60 != h then - return -1 -endi -if $data61 != BINARY then - return -1 -endi -if $data62 != 10 then - return -1 -endi -if $data70 != t then - return -1 -endi -if $data71 != INT then - return -1 -endi - -print ======== step14 -sql alter table mt drop column d -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != e then - return -1 -endi -if $data21 != BIGINT then - return -1 -endi -if $data30 != f then - return -1 -endi -if $data31 != FLOAT then - return -1 -endi -if $data40 != g then - return -1 -endi -if $data41 != DOUBLE then - return -1 -endi -if $data50 != h then - return -1 -endi -if $data51 != BINARY then - return -1 -endi -if $data52 != 10 then - return -1 -endi -if $data60 != t then - return -1 -endi -if $data61 != INT then - return -1 -endi - -print ======== step15 -sql alter table mt drop column e -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != f then - return -1 -endi -if $data21 != FLOAT then - return -1 -endi -if $data30 != g then - return -1 -endi -if $data31 != DOUBLE then - return -1 -endi -if $data40 != h then - return -1 -endi -if $data41 != BINARY then - return -1 -endi -if $data42 != 10 then - return -1 -endi -if $data50 != t then - return -1 -endi -if $data51 != INT then - return -1 -endi - -print ======== step16 -sql alter table mt drop column f -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != g then - return -1 -endi -if $data21 != DOUBLE then - return -1 -endi -if $data30 != h then - return -1 -endi -if $data31 != BINARY then - return -1 -endi -if $data32 != 10 then - return -1 -endi -if $data40 != t then - return -1 -endi -if $data41 != INT then - return -1 -endi - -print ======== step17 -sql alter table mt drop column g -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != h then - return -1 -endi -if $data21 != BINARY then - return -1 -endi -if $data22 != 10 then - return -1 -endi -if $data30 != t then - return -1 -endi -if $data31 != INT then - return -1 -endi - -print ============= step18 -sql alter table mt drop column h -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != t then - return -1 -endi -if $data21 != INT then - return -1 -endi -if $data30 != null then - return -1 -endi - -print ======= over -sql drop database d2 -sql show databases -if $rows != 0 then - return -1 -endi - diff --git a/tests/script/windows/alter/table.sim b/tests/script/windows/alter/table.sim deleted file mode 100644 index 52757da20ef226ececec64698cea7846584a73bd..0000000000000000000000000000000000000000 --- a/tests/script/windows/alter/table.sim +++ /dev/null @@ -1,672 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -print ======== step1 -sql create database d1 -sql use d1 -sql create table tb (ts timestamp, a int) -sql insert into tb values(now-28d, -28) -sql insert into tb values(now-27d, -27) -sql insert into tb values(now-26d, -26) -sql select * from tb -if $rows != 3 then - return -1 -endi -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi - -print ======== step2 -sql alter table tb add column b smallint -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi - -print ======== step3 -sql alter table tb add column c tinyint -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != c then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi - -print ======== step4 -sql alter table tb add column d int -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != c then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi -if $data40 != d then - return -1 -endi -if $data41 != INT then - return -1 -endi - -print ======== step5 -sql alter table tb add column e bigint -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != c then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi -if $data40 != d then - return -1 -endi -if $data41 != INT then - return -1 -endi -if $data50 != e then - return -1 -endi -if $data51 != BIGINT then - return -1 -endi - -print ======== step6 -sql alter table tb add column f float -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != c then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi -if $data40 != d then - return -1 -endi -if $data41 != INT then - return -1 -endi -if $data50 != e then - return -1 -endi -if $data51 != BIGINT then - return -1 -endi -if $data60 != f then - return -1 -endi -if $data61 != FLOAT then - return -1 -endi - -print ======== step7 -sql alter table tb add column g double -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != c then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi -if $data40 != d then - return -1 -endi -if $data41 != INT then - return -1 -endi -if $data50 != e then - return -1 -endi -if $data51 != BIGINT then - return -1 -endi -if $data60 != f then - return -1 -endi -if $data61 != FLOAT then - return -1 -endi -if $data70 != g then - return -1 -endi -if $data71 != DOUBLE then - return -1 -endi - -print ======== step8 -sql alter table tb add column h binary(10) -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != c then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi -if $data40 != d then - return -1 -endi -if $data41 != INT then - return -1 -endi -if $data50 != e then - return -1 -endi -if $data51 != BIGINT then - return -1 -endi -if $data60 != f then - return -1 -endi -if $data61 != FLOAT then - return -1 -endi -if $data70 != g then - return -1 -endi -if $data71 != DOUBLE then - return -1 -endi -if $data80 != h then - return -1 -endi -if $data81 != BINARY then - return -1 -endi -if $data82 != 10 then - return -1 -endi - -print ======== step9 -print ======== step10 -system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 -system sh/exec.sh -n dnode1 -s start -sleep 3000 - -sql use d1 -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != c then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi -if $data40 != d then - return -1 -endi -if $data41 != INT then - return -1 -endi -if $data50 != e then - return -1 -endi -if $data51 != BIGINT then - return -1 -endi -if $data60 != f then - return -1 -endi -if $data61 != FLOAT then - return -1 -endi -if $data70 != g then - return -1 -endi -if $data71 != DOUBLE then - return -1 -endi -if $data80 != h then - return -1 -endi -if $data81 != BINARY then - return -1 -endi -if $data82 != 10 then - return -1 -endi - -print ======== step11 -sql alter table drop column a -x step111 - return -1 -step111: - -sql alter table drop column ts -x step112 - return -1 -step112: - -sql alter table drop column cdfg -x step113 - return -1 -step113: - -sql alter table add column a -x step114 - return -1 -step114: - -sql alter table add column b -x step115 - return -1 -step115: - -print ======== step12 -sql alter table tb drop column b -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != c then - return -1 -endi -if $data21 != TINYINT then - return -1 -endi -if $data30 != d then - return -1 -endi -if $data31 != INT then - return -1 -endi -if $data40 != e then - return -1 -endi -if $data41 != BIGINT then - return -1 -endi -if $data50 != f then - return -1 -endi -if $data51 != FLOAT then - return -1 -endi -if $data60 != g then - return -1 -endi -if $data61 != DOUBLE then - return -1 -endi -if $data70 != h then - return -1 -endi -if $data71 != BINARY then - return -1 -endi -if $data72 != 10 then - return -1 -endi - -print ======== step13 -sql alter table tb drop column c -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != d then - return -1 -endi -if $data21 != INT then - return -1 -endi -if $data30 != e then - return -1 -endi -if $data31 != BIGINT then - return -1 -endi -if $data40 != f then - return -1 -endi -if $data41 != FLOAT then - return -1 -endi -if $data50 != g then - return -1 -endi -if $data51 != DOUBLE then - return -1 -endi -if $data60 != h then - return -1 -endi -if $data61 != BINARY then - return -1 -endi -if $data62 != 10 then - return -1 -endi - -print ======== step14 -sql alter table tb drop column d -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != e then - return -1 -endi -if $data21 != BIGINT then - return -1 -endi -if $data30 != f then - return -1 -endi -if $data31 != FLOAT then - return -1 -endi -if $data40 != g then - return -1 -endi -if $data41 != DOUBLE then - return -1 -endi -if $data50 != h then - return -1 -endi -if $data51 != BINARY then - return -1 -endi -if $data52 != 10 then - return -1 -endi - -print ======== step15 -sql alter table tb drop column e -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != f then - return -1 -endi -if $data21 != FLOAT then - return -1 -endi -if $data30 != g then - return -1 -endi -if $data31 != DOUBLE then - return -1 -endi -if $data40 != h then - return -1 -endi -if $data41 != BINARY then - return -1 -endi -if $data42 != 10 then - return -1 -endi - -print ======== step16 -sql alter table tb drop column f -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != g then - return -1 -endi -if $data21 != DOUBLE then - return -1 -endi -if $data30 != h then - return -1 -endi -if $data31 != BINARY then - return -1 -endi -if $data32 != 10 then - return -1 -endi - -print ======== step17 -sql alter table tb drop column g -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != h then - return -1 -endi -if $data21 != BINARY then - return -1 -endi -if $data22 != 10 then - return -1 -endi - -print ============= step18 -sql alter table tb drop column h -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != null then - return -1 -endi - -print ======= over -sql drop database d1 -sql show databases -if $rows != 0 then - return -1 -endi - diff --git a/tests/script/windows/compute/avg.sim b/tests/script/windows/compute/avg.sim deleted file mode 100644 index 7445808db5dbd293e781f66ed7010396413880bc..0000000000000000000000000000000000000000 --- a/tests/script/windows/compute/avg.sim +++ /dev/null @@ -1,158 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_av_db -$tbPrefix = m_av_tb -$mtPrefix = m_av_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select avg(tbcol) from $tb -print ===> $data00 -if $data00 != 9.500000000 then - return -1 -endi - -print =============== step3 -sql select avg(tbcol) from $tb where ts < now + 4m -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -print =============== step4 -sql select avg(tbcol) as b from $tb -print ===> $data00 -if $data00 != 9.500000000 then - return -1 -endi - -print =============== step5 -sql select avg(tbcol) as b from $tb interval(1m) -print ===> $data01 -if $data11 != 1.000000000 then - return -1 -endi - -sql select avg(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != 9.500000000 then - return -1 -endi - -print =============== step6 -sql select avg(tbcol) as b from $tb where ts < now + 4m interval(1m) -print ===> $data01 -if $data41 != 4.000000000 then - return -1 -endi -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select avg(tbcol) from $mt -print ===> $data00 -if $data00 != 9.500000000 then - return -1 -endi - -print =============== step8 -sql select avg(tbcol) as c from $mt where ts < now + 4m -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select avg(tbcol) as c from $mt where tgcol < 5 -print ===> $data00 -if $data00 != 9.500000000 then - return -1 -endi - -sql select avg(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -print =============== step9 -sql select avg(tbcol) as b from $mt interval(1m) -print ===> $data11 -if $data11 != 1.000000000 then - return -1 -endi - -sql select avg(tbcol) as b from $mt interval(1d) -print ===> $data01 -if $data01 != 9.500000000 then - return -1 -endi - -print =============== step10 -sql select avg(tbcol) as b from $mt group by tgcol -print ===> $data00 -if $data00 != 9.500000000 then - return -1 -endi - -if $rows != $tbNum then - return -1 -endi - -print =============== step11 -sql select avg(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol -print ===> $data11 -if $data11 != 1.000000000 then - return -1 -endi -if $rows != 50 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/compute/bottom.sim b/tests/script/windows/compute/bottom.sim deleted file mode 100644 index 18f6c0bd09d1e6ee4cba734dab20f2634e587d32..0000000000000000000000000000000000000000 --- a/tests/script/windows/compute/bottom.sim +++ /dev/null @@ -1,99 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_bo_db -$tbPrefix = m_bo_tb -$mtPrefix = m_bo_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select bottom(tbcol, 1) from $tb -print ===> $data01 -if $data01 != 0 then - return -1 -endi - -print =============== step3 -sql select bottom(tbcol, 1) from $tb where ts > now + 4m -print ===> $data01 -if $data01 != 5 then - return -1 -endi - -print =============== step4 -sql select bottom(tbcol, 1) as b from $tb -print ===> $data01 -if $data01 != 0 then - return -1 -endi - -print =============== step5 -sql select bottom(tbcol, 2) as b from $tb -print ===> $data01 $data11 -if $data01 != 0 then - return -1 -endi -if $data11 != 1 then - return -1 -endi - -print =============== step6 -sql select bottom(tbcol, 2) as b from $tb where ts > now + 4m -print ===> $data01 $data11 -if $data01 != 5 then - return -1 -endi -if $data11 != 6 then - return -1 -endi - -sql select bottom(tbcol, 122) as b from $tb -x step6 - return -1 -step6: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/compute/count.sim b/tests/script/windows/compute/count.sim deleted file mode 100644 index 227b49a8bd61d74f242f3f505fddd599a2862cdc..0000000000000000000000000000000000000000 --- a/tests/script/windows/compute/count.sim +++ /dev/null @@ -1,174 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_co_db -$tbPrefix = m_co_tb -$mtPrefix = m_co_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - - -sql select count(*) from $tb -print ===> select count(*) from $tb => $data00 -if $data00 != $rowNum then - return -1 -endi - -sql select count(tbcol) from $tb -print ===> $data00 -if $data00 != $rowNum then - return -1 -endi - -print =============== step3 -sql select count(tbcol) from $tb where ts < now + 4m -print ===> $data00 -if $data00 != 5 then - return -1 -endi - -print =============== step4 -sql select count(tbcol) as b from $tb -print ===> $data00 -if $data00 != $rowNum then - return -1 -endi - -print =============== step5 -sql select count(tbcol) as b from $tb interval(1m) -print ===> $data01 -if $data01 != 1 then - return -1 -endi - -sql select count(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != $rowNum then - return -1 -endi - -print =============== step6 -sql select count(tbcol) as b from $tb where ts < now + 4m interval(1m) -print ===> $data01 -if $data01 != 1 then - return -1 -endi -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select count(*) from $mt -print ===> $data00 -if $data00 != $totalNum then - return -1 -endi - -sql select count(tbcol) from $mt -print ===> $data00 -if $data00 != $totalNum then - return -1 -endi - -print =============== step8 -sql select count(tbcol) as c from $mt where ts < now + 4m -print ===> $data00 -if $data00 != 50 then - return -1 -endi - -sql select count(tbcol) as c from $mt where tgcol < 5 -print ===> $data00 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m -print ===> $data00 -if $data00 != 25 then - return -1 -endi - -print =============== step9 -sql select count(tbcol) as b from $mt interval(1m) -print ===> $data01 -if $data01 != 10 then - return -1 -endi -if $data11 != 10 then - return -1 -endi - -sql select count(tbcol) as b from $mt interval(1d) -print ===> $data01 -if $data01 != 200 then - return -1 -endi - -print =============== step10 -sql select count(tbcol) as b from $mt group by tgcol -print ===> $data00 -if $data00 != $rowNum then - return -1 -endi - -if $rows != $tbNum then - return -1 -endi - -print =============== step11 -sql select count(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol -print ===> $data01 -if $data01 != 1 then - return -1 -endi -if $rows != 50 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/compute/diff.sim b/tests/script/windows/compute/diff.sim deleted file mode 100644 index bdc5a0e3d8a781bdccc500ef667ad6f568ad8e66..0000000000000000000000000000000000000000 --- a/tests/script/windows/compute/diff.sim +++ /dev/null @@ -1,91 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_di_db -$tbPrefix = m_di_tb -$mtPrefix = m_di_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select diff(tbcol) from $tb -print ===> $data11 -if $data11 != 1 then - return -1 -endi - -print =============== step3 -sql select diff(tbcol) from $tb where ts > now + 4m -print ===> $data11 -if $data11 != 1 then - return -1 -endi - -sql select diff(tbcol) from $tb where ts < now + 4m -print ===> $data11 -if $data11 != 1 then - return -1 -endi - -print =============== step4 -sql select diff(tbcol) as b from $tb -print ===> $data11 -if $data11 != 1 then - return -1 -endi - -print =============== step5 -sql select diff(tbcol) as b from $tb interval(1m) -x step5 - return -1 -step5: - -print =============== step6 -sql select diff(tbcol) as b from $tb where ts < now + 4m interval(1m) -x step6 - return -1 -step6: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/compute/first.sim b/tests/script/windows/compute/first.sim deleted file mode 100644 index a83939c2a629e13eb474b6b936e7e4b409d7329e..0000000000000000000000000000000000000000 --- a/tests/script/windows/compute/first.sim +++ /dev/null @@ -1,160 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_fi_db -$tbPrefix = m_fi_tb -$mtPrefix = m_fi_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select first(tbcol) from $tb -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -print =============== step3 -sql select first(tbcol) from $tb where ts < now + 4m -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -print =============== step4 -sql select first(tbcol) as b from $tb -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -print =============== step5 -sql select first(tbcol) as b from $tb interval(1m) -print ===> $data01 -if $data01 != 0 then - return -1 -endi - -sql select first(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != 0 then - return -1 -endi - -print =============== step6 -sql select first(tbcol) as b from $tb where ts < now + 4m interval(1m) -print ===> $data01 -if $data41 != 4 then - return -1 -endi -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select first(tbcol) from $mt -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -print =============== step8 -sql select first(tbcol) as c from $mt where ts < now + 4m -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -sql select first(tbcol) as c from $mt where tgcol < 5 -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -sql select first(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -print =============== step9 -sql select first(tbcol) as b from $mt interval(1m) -print select first(tbcol) as b from $mt interval(1m) -print ===> $data11 -if $data11 != 1 then - return -1 -endi - -sql select first(tbcol) as b from $mt interval(1d) -print ===> $data01 -if $data01 != 0 then - return -1 -endi - -print =============== step10 -sql select first(tbcol) as b from $mt group by tgcol -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -if $rows != $tbNum then - return -1 -endi - -print =============== step11 -sql select first(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol -print ===> $data11 -if $data11 != 1 then - return -1 -endi -print ===> $rows -if $rows != 50 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/compute/interval.sim b/tests/script/windows/compute/interval.sim deleted file mode 100644 index feacce16066a4b5a06268033dedefe327a9f6fa8..0000000000000000000000000000000000000000 --- a/tests/script/windows/compute/interval.sim +++ /dev/null @@ -1,176 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_in_db -$tbPrefix = m_in_tb -$mtPrefix = m_in_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb interval(1m) -print ===> $rows -if $rows < $rowNum then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data05 != 1 then - return -1 -endi - -print =============== step3 -sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts < now + 4m interval(1m) -print ===> $rows -if $rows > 10 then - return -1 -endi -if $rows < 3 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data05 != 1 then - return -1 -endi - -print =============== step4 -sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts < now+40m and ts > now-1m interval(1m) -print ===> $rows -if $rows < 18 then - return -1 -endi -if $rows > 22 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data05 != 1 then - return -1 -endi - -print =============== step5 -sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts < now+40m and ts > now+1m interval(1m) fill(value,0) -print ===> $rows -if $rows < 30 then - return -1 -endi -if $rows > 50 then - return -1 -endi -if $data21 != 1 then - return -1 -endi -if $data25 != 1 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt interval(1m) -print ===> $rows -if $rows < 18 then - return -1 -endi -if $rows > 22 then - return -1 -endi -if $data11 > 15 then - return -1 -endi -if $data11 < 5 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts < now + 4m interval(1m) -print ===> $rows -if $rows < 3 then - return -1 -endi -if $rows > 7 then - return -1 -endi -if $data11 > 15 then - return -1 -endi -if $data11 < 5 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts < now+40m and ts > now-1m interval(1m) -print ===> $rows -if $rows < 18 then - return -1 -endi -if $rows > 22 then - return -1 -endi -if $data11 > 15 then - return -1 -endi -if $data11 < 5 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts < now+40m and ts > now+1m interval(1m) fill(value, 0) -if $rows < 30 then - return -1 -endi -if $rows > 50 then - return -1 -endi -if $data11 > 15 then - return -1 -endi -if $data11 < 5 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/compute/last.sim b/tests/script/windows/compute/last.sim deleted file mode 100644 index 379a5ae64a48b467ffdae816066e8bc3c956d50c..0000000000000000000000000000000000000000 --- a/tests/script/windows/compute/last.sim +++ /dev/null @@ -1,159 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_la_db -$tbPrefix = m_la_tb -$mtPrefix = m_la_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select last(tbcol) from $tb -print ===> $data00 -if $data00 != 19 then - return -1 -endi - -print =============== step3 -sql select last(tbcol) from $tb where ts < now + 4m -print ===> $data00 -if $data00 != 4 then - return -1 -endi - -print =============== step4 -sql select last(tbcol) as b from $tb -print ===> $data00 -if $data00 != 19 then - return -1 -endi - -print =============== step5 -sql select last(tbcol) as b from $tb interval(1m) -print ===> $data11 -if $data11 != 1 then - return -1 -endi - -sql select last(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != 19 then - return -1 -endi - -print =============== step6 -sql select last(tbcol) as b from $tb where ts < now + 4m interval(1m) -print ===> $data11 -if $data11 != 1 then - return -1 -endi -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select last(tbcol) from $mt -print ===> $data00 -if $data00 != 19 then - return -1 -endi - -print =============== step8 -sql select last(tbcol) as c from $mt where ts < now + 4m -print ===> $data00 -if $data00 != 4 then - return -1 -endi - -sql select last(tbcol) as c from $mt where tgcol < 5 -print ===> $data00 -if $data00 != 19 then - return -1 -endi - -sql select last(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m -print ===> $data00 -if $data00 != 4 then - return -1 -endi - -print =============== step9 -sql select last(tbcol) as b from $mt interval(1m) -print ===> $data11 -if $data11 != 1 then - return -1 -endi - -sql select last(tbcol) as b from $mt interval(1d) -print ===> $data01 -if $data01 != 19 then - return -1 -endi - -print =============== step10 -sql select last(tbcol) as b from $mt group by tgcol -print ===> $data00 -if $data00 != 19 then - return -1 -endi - -if $rows != $tbNum then - return -1 -endi - -print =============== step11 -sql select last(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol -print ===> $data11 -if $data11 != 1 then - return -1 -endi -print ===> $rows -if $rows != 50 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/compute/leastsquare.sim b/tests/script/windows/compute/leastsquare.sim deleted file mode 100644 index 20353a409e166243212c072d5596492e251e984b..0000000000000000000000000000000000000000 --- a/tests/script/windows/compute/leastsquare.sim +++ /dev/null @@ -1,102 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_le_db -$tbPrefix = m_le_tb -$mtPrefix = m_le_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db keep 36500 -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 2 - $ms = 1000 - while $x < $rowNum - $ms = $ms + 1000 - sql insert into $tb values ($ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select leastsquares(tbcol, 1, 1) from $tb -print ===> $data00 -if $data00 != @{slop:1.000000, intercept:1.000000}@ then - return -1 -endi - -print =============== step3 -sql select leastsquares(tbcol, 1, 1) from $tb where ts < now + 4m -print ===> $data00 -if $data00 != @{slop:1.000000, intercept:1.000000}@ then - return -1 -endi - -print =============== step4 -sql select leastsquares(tbcol, 1, 1) as b from $tb -print ===> $data00 -if $data00 != @{slop:1.000000, intercept:1.000000}@ then - return -1 -endi - -print =============== step5 -print select leastsquares(tbcol, 1, 1) as b from $tb interval(1d) -sql select leastsquares(tbcol, 1, 1) as b from $tb interval(1m) -print ===> $data01 -if $data01 != @{slop:1.000000, intercept:1.000000}@ then - return -1 -endi - -print select leastsquares(tbcol, 1, 1) as b from $tb interval(1d) -sql select leastsquares(tbcol, 1, 1) as b from $tb interval(1d) -print ===> $data01 -if $data01 != @{slop:1.000000, intercept:1.000000}@ then - return -1 -endi - -print =============== step6 -sql select leastsquares(tbcol, 1, 1) as b from $tb where ts < now + 4m interval(1m) -print ===> $data01 -if $data01 != @{slop:1.000000, intercept:1.000000}@ then - return -1 -endi -print ===> $rows -if $rows != 1 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi diff --git a/tests/script/windows/compute/max.sim b/tests/script/windows/compute/max.sim deleted file mode 100644 index 641b31fe362712e09081f105bacdb11f41f2bb99..0000000000000000000000000000000000000000 --- a/tests/script/windows/compute/max.sim +++ /dev/null @@ -1,159 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_ma_db -$tbPrefix = m_ma_tb -$mtPrefix = m_ma_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select max(tbcol) from $tb -print ===> $data00 -if $data00 != 19 then - return -1 -endi - -print =============== step3 -sql select max(tbcol) from $tb where ts < now + 4m -print ===> $data00 -if $data00 != 4 then - return -1 -endi - -print =============== step4 -sql select max(tbcol) as b from $tb -print ===> $data00 -if $data00 != 19 then - return -1 -endi - -print =============== step5 -sql select max(tbcol) as b from $tb interval(1m) -print ===> $data11 -if $data11 != 1 then - return -1 -endi - -sql select max(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != 19 then - return -1 -endi - -print =============== step6 -sql select max(tbcol) as b from $tb where ts < now + 4m interval(1m) -print ===> $data11 -if $data11 != 1 then - return -1 -endi -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select max(tbcol) from $mt -print ===> $data00 -if $data00 != 19 then - return -1 -endi - -print =============== step8 -sql select max(tbcol) as c from $mt where ts < now + 4m -print ===> $data00 -if $data00 != 4 then - return -1 -endi - -sql select max(tbcol) as c from $mt where tgcol < 5 -print ===> $data00 -if $data00 != 19 then - return -1 -endi - -sql select max(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m -print ===> $data00 -if $data00 != 4 then - return -1 -endi - -print =============== step9 -sql select max(tbcol) as b from $mt interval(1m) -print ===> $data11 -if $data11 != 1 then - return -1 -endi - -sql select max(tbcol) as b from $mt interval(1d) -print ===> $data01 -if $data01 != 19 then - return -1 -endi - -print =============== step10 -sql select max(tbcol) as b from $mt group by tgcol -print ===> $data00 -if $data00 != 19 then - return -1 -endi - -if $rows != $tbNum then - return -1 -endi - -print =============== step11 -sql select max(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol -print ===> $data11 -if $data11 != 1 then - return -1 -endi -print ===> $rows -if $rows != 50 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/compute/min.sim b/tests/script/windows/compute/min.sim deleted file mode 100644 index 3528f573ce4c65ac03ac0c0d6c5502b33979cb17..0000000000000000000000000000000000000000 --- a/tests/script/windows/compute/min.sim +++ /dev/null @@ -1,159 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_mi_db -$tbPrefix = m_mi_tb -$mtPrefix = m_mi_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select min(tbcol) from $tb -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -print =============== step3 -sql select min(tbcol) from $tb where ts < now + 4m -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -print =============== step4 -sql select min(tbcol) as b from $tb -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -print =============== step5 -sql select min(tbcol) as b from $tb interval(1m) -print ===> $data11 -if $data11 != 1 then - return -1 -endi - -sql select min(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != 0 then - return -1 -endi - -print =============== step6 -sql select min(tbcol) as b from $tb where ts < now + 4m interval(1m) -print ===> $data11 -if $data11 != 1 then - return -1 -endi -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select min(tbcol) from $mt -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -print =============== step8 -sql select min(tbcol) as c from $mt where ts < now + 4m -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -sql select min(tbcol) as c from $mt where tgcol < 5 -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -sql select min(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -print =============== step9 -sql select min(tbcol) as b from $mt interval(1m) -print ===> $data11 -if $data11 != 1 then - return -1 -endi - -sql select min(tbcol) as b from $mt interval(1d) -print ===> $data01 -if $data01 != 0 then - return -1 -endi - -print =============== step10 -sql select min(tbcol) as b from $mt group by tgcol -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -if $rows != $tbNum then - return -1 -endi - -print =============== step11 -sql select min(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol -print ===> $data11 -if $data11 != 1 then - return -1 -endi -print ===> $rows -if $rows != 50 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/compute/percentile.sim b/tests/script/windows/compute/percentile.sim deleted file mode 100644 index fa6212f013b4ec0aa92c06842263fd32be05e1e9..0000000000000000000000000000000000000000 --- a/tests/script/windows/compute/percentile.sim +++ /dev/null @@ -1,116 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_pe_db -$tbPrefix = m_pe_tb -$mtPrefix = m_pe_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select percentile(tbcol, 10) from $tb -print ===> $data00 -if $data00 != 1.900000000 then - return -1 -endi - -sql select percentile(tbcol, 20) from $tb -print ===> $data00 -if $data00 != 3.800000000 then - return -1 -endi - -sql select percentile(tbcol, 100) from $tb -print ===> $data00 -if $data00 != 19.000000000 then - return -1 -endi - -sql select percentile(tbcol, 110) from $tb -x step2 - return -1 -step2: - -print =============== step3 -sql select percentile(tbcol, 1) from $tb where ts > now + 4m -print ===> $data00 -if $data00 != 5.140000000 then - return -1 -endi - -sql select percentile(tbcol, 5) from $tb where ts > now + 4m -print ===> $data00 -if $data00 != 5.700000000 then - return -1 -endi - -sql select percentile(tbcol, 0) from $tb where ts > now + 4m -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -print =============== step4 -sql select percentile(tbcol, 1) as c from $tb where ts > now + 4m -print ===> $data00 -if $data00 != 5.140000000 then - return -1 -endi - -sql select percentile(tbcol, 5) as c from $tb where ts > now + 4m -print ===> $data00 -if $data00 != 5.700000000 then - return -1 -endi - -sql select percentile(tbcol, 0) as c from $tb where ts > now + 4m -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/compute/stddev.sim b/tests/script/windows/compute/stddev.sim deleted file mode 100644 index eea6c8aa0529d0f8dba9907de76017751fbf3d6f..0000000000000000000000000000000000000000 --- a/tests/script/windows/compute/stddev.sim +++ /dev/null @@ -1,98 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_st_db -$tbPrefix = m_st_tb -$mtPrefix = m_st_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select stddev(tbcol) from $tb -print ===> $data00 -if $data00 != 5.766281297 then - return -1 -endi - -print =============== step3 -sql select stddev(tbcol) from $tb where ts < now + 4m -print ===> $data00 -if $data00 != 1.414213562 then - return -1 -endi - -print =============== step4 -sql select stddev(tbcol) as b from $tb -print ===> $data00 -if $data00 != 5.766281297 then - return -1 -endi - -print =============== step5 -sql select stddev(tbcol) as b from $tb interval(1m) -print ===> $data01 -if $data01 != 0.000000000 then - return -1 -endi - -sql select stddev(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != 5.766281297 then - return -1 -endi - -print =============== step6 -sql select stddev(tbcol) as b from $tb where ts < now + 4m interval(1m) -print ===> $data01 -if $data01 != 0.000000000 then - return -1 -endi -if $rows != 5 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/compute/sum.sim b/tests/script/windows/compute/sum.sim deleted file mode 100644 index a429ce99e0b2faea0d594cc97c7f232b11c5e781..0000000000000000000000000000000000000000 --- a/tests/script/windows/compute/sum.sim +++ /dev/null @@ -1,159 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_su_db -$tbPrefix = m_su_tb -$mtPrefix = m_su_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select sum(tbcol) from $tb -print ===> $data00 -if $data00 != 190 then - return -1 -endi - -print =============== step3 -sql select sum(tbcol) from $tb where ts < now + 4m -print ===> $data00 -if $data00 != 10 then - return -1 -endi - -print =============== step4 -sql select sum(tbcol) as b from $tb -print ===> $data00 -if $data00 != 190 then - return -1 -endi - -print =============== step5 -sql select sum(tbcol) as b from $tb interval(1m) -print ===> $data11 -if $data11 != 1 then - return -1 -endi - -sql select sum(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != 190 then - return -1 -endi - -print =============== step6 -sql select sum(tbcol) as b from $tb where ts < now + 4m interval(1m) -print ===> $data11 -if $data11 != 1 then - return -1 -endi -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select sum(tbcol) from $mt -print ===> $data00 -if $data00 != 1900 then - return -1 -endi - -print =============== step8 -sql select sum(tbcol) as c from $mt where ts < now + 4m -print ===> $data00 -if $data00 != 100 then - return -1 -endi - -sql select sum(tbcol) as c from $mt where tgcol < 5 -print ===> $data00 -if $data00 != 950 then - return -1 -endi - -sql select sum(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m -print ===> $data00 -if $data00 != 50 then - return -1 -endi - -print =============== step9 -sql select sum(tbcol) as b from $mt interval(1m) -print ===> $data11 -if $data11 < 5 then - return -1 -endi - -sql select sum(tbcol) as b from $mt interval(1d) -print ===> $data01 -if $data01 != 1900 then - return -1 -endi - -print =============== step10 -sql select sum(tbcol) as b from $mt group by tgcol -print ===> $data00 -if $data00 != 190 then - return -1 -endi - -if $rows != $tbNum then - return -1 -endi - -print =============== step11 -sql select sum(tbcol) as b from $mt where ts < now + 4m interval(1d) group by tgcol -print select sum(tbcol) as b from $mt where ts < now + 4m interval(1d) group by tgcol -print ===> $data01 -if $data01 != 10 then - return -1 -endi -if $rows != 10 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/compute/top.sim b/tests/script/windows/compute/top.sim deleted file mode 100644 index 65e448b0fa5fb1dffcaf1e63129099c57a4a9a02..0000000000000000000000000000000000000000 --- a/tests/script/windows/compute/top.sim +++ /dev/null @@ -1,99 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_to_db -$tbPrefix = m_to_tb -$mtPrefix = m_to_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select top(tbcol, 1) from $tb -print ===> $data01 -if $data01 != 19 then - return -1 -endi - -print =============== step3 -sql select top(tbcol, 1) from $tb where ts < now + 4m -print ===> $data01 -if $data01 != 4 then - return -1 -endi - -print =============== step4 -sql select top(tbcol, 1) as b from $tb -print ===> $data01 -if $data01 != 19 then - return -1 -endi - -print =============== step5 -sql select top(tbcol, 2) as b from $tb -print ===> $data01 $data11 -if $data01 != 18 then - return -1 -endi -if $data11 != 19 then - return -1 -endi - -print =============== step6 -sql select top(tbcol, 2) as b from $tb where ts < now + 4m -print ===> $data01 $data11 -if $data01 != 3 then - return -1 -endi -if $data11 != 4 then - return -1 -endi - -sql select top(tbcol, 122) as b from $tb -x step6 - return -1 -step6: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/db/basic.sim b/tests/script/windows/db/basic.sim deleted file mode 100644 index 1f0fc31a6bd4db3c6d11f21b966638ba434b9585..0000000000000000000000000000000000000000 --- a/tests/script/windows/db/basic.sim +++ /dev/null @@ -1,193 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -print ============================ dnode1 start - -$i = 0 -$dbPrefix = ob_db_db -$tbPrefix = ob_db_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql create database $db replica 1 duration 20 keep 2000 cache 16 -sql show databases -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 -if $data00 != $db then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 0 then - return -1 -endi -if $data04 != 1 then - return -1 -endi -if $data06 != 20 then - return -1 -endi -if $data08 != 16 then - return -1 -endi - -print =============== step2 -sql create database $db -sql show databases -if $rows != 1 then - return -1 -endi - -print =============== step3 -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi - -print =============== step4 -sql_error drop database $db - -print =============== step5 -sql create database $db replica 1 duration 15 keep 1500 -sql show databases -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 -if $data00 != $db then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 0 then - return -1 -endi -if $data04 != 1 then - return -1 -endi -if $data06 != 15 then - return -1 -endi - -print =============== step6 -sql use $db -sql create table $tb (ts timestamp, speed int) -$i = 1 -while $i < 4 - $db = $dbPrefix . $i - $tb = $tbPrefix . $i - sql create database $db - sql use $db - sql create table $tb (ts timestamp, speed int) - $i = $i + 1 -endw - -sql show databases -if $rows != 4 then - return -1 -endi - -$i = 4 -$db = $dbPrefix . $i -$tb = $tbPrefix . $i -sql create database $db -sql use $db -sql create table $tb (ts timestamp, speed int) - -print =============== step7 -$i = 0 -while $i < 5 - $db = $dbPrefix . $i - sql drop database $db - $i = $i + 1 -endw - -print =============== step8 -$i = 0 -$db = $dbPrefix . $i -$tb = $tbPrefix . $i -sql create database $db -sql use $db -sql create table $tb (ts timestamp, speed int) -sql show tables -if $rows != 1 then - return -1 -endi - -print =============== step9 -sql drop database $db - -print =============== step10 -sql create database $db -sql use $db -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step11 -sql create table $tb (ts timestamp, speed int) -sql show tables -if $rows != 1 then - return -1 -endi - -print =============== step12 -sql drop database $db - -print =============== step13 -sql create database $db -sql use $db -sql show tables -if $rows != 0 then - return -1 -endi -sql create table $tb (ts timestamp, speed int) -sql show tables -if $rows != 1 then - return -1 -endi -sql insert into $tb values (now+1a, 0) -sql insert into $tb values (now+2a, 1) -sql insert into $tb values (now+3a, 2) -sql insert into $tb values (now+4a, 3) -sql insert into $tb values (now+5a, 4) -sql select * from $tb -if $rows != 5 then - return -1 -endi - -print =============== step14 -sql drop database $db - -print =============== step15 -sql create database $db -sql use $db -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step16 -sql create table $tb (ts timestamp, speed int) -sql show tables -if $rows != 1 then - return -1 -endi -sql select * from $tb -if $rows != 0 then - return -1 -endi - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/db/len.sim b/tests/script/windows/db/len.sim deleted file mode 100644 index 3356165117d3986d9eef4e7dced3bb1b61dd36da..0000000000000000000000000000000000000000 --- a/tests/script/windows/db/len.sim +++ /dev/null @@ -1,92 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -print =============== step1 -sql_error drop database dd - -sql create database -x step1 - return -1 -step1: - -sql show databases -if $rows != 0 then - return -1 -endi - -print =============== step2 -sql create database a -sql show databases -if $rows != 1 then - return -1 -endi - -sql drop database a -sql show databases -if $rows != 0 then - return -1 -endi - -print =============== step3 -sql create database a12345678 -sql show databases -if $rows != 1 then - return -1 -endi - -sql drop database a12345678 -sql show databases -if $rows != 0 then - return -1 -endi - -print =============== step4 -sql create database a012345678901201234567890120123456789012a012345678901201234567890120123456789012 -x step4 - return -1 -step4: -sql show databases -if $rows != 0 then - return -1 -endi - -print =============== step5 -sql create database a;1 -sql drop database a -sql show databases -if $rows != 0 then - return -1 -endi - -print =============== step6 -sql create database a'1 -x step6 - return -1 -step6: - -sql show databases -if $rows != 0 then - return -1 -endi - -print =============== step7 -sql create database (a) -x step7 - return -1 -step7: -sql show databases -if $rows != 0 then - return -1 -endi - -print =============== step8 -sql create database a.1 -x step8 - return -1 -step8: -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/field/2.sim b/tests/script/windows/field/2.sim deleted file mode 100644 index e258fbe80efbdde2d1b8f289f5302b74adb8b0f7..0000000000000000000000000000000000000000 --- a/tests/script/windows/field/2.sim +++ /dev/null @@ -1,295 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = fi_bt_db -$tbPrefix = fi_bt_tb -$mtPrefix = fi_bt_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol2 bool, tbcol int) TAGS(tgcol bool, tgcol2 int) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0, 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 0, 0 ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1, 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 1, 1 ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step3 -sql select * from $mt where tbcol2 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step4 -sql select * from $mt where ts > now + 4m and tbcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step5 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step6 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 and tbcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 and tbcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 and tbcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m and ts < now + 5m and tbcol <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 and tbcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol2 = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 and tbcol2 = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol2 = 1 interval(1d) group by tgcol order by tgcol desc -print $db -print select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol2 = 1 interval(1d) group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/field/3.sim b/tests/script/windows/field/3.sim deleted file mode 100644 index e3fe0b0b1162548ccd8ce0d4e5d5606a628abcef..0000000000000000000000000000000000000000 --- a/tests/script/windows/field/3.sim +++ /dev/null @@ -1,521 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = fi_3_db -$tbPrefix = fi_3_tb -$mtPrefix = fi_3_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol1 smallint, tbcol2 int, tbcol3 float) TAGS(tgcol1 smallint, tgcol2 int, tgcol3 float) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0, 0, 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 0, 0, 0 ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1, 1, 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 1, 1, 1 ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step3 -sql select * from $mt where tbcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tbcol2 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where tbcol3 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol3 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol3 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol3 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step6 -sql select * from $mt where ts > now + 4m and tbcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step8 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step9 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 and tbcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 and tbcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m and ts < now + 5m and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step10 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step11 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step12 -sql select * from $mt where ts > now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step13 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step14 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step15 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step16 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol3 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step17 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step18 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step19 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol1 order by tgcol1 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol2 order by tgcol2 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol3 order by tgcol3 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/field/4.sim b/tests/script/windows/field/4.sim deleted file mode 100644 index aabfe2be2ce76d5fa52fcde85c129b0f4bdf75ac..0000000000000000000000000000000000000000 --- a/tests/script/windows/field/4.sim +++ /dev/null @@ -1,711 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = fi_4_db -$tbPrefix = fi_4_tb -$mtPrefix = fi_4_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol1 smallint, tbcol2 bigint, tbcol3 float, tbcol4 double) TAGS(tgcol1 smallint, tgcol2 bigint, tgcol3 float, tgcol4 double) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0, 0, 0, 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 0, 0, 0, 0 ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1, 1, 1, 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 1, 1, 1, 1 ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step3 -sql select * from $mt where tbcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tbcol2 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where tbcol3 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol3 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol3 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol3 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step6 -sql select * from $mt where tbcol4 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol4 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol4 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol4 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step7 -sql select * from $mt where ts > now + 4m and tbcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step8 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step9 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step10 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step11 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 and tbcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 and tbcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m and ts < now + 5m and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step12 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step13 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step14 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol4 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step15 -sql select * from $mt where ts > now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step16 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step17 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step18 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step19 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step20 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step21 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol3 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol4 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step22 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step23 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step24 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol1 order by tgcol1 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol2 order by tgcol2 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol3 order by tgcol3 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 interval(1d) group by tgcol4 order by tgcol4 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/field/5.sim b/tests/script/windows/field/5.sim deleted file mode 100644 index 874730ff1c9cd341e8c3cc1f9c8d33b228d5b3ad..0000000000000000000000000000000000000000 --- a/tests/script/windows/field/5.sim +++ /dev/null @@ -1,834 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = fi_5_db -$tbPrefix = fi_5_tb -$mtPrefix = fi_5_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol1 tinyint, tbcol2 int, tbcol3 bigint, tbcol4 double, tbcol5 smallint) TAGS(tgcol1 tinyint, tgcol2 int, tgcol3 bigint, tgcol4 double, tgcol5 smallint) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0, 0, 0, 0, 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 0, 0, 0, 0, 0 ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1, 1, 1, 1, 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 1, 1, 1, 1, 1 ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step3 -sql select * from $mt where tbcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tbcol2 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where tbcol3 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol3 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol3 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol3 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step6 -sql select * from $mt where tbcol4 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol4 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol4 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol4 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step7 -sql select * from $mt where tbcol5 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol5 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol5 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol5 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step8 -sql select * from $mt where ts > now + 4m and tbcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step9 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step10 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step11 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step12 -sql select * from $mt where ts > now + 4m and tbcol5 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol5 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step13 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 and tbcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 and tbcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m and ts < now + 5m and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step14 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step15 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol4 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step16 -sql select * from $mt where ts > now + 4m and tbcol5 = 1 and tbcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 1 and tbcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol5 = 0 and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol5 <> 0 and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol5 = 0 and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol5 <> 0 and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol5 <> 0 and tbcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 0 and ts < now + 5m and ts < now + 5m and tbcol4 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step17 -sql select * from $mt where ts > now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step18 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step19 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step20 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 and tbcol5 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 and tbcol5 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step21 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step22 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step23 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step24 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol3 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol4 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol5 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step25 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step26 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - - -print =============== step27 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol1 order by tgcol1 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol2 order by tgcol2 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol3 order by tgcol3 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 interval(1d) group by tgcol4 order by tgcol4 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 interval(1d) group by tgcol5 order by tgcol5 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/field/6.sim b/tests/script/windows/field/6.sim deleted file mode 100644 index 77277df35b2a41bbf7ab759763b9601054b0d5d6..0000000000000000000000000000000000000000 --- a/tests/script/windows/field/6.sim +++ /dev/null @@ -1,989 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = fi_6_db -$tbPrefix = fi_6_tb -$mtPrefix = fi_6_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol1 smallint, tbcol2 bigint, tbcol3 smallint, tbcol4 bigint, tbcol5 float, tbcol6 bool) TAGS(tgcol1 smallint, tgcol2 bigint, tgcol3 smallint, tgcol4 bigint, tgcol5 float, tgcol6 bool) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0, 0, 0, 0, 0, 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 0, 0, 0, 0, 0, 0 ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1, 1, 1, 1, 1, 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 1, 1, 1, 1, 1, 1 ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step3 -sql select * from $mt where tbcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tbcol2 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where tbcol3 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol3 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol3 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol3 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step6 -sql select * from $mt where tbcol4 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol4 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol4 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol4 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step7 -sql select * from $mt where tbcol5 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol5 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol5 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol5 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step8 -sql select * from $mt where tbcol6 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol6 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol6 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol6 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step9 -sql select * from $mt where ts > now + 4m and tbcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step10 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step11 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step12 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step13 -sql select * from $mt where ts > now + 4m and tbcol5 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol5 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step14 -sql select * from $mt where ts > now + 4m and tbcol6 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol6 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol6 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol6 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol6 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol6 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol6 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol6 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step15 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 and tbcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 and tbcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m and ts < now + 5m and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step16 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step17 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol4 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step18 -sql select * from $mt where ts > now + 4m and tbcol5 = 1 and tbcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 1 and tbcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol5 = 0 and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol5 <> 0 and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol5 = 0 and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol5 <> 0 and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol5 <> 0 and tbcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 0 and ts < now + 5m and ts < now + 5m and tbcol4 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step19 -sql select * from $mt where ts > now + 4m and tbcol5 = 1 and tbcol6 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 1 and tbcol6 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol5 = 0 and tbcol6 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol5 <> 0 and tbcol6 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol5 = 0 and tbcol6 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol5 <> 0 and tbcol6 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol5 <> 0 and tbcol6 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 0 and ts < now + 5m and ts < now + 5m and tbcol6 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step20 -sql select * from $mt where ts > now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step21 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step22 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step23 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 and tbcol5 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 and tbcol5 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step24 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 and tbcol5 = 1 and tbcol6 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 and tbcol5 <> 1 and tbcol6 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 and tbcol6 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 and tbcol6 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 and tbcol6 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 and tbcol6 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 and tbcol6 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 and tbcol6 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step25 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step26 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 and tbcol6 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step27 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 and tbcol6 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step28 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol3 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol4 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol5 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol6 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step29 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 and tbcol6 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step30 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 and tbcol6 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step31 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol1 order by tgcol1 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol2 order by tgcol2 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol3 order by tgcol3 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 interval(1d) group by tgcol4 order by tgcol4 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 interval(1d) group by tgcol5 order by tgcol5 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 and tbcol6 = 1 interval(1d) group by tgcol6 order by tgcol6 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/field/bigint.sim b/tests/script/windows/field/bigint.sim deleted file mode 100644 index f912ee968b0955e339340e9ee712b99eb954914a..0000000000000000000000000000000000000000 --- a/tests/script/windows/field/bigint.sim +++ /dev/null @@ -1,160 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = fi_bi_db -$tbPrefix = fi_bi_tb -$mtPrefix = fi_bi_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol bigint) TAGS(tgcol bigint) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 0 ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 1 ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step3 -sql select * from $mt where ts > now + 4m and tbcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step4 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step5 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 interval(1d) group by tgcol order by tgcol desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/field/binary.sim b/tests/script/windows/field/binary.sim deleted file mode 100644 index aa641878e4c49463aca22ab3f57b43a558e955f7..0000000000000000000000000000000000000000 --- a/tests/script/windows/field/binary.sim +++ /dev/null @@ -1,77 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = fi_by_db -$tbPrefix = fi_by_tb -$mtPrefix = fi_by_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol binary(10)) TAGS(tgcol binary(10)) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( '0' ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , '0' ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( '1' ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , '1' ) - $x = $x + 1 - endw - $i = $i + 1 -endw - - -print =============== step2 - -sql select * from $mt where tbcol = '0' -if $rows != 100 then - return -1 -endi - -sql select * from $mt where ts > now + 4m and tbcol = '1' -if $rows != 75 then - return -1 -endi - -print select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1' -sql_error select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1' group by tgcol -sql_error select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = '1' group by tgcol -sql_error select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1' interval(1d) group by tgcol - -#can't filter binary fields - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/field/bool.sim b/tests/script/windows/field/bool.sim deleted file mode 100644 index 3ef56a1d95082faf54f1e34db4009b8af0e80c6c..0000000000000000000000000000000000000000 --- a/tests/script/windows/field/bool.sim +++ /dev/null @@ -1,161 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = fi_bo_db -$tbPrefix = fi_bo_tb -$mtPrefix = fi_bo_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol bool) TAGS(tgcol bool) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 0 ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 1 ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = true -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> true -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = false -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> false -if $rows != 100 then - return -1 -endi - -print =============== step3 -sql select * from $mt where ts > now + 4m and tbcol = true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> false -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> false and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step4 -sql select count(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step5 -sql select count(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = true -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = true group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = true group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = true interval(1d) group by tgcol order by tgcol desc -print select count(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = true interval(1d) group by tgcol order by tgcol desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/field/double.sim b/tests/script/windows/field/double.sim deleted file mode 100644 index ef404d28dc306edaf2fe6be00eb83dfb484c23a3..0000000000000000000000000000000000000000 --- a/tests/script/windows/field/double.sim +++ /dev/null @@ -1,160 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = fi_do_db -$tbPrefix = fi_do_tb -$mtPrefix = fi_do_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol double) TAGS(tgcol double) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 0 ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 1 ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step3 -sql select * from $mt where ts > now + 4m and tbcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step4 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step5 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 interval(1d) group by tgcol order by tgcol desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/field/float.sim b/tests/script/windows/field/float.sim deleted file mode 100644 index 8435f31c1fbc3353f87f8abc620184919b32ccbc..0000000000000000000000000000000000000000 --- a/tests/script/windows/field/float.sim +++ /dev/null @@ -1,160 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = fi_fl_db -$tbPrefix = fi_fl_tb -$mtPrefix = fi_fl_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol float) TAGS(tgcol float) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 0 ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 1 ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step3 -sql select * from $mt where ts > now + 4m and tbcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step4 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step5 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 interval(1d) group by tgcol order by tgcol desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/field/int.sim b/tests/script/windows/field/int.sim deleted file mode 100644 index 781b9394849192725ba5d46e3d669d53838501b7..0000000000000000000000000000000000000000 --- a/tests/script/windows/field/int.sim +++ /dev/null @@ -1,160 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = fi_in_db -$tbPrefix = fi_in_tb -$mtPrefix = fi_in_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 0 ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 1 ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step3 -sql select * from $mt where ts > now + 4m and tbcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step4 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step5 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 interval(1d) group by tgcol order by tgcol desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/field/single.sim b/tests/script/windows/field/single.sim deleted file mode 100644 index b6b44020915e57b130c77f2c40e1a7a2e4e1342c..0000000000000000000000000000000000000000 --- a/tests/script/windows/field/single.sim +++ /dev/null @@ -1,218 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = fi_si_db -$tbPrefix = fi_si_tb -$mtPrefix = fi_si_mt -$rowNum = 20 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql create database $db -sql use $db -sql create table $tb (ts timestamp, tbcol int) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - -print =============== step2 -sql select * from $tb -if $rows != $rowNum then - return -1 -endi - -sql select * from $tb where tbcol = 10 -if $rows != 1 then - return -1 -endi -if $data01 != 10 then - return -1 -endi - -sql select * from $tb where tbcol = 8 -if $rows != 1 then - return -1 -endi -if $data01 != 8 then - return -1 -endi - -sql select * from $tb where tbcol < 10 -if $rows != 10 then - return -1 -endi -if $data91 != 9 then - return -1 -endi - -sql select * from $tb where tbcol <= 10 -if $rows != 11 then - return -1 -endi -if $data81 != 8 then - return -1 -endi - -sql select * from $tb where tbcol > 10 -if $rows != 9 then - return -1 -endi -if $data81 != 19 then - return -1 -endi - -sql select * from $tb where tbcol > 10 order by ts asc -if $rows != 9 then - return -1 -endi -if $data01 != 11 then - return -1 -endi - -sql select * from $tb where tbcol < 10 and tbcol > 5 order by ts desc -if $rows != 4 then - return -1 -endi -if $data01 != 9 then - return -1 -endi -if $data31 != 6 then - return -1 -endi - -sql select * from $tb where tbcol < 10 and tbcol > 5 order by ts asc -if $rows != 4 then - return -1 -endi -if $data01 != 6 then - return -1 -endi -if $data31 != 9 then - return -1 -endi - -sql select * from $tb where tbcol > 10 and tbcol < 5 order by ts asc -if $rows != 0 then - return -1 -endi - -print =============== step3 -sql select * from $tb where ts < now + 4m -if $rows != 5 then - return -1 -endi - -sql select * from $tb where tbcol = 10 and ts < now + 4m -print select * from $tb where tbcol = 10 and ts < now + 4m -if $rows != 0 then - return -1 -endi - -sql select * from $tb where tbcol = 4 and ts < now + 4m order by ts desc -if $rows != 1 then - return -1 -endi -if $data01 != 4 then - return -1 -endi - -sql select * from $tb where tbcol < 10 and ts < now + 4m order by ts desc -if $rows != 5 then - return -1 -endi -if $data01 != 4 then - return -1 -endi - -sql select * from $tb where tbcol < 10 and ts > now + 4m and ts < now + 5m order by ts desc -print $rows $data00 $data01 -if $rows != 1 then - return -1 -endi -if $data01 != 5 then - return -1 -endi - -print =============== step4 -sql select count(*) from $tb -if $data00 != $rowNum then - return -1 -endi - -sql select count(*) from $tb where tbcol = 10 -if $data00 != 1 then - return -1 -endi - -#sql select count(*) from $tb where tbcol = 8 or tbcol = 9 -#if $data00 != 2 then -# return -1 -#endi - -sql select count(*) from $tb where tbcol < 10 -if $data00 != 10 then - return -1 -endi - -sql select count(*) from $tb where tbcol <= 10 -if $data00 != 11 then - return -1 -endi - -sql select count(*) from $tb where tbcol < 10 and tbcol > 5 -if $data00 != 4 then - return -1 -endi - -sql select count(*) from $tb where tbcol < 10 and tbcol > 5 order by ts asc -x step4 -# return -1 -step4: - -print =============== step5 -sql select count(*) from $tb where ts < now + 4m -if $data00 != 5 then - return -1 -endi - -#sql select count(*) from $tb where tbcol = 10 and ts < now + 4m -#if $data00 != 0 then -# return -1 -#endi - -sql select count(*) from $tb where tbcol = 4 and ts < now + 4m -if $data00 != 1 then - return -1 -endi - -sql select count(*) from $tb where tbcol < 10 and ts < now + 4m -if $data00 != 5 then - return -1 -endi - -sql select count(*) from $tb where tbcol < 10 and ts > now + 4m and ts < now + 5m -if $data00 != 1 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/field/smallint.sim b/tests/script/windows/field/smallint.sim deleted file mode 100644 index 5f1839226b1d3aabfebfe9b30ad3f8b02d1e21a9..0000000000000000000000000000000000000000 --- a/tests/script/windows/field/smallint.sim +++ /dev/null @@ -1,160 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = fi_sm_db -$tbPrefix = fi_sm_tb -$mtPrefix = fi_sm_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol smallint) TAGS(tgcol smallint) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 0 ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 1 ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step3 -sql select * from $mt where ts > now + 4m and tbcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step4 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step5 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 interval(1d) group by tgcol order by tgcol desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/field/tinyint.sim b/tests/script/windows/field/tinyint.sim deleted file mode 100644 index c90ff3f932a3eeb52e1ff607ac0bcacf21fecfe4..0000000000000000000000000000000000000000 --- a/tests/script/windows/field/tinyint.sim +++ /dev/null @@ -1,160 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = fi_ti_db -$tbPrefix = fi_ti_tb -$mtPrefix = fi_ti_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol tinyint) TAGS(tgcol tinyint) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 0 ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 1 ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step3 -sql select * from $mt where ts > now + 4m and tbcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step4 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step5 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 interval(1d) group by tgcol order by tgcol desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/import/basic.sim b/tests/script/windows/import/basic.sim deleted file mode 100644 index ee19893ae21fd8c97eeb9aa5898ead86b8b8d19f..0000000000000000000000000000000000000000 --- a/tests/script/windows/import/basic.sim +++ /dev/null @@ -1,125 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -sql create database ibadb -sql use ibadb -sql create table tb(ts timestamp, i int) - -print ================= step1 - -sql import into tb values(1564641710000, 10000) -sql select * from tb; -if $rows != 1 then - return -1 -endi - -print ================= step2 -sql insert into tb values(1564641708000, 8000) -sql select * from tb; -if $rows != 2 then - return -1 -endi - -print ================= step3 -sql insert into tb values(1564641720000, 20000) -sql select * from tb; -if $rows != 3 then - return -1 -endi - -print ================= step4 -sql import into tb values(1564641708000, 8000) -sql import into tb values(1564641715000, 15000) -sql import into tb values(1564641730000, 30000) -sql select * from tb; -if $rows != 5 then - return -1 -endi - -print ================= step5 -sql insert into tb values(1564641708000, 8000) -sql insert into tb values(1564641714000, 14000) -sql insert into tb values(1564641725000, 25000) -sql insert into tb values(1564641740000, 40000) -sql select * from tb; -if $rows != 8 then - return -1 -endi - -print ================= step6 -sql import into tb values(1564641707000, 7000) -sql import into tb values(1564641712000, 12000) -sql import into tb values(1564641723000, 23000) -sql import into tb values(1564641734000, 34000) -sql import into tb values(1564641750000, 50000) -sql select * from tb; -if $rows != 13 then - return -1 -endi - -print ================= step7 -sql import into tb values(1564641707001, 7001) -sql import into tb values(1564641712001, 12001) -sql import into tb values(1564641723001, 23001) -sql import into tb values(1564641734001, 34001) -sql import into tb values(1564641750001, 50001) -sql select * from tb; -if $rows != 18 then - return -1 -endi - -print ================= step8 -sql insert into tb values(1564641708002, 8002) -sql insert into tb values(1564641714002, 14002) -sql insert into tb values(1564641725002, 25002) -sql insert into tb values(1564641900000, 200000) -sql select * from tb; -if $rows != 22 then - return -1 -endi - -print ================= step9 only insert last one -sql import into tb values(1564641705000, 5000)(1564641718000, 18000)(1564642400000, 700000) -sql select * from tb; -if $rows != 25 then - return -1 -endi - -print ================= step10 -sql import into tb values(1564641705000, 5000)(1564641718000, 18000)(1564642400000, 70000) -sql select * from tb; -if $rows != 25 then - return -1 -endi - -print ================= step11 -sql import into tb values(1564642400000, 700000) -sql select * from tb; -if $rows != 25 then - return -1 -endi - -print ================= step12 -sql import into tb values(1564641709527, 9527)(1564641709527, 9528) -sql select * from tb; -print rows=> $rows -if $rows != 26 then - return -1 -endi - -print ================= step13 -sql import into tb values(1564641709898, 9898)(1564641709897, 9897) -sql select * from tb; -print rows=> $rows -if $rows != 28 then - return -1 -endi - -sql drop database ibadb \ No newline at end of file diff --git a/tests/script/windows/insert/basic.sim b/tests/script/windows/insert/basic.sim deleted file mode 100644 index a516f80e1013a40a8889ca939ca650360e4fc976..0000000000000000000000000000000000000000 --- a/tests/script/windows/insert/basic.sim +++ /dev/null @@ -1,49 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$i = 0 -$dbPrefix = tb_in_db -$tbPrefix = tb_in_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql drop database -x step1 -step1: -sql create database $db -sql use $db -sql create table $tb (ts timestamp, speed int) - -$x = 0 -while $x < 10 - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 -endw - -print =============== step 2 -sql insert into $tb values (now - 5m , 10) -sql insert into $tb values (now - 6m , 10) -sql insert into $tb values (now - 7m , 10) -sql insert into $tb values (now - 8m , 10) - -sql select * from $tb - -print $rows points data are retrieved -if $rows != 14 then - return -1 -endi - -sql drop database $db -sleep 1000 -sql show databases -if $rows != 0 then - return -1 -endi diff --git a/tests/script/windows/insert/query_block1_file.sim b/tests/script/windows/insert/query_block1_file.sim deleted file mode 100644 index 62b74ac19c18a624d41941e8c51a3e8fb87ddee0..0000000000000000000000000000000000000000 --- a/tests/script/windows/insert/query_block1_file.sim +++ /dev/null @@ -1,195 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$i = 0 -$dbPrefix = tb_1f_db -$tbPrefix = tb_1f_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql drop database -x step1 -step1: -sql create database $db -sql use $db -sql create table $tb (ts timestamp, speed int) - -#commit to file will trigger if insert 82 rows - -$N = 82 - -print =============== step 1 -$x = $N -$y = $N / 2 -while $x > $y - $ms = $x . m - $xt = - . $x - sql insert into $tb values (now - $ms , $x ) - $x = $x - 1 -endw - -sql select * from $tb -print sql select * from $tb -> $rows points -if $rows != $y then - return -1 -endi - -$x = $N / 2 -$y = $N -while $x < $y - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 -endw -sql select * from $tb -print sql select * from $tb -> $rows points -if $rows != $N then - return -1 -endi - -print =============== step 2 - -$R = 4 -$x = $N * 2 -$y = $N * $R -$expect = $y + $N -$y = $y + $x -while $x < $y - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $tb -print sql select * from $tb -> $rows points -if $rows != $expect then - return -1 -endi - -print =============== step 3 - -$N1 = $N + 1 -$result1 = $N / 2 -$result2 = $N -$step = $N1 . m - -$start1 = now- . $step -$start2 = now -$start3 = now+ . $step -$end1 = now- . $step -$end2 = now -$end3 = now+ . $step - - -sql select * from $tb where ts < $start1 and ts > $end1 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end2 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end3 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end1 -print select * from $tb where ts < $start2 and ts > $end1 -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end2 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end3 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end1 -print sql select * from $tb where ts < $start3 and ts > $end1 -> $rows points -if $rows != $result2 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end2 -print sql select * from $tb where ts < $start3 and ts > $end2 -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end3 -if $rows != 0 then - return -1 -endi - -print ================= order by ts desc - -sql select * from $tb where ts < $start1 and ts > $end1 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end2 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end1 order by ts desc -print select * from $tb where ts < $start2 and ts > $end1 order by ts desc -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end2 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end1 order by ts desc -print sql select * from $tb where ts < $start3 and ts > $end1 order by ts desc -> $rows points -if $rows != $result2 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end2 order by ts desc -print sql select * from $tb where ts < $start3 and ts > $end2 order by ts desc -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -clear: - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi diff --git a/tests/script/windows/insert/query_block1_memory.sim b/tests/script/windows/insert/query_block1_memory.sim deleted file mode 100644 index 6c3e58d70e992a79bfcd84a670616b9b3441393f..0000000000000000000000000000000000000000 --- a/tests/script/windows/insert/query_block1_memory.sim +++ /dev/null @@ -1,177 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$i = 0 -$dbPrefix = tb_1m_db -$tbPrefix = tb_1m_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql drop database -x step1 -step1: -sql create database $db -sql use $db - -sql create table $tb (ts timestamp, speed int) - -#commit to file will trigger if insert 82 rows - -$N = 82 - -print =============== step 1 -$x = $N -$y = $N / 2 -while $x > $y - $ms = $x . m - $xt = - . $x - sql insert into $tb values (now - $ms , -$x ) - $x = $x - 1 -endw - -sql select * from $tb -print sql select * from $tb -> $rows points -if $rows != $y then - return -1 -endi - -$x = $N / 2 -$y = $N -while $x < $y - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 -endw -sql select * from $tb -print sql select * from $tb -> $rows points -if $rows != $N then - return -1 -endi - -print =============== step 2 - -$N1 = $N + 1 -$result1 = $N / 2 -$result2 = $N -$step = $N1 . m - -$start1 = now- . $step -$start2 = now -$start3 = now+ . $step -$end1 = now- . $step -$end2 = now -$end3 = now+ . $step - -sql select * from $tb where ts < $start1 and ts > $end1 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end2 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end3 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end1 -print select * from $tb where ts < $start2 and ts > $end1 -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end2 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end3 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end1 -print sql select * from $tb where ts < $start3 and ts > $end1 -> $rows points -if $rows != $result2 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end2 -print sql select * from $tb where ts < $start3 and ts > $end2 -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end3 -if $rows != 0 then - return -1 -endi - -print ================= order by ts desc - -sql select * from $tb where ts < $start1 and ts > $end1 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end2 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end1 order by ts desc -print select * from $tb where ts < $start2 and ts > $end1 order by ts desc -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end2 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end1 order by ts desc -print sql select * from $tb where ts < $start3 and ts > $end1 order by ts desc -> $rows points -if $rows != $result2 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end2 order by ts desc -print sql select * from $tb where ts < $start3 and ts > $end2 order by ts desc -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -clear: - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi - diff --git a/tests/script/windows/insert/query_block2_file.sim b/tests/script/windows/insert/query_block2_file.sim deleted file mode 100644 index 164c8a1124eb7648c2cb0d39a1dba3839849aab4..0000000000000000000000000000000000000000 --- a/tests/script/windows/insert/query_block2_file.sim +++ /dev/null @@ -1,210 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$i = 0 -$dbPrefix = tb_2f_db -$tbPrefix = tb_2f_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql drop database -x step1 -step1: -sql create database $db -sql use $db - -$x = 0 -create1: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi -sql create table $tb (ts timestamp, speed int) -x create1 - -#commit to file will trigger if insert 82 rows -$N = 82 - -print =============== step 1 -$x = $N * 2 -$y = $N -$expect = $N -while $x > $y - $ms = $x . m - $xt = - . $x - sql insert into $tb values (now - $ms , $xt ) - $x = $x - 1 -endw - -sql select * from $tb -print sql select * from $tb -> $rows points -if $rows != $expect then - return -1 -endi - -$x = $N -$y = $N * 2 -$expect = $N * 2 -while $x < $y - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 -endw -sql select * from $tb -print sql select * from $tb -> $rows points -if $rows != $expect then - return -1 -endi - -print =============== step 2 - -$R = 4 -$y = $N * $R - -$expect = $y + $N -$expect = $expect + $N - -$x = $N * 3 -$y = $y + $x - -while $x < $y - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $tb -print sql select * from $tb -> $rows points -if $rows != $expect then - return -1 -endi - - -print =============== step 2 - -$N2 = $N -$result1 = $N -$result2 = 2 * $N -$N1 = $result2 + 1 -$step = $N1 . m - -$start1 = now- . $step -$start2 = now -$start3 = now+ . $step -$end1 = now- . $step -$end2 = now -$end3 = now+ . $step - -sql select * from $tb where ts < $start1 and ts > $end1 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end2 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end3 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end1 -print select * from $tb where ts < $start2 and ts > $end1 -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end2 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end3 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end1 -print sql select * from $tb where ts < $start3 and ts > $end1 -> $rows points -if $rows != $result2 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end2 -print sql select * from $tb where ts < $start3 and ts > $end2 -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end3 -if $rows != 0 then - return -1 -endi - -print ================= order by ts desc - -sql select * from $tb where ts < $start1 and ts > $end1 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end2 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end1 order by ts desc -print select * from $tb where ts < $start2 and ts > $end1 order by ts desc -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end2 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end1 order by ts desc -print sql select * from $tb where ts < $start3 and ts > $end1 order by ts desc -> $rows points -if $rows != $result2 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end2 order by ts desc -print sql select * from $tb where ts < $start3 and ts > $end2 order by ts desc -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -clear: - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi - diff --git a/tests/script/windows/insert/query_block2_memory.sim b/tests/script/windows/insert/query_block2_memory.sim deleted file mode 100644 index f3ceb503acfebae398856d1a2d085fd0e3a0ce2d..0000000000000000000000000000000000000000 --- a/tests/script/windows/insert/query_block2_memory.sim +++ /dev/null @@ -1,172 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$i = 0 -$dbPrefix = tb_2m_db -$tbPrefix = tb_2m_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql drop database -x step1 -step1: -sql create database $db -sql use $db -sql create table $tb (ts timestamp, speed int) - -$N = 82 - -$x = $N * 2 -$y = $N -while $x > $y - $ms = $x . m - $xt = - . $x - sql insert into $tb values (now - $ms , $xt ) - $x = $x - 1 -endw - -sql select * from $tb -print sql select * from $tb -> $rows points -if $rows != $y then - return -1 -endi - -$x = $N -$y = $N * 2 -$expect = $N * 2 -while $x < $y - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 -endw -sql select * from $tb -print sql select * from $tb -> $rows points -if $rows != $expect then - return -1 -endi - -print =============== step 2 - -$result1 = $N -$result2 = $N * 2 - -$N1 = $result2 + 1 -$step = $N1 . m - -$start1 = now- . $step -$start2 = now -$start3 = now+ . $step -$end1 = now- . $step -$end2 = now -$end3 = now+ . $step - -sql select * from $tb where ts < $start1 and ts > $end1 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end2 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end3 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end1 -print select * from $tb where ts < $start2 and ts > $end1 -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end2 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end3 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end1 -print sql select * from $tb where ts < $start3 and ts > $end1 -> $rows points -if $rows != $result2 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end2 -print sql select * from $tb where ts < $start3 and ts > $end2 -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end3 -if $rows != 0 then - return -1 -endi - -print ================= order by ts desc - -sql select * from $tb where ts < $start1 and ts > $end1 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end2 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end1 order by ts desc -print select * from $tb where ts < $start2 and ts > $end1 order by ts desc -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end2 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end1 order by ts desc -print sql select * from $tb where ts < $start3 and ts > $end1 order by ts desc -> $rows points -if $rows != $result2 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end2 order by ts desc -print sql select * from $tb where ts < $start3 and ts > $end2 order by ts desc -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/insert/query_file_memory.sim b/tests/script/windows/insert/query_file_memory.sim deleted file mode 100644 index d9752c40c9cc7c264a86e245eb3877fc47783b2a..0000000000000000000000000000000000000000 --- a/tests/script/windows/insert/query_file_memory.sim +++ /dev/null @@ -1,209 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$i = 0 -$dbPrefix = tb_fm_db -$tbPrefix = tb_fm_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql drop database -x step1 -step1: -sql create database $db -sql use $db - -$x = 0 -create1: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi -sql create table $tb (ts timestamp, speed int) -x create1 - -#commit to file will trigger if insert 82 rows - -$N = 82 - -$x = $N * 2 -$y = $N -$expect = $y -while $x > $y - $ms = $x . m - $xt = - . $x - sql insert into $tb values (now - $ms , $xt ) - $x = $x - 1 -endw - -sql select * from $tb -print sql select * from $tb -> $rows points -if $rows != $expect then - return -1 -endi - -$x = $N -$y = $N * 2 -$expect = $N * 2 -while $x < $y - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 -endw -sql select * from $tb -print sql select * from $tb -> $rows points -if $rows != $expect then - return -1 -endi - -$R = 4 -$R = $R - 1 - -$y = $N * $R -$expect = $y + $N -$expect = $expect + $N - -$x = $N * 3 -$y = $y + $x -while $x < $y - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $tb -print sql select * from $tb -> $rows points -if $rows != $expect then - return -1 -endi - - -print =============== step 2 - -$result1 = $N -$result2 = $N * 2 -$N1 = $result2 + 1 -$step = $N1 . m - -$start1 = now- . $step -$start2 = now -$start3 = now+ . $step -$end1 = now- . $step -$end2 = now -$end3 = now+ . $step - - -sql select * from $tb where ts < $start1 and ts > $end1 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end2 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end3 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end1 -print select * from $tb where ts < $start2 and ts > $end1 -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end2 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end3 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end1 -print sql select * from $tb where ts < $start3 and ts > $end1 -> $rows points -if $rows != $result2 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end2 -print sql select * from $tb where ts < $start3 and ts > $end2 -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end3 -if $rows != 0 then - return -1 -endi - -print ================= order by ts desc - -sql select * from $tb where ts < $start1 and ts > $end1 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end2 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end1 order by ts desc -print select * from $tb where ts < $start2 and ts > $end1 order by ts desc -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end2 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end1 order by ts desc -print sql select * from $tb where ts < $start3 and ts > $end1 order by ts desc -> $rows points -if $rows != $result2 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end2 order by ts desc -print sql select * from $tb where ts < $start3 and ts > $end2 order by ts desc -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -clear: - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi - - diff --git a/tests/script/windows/insert/query_multi_file.sim b/tests/script/windows/insert/query_multi_file.sim deleted file mode 100644 index ba617ce63c6886bc978fe732222a54a7a99ad4d5..0000000000000000000000000000000000000000 --- a/tests/script/windows/insert/query_multi_file.sim +++ /dev/null @@ -1,55 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$i = 0 -$dbPrefix = tb_mf_db -$tbPrefix = tb_mf_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql drop database -x step1 -step1: -sql create database $db -sql use $db - -$x = 0 -create1: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi -sql create table $tb (ts timestamp, speed int) -x create1 - -$N = 20000 - -$x = 0 - -while $x < $N - $ms = $x . s - #print insert into $tb values (now + $ms , $x ) - sql insert into $tb values (now + $ms , $x ) -x error_insert - $x = $x + 1 -endw -error_insert: - -sql select * from $tb -print $rows points data are retrieved -> exepct $N rows -if $rows < $N then - return -1 -endi - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi - diff --git a/tests/script/windows/table/binary.sim b/tests/script/windows/table/binary.sim deleted file mode 100644 index 5efa0bc6667c4f2418e53f341315bf6529527455..0000000000000000000000000000000000000000 --- a/tests/script/windows/table/binary.sim +++ /dev/null @@ -1,63 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$i = 0 -$dbPrefix = lm_bn_db -$tbPrefix = lm_bn_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql create database $db -sql use $db -sql create table $tb (ts timestamp, speed binary(5)) - -sql insert into $tb values (now, ) -x step1 - return -1 -step1: - -print =============== step2 -sql insert into $tb values (now+1a, '1234') -sql select speed from $tb order by ts desc -if $rows != 1 then - return -1 -endi -if $data00 != 1234 then - return -1 -endi - -print =============== step3 -sql insert into $tb values (now+2a, '23456') -sql select speed from $tb order by ts desc -if $rows != 2 then - return -1 -endi -print ==> $data00 -if $data00 != 23456 then - return -1 -endi - -print =============== step4 -sql_error insert into $tb values (now+3a, '345678') -sql insert into $tb values (now+3a, '34567') -sql select speed from $tb order by ts desc -if $rows != 3 then - return -1 -endi -print ==> $data00 -if $data00 != 34567 then - return -1 -endi - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi diff --git a/tests/script/windows/table/bool.sim b/tests/script/windows/table/bool.sim deleted file mode 100644 index 0d185d31e81c34d7289d753cce63ec419612646b..0000000000000000000000000000000000000000 --- a/tests/script/windows/table/bool.sim +++ /dev/null @@ -1,92 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$i = 0 -$dbPrefix = lm_bo_db -$tbPrefix = lm_bo_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql create database $db -sql use $db -$x = 0 -sql create table $tb (ts timestamp, speed bool) - -sql insert into $tb values (now, true) -sql select * from $tb -if $rows != 1 then - return -1 -endi - -if $data01 != 1 then - return -1 -endi - -print =============== step2 -sql insert into $tb values (now+1m, 1) -sql select * from $tb order by ts desc -if $rows != 2 then - return -1 -endi - -if $data01 != 1 then - return -1 -endi - -print =============== step3 -sql insert into $tb values (now+2m, 2) -sql select * from $tb order by ts desc -if $rows != 3 then - return -1 -endi - -if $data01 != 1 then - return -1 -endi - -print =============== step4 -sql insert into $tb values (now+3m, 0) -sql select * from $tb order by ts desc -if $rows != 4 then - return -1 -endi - -if $data01 != 0 then - return -1 -endi - -print =============== step5 -sql insert into $tb values (now+4m, -1) -sql select * from $tb order by ts desc -if $rows != 5 then - return -1 -endi - -if $data01 != 1 then - return -1 -endi - -print =============== step6 -sql insert into $tb values (now+5m, false) -sql select * from $tb order by ts desc -if $rows != 6 then - return -1 -endi - -if $data01 != 0 then - return -1 -endi - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi diff --git a/tests/script/windows/table/column_name.sim b/tests/script/windows/table/column_name.sim deleted file mode 100644 index 6f9f954461c6faaddb01ab8e327c008a86809bbd..0000000000000000000000000000000000000000 --- a/tests/script/windows/table/column_name.sim +++ /dev/null @@ -1,91 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - - -$i = 0 -$dbPrefix = lm_cm_db -$tbPrefix = lm_cm_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql create database $db -sql use $db - -sql drop table dd -x step0 - return -1 -step0: - -sql create table $tb(ts timestamp, int) -x step1 - return -1 -step1: - -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step2 -sql create table $tb (ts timestamp, s int) -sql show tables -if $rows != 1 then - return -1 -endi - -sql drop table $tb -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step3 -sql create table $tb (ts timestamp, a0123456789 int) -sql show tables -if $rows != 1 then - return -1 -endi - -sql drop table $tb -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step4 -sql create table $tb (ts timestamp, a0123456789012345678901234567890123456789 int) -sql drop table $tb - -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step5 -sql create table $tb (ts timestamp, a0123456789 int) -sql show tables -if $rows != 1 then - return -1 -endi - -sql insert into $tb values (now , 1) -sql select * from $tb -if $rows != 1 then - return -1 -endi - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi - - - - diff --git a/tests/script/windows/table/column_num.sim b/tests/script/windows/table/column_num.sim deleted file mode 100644 index 395ee02cdea0b90fe8cd248af63cc950c090c283..0000000000000000000000000000000000000000 --- a/tests/script/windows/table/column_num.sim +++ /dev/null @@ -1,86 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - - -$i = 0 -$dbPrefix = lm_cn_db -$tbPrefix = lm_cn_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql create database $db -sql use $db - -sql create table $tb() -x step1 - return -1 -step1: - -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step2 -sql create table $tb (ts timestamp) -x step2 - return -1 -step2: - -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step3 -sql create table $tb (ts int) -x step3 - return -1 -step3: - -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step4 -sql create table $tb (ts timestamp, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, a10 int, a11 int, a12 int, a13 int, a14 int, a15 int, a16 int, a17 int, a18 int, a19 int, a20 int, a21 int, a22 int, a23 int, a24 int, a25 int, a26 int, a27 int, a28 int,a29 int,a30 int,a31 int,a32 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int, b7 int, b8 int, b9 int, b10 int, b11 int, b12 int, b13 int, b14 int, b15 int, b16 int, b17 int, b18 int, b19 int, b20 int, b21 int, b22 int, b23 int, b24 int, b25 int, b26 int, b27 int, b28 int,b29 int,b30 int,b31 int,b32 int) - -sql show tables -if $rows != 1 then - return -1 -endi - -print =============== step5 -$i = 1 -$tb = $tbPrefix . $i - -sql create table $tb (ts timestamp, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, a10 int, a11 int, a12 int, a13 int, a14 int, a15 int, a16 int, a17 int, a18 int, a19 int, a20 int, a21 int, a22 int, a23 int, a24 int, a25 int, a26 int, a27 int, a28 int,a29 int,a30 int,a31 int,a32 int, b1 int, b2 int, b3 int, b4 int, b5 int) - -sql show tables -if $rows != 2 then - return -1 -endi - -sql insert into $tb values (now, 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 ,26 , 27 ,28 ,29,30,31, 32, 33, 34, 35, 36, 37) -sql select * from $tb -if $rows != 1 then - return -1 -endi - -sql drop table $tb -sql show tables -if $rows != 1 then - return -1 -endi - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi diff --git a/tests/script/windows/table/column_value.sim b/tests/script/windows/table/column_value.sim deleted file mode 100644 index 8db85f16ad876deff5c1a4b445351c83e9c5a3b7..0000000000000000000000000000000000000000 --- a/tests/script/windows/table/column_value.sim +++ /dev/null @@ -1,80 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - - -$i = 0 -$dbPrefix = lm_cv_db -$tbPrefix = lm_cv_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql create database $db -sql use $db - -sql create table $tb (ts timestamp, speed int, v1 binary(100), v2 binary(100), v3 binary(100), v4 binary(100), v5 binary(100)) -sql show tables -if $rows != 1 then - return -1 -endi -sql insert into $tb values(now, 1, '1', '2', '3', '4', '5') -sql insert into $tb values(now+1a, 1, '1', '2', '3', '4', '5') -sql select * from $tb -if $rows != 2 then - return -1 -endi -sql drop table $tb -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step2 -sql create table $tb (ts timestamp, speed bigint, v1 binary(1500), v2 binary(1500), v3 binary(1500), v4 binary(500), v5 binary(500)) -sql show tables -if $rows != 1 then - return -1 -endi -sql drop table $tb - -print =============== step3 -sql create table $tb (ts timestamp, speed float, v1 binary(100), v2 binary(100), v3 binary(100), v4 binary(100), v5 binary(100)) -sql show tables -if $rows != 1 then - return -1 -endi -sql insert into $tb values(now+2a, 1, '1', '2', '3', '4', '5') -sql insert into $tb values(now+3a, 1, '1', '2', '3', '4', '5') -sql select * from $tb -if $rows != 2 then - return -1 -endi -sql drop table $tb -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step4 -sql create table $tb (ts timestamp, speed double, v1 binary(1500), v2 binary(1500), v3 binary(1500), v4 binary(500), v5 binary(500)) -sql show tables -if $rows != 1 then - return -1 -endi - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi - - - - diff --git a/tests/script/windows/table/db.table.sim b/tests/script/windows/table/db.table.sim deleted file mode 100644 index 0e207c998276fe4e33d0f875155d971506aadb70..0000000000000000000000000000000000000000 --- a/tests/script/windows/table/db.table.sim +++ /dev/null @@ -1,48 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - - -$i = 0 -$dbPrefix = lm_dt_db -$tbPrefix = lm_dt_tb -$db = $dbPrefix -$tb = $tbPrefix - -print =============== step1 -sql create database $db -$table = lm_dt_db.lm_dt_tb - -print =============== step2 -sql create table $table (ts timestamp, speed int) - -print =============== step3 -sql insert into $table values (now, 1) - -print =============== step4 -sql select * from $table -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi - -print =============== step5 -sql describe $table - -print =============== step6 -sql drop table $table - - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/table/double.sim b/tests/script/windows/table/double.sim deleted file mode 100644 index b88ac4a199c9394422c7427eda6d824ec524e667..0000000000000000000000000000000000000000 --- a/tests/script/windows/table/double.sim +++ /dev/null @@ -1,98 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$i = 0 -$dbPrefix = lm_do_db -$tbPrefix = lm_do_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql create database $db -sql use $db -sql create table $tb (ts timestamp, speed double) -#sql insert into $tb values (now, -1.79E+308) -x step1 -# return -1 -#step1: - -print =============== step2 -#sql insert into $tb values (now+1a, 1.79E+308) -x step2 -# return -1 -#step2: - -sql select * from $tb order by ts desc -if $rows != 0 then - return -1 -endi - -print =============== step3 -sql insert into $tb values (now+2a, 2.85) -sql select * from $tb order by ts desc -if $rows != 1 then - return -1 -endi -if $data01 != 2.850000000 then - return -1 -endi - -print =============== step4 -sql insert into $tb values (now+3a, 3.4) -sql select * from $tb order by ts desc -if $rows != 2 then - return -1 -endi -if $data01 != 3.400000000 then - return -1 -endi - -print =============== step5 -sql insert into $tb values (now+4a, a2) -x step51 - return -1 -step51: -sql insert into $tb values (now+4a, 0) -sql select * from $tb order by ts desc -if $rows != 3 then - return -1 -endi -if $data01 != 0.000000000 then - return -1 -endi - -print =============== step6 -sql insert into $tb values (now+5a, 2a) -x step6 - return -1 -step6: -sql insert into $tb values(now+5a, 2) -sql select * from $tb order by ts desc -if $rows != 4 then - return -1 -endi -if $data01 != 2.000000000 then - return -1 -endi - -print =============== step7 -sql insert into $tb values (now+6a, 2a'1) -x step7 - return -1 -step7: -sql insert into $tb values(now+6a, 2) -sql select * from $tb order by ts desc -if $rows != 5 then - return -1 -endi -if $data01 != 2.000000000 then - return -1 -endi - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi diff --git a/tests/script/windows/table/float.sim b/tests/script/windows/table/float.sim deleted file mode 100644 index 741525830d9a5ea38d82420e9affcb8015dab1db..0000000000000000000000000000000000000000 --- a/tests/script/windows/table/float.sim +++ /dev/null @@ -1,98 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$i = 0 -$dbPrefix = lm_fl_db -$tbPrefix = lm_fl_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql create database $db -sql use $db -sql create table $tb (ts timestamp, speed float) -#sql insert into $tb values (now, -3.40E+38) -x step1 -# return -1 -#step1: - -print =============== step2 -#sql insert into $tb values (now+1a, 3.40E+308) -x step2 -# return -1 -#step2: - -sql select * from $tb order by ts desc -if $rows != 0 then - return -1 -endi - -print =============== step3 -sql insert into $tb values (now+2a, 2.85) -sql select * from $tb order by ts desc -if $rows != 1 then - return -1 -endi -if $data01 != 2.85000 then - return -1 -endi - -print =============== step4 -sql insert into $tb values (now+3a, 3.4) -sql select * from $tb order by ts desc -if $rows != 2 then - return -1 -endi -if $data01 != 3.40000 then - return -1 -endi - -print =============== step5 -sql insert into $tb values (now+4a, a2) -x step5 - return -1 -step5: -sql insert into $tb values (now+4a, 0) -sql select * from $tb order by ts desc -if $rows != 3 then - return -1 -endi -if $data01 != 0.00000 then - return -1 -endi - -print =============== step6 -sql insert into $tb values (now+5a, 2a) -x step6 - return -1 -step6: -sql insert into $tb values (now+5a, 2) -sql select * from $tb order by ts desc -if $rows != 4 then - return -1 -endi -if $data01 != 2.00000 then - return -1 -endi - -print =============== step7 -sql insert into $tb values (now+6a, 2a'1) -x step7 - return -1 -step7: -sql insert into $tb values (now+6a, 2) -sql select * from $tb order by ts desc -if $rows != 5 then - return -1 -endi -if $data01 != 2.00000 then - return -1 -endi - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi diff --git a/tests/script/windows/table/table.sim b/tests/script/windows/table/table.sim deleted file mode 100644 index 13d157627720e9f5c8a355255782b10ea43b4a58..0000000000000000000000000000000000000000 --- a/tests/script/windows/table/table.sim +++ /dev/null @@ -1,225 +0,0 @@ -sql connect -sleep 2000 -print ============================ dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$i = 0 -$dbPrefix = ob_tb_db -$tbPrefix = ob_tb_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql drop database $db -x step1 -step1: -sql create database $db - -print =============== step2-3-4 -sql use $db - -$i = 1 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val tinyint, val2 tinyint) -sql insert into $tb values(now, 1, 1) -sql select * from $tb -if $data01 != 1 then - return -1 -endi - -$i = 2 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val smallint, val2 smallint) -sql insert into $tb values(now, 2, 2) -sql select * from $tb -if $data01 != 2 then - return -1 -endi - -$i = 3 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val int, val2 int) -sql insert into $tb values(now, 3, 3) -sql select * from $tb -if $data01 != 3 then - return -1 -endi - -$i = 4 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val bigint, val2 bigint) -sql insert into $tb values(now, 4, 4) -sql select * from $tb -if $data01 != 4 then - return -1 -endi - -$i = 5 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val float, val2 float) -sql insert into $tb values(now, 5, 5) -sql select * from $tb -print ==> $data01 $data02 -if $data01 != 5.00000 then - return -1 -endi - -$i = 6 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val double, val2 double) -sql insert into $tb values(now, 6, 6) -sql select * from $tb -print ==> $data01 $data02 -if $data01 != 6.000000000 then - return -1 -endi - -$i = 7 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val binary(20), val2 binary(20)) -sql insert into $tb values(now, '7', '7') -sql select * from $tb -if $data01 != 7 then - return -1 -endi - -print =============== step5 -sql show tables -if $rows != 7 then - return -1 -endi - -$i = 1 -while $i < 8 - $tb = $tbPrefix . $i - sql drop table $tb - $i = $i + 1 -endw - -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step6-9 -$i = 1 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val tinyint, val2 tinyint) -sql select * from $tb -if $rows != 0 then - return -1 -endi -sql insert into $tb values(now, 1, 1) -sql select * from $tb -if $data01 != 1 then - return -1 -endi - -$i = 2 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val smallint, val2 smallint) -sql select * from $tb -if $rows != 0 then - return -1 -endi -sql insert into $tb values(now, 2, 2) -sql select * from $tb -if $data01 != 2 then - return -1 -endi - -$i = 3 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val int, val2 int) -sql select * from $tb -if $rows != 0 then - return -1 -endi -sql insert into $tb values(now, 3, 3) -sql select * from $tb -if $data01 != 3 then - return -1 -endi - -$i = 4 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val bigint, val2 bigint) -sql select * from $tb -if $rows != 0 then - return -1 -endi -sql insert into $tb values(now, 4, 4) -sql select * from $tb -if $data01 != 4 then - return -1 -endi - -$i = 5 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val float, val2 float) -sql select * from $tb -if $rows != 0 then - return -1 -endi -sql insert into $tb values(now, 5, 5) -sql select * from $tb -print ==> $data01 $data02 -if $data01 != 5.00000 then - return -1 -endi - -$i = 6 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val double, val2 double) -sql select * from $tb -if $rows != 0 then - return -1 -endi -sql insert into $tb values(now, 6, 6) -sql select * from $tb -print ==> $data01 $data02 -if $data01 != 6.000000000 then - return -1 -endi - -$i = 7 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val binary(20), val2 binary(20)) -sql select * from $tb -if $rows != 0 then - return -1 -endi -sql insert into $tb values(now, '7', '7') -sql select * from $tb -if $data01 != 7 then - return -1 -endi - -print =============== step10 -$i = 1 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val tinyint, val2 tinyint) -sql show tables -if $rows != 7 then - return -1 -endi - -print =============== step11 -sql create table $tb (ts timestamp, val float, val2 double) -sql show tables -if $rows != 7 then - return -1 -endi - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi - - diff --git a/tests/script/windows/table/table_len.sim b/tests/script/windows/table/table_len.sim deleted file mode 100644 index 72ed549466a61e984a0d9f287639a590c7d07f79..0000000000000000000000000000000000000000 --- a/tests/script/windows/table/table_len.sim +++ /dev/null @@ -1,105 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$i = 0 -$dbPrefix = lm_tb_db -$tbPrefix = lm_tb_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql create database $db -sql use $db - -sql drop table dd -x step0 - return -1 -step0: - -sql create table (ts timestamp, speed int) -x step1 - return -1 -step1: - -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step2 -sql create table a (ts timestamp, speed int) -sql show tables -if $rows != 1 then - return -1 -endi - -sql drop table a -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step3 -sql create table a0123456789 (ts timestamp, speed int) -sql show tables -if $rows != 1 then - return -1 -endi - -sql drop table a0123456789 -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step4 -sql create table ab01234567890123456789a0123456789a0123456789ab01234567890123456789a0123456789a0123456789ab01234567890123456789a0123456789a0123456789ab01234567890123456789a0123456789a0123456789ab01234567890123456789a0123456789a0123456789ab01234567890123456789a0123456789a0123456789 (ts timestamp, speed int) -x step4 - return -1 -step4: -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step5 -sql create table a;1 (ts timestamp, speed int) -x step5 - return -1 -step5: -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step6 -sql create table a'1 (ts timestamp, speed int) -x step6 - return -1 -step6: -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step7 -sql create table (a) (ts timestamp, speed int) -x step7 - return -1 -step7: -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step8 -sql create table a.1 (ts timestamp, speed int) -x step8 - return -1 -step8: - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/3.sim b/tests/script/windows/tag/3.sim deleted file mode 100644 index 5479be158ba4ab0be883d1f0eb26d2eb09aaafa1..0000000000000000000000000000000000000000 --- a/tests/script/windows/tag/3.sim +++ /dev/null @@ -1,521 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_3_db -$tbPrefix = ta_3_tb -$mtPrefix = ta_3_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 float) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0, 0, 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1, 1, 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step3 -sql select * from $mt where tgcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 = true -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> true -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 = false -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> false -if $rows != 100 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol2 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where tgcol3 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol3 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol3 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol3 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step6 -sql select * from $mt where ts > now + 4m and tgcol1 = true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol1 <> false -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> false and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select * from $mt where ts > now + 4m and tgcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step8 -sql select * from $mt where ts > now + 4m and tgcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step9 -sql select * from $mt where ts > now + 4m and tgcol2 = 1 and tgcol1 = true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 1 and tgcol1 <> true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = 0 and tgcol1 = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> 0 and tgcol1 <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = 0 and tgcol1 = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 and tgcol1 <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol1 <> false -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> false -if $rows != 5 then - return -1 -endi - -print =============== step10 -sql select * from $mt where ts > now + 4m and tgcol3 = 1 and tgcol1 = true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 1 and tgcol1 <> true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 = 0 and tgcol1 = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 <> 0 and tgcol1 <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 = 0 and tgcol1 = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 and tgcol1 <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol1 <> false -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> false -if $rows != 5 then - return -1 -endi - -print =============== step11 -sql select * from $mt where ts > now + 4m and tgcol3 = 1 and tgcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 1 and tgcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 = 0 and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 <> 0 and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 = 0 and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step12 -sql select * from $mt where ts > now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step13 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step14 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = true -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = true and tgcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step15 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = true -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = true and tgcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step16 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol3 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step17 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = true group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = true and tgcol2 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step18 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = true group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = true and tgcol2 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step19 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol3 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/4.sim b/tests/script/windows/tag/4.sim deleted file mode 100644 index 17552010b0382db3e9cc7e0bafdecdefff03dd96..0000000000000000000000000000000000000000 --- a/tests/script/windows/tag/4.sim +++ /dev/null @@ -1,711 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_4_db -$tbPrefix = ta_4_tb -$mtPrefix = ta_4_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 bigint, tgcol3 float, tgcol4 double) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0, 0, 0, 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1, 1, 1, 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step3 -sql select * from $mt where tgcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol2 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where tgcol3 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol3 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol3 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol3 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step6 -sql select * from $mt where tgcol4 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol4 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol4 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol4 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step7 -sql select * from $mt where ts > now + 4m and tgcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step8 -sql select * from $mt where ts > now + 4m and tgcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step9 -sql select * from $mt where ts > now + 4m and tgcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step10 -sql select * from $mt where ts > now + 4m and tgcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step11 -sql select * from $mt where ts > now + 4m and tgcol2 = 1 and tgcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 1 and tgcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = 0 and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> 0 and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = 0 and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step12 -sql select * from $mt where ts > now + 4m and tgcol3 = 1 and tgcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 1 and tgcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 = 0 and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 = 0 and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step13 -sql select * from $mt where ts > now + 4m and tgcol3 = 1 and tgcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 1 and tgcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 = 0 and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 <> 0 and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 = 0 and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step14 -sql select * from $mt where ts > now + 4m and tgcol3 = 1 and tgcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 1 and tgcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 = 0 and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 <> 0 and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 = 0 and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step15 -sql select * from $mt where ts > now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step16 -sql select * from $mt where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step17 -sql select * from $mt where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step18 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step19 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step20 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step21 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol3 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol4 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step22 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step23 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step24 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol3 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 interval(1d) group by tgcol4 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/5.sim b/tests/script/windows/tag/5.sim deleted file mode 100644 index f06d78e7b5b4082699349e12ee99c96e110fa91b..0000000000000000000000000000000000000000 --- a/tests/script/windows/tag/5.sim +++ /dev/null @@ -1,834 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_5_db -$tbPrefix = ta_5_tb -$mtPrefix = ta_5_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 tinyint, tgcol2 int, tgcol3 bigint, tgcol4 double, tgcol5 binary(20)) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0, 0, 0, 0, 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1, 1, 1, 1, 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step3 -sql select * from $mt where tgcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol2 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where tgcol3 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol3 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol3 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol3 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step6 -sql select * from $mt where tgcol4 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol4 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol4 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol4 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step7 -sql select * from $mt where tgcol5 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol5 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol5 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol5 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step8 -sql select * from $mt where ts > now + 4m and tgcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step9 -sql select * from $mt where ts > now + 4m and tgcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step10 -sql select * from $mt where ts > now + 4m and tgcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step11 -sql select * from $mt where ts > now + 4m and tgcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step12 -sql select * from $mt where ts > now + 4m and tgcol5 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol5 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol5 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step13 -sql select * from $mt where ts > now + 4m and tgcol2 = 1 and tgcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 1 and tgcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = 0 and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> 0 and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = 0 and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step14 -sql select * from $mt where ts > now + 4m and tgcol3 = 1 and tgcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 1 and tgcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 = 0 and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 <> 0 and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 = 0 and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step15 -sql select * from $mt where ts > now + 4m and tgcol3 = 1 and tgcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 1 and tgcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 = 0 and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 <> 0 and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 = 0 and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step16 -sql select * from $mt where ts > now + 4m and tgcol5 = 1 and tgcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol5 <> 1 and tgcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol5 = 0 and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol5 <> 0 and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol5 = 0 and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol5 <> 0 and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol5 <> 0 and tgcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step17 -sql select * from $mt where ts > now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step18 -sql select * from $mt where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step19 -sql select * from $mt where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step20 -sql select * from $mt where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step21 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step22 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step23 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step24 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol3 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol4 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol5 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step25 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step26 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - - -print =============== step27 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol3 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 interval(1d) group by tgcol4 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 interval(1d) group by tgcol5 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/6.sim b/tests/script/windows/tag/6.sim deleted file mode 100644 index 64cb9df6f030d4c0314d533fb6239daf7ba3586e..0000000000000000000000000000000000000000 --- a/tests/script/windows/tag/6.sim +++ /dev/null @@ -1,989 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_6_db -$tbPrefix = ta_6_tb -$mtPrefix = ta_6_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 bigint, tgcol3 smallint, tgcol4 bigint, tgcol5 binary(30), tgcol6 binary(20)) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( '0', 0, 0, 0, '0', '0' ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( '1', 1, 1, 1, '1', '1' ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step3 -sql select * from $mt where tgcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol2 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where tgcol3 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol3 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol3 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol3 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step6 -sql select * from $mt where tgcol4 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol4 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol4 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol4 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step7 -sql select * from $mt where tgcol5 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol5 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol5 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol5 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step8 -sql select * from $mt where tgcol6 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol6 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol6 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol6 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step9 -sql select * from $mt where ts > now + 4m and tgcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step10 -sql select * from $mt where ts > now + 4m and tgcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step11 -sql select * from $mt where ts > now + 4m and tgcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step12 -sql select * from $mt where ts > now + 4m and tgcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step13 -sql select * from $mt where ts > now + 4m and tgcol5 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol5 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol5 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step14 -sql select * from $mt where ts > now + 4m and tgcol6 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol6 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol6 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol6 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol6 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol6 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol6 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol6 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step15 -sql select * from $mt where ts > now + 4m and tgcol2 = 1 and tgcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 1 and tgcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = 0 and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> 0 and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = 0 and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step16 -sql select * from $mt where ts > now + 4m and tgcol3 = 1 and tgcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 1 and tgcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 = 0 and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 <> 0 and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 = 0 and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step17 -sql select * from $mt where ts > now + 4m and tgcol3 = 1 and tgcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 1 and tgcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 = 0 and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 <> 0 and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 = 0 and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step18 -sql select * from $mt where ts > now + 4m and tgcol5 = 1 and tgcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol5 <> 1 and tgcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol5 = 0 and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol5 <> 0 and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol5 = 0 and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol5 <> 0 and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol5 <> 0 and tgcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step19 -sql select * from $mt where ts > now + 4m and tgcol5 = 1 and tgcol6 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol5 <> 1 and tgcol6 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol5 = 0 and tgcol6 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol5 <> 0 and tgcol6 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol5 = 0 and tgcol6 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol5 <> 0 and tgcol6 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol5 <> 0 and tgcol6 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m and ts < now + 5m and tgcol6 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step20 -sql select * from $mt where ts > now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step21 -sql select * from $mt where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step22 -sql select * from $mt where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step23 -sql select * from $mt where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step24 -sql select * from $mt where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 1 and tgcol6 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1 and tgcol6 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 and tgcol6 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 and tgcol6 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step25 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step26 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step27 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step28 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol3 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol4 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol5 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol6 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step29 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step30 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step31 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol3 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 interval(1d) group by tgcol4 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 interval(1d) group by tgcol5 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1 interval(1d) group by tgcol6 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/add.sim b/tests/script/windows/tag/add.sim deleted file mode 100644 index 02d027ccf4e43c472a1d8b60daa99d254b2df35c..0000000000000000000000000000000000000000 --- a/tests/script/windows/tag/add.sim +++ /dev/null @@ -1,854 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_ad_db -$tbPrefix = ta_ad_tb -$mtPrefix = ta_ad_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i - -sql create database $db -sql use $db - -print =============== step2 -$i = 2 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql alter table $mt drop tag tgcol2 -sql alter table $mt add tag tgcol4 int -sql reset query cache -sql alter table $tb set tag tgcol4 =4 -sql reset query cache - -sql select * from $mt where tgcol4 = 4 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 4 then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step2 - return -1 -step2: - -print =============== step3 -$i = 3 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql alter table $mt drop tag tgcol2 -sql alter table $mt add tag tgcol4 tinyint -sql reset query cache -sql alter table $tb set tag tgcol4=4 -sql reset query cache - -sql select * from $mt where tgcol4 = 4 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 4 then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step3 - return -1 -step3: - -print =============== step4 -$i = 4 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2.00000 then - return -1 -endi - -sql describe $tb -print sql describe $tb -if $data21 != BIGINT then - return -1 -endi -if $data31 != FLOAT then - return -1 -endi -if $data23 != TAG then - return -1 -endi -if $data33 != TAG then - return -1 -endi - -sql alter table $mt drop tag tgcol2 -sql alter table $mt add tag tgcol4 float -sql reset query cache -sql alter table $tb set tag tgcol4=4 -sql reset query cache - -sql select * from $mt where tgcol4 = 4 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 4.00000 then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step4 - return -1 -step4: - -print =============== step5 -$i = 5 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10)) -sql create table $tb using $mt tags( 1, '2' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = '2' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1.000000000 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql alter table $mt drop tag tgcol2 -sql alter table $mt add tag tgcol4 smallint -sql reset query cache -sql alter table $tb set tag tgcol4=4 -sql reset query cache - -sql select * from $mt where tgcol4 = 4 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1.000000000 then - return -1 -endi -if $data03 != 4 then - return -1 -endi - -sql select * from $mt where tgcol3 = '1' -x step5 - return -1 -step5: - -print =============== step6 -$i = 6 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 tinyint) -sql create table $tb using $mt tags( 1, 2, 3 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3 then - return -1 -endi - -sql alter table $mt change tag tgcol1 tgcol4 -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol3 -sql alter table $mt add tag tgcol5 binary(10) -sql alter table $mt add tag tgcol6 binary(10) - -sql reset query cache -sql alter table $tb set tag tgcol4=false -sql alter table $tb set tag tgcol5=5 -sql alter table $tb set tag tgcol6=6 -sql reset query cache - -sql select * from $mt where tgcol5 = '5' -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 5 then - return -1 -endi -if $data04 != 6 then - return -1 -endi - -sql select * from $mt where tgcol6 = '6' -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 5 then - return -1 -endi -if $data04 != 6 then - return -1 -endi - -sql select * from $mt where tgcol4 = 1 -if $rows != 0 then - return -1 -endi -sql select * from $mt where tgcol3 = 1 -x step52 - return -1 -step52: - -print =============== step7 -$i = 7 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint, tgcol3 binary(10)) -sql create table $tb using $mt tags( 1, 2, '3' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol3 = '3' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3 then - return -1 -endi - -sql alter table $mt change tag tgcol1 tgcol4 -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol3 -sql alter table $mt add tag tgcol5 bigint -sql alter table $mt add tag tgcol6 tinyint - -sql reset query cache -sql alter table $tb set tag tgcol4=4 -sql alter table $tb set tag tgcol5=5 -sql alter table $tb set tag tgcol6=6 -sql reset query cache - -sql select * from $mt where tgcol6 = 6 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 4 then - return -1 -endi -if $data03 != 5 then - return -1 -endi -if $data04 != 6 then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step71 - return -1 -step71: -sql select * from $mt where tgcol3 = 1 -x step72 - return -1 -step72: - -print =============== step8 -$i = 8 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float, tgcol3 binary(10)) -sql create table $tb using $mt tags( 1, 2, '3' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol3 = '3' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2.00000 then - return -1 -endi -if $data04 != 3 then - return -1 -endi - -sql alter table $mt change tag tgcol1 tgcol4 -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol3 -sql alter table $mt add tag tgcol5 binary(17) -sql alter table $mt add tag tgcol6 bool -sql reset query cache -sql alter table $tb set tag tgcol4=4 -sql alter table $tb set tag tgcol5=5 -sql alter table $tb set tag tgcol6=1 -sql reset query cache - -sql select * from $mt where tgcol5 = '5' -print select * from $mt where tgcol5 = 5 -print $data01 $data02 $data03 $data04 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 4 then - return -1 -endi -if $data03 != 5 then - return -1 -endi -if $data04 != 1 then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step81 - return -1 -step81: -sql select * from $mt where tgcol3 = 1 -x step82 - return -1 -step82: - -print =============== step9 -$i = 9 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10), tgcol3 binary(10)) -sql create table $tb using $mt tags( 1, 2, '3' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = '2' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1.000000000 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3 then - return -1 -endi - -sql alter table $mt change tag tgcol1 tgcol4 -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol3 -sql alter table $mt add tag tgcol5 bool -sql alter table $mt add tag tgcol6 float - -sql reset query cache -sql alter table $tb set tag tgcol4=4 -sql alter table $tb set tag tgcol5=1 -sql alter table $tb set tag tgcol6=6 -sql reset query cache - -sql select * from $mt where tgcol5 = 1 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 4.000000000 then - return -1 -endi -if $data03 != 1 then - return -1 -endi -if $data04 != 6.00000 then - return -1 -endi - -sql select * from $mt where tgcol3 = 1 -x step91 - return -1 -step91: -sql select * from $mt where tgcol2 = 1 -x step92 - return -1 -step92: - -print =============== step10 -$i = 10 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10)) -sql create table $tb using $mt tags( '1', '2', '3', '4' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol4 = '4' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3 then - return -1 -endi -if $data05 != 4 then - return -1 -endi - -sql alter table $mt change tag tgcol1 tgcol4 -x step103 - return -1 -step103: - -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol3 -sql alter table $mt drop tag tgcol4 -sql reset query cache -sql alter table $mt add tag tgcol4 binary(10) -sql alter table $mt add tag tgcol5 bool - -sql reset query cache -sql alter table $tb set tag tgcol4=4 -sql alter table $tb set tag tgcol5=false -sql reset query cache - -sql select * from $mt where tgcol4 = '4' -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 4 then - return -1 -endi -if $data04 != 0 then - return -1 -endi -if $data05 != null then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step101 - return -1 -step101: -sql select * from $mt where tgcol3 = 1 -x step102 - return -1 -step102: - -print =============== step11 -$i = 11 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 smallint, tgcol4 float, tgcol5 binary(10)) -sql create table $tb using $mt tags( 1, 2, 3, 4, '5' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3 then - return -1 -endi -if $data05 != 4.00000 then - return -1 -endi -if $data06 != 5 then - return -1 -endi - -sql alter table $mt change tag tgcol1 tgcol4 -x step114 - return -1 -step114: - -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol3 -sql alter table $mt drop tag tgcol4 -sql alter table $mt drop tag tgcol5 -sql reset query cache -sql alter table $mt add tag tgcol4 binary(10) -sql alter table $mt add tag tgcol5 int -sql alter table $mt add tag tgcol6 binary(10) -sql alter table $mt add tag tgcol7 bigint -sql alter table $mt add tag tgcol8 smallint - -sql reset query cache -sql alter table $tb set tag tgcol4=4 -sql alter table $tb set tag tgcol5=5 -sql alter table $tb set tag tgcol6=6 -sql alter table $tb set tag tgcol7=7 -sql alter table $tb set tag tgcol8=8 -sql reset query cache - -sql select * from $mt where tgcol5 =5 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 4 then - return -1 -endi -if $data04 != 5 then - return -1 -endi -if $data05 != 6 then - return -1 -endi -if $data06 != 7 then - return -1 -endi -if $data07 != 8 then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step111 - return -1 -step111: -sql select * from $mt where tgcol3 = 1 -x step112 - return -1 -step112: -sql select * from $mt where tgcol9 = 1 -x step113 - return -1 -step113: - -print =============== step12 -$i = 12 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 smallint, tgcol3 float, tgcol4 double, tgcol5 binary(10), tgcol6 binary(20)) -sql create table $tb using $mt tags( 1, 2, 3, 4, '5', '6' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3.00000 then - return -1 -endi -if $data05 != 4.000000000 then - return -1 -endi -if $data06 != 5 then - return -1 -endi -if $data07 != 6 then - return -1 -endi - -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol3 -sql alter table $mt drop tag tgcol4 -sql alter table $mt drop tag tgcol5 -sql reset query cache -sql alter table $mt add tag tgcol2 binary(10) -sql alter table $mt add tag tgcol3 int -sql alter table $mt add tag tgcol4 binary(10) -sql alter table $mt add tag tgcol5 bigint - -sql reset query cache -sql alter table $tb set tag tgcol1=false -sql alter table $tb set tag tgcol2=5 -sql alter table $tb set tag tgcol3=4 -sql alter table $tb set tag tgcol4=3 -sql alter table $tb set tag tgcol5=2 -sql alter table $tb set tag tgcol6=1 -sql reset query cache - -sql select * from $mt where tgcol4 = '3' -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 1 then - return -1 -endi -if $data04 != 5 then - return -1 -endi -if $data05 != 4 then - return -1 -endi -if $data06 != 3 then - return -1 -endi -if $data07 != 2 then - return -1 -endi - -sql select * from $mt where tgcol2 = '5' -if $rows != 1 then - return -1 -endi - -sql select * from $mt where tgcol3 = 4 -if $rows != 1 then - return -1 -endi - -sql select * from $mt where tgcol5 = 2 -if $rows != 1 then - return -1 -endi - -sql select * from $mt where tgcol6 = '1' -if $rows != 1 then - return -1 -endi - -print =============== step13 -$i = 13 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20)) -sql create table $tb using $mt tags( '1', 2, 3, '4', 5, '6' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = '1' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3 then - return -1 -endi -if $data05 != 4 then - return -1 -endi -if $data06 != 5.000000000 then - return -1 -endi -if $data07 != 6 then - return -1 -endi - -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol4 -sql alter table $mt drop tag tgcol6 -sql reset query cache -sql alter table $mt add tag tgcol2 binary(10) -sql alter table $mt add tag tgcol4 int -sql alter table $mt add tag tgcol6 bigint - -sql reset query cache -sql alter table $tb set tag tgcol1=7 -sql alter table $tb set tag tgcol2=8 -sql alter table $tb set tag tgcol3=9 -sql alter table $tb set tag tgcol4=10 -sql alter table $tb set tag tgcol5=11 -sql alter table $tb set tag tgcol6=12 -sql reset query cache - -sql select * from $mt where tgcol2 = '8' -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 7 then - return -1 -endi -if $data03 != 9 then - return -1 -endi -if $data04 != 11.000000000 then - return -1 -endi -if $data05 != 8 then - return -1 -endi -if $data06 != 10 then - return -1 -endi -if $data07 != 12 then - return -1 -endi - -print =============== step14 -$i = 14 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 bigint) -sql create table $tb using $mt tags( 1, 1 ) -sql insert into $tb values(now, 1) - -sql alter table $mt add tag tgcol3 binary(10) -sql alter table $mt add tag tgcol4 int -sql alter table $mt add tag tgcol5 bigint -sql alter table $mt add tag tgcol6 bigint - -return -sql alter table $mt add tag tgcol7 bigint -x step141 - return -1 -step141: -sql reset query cache -sql alter table $mt drop tag tgcol6 -sql alter table $mt add tag tgcol7 bigint -sql alter table $mt add tag tgcol8 bigint -x step142 - return -1 -step142: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/bigint.sim b/tests/script/windows/tag/bigint.sim deleted file mode 100644 index ebb67d452c82586d31f673d7c9c5c78249285795..0000000000000000000000000000000000000000 --- a/tests/script/windows/tag/bigint.sim +++ /dev/null @@ -1,241 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_bi_db -$tbPrefix = ta_bi_tb -$mtPrefix = ta_bi_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bigint) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sleep 100 -sql select * from $tb -if $rows != $rowNum then - return -1 -endi -sql select * from $tb where ts < now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts <= now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts > now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts >= now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 5m -if $rows != 1 then - return -1 -endi -sql select * from $tb where ts < now + 4m and ts > now + 5m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > 100000 and ts < 100000 -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 3m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts > now + 5m and ts < now + 6m -if $rows != 1 then - return -1 -endi - -print =============== step3 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where ts > now + 4m and tgcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - - -print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/binary.sim b/tests/script/windows/tag/binary.sim deleted file mode 100644 index c59039b6a6d8ba5d05a653c1f5d40de170e89f15..0000000000000000000000000000000000000000 --- a/tests/script/windows/tag/binary.sim +++ /dev/null @@ -1,241 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_by_db -$tbPrefix = ta_by_tb -$mtPrefix = ta_by_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol binary(10)) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( '0' ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( '1' ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sleep 100 -sql select * from $tb -if $rows != $rowNum then - return -1 -endi -sql select * from $tb where ts < now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts <= now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts > now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts >= now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 5m -if $rows != 1 then - return -1 -endi -sql select * from $tb where ts < now + 4m and ts > now + 5m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > 100000 and ts < 100000 -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 3m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts > now + 5m and ts < now + 6m -if $rows != 1 then - return -1 -endi - -print =============== step3 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol = '0' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> '0' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = '1' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> '1' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = '1' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> '1' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = '0' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> '0' -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where ts > now + 4m and tgcol = '1' -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> '1' -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol = '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol <> '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol = '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol <> '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol <> '0' -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> '0' and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = '1' -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = '1' group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - - -print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/binary_binary.sim b/tests/script/windows/tag/binary_binary.sim deleted file mode 100644 index 361a6edb8b3f6d9440a1796bed5ca7c431bcf115..0000000000000000000000000000000000000000 --- a/tests/script/windows/tag/binary_binary.sim +++ /dev/null @@ -1,308 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_bib_db -$tbPrefix = ta_bib_tb -$mtPrefix = ta_bib_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol binary(5), tgcol2 binary(5)) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( '0', '0' ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( '1', '1' ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step3 -sql select * from $mt where tgcol = '0' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> '0' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = '1' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> '1' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = '1' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> '1' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = '0' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> '0' -if $rows != 100 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol2 = '0' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> '0' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 = '1' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> '1' -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where ts > now + 4m and tgcol = '1' -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> '1' -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol = '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol <> '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol = '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol <> '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol <> '0' -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> '0' and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step6 -sql select * from $mt where ts > now + 4m and tgcol2 = '1' -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> '1' -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> '0' -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select * from $mt where ts > now + 4m and tgcol2 = '1' and tgcol = '1' -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> '1' and tgcol <> '1' -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = '0' and tgcol = '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> '0' and tgcol <> '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = '0' and tgcol = '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> '0' and tgcol <> '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> '0' and tgcol <> '0' -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and ts < now + 5m and ts < now + 5m and tgcol <> '0' -if $rows != 5 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = '1' -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = '1' -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = '1' and tgcol2 = '1' -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = '1' group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = '1' group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = '1' and tgcol2 = '1' group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - - -print =============== step13 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step14 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/bool.sim b/tests/script/windows/tag/bool.sim deleted file mode 100644 index adf12338d089c41fea9e23b65b8dee03f8eb5b46..0000000000000000000000000000000000000000 --- a/tests/script/windows/tag/bool.sim +++ /dev/null @@ -1,238 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_bo_db -$tbPrefix = ta_bo_tb -$mtPrefix = ta_bo_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sleep 100 -sql select * from $tb -if $rows != $rowNum then - return -1 -endi -sql select * from $tb where ts < now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts <= now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts > now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts >= now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 5m -if $rows != 1 then - return -1 -endi -sql select * from $tb where ts < now + 4m and ts > now + 5m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 3m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts > now + 5m and ts < now + 6m -if $rows != 1 then - return -1 -endi - -print =============== step3 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = true -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> true -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = false -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> false -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where ts > now + 4m and tgcol = true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol <> false -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> false and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - - -print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/bool_binary.sim b/tests/script/windows/tag/bool_binary.sim deleted file mode 100644 index 064677ee407ee9851e45ea3c743b5d95c66e8545..0000000000000000000000000000000000000000 --- a/tests/script/windows/tag/bool_binary.sim +++ /dev/null @@ -1,308 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_bob_db -$tbPrefix = ta_bob_tb -$mtPrefix = ta_bob_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 binary(5)) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0, '0' ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1, '1' ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step3 -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = true -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> true -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = false -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> false -if $rows != 100 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol2 = '0' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> '0' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 = '1' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> '1' -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where ts > now + 4m and tgcol = true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol <> false -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> false and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step6 -sql select * from $mt where ts > now + 4m and tgcol2 = '1' -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> '1' -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> '0' -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select * from $mt where ts > now + 4m and tgcol2 = '1' and tgcol = true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> '1' and tgcol <> true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = '0' and tgcol = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> '0' and tgcol <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = '0' and tgcol = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> '0' and tgcol <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> '0' and tgcol <> false -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and ts < now + 5m and ts < now + 5m and tgcol <> false -if $rows != 5 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = '1' -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true and tgcol2 = '1' -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = '1' group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true and tgcol2 = '1' group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - - -print =============== step13 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step14 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/bool_int.sim b/tests/script/windows/tag/bool_int.sim deleted file mode 100644 index ef5cd27553161345e95d1ca1b0f414ed16394cb1..0000000000000000000000000000000000000000 --- a/tests/script/windows/tag/bool_int.sim +++ /dev/null @@ -1,324 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_boi_db -$tbPrefix = ta_boi_tb -$mtPrefix = ta_boi_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 int) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0, 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1, 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step3 -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = true -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> true -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = false -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> false -if $rows != 100 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol2 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 = true -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> true -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 = false -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> false -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where ts > now + 4m and tgcol = true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol <> false -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> false and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step6 -sql select * from $mt where ts > now + 4m and tgcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select * from $mt where ts > now + 4m and tgcol2 = 1 and tgcol = true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 1 and tgcol <> true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = 0 and tgcol = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> 0 and tgcol <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = 0 and tgcol = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 and tgcol <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol <> false -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol <> false -if $rows != 5 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true and tgcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true and tgcol2 = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - - -print =============== step13 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step14 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/change.sim b/tests/script/windows/tag/change.sim deleted file mode 100644 index 4126ea1181e8b554cac2833eb66c27f3d4290071..0000000000000000000000000000000000000000 --- a/tests/script/windows/tag/change.sim +++ /dev/null @@ -1,513 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_ch_db -$tbPrefix = ta_ch_tb -$mtPrefix = ta_ch_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i - -sql create database $db -sql use $db - -print =============== step2 -$i = 2 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql alter table $mt change tag tagcx tgcol3 -x step21 - return -1 -step21: -sql alter table $mt change tag tgcol1 tgcol2 -x step22 - return -1 -step22: -#sql alter table $mt change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20 -# return -1 -#step20: - -sql alter table $mt change tag tgcol1 tgcol3 -sql alter table $mt change tag tgcol2 tgcol4 -sql alter table $mt change tag tgcol4 tgcol3 -x step23 - return -1 -step23: - -print =============== step3 -$i = 3 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql alter table $mt change tag tgcol1 tgcol3 -sql alter table $mt change tag tgcol2 tgcol4 - -print =============== step4 -$i = 4 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2.00000 then - return -1 -endi - -sql alter table $mt change tag tgcol1 tgcol3 -sql alter table $mt change tag tgcol2 tgcol4 - -print =============== step5 -$i = 5 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10)) -sql create table $tb using $mt tags( 1, '2' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = '2' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1.000000000 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql alter table $mt change tag tgcol1 tgcol3 -sql alter table $mt change tag tgcol2 tgcol4 - -print =============== step6 -$i = 6 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20)) -sql create table $tb using $mt tags( '1', 2, 3, '4', 5, '6' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = '1' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3 then - return -1 -endi -if $data05 != 4 then - return -1 -endi -if $data06 != 5.000000000 then - return -1 -endi -if $data07 != 6 then - return -1 -endi - -sql alter table $mt drop tag tgcol3 -sql reset query cache -sql alter table $mt change tag tgcol4 tgcol3 -sql alter table $mt change tag tgcol1 tgcol7 -sql alter table $mt change tag tgcol2 tgcol8 -sql reset query cache -sql alter table $mt change tag tgcol3 tgcol9 -sql alter table $mt change tag tgcol5 tgcol10 -sql alter table $mt change tag tgcol6 tgcol11 - -sleep 3000 -sql reset query cache - -print =============== step2 -$i = 2 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol1 = 1 -x step24 - return -1 -step24: -sql select * from $mt where tgcol2 = 1 -x step25 - return -1 -step25: - -sql select * from $mt where tgcol3 = 1 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql select * from $mt where tgcol4 = 2 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -print =============== step3 -$i = 3 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol1 = 1 -x step31 - return -1 -step31: -sql select * from $mt where tgcol2 = 1 -x step32 - return -1 -step32: - -sql select * from $mt where tgcol3 = 1 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql select * from $mt where tgcol4 = 2 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -print =============== step4 -$i = 4 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol1 = 1 -x step41 - return -1 -step41: -sql select * from $mt where tgcol2 = 1 -x step42 - return -1 -step42: - -sql select * from $mt where tgcol3 = 1 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2.00000 then - return -1 -endi - -sql select * from $mt where tgcol4 = 2 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2.00000 then - return -1 -endi - -print =============== step5 -$i = 5 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol1 = 1 -x step51 - return -1 -step51: -sql select * from $mt where tgcol2 = 1 -x step52 - return -1 -step52: - -sql select * from $mt where tgcol3 = 1 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1.000000000 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql select * from $mt where tgcol4 = '2' -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1.000000000 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -print =============== step6 -$i = 6 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol1 = 1 -x step61 - return -1 -step61: -sql select * from $mt where tgcol2 = 1 -x step62 - return -1 -step62: -sql select * from $mt where tgcol3 = 1 -x step63 - return -1 -step63: -sql select * from $mt where tgcol4 = 1 -x step64 - return -1 -step64: -sql select * from $mt where tgcol5 = 1 -x step65 - return -1 -step65: -sql select * from $mt where tgcol6 = 1 -x step66 - return -1 -step66: - -sql select * from $mt where tgcol7 = '1' -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 4 then - return -1 -endi -if $data05 != 5.000000000 then - return -1 -endi -if $data06 != 6 then - return -1 -endi -if $data07 != null then - return -1 -endi - -sql select * from $mt where tgcol8 = 2 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 4 then - return -1 -endi -if $data05 != 5.000000000 then - return -1 -endi -if $data06 != 6 then - return -1 -endi -if $data07 != null then - return -1 -endi - -sql select * from $mt where tgcol9 = '4' -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 4 then - return -1 -endi -if $data05 != 5.000000000 then - return -1 -endi -if $data06 != 6 then - return -1 -endi -if $data07 != null then - return -1 -endi - -sql select * from $mt where tgcol10 = 5 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 4 then - return -1 -endi -if $data05 != 5.000000000 then - return -1 -endi -if $data06 != 6 then - return -1 -endi -if $data07 != null then - return -1 -endi - -sql select * from $mt where tgcol11 = '6' -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 4 then - return -1 -endi -if $data05 != 5.000000000 then - return -1 -endi -if $data06 != 6 then - return -1 -endi -if $data07 != null then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi diff --git a/tests/script/windows/tag/column.sim b/tests/script/windows/tag/column.sim deleted file mode 100644 index 40159bcae347e1292e2c327110bc4db6b7176bbb..0000000000000000000000000000000000000000 --- a/tests/script/windows/tag/column.sim +++ /dev/null @@ -1,93 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_co_db -$tbPrefix = ta_co_tb -$mtPrefix = ta_co_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db - -$i = 0 -sql create table $mt (ts timestamp, tbcol int, tbcol2 binary(10)) TAGS(tgcol int, tgcol2 binary(10)) - -print =============== step2 - -$i = 0 -$tb = $tbPrefix . $i -sql create table $tb using $mt tags( 0, '0' ) - -$i = 1 -$tb = $tbPrefix . $i -sql create table $tb using $mt tags( 1, 1 ) - -$i = 2 -$tb = $tbPrefix . $i -sql create table $tb using $mt tags( '2', '2' ) - -$i = 3 -$tb = $tbPrefix . $i -sql create table $tb using $mt tags( '3', 3 ) - -sql show tables -if $rows != 4 then - return -1 -endi - -print =============== step3 - -$i = 0 -$tb = $tbPrefix . $i -sql insert into $tb values(now, 0, '0') - -$i = 1 -$tb = $tbPrefix . $i -sql insert into $tb values(now, 1, 1 ) - -$i = 2 -$tb = $tbPrefix . $i -sql insert into $tb values(now, '2', '2') - -$i = 3 -$tb = $tbPrefix . $i -sql insert into $tb values(now, '3', 3) - -print =============== step4 -sql select * from $mt where tgcol2 = '1' -if $rows != 1 then - return -1 -endi - -print =============== step5 -sql select * from $mt -if $rows != 4 then - return -1 -endi - -sql select * from $mt where tgcol = 1 -if $rows != 1 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/create.sim b/tests/script/windows/tag/create.sim deleted file mode 100644 index 62dc8a7a21c442b0a38fd067da0d55ad5c8ed8ef..0000000000000000000000000000000000000000 --- a/tests/script/windows/tag/create.sim +++ /dev/null @@ -1,601 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_cr_db -$tbPrefix = ta_cr_tb -$mtPrefix = ta_cr_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i - -sql create database $db -sql use $db - -print =============== step2 -$i = 2 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool) -sql create table $tb using $mt tags( 1 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 0 then - return -1 -endi - -print =============== step3 -$i = 3 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol smallint) -sql create table $tb using $mt tags( 1 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 0 then - return -1 -endi - -print =============== step4 -$i = 4 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol tinyint) -sql create table $tb using $mt tags( 1 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 0 then - return -1 -endi - -print =============== step5 -$i = 5 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) -sql create table $tb using $mt tags( 1 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 0 then - return -1 -endi - -print =============== step6 -$i = 6 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bigint) -sql create table $tb using $mt tags( 1 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 0 then - return -1 -endi - -print =============== step7 -$i = 7 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol float) -sql create table $tb using $mt tags( 1 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 0 then - print expect 0, actual: $rows - return -1 -endi - -print =============== step8 -$i = 8 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol double) -sql create table $tb using $mt tags( 1 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 0 then - return -1 -endi - -print =============== step9 -$i = 9 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol binary(10)) -sql create table $tb using $mt tags( '1') -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol = '1' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol = '0' -if $rows != 0 then - return -1 -endi - -print =============== step10 -$i = 10 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 bool) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - print expect 1, actual: $rows - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol2 = 0 -if $rows != 0 then - return -1 -endi - -print =============== step11 -$i = 11 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 smallint) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol2 = 0 -if $rows != 0 then - return -1 -endi - -print =============== step12 -$i = 12 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 tinyint) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol2 = 0 -if $rows != 0 then - return -1 -endi - -print =============== step13 -$i = 13 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 int) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol2 = 0 -if $rows != 0 then - return -1 -endi - -print =============== step14 -$i = 14 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 bigint) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi - -sql select * from $mt where tgcol2 = 0 -if $rows != 0 then - return -1 -endi -print =============== step15 -$i = 15 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 float) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol2 = 0 -if $rows != 0 then - return -1 -endi - -print =============== step16 -$i = 16 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 double) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol2 = 0 -if $rows != 0 then - return -1 -endi - -print =============== step17 -$i = 17 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 binary(10)) -sql create table $tb using $mt tags( 1, '2' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol = true -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol2 = 0 -if $rows != 0 then - return -1 -endi - -print =============== step18 -$i = 18 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol smallint, tgcol2 tinyint) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol2 = 0 -if $rows != 0 then - return -1 -endi - -print =============== step19 -$i = 19 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol tinyint, tgcol2 int) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol2 = 0 -if $rows != 0 then - return -1 -endi - -print =============== step20 -$i = 20 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int, tgcol2 bigint) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol2 = 0 -if $rows != 0 then - return -1 -endi - -print =============== step21 -$i = 21 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bigint, tgcol2 float) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol2 = 0 -if $rows != 0 then - return -1 -endi - -print =============== step22 -$i = 22 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol float, tgcol2 double) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol2 = 0 -if $rows != 0 then - return -1 -endi - -print =============== step23 -$i = 23 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol double, tgcol2 binary(10)) -sql create table $tb using $mt tags( 1, '2' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = '2' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol2 = 0 -if $rows != 0 then - return -1 -endi - -print =============== step24 -$i = 24 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 bool, tgcol3 int, tgcol4 float, tgcol5 double, tgcol6 binary(10)) -sql create table $tb using $mt tags( 1, 2, 3, 4, 5, '6' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol3 = 3 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol4 = 4 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol5 = 5 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol6 = '6' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol6 = '0' -if $rows != 0 then - return -1 -endi - -print =============== step25 -$i = 25 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 int, tgcol3 float, tgcol4 double, tgcol5 binary(10), tgcol6 binary(10)) -sql create table $tb using $mt tags( 1, 2, 3, 4, '5', '6' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol6 = '6' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol6 = '0' -if $rows != 0 then - return -1 -endi - -print =============== step26 -$i = 26 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10), tgcol5 binary(10), tgcol6 binary(10)) -sql create table $tb using $mt tags( '1', '2', '3', '4', '5', '6' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol3 = '3' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol3 = '0' -if $rows != 0 then - return -1 -endi - -print =============== step27 -$i = 27 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 bool, tgcol3 int, tgcol4 float, tgcol5 double, tgcol6 binary(10), tgcol7) -x step27 - return -1 -step27: - -print =============== step28 -$i = 28 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol binary(250), tgcol2 binary(250)) -sql create table $tb using $mt tags('1', '1') -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol = '1' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi - -print =============== step29 -$i = 29 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol binary(25), tgcol2 binary(250)) -sql create table $tb using $mt tags('1', '1') -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol = '1' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi - -print =============== step30 -$i = 30 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol binary(250), tgcol2 binary(250), tgcol3 binary(30)) -x step30 -# return -1 -step30: - -print =============== step31 -$i = 31 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol binary(5)) -sql_error create table $tb using $mt tags('1234567') -sql create table $tb using $mt tags('12345') -sql insert into $tb values(now, 1) -sql select * from $mt -print sql select * from $mt -if $rows != 1 then - return -1 -endi - -print $data00 $data01 $data02 -if $data02 != 12345 then - return -1 -endi diff --git a/tests/script/windows/tag/delete.sim b/tests/script/windows/tag/delete.sim deleted file mode 100644 index 2b503fdf47ac2eaa5ea18c8c6af1bbbe05e9c44c..0000000000000000000000000000000000000000 --- a/tests/script/windows/tag/delete.sim +++ /dev/null @@ -1,825 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_de_db -$tbPrefix = ta_de_tb -$mtPrefix = ta_de_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i - -sql create database $db -sql use $db - -print =============== step2 -$i = 2 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql alter table $mt drop tag tgcol2 - -print =============== step3 -$i = 3 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql alter table $mt drop tag tgcol2 - -print =============== step4 -$i = 4 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 < 3 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2.00000 then - return -1 -endi - -sql describe $tb -if $data21 != BIGINT then - return -1 -endi -if $data31 != FLOAT then - return -1 -endi -if $data23 != TAG then - return -1 -endi - -sql alter table $mt drop tag tgcol1 -x step40 - return -1 -step40: -sql alter table $mt drop tag tgcol2 - -print =============== step5 -$i = 5 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10)) -sql create table $tb using $mt tags( 1, '2' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = '2' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1.000000000 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql alter table $mt drop tag tgcol1 -x step50 - return -1 -step50: -sql alter table $mt drop tag tgcol2 - -print =============== step6 -$i = 6 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 tinyint) -sql create table $tb using $mt tags( 1, 2, 3 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3 then - return -1 -endi - -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol3 - -print =============== step7 -$i = 7 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint, tgcol3 binary(10)) -sql create table $tb using $mt tags( 1, 2, '3' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol3 = '3' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3 then - return -1 -endi - -sql describe $tb -if $data21 != SMALLINT then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi -if $data41 != BINARY then - return -1 -endi -if $data22 != 2 then - return -1 -endi -if $data32 != 1 then - return -1 -endi -if $data42 != 10 then - return -1 -endi -if $data23 != TAG then - return -1 -endi -if $data33 != TAG then - return -1 -endi -if $data43 != TAG then - return -1 -endi - -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol3 - -print =============== step8 -$i = 8 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float, tgcol3 binary(10)) -sql create table $tb using $mt tags( 1, 2, '3' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol3 = '3' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2.00000 then - return -1 -endi -if $data04 != 3 then - return -1 -endi - -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol3 - -print =============== step9 -$i = 9 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10), tgcol3 binary(10)) -sql create table $tb using $mt tags( 1, '2', '3' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1.000000000 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3 then - return -1 -endi - -sql alter table $mt drop tag tgcol3 -sql alter table $mt drop tag tgcol2 - -print =============== step10 -$i = 10 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10)) -sql create table $tb using $mt tags( '1', '2', '3', '4' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol4 = '4' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3 then - return -1 -endi -if $data05 != 4 then - return -1 -endi - -sql alter table $mt drop tag tgcol3 -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol4 - -print =============== step11 -$i = 11 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 smallint, tgcol4 float, tgcol5 binary(10)) -sql create table $tb using $mt tags( 1, 2, 3, 4, '5' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3 then - return -1 -endi -if $data05 != 4.00000 then - return -1 -endi -if $data06 != 5 then - return -1 -endi - -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol3 -sql alter table $mt drop tag tgcol5 - -print =============== step12 -$i = 12 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 smallint, tgcol3 float, tgcol4 double, tgcol5 binary(10), tgcol6 binary(20)) -sql create table $tb using $mt tags( 1, 2, 3, 4, '5', '6' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3.00000 then - return -1 -endi -if $data05 != 4.000000000 then - return -1 -endi -if $data06 != 5 then - return -1 -endi -if $data07 != 6 then - return -1 -endi - -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol3 -sql alter table $mt drop tag tgcol5 -sql alter table $mt drop tag tgcol6 - -print =============== step13 -$i = 13 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20)) -sql create table $tb using $mt tags( '1', 2, 3, '4', 5, '6' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = '1' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3 then - return -1 -endi -if $data05 != 4 then - return -1 -endi -if $data06 != 5.000000000 then - return -1 -endi -if $data07 != 6 then - return -1 -endi - -sql alter table $mt drop tag tgcol3 -sql alter table $mt drop tag tgcol4 -sql alter table $mt drop tag tgcol6 - -sleep 3000 - -print =============== step2 -$i = 2 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol1 = 1 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != null then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step2 - return -1 -step2: - -print =============== step3 -$i = 3 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol1 = 1 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != null then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step3 - return -1 -step3: - -print =============== step4 -$i = 4 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol1 = 1 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != null then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step4 - return -1 -step4: - -print =============== step5 -$i = 5 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol1 = 1 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1.000000000 then - return -1 -endi -if $data03 != null then - return -1 -endi - -sql select * from $mt where tgcol2 = '1' -x step5 - return -1 -step5: - -print =============== step6 -$i = 6 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol1 = 1 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != null then - return -1 -endi -if $data04 != null then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step51 - return -1 -step51: -sql select * from $mt where tgcol3 = 1 -x step52 - return -1 -step52: - -print =============== step7 -$i = 7 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol1 = 1 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != null then - return -1 -endi -if $data04 != null then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step71 - return -1 -step71: -sql select * from $mt where tgcol3 = 1 -x step72 - return -1 -step72: - -print =============== step8 -$i = 8 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol1 = 1 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != null then - return -1 -endi -if $data04 != null then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step81 - return -1 -step81: -sql select * from $mt where tgcol3 = 1 -x step82 - return -1 -step82: - -print =============== step9 -$i = 9 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol1 = 1 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1.000000000 then - return -1 -endi -if $data03 != null then - return -1 -endi -if $data04 != null then - return -1 -endi - -sql select * from $mt where tgcol3 = 1 -x step91 - return -1 -step91: -sql select * from $mt where tgcol2 = 1 -x step92 - return -1 -step92: - -print =============== step10 -$i = 10 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol1 = '1' -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != null then - return -1 -endi -if $data04 != null then - return -1 -endi -if $data05 != null then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step101 - return -1 -step101: -sql select * from $mt where tgcol3 = 1 -x step102 - return -1 -step102: -sql select * from $mt where tgcol4 = 1 -x step103 - return -1 -step103: - -print =============== step11 -$i = 11 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol4=4 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 4.00000 then - return -1 -endi -if $data04 != null then - return -1 -endi -if $data05 != null then - return -1 -endi -if $data06 != null then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step111 - return -1 -step111: -sql select * from $mt where tgcol3 = 1 -x step112 - return -1 -step112: -sql select * from $mt where tgcol5 = 1 -x step113 - return -1 -step113: - -print =============== step12 -$i = 12 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol4 = 4 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 4.000000000 then - return -1 -endi -if $data04 != null then - return -1 -endi -if $data05 != null then - return -1 -endi -if $data06 != null then - return -1 -endi -if $data07 != null then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step120 - return -1 -step120: -sql select * from $mt where tgcol3 = 1 -x step121 - return -1 -step121: -sql select * from $mt where tgcol5 = 1 -x step122 - return -1 -step122: -sql select * from $mt where tgcol6 = 1 -x step123 - return -1 -step123: - -print =============== step13 -$i = 13 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql reset query cache -sql select * from $mt where tgcol2 = 2 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 5.000000000 then - return -1 -endi -if $data05 != null then - return -1 -endi -if $data06 != null then - return -1 -endi -if $data07 != null then - return -1 -endi - -sql select * from $mt where tgcol3 = 1 -x step130 - return -1 -step130: -sql select * from $mt where tgcol4 = 1 -x step131 - return -1 -step131: -sql select * from $mt where tgcol6 = 1 -x step133 - return -1 -step133: - -print =============== step14 -$i = 14 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 bigint) -sql create table $tb using $mt tags( 1, 1 ) -sql insert into $tb values(now, 1) - -sql alter table xxmt drop tag tag1 -x step141 - return -1 -step141: -sql alter table $tb drop tag tag1 -x step142 - return -1 -step142: -sql alter table $mt drop tag tag1 -x step143 - return -1 -step143: - -sql alter table $mt drop tag tagcol1 -x step144 - return -1 -step144: - -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol1 -x step145 - return -1 -step145: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/double.sim b/tests/script/windows/tag/double.sim deleted file mode 100644 index 4381aa20f939d79ac81804a5be54952db7a27ba4..0000000000000000000000000000000000000000 --- a/tests/script/windows/tag/double.sim +++ /dev/null @@ -1,241 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_do_db -$tbPrefix = ta_do_tb -$mtPrefix = ta_do_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol double) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sleep 100 -sql select * from $tb -if $rows != $rowNum then - return -1 -endi -sql select * from $tb where ts < now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts <= now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts > now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts >= now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 5m -if $rows != 1 then - return -1 -endi -sql select * from $tb where ts < now + 4m and ts > now + 5m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > 100000 and ts < 100000 -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 3m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts > now + 5m and ts < now + 6m -if $rows != 1 then - return -1 -endi - -print =============== step3 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where ts > now + 4m and tgcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - - -print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/filter.sim b/tests/script/windows/tag/filter.sim deleted file mode 100644 index 802e9a312f8cccbc34bb537dbba5ec3ab13b11d5..0000000000000000000000000000000000000000 --- a/tests/script/windows/tag/filter.sim +++ /dev/null @@ -1,149 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_fi_db -$tbPrefix = ta_fi_tb -$mtPrefix = ta_fi_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol binary(10)) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( '0' ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( '1' ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = '1' -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tg = '1' -x step2 - return -1 -step2: - -print =============== step3 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where noexist = '1' -x step3 - return -1 -step3: - -print =============== step4 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1' -if $rows != 1 then - return -1 -endi -if $data00 != 10 then - return -1 -endi - -print =============== step5 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(cc), sum(xx), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -x step6 - return -1 -step6: - -print =============== step7 -sql select count(tgcol), avg(tgcol), sum(tgcol), min(tgcol), max(tgcol), first(tgcol), last(tgcol) from $mt -x step7 - return -1 -step7: - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tbcol - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by noexist -x step9 - return -1 -step9: - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step11 -sql select count(tbcol) as c from $mt group by tbcol - -print =============== step12 -sql select count(tbcol) as c from $mt group by noexist -x step12 - return -1 -step12: - -print =============== step13 -sql select count(tbcol) as c from $mt group by tgcol -print $data00 -if $data00 != 100 then - return -1 -endi - -print =============== step14 -sql select count(tbcol) as c from $mt where ts > 1000 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - print expect 100, actual $data00 - return -1 -endi - -print =============== step15 -sql select count(tbcol) as c from $mt where noexist < 1 group by tgcol -x step15 - return -1 -step15: - -print =============== step16 -sql select count(tbcol) as c from $mt where tgcol = '1' group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/float.sim b/tests/script/windows/tag/float.sim deleted file mode 100644 index 8df44c24a56d8c013af7c63aa9d45b720069cbaa..0000000000000000000000000000000000000000 --- a/tests/script/windows/tag/float.sim +++ /dev/null @@ -1,241 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_fl_db -$tbPrefix = ta_fl_tb -$mtPrefix = ta_fl_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol float) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sleep 100 -sql select * from $tb -if $rows != $rowNum then - return -1 -endi -sql select * from $tb where ts < now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts <= now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts > now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts >= now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 5m -if $rows != 1 then - return -1 -endi -sql select * from $tb where ts < now + 4m and ts > now + 5m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > 100000 and ts < 100000 -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 3m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts > now + 5m and ts < now + 6m -if $rows != 1 then - return -1 -endi - -print =============== step3 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where ts > now + 4m and tgcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - - -print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/int.sim b/tests/script/windows/tag/int.sim deleted file mode 100644 index dbff8c15b6aad716a1c90ad5c74269f955c7307d..0000000000000000000000000000000000000000 --- a/tests/script/windows/tag/int.sim +++ /dev/null @@ -1,241 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_in_db -$tbPrefix = ta_in_tb -$mtPrefix = ta_in_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sleep 100 -sql select * from $tb -if $rows != $rowNum then - return -1 -endi -sql select * from $tb where ts < now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts <= now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts > now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts >= now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 5m -if $rows != 1 then - return -1 -endi -sql select * from $tb where ts < now + 4m and ts > now + 5m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > 100000 and ts < 100000 -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 3m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts > now + 5m and ts < now + 6m -if $rows != 1 then - return -1 -endi - -print =============== step3 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where ts > now + 4m and tgcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - - -print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/int_binary.sim b/tests/script/windows/tag/int_binary.sim deleted file mode 100644 index 94aa9eb7f40441f5cc4e399ac8a4f5f5ce396beb..0000000000000000000000000000000000000000 --- a/tests/script/windows/tag/int_binary.sim +++ /dev/null @@ -1,308 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_inb_db -$tbPrefix = ta_inb_tb -$mtPrefix = ta_inb_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int, tgcol2 binary(5)) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0, '0' ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1, '1' ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step3 -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol2 = '0' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> '0' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 = '1' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> '1' -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where ts > now + 4m and tgcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step6 -sql select * from $mt where ts > now + 4m and tgcol2 = '1' -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> '1' -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> '0' -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select * from $mt where ts > now + 4m and tgcol2 = '1' and tgcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> '1' and tgcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = '0' and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> '0' and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = '0' and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> '0' and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> '0' and tgcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and ts < now + 5m and ts < now + 5m and tgcol <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = '1' -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 and tgcol2 = '1' -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = '1' group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 and tgcol2 = '1' group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - - -print =============== step13 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step14 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/int_float.sim b/tests/script/windows/tag/int_float.sim deleted file mode 100644 index 9789c9ea06640432e8866a787ec0389ed3d239c2..0000000000000000000000000000000000000000 --- a/tests/script/windows/tag/int_float.sim +++ /dev/null @@ -1,324 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_inf_db -$tbPrefix = ta_inf_tb -$mtPrefix = ta_inf_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int, tgcol2 float) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0, 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1, 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step3 -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol2 > 0.5 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 < 0.5 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 > 0.5 and tgcol2 < 1.5 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where ts > now + 4m and tgcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step6 -sql select * from $mt where ts > now + 4m and tgcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select * from $mt where ts > now + 4m and tgcol2 = 1 and tgcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 1 and tgcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = 0 and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> 0 and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = 0 and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 and tgcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 and tgcol2 = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - - -print =============== step13 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step14 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/set.sim b/tests/script/windows/tag/set.sim deleted file mode 100644 index 54b87c7d0c1c4eac55a16d42b61979329a31167d..0000000000000000000000000000000000000000 --- a/tests/script/windows/tag/set.sim +++ /dev/null @@ -1,457 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_se_db -$tbPrefix = ta_se_tb -$mtPrefix = ta_se_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i - -sql create database $db -sql use $db - -print =============== step2 -$i = 2 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql alter table $tb set tag tagcx 1 -x step21 - return -1 -step21: -sql alter table $tb set tag tgcol1=false -sql alter table $tb set tag tgcol2=4 - -sql reset query cache - -sql select * from $mt where tgcol1 = false -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 4 then - return -1 -endi - -sql select * from $mt where tgcol2 = 4 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 4 then - return -1 -endi - -sql describe $tb -print $data21 $data23 $data32 $data33 -if $data21 != BOOL then - return -1 -endi -if $data31 != INT then - return -1 -endi -if $data23 != TAG then - return -1 -endi -if $data33 != TAG then - return -1 -endi - -print =============== step3 -$i = 3 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql alter table $tb set tag tgcol1=3 -sql alter table $tb set tag tgcol2=4 - -sql reset query cache - -sql select * from $mt where tgcol1 = 3 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 3 then - return -1 -endi -if $data03 != 4 then - return -1 -endi - -sql select * from $mt where tgcol2 = 4 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 3 then - return -1 -endi -if $data03 != 4 then - return -1 -endi - -sql select * from $mt where tgcol2 = 2 -if $rows != 0 then - return -1 -endi - - -print =============== step4 -$i = 4 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2.00000 then - return -1 -endi - -sql alter table $tb set tag tgcol1=3 -sql alter table $tb set tag tgcol2=4 - -sql reset query cache - -sql select * from $mt where tgcol1 = 3 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 3 then - return -1 -endi -if $data03 != 4.00000 then - return -1 -endi - -sql select * from $mt where tgcol2 = 4 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 3 then - return -1 -endi -if $data03 != 4.00000 then - return -1 -endi - - -print =============== step5 -$i = 5 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10)) -sql create table $tb using $mt tags( 1, '2' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = '2' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1.000000000 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql alter table $tb set tag tgcol1=3 -sql alter table $tb set tag tgcol2='4' - -sql reset query cache - -sql select * from $mt where tgcol1 = 3 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 3.000000000 then - return -1 -endi -if $data03 != 4 then - return -1 -endi - -sql select * from $mt where tgcol2 = '4' -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 3.000000000 then - return -1 -endi -if $data03 != 4 then - return -1 -endi - -print =============== step6 -$i = 6 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20)) -sql create table $tb using $mt tags( '1', 2, 3, '4', 5, '6' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = '1' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3 then - return -1 -endi -if $data05 != 4 then - return -1 -endi -if $data06 != 5.000000000 then - return -1 -endi -if $data07 != 6 then - return -1 -endi - -sql alter table $mt drop tag tgcol3 -sql alter table $tb set tag tgcol1='7' -sql alter table $tb set tag tgcol2=8 -sql alter table $tb set tag tgcol4='9' -sql alter table $tb set tag tgcol5=10 -sql alter table $tb set tag tgcol6='11' - -sql reset query cache - -sql select * from $mt where tgcol1 = '7' -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 7 then - return -1 -endi -if $data03 != 8 then - return -1 -endi -if $data04 != 9 then - return -1 -endi -if $data05 != 10.000000000 then - return -1 -endi -if $data06 != 11 then - return -1 -endi -if $data07 != null then - return -1 -endi - -sql select * from $mt where tgcol2 = 8 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 7 then - return -1 -endi -if $data03 != 8 then - return -1 -endi -if $data04 != 9 then - return -1 -endi -if $data05 != 10.000000000 then - return -1 -endi -if $data06 != 11 then - return -1 -endi -if $data07 != null then - return -1 -endi - -sql select * from $mt where tgcol4 = '9' -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 7 then - return -1 -endi -if $data03 != 8 then - return -1 -endi -if $data04 != 9 then - return -1 -endi -if $data05 != 10.000000000 then - return -1 -endi -if $data06 != 11 then - return -1 -endi -if $data07 != null then - return -1 -endi - -sql select * from $mt where tgcol5 = 10 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 7 then - return -1 -endi -if $data03 != 8 then - return -1 -endi -if $data04 != 9 then - return -1 -endi -if $data05 != 10.000000000 then - return -1 -endi -if $data06 != 11 then - return -1 -endi -if $data07 != null then - return -1 -endi - -sql select * from $mt where tgcol6 = '11' -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 7 then - return -1 -endi -if $data03 != 8 then - return -1 -endi -if $data04 != 9 then - return -1 -endi -if $data05 != 10.000000000 then - return -1 -endi -if $data06 != 11 then - return -1 -endi -if $data07 != null then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/smallint.sim b/tests/script/windows/tag/smallint.sim deleted file mode 100644 index bc668b164d53309512d69434e021f5744da2a253..0000000000000000000000000000000000000000 --- a/tests/script/windows/tag/smallint.sim +++ /dev/null @@ -1,241 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_sm_db -$tbPrefix = ta_sm_tb -$mtPrefix = ta_sm_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol smallint) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sleep 100 -sql select * from $tb -if $rows != $rowNum then - return -1 -endi -sql select * from $tb where ts < now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts <= now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts > now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts >= now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 5m -if $rows != 1 then - return -1 -endi -sql select * from $tb where ts < now + 4m and ts > now + 5m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > 100000 and ts < 100000 -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 3m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts > now + 5m and ts < now + 6m -if $rows != 1 then - return -1 -endi - -print =============== step3 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where ts > now + 4m and tgcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - - -print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/tinyint.sim b/tests/script/windows/tag/tinyint.sim deleted file mode 100644 index 44fc9ba4dc0d0f4a670c3c03abf36a38f658f878..0000000000000000000000000000000000000000 --- a/tests/script/windows/tag/tinyint.sim +++ /dev/null @@ -1,241 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_ti_db -$tbPrefix = ta_ti_tb -$mtPrefix = ta_ti_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol tinyint) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sleep 100 -sql select * from $tb -if $rows != $rowNum then - return -1 -endi -sql select * from $tb where ts < now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts <= now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts > now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts >= now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 5m -if $rows != 1 then - return -1 -endi -sql select * from $tb where ts < now + 4m and ts > now + 5m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > 100000 and ts < 100000 -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 3m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts > now + 5m and ts < now + 6m -if $rows != 1 then - return -1 -endi - -print =============== step3 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where ts > now + 4m and tgcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - - -print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/testSuite.sim b/tests/script/windows/testSuite.sim deleted file mode 100644 index e372217b620fcf0735e3645fa96872ca11450225..0000000000000000000000000000000000000000 --- a/tests/script/windows/testSuite.sim +++ /dev/null @@ -1,93 +0,0 @@ -run windows/alter/table.sim -run windows/alter/metrics.sim - -run windows/compute/avg.sim -run windows/compute/bottom.sim -run windows/compute/count.sim -run windows/compute/diff.sim -run windows/compute/first.sim -run windows/compute/interval.sim -run windows/compute/last.sim -run windows/compute/leastsquare.sim -run windows/compute/max.sim -run windows/compute/min.sim -run windows/compute/percentile.sim -run windows/compute/stddev.sim -run windows/compute/sum.sim -run windows/compute/top.sim - -run windows/db/basic.sim -run windows/db/len.sim - -run windows/field/2.sim -run windows/field/3.sim -run windows/field/4.sim -run windows/field/5.sim -run windows/field/6.sim -run windows/field/bigint.sim -run windows/field/binary.sim -run windows/field/bool.sim -run windows/field/double.sim -run windows/field/float.sim -run windows/field/int.sim -run windows/field/single.sim -run windows/field/smallint.sim -run windows/field/tinyint.sim - -run windows/import/basic.sim - -run windows/insert/basic.sim -run windows/insert/query_block1_file.sim -run windows/insert/query_block1_memory.sim -run windows/insert/query_block2_file.sim -run windows/insert/query_block2_memory.sim -run windows/insert/query_file_memory.sim -run windows/insert/query_multi_file.sim - -run windows/table/binary.sim -run windows/table/bool.sim -run windows/table/column_num.sim -run windows/table/column_name.sim -run windows/table/column_value.sim -run windows/table/db.table.sim -run windows/table/double.sim -run windows/table/float.sim -run windows/table/table_len.sim -run windows/table/table.sim - -run windows/tag/3.sim -run windows/tag/4.sim -run windows/tag/5.sim -run windows/tag/6.sim -run windows/tag/add.sim -run windows/tag/bigint.sim -run windows/tag/binary_binary.sim -run windows/tag/binary.sim -run windows/tag/bool_binary.sim -run windows/tag/bool_int.sim -run windows/tag/bool.sim -run windows/tag/change.sim -run windows/tag/column.sim -run windows/tag/create.sim -run windows/tag/delete.sim -run windows/tag/double.sim -run windows/tag/filter.sim -run windows/tag/float.sim -run windows/tag/int_binary.sim -run windows/tag/int_float.sim -run windows/tag/int.sim -run windows/tag/set.sim -run windows/tag/smallint.sim -run windows/tag/tinyint.sim - -run windows/vector/metrics_field.sim -run windows/vector/metrics_mix.sim -run windows/vector/metrics_query.sim -run windows/vector/metrics_tag.sim -run windows/vector/metrics_time.sim -run windows/vector/multi.sim -run windows/vector/single.sim -run windows/vector/table_field.sim -run windows/vector/table_mix.sim -run windows/vector/table_query.sim -run windows/vector/table_time.sim diff --git a/tests/script/windows/vector/metrics_field.sim b/tests/script/windows/vector/metrics_field.sim deleted file mode 100644 index dfaa7e1d9978357f5858e529ebac40941dd6bf2c..0000000000000000000000000000000000000000 --- a/tests/script/windows/vector/metrics_field.sim +++ /dev/null @@ -1,622 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_mf_db -$tbPrefix = m_mf_tb -$mtPrefix = m_mf_mt - -$dbPrefix = db -$tbPrefix = tb -$mtPrefix = mt - -$tbNum = 10 -$rowNum = 21 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, a int, b float, c smallint, d double, e tinyint, f bigint, g binary(10), h bool) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 1 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x , $x , $x , $x , $x , 10 , '11' , true ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select a - f from $mt where a = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - a from $mt where a = 5 -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select b - f from $mt where a = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - b from $mt where a = 5 -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select c - f from $mt where a = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select d - f from $mt where a = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select e - f from $mt where a = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - f from $mt where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select g - f from $mt where a = 5 -x step21 - return -1 -step21: - -sql select h - f from $mt where a = 5 -x step22 - return -1 -step22: - -sql select ts - f from $mt where a = 5 -x step23 - return -1 -step23: - -sql select a - e from $mt where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - e from $mt where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - e from $mt where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select d - e from $mt where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - d from $mt where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - d from $mt where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - d from $mt where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - c from $mt where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - c from $mt where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - b from $mt where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - a from $mt where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -print =============== step3 -$i = 1 -$tb where tgcol = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a + f from $mt where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + a from $mt where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select b + f from $mt where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + b from $mt where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select c + f from $mt where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select d + f from $mt where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select e + f from $mt where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + f from $mt where a = 5 -print ===> $data00 -if $data00 != 20.000000000 then - return -1 -endi - -sql select a + e from $mt where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + e from $mt where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c + e from $mt where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select d + e from $mt where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + d from $mt where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + d from $mt where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c + d from $mt where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + c from $mt where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + c from $mt where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + b from $mt where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + a from $mt where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -print =============== step4 -$i = 1 -$tb where tgcol = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a * f from $mt where a = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * a from $mt where a = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select b * f from $mt where a = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * b from $mt where a = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select c * f from $mt where a = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select d * f from $mt where a = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select e * f from $mt where a = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * f from $mt where a = 5 -print ===> $data00 -if $data00 != 100.000000000 then - return -1 -endi - -sql select a * e from $mt where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * e from $mt where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select c * e from $mt where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select d * e from $mt where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * d from $mt where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * d from $mt where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select c * d from $mt where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * c from $mt where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * c from $mt where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * b from $mt where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * a from $mt where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -print =============== step5 -$i = 1 -$tb where tgcol = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a / f from $mt where a = 5 -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / a from $mt where a = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b / f from $mt where a = 5 -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / b from $mt where a = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select c / f from $mt where a = 5 -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select d / f from $mt where a = 5 -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select e / f from $mt where a = 5 -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / f from $mt where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / e from $mt where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / e from $mt where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / e from $mt where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select d / e from $mt where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / d from $mt where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / d from $mt where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / d from $mt where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / c from $mt where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / c from $mt where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / b from $mt where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / a from $mt where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -print =============== step6 -$i = 1 -$tb where tgcol = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select (a+b+c+d+e) / f from $mt where a = 5 -print ===> $data00 -if $data00 != 2.500000000 then - return -1 -endi - -sql select f / (a+b+c+d+e) from $mt where a = 5 -print ===> $data00 -if $data00 != 0.400000000 then - return -1 -endi - -sql select (a+b+c+d+e) * f from $mt where a = 5 -print ===> $data00 -if $data00 != 250.000000000 then - return -1 -endi - -sql select f * (a+b+c+d+e) from $mt where a = 5 -print ===> $data00 -if $data00 != 250.000000000 then - return -1 -endi - -sql select (a+b+c+d+e) - f from $mt where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f - (a+b+c+d+e) from $mt where a = 5 -print ===> $data00 -if $data00 != -15.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) / f from $mt where a = 5 -print ===> $data00 -if $data00 != -1.500000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) * f from $mt where a = 5 -print ===> $data00 -if $data00 != -150.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) + f from $mt where a = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) - f from $mt where a = 5 -print ===> $data00 -if $data00 != -25.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e) * f as zz from $mt where a = 5 -print ===> $data00 -if $data00 != -1300.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e))) * f as zz from $mt where a = 5 -x step61 - return -1 -step61: - -sql select (f - (a*b+c)*a + d + e))) * 2f as zz from $mt where a = 5 -x step62 - return -1 -step62: - -sql select (f - (a*b+c)*a + d + e))) ** f as zz from $mt where a = 5 -x step63 - return -1 -step63: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/vector/metrics_mix.sim b/tests/script/windows/vector/metrics_mix.sim deleted file mode 100644 index 111fdebb05735057a922ce313d9c595a7d8491ff..0000000000000000000000000000000000000000 --- a/tests/script/windows/vector/metrics_mix.sim +++ /dev/null @@ -1,622 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_mx_db -$tbPrefix = m_mx_tb -$mtPrefix = m_mx_mt - -$tbNum = 10 -$rowNum = 21 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, a int, b float, c smallint, d double, e tinyint, f bigint, g binary(10), h bool) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 1 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x , $x , $x , $x , $x , 10 , '11' , true ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select a - ffrom $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -x step020 - return -1 -step020: - -sql select a -f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - a from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select b - f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - b from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select c - f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select d - f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select e - f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select g - f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -x step21 - return -1 -step21: - -sql select h - f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -x step22 - return -1 -step22: - -sql select ts - f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -x step23 - return -1 -step23: - -sql select a - e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select d - e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - d from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - d from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - d from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - c from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - c from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - b from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - a from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -print =============== step3 -$i = 1 -$tb where tgcol = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a + f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + a from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select b + f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + b from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select c + f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select d + f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select e + f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 20.000000000 then - return -1 -endi - -sql select a + e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c + e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select d + e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + d from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + d from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c + d from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + c from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + c from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + b from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + a from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -print =============== step4 -$i = 1 -$tb where tgcol = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a * f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * a from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select b * f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * b from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select c * f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select d * f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select e * f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 100.000000000 then - return -1 -endi - -sql select a * e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select c * e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select d * e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * d from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * d from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select c * d from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * c from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * c from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * b from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * a from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -print =============== step5 -$i = 1 -$tb where tgcol = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a / f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / a from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b / f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / b from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select c / f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select d / f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select e / f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select d / e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / d from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / d from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / d from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / c from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / c from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / b from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / a from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -print =============== step6 -$i = 1 -$tb where tgcol = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select (a+b+c+d+e) / f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 2.500000000 then - return -1 -endi - -sql select f / (a+b+c+d+e) from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.400000000 then - return -1 -endi - -sql select (a+b+c+d+e) * f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 250.000000000 then - return -1 -endi - -sql select f * (a+b+c+d+e) from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 250.000000000 then - return -1 -endi - -sql select (a+b+c+d+e) - f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f - (a+b+c+d+e) from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -15.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) / f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -1.500000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) * f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -150.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) + f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) - f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -25.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e) * f as zz from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -1300.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e))) * f as zz from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -x step61 - return -1 -step61: - -sql select (f - (a*b+c)*a + d + e))) * 2f as zz from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -x step62 - return -1 -step62: - -sql select (f - (a*b+c)*a + d + e))) ** f as zz from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -x step63 - return -1 -step63: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/vector/metrics_query.sim b/tests/script/windows/vector/metrics_query.sim deleted file mode 100644 index 45e734f468deb4fb1567260fdde8b072bdb2a3b2..0000000000000000000000000000000000000000 --- a/tests/script/windows/vector/metrics_query.sim +++ /dev/null @@ -1,618 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_mq_db -$tbPrefix = m_mq_tb -$mtPrefix = m_mq_mt - -$tbNum = 10 -$rowNum = 21 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, a int, b float, c smallint, d double, e tinyint, f bigint, g binary(10), h bool) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 1 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x , $x , $x , $x , $x , 10 , '11' , true ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select a - f from $mt -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select f - a from $mt -print ===> $data00 -if $data00 != 9.000000000 then - return -1 -endi - -sql select b - f from $mt -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select f - b from $mt -print ===> $data00 -if $data00 != 9.000000000 then - return -1 -endi - -sql select c - f from $mt -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select d - f from $mt -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select e - f from $mt -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select f - f from $mt -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select g - f from $mt -x step21 - return -1 -step21: - -sql select h - f from $mt -x step22 - return -1 -step22: - -sql select ts - f from $mt -x step23 - return -1 -step23: - -sql select a - e from $mt -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - e from $mt -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - e from $mt -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select d - e from $mt -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - d from $mt -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - d from $mt -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - d from $mt -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - c from $mt -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - c from $mt -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - b from $mt -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - a from $mt -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -print =============== step3 -$i = 1 -$tb = $tbPrefix . $i - -sql select a + f from $mt -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select f + a from $mt -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select b + f from $mt -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select f + b from $mt -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select c + f from $mt -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select d + f from $mt -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select e + f from $mt -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select f + f from $mt -print ===> $data00 -if $data00 != 20.000000000 then - return -1 -endi - -sql select a + e from $mt -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b + e from $mt -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select c + e from $mt -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select d + e from $mt -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select a + d from $mt -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b + d from $mt -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select c + d from $mt -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select a + c from $mt -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b + c from $mt -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select a + b from $mt -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b + a from $mt -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -print =============== step4 -$i = 1 -$tb = $tbPrefix . $i - -sql select a * f from $mt -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select f * a from $mt -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b * f from $mt -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select f * b from $mt -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c * f from $mt -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select d * f from $mt -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select e * f from $mt -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select f * f from $mt -print ===> $data00 -if $data00 != 100.000000000 then - return -1 -endi - -sql select a * e from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b * e from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c * e from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select d * e from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a * d from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b * d from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c * d from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a * c from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b * c from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a * b from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b * a from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -print =============== step5 -$i = 1 -$tb = $tbPrefix . $i - -sql select a / f from $mt -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select f / a from $mt -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b / f from $mt -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select f / b from $mt -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c / f from $mt -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select d / f from $mt -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select e / f from $mt -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select f / f from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / e from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / e from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / e from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select d / e from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / d from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / d from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / d from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / c from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / c from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / b from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / a from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -print =============== step6 -$i = 1 -$tb = $tbPrefix . $i - -sql select (a+b+c+d+e) / f from $mt -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / (a+b+c+d+e) from $mt -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select (a+b+c+d+e) * f from $mt -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * (a+b+c+d+e) from $mt -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select (a+b+c+d+e) - f from $mt -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - (a+b+c+d+e) from $mt -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) / f from $mt -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) * f from $mt -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) + f from $mt -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) - f from $mt -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e) * f as zz from $mt -print ===> $data00 -if $data00 != 100.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e))) * f as zz from $mt -x step61 - return -1 -step61: - -sql select (f - (a*b+c)*a + d + e))) * 2f as zz from $mt -x step62 - return -1 -step62: - -sql select (f - (a*b+c)*a + d + e))) ** f as zz from $mt -x step63 - return -1 -step63: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/vector/metrics_tag.sim b/tests/script/windows/vector/metrics_tag.sim deleted file mode 100644 index 80c204fa10e963fa264aa8f64d116cfc5ee1277f..0000000000000000000000000000000000000000 --- a/tests/script/windows/vector/metrics_tag.sim +++ /dev/null @@ -1,618 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_mtg_db -$tbPrefix = m_mtg_tb -$mtPrefix = m_mtg_mt - -$tbNum = 10 -$rowNum = 21 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, a int, b float, c smallint, d double, e tinyint, f bigint, g binary(10), h bool) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 1 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x , $x , $x , $x , $x , 10 , '11' , true ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select a - f from $mt -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select f - a from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 9.000000000 then - return -1 -endi - -sql select b - f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select f - b from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 9.000000000 then - return -1 -endi - -sql select c - f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select d - f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select e - f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select f - f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select g - f from $mt where tgcol = 5 -x step21 - return -1 -step21: - -sql select h - f from $mt where tgcol = 5 -x step22 - return -1 -step22: - -sql select ts - f from $mt where tgcol = 5 -x step23 - return -1 -step23: - -sql select a - e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select d - e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - d from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - d from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - d from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - c from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - c from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - b from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - a from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -print =============== step3 -$i = 1 -$tb = $tbPrefix . $i - -sql select a + f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select f + a from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select b + f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select f + b from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select c + f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select d + f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select e + f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select f + f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 20.000000000 then - return -1 -endi - -sql select a + e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b + e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select c + e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select d + e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select a + d from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b + d from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select c + d from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select a + c from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b + c from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select a + b from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b + a from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -print =============== step4 -$i = 1 -$tb = $tbPrefix . $i - -sql select a * f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select f * a from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b * f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select f * b from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c * f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select d * f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select e * f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select f * f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 100.000000000 then - return -1 -endi - -sql select a * e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b * e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c * e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select d * e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a * d from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b * d from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c * d from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a * c from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b * c from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a * b from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b * a from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -print =============== step5 -$i = 1 -$tb = $tbPrefix . $i - -sql select a / f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select f / a from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b / f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select f / b from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c / f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select d / f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select e / f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select f / f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select d / e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / d from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / d from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / d from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / c from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / c from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / b from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / a from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -print =============== step6 -$i = 1 -$tb = $tbPrefix . $i - -sql select (a+b+c+d+e) / f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / (a+b+c+d+e) from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select (a+b+c+d+e) * f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * (a+b+c+d+e) from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select (a+b+c+d+e) - f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - (a+b+c+d+e) from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) / f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) * f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) + f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) - f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e) * f as zz from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 100.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e))) * f as zz from $mt where tgcol = 5 -x step61 - return -1 -step61: - -sql select (f - (a*b+c)*a + d + e))) * 2f as zz from $mt where tgcol = 5 -x step62 - return -1 -step62: - -sql select (f - (a*b+c)*a + d + e))) ** f as zz from $mt where tgcol = 5 -x step63 - return -1 -step63: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/vector/metrics_time.sim b/tests/script/windows/vector/metrics_time.sim deleted file mode 100644 index c127fe78fc1acf712cc5505a680477c0e52d8514..0000000000000000000000000000000000000000 --- a/tests/script/windows/vector/metrics_time.sim +++ /dev/null @@ -1,618 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_mt_db -$tbPrefix = m_mt_tb -$mtPrefix = m_mt_mt - -$tbNum = 10 -$rowNum = 21 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, a int, b float, c smallint, d double, e tinyint, f bigint, g binary(10), h bool) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 1 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x , $x , $x , $x , $x , 10 , '11' , true ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select a - f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - a from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select b - f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - b from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select c - f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select d - f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select e - f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select g - f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -x step21 - return -1 -step21: - -sql select h - f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -x step22 - return -1 -step22: - -sql select ts - f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -x step23 - return -1 -step23: - -sql select a - e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select d - e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - d from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - d from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - d from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - c from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - c from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - b from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - a from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -print =============== step3 -$i = 1 -$tb where tgcol = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a + f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + a from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select b + f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + b from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select c + f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select d + f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select e + f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 20.000000000 then - return -1 -endi - -sql select a + e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c + e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select d + e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + d from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + d from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c + d from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + c from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + c from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + b from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + a from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -print =============== step4 -$i = 1 -$tb where tgcol = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a * f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * a from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select b * f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * b from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select c * f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select d * f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select e * f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 100.000000000 then - return -1 -endi - -sql select a * e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select c * e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select d * e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * d from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * d from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select c * d from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * c from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * c from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * b from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * a from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -print =============== step5 -$i = 1 -$tb where tgcol = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a / f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / a from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b / f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / b from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select c / f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select d / f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select e / f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select d / e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / d from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / d from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / d from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / c from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / c from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / b from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / a from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -print =============== step6 -$i = 1 -$tb where tgcol = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select (a+b+c+d+e) / f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 2.500000000 then - return -1 -endi - -sql select f / (a+b+c+d+e) from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.400000000 then - return -1 -endi - -sql select (a+b+c+d+e) * f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 250.000000000 then - return -1 -endi - -sql select f * (a+b+c+d+e) from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 250.000000000 then - return -1 -endi - -sql select (a+b+c+d+e) - f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f - (a+b+c+d+e) from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -15.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) / f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -1.500000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) * f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -150.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) + f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) - f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -25.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e) * f as zz from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -1300.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e))) * f as zz from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -x step61 - return -1 -step61: - -sql select (f - (a*b+c)*a + d + e))) * 2f as zz from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -x step62 - return -1 -step62: - -sql select (f - (a*b+c)*a + d + e))) ** f as zz from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -x step63 - return -1 -step63: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/vector/multi.sim b/tests/script/windows/vector/multi.sim deleted file mode 100644 index ff63cda9a5777a3f20102aafb388f9a7b491a972..0000000000000000000000000000000000000000 --- a/tests/script/windows/vector/multi.sim +++ /dev/null @@ -1,215 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_mu_db -$tbPrefix = m_mu_tb -$mtPrefix = m_mu_mt - -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, a int, b float, c smallint, d double, e tinyint, f binary(10), g bool) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 1 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x , $x , $x , $x , 10 , '11' , true ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select a + b from $tb -print ===> $data00 $data10 $data20 $data30 -if $data00 != 2.000000000 then - return -1 -endi - -sql select a + c from $tb where ts < now + 4m -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select a + d from $tb where ts > now + 4m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + e from $tb where ts < now + 4m order by ts desc - -sql select a + a from $tb where ts > now + 4m order by ts desc - -sql select a + c from $tb where ts < now + 4m order by ts asc - -sql select a + f from $tb where ts > now + 4m order by ts asc -x step24 - return -1 -step24: - -print =============== step3 -$i = 1 -$tb = $tbPrefix . $i - -sql select a - e from $tb -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select a - b from $tb where ts < now + 4m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - e from $tb where ts > now + 4m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -print =============== step4 -$i = 1 -$tb = $tbPrefix . $i - -sql select a * b + e from $tb -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select a * b + c from $tb where ts < now + 4m -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select a * b -d from $tb where ts > now + 4m -print ===> $data20 -if $data20 != 42.000000000 then - return -1 -endi - -print =============== step5 -$i = 1 -$tb = $tbPrefix . $i - -sql select a / 2 + e from $tb -print ===> $data00 -if $data00 != 10.500000000 then - return -1 -endi - -sql select a / 2 from $tb where ts < now + 4m -print ===> $data10 -if $data10 != 1.000000000 then - return -1 -endi - -sql select a / 2 * e from $tb where ts > now + 4m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a / e from $tb where ts > now + 4m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -print =============== step6 -$i = 1 -$tb = $tbPrefix . $i -sql select a + ts from $tb -x step61 - return -1 -step61: - -sql select a + f from $tb -x step62 - return -1 -step62: - -sql select a + g from $tb -x step63 - return -1 -step63: - -print =============== step7 -$i = 1 -$tb = $tbPrefix . $i - -sql select a + b from $tb where a = 2 -print ===> $data00 -if $data00 != 4.000000000 then - return -1 -endi - -sql select * from $tb where b < 2 -print ===> $rows -if $rows != 1 then - return -1 -endi - -sql select * from $tb where b > 2 -print ===> $rows -if $rows != 17 then - return -1 -endi - -sql select a + c from $tb where b = 2 and ts < now + 4m -print ===> $data00 -if $data00 != 4.000000000 then - return -1 -endi - -sql select a + d from $tb where c = 10 and ts > now + 4m -print ===> $data00 -if $data00 != 20.000000000 then - return -1 -endi - -sql select a + e from $tb where d = 2 and ts < now + 4m order by ts desc - -sql select a + a from $tb where e = 2 and ts > now + 4m order by ts desc - -sql select a + c from $tb where f = 2 and ts < now + 4m order by ts asc - -sql select a + f from $tb where g = 2 and ts > now + 4m order by ts asc -x step74 - return -1 -step74: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/vector/single.sim b/tests/script/windows/vector/single.sim deleted file mode 100644 index fb3a52760b4efb5133998a9d71d0b7ce2957e69b..0000000000000000000000000000000000000000 --- a/tests/script/windows/vector/single.sim +++ /dev/null @@ -1,302 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_si_db -$tbPrefix = m_si_tb -$mtPrefix = m_si_mt - -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select tbcol + 1 from $tb -print ===> $data00 $data10 $data20 $data30 -if $data00 != 1.000000000 then - return -1 -endi - -sql select tbcol + 1 from $tb where ts < now + 4m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select tbcol + 1 from $tb where ts > now + 4m -print ===> $data00 -if $data00 != 6.000000000 then - return -1 -endi - -sql select tbcol + 1 from $tb where ts < now + 4m order by ts desc - -sql select tbcol + 1 from $tb where ts > now + 4m order by ts desc - -sql select tbcol + 1 from $tb where ts < now + 4m order by ts asc - -sql select tbcol + 1 from $tb where ts > now + 4m order by ts asc - -print =============== step3 -$i = 1 -$tb = $tbPrefix . $i - -sql select tbcol - 1 from $tb -print ===> $data00 -if $data00 != -1.000000000 then - return -1 -endi - -sql select tbcol - 1 from $tb where ts < now + 4m -print ===> $data00 -if $data00 != -1.000000000 then - return -1 -endi - -sql select tbcol - 1 from $tb where ts > now + 4m -print ===> $data00 -if $data00 != 4.000000000 then - return -1 -endi - -print =============== step4 -$i = 1 -$tb = $tbPrefix . $i - -sql select tbcol * 2 from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select tbcol * 2 from $tb where ts < now + 4m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select tbcol * 2 from $tb where ts > now + 4m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -print =============== step5 -$i = 1 -$tb = $tbPrefix . $i - -sql select tbcol / 2 from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select tbcol / 2 from $tb where ts < now + 4m -print ===> $data10 -if $data10 != 0.500000000 then - return -1 -endi - -sql select tbcol / 2 from $tb where ts > now + 4m -print ===> $data00 -if $data00 != 2.500000000 then - return -1 -endi - -sql select tbcol / 0 from $tb where ts > now + 4m -print ===> $data00 -#if $data00 != 0.000000000 then -# return -1 -#endi - -print =============== step6 -$i = 11 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, tbcol bool) -sql insert into $tb values(now, 0) -sql select tbcol + 2 from $tb -x step6 - return -1 -step6: - -print =============== step7 -$i = $i + 1 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, tbcol tinyint) -sql insert into $tb values(now, 0); -sql select tbcol + 2 from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi -sql select tbcol - 2 from $tb -print ===> $data00 -if $data00 != -2.000000000 then - return -1 -endi -sql select tbcol * 2 from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi -sql select tbcol / 2 from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -print =============== step8 -$i = $i + 1 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, tbcol smallint) -sql insert into $tb values(now, 0); -sql select tbcol + 2 from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi -sql select tbcol - 2 from $tb -print ===> $data00 -if $data00 != -2.000000000 then - return -1 -endi -sql select tbcol * 2 from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi -sql select tbcol / 2 from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -print =============== step9 -$i = $i + 1 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, tbcol bigint) -sql insert into $tb values(now, 0); -sql select tbcol + 2 from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi -sql select tbcol - 2 from $tb -print ===> $data00 -if $data00 != -2.000000000 then - return -1 -endi -sql select tbcol * 2 from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi -sql select tbcol / 2 from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -print =============== step10 -$i = $i + 1 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, tbcol float) -sql insert into $tb values(now, 0); -sql select tbcol + 2 from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi -sql select tbcol - 2 from $tb -print ===> $data00 -if $data00 != -2.000000000 then - return -1 -endi -sql select tbcol * 2 from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi -sql select tbcol / 2 from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -print =============== step11 -$i = $i + 1 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, tbcol double) -sql insert into $tb values(now, 0); -sql select tbcol + 2 from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi -sql select tbcol - 2 from $tb -print ===> $data00 -if $data00 != -2.000000000 then - return -1 -endi -sql select tbcol * 2 from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi -sql select tbcol / 2 from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -print =============== step12 -$i = $i + 1 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, tbcol binary(100)) -sql insert into $tb values(now, '0'); -sql select tbcol + 2 from $tb -x step12 - return -1 -step12: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/vector/table_field.sim b/tests/script/windows/vector/table_field.sim deleted file mode 100644 index 10c5148243793adbd01221743cbda673ae7ce651..0000000000000000000000000000000000000000 --- a/tests/script/windows/vector/table_field.sim +++ /dev/null @@ -1,618 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_tf_db -$tbPrefix = m_tf_tb -$mtPrefix = m_tf_mt - -$tbNum = 10 -$rowNum = 21 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, a int, b float, c smallint, d double, e tinyint, f bigint, g binary(10), h bool) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 1 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x , $x , $x , $x , $x , 10 , '11' , true ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select a - f from $tb where a = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - a from $tb where a = 5 -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select b - f from $tb where a = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - b from $tb where a = 5 -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select c - f from $tb where a = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select d - f from $tb where a = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select e - f from $tb where a = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - f from $tb where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select g - f from $tb where a = 5 -x step21 - return -1 -step21: - -sql select h - f from $tb where a = 5 -x step22 - return -1 -step22: - -sql select ts - f from $tb where a = 5 -x step23 - return -1 -step23: - -sql select a - e from $tb where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - e from $tb where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - e from $tb where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select d - e from $tb where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - d from $tb where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - d from $tb where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - d from $tb where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - c from $tb where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - c from $tb where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - b from $tb where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - a from $tb where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -print =============== step3 -$i = 1 -$tb where a = 5 = $tbPrefix . $i - -sql select a + f from $tb where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + a from $tb where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select b + f from $tb where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + b from $tb where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select c + f from $tb where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select d + f from $tb where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select e + f from $tb where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + f from $tb where a = 5 -print ===> $data00 -if $data00 != 20.000000000 then - return -1 -endi - -sql select a + e from $tb where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + e from $tb where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c + e from $tb where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select d + e from $tb where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + d from $tb where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + d from $tb where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c + d from $tb where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + c from $tb where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + c from $tb where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + b from $tb where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + a from $tb where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -print =============== step4 -$i = 1 -$tb where a = 5 = $tbPrefix . $i - -sql select a * f from $tb where a = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * a from $tb where a = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select b * f from $tb where a = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * b from $tb where a = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select c * f from $tb where a = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select d * f from $tb where a = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select e * f from $tb where a = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * f from $tb where a = 5 -print ===> $data00 -if $data00 != 100.000000000 then - return -1 -endi - -sql select a * e from $tb where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * e from $tb where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select c * e from $tb where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select d * e from $tb where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * d from $tb where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * d from $tb where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select c * d from $tb where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * c from $tb where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * c from $tb where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * b from $tb where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * a from $tb where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -print =============== step5 -$i = 1 -$tb where a = 5 = $tbPrefix . $i - -sql select a / f from $tb where a = 5 -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / a from $tb where a = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b / f from $tb where a = 5 -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / b from $tb where a = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select c / f from $tb where a = 5 -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select d / f from $tb where a = 5 -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select e / f from $tb where a = 5 -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / f from $tb where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / e from $tb where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / e from $tb where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / e from $tb where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select d / e from $tb where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / d from $tb where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / d from $tb where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / d from $tb where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / c from $tb where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / c from $tb where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / b from $tb where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / a from $tb where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -print =============== step6 -$i = 1 -$tb where a = 5 = $tbPrefix . $i - -sql select (a+b+c+d+e) / f from $tb where a = 5 -print ===> $data00 -if $data00 != 2.500000000 then - return -1 -endi - -sql select f / (a+b+c+d+e) from $tb where a = 5 -print ===> $data00 -if $data00 != 0.400000000 then - return -1 -endi - -sql select (a+b+c+d+e) * f from $tb where a = 5 -print ===> $data00 -if $data00 != 250.000000000 then - return -1 -endi - -sql select f * (a+b+c+d+e) from $tb where a = 5 -print ===> $data00 -if $data00 != 250.000000000 then - return -1 -endi - -sql select (a+b+c+d+e) - f from $tb where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f - (a+b+c+d+e) from $tb where a = 5 -print ===> $data00 -if $data00 != -15.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) / f from $tb where a = 5 -print ===> $data00 -if $data00 != -1.500000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) * f from $tb where a = 5 -print ===> $data00 -if $data00 != -150.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) + f from $tb where a = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) - f from $tb where a = 5 -print ===> $data00 -if $data00 != -25.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e) * f as zz from $tb where a = 5 -print ===> $data00 -if $data00 != -1300.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e))) * f as zz from $tb where a = 5 -x step61 - return -1 -step61: - -sql select (f - (a*b+c)*a + d + e))) * 2f as zz from $tb where a = 5 -x step62 - return -1 -step62: - -sql select (f - (a*b+c)*a + d + e))) ** f as zz from $tb where a = 5 -x step63 - return -1 -step63: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/vector/table_mix.sim b/tests/script/windows/vector/table_mix.sim deleted file mode 100644 index 7418cb453df7fc627acc9f34598db6ce7db144d9..0000000000000000000000000000000000000000 --- a/tests/script/windows/vector/table_mix.sim +++ /dev/null @@ -1,618 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_tm_db -$tbPrefix = m_tm_tb -$mtPrefix = m_tm_mt - -$tbNum = 10 -$rowNum = 21 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, a int, b float, c smallint, d double, e tinyint, f bigint, g binary(10), h bool) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 1 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x , $x , $x , $x , $x , 10 , '11' , true ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select a - f from $tb where a = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - a from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select b - f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - b from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select c - f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select d - f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select e - f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select g - f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -x step21 - return -1 -step21: - -sql select h - f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -x step22 - return -1 -step22: - -sql select ts - f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -x step23 - return -1 -step23: - -sql select a - e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select d - e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - d from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - d from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - d from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - c from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - c from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - b from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - a from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -print =============== step3 -$i = 1 -$tb where a = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a + f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + a from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select b + f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + b from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select c + f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select d + f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select e + f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 20.000000000 then - return -1 -endi - -sql select a + e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c + e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select d + e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + d from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + d from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c + d from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + c from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + c from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + b from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + a from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -print =============== step4 -$i = 1 -$tb where a = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a * f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * a from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select b * f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * b from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select c * f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select d * f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select e * f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 100.000000000 then - return -1 -endi - -sql select a * e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select c * e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select d * e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * d from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * d from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select c * d from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * c from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * c from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * b from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * a from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -print =============== step5 -$i = 1 -$tb where a = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a / f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / a from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b / f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / b from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select c / f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select d / f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select e / f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select d / e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / d from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / d from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / d from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / c from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / c from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / b from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / a from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -print =============== step6 -$i = 1 -$tb where a = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select (a+b+c+d+e) / f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 2.500000000 then - return -1 -endi - -sql select f / (a+b+c+d+e) from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.400000000 then - return -1 -endi - -sql select (a+b+c+d+e) * f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 250.000000000 then - return -1 -endi - -sql select f * (a+b+c+d+e) from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 250.000000000 then - return -1 -endi - -sql select (a+b+c+d+e) - f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f - (a+b+c+d+e) from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -15.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) / f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -1.500000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) * f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -150.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) + f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) - f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -25.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e) * f as zz from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -1300.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e))) * f as zz from $tb where a = 5 and ts > now + 4m and ts < now + 6m -x step61 - return -1 -step61: - -sql select (f - (a*b+c)*a + d + e))) * 2f as zz from $tb where a = 5 and ts > now + 4m and ts < now + 6m -x step62 - return -1 -step62: - -sql select (f - (a*b+c)*a + d + e))) ** f as zz from $tb where a = 5 and ts > now + 4m and ts < now + 6m -x step63 - return -1 -step63: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/vector/table_query.sim b/tests/script/windows/vector/table_query.sim deleted file mode 100644 index 7654688b269eb16c278c000d9da565515512062a..0000000000000000000000000000000000000000 --- a/tests/script/windows/vector/table_query.sim +++ /dev/null @@ -1,618 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_tq_db -$tbPrefix = m_tq_tb -$mtPrefix = m_tq_mt - -$tbNum = 10 -$rowNum = 21 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, a int, b float, c smallint, d double, e tinyint, f bigint, g binary(10), h bool) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 1 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x , $x , $x , $x , $x , 10 , '11' , true ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select a - f from $tb -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select f - a from $tb -print ===> $data00 -if $data00 != 9.000000000 then - return -1 -endi - -sql select b - f from $tb -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select f - b from $tb -print ===> $data00 -if $data00 != 9.000000000 then - return -1 -endi - -sql select c - f from $tb -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select d - f from $tb -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select e - f from $tb -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select f - f from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select g - f from $tb -x step21 - return -1 -step21: - -sql select h - f from $tb -x step22 - return -1 -step22: - -sql select ts - f from $tb -x step23 - return -1 -step23: - -sql select a - e from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - e from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - e from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select d - e from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - d from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - d from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - d from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - c from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - c from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - b from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - a from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -print =============== step3 -$i = 1 -$tb = $tbPrefix . $i - -sql select a + f from $tb -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select f + a from $tb -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select b + f from $tb -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select f + b from $tb -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select c + f from $tb -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select d + f from $tb -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select e + f from $tb -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select f + f from $tb -print ===> $data00 -if $data00 != 20.000000000 then - return -1 -endi - -sql select a + e from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b + e from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select c + e from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select d + e from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select a + d from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b + d from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select c + d from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select a + c from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b + c from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select a + b from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b + a from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -print =============== step4 -$i = 1 -$tb = $tbPrefix . $i - -sql select a * f from $tb -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select f * a from $tb -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b * f from $tb -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select f * b from $tb -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c * f from $tb -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select d * f from $tb -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select e * f from $tb -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select f * f from $tb -print ===> $data00 -if $data00 != 100.000000000 then - return -1 -endi - -sql select a * e from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b * e from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c * e from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select d * e from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a * d from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b * d from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c * d from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a * c from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b * c from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a * b from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b * a from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -print =============== step5 -$i = 1 -$tb = $tbPrefix . $i - -sql select a / f from $tb -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select f / a from $tb -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b / f from $tb -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select f / b from $tb -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c / f from $tb -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select d / f from $tb -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select e / f from $tb -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select f / f from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / e from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / e from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / e from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select d / e from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / d from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / d from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / d from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / c from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / c from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / b from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / a from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -print =============== step6 -$i = 1 -$tb = $tbPrefix . $i - -sql select (a+b+c+d+e) / f from $tb -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / (a+b+c+d+e) from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select (a+b+c+d+e) * f from $tb -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * (a+b+c+d+e) from $tb -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select (a+b+c+d+e) - f from $tb -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - (a+b+c+d+e) from $tb -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) / f from $tb -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) * f from $tb -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) + f from $tb -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) - f from $tb -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e) * f as zz from $tb -print ===> $data00 -if $data00 != 100.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e))) * f as zz from $tb -x step61 - return -1 -step61: - -sql select (f - (a*b+c)*a + d + e))) * 2f as zz from $tb -x step62 - return -1 -step62: - -sql select (f - (a*b+c)*a + d + e))) ** f as zz from $tb -x step63 - return -1 -step63: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/vector/table_time.sim b/tests/script/windows/vector/table_time.sim deleted file mode 100644 index bea9d41d1bcdfa77acd5eaf52a2de22353b075d9..0000000000000000000000000000000000000000 --- a/tests/script/windows/vector/table_time.sim +++ /dev/null @@ -1,618 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_tt_db -$tbPrefix = m_tt_tb -$mtPrefix = m_tt_mt - -$tbNum = 10 -$rowNum = 21 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, a int, b float, c smallint, d double, e tinyint, f bigint, g binary(10), h bool) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 1 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x , $x , $x , $x , $x , 10 , '11' , true ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select a - f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - a from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select b - f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - b from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select c - f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select d - f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select e - f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select g - f from $tb where ts > now + 4m and ts < now + 6m -x step21 - return -1 -step21: - -sql select h - f from $tb where ts > now + 4m and ts < now + 6m -x step22 - return -1 -step22: - -sql select ts - f from $tb where ts > now + 4m and ts < now + 6m -x step23 - return -1 -step23: - -sql select a - e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select d - e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - d from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - d from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - d from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - c from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - c from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - b from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - a from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -print =============== step3 -$i = 1 -$tb where ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a + f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + a from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select b + f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + b from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select c + f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select d + f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select e + f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 20.000000000 then - return -1 -endi - -sql select a + e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c + e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select d + e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + d from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + d from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c + d from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + c from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + c from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + b from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + a from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -print =============== step4 -$i = 1 -$tb where ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a * f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * a from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select b * f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * b from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select c * f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select d * f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select e * f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 100.000000000 then - return -1 -endi - -sql select a * e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select c * e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select d * e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * d from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * d from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select c * d from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * c from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * c from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * b from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * a from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -print =============== step5 -$i = 1 -$tb where ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a / f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / a from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b / f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / b from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select c / f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select d / f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select e / f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select d / e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / d from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / d from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / d from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / c from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / c from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / b from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / a from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -print =============== step6 -$i = 1 -$tb where ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select (a+b+c+d+e) / f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 2.500000000 then - return -1 -endi - -sql select f / (a+b+c+d+e) from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.400000000 then - return -1 -endi - -sql select (a+b+c+d+e) * f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 250.000000000 then - return -1 -endi - -sql select f * (a+b+c+d+e) from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 250.000000000 then - return -1 -endi - -sql select (a+b+c+d+e) - f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f - (a+b+c+d+e) from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -15.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) / f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -1.500000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) * f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -150.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) + f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) - f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -25.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e) * f as zz from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -1300.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e))) * f as zz from $tb where ts > now + 4m and ts < now + 6m -x step61 - return -1 -step61: - -sql select (f - (a*b+c)*a + d + e))) * 2f as zz from $tb where ts > now + 4m and ts < now + 6m -x step62 - return -1 -step62: - -sql select (f - (a*b+c)*a + d + e))) ** f as zz from $tb where ts > now + 4m and ts < now + 6m -x step63 - return -1 -step63: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/system-test/0-others/taosShell.py b/tests/system-test/0-others/taosShell.py index e03b34adcabfbb2319b6d1f2d1b73b1bff021dba..f55813ac834edc4f26255ae02ff1ff5c7505bd5a 100644 --- a/tests/system-test/0-others/taosShell.py +++ b/tests/system-test/0-others/taosShell.py @@ -44,13 +44,13 @@ def taos_command (buildPath, key, value, expectString, cfgDir, sqlString='', key tdLog.info ("taos cmd: %s" % taosCmd) - child = taosExpect.spawn(taosCmd, timeout=10) + child = taosExpect.spawn(taosCmd, timeout=20) #output = child.readline() #print (output.decode()) if len(expectString) != 0: - i = child.expect([expectString, taosExpect.TIMEOUT, taosExpect.EOF], timeout=10) + i = child.expect([expectString, taosExpect.TIMEOUT, taosExpect.EOF], timeout=20) else: - i = child.expect([taosExpect.TIMEOUT, taosExpect.EOF], timeout=10) + i = child.expect([taosExpect.TIMEOUT, taosExpect.EOF], timeout=20) if platform.system().lower() == 'windows': retResult = child.before @@ -62,7 +62,7 @@ def taos_command (buildPath, key, value, expectString, cfgDir, sqlString='', key print ('taos login success! Here can run sql, taos> ') if len(sqlString) != 0: child.sendline (sqlString) - w = child.expect(["Query OK", taosExpect.TIMEOUT, taosExpect.EOF], timeout=1) + w = child.expect(["Query OK", taosExpect.TIMEOUT, taosExpect.EOF], timeout=10) if w == 0: return "TAOS_OK" else: diff --git a/tests/system-test/0-others/udfTest.py b/tests/system-test/0-others/udfTest.py index 9b145e9093a3fd979bc0057d386ee1b2c3efaeb5..375b7a6272958e7f90b70c785cc9667abad9003d 100644 --- a/tests/system-test/0-others/udfTest.py +++ b/tests/system-test/0-others/udfTest.py @@ -301,13 +301,13 @@ class TDTestCase: tdSql.checkRows(1) tdSql.query("select ceil(num1) , min(num1) from tb;") tdSql.checkRows(1) - tdSql.error("select udf1(num1) , first(num1) from tb;") + tdSql.query("select udf1(num1) , first(num1) from tb;") - tdSql.error("select abs(num1) , first(num1) from tb;") + tdSql.query("select abs(num1) , first(num1) from tb;") - tdSql.error("select udf1(num1) , last(num1) from tb;") + tdSql.query("select udf1(num1) , last(num1) from tb;") - tdSql.error("select round(num1) , last(num1) from tb;") + tdSql.query("select round(num1) , last(num1) from tb;") tdSql.query("select udf1(num1) , top(num1,1) from tb;") tdSql.checkRows(1) @@ -327,9 +327,9 @@ class TDTestCase: tdSql.checkRows(1) tdSql.query("select floor(c1) , min(c1) from stb1;") tdSql.checkRows(1) - tdSql.error("select udf1(c1) , first(c1) from stb1;") + tdSql.query("select udf1(c1) , first(c1) from stb1;") - tdSql.error("select udf1(c1) , last(c1) from stb1;") + tdSql.query("select udf1(c1) , last(c1) from stb1;") tdSql.query("select udf1(c1) , top(c1 ,1) from stb1;") tdSql.checkRows(1) diff --git a/tests/system-test/0-others/udf_create.py b/tests/system-test/0-others/udf_create.py index 11ad8e1584890067d10d0ef62be14df61c8a32c2..5f3ab2e863a159bb4c8d95cc0d8f683061773e5f 100644 --- a/tests/system-test/0-others/udf_create.py +++ b/tests/system-test/0-others/udf_create.py @@ -303,13 +303,13 @@ class TDTestCase: tdSql.checkRows(1) tdSql.query("select ceil(num1) , min(num1) from tb;") tdSql.checkRows(1) - tdSql.error("select udf1(num1) , first(num1) from tb;") + tdSql.query("select udf1(num1) , first(num1) from tb;") - tdSql.error("select abs(num1) , first(num1) from tb;") + tdSql.query("select abs(num1) , first(num1) from tb;") - tdSql.error("select udf1(num1) , last(num1) from tb;") + tdSql.query("select udf1(num1) , last(num1) from tb;") - tdSql.error("select round(num1) , last(num1) from tb;") + tdSql.query("select round(num1) , last(num1) from tb;") tdSql.query("select udf1(num1) , top(num1,1) from tb;") tdSql.checkRows(1) @@ -329,9 +329,9 @@ class TDTestCase: tdSql.checkRows(1) tdSql.query("select floor(c1) , min(c1) from stb1;") tdSql.checkRows(1) - tdSql.error("select udf1(c1) , first(c1) from stb1;") + tdSql.query("select udf1(c1) , first(c1) from stb1;") - tdSql.error("select udf1(c1) , last(c1) from stb1;") + tdSql.query("select udf1(c1) , last(c1) from stb1;") tdSql.query("select udf1(c1) , top(c1 ,1) from stb1;") tdSql.checkRows(1) diff --git a/tests/system-test/0-others/udf_restart_taosd.py b/tests/system-test/0-others/udf_restart_taosd.py index c9eb22cf1508d6f36d9e67a5934ea18c78b1c09c..857921e32cf7d934243cc12a67d4cc4a9f767492 100644 --- a/tests/system-test/0-others/udf_restart_taosd.py +++ b/tests/system-test/0-others/udf_restart_taosd.py @@ -300,13 +300,13 @@ class TDTestCase: tdSql.checkRows(1) tdSql.query("select ceil(num1) , min(num1) from tb;") tdSql.checkRows(1) - tdSql.error("select udf1(num1) , first(num1) from tb;") + tdSql.query("select udf1(num1) , first(num1) from tb;") - tdSql.error("select abs(num1) , first(num1) from tb;") + tdSql.query("select abs(num1) , first(num1) from tb;") - tdSql.error("select udf1(num1) , last(num1) from tb;") + tdSql.query("select udf1(num1) , last(num1) from tb;") - tdSql.error("select round(num1) , last(num1) from tb;") + tdSql.query("select round(num1) , last(num1) from tb;") tdSql.query("select udf1(num1) , top(num1,1) from tb;") tdSql.checkRows(1) @@ -326,9 +326,9 @@ class TDTestCase: tdSql.checkRows(1) tdSql.query("select floor(c1) , min(c1) from stb1;") tdSql.checkRows(1) - tdSql.error("select udf1(c1) , first(c1) from stb1;") + tdSql.query("select udf1(c1) , first(c1) from stb1;") - tdSql.error("select udf1(c1) , last(c1) from stb1;") + tdSql.query("select udf1(c1) , last(c1) from stb1;") tdSql.query("select udf1(c1) , top(c1 ,1) from stb1;") tdSql.checkRows(1) diff --git a/tests/system-test/1-insert/insertWithMoreVgroup.py b/tests/system-test/1-insert/insertWithMoreVgroup.py index 29c293c6084c9edb7107e4289e194b320cd43207..e3a20cebf88f08652a9a1524754e1e3513382636 100644 --- a/tests/system-test/1-insert/insertWithMoreVgroup.py +++ b/tests/system-test/1-insert/insertWithMoreVgroup.py @@ -401,14 +401,10 @@ class TDTestCase: tdLog.debug(" LIMIT test_case3 ............ [OK]") - # test qnode - self.test_case4() - tdLog.debug(" LIMIT test_case3 ............ [OK]") - return # # add case with filename # tdCases.addWindows(__file__, TDTestCase()) -tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/system-test/2-query/json_tag.py b/tests/system-test/2-query/json_tag.py index 9b96b6ebd00864a802971220ce2ecec969b2ab19..53dfc574584ab9113d5ab2e05e7897f8dc3fa009 100644 --- a/tests/system-test/2-query/json_tag.py +++ b/tests/system-test/2-query/json_tag.py @@ -199,7 +199,7 @@ class TDTestCase: tdSql.checkData(0, 0, "true") # test select json tag->'key', value is null tdSql.query("select jtag->'tag1' from jsons1_4") - tdSql.checkData(0, 0, "null") + tdSql.checkData(0, 0, None) # test select json tag->'key', value is double tdSql.query("select jtag->'tag1' from jsons1_5") tdSql.checkData(0, 0, "1.232000000") @@ -562,7 +562,7 @@ class TDTestCase: tdSql.checkRows(3) tdSql.query("select round(dataint) from jsons1 where jtag->'tag1'>1") tdSql.checkRows(3) - + #math function tdSql.query("select sin(dataint) from jsons1 where jtag->'tag1'>1;") tdSql.checkRows(3) @@ -606,7 +606,7 @@ class TDTestCase: tdSql.checkRows(1) tdSql.query("select twa(dataint) from jsons1 where jtag->'tag1'>1;") tdSql.checkRows(1) - + # function not ready # tdSql.query("select tail(dataint,1) from jsons1 where jtag->'tag1'>1;") # tdSql.checkRows(3) @@ -616,7 +616,7 @@ class TDTestCase: # tdSql.checkRows(3) # tdSql.query("select irate(dataint) from jsons1 where jtag->'tag1'>1;") # tdSql.checkRows(1) - + #str function tdSql.query("select upper(dataStr) from jsons1 where jtag->'tag1'>1;") tdSql.checkRows(3) @@ -658,7 +658,7 @@ class TDTestCase: tdSql.checkRows(3) tdSql.query("select ELAPSED(ts,1h) from jsons1 where jtag->'tag1'>1;") tdSql.checkRows(1) - + # # #test TD-12077 tdSql.execute("insert into jsons1_16 using jsons1 tags('{\"tag1\":\"收到货\",\"tag2\":\"\",\"tag3\":-2.111}') values(1591062628000, 2, NULL, '你就会', 'dws')") diff --git a/tests/system-test/2-query/queryQnode.py b/tests/system-test/2-query/queryQnode.py new file mode 100644 index 0000000000000000000000000000000000000000..15b643f5d7e73754710d7aca2de6cafef054cefd --- /dev/null +++ b/tests/system-test/2-query/queryQnode.py @@ -0,0 +1,342 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import os +import threading as thd +import multiprocessing as mp +from numpy.lib.function_base import insert +import taos +from util.log import * +from util.cases import * +from util.sql import * +import numpy as np +import datetime as dt +import time +# constant define +WAITS = 5 # wait seconds + +class TDTestCase: + # + # --------------- main frame ------------------- + # + clientCfgDict = {'queryproxy': '1','debugFlag': 135} + clientCfgDict["queryproxy"] = '2' + clientCfgDict["debugFlag"] = 143 + + updatecfgDict = {'clientCfg': {}} + updatecfgDict = {'debugFlag': 143} + updatecfgDict["clientCfg"] = clientCfgDict + def caseDescription(self): + ''' + limit and offset keyword function test cases; + case1: limit offset base function test + case2: offset return valid + ''' + return + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files or "taosd.exe" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root)-len("/build/bin")] + break + return buildPath + + # init + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + # tdSql.prepare() + # self.create_tables(); + self.ts = 1500000000000 + + # stop + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + + # --------------- case ------------------- + + def newcur(self,host,cfg): + user = "root" + password = "taosdata" + port =6030 + con=taos.connect(host=host, user=user, password=password, config=cfg ,port=port) + cur=con.cursor() + print(cur) + return cur + + # create tables + def create_tables(self,host,dbname,stbname,count): + buildPath = self.getBuildPath() + config = buildPath+ "../sim/dnode1/cfg/" + + tsql=self.newcur(host,config) + tsql.execute("use %s" %dbname) + + pre_create = "create table" + sql = pre_create + count=int(count) + + tdLog.debug("doing create one stable %s and %d child table in %s ..." %(stbname, count ,dbname)) + # print(time.time()) + exeStartTime=time.time() + # print(type(tcountStop),type(tcountStart)) + for i in range(0,count): + sql += " %s_%d using %s tags(%d)"%(stbname,i,stbname,i+1) + if i >0 and i%20000 == 0: + # print(sql) + tsql.execute(sql) + sql = pre_create + # print(time.time()) + # end sql + if sql != pre_create: + # print(sql) + tsql.execute(sql) + exeEndTime=time.time() + spendTime=exeEndTime-exeStartTime + speedCreate=count/spendTime + # tdLog.debug("spent %.2fs to create 1 stable and %d table, create speed is %.2f table/s... [OK]"% (spendTime,count,speedCreate)) + return + + def mutiThread_create_tables(self,host,dbname,stbname,vgroups,threadNumbers,childcount): + buildPath = self.getBuildPath() + config = buildPath+ "../sim/dnode1/cfg/" + + tsql=self.newcur(host,config) + tdLog.debug("create database %s"%dbname) + tsql.execute("drop database if exists %s"%dbname) + tsql.execute("create database %s vgroups %d"%(dbname,vgroups)) + tsql.execute("use %s" %dbname) + count=int(childcount) + threads = [] + for i in range(threadNumbers): + tsql.execute("create stable %s%d(ts timestamp, c1 int, c2 binary(10)) tags(t1 int)"%(stbname,i)) + threads.append(thd.Thread(target=self.create_tables, args=(host, dbname, stbname+"%d"%i, count,))) + start_time = time.time() + for tr in threads: + tr.start() + for tr in threads: + tr.join() + end_time = time.time() + spendTime=end_time-start_time + speedCreate=threadNumbers*count/spendTime + tdLog.debug("spent %.2fs to create %d stable and %d table, create speed is %.2f table/s... [OK]"% (spendTime,threadNumbers,threadNumbers*count,speedCreate)) + + return + + # def create_tables(self,host,dbname,stbname,vgroups,tcountStart,tcountStop): + + + # insert data + def insert_data(self, host, dbname, stbname, chilCount, ts_start, rowCount): + buildPath = self.getBuildPath() + config = buildPath+ "../sim/dnode1/cfg/" + tsql=self.newcur(host,config) + tdLog.debug("ready to inser data") + tsql.execute("use %s" %dbname) + pre_insert = "insert into " + sql = pre_insert + chilCount=int(chilCount) + allRows=chilCount*rowCount + tdLog.debug("doing insert data into stable-index:%s rows:%d ..."%(stbname, allRows)) + exeStartTime=time.time() + for i in range(0,chilCount): + sql += " %s_%d values "%(stbname,i) + for j in range(rowCount): + sql += "(%d, %d, 'taos_%d') "%(ts_start + j*1000, j, j) + if j >0 and j%4000 == 0: + # print(sql) + tsql.execute(sql) + sql = "insert into %s_%d values " %(stbname,i) + # end sql + if sql != pre_insert: + # print(sql) + print(len(sql)) + tsql.execute(sql) + exeEndTime=time.time() + spendTime=exeEndTime-exeStartTime + speedInsert=allRows/spendTime + tdLog.debug("spent %.2fs to INSERT %d rows into %s , insert rate is %.2f rows/s... [OK]"% (spendTime,allRows,stbname,speedInsert)) + # tdLog.debug("INSERT TABLE DATA ............ [OK]") + return + + def mutiThread_insert_data(self, host, dbname, stbname, threadNumbers, chilCount, ts_start, childrowcount): + buildPath = self.getBuildPath() + config = buildPath+ "../sim/dnode1/cfg/" + + tsql=self.newcur(host,config) + tdLog.debug("ready to inser data") + + tsql.execute("use %s" %dbname) + chilCount=int(chilCount) + threads = [] + for i in range(threadNumbers): + # tsql.execute("create stable %s%d(ts timestamp, c1 int, c2 binary(10)) tags(t1 int)"%(stbname,i)) + threads.append(thd.Thread(target=self.insert_data, args=(host, dbname, stbname+"%d"%i, chilCount, ts_start, childrowcount,))) + start_time = time.time() + for tr in threads: + tr.start() + for tr in threads: + tr.join() + end_time = time.time() + spendTime=end_time-start_time + tableCounts=threadNumbers*chilCount + stableRows=chilCount*childrowcount + allRows=stableRows*threadNumbers + speedInsert=allRows/spendTime + + for i in range(threadNumbers): + tdSql.execute("use %s" %dbname) + tdSql.query("select count(*) from %s%d"%(stbname,i)) + tdSql.checkData(0,0,stableRows) + tdLog.debug("spent %.2fs to insert %d rows into %d stable and %d table, speed is %.2f table/s... [OK]"% (spendTime,allRows,threadNumbers,tableCounts,speedInsert)) + tdLog.debug("INSERT TABLE DATA ............ [OK]") + + return + + + def taosBench(self,jsonFile): + buildPath = self.getBuildPath() + if (buildPath == ""): + tdLog.exit("taosd not found!") + else: + tdLog.info("taosd found in %s" % buildPath) + taosBenchbin = buildPath+ "/build/bin/taosBenchmark" + os.system("%s -f %s -y " %(taosBenchbin,jsonFile)) + + return + def taosBenchCreate(self,host,dropdb,dbname,stbname,vgroups,processNumbers,count): + + # count=50000 + buildPath = self.getBuildPath() + config = buildPath+ "../sim/dnode1/cfg/" + tsql=self.newcur(host,config) + + # insert: create one or mutiple tables per sql and insert multiple rows per sql + tsql.execute("drop database if exists %s"%dbname) + + tsql.execute("create database %s vgroups %d"%(dbname,vgroups)) + print("db has been created") + # tsql.getResult("show databases") + # print(tdSql.queryResult) + tsql.execute("use %s" %dbname) + + threads = [] + for i in range(processNumbers): + jsonfile="1-insert/Vgroups%d%d.json"%(vgroups,i) + os.system("cp -f 1-insert/manyVgroups.json %s"%(jsonfile)) + os.system("sed -i 's/\"name\": \"db\",/\"name\": \"%s\",/g' %s"%(dbname,jsonfile)) + os.system("sed -i 's/\"drop\": \"no\",/\"drop\": \"%s\",/g' %s"%(dropdb,jsonfile)) + os.system("sed -i 's/\"host\": \"127.0.0.1\",/\"host\": \"%s\",/g' %s"%(host,jsonfile)) + os.system("sed -i 's/\"childtable_count\": 10000,/\"childtable_count\": %d,/g' %s "%(count,jsonfile)) + os.system("sed -i 's/\"name\": \"stb1\",/\"name\": \"%s%d\",/g' %s "%(stbname,i,jsonfile)) + os.system("sed -i 's/\"childtable_prefix\": \"stb1_\",/\"childtable_prefix\": \"%s%d_\",/g' %s "%(stbname,i,jsonfile)) + threads.append(mp.Process(target=self.taosBench, args=("%s"%jsonfile,))) + start_time = time.time() + for tr in threads: + tr.start() + for tr in threads: + tr.join() + end_time = time.time() + + spendTime=end_time-start_time + speedCreate=count/spendTime + tdLog.debug("spent %.2fs to create 1 stable and %d table, create speed is %.2f table/s... [OK]"% (spendTime,count,speedCreate)) + return + + def checkData(self,dbname,stbname,stableCount,CtableCount,rowsPerSTable,): + tdSql.execute("use %s"%dbname) + tdSql.query("show stables") + tdSql.checkRows(stableCount) + tdSql.query("show tables") + tdSql.checkRows(CtableCount) + for i in range(stableCount): + tdSql.query("select count(*) from %s%d"%(stbname,i)) + tdSql.checkData(0,0,rowsPerSTable) + return + + # test case1 base + def test_case1(self): + #stableCount=threadNumbersCtb + parameterDict = {'vgroups': 1, \ + 'threadNumbersCtb': 5, \ + 'threadNumbersIda': 5, \ + 'stableCount': 5, \ + 'tablesPerStb': 50, \ + 'rowsPerTable': 10, \ + 'dbname': 'db', \ + 'stbname': 'stb', \ + 'host': 'localhost', \ + 'startTs': 1640966400000} # 2022-01-01 00:00:00.000 + + tdLog.debug("-----create database and muti-thread create tables test------- ") + + def test_case4(self): + self.taosBenchCreate("127.0.0.1","no","db1", "stb1", 1, 2, 1*10) + tdSql.execute("use db1;") + tdSql.query("show dnodes;") + dnodeId=tdSql.getData(0,0) + print(dnodeId) + tdSql.execute("create qnode on dnode %s"%dnodeId) + tdSql.query("select max(c1) from stb10;") + maxQnode=tdSql.getData(0,0) + tdSql.query("select min(c1) from stb11;") + minQnode=tdSql.getData(0,0) + tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;") + unionQnode=tdSql.queryResult + tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;") + unionallQnode=tdSql.queryResult + + # tdSql.query("show qnodes;") + # qnodeId=tdSql.getData(0,0) + tdSql.execute("drop qnode on dnode %s"%dnodeId) + tdSql.execute("reset query cache") + tdSql.query("select max(c1) from stb10;") + tdSql.checkData(0, 0, "%s"%maxQnode) + tdSql.query("select min(c1) from stb11;") + tdSql.checkData(0, 0, "%s"%minQnode) + tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;") + unionVnode=tdSql.queryResult + assert unionQnode == unionVnode + tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;") + unionallVnode=tdSql.queryResult + assert unionallQnode == unionallVnode + + + # tdSql.execute("create qnode on dnode %s"%dnodeId) + + # run case + def run(self): + + # test qnode + self.test_case4() + tdLog.debug(" LIMIT test_case3 ............ [OK]") + + + return +# +# add case with filename +# +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/system-test/2-query/unique.py b/tests/system-test/2-query/unique.py index f910ff14393395ec658522c1c0dad2a56ad7946a..aeebf2425aeb75cbe5cf3d05a46c71cbe530b6d8 100644 --- a/tests/system-test/2-query/unique.py +++ b/tests/system-test/2-query/unique.py @@ -266,7 +266,7 @@ class TDTestCase: tdSql.query("select unique(c1) from ct4") tdSql.checkRows(10) - tdSql.error("select unique(c1),tbname from ct1") + #tdSql.error("select unique(c1),tbname from ct1") #support #tdSql.error("select unique(c1),t1 from ct1") #support # unique with common col diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py new file mode 100644 index 0000000000000000000000000000000000000000..96fad487d1955495f60c980949af4e83309a6642 --- /dev/null +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py @@ -0,0 +1,200 @@ +from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE +import taos +import sys +import time +import os + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import TDDnodes +from util.dnodes import TDDnode +from util.cluster import * +sys.path.append("./6-cluster") +from clusterCommonCreate import * +from clusterCommonCheck import clusterComCheck + +import time +import socket +import subprocess +from multiprocessing import Process +import threading +import time +import inspect +import ctypes + +class TDTestCase: + + def init(self,conn ,logSql): + tdLog.debug(f"start to excute {__file__}") + self.TDDnodes = None + tdSql.init(conn.cursor()) + self.host = socket.gethostname() + + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root) - len("/build/bin")] + break + return buildPath + + def _async_raise(self, tid, exctype): + """raises the exception, performs cleanup if needed""" + if not inspect.isclass(exctype): + exctype = type(exctype) + res = ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, ctypes.py_object(exctype)) + if res == 0: + raise ValueError("invalid thread id") + elif res != 1: + # """if it returns a number greater than one, you're in trouble, + # and you should call it again with exc=NULL to revert the effect""" + ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, None) + raise SystemError("PyThreadState_SetAsyncExc failed") + + def stopThread(self,thread): + self._async_raise(thread.ident, SystemExit) + + + def insertData(self,countstart,countstop): + # fisrt add data : db\stable\childtable\general table + + for couti in range(countstart,countstop): + tdLog.debug("drop database if exists db%d" %couti) + tdSql.execute("drop database if exists db%d" %couti) + print("create database if not exists db%d replica 1 duration 300" %couti) + tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) + tdSql.execute("use db%d" %couti) + tdSql.execute( + '''create table stb1 + (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) + tags (t1 int) + ''' + ) + tdSql.execute( + ''' + create table t1 + (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) + ''' + ) + for i in range(4): + tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') + + + def fiveDnodeThreeMnode(self,dnodeNumbers,mnodeNums,restartNumbers,stopRole): + tdLog.printNoPrefix("======== test case 1: ") + paraDict = {'dbName': 'db', + 'dbNumbers': 20, + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'replica': 1, + 'stbName': 'stb', + 'stbNumbers': 100, + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbNum': 1, + } + + dnodeNumbers=int(dnodeNumbers) + mnodeNums=int(mnodeNums) + vnodeNumbers = int(dnodeNumbers-mnodeNums) + allDbNumbers=(paraDict['dbNumbers']*restartNumbers) + allStbNumbers=(paraDict['stbNumbers']*restartNumbers) + + tdLog.info("first check dnode and mnode") + tdSql.query("show dnodes;") + tdSql.checkData(0,1,'%s:6030'%self.host) + tdSql.checkData(4,1,'%s:6430'%self.host) + clusterComCheck.checkDnodes(dnodeNumbers) + clusterComCheck.checkMnodeStatus(1) + + # fisr add three mnodes; + tdLog.info("fisr add three mnodes and check mnode status") + tdSql.execute("create mnode on dnode 2") + clusterComCheck.checkMnodeStatus(2) + tdSql.execute("create mnode on dnode 3") + clusterComCheck.checkMnodeStatus(3) + + # add some error operations and + tdLog.info("Confirm the status of the dnode again") + tdSql.error("create mnode on dnode 2") + tdSql.query("show dnodes;") + print(tdSql.queryResult) + clusterComCheck.checkDnodes(dnodeNumbers) + + # create database and stable + + + tdDnodes=cluster.dnodes + stopcount =0 + threads=[] + for i in range(restartNumbers): + dbNameIndex = '%s%d'%(paraDict["dbName"],i) + threads.append(threading.Thread(target=clusterComCreate.create_databases, args=(tdSql, dbNameIndex,paraDict["dbNumbers"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica']))) + + for tr in threads: + tr.start() + + tdLog.info("Take turns stopping Mnodes ") + # while stopcount < restartNumbers: + # tdLog.info(" restart loop: %d"%stopcount ) + # if stopRole == "mnode": + # for i in range(mnodeNums): + # tdDnodes[i].stoptaosd() + # # sleep(10) + # tdDnodes[i].starttaosd() + # # sleep(10) + # elif stopRole == "vnode": + # for i in range(vnodeNumbers): + # tdDnodes[i+mnodeNums].stoptaosd() + # # sleep(10) + # tdDnodes[i+mnodeNums].starttaosd() + # # sleep(10) + # elif stopRole == "dnode": + # for i in range(dnodeNumbers): + # tdDnodes[i].stoptaosd() + # # sleep(10) + # tdDnodes[i].starttaosd() + # # sleep(10) + + # # dnodeNumbers don't include database of schema + # if clusterComCheck.checkDnodes(dnodeNumbers): + # tdLog.info("check dnodes status is ready") + # else: + # tdLog.info("check dnodes status is not ready") + # self.stopThread(threads) + # tdLog.exit("one or more of dnodes failed to start ") + # # self.check3mnode() + # stopcount+=1 + + for tr in threads: + tr.join() + clusterComCheck.checkDnodes(dnodeNumbers) + clusterComCheck.checkDbRows(allDbNumbers) + for i in range(restartNumbers): + clusterComCheck.checkDb(paraDict['dbNumbers'],restartNumbers,dbNameIndex = '%s%d'%(paraDict["dbName"],i)) + + + def run(self): + # print(self.master_dnode.cfgDict) + self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=2,stopRole='dnode') + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopCreateDb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py similarity index 67% rename from tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopCreateDb.py rename to tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py index 59fe1c0b169a99858b0b893df6f2bfdfecae025d..4ab9aa64e1c5bac220186c6d07ab0e82be88b205 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopCreateDb.py +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py @@ -90,35 +90,34 @@ class TDTestCase: tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') - def fiveDnodeThreeMnode(self,dnodenumbers,mnodeNums,restartNumber): + def fiveDnodeThreeMnode(self,dnodeNumbers,mnodeNums,restartNumbers,stopRole): tdLog.printNoPrefix("======== test case 1: ") - paraDict = {'dbName': 'db', + paraDict = {'dbName': 'db0_0', 'dropFlag': 1, 'event': '', 'vgroups': 4, 'replica': 1, 'stbName': 'stb', + 'stbNumbers': 100, 'colPrefix': 'c', 'tagPrefix': 't', 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], 'ctbPrefix': 'ctb', 'ctbNum': 1, - 'rowsPerTbl': 10000, - 'batchNum': 10, - 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 - 'pollDelay': 10, - 'showMsg': 1, - 'showRow': 1} - dnodenumbers=int(dnodenumbers) + } + + dnodeNumbers=int(dnodeNumbers) mnodeNums=int(mnodeNums) - dbNumbers = int(dnodenumbers * restartNumber) - + vnodeNumbers = int(dnodeNumbers-mnodeNums) + allStbNumbers=(paraDict['stbNumbers']*restartNumbers) + dbNumbers = 1 + tdLog.info("first check dnode and mnode") tdSql.query("show dnodes;") tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(4,1,'%s:6430'%self.host) - clusterComCheck.checkDnodes(dnodenumbers) + clusterComCheck.checkDnodes(dnodeNumbers) clusterComCheck.checkMnodeStatus(1) # fisr add three mnodes; @@ -133,45 +132,67 @@ class TDTestCase: tdSql.error("create mnode on dnode 2") tdSql.query("show dnodes;") print(tdSql.queryResult) - clusterComCheck.checkDnodes(dnodenumbers) + clusterComCheck.checkDnodes(dnodeNumbers) - tdLog.info("Take turns stopping all dnodes ") - # seperate vnode and mnode in different dnodes. # create database and stable + clusterComCreate.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica']) + tdLog.info("Take turns stopping Mnodes ") + tdDnodes=cluster.dnodes - stopcount =0 - while stopcount < restartNumber: - for i in range(dnodenumbers): - # threads=[] - # threads = MyThreadFunc(self.insert_data(i*2,i*2+2)) - paraDict["dbName"]= 'db%d%d'%(stopcount,i) - threads=threading.Thread(target=clusterComCreate.create_database, args=(tdSql, paraDict["dbName"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica'])) - threads.start() - tdDnodes[i].stoptaosd() - # sleep(10) - tdDnodes[i].starttaosd() - # sleep(10) - - if clusterComCheck.checkDnodes(dnodenumbers): - # threads.join() - tdLog.info("first restart loop") + stopcount =0 + threads=[] + for i in range(restartNumbers): + stableName= '%s%d'%(paraDict['stbName'],i) + threads.append(threading.Thread(target=clusterComCreate.create_stables, args=(tdSql, paraDict["dbName"],stableName,paraDict['stbNumbers']))) + + for tr in threads: + tr.start() + while stopcount < restartNumbers: + tdLog.info(" restart loop: %d"%stopcount ) + if stopRole == "mnode": + for i in range(mnodeNums): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + elif stopRole == "vnode": + for i in range(vnodeNumbers): + tdDnodes[i+mnodeNums].stoptaosd() + # sleep(10) + tdDnodes[i+mnodeNums].starttaosd() + # sleep(10) + elif stopRole == "dnode": + for i in range(dnodeNumbers): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + + # dnodeNumbers don't include database of schema + if clusterComCheck.checkDnodes(dnodeNumbers): + tdLog.info("123") else: print("456") - threads.join() + self.stopThread(threads) tdLog.exit("one or more of dnodes failed to start ") # self.check3mnode() stopcount+=1 - threads.join() - clusterComCheck.checkDnodes(dnodenumbers) + + for tr in threads: + tr.join() + clusterComCheck.checkDnodes(dnodeNumbers) clusterComCheck.checkDbRows(dbNumbers) - for i in range(restartNumber): - clusterComCheck.checkDb(dnodenumbers,'db%d'%i) + clusterComCheck.checkDb(dbNumbers,1,'db0') + + tdSql.execute("use %s" %(paraDict["dbName"])) + tdSql.query("show stables") + tdSql.checkRows(allStbNumbers) def run(self): # print(self.master_dnode.cfgDict) - self.fiveDnodeThreeMnode(5,3,1) + self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=2,stopRole='dnode') def stop(self): tdSql.close() diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py index cf608f64807d1046c0f776347f2f61d321ef87ba..17c344e341eb718f98a3e9c6286f9bdca019947e 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py @@ -65,59 +65,35 @@ class TDTestCase: self._async_raise(thread.ident, SystemExit) - def insertData(self,countstart,countstop): - # fisrt add data : db\stable\childtable\general table - - for couti in range(countstart,countstop): - tdLog.debug("drop database if exists db%d" %couti) - tdSql.execute("drop database if exists db%d" %couti) - print("create database if not exists db%d replica 1 duration 300" %couti) - tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) - tdSql.execute("use db%d" %couti) - tdSql.execute( - '''create table stb1 - (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) - tags (t1 int) - ''' - ) - tdSql.execute( - ''' - create table t1 - (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) - ''' - ) - for i in range(4): - tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') - - - def fiveDnodeThreeMnode(self,dnodenumbers,mnodeNums,restartNumber): + def fiveDnodeThreeMnode(self,dnodeNumbers,mnodeNums,restartNumbers,stopRole): tdLog.printNoPrefix("======== test case 1: ") paraDict = {'dbName': 'db', + 'dbNumbers': 20, 'dropFlag': 1, 'event': '', 'vgroups': 4, 'replica': 1, 'stbName': 'stb', + 'stbNumbers': 100, 'colPrefix': 'c', 'tagPrefix': 't', 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], 'ctbPrefix': 'ctb', 'ctbNum': 1, - 'rowsPerTbl': 10000, - 'batchNum': 10, - 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 - 'pollDelay': 10, - 'showMsg': 1, - 'showRow': 1} - dnodenumbers=int(dnodenumbers) + } + + dnodeNumbers=int(dnodeNumbers) mnodeNums=int(mnodeNums) - dbNumbers = int(mnodeNums * restartNumber) + vnodeNumbers = int(dnodeNumbers-mnodeNums) + allDbNumbers=(paraDict['dbNumbers']*restartNumbers) + allStbNumbers=(paraDict['stbNumbers']*restartNumbers) + tdLog.info("first check dnode and mnode") tdSql.query("show dnodes;") tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(4,1,'%s:6430'%self.host) - clusterComCheck.checkDnodes(dnodenumbers) + clusterComCheck.checkDnodes(dnodeNumbers) clusterComCheck.checkMnodeStatus(1) # fisr add three mnodes; @@ -132,46 +108,62 @@ class TDTestCase: tdSql.error("create mnode on dnode 2") tdSql.query("show dnodes;") print(tdSql.queryResult) - clusterComCheck.checkDnodes(dnodenumbers) + clusterComCheck.checkDnodes(dnodeNumbers) - tdLog.info("Take turns stopping Mnodes ") - # seperate vnode and mnode in different dnodes. # create database and stable tdDnodes=cluster.dnodes - stopcount =0 - while stopcount < restartNumber: - tdLog.info("first restart loop") - for i in range(mnodeNums): - # threads=[] - # threads = MyThreadFunc(self.insert_data(i*2,i*2+2)) - paraDict["dbName"]= 'db%d%d'%(stopcount,i) - threads=threading.Thread(target=clusterComCreate.create_database, args=(tdSql, paraDict["dbName"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica'])) - threads.start() - tdDnodes[i].stoptaosd() - # sleep(10) - tdDnodes[i].starttaosd() - # sleep(10) - - if clusterComCheck.checkDnodes(dnodenumbers): - # threads.join() - tdLog.info("123") + stopcount =0 + threads=[] + for i in range(restartNumbers): + dbNameIndex = '%s%d'%(paraDict["dbName"],i) + threads.append(threading.Thread(target=clusterComCreate.create_databases, args=(tdSql, dbNameIndex,paraDict["dbNumbers"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica']))) + + for tr in threads: + tr.start() + + tdLog.info("Take turns stopping Mnodes ") + while stopcount < restartNumbers: + tdLog.info(" restart loop: %d"%stopcount ) + if stopRole == "mnode": + for i in range(mnodeNums): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + elif stopRole == "vnode": + for i in range(vnodeNumbers): + tdDnodes[i+mnodeNums].stoptaosd() + # sleep(10) + tdDnodes[i+mnodeNums].starttaosd() + # sleep(10) + elif stopRole == "dnode": + for i in range(dnodeNumbers): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + + # dnodeNumbers don't include database of schema + if clusterComCheck.checkDnodes(dnodeNumbers): + tdLog.info("check dnodes status is ready") else: - print("456") - threads.join() + tdLog.info("check dnodes status is not ready") self.stopThread(threads) tdLog.exit("one or more of dnodes failed to start ") # self.check3mnode() stopcount+=1 - threads.join() - clusterComCheck.checkDnodes(dnodenumbers) - clusterComCheck.checkDbRows(dbNumbers) - for i in range(restartNumber): - clusterComCheck.checkDb(mnodeNums,'db%d'%i) + + for tr in threads: + tr.join() + clusterComCheck.checkDnodes(dnodeNumbers) + clusterComCheck.checkDbRows(allDbNumbers) + for i in range(restartNumbers): + clusterComCheck.checkDb(paraDict['dbNumbers'],restartNumbers,dbNameIndex = '%s%d'%(paraDict["dbName"],i)) def run(self): # print(self.master_dnode.cfgDict) - self.fiveDnodeThreeMnode(5,3,1) + self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=2,stopRole='mnode') def stop(self): tdSql.close() diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py new file mode 100644 index 0000000000000000000000000000000000000000..29fb3008c355702e1bbfc76c32e068d9b33856fc --- /dev/null +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py @@ -0,0 +1,204 @@ +from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE +import taos +import sys +import time +import os + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import TDDnodes +from util.dnodes import TDDnode +from util.cluster import * +sys.path.append("./6-cluster") +from clusterCommonCreate import * +from clusterCommonCheck import clusterComCheck + +import time +import socket +import subprocess +from multiprocessing import Process +import threading +import time +import inspect +import ctypes + +class TDTestCase: + + def init(self,conn ,logSql): + tdLog.debug(f"start to excute {__file__}") + self.TDDnodes = None + tdSql.init(conn.cursor()) + self.host = socket.gethostname() + + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root) - len("/build/bin")] + break + return buildPath + + def _async_raise(self, tid, exctype): + """raises the exception, performs cleanup if needed""" + if not inspect.isclass(exctype): + exctype = type(exctype) + res = ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, ctypes.py_object(exctype)) + if res == 0: + raise ValueError("invalid thread id") + elif res != 1: + # """if it returns a number greater than one, you're in trouble, + # and you should call it again with exc=NULL to revert the effect""" + ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, None) + raise SystemError("PyThreadState_SetAsyncExc failed") + + def stopThread(self,thread): + self._async_raise(thread.ident, SystemExit) + + + def insertData(self,countstart,countstop): + # fisrt add data : db\stable\childtable\general table + + for couti in range(countstart,countstop): + tdLog.debug("drop database if exists db%d" %couti) + tdSql.execute("drop database if exists db%d" %couti) + print("create database if not exists db%d replica 1 duration 300" %couti) + tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) + tdSql.execute("use db%d" %couti) + tdSql.execute( + '''create table stb1 + (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) + tags (t1 int) + ''' + ) + tdSql.execute( + ''' + create table t1 + (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) + ''' + ) + for i in range(4): + tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') + + + def fiveDnodeThreeMnode(self,dnodeNumbers,mnodeNums,restartNumbers,stopRole): + tdLog.printNoPrefix("======== test case 1: ") + paraDict = {'dbName': 'db0_0', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'replica': 1, + 'stbName': 'stb', + 'stbNumbers': 100, + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbNum': 1, + } + + dnodeNumbers=int(dnodeNumbers) + mnodeNums=int(mnodeNums) + vnodeNumbers = int(dnodeNumbers-mnodeNums) + allStbNumbers=(paraDict['stbNumbers']*restartNumbers) + dbNumbers = 1 + + tdLog.info("first check dnode and mnode") + tdSql.query("show dnodes;") + tdSql.checkData(0,1,'%s:6030'%self.host) + tdSql.checkData(4,1,'%s:6430'%self.host) + clusterComCheck.checkDnodes(dnodeNumbers) + clusterComCheck.checkMnodeStatus(1) + + # fisr add three mnodes; + tdLog.info("fisr add three mnodes and check mnode status") + tdSql.execute("create mnode on dnode 2") + clusterComCheck.checkMnodeStatus(2) + tdSql.execute("create mnode on dnode 3") + clusterComCheck.checkMnodeStatus(3) + + # add some error operations and + tdLog.info("Confirm the status of the dnode again") + tdSql.error("create mnode on dnode 2") + tdSql.query("show dnodes;") + print(tdSql.queryResult) + clusterComCheck.checkDnodes(dnodeNumbers) + + # create database and stable + clusterComCreate.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica']) + + tdDnodes=cluster.dnodes + stopcount =0 + threads=[] + for i in range(restartNumbers): + stableName= '%s%d'%(paraDict['stbName'],i) + threads.append(threading.Thread(target=clusterComCreate.create_stables, args=(tdSql, paraDict["dbName"],stableName,paraDict['stbNumbers']))) + + for tr in threads: + tr.start() + + tdLog.info("Take turns stopping Mnodes ") + + while stopcount < restartNumbers: + tdLog.info(" restart loop: %d"%stopcount ) + if stopRole == "mnode": + for i in range(mnodeNums): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + elif stopRole == "vnode": + for i in range(vnodeNumbers): + tdDnodes[i+mnodeNums].stoptaosd() + # sleep(10) + tdDnodes[i+mnodeNums].starttaosd() + # sleep(10) + elif stopRole == "dnode": + for i in range(dnodeNumbers): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + + # dnodeNumbers don't include database of schema + if clusterComCheck.checkDnodes(dnodeNumbers): + tdLog.info("123") + else: + print("456") + + self.stopThread(threads) + tdLog.exit("one or more of dnodes failed to start ") + # self.check3mnode() + stopcount+=1 + + for tr in threads: + tr.join() + clusterComCheck.checkDnodes(dnodeNumbers) + clusterComCheck.checkDbRows(dbNumbers) + clusterComCheck.checkDb(dbNumbers,1,'db0') + + tdSql.execute("use %s" %(paraDict["dbName"])) + tdSql.query("show stables") + tdSql.checkRows(allStbNumbers) + + + def run(self): + # print(self.master_dnode.cfgDict) + self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=2,stopRole='mnode') + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py index 2d2322fada3d87157653404727b94ab1a723188c..e7353b0f1336a59a25068616277d74a07df4aab8 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py @@ -90,35 +90,35 @@ class TDTestCase: tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') - def fiveDnodeThreeMnode(self,dnodenumbers,mnodeNums,restartNumber): + def fiveDnodeThreeMnode(self,dnodeNumbers,mnodeNums,restartNumbers,stopRole): tdLog.printNoPrefix("======== test case 1: ") paraDict = {'dbName': 'db', + 'dbNumbers': 20, 'dropFlag': 1, 'event': '', 'vgroups': 4, 'replica': 1, 'stbName': 'stb', + 'stbNumbers': 100, 'colPrefix': 'c', 'tagPrefix': 't', 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], 'ctbPrefix': 'ctb', 'ctbNum': 1, - 'rowsPerTbl': 10000, - 'batchNum': 10, - 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 - 'pollDelay': 10, - 'showMsg': 1, - 'showRow': 1} - dnodenumbers=int(dnodenumbers) + } + + dnodeNumbers=int(dnodeNumbers) mnodeNums=int(mnodeNums) - vnodeNumbers = int(dnodenumbers-mnodeNums) - dbNumbers = int(vnodeNumbers * restartNumber) + vnodeNumbers = int(dnodeNumbers-mnodeNums) + allDbNumbers=(paraDict['dbNumbers']*restartNumbers) + allStbNumbers=(paraDict['stbNumbers']*restartNumbers) + tdLog.info("first check dnode and mnode") tdSql.query("show dnodes;") tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(4,1,'%s:6430'%self.host) - clusterComCheck.checkDnodes(dnodenumbers) + clusterComCheck.checkDnodes(dnodeNumbers) clusterComCheck.checkMnodeStatus(1) # fisr add three mnodes; @@ -133,45 +133,64 @@ class TDTestCase: tdSql.error("create mnode on dnode 2") tdSql.query("show dnodes;") print(tdSql.queryResult) - clusterComCheck.checkDnodes(dnodenumbers) + clusterComCheck.checkDnodes(dnodeNumbers) - tdLog.info("Take turns stopping Vnodes ") - # seperate vnode and mnode in different dnodes. # create database and stable + + tdDnodes=cluster.dnodes - stopcount =0 - while stopcount < restartNumber: - for i in range(vnodeNumbers): - # threads=[] - # threads = MyThreadFunc(self.insert_data(i*2,i*2+2)) - paraDict["dbName"]= 'db%d%d'%(stopcount,i) - threads=threading.Thread(target=clusterComCreate.create_database, args=(tdSql, paraDict["dbName"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica'])) - threads.start() - tdDnodes[mnodeNums+i].stoptaosd() - # sleep(10) - tdDnodes[mnodeNums+i].starttaosd() - # sleep(10) - - if clusterComCheck.checkDnodes(vnodeNumbers): - # threads.join() - tdLog.info("first restart loop") + stopcount =0 + threads=[] + for i in range(restartNumbers): + dbNameIndex = '%s%d'%(paraDict["dbName"],i) + threads.append(threading.Thread(target=clusterComCreate.create_databases, args=(tdSql, dbNameIndex,paraDict["dbNumbers"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica']))) + + for tr in threads: + tr.start() + + tdLog.info("Take turns stopping Mnodes ") + while stopcount < restartNumbers: + tdLog.info(" restart loop: %d"%stopcount ) + if stopRole == "mnode": + for i in range(mnodeNums): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + elif stopRole == "vnode": + for i in range(vnodeNumbers): + tdDnodes[i+mnodeNums].stoptaosd() + # sleep(10) + tdDnodes[i+mnodeNums].starttaosd() + # sleep(10) + elif stopRole == "dnode": + for i in range(dnodeNumbers): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + + # dnodeNumbers don't include database of schema + if clusterComCheck.checkDnodes(dnodeNumbers): + tdLog.info("check dnodes status is ready") else: - print("456") - threads.join() + tdLog.info("check dnodes status is not ready") self.stopThread(threads) tdLog.exit("one or more of dnodes failed to start ") # self.check3mnode() stopcount+=1 - threads.join() - clusterComCheck.checkDnodes(dnodenumbers) - clusterComCheck.checkDbRows(dbNumbers) - for i in range(restartNumber): - clusterComCheck.checkDb(vnodeNumbers,'db%d'%i) + + for tr in threads: + tr.join() + clusterComCheck.checkDnodes(dnodeNumbers) + clusterComCheck.checkDbRows(allDbNumbers) + for i in range(restartNumbers): + clusterComCheck.checkDb(paraDict['dbNumbers'],restartNumbers,dbNameIndex = '%s%d'%(paraDict["dbName"],i)) def run(self): # print(self.master_dnode.cfgDict) - self.fiveDnodeThreeMnode(5,3,1) + self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=2,stopRole='vnode') def stop(self): tdSql.close() diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py new file mode 100644 index 0000000000000000000000000000000000000000..2f1c1368d1bd811362fac57a72a9a11734367488 --- /dev/null +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py @@ -0,0 +1,204 @@ +from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE +import taos +import sys +import time +import os + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import TDDnodes +from util.dnodes import TDDnode +from util.cluster import * +sys.path.append("./6-cluster") +from clusterCommonCreate import * +from clusterCommonCheck import clusterComCheck + +import time +import socket +import subprocess +from multiprocessing import Process +import threading +import time +import inspect +import ctypes + +class TDTestCase: + + def init(self,conn ,logSql): + tdLog.debug(f"start to excute {__file__}") + self.TDDnodes = None + tdSql.init(conn.cursor()) + self.host = socket.gethostname() + + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root) - len("/build/bin")] + break + return buildPath + + def _async_raise(self, tid, exctype): + """raises the exception, performs cleanup if needed""" + if not inspect.isclass(exctype): + exctype = type(exctype) + res = ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, ctypes.py_object(exctype)) + if res == 0: + raise ValueError("invalid thread id") + elif res != 1: + # """if it returns a number greater than one, you're in trouble, + # and you should call it again with exc=NULL to revert the effect""" + ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, None) + raise SystemError("PyThreadState_SetAsyncExc failed") + + def stopThread(self,thread): + self._async_raise(thread.ident, SystemExit) + + + def insertData(self,countstart,countstop): + # fisrt add data : db\stable\childtable\general table + + for couti in range(countstart,countstop): + tdLog.debug("drop database if exists db%d" %couti) + tdSql.execute("drop database if exists db%d" %couti) + print("create database if not exists db%d replica 1 duration 300" %couti) + tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) + tdSql.execute("use db%d" %couti) + tdSql.execute( + '''create table stb1 + (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) + tags (t1 int) + ''' + ) + tdSql.execute( + ''' + create table t1 + (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) + ''' + ) + for i in range(4): + tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') + + + def fiveDnodeThreeMnode(self,dnodeNumbers,mnodeNums,restartNumbers,stopRole): + tdLog.printNoPrefix("======== test case 1: ") + paraDict = {'dbName': 'db0_0', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'replica': 1, + 'stbName': 'stb', + 'stbNumbers': 100, + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbNum': 1, + } + + dnodeNumbers=int(dnodeNumbers) + mnodeNums=int(mnodeNums) + vnodeNumbers = int(dnodeNumbers-mnodeNums) + allStbNumbers=(paraDict['stbNumbers']*restartNumbers) + dbNumbers = 1 + + tdLog.info("first check dnode and mnode") + tdSql.query("show dnodes;") + tdSql.checkData(0,1,'%s:6030'%self.host) + tdSql.checkData(4,1,'%s:6430'%self.host) + clusterComCheck.checkDnodes(dnodeNumbers) + clusterComCheck.checkMnodeStatus(1) + + # fisr add three mnodes; + tdLog.info("fisr add three mnodes and check mnode status") + tdSql.execute("create mnode on dnode 2") + clusterComCheck.checkMnodeStatus(2) + tdSql.execute("create mnode on dnode 3") + clusterComCheck.checkMnodeStatus(3) + + # add some error operations and + tdLog.info("Confirm the status of the dnode again") + tdSql.error("create mnode on dnode 2") + tdSql.query("show dnodes;") + print(tdSql.queryResult) + clusterComCheck.checkDnodes(dnodeNumbers) + + # create database and stable + clusterComCreate.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica']) + tdLog.info("Take turns stopping Mnodes ") + + tdDnodes=cluster.dnodes + stopcount =0 + threads=[] + for i in range(restartNumbers): + stableName= '%s%d'%(paraDict['stbName'],i) + threads.append(threading.Thread(target=clusterComCreate.create_stables, args=(tdSql, paraDict["dbName"],stableName,paraDict['stbNumbers']))) + + for tr in threads: + tr.start() + + tdLog.info("Take turns stopping Mnodes ") + while stopcount < restartNumbers: + tdLog.info(" restart loop: %d"%stopcount ) + if stopRole == "mnode": + for i in range(mnodeNums): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + elif stopRole == "vnode": + for i in range(vnodeNumbers): + tdDnodes[i+mnodeNums].stoptaosd() + # sleep(10) + tdDnodes[i+mnodeNums].starttaosd() + # sleep(10) + elif stopRole == "dnode": + for i in range(dnodeNumbers): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + + # dnodeNumbers don't include database of schema + if clusterComCheck.checkDnodes(dnodeNumbers): + tdLog.info("123") + else: + print("456") + + self.stopThread(threads) + tdLog.exit("one or more of dnodes failed to start ") + # self.check3mnode() + stopcount+=1 + + for tr in threads: + tr.join() + clusterComCheck.checkDnodes(dnodeNumbers) + clusterComCheck.checkDbRows(dbNumbers) + clusterComCheck.checkDb(dbNumbers,1,'db0') + + tdSql.execute("use %s" %(paraDict["dbName"])) + tdSql.query("show stables") + tdSql.checkRows(allStbNumbers) + + + def run(self): + # print(self.master_dnode.cfgDict) + self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=2,stopRole='vnode') + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/system-test/6-cluster/5dnode3mnodeStop.py b/tests/system-test/6-cluster/5dnode3mnodeStop.py index 5311d29846ecf1ec93c912abaf9634d40a50d680..1b55176e1d23c3670a2ec9fedf850ac7814c2cdc 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeStop.py +++ b/tests/system-test/6-cluster/5dnode3mnodeStop.py @@ -45,179 +45,6 @@ class TDTestCase: buildPath = root[:len(root) - len("/build/bin")] break return buildPath - - def insert_data(self,count): - # fisrt add data : db\stable\childtable\general table - for couti in count: - tdSql.execute("drop database if exists db%d" %couti) - tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) - tdSql.execute("use db%d" %couti) - tdSql.execute( - '''create table stb1 - (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) - tags (t1 int) - ''' - ) - tdSql.execute( - ''' - create table t1 - (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) - ''' - ) - for i in range(4): - tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') - - - def check3mnode(self): - count=0 - while count < 10: - time.sleep(1) - tdSql.query("show mnodes;") - if tdSql.checkRows(3) : - tdLog.debug("mnode is three nodes") - else: - tdLog.exit("mnode number is correct") - if tdSql.queryResult[0][2]=='leader' : - if tdSql.queryResult[1][2]=='follower': - if tdSql.queryResult[2][2]=='follower': - tdLog.debug("three mnodes is ready in 10s") - break - elif tdSql.queryResult[1][2]=='leader' : - if tdSql.queryResult[0][2]=='follower': - if tdSql.queryResult[2][2]=='follower': - tdLog.debug("three mnodes is ready in 10s") - break - elif tdSql.queryResult[2][2]=='leader' : - if tdSql.queryResult[1][2]=='follower': - if tdSql.queryResult[0][2]=='follower': - tdLog.debug("three mnodes is ready in 10s") - break - count+=1 - else: - tdLog.exit("three mnodes is not ready in 10s ") - - tdSql.query("show mnodes;") - tdSql.checkRows(3) - tdSql.checkData(0,1,'%s:6030'%self.host) - tdSql.checkData(0,3,'ready') - tdSql.checkData(1,1,'%s:6130'%self.host) - tdSql.checkData(1,3,'ready') - tdSql.checkData(2,1,'%s:6230'%self.host) - tdSql.checkData(2,3,'ready') - - def check3mnode1off(self): - count=0 - while count < 10: - time.sleep(1) - tdSql.query("show mnodes;") - if tdSql.checkRows(3) : - tdLog.debug("mnode is three nodes") - else: - tdLog.exit("mnode number is correct") - if tdSql.queryResult[0][2]=='offline' : - if tdSql.queryResult[1][2]=='leader': - if tdSql.queryResult[2][2]=='follower': - tdLog.debug("stop mnodes on dnode 2 successfully in 10s") - break - elif tdSql.queryResult[1][2]=='follower': - if tdSql.queryResult[2][2]=='leader': - tdLog.debug("stop mnodes on dnode 2 successfully in 10s") - break - count+=1 - else: - tdLog.exit("stop mnodes on dnode 2 failed in 10s ") - - tdSql.error("drop mnode on dnode 1;") - - tdSql.query("show mnodes;") - tdSql.checkRows(3) - tdSql.checkData(0,1,'%s:6030'%self.host) - tdSql.checkData(0,2,'offline') - tdSql.checkData(0,3,'ready') - tdSql.checkData(1,1,'%s:6130'%self.host) - tdSql.checkData(1,3,'ready') - tdSql.checkData(2,1,'%s:6230'%self.host) - tdSql.checkData(2,3,'ready') - - def check3mnode2off(self): - count=0 - while count < 40: - time.sleep(1) - tdSql.query("show mnodes;") - if tdSql.checkRows(3) : - tdLog.debug("mnode is three nodes") - else: - tdLog.exit("mnode number is correct") - if tdSql.queryResult[0][2]=='leader' : - if tdSql.queryResult[1][2]=='offline': - if tdSql.queryResult[2][2]=='follower': - tdLog.debug("stop mnodes on dnode 2 successfully in 10s") - break - count+=1 - else: - tdLog.exit("stop mnodes on dnode 2 failed in 10s ") - - tdSql.error("drop mnode on dnode 2;") - - tdSql.query("show mnodes;") - tdSql.checkRows(3) - tdSql.checkData(0,1,'%s:6030'%self.host) - tdSql.checkData(0,3,'ready') - tdSql.checkData(1,1,'%s:6130'%self.host) - tdSql.checkData(1,3,'ready') - tdSql.checkData(2,1,'%s:6230'%self.host) - tdSql.checkData(2,3,'ready') - - def check3mnode3off(self): - count=0 - while count < 10: - time.sleep(1) - tdSql.query("show mnodes;") - if tdSql.checkRows(3) : - tdLog.debug("mnode is three nodes") - else: - tdLog.exit("mnode number is correct") - if tdSql.queryResult[0][2]=='leader' : - if tdSql.queryResult[2][2]=='offline': - if tdSql.queryResult[1][2]=='follower': - tdLog.debug("stop mnodes on dnode 3 successfully in 10s") - break - count+=1 - else: - tdLog.exit("stop mnodes on dnode 3 failed in 10s") - - tdSql.error("drop mnode on dnode 3;") - tdSql.query("show mnodes;") - tdSql.checkRows(3) - tdSql.checkData(0,1,'%s:6030'%self.host) - tdSql.checkData(0,2,'leader') - tdSql.checkData(0,3,'ready') - tdSql.checkData(1,1,'%s:6130'%self.host) - tdSql.checkData(1,2,'follower') - tdSql.checkData(1,3,'ready') - tdSql.checkData(2,1,'%s:6230'%self.host) - tdSql.checkData(2,2,'offline') - tdSql.checkData(2,3,'ready') - - - def check_dnodes_status(self,dnodeNumbers): - count=0 - while count < 5: - tdSql.query("show dnodes") - # tdLog.debug(tdSql.queryResult) - status=0 - for i in range(dnodeNumbers): - if tdSql.queryResult[i][4] == "ready": - status+=1 - tdLog.debug(status) - - if status == dnodeNumbers: - tdLog.debug(" create cluster with %d dnode and check cluster dnode all ready within 5s! " %dnodeNumbers) - break - count+=1 - time.sleep(1) - else: - tdLog.exit("create cluster with %d dnode but check dnode not ready within 5s ! "%dnodeNumbers) def fiveDnodeThreeMnode(self,dnodenumbers,mnodeNums,restartNumber): tdLog.printNoPrefix("======== test case 1: ") diff --git a/tests/system-test/6-cluster/5dnode3mnodeStopConnect.py b/tests/system-test/6-cluster/5dnode3mnodeStopConnect.py new file mode 100644 index 0000000000000000000000000000000000000000..247bd29ed99458620a10173e685cdddb7674e18e --- /dev/null +++ b/tests/system-test/6-cluster/5dnode3mnodeStopConnect.py @@ -0,0 +1,132 @@ +from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE +import taos +import sys +import time +import os + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +from util.dnodes import TDDnodes +from util.dnodes import TDDnode +from util.common import * +from util.cluster import * +from test import tdDnodes +sys.path.append("./6-cluster") + +from clusterCommonCreate import * +from clusterCommonCheck import * +import time +import socket +import subprocess +from multiprocessing import Process + + +class TDTestCase: + + def init(self,conn ,logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor()) + self.host = socket.gethostname() + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root) - len("/build/bin")] + break + return buildPath + + def fiveDnodeThreeMnode(self,dnodenumbers,mnodeNums,restartNumber): + tdLog.printNoPrefix("======== test case 1: ") + paraDict = {'dbName': 'db', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'replica': 1, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbNum': 1, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 10, + 'showMsg': 1, + 'showRow': 1} + dnodenumbers=int(dnodenumbers) + mnodeNums=int(mnodeNums) + dbNumbers = int(dnodenumbers * restartNumber) + + tdLog.info("first check dnode and mnode") + tdSql.query("show dnodes;") + tdSql.checkData(0,1,'%s:6030'%self.host) + tdSql.checkData(4,1,'%s:6430'%self.host) + clusterComCheck.checkDnodes(dnodenumbers) + clusterComCheck.checkMnodeStatus(1) + + # fisr add three mnodes; + tdLog.info("fisr add three mnodes and check mnode status") + tdSql.execute("create mnode on dnode 2") + clusterComCheck.checkMnodeStatus(2) + tdSql.execute("create mnode on dnode 3") + clusterComCheck.checkMnodeStatus(3) + + # add some error operations and + tdLog.info("Confirm the status of the dnode again") + tdSql.error("create mnode on dnode 2") + tdSql.query("show dnodes;") + print(tdSql.queryResult) + clusterComCheck.checkDnodes(dnodenumbers) + + # check status of connection + + + + # restart all taosd + tdDnodes=cluster.dnodes + for i in range(mnodeNums): + tdDnodes[i].stoptaosd() + for j in range(dnodenumbers): + if j != i: + cluster.checkConnectStatus(j) + clusterComCheck.check3mnodeoff(i+1,3) + clusterComCheck.init(cluster.checkConnectStatus(i+1)) + tdDnodes[i].starttaosd() + clusterComCheck.checkMnodeStatus(mnodeNums) + + tdLog.info("Take turns stopping all dnodes ") + # seperate vnode and mnode in different dnodes. + # create database and stable + stopcount =0 + while stopcount <= 2: + tdLog.info("first restart loop") + for i in range(dnodenumbers): + tdDnodes[i].stoptaosd() + tdDnodes[i].starttaosd() + stopcount+=1 + clusterComCheck.checkDnodes(dnodenumbers) + clusterComCheck.checkMnodeStatus(3) + + def run(self): + # print(self.master_dnode.cfgDict) + self.fiveDnodeThreeMnode(5,3,1) + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/system-test/6-cluster/clusterCommonCheck.py b/tests/system-test/6-cluster/clusterCommonCheck.py index d03000896340afad5ec84593e3d8a29eb410c486..2d378e623d73635ec992084395b6042c011caf37 100644 --- a/tests/system-test/6-cluster/clusterCommonCheck.py +++ b/tests/system-test/6-cluster/clusterCommonCheck.py @@ -33,7 +33,7 @@ from util.common import * # INSERT_DATA = 3 class ClusterComCheck: - def init(self, conn, logSql): + def init(self, conn, logSql=False): tdSql.init(conn.cursor()) # tdSql.init(conn.cursor(), logSql) # output sql.txt file @@ -71,25 +71,28 @@ class ClusterComCheck: tdLog.debug(tdSql.queryResult) tdLog.exit("we find %d databases but expect %d in clusters! " %(tdSql.queryRows,dbNumbers)) - def checkDb(self,dbNumbers,dbindex): + def checkDb(self,dbNumbers,restartNumber,dbNameIndex): count=0 + alldbNumbers=(dbNumbers*restartNumber)+2 while count < 5: query_status=0 - for i in range(dbNumbers): - for j in range(dbNumbers): + for j in range(dbNumbers): + for i in range(alldbNumbers): tdSql.query("show databases;") - if "%s%d"%(dbindex,j) == tdSql.queryResult[i+2][0] : - if tdSql.queryResult[i+2][19] == "ready": + if "%s_%d"%(dbNameIndex,j) == tdSql.queryResult[i][0] : + if tdSql.queryResult[i][19] == "ready": query_status+=1 + tdLog.debug("check %s_%d that status is ready "%(dbNameIndex,j)) else: continue - # print(query_status) + print(query_status) count+=1 if query_status == dbNumbers: tdLog.success("we find cluster with %d dnode and check all databases are ready within 5s! " %dbNumbers) return True else: tdLog.debug(tdSql.queryResult) + tdLog.debug("query status is %d"%query_status) tdLog.exit("database is not ready within 5s") def checkData(self,dbname,stbname,stableCount,CtableCount,rowsPerSTable,): diff --git a/tests/system-test/6-cluster/clusterCommonCreate.py b/tests/system-test/6-cluster/clusterCommonCreate.py index b3107d8537297ec7497407af8f74b96f14bab724..78aac309a051e4cf392025fb4f52835397656fa5 100644 --- a/tests/system-test/6-cluster/clusterCommonCreate.py +++ b/tests/system-test/6-cluster/clusterCommonCreate.py @@ -123,11 +123,26 @@ class ClusterComCreate: tdLog.debug("complete to create database %s"%(dbName)) return + def create_databases(self,tsql,dbNameIndex,dbNumbers,dropFlag=1,vgroups=4,replica=1): + for i in range(dbNumbers): + print(dbNumbers) + if dropFlag == 1: + tsql.execute("drop database if exists %s_%d"%(dbNameIndex,i)) + tsql.execute("create database if not exists %s_%d vgroups %d replica %d"%(dbNameIndex,i, vgroups, replica)) + tdLog.debug("complete to create database %s_%d"%(dbNameIndex,i)) + return + def create_stable(self,tsql, dbName,stbName): tsql.execute("create table if not exists %s.%s (ts timestamp, c1 int, c2 int, c3 binary(16)) tags(t1 int, t2 binary(32))"%(dbName, stbName)) tdLog.debug("complete to create %s.%s" %(dbName, stbName)) return + def create_stables(self,tsql,dbNameIndex,stbNameIndex,stbNumbers): + for i in range(stbNumbers): + tsql.execute("create table if not exists %s.%s_%d (ts timestamp, c1 int, c2 int, c3 binary(16)) tags(t1 int, t2 binary(32))"%(dbNameIndex, stbNameIndex,i)) + tdLog.debug("complete to create %s.%s_%d" %(dbNameIndex, stbNameIndex,i)) + return + def create_ctable(self,tsql=None, dbName='dbx',stbName='stb',ctbPrefix='ctb',ctbNum=1): tsql.execute("use %s" %dbName) pre_create = "create table" diff --git a/tests/system-test/fulltest.sh b/tests/system-test/fulltest.sh index 2e2e390d123c469cfa542e587f99a4c8d6091e3f..d0fee5c49c5e119c5ad52c8655fe5c0f22d95908 100755 --- a/tests/system-test/fulltest.sh +++ b/tests/system-test/fulltest.sh @@ -23,7 +23,7 @@ python3 ./test.py -f 1-insert/alter_stable.py python3 ./test.py -f 1-insert/alter_table.py python3 ./test.py -f 1-insert/insertWithMoreVgroup.py python3 ./test.py -f 1-insert/table_comment.py -python3 ./test.py -f 1-insert/table_param_ttl.py +#python3 ./test.py -f 1-insert/table_param_ttl.py python3 ./test.py -f 2-query/between.py python3 ./test.py -f 2-query/distinct.py python3 ./test.py -f 2-query/varchar.py @@ -113,16 +113,21 @@ python3 ./test.py -f 2-query/twa.py python3 ./test.py -f 2-query/irate.py python3 ./test.py -f 2-query/function_null.py +python3 ./test.py -f 2-query/queryQnode.py python3 ./test.py -f 6-cluster/5dnode1mnode.py python3 ./test.py -f 6-cluster/5dnode2mnode.py python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -N 5 -M 3 -python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py -N 5 -M 3 -# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopCreateDb.py -N 5 -M 3 -# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -N 5 -M 3 - -# python3 ./test.py -f 6-cluster/5dnode3mnodeDrop.py -N 5 +# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py -N 5 -M 3 +# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -N 5 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py -N 5 -M 3 +# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py -N 5 -M 3 +# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py -N 5 -M 3 +# python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py -N 5 -M 3 # BUG python3 ./test.py -f 6-cluster/5dnode3mnodeStopInsert.py +# python3 ./test.py -f 6-cluster/5dnode3mnodeDrop.py -N 5 +python3 test.py -f 6-cluster/5dnode3mnodeStopConnect.py -N 5 -M 3 + python3 ./test.py -f 7-tmq/basic5.py python3 ./test.py -f 7-tmq/subscribeDb.py diff --git a/tests/system-test/test-all.bat b/tests/system-test/test-all.bat index d4032cbc0de311469a62abe81982abc2026ffb5d..2af23596a325c76ee4c379d5daa7fff5e0c0e245 100644 --- a/tests/system-test/test-all.bat +++ b/tests/system-test/test-all.bat @@ -20,12 +20,12 @@ if "%1" == "full" ( call :GetTimeSeconds !time! set time1=!_timeTemp! echo Start at !time! - call %%i ARG1 > result_!a!.txt 2>error_!a!.txt + call %%i ARG1 > result_!a!.txt 2>error_!a!.txt || set errorlevel=8 if errorlevel 1 ( call :colorEcho 0c "failed" &echo. && set /a exitNum=8 && echo %%i >>failed.txt ) else ( call :colorEcho 0a "Success" &echo. ) ) ) ) - exit !exitNum! + exit /b !exitNum! ) echo Windows Taosd Test for /F "usebackq tokens=*" %%i in (simpletest.bat) do ( @@ -36,8 +36,8 @@ for /F "usebackq tokens=*" %%i in (simpletest.bat) do ( call :GetTimeSeconds !timeNow! set time1=!_timeTemp! echo Start at !timeNow! - call %%i ARG1 > result_!a!.txt 2>error_!a!.txt - if errorlevel 1 ( call :colorEcho 0c "failed" &echo. && echo result: && cat result_!a!.txt && echo error: && cat error_!a!.txt && exit 8 ) else ( call :colorEcho 0a "Success" &echo. ) + call %%i ARG1 > result_!a!.txt 2>error_!a!.txt || set errorlevel=8 + if errorlevel 1 ( call :colorEcho 0c "failed" &echo. && echo result: && cat result_!a!.txt && echo error: && cat error_!a!.txt && exit /b 8 ) else ( call :colorEcho 0a "Success" &echo. ) ) ) @REM echo Linux Taosd Test @@ -52,7 +52,7 @@ for /F "usebackq tokens=*" %%i in (simpletest.bat) do ( @REM if errorlevel 1 ( call :colorEcho 0c "failed" &echo. && echo result: && cat result_!a!.txt && echo error: && cat error_!a!.txt && exit 8 ) else ( call :colorEcho 0a "Success" &echo. ) @REM ) @REM ) -exit +exit /b :colorEcho set timeNow=%time% diff --git a/tests/system-test/test.py b/tests/system-test/test.py index 76b83da34813fed3969aa07e50ed3c05aec163b6..2d7f78661ae856745b0aa22afd644e3e5b345227 100644 --- a/tests/system-test/test.py +++ b/tests/system-test/test.py @@ -186,7 +186,7 @@ if __name__ == "__main__": tdLog.info("Procedures for tdengine deployed in %s" % (host)) if platform.system().lower() == 'windows': fileName = fileName.replace("/", os.sep) - if (masterIp == "" and not fileName[0:12] == "0-others\\udf"): + if (masterIp == "" and not fileName == "0-others\\udf_create.py"): threading.Thread(target=checkRunTimeError,daemon=True).start() tdLog.info("Procedures for testing self-deployment") tdDnodes.init(deployPath, masterIp) diff --git a/tools/taos-tools b/tools/taos-tools index a875a057d1225d85c6323b9edaccc2b1a9641987..7105027650b51e701cfa1dac11b8fb42d447dd01 160000 --- a/tools/taos-tools +++ b/tools/taos-tools @@ -1 +1 @@ -Subproject commit a875a057d1225d85c6323b9edaccc2b1a9641987 +Subproject commit 7105027650b51e701cfa1dac11b8fb42d447dd01