diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 2f8b20e791ee73e776b46f317676d66f714c0fec..5798d325d4c59b8bf71522e1d8819e4243f37b54 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -1688,8 +1688,8 @@ static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pC return false; } - if ((p->type == TSDB_DATA_TYPE_BINARY && p->bytes <= 0) || - (p->type == TSDB_DATA_TYPE_NCHAR && p->bytes <= 0)) { + if ((p->type == TSDB_DATA_TYPE_BINARY && (p->bytes <= 0 || p->bytes > TSDB_MAX_BINARY_LEN)) || + (p->type == TSDB_DATA_TYPE_NCHAR && (p->bytes <= 0 || p->bytes > TSDB_MAX_NCHAR_LEN))) { invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg7); return false; } @@ -1803,7 +1803,8 @@ int32_t validateOneTag(SSqlCmd* pCmd, TAOS_FIELD* pTagField) { } // binary(val), val can not be equalled to or less than 0 - if ((pTagField->type == TSDB_DATA_TYPE_BINARY || pTagField->type == TSDB_DATA_TYPE_NCHAR) && pTagField->bytes <= 0) { + if ((pTagField->type == TSDB_DATA_TYPE_BINARY || pTagField->type == TSDB_DATA_TYPE_NCHAR) && + (pTagField->bytes <= 0 || pTagField->bytes > TSDB_MAX_TAGS_LEN)) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg5); } @@ -5318,7 +5319,7 @@ static int32_t validateSQLExprItem(SSqlCmd* pCmd, tSqlExpr* pExpr, pList->ids[pList->num++] = idx; *type = SQLEXPR_TYPE_SCALAR; } else if (pExpr->type == SQL_NODE_DATA_TYPE) { - if (pExpr->dataType.type < 0 || pExpr->dataType.bytes <= 0) { + if (pExpr->dataType.type < 0 || pExpr->dataType.bytes <= 0 || pExpr->dataType.bytes > TSDB_MAX_FIELD_LEN) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2); } *type = SQLEXPR_TYPE_VALUE; diff --git a/src/inc/taosdef.h b/src/inc/taosdef.h index 261407efff57df99e9383d4728ae054a42114444..8c7996c668dd068586bdc76e1f6560c60e7e707d 100644 --- a/src/inc/taosdef.h +++ b/src/inc/taosdef.h @@ -226,30 +226,11 @@ do { \ #define TSDB_APPNAME_LEN TSDB_UNI_LEN -#if 1 /** - * In some scenarios uint16_t (0~65535) is used to store the row len. - * - Firstly, we use 65531(65535 - 4), as the SDataRow/SKVRow contains 4 bits header. - * - Secondly, if all cols are VarDataT type except primary key, we need 4 bits to store the offset, thus - * the final value is 65531-(4096-1)*4 = 49151. + * uint16_t (0~65535) is used to store the row len, and SDataRow contains 4 bits header. + * history: 49151->65531 */ -#define TSDB_MAX_BYTES_PER_ROW 65527 -// 49151 -// 65527 -#endif - - /** - * In some scenarios uint16_t (0~65535) is used to store the row len. - * - Firstly, we use 65531(65535 - 4), as the SDataRow contains 4 bits header. - * - Secondly, if all cols are VarDataT type except primary key, we need 4 bits to store the offset, thus - * the final value is [65531 - (4096-1)*4 = 49151, 65531 - (2-1)*4 = 65527] - * - - */ - // [49151, min(65527, RPC_MAX_UDP_SIZE)] - -#if 0 -#define TSDB_MAX_BYTES_PER_ROW_BY_COL(c) (65535 - (c) << 2) // 65531 - (col-1)*4 -#endif +#define TSDB_MAX_BYTES_PER_ROW 65531 #define TSDB_MAX_TAGS_LEN 16384 #define TSDB_MAX_JSON_TAGS_LEN (4096 * TSDB_NCHAR_SIZE + 2 + 1) // 2->var_header_len 1->type @@ -391,14 +372,8 @@ do { \ #define TSDB_MAX_UNION_CLAUSE 5 #define TSDB_MAX_FIELD_LEN 65519 -// 16384 - // 65519 - - // #define TSDB_MAX_BINARY_LEN (TSDB_MAX_FIELD_LEN - TSDB_KEYSIZE) // keep 16384 => 65511 - // #define TSDB_MAX_NCHAR_LEN (TSDB_MAX_FIELD_LEN - TSDB_KEYSIZE) // keep 16384 => 65511 - -#define TSDB_MAX_BINARY_LEN TSDB_MAX_FIELD_LEN // keep 16384 => 65511 -#define TSDB_MAX_NCHAR_LEN TSDB_MAX_FIELD_LEN // keep 16384 => 65511 +#define TSDB_MAX_BINARY_LEN TSDB_MAX_FIELD_LEN // 16384:65519 +#define TSDB_MAX_NCHAR_LEN TSDB_MAX_FIELD_LEN // 16384:65519 #define PRIMARYKEY_TIMESTAMP_COL_INDEX 0 diff --git a/tests/pytest/insert/openTsdbTelnetLinesInsert.py b/tests/pytest/insert/openTsdbTelnetLinesInsert.py index 75e3a18980620c0ff1f9c3c6fae06950d8cad1db..0bc92792d1390a1d8ea6ce946205c328ae4120ee 100644 --- a/tests/pytest/insert/openTsdbTelnetLinesInsert.py +++ b/tests/pytest/insert/openTsdbTelnetLinesInsert.py @@ -702,11 +702,11 @@ class TDTestCase: # # binary tdCom.cleanTb() stb_name = tdCom.getLongName(7, "letters") - input_sql = f'{stb_name} 1626006833640 "{tdCom.getLongName(16374, "letters")}" t0=t' + input_sql = f'{stb_name} 1626006833640 "{tdCom.getLongName(65517, "letters")}" t0=t' self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None) tdCom.cleanTb() - input_sql = f'{stb_name} 1626006833640 "{tdCom.getLongName(65514, "letters")}" t0=t' + input_sql = f'{stb_name} 1626006833640 "{tdCom.getLongName(65518, "letters")}" t0=t' try: self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None) raise Exception("should not reach here") @@ -717,11 +717,11 @@ class TDTestCase: # * legal nchar could not be larger than 16374/4 tdCom.cleanTb() stb_name = tdCom.getLongName(7, "letters") - input_sql = f'{stb_name} 1626006833640 L"{tdCom.getLongName(4093, "letters")}" t0=t' + input_sql = f'{stb_name} 1626006833640 L"{tdCom.getLongName(16379, "letters")}" t0=t' self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None) tdCom.cleanTb() - input_sql = f'{stb_name} 1626006833640 L"{tdCom.getLongName(16379, "letters")}" t0=t' + input_sql = f'{stb_name} 1626006833640 L"{tdCom.getLongName(16380, "letters")}" t0=t' try: self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None) raise Exception("should not reach here") diff --git a/tests/pytest/tools/taosdemoAllTest/TD-5213/insert4096columns_not_use_taosdemo.py b/tests/pytest/tools/taosdemoAllTest/TD-5213/insert4096columns_not_use_taosdemo.py index ad852f0a8084421a309a18df528fb9924c8f006c..f49cecdfa766a2d5529627fc754545791c968f5d 100644 --- a/tests/pytest/tools/taosdemoAllTest/TD-5213/insert4096columns_not_use_taosdemo.py +++ b/tests/pytest/tools/taosdemoAllTest/TD-5213/insert4096columns_not_use_taosdemo.py @@ -288,9 +288,9 @@ class TDTestCase: tdSql.checkRows(4*self.num) tdSql.checkCols(4096) - #define TSDB_MAX_BYTES_PER_ROW 65527[old:1024 && 16384 && 49151] + #define TSDB_MAX_BYTES_PER_ROW 65531[old:1024 && 16384 && 49151] #ts:8\int:4\smallint:2\bigint:8\bool:1\float:4\tinyint:1\nchar:4*()+2[offset]\binary:1*()+2[offset] - tdLog.info('test regular_table max bytes per row 65527') + tdLog.info('test regular_table max bytes per row 65531') sql = "create table regular_table_5(ts timestamp, " for i in range(500): sql += "int_%d int, " % (i + 1) @@ -312,12 +312,12 @@ class TDTestCase: sql += "binary_%d binary(34), " % (i + 1) for i in range(4090,4094): sql += "timestamp_%d timestamp, " % (i + 1) - sql += "col4095 binary(14081))" + sql += "col4095 binary(14085))" tdSql.execute(sql) tdSql.query("select * from regular_table_5") tdSql.checkCols(4096) # TD-5324 - sql = "alter table regular_table_5 modify column col4095 binary(14082); " + sql = "alter table regular_table_5 modify column col4095 binary(14086); " tdSql.error(sql) # drop and add @@ -326,16 +326,16 @@ class TDTestCase: sql = "select * from regular_table_5; " tdSql.query(sql) tdSql.checkCols(4095) - sql = "alter table regular_table_5 add column col4095 binary(14082); " + sql = "alter table regular_table_5 add column col4095 binary(14086); " tdSql.error(sql) - sql = "alter table regular_table_5 add column col4095 binary(14081); " + sql = "alter table regular_table_5 add column col4095 binary(14085); " tdSql.execute(sql) sql = "select * from regular_table_5; " tdSql.query(sql) tdSql.checkCols(4096) - #out TSDB_MAX_BYTES_PER_ROW 65527 - tdLog.info('test regular_table max bytes per row out 65527') + #out TSDB_MAX_BYTES_PER_ROW 65531 + tdLog.info('test regular_table max bytes per row out 65531') sql = "create table regular_table_6(ts timestamp, " for i in range(500): sql += "int_%d int, " % (i + 1) @@ -357,7 +357,7 @@ class TDTestCase: sql += "binary_%d binary(34), " % (i + 1) for i in range(4090,4094): sql += "timestamp_%d timestamp, " % (i + 1) - sql += "col4095 binary(14082))" + sql += "col4095 binary(14086))" tdLog.info(len(sql)) tdSql.error(sql) @@ -575,9 +575,9 @@ class TDTestCase: tdSql.checkRows(3*self.num) tdSql.checkCols(4092) - #define TSDB_MAX_BYTES_PER_ROW 65527 TSDB_MAX_TAGS_LEN 16384 + #define TSDB_MAX_BYTES_PER_ROW 65531 TSDB_MAX_TAGS_LEN 16384 #ts:8\int:4\smallint:2\bigint:8\bool:1\float:4\tinyint:1\nchar:4*()+2[offset]\binary:1*()+2[offset] - tdLog.info('test super table max bytes per row 65527') + tdLog.info('test super table max bytes per row 65531') sql = "create table stable_4(ts timestamp, " for i in range(500): sql += "int_%d int, " % (i + 1) @@ -597,7 +597,7 @@ class TDTestCase: sql += "nchar_%d nchar(20), " % (i + 1) for i in range(3800,4090): sql += "binary_%d binary(34), " % (i + 1) - sql += "col4091 binary(14113))" + sql += "col4091 binary(14117))" sql += " tags (loc nchar(10),tag_1 int,tag_2 int,tag_3 int) " tdSql.execute(sql) sql = '''create table table_40 using stable_4 @@ -614,9 +614,9 @@ class TDTestCase: sql = "select * from stable_4; " tdSql.query(sql) tdSql.checkCols(4095) - sql = "alter table stable_4 add column col4091 binary(14114); " + sql = "alter table stable_4 add column col4091 binary(14118); " tdSql.error(sql) - sql = "alter table stable_4 add column col4091 binary(14113); " + sql = "alter table stable_4 add column col4091 binary(14117); " tdSql.execute(sql) sql = "select * from stable_4; " tdSql.query(sql) @@ -635,7 +635,7 @@ class TDTestCase: sql = "alter table stable_4 add tag loc1 nchar(10); " tdSql.error(sql) - tdLog.info('test super table max bytes per row 65527') + tdLog.info('test super table max bytes per row 65531') sql = "create table stable_5(ts timestamp, " for i in range(500): sql += "int_%d int, " % (i + 1) @@ -655,7 +655,7 @@ class TDTestCase: sql += "nchar_%d nchar(20), " % (i + 1) for i in range(3800,4090): sql += "binary_%d binary(34), " % (i + 1) - sql += "col4091 binary(14114))" + sql += "col4091 binary(14118))" sql += " tags (loc nchar(10),tag_1 int,tag_2 int,tag_3 int) " tdSql.error(sql) @@ -686,7 +686,7 @@ class TDTestCase: sql = "alter table stable_1 add tag max int; " tdSql.error(sql) # TD-5324 - sql = "alter table stable_4 modify column col4091 binary(14114); " + sql = "alter table stable_4 modify column col4091 binary(14118); " tdSql.error(sql) sql = "alter table stable_4 modify tag loc nchar(20); " tdSql.query("select * from table_40") diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-error-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-error-stmt.json index 6e2b66c60e2d29b767038e58acf5e0e9b188bae4..ce3f04fdad35f3e1e10bba69739c6b422045c651 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-error-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-error-stmt.json @@ -54,7 +54,7 @@ "sample_format": "csv", "sample_file": "./sample.csv", "tags_file": "", - "columns": [{"type": "BINARY", "len": 65514, "count":1}], + "columns": [{"type": "BINARY", "len": 65518, "count":1}], "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] }, { @@ -80,7 +80,7 @@ "sample_format": "csv", "sample_file": "./sample.csv", "tags_file": "", - "columns": [{"type": "BINARY", "len": 21831, "count":3},{"type": "INT","count":2},{"type": "TINYINT"}], + "columns": [{"type": "BINARY", "len": 21831, "count":3},{"type": "INT","count":3},{"type": "TINYINT"}], "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] }] }] diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertShell.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertShell.py index 9b64a5272ddc74f0b165ea6744362d24475ae40a..7bfc72c08cfe2a2e4204da6851c6d9993ccb60e8 100644 --- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertShell.py +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertShell.py @@ -213,18 +213,29 @@ class TDTestCase: tdSql.query("select count(*) from `test.0`") tdSql.checkData(0, 0, 100) + # max valid length - row + sql = "%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(16370\) \ + -w 40 -T 8 -i 10 -S 1000 -r 48 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I taosc" % (binPath, cfgPath) + tdLog.info("%s" % sql) + assert os.system("%s" % sql) == 0 + # taosdemo error - # too max length - sql = "%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(16379\) \ - -w 40 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I taosc" % (binPath, - cfgPath) + # # too max length - column + sql = "%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b NCHAR\(16380\) \ + -w 40 -T 8 -i 10 -S 1000 -r 48 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I taosc" % (binPath, cfgPath) + tdLog.info("%s" % sql) + assert os.system("%s" % sql) != 0 + + # too max length - row + sql = "%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(16371\) \ + -w 40 -T 8 -i 10 -S 1000 -r 48 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I taosc" % (binPath, cfgPath) tdLog.info("%s" % sql) assert os.system("%s" % sql) != 0 + # error password sql = "%s -u root -c %s -h localhost -P 6030 -p123 -d db1 -a 1 -l 10 -b float,int,NCHAR\(40\) \ - -w 40 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt" % (binPath, - cfgPath) + -w 40 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt" % (binPath, cfgPath) tdLog.info("%s" % sql) assert os.system("%s" % sql) != 0 diff --git a/tests/robust/robust.c b/tests/robust/robust.c index 0e3d01971df23d7d9c355b2561f6975e04dc0110..111acfa39b4ddd8e2749a5ba1878bd1fc64af707 100644 --- a/tests/robust/robust.c +++ b/tests/robust/robust.c @@ -195,7 +195,7 @@ void insertImp(void *param) { for (int j = 0; j < arguments.table; j++) { sqlLen += sprintf(sql + sqlLen, " s%d_%d values (%ld, %d, %d, %d)", i, j, time, rand(), rand(), rand()); count++; - if ( (1048576 - sqlLen) < 65527 || i == (pThread->threadId * arguments.stable / arguments.client - 1)) { + if ( (1048576 - sqlLen) < 65531 || i == (pThread->threadId * arguments.stable / arguments.client - 1)) { result = taos_query(pThread->taos, sql); printf("Thread %d already insert %d rows\n", pThread->threadId, count); if (result == NULL || taos_errno(result) != 0) { diff --git a/tests/script/general/compute/cast_query1.sim b/tests/script/general/compute/cast_query1.sim index 4bc7af7941b8fd9104a59b053d29ad4a0fa8cc5e..c19fc6161ba9bc93c99df8579cb0a4cf74ad42ee 100644 --- a/tests/script/general/compute/cast_query1.sim +++ b/tests/script/general/compute/cast_query1.sim @@ -13,8 +13,8 @@ sql_error select cast(* as bigint) as a from tb1; sql_error select cast(* as bigint) + 1 as a from tb1; sql_error select cast(tb1.* as bigint) + 1 as a from tb1; sql_error select cast(* as bigint) from tb1; -sql_error select cast(c1 as binary(16384)) from tb1; -sql_error select cast(c1 as nchar(16384)) from tb1; +sql_error select cast(c1 as binary(65518)) from tb1; +sql_error select cast(c1 as nchar(16380)) from tb1; sql_error select cast(c1 + c2 as bigint) from tb1; sql_error select cast(13 as binary(0)) from tb1; sql_error select cast(12 as binary(-1)) from tb1; diff --git a/tests/system-test/5-taos-tools/taosbenchmark/stmt/insertBinaryLenLarge16374AllcolLar49151-error-stmt.json b/tests/system-test/5-taos-tools/taosbenchmark/stmt/insertBinaryLenLarge16374AllcolLar49151-error-stmt.json index 6e2b66c60e2d29b767038e58acf5e0e9b188bae4..98146d0d2f441020e004533cb83f6b6a5ff2b146 100644 --- a/tests/system-test/5-taos-tools/taosbenchmark/stmt/insertBinaryLenLarge16374AllcolLar49151-error-stmt.json +++ b/tests/system-test/5-taos-tools/taosbenchmark/stmt/insertBinaryLenLarge16374AllcolLar49151-error-stmt.json @@ -54,7 +54,7 @@ "sample_format": "csv", "sample_file": "./sample.csv", "tags_file": "", - "columns": [{"type": "BINARY", "len": 65514, "count":1}], + "columns": [{"type": "BINARY", "len": 65518, "count":1}], "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] }, { @@ -81,7 +81,7 @@ "sample_file": "./sample.csv", "tags_file": "", "columns": [{"type": "BINARY", "len": 21831, "count":3},{"type": "INT","count":2},{"type": "TINYINT"}], - "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + "tags": [{"type": "TINYINT", "count":3}, {"type": "BINARY", "len": 16, "count":5}] }] }] } diff --git a/tests/system-test/5-taos-tools/taosbenchmark/taosdemoTestInsertShell.py b/tests/system-test/5-taos-tools/taosbenchmark/taosdemoTestInsertShell.py index 25bbc871639a2153cc5981c6e3642d18345d316f..7bfc72c08cfe2a2e4204da6851c6d9993ccb60e8 100644 --- a/tests/system-test/5-taos-tools/taosbenchmark/taosdemoTestInsertShell.py +++ b/tests/system-test/5-taos-tools/taosbenchmark/taosdemoTestInsertShell.py @@ -24,40 +24,41 @@ class TDTestCase: tdLog.debug("start to execute %s" % __file__) tdSql.init(conn.cursor(), logSql) - def getBuildPath(self): + def getPath(self, tool="taosBenchmark"): selfPath = os.path.dirname(os.path.realpath(__file__)) global cfgPath if ("community" in selfPath): projPath = selfPath[:selfPath.find("community")] cfgPath = projPath + "/community/sim/dnode1/cfg" - else: projPath = selfPath[:selfPath.find("tests")] cfgPath = projPath + "/sim/dnode1/cfg" + paths = [] for root, dirs, files in os.walk(projPath): - if ("taosd" in files): + if ((tool) in files): rootRealPath = os.path.dirname(os.path.realpath(root)) if ("packaging" not in rootRealPath): - buildPath = root[:len(root)-len("/build/bin")] + paths.append(os.path.join(root, tool)) break - return buildPath + return paths[0] # def checkGerData(): def run(self): - buildPath = self.getBuildPath() - print("%s" % cfgPath ) - if (buildPath == ""): - tdLog.exit("taosd not found!") + binPath = self.getPath("taosBenchmark") + print("%s" % cfgPath) + if (binPath == ""): + tdLog.exit("taosBenchmark not found!") else: - tdLog.info("taosd found in %s" % buildPath) - binPath = buildPath+ "/build/bin/" + tdLog.info("taosBenchmark found in %s" % binPath) tdLog.info("create super table") - # create super table - os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096 \ - -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath)) + # create super table + os.system( + "%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096 \ + -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % + (binPath, cfgPath)) tdSql.execute("use db1") tdSql.query("describe meters;") tdSql.checkRows(13) @@ -68,12 +69,13 @@ class TDTestCase: tdSql.query("select count(*) from `test.0`") tdSql.checkData(0, 0, 100) - tdLog.info("create general table -N ") tdSql.execute("drop database db1;") - # create general table -N - os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096 \ - -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -N " % (binPath,cfgPath)) + # create general table -N + os.system( + "%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096 \ + -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -N " % + (binPath, cfgPath)) tdSql.execute("use db1") tdSql.query("describe `test.0`;") tdSql.checkRows(11) @@ -85,8 +87,10 @@ class TDTestCase: tdLog.info("use diffrent interface stmt") tdSql.execute("drop database db1;") # use diffrent interface-stmt - os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,BINARY\(4000\) -w 40 \ - -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt " % (binPath,cfgPath)) + os.system( + "%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,BINARY\(4000\) -w 40 \ + -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt " % + (binPath, cfgPath)) tdSql.execute("use db1") tdSql.query("select count(*) from meters") tdSql.checkData(0, 0, 1000) @@ -98,8 +102,10 @@ class TDTestCase: tdLog.info("use diffrent interface rest") tdSql.execute("drop database db1;") # use diffrent interface -rest - os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4097 \ - -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I rest " % (binPath,cfgPath)) + os.system( + "%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4097 \ + -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I rest " % + (binPath, cfgPath)) tdSql.execute("use db1") tdSql.query("select count(*) from meters") tdSql.checkData(0, 0, 1000) @@ -111,8 +117,10 @@ class TDTestCase: tdLog.info("use diffrent interface sml") tdSql.execute("drop database db1;") # use diffrent interface-sml - os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 1024 \ - -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I sml " % (binPath,cfgPath)) + os.system( + "%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 1024 \ + -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I sml " % + (binPath, cfgPath)) tdSql.execute("use db1") tdSql.query("select count(*) from meters") tdSql.checkData(0, 0, 1000) @@ -122,9 +130,9 @@ class TDTestCase: tdLog.info("all data type") tdSql.execute("drop database db1;") # all data type-taosc - os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 \ + os.system("%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 \ -b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY\(15\),NCHAR\(15\) -w 4096 \ - -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath)) + -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % (binPath, cfgPath)) tdSql.execute("use db1") tdSql.query("select count(*) from meters") tdSql.checkData(0, 0, 1000) @@ -135,9 +143,9 @@ class TDTestCase: tdLog.info("all data type") tdSql.execute("drop database db1;") # all data type-stmt - os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 \ + os.system("%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 \ -b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY\(15\),NCHAR\(15\) -w 4096 \ - -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt " % (binPath,cfgPath)) + -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt " % (binPath, cfgPath)) tdSql.execute("use db1") tdSql.query("select count(*) from meters") tdSql.checkData(0, 0, 1000) @@ -147,9 +155,9 @@ class TDTestCase: tdSql.checkData(0, 0, 100) # all data type-rest - os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 \ + os.system("%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 \ -b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY\(15\),NCHAR\(15\) -w 4096 \ - -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I rest " % (binPath,cfgPath)) + -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I rest " % (binPath, cfgPath)) tdSql.execute("use db1") tdSql.query("select count(*) from meters") tdSql.checkData(0, 0, 1000) @@ -159,7 +167,7 @@ class TDTestCase: tdSql.checkData(0, 0, 100) # # all data type-rest - # os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 \ + # os.system("%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 \ # -b INT,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY\(15\),NCHAR\(15\) -w 4096 \ # -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I sml " % (binPath,cfgPath)) # tdSql.execute("use db1") @@ -172,10 +180,10 @@ class TDTestCase: tdLog.info("all data type and interlace rows") tdSql.execute("drop database db1;") - # all data type - os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db3 -a 1 -l 10\ + # all data type + os.system("%s -u root -c %s -h localhost -P 6030 -d db3 -a 1 -l 10\ -b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY\(15\),NCHAR\(15\) -w 4096\ - -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -B 1000 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath)) + -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -B 1000 -M -x -y -O 10 -R 100 -E -m test. " % (binPath, cfgPath)) tdSql.execute("use db3") tdSql.query("select count(*) from meters") tdSql.checkData(0, 0, 1000) @@ -185,14 +193,18 @@ class TDTestCase: tdSql.checkData(0, 0, 100) tdLog.info("all data type and too much para") - tdLog.info("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096 \ + tdLog.info( + "%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096 \ -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test.taosdemo -u root -c %s -h \ - localhost -P 6030 -d db1 -a 1 -l 100 -b float,int,NCHAR\(15\) -w 4096 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath,cfgPath)) + localhost -P 6030 -d db1 -a 1 -l 100 -b float,int,NCHAR\(15\) -w 4096 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % + (binPath, cfgPath, cfgPath)) tdSql.execute("drop database db3;") - # repeate parameters - os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096 \ + # repeate parameters + os.system( + "%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096 \ -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test.taosdemo -u root -c %s -h \ - localhost -P 6030 -d db1 -a 1 -l 100 -b float,int,NCHAR\(15\) -w 4096 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath,cfgPath)) + localhost -P 6030 -d db1 -a 1 -l 100 -b float,int,NCHAR\(15\) -w 4096 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % + (binPath, cfgPath, cfgPath)) tdSql.execute("use db1") tdSql.query("select count(*) from meters") tdSql.checkData(0, 0, 1000) @@ -201,23 +213,35 @@ class TDTestCase: tdSql.query("select count(*) from `test.0`") tdSql.checkData(0, 0, 100) + # max valid length - row + sql = "%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(16370\) \ + -w 40 -T 8 -i 10 -S 1000 -r 48 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I taosc" % (binPath, cfgPath) + tdLog.info("%s" % sql) + assert os.system("%s" % sql) == 0 + # taosdemo error - # too max length - sql = "%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(16379\) \ - -w 40 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I taosc" % (binPath,cfgPath) - tdLog.info("%s" % sql ) - assert os.system("%s" % sql ) != 0 - - # error password - sql = "%staosBenchmark -u root -c %s -h localhost -P 6030 -p123 -d db1 -a 1 -l 10 -b float,int,NCHAR\(40\) \ - -w 40 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt" % (binPath,cfgPath) - tdLog.info("%s" % sql ) - assert os.system("%s" % sql ) != 0 + # # too max length - column + sql = "%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b NCHAR\(16380\) \ + -w 40 -T 8 -i 10 -S 1000 -r 48 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I taosc" % (binPath, cfgPath) + tdLog.info("%s" % sql) + assert os.system("%s" % sql) != 0 + + # too max length - row + sql = "%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(16371\) \ + -w 40 -T 8 -i 10 -S 1000 -r 48 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I taosc" % (binPath, cfgPath) + tdLog.info("%s" % sql) + assert os.system("%s" % sql) != 0 + + + # error password + sql = "%s -u root -c %s -h localhost -P 6030 -p123 -d db1 -a 1 -l 10 -b float,int,NCHAR\(40\) \ + -w 40 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt" % (binPath, cfgPath) + tdLog.info("%s" % sql) + assert os.system("%s" % sql) != 0 testcaseFilename = os.path.split(__file__)[-1] os.system("rm -rf ./insert_res*.txt*") - os.system("rm -rf tools/taosdemoAllTest/%s.sql" % testcaseFilename ) - + os.system("rm -rf tools/taosdemoAllTest/%s.sql" % testcaseFilename) def stop(self): tdSql.close()