From 2307d8ef2531312c8e01cb73449a659fec209185 Mon Sep 17 00:00:00 2001 From: Wizzer Date: Tue, 16 Mar 2021 17:57:04 +0800 Subject: [PATCH 01/52] fix: jdbc connector RestfulResultSet.getString NPE --- .../src/main/java/com/taosdata/jdbc/rs/RestfulResultSet.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulResultSet.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulResultSet.java index 30081a63c3..0cbb40dbb6 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulResultSet.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulResultSet.java @@ -136,7 +136,8 @@ public class RestfulResultSet extends AbstractResultSet implements ResultSet { throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_PARAMETER_INDEX_OUT_RANGE, "Column Index out of range, " + columnIndex + " > " + resultSet.get(pos).size()); columnIndex = getTrueColumnIndex(columnIndex); - return resultSet.get(pos).get(columnIndex).toString(); + Object value = resultSet.get(pos).get(columnIndex); + return value == null ? null : value.toString(); } @Override From 608134c2297c62f4ad5fb60b5d5e21818874b03a Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Wed, 17 Mar 2021 12:38:43 +0800 Subject: [PATCH 02/52] [TD-3198]sync test case file --- tests/pytest/fulltest.sh | 129 +++++--- tests/pytest/pytest_1.sh | 138 -------- tests/pytest/pytest_2.sh | 16 - tests/pytest/pytest_3.sh | 92 ------ tests/pytest/pytest_4.sh | 39 --- tests/script/jenkins/basic.txt | 546 ++++++++++++++++--------------- tests/script/jenkins/basic_1.txt | 85 ----- tests/script/jenkins/basic_2.txt | 74 ----- tests/script/jenkins/basic_3.txt | 58 ---- tests/script/jenkins/basic_4.txt | 46 --- tests/script/jenkins/basic_5.txt | 19 -- tests/script/jenkins/basic_6.txt | 37 --- tests/script/jenkins/basic_7.txt | 83 ----- tests/test-all.sh | 66 ++-- 14 files changed, 400 insertions(+), 1028 deletions(-) delete mode 100755 tests/pytest/pytest_1.sh delete mode 100755 tests/pytest/pytest_2.sh delete mode 100755 tests/pytest/pytest_3.sh delete mode 100755 tests/pytest/pytest_4.sh delete mode 100644 tests/script/jenkins/basic_1.txt delete mode 100644 tests/script/jenkins/basic_2.txt delete mode 100644 tests/script/jenkins/basic_3.txt delete mode 100644 tests/script/jenkins/basic_4.txt delete mode 100644 tests/script/jenkins/basic_5.txt delete mode 100644 tests/script/jenkins/basic_6.txt delete mode 100644 tests/script/jenkins/basic_7.txt diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index d830d96865..506d469b2f 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -1,18 +1,15 @@ #!/bin/bash ulimit -c unlimited +#======================p1-start=============== python3 ./test.py -f insert/basic.py python3 ./test.py -f insert/int.py -python3 ./test.py -f insert/unsignedInt.py python3 ./test.py -f insert/float.py python3 ./test.py -f insert/bigint.py -python3 ./test.py -f insert/unsignedBigint.py python3 ./test.py -f insert/bool.py python3 ./test.py -f insert/double.py python3 ./test.py -f insert/smallint.py -python3 ./test.py -f insert/unsignedSmallint.py python3 ./test.py -f insert/tinyint.py -python3 ./test.py -f insert/unsignedTinyint.py python3 ./test.py -f insert/date.py python3 ./test.py -f insert/binary.py python3 ./test.py -f insert/nchar.py @@ -23,10 +20,8 @@ python3 ./test.py -f insert/randomNullCommit.py python3 insert/retentionpolicy.py python3 ./test.py -f insert/alterTableAndInsert.py python3 ./test.py -f insert/insertIntoTwoTables.py -#python3 ./test.py -f insert/before_1970.py -python3 ./test.py -f insert/metadataUpdate.py +python3 ./test.py -f insert/before_1970.py python3 bug2265.py -python3 ./test.py -f insert/boundary2.py #table python3 ./test.py -f table/alter_wal0.py @@ -71,7 +66,7 @@ python3 ./test.py -f tag_lite/int.py python3 ./test.py -f tag_lite/set.py python3 ./test.py -f tag_lite/smallint.py python3 ./test.py -f tag_lite/tinyint.py -python3 ./test.py -f tag_lite/alter_tag.py + #python3 ./test.py -f dbmgmt/database-name-boundary.py python3 ./test.py -f import_merge/importBlock1HO.py @@ -142,6 +137,27 @@ python3 ./test.py -f import_merge/importTPORestart.py python3 ./test.py -f import_merge/importTRestart.py python3 ./test.py -f import_merge/importInsertThenImport.py python3 ./test.py -f import_merge/importCSV.py +#======================p1-end=============== +#======================p2-start=============== +# update +python3 ./test.py -f update/allow_update.py +python3 ./test.py -f update/allow_update-0.py +python3 ./test.py -f update/append_commit_data.py +python3 ./test.py -f update/append_commit_last-0.py +python3 ./test.py -f update/append_commit_last.py +python3 ./test.py -f update/merge_commit_data.py + +python3 ./test.py -f update/merge_commit_data2.py +python3 ./test.py -f update/merge_commit_data2_update0.py +python3 ./test.py -f update/merge_commit_last-0.py +python3 ./test.py -f update/merge_commit_last.py +python3 ./test.py -f update/bug_td2279.py + +#======================p2-end=============== +#======================p3-start=============== + +python3 ./test.py -f insert/randomNullCommit.py + # user python3 ./test.py -f user/user_create.py python3 ./test.py -f user/pass_len.py @@ -155,7 +171,6 @@ python3 ./test.py -f query/filterCombo.py python3 ./test.py -f query/queryNormal.py python3 ./test.py -f query/queryError.py python3 ./test.py -f query/filterAllIntTypes.py -python3 ./test.py -f query/filterAllUnsignedIntTypes.py python3 ./test.py -f query/filterFloatAndDouble.py python3 ./test.py -f query/filterOtherTypes.py python3 ./test.py -f query/querySort.py @@ -182,8 +197,6 @@ python3 ./test.py -f query/bug2119.py python3 ./test.py -f query/isNullTest.py python3 ./test.py -f query/queryWithTaosdKilled.py python3 ./test.py -f query/floatCompare.py -python3 ./test.py -f query/queryGroupbySort.py -python3 ./test.py -f query/queryBetweenAnd.py #stream python3 ./test.py -f stream/metric_1.py @@ -199,8 +212,6 @@ python3 ./test.py -f stream/table_n.py #alter table python3 ./test.py -f alter/alter_table_crash.py -python3 ./test.py -f alter/alter_table.py -python3 ./test.py -f alter/alter_debugFlag.py # client python3 ./test.py -f client/client.py @@ -213,6 +224,36 @@ python3 testCompress.py python3 testNoCompress.py python3 testMinTablesPerVnode.py + +python3 queryCount.py +python3 ./test.py -f query/queryGroupbyWithInterval.py +python3 client/twoClients.py +python3 test.py -f query/queryInterval.py +python3 test.py -f query/queryFillTest.py + +# tools +python3 test.py -f tools/lowaTest.py +python3 test.py -f tools/taosdemoTest.py +python3 test.py -f tools/taosdemoTestWithoutMetric.py +python3 test.py -f tools/taosdemoTestLimitOffset.py +python3 test.py -f tools/taosdumpTest.py +python3 test.py -f tools/taosdemoTest2.py + +# subscribe +python3 test.py -f subscribe/singlemeter.py +#python3 test.py -f subscribe/stability.py +python3 test.py -f subscribe/supertable.py + + +#======================p3-end=============== +#======================p4-start=============== + +python3 ./test.py -f update/merge_commit_data-0.py +# wal +python3 ./test.py -f wal/addOldWalTest.py + +# function +python3 ./test.py -f functions/all_null_value.py # functions python3 ./test.py -f functions/function_avg.py -r 1 python3 ./test.py -f functions/function_bottom.py -r 1 @@ -232,46 +273,26 @@ python3 ./test.py -f functions/function_sum.py -r 1 python3 ./test.py -f functions/function_top.py -r 1 python3 ./test.py -f functions/function_twa.py -r 1 python3 ./test.py -f functions/function_twa_test2.py -python3 ./test.py -f functions/all_null_value.py -python3 ./test.py -f functions/function_percentile2.py -python3 queryCount.py -python3 ./test.py -f query/queryGroupbyWithInterval.py -python3 client/twoClients.py -python3 ./test.py -f query/queryInterval.py -python3 ./test.py -f query/queryFillTest.py -python3 ./test.py -f query/last_row_cache.py +python3 ./test.py -f functions/function_stddev_td2555.py +python3 ./test.py -f insert/metadataUpdate.py +python3 ./test.py -f tools/taosdemoTest2.py python3 ./test.py -f query/last_cache.py - -# tools -python3 test.py -f tools/taosdumpTest.py -python3 test.py -f tools/lowaTest.py -python3 test.py -f tools/taosdemoTest.py -python3 test.py -f tools/taosdemoTest2.py -python3 test.py -f tools/taosdemoTestWithoutMetric.py -python3 test.py -f tools/taosdemoTestLimitOffset.py - -# subscribe -python3 test.py -f subscribe/singlemeter.py -#python3 test.py -f subscribe/stability.py -python3 test.py -f subscribe/supertable.py - - -# update -python3 ./test.py -f update/allow_update.py -python3 ./test.py -f update/allow_update-0.py -python3 ./test.py -f update/append_commit_data.py -python3 ./test.py -f update/append_commit_last-0.py -python3 ./test.py -f update/append_commit_last.py -python3 ./test.py -f update/merge_commit_data.py -python3 ./test.py -f update/merge_commit_data-0.py -python3 ./test.py -f update/merge_commit_data2.py -python3 ./test.py -f update/merge_commit_data2_update0.py -python3 ./test.py -f update/merge_commit_last-0.py -python3 ./test.py -f update/merge_commit_last.py -python3 ./test.py -f update/bug_td2279.py - -# wal -python3 ./test.py -f wal/addOldWalTest.py - -# account +python3 ./test.py -f query/last_row_cache.py python3 ./test.py -f account/account_create.py +python3 ./test.py -f alter/alter_table.py +python3 ./test.py -f query/queryGroupbySort.py + +python3 ./test.py -f insert/unsignedInt.py +python3 ./test.py -f insert/unsignedBigint.py +python3 ./test.py -f insert/unsignedSmallint.py +python3 ./test.py -f insert/unsignedTinyint.py +python3 ./test.py -f query/filterAllUnsignedIntTypes.py + +python3 ./test.py -f functions/function_percentile2.py +python3 ./test.py -f insert/boundary2.py +python3 ./test.py -f query/queryFillTest.py +python3 ./test.py -f alter/alter_debugFlag.py +python3 ./test.py -f query/queryBetweenAnd.py +python3 ./test.py -f tag_lite/alter_tag.py + +#======================p4-end=============== \ No newline at end of file diff --git a/tests/pytest/pytest_1.sh b/tests/pytest/pytest_1.sh deleted file mode 100755 index e6638cbb17..0000000000 --- a/tests/pytest/pytest_1.sh +++ /dev/null @@ -1,138 +0,0 @@ -#!/bin/bash -ulimit -c unlimited - -python3 ./test.py -f insert/basic.py -python3 ./test.py -f insert/int.py -python3 ./test.py -f insert/float.py -python3 ./test.py -f insert/bigint.py -python3 ./test.py -f insert/bool.py -python3 ./test.py -f insert/double.py -python3 ./test.py -f insert/smallint.py -python3 ./test.py -f insert/tinyint.py -python3 ./test.py -f insert/date.py -python3 ./test.py -f insert/binary.py -python3 ./test.py -f insert/nchar.py -#python3 ./test.py -f insert/nchar-boundary.py -python3 ./test.py -f insert/nchar-unicode.py -python3 ./test.py -f insert/multi.py -python3 ./test.py -f insert/randomNullCommit.py -python3 insert/retentionpolicy.py -python3 ./test.py -f insert/alterTableAndInsert.py -python3 ./test.py -f insert/insertIntoTwoTables.py -python3 ./test.py -f insert/before_1970.py -python3 bug2265.py - -#table -python3 ./test.py -f table/alter_wal0.py -python3 ./test.py -f table/column_name.py -python3 ./test.py -f table/column_num.py -python3 ./test.py -f table/db_table.py -python3 ./test.py -f table/create_sensitive.py -#python3 ./test.py -f table/tablename-boundary.py -python3 ./test.py -f table/max_table_length.py -python3 ./test.py -f table/alter_column.py -python3 ./test.py -f table/boundary.py -python3 ./test.py -f table/create.py -python3 ./test.py -f table/del_stable.py - - -# tag -python3 ./test.py -f tag_lite/filter.py -python3 ./test.py -f tag_lite/create-tags-boundary.py -python3 ./test.py -f tag_lite/3.py -python3 ./test.py -f tag_lite/4.py -python3 ./test.py -f tag_lite/5.py -python3 ./test.py -f tag_lite/6.py -python3 ./test.py -f tag_lite/add.py -python3 ./test.py -f tag_lite/bigint.py -python3 ./test.py -f tag_lite/binary_binary.py -python3 ./test.py -f tag_lite/binary.py -python3 ./test.py -f tag_lite/bool_binary.py -python3 ./test.py -f tag_lite/bool_int.py -python3 ./test.py -f tag_lite/bool.py -python3 ./test.py -f tag_lite/change.py -python3 ./test.py -f tag_lite/column.py -python3 ./test.py -f tag_lite/commit.py -python3 ./test.py -f tag_lite/create.py -python3 ./test.py -f tag_lite/datatype.py -python3 ./test.py -f tag_lite/datatype-without-alter.py -python3 ./test.py -f tag_lite/delete.py -python3 ./test.py -f tag_lite/double.py -python3 ./test.py -f tag_lite/float.py -python3 ./test.py -f tag_lite/int_binary.py -python3 ./test.py -f tag_lite/int_float.py -python3 ./test.py -f tag_lite/int.py -python3 ./test.py -f tag_lite/set.py -python3 ./test.py -f tag_lite/smallint.py -python3 ./test.py -f tag_lite/tinyint.py - -#python3 ./test.py -f dbmgmt/database-name-boundary.py - -python3 ./test.py -f import_merge/importBlock1HO.py -python3 ./test.py -f import_merge/importBlock1HPO.py -python3 ./test.py -f import_merge/importBlock1H.py -python3 ./test.py -f import_merge/importBlock1S.py -python3 ./test.py -f import_merge/importBlock1Sub.py -python3 ./test.py -f import_merge/importBlock1TO.py -python3 ./test.py -f import_merge/importBlock1TPO.py -python3 ./test.py -f import_merge/importBlock1T.py -python3 ./test.py -f import_merge/importBlock2HO.py -python3 ./test.py -f import_merge/importBlock2HPO.py -python3 ./test.py -f import_merge/importBlock2H.py -python3 ./test.py -f import_merge/importBlock2S.py -python3 ./test.py -f import_merge/importBlock2Sub.py -python3 ./test.py -f import_merge/importBlock2TO.py -python3 ./test.py -f import_merge/importBlock2TPO.py -python3 ./test.py -f import_merge/importBlock2T.py -python3 ./test.py -f import_merge/importBlockbetween.py -python3 ./test.py -f import_merge/importCacheFileHO.py -python3 ./test.py -f import_merge/importCacheFileHPO.py -python3 ./test.py -f import_merge/importCacheFileH.py -python3 ./test.py -f import_merge/importCacheFileS.py -python3 ./test.py -f import_merge/importCacheFileSub.py -python3 ./test.py -f import_merge/importCacheFileTO.py -python3 ./test.py -f import_merge/importCacheFileTPO.py -python3 ./test.py -f import_merge/importCacheFileT.py -python3 ./test.py -f import_merge/importDataH2.py -python3 ./test.py -f import_merge/importDataHO2.py -python3 ./test.py -f import_merge/importDataHO.py -python3 ./test.py -f import_merge/importDataHPO.py -python3 ./test.py -f import_merge/importDataLastHO.py -python3 ./test.py -f import_merge/importDataLastHPO.py -python3 ./test.py -f import_merge/importDataLastH.py -python3 ./test.py -f import_merge/importDataLastS.py -python3 ./test.py -f import_merge/importDataLastSub.py -python3 ./test.py -f import_merge/importDataLastTO.py -python3 ./test.py -f import_merge/importDataLastTPO.py -python3 ./test.py -f import_merge/importDataLastT.py -python3 ./test.py -f import_merge/importDataS.py -python3 ./test.py -f import_merge/importDataSub.py -python3 ./test.py -f import_merge/importDataTO.py -python3 ./test.py -f import_merge/importDataTPO.py -python3 ./test.py -f import_merge/importDataT.py -python3 ./test.py -f import_merge/importHeadOverlap.py -python3 ./test.py -f import_merge/importHeadPartOverlap.py -python3 ./test.py -f import_merge/importHead.py -python3 ./test.py -f import_merge/importHORestart.py -python3 ./test.py -f import_merge/importHPORestart.py -python3 ./test.py -f import_merge/importHRestart.py -python3 ./test.py -f import_merge/importLastHO.py -python3 ./test.py -f import_merge/importLastHPO.py -python3 ./test.py -f import_merge/importLastH.py -python3 ./test.py -f import_merge/importLastS.py -python3 ./test.py -f import_merge/importLastSub.py -python3 ./test.py -f import_merge/importLastTO.py -python3 ./test.py -f import_merge/importLastTPO.py -python3 ./test.py -f import_merge/importLastT.py -python3 ./test.py -f import_merge/importSpan.py -python3 ./test.py -f import_merge/importSRestart.py -python3 ./test.py -f import_merge/importSubRestart.py -python3 ./test.py -f import_merge/importTailOverlap.py -python3 ./test.py -f import_merge/importTailPartOverlap.py -python3 ./test.py -f import_merge/importTail.py -python3 ./test.py -f import_merge/importToCommit.py -python3 ./test.py -f import_merge/importTORestart.py -python3 ./test.py -f import_merge/importTPORestart.py -python3 ./test.py -f import_merge/importTRestart.py -python3 ./test.py -f import_merge/importInsertThenImport.py -python3 ./test.py -f import_merge/importCSV.py \ No newline at end of file diff --git a/tests/pytest/pytest_2.sh b/tests/pytest/pytest_2.sh deleted file mode 100755 index d152ed85fb..0000000000 --- a/tests/pytest/pytest_2.sh +++ /dev/null @@ -1,16 +0,0 @@ - - -# update -python3 ./test.py -f update/allow_update.py -python3 ./test.py -f update/allow_update-0.py -python3 ./test.py -f update/append_commit_data.py -python3 ./test.py -f update/append_commit_last-0.py -python3 ./test.py -f update/append_commit_last.py -python3 ./test.py -f update/merge_commit_data.py - -python3 ./test.py -f update/merge_commit_data2.py -python3 ./test.py -f update/merge_commit_data2_update0.py -python3 ./test.py -f update/merge_commit_last-0.py -python3 ./test.py -f update/merge_commit_last.py -python3 ./test.py -f update/bug_td2279.py - diff --git a/tests/pytest/pytest_3.sh b/tests/pytest/pytest_3.sh deleted file mode 100755 index f2462154bc..0000000000 --- a/tests/pytest/pytest_3.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/bash -ulimit -c unlimited - - -python3 ./test.py -f insert/randomNullCommit.py - -# user -python3 ./test.py -f user/user_create.py -python3 ./test.py -f user/pass_len.py - -# stable -python3 ./test.py -f stable/query_after_reset.py - -#query -python3 ./test.py -f query/filter.py -python3 ./test.py -f query/filterCombo.py -python3 ./test.py -f query/queryNormal.py -python3 ./test.py -f query/queryError.py -python3 ./test.py -f query/filterAllIntTypes.py -python3 ./test.py -f query/filterFloatAndDouble.py -python3 ./test.py -f query/filterOtherTypes.py -python3 ./test.py -f query/querySort.py -python3 ./test.py -f query/queryJoin.py -python3 ./test.py -f query/select_last_crash.py -python3 ./test.py -f query/queryNullValueTest.py -python3 ./test.py -f query/queryInsertValue.py -python3 ./test.py -f query/queryConnection.py -python3 ./test.py -f query/queryCountCSVData.py -python3 ./test.py -f query/natualInterval.py -python3 ./test.py -f query/bug1471.py -#python3 ./test.py -f query/dataLossTest.py -python3 ./test.py -f query/bug1874.py -python3 ./test.py -f query/bug1875.py -python3 ./test.py -f query/bug1876.py -python3 ./test.py -f query/bug2218.py -python3 ./test.py -f query/bug2117.py -python3 ./test.py -f query/bug2118.py -python3 ./test.py -f query/bug2143.py -python3 ./test.py -f query/sliding.py -python3 ./test.py -f query/unionAllTest.py -python3 ./test.py -f query/bug2281.py -python3 ./test.py -f query/bug2119.py -python3 ./test.py -f query/isNullTest.py -python3 ./test.py -f query/queryWithTaosdKilled.py -python3 ./test.py -f query/floatCompare.py - -#stream -python3 ./test.py -f stream/metric_1.py -python3 ./test.py -f stream/metric_n.py -python3 ./test.py -f stream/new.py -python3 ./test.py -f stream/stream1.py -python3 ./test.py -f stream/stream2.py -#python3 ./test.py -f stream/parser.py -python3 ./test.py -f stream/history.py -python3 ./test.py -f stream/sys.py -python3 ./test.py -f stream/table_1.py -python3 ./test.py -f stream/table_n.py - -#alter table -python3 ./test.py -f alter/alter_table_crash.py - -# client -python3 ./test.py -f client/client.py -python3 ./test.py -f client/version.py -python3 ./test.py -f client/alterDatabase.py -python3 ./test.py -f client/noConnectionErrorTest.py - -# Misc -python3 testCompress.py -python3 testNoCompress.py -python3 testMinTablesPerVnode.py - - -python3 queryCount.py -python3 ./test.py -f query/queryGroupbyWithInterval.py -python3 client/twoClients.py -python3 test.py -f query/queryInterval.py -python3 test.py -f query/queryFillTest.py - -# tools -python3 test.py -f tools/lowaTest.py -python3 test.py -f tools/taosdemoTest.py -python3 test.py -f tools/taosdemoTestWithoutMetric.py -python3 test.py -f tools/taosdemoTestLimitOffset.py -python3 test.py -f tools/taosdumpTest.py -#python3 test.py -f tools/taosdemoTest2.py - -# subscribe -python3 test.py -f subscribe/singlemeter.py -#python3 test.py -f subscribe/stability.py -python3 test.py -f subscribe/supertable.py - diff --git a/tests/pytest/pytest_4.sh b/tests/pytest/pytest_4.sh deleted file mode 100755 index dada90c709..0000000000 --- a/tests/pytest/pytest_4.sh +++ /dev/null @@ -1,39 +0,0 @@ -python3 ./test.py -f update/merge_commit_data-0.py -# wal -python3 ./test.py -f wal/addOldWalTest.py - -# function -python3 ./test.py -f functions/all_null_value.py -# functions -python3 ./test.py -f functions/function_avg.py -r 1 -python3 ./test.py -f functions/function_bottom.py -r 1 -python3 ./test.py -f functions/function_count.py -r 1 -python3 ./test.py -f functions/function_diff.py -r 1 -python3 ./test.py -f functions/function_first.py -r 1 -python3 ./test.py -f functions/function_last.py -r 1 -python3 ./test.py -f functions/function_last_row.py -r 1 -python3 ./test.py -f functions/function_leastsquares.py -r 1 -python3 ./test.py -f functions/function_max.py -r 1 -python3 ./test.py -f functions/function_min.py -r 1 -python3 ./test.py -f functions/function_operations.py -r 1 -python3 ./test.py -f functions/function_percentile.py -r 1 -python3 ./test.py -f functions/function_spread.py -r 1 -python3 ./test.py -f functions/function_stddev.py -r 1 -python3 ./test.py -f functions/function_sum.py -r 1 -python3 ./test.py -f functions/function_top.py -r 1 -python3 ./test.py -f functions/function_twa.py -r 1 -python3 ./test.py -f functions/function_twa_test2.py -python3 ./test.py -f functions/function_stddev_td2555.py -python3 ./test.py -f insert/metadataUpdate.py -python3 ./test.py -f tools/taosdemoTest2.py -python3 ./test.py -f query/last_cache.py -python3 ./test.py -f query/last_row_cache.py -python3 ./test.py -f account/account_create.py -python3 ./test.py -f alter/alter_table.py -python3 ./test.py -f query/queryGroupbySort.py - -python3 ./test.py -f insert/unsignedInt.py -python3 ./test.py -f insert/unsignedBigint.py -python3 ./test.py -f insert/unsignedSmallint.py -python3 ./test.py -f insert/unsignedTinyint.py -python3 ./test.py -f query/filterAllUnsignedIntTypes.py \ No newline at end of file diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index fc56e34dca..d0bd7179e5 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -1,76 +1,7 @@ cd ../../../debug; cmake .. cd ../../../debug; make -./test.sh -f issue/TD-2677.sim -./test.sh -f issue/TD-2680.sim -./test.sh -f issue/TD-2713.sim - -./test.sh -f general/alter/cached_schema_after_alter.sim -./test.sh -f general/alter/count.sim -./test.sh -f general/alter/dnode.sim -./test.sh -f general/alter/import.sim -./test.sh -f general/alter/insert1.sim -./test.sh -f general/alter/insert2.sim -./test.sh -f general/alter/metrics.sim -./test.sh -f general/alter/table.sim - -./test.sh -f general/cache/new_metrics.sim -./test.sh -f general/cache/restart_metrics.sim -./test.sh -f general/cache/restart_table.sim - -./test.sh -f general/connection/connection.sim - -./test.sh -f general/column/commit.sim -./test.sh -f general/column/metrics.sim -./test.sh -f general/column/table.sim - -./test.sh -f general/compress/commitlog.sim -./test.sh -f general/compress/compress.sim -./test.sh -f general/compress/compress2.sim -./test.sh -f general/compress/uncompress.sim - -./test.sh -f general/compute/avg.sim -./test.sh -f general/compute/bottom.sim -./test.sh -f general/compute/count.sim -./test.sh -f general/compute/diff.sim -./test.sh -f general/compute/diff2.sim -./test.sh -f general/compute/first.sim -./test.sh -f general/compute/interval.sim -./test.sh -f general/compute/last.sim -./test.sh -f general/compute/leastsquare.sim -./test.sh -f general/compute/max.sim -./test.sh -f general/compute/min.sim -./test.sh -f general/compute/null.sim -./test.sh -f general/compute/percentile.sim -./test.sh -f general/compute/stddev.sim -./test.sh -f general/compute/sum.sim -./test.sh -f general/compute/top.sim - -./test.sh -f general/db/alter_option.sim -./test.sh -f general/db/alter_tables_d2.sim -./test.sh -f general/db/alter_tables_v1.sim -./test.sh -f general/db/alter_tables_v4.sim -./test.sh -f general/db/alter_vgroups.sim -./test.sh -f general/db/basic.sim -./test.sh -f general/db/basic1.sim -./test.sh -f general/db/basic2.sim -./test.sh -f general/db/basic3.sim -./test.sh -f general/db/basic4.sim -./test.sh -f general/db/basic5.sim -./test.sh -f general/db/delete_reuse1.sim -./test.sh -f general/db/delete_reuse2.sim -./test.sh -f general/db/delete_reusevnode.sim -./test.sh -f general/db/delete_reusevnode2.sim -./test.sh -f general/db/delete_writing1.sim -./test.sh -f general/db/delete_writing2.sim -./test.sh -f general/db/delete.sim -./test.sh -f general/db/len.sim -./test.sh -f general/db/repeat.sim -./test.sh -f general/db/tables.sim -./test.sh -f general/db/vnodes.sim -./test.sh -f general/db/topic1.sim -./test.sh -f general/db/topic2.sim -./test.sh -f general/db/nosuchfile.sim +#======================s1-start=============== ./test.sh -f general/field/2.sim ./test.sh -f general/field/3.sim @@ -96,11 +27,6 @@ cd ../../../debug; make ./test.sh -f general/http/grafana_bug.sim ./test.sh -f general/http/grafana.sim -./test.sh -f general/import/basic.sim -./test.sh -f general/import/commit.sim -./test.sh -f general/import/large.sim -./test.sh -f general/import/replica1.sim - ./test.sh -f general/insert/basic.sim ./test.sh -f general/insert/insert_drop.sim ./test.sh -f general/insert/query_block1_memory.sim @@ -160,8 +86,174 @@ cd ../../../debug; make ./test.sh -f general/parser/repeatAlter.sim ./test.sh -f general/parser/union.sim ./test.sh -f general/parser/topbot.sim +./test.sh -f general/db/nosuchfile.sim ./test.sh -f general/parser/function.sim -./test.sh -f general/parser/select_distinct_tag.sim + +#======================s1-end=============== +#======================s2-start=============== + +./test.sh -f general/tag/3.sim +./test.sh -f general/tag/4.sim +./test.sh -f general/tag/5.sim +./test.sh -f general/tag/6.sim +./test.sh -f general/tag/add.sim +./test.sh -f general/tag/bigint.sim +./test.sh -f general/tag/binary_binary.sim +./test.sh -f general/tag/binary.sim +./test.sh -f general/tag/bool_binary.sim +./test.sh -f general/tag/bool_int.sim +./test.sh -f general/tag/bool.sim +./test.sh -f general/tag/change.sim +./test.sh -f general/tag/column.sim +./test.sh -f general/tag/commit.sim +./test.sh -f general/tag/create.sim +./test.sh -f general/tag/delete.sim +./test.sh -f general/tag/double.sim +./test.sh -f general/tag/filter.sim +./test.sh -f general/tag/float.sim +./test.sh -f general/tag/int_binary.sim +./test.sh -f general/tag/int_float.sim +./test.sh -f general/tag/int.sim +./test.sh -f general/tag/set.sim +./test.sh -f general/tag/smallint.sim +./test.sh -f general/tag/tinyint.sim +./test.sh -f general/wal/sync.sim +./test.sh -f general/wal/kill.sim +./test.sh -f general/wal/maxtables.sim + +./test.sh -f general/user/authority.sim +./test.sh -f general/user/monitor.sim +./test.sh -f general/user/pass_alter.sim +./test.sh -f general/user/pass_len.sim +./test.sh -f general/user/user_create.sim +./test.sh -f general/user/user_len.sim + +./test.sh -f general/vector/metrics_field.sim +./test.sh -f general/vector/metrics_mix.sim +./test.sh -f general/vector/metrics_query.sim +./test.sh -f general/vector/metrics_tag.sim +./test.sh -f general/vector/metrics_time.sim +./test.sh -f general/vector/multi.sim +./test.sh -f general/vector/single.sim +./test.sh -f general/vector/table_field.sim +./test.sh -f general/vector/table_mix.sim +./test.sh -f general/vector/table_query.sim +./test.sh -f general/vector/table_time.sim + +./test.sh -f unique/account/account_create.sim +./test.sh -f unique/account/account_delete.sim +./test.sh -f unique/account/account_len.sim +./test.sh -f unique/account/authority.sim +./test.sh -f unique/account/basic.sim +./test.sh -f unique/account/paras.sim +./test.sh -f unique/account/pass_alter.sim +./test.sh -f unique/account/pass_len.sim +./test.sh -f unique/account/usage.sim +./test.sh -f unique/account/user_create.sim +./test.sh -f unique/account/user_len.sim + +./test.sh -f unique/big/balance.sim +./test.sh -f unique/big/maxvnodes.sim +./test.sh -f unique/big/tcp.sim + +./test.sh -f unique/cluster/alter.sim +./test.sh -f unique/cluster/balance1.sim +./test.sh -f unique/cluster/balance2.sim +./test.sh -f unique/cluster/balance3.sim +./test.sh -f unique/cluster/cache.sim +./test.sh -f unique/cluster/vgroup100.sim + +#======================s2-end=============== +#======================s3-start=============== + +./test.sh -f unique/arbitrator/check_cluster_cfg_para.sim +#./test.sh -f unique/arbitrator/dn2_mn1_cache_file_sync.sim +./test.sh -f unique/arbitrator/dn3_mn1_full_createTableFail.sim +./test.sh -f unique/arbitrator/dn3_mn1_multiCreateDropTable.sim +#./test.sh -f unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim +#./test.sh -f unique/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim +./test.sh -f unique/arbitrator/dn3_mn1_replica_change_dropDnod.sim +./test.sh -f unique/arbitrator/dn3_mn1_replica_change.sim +#./test.sh -f unique/arbitrator/dn3_mn1_stopDnode_timeout.sim +# lower the priority while file corruption +#./test.sh -f unique/arbitrator/dn3_mn1_vnode_change.sim +#./test.sh -f unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim +#./test.sh -f unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim +#./test.sh -f unique/arbitrator/dn3_mn1_vnode_createErrData_online.sim +./test.sh -f unique/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim +./test.sh -f unique/arbitrator/dn3_mn1_vnode_delDir.sim +./test.sh -f unique/arbitrator/dn3_mn1_r2_vnode_delDir.sim +./test.sh -f unique/arbitrator/dn3_mn1_r3_vnode_delDir.sim +./test.sh -f unique/arbitrator/dn3_mn1_vnode_nomaster.sim +./test.sh -f unique/arbitrator/dn3_mn2_killDnode.sim + +./test.sh -f unique/arbitrator/offline_replica2_alterTable_online.sim +./test.sh -f unique/arbitrator/offline_replica2_alterTag_online.sim +./test.sh -f unique/arbitrator/offline_replica2_createTable_online.sim +./test.sh -f unique/arbitrator/offline_replica2_dropDb_online.sim +./test.sh -f unique/arbitrator/offline_replica2_dropTable_online.sim +./test.sh -f unique/arbitrator/offline_replica3_alterTable_online.sim +./test.sh -f unique/arbitrator/offline_replica3_alterTag_online.sim +./test.sh -f unique/arbitrator/offline_replica3_createTable_online.sim +./test.sh -f unique/arbitrator/offline_replica3_dropDb_online.sim +./test.sh -f unique/arbitrator/offline_replica3_dropTable_online.sim +./test.sh -f unique/arbitrator/replica_changeWithArbitrator.sim +./test.sh -f unique/arbitrator/sync_replica2_alterTable_add.sim +./test.sh -f unique/arbitrator/sync_replica2_alterTable_drop.sim + +./test.sh -f unique/arbitrator/sync_replica2_dropDb.sim +./test.sh -f unique/arbitrator/sync_replica2_dropTable.sim +./test.sh -f unique/arbitrator/sync_replica3_alterTable_add.sim +./test.sh -f unique/arbitrator/sync_replica3_alterTable_drop.sim +./test.sh -f unique/arbitrator/sync_replica3_dropDb.sim +./test.sh -f unique/arbitrator/sync_replica3_dropTable.sim + +./test.sh -f unique/migrate/mn2_vn2_repl2_rmMnodeDir.sim +./test.sh -f unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim +./test.sh -f unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir_stopAll_starAll.sim +./test.sh -f unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim + +./test.sh -f unique/stable/balance_replica1.sim +./test.sh -f unique/stable/dnode2_stop.sim +./test.sh -f unique/stable/dnode2.sim +./test.sh -f unique/stable/dnode3.sim +./test.sh -f unique/stable/replica2_dnode4.sim +./test.sh -f unique/stable/replica2_vnode3.sim +./test.sh -f unique/stable/replica3_dnode6.sim +./test.sh -f unique/stable/replica3_vnode3.sim + +#======================s3-end=============== +#======================s4-start=============== + +./test.sh -f unique/http/admin.sim +./test.sh -f unique/http/opentsdb.sim + +./test.sh -f unique/import/replica2.sim +./test.sh -f unique/import/replica3.sim + +./test.sh -f general/alter/cached_schema_after_alter.sim +./test.sh -f general/alter/count.sim +./test.sh -f general/alter/dnode.sim +./test.sh -f general/alter/import.sim +./test.sh -f general/alter/insert1.sim +./test.sh -f general/alter/insert2.sim +./test.sh -f general/alter/metrics.sim +./test.sh -f general/alter/table.sim + +./test.sh -f general/cache/new_metrics.sim +./test.sh -f general/cache/restart_metrics.sim +./test.sh -f general/cache/restart_table.sim + +./test.sh -f general/connection/connection.sim + +./test.sh -f general/column/commit.sim +./test.sh -f general/column/metrics.sim +./test.sh -f general/column/table.sim + +./test.sh -f general/compress/commitlog.sim +./test.sh -f general/compress/compress.sim +./test.sh -f general/compress/compress2.sim +./test.sh -f general/compress/uncompress.sim ./test.sh -f general/stable/disk.sim ./test.sh -f general/stable/dnode3.sim @@ -171,6 +263,122 @@ cd ../../../debug; make ./test.sh -f general/stable/values.sim ./test.sh -f general/stable/vnode3.sim +./test.sh -f unique/column/replica3.sim +./test.sh -f issue/TD-2713.sim +./test.sh -f general/parser/select_distinct_tag.sim +./test.sh -f unique/mnode/mgmt30.sim +./test.sh -f issue/TD-2677.sim +./test.sh -f issue/TD-2680.sim +./test.sh -f unique/dnode/lossdata.sim + +#======================s4-end=============== +#======================s5-start=============== + +./test.sh -f unique/dnode/alternativeRole.sim +./test.sh -f unique/dnode/balance1.sim +./test.sh -f unique/dnode/balance2.sim +./test.sh -f unique/dnode/balance3.sim +./test.sh -f unique/dnode/balancex.sim +./test.sh -f unique/dnode/offline1.sim +./test.sh -f unique/dnode/offline2.sim + +./test.sh -f general/stream/metrics_del.sim +./test.sh -f general/stream/metrics_replica1_vnoden.sim +./test.sh -f general/stream/restart_stream.sim +./test.sh -f general/stream/stream_3.sim +./test.sh -f general/stream/stream_restart.sim +./test.sh -f general/stream/table_del.sim +./test.sh -f general/stream/table_replica1_vnoden.sim + +./test.sh -f general/connection/test_old_data.sim +./test.sh -f unique/dnode/datatrans_3node.sim +./test.sh -f unique/dnode/datatrans_3node_2.sim + +#======================s5-end=============== +#======================s6-start=============== + +./test.sh -f unique/dnode/reason.sim +./test.sh -f unique/dnode/remove1.sim +./test.sh -f unique/dnode/remove2.sim +./test.sh -f unique/dnode/vnode_clean.sim + +./test.sh -f unique/db/commit.sim +./test.sh -f unique/db/delete.sim +./test.sh -f unique/db/delete_part.sim +./test.sh -f unique/db/replica_add12.sim +./test.sh -f unique/db/replica_add13.sim +./test.sh -f unique/db/replica_add23.sim +./test.sh -f unique/db/replica_reduce21.sim +./test.sh -f unique/db/replica_reduce32.sim +./test.sh -f unique/db/replica_reduce31.sim +./test.sh -f unique/db/replica_part.sim + +./test.sh -f unique/vnode/many.sim +./test.sh -f unique/vnode/replica2_basic2.sim +./test.sh -f unique/vnode/replica2_repeat.sim +./test.sh -f unique/vnode/replica3_basic.sim +./test.sh -f unique/vnode/replica3_repeat.sim +./test.sh -f unique/vnode/replica3_vgroup.sim + +./test.sh -f unique/dnode/monitor.sim +./test.sh -f unique/dnode/monitor_bug.sim +./test.sh -f unique/dnode/simple.sim +./test.sh -f unique/dnode/data1.sim +./test.sh -f unique/dnode/m2.sim +./test.sh -f unique/dnode/m3.sim +./test.sh -f unique/dnode/offline3.sim +./test.sh -f general/wal/kill.sim +./test.sh -f general/wal/maxtables.sim + +./test.sh -f general/import/basic.sim +./test.sh -f general/import/commit.sim +./test.sh -f general/import/large.sim +./test.sh -f general/import/replica1.sim + +#======================s6-end=============== +#======================s7-start=============== + +./test.sh -f general/compute/avg.sim +./test.sh -f general/compute/bottom.sim +./test.sh -f general/compute/count.sim +./test.sh -f general/compute/diff.sim +./test.sh -f general/compute/diff2.sim +./test.sh -f general/compute/first.sim +./test.sh -f general/compute/interval.sim +./test.sh -f general/compute/last.sim +./test.sh -f general/compute/leastsquare.sim +./test.sh -f general/compute/max.sim +./test.sh -f general/compute/min.sim +./test.sh -f general/compute/null.sim +./test.sh -f general/compute/percentile.sim +./test.sh -f general/compute/stddev.sim +./test.sh -f general/compute/sum.sim +./test.sh -f general/compute/top.sim + +./test.sh -f general/db/alter_option.sim +./test.sh -f general/db/alter_tables_d2.sim +./test.sh -f general/db/alter_tables_v1.sim +./test.sh -f general/db/alter_tables_v4.sim +./test.sh -f general/db/alter_vgroups.sim +./test.sh -f general/db/basic.sim +./test.sh -f general/db/basic1.sim +./test.sh -f general/db/basic2.sim +./test.sh -f general/db/basic3.sim +./test.sh -f general/db/basic4.sim +./test.sh -f general/db/basic5.sim +./test.sh -f general/db/delete_reuse1.sim +./test.sh -f general/db/delete_reuse2.sim +./test.sh -f general/db/delete_reusevnode.sim +./test.sh -f general/db/delete_reusevnode2.sim +./test.sh -f general/db/delete_writing1.sim +./test.sh -f general/db/delete_writing2.sim +./test.sh -f general/db/delete.sim +./test.sh -f general/db/len.sim +./test.sh -f general/db/repeat.sim +./test.sh -f general/db/tables.sim +./test.sh -f general/db/vnodes.sim +./test.sh -f general/db/topic1.sim +./test.sh -f general/db/topic2.sim ./test.sh -f general/table/autocreate.sim ./test.sh -f general/table/basic1.sim ./test.sh -f general/table/basic2.sim @@ -200,126 +408,6 @@ cd ../../../debug; make ./test.sh -f general/table/vgroup.sim ./test.sh -f general/table/createmulti.sim -./test.sh -f general/tag/3.sim -./test.sh -f general/tag/4.sim -./test.sh -f general/tag/5.sim -./test.sh -f general/tag/6.sim -./test.sh -f general/tag/add.sim -./test.sh -f general/tag/bigint.sim -./test.sh -f general/tag/binary_binary.sim -./test.sh -f general/tag/binary.sim -./test.sh -f general/tag/bool_binary.sim -./test.sh -f general/tag/bool_int.sim -./test.sh -f general/tag/bool.sim -./test.sh -f general/tag/change.sim -./test.sh -f general/tag/column.sim -./test.sh -f general/tag/commit.sim -./test.sh -f general/tag/create.sim -./test.sh -f general/tag/delete.sim -./test.sh -f general/tag/double.sim -./test.sh -f general/tag/filter.sim -./test.sh -f general/tag/float.sim -./test.sh -f general/tag/int_binary.sim -./test.sh -f general/tag/int_float.sim -./test.sh -f general/tag/int.sim -./test.sh -f general/tag/set.sim -./test.sh -f general/tag/smallint.sim -./test.sh -f general/tag/tinyint.sim - -./test.sh -f general/user/authority.sim -./test.sh -f general/user/monitor.sim -./test.sh -f general/user/pass_alter.sim -./test.sh -f general/user/pass_len.sim -./test.sh -f general/user/user_create.sim -./test.sh -f general/user/user_len.sim - -./test.sh -f general/vector/metrics_field.sim -./test.sh -f general/vector/metrics_mix.sim -./test.sh -f general/vector/metrics_query.sim -./test.sh -f general/vector/metrics_tag.sim -./test.sh -f general/vector/metrics_time.sim -./test.sh -f general/vector/multi.sim -./test.sh -f general/vector/single.sim -./test.sh -f general/vector/table_field.sim -./test.sh -f general/vector/table_mix.sim -./test.sh -f general/vector/table_query.sim -./test.sh -f general/vector/table_time.sim - -./test.sh -f general/wal/sync.sim -./test.sh -f general/wal/kill.sim -./test.sh -f general/wal/maxtables.sim - -./test.sh -f unique/account/account_create.sim -./test.sh -f unique/account/account_delete.sim -./test.sh -f unique/account/account_len.sim -./test.sh -f unique/account/authority.sim -./test.sh -f unique/account/basic.sim -./test.sh -f unique/account/paras.sim -./test.sh -f unique/account/pass_alter.sim -./test.sh -f unique/account/pass_len.sim -./test.sh -f unique/account/usage.sim -./test.sh -f unique/account/user_create.sim -./test.sh -f unique/account/user_len.sim - -./test.sh -f unique/big/balance.sim -./test.sh -f unique/big/maxvnodes.sim -./test.sh -f unique/big/tcp.sim - -./test.sh -f unique/cluster/alter.sim -./test.sh -f unique/cluster/balance1.sim -./test.sh -f unique/cluster/balance2.sim -./test.sh -f unique/cluster/balance3.sim -./test.sh -f unique/cluster/cache.sim -./test.sh -f unique/cluster/vgroup100.sim - -./test.sh -f unique/column/replica3.sim - -./test.sh -f unique/db/commit.sim -./test.sh -f unique/db/delete.sim -./test.sh -f unique/db/delete_part.sim -./test.sh -f unique/db/replica_add12.sim -./test.sh -f unique/db/replica_add13.sim -./test.sh -f unique/db/replica_add23.sim -./test.sh -f unique/db/replica_reduce21.sim -./test.sh -f unique/db/replica_reduce32.sim -./test.sh -f unique/db/replica_reduce31.sim -./test.sh -f unique/db/replica_part.sim - -./test.sh -f unique/dnode/alternativeRole.sim -./test.sh -f unique/dnode/monitor.sim -./test.sh -f unique/dnode/monitor_bug.sim -./test.sh -f unique/dnode/simple.sim -./test.sh -f unique/dnode/balance1.sim -./test.sh -f unique/dnode/balance2.sim -./test.sh -f unique/dnode/balance3.sim -./test.sh -f unique/dnode/balancex.sim -./test.sh -f unique/dnode/data1.sim -./test.sh -f unique/dnode/m2.sim -./test.sh -f unique/dnode/m3.sim -./test.sh -f unique/dnode/lossdata.sim -./test.sh -f unique/dnode/offline1.sim -./test.sh -f unique/dnode/offline2.sim -./test.sh -f unique/dnode/offline3.sim -./test.sh -f unique/dnode/reason.sim -./test.sh -f unique/dnode/remove1.sim -./test.sh -f unique/dnode/remove2.sim -./test.sh -f unique/dnode/vnode_clean.sim - -./test.sh -f unique/http/admin.sim -./test.sh -f unique/http/opentsdb.sim - -./test.sh -f unique/import/replica2.sim -./test.sh -f unique/import/replica3.sim - -./test.sh -f unique/stable/balance_replica1.sim -./test.sh -f unique/stable/dnode2_stop.sim -./test.sh -f unique/stable/dnode2.sim -./test.sh -f unique/stable/dnode3.sim -./test.sh -f unique/stable/replica2_dnode4.sim -./test.sh -f unique/stable/replica2_vnode3.sim -./test.sh -f unique/stable/replica3_dnode6.sim -./test.sh -f unique/stable/replica3_vnode3.sim - ./test.sh -f unique/mnode/mgmt20.sim ./test.sh -f unique/mnode/mgmt21.sim ./test.sh -f unique/mnode/mgmt22.sim @@ -327,74 +415,10 @@ cd ../../../debug; make ./test.sh -f unique/mnode/mgmt24.sim ./test.sh -f unique/mnode/mgmt25.sim ./test.sh -f unique/mnode/mgmt26.sim -./test.sh -f unique/mnode/mgmt30.sim ./test.sh -f unique/mnode/mgmt33.sim ./test.sh -f unique/mnode/mgmt34.sim ./test.sh -f unique/mnode/mgmtr2.sim -./test.sh -f unique/vnode/many.sim -./test.sh -f unique/vnode/replica2_basic2.sim -./test.sh -f unique/vnode/replica2_repeat.sim -./test.sh -f unique/vnode/replica3_basic.sim -./test.sh -f unique/vnode/replica3_repeat.sim -./test.sh -f unique/vnode/replica3_vgroup.sim - -./test.sh -f general/stream/metrics_del.sim -./test.sh -f general/stream/metrics_replica1_vnoden.sim -./test.sh -f general/stream/restart_stream.sim -./test.sh -f general/stream/stream_3.sim -./test.sh -f general/stream/stream_restart.sim -./test.sh -f general/stream/table_del.sim -./test.sh -f general/stream/table_replica1_vnoden.sim - -./test.sh -f unique/arbitrator/check_cluster_cfg_para.sim -#./test.sh -f unique/arbitrator/dn2_mn1_cache_file_sync.sim -./test.sh -f unique/arbitrator/dn3_mn1_full_createTableFail.sim -./test.sh -f unique/arbitrator/dn3_mn1_multiCreateDropTable.sim -#./test.sh -f unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim -#./test.sh -f unique/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim -./test.sh -f unique/arbitrator/dn3_mn1_replica_change_dropDnod.sim -./test.sh -f unique/arbitrator/dn3_mn1_replica_change.sim -#./test.sh -f unique/arbitrator/dn3_mn1_stopDnode_timeout.sim -# lower the priority while file corruption -#./test.sh -f unique/arbitrator/dn3_mn1_vnode_change.sim -#./test.sh -f unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim -#./test.sh -f unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim -#./test.sh -f unique/arbitrator/dn3_mn1_vnode_createErrData_online.sim -./test.sh -f unique/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim -./test.sh -f unique/arbitrator/dn3_mn1_vnode_delDir.sim -./test.sh -f unique/arbitrator/dn3_mn1_r2_vnode_delDir.sim -./test.sh -f unique/arbitrator/dn3_mn1_r3_vnode_delDir.sim -./test.sh -f unique/arbitrator/dn3_mn1_vnode_nomaster.sim -./test.sh -f unique/arbitrator/dn3_mn2_killDnode.sim ./test.sh -f unique/arbitrator/insert_duplicationTs.sim -./test.sh -f unique/arbitrator/offline_replica2_alterTable_online.sim -./test.sh -f unique/arbitrator/offline_replica2_alterTag_online.sim -./test.sh -f unique/arbitrator/offline_replica2_createTable_online.sim -./test.sh -f unique/arbitrator/offline_replica2_dropDb_online.sim -./test.sh -f unique/arbitrator/offline_replica2_dropTable_online.sim -./test.sh -f unique/arbitrator/offline_replica3_alterTable_online.sim -./test.sh -f unique/arbitrator/offline_replica3_alterTag_online.sim -./test.sh -f unique/arbitrator/offline_replica3_createTable_online.sim -./test.sh -f unique/arbitrator/offline_replica3_dropDb_online.sim -./test.sh -f unique/arbitrator/offline_replica3_dropTable_online.sim -./test.sh -f unique/arbitrator/replica_changeWithArbitrator.sim -./test.sh -f unique/arbitrator/sync_replica2_alterTable_add.sim -./test.sh -f unique/arbitrator/sync_replica2_alterTable_drop.sim - -./test.sh -f unique/arbitrator/sync_replica2_dropDb.sim -./test.sh -f unique/arbitrator/sync_replica2_dropTable.sim -./test.sh -f unique/arbitrator/sync_replica3_alterTable_add.sim -./test.sh -f unique/arbitrator/sync_replica3_alterTable_drop.sim -./test.sh -f unique/arbitrator/sync_replica3_dropDb.sim -./test.sh -f unique/arbitrator/sync_replica3_dropTable.sim - -./test.sh -f unique/migrate/mn2_vn2_repl2_rmMnodeDir.sim -./test.sh -f unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim -./test.sh -f unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir_stopAll_starAll.sim -./test.sh -f unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim - -./test.sh -f general/connection/test_old_data.sim -./test.sh -f unique/dnode/datatrans_3node.sim -./test.sh -f unique/dnode/datatrans_3node_2.sim +#======================s7-end=============== diff --git a/tests/script/jenkins/basic_1.txt b/tests/script/jenkins/basic_1.txt deleted file mode 100644 index ae72e76b2f..0000000000 --- a/tests/script/jenkins/basic_1.txt +++ /dev/null @@ -1,85 +0,0 @@ -./test.sh -f general/field/2.sim -./test.sh -f general/field/3.sim -./test.sh -f general/field/4.sim -./test.sh -f general/field/5.sim -./test.sh -f general/field/6.sim -./test.sh -f general/field/bigint.sim -./test.sh -f general/field/binary.sim -./test.sh -f general/field/bool.sim -./test.sh -f general/field/single.sim -./test.sh -f general/field/smallint.sim -./test.sh -f general/field/tinyint.sim - -./test.sh -f general/http/autocreate.sim -./test.sh -f general/http/chunked.sim -./test.sh -f general/http/gzip.sim -./test.sh -f general/http/restful.sim -./test.sh -f general/http/restful_insert.sim -./test.sh -f general/http/restful_limit.sim -./test.sh -f general/http/restful_full.sim -./test.sh -f general/http/prepare.sim -./test.sh -f general/http/telegraf.sim -./test.sh -f general/http/grafana_bug.sim -./test.sh -f general/http/grafana.sim - -./test.sh -f general/insert/basic.sim -./test.sh -f general/insert/insert_drop.sim -./test.sh -f general/insert/query_block1_memory.sim -./test.sh -f general/insert/query_block2_memory.sim -./test.sh -f general/insert/query_block1_file.sim -./test.sh -f general/insert/query_block2_file.sim -./test.sh -f general/insert/query_file_memory.sim -./test.sh -f general/insert/query_multi_file.sim -./test.sh -f general/insert/tcp.sim - -./test.sh -f general/parser/alter.sim -./test.sh -f general/parser/alter1.sim -./test.sh -f general/parser/alter_stable.sim -./test.sh -f general/parser/auto_create_tb.sim -./test.sh -f general/parser/auto_create_tb_drop_tb.sim -./test.sh -f general/parser/col_arithmetic_operation.sim -./test.sh -f general/parser/columnValue.sim -./test.sh -f general/parser/commit.sim -./test.sh -f general/parser/create_db.sim -./test.sh -f general/parser/create_mt.sim -./test.sh -f general/parser/create_tb.sim -./test.sh -f general/parser/dbtbnameValidate.sim -./test.sh -f general/parser/import_commit1.sim -./test.sh -f general/parser/import_commit2.sim -./test.sh -f general/parser/import_commit3.sim -./test.sh -f general/parser/insert_tb.sim -./test.sh -f general/parser/first_last.sim -./test.sh -f general/parser/lastrow.sim -./test.sh -f general/parser/nchar.sim -./test.sh -f general/parser/null_char.sim -./test.sh -f general/parser/single_row_in_tb.sim -./test.sh -f general/parser/select_from_cache_disk.sim -./test.sh -f general/parser/mixed_blocks.sim -./test.sh -f general/parser/selectResNum.sim -./test.sh -f general/parser/limit.sim -./test.sh -f general/parser/limit1.sim -./test.sh -f general/parser/limit1_tblocks100.sim -./test.sh -f general/parser/select_across_vnodes.sim -./test.sh -f general/parser/slimit1.sim -./test.sh -f general/parser/tbnameIn.sim -./test.sh -f general/parser/projection_limit_offset.sim -./test.sh -f general/parser/limit2.sim -./test.sh -f general/parser/fill.sim -./test.sh -f general/parser/fill_stb.sim -./test.sh -f general/parser/where.sim -./test.sh -f general/parser/slimit.sim -./test.sh -f general/parser/select_with_tags.sim -./test.sh -f general/parser/interp.sim -./test.sh -f general/parser/tags_dynamically_specifiy.sim -./test.sh -f general/parser/groupby.sim -./test.sh -f general/parser/set_tag_vals.sim -./test.sh -f general/parser/tags_filter.sim -./test.sh -f general/parser/slimit_alter_tags.sim -./test.sh -f general/parser/join.sim -./test.sh -f general/parser/join_multivnode.sim -./test.sh -f general/parser/binary_escapeCharacter.sim -./test.sh -f general/parser/repeatAlter.sim -./test.sh -f general/parser/union.sim -./test.sh -f general/parser/topbot.sim -./test.sh -f general/db/nosuchfile.sim -./test.sh -f general/parser/function.sim \ No newline at end of file diff --git a/tests/script/jenkins/basic_2.txt b/tests/script/jenkins/basic_2.txt deleted file mode 100644 index 5a2a6f4062..0000000000 --- a/tests/script/jenkins/basic_2.txt +++ /dev/null @@ -1,74 +0,0 @@ -cd ../../../debug; cmake .. -cd ../../../debug; make - -./test.sh -f general/tag/3.sim -./test.sh -f general/tag/4.sim -./test.sh -f general/tag/5.sim -./test.sh -f general/tag/6.sim -./test.sh -f general/tag/add.sim -./test.sh -f general/tag/bigint.sim -./test.sh -f general/tag/binary_binary.sim -./test.sh -f general/tag/binary.sim -./test.sh -f general/tag/bool_binary.sim -./test.sh -f general/tag/bool_int.sim -./test.sh -f general/tag/bool.sim -./test.sh -f general/tag/change.sim -./test.sh -f general/tag/column.sim -./test.sh -f general/tag/commit.sim -./test.sh -f general/tag/create.sim -./test.sh -f general/tag/delete.sim -./test.sh -f general/tag/double.sim -./test.sh -f general/tag/filter.sim -./test.sh -f general/tag/float.sim -./test.sh -f general/tag/int_binary.sim -./test.sh -f general/tag/int_float.sim -./test.sh -f general/tag/int.sim -./test.sh -f general/tag/set.sim -./test.sh -f general/tag/smallint.sim -./test.sh -f general/tag/tinyint.sim -./test.sh -f general/wal/sync.sim -./test.sh -f general/wal/kill.sim -./test.sh -f general/wal/maxtables.sim - -./test.sh -f general/user/authority.sim -./test.sh -f general/user/monitor.sim -./test.sh -f general/user/pass_alter.sim -./test.sh -f general/user/pass_len.sim -./test.sh -f general/user/user_create.sim -./test.sh -f general/user/user_len.sim - -./test.sh -f general/vector/metrics_field.sim -./test.sh -f general/vector/metrics_mix.sim -./test.sh -f general/vector/metrics_query.sim -./test.sh -f general/vector/metrics_tag.sim -./test.sh -f general/vector/metrics_time.sim -./test.sh -f general/vector/multi.sim -./test.sh -f general/vector/single.sim -./test.sh -f general/vector/table_field.sim -./test.sh -f general/vector/table_mix.sim -./test.sh -f general/vector/table_query.sim -./test.sh -f general/vector/table_time.sim - -./test.sh -f unique/account/account_create.sim -./test.sh -f unique/account/account_delete.sim -./test.sh -f unique/account/account_len.sim -./test.sh -f unique/account/authority.sim -./test.sh -f unique/account/basic.sim -./test.sh -f unique/account/paras.sim -./test.sh -f unique/account/pass_alter.sim -./test.sh -f unique/account/pass_len.sim -./test.sh -f unique/account/usage.sim -./test.sh -f unique/account/user_create.sim -./test.sh -f unique/account/user_len.sim - -./test.sh -f unique/big/balance.sim -./test.sh -f unique/big/maxvnodes.sim -./test.sh -f unique/big/tcp.sim - -./test.sh -f unique/cluster/alter.sim -./test.sh -f unique/cluster/balance1.sim -./test.sh -f unique/cluster/balance2.sim -./test.sh -f unique/cluster/balance3.sim -./test.sh -f unique/cluster/cache.sim -./test.sh -f unique/cluster/vgroup100.sim - diff --git a/tests/script/jenkins/basic_3.txt b/tests/script/jenkins/basic_3.txt deleted file mode 100644 index f53b1b763a..0000000000 --- a/tests/script/jenkins/basic_3.txt +++ /dev/null @@ -1,58 +0,0 @@ - -./test.sh -f unique/arbitrator/check_cluster_cfg_para.sim -#./test.sh -f unique/arbitrator/dn2_mn1_cache_file_sync.sim -./test.sh -f unique/arbitrator/dn3_mn1_full_createTableFail.sim -./test.sh -f unique/arbitrator/dn3_mn1_multiCreateDropTable.sim -#./test.sh -f unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim -#./test.sh -f unique/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim -./test.sh -f unique/arbitrator/dn3_mn1_replica_change_dropDnod.sim -./test.sh -f unique/arbitrator/dn3_mn1_replica_change.sim -#./test.sh -f unique/arbitrator/dn3_mn1_stopDnode_timeout.sim -# lower the priority while file corruption -#./test.sh -f unique/arbitrator/dn3_mn1_vnode_change.sim -#./test.sh -f unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim -#./test.sh -f unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim -#./test.sh -f unique/arbitrator/dn3_mn1_vnode_createErrData_online.sim -./test.sh -f unique/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim -./test.sh -f unique/arbitrator/dn3_mn1_vnode_delDir.sim -./test.sh -f unique/arbitrator/dn3_mn1_r2_vnode_delDir.sim -./test.sh -f unique/arbitrator/dn3_mn1_r3_vnode_delDir.sim -./test.sh -f unique/arbitrator/dn3_mn1_vnode_nomaster.sim -./test.sh -f unique/arbitrator/dn3_mn2_killDnode.sim - -./test.sh -f unique/arbitrator/offline_replica2_alterTable_online.sim -./test.sh -f unique/arbitrator/offline_replica2_alterTag_online.sim -./test.sh -f unique/arbitrator/offline_replica2_createTable_online.sim -./test.sh -f unique/arbitrator/offline_replica2_dropDb_online.sim -./test.sh -f unique/arbitrator/offline_replica2_dropTable_online.sim -./test.sh -f unique/arbitrator/offline_replica3_alterTable_online.sim -./test.sh -f unique/arbitrator/offline_replica3_alterTag_online.sim -./test.sh -f unique/arbitrator/offline_replica3_createTable_online.sim -./test.sh -f unique/arbitrator/offline_replica3_dropDb_online.sim -./test.sh -f unique/arbitrator/offline_replica3_dropTable_online.sim -./test.sh -f unique/arbitrator/replica_changeWithArbitrator.sim -./test.sh -f unique/arbitrator/sync_replica2_alterTable_add.sim -./test.sh -f unique/arbitrator/sync_replica2_alterTable_drop.sim - -./test.sh -f unique/arbitrator/sync_replica2_dropDb.sim -./test.sh -f unique/arbitrator/sync_replica2_dropTable.sim -./test.sh -f unique/arbitrator/sync_replica3_alterTable_add.sim -./test.sh -f unique/arbitrator/sync_replica3_alterTable_drop.sim -./test.sh -f unique/arbitrator/sync_replica3_dropDb.sim -./test.sh -f unique/arbitrator/sync_replica3_dropTable.sim - -./test.sh -f unique/migrate/mn2_vn2_repl2_rmMnodeDir.sim -./test.sh -f unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim -./test.sh -f unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir_stopAll_starAll.sim -./test.sh -f unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim - -./test.sh -f unique/stable/balance_replica1.sim -./test.sh -f unique/stable/dnode2_stop.sim -./test.sh -f unique/stable/dnode2.sim -./test.sh -f unique/stable/dnode3.sim -./test.sh -f unique/stable/replica2_dnode4.sim -./test.sh -f unique/stable/replica2_vnode3.sim -./test.sh -f unique/stable/replica3_dnode6.sim -./test.sh -f unique/stable/replica3_vnode3.sim - - diff --git a/tests/script/jenkins/basic_4.txt b/tests/script/jenkins/basic_4.txt deleted file mode 100644 index 5a7d23df71..0000000000 --- a/tests/script/jenkins/basic_4.txt +++ /dev/null @@ -1,46 +0,0 @@ - -./test.sh -f unique/http/admin.sim -./test.sh -f unique/http/opentsdb.sim - -./test.sh -f unique/import/replica2.sim -./test.sh -f unique/import/replica3.sim - -./test.sh -f general/alter/cached_schema_after_alter.sim -./test.sh -f general/alter/count.sim -./test.sh -f general/alter/dnode.sim -./test.sh -f general/alter/import.sim -./test.sh -f general/alter/insert1.sim -./test.sh -f general/alter/insert2.sim -./test.sh -f general/alter/metrics.sim -./test.sh -f general/alter/table.sim - -./test.sh -f general/cache/new_metrics.sim -./test.sh -f general/cache/restart_metrics.sim -./test.sh -f general/cache/restart_table.sim - -./test.sh -f general/connection/connection.sim - -./test.sh -f general/column/commit.sim -./test.sh -f general/column/metrics.sim -./test.sh -f general/column/table.sim - -./test.sh -f general/compress/commitlog.sim -./test.sh -f general/compress/compress.sim -./test.sh -f general/compress/compress2.sim -./test.sh -f general/compress/uncompress.sim - -./test.sh -f general/stable/disk.sim -./test.sh -f general/stable/dnode3.sim -./test.sh -f general/stable/metrics.sim -./test.sh -f general/stable/refcount.sim -./test.sh -f general/stable/show.sim -./test.sh -f general/stable/values.sim -./test.sh -f general/stable/vnode3.sim - -./test.sh -f unique/column/replica3.sim -./test.sh -f issue/TD-2713.sim -./test.sh -f general/parser/select_distinct_tag.sim -./test.sh -f unique/mnode/mgmt30.sim -./test.sh -f issue/TD-2677.sim -./test.sh -f issue/TD-2680.sim -./test.sh -f unique/dnode/lossdata.sim \ No newline at end of file diff --git a/tests/script/jenkins/basic_5.txt b/tests/script/jenkins/basic_5.txt deleted file mode 100644 index f89be9499e..0000000000 --- a/tests/script/jenkins/basic_5.txt +++ /dev/null @@ -1,19 +0,0 @@ -./test.sh -f unique/dnode/alternativeRole.sim -./test.sh -f unique/dnode/balance1.sim -./test.sh -f unique/dnode/balance2.sim -./test.sh -f unique/dnode/balance3.sim -./test.sh -f unique/dnode/balancex.sim -./test.sh -f unique/dnode/offline1.sim -./test.sh -f unique/dnode/offline2.sim - -./test.sh -f general/stream/metrics_del.sim -./test.sh -f general/stream/metrics_replica1_vnoden.sim -./test.sh -f general/stream/restart_stream.sim -./test.sh -f general/stream/stream_3.sim -./test.sh -f general/stream/stream_restart.sim -./test.sh -f general/stream/table_del.sim -./test.sh -f general/stream/table_replica1_vnoden.sim - -./test.sh -f general/connection/test_old_data.sim -./test.sh -f unique/dnode/datatrans_3node.sim -./test.sh -f unique/dnode/datatrans_3node_2.sim \ No newline at end of file diff --git a/tests/script/jenkins/basic_6.txt b/tests/script/jenkins/basic_6.txt deleted file mode 100644 index 9156360a9f..0000000000 --- a/tests/script/jenkins/basic_6.txt +++ /dev/null @@ -1,37 +0,0 @@ -./test.sh -f unique/dnode/reason.sim -./test.sh -f unique/dnode/remove1.sim -./test.sh -f unique/dnode/remove2.sim -./test.sh -f unique/dnode/vnode_clean.sim - -./test.sh -f unique/db/commit.sim -./test.sh -f unique/db/delete.sim -./test.sh -f unique/db/delete_part.sim -./test.sh -f unique/db/replica_add12.sim -./test.sh -f unique/db/replica_add13.sim -./test.sh -f unique/db/replica_add23.sim -./test.sh -f unique/db/replica_reduce21.sim -./test.sh -f unique/db/replica_reduce32.sim -./test.sh -f unique/db/replica_reduce31.sim -./test.sh -f unique/db/replica_part.sim - -./test.sh -f unique/vnode/many.sim -./test.sh -f unique/vnode/replica2_basic2.sim -./test.sh -f unique/vnode/replica2_repeat.sim -./test.sh -f unique/vnode/replica3_basic.sim -./test.sh -f unique/vnode/replica3_repeat.sim -./test.sh -f unique/vnode/replica3_vgroup.sim - -./test.sh -f unique/dnode/monitor.sim -./test.sh -f unique/dnode/monitor_bug.sim -./test.sh -f unique/dnode/simple.sim -./test.sh -f unique/dnode/data1.sim -./test.sh -f unique/dnode/m2.sim -./test.sh -f unique/dnode/m3.sim -./test.sh -f unique/dnode/offline3.sim -./test.sh -f general/wal/kill.sim -./test.sh -f general/wal/maxtables.sim - -./test.sh -f general/import/basic.sim -./test.sh -f general/import/commit.sim -./test.sh -f general/import/large.sim -./test.sh -f general/import/replica1.sim \ No newline at end of file diff --git a/tests/script/jenkins/basic_7.txt b/tests/script/jenkins/basic_7.txt deleted file mode 100644 index d951e0a48d..0000000000 --- a/tests/script/jenkins/basic_7.txt +++ /dev/null @@ -1,83 +0,0 @@ - -./test.sh -f general/compute/avg.sim -./test.sh -f general/compute/bottom.sim -./test.sh -f general/compute/count.sim -./test.sh -f general/compute/diff.sim -./test.sh -f general/compute/diff2.sim -./test.sh -f general/compute/first.sim -./test.sh -f general/compute/interval.sim -./test.sh -f general/compute/last.sim -./test.sh -f general/compute/leastsquare.sim -./test.sh -f general/compute/max.sim -./test.sh -f general/compute/min.sim -./test.sh -f general/compute/null.sim -./test.sh -f general/compute/percentile.sim -./test.sh -f general/compute/stddev.sim -./test.sh -f general/compute/sum.sim -./test.sh -f general/compute/top.sim - -./test.sh -f general/db/alter_option.sim -./test.sh -f general/db/alter_tables_d2.sim -./test.sh -f general/db/alter_tables_v1.sim -./test.sh -f general/db/alter_tables_v4.sim -./test.sh -f general/db/alter_vgroups.sim -./test.sh -f general/db/basic.sim -./test.sh -f general/db/basic1.sim -./test.sh -f general/db/basic2.sim -./test.sh -f general/db/basic3.sim -./test.sh -f general/db/basic4.sim -./test.sh -f general/db/basic5.sim -./test.sh -f general/db/delete_reuse1.sim -./test.sh -f general/db/delete_reuse2.sim -./test.sh -f general/db/delete_reusevnode.sim -./test.sh -f general/db/delete_reusevnode2.sim -./test.sh -f general/db/delete_writing1.sim -./test.sh -f general/db/delete_writing2.sim -./test.sh -f general/db/delete.sim -./test.sh -f general/db/len.sim -./test.sh -f general/db/repeat.sim -./test.sh -f general/db/tables.sim -./test.sh -f general/db/vnodes.sim -./test.sh -f general/db/topic1.sim -./test.sh -f general/db/topic2.sim -./test.sh -f general/table/autocreate.sim -./test.sh -f general/table/basic1.sim -./test.sh -f general/table/basic2.sim -./test.sh -f general/table/basic3.sim -./test.sh -f general/table/bigint.sim -./test.sh -f general/table/binary.sim -./test.sh -f general/table/bool.sim -./test.sh -f general/table/column_name.sim -./test.sh -f general/table/column_num.sim -./test.sh -f general/table/column_value.sim -./test.sh -f general/table/column2.sim -./test.sh -f general/table/date.sim -./test.sh -f general/table/db.table.sim -./test.sh -f general/table/delete_reuse1.sim -./test.sh -f general/table/delete_reuse2.sim -./test.sh -f general/table/delete_writing.sim -./test.sh -f general/table/describe.sim -./test.sh -f general/table/double.sim -./test.sh -f general/table/fill.sim -./test.sh -f general/table/float.sim -./test.sh -f general/table/int.sim -./test.sh -f general/table/limit.sim -./test.sh -f general/table/smallint.sim -./test.sh -f general/table/table_len.sim -./test.sh -f general/table/table.sim -./test.sh -f general/table/tinyint.sim -./test.sh -f general/table/vgroup.sim -./test.sh -f general/table/createmulti.sim - -./test.sh -f unique/mnode/mgmt20.sim -./test.sh -f unique/mnode/mgmt21.sim -./test.sh -f unique/mnode/mgmt22.sim -./test.sh -f unique/mnode/mgmt23.sim -./test.sh -f unique/mnode/mgmt24.sim -./test.sh -f unique/mnode/mgmt25.sim -./test.sh -f unique/mnode/mgmt26.sim -./test.sh -f unique/mnode/mgmt33.sim -./test.sh -f unique/mnode/mgmt34.sim -./test.sh -f unique/mnode/mgmtr2.sim - -./test.sh -f unique/arbitrator/insert_duplicationTs.sim \ No newline at end of file diff --git a/tests/test-all.sh b/tests/test-all.sh index db9d6523a0..75ec2bc563 100755 --- a/tests/test-all.sh +++ b/tests/test-all.sh @@ -31,6 +31,7 @@ function dohavecore(){ fi fi } + function runSimCaseOneByOne { while read -r line; do if [[ $line =~ ^./test.sh* ]] || [[ $line =~ ^run* ]]; then @@ -61,7 +62,11 @@ function runSimCaseOneByOne { done < $1 } function runSimCaseOneByOnefq { - while read -r line; do + + start=`sed -n "/$1-start/=" jenkins/basic.txt` + end=`sed -n "/$1-end/=" jenkins/basic.txt` + for ((i=$start;i<=$end;i++)) ; do + line=`sed -n "$i"p jenkins/basic.txt` if [[ $line =~ ^./test.sh* ]] || [[ $line =~ ^run* ]]; then case=`echo $line | grep sim$ |awk '{print $NF}'` @@ -92,9 +97,9 @@ function runSimCaseOneByOnefq { fi end_time=`date +%s` echo execution time of $case was `expr $end_time - $start_time`s. | tee -a out.log - dohavecore 1 + dohavecore $2 fi - done < $1 + done } function runPyCaseOneByOne { @@ -126,8 +131,17 @@ function runPyCaseOneByOne { fi done < $1 } -function runPyCaseOneByOnefq { - while read -r line; do +function runPyCaseOneByOnefq() { + cd $tests_dir/pytest + if [[ $1 =~ full ]] ; then + start=1 + end=`sed -n '$=' fulltest.sh` + else + start=`sed -n "/$1-start/=" fulltest.sh` + end=`sed -n "/$1-end/=" fulltest.sh` + fi + for ((i=$start;i<=$end;i++)) ; do + line=`sed -n "$i"p fulltest.sh` if [[ $line =~ ^python.* ]]; then if [[ $line != *sleep* ]]; then @@ -152,9 +166,9 @@ function runPyCaseOneByOnefq { else $line > /dev/null 2>&1 fi - dohavecore 1 + dohavecore $2 fi - done < $1 + done } totalFailed=0 @@ -176,38 +190,38 @@ if [ "$2" != "jdbc" ] && [ "$2" != "python" ] && [ "$2" != "unit" ]; then runSimCaseOneByOne jenkins/basic.txt elif [ "$1" == "b1" ]; then echo "### run TSIM b1 test ###" - runSimCaseOneByOne jenkins/basic_1.txt - runSimCaseOneByOne jenkins/basic_4.txt - runSimCaseOneByOne jenkins/basic_5.txt - runSimCaseOneByOne jenkins/basic_6.txt - runSimCaseOneByOne jenkins/basic_7.txt + runSimCaseOneByOnefq b1 0 + runSimCaseOneByOnefq b4 0 + runSimCaseOneByOnefq b5 0 + runSimCaseOneByOnefq b6 0 + runSimCaseOneByOnefq b7 0 elif [ "$1" == "b2" ]; then echo "### run TSIM b2 test ###" - runSimCaseOneByOne jenkins/basic_2.txt + runSimCaseOneByOnefq b2 0 elif [ "$1" == "b3" ]; then echo "### run TSIM b3 test ###" - runSimCaseOneByOne jenkins/basic_3.txt + runSimCaseOneByOnefq b3 0 elif [ "$1" == "b1fq" ]; then echo "### run TSIM b1 test ###" - runSimCaseOneByOnefq jenkins/basic_1.txt + runSimCaseOneByOnefq b1 1 elif [ "$1" == "b2fq" ]; then echo "### run TSIM b2 test ###" - runSimCaseOneByOnefq jenkins/basic_2.txt + runSimCaseOneByOnefq b2 1 elif [ "$1" == "b3fq" ]; then echo "### run TSIM b3 test ###" - runSimCaseOneByOnefq jenkins/basic_3.txt + runSimCaseOneByOnefq b3 1 elif [ "$1" == "b4fq" ]; then echo "### run TSIM b4 test ###" - runSimCaseOneByOnefq jenkins/basic_4.txt + runSimCaseOneByOnefq b4 1 elif [ "$1" == "b5fq" ]; then echo "### run TSIM b5 test ###" - runSimCaseOneByOnefq jenkins/basic_5.txt + runSimCaseOneByOnefq b5 1 elif [ "$1" == "b6fq" ]; then echo "### run TSIM b6 test ###" - runSimCaseOneByOnefq jenkins/basic_6.txt + runSimCaseOneByOnefq b6 1 elif [ "$1" == "b7fq" ]; then echo "### run TSIM b7 test ###" - runSimCaseOneByOnefq jenkins/basic_7.txt + runSimCaseOneByOnefq b7 1 elif [ "$1" == "smoke" ] || [ -z "$1" ]; then echo "### run TSIM smoke test ###" runSimCaseOneByOne basicSuite.sim @@ -268,19 +282,19 @@ if [ "$2" != "sim" ] && [ "$2" != "jdbc" ] && [ "$2" != "unit" ]; then runPyCaseOneByOne fulltest.sh elif [ "$1" == "pytestfq" ]; then echo "### run Python full test ###" - runPyCaseOneByOnefq fulltest.sh + runPyCaseOneByOnefq full 0 elif [ "$1" == "p1" ]; then echo "### run Python_1 test ###" - runPyCaseOneByOnefq pytest_1.sh + runPyCaseOneByOnefq p1 1 elif [ "$1" == "p2" ]; then echo "### run Python_2 test ###" - runPyCaseOneByOnefq pytest_2.sh + runPyCaseOneByOnefq p2 1 elif [ "$1" == "p3" ]; then echo "### run Python_3 test ###" - runPyCaseOneByOnefq pytest_3.sh + runPyCaseOneByOnefq p3 1 elif [ "$1" == "p4" ]; then echo "### run Python_4 test ###" - runPyCaseOneByOnefq pytest_4.sh + runPyCaseOneByOnefq p4 1 elif [ "$1" == "b2" ] || [ "$1" == "b3" ]; then exit $(($totalFailed + $totalPyFailed)) elif [ "$1" == "smoke" ] || [ -z "$1" ]; then From 4c64997447fe45210b00e5ef50ca28f4d8f03771 Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Wed, 17 Mar 2021 13:02:51 +0800 Subject: [PATCH 03/52] add case --- tests/pytest/fulltest.sh | 1 + tests/script/jenkins/basic.txt | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index 506d469b2f..84a52d81a9 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -294,5 +294,6 @@ python3 ./test.py -f query/queryFillTest.py python3 ./test.py -f alter/alter_debugFlag.py python3 ./test.py -f query/queryBetweenAnd.py python3 ./test.py -f tag_lite/alter_tag.py +python3 test.py -f tools/taosdemoTestSampleData.py #======================p4-end=============== \ No newline at end of file diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index d0bd7179e5..33489b50ff 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -420,5 +420,9 @@ cd ../../../debug; make ./test.sh -f unique/mnode/mgmtr2.sim ./test.sh -f unique/arbitrator/insert_duplicationTs.sim +./test.sh -f general/parser/join_manyblocks.sim +./test.sh -f general/parser/stableOp.sim +./test.sh -f general/parser/timestamp.sim +./test.sh -f general/parser/sliding.sim #======================s7-end=============== From 8286820a1cd75b7fb627767d1aa759740271adab Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 17 Mar 2021 13:15:09 +0800 Subject: [PATCH 04/52] [td-225]remove unused keywords. --- src/inc/ttokendef.h | 12 +- src/query/inc/sql.y | 4 +- src/query/src/qTokenizer.c | 2 - src/query/src/sql.c | 1604 ++++++++++----------- tests/script/general/parser/create_mt.sim | 6 +- tests/script/general/parser/create_tb.sim | 8 +- 6 files changed, 811 insertions(+), 825 deletions(-) diff --git a/src/inc/ttokendef.h b/src/inc/ttokendef.h index 31e38c1b50..91c08fa26a 100644 --- a/src/inc/ttokendef.h +++ b/src/inc/ttokendef.h @@ -197,13 +197,11 @@ #define TK_PREV 178 #define TK_LINEAR 179 #define TK_IMPORT 180 -#define TK_METRIC 181 -#define TK_TBNAME 182 -#define TK_JOIN 183 -#define TK_METRICS 184 -#define TK_INSERT 185 -#define TK_INTO 186 -#define TK_VALUES 187 +#define TK_TBNAME 181 +#define TK_JOIN 182 +#define TK_INSERT 183 +#define TK_INTO 184 +#define TK_VALUES 185 #define TK_SPACE 300 diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y index 7d704e03b4..7f6aa1ca5f 100644 --- a/src/query/inc/sql.y +++ b/src/query/inc/sql.y @@ -838,6 +838,4 @@ cmd ::= KILL QUERY INTEGER(X) COLON(Z) INTEGER(Y). {X.n += (Z.n + Y.n); s %fallback ID ABORT AFTER ASC ATTACH BEFORE BEGIN CASCADE CLUSTER CONFLICT COPY DATABASE DEFERRED DELIMITERS DESC DETACH EACH END EXPLAIN FAIL FOR GLOB IGNORE IMMEDIATE INITIALLY INSTEAD LIKE MATCH KEY OF OFFSET RAISE REPLACE RESTRICT ROW STATEMENT TRIGGER VIEW ALL - NOW IPTOKEN SEMI NONE PREV LINEAR IMPORT - METRIC TBNAME JOIN METRICS STABLE NULL INSERT INTO VALUES. - \ No newline at end of file + NOW IPTOKEN SEMI NONE PREV LINEAR IMPORT TBNAME JOIN STABLE NULL INSERT INTO VALUES. \ No newline at end of file diff --git a/src/query/src/qTokenizer.c b/src/query/src/qTokenizer.c index 63ec2bd342..013eaaf2a9 100644 --- a/src/query/src/qTokenizer.c +++ b/src/query/src/qTokenizer.c @@ -206,10 +206,8 @@ static SKeyword keywordTable[] = { {"PREV", TK_PREV}, {"LINEAR", TK_LINEAR}, {"IMPORT", TK_IMPORT}, - {"METRIC", TK_METRIC}, {"TBNAME", TK_TBNAME}, {"JOIN", TK_JOIN}, - {"METRICS", TK_METRICS}, {"STABLE", TK_STABLE}, {"FILE", TK_FILE}, {"VNODES", TK_VNODES}, diff --git a/src/query/src/sql.c b/src/query/src/sql.c index 1aafe75c32..98304d636f 100644 --- a/src/query/src/sql.c +++ b/src/query/src/sql.c @@ -97,28 +97,28 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 265 +#define YYNOCODE 263 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SStrToken typedef union { int yyinit; ParseTOKENTYPE yy0; - SCreatedTableInfo yy96; - SFromInfo* yy162; - tSqlExpr* yy178; - SCreateAcctInfo yy187; - SArray* yy285; - TAOS_FIELD yy295; - SQuerySqlNode* yy342; - tVariant yy362; - SIntervalVal yy376; - SLimitVal yy438; - int yy460; - SCreateTableSql* yy470; - SSubclauseInfo* yy513; - SSessionWindowVal yy523; - int64_t yy525; - SCreateDbInfo yy526; + SLimitVal yy18; + SFromInfo* yy70; + SSessionWindowVal yy87; + SCreateDbInfo yy94; + int yy116; + SSubclauseInfo* yy141; + tSqlExpr* yy170; + SCreateTableSql* yy194; + tVariant yy218; + SIntervalVal yy220; + SCreatedTableInfo yy252; + SQuerySqlNode* yy254; + SCreateAcctInfo yy419; + SArray* yy429; + TAOS_FIELD yy451; + int64_t yy481; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -130,7 +130,7 @@ typedef union { #define YYFALLBACK 1 #define YYNSTATE 313 #define YYNRULE 265 -#define YYNTOKEN 188 +#define YYNTOKEN 186 #define YY_MAX_SHIFT 312 #define YY_MIN_SHIFTREDUCE 502 #define YY_MAX_SHIFTREDUCE 766 @@ -217,152 +217,152 @@ static const YYACTIONTYPE yy_action[] = { /* 80 */ 57, 54, 969, 550, 255, 220, 46, 45, 276, 916, /* 90 */ 44, 43, 42, 503, 504, 505, 506, 507, 508, 509, /* 100 */ 510, 511, 512, 513, 514, 515, 311, 628, 84, 230, - /* 110 */ 69, 916, 296, 47, 48, 30, 51, 52, 1013, 30, - /* 120 */ 213, 41, 549, 50, 260, 55, 53, 57, 54, 1012, + /* 110 */ 69, 916, 1013, 47, 48, 30, 51, 52, 296, 30, + /* 120 */ 213, 41, 549, 50, 260, 55, 53, 57, 54, 64, /* 130 */ 550, 306, 714, 46, 45, 286, 285, 44, 43, 42, - /* 140 */ 47, 49, 904, 51, 52, 224, 1011, 213, 41, 667, + /* 140 */ 47, 49, 904, 51, 52, 224, 1012, 213, 41, 65, /* 150 */ 50, 260, 55, 53, 57, 54, 216, 916, 902, 913, /* 160 */ 46, 45, 222, 912, 44, 43, 42, 23, 274, 305, /* 170 */ 304, 273, 272, 271, 303, 270, 302, 301, 300, 269, /* 180 */ 299, 298, 876, 139, 864, 865, 866, 867, 868, 869, /* 190 */ 870, 871, 872, 873, 874, 875, 877, 878, 51, 52, - /* 200 */ 815, 197, 213, 41, 165, 50, 260, 55, 53, 57, - /* 210 */ 54, 198, 18, 81, 226, 46, 45, 283, 282, 44, - /* 220 */ 43, 42, 212, 727, 928, 25, 718, 671, 721, 189, + /* 200 */ 815, 139, 213, 41, 165, 50, 260, 55, 53, 57, + /* 210 */ 54, 1011, 18, 81, 226, 46, 45, 283, 282, 44, + /* 220 */ 43, 42, 212, 727, 928, 25, 718, 68, 721, 189, /* 230 */ 724, 223, 212, 727, 278, 190, 718, 276, 721, 203, /* 240 */ 724, 117, 116, 188, 899, 900, 29, 903, 257, 233, - /* 250 */ 77, 44, 43, 42, 209, 210, 237, 236, 259, 139, - /* 260 */ 23, 104, 305, 304, 209, 210, 296, 303, 79, 302, - /* 270 */ 301, 300, 73, 299, 298, 884, 132, 30, 882, 883, - /* 280 */ 36, 70, 225, 885, 824, 887, 888, 886, 165, 889, - /* 290 */ 890, 55, 53, 57, 54, 182, 309, 308, 125, 46, - /* 300 */ 45, 1026, 239, 44, 43, 42, 102, 107, 30, 196, - /* 310 */ 261, 73, 96, 106, 112, 115, 105, 914, 217, 36, - /* 320 */ 674, 913, 109, 5, 155, 56, 78, 30, 243, 33, - /* 330 */ 154, 91, 86, 90, 30, 56, 173, 169, 726, 245, - /* 340 */ 30, 68, 171, 168, 120, 119, 118, 12, 726, 279, - /* 350 */ 183, 83, 913, 80, 725, 28, 46, 45, 266, 816, - /* 360 */ 44, 43, 42, 165, 725, 1, 153, 652, 280, 716, - /* 370 */ 649, 913, 650, 901, 651, 284, 695, 696, 913, 664, - /* 380 */ 720, 288, 723, 241, 913, 680, 24, 31, 686, 134, - /* 390 */ 687, 747, 60, 728, 20, 19, 211, 19, 227, 228, - /* 400 */ 719, 61, 722, 185, 638, 717, 730, 64, 31, 263, - /* 410 */ 640, 265, 639, 31, 60, 82, 60, 179, 95, 94, - /* 420 */ 186, 14, 13, 62, 101, 100, 67, 65, 627, 187, - /* 430 */ 16, 15, 656, 654, 657, 655, 114, 113, 130, 128, - /* 440 */ 6, 193, 194, 192, 177, 191, 181, 915, 979, 131, - /* 450 */ 978, 214, 975, 974, 215, 287, 936, 39, 961, 944, - /* 460 */ 946, 133, 960, 929, 244, 137, 129, 150, 911, 149, - /* 470 */ 242, 909, 679, 246, 151, 204, 653, 247, 258, 256, - /* 480 */ 66, 152, 827, 268, 63, 926, 37, 140, 175, 34, - /* 490 */ 248, 253, 277, 823, 1031, 92, 58, 141, 254, 142, - /* 500 */ 1030, 1028, 156, 281, 1025, 98, 1024, 1022, 157, 845, - /* 510 */ 35, 32, 38, 176, 252, 144, 812, 108, 810, 110, - /* 520 */ 111, 808, 807, 229, 167, 805, 804, 803, 250, 802, - /* 530 */ 801, 800, 170, 172, 797, 795, 793, 791, 789, 174, - /* 540 */ 40, 71, 74, 249, 962, 297, 103, 289, 290, 291, - /* 550 */ 292, 293, 294, 295, 307, 199, 766, 221, 231, 232, - /* 560 */ 267, 765, 234, 235, 764, 752, 200, 195, 238, 87, - /* 570 */ 88, 243, 75, 8, 262, 659, 72, 806, 681, 121, - /* 580 */ 206, 135, 122, 799, 160, 123, 159, 846, 158, 161, - /* 590 */ 162, 164, 163, 798, 684, 124, 880, 790, 2, 136, - /* 600 */ 4, 145, 143, 146, 147, 76, 148, 251, 892, 688, - /* 610 */ 138, 26, 264, 729, 9, 10, 27, 7, 11, 21, - /* 620 */ 731, 22, 85, 591, 83, 587, 585, 584, 583, 580, - /* 630 */ 553, 275, 93, 89, 31, 59, 630, 97, 99, 629, + /* 250 */ 77, 44, 43, 42, 209, 210, 237, 236, 259, 901, + /* 260 */ 23, 197, 305, 304, 209, 210, 225, 303, 78, 302, + /* 270 */ 301, 300, 73, 299, 298, 884, 104, 30, 882, 883, + /* 280 */ 36, 296, 720, 885, 723, 887, 888, 886, 667, 889, + /* 290 */ 890, 55, 53, 57, 54, 132, 309, 308, 125, 46, + /* 300 */ 45, 914, 239, 44, 43, 42, 102, 107, 30, 196, + /* 310 */ 664, 73, 96, 106, 112, 115, 105, 24, 217, 36, + /* 320 */ 674, 913, 109, 5, 155, 56, 261, 79, 243, 33, + /* 330 */ 154, 91, 86, 90, 30, 56, 173, 169, 726, 30, + /* 340 */ 70, 30, 171, 168, 120, 119, 118, 12, 726, 279, + /* 350 */ 211, 83, 913, 80, 725, 824, 46, 45, 245, 165, + /* 360 */ 44, 43, 42, 198, 725, 816, 671, 652, 182, 165, + /* 370 */ 649, 719, 650, 722, 651, 280, 1, 153, 913, 716, + /* 380 */ 284, 61, 288, 913, 183, 913, 241, 695, 696, 680, + /* 390 */ 31, 686, 687, 134, 6, 60, 20, 747, 227, 228, + /* 400 */ 728, 19, 638, 62, 19, 263, 31, 640, 265, 31, + /* 410 */ 639, 60, 82, 28, 60, 717, 266, 95, 94, 14, + /* 420 */ 13, 67, 730, 627, 185, 101, 100, 179, 16, 15, + /* 430 */ 979, 656, 654, 657, 655, 114, 113, 130, 128, 186, + /* 440 */ 187, 193, 194, 192, 177, 191, 181, 1026, 915, 978, + /* 450 */ 214, 975, 974, 215, 287, 131, 39, 936, 944, 946, + /* 460 */ 133, 137, 929, 244, 129, 150, 961, 960, 911, 909, + /* 470 */ 149, 679, 246, 151, 204, 152, 653, 250, 258, 827, + /* 480 */ 140, 66, 141, 268, 37, 63, 175, 926, 34, 277, + /* 490 */ 248, 823, 253, 142, 1031, 58, 92, 1030, 1028, 256, + /* 500 */ 156, 143, 281, 1025, 98, 1024, 1022, 254, 157, 845, + /* 510 */ 35, 32, 38, 252, 176, 812, 108, 810, 110, 111, + /* 520 */ 808, 807, 229, 167, 805, 804, 803, 802, 801, 800, + /* 530 */ 170, 172, 797, 795, 793, 791, 789, 174, 247, 242, + /* 540 */ 71, 74, 249, 962, 40, 297, 103, 289, 290, 291, + /* 550 */ 292, 293, 294, 295, 199, 221, 307, 766, 231, 232, + /* 560 */ 267, 765, 234, 235, 764, 200, 238, 87, 88, 752, + /* 570 */ 195, 243, 75, 8, 262, 806, 72, 659, 681, 135, + /* 580 */ 76, 121, 159, 846, 160, 161, 158, 162, 164, 122, + /* 590 */ 163, 799, 2, 123, 880, 124, 798, 790, 684, 144, + /* 600 */ 147, 145, 146, 4, 136, 148, 892, 206, 251, 26, + /* 610 */ 688, 138, 9, 10, 729, 27, 7, 11, 21, 731, + /* 620 */ 22, 85, 264, 591, 587, 83, 585, 584, 583, 580, + /* 630 */ 553, 275, 93, 89, 31, 630, 59, 97, 629, 99, /* 640 */ 626, 575, 573, 565, 571, 567, 569, 563, 561, 594, - /* 650 */ 593, 592, 590, 589, 588, 586, 582, 581, 60, 519, - /* 660 */ 551, 517, 770, 769, 769, 769, 769, 769, 769, 769, + /* 650 */ 593, 592, 590, 589, 588, 586, 582, 581, 60, 551, + /* 660 */ 519, 517, 770, 769, 769, 769, 769, 769, 769, 769, /* 670 */ 769, 769, 769, 769, 126, 127, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 192, 1, 191, 192, 211, 192, 192, 195, 196, 9, - /* 10 */ 189, 190, 253, 13, 14, 192, 16, 17, 192, 253, - /* 20 */ 20, 21, 253, 23, 24, 25, 26, 27, 28, 263, - /* 30 */ 237, 262, 263, 33, 34, 253, 253, 37, 38, 39, - /* 40 */ 13, 14, 234, 16, 17, 262, 263, 20, 21, 1, - /* 50 */ 23, 24, 25, 26, 27, 28, 235, 9, 253, 233, - /* 60 */ 33, 34, 236, 211, 37, 38, 39, 14, 254, 16, - /* 70 */ 17, 250, 259, 20, 21, 1, 23, 24, 25, 26, - /* 80 */ 27, 28, 259, 9, 261, 211, 33, 34, 79, 237, + /* 0 */ 190, 1, 189, 190, 209, 190, 190, 193, 194, 9, + /* 10 */ 187, 188, 251, 13, 14, 190, 16, 17, 190, 251, + /* 20 */ 20, 21, 251, 23, 24, 25, 26, 27, 28, 261, + /* 30 */ 235, 260, 261, 33, 34, 251, 251, 37, 38, 39, + /* 40 */ 13, 14, 232, 16, 17, 260, 261, 20, 21, 1, + /* 50 */ 23, 24, 25, 26, 27, 28, 233, 9, 251, 231, + /* 60 */ 33, 34, 234, 209, 37, 38, 39, 14, 252, 16, + /* 70 */ 17, 248, 257, 20, 21, 1, 23, 24, 25, 26, + /* 80 */ 27, 28, 257, 9, 259, 209, 33, 34, 79, 235, /* 90 */ 37, 38, 39, 45, 46, 47, 48, 49, 50, 51, - /* 100 */ 52, 53, 54, 55, 56, 57, 58, 5, 198, 61, - /* 110 */ 110, 237, 81, 13, 14, 192, 16, 17, 253, 192, - /* 120 */ 20, 21, 1, 23, 24, 25, 26, 27, 28, 253, - /* 130 */ 9, 211, 105, 33, 34, 33, 34, 37, 38, 39, - /* 140 */ 13, 14, 232, 16, 17, 67, 253, 20, 21, 37, - /* 150 */ 23, 24, 25, 26, 27, 28, 233, 237, 0, 236, - /* 160 */ 33, 34, 67, 236, 37, 38, 39, 88, 89, 90, + /* 100 */ 52, 53, 54, 55, 56, 57, 58, 5, 196, 61, + /* 110 */ 110, 235, 251, 13, 14, 190, 16, 17, 81, 190, + /* 120 */ 20, 21, 1, 23, 24, 25, 26, 27, 28, 109, + /* 130 */ 9, 209, 105, 33, 34, 33, 34, 37, 38, 39, + /* 140 */ 13, 14, 230, 16, 17, 67, 251, 20, 21, 129, + /* 150 */ 23, 24, 25, 26, 27, 28, 231, 235, 0, 234, + /* 160 */ 33, 34, 67, 234, 37, 38, 39, 88, 89, 90, /* 170 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 180 */ 101, 102, 210, 192, 212, 213, 214, 215, 216, 217, - /* 190 */ 218, 219, 220, 221, 222, 223, 224, 225, 16, 17, - /* 200 */ 197, 253, 20, 21, 201, 23, 24, 25, 26, 27, - /* 210 */ 28, 253, 44, 198, 136, 33, 34, 139, 140, 37, - /* 220 */ 38, 39, 1, 2, 235, 104, 5, 115, 7, 61, - /* 230 */ 9, 136, 1, 2, 139, 67, 5, 79, 7, 250, - /* 240 */ 9, 73, 74, 75, 229, 230, 231, 232, 257, 135, - /* 250 */ 259, 37, 38, 39, 33, 34, 142, 143, 37, 192, - /* 260 */ 88, 76, 90, 91, 33, 34, 81, 95, 238, 97, - /* 270 */ 98, 99, 104, 101, 102, 210, 192, 192, 213, 214, - /* 280 */ 112, 251, 192, 218, 197, 220, 221, 222, 201, 224, - /* 290 */ 225, 25, 26, 27, 28, 253, 64, 65, 66, 33, - /* 300 */ 34, 237, 134, 37, 38, 39, 62, 63, 192, 141, - /* 310 */ 15, 104, 68, 69, 70, 71, 72, 227, 233, 112, - /* 320 */ 105, 236, 78, 62, 63, 104, 259, 192, 113, 68, - /* 330 */ 69, 70, 71, 72, 192, 104, 62, 63, 117, 255, - /* 340 */ 192, 198, 68, 69, 70, 71, 72, 104, 117, 233, - /* 350 */ 253, 108, 236, 110, 133, 104, 33, 34, 107, 197, - /* 360 */ 37, 38, 39, 201, 133, 199, 200, 2, 233, 1, - /* 370 */ 5, 236, 7, 230, 9, 233, 124, 125, 236, 109, - /* 380 */ 5, 233, 7, 105, 236, 105, 116, 109, 105, 109, - /* 390 */ 105, 105, 109, 105, 109, 109, 60, 109, 33, 34, - /* 400 */ 5, 109, 7, 253, 105, 37, 111, 109, 109, 105, - /* 410 */ 105, 105, 105, 109, 109, 109, 109, 253, 137, 138, - /* 420 */ 253, 137, 138, 131, 137, 138, 104, 129, 106, 253, - /* 430 */ 137, 138, 5, 5, 7, 7, 76, 77, 62, 63, - /* 440 */ 104, 253, 253, 253, 253, 253, 253, 237, 228, 192, - /* 450 */ 228, 228, 228, 228, 228, 228, 192, 252, 260, 192, - /* 460 */ 192, 192, 260, 235, 235, 192, 60, 192, 235, 239, - /* 470 */ 193, 192, 117, 256, 192, 256, 111, 118, 122, 126, - /* 480 */ 128, 192, 192, 192, 130, 249, 192, 248, 192, 192, - /* 490 */ 256, 256, 192, 192, 192, 192, 127, 247, 121, 246, - /* 500 */ 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, - /* 510 */ 192, 192, 192, 192, 120, 244, 192, 192, 192, 192, - /* 520 */ 192, 192, 192, 192, 192, 192, 192, 192, 119, 192, - /* 530 */ 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, - /* 540 */ 132, 193, 193, 193, 193, 103, 87, 86, 50, 83, - /* 550 */ 85, 54, 84, 82, 79, 193, 5, 193, 144, 5, - /* 560 */ 193, 5, 144, 5, 5, 89, 193, 193, 135, 198, - /* 570 */ 198, 113, 109, 104, 107, 105, 114, 193, 105, 194, - /* 580 */ 1, 104, 194, 193, 203, 194, 207, 209, 208, 206, - /* 590 */ 204, 202, 205, 193, 105, 194, 226, 193, 199, 109, - /* 600 */ 195, 243, 245, 242, 241, 104, 240, 104, 226, 105, - /* 610 */ 104, 109, 107, 105, 123, 123, 109, 104, 104, 104, - /* 620 */ 111, 104, 76, 9, 108, 5, 5, 5, 5, 5, - /* 630 */ 80, 15, 138, 76, 109, 16, 5, 138, 138, 5, + /* 180 */ 101, 102, 208, 190, 210, 211, 212, 213, 214, 215, + /* 190 */ 216, 217, 218, 219, 220, 221, 222, 223, 16, 17, + /* 200 */ 195, 190, 20, 21, 199, 23, 24, 25, 26, 27, + /* 210 */ 28, 251, 44, 196, 136, 33, 34, 139, 140, 37, + /* 220 */ 38, 39, 1, 2, 233, 104, 5, 196, 7, 61, + /* 230 */ 9, 136, 1, 2, 139, 67, 5, 79, 7, 248, + /* 240 */ 9, 73, 74, 75, 227, 228, 229, 230, 255, 135, + /* 250 */ 257, 37, 38, 39, 33, 34, 142, 143, 37, 228, + /* 260 */ 88, 251, 90, 91, 33, 34, 190, 95, 257, 97, + /* 270 */ 98, 99, 104, 101, 102, 208, 76, 190, 211, 212, + /* 280 */ 112, 81, 5, 216, 7, 218, 219, 220, 37, 222, + /* 290 */ 223, 25, 26, 27, 28, 190, 64, 65, 66, 33, + /* 300 */ 34, 225, 134, 37, 38, 39, 62, 63, 190, 141, + /* 310 */ 109, 104, 68, 69, 70, 71, 72, 116, 231, 112, + /* 320 */ 105, 234, 78, 62, 63, 104, 15, 236, 113, 68, + /* 330 */ 69, 70, 71, 72, 190, 104, 62, 63, 117, 190, + /* 340 */ 249, 190, 68, 69, 70, 71, 72, 104, 117, 231, + /* 350 */ 60, 108, 234, 110, 133, 195, 33, 34, 253, 199, + /* 360 */ 37, 38, 39, 251, 133, 195, 115, 2, 251, 199, + /* 370 */ 5, 5, 7, 7, 9, 231, 197, 198, 234, 1, + /* 380 */ 231, 109, 231, 234, 251, 234, 105, 124, 125, 105, + /* 390 */ 109, 105, 105, 109, 104, 109, 109, 105, 33, 34, + /* 400 */ 105, 109, 105, 131, 109, 105, 109, 105, 105, 109, + /* 410 */ 105, 109, 109, 104, 109, 37, 107, 137, 138, 137, + /* 420 */ 138, 104, 111, 106, 251, 137, 138, 251, 137, 138, + /* 430 */ 226, 5, 5, 7, 7, 76, 77, 62, 63, 251, + /* 440 */ 251, 251, 251, 251, 251, 251, 251, 235, 235, 226, + /* 450 */ 226, 226, 226, 226, 226, 190, 250, 190, 190, 190, + /* 460 */ 190, 190, 233, 233, 60, 190, 258, 258, 233, 190, + /* 470 */ 237, 117, 254, 190, 254, 190, 111, 119, 122, 190, + /* 480 */ 246, 128, 245, 190, 190, 130, 190, 247, 190, 190, + /* 490 */ 254, 190, 254, 244, 190, 127, 190, 190, 190, 126, + /* 500 */ 190, 243, 190, 190, 190, 190, 190, 121, 190, 190, + /* 510 */ 190, 190, 190, 120, 190, 190, 190, 190, 190, 190, + /* 520 */ 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, + /* 530 */ 190, 190, 190, 190, 190, 190, 190, 190, 118, 191, + /* 540 */ 191, 191, 191, 191, 132, 103, 87, 86, 50, 83, + /* 550 */ 85, 54, 84, 82, 191, 191, 79, 5, 144, 5, + /* 560 */ 191, 5, 144, 5, 5, 191, 135, 196, 196, 89, + /* 570 */ 191, 113, 109, 104, 107, 191, 114, 105, 105, 104, + /* 580 */ 104, 192, 205, 207, 201, 204, 206, 202, 200, 192, + /* 590 */ 203, 191, 197, 192, 224, 192, 191, 191, 105, 242, + /* 600 */ 239, 241, 240, 193, 109, 238, 224, 1, 104, 109, + /* 610 */ 105, 104, 123, 123, 105, 109, 104, 104, 104, 111, + /* 620 */ 104, 76, 107, 9, 5, 108, 5, 5, 5, 5, + /* 630 */ 80, 15, 138, 76, 109, 5, 16, 138, 5, 138, /* 640 */ 105, 5, 5, 5, 5, 5, 5, 5, 5, 5, - /* 650 */ 5, 5, 5, 5, 5, 5, 5, 5, 109, 60, - /* 660 */ 80, 59, 0, 264, 264, 264, 264, 264, 264, 264, - /* 670 */ 264, 264, 264, 264, 21, 21, 264, 264, 264, 264, - /* 680 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - /* 690 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - /* 700 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - /* 710 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - /* 720 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - /* 730 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - /* 740 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - /* 750 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - /* 760 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - /* 770 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - /* 780 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - /* 790 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - /* 800 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - /* 810 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - /* 820 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - /* 830 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - /* 840 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - /* 850 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - /* 860 */ 264, 264, 264, 264, + /* 650 */ 5, 5, 5, 5, 5, 5, 5, 5, 109, 80, + /* 660 */ 60, 59, 0, 262, 262, 262, 262, 262, 262, 262, + /* 670 */ 262, 262, 262, 262, 21, 21, 262, 262, 262, 262, + /* 680 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 690 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 700 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 710 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 720 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 730 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 740 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 750 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 760 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 770 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 780 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 790 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 800 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 810 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 820 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 830 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 840 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 850 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, + /* 860 */ 262, 262, }; #define YY_SHIFT_COUNT (312) #define YY_SHIFT_MIN (0) @@ -371,58 +371,58 @@ static const unsigned short int yy_shift_ofst[] = { /* 0 */ 168, 79, 79, 172, 172, 9, 221, 231, 74, 74, /* 10 */ 74, 74, 74, 74, 74, 74, 74, 0, 48, 231, /* 20 */ 365, 365, 365, 365, 121, 207, 74, 74, 74, 158, - /* 30 */ 74, 74, 185, 9, 31, 31, 676, 676, 676, 231, + /* 30 */ 74, 74, 200, 9, 37, 37, 676, 676, 676, 231, /* 40 */ 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, /* 50 */ 231, 231, 231, 231, 231, 231, 231, 231, 231, 365, /* 60 */ 365, 102, 102, 102, 102, 102, 102, 102, 74, 74, - /* 70 */ 112, 74, 207, 207, 74, 74, 74, 252, 252, 270, + /* 70 */ 251, 74, 207, 207, 74, 74, 74, 263, 263, 201, /* 80 */ 207, 74, 74, 74, 74, 74, 74, 74, 74, 74, /* 90 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, /* 100 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, /* 110 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, /* 120 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, - /* 130 */ 74, 406, 406, 406, 355, 355, 355, 406, 355, 406, - /* 140 */ 352, 354, 369, 356, 353, 377, 394, 409, 359, 408, - /* 150 */ 406, 406, 406, 442, 9, 9, 406, 406, 459, 461, - /* 160 */ 498, 466, 465, 497, 468, 471, 442, 406, 475, 475, - /* 170 */ 406, 475, 406, 475, 406, 676, 676, 27, 100, 127, + /* 130 */ 74, 404, 404, 404, 354, 354, 354, 404, 354, 404, + /* 140 */ 353, 355, 368, 356, 373, 386, 393, 358, 420, 412, + /* 150 */ 404, 404, 404, 442, 9, 9, 404, 404, 459, 461, + /* 160 */ 498, 466, 465, 497, 468, 471, 442, 404, 477, 477, + /* 170 */ 404, 477, 404, 477, 404, 676, 676, 27, 100, 127, /* 180 */ 100, 100, 53, 182, 266, 266, 266, 266, 244, 261, /* 190 */ 274, 323, 323, 323, 323, 78, 114, 214, 214, 243, - /* 200 */ 95, 232, 278, 215, 280, 283, 285, 286, 288, 375, - /* 210 */ 395, 368, 336, 295, 292, 298, 299, 304, 305, 306, - /* 220 */ 307, 251, 281, 284, 287, 322, 293, 427, 428, 360, - /* 230 */ 376, 551, 414, 554, 556, 418, 558, 559, 476, 433, - /* 240 */ 458, 467, 469, 462, 470, 463, 473, 477, 489, 490, - /* 250 */ 501, 579, 503, 504, 506, 502, 491, 507, 492, 508, - /* 260 */ 513, 509, 514, 467, 515, 505, 517, 516, 546, 614, - /* 270 */ 620, 621, 622, 623, 624, 550, 616, 557, 494, 525, - /* 280 */ 525, 619, 499, 500, 525, 631, 634, 535, 525, 636, + /* 200 */ 95, 232, 281, 215, 284, 286, 287, 292, 295, 277, + /* 210 */ 366, 378, 290, 311, 272, 20, 297, 300, 302, 303, + /* 220 */ 305, 309, 280, 282, 288, 317, 291, 426, 427, 359, + /* 230 */ 375, 552, 414, 554, 556, 418, 558, 559, 480, 431, + /* 240 */ 458, 467, 469, 462, 472, 463, 473, 475, 493, 495, + /* 250 */ 476, 606, 504, 505, 507, 500, 489, 506, 490, 509, + /* 260 */ 512, 508, 513, 467, 514, 515, 516, 517, 545, 614, + /* 270 */ 619, 621, 622, 623, 624, 550, 616, 557, 494, 525, + /* 280 */ 525, 620, 499, 501, 525, 630, 633, 535, 525, 636, /* 290 */ 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, - /* 300 */ 647, 648, 649, 650, 651, 652, 549, 580, 653, 654, - /* 310 */ 599, 602, 662, + /* 300 */ 647, 648, 649, 650, 651, 652, 549, 579, 653, 654, + /* 310 */ 600, 602, 662, }; #define YY_REDUCE_COUNT (176) -#define YY_REDUCE_MIN (-241) -#define YY_REDUCE_MAX (405) +#define YY_REDUCE_MIN (-239) +#define YY_REDUCE_MAX (410) static const short yy_reduce_ofst[] = { - /* 0 */ -179, -28, -28, 65, 65, 15, -231, -217, -174, -177, - /* 10 */ -9, -77, 85, 116, 135, 142, 148, -186, -189, -234, - /* 20 */ -207, -148, -126, -80, 84, -11, -187, 67, -192, -90, - /* 30 */ 90, -73, 3, 143, 87, 162, 30, 166, -188, -241, - /* 40 */ -218, -195, -135, -124, -107, -52, -42, 42, 97, 150, - /* 50 */ 164, 167, 176, 188, 189, 190, 191, 192, 193, 64, - /* 60 */ 210, 220, 222, 223, 224, 225, 226, 227, 257, 264, - /* 70 */ 205, 267, 228, 229, 268, 269, 273, 198, 202, 230, - /* 80 */ 233, 275, 279, 282, 289, 290, 291, 294, 296, 297, - /* 90 */ 300, 301, 302, 303, 308, 309, 310, 311, 312, 313, - /* 100 */ 314, 315, 316, 317, 318, 319, 320, 321, 324, 325, - /* 110 */ 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, + /* 0 */ -177, -26, -26, 67, 67, 17, -229, -215, -172, -175, + /* 10 */ -7, -75, 87, 118, 144, 149, 151, -184, -187, -232, + /* 20 */ -205, -146, -124, -78, 105, -9, -185, 11, -190, -88, + /* 30 */ 76, -71, 5, 31, 160, 170, 91, 179, -186, -239, + /* 40 */ -216, -193, -139, -105, -40, 10, 112, 117, 133, 173, + /* 50 */ 176, 188, 189, 190, 191, 192, 193, 194, 195, 212, + /* 60 */ 213, 204, 223, 224, 225, 226, 227, 228, 265, 267, + /* 70 */ 206, 268, 229, 230, 269, 270, 271, 208, 209, 233, + /* 80 */ 235, 275, 279, 283, 285, 289, 293, 294, 296, 298, + /* 90 */ 299, 301, 304, 306, 307, 308, 310, 312, 313, 314, + /* 100 */ 315, 316, 318, 319, 320, 321, 322, 324, 325, 326, + /* 110 */ 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, /* 120 */ 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, - /* 130 */ 347, 277, 348, 349, 217, 219, 234, 350, 235, 351, - /* 140 */ 236, 239, 250, 253, 357, 271, 358, 361, 363, 366, - /* 150 */ 362, 364, 367, 370, 371, 372, 373, 374, 378, 380, - /* 160 */ 379, 381, 383, 386, 387, 389, 382, 384, 385, 388, - /* 170 */ 390, 391, 400, 401, 404, 399, 405, + /* 130 */ 347, 348, 349, 350, 218, 220, 236, 351, 238, 352, + /* 140 */ 240, 234, 237, 249, 258, 357, 360, 362, 361, 367, + /* 150 */ 363, 364, 369, 370, 371, 372, 374, 379, 376, 380, + /* 160 */ 377, 383, 381, 385, 387, 388, 382, 384, 389, 397, + /* 170 */ 400, 401, 405, 403, 406, 395, 410, }; static const YYACTIONTYPE yy_default[] = { /* 0 */ 767, 879, 825, 891, 813, 822, 1019, 1019, 767, 767, @@ -657,10 +657,8 @@ static const YYCODETYPE yyFallback[] = { 1, /* PREV => ID */ 1, /* LINEAR => ID */ 1, /* IMPORT => ID */ - 1, /* METRIC => ID */ 1, /* TBNAME => ID */ 1, /* JOIN => ID */ - 1, /* METRICS => ID */ 1, /* INSERT => ID */ 1, /* INTO => ID */ 1, /* VALUES => ID */ @@ -931,89 +929,87 @@ static const char *const yyTokenName[] = { /* 178 */ "PREV", /* 179 */ "LINEAR", /* 180 */ "IMPORT", - /* 181 */ "METRIC", - /* 182 */ "TBNAME", - /* 183 */ "JOIN", - /* 184 */ "METRICS", - /* 185 */ "INSERT", - /* 186 */ "INTO", - /* 187 */ "VALUES", - /* 188 */ "error", - /* 189 */ "program", - /* 190 */ "cmd", - /* 191 */ "dbPrefix", - /* 192 */ "ids", - /* 193 */ "cpxName", - /* 194 */ "ifexists", - /* 195 */ "alter_db_optr", - /* 196 */ "alter_topic_optr", - /* 197 */ "acct_optr", - /* 198 */ "ifnotexists", - /* 199 */ "db_optr", - /* 200 */ "topic_optr", - /* 201 */ "pps", - /* 202 */ "tseries", - /* 203 */ "dbs", - /* 204 */ "streams", - /* 205 */ "storage", - /* 206 */ "qtime", - /* 207 */ "users", - /* 208 */ "conns", - /* 209 */ "state", - /* 210 */ "keep", - /* 211 */ "tagitemlist", - /* 212 */ "cache", - /* 213 */ "replica", - /* 214 */ "quorum", - /* 215 */ "days", - /* 216 */ "minrows", - /* 217 */ "maxrows", - /* 218 */ "blocks", - /* 219 */ "ctime", - /* 220 */ "wal", - /* 221 */ "fsync", - /* 222 */ "comp", - /* 223 */ "prec", - /* 224 */ "update", - /* 225 */ "cachelast", - /* 226 */ "partitions", - /* 227 */ "typename", - /* 228 */ "signed", - /* 229 */ "create_table_args", - /* 230 */ "create_stable_args", - /* 231 */ "create_table_list", - /* 232 */ "create_from_stable", - /* 233 */ "columnlist", - /* 234 */ "tagNamelist", - /* 235 */ "select", - /* 236 */ "column", - /* 237 */ "tagitem", - /* 238 */ "selcollist", - /* 239 */ "from", - /* 240 */ "where_opt", - /* 241 */ "interval_opt", - /* 242 */ "session_option", - /* 243 */ "fill_opt", - /* 244 */ "sliding_opt", - /* 245 */ "groupby_opt", - /* 246 */ "orderby_opt", - /* 247 */ "having_opt", - /* 248 */ "slimit_opt", - /* 249 */ "limit_opt", - /* 250 */ "union", - /* 251 */ "sclp", - /* 252 */ "distinct", - /* 253 */ "expr", - /* 254 */ "as", - /* 255 */ "tablelist", - /* 256 */ "tmvar", - /* 257 */ "sortlist", - /* 258 */ "sortitem", - /* 259 */ "item", - /* 260 */ "sortorder", - /* 261 */ "grouplist", - /* 262 */ "exprlist", - /* 263 */ "expritem", + /* 181 */ "TBNAME", + /* 182 */ "JOIN", + /* 183 */ "INSERT", + /* 184 */ "INTO", + /* 185 */ "VALUES", + /* 186 */ "error", + /* 187 */ "program", + /* 188 */ "cmd", + /* 189 */ "dbPrefix", + /* 190 */ "ids", + /* 191 */ "cpxName", + /* 192 */ "ifexists", + /* 193 */ "alter_db_optr", + /* 194 */ "alter_topic_optr", + /* 195 */ "acct_optr", + /* 196 */ "ifnotexists", + /* 197 */ "db_optr", + /* 198 */ "topic_optr", + /* 199 */ "pps", + /* 200 */ "tseries", + /* 201 */ "dbs", + /* 202 */ "streams", + /* 203 */ "storage", + /* 204 */ "qtime", + /* 205 */ "users", + /* 206 */ "conns", + /* 207 */ "state", + /* 208 */ "keep", + /* 209 */ "tagitemlist", + /* 210 */ "cache", + /* 211 */ "replica", + /* 212 */ "quorum", + /* 213 */ "days", + /* 214 */ "minrows", + /* 215 */ "maxrows", + /* 216 */ "blocks", + /* 217 */ "ctime", + /* 218 */ "wal", + /* 219 */ "fsync", + /* 220 */ "comp", + /* 221 */ "prec", + /* 222 */ "update", + /* 223 */ "cachelast", + /* 224 */ "partitions", + /* 225 */ "typename", + /* 226 */ "signed", + /* 227 */ "create_table_args", + /* 228 */ "create_stable_args", + /* 229 */ "create_table_list", + /* 230 */ "create_from_stable", + /* 231 */ "columnlist", + /* 232 */ "tagNamelist", + /* 233 */ "select", + /* 234 */ "column", + /* 235 */ "tagitem", + /* 236 */ "selcollist", + /* 237 */ "from", + /* 238 */ "where_opt", + /* 239 */ "interval_opt", + /* 240 */ "session_option", + /* 241 */ "fill_opt", + /* 242 */ "sliding_opt", + /* 243 */ "groupby_opt", + /* 244 */ "orderby_opt", + /* 245 */ "having_opt", + /* 246 */ "slimit_opt", + /* 247 */ "limit_opt", + /* 248 */ "union", + /* 249 */ "sclp", + /* 250 */ "distinct", + /* 251 */ "expr", + /* 252 */ "as", + /* 253 */ "tablelist", + /* 254 */ "tmvar", + /* 255 */ "sortlist", + /* 256 */ "sortitem", + /* 257 */ "item", + /* 258 */ "sortorder", + /* 259 */ "grouplist", + /* 260 */ "exprlist", + /* 261 */ "expritem", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1406,52 +1402,52 @@ static void yy_destructor( ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case 210: /* keep */ - case 211: /* tagitemlist */ - case 233: /* columnlist */ - case 234: /* tagNamelist */ - case 243: /* fill_opt */ - case 245: /* groupby_opt */ - case 246: /* orderby_opt */ - case 257: /* sortlist */ - case 261: /* grouplist */ + case 208: /* keep */ + case 209: /* tagitemlist */ + case 231: /* columnlist */ + case 232: /* tagNamelist */ + case 241: /* fill_opt */ + case 243: /* groupby_opt */ + case 244: /* orderby_opt */ + case 255: /* sortlist */ + case 259: /* grouplist */ { -taosArrayDestroy((yypminor->yy285)); +taosArrayDestroy((yypminor->yy429)); } break; - case 231: /* create_table_list */ + case 229: /* create_table_list */ { -destroyCreateTableSql((yypminor->yy470)); +destroyCreateTableSql((yypminor->yy194)); } break; - case 235: /* select */ + case 233: /* select */ { -destroyQuerySqlNode((yypminor->yy342)); +destroyQuerySqlNode((yypminor->yy254)); } break; - case 238: /* selcollist */ - case 251: /* sclp */ - case 262: /* exprlist */ + case 236: /* selcollist */ + case 249: /* sclp */ + case 260: /* exprlist */ { -tSqlExprListDestroy((yypminor->yy285)); +tSqlExprListDestroy((yypminor->yy429)); } break; - case 240: /* where_opt */ - case 247: /* having_opt */ - case 253: /* expr */ - case 263: /* expritem */ + case 238: /* where_opt */ + case 245: /* having_opt */ + case 251: /* expr */ + case 261: /* expritem */ { -tSqlExprDestroy((yypminor->yy178)); +tSqlExprDestroy((yypminor->yy170)); } break; - case 250: /* union */ + case 248: /* union */ { -destroyAllSelectClause((yypminor->yy513)); +destroyAllSelectClause((yypminor->yy141)); } break; - case 258: /* sortitem */ + case 256: /* sortitem */ { -tVariantDestroy(&(yypminor->yy362)); +tVariantDestroy(&(yypminor->yy218)); } break; /********* End destructor definitions *****************************************/ @@ -1745,271 +1741,271 @@ 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[] = { - { 189, -1 }, /* (0) program ::= cmd */ - { 190, -2 }, /* (1) cmd ::= SHOW DATABASES */ - { 190, -2 }, /* (2) cmd ::= SHOW TOPICS */ - { 190, -2 }, /* (3) cmd ::= SHOW MNODES */ - { 190, -2 }, /* (4) cmd ::= SHOW DNODES */ - { 190, -2 }, /* (5) cmd ::= SHOW ACCOUNTS */ - { 190, -2 }, /* (6) cmd ::= SHOW USERS */ - { 190, -2 }, /* (7) cmd ::= SHOW MODULES */ - { 190, -2 }, /* (8) cmd ::= SHOW QUERIES */ - { 190, -2 }, /* (9) cmd ::= SHOW CONNECTIONS */ - { 190, -2 }, /* (10) cmd ::= SHOW STREAMS */ - { 190, -2 }, /* (11) cmd ::= SHOW VARIABLES */ - { 190, -2 }, /* (12) cmd ::= SHOW SCORES */ - { 190, -2 }, /* (13) cmd ::= SHOW GRANTS */ - { 190, -2 }, /* (14) cmd ::= SHOW VNODES */ - { 190, -3 }, /* (15) cmd ::= SHOW VNODES IPTOKEN */ - { 191, 0 }, /* (16) dbPrefix ::= */ - { 191, -2 }, /* (17) dbPrefix ::= ids DOT */ - { 193, 0 }, /* (18) cpxName ::= */ - { 193, -2 }, /* (19) cpxName ::= DOT ids */ - { 190, -5 }, /* (20) cmd ::= SHOW CREATE TABLE ids cpxName */ - { 190, -4 }, /* (21) cmd ::= SHOW CREATE DATABASE ids */ - { 190, -3 }, /* (22) cmd ::= SHOW dbPrefix TABLES */ - { 190, -5 }, /* (23) cmd ::= SHOW dbPrefix TABLES LIKE ids */ - { 190, -3 }, /* (24) cmd ::= SHOW dbPrefix STABLES */ - { 190, -5 }, /* (25) cmd ::= SHOW dbPrefix STABLES LIKE ids */ - { 190, -3 }, /* (26) cmd ::= SHOW dbPrefix VGROUPS */ - { 190, -4 }, /* (27) cmd ::= SHOW dbPrefix VGROUPS ids */ - { 190, -5 }, /* (28) cmd ::= DROP TABLE ifexists ids cpxName */ - { 190, -5 }, /* (29) cmd ::= DROP STABLE ifexists ids cpxName */ - { 190, -4 }, /* (30) cmd ::= DROP DATABASE ifexists ids */ - { 190, -4 }, /* (31) cmd ::= DROP TOPIC ifexists ids */ - { 190, -3 }, /* (32) cmd ::= DROP DNODE ids */ - { 190, -3 }, /* (33) cmd ::= DROP USER ids */ - { 190, -3 }, /* (34) cmd ::= DROP ACCOUNT ids */ - { 190, -2 }, /* (35) cmd ::= USE ids */ - { 190, -3 }, /* (36) cmd ::= DESCRIBE ids cpxName */ - { 190, -5 }, /* (37) cmd ::= ALTER USER ids PASS ids */ - { 190, -5 }, /* (38) cmd ::= ALTER USER ids PRIVILEGE ids */ - { 190, -4 }, /* (39) cmd ::= ALTER DNODE ids ids */ - { 190, -5 }, /* (40) cmd ::= ALTER DNODE ids ids ids */ - { 190, -3 }, /* (41) cmd ::= ALTER LOCAL ids */ - { 190, -4 }, /* (42) cmd ::= ALTER LOCAL ids ids */ - { 190, -4 }, /* (43) cmd ::= ALTER DATABASE ids alter_db_optr */ - { 190, -4 }, /* (44) cmd ::= ALTER TOPIC ids alter_topic_optr */ - { 190, -4 }, /* (45) cmd ::= ALTER ACCOUNT ids acct_optr */ - { 190, -6 }, /* (46) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ - { 192, -1 }, /* (47) ids ::= ID */ - { 192, -1 }, /* (48) ids ::= STRING */ - { 194, -2 }, /* (49) ifexists ::= IF EXISTS */ - { 194, 0 }, /* (50) ifexists ::= */ - { 198, -3 }, /* (51) ifnotexists ::= IF NOT EXISTS */ - { 198, 0 }, /* (52) ifnotexists ::= */ - { 190, -3 }, /* (53) cmd ::= CREATE DNODE ids */ - { 190, -6 }, /* (54) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ - { 190, -5 }, /* (55) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ - { 190, -5 }, /* (56) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ - { 190, -5 }, /* (57) cmd ::= CREATE USER ids PASS ids */ - { 201, 0 }, /* (58) pps ::= */ - { 201, -2 }, /* (59) pps ::= PPS INTEGER */ - { 202, 0 }, /* (60) tseries ::= */ - { 202, -2 }, /* (61) tseries ::= TSERIES INTEGER */ - { 203, 0 }, /* (62) dbs ::= */ - { 203, -2 }, /* (63) dbs ::= DBS INTEGER */ - { 204, 0 }, /* (64) streams ::= */ - { 204, -2 }, /* (65) streams ::= STREAMS INTEGER */ - { 205, 0 }, /* (66) storage ::= */ - { 205, -2 }, /* (67) storage ::= STORAGE INTEGER */ - { 206, 0 }, /* (68) qtime ::= */ - { 206, -2 }, /* (69) qtime ::= QTIME INTEGER */ - { 207, 0 }, /* (70) users ::= */ - { 207, -2 }, /* (71) users ::= USERS INTEGER */ - { 208, 0 }, /* (72) conns ::= */ - { 208, -2 }, /* (73) conns ::= CONNS INTEGER */ - { 209, 0 }, /* (74) state ::= */ - { 209, -2 }, /* (75) state ::= STATE ids */ - { 197, -9 }, /* (76) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ - { 210, -2 }, /* (77) keep ::= KEEP tagitemlist */ - { 212, -2 }, /* (78) cache ::= CACHE INTEGER */ - { 213, -2 }, /* (79) replica ::= REPLICA INTEGER */ - { 214, -2 }, /* (80) quorum ::= QUORUM INTEGER */ - { 215, -2 }, /* (81) days ::= DAYS INTEGER */ - { 216, -2 }, /* (82) minrows ::= MINROWS INTEGER */ - { 217, -2 }, /* (83) maxrows ::= MAXROWS INTEGER */ - { 218, -2 }, /* (84) blocks ::= BLOCKS INTEGER */ - { 219, -2 }, /* (85) ctime ::= CTIME INTEGER */ - { 220, -2 }, /* (86) wal ::= WAL INTEGER */ - { 221, -2 }, /* (87) fsync ::= FSYNC INTEGER */ - { 222, -2 }, /* (88) comp ::= COMP INTEGER */ - { 223, -2 }, /* (89) prec ::= PRECISION STRING */ - { 224, -2 }, /* (90) update ::= UPDATE INTEGER */ - { 225, -2 }, /* (91) cachelast ::= CACHELAST INTEGER */ - { 226, -2 }, /* (92) partitions ::= PARTITIONS INTEGER */ - { 199, 0 }, /* (93) db_optr ::= */ - { 199, -2 }, /* (94) db_optr ::= db_optr cache */ - { 199, -2 }, /* (95) db_optr ::= db_optr replica */ - { 199, -2 }, /* (96) db_optr ::= db_optr quorum */ - { 199, -2 }, /* (97) db_optr ::= db_optr days */ - { 199, -2 }, /* (98) db_optr ::= db_optr minrows */ - { 199, -2 }, /* (99) db_optr ::= db_optr maxrows */ - { 199, -2 }, /* (100) db_optr ::= db_optr blocks */ - { 199, -2 }, /* (101) db_optr ::= db_optr ctime */ - { 199, -2 }, /* (102) db_optr ::= db_optr wal */ - { 199, -2 }, /* (103) db_optr ::= db_optr fsync */ - { 199, -2 }, /* (104) db_optr ::= db_optr comp */ - { 199, -2 }, /* (105) db_optr ::= db_optr prec */ - { 199, -2 }, /* (106) db_optr ::= db_optr keep */ - { 199, -2 }, /* (107) db_optr ::= db_optr update */ - { 199, -2 }, /* (108) db_optr ::= db_optr cachelast */ - { 200, -1 }, /* (109) topic_optr ::= db_optr */ - { 200, -2 }, /* (110) topic_optr ::= topic_optr partitions */ - { 195, 0 }, /* (111) alter_db_optr ::= */ - { 195, -2 }, /* (112) alter_db_optr ::= alter_db_optr replica */ - { 195, -2 }, /* (113) alter_db_optr ::= alter_db_optr quorum */ - { 195, -2 }, /* (114) alter_db_optr ::= alter_db_optr keep */ - { 195, -2 }, /* (115) alter_db_optr ::= alter_db_optr blocks */ - { 195, -2 }, /* (116) alter_db_optr ::= alter_db_optr comp */ - { 195, -2 }, /* (117) alter_db_optr ::= alter_db_optr wal */ - { 195, -2 }, /* (118) alter_db_optr ::= alter_db_optr fsync */ - { 195, -2 }, /* (119) alter_db_optr ::= alter_db_optr update */ - { 195, -2 }, /* (120) alter_db_optr ::= alter_db_optr cachelast */ - { 196, -1 }, /* (121) alter_topic_optr ::= alter_db_optr */ - { 196, -2 }, /* (122) alter_topic_optr ::= alter_topic_optr partitions */ - { 227, -1 }, /* (123) typename ::= ids */ - { 227, -4 }, /* (124) typename ::= ids LP signed RP */ - { 227, -2 }, /* (125) typename ::= ids UNSIGNED */ - { 228, -1 }, /* (126) signed ::= INTEGER */ - { 228, -2 }, /* (127) signed ::= PLUS INTEGER */ - { 228, -2 }, /* (128) signed ::= MINUS INTEGER */ - { 190, -3 }, /* (129) cmd ::= CREATE TABLE create_table_args */ - { 190, -3 }, /* (130) cmd ::= CREATE TABLE create_stable_args */ - { 190, -3 }, /* (131) cmd ::= CREATE STABLE create_stable_args */ - { 190, -3 }, /* (132) cmd ::= CREATE TABLE create_table_list */ - { 231, -1 }, /* (133) create_table_list ::= create_from_stable */ - { 231, -2 }, /* (134) create_table_list ::= create_table_list create_from_stable */ - { 229, -6 }, /* (135) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ - { 230, -10 }, /* (136) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ - { 232, -10 }, /* (137) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ - { 232, -13 }, /* (138) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ - { 234, -3 }, /* (139) tagNamelist ::= tagNamelist COMMA ids */ - { 234, -1 }, /* (140) tagNamelist ::= ids */ - { 229, -5 }, /* (141) create_table_args ::= ifnotexists ids cpxName AS select */ - { 233, -3 }, /* (142) columnlist ::= columnlist COMMA column */ - { 233, -1 }, /* (143) columnlist ::= column */ - { 236, -2 }, /* (144) column ::= ids typename */ - { 211, -3 }, /* (145) tagitemlist ::= tagitemlist COMMA tagitem */ - { 211, -1 }, /* (146) tagitemlist ::= tagitem */ - { 237, -1 }, /* (147) tagitem ::= INTEGER */ - { 237, -1 }, /* (148) tagitem ::= FLOAT */ - { 237, -1 }, /* (149) tagitem ::= STRING */ - { 237, -1 }, /* (150) tagitem ::= BOOL */ - { 237, -1 }, /* (151) tagitem ::= NULL */ - { 237, -2 }, /* (152) tagitem ::= MINUS INTEGER */ - { 237, -2 }, /* (153) tagitem ::= MINUS FLOAT */ - { 237, -2 }, /* (154) tagitem ::= PLUS INTEGER */ - { 237, -2 }, /* (155) tagitem ::= PLUS FLOAT */ - { 235, -13 }, /* (156) select ::= SELECT selcollist from where_opt interval_opt session_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ - { 235, -3 }, /* (157) select ::= LP select RP */ - { 250, -1 }, /* (158) union ::= select */ - { 250, -4 }, /* (159) union ::= union UNION ALL select */ - { 190, -1 }, /* (160) cmd ::= union */ - { 235, -2 }, /* (161) select ::= SELECT selcollist */ - { 251, -2 }, /* (162) sclp ::= selcollist COMMA */ - { 251, 0 }, /* (163) sclp ::= */ - { 238, -4 }, /* (164) selcollist ::= sclp distinct expr as */ - { 238, -2 }, /* (165) selcollist ::= sclp STAR */ - { 254, -2 }, /* (166) as ::= AS ids */ - { 254, -1 }, /* (167) as ::= ids */ - { 254, 0 }, /* (168) as ::= */ - { 252, -1 }, /* (169) distinct ::= DISTINCT */ - { 252, 0 }, /* (170) distinct ::= */ - { 239, -2 }, /* (171) from ::= FROM tablelist */ - { 239, -4 }, /* (172) from ::= FROM LP union RP */ - { 255, -2 }, /* (173) tablelist ::= ids cpxName */ - { 255, -3 }, /* (174) tablelist ::= ids cpxName ids */ - { 255, -4 }, /* (175) tablelist ::= tablelist COMMA ids cpxName */ - { 255, -5 }, /* (176) tablelist ::= tablelist COMMA ids cpxName ids */ - { 256, -1 }, /* (177) tmvar ::= VARIABLE */ - { 241, -4 }, /* (178) interval_opt ::= INTERVAL LP tmvar RP */ - { 241, -6 }, /* (179) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ - { 241, 0 }, /* (180) interval_opt ::= */ - { 242, 0 }, /* (181) session_option ::= */ - { 242, -7 }, /* (182) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ - { 243, 0 }, /* (183) fill_opt ::= */ - { 243, -6 }, /* (184) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ - { 243, -4 }, /* (185) fill_opt ::= FILL LP ID RP */ - { 244, -4 }, /* (186) sliding_opt ::= SLIDING LP tmvar RP */ - { 244, 0 }, /* (187) sliding_opt ::= */ - { 246, 0 }, /* (188) orderby_opt ::= */ - { 246, -3 }, /* (189) orderby_opt ::= ORDER BY sortlist */ - { 257, -4 }, /* (190) sortlist ::= sortlist COMMA item sortorder */ - { 257, -2 }, /* (191) sortlist ::= item sortorder */ - { 259, -2 }, /* (192) item ::= ids cpxName */ - { 260, -1 }, /* (193) sortorder ::= ASC */ - { 260, -1 }, /* (194) sortorder ::= DESC */ - { 260, 0 }, /* (195) sortorder ::= */ - { 245, 0 }, /* (196) groupby_opt ::= */ - { 245, -3 }, /* (197) groupby_opt ::= GROUP BY grouplist */ - { 261, -3 }, /* (198) grouplist ::= grouplist COMMA item */ - { 261, -1 }, /* (199) grouplist ::= item */ - { 247, 0 }, /* (200) having_opt ::= */ - { 247, -2 }, /* (201) having_opt ::= HAVING expr */ - { 249, 0 }, /* (202) limit_opt ::= */ - { 249, -2 }, /* (203) limit_opt ::= LIMIT signed */ - { 249, -4 }, /* (204) limit_opt ::= LIMIT signed OFFSET signed */ - { 249, -4 }, /* (205) limit_opt ::= LIMIT signed COMMA signed */ - { 248, 0 }, /* (206) slimit_opt ::= */ - { 248, -2 }, /* (207) slimit_opt ::= SLIMIT signed */ - { 248, -4 }, /* (208) slimit_opt ::= SLIMIT signed SOFFSET signed */ - { 248, -4 }, /* (209) slimit_opt ::= SLIMIT signed COMMA signed */ - { 240, 0 }, /* (210) where_opt ::= */ - { 240, -2 }, /* (211) where_opt ::= WHERE expr */ - { 253, -3 }, /* (212) expr ::= LP expr RP */ - { 253, -1 }, /* (213) expr ::= ID */ - { 253, -3 }, /* (214) expr ::= ID DOT ID */ - { 253, -3 }, /* (215) expr ::= ID DOT STAR */ - { 253, -1 }, /* (216) expr ::= INTEGER */ - { 253, -2 }, /* (217) expr ::= MINUS INTEGER */ - { 253, -2 }, /* (218) expr ::= PLUS INTEGER */ - { 253, -1 }, /* (219) expr ::= FLOAT */ - { 253, -2 }, /* (220) expr ::= MINUS FLOAT */ - { 253, -2 }, /* (221) expr ::= PLUS FLOAT */ - { 253, -1 }, /* (222) expr ::= STRING */ - { 253, -1 }, /* (223) expr ::= NOW */ - { 253, -1 }, /* (224) expr ::= VARIABLE */ - { 253, -1 }, /* (225) expr ::= BOOL */ - { 253, -4 }, /* (226) expr ::= ID LP exprlist RP */ - { 253, -4 }, /* (227) expr ::= ID LP STAR RP */ - { 253, -3 }, /* (228) expr ::= expr IS NULL */ - { 253, -4 }, /* (229) expr ::= expr IS NOT NULL */ - { 253, -3 }, /* (230) expr ::= expr LT expr */ - { 253, -3 }, /* (231) expr ::= expr GT expr */ - { 253, -3 }, /* (232) expr ::= expr LE expr */ - { 253, -3 }, /* (233) expr ::= expr GE expr */ - { 253, -3 }, /* (234) expr ::= expr NE expr */ - { 253, -3 }, /* (235) expr ::= expr EQ expr */ - { 253, -5 }, /* (236) expr ::= expr BETWEEN expr AND expr */ - { 253, -3 }, /* (237) expr ::= expr AND expr */ - { 253, -3 }, /* (238) expr ::= expr OR expr */ - { 253, -3 }, /* (239) expr ::= expr PLUS expr */ - { 253, -3 }, /* (240) expr ::= expr MINUS expr */ - { 253, -3 }, /* (241) expr ::= expr STAR expr */ - { 253, -3 }, /* (242) expr ::= expr SLASH expr */ - { 253, -3 }, /* (243) expr ::= expr REM expr */ - { 253, -3 }, /* (244) expr ::= expr LIKE expr */ - { 253, -5 }, /* (245) expr ::= expr IN LP exprlist RP */ - { 262, -3 }, /* (246) exprlist ::= exprlist COMMA expritem */ - { 262, -1 }, /* (247) exprlist ::= expritem */ - { 263, -1 }, /* (248) expritem ::= expr */ - { 263, 0 }, /* (249) expritem ::= */ - { 190, -3 }, /* (250) cmd ::= RESET QUERY CACHE */ - { 190, -7 }, /* (251) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ - { 190, -7 }, /* (252) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ - { 190, -7 }, /* (253) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ - { 190, -7 }, /* (254) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ - { 190, -8 }, /* (255) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ - { 190, -9 }, /* (256) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ - { 190, -7 }, /* (257) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ - { 190, -7 }, /* (258) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ - { 190, -7 }, /* (259) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ - { 190, -7 }, /* (260) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ - { 190, -8 }, /* (261) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ - { 190, -3 }, /* (262) cmd ::= KILL CONNECTION INTEGER */ - { 190, -5 }, /* (263) cmd ::= KILL STREAM INTEGER COLON INTEGER */ - { 190, -5 }, /* (264) cmd ::= KILL QUERY INTEGER COLON INTEGER */ + { 187, -1 }, /* (0) program ::= cmd */ + { 188, -2 }, /* (1) cmd ::= SHOW DATABASES */ + { 188, -2 }, /* (2) cmd ::= SHOW TOPICS */ + { 188, -2 }, /* (3) cmd ::= SHOW MNODES */ + { 188, -2 }, /* (4) cmd ::= SHOW DNODES */ + { 188, -2 }, /* (5) cmd ::= SHOW ACCOUNTS */ + { 188, -2 }, /* (6) cmd ::= SHOW USERS */ + { 188, -2 }, /* (7) cmd ::= SHOW MODULES */ + { 188, -2 }, /* (8) cmd ::= SHOW QUERIES */ + { 188, -2 }, /* (9) cmd ::= SHOW CONNECTIONS */ + { 188, -2 }, /* (10) cmd ::= SHOW STREAMS */ + { 188, -2 }, /* (11) cmd ::= SHOW VARIABLES */ + { 188, -2 }, /* (12) cmd ::= SHOW SCORES */ + { 188, -2 }, /* (13) cmd ::= SHOW GRANTS */ + { 188, -2 }, /* (14) cmd ::= SHOW VNODES */ + { 188, -3 }, /* (15) cmd ::= SHOW VNODES IPTOKEN */ + { 189, 0 }, /* (16) dbPrefix ::= */ + { 189, -2 }, /* (17) dbPrefix ::= ids DOT */ + { 191, 0 }, /* (18) cpxName ::= */ + { 191, -2 }, /* (19) cpxName ::= DOT ids */ + { 188, -5 }, /* (20) cmd ::= SHOW CREATE TABLE ids cpxName */ + { 188, -4 }, /* (21) cmd ::= SHOW CREATE DATABASE ids */ + { 188, -3 }, /* (22) cmd ::= SHOW dbPrefix TABLES */ + { 188, -5 }, /* (23) cmd ::= SHOW dbPrefix TABLES LIKE ids */ + { 188, -3 }, /* (24) cmd ::= SHOW dbPrefix STABLES */ + { 188, -5 }, /* (25) cmd ::= SHOW dbPrefix STABLES LIKE ids */ + { 188, -3 }, /* (26) cmd ::= SHOW dbPrefix VGROUPS */ + { 188, -4 }, /* (27) cmd ::= SHOW dbPrefix VGROUPS ids */ + { 188, -5 }, /* (28) cmd ::= DROP TABLE ifexists ids cpxName */ + { 188, -5 }, /* (29) cmd ::= DROP STABLE ifexists ids cpxName */ + { 188, -4 }, /* (30) cmd ::= DROP DATABASE ifexists ids */ + { 188, -4 }, /* (31) cmd ::= DROP TOPIC ifexists ids */ + { 188, -3 }, /* (32) cmd ::= DROP DNODE ids */ + { 188, -3 }, /* (33) cmd ::= DROP USER ids */ + { 188, -3 }, /* (34) cmd ::= DROP ACCOUNT ids */ + { 188, -2 }, /* (35) cmd ::= USE ids */ + { 188, -3 }, /* (36) cmd ::= DESCRIBE ids cpxName */ + { 188, -5 }, /* (37) cmd ::= ALTER USER ids PASS ids */ + { 188, -5 }, /* (38) cmd ::= ALTER USER ids PRIVILEGE ids */ + { 188, -4 }, /* (39) cmd ::= ALTER DNODE ids ids */ + { 188, -5 }, /* (40) cmd ::= ALTER DNODE ids ids ids */ + { 188, -3 }, /* (41) cmd ::= ALTER LOCAL ids */ + { 188, -4 }, /* (42) cmd ::= ALTER LOCAL ids ids */ + { 188, -4 }, /* (43) cmd ::= ALTER DATABASE ids alter_db_optr */ + { 188, -4 }, /* (44) cmd ::= ALTER TOPIC ids alter_topic_optr */ + { 188, -4 }, /* (45) cmd ::= ALTER ACCOUNT ids acct_optr */ + { 188, -6 }, /* (46) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ + { 190, -1 }, /* (47) ids ::= ID */ + { 190, -1 }, /* (48) ids ::= STRING */ + { 192, -2 }, /* (49) ifexists ::= IF EXISTS */ + { 192, 0 }, /* (50) ifexists ::= */ + { 196, -3 }, /* (51) ifnotexists ::= IF NOT EXISTS */ + { 196, 0 }, /* (52) ifnotexists ::= */ + { 188, -3 }, /* (53) cmd ::= CREATE DNODE ids */ + { 188, -6 }, /* (54) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ + { 188, -5 }, /* (55) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ + { 188, -5 }, /* (56) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ + { 188, -5 }, /* (57) cmd ::= CREATE USER ids PASS ids */ + { 199, 0 }, /* (58) pps ::= */ + { 199, -2 }, /* (59) pps ::= PPS INTEGER */ + { 200, 0 }, /* (60) tseries ::= */ + { 200, -2 }, /* (61) tseries ::= TSERIES INTEGER */ + { 201, 0 }, /* (62) dbs ::= */ + { 201, -2 }, /* (63) dbs ::= DBS INTEGER */ + { 202, 0 }, /* (64) streams ::= */ + { 202, -2 }, /* (65) streams ::= STREAMS INTEGER */ + { 203, 0 }, /* (66) storage ::= */ + { 203, -2 }, /* (67) storage ::= STORAGE INTEGER */ + { 204, 0 }, /* (68) qtime ::= */ + { 204, -2 }, /* (69) qtime ::= QTIME INTEGER */ + { 205, 0 }, /* (70) users ::= */ + { 205, -2 }, /* (71) users ::= USERS INTEGER */ + { 206, 0 }, /* (72) conns ::= */ + { 206, -2 }, /* (73) conns ::= CONNS INTEGER */ + { 207, 0 }, /* (74) state ::= */ + { 207, -2 }, /* (75) state ::= STATE ids */ + { 195, -9 }, /* (76) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ + { 208, -2 }, /* (77) keep ::= KEEP tagitemlist */ + { 210, -2 }, /* (78) cache ::= CACHE INTEGER */ + { 211, -2 }, /* (79) replica ::= REPLICA INTEGER */ + { 212, -2 }, /* (80) quorum ::= QUORUM INTEGER */ + { 213, -2 }, /* (81) days ::= DAYS INTEGER */ + { 214, -2 }, /* (82) minrows ::= MINROWS INTEGER */ + { 215, -2 }, /* (83) maxrows ::= MAXROWS INTEGER */ + { 216, -2 }, /* (84) blocks ::= BLOCKS INTEGER */ + { 217, -2 }, /* (85) ctime ::= CTIME INTEGER */ + { 218, -2 }, /* (86) wal ::= WAL INTEGER */ + { 219, -2 }, /* (87) fsync ::= FSYNC INTEGER */ + { 220, -2 }, /* (88) comp ::= COMP INTEGER */ + { 221, -2 }, /* (89) prec ::= PRECISION STRING */ + { 222, -2 }, /* (90) update ::= UPDATE INTEGER */ + { 223, -2 }, /* (91) cachelast ::= CACHELAST INTEGER */ + { 224, -2 }, /* (92) partitions ::= PARTITIONS INTEGER */ + { 197, 0 }, /* (93) db_optr ::= */ + { 197, -2 }, /* (94) db_optr ::= db_optr cache */ + { 197, -2 }, /* (95) db_optr ::= db_optr replica */ + { 197, -2 }, /* (96) db_optr ::= db_optr quorum */ + { 197, -2 }, /* (97) db_optr ::= db_optr days */ + { 197, -2 }, /* (98) db_optr ::= db_optr minrows */ + { 197, -2 }, /* (99) db_optr ::= db_optr maxrows */ + { 197, -2 }, /* (100) db_optr ::= db_optr blocks */ + { 197, -2 }, /* (101) db_optr ::= db_optr ctime */ + { 197, -2 }, /* (102) db_optr ::= db_optr wal */ + { 197, -2 }, /* (103) db_optr ::= db_optr fsync */ + { 197, -2 }, /* (104) db_optr ::= db_optr comp */ + { 197, -2 }, /* (105) db_optr ::= db_optr prec */ + { 197, -2 }, /* (106) db_optr ::= db_optr keep */ + { 197, -2 }, /* (107) db_optr ::= db_optr update */ + { 197, -2 }, /* (108) db_optr ::= db_optr cachelast */ + { 198, -1 }, /* (109) topic_optr ::= db_optr */ + { 198, -2 }, /* (110) topic_optr ::= topic_optr partitions */ + { 193, 0 }, /* (111) alter_db_optr ::= */ + { 193, -2 }, /* (112) alter_db_optr ::= alter_db_optr replica */ + { 193, -2 }, /* (113) alter_db_optr ::= alter_db_optr quorum */ + { 193, -2 }, /* (114) alter_db_optr ::= alter_db_optr keep */ + { 193, -2 }, /* (115) alter_db_optr ::= alter_db_optr blocks */ + { 193, -2 }, /* (116) alter_db_optr ::= alter_db_optr comp */ + { 193, -2 }, /* (117) alter_db_optr ::= alter_db_optr wal */ + { 193, -2 }, /* (118) alter_db_optr ::= alter_db_optr fsync */ + { 193, -2 }, /* (119) alter_db_optr ::= alter_db_optr update */ + { 193, -2 }, /* (120) alter_db_optr ::= alter_db_optr cachelast */ + { 194, -1 }, /* (121) alter_topic_optr ::= alter_db_optr */ + { 194, -2 }, /* (122) alter_topic_optr ::= alter_topic_optr partitions */ + { 225, -1 }, /* (123) typename ::= ids */ + { 225, -4 }, /* (124) typename ::= ids LP signed RP */ + { 225, -2 }, /* (125) typename ::= ids UNSIGNED */ + { 226, -1 }, /* (126) signed ::= INTEGER */ + { 226, -2 }, /* (127) signed ::= PLUS INTEGER */ + { 226, -2 }, /* (128) signed ::= MINUS INTEGER */ + { 188, -3 }, /* (129) cmd ::= CREATE TABLE create_table_args */ + { 188, -3 }, /* (130) cmd ::= CREATE TABLE create_stable_args */ + { 188, -3 }, /* (131) cmd ::= CREATE STABLE create_stable_args */ + { 188, -3 }, /* (132) cmd ::= CREATE TABLE create_table_list */ + { 229, -1 }, /* (133) create_table_list ::= create_from_stable */ + { 229, -2 }, /* (134) create_table_list ::= create_table_list create_from_stable */ + { 227, -6 }, /* (135) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ + { 228, -10 }, /* (136) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ + { 230, -10 }, /* (137) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ + { 230, -13 }, /* (138) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ + { 232, -3 }, /* (139) tagNamelist ::= tagNamelist COMMA ids */ + { 232, -1 }, /* (140) tagNamelist ::= ids */ + { 227, -5 }, /* (141) create_table_args ::= ifnotexists ids cpxName AS select */ + { 231, -3 }, /* (142) columnlist ::= columnlist COMMA column */ + { 231, -1 }, /* (143) columnlist ::= column */ + { 234, -2 }, /* (144) column ::= ids typename */ + { 209, -3 }, /* (145) tagitemlist ::= tagitemlist COMMA tagitem */ + { 209, -1 }, /* (146) tagitemlist ::= tagitem */ + { 235, -1 }, /* (147) tagitem ::= INTEGER */ + { 235, -1 }, /* (148) tagitem ::= FLOAT */ + { 235, -1 }, /* (149) tagitem ::= STRING */ + { 235, -1 }, /* (150) tagitem ::= BOOL */ + { 235, -1 }, /* (151) tagitem ::= NULL */ + { 235, -2 }, /* (152) tagitem ::= MINUS INTEGER */ + { 235, -2 }, /* (153) tagitem ::= MINUS FLOAT */ + { 235, -2 }, /* (154) tagitem ::= PLUS INTEGER */ + { 235, -2 }, /* (155) tagitem ::= PLUS FLOAT */ + { 233, -13 }, /* (156) select ::= SELECT selcollist from where_opt interval_opt session_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ + { 233, -3 }, /* (157) select ::= LP select RP */ + { 248, -1 }, /* (158) union ::= select */ + { 248, -4 }, /* (159) union ::= union UNION ALL select */ + { 188, -1 }, /* (160) cmd ::= union */ + { 233, -2 }, /* (161) select ::= SELECT selcollist */ + { 249, -2 }, /* (162) sclp ::= selcollist COMMA */ + { 249, 0 }, /* (163) sclp ::= */ + { 236, -4 }, /* (164) selcollist ::= sclp distinct expr as */ + { 236, -2 }, /* (165) selcollist ::= sclp STAR */ + { 252, -2 }, /* (166) as ::= AS ids */ + { 252, -1 }, /* (167) as ::= ids */ + { 252, 0 }, /* (168) as ::= */ + { 250, -1 }, /* (169) distinct ::= DISTINCT */ + { 250, 0 }, /* (170) distinct ::= */ + { 237, -2 }, /* (171) from ::= FROM tablelist */ + { 237, -4 }, /* (172) from ::= FROM LP union RP */ + { 253, -2 }, /* (173) tablelist ::= ids cpxName */ + { 253, -3 }, /* (174) tablelist ::= ids cpxName ids */ + { 253, -4 }, /* (175) tablelist ::= tablelist COMMA ids cpxName */ + { 253, -5 }, /* (176) tablelist ::= tablelist COMMA ids cpxName ids */ + { 254, -1 }, /* (177) tmvar ::= VARIABLE */ + { 239, -4 }, /* (178) interval_opt ::= INTERVAL LP tmvar RP */ + { 239, -6 }, /* (179) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ + { 239, 0 }, /* (180) interval_opt ::= */ + { 240, 0 }, /* (181) session_option ::= */ + { 240, -7 }, /* (182) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ + { 241, 0 }, /* (183) fill_opt ::= */ + { 241, -6 }, /* (184) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + { 241, -4 }, /* (185) fill_opt ::= FILL LP ID RP */ + { 242, -4 }, /* (186) sliding_opt ::= SLIDING LP tmvar RP */ + { 242, 0 }, /* (187) sliding_opt ::= */ + { 244, 0 }, /* (188) orderby_opt ::= */ + { 244, -3 }, /* (189) orderby_opt ::= ORDER BY sortlist */ + { 255, -4 }, /* (190) sortlist ::= sortlist COMMA item sortorder */ + { 255, -2 }, /* (191) sortlist ::= item sortorder */ + { 257, -2 }, /* (192) item ::= ids cpxName */ + { 258, -1 }, /* (193) sortorder ::= ASC */ + { 258, -1 }, /* (194) sortorder ::= DESC */ + { 258, 0 }, /* (195) sortorder ::= */ + { 243, 0 }, /* (196) groupby_opt ::= */ + { 243, -3 }, /* (197) groupby_opt ::= GROUP BY grouplist */ + { 259, -3 }, /* (198) grouplist ::= grouplist COMMA item */ + { 259, -1 }, /* (199) grouplist ::= item */ + { 245, 0 }, /* (200) having_opt ::= */ + { 245, -2 }, /* (201) having_opt ::= HAVING expr */ + { 247, 0 }, /* (202) limit_opt ::= */ + { 247, -2 }, /* (203) limit_opt ::= LIMIT signed */ + { 247, -4 }, /* (204) limit_opt ::= LIMIT signed OFFSET signed */ + { 247, -4 }, /* (205) limit_opt ::= LIMIT signed COMMA signed */ + { 246, 0 }, /* (206) slimit_opt ::= */ + { 246, -2 }, /* (207) slimit_opt ::= SLIMIT signed */ + { 246, -4 }, /* (208) slimit_opt ::= SLIMIT signed SOFFSET signed */ + { 246, -4 }, /* (209) slimit_opt ::= SLIMIT signed COMMA signed */ + { 238, 0 }, /* (210) where_opt ::= */ + { 238, -2 }, /* (211) where_opt ::= WHERE expr */ + { 251, -3 }, /* (212) expr ::= LP expr RP */ + { 251, -1 }, /* (213) expr ::= ID */ + { 251, -3 }, /* (214) expr ::= ID DOT ID */ + { 251, -3 }, /* (215) expr ::= ID DOT STAR */ + { 251, -1 }, /* (216) expr ::= INTEGER */ + { 251, -2 }, /* (217) expr ::= MINUS INTEGER */ + { 251, -2 }, /* (218) expr ::= PLUS INTEGER */ + { 251, -1 }, /* (219) expr ::= FLOAT */ + { 251, -2 }, /* (220) expr ::= MINUS FLOAT */ + { 251, -2 }, /* (221) expr ::= PLUS FLOAT */ + { 251, -1 }, /* (222) expr ::= STRING */ + { 251, -1 }, /* (223) expr ::= NOW */ + { 251, -1 }, /* (224) expr ::= VARIABLE */ + { 251, -1 }, /* (225) expr ::= BOOL */ + { 251, -4 }, /* (226) expr ::= ID LP exprlist RP */ + { 251, -4 }, /* (227) expr ::= ID LP STAR RP */ + { 251, -3 }, /* (228) expr ::= expr IS NULL */ + { 251, -4 }, /* (229) expr ::= expr IS NOT NULL */ + { 251, -3 }, /* (230) expr ::= expr LT expr */ + { 251, -3 }, /* (231) expr ::= expr GT expr */ + { 251, -3 }, /* (232) expr ::= expr LE expr */ + { 251, -3 }, /* (233) expr ::= expr GE expr */ + { 251, -3 }, /* (234) expr ::= expr NE expr */ + { 251, -3 }, /* (235) expr ::= expr EQ expr */ + { 251, -5 }, /* (236) expr ::= expr BETWEEN expr AND expr */ + { 251, -3 }, /* (237) expr ::= expr AND expr */ + { 251, -3 }, /* (238) expr ::= expr OR expr */ + { 251, -3 }, /* (239) expr ::= expr PLUS expr */ + { 251, -3 }, /* (240) expr ::= expr MINUS expr */ + { 251, -3 }, /* (241) expr ::= expr STAR expr */ + { 251, -3 }, /* (242) expr ::= expr SLASH expr */ + { 251, -3 }, /* (243) expr ::= expr REM expr */ + { 251, -3 }, /* (244) expr ::= expr LIKE expr */ + { 251, -5 }, /* (245) expr ::= expr IN LP exprlist RP */ + { 260, -3 }, /* (246) exprlist ::= exprlist COMMA expritem */ + { 260, -1 }, /* (247) exprlist ::= expritem */ + { 261, -1 }, /* (248) expritem ::= expr */ + { 261, 0 }, /* (249) expritem ::= */ + { 188, -3 }, /* (250) cmd ::= RESET QUERY CACHE */ + { 188, -7 }, /* (251) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + { 188, -7 }, /* (252) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + { 188, -7 }, /* (253) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + { 188, -7 }, /* (254) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + { 188, -8 }, /* (255) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + { 188, -9 }, /* (256) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + { 188, -7 }, /* (257) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + { 188, -7 }, /* (258) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + { 188, -7 }, /* (259) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + { 188, -7 }, /* (260) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + { 188, -8 }, /* (261) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + { 188, -3 }, /* (262) cmd ::= KILL CONNECTION INTEGER */ + { 188, -5 }, /* (263) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + { 188, -5 }, /* (264) cmd ::= KILL QUERY INTEGER COLON INTEGER */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2256,13 +2252,13 @@ static void yy_reduce( break; case 43: /* cmd ::= ALTER DATABASE ids alter_db_optr */ case 44: /* cmd ::= ALTER TOPIC ids alter_topic_optr */ yytestcase(yyruleno==44); -{ SStrToken t = {0}; setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy526, &t);} +{ SStrToken t = {0}; setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy94, &t);} break; case 45: /* cmd ::= ALTER ACCOUNT ids acct_optr */ -{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy187);} +{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy419);} break; case 46: /* cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ -{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy187);} +{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy419);} break; case 47: /* ids ::= ID */ case 48: /* ids ::= STRING */ yytestcase(yyruleno==48); @@ -2284,11 +2280,11 @@ static void yy_reduce( { setDCLSqlElems(pInfo, TSDB_SQL_CREATE_DNODE, 1, &yymsp[0].minor.yy0);} break; case 54: /* cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ -{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy187);} +{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy419);} break; case 55: /* cmd ::= CREATE DATABASE ifnotexists ids db_optr */ case 56: /* cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ yytestcase(yyruleno==56); -{ setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy526, &yymsp[-2].minor.yy0);} +{ setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy94, &yymsp[-2].minor.yy0);} break; case 57: /* cmd ::= CREATE USER ids PASS ids */ { setCreateUserSql(pInfo, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);} @@ -2317,20 +2313,20 @@ static void yy_reduce( break; case 76: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */ { - yylhsminor.yy187.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1; - yylhsminor.yy187.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1; - yylhsminor.yy187.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1; - yylhsminor.yy187.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1; - yylhsminor.yy187.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1; - yylhsminor.yy187.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1; - yylhsminor.yy187.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1; - yylhsminor.yy187.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1; - yylhsminor.yy187.stat = yymsp[0].minor.yy0; + yylhsminor.yy419.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1; + yylhsminor.yy419.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1; + yylhsminor.yy419.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1; + yylhsminor.yy419.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1; + yylhsminor.yy419.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1; + yylhsminor.yy419.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1; + yylhsminor.yy419.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1; + yylhsminor.yy419.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1; + yylhsminor.yy419.stat = yymsp[0].minor.yy0; } - yymsp[-8].minor.yy187 = yylhsminor.yy187; + yymsp[-8].minor.yy419 = yylhsminor.yy419; break; case 77: /* keep ::= KEEP tagitemlist */ -{ yymsp[-1].minor.yy285 = yymsp[0].minor.yy285; } +{ yymsp[-1].minor.yy429 = yymsp[0].minor.yy429; } break; case 78: /* cache ::= CACHE INTEGER */ case 79: /* replica ::= REPLICA INTEGER */ yytestcase(yyruleno==79); @@ -2350,234 +2346,234 @@ static void yy_reduce( { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } break; case 93: /* db_optr ::= */ -{setDefaultCreateDbOption(&yymsp[1].minor.yy526); yymsp[1].minor.yy526.dbType = TSDB_DB_TYPE_DEFAULT;} +{setDefaultCreateDbOption(&yymsp[1].minor.yy94); yymsp[1].minor.yy94.dbType = TSDB_DB_TYPE_DEFAULT;} break; case 94: /* db_optr ::= db_optr cache */ -{ yylhsminor.yy526 = yymsp[-1].minor.yy526; yylhsminor.yy526.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy526 = yylhsminor.yy526; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 95: /* db_optr ::= db_optr replica */ case 112: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==112); -{ yylhsminor.yy526 = yymsp[-1].minor.yy526; yylhsminor.yy526.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy526 = yylhsminor.yy526; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 96: /* db_optr ::= db_optr quorum */ case 113: /* alter_db_optr ::= alter_db_optr quorum */ yytestcase(yyruleno==113); -{ yylhsminor.yy526 = yymsp[-1].minor.yy526; yylhsminor.yy526.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy526 = yylhsminor.yy526; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 97: /* db_optr ::= db_optr days */ -{ yylhsminor.yy526 = yymsp[-1].minor.yy526; yylhsminor.yy526.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy526 = yylhsminor.yy526; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 98: /* db_optr ::= db_optr minrows */ -{ yylhsminor.yy526 = yymsp[-1].minor.yy526; yylhsminor.yy526.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } - yymsp[-1].minor.yy526 = yylhsminor.yy526; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 99: /* db_optr ::= db_optr maxrows */ -{ yylhsminor.yy526 = yymsp[-1].minor.yy526; yylhsminor.yy526.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } - yymsp[-1].minor.yy526 = yylhsminor.yy526; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 100: /* db_optr ::= db_optr blocks */ case 115: /* alter_db_optr ::= alter_db_optr blocks */ yytestcase(yyruleno==115); -{ yylhsminor.yy526 = yymsp[-1].minor.yy526; yylhsminor.yy526.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy526 = yylhsminor.yy526; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 101: /* db_optr ::= db_optr ctime */ -{ yylhsminor.yy526 = yymsp[-1].minor.yy526; yylhsminor.yy526.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy526 = yylhsminor.yy526; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 102: /* db_optr ::= db_optr wal */ case 117: /* alter_db_optr ::= alter_db_optr wal */ yytestcase(yyruleno==117); -{ yylhsminor.yy526 = yymsp[-1].minor.yy526; yylhsminor.yy526.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy526 = yylhsminor.yy526; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 103: /* db_optr ::= db_optr fsync */ case 118: /* alter_db_optr ::= alter_db_optr fsync */ yytestcase(yyruleno==118); -{ yylhsminor.yy526 = yymsp[-1].minor.yy526; yylhsminor.yy526.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy526 = yylhsminor.yy526; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 104: /* db_optr ::= db_optr comp */ case 116: /* alter_db_optr ::= alter_db_optr comp */ yytestcase(yyruleno==116); -{ yylhsminor.yy526 = yymsp[-1].minor.yy526; yylhsminor.yy526.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy526 = yylhsminor.yy526; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 105: /* db_optr ::= db_optr prec */ -{ yylhsminor.yy526 = yymsp[-1].minor.yy526; yylhsminor.yy526.precision = yymsp[0].minor.yy0; } - yymsp[-1].minor.yy526 = yylhsminor.yy526; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.precision = yymsp[0].minor.yy0; } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 106: /* db_optr ::= db_optr keep */ case 114: /* alter_db_optr ::= alter_db_optr keep */ yytestcase(yyruleno==114); -{ yylhsminor.yy526 = yymsp[-1].minor.yy526; yylhsminor.yy526.keep = yymsp[0].minor.yy285; } - yymsp[-1].minor.yy526 = yylhsminor.yy526; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.keep = yymsp[0].minor.yy429; } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 107: /* db_optr ::= db_optr update */ case 119: /* alter_db_optr ::= alter_db_optr update */ yytestcase(yyruleno==119); -{ yylhsminor.yy526 = yymsp[-1].minor.yy526; yylhsminor.yy526.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy526 = yylhsminor.yy526; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 108: /* db_optr ::= db_optr cachelast */ case 120: /* alter_db_optr ::= alter_db_optr cachelast */ yytestcase(yyruleno==120); -{ yylhsminor.yy526 = yymsp[-1].minor.yy526; yylhsminor.yy526.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy526 = yylhsminor.yy526; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 109: /* topic_optr ::= db_optr */ case 121: /* alter_topic_optr ::= alter_db_optr */ yytestcase(yyruleno==121); -{ yylhsminor.yy526 = yymsp[0].minor.yy526; yylhsminor.yy526.dbType = TSDB_DB_TYPE_TOPIC; } - yymsp[0].minor.yy526 = yylhsminor.yy526; +{ yylhsminor.yy94 = yymsp[0].minor.yy94; yylhsminor.yy94.dbType = TSDB_DB_TYPE_TOPIC; } + yymsp[0].minor.yy94 = yylhsminor.yy94; break; case 110: /* topic_optr ::= topic_optr partitions */ case 122: /* alter_topic_optr ::= alter_topic_optr partitions */ yytestcase(yyruleno==122); -{ yylhsminor.yy526 = yymsp[-1].minor.yy526; yylhsminor.yy526.partitions = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy526 = yylhsminor.yy526; +{ yylhsminor.yy94 = yymsp[-1].minor.yy94; yylhsminor.yy94.partitions = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy94 = yylhsminor.yy94; break; case 111: /* alter_db_optr ::= */ -{ setDefaultCreateDbOption(&yymsp[1].minor.yy526); yymsp[1].minor.yy526.dbType = TSDB_DB_TYPE_DEFAULT;} +{ setDefaultCreateDbOption(&yymsp[1].minor.yy94); yymsp[1].minor.yy94.dbType = TSDB_DB_TYPE_DEFAULT;} break; case 123: /* typename ::= ids */ { yymsp[0].minor.yy0.type = 0; - tSetColumnType (&yylhsminor.yy295, &yymsp[0].minor.yy0); + tSetColumnType (&yylhsminor.yy451, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy295 = yylhsminor.yy295; + yymsp[0].minor.yy451 = yylhsminor.yy451; break; case 124: /* typename ::= ids LP signed RP */ { - if (yymsp[-1].minor.yy525 <= 0) { + if (yymsp[-1].minor.yy481 <= 0) { yymsp[-3].minor.yy0.type = 0; - tSetColumnType(&yylhsminor.yy295, &yymsp[-3].minor.yy0); + tSetColumnType(&yylhsminor.yy451, &yymsp[-3].minor.yy0); } else { - yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy525; // negative value of name length - tSetColumnType(&yylhsminor.yy295, &yymsp[-3].minor.yy0); + yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy481; // negative value of name length + tSetColumnType(&yylhsminor.yy451, &yymsp[-3].minor.yy0); } } - yymsp[-3].minor.yy295 = yylhsminor.yy295; + yymsp[-3].minor.yy451 = yylhsminor.yy451; break; case 125: /* typename ::= ids UNSIGNED */ { yymsp[-1].minor.yy0.type = 0; yymsp[-1].minor.yy0.n = ((yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z); - tSetColumnType (&yylhsminor.yy295, &yymsp[-1].minor.yy0); + tSetColumnType (&yylhsminor.yy451, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy295 = yylhsminor.yy295; + yymsp[-1].minor.yy451 = yylhsminor.yy451; break; case 126: /* signed ::= INTEGER */ -{ yylhsminor.yy525 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[0].minor.yy525 = yylhsminor.yy525; +{ yylhsminor.yy481 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[0].minor.yy481 = yylhsminor.yy481; break; case 127: /* signed ::= PLUS INTEGER */ -{ yymsp[-1].minor.yy525 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy481 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } break; case 128: /* signed ::= MINUS INTEGER */ -{ yymsp[-1].minor.yy525 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} +{ yymsp[-1].minor.yy481 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} break; case 132: /* cmd ::= CREATE TABLE create_table_list */ -{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy470;} +{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy194;} break; case 133: /* create_table_list ::= create_from_stable */ { SCreateTableSql* pCreateTable = calloc(1, sizeof(SCreateTableSql)); pCreateTable->childTableInfo = taosArrayInit(4, sizeof(SCreatedTableInfo)); - taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy96); + taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy252); pCreateTable->type = TSQL_CREATE_TABLE_FROM_STABLE; - yylhsminor.yy470 = pCreateTable; + yylhsminor.yy194 = pCreateTable; } - yymsp[0].minor.yy470 = yylhsminor.yy470; + yymsp[0].minor.yy194 = yylhsminor.yy194; break; case 134: /* create_table_list ::= create_table_list create_from_stable */ { - taosArrayPush(yymsp[-1].minor.yy470->childTableInfo, &yymsp[0].minor.yy96); - yylhsminor.yy470 = yymsp[-1].minor.yy470; + taosArrayPush(yymsp[-1].minor.yy194->childTableInfo, &yymsp[0].minor.yy252); + yylhsminor.yy194 = yymsp[-1].minor.yy194; } - yymsp[-1].minor.yy470 = yylhsminor.yy470; + yymsp[-1].minor.yy194 = yylhsminor.yy194; break; case 135: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ { - yylhsminor.yy470 = tSetCreateTableInfo(yymsp[-1].minor.yy285, NULL, NULL, TSQL_CREATE_TABLE); - setSqlInfo(pInfo, yylhsminor.yy470, NULL, TSDB_SQL_CREATE_TABLE); + yylhsminor.yy194 = tSetCreateTableInfo(yymsp[-1].minor.yy429, NULL, NULL, TSQL_CREATE_TABLE); + setSqlInfo(pInfo, yylhsminor.yy194, NULL, TSDB_SQL_CREATE_TABLE); yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; setCreatedTableName(pInfo, &yymsp[-4].minor.yy0, &yymsp[-5].minor.yy0); } - yymsp[-5].minor.yy470 = yylhsminor.yy470; + yymsp[-5].minor.yy194 = yylhsminor.yy194; break; case 136: /* create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ { - yylhsminor.yy470 = tSetCreateTableInfo(yymsp[-5].minor.yy285, yymsp[-1].minor.yy285, NULL, TSQL_CREATE_STABLE); - setSqlInfo(pInfo, yylhsminor.yy470, NULL, TSDB_SQL_CREATE_TABLE); + yylhsminor.yy194 = tSetCreateTableInfo(yymsp[-5].minor.yy429, yymsp[-1].minor.yy429, NULL, TSQL_CREATE_STABLE); + setSqlInfo(pInfo, yylhsminor.yy194, NULL, TSDB_SQL_CREATE_TABLE); yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n; setCreatedTableName(pInfo, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); } - yymsp[-9].minor.yy470 = yylhsminor.yy470; + yymsp[-9].minor.yy194 = yylhsminor.yy194; break; case 137: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n; - yylhsminor.yy96 = createNewChildTableInfo(&yymsp[-5].minor.yy0, NULL, yymsp[-1].minor.yy285, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); + yylhsminor.yy252 = createNewChildTableInfo(&yymsp[-5].minor.yy0, NULL, yymsp[-1].minor.yy429, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); } - yymsp[-9].minor.yy96 = yylhsminor.yy96; + yymsp[-9].minor.yy252 = yylhsminor.yy252; break; case 138: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ { yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n; yymsp[-11].minor.yy0.n += yymsp[-10].minor.yy0.n; - yylhsminor.yy96 = createNewChildTableInfo(&yymsp[-8].minor.yy0, yymsp[-5].minor.yy285, yymsp[-1].minor.yy285, &yymsp[-11].minor.yy0, &yymsp[-12].minor.yy0); + yylhsminor.yy252 = createNewChildTableInfo(&yymsp[-8].minor.yy0, yymsp[-5].minor.yy429, yymsp[-1].minor.yy429, &yymsp[-11].minor.yy0, &yymsp[-12].minor.yy0); } - yymsp[-12].minor.yy96 = yylhsminor.yy96; + yymsp[-12].minor.yy252 = yylhsminor.yy252; break; case 139: /* tagNamelist ::= tagNamelist COMMA ids */ -{taosArrayPush(yymsp[-2].minor.yy285, &yymsp[0].minor.yy0); yylhsminor.yy285 = yymsp[-2].minor.yy285; } - yymsp[-2].minor.yy285 = yylhsminor.yy285; +{taosArrayPush(yymsp[-2].minor.yy429, &yymsp[0].minor.yy0); yylhsminor.yy429 = yymsp[-2].minor.yy429; } + yymsp[-2].minor.yy429 = yylhsminor.yy429; break; case 140: /* tagNamelist ::= ids */ -{yylhsminor.yy285 = taosArrayInit(4, sizeof(SStrToken)); taosArrayPush(yylhsminor.yy285, &yymsp[0].minor.yy0);} - yymsp[0].minor.yy285 = yylhsminor.yy285; +{yylhsminor.yy429 = taosArrayInit(4, sizeof(SStrToken)); taosArrayPush(yylhsminor.yy429, &yymsp[0].minor.yy0);} + yymsp[0].minor.yy429 = yylhsminor.yy429; break; case 141: /* create_table_args ::= ifnotexists ids cpxName AS select */ { - yylhsminor.yy470 = tSetCreateTableInfo(NULL, NULL, yymsp[0].minor.yy342, TSQL_CREATE_STREAM); - setSqlInfo(pInfo, yylhsminor.yy470, NULL, TSDB_SQL_CREATE_TABLE); + yylhsminor.yy194 = tSetCreateTableInfo(NULL, NULL, yymsp[0].minor.yy254, TSQL_CREATE_STREAM); + setSqlInfo(pInfo, yylhsminor.yy194, NULL, TSDB_SQL_CREATE_TABLE); yymsp[-3].minor.yy0.n += yymsp[-2].minor.yy0.n; setCreatedTableName(pInfo, &yymsp[-3].minor.yy0, &yymsp[-4].minor.yy0); } - yymsp[-4].minor.yy470 = yylhsminor.yy470; + yymsp[-4].minor.yy194 = yylhsminor.yy194; break; case 142: /* columnlist ::= columnlist COMMA column */ -{taosArrayPush(yymsp[-2].minor.yy285, &yymsp[0].minor.yy295); yylhsminor.yy285 = yymsp[-2].minor.yy285; } - yymsp[-2].minor.yy285 = yylhsminor.yy285; +{taosArrayPush(yymsp[-2].minor.yy429, &yymsp[0].minor.yy451); yylhsminor.yy429 = yymsp[-2].minor.yy429; } + yymsp[-2].minor.yy429 = yylhsminor.yy429; break; case 143: /* columnlist ::= column */ -{yylhsminor.yy285 = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(yylhsminor.yy285, &yymsp[0].minor.yy295);} - yymsp[0].minor.yy285 = yylhsminor.yy285; +{yylhsminor.yy429 = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(yylhsminor.yy429, &yymsp[0].minor.yy451);} + yymsp[0].minor.yy429 = yylhsminor.yy429; break; case 144: /* column ::= ids typename */ { - tSetColumnInfo(&yylhsminor.yy295, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy295); + tSetColumnInfo(&yylhsminor.yy451, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy451); } - yymsp[-1].minor.yy295 = yylhsminor.yy295; + yymsp[-1].minor.yy451 = yylhsminor.yy451; break; case 145: /* tagitemlist ::= tagitemlist COMMA tagitem */ -{ yylhsminor.yy285 = tVariantListAppend(yymsp[-2].minor.yy285, &yymsp[0].minor.yy362, -1); } - yymsp[-2].minor.yy285 = yylhsminor.yy285; +{ yylhsminor.yy429 = tVariantListAppend(yymsp[-2].minor.yy429, &yymsp[0].minor.yy218, -1); } + yymsp[-2].minor.yy429 = yylhsminor.yy429; break; case 146: /* tagitemlist ::= tagitem */ -{ yylhsminor.yy285 = tVariantListAppend(NULL, &yymsp[0].minor.yy362, -1); } - yymsp[0].minor.yy285 = yylhsminor.yy285; +{ yylhsminor.yy429 = tVariantListAppend(NULL, &yymsp[0].minor.yy218, -1); } + yymsp[0].minor.yy429 = yylhsminor.yy429; break; case 147: /* tagitem ::= INTEGER */ case 148: /* tagitem ::= FLOAT */ yytestcase(yyruleno==148); case 149: /* tagitem ::= STRING */ yytestcase(yyruleno==149); case 150: /* tagitem ::= BOOL */ yytestcase(yyruleno==150); -{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy362, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy362 = yylhsminor.yy362; +{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy218, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy218 = yylhsminor.yy218; break; case 151: /* tagitem ::= NULL */ -{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy362, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy362 = yylhsminor.yy362; +{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy218, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy218 = yylhsminor.yy218; break; case 152: /* tagitem ::= MINUS INTEGER */ case 153: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==153); @@ -2587,56 +2583,56 @@ static void yy_reduce( yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = yymsp[0].minor.yy0.type; toTSDBType(yymsp[-1].minor.yy0.type); - tVariantCreate(&yylhsminor.yy362, &yymsp[-1].minor.yy0); + tVariantCreate(&yylhsminor.yy218, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy362 = yylhsminor.yy362; + yymsp[-1].minor.yy218 = yylhsminor.yy218; break; case 156: /* select ::= SELECT selcollist from where_opt interval_opt session_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ { - yylhsminor.yy342 = tSetQuerySqlNode(&yymsp[-12].minor.yy0, yymsp[-11].minor.yy285, yymsp[-10].minor.yy162, yymsp[-9].minor.yy178, yymsp[-4].minor.yy285, yymsp[-3].minor.yy285, &yymsp[-8].minor.yy376, &yymsp[-7].minor.yy523, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy285, &yymsp[0].minor.yy438, &yymsp[-1].minor.yy438); + yylhsminor.yy254 = tSetQuerySqlNode(&yymsp[-12].minor.yy0, yymsp[-11].minor.yy429, yymsp[-10].minor.yy70, yymsp[-9].minor.yy170, yymsp[-4].minor.yy429, yymsp[-3].minor.yy429, &yymsp[-8].minor.yy220, &yymsp[-7].minor.yy87, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy429, &yymsp[0].minor.yy18, &yymsp[-1].minor.yy18); } - yymsp[-12].minor.yy342 = yylhsminor.yy342; + yymsp[-12].minor.yy254 = yylhsminor.yy254; break; case 157: /* select ::= LP select RP */ -{yymsp[-2].minor.yy342 = yymsp[-1].minor.yy342;} +{yymsp[-2].minor.yy254 = yymsp[-1].minor.yy254;} break; case 158: /* union ::= select */ -{ yylhsminor.yy513 = setSubclause(NULL, yymsp[0].minor.yy342); } - yymsp[0].minor.yy513 = yylhsminor.yy513; +{ yylhsminor.yy141 = setSubclause(NULL, yymsp[0].minor.yy254); } + yymsp[0].minor.yy141 = yylhsminor.yy141; break; case 159: /* union ::= union UNION ALL select */ -{ yylhsminor.yy513 = appendSelectClause(yymsp[-3].minor.yy513, yymsp[0].minor.yy342); } - yymsp[-3].minor.yy513 = yylhsminor.yy513; +{ yylhsminor.yy141 = appendSelectClause(yymsp[-3].minor.yy141, yymsp[0].minor.yy254); } + yymsp[-3].minor.yy141 = yylhsminor.yy141; break; case 160: /* cmd ::= union */ -{ setSqlInfo(pInfo, yymsp[0].minor.yy513, NULL, TSDB_SQL_SELECT); } +{ setSqlInfo(pInfo, yymsp[0].minor.yy141, NULL, TSDB_SQL_SELECT); } break; case 161: /* select ::= SELECT selcollist */ { - yylhsminor.yy342 = tSetQuerySqlNode(&yymsp[-1].minor.yy0, yymsp[0].minor.yy285, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + yylhsminor.yy254 = tSetQuerySqlNode(&yymsp[-1].minor.yy0, yymsp[0].minor.yy429, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } - yymsp[-1].minor.yy342 = yylhsminor.yy342; + yymsp[-1].minor.yy254 = yylhsminor.yy254; break; case 162: /* sclp ::= selcollist COMMA */ -{yylhsminor.yy285 = yymsp[-1].minor.yy285;} - yymsp[-1].minor.yy285 = yylhsminor.yy285; +{yylhsminor.yy429 = yymsp[-1].minor.yy429;} + yymsp[-1].minor.yy429 = yylhsminor.yy429; break; case 163: /* sclp ::= */ case 188: /* orderby_opt ::= */ yytestcase(yyruleno==188); -{yymsp[1].minor.yy285 = 0;} +{yymsp[1].minor.yy429 = 0;} break; case 164: /* selcollist ::= sclp distinct expr as */ { - yylhsminor.yy285 = tSqlExprListAppend(yymsp[-3].minor.yy285, yymsp[-1].minor.yy178, yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); + yylhsminor.yy429 = tSqlExprListAppend(yymsp[-3].minor.yy429, yymsp[-1].minor.yy170, yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); } - yymsp[-3].minor.yy285 = yylhsminor.yy285; + yymsp[-3].minor.yy429 = yylhsminor.yy429; break; case 165: /* selcollist ::= sclp STAR */ { tSqlExpr *pNode = tSqlExprCreateIdValue(NULL, TK_ALL); - yylhsminor.yy285 = tSqlExprListAppend(yymsp[-1].minor.yy285, pNode, 0, 0); + yylhsminor.yy429 = tSqlExprListAppend(yymsp[-1].minor.yy429, pNode, 0, 0); } - yymsp[-1].minor.yy285 = yylhsminor.yy285; + yymsp[-1].minor.yy429 = yylhsminor.yy429; break; case 166: /* as ::= AS ids */ { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } @@ -2653,35 +2649,35 @@ static void yy_reduce( yymsp[0].minor.yy0 = yylhsminor.yy0; break; case 171: /* from ::= FROM tablelist */ -{yymsp[-1].minor.yy162 = yymsp[0].minor.yy285;} +{yymsp[-1].minor.yy70 = yymsp[0].minor.yy429;} break; case 172: /* from ::= FROM LP union RP */ -{yymsp[-3].minor.yy162 = yymsp[-1].minor.yy513;} +{yymsp[-3].minor.yy70 = yymsp[-1].minor.yy141;} break; case 173: /* tablelist ::= ids cpxName */ { toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - yylhsminor.yy285 = setTableNameList(NULL, &yymsp[-1].minor.yy0, NULL); + yylhsminor.yy429 = setTableNameList(NULL, &yymsp[-1].minor.yy0, NULL); } - yymsp[-1].minor.yy285 = yylhsminor.yy285; + yymsp[-1].minor.yy429 = yylhsminor.yy429; break; case 174: /* tablelist ::= ids cpxName ids */ { toTSDBType(yymsp[-2].minor.yy0.type); toTSDBType(yymsp[0].minor.yy0.type); yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; - yylhsminor.yy285 = setTableNameList(NULL, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); + yylhsminor.yy429 = setTableNameList(NULL, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy285 = yylhsminor.yy285; + yymsp[-2].minor.yy429 = yylhsminor.yy429; break; case 175: /* tablelist ::= tablelist COMMA ids cpxName */ { toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - yylhsminor.yy285 = setTableNameList(yymsp[-3].minor.yy285, &yymsp[-1].minor.yy0, NULL); + yylhsminor.yy429 = setTableNameList(yymsp[-3].minor.yy429, &yymsp[-1].minor.yy0, NULL); } - yymsp[-3].minor.yy285 = yylhsminor.yy285; + yymsp[-3].minor.yy429 = yylhsminor.yy429; break; case 176: /* tablelist ::= tablelist COMMA ids cpxName ids */ { @@ -2689,35 +2685,35 @@ static void yy_reduce( toTSDBType(yymsp[0].minor.yy0.type); yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; - yylhsminor.yy285 = setTableNameList(yymsp[-4].minor.yy285, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); + yylhsminor.yy429 = setTableNameList(yymsp[-4].minor.yy429, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } - yymsp[-4].minor.yy285 = yylhsminor.yy285; + yymsp[-4].minor.yy429 = yylhsminor.yy429; break; case 177: /* tmvar ::= VARIABLE */ {yylhsminor.yy0 = yymsp[0].minor.yy0;} yymsp[0].minor.yy0 = yylhsminor.yy0; break; case 178: /* interval_opt ::= INTERVAL LP tmvar RP */ -{yymsp[-3].minor.yy376.interval = yymsp[-1].minor.yy0; yymsp[-3].minor.yy376.offset.n = 0;} +{yymsp[-3].minor.yy220.interval = yymsp[-1].minor.yy0; yymsp[-3].minor.yy220.offset.n = 0;} break; case 179: /* interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ -{yymsp[-5].minor.yy376.interval = yymsp[-3].minor.yy0; yymsp[-5].minor.yy376.offset = yymsp[-1].minor.yy0;} +{yymsp[-5].minor.yy220.interval = yymsp[-3].minor.yy0; yymsp[-5].minor.yy220.offset = yymsp[-1].minor.yy0;} break; case 180: /* interval_opt ::= */ -{memset(&yymsp[1].minor.yy376, 0, sizeof(yymsp[1].minor.yy376));} +{memset(&yymsp[1].minor.yy220, 0, sizeof(yymsp[1].minor.yy220));} break; case 181: /* session_option ::= */ -{yymsp[1].minor.yy523.col.n = 0; yymsp[1].minor.yy523.gap.n = 0;} +{yymsp[1].minor.yy87.col.n = 0; yymsp[1].minor.yy87.gap.n = 0;} break; case 182: /* session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - yymsp[-6].minor.yy523.col = yymsp[-4].minor.yy0; - yymsp[-6].minor.yy523.gap = yymsp[-1].minor.yy0; + yymsp[-6].minor.yy87.col = yymsp[-4].minor.yy0; + yymsp[-6].minor.yy87.gap = yymsp[-1].minor.yy0; } break; case 183: /* fill_opt ::= */ -{ yymsp[1].minor.yy285 = 0; } +{ yymsp[1].minor.yy429 = 0; } break; case 184: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */ { @@ -2725,14 +2721,14 @@ static void yy_reduce( toTSDBType(yymsp[-3].minor.yy0.type); tVariantCreate(&A, &yymsp[-3].minor.yy0); - tVariantListInsert(yymsp[-1].minor.yy285, &A, -1, 0); - yymsp[-5].minor.yy285 = yymsp[-1].minor.yy285; + tVariantListInsert(yymsp[-1].minor.yy429, &A, -1, 0); + yymsp[-5].minor.yy429 = yymsp[-1].minor.yy429; } break; case 185: /* fill_opt ::= FILL LP ID RP */ { toTSDBType(yymsp[-1].minor.yy0.type); - yymsp[-3].minor.yy285 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); + yymsp[-3].minor.yy429 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); } break; case 186: /* sliding_opt ::= SLIDING LP tmvar RP */ @@ -2742,226 +2738,226 @@ static void yy_reduce( {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0; } break; case 189: /* orderby_opt ::= ORDER BY sortlist */ -{yymsp[-2].minor.yy285 = yymsp[0].minor.yy285;} +{yymsp[-2].minor.yy429 = yymsp[0].minor.yy429;} break; case 190: /* sortlist ::= sortlist COMMA item sortorder */ { - yylhsminor.yy285 = tVariantListAppend(yymsp[-3].minor.yy285, &yymsp[-1].minor.yy362, yymsp[0].minor.yy460); + yylhsminor.yy429 = tVariantListAppend(yymsp[-3].minor.yy429, &yymsp[-1].minor.yy218, yymsp[0].minor.yy116); } - yymsp[-3].minor.yy285 = yylhsminor.yy285; + yymsp[-3].minor.yy429 = yylhsminor.yy429; break; case 191: /* sortlist ::= item sortorder */ { - yylhsminor.yy285 = tVariantListAppend(NULL, &yymsp[-1].minor.yy362, yymsp[0].minor.yy460); + yylhsminor.yy429 = tVariantListAppend(NULL, &yymsp[-1].minor.yy218, yymsp[0].minor.yy116); } - yymsp[-1].minor.yy285 = yylhsminor.yy285; + yymsp[-1].minor.yy429 = yylhsminor.yy429; break; case 192: /* item ::= ids cpxName */ { toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - tVariantCreate(&yylhsminor.yy362, &yymsp[-1].minor.yy0); + tVariantCreate(&yylhsminor.yy218, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy362 = yylhsminor.yy362; + yymsp[-1].minor.yy218 = yylhsminor.yy218; break; case 193: /* sortorder ::= ASC */ -{ yymsp[0].minor.yy460 = TSDB_ORDER_ASC; } +{ yymsp[0].minor.yy116 = TSDB_ORDER_ASC; } break; case 194: /* sortorder ::= DESC */ -{ yymsp[0].minor.yy460 = TSDB_ORDER_DESC;} +{ yymsp[0].minor.yy116 = TSDB_ORDER_DESC;} break; case 195: /* sortorder ::= */ -{ yymsp[1].minor.yy460 = TSDB_ORDER_ASC; } +{ yymsp[1].minor.yy116 = TSDB_ORDER_ASC; } break; case 196: /* groupby_opt ::= */ -{ yymsp[1].minor.yy285 = 0;} +{ yymsp[1].minor.yy429 = 0;} break; case 197: /* groupby_opt ::= GROUP BY grouplist */ -{ yymsp[-2].minor.yy285 = yymsp[0].minor.yy285;} +{ yymsp[-2].minor.yy429 = yymsp[0].minor.yy429;} break; case 198: /* grouplist ::= grouplist COMMA item */ { - yylhsminor.yy285 = tVariantListAppend(yymsp[-2].minor.yy285, &yymsp[0].minor.yy362, -1); + yylhsminor.yy429 = tVariantListAppend(yymsp[-2].minor.yy429, &yymsp[0].minor.yy218, -1); } - yymsp[-2].minor.yy285 = yylhsminor.yy285; + yymsp[-2].minor.yy429 = yylhsminor.yy429; break; case 199: /* grouplist ::= item */ { - yylhsminor.yy285 = tVariantListAppend(NULL, &yymsp[0].minor.yy362, -1); + yylhsminor.yy429 = tVariantListAppend(NULL, &yymsp[0].minor.yy218, -1); } - yymsp[0].minor.yy285 = yylhsminor.yy285; + yymsp[0].minor.yy429 = yylhsminor.yy429; break; case 200: /* having_opt ::= */ case 210: /* where_opt ::= */ yytestcase(yyruleno==210); case 249: /* expritem ::= */ yytestcase(yyruleno==249); -{yymsp[1].minor.yy178 = 0;} +{yymsp[1].minor.yy170 = 0;} break; case 201: /* having_opt ::= HAVING expr */ case 211: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==211); -{yymsp[-1].minor.yy178 = yymsp[0].minor.yy178;} +{yymsp[-1].minor.yy170 = yymsp[0].minor.yy170;} break; case 202: /* limit_opt ::= */ case 206: /* slimit_opt ::= */ yytestcase(yyruleno==206); -{yymsp[1].minor.yy438.limit = -1; yymsp[1].minor.yy438.offset = 0;} +{yymsp[1].minor.yy18.limit = -1; yymsp[1].minor.yy18.offset = 0;} break; case 203: /* limit_opt ::= LIMIT signed */ case 207: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==207); -{yymsp[-1].minor.yy438.limit = yymsp[0].minor.yy525; yymsp[-1].minor.yy438.offset = 0;} +{yymsp[-1].minor.yy18.limit = yymsp[0].minor.yy481; yymsp[-1].minor.yy18.offset = 0;} break; case 204: /* limit_opt ::= LIMIT signed OFFSET signed */ -{ yymsp[-3].minor.yy438.limit = yymsp[-2].minor.yy525; yymsp[-3].minor.yy438.offset = yymsp[0].minor.yy525;} +{ yymsp[-3].minor.yy18.limit = yymsp[-2].minor.yy481; yymsp[-3].minor.yy18.offset = yymsp[0].minor.yy481;} break; case 205: /* limit_opt ::= LIMIT signed COMMA signed */ -{ yymsp[-3].minor.yy438.limit = yymsp[0].minor.yy525; yymsp[-3].minor.yy438.offset = yymsp[-2].minor.yy525;} +{ yymsp[-3].minor.yy18.limit = yymsp[0].minor.yy481; yymsp[-3].minor.yy18.offset = yymsp[-2].minor.yy481;} break; case 208: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ -{yymsp[-3].minor.yy438.limit = yymsp[-2].minor.yy525; yymsp[-3].minor.yy438.offset = yymsp[0].minor.yy525;} +{yymsp[-3].minor.yy18.limit = yymsp[-2].minor.yy481; yymsp[-3].minor.yy18.offset = yymsp[0].minor.yy481;} break; case 209: /* slimit_opt ::= SLIMIT signed COMMA signed */ -{yymsp[-3].minor.yy438.limit = yymsp[0].minor.yy525; yymsp[-3].minor.yy438.offset = yymsp[-2].minor.yy525;} +{yymsp[-3].minor.yy18.limit = yymsp[0].minor.yy481; yymsp[-3].minor.yy18.offset = yymsp[-2].minor.yy481;} break; case 212: /* expr ::= LP expr RP */ -{yylhsminor.yy178 = yymsp[-1].minor.yy178; yylhsminor.yy178->token.z = yymsp[-2].minor.yy0.z; yylhsminor.yy178->token.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);} - yymsp[-2].minor.yy178 = yylhsminor.yy178; +{yylhsminor.yy170 = yymsp[-1].minor.yy170; yylhsminor.yy170->token.z = yymsp[-2].minor.yy0.z; yylhsminor.yy170->token.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);} + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 213: /* expr ::= ID */ -{ yylhsminor.yy178 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_ID);} - yymsp[0].minor.yy178 = yylhsminor.yy178; +{ yylhsminor.yy170 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_ID);} + yymsp[0].minor.yy170 = yylhsminor.yy170; break; case 214: /* expr ::= ID DOT ID */ -{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy178 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ID);} - yymsp[-2].minor.yy178 = yylhsminor.yy178; +{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy170 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ID);} + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 215: /* expr ::= ID DOT STAR */ -{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy178 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ALL);} - yymsp[-2].minor.yy178 = yylhsminor.yy178; +{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy170 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ALL);} + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 216: /* expr ::= INTEGER */ -{ yylhsminor.yy178 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_INTEGER);} - yymsp[0].minor.yy178 = yylhsminor.yy178; +{ yylhsminor.yy170 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_INTEGER);} + yymsp[0].minor.yy170 = yylhsminor.yy170; break; case 217: /* expr ::= MINUS INTEGER */ case 218: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==218); -{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy178 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_INTEGER);} - yymsp[-1].minor.yy178 = yylhsminor.yy178; +{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy170 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_INTEGER);} + yymsp[-1].minor.yy170 = yylhsminor.yy170; break; case 219: /* expr ::= FLOAT */ -{ yylhsminor.yy178 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_FLOAT);} - yymsp[0].minor.yy178 = yylhsminor.yy178; +{ yylhsminor.yy170 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_FLOAT);} + yymsp[0].minor.yy170 = yylhsminor.yy170; break; case 220: /* expr ::= MINUS FLOAT */ case 221: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==221); -{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy178 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_FLOAT);} - yymsp[-1].minor.yy178 = yylhsminor.yy178; +{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy170 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_FLOAT);} + yymsp[-1].minor.yy170 = yylhsminor.yy170; break; case 222: /* expr ::= STRING */ -{ yylhsminor.yy178 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_STRING);} - yymsp[0].minor.yy178 = yylhsminor.yy178; +{ yylhsminor.yy170 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_STRING);} + yymsp[0].minor.yy170 = yylhsminor.yy170; break; case 223: /* expr ::= NOW */ -{ yylhsminor.yy178 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NOW); } - yymsp[0].minor.yy178 = yylhsminor.yy178; +{ yylhsminor.yy170 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NOW); } + yymsp[0].minor.yy170 = yylhsminor.yy170; break; case 224: /* expr ::= VARIABLE */ -{ yylhsminor.yy178 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_VARIABLE);} - yymsp[0].minor.yy178 = yylhsminor.yy178; +{ yylhsminor.yy170 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_VARIABLE);} + yymsp[0].minor.yy170 = yylhsminor.yy170; break; case 225: /* expr ::= BOOL */ -{ yylhsminor.yy178 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_BOOL);} - yymsp[0].minor.yy178 = yylhsminor.yy178; +{ yylhsminor.yy170 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_BOOL);} + yymsp[0].minor.yy170 = yylhsminor.yy170; break; case 226: /* expr ::= ID LP exprlist RP */ -{ yylhsminor.yy178 = tSqlExprCreateFunction(yymsp[-1].minor.yy285, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } - yymsp[-3].minor.yy178 = yylhsminor.yy178; +{ yylhsminor.yy170 = tSqlExprCreateFunction(yymsp[-1].minor.yy429, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } + yymsp[-3].minor.yy170 = yylhsminor.yy170; break; case 227: /* expr ::= ID LP STAR RP */ -{ yylhsminor.yy178 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } - yymsp[-3].minor.yy178 = yylhsminor.yy178; +{ yylhsminor.yy170 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } + yymsp[-3].minor.yy170 = yylhsminor.yy170; break; case 228: /* expr ::= expr IS NULL */ -{yylhsminor.yy178 = tSqlExprCreate(yymsp[-2].minor.yy178, NULL, TK_ISNULL);} - yymsp[-2].minor.yy178 = yylhsminor.yy178; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, NULL, TK_ISNULL);} + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 229: /* expr ::= expr IS NOT NULL */ -{yylhsminor.yy178 = tSqlExprCreate(yymsp[-3].minor.yy178, NULL, TK_NOTNULL);} - yymsp[-3].minor.yy178 = yylhsminor.yy178; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-3].minor.yy170, NULL, TK_NOTNULL);} + yymsp[-3].minor.yy170 = yylhsminor.yy170; break; case 230: /* expr ::= expr LT expr */ -{yylhsminor.yy178 = tSqlExprCreate(yymsp[-2].minor.yy178, yymsp[0].minor.yy178, TK_LT);} - yymsp[-2].minor.yy178 = yylhsminor.yy178; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_LT);} + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 231: /* expr ::= expr GT expr */ -{yylhsminor.yy178 = tSqlExprCreate(yymsp[-2].minor.yy178, yymsp[0].minor.yy178, TK_GT);} - yymsp[-2].minor.yy178 = yylhsminor.yy178; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_GT);} + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 232: /* expr ::= expr LE expr */ -{yylhsminor.yy178 = tSqlExprCreate(yymsp[-2].minor.yy178, yymsp[0].minor.yy178, TK_LE);} - yymsp[-2].minor.yy178 = yylhsminor.yy178; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_LE);} + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 233: /* expr ::= expr GE expr */ -{yylhsminor.yy178 = tSqlExprCreate(yymsp[-2].minor.yy178, yymsp[0].minor.yy178, TK_GE);} - yymsp[-2].minor.yy178 = yylhsminor.yy178; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_GE);} + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 234: /* expr ::= expr NE expr */ -{yylhsminor.yy178 = tSqlExprCreate(yymsp[-2].minor.yy178, yymsp[0].minor.yy178, TK_NE);} - yymsp[-2].minor.yy178 = yylhsminor.yy178; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_NE);} + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 235: /* expr ::= expr EQ expr */ -{yylhsminor.yy178 = tSqlExprCreate(yymsp[-2].minor.yy178, yymsp[0].minor.yy178, TK_EQ);} - yymsp[-2].minor.yy178 = yylhsminor.yy178; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_EQ);} + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 236: /* expr ::= expr BETWEEN expr AND expr */ -{ tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy178); yylhsminor.yy178 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy178, yymsp[-2].minor.yy178, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy178, TK_LE), TK_AND);} - yymsp[-4].minor.yy178 = yylhsminor.yy178; +{ tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy170); yylhsminor.yy170 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy170, yymsp[-2].minor.yy170, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy170, TK_LE), TK_AND);} + yymsp[-4].minor.yy170 = yylhsminor.yy170; break; case 237: /* expr ::= expr AND expr */ -{yylhsminor.yy178 = tSqlExprCreate(yymsp[-2].minor.yy178, yymsp[0].minor.yy178, TK_AND);} - yymsp[-2].minor.yy178 = yylhsminor.yy178; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_AND);} + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 238: /* expr ::= expr OR expr */ -{yylhsminor.yy178 = tSqlExprCreate(yymsp[-2].minor.yy178, yymsp[0].minor.yy178, TK_OR); } - yymsp[-2].minor.yy178 = yylhsminor.yy178; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_OR); } + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 239: /* expr ::= expr PLUS expr */ -{yylhsminor.yy178 = tSqlExprCreate(yymsp[-2].minor.yy178, yymsp[0].minor.yy178, TK_PLUS); } - yymsp[-2].minor.yy178 = yylhsminor.yy178; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_PLUS); } + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 240: /* expr ::= expr MINUS expr */ -{yylhsminor.yy178 = tSqlExprCreate(yymsp[-2].minor.yy178, yymsp[0].minor.yy178, TK_MINUS); } - yymsp[-2].minor.yy178 = yylhsminor.yy178; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_MINUS); } + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 241: /* expr ::= expr STAR expr */ -{yylhsminor.yy178 = tSqlExprCreate(yymsp[-2].minor.yy178, yymsp[0].minor.yy178, TK_STAR); } - yymsp[-2].minor.yy178 = yylhsminor.yy178; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_STAR); } + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 242: /* expr ::= expr SLASH expr */ -{yylhsminor.yy178 = tSqlExprCreate(yymsp[-2].minor.yy178, yymsp[0].minor.yy178, TK_DIVIDE);} - yymsp[-2].minor.yy178 = yylhsminor.yy178; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_DIVIDE);} + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 243: /* expr ::= expr REM expr */ -{yylhsminor.yy178 = tSqlExprCreate(yymsp[-2].minor.yy178, yymsp[0].minor.yy178, TK_REM); } - yymsp[-2].minor.yy178 = yylhsminor.yy178; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_REM); } + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 244: /* expr ::= expr LIKE expr */ -{yylhsminor.yy178 = tSqlExprCreate(yymsp[-2].minor.yy178, yymsp[0].minor.yy178, TK_LIKE); } - yymsp[-2].minor.yy178 = yylhsminor.yy178; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_LIKE); } + yymsp[-2].minor.yy170 = yylhsminor.yy170; break; case 245: /* expr ::= expr IN LP exprlist RP */ -{yylhsminor.yy178 = tSqlExprCreate(yymsp[-4].minor.yy178, (tSqlExpr*)yymsp[-1].minor.yy285, TK_IN); } - yymsp[-4].minor.yy178 = yylhsminor.yy178; +{yylhsminor.yy170 = tSqlExprCreate(yymsp[-4].minor.yy170, (tSqlExpr*)yymsp[-1].minor.yy429, TK_IN); } + yymsp[-4].minor.yy170 = yylhsminor.yy170; break; case 246: /* exprlist ::= exprlist COMMA expritem */ -{yylhsminor.yy285 = tSqlExprListAppend(yymsp[-2].minor.yy285,yymsp[0].minor.yy178,0, 0);} - yymsp[-2].minor.yy285 = yylhsminor.yy285; +{yylhsminor.yy429 = tSqlExprListAppend(yymsp[-2].minor.yy429,yymsp[0].minor.yy170,0, 0);} + yymsp[-2].minor.yy429 = yylhsminor.yy429; break; case 247: /* exprlist ::= expritem */ -{yylhsminor.yy285 = tSqlExprListAppend(0,yymsp[0].minor.yy178,0, 0);} - yymsp[0].minor.yy285 = yylhsminor.yy285; +{yylhsminor.yy429 = tSqlExprListAppend(0,yymsp[0].minor.yy170,0, 0);} + yymsp[0].minor.yy429 = yylhsminor.yy429; break; case 248: /* expritem ::= expr */ -{yylhsminor.yy178 = yymsp[0].minor.yy178;} - yymsp[0].minor.yy178 = yylhsminor.yy178; +{yylhsminor.yy170 = yymsp[0].minor.yy170;} + yymsp[0].minor.yy170 = yylhsminor.yy170; break; case 250: /* cmd ::= RESET QUERY CACHE */ { setDCLSqlElems(pInfo, TSDB_SQL_RESET_CACHE, 0);} @@ -2969,7 +2965,7 @@ static void yy_reduce( case 251: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy285, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy429, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; @@ -2987,7 +2983,7 @@ static void yy_reduce( case 253: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy285, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy429, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; @@ -3022,7 +3018,7 @@ static void yy_reduce( toTSDBType(yymsp[-2].minor.yy0.type); SArray* A = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1); - A = tVariantListAppend(A, &yymsp[0].minor.yy362, -1); + A = tVariantListAppend(A, &yymsp[0].minor.yy218, -1); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); @@ -3031,7 +3027,7 @@ static void yy_reduce( case 257: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy285, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy429, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; @@ -3049,7 +3045,7 @@ static void yy_reduce( case 259: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy285, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy429, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; diff --git a/tests/script/general/parser/create_mt.sim b/tests/script/general/parser/create_mt.sim index 830b72f93f..ae1629dce9 100644 --- a/tests/script/general/parser/create_mt.sim +++ b/tests/script/general/parser/create_mt.sim @@ -126,8 +126,7 @@ $tb_ = table $tbs = tables $db_ = database $dbs = databases -$mt_ = metric -$mts = metrics +$ses = session $int = int $bint = bigint $binary = binary @@ -145,8 +144,7 @@ sql_error create table $mt (ts timestamp, col1 int) tags ( $tb_ int) sql_error create table $mt (ts timestamp, col1 int) tags ( $tbs int) sql_error create table $mt (ts timestamp, col1 int) tags ( $db_ int) sql_error create table $mt (ts timestamp, col1 int) tags ( $dbs int) -sql_error create table $mt (ts timestamp, col1 int) tags ( $mt_ int) -sql_error create table $mt (ts timestamp, col1 int) tags ( $mts int) +sql_error create table $mt (ts timestamp, col1 int) tags ( $ses int) sql_error create table $mt (ts timestamp, col1 int) tags ( $int int) sql_error create table $mt (ts timestamp, col1 int) tags ( $bint int) sql_error create table $mt (ts timestamp, col1 int) tags ( $binary int) diff --git a/tests/script/general/parser/create_tb.sim b/tests/script/general/parser/create_tb.sim index d30a1392ef..eb6e4f71c3 100644 --- a/tests/script/general/parser/create_tb.sim +++ b/tests/script/general/parser/create_tb.sim @@ -90,8 +90,7 @@ $tb_ = table $tbs = tables $db_ = database $dbs = databases -$mt_ = metric -$mts = metrics +$ses = session $int = int $bint = bigint $binary = binary @@ -105,9 +104,8 @@ $nchar = nchar sql_error create table $tb (ts timestamp, $tb_ int) sql_error create table $tb (ts timestamp, $tbs int) sql_error create table $tb (ts timestamp, $db_ int) -sql_error create table $tb (ts timestamp, $dbs int) -sql_error create table $tb (ts timestamp, $mt_ int) -sql_error create table $tb (ts timestamp, $mts int) +sql_error create table $tb (ts timestamp, $dbs int) +sql_error create table $tb (ts timestamp, $ses int) sql_error create table $tb (ts timestamp, $int int) sql_error create table $tb (ts timestamp, $bint int) sql_error create table $tb (ts timestamp, $binary int) From ea82920d84a31a8d1e92107b7dc27bc89d9620bc Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Wed, 17 Mar 2021 13:36:54 +0800 Subject: [PATCH 05/52] remove duplicate case --- tests/pytest/fulltest.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index 84a52d81a9..409d684d01 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -156,7 +156,6 @@ python3 ./test.py -f update/bug_td2279.py #======================p2-end=============== #======================p3-start=============== -python3 ./test.py -f insert/randomNullCommit.py # user python3 ./test.py -f user/user_create.py @@ -275,7 +274,6 @@ python3 ./test.py -f functions/function_twa.py -r 1 python3 ./test.py -f functions/function_twa_test2.py python3 ./test.py -f functions/function_stddev_td2555.py python3 ./test.py -f insert/metadataUpdate.py -python3 ./test.py -f tools/taosdemoTest2.py python3 ./test.py -f query/last_cache.py python3 ./test.py -f query/last_row_cache.py python3 ./test.py -f account/account_create.py @@ -290,7 +288,6 @@ python3 ./test.py -f query/filterAllUnsignedIntTypes.py python3 ./test.py -f functions/function_percentile2.py python3 ./test.py -f insert/boundary2.py -python3 ./test.py -f query/queryFillTest.py python3 ./test.py -f alter/alter_debugFlag.py python3 ./test.py -f query/queryBetweenAnd.py python3 ./test.py -f tag_lite/alter_tag.py From 137405ba613619da0a3925995ba3e4864baa0719 Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Wed, 17 Mar 2021 13:50:55 +0800 Subject: [PATCH 06/52] fix erros --- tests/script/jenkins/basic.txt | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 33489b50ff..55c88a2891 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -1,7 +1,7 @@ cd ../../../debug; cmake .. cd ../../../debug; make -#======================s1-start=============== +#======================b1-start=============== ./test.sh -f general/field/2.sim ./test.sh -f general/field/3.sim @@ -89,8 +89,8 @@ cd ../../../debug; make ./test.sh -f general/db/nosuchfile.sim ./test.sh -f general/parser/function.sim -#======================s1-end=============== -#======================s2-start=============== +#======================b1-end=============== +#======================b2-start=============== ./test.sh -f general/tag/3.sim ./test.sh -f general/tag/4.sim @@ -163,8 +163,8 @@ cd ../../../debug; make ./test.sh -f unique/cluster/cache.sim ./test.sh -f unique/cluster/vgroup100.sim -#======================s2-end=============== -#======================s3-start=============== +#======================b2-end=============== +#======================b3-start=============== ./test.sh -f unique/arbitrator/check_cluster_cfg_para.sim #./test.sh -f unique/arbitrator/dn2_mn1_cache_file_sync.sim @@ -222,8 +222,8 @@ cd ../../../debug; make ./test.sh -f unique/stable/replica3_dnode6.sim ./test.sh -f unique/stable/replica3_vnode3.sim -#======================s3-end=============== -#======================s4-start=============== +#======================b3-end=============== +#======================b4-start=============== ./test.sh -f unique/http/admin.sim ./test.sh -f unique/http/opentsdb.sim @@ -271,8 +271,8 @@ cd ../../../debug; make ./test.sh -f issue/TD-2680.sim ./test.sh -f unique/dnode/lossdata.sim -#======================s4-end=============== -#======================s5-start=============== +#======================b4-end=============== +#======================b5-start=============== ./test.sh -f unique/dnode/alternativeRole.sim ./test.sh -f unique/dnode/balance1.sim @@ -294,8 +294,8 @@ cd ../../../debug; make ./test.sh -f unique/dnode/datatrans_3node.sim ./test.sh -f unique/dnode/datatrans_3node_2.sim -#======================s5-end=============== -#======================s6-start=============== +#======================b5-end=============== +#======================b6-start=============== ./test.sh -f unique/dnode/reason.sim ./test.sh -f unique/dnode/remove1.sim @@ -335,8 +335,8 @@ cd ../../../debug; make ./test.sh -f general/import/large.sim ./test.sh -f general/import/replica1.sim -#======================s6-end=============== -#======================s7-start=============== +#======================b6-end=============== +#======================b7-start=============== ./test.sh -f general/compute/avg.sim ./test.sh -f general/compute/bottom.sim @@ -425,4 +425,4 @@ cd ../../../debug; make ./test.sh -f general/parser/timestamp.sim ./test.sh -f general/parser/sliding.sim -#======================s7-end=============== +#======================b7-end=============== From 4478f3496bc1513d83d5eacc5f81acebc5b7ce2e Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Wed, 17 Mar 2021 14:01:13 +0800 Subject: [PATCH 07/52] abort pervious build --- Jenkinsfile | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e7603b578b..d8c9666828 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -24,13 +24,7 @@ def abortPreviousBuilds() { build.doKill() //doTerm(),doKill(),doTerm() } } -//abort previous build -abortPreviousBuilds() -def abort_previous(){ - def buildNumber = env.BUILD_NUMBER as int - if (buildNumber > 1) milestone(buildNumber - 1) - milestone(buildNumber) -} + def pre_test(){ catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { sh ''' From 8930b00ead4177a3b127f237f4c269fbfdcd9c7a Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Wed, 17 Mar 2021 14:19:03 +0800 Subject: [PATCH 08/52] inc coreverage of operation --- tests/pytest/functions/function_operations.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/pytest/functions/function_operations.py b/tests/pytest/functions/function_operations.py index e703147b67..162aa3eb65 100644 --- a/tests/pytest/functions/function_operations.py +++ b/tests/pytest/functions/function_operations.py @@ -92,14 +92,16 @@ class TDTestCase: col_list = [ 'col1' , 'col2' , 'col3' , 'col4' , 'col5' , 'col6' , 'col7' , 'col8' , 'col9' , 'col11' , 'col12' , 'col13' , 'col14' , '1' , '1.1' , 'NULL' ] op_list = [ '+' , '-' , '*' , '/' , '%' ] err_list = [ 'col7' , 'col8' , 'col9' , 'NULL' ] + order_lsit = [ ' order by ts ', ' order by ts desc ', ' order by ts asc '] for i in col_list : for j in col_list : for k in op_list : - sql = " select %s %s %s from test1 " % ( i , k , j ) - if i in err_list or j in err_list: - tdSql.error(sql) - else: - tdSql.query(sql) + for l in order_lsit : + sql = " select %s %s %s from test1 %s" % ( i , k , j , l ) + if i in err_list or j in err_list: + tdSql.error(sql) + else: + tdSql.query(sql) def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__) From 4e34b78dcdec327aedb7c923dfc93f066304678d Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Wed, 17 Mar 2021 14:24:55 +0800 Subject: [PATCH 09/52] add stage after build --- Jenkinsfile | 11 +++++++++++ tests/pytest/functions/function_operations.py | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index d8c9666828..685fde662d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -267,6 +267,17 @@ pipeline { } } } + stage('after_build'){ + agent{label 'master'} + when { + changeRequest() + } + steps { + sh''' + df -h + ''' + } + } } post { success { diff --git a/tests/pytest/functions/function_operations.py b/tests/pytest/functions/function_operations.py index 162aa3eb65..4f126371b9 100644 --- a/tests/pytest/functions/function_operations.py +++ b/tests/pytest/functions/function_operations.py @@ -92,7 +92,7 @@ class TDTestCase: col_list = [ 'col1' , 'col2' , 'col3' , 'col4' , 'col5' , 'col6' , 'col7' , 'col8' , 'col9' , 'col11' , 'col12' , 'col13' , 'col14' , '1' , '1.1' , 'NULL' ] op_list = [ '+' , '-' , '*' , '/' , '%' ] err_list = [ 'col7' , 'col8' , 'col9' , 'NULL' ] - order_lsit = [ ' order by ts ', ' order by ts desc ', ' order by ts asc '] + order_lsit = [ ' order by ts ', ' order by ts desc ', ' order by ts asc'] for i in col_list : for j in col_list : for k in op_list : From 683b1282b8a5b5f544104d8a291fba90958de3d6 Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Wed, 17 Mar 2021 14:28:36 +0800 Subject: [PATCH 10/52] abort build --- Jenkinsfile | 8 +++++++- tests/pytest/functions/function_operations.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 685fde662d..a78851fd90 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -24,7 +24,13 @@ def abortPreviousBuilds() { build.doKill() //doTerm(),doKill(),doTerm() } } - +//abort previous build +abortPreviousBuilds() +def abort_previous(){ + def buildNumber = env.BUILD_NUMBER as int + if (buildNumber > 1) milestone(buildNumber - 1) + milestone(buildNumber) +} def pre_test(){ catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { sh ''' diff --git a/tests/pytest/functions/function_operations.py b/tests/pytest/functions/function_operations.py index 4f126371b9..162aa3eb65 100644 --- a/tests/pytest/functions/function_operations.py +++ b/tests/pytest/functions/function_operations.py @@ -92,7 +92,7 @@ class TDTestCase: col_list = [ 'col1' , 'col2' , 'col3' , 'col4' , 'col5' , 'col6' , 'col7' , 'col8' , 'col9' , 'col11' , 'col12' , 'col13' , 'col14' , '1' , '1.1' , 'NULL' ] op_list = [ '+' , '-' , '*' , '/' , '%' ] err_list = [ 'col7' , 'col8' , 'col9' , 'NULL' ] - order_lsit = [ ' order by ts ', ' order by ts desc ', ' order by ts asc'] + order_lsit = [ ' order by ts ', ' order by ts desc ', ' order by ts asc '] for i in col_list : for j in col_list : for k in op_list : From 1df23b1885991c445c4d75f6eae6aa74b93f1141 Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Wed, 17 Mar 2021 14:49:56 +0800 Subject: [PATCH 11/52] change --- Jenkinsfile | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a78851fd90..9a4515278a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -273,18 +273,7 @@ pipeline { } } } - stage('after_build'){ - agent{label 'master'} - when { - changeRequest() - } - steps { - sh''' - df -h - ''' - } - } - } + post { success { emailext ( From 87c1726c72699bace2ca31c21c6a592163377354 Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Wed, 17 Mar 2021 14:53:17 +0800 Subject: [PATCH 12/52] change --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9a4515278a..e7603b578b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -273,7 +273,7 @@ pipeline { } } } - + } post { success { emailext ( From be171d7787bc53d5b1d79632de4976d09498ef9a Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Wed, 17 Mar 2021 15:02:51 +0800 Subject: [PATCH 13/52] [TD-3332]: vnode report status if not closing instead of not ready --- src/vnode/src/vnodeMgmt.c | 4 ++-- src/vnode/src/vnodeStatus.c | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/vnode/src/vnodeMgmt.c b/src/vnode/src/vnodeMgmt.c index 8469ab12c1..71d9bc07f5 100644 --- a/src/vnode/src/vnodeMgmt.c +++ b/src/vnode/src/vnodeMgmt.c @@ -128,7 +128,7 @@ static void vnodeBuildVloadMsg(SVnodeObj *pVnode, SStatusMsg *pStatus) { int64_t compStorage = 0; int64_t pointsWritten = 0; - if (!vnodeInReadyStatus(pVnode)) return; + if (vnodeInClosingStatus(pVnode)) return; if (pStatus->openVnodes >= TSDB_MAX_VNODES) return; if (pVnode->tsdb) { @@ -194,4 +194,4 @@ void vnodeSetAccess(SVgroupAccess *pAccess, int32_t numOfVnodes) { vnodeRelease(pVnode); } } -} \ No newline at end of file +} diff --git a/src/vnode/src/vnodeStatus.c b/src/vnode/src/vnodeStatus.c index 6889843530..64da8a4ad1 100644 --- a/src/vnode/src/vnodeStatus.c +++ b/src/vnode/src/vnodeStatus.c @@ -153,6 +153,18 @@ bool vnodeInReadyOrUpdatingStatus(SVnodeObj* pVnode) { return in; } +bool vnodeInClosingStatus(SVnodeObj* pVnode) { + bool in = false; + pthread_mutex_lock(&pVnode->statusMutex); + + if (pVnode->status == TAOS_VN_STATUS_CLOSING) { + in = true; + } + + pthread_mutex_unlock(&pVnode->statusMutex); + return in; +} + bool vnodeInResetStatus(SVnodeObj* pVnode) { bool in = false; pthread_mutex_lock(&pVnode->statusMutex); From ba79d022ce71ac91a34b7ace3272d5d5286ffe77 Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Wed, 17 Mar 2021 15:16:11 +0800 Subject: [PATCH 14/52] rebalance --- tests/pytest/handle_crash_gen_val_log.sh | 2 +- tests/script/jenkins/basic.txt | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/pytest/handle_crash_gen_val_log.sh b/tests/pytest/handle_crash_gen_val_log.sh index 502c859dad..55c10639d7 100755 --- a/tests/pytest/handle_crash_gen_val_log.sh +++ b/tests/pytest/handle_crash_gen_val_log.sh @@ -16,7 +16,7 @@ TOP_DIR=`pwd` TAOSD_DIR=`find . -name "taosd"|grep -v community|head -n1` nohup $TAOSD_DIR >/dev/null & cd - -./crash_gen.sh --valgrind -p -t 10 -s 500 -b 4 +./crash_gen.sh --valgrind -p -t 10 -s 1000 -b 4 pidof taosd|xargs kill -9 grep 'start to execute\|ERROR SUMMARY' valgrind.err|grep -v 'grep'|uniq|tee crash_gen_mem_err.log diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 55c88a2891..356e318eb4 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -157,9 +157,6 @@ cd ../../../debug; make ./test.sh -f unique/big/tcp.sim ./test.sh -f unique/cluster/alter.sim -./test.sh -f unique/cluster/balance1.sim -./test.sh -f unique/cluster/balance2.sim -./test.sh -f unique/cluster/balance3.sim ./test.sh -f unique/cluster/cache.sim ./test.sh -f unique/cluster/vgroup100.sim @@ -293,6 +290,9 @@ cd ../../../debug; make ./test.sh -f general/connection/test_old_data.sim ./test.sh -f unique/dnode/datatrans_3node.sim ./test.sh -f unique/dnode/datatrans_3node_2.sim +./test.sh -f general/db/alter_tables_d2.sim +./test.sh -f general/db/alter_tables_v1.sim +./test.sh -f general/db/alter_tables_v4.sim #======================b5-end=============== #======================b6-start=============== @@ -334,6 +334,9 @@ cd ../../../debug; make ./test.sh -f general/import/commit.sim ./test.sh -f general/import/large.sim ./test.sh -f general/import/replica1.sim +./test.sh -f unique/cluster/balance1.sim +./test.sh -f unique/cluster/balance2.sim +./test.sh -f unique/cluster/balance3.sim #======================b6-end=============== #======================b7-start=============== @@ -356,9 +359,6 @@ cd ../../../debug; make ./test.sh -f general/compute/top.sim ./test.sh -f general/db/alter_option.sim -./test.sh -f general/db/alter_tables_d2.sim -./test.sh -f general/db/alter_tables_v1.sim -./test.sh -f general/db/alter_tables_v4.sim ./test.sh -f general/db/alter_vgroups.sim ./test.sh -f general/db/basic.sim ./test.sh -f general/db/basic1.sim From 34565eff16aa6dadb3643dc9b1e48d747c9ea5db Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 17 Mar 2021 07:47:51 +0000 Subject: [PATCH 15/52] add some log for debug --- src/query/src/queryMain.c | 4 ++-- src/sync/src/syncRetrieve.c | 44 ++++++++++++++++++------------------- src/vnode/src/vnodeMain.c | 4 ++-- src/vnode/src/vnodeStatus.c | 2 ++ src/vnode/src/vnodeSync.c | 6 ++--- src/wal/src/walWrite.c | 2 +- 6 files changed, 32 insertions(+), 30 deletions(-) diff --git a/src/query/src/queryMain.c b/src/query/src/queryMain.c index d35d4a5ff8..1c839e4cfe 100644 --- a/src/query/src/queryMain.c +++ b/src/query/src/queryMain.c @@ -430,7 +430,7 @@ void qQueryMgmtNotifyClosed(void* pQMgmt) { } SQueryMgmt* pQueryMgmt = pQMgmt; - qDebug("vgId:%d, set querymgmt closed, wait for all queries cancelled", pQueryMgmt->vgId); + qInfo("vgId:%d, set querymgmt closed, wait for all queries cancelled", pQueryMgmt->vgId); pthread_mutex_lock(&pQueryMgmt->lock); pQueryMgmt->closed = true; @@ -445,7 +445,7 @@ void qQueryMgmtReOpen(void *pQMgmt) { } SQueryMgmt *pQueryMgmt = pQMgmt; - qDebug("vgId:%d, set querymgmt reopen", pQueryMgmt->vgId); + qInfo("vgId:%d, set querymgmt reopen", pQueryMgmt->vgId); pthread_mutex_lock(&pQueryMgmt->lock); pQueryMgmt->closed = false; diff --git a/src/sync/src/syncRetrieve.c b/src/sync/src/syncRetrieve.c index be4073760d..18af7bd686 100644 --- a/src/sync/src/syncRetrieve.c +++ b/src/sync/src/syncRetrieve.c @@ -29,7 +29,7 @@ static int32_t syncGetWalVersion(SSyncNode *pNode, SSyncPeer *pPeer) { uint64_t fver, wver; int32_t code = (*pNode->getVersionFp)(pNode->vgId, &fver, &wver); if (code != 0) { - sDebug("%s, vnode is commiting while retrieve, last wver:%" PRIu64, pPeer->id, pPeer->lastWalVer); + sInfo("%s, vnode is commiting while retrieve, last wver:%" PRIu64, pPeer->id, pPeer->lastWalVer); return -1; } @@ -41,12 +41,12 @@ static bool syncIsWalModified(SSyncNode *pNode, SSyncPeer *pPeer) { uint64_t fver, wver; int32_t code = (*pNode->getVersionFp)(pNode->vgId, &fver, &wver); if (code != 0) { - sDebug("%s, vnode is commiting while retrieve, last wver:%" PRIu64, pPeer->id, pPeer->lastWalVer); + sInfo("%s, vnode is commiting while retrieve, last wver:%" PRIu64, pPeer->id, pPeer->lastWalVer); return true; } if (wver != pPeer->lastWalVer) { - sDebug("%s, wal is modified while retrieve, wver:%" PRIu64 ", last:%" PRIu64, pPeer->id, wver, pPeer->lastWalVer); + sInfo("%s, wal is modified while retrieve, wver:%" PRIu64 ", last:%" PRIu64, pPeer->id, wver, pPeer->lastWalVer); return true; } @@ -57,7 +57,7 @@ static int32_t syncGetFileVersion(SSyncNode *pNode, SSyncPeer *pPeer) { uint64_t fver, wver; int32_t code = (*pNode->getVersionFp)(pNode->vgId, &fver, &wver); if (code != 0) { - sDebug("%s, vnode is commiting while get fver for retrieve, last fver:%" PRIu64, pPeer->id, pPeer->lastFileVer); + sInfo("%s, vnode is commiting while get fver for retrieve, last fver:%" PRIu64, pPeer->id, pPeer->lastFileVer); return -1; } @@ -69,13 +69,13 @@ static bool syncAreFilesModified(SSyncNode *pNode, SSyncPeer *pPeer) { uint64_t fver, wver; int32_t code = (*pNode->getVersionFp)(pNode->vgId, &fver, &wver); if (code != 0) { - sDebug("%s, vnode is commiting while retrieve, last fver:%" PRIu64, pPeer->id, pPeer->lastFileVer); + sInfo("%s, vnode is commiting while retrieve, last fver:%" PRIu64, pPeer->id, pPeer->lastFileVer); pPeer->fileChanged = 1; return true; } if (fver != pPeer->lastFileVer) { - sDebug("%s, files are modified while retrieve, fver:%" PRIu64 ", last:%" PRIu64, pPeer->id, fver, pPeer->lastFileVer); + sInfo("%s, files are modified while retrieve, fver:%" PRIu64 ", last:%" PRIu64, pPeer->id, fver, pPeer->lastFileVer); pPeer->fileChanged = 1; return true; } @@ -143,13 +143,13 @@ static int32_t syncReadOneWalRecord(int32_t sfd, SWalHead *pHead) { } if (ret == 0) { - sDebug("sfd:%d, read to the end of file, ret:%d", sfd, ret); + sInfo("sfd:%d, read to the end of file, ret:%d", sfd, ret); return 0; } if (ret != sizeof(SWalHead)) { // file is not at end yet, it shall be reloaded - sDebug("sfd:%d, a partial wal head is read out, ret:%d", sfd, ret); + sInfo("sfd:%d, a partial wal head is read out, ret:%d", sfd, ret); return 0; } @@ -163,7 +163,7 @@ static int32_t syncReadOneWalRecord(int32_t sfd, SWalHead *pHead) { if (ret != pHead->len) { // file is not at end yet, it shall be reloaded - sDebug("sfd:%d, a partial wal conetnt is read out, ret:%d", sfd, ret); + sInfo("sfd:%d, a partial wal conetnt is read out, ret:%d", sfd, ret); return 0; } @@ -184,7 +184,7 @@ static int64_t syncRetrieveLastWal(SSyncPeer *pPeer, char *name, uint64_t fversi return -1; } - sDebug("%s, retrieve last wal:%s, offset:%" PRId64 " fver:%" PRIu64, pPeer->id, name, offset, fversion); + sInfo("%s, retrieve last wal:%s, offset:%" PRId64 " fver:%" PRIu64, pPeer->id, name, offset, fversion); SWalHead *pHead = malloc(SYNC_MAX_SIZE); int64_t bytes = 0; @@ -198,7 +198,7 @@ static int64_t syncRetrieveLastWal(SSyncPeer *pPeer, char *name, uint64_t fversi if (code == 0) { code = bytes; - sDebug("%s, read to the end of wal, bytes:%" PRId64, pPeer->id, bytes); + sInfo("%s, read to the end of wal, bytes:%" PRId64, pPeer->id, bytes); break; } @@ -217,7 +217,7 @@ static int64_t syncRetrieveLastWal(SSyncPeer *pPeer, char *name, uint64_t fversi if (pHead->version >= fversion && fversion > 0) { code = 0; - sDebug("%s, retrieve wal finished, hver:%" PRIu64 " fver:%" PRIu64, pPeer->id, pHead->version, fversion); + sInfo("%s, retrieve wal finished, hver:%" PRIu64 " fver:%" PRIu64, pPeer->id, pHead->version, fversion); break; } } @@ -237,7 +237,7 @@ static int64_t syncProcessLastWal(SSyncPeer *pPeer, char *wname, int64_t index) // get full path to wal file snprintf(fname, sizeof(fname), "%s/%s", pNode->path, wname); - sDebug("%s, start to retrieve last wal:%s", pPeer->id, fname); + sInfo("%s, start to retrieve last wal:%s", pPeer->id, fname); while (1) { if (syncAreFilesModified(pNode, pPeer)) return -1; @@ -245,7 +245,7 @@ static int64_t syncProcessLastWal(SSyncPeer *pPeer, char *wname, int64_t index) int64_t bytes = syncRetrieveLastWal(pPeer, fname, fversion, offset); if (bytes < 0) { - sDebug("%s, failed to retrieve last wal, bytes:%" PRId64, pPeer->id, bytes); + sInfo("%s, failed to retrieve last wal, bytes:%" PRId64, pPeer->id, bytes); return bytes; } @@ -257,13 +257,13 @@ static int64_t syncProcessLastWal(SSyncPeer *pPeer, char *wname, int64_t index) if (fversion == 0) { pPeer->sstatus = TAOS_SYNC_STATUS_CACHE; // start to forward pkt fversion = nodeVersion; // must read data to fversion - sDebug("%s, set sstatus:%s and fver:%" PRIu64, pPeer->id, syncStatus[pPeer->sstatus], fversion); + sInfo("%s, set sstatus:%s and fver:%" PRIu64, pPeer->id, syncStatus[pPeer->sstatus], fversion); } } // if all data up to fversion is read out, it is over if (pPeer->sversion >= fversion && fversion > 0) { - sDebug("%s, data up to fver:%" PRIu64 " has been read out, bytes:%" PRId64 " sver:%" PRIu64, pPeer->id, fversion, bytes, + sInfo("%s, data up to fver:%" PRIu64 " has been read out, bytes:%" PRId64 " sver:%" PRIu64, pPeer->id, fversion, bytes, pPeer->sversion); return 0; } @@ -277,7 +277,7 @@ static int64_t syncProcessLastWal(SSyncPeer *pPeer, char *wname, int64_t index) // if bytes > 0, file is updated, or fversion is not reached but file still open, read again once = 1; offset += bytes; - sDebug("%s, continue retrieve last wal, bytes:%" PRId64 " offset:%" PRId64 " sver:%" PRIu64 " fver:%" PRIu64, pPeer->id, + sInfo("%s, continue retrieve last wal, bytes:%" PRId64 " offset:%" PRId64 " sver:%" PRIu64 " fver:%" PRIu64, pPeer->id, bytes, offset, pPeer->sversion, fversion); } @@ -303,7 +303,7 @@ static int64_t syncRetrieveWal(SSyncPeer *pPeer) { if (wname[0] == 0) { // no wal file code = 0; - sDebug("%s, no wal file anymore", pPeer->id); + sInfo("%s, no wal file anymore", pPeer->id); break; } @@ -320,12 +320,12 @@ static int64_t syncRetrieveWal(SSyncPeer *pPeer) { struct stat fstat; if (stat(fname, &fstat) < 0) { code = -1; - sDebug("%s, failed to stat wal:%s for retrieve since %s, code:0x%" PRIx64, pPeer->id, fname, strerror(errno), code); + sInfo("%s, failed to stat wal:%s for retrieve since %s, code:0x%" PRIx64, pPeer->id, fname, strerror(errno), code); break; } size = fstat.st_size; - sDebug("%s, retrieve wal:%s size:%d", pPeer->id, fname, size); + sInfo("%s, retrieve wal:%s size:%d", pPeer->id, fname, size); int32_t sfd = open(fname, O_RDONLY | O_BINARY); if (sfd < 0) { @@ -374,7 +374,7 @@ static int32_t syncRetrieveFirstPkt(SSyncPeer *pPeer) { sError("%s, failed to send sync-data msg since %s, tranId:%u", pPeer->id, strerror(errno), msg.tranId); return -1; } - sDebug("%s, send sync-data msg to peer, tranId:%u", pPeer->id, msg.tranId); + sInfo("%s, send sync-data msg to peer, tranId:%u", pPeer->id, msg.tranId); SSyncRsp rsp; if (taosReadMsg(pPeer->syncFd, &rsp, sizeof(SSyncRsp)) != sizeof(SSyncRsp)) { @@ -382,7 +382,7 @@ static int32_t syncRetrieveFirstPkt(SSyncPeer *pPeer) { return -1; } - sDebug("%s, recv sync-data rsp from peer, tranId:%u rsp-tranId:%u", pPeer->id, msg.tranId, rsp.tranId); + sInfo("%s, recv sync-data rsp from peer, tranId:%u rsp-tranId:%u", pPeer->id, msg.tranId, rsp.tranId); return 0; } diff --git a/src/vnode/src/vnodeMain.c b/src/vnode/src/vnodeMain.c index 42b9c024c9..d25cf10774 100644 --- a/src/vnode/src/vnodeMain.c +++ b/src/vnode/src/vnodeMain.c @@ -482,7 +482,7 @@ static int32_t vnodeProcessTsdbStatus(void *arg, int32_t status, int32_t eno) { if (status == TSDB_STATUS_COMMIT_START) { pVnode->isCommiting = 1; pVnode->cversion = pVnode->version; - vDebug("vgId:%d, start commit, fver:%" PRIu64 " vver:%" PRIu64, pVnode->vgId, pVnode->fversion, pVnode->version); + vInfo("vgId:%d, start commit, fver:%" PRIu64 " vver:%" PRIu64, pVnode->vgId, pVnode->fversion, pVnode->version); if (!vnodeInInitStatus(pVnode)) { return walRenew(pVnode->wal); } @@ -493,7 +493,7 @@ static int32_t vnodeProcessTsdbStatus(void *arg, int32_t status, int32_t eno) { pVnode->isCommiting = 0; pVnode->isFull = 0; pVnode->fversion = pVnode->cversion; - vDebug("vgId:%d, commit over, fver:%" PRIu64 " vver:%" PRIu64, pVnode->vgId, pVnode->fversion, pVnode->version); + vInfo("vgId:%d, commit over, fver:%" PRIu64 " vver:%" PRIu64, pVnode->vgId, pVnode->fversion, pVnode->version); if (!vnodeInInitStatus(pVnode)) { walRemoveOneOldFile(pVnode->wal); } diff --git a/src/vnode/src/vnodeStatus.c b/src/vnode/src/vnodeStatus.c index 6889843530..1344e1c167 100644 --- a/src/vnode/src/vnodeStatus.c +++ b/src/vnode/src/vnodeStatus.c @@ -109,6 +109,8 @@ bool vnodeSetResetStatus(SVnodeObj* pVnode) { taosMsleep(1); } + vInfo("vgId:%d, set to reset status", pVnode->vgId); + // release local resources only after cutting off outside connections qQueryMgmtNotifyClosed(pVnode->qMgmt); vnodeWaitReadCompleted(pVnode); diff --git a/src/vnode/src/vnodeSync.c b/src/vnode/src/vnodeSync.c index a45eae9b16..929dd15926 100644 --- a/src/vnode/src/vnodeSync.c +++ b/src/vnode/src/vnodeSync.c @@ -91,7 +91,7 @@ void vnodeStartSyncFile(int32_t vgId) { return; } - vDebug("vgId:%d, datafile will be synced", vgId); + vInfo("vgId:%d, datafile will be synced", vgId); vnodeSetResetStatus(pVnode); vnodeRelease(pVnode); @@ -147,7 +147,7 @@ int32_t vnodeGetVersion(int32_t vgId, uint64_t *fver, uint64_t *wver) { int32_t code = 0; if (pVnode->isCommiting) { - vDebug("vgId:%d, vnode is commiting while get version", vgId); + vInfo("vgId:%d, vnode is commiting while get version", vgId); code = -1; } else { *fver = pVnode->fversion; @@ -168,7 +168,7 @@ int32_t vnodeResetVersion(int32_t vgId, uint64_t fver) { pVnode->fversion = fver; pVnode->version = fver; walResetVersion(pVnode->wal, fver); - vDebug("vgId:%d, version reset to %" PRIu64, vgId, fver); + vInfo("vgId:%d, version reset to %" PRIu64, vgId, fver); vnodeRelease(pVnode); return 0; diff --git a/src/wal/src/walWrite.c b/src/wal/src/walWrite.c index 51b770d346..4368ddd7d3 100644 --- a/src/wal/src/walWrite.c +++ b/src/wal/src/walWrite.c @@ -455,7 +455,7 @@ uint64_t walGetVersion(twalh param) { void walResetVersion(twalh param, uint64_t newVer) { SWal *pWal = param; if (pWal == 0) return; - wDebug("vgId:%d, version reset from %" PRIu64 " to %" PRIu64, pWal->vgId, pWal->version, newVer); + wInfo("vgId:%d, version reset from %" PRIu64 " to %" PRIu64, pWal->vgId, pWal->version, newVer); pWal->version = newVer; } \ No newline at end of file From ee17eab632563c2cc55da796fd3f661a7c3c82c7 Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Wed, 17 Mar 2021 15:58:49 +0800 Subject: [PATCH 16/52] rebalance --- tests/script/jenkins/basic.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 356e318eb4..ce770aee56 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -88,6 +88,7 @@ cd ../../../debug; make ./test.sh -f general/parser/topbot.sim ./test.sh -f general/db/nosuchfile.sim ./test.sh -f general/parser/function.sim +./test.sh -f unique/cluster/vgroup100.sim #======================b1-end=============== #======================b2-start=============== @@ -152,13 +153,12 @@ cd ../../../debug; make ./test.sh -f unique/account/user_create.sim ./test.sh -f unique/account/user_len.sim -./test.sh -f unique/big/balance.sim ./test.sh -f unique/big/maxvnodes.sim ./test.sh -f unique/big/tcp.sim ./test.sh -f unique/cluster/alter.sim ./test.sh -f unique/cluster/cache.sim -./test.sh -f unique/cluster/vgroup100.sim + #======================b2-end=============== #======================b3-start=============== @@ -424,5 +424,6 @@ cd ../../../debug; make ./test.sh -f general/parser/stableOp.sim ./test.sh -f general/parser/timestamp.sim ./test.sh -f general/parser/sliding.sim +./test.sh -f unique/big/balance.sim #======================b7-end=============== From fcf6a1cf1f068bbc19cff6a6bffd493396d1b942 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 17 Mar 2021 16:08:55 +0800 Subject: [PATCH 17/52] [TD-3320]: fix sync coredump --- src/tsdb/src/tsdbSync.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/tsdb/src/tsdbSync.c b/src/tsdb/src/tsdbSync.c index 6b8483e4a6..ee545fbabc 100644 --- a/src/tsdb/src/tsdbSync.c +++ b/src/tsdb/src/tsdbSync.c @@ -677,13 +677,13 @@ static int32_t tsdbRecvDFileSetInfo(SSyncH *pSynch) { static int tsdbReload(STsdbRepo *pRepo, bool isMfChanged) { // TODO: may need to stop and restart stream - if (isMfChanged) { - tsdbCloseMeta(pRepo); - tsdbFreeMeta(pRepo->tsdbMeta); - pRepo->tsdbMeta = tsdbNewMeta(REPO_CFG(pRepo)); - tsdbOpenMeta(pRepo); - tsdbLoadMetaCache(pRepo, true); - } + // if (isMfChanged) { + tsdbCloseMeta(pRepo); + tsdbFreeMeta(pRepo->tsdbMeta); + pRepo->tsdbMeta = tsdbNewMeta(REPO_CFG(pRepo)); + tsdbOpenMeta(pRepo); + tsdbLoadMetaCache(pRepo, true); + // } tsdbUnRefMemTable(pRepo, pRepo->mem); tsdbUnRefMemTable(pRepo, pRepo->imem); From 785645eef4b4592ea5ce0f2dd8cc037c6266d020 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Wed, 17 Mar 2021 16:26:37 +0800 Subject: [PATCH 18/52] [TD-3337]: [balance] fix pVgroup->pDb NULL pointer crash --- src/balance/src/bnMain.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/balance/src/bnMain.c b/src/balance/src/bnMain.c index 236b22afaf..3055f77e81 100644 --- a/src/balance/src/bnMain.c +++ b/src/balance/src/bnMain.c @@ -425,7 +425,7 @@ static bool bnMonitorVgroups() { while (1) { pIter = mnodeGetNextVgroup(pIter, &pVgroup); - if (pVgroup == NULL) break; + if (pVgroup == NULL || pVgroup->pDb == NULL) break; int32_t dbReplica = pVgroup->pDb->cfg.replications; int32_t vgReplica = pVgroup->numOfVnodes; @@ -721,4 +721,4 @@ int32_t bnAlterDnode(struct SDnodeObj *pSrcDnode, int32_t vnodeId, int32_t dnode mnodeDecDnodeRef(pDestDnode); return code; -} \ No newline at end of file +} From 363bacbe76b6711113c6ee84931925e858b2fce4 Mon Sep 17 00:00:00 2001 From: dapan1121 <89396746@qq.com> Date: Wed, 17 Mar 2021 17:42:39 +0800 Subject: [PATCH 19/52] fix bug --- src/client/src/tscAsync.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/client/src/tscAsync.c b/src/client/src/tscAsync.c index 5cba897b30..87f6058cec 100644 --- a/src/client/src/tscAsync.c +++ b/src/client/src/tscAsync.c @@ -281,7 +281,7 @@ void tscQueueAsyncError(void(*fp), void *param, int32_t code) { } static void tscAsyncResultCallback(SSchedMsg *pMsg) { - SSqlObj* pSql = pMsg->ahandle; + SSqlObj* pSql = (SSqlObj*)taosAcquireRef(tscObjRef, (int64_t)pMsg->ahandle); if (pSql == NULL || pSql->signature != pSql) { tscDebug("%p SqlObj is freed, not add into queue async res", pSql); return; @@ -292,23 +292,26 @@ static void tscAsyncResultCallback(SSchedMsg *pMsg) { SSqlRes *pRes = &pSql->res; if (pSql->fp == NULL || pSql->fetchFp == NULL){ + taosReleaseRef(tscObjRef, pSql->self); return; } pSql->fp = pSql->fetchFp; (*pSql->fp)(pSql->param, pSql, pRes->code); + taosReleaseRef(tscObjRef, pSql->self); } void tscAsyncResultOnError(SSqlObj* pSql) { SSchedMsg schedMsg = {0}; schedMsg.fp = tscAsyncResultCallback; - schedMsg.ahandle = pSql; + schedMsg.ahandle = (void *)pSql->self; schedMsg.thandle = (void *)1; schedMsg.msg = 0; taosScheduleTask(tscQhandle, &schedMsg); } + int tscSendMsgToServer(SSqlObj *pSql); void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) { From 1e3f28cfb3a1edd9229ac3759dcef737c9b4afdb Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 17 Mar 2021 11:19:05 +0000 Subject: [PATCH 20/52] hotfix for mxkz --- src/tsdb/src/tsdbMeta.c | 6 +++--- src/tsdb/src/tsdbSync.c | 40 ++++++++++++++++++++-------------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/tsdb/src/tsdbMeta.c b/src/tsdb/src/tsdbMeta.c index cdde2bc91f..824f69608e 100644 --- a/src/tsdb/src/tsdbMeta.c +++ b/src/tsdb/src/tsdbMeta.c @@ -213,9 +213,9 @@ void *tsdbGetTableTagVal(const void* pTable, int32_t colId, int16_t type, int16_ char *val = tdGetKVRowValOfCol(((STable*)pTable)->tagVal, colId); assert(type == pCol->type && bytes == pCol->bytes); - if (val != NULL && IS_VAR_DATA_TYPE(type)) { - assert(varDataLen(val) < pCol->bytes); - } + // if (val != NULL && IS_VAR_DATA_TYPE(type)) { + // assert(varDataLen(val) < pCol->bytes); + // } return val; } diff --git a/src/tsdb/src/tsdbSync.c b/src/tsdb/src/tsdbSync.c index 6b8483e4a6..e30dfed86a 100644 --- a/src/tsdb/src/tsdbSync.c +++ b/src/tsdb/src/tsdbSync.c @@ -152,14 +152,14 @@ static int32_t tsdbSyncSendMeta(SSyncH *pSynch) { return -1; } - int32_t writeLen = (int32_t)mf.info.size; - tsdbInfo("vgId:%d, metafile:%s will be sent, size:%d", REPO_ID(pRepo), mf.f.aname, writeLen); + int64_t writeLen = mf.info.size; + tsdbInfo("vgId:%d, metafile:%s will be sent, size:%" PRId64, REPO_ID(pRepo), mf.f.aname, writeLen); - int32_t ret = (int32_t)taosSendFile(pSynch->socketFd, TSDB_FILE_FD(&mf), 0, writeLen); + int64_t ret = taosSendFile(pSynch->socketFd, TSDB_FILE_FD(&mf), 0, writeLen); if (ret != writeLen) { terrno = TAOS_SYSTEM_ERROR(errno); - tsdbError("vgId:%d, failed to send metafile since %s, ret:%d writeLen:%d", REPO_ID(pRepo), tstrerror(terrno), ret, - writeLen); + tsdbError("vgId:%d, failed to send metafile since %s, ret:%" PRId64 " writeLen:%" PRId64, REPO_ID(pRepo), + tstrerror(terrno), ret, writeLen); tsdbCloseMFile(&mf); return -1; } @@ -217,18 +217,18 @@ static int32_t tsdbSyncRecvMeta(SSyncH *pSynch) { tsdbInfo("vgId:%d, metafile:%s is created", REPO_ID(pRepo), mf.f.aname); - int32_t readLen = (int32_t)pSynch->pmf->info.size; - int32_t ret = taosCopyFds(pSynch->socketFd, TSDB_FILE_FD(&mf), readLen); + int64_t readLen = pSynch->pmf->info.size; + int64_t ret = taosCopyFds(pSynch->socketFd, TSDB_FILE_FD(&mf), readLen); if (ret != readLen) { terrno = TAOS_SYSTEM_ERROR(errno); - tsdbError("vgId:%d, failed to recv metafile since %s, ret:%d readLen:%d", REPO_ID(pRepo), tstrerror(terrno), ret, - readLen); + tsdbError("vgId:%d, failed to recv metafile since %s, ret:%" PRId64 " readLen:%" PRId64, REPO_ID(pRepo), + tstrerror(terrno), ret, readLen); tsdbCloseMFile(&mf); tsdbRemoveMFile(&mf); return -1; } - tsdbInfo("vgId:%d, metafile is received, size:%d", REPO_ID(pRepo), readLen); + tsdbInfo("vgId:%d, metafile is received, size:%" PRId64, REPO_ID(pRepo), readLen); mf.info = pSynch->pmf->info; tsdbCloseMFile(&mf); @@ -463,12 +463,12 @@ static int32_t tsdbSyncRecvDFileSetArray(SSyncH *pSynch) { tsdbInfo("vgId:%d, file:%s will be received, osize:%" PRIu64 " rsize:%" PRIu64, REPO_ID(pRepo), pDFile->f.aname, pDFile->info.size, pRDFile->info.size); - int32_t writeLen = (int32_t)pRDFile->info.size; - int32_t ret = taosCopyFds(pSynch->socketFd, pDFile->fd, writeLen); + int64_t writeLen = pRDFile->info.size; + int64_t ret = taosCopyFds(pSynch->socketFd, pDFile->fd, writeLen); if (ret != writeLen) { terrno = TAOS_SYSTEM_ERROR(errno); - tsdbError("vgId:%d, failed to recv file:%s since %s, ret:%d writeLen:%d", REPO_ID(pRepo), pDFile->f.aname, - tstrerror(terrno), ret, writeLen); + tsdbError("vgId:%d, failed to recv file:%s since %s, ret:%" PRId64 " writeLen:%" PRId64, REPO_ID(pRepo), + pDFile->f.aname, tstrerror(terrno), ret, writeLen); tsdbCloseDFileSet(&fset); tsdbRemoveDFileSet(&fset); return -1; @@ -476,7 +476,7 @@ static int32_t tsdbSyncRecvDFileSetArray(SSyncH *pSynch) { // Update new file info pDFile->info = pRDFile->info; - tsdbInfo("vgId:%d, file:%s is received, size:%d", REPO_ID(pRepo), pDFile->f.aname, writeLen); + tsdbInfo("vgId:%d, file:%s is received, size:%" PRId64, REPO_ID(pRepo), pDFile->f.aname, writeLen); } tsdbCloseDFileSet(&fset); @@ -575,14 +575,14 @@ static int32_t tsdbSyncSendDFileSet(SSyncH *pSynch, SDFileSet *pSet) { return -1; } - int32_t writeLen = (int32_t)df.info.size; - tsdbInfo("vgId:%d, file:%s will be sent, size:%d", REPO_ID(pRepo), df.f.aname, writeLen); + int64_t writeLen = df.info.size; + tsdbInfo("vgId:%d, file:%s will be sent, size:%" PRId64, REPO_ID(pRepo), df.f.aname, writeLen); - int32_t ret = (int32_t)taosSendFile(pSynch->socketFd, TSDB_FILE_FD(&df), 0, writeLen); + int64_t ret = taosSendFile(pSynch->socketFd, TSDB_FILE_FD(&df), 0, writeLen); if (ret != writeLen) { terrno = TAOS_SYSTEM_ERROR(errno); - tsdbError("vgId:%d, failed to send file:%s since %s, ret:%d writeLen:%d", REPO_ID(pRepo), df.f.aname, - tstrerror(terrno), ret, writeLen); + tsdbError("vgId:%d, failed to send file:%s since %s, ret:%" PRId64 " writeLen:%" PRId64, REPO_ID(pRepo), + df.f.aname, tstrerror(terrno), ret, writeLen); tsdbCloseDFile(&df); return -1; } From 000eac74214aa6482c0e8a93b359802950eface1 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 17 Mar 2021 13:43:21 +0000 Subject: [PATCH 21/52] TD-3354 --- src/sync/src/syncRetrieve.c | 2 +- src/util/inc/tsocket.h | 2 +- src/util/src/tsocket.c | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/sync/src/syncRetrieve.c b/src/sync/src/syncRetrieve.c index be4073760d..57472851df 100644 --- a/src/sync/src/syncRetrieve.c +++ b/src/sync/src/syncRetrieve.c @@ -334,7 +334,7 @@ static int64_t syncRetrieveWal(SSyncPeer *pPeer) { break; } - code = (int32_t)taosSendFile(pPeer->syncFd, sfd, NULL, size); + code = taosSendFile(pPeer->syncFd, sfd, NULL, size); close(sfd); if (code < 0) { sError("%s, failed to send wal:%s for retrieve since %s, code:0x%" PRIx64, pPeer->id, fname, strerror(errno), code); diff --git a/src/util/inc/tsocket.h b/src/util/inc/tsocket.h index 35b591b61e..b4f5516959 100644 --- a/src/util/inc/tsocket.h +++ b/src/util/inc/tsocket.h @@ -28,7 +28,7 @@ int32_t taosReadn(SOCKET sock, char *buffer, int32_t len); int32_t taosWriteMsg(SOCKET fd, void *ptr, int32_t nbytes); int32_t taosReadMsg(SOCKET fd, void *ptr, int32_t nbytes); int32_t taosNonblockwrite(SOCKET fd, char *ptr, int32_t nbytes); -int32_t taosCopyFds(SOCKET sfd, int32_t dfd, int64_t len); +int64_t taosCopyFds(SOCKET sfd, int32_t dfd, int64_t len); int32_t taosSetNonblocking(SOCKET sock, int32_t on); SOCKET taosOpenUdpSocket(uint32_t localIp, uint16_t localPort); diff --git a/src/util/src/tsocket.c b/src/util/src/tsocket.c index e075876867..8911b7e8ee 100644 --- a/src/util/src/tsocket.c +++ b/src/util/src/tsocket.c @@ -465,36 +465,36 @@ void tinet_ntoa(char *ipstr, uint32_t ip) { #define COPY_SIZE 32768 // sendfile shall be used -int32_t taosCopyFds(SOCKET sfd, int32_t dfd, int64_t len) { +int64_t taosCopyFds(SOCKET sfd, int32_t dfd, int64_t len) { int64_t leftLen; - int32_t readLen, writeLen; + int64_t readLen, writeLen; char temp[COPY_SIZE]; leftLen = len; while (leftLen > 0) { if (leftLen < COPY_SIZE) - readLen = (int32_t)leftLen; + readLen = leftLen; else readLen = COPY_SIZE; // 4K - int32_t retLen = taosReadMsg(sfd, temp, (int32_t)readLen); + int64_t retLen = taosReadMsg(sfd, temp, (int32_t)readLen); if (readLen != retLen) { - uError("read error, readLen:%d retLen:%d len:%" PRId64 " leftLen:%" PRId64 ", reason:%s", readLen, retLen, len, - leftLen, strerror(errno)); + uError("read error, readLen:%" PRId64 " retLen:%" PRId64 " len:%" PRId64 " leftLen:%" PRId64 ", reason:%s", + readLen, retLen, len, leftLen, strerror(errno)); return -1; } writeLen = taosWriteMsg(dfd, temp, readLen); if (readLen != writeLen) { - uError("copy error, readLen:%d writeLen:%d len:%" PRId64 " leftLen:%" PRId64 ", reason:%s", readLen, writeLen, - len, leftLen, strerror(errno)); + uError("copy error, readLen:%" PRId64 " writeLen:%" PRId64 " len:%" PRId64 " leftLen:%" PRId64 ", reason:%s", + readLen, writeLen, len, leftLen, strerror(errno)); return -1; } leftLen -= readLen; } - return (int32_t)len; + return len; } From 3f312f8bf49d931b8f245b3ffd0a539a2aafd264 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Wed, 17 Mar 2021 23:15:18 +0800 Subject: [PATCH 22/52] Feature/sangshuduo/td 3317 taosdemo interlace (#5476) * [TD-3316] : add testcase for taosdemo limit and offset. check offset 0. * [TD-3316] : add testcase for taosdemo limit and offset. fix sample file import bug. * [TD-3316] : add test case for limit and offset. fix sample data issue. * [TD-3327] : fix taosdemo segfault when import data from sample data file. * [TD-3317] : make taosdemo support interlace mode. json parameter rows_per_tbl support. * [TD-3317] : support interlace mode. refactor * [TD-3317] : support interlace mode. refactor * [TD-3317] : support interlace mode insertion. refactor. * [TD-3317] : support interlace mode insertion. change json file. * [TD-3317] : support interlace mode insertion. fix multithread create table regression. * [TD-3317] : support interlace mode insertion. working but not perfect. * [TD-3317] : support interlace mode insertion. rename lowaTest with taosdemoTestWithJson Co-authored-by: Shuduo Sang --- src/kit/taosdemo/insert-interlace.json | 58 ++ src/kit/taosdemo/taosdemo.c | 782 +++++++++++++----- tests/pytest/fulltest.sh | 6 +- tests/pytest/tools/insert-interlace.json | 58 ++ .../tools/insert-tblimit-tboffset0.json | 1 - .../tools/insert-tblimit1-tboffset.json | 59 ++ tests/pytest/tools/insert.json | 91 +- tests/pytest/tools/taosdemoTestInterlace.py | 68 ++ tests/pytest/tools/taosdemoTestLimitOffset.py | 9 + .../{lowaTest.py => taosdemoTestWithJson.py} | 0 10 files changed, 874 insertions(+), 258 deletions(-) create mode 100644 src/kit/taosdemo/insert-interlace.json create mode 100644 tests/pytest/tools/insert-interlace.json create mode 100644 tests/pytest/tools/insert-tblimit1-tboffset.json create mode 100644 tests/pytest/tools/taosdemoTestInterlace.py rename tests/pytest/tools/{lowaTest.py => taosdemoTestWithJson.py} (100%) diff --git a/src/kit/taosdemo/insert-interlace.json b/src/kit/taosdemo/insert-interlace.json new file mode 100644 index 0000000000..b05c1ee312 --- /dev/null +++ b/src/kit/taosdemo/insert-interlace.json @@ -0,0 +1,58 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 5000, + "rows_per_tbl": 50, + "num_of_records_per_req": 100, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb_", + "auto_create_table": "no", + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 200, + "multi_thread_write_one_tbl": "no", + "rows_per_tbl": 20, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/src/kit/taosdemo/taosdemo.c b/src/kit/taosdemo/taosdemo.c index b03f47bfaf..846eea5062 100644 --- a/src/kit/taosdemo/taosdemo.c +++ b/src/kit/taosdemo/taosdemo.c @@ -60,9 +60,12 @@ extern char configDir[]; #define QUERY_JSON_NAME "query.json" #define SUBSCRIBE_JSON_NAME "subscribe.json" -#define INSERT_MODE 0 -#define QUERY_MODE 1 -#define SUBSCRIBE_MODE 2 +enum TEST_MODE { + INSERT_TEST, // 0 + QUERY_TEST, // 1 + SUBSCRIBE_TEST, // 2 + INVAID_TEST +}; #define MAX_SQL_SIZE 65536 #define BUFFER_SIZE (65536*2) @@ -109,6 +112,12 @@ enum MODE { MODE_BUT }; +typedef enum enum_INSERT_MODE { + PROGRESSIVE_INSERT_MODE, + INTERLACE_INSERT_MODE, + INVALID_INSERT_MODE +} INSERT_MODE; + enum QUERY_TYPE { NO_INSERT_TYPE, INSERT_TYPE, @@ -148,7 +157,8 @@ enum _show_stables_index { TSDB_SHOW_STABLES_TID_INDEX, TSDB_SHOW_STABLES_VGID_INDEX, TSDB_MAX_SHOW_STABLES -}; +}; + enum _describe_table_index { TSDB_DESCRIBE_METRIC_FIELD_INDEX, TSDB_DESCRIBE_METRIC_TYPE_INDEX, @@ -188,6 +198,7 @@ typedef struct SArguments_S { int num_of_CPR; int num_of_threads; int insert_interval; + int rows_per_tbl; int num_of_RPR; int max_sql_len; int num_of_tables; @@ -197,6 +208,8 @@ typedef struct SArguments_S { int disorderRange; int method_of_delete; char ** arg_list; + int64_t totalInsertRows; + int64_t totalAffectedRows; } SArguments; typedef struct SColumn_S { @@ -379,8 +392,9 @@ typedef struct SThreadInfo_S { char db_name[MAX_DB_NAME_SIZE+1]; char fp[4096]; char tb_prefix[MAX_TB_NAME_SIZE]; - int start_table_id; - int end_table_id; + int start_table_from; + int end_table_to; + int ntables; int data_of_rate; uint64_t start_time; char* cols; @@ -531,6 +545,7 @@ SArguments g_args = { 10, // num_of_CPR 10, // num_of_connections/thread 0, // insert_interval + 0, // rows_per_tbl; 100, // num_of_RPR TSDB_PAYLOAD_SIZE, // max_sql_len 10000, // num_of_tables @@ -553,7 +568,8 @@ static FILE * g_fpOfInsertResult = NULL; do { if (g_args.debug_print || g_args.verbose_print) \ fprintf(stderr, "DEBG: "fmt, __VA_ARGS__); } while(0) #define verbosePrint(fmt, ...) \ - do { if (g_args.verbose_print) fprintf(stderr, "VERB: "fmt, __VA_ARGS__); } while(0) + do { if (g_args.verbose_print) \ + fprintf(stderr, "VERB: "fmt, __VA_ARGS__); } while(0) /////////////////////////////////////////////////// @@ -652,6 +668,8 @@ void parse_args(int argc, char *argv[], SArguments *arguments) { arguments->num_of_threads = atoi(argv[++i]); } else if (strcmp(argv[i], "-i") == 0) { arguments->insert_interval = atoi(argv[++i]); + } else if (strcmp(argv[i], "-B") == 0) { + arguments->rows_per_tbl = atoi(argv[++i]); } else if (strcmp(argv[i], "-r") == 0) { arguments->num_of_RPR = atoi(argv[++i]); } else if (strcmp(argv[i], "-t") == 0) { @@ -1299,33 +1317,45 @@ static void printfInsertMetaToFile(FILE* fp) { fprintf(fp, " columnCount: %d\n ", g_Dbs.db[i].superTbls[j].columnCount); for (int k = 0; k < g_Dbs.db[i].superTbls[j].columnCount; k++) { //printf("dataType:%s, dataLen:%d\t", g_Dbs.db[i].superTbls[j].columns[k].dataType, g_Dbs.db[i].superTbls[j].columns[k].dataLen); - if ((0 == strncasecmp(g_Dbs.db[i].superTbls[j].columns[k].dataType, "binary", 6)) || (0 == strncasecmp(g_Dbs.db[i].superTbls[j].columns[k].dataType, "nchar", 5))) { - fprintf(fp, "column[%d]:%s(%d) ", k, g_Dbs.db[i].superTbls[j].columns[k].dataType, g_Dbs.db[i].superTbls[j].columns[k].dataLen); + if ((0 == strncasecmp( + g_Dbs.db[i].superTbls[j].columns[k].dataType, + "binary", strlen("binary"))) + || (0 == strncasecmp(g_Dbs.db[i].superTbls[j].columns[k].dataType, + "nchar", strlen("nchar")))) { + fprintf(fp, "column[%d]:%s(%d) ", k, + g_Dbs.db[i].superTbls[j].columns[k].dataType, + g_Dbs.db[i].superTbls[j].columns[k].dataLen); } else { fprintf(fp, "column[%d]:%s ", k, g_Dbs.db[i].superTbls[j].columns[k].dataType); } } fprintf(fp, "\n"); - - fprintf(fp, " tagCount: %d\n ", g_Dbs.db[i].superTbls[j].tagCount); + + fprintf(fp, " tagCount: %d\n ", + g_Dbs.db[i].superTbls[j].tagCount); for (int k = 0; k < g_Dbs.db[i].superTbls[j].tagCount; k++) { //printf("dataType:%s, dataLen:%d\t", g_Dbs.db[i].superTbls[j].tags[k].dataType, g_Dbs.db[i].superTbls[j].tags[k].dataLen); - if ((0 == strncasecmp(g_Dbs.db[i].superTbls[j].tags[k].dataType, "binary", 6)) || (0 == strncasecmp(g_Dbs.db[i].superTbls[j].tags[k].dataType, "nchar", 5))) { - fprintf(fp, "tag[%d]:%s(%d) ", k, g_Dbs.db[i].superTbls[j].tags[k].dataType, g_Dbs.db[i].superTbls[j].tags[k].dataLen); + if ((0 == strncasecmp(g_Dbs.db[i].superTbls[j].tags[k].dataType, + "binary", strlen("binary"))) + || (0 == strncasecmp(g_Dbs.db[i].superTbls[j].tags[k].dataType, + "nchar", strlen("nchar")))) { + fprintf(fp, "tag[%d]:%s(%d) ", k, g_Dbs.db[i].superTbls[j].tags[k].dataType, + g_Dbs.db[i].superTbls[j].tags[k].dataLen); } else { fprintf(fp, "tag[%d]:%s ", k, g_Dbs.db[i].superTbls[j].tags[k].dataType); - } + } } fprintf(fp, "\n"); } fprintf(fp, "\n"); } - SHOW_PARSE_RESULT_END_TO_FILE(fp); + SHOW_PARSE_RESULT_END_TO_FILE(fp); } static void printfQueryMeta() { - SHOW_PARSE_RESULT_START(); - printf("host: \033[33m%s:%u\033[0m\n", g_queryInfo.host, g_queryInfo.port); + SHOW_PARSE_RESULT_START(); + printf("host: \033[33m%s:%u\033[0m\n", + g_queryInfo.host, g_queryInfo.port); printf("user: \033[33m%s\033[0m\n", g_queryInfo.user); printf("password: \033[33m%s\033[0m\n", g_queryInfo.password); printf("database name: \033[33m%s\033[0m\n", g_queryInfo.dbName); @@ -1336,7 +1366,7 @@ static void printfQueryMeta() { printf("concurrent: \033[33m%d\033[0m\n", g_queryInfo.superQueryInfo.concurrent); printf("sqlCount: \033[33m%d\033[0m\n", g_queryInfo.superQueryInfo.sqlCount); - if (SUBSCRIBE_MODE == g_args.test_mode) { + if (SUBSCRIBE_TEST == g_args.test_mode) { printf("mod: \033[33m%d\033[0m\n", g_queryInfo.superQueryInfo.subscribeMode); printf("interval: \033[33m%d\033[0m\n", g_queryInfo.superQueryInfo.subscribeInterval); printf("restart: \033[33m%d\033[0m\n", g_queryInfo.superQueryInfo.subscribeRestart); @@ -1353,7 +1383,7 @@ static void printfQueryMeta() { printf("childTblCount: \033[33m%d\033[0m\n", g_queryInfo.subQueryInfo.childTblCount); printf("stable name: \033[33m%s\033[0m\n", g_queryInfo.subQueryInfo.sTblName); - if (SUBSCRIBE_MODE == g_args.test_mode) { + if (SUBSCRIBE_TEST == g_args.test_mode) { printf("mod: \033[33m%d\033[0m\n", g_queryInfo.subQueryInfo.subscribeMode); printf("interval: \033[33m%d\033[0m\n", g_queryInfo.subQueryInfo.subscribeInterval); printf("restart: \033[33m%d\033[0m\n", g_queryInfo.subQueryInfo.subscribeRestart); @@ -1515,15 +1545,19 @@ static int getDbFromServer(TAOS * taos, SDbInfo** dbInfos) { return -1; } - tstrncpy(dbInfos[count]->name, (char *)row[TSDB_SHOW_DB_NAME_INDEX], fields[TSDB_SHOW_DB_NAME_INDEX].bytes); - xFormatTimestamp(dbInfos[count]->create_time, *(int64_t*)row[TSDB_SHOW_DB_CREATED_TIME_INDEX], TSDB_TIME_PRECISION_MILLI); + tstrncpy(dbInfos[count]->name, (char *)row[TSDB_SHOW_DB_NAME_INDEX], + fields[TSDB_SHOW_DB_NAME_INDEX].bytes); + xFormatTimestamp(dbInfos[count]->create_time, + *(int64_t*)row[TSDB_SHOW_DB_CREATED_TIME_INDEX], + TSDB_TIME_PRECISION_MILLI); dbInfos[count]->ntables = *((int32_t *)row[TSDB_SHOW_DB_NTABLES_INDEX]); dbInfos[count]->vgroups = *((int32_t *)row[TSDB_SHOW_DB_VGROUPS_INDEX]); dbInfos[count]->replica = *((int16_t *)row[TSDB_SHOW_DB_REPLICA_INDEX]); dbInfos[count]->quorum = *((int16_t *)row[TSDB_SHOW_DB_QUORUM_INDEX]); dbInfos[count]->days = *((int16_t *)row[TSDB_SHOW_DB_DAYS_INDEX]); - tstrncpy(dbInfos[count]->keeplist, (char *)row[TSDB_SHOW_DB_KEEP_INDEX], fields[TSDB_SHOW_DB_KEEP_INDEX].bytes); + tstrncpy(dbInfos[count]->keeplist, (char *)row[TSDB_SHOW_DB_KEEP_INDEX], + fields[TSDB_SHOW_DB_KEEP_INDEX].bytes); dbInfos[count]->cache = *((int32_t *)row[TSDB_SHOW_DB_CACHE_INDEX]); dbInfos[count]->blocks = *((int32_t *)row[TSDB_SHOW_DB_BLOCKS_INDEX]); dbInfos[count]->minrows = *((int32_t *)row[TSDB_SHOW_DB_MINROWS_INDEX]); @@ -1537,8 +1571,9 @@ static int getDbFromServer(TAOS * taos, SDbInfo** dbInfos) { (char *)row[TSDB_SHOW_DB_PRECISION_INDEX], fields[TSDB_SHOW_DB_PRECISION_INDEX].bytes); dbInfos[count]->update = *((int8_t *)row[TSDB_SHOW_DB_UPDATE_INDEX]); - tstrncpy(dbInfos[count]->status, (char *)row[TSDB_SHOW_DB_STATUS_INDEX], fields[TSDB_SHOW_DB_STATUS_INDEX].bytes); - + tstrncpy(dbInfos[count]->status, (char *)row[TSDB_SHOW_DB_STATUS_INDEX], + fields[TSDB_SHOW_DB_STATUS_INDEX].bytes); + count++; if (count > MAX_DATABASE_COUNT) { fprintf(stderr, "The database count overflow than %d\n", MAX_DATABASE_COUNT); @@ -1593,8 +1628,10 @@ static void printfQuerySystemInfo(TAOS * taos) { struct tm* lt; time(&t); lt = localtime(&t); - snprintf(filename, MAX_QUERY_SQL_LENGTH, "querySystemInfo-%d-%d-%d %d:%d:%d", lt->tm_year+1900, lt->tm_mon, lt->tm_mday, lt->tm_hour, lt->tm_min, lt->tm_sec); - + snprintf(filename, MAX_QUERY_SQL_LENGTH, "querySystemInfo-%d-%d-%d %d:%d:%d", + lt->tm_year+1900, lt->tm_mon, lt->tm_mday, lt->tm_hour, lt->tm_min, + lt->tm_sec); + // show variables res = taos_query(taos, "show variables;"); //getResult(res, filename); @@ -1604,7 +1641,7 @@ static void printfQuerySystemInfo(TAOS * taos) { res = taos_query(taos, "show dnodes;"); xDumpResultToFile(filename, res); //getResult(res, filename); - + // show databases res = taos_query(taos, "show databases;"); SDbInfo** dbInfos = (SDbInfo **)calloc(MAX_DATABASE_COUNT, sizeof(SDbInfo *)); @@ -1621,7 +1658,7 @@ static void printfQuerySystemInfo(TAOS * taos) { for (int i = 0; i < dbCount; i++) { // printf database info printfDbInfoForQueryToFile(filename, dbInfos[i], i); - + // show db.vgroups snprintf(buffer, MAX_QUERY_SQL_LENGTH, "show %s.vgroups;", dbInfos[i]->name); res = taos_query(taos, buffer); @@ -1639,9 +1676,9 @@ static void printfQuerySystemInfo(TAOS * taos) { } -void ERROR_EXIT(const char *msg) { perror(msg); exit(-1); } +static void ERROR_EXIT(const char *msg) { perror(msg); exit(-1); } -int postProceSql(char* host, uint16_t port, char* sqlstr) +static int postProceSql(char* host, uint16_t port, char* sqlstr) { char *req_fmt = "POST %s HTTP/1.1\r\nHost: %s:%d\r\nAccept: */*\r\nAuthorization: Basic %s\r\nContent-Length: %d\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\n%s"; @@ -2346,7 +2383,8 @@ static int createDatabases() { } printf("\ncreate database %s success!\n\n", g_Dbs.db[i].dbName); - debugPrint("%s() %d supertbl count:%d\n", __func__, __LINE__, g_Dbs.db[i].superTblCount); + debugPrint("%s() %d supertbl count:%d\n", + __func__, __LINE__, g_Dbs.db[i].superTblCount); for (int j = 0; j < g_Dbs.db[i].superTblCount; j++) { // describe super table, if exists sprintf(command, "describe %s.%s;", g_Dbs.db[i].dbName, @@ -2395,8 +2433,12 @@ static void* createTable(void *sarg) int len = 0; int batchNum = 0; - //printf("Creating table from %d to %d\n", winfo->start_table_id, winfo->end_table_id); - for (int i = winfo->start_table_id; i <= winfo->end_table_id; i++) { + + verbosePrint("%s() LN%d: Creating table from %d to %d\n", + __func__, __LINE__, + winfo->start_table_from, winfo->end_table_to); + + for (int i = winfo->start_table_from; i <= winfo->end_table_to; i++) { if (0 == g_Dbs.use_metric) { snprintf(buffer, buff_len, "create table if not exists %s.%s%d %s;", @@ -2451,7 +2493,7 @@ static void* createTable(void *sarg) int64_t currentPrintTime = taosGetTimestampMs(); if (currentPrintTime - lastPrintTime > 30*1000) { printf("thread[%d] already create %d - %d tables\n", - winfo->threadID, winfo->start_table_id, i); + winfo->threadID, winfo->start_table_from, i); lastPrintTime = currentPrintTime; } } @@ -2467,7 +2509,7 @@ static void* createTable(void *sarg) return NULL; } -int startMultiThreadCreateChildTable( +static int startMultiThreadCreateChildTable( char* cols, int threads, int startFrom, int ntables, char* db_name, SSuperTable* superTblInfo) { pthread_t *pids = malloc(threads * sizeof(pthread_t)); @@ -2491,7 +2533,6 @@ int startMultiThreadCreateChildTable( int b = 0; b = ntables % threads; - int last = startFrom; for (int i = 0; i < threads; i++) { threadInfo *t_info = infos + i; t_info->threadID = i; @@ -2510,9 +2551,11 @@ int startMultiThreadCreateChildTable( free(infos); return -1; } - t_info->start_table_id = last; - t_info->end_table_id = i < b ? last + a : last + a - 1; - last = t_info->end_table_id + 1; + + t_info->start_table_from = startFrom; + t_info->ntables = iend_table_to = i < b ? startFrom + a : startFrom + a - 1; + startFrom = t_info->end_table_to + 1; t_info->use_metric = 1; t_info->cols = cols; t_info->minDelay = INT16_MAX; @@ -2599,7 +2642,7 @@ static void createChildTables() { /* Read 10000 lines at most. If more than 10000 lines, continue to read after using */ -int readTagFromCsvFileToMem(SSuperTable * superTblInfo) { +static int readTagFromCsvFileToMem(SSuperTable * superTblInfo) { size_t n = 0; ssize_t readLen = 0; char * line = NULL; @@ -2669,7 +2712,6 @@ int readSampleFromJsonFileToMem(SSuperTable * superTblInfo) { return 0; } - /* Read 10000 lines at most. If more than 10000 lines, continue to read after using */ @@ -2716,7 +2758,8 @@ static int readSampleFromCsvFileToMem( continue; } - verbosePrint("readLen=%ld stb->lenOfOneRow=%d getRows=%d\n", readLen, superTblInfo->lenOfOneRow, getRows); + verbosePrint("readLen=%ld stb->lenOfOneRow=%d getRows=%d\n", readLen, + superTblInfo->lenOfOneRow, getRows); memcpy(superTblInfo->sampleDataBuf + getRows * superTblInfo->lenOfOneRow, line, readLen); @@ -2958,6 +3001,16 @@ static bool getMetaFromInsertJsonFile(cJSON* root) { goto PARSE_OVER; } + cJSON* rowsPerTbl = cJSON_GetObjectItem(root, "rows_per_tbl"); + if (rowsPerTbl && rowsPerTbl->type == cJSON_Number) { + g_args.rows_per_tbl = rowsPerTbl->valueint; + } else if (!rowsPerTbl) { + g_args.rows_per_tbl = 0; // 0 means progressive mode, > 0 mean interlace mode. max value is less or equ num_of_records_per_req + } else { + fprintf(stderr, "ERROR: failed to read json, rows_per_tbl input mistake\n"); + goto PARSE_OVER; + } + cJSON* maxSqlLen = cJSON_GetObjectItem(root, "max_sql_len"); if (maxSqlLen && maxSqlLen->type == cJSON_Number) { g_args.max_sql_len = maxSqlLen->valueint; @@ -3005,7 +3058,9 @@ static bool getMetaFromInsertJsonFile(cJSON* root) { int dbSize = cJSON_GetArraySize(dbs); if (dbSize > MAX_DB_COUNT) { - printf("ERROR: failed to read json, databases size overflow, max database is %d\n", MAX_DB_COUNT); + fprintf(stderr, + "ERROR: failed to read json, databases size overflow, max database is %d\n", + MAX_DB_COUNT); goto PARSE_OVER; } @@ -3202,7 +3257,9 @@ static bool getMetaFromInsertJsonFile(cJSON* root) { int stbSize = cJSON_GetArraySize(stables); if (stbSize > MAX_SUPER_TABLE_COUNT) { - printf("ERROR: failed to read json, databases size overflow, max database is %d\n", MAX_SUPER_TABLE_COUNT); + fprintf(stderr, + "ERROR: failed to read json, databases size overflow, max database is %d\n", + MAX_SUPER_TABLE_COUNT); goto PARSE_OVER; } @@ -3429,6 +3486,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) { printf("ERROR: failed to read json, multiThreadWriteOneTbl not found\n"); goto PARSE_OVER; } + cJSON* rowsPerTbl = cJSON_GetObjectItem(stbInfo, "rows_per_tbl"); if (rowsPerTbl && rowsPerTbl->type == cJSON_Number) { g_Dbs.db[i].superTbls[j].rowsPerTbl = rowsPerTbl->valueint; @@ -3768,7 +3826,9 @@ static bool getMetaFromQueryJsonFile(cJSON* root) { } cJSON* subkeepProgress = cJSON_GetObjectItem(subQuery, "keepProgress"); - if (subkeepProgress && subkeepProgress->type == cJSON_String && subkeepProgress->valuestring != NULL) { + if (subkeepProgress && + subkeepProgress->type == cJSON_String + && subkeepProgress->valuestring != NULL) { if (0 == strcmp("yes", subkeepProgress->valuestring)) { g_queryInfo.subQueryInfo.subscribeKeepProgress = 1; } else if (0 == strcmp("no", subkeepProgress->valuestring)) { @@ -3859,27 +3919,27 @@ static bool getInfoFromJsonFile(char* file) { cJSON* filetype = cJSON_GetObjectItem(root, "filetype"); if (filetype && filetype->type == cJSON_String && filetype->valuestring != NULL) { if (0 == strcasecmp("insert", filetype->valuestring)) { - g_args.test_mode = INSERT_MODE; + g_args.test_mode = INSERT_TEST; } else if (0 == strcasecmp("query", filetype->valuestring)) { - g_args.test_mode = QUERY_MODE; + g_args.test_mode = QUERY_TEST; } else if (0 == strcasecmp("subscribe", filetype->valuestring)) { - g_args.test_mode = SUBSCRIBE_MODE; + g_args.test_mode = SUBSCRIBE_TEST; } else { printf("ERROR: failed to read json, filetype not support\n"); goto PARSE_OVER; } } else if (!filetype) { - g_args.test_mode = INSERT_MODE; + g_args.test_mode = INSERT_TEST; } else { printf("ERROR: failed to read json, filetype not found\n"); goto PARSE_OVER; } - if (INSERT_MODE == g_args.test_mode) { + if (INSERT_TEST == g_args.test_mode) { ret = getMetaFromInsertJsonFile(root); - } else if (QUERY_MODE == g_args.test_mode) { + } else if (QUERY_TEST == g_args.test_mode) { ret = getMetaFromQueryJsonFile(root); - } else if (SUBSCRIBE_MODE == g_args.test_mode) { + } else if (SUBSCRIBE_TEST == g_args.test_mode) { ret = getMetaFromQueryJsonFile(root); } else { printf("ERROR: input json file type error! please input correct file type: insert or query or subscribe\n"); @@ -4125,13 +4185,34 @@ static int execInsert(threadInfo *winfo, char *buffer, int k) return affectedRows; } -static int generateDataBuffer(int32_t tableSeq, - threadInfo *pThreadInfo, char *buffer, - int64_t insertRows, - int64_t startFrom, int64_t startTime, int *pSampleUsePos) +static void getTableName(char *pTblName, threadInfo* pThreadInfo, int tableSeq) { SSuperTable* superTblInfo = pThreadInfo->superTblInfo; + if (superTblInfo) { + if ((superTblInfo->childTblOffset >= 0) + && (superTblInfo->childTblLimit > 0)) { + snprintf(pTblName, TSDB_TABLE_NAME_LEN, "%s", + superTblInfo->childTblName + (tableSeq - superTblInfo->childTblOffset) * TSDB_TABLE_NAME_LEN); + } else { + verbosePrint("%s() LN%d: from=%d count=%d seq=%d\n", + __func__, __LINE__, pThreadInfo->start_table_from, + pThreadInfo->ntables, tableSeq); + snprintf(pTblName, TSDB_TABLE_NAME_LEN, "%s", + superTblInfo->childTblName + tableSeq * TSDB_TABLE_NAME_LEN); + } + } else { + snprintf(pTblName, TSDB_TABLE_NAME_LEN, "%s%d", + superTblInfo?superTblInfo->childTblPrefix:g_args.tb_prefix, tableSeq); + } +} + +static int generateDataTail(char *tableName, int32_t tableSeq, + threadInfo* pThreadInfo, + SSuperTable* superTblInfo, + int batch, char* buffer, int64_t insertRows, + int64_t startFrom, uint64_t startTime, int *pSamplePos, int *dataLen) { + int len = 0; int ncols_per_record = 1; // count first col ts if (superTblInfo == NULL) { @@ -4142,91 +4223,21 @@ static int generateDataBuffer(int32_t tableSeq, } } - assert(buffer != NULL); + verbosePrint("%s() LN%d batch=%d\n", __func__, __LINE__, batch); - char *pChildTblName; - - pChildTblName = calloc(TSDB_TABLE_NAME_LEN, 1); - if (NULL == pChildTblName) { - fprintf(stderr, "failed to alloc memory %d\n", TSDB_TABLE_NAME_LEN); - return -1; - } - - if (superTblInfo && (superTblInfo->childTblOffset >= 0) - && (superTblInfo->childTblLimit > 0)) { - snprintf(pChildTblName, TSDB_TABLE_NAME_LEN, "%s", - superTblInfo->childTblName + (tableSeq - superTblInfo->childTblOffset) * TSDB_TABLE_NAME_LEN); - } else { - snprintf(pChildTblName, TSDB_TABLE_NAME_LEN, "%s%d", - superTblInfo?superTblInfo->childTblPrefix:g_args.tb_prefix, tableSeq); - } - - memset(buffer, 0, superTblInfo?superTblInfo->maxSqlLen:g_args.max_sql_len); - - char *pstr = buffer; - - if (superTblInfo) { - if (AUTO_CREATE_SUBTBL == superTblInfo->autoCreateTable) { - char* tagsValBuf = NULL; - if (0 == superTblInfo->tagSource) { - tagsValBuf = generateTagVaulesForStb(superTblInfo); - } else { - tagsValBuf = getTagValueFromTagSample( - superTblInfo, - tableSeq % superTblInfo->tagSampleCount); - } - if (NULL == tagsValBuf) { - free(pChildTblName); - fprintf(stderr, "tag buf failed to allocate memory\n"); - return -1; - } - - pstr += snprintf(pstr, - superTblInfo->maxSqlLen, - "insert into %s.%s using %s.%s tags %s values", - pThreadInfo->db_name, - pChildTblName, - pThreadInfo->db_name, - superTblInfo->sTblName, - tagsValBuf); - tmfree(tagsValBuf); - } else if (TBL_ALREADY_EXISTS == superTblInfo->childTblExists) { - pstr += snprintf(pstr, - superTblInfo->maxSqlLen, - "insert into %s.%s values", - pThreadInfo->db_name, - superTblInfo->childTblName + tableSeq * TSDB_TABLE_NAME_LEN); - } else { - pstr += snprintf(pstr, - (superTblInfo?superTblInfo->maxSqlLen:g_args.max_sql_len), - "insert into %s.%s values", - pThreadInfo->db_name, - pChildTblName); - } - } else { - pstr += snprintf(pstr, - g_args.max_sql_len, - "insert into %s.%s values", - pThreadInfo->db_name, - pChildTblName); - } - - int k; - int len = 0; - - verbosePrint("%s() LN%d num_of_RPR=%d\n", __func__, __LINE__, g_args.num_of_RPR); - for (k = 0; k < g_args.num_of_RPR;) { + int k = 0; + for (k = 0; k < batch;) { if (superTblInfo) { int retLen = 0; if (0 == strncasecmp(superTblInfo->dataSource, "sample", strlen("sample"))) { retLen = getRowDataFromSample( - pstr + len, + buffer + len, superTblInfo->maxSqlLen - len, startTime + superTblInfo->timeStampStep * startFrom, superTblInfo, - pSampleUsePos); + pSamplePos); } else if (0 == strncasecmp(superTblInfo->dataSource, "rand", strlen("rand"))) { int rand_num = rand_tinyint() % 100; @@ -4234,13 +4245,13 @@ static int generateDataBuffer(int32_t tableSeq, && rand_num < superTblInfo->disorderRatio) { int64_t d = startTime - taosRandom() % superTblInfo->disorderRange; retLen = generateRowData( - pstr + len, + buffer + len, superTblInfo->maxSqlLen - len, d, superTblInfo); } else { retLen = generateRowData( - pstr + len, + buffer + len, superTblInfo->maxSqlLen - len, startTime + superTblInfo->timeStampStep * startFrom, superTblInfo); @@ -4248,7 +4259,6 @@ static int generateDataBuffer(int32_t tableSeq, } if (retLen < 0) { - free(pChildTblName); return -1; } @@ -4277,28 +4287,288 @@ static int generateDataBuffer(int32_t tableSeq, lenOfBinary); } - pstr += sprintf(pstr, " %s", data); - if (len + pstr - buffer >= (g_args.max_sql_len - 256)) { // too long + buffer += sprintf(buffer, " %s", data); + if (strlen(buffer) >= (g_args.max_sql_len - 256)) { // too long k++; break; } } - verbosePrint("%s() LN%d len=%d k=%d \nbuffer=%s\n", __func__, __LINE__, len, k, buffer); + verbosePrint("%s() LN%d len=%d k=%d \nbuffer=%s\n", + __func__, __LINE__, len, k, buffer); k++; startFrom ++; - if (startFrom >= insertRows) + if (startFrom >= insertRows) { break; + } } - if (pChildTblName) - free(pChildTblName); - + *dataLen = len; return k; } +static int generateSQLHead(char *tableName, int32_t tableSeq, threadInfo* pThreadInfo, SSuperTable* superTblInfo, char *buffer) +{ + int len; + if (superTblInfo) { + if (AUTO_CREATE_SUBTBL == superTblInfo->autoCreateTable) { + char* tagsValBuf = NULL; + if (0 == superTblInfo->tagSource) { + tagsValBuf = generateTagVaulesForStb(superTblInfo); + } else { + tagsValBuf = getTagValueFromTagSample( + superTblInfo, + tableSeq % superTblInfo->tagSampleCount); + } + if (NULL == tagsValBuf) { + fprintf(stderr, "tag buf failed to allocate memory\n"); + return -1; + } + + len = snprintf(buffer, + superTblInfo->maxSqlLen, + "insert into %s.%s using %s.%s tags %s values", + pThreadInfo->db_name, + tableName, + pThreadInfo->db_name, + superTblInfo->sTblName, + tagsValBuf); + tmfree(tagsValBuf); + } else if (TBL_ALREADY_EXISTS == superTblInfo->childTblExists) { + len = snprintf(buffer, + superTblInfo->maxSqlLen, + "insert into %s.%s values", + pThreadInfo->db_name, + superTblInfo->childTblName + tableSeq * TSDB_TABLE_NAME_LEN); + } else { + len = snprintf(buffer, + (superTblInfo?superTblInfo->maxSqlLen:g_args.max_sql_len), + "insert into %s.%s values", + pThreadInfo->db_name, + tableName); + } + } else { + len = snprintf(buffer, + g_args.max_sql_len, + "insert into %s.%s values", + pThreadInfo->db_name, + tableName); + } + + return len; +} + +static int generateDataBuffer(char *pTblName, + int32_t tableSeq, + threadInfo *pThreadInfo, char *buffer, + int64_t insertRows, + int64_t startFrom, int64_t startTime, int *pSamplePos) +{ + SSuperTable* superTblInfo = pThreadInfo->superTblInfo; + + int ncols_per_record = 1; // count first col ts + + if (superTblInfo == NULL) { + int datatypeSeq = 0; + while(g_args.datatype[datatypeSeq]) { + datatypeSeq ++; + ncols_per_record ++; + } + } + + assert(buffer != NULL); + + memset(buffer, 0, superTblInfo?superTblInfo->maxSqlLen:g_args.max_sql_len); + + char *pstr = buffer; + + int headLen = generateSQLHead(pTblName, tableSeq, pThreadInfo, superTblInfo, buffer); + pstr += headLen; + + int k; + int dataLen; + k = generateDataTail(pTblName, tableSeq, pThreadInfo, superTblInfo, + g_args.num_of_RPR, pstr, insertRows, startFrom, startTime, + pSamplePos, &dataLen); + return k; +} + +static void* syncWriteInterlace(threadInfo *pThreadInfo) { + printf("### CBD: interlace write\n"); + + SSuperTable* superTblInfo = pThreadInfo->superTblInfo; + + char* buffer = calloc(superTblInfo?superTblInfo->maxSqlLen:g_args.max_sql_len, 1); + if (NULL == buffer) { + fprintf(stderr, "Failed to alloc %d Bytes, reason:%s\n", + superTblInfo?superTblInfo->maxSqlLen:g_args.max_sql_len, + strerror(errno)); + return NULL; + } + + int insertMode; + char tableName[TSDB_TABLE_NAME_LEN]; + + int rowsPerTbl = superTblInfo?superTblInfo->rowsPerTbl:g_args.rows_per_tbl; + + if (rowsPerTbl > 0) { + insertMode = INTERLACE_INSERT_MODE; + } else { + insertMode = PROGRESSIVE_INSERT_MODE; + } + + // rows per table need be less than insert batch + if (rowsPerTbl > g_args.num_of_RPR) + rowsPerTbl = g_args.num_of_RPR; + + pThreadInfo->totalInsertRows = 0; + pThreadInfo->totalAffectedRows = 0; + + int64_t insertRows = (superTblInfo)?superTblInfo->insertRows:g_args.num_of_DPT; + int insert_interval = superTblInfo?superTblInfo->insertInterval:g_args.insert_interval; + uint64_t st = 0; + uint64_t et = 0xffffffff; + + int64_t lastPrintTime = taosGetTimestampMs(); + int64_t startTs = taosGetTimestampUs(); + int64_t endTs; + + int tableSeq = pThreadInfo->start_table_from; + + debugPrint("%s() LN%d: start_table_from=%d ntables=%d insertRows=%"PRId64"\n", + __func__, __LINE__, pThreadInfo->start_table_from, + pThreadInfo->ntables, insertRows); + + int64_t startTime = pThreadInfo->start_time; + + int batchPerTblTimes; + int prevBatchPerTbl, lastBatchPerTbl; + + if (pThreadInfo->ntables == 1) { + batchPerTblTimes = 1; + lastBatchPerTbl = rowsPerTbl; + prevBatchPerTbl = rowsPerTbl; + } else if (rowsPerTbl > 0) { + batchPerTblTimes = g_args.num_of_RPR / rowsPerTbl; + lastBatchPerTbl = g_args.num_of_RPR % rowsPerTbl; + + if (lastBatchPerTbl > 0) + batchPerTblTimes += 1; + else + lastBatchPerTbl = rowsPerTbl; + prevBatchPerTbl = rowsPerTbl; + } else { + batchPerTblTimes = 1; + prevBatchPerTbl = g_args.num_of_RPR; + lastBatchPerTbl = g_args.num_of_RPR; + } + + while(pThreadInfo->totalInsertRows < pThreadInfo->ntables * insertRows) { + if (insert_interval) { + st = taosGetTimestampUs(); + } + // generate data + memset(buffer, 0, superTblInfo?superTblInfo->maxSqlLen:g_args.max_sql_len); + + char *pstr = buffer; + int recGenerated = 0; + + for (int i = 0; i < batchPerTblTimes; i ++) { + if (insertMode == INTERLACE_INSERT_MODE) { + if (tableSeq == pThreadInfo->start_table_from + pThreadInfo->ntables) { + // turn to first table + tableSeq = pThreadInfo->start_table_from; + } + } + getTableName(tableName, pThreadInfo, tableSeq); + + int headLen; + if (i == 0) { + headLen = generateSQLHead(tableName, tableSeq, pThreadInfo, superTblInfo, pstr); + } else { + headLen = snprintf(pstr, TSDB_TABLE_NAME_LEN, "%s.%s values", + pThreadInfo->db_name, + tableName); + } + + // generate data buffer + verbosePrint("%s() LN%d i=%d buffer:\n%s\n", + __func__, __LINE__, i, buffer); + + pstr += headLen; + int dataLen = 0; + + int batchPerTbl; + if (i == batchPerTblTimes - 1) { + batchPerTbl = lastBatchPerTbl; + } else { + batchPerTbl = prevBatchPerTbl; + } + + verbosePrint("%s() LN%d batchPerTbl = %d\n", + __func__, __LINE__, batchPerTbl); + int numOfRecGenerated = generateDataTail( + tableName, tableSeq, pThreadInfo, superTblInfo, + batchPerTbl, pstr, insertRows, 0, + startTime + pThreadInfo->totalInsertRows * superTblInfo->timeStampStep, + &(pThreadInfo->samplePos), &dataLen); + verbosePrint("%s() LN%d numOfRecGenerated= %d\n", + __func__, __LINE__, numOfRecGenerated); + pstr += dataLen; + recGenerated += numOfRecGenerated; + + tableSeq ++; + } + verbosePrint("%s() LN%d buffer:\n%s\n", + __func__, __LINE__, buffer); + pThreadInfo->totalInsertRows += recGenerated; + + int affectedRows = execInsert(pThreadInfo, buffer, recGenerated); + if (affectedRows < 0) + goto free_and_statistics_interlace; + + pThreadInfo->totalAffectedRows += affectedRows; + + endTs = taosGetTimestampUs(); + int64_t delay = endTs - startTs; + if (delay > pThreadInfo->maxDelay) pThreadInfo->maxDelay = delay; + if (delay < pThreadInfo->minDelay) pThreadInfo->minDelay = delay; + pThreadInfo->cntDelay++; + pThreadInfo->totalDelay += delay; + + int64_t currentPrintTime = taosGetTimestampMs(); + if (currentPrintTime - lastPrintTime > 30*1000) { + printf("thread[%d] has currently inserted rows: %"PRId64 ", affected rows: %"PRId64 "\n", + pThreadInfo->threadID, + pThreadInfo->totalInsertRows, + pThreadInfo->totalAffectedRows); + lastPrintTime = currentPrintTime; + } + + if (insert_interval) { + et = taosGetTimestampUs(); + + if (insert_interval > ((et - st)/1000) ) { + int sleep_time = insert_interval - (et -st)/1000; + verbosePrint("%s() LN%d sleep: %d ms for insert interval\n", + __func__, __LINE__, sleep_time); + taosMsleep(sleep_time); // ms + } + } + } + +free_and_statistics_interlace: + tmfree(buffer); + + printf("====thread[%d] completed total inserted rows: %"PRId64 ", total affected rows: %"PRId64 "====\n", + pThreadInfo->threadID, + pThreadInfo->totalInsertRows, + pThreadInfo->totalAffectedRows); + return NULL; +} + // sync insertion /* 1 thread: 100 tables * 2000 rows/s @@ -4307,10 +4577,9 @@ static int generateDataBuffer(int32_t tableSeq, 2 taosinsertdata , 1 thread: 10 tables * 20000 rows/s */ -static void* syncWrite(void *sarg) { +static void* syncWriteProgressive(threadInfo *pThreadInfo) { - threadInfo *winfo = (threadInfo *)sarg; - SSuperTable* superTblInfo = winfo->superTblInfo; + SSuperTable* superTblInfo = pThreadInfo->superTblInfo; char* buffer = calloc(superTblInfo?superTblInfo->maxSqlLen:g_args.max_sql_len, 1); if (NULL == buffer) { @@ -4324,19 +4593,18 @@ static void* syncWrite(void *sarg) { int64_t startTs = taosGetTimestampUs(); int64_t endTs; - int insert_interval = superTblInfo?superTblInfo->insertInterval: - g_args.insert_interval; + int insert_interval = superTblInfo?superTblInfo->insertInterval:g_args.insert_interval; uint64_t st = 0; uint64_t et = 0xffffffff; - winfo->totalInsertRows = 0; - winfo->totalAffectedRows = 0; + pThreadInfo->totalInsertRows = 0; + pThreadInfo->totalAffectedRows = 0; - winfo->samplePos = 0; + pThreadInfo->samplePos = 0; - for (uint32_t tableSeq = winfo->start_table_id; tableSeq <= winfo->end_table_id; + for (uint32_t tableSeq = pThreadInfo->start_table_from; tableSeq <= pThreadInfo->end_table_to; tableSeq ++) { - int64_t start_time = winfo->start_time; + int64_t start_time = pThreadInfo->start_time; int64_t insertRows = (superTblInfo)?superTblInfo->insertRows:g_args.num_of_DPT; verbosePrint("%s() LN%d insertRows=%"PRId64"\n", __func__, __LINE__, insertRows); @@ -4346,34 +4614,39 @@ static void* syncWrite(void *sarg) { st = taosGetTimestampUs(); } - int generated = generateDataBuffer(tableSeq, winfo, buffer, insertRows, - i, start_time, &(winfo->samplePos)); + char tableName[TSDB_TABLE_NAME_LEN]; + getTableName(tableName, pThreadInfo, tableSeq); + verbosePrint("%s() LN%d: tid=%d seq=%d tableName=%s\n", + __func__, __LINE__, + pThreadInfo->threadID, tableSeq, tableName); + + int generated = generateDataBuffer(tableName, tableSeq, pThreadInfo, buffer, insertRows, + i, start_time, &(pThreadInfo->samplePos)); if (generated > 0) i += generated; else goto free_and_statistics_2; - int affectedRows = execInsert(winfo, buffer, generated); + int affectedRows = execInsert(pThreadInfo, buffer, generated); if (affectedRows < 0) goto free_and_statistics_2; - - winfo->totalInsertRows += generated; - winfo->totalAffectedRows += affectedRows; + pThreadInfo->totalInsertRows += generated; + pThreadInfo->totalAffectedRows += affectedRows; endTs = taosGetTimestampUs(); int64_t delay = endTs - startTs; - if (delay > winfo->maxDelay) winfo->maxDelay = delay; - if (delay < winfo->minDelay) winfo->minDelay = delay; - winfo->cntDelay++; - winfo->totalDelay += delay; + if (delay > pThreadInfo->maxDelay) pThreadInfo->maxDelay = delay; + if (delay < pThreadInfo->minDelay) pThreadInfo->minDelay = delay; + pThreadInfo->cntDelay++; + pThreadInfo->totalDelay += delay; int64_t currentPrintTime = taosGetTimestampMs(); if (currentPrintTime - lastPrintTime > 30*1000) { printf("thread[%d] has currently inserted rows: %"PRId64 ", affected rows: %"PRId64 "\n", - winfo->threadID, - winfo->totalInsertRows, - winfo->totalAffectedRows); + pThreadInfo->threadID, + pThreadInfo->totalInsertRows, + pThreadInfo->totalAffectedRows); lastPrintTime = currentPrintTime; } @@ -4391,10 +4664,11 @@ static void* syncWrite(void *sarg) { } } // num_of_DPT - if ((tableSeq == winfo->end_table_id) && superTblInfo && + if ((tableSeq == pThreadInfo->ntables - 1) && superTblInfo && (0 == strncasecmp( superTblInfo->dataSource, "sample", strlen("sample")))) { - printf("%s() LN%d samplePos=%d\n", __func__, __LINE__, winfo->samplePos); + printf("%s() LN%d samplePos=%d\n", + __func__, __LINE__, pThreadInfo->samplePos); } } // tableSeq @@ -4402,12 +4676,28 @@ free_and_statistics_2: tmfree(buffer); printf("====thread[%d] completed total inserted rows: %"PRId64 ", total affected rows: %"PRId64 "====\n", - winfo->threadID, - winfo->totalInsertRows, - winfo->totalAffectedRows); + pThreadInfo->threadID, + pThreadInfo->totalInsertRows, + pThreadInfo->totalAffectedRows); return NULL; } +static void* syncWrite(void *sarg) { + + threadInfo *winfo = (threadInfo *)sarg; + SSuperTable* superTblInfo = winfo->superTblInfo; + + int rowsPerTbl = superTblInfo?superTblInfo->rowsPerTbl:g_args.rows_per_tbl; + + if (rowsPerTbl > 0) { + // interlace mode + return syncWriteInterlace(winfo); + } else { + // progressive mode + return syncWriteProgressive(winfo); + } +} + void callBack(void *param, TAOS_RES *res, int code) { threadInfo* winfo = (threadInfo*)param; SSuperTable* superTblInfo = winfo->superTblInfo; @@ -4423,13 +4713,14 @@ void callBack(void *param, TAOS_RES *res, int code) { char *buffer = calloc(1, winfo->superTblInfo->maxSqlLen); char *data = calloc(1, MAX_DATA_SIZE); char *pstr = buffer; - pstr += sprintf(pstr, "insert into %s.%s%d values", winfo->db_name, winfo->tb_prefix, winfo->start_table_id); + pstr += sprintf(pstr, "insert into %s.%s%d values", winfo->db_name, winfo->tb_prefix, + winfo->start_table_from); // if (winfo->counter >= winfo->superTblInfo->insertRows) { if (winfo->counter >= g_args.num_of_RPR) { - winfo->start_table_id++; + winfo->start_table_from++; winfo->counter = 0; } - if (winfo->start_table_id > winfo->end_table_id) { + if (winfo->start_table_from > winfo->end_table_to) { tsem_post(&winfo->lock_sem); free(buffer); free(data); @@ -4553,7 +4844,7 @@ static void startMultiThreadInsertData(int threads, char* db_name, &start_time, strlen(superTblInfo->startTimestamp), timePrec, 0)) { - printf("ERROR to parse time!\n"); + fprintf(stderr, "ERROR to parse time!\n"); exit(-1); } } @@ -4563,12 +4854,12 @@ static void startMultiThreadInsertData(int threads, char* db_name, double start = getCurrentTime(); - int last; + int startFrom; if ((superTblInfo) && (superTblInfo->childTblOffset >= 0)) - last = superTblInfo->childTblOffset; + startFrom = superTblInfo->childTblOffset; else - last = 0; + startFrom = 0; // read sample data from file first if ((superTblInfo) && (0 == strncasecmp(superTblInfo->dataSource, @@ -4609,6 +4900,55 @@ static void startMultiThreadInsertData(int threads, char* db_name, taos_close(taos); } + // read sample data from file first + if ((superTblInfo) && (0 == strncasecmp(superTblInfo->dataSource, + "sample", strlen("sample")))) { + if (0 != prepareSampleDataForSTable(superTblInfo)) { + fprintf(stderr, "prepare sample data for stable failed!\n"); + exit(-1); + } + } + + + TAOS* taos = taos_connect( + g_Dbs.host, g_Dbs.user, + g_Dbs.password, db_name, g_Dbs.port); + if (NULL == taos) { + fprintf(stderr, "connect to server fail , reason: %s\n", + taos_errstr(NULL)); + exit(-1); + } + + if (superTblInfo) { + + int limit, offset; + if (superTblInfo && (superTblInfo->childTblOffset >= 0) + && (superTblInfo->childTblLimit > 0)) { + limit = superTblInfo->childTblLimit; + offset = superTblInfo->childTblOffset; + } else { + limit = superTblInfo->childTblCount; + offset = 0; + } + + superTblInfo->childTblName = (char*)calloc(1, + limit * TSDB_TABLE_NAME_LEN); + if (superTblInfo->childTblName == NULL) { + fprintf(stderr, "alloc memory failed!"); + taos_close(taos); + exit(-1); + } + + int childTblCount; + getChildNameOfSuperTableWithLimitAndOffset( + taos, + db_name, superTblInfo->sTblName, + &superTblInfo->childTblName, &childTblCount, + limit, + offset); + } + taos_close(taos); + for (int i = 0; i < threads; i++) { threadInfo *t_info = infos + i; t_info->threadID = i; @@ -4625,7 +4965,7 @@ static void startMultiThreadInsertData(int threads, char* db_name, g_Dbs.host, g_Dbs.user, g_Dbs.password, db_name, g_Dbs.port); if (NULL == t_info->taos) { - printf("connect to server fail from insert sub thread, reason: %s\n", + fprintf(stderr, "connect to server fail from insert sub thread, reason: %s\n", taos_errstr(NULL)); exit(-1); } @@ -4635,12 +4975,13 @@ static void startMultiThreadInsertData(int threads, char* db_name, if ((NULL == superTblInfo) || (0 == superTblInfo->multiThreadWriteOneTbl)) { - t_info->start_table_id = last; - t_info->end_table_id = i < b ? last + a : last + a - 1; - last = t_info->end_table_id + 1; + t_info->start_table_from = startFrom; + t_info->ntables = iend_table_to = i < b ? startFrom + a : startFrom + a - 1; + startFrom = t_info->end_table_to + 1; } else { - t_info->start_table_id = 0; - t_info->end_table_id = superTblInfo->childTblCount - 1; + t_info->start_table_from = 0; + t_info->ntables = superTblInfo->childTblCount; t_info->start_time = t_info->start_time + rand_int() % 10000 - rand_tinyint(); } @@ -4671,6 +5012,9 @@ static void startMultiThreadInsertData(int threads, char* db_name, if (superTblInfo) { superTblInfo->totalAffectedRows += t_info->totalAffectedRows; superTblInfo->totalInsertRows += t_info->totalInsertRows; + } else { + g_args.totalAffectedRows += t_info->totalAffectedRows; + g_args.totalInsertRows += t_info->totalInsertRows; } totalDelay += t_info->totalDelay; @@ -4698,6 +5042,18 @@ static void startMultiThreadInsertData(int threads, char* db_name, superTblInfo->totalAffectedRows, threads, db_name, superTblInfo->sTblName, superTblInfo->totalInsertRows/ t); + } else { + printf("Spent %.4f seconds to insert rows: %"PRId64", affected rows: %"PRId64" with %d thread(s) into %s %2.f records/second\n\n", + t, g_args.totalInsertRows, + g_args.totalAffectedRows, + threads, db_name, + g_args.totalInsertRows / t); + fprintf(g_fpOfInsertResult, + "Spent %.4f seconds to insert rows: %"PRId64", affected rows: %"PRId64" with %d thread(s) into %s %2.f records/second\n\n", + t, g_args.totalInsertRows, + g_args.totalAffectedRows, + threads, db_name, + g_args.totalInsertRows / t); } printf("insert delay, avg: %10.6fms, max: %10.6fms, min: %10.6fms\n\n", @@ -4720,7 +5076,7 @@ void *readTable(void *sarg) { char *tb_prefix = rinfo->tb_prefix; FILE *fp = fopen(rinfo->fp, "a"); if (NULL == fp) { - printf("fopen %s fail, reason:%s.\n", rinfo->fp, strerror(errno)); + fprintf(stderr, "fopen %s fail, reason:%s.\n", rinfo->fp, strerror(errno)); return NULL; } @@ -4732,7 +5088,7 @@ void *readTable(void *sarg) { num_of_DPT = g_args.num_of_DPT; // } - int num_of_tables = rinfo->end_table_id - rinfo->start_table_id + 1; + int num_of_tables = rinfo->ntables; // rinfo->end_table_to - rinfo->start_table_from + 1; int totalData = num_of_DPT * num_of_tables; bool do_aggreFunc = g_Dbs.do_aggreFunc; @@ -4794,7 +5150,7 @@ void *readMetric(void *sarg) { } int num_of_DPT = rinfo->superTblInfo->insertRows; - int num_of_tables = rinfo->end_table_id - rinfo->start_table_id + 1; + int num_of_tables = rinfo->ntables; // rinfo->end_table_to - rinfo->start_table_from + 1; int totalData = num_of_DPT * num_of_tables; bool do_aggreFunc = g_Dbs.do_aggreFunc; @@ -4842,7 +5198,8 @@ void *readMetric(void *sarg) { } t = getCurrentTime() - t; - fprintf(fp, "| Speed: %12.2f(per s) | Latency: %.4f(ms) |\n", num_of_tables * num_of_DPT / t, t * 1000); + fprintf(fp, "| Speed: %12.2f(per s) | Latency: %.4f(ms) |\n", + num_of_tables * num_of_DPT / t, t * 1000); printf("select %10s took %.6f second(s)\n\n", aggreFunc[j], t); taos_free_result(pSql); @@ -4956,7 +5313,7 @@ void *superQueryProcess(void *sarg) { while (1) { if (g_queryInfo.superQueryInfo.rate && (et - st) < (int64_t)g_queryInfo.superQueryInfo.rate*1000) { taosMsleep(g_queryInfo.superQueryInfo.rate*1000 - (et - st)); // ms - //printf("========sleep duration:%"PRId64 "========inserted rows:%d, table range:%d - %d\n", (1000 - (et - st)), i, winfo->start_table_id, winfo->end_table_id); + //printf("========sleep duration:%"PRId64 "========inserted rows:%d, table range:%d - %d\n", (1000 - (et - st)), i, winfo->start_table_from, winfo->end_table_to); } st = taosGetTimestampUs(); @@ -5020,13 +5377,14 @@ static void *subQueryProcess(void *sarg) { int64_t st = 0; int64_t et = (int64_t)g_queryInfo.subQueryInfo.rate*1000; while (1) { - if (g_queryInfo.subQueryInfo.rate && (et - st) < (int64_t)g_queryInfo.subQueryInfo.rate*1000) { + if (g_queryInfo.subQueryInfo.rate + && (et - st) < (int64_t)g_queryInfo.subQueryInfo.rate*1000) { taosMsleep(g_queryInfo.subQueryInfo.rate*1000 - (et - st)); // ms - //printf("========sleep duration:%"PRId64 "========inserted rows:%d, table range:%d - %d\n", (1000 - (et - st)), i, winfo->start_table_id, winfo->end_table_id); + //printf("========sleep duration:%"PRId64 "========inserted rows:%d, table range:%d - %d\n", (1000 - (et - st)), i, winfo->start_table_from, winfo->end_table_to); } st = taosGetTimestampUs(); - for (int i = winfo->start_table_id; i <= winfo->end_table_id; i++) { + for (int i = winfo->start_table_from; i <= winfo->end_table_to; i++) { for (int j = 0; j < g_queryInfo.subQueryInfo.sqlCount; j++) { memset(sqlstr,0,sizeof(sqlstr)); replaceSubTblName(g_queryInfo.subQueryInfo.sql[j], sqlstr, i); @@ -5042,8 +5400,8 @@ static void *subQueryProcess(void *sarg) { et = taosGetTimestampUs(); printf("####thread[%"PRId64"] complete all sqls to allocate all sub-tables[%d - %d] once queries duration:%.4fs\n\n", taosGetSelfPthreadId(), - winfo->start_table_id, - winfo->end_table_id, + winfo->start_table_from, + winfo->end_table_to, (double)(et - st)/1000000.0); } return NULL; @@ -5081,7 +5439,8 @@ static int queryTestProcess() { pthread_t *pids = NULL; threadInfo *infos = NULL; //==== create sub threads for query from specify table - if (g_queryInfo.superQueryInfo.sqlCount > 0 && g_queryInfo.superQueryInfo.concurrent > 0) { + if (g_queryInfo.superQueryInfo.sqlCount > 0 + && g_queryInfo.superQueryInfo.concurrent > 0) { pids = malloc(g_queryInfo.superQueryInfo.concurrent * sizeof(pthread_t)); infos = malloc(g_queryInfo.superQueryInfo.concurrent * sizeof(threadInfo)); @@ -5139,14 +5498,15 @@ static int queryTestProcess() { b = ntables % threads; } - int last = 0; + int startFrom = 0; for (int i = 0; i < threads; i++) { threadInfo *t_info = infosOfSub + i; t_info->threadID = i; - t_info->start_table_id = last; - t_info->end_table_id = i < b ? last + a : last + a - 1; - last = t_info->end_table_id + 1; + t_info->start_table_from = startFrom; + t_info->ntables = iend_table_to = i < b ? startFrom + a : startFrom + a - 1; + startFrom = t_info->end_table_to + 1; t_info->taos = taos; pthread_create(pidsOfSub + i, NULL, subQueryProcess, t_info); } @@ -5222,7 +5582,7 @@ void *subSubscribeProcess(void *sarg) { do { //if (g_queryInfo.superQueryInfo.rate && (et - st) < g_queryInfo.superQueryInfo.rate*1000) { // taosMsleep(g_queryInfo.superQueryInfo.rate*1000 - (et - st)); // ms - // //printf("========sleep duration:%"PRId64 "========inserted rows:%d, table range:%d - %d\n", (1000 - (et - st)), i, winfo->start_table_id, winfo->end_table_id); + // //printf("========sleep duration:%"PRId64 "========inserted rows:%d, table range:%d - %d\n", (1000 - (et - st)), i, winfo->start_table_from, winfo->end_table_to); //} //st = taosGetTimestampMs(); @@ -5288,7 +5648,7 @@ void *superSubscribeProcess(void *sarg) { do { //if (g_queryInfo.superQueryInfo.rate && (et - st) < g_queryInfo.superQueryInfo.rate*1000) { // taosMsleep(g_queryInfo.superQueryInfo.rate*1000 - (et - st)); // ms - // //printf("========sleep duration:%"PRId64 "========inserted rows:%d, table range:%d - %d\n", (1000 - (et - st)), i, winfo->start_table_id, winfo->end_table_id); + // //printf("========sleep duration:%"PRId64 "========inserted rows:%d, table range:%d - %d\n", (1000 - (et - st)), i, winfo->start_table_from, winfo->end_table_to); //} //st = taosGetTimestampMs(); @@ -5417,13 +5777,15 @@ static int subscribeTestProcess() { b = ntables % threads; } - int last = 0; + int startFrom = 0; for (int i = 0; i < threads; i++) { threadInfo *t_info = infosOfSub + i; t_info->threadID = i; - t_info->start_table_id = last; - t_info->end_table_id = i < b ? last + a : last + a - 1; + t_info->start_table_from = startFrom; + t_info->ntables = iend_table_to = i < b ? startFrom + a : startFrom + a - 1; + startFrom = t_info->end_table_to + 1; t_info->taos = taos; pthread_create(pidsOfSub + i, NULL, subSubscribeProcess, t_info); } @@ -5665,14 +6027,14 @@ void querySqlFile(TAOS* taos, char* sqlFile) } static void testMetaFile() { - if (INSERT_MODE == g_args.test_mode) { + if (INSERT_TEST == g_args.test_mode) { if (g_Dbs.cfgDir[0]) taos_options(TSDB_OPTION_CONFIGDIR, g_Dbs.cfgDir); insertTestProcess(); - } else if (QUERY_MODE == g_args.test_mode) { + } else if (QUERY_TEST == g_args.test_mode) { if (g_queryInfo.cfgDir[0]) taos_options(TSDB_OPTION_CONFIGDIR, g_queryInfo.cfgDir); queryTestProcess(); - } else if (SUBSCRIBE_MODE == g_args.test_mode) { + } else if (SUBSCRIBE_TEST == g_args.test_mode) { if (g_queryInfo.cfgDir[0]) taos_options(TSDB_OPTION_CONFIGDIR, g_queryInfo.cfgDir); subscribeTestProcess(); @@ -5689,16 +6051,18 @@ static void queryResult() { pthread_t read_id; threadInfo *rInfo = malloc(sizeof(threadInfo)); rInfo->start_time = 1500000000000; // 2017-07-14 10:40:00.000 - rInfo->start_table_id = 0; + rInfo->start_table_from = 0; //rInfo->do_aggreFunc = g_Dbs.do_aggreFunc; if (g_args.use_metric) { - rInfo->end_table_id = g_Dbs.db[0].superTbls[0].childTblCount - 1; + rInfo->ntables = g_Dbs.db[0].superTbls[0].childTblCount; + rInfo->end_table_to = g_Dbs.db[0].superTbls[0].childTblCount - 1; rInfo->superTblInfo = &g_Dbs.db[0].superTbls[0]; strcpy(rInfo->tb_prefix, g_Dbs.db[0].superTbls[0].childTblPrefix); } else { - rInfo->end_table_id = g_args.num_of_tables -1; + rInfo->ntables = g_args.num_of_tables; + rInfo->end_table_to = g_args.num_of_tables -1; strcpy(rInfo->tb_prefix, g_args.tb_prefix); } @@ -5729,7 +6093,7 @@ static void queryResult() { static void testCmdLine() { - g_args.test_mode = INSERT_MODE; + g_args.test_mode = INSERT_TEST; insertTestProcess(); if (g_Dbs.insert_only) diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index 409d684d01..46a1abf12c 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -231,12 +231,13 @@ python3 test.py -f query/queryInterval.py python3 test.py -f query/queryFillTest.py # tools -python3 test.py -f tools/lowaTest.py python3 test.py -f tools/taosdemoTest.py python3 test.py -f tools/taosdemoTestWithoutMetric.py +python3 test.py -f tools/taosdemoTestWithJson.py python3 test.py -f tools/taosdemoTestLimitOffset.py python3 test.py -f tools/taosdumpTest.py python3 test.py -f tools/taosdemoTest2.py +python3 test.py -f tools/taosdemoTestSampleData.py # subscribe python3 test.py -f subscribe/singlemeter.py @@ -291,6 +292,5 @@ python3 ./test.py -f insert/boundary2.py python3 ./test.py -f alter/alter_debugFlag.py python3 ./test.py -f query/queryBetweenAnd.py python3 ./test.py -f tag_lite/alter_tag.py -python3 test.py -f tools/taosdemoTestSampleData.py -#======================p4-end=============== \ No newline at end of file +#======================p4-end=============== diff --git a/tests/pytest/tools/insert-interlace.json b/tests/pytest/tools/insert-interlace.json new file mode 100644 index 0000000000..a2ff2c001c --- /dev/null +++ b/tests/pytest/tools/insert-interlace.json @@ -0,0 +1,58 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 5000, + "rows_per_tbl": 50, + "num_of_records_per_req": 100, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "childtable_count": 9, + "childtable_prefix": "stb_", + "auto_create_table": "no", + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 250, + "multi_thread_write_one_tbl": "no", + "rows_per_tbl": 80, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "INT", "count":1}] + }] + }] +} diff --git a/tests/pytest/tools/insert-tblimit-tboffset0.json b/tests/pytest/tools/insert-tblimit-tboffset0.json index 302744cab9..7dcb2e0527 100644 --- a/tests/pytest/tools/insert-tblimit-tboffset0.json +++ b/tests/pytest/tools/insert-tblimit-tboffset0.json @@ -44,7 +44,6 @@ "childtable_offset": 0, "multi_thread_write_one_tbl": "no", "number_of_tbl_in_one_sql": 0, - "rows_per_tbl": 100, "max_sql_len": 1024000, "disorder_ratio": 0, "disorder_range": 1000, diff --git a/tests/pytest/tools/insert-tblimit1-tboffset.json b/tests/pytest/tools/insert-tblimit1-tboffset.json new file mode 100644 index 0000000000..a33dc22d5d --- /dev/null +++ b/tests/pytest/tools/insert-tblimit1-tboffset.json @@ -0,0 +1,59 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "num_of_records_per_req": 100, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "childtable_count": 100, + "childtable_prefix": "stb_", + "auto_create_table": "no", + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 1000, + "childtable_limit": 1, + "childtable_offset": 50, + "multi_thread_write_one_tbl": "no", + "number_of_tbl_in_one_sql": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT", "count":1}] + }] + }] +} diff --git a/tests/pytest/tools/insert.json b/tests/pytest/tools/insert.json index c3fa78076b..51e9dcc820 100644 --- a/tests/pytest/tools/insert.json +++ b/tests/pytest/tools/insert.json @@ -1,50 +1,51 @@ { "filetype":"insert", "cfgdir": "/etc/taos", - "host": "127.0.0.1", - "port": 6030, - "user": "root", - "password": "taosdata", - "thread_count": 1, - "databases": [{ - "dbinfo": { - "name": "db01", - "replica": 1, - "days": 10, - "cache": 16, - "blocks": 8, - "precision": "ms", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "databases": [{ + "dbinfo": { + "name": "db01", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", "update": 0, - "maxtablesPerVnode": 1000 - }, - "super_tables": [{ - "name": "stb01", - "childtable_count": 100, - "childtable_prefix": "stb01_", - "auto_create_table": "no", - "data_source": "rand", - "insert_mode": "taosc", - "insert_rate": 0, - "insert_rows": 1000, - "timestamp_step": 1000, - "start_timestamp": "2020-10-01 00:00:00.000", - "sample_format": "csv", - "sample_file": "/home/data/sample.csv", - "tags_file": "", - "columns": [{ - "type": "SMALLINT" - }, { - "type": "BOOL" - }, { - "type": "BINARY", - "len": 6 - }], - "tags": [{ - "type": "INT" - },{ - "type": "BINARY", - "len": 4 - }] - }] - }] + "maxtablesPerVnode": 1000 + }, + "super_tables": [{ + "name": "stb01", + "childtable_count": 100, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "data_source": "rand", + "insert_mode": "taosc", + "insert_rate": 0, + "insert_rows": 1000, + "timestamp_step": 1000, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "/home/data/sample.csv", + "tags_file": "", + "columns": [{ + "type": "SMALLINT" + }, { + "type": "BOOL" + }, { + "type": "BINARY", + "len": 6 + }], + "tags": [{ + "type": "INT" + },{ + "type": "BINARY", + "len": 4 + }] + }] + }] } diff --git a/tests/pytest/tools/taosdemoTestInterlace.py b/tests/pytest/tools/taosdemoTestInterlace.py new file mode 100644 index 0000000000..9ceb8c5cbb --- /dev/null +++ b/tests/pytest/tools/taosdemoTestInterlace.py @@ -0,0 +1,68 @@ +################################################################### +# 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 +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + self.numberOfTables = 10000 + self.numberOfRecords = 100 + + 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 run(self): + tdSql.prepare() + buildPath = self.getBuildPath() + if (buildPath == ""): + tdLog.exit("taosd not found!") + else: + tdLog.info("taosd found in %s" % buildPath) + binPath = buildPath+ "/build/bin/" + os.system("%staosdemo -f tools/insert-interlace.json" % binPath) + + tdSql.execute("use db") + tdSql.query("select count(tbname) from db.stb") + tdSql.checkData(0, 0, 100) + tdSql.query("select count(*) from db.stb") + tdSql.checkData(0, 0, 33000) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tools/taosdemoTestLimitOffset.py b/tests/pytest/tools/taosdemoTestLimitOffset.py index 69a81b166b..bce41e1c75 100644 --- a/tests/pytest/tools/taosdemoTestLimitOffset.py +++ b/tests/pytest/tools/taosdemoTestLimitOffset.py @@ -68,6 +68,15 @@ class TDTestCase: tdSql.query("select count(*) from db.stb") tdSql.checkData(0, 0, 20000) + os.system("%staosdemo -f tools/insert-tblimit1-tboffset.json" % binPath) + + tdSql.execute("reset query cache") + tdSql.execute("use db") + tdSql.query("select count(tbname) from db.stb") + tdSql.checkData(0, 0, 100) + tdSql.query("select count(*) from db.stb") + tdSql.checkData(0, 0, 1000) + def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__) diff --git a/tests/pytest/tools/lowaTest.py b/tests/pytest/tools/taosdemoTestWithJson.py similarity index 100% rename from tests/pytest/tools/lowaTest.py rename to tests/pytest/tools/taosdemoTestWithJson.py From 199e61ec54c1999593fdeab3d9e9ff536692174b Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Thu, 18 Mar 2021 09:41:26 +0800 Subject: [PATCH 23/52] Feature/sangshuduo/td 3317 taosdemo interlace (#5477) * [TD-3316] : add testcase for taosdemo limit and offset. check offset 0. * [TD-3316] : add testcase for taosdemo limit and offset. fix sample file import bug. * [TD-3316] : add test case for limit and offset. fix sample data issue. * [TD-3327] : fix taosdemo segfault when import data from sample data file. * [TD-3317] : make taosdemo support interlace mode. json parameter rows_per_tbl support. * [TD-3317] : support interlace mode. refactor * [TD-3317] : support interlace mode. refactor * [TD-3317] : support interlace mode insertion. refactor. * [TD-3317] : support interlace mode insertion. change json file. * [TD-3317] : support interlace mode insertion. fix multithread create table regression. * [TD-3317] : support interlace mode insertion. working but not perfect. * [TD-3317] : support interlace mode insertion. rename lowaTest with taosdemoTestWithJson * [TD-3317] : support interlace mode insertion. perfect Co-authored-by: Shuduo Sang --- src/kit/taosdemo/insert-interlace.json | 11 +-- src/kit/taosdemo/taosdemo.c | 132 ++++++++++++------------- 2 files changed, 67 insertions(+), 76 deletions(-) diff --git a/src/kit/taosdemo/insert-interlace.json b/src/kit/taosdemo/insert-interlace.json index b05c1ee312..0f54f008fb 100644 --- a/src/kit/taosdemo/insert-interlace.json +++ b/src/kit/taosdemo/insert-interlace.json @@ -9,8 +9,7 @@ "thread_count_create_tbl": 4, "result_file": "./insert_res.txt", "confirm_parameter_prompt": "no", - "insert_interval": 5000, - "rows_per_tbl": 50, + "insert_interval": 1000, "num_of_records_per_req": 100, "max_sql_len": 1024000, "databases": [{ @@ -35,12 +34,12 @@ "super_tables": [{ "name": "stb", "child_table_exists":"no", - "childtable_count": 10, + "childtable_count": 100, "childtable_prefix": "stb_", "auto_create_table": "no", "data_source": "rand", "insert_mode": "taosc", - "insert_rows": 200, + "insert_rows": 1000, "multi_thread_write_one_tbl": "no", "rows_per_tbl": 20, "max_sql_len": 1024000, @@ -51,8 +50,8 @@ "sample_format": "csv", "sample_file": "./sample.csv", "tags_file": "", - "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], - "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT", "count":1}] }] }] } diff --git a/src/kit/taosdemo/taosdemo.c b/src/kit/taosdemo/taosdemo.c index 846eea5062..83195ca15d 100644 --- a/src/kit/taosdemo/taosdemo.c +++ b/src/kit/taosdemo/taosdemo.c @@ -4444,110 +4444,102 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { int64_t startTime = pThreadInfo->start_time; int batchPerTblTimes; - int prevBatchPerTbl, lastBatchPerTbl; + int batchPerTbl; - if (pThreadInfo->ntables == 1) { - batchPerTblTimes = 1; - lastBatchPerTbl = rowsPerTbl; - prevBatchPerTbl = rowsPerTbl; - } else if (rowsPerTbl > 0) { + if ((rowsPerTbl > 0) && (pThreadInfo->ntables > 1)) { batchPerTblTimes = g_args.num_of_RPR / rowsPerTbl; - lastBatchPerTbl = g_args.num_of_RPR % rowsPerTbl; - - if (lastBatchPerTbl > 0) - batchPerTblTimes += 1; - else - lastBatchPerTbl = rowsPerTbl; - prevBatchPerTbl = rowsPerTbl; + batchPerTbl = rowsPerTbl; } else { batchPerTblTimes = 1; - prevBatchPerTbl = g_args.num_of_RPR; - lastBatchPerTbl = g_args.num_of_RPR; + batchPerTbl = g_args.num_of_RPR; } + int generatedRecPerTbl = 0; while(pThreadInfo->totalInsertRows < pThreadInfo->ntables * insertRows) { - if (insert_interval) { + if (insert_interval) { st = taosGetTimestampUs(); - } - // generate data - memset(buffer, 0, superTblInfo?superTblInfo->maxSqlLen:g_args.max_sql_len); + } + // generate data + memset(buffer, 0, superTblInfo?superTblInfo->maxSqlLen:g_args.max_sql_len); - char *pstr = buffer; - int recGenerated = 0; + char *pstr = buffer; + int recGenerated = 0; - for (int i = 0; i < batchPerTblTimes; i ++) { - if (insertMode == INTERLACE_INSERT_MODE) { - if (tableSeq == pThreadInfo->start_table_from + pThreadInfo->ntables) { - // turn to first table - tableSeq = pThreadInfo->start_table_from; - } - } - getTableName(tableName, pThreadInfo, tableSeq); + for (int i = 0; i < batchPerTblTimes; i ++) { + getTableName(tableName, pThreadInfo, tableSeq); - int headLen; - if (i == 0) { + int headLen; + if (i == 0) { headLen = generateSQLHead(tableName, tableSeq, pThreadInfo, superTblInfo, pstr); - } else { + } else { headLen = snprintf(pstr, TSDB_TABLE_NAME_LEN, "%s.%s values", pThreadInfo->db_name, tableName); - } + } - // generate data buffer - verbosePrint("%s() LN%d i=%d buffer:\n%s\n", + // generate data buffer + verbosePrint("%s() LN%d i=%d buffer:\n%s\n", __func__, __LINE__, i, buffer); - pstr += headLen; - int dataLen = 0; + pstr += headLen; + int dataLen = 0; - int batchPerTbl; - if (i == batchPerTblTimes - 1) { - batchPerTbl = lastBatchPerTbl; - } else { - batchPerTbl = prevBatchPerTbl; - } - - verbosePrint("%s() LN%d batchPerTbl = %d\n", - __func__, __LINE__, batchPerTbl); - int numOfRecGenerated = generateDataTail( + printf("%s() LN%d i=%d batchPerTblTimes=%d batchPerTbl = %d\n", + __func__, __LINE__, i, batchPerTblTimes, batchPerTbl); + int numOfRecGenerated = generateDataTail( tableName, tableSeq, pThreadInfo, superTblInfo, batchPerTbl, pstr, insertRows, 0, startTime + pThreadInfo->totalInsertRows * superTblInfo->timeStampStep, &(pThreadInfo->samplePos), &dataLen); - verbosePrint("%s() LN%d numOfRecGenerated= %d\n", + verbosePrint("%s() LN%d numOfRecGenerated= %d\n", __func__, __LINE__, numOfRecGenerated); - pstr += dataLen; - recGenerated += numOfRecGenerated; + pstr += dataLen; + recGenerated += numOfRecGenerated; - tableSeq ++; + tableSeq ++; + if (insertMode == INTERLACE_INSERT_MODE) { + if (tableSeq == pThreadInfo->start_table_from + pThreadInfo->ntables) { + // turn to first table + tableSeq = pThreadInfo->start_table_from; + generatedRecPerTbl += numOfRecGenerated; + } } - verbosePrint("%s() LN%d buffer:\n%s\n", - __func__, __LINE__, buffer); - pThreadInfo->totalInsertRows += recGenerated; - int affectedRows = execInsert(pThreadInfo, buffer, recGenerated); - if (affectedRows < 0) + int remainRows = insertRows - generatedRecPerTbl; + if (batchPerTbl > remainRows) + batchPerTbl = remainRows; + + if ((g_args.num_of_RPR - recGenerated) < batchPerTbl) + break; + } + pThreadInfo->totalInsertRows += recGenerated; + printf("%s() LN%d recGenerated=%d totalInsertRows=%"PRId64" buffer:\n%s\n", + __func__, __LINE__, recGenerated, + pThreadInfo->totalInsertRows, buffer); + + int affectedRows = execInsert(pThreadInfo, buffer, recGenerated); + if (affectedRows < 0) goto free_and_statistics_interlace; - pThreadInfo->totalAffectedRows += affectedRows; + pThreadInfo->totalAffectedRows += affectedRows; - endTs = taosGetTimestampUs(); - int64_t delay = endTs - startTs; - if (delay > pThreadInfo->maxDelay) pThreadInfo->maxDelay = delay; - if (delay < pThreadInfo->minDelay) pThreadInfo->minDelay = delay; - pThreadInfo->cntDelay++; - pThreadInfo->totalDelay += delay; + endTs = taosGetTimestampUs(); + int64_t delay = endTs - startTs; + if (delay > pThreadInfo->maxDelay) pThreadInfo->maxDelay = delay; + if (delay < pThreadInfo->minDelay) pThreadInfo->minDelay = delay; + pThreadInfo->cntDelay++; + pThreadInfo->totalDelay += delay; - int64_t currentPrintTime = taosGetTimestampMs(); - if (currentPrintTime - lastPrintTime > 30*1000) { - printf("thread[%d] has currently inserted rows: %"PRId64 ", affected rows: %"PRId64 "\n", + int64_t currentPrintTime = taosGetTimestampMs(); + if (currentPrintTime - lastPrintTime > 30*1000) { + printf("thread[%d] has currently inserted rows: %"PRId64 ", affected rows: %"PRId64 "\n", pThreadInfo->threadID, pThreadInfo->totalInsertRows, pThreadInfo->totalAffectedRows); - lastPrintTime = currentPrintTime; - } + lastPrintTime = currentPrintTime; + } - if (insert_interval) { + if (insert_interval) { et = taosGetTimestampUs(); if (insert_interval > ((et - st)/1000) ) { @@ -4556,7 +4548,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { __func__, __LINE__, sleep_time); taosMsleep(sleep_time); // ms } - } + } } free_and_statistics_interlace: From 282d1c10f254d391cc4693451bf2f7f926ba375e Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Thu, 18 Mar 2021 11:18:51 +0800 Subject: [PATCH 24/52] [TD-3318]add case for stddev --- tests/pytest/functions/function_stddev.py | 6 +++++- tests/test-all.sh | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/pytest/functions/function_stddev.py b/tests/pytest/functions/function_stddev.py index afc59ac83d..3ff2b82bf6 100644 --- a/tests/pytest/functions/function_stddev.py +++ b/tests/pytest/functions/function_stddev.py @@ -118,7 +118,11 @@ class TDTestCase: if i == 1 or i == 5 or i == 6 or i == 7 or i == 9 or i == 8 :continue tdSql.query('select stddev(c%d),stddev(c%d) from s group by c%d' %( i+1 , i+1 , i+1 ) ) - + #add for TD-3318 + tdSql.execute('create table t1(ts timestamp, k int, b binary(12));') + tdSql.execute("insert into t1 values(now, 1, 'abc');") + tdLog.info("select stddev(k) from t1 where b <> 'abc' interval(1s);") + tdSql.query("select stddev(k) from t1 where b <> 'abc' interval(1s);") def stop(self): diff --git a/tests/test-all.sh b/tests/test-all.sh index b617dd2f07..c8546f591a 100755 --- a/tests/test-all.sh +++ b/tests/test-all.sh @@ -29,7 +29,7 @@ function dohavecore(){ proc=`echo $corefile|cut -d "_" -f3` if [ -n "$corefile" ];then echo 'taosd or taos has generated core' - tar -zcvPf $corepath'taos_'`date "+%Y_%m_%d_%H_%M_%S"`.tar.gz /usr/local/taos/ + tar -zcPf $corepath'taos_'`date "+%Y_%m_%d_%H_%M_%S"`.tar.gz if [[ $1 == 1 ]];then echo '\n'|gdb /usr/local/taos/bin/$proc $core_file -ex "bt 10" -ex quit exit 8 From 53496c7844b0377153d284a6f89e694d82ba71e3 Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Thu, 18 Mar 2021 11:21:56 +0800 Subject: [PATCH 25/52] fix --- tests/test-all.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test-all.sh b/tests/test-all.sh index c8546f591a..dcc2b61f43 100755 --- a/tests/test-all.sh +++ b/tests/test-all.sh @@ -29,7 +29,7 @@ function dohavecore(){ proc=`echo $corefile|cut -d "_" -f3` if [ -n "$corefile" ];then echo 'taosd or taos has generated core' - tar -zcPf $corepath'taos_'`date "+%Y_%m_%d_%H_%M_%S"`.tar.gz + tar -zcPf $corepath'taos_'`date "+%Y_%m_%d_%H_%M_%S"`.tar.gz /usr/local/taos/ if [[ $1 == 1 ]];then echo '\n'|gdb /usr/local/taos/bin/$proc $core_file -ex "bt 10" -ex quit exit 8 From 9f00cd82bbe7190bd734e22e62c05d0bf1531bd1 Mon Sep 17 00:00:00 2001 From: Elias Soong Date: Thu, 18 Mar 2021 14:39:34 +0800 Subject: [PATCH 26/52] [TD-3352] : move "quick run" section into "install" part. --- README.md | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 6ad9d4a97f..97ac9dffeb 100644 --- a/README.md +++ b/README.md @@ -160,24 +160,13 @@ mkdir debug && cd debug cmake .. && cmake --build . ``` -# Quick Run - -# Quick Run -To quickly start a TDengine server after building, run the command below in terminal: -```bash -./build/bin/taosd -c test/cfg -``` -In another terminal, use the TDengine shell to connect the server: -```bash -./build/bin/taos -c test/cfg -``` -option "-c test/cfg" specifies the system configuration file directory. - # Installing + After building successfully, TDengine can be installed by: ```bash sudo make install ``` + Users can find more information about directories installed on the system in the [directory and files](https://www.taosdata.com/en/documentation/administrator/#Directory-and-Files) section. Since version 2.0, installing from source code will also configure service management for TDengine. Users can also choose to [install from packages](https://www.taosdata.com/en/getting-started/#Install-from-Package) for it. @@ -193,6 +182,20 @@ taos If TDengine shell connects the server successfully, welcome messages and version info are printed. Otherwise, an error message is shown. +## Quick Run + +If you don't want to run TDengine as a service, you can run it in current shell. For example, to quickly start a TDengine server after building, run the command below in terminal: +```bash +./build/bin/taosd -c test/cfg +``` + +In another terminal, use the TDengine shell to connect the server: +```bash +./build/bin/taos -c test/cfg +``` + +option "-c test/cfg" specifies the system configuration file directory. + # Try TDengine It is easy to run SQL commands from TDengine shell which is the same as other SQL databases. ```sql From 2d8c6952398900567c5d2e8b8ad6b91f58741f0b Mon Sep 17 00:00:00 2001 From: Elias Soong Date: Thu, 18 Mar 2021 14:47:39 +0800 Subject: [PATCH 27/52] [TD-3363] : fix typo. --- documentation20/cn/13.faq/docs.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/documentation20/cn/13.faq/docs.md b/documentation20/cn/13.faq/docs.md index d3169d507a..e2285b29e2 100644 --- a/documentation20/cn/13.faq/docs.md +++ b/documentation20/cn/13.faq/docs.md @@ -16,13 +16,13 @@ ## 1. TDengine2.0之前的版本升级到2.0及以上的版本应该注意什么?☆☆☆ -2.0版本在之前版本的基础上,进行了完全的重构,配置文件和数据文件是不兼容的。在升级之前务必进行如下操作: +2.0版在之前版本的基础上,进行了完全的重构,配置文件和数据文件是不兼容的。在升级之前务必进行如下操作: -1. 删除配置文件,执行 sudo rm -rf /etc/taos/taos.cfg -2. 删除日志文件,执行 sudo rm -rf /var/log/taos/ -3. 确保数据已经不再需要的前提下,删除数据文件,执行 sudo rm -rf /var/lib/taos/ -4. 安装最新稳定版本的TDengine -5. 如果数据需要迁移数据或者数据文件损坏,请联系涛思数据官方技术支持团队,进行协助解决 +1. 删除配置文件,执行 `sudo rm -rf /etc/taos/taos.cfg` +2. 删除日志文件,执行 `sudo rm -rf /var/log/taos/` +3. 确保数据已经不再需要的前提下,删除数据文件,执行 `sudo rm -rf /var/lib/taos/` +4. 安装最新稳定版本的 TDengine +5. 如果需要迁移数据或者数据文件损坏,请联系涛思数据官方技术支持团队,进行协助解决 ## 2. Windows平台下JDBCDriver找不到动态链接库,怎么办? From 7447a8c562854d16a9fdb943b965e2f281b44bb9 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 18 Mar 2021 15:24:36 +0800 Subject: [PATCH 28/52] [td-3361]: nchar tag filter caused client crash. --- src/client/src/tscSQLParser.c | 14 +++++++++++--- tests/script/general/parser/topbot.sim | 9 +++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 8b2998c0e7..3b65d0625f 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -4138,13 +4138,21 @@ static int32_t validateTagCondExpr(SSqlCmd* pCmd, tExprNode *p) { } int32_t retVal = TSDB_CODE_SUCCESS; + + int32_t bufLen = 0; + if (IS_NUMERIC_TYPE(vVariant->nType)) { + bufLen = 60; // The maximum length of string that a number is converted to. + } else { + bufLen = vVariant->nLen + 1; + } + if (schemaType == TSDB_DATA_TYPE_BINARY) { - char *tmp = calloc(1, vVariant->nLen + TSDB_NCHAR_SIZE); + char *tmp = calloc(1, bufLen * TSDB_NCHAR_SIZE); retVal = tVariantDump(vVariant, tmp, schemaType, false); free(tmp); } else if (schemaType == TSDB_DATA_TYPE_NCHAR) { // pRight->value.nLen + 1 is larger than the actual nchar string length - char *tmp = calloc(1, (vVariant->nLen + 1) * TSDB_NCHAR_SIZE); + char *tmp = calloc(1, bufLen * TSDB_NCHAR_SIZE); retVal = tVariantDump(vVariant, tmp, schemaType, false); free(tmp); } else { @@ -4155,7 +4163,7 @@ static int32_t validateTagCondExpr(SSqlCmd* pCmd, tExprNode *p) { if (retVal != TSDB_CODE_SUCCESS) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); } - }while (0); + } while (0); return TSDB_CODE_SUCCESS; } diff --git a/tests/script/general/parser/topbot.sim b/tests/script/general/parser/topbot.sim index 80a122238e..e23bbf6724 100644 --- a/tests/script/general/parser/topbot.sim +++ b/tests/script/general/parser/topbot.sim @@ -316,4 +316,13 @@ if $data13 != @20-02-02 01:01:01.000@ then return -1 endi +print ===============================>td-3361 +sql create table ttm1(ts timestamp, k int) tags(a nchar(12)); +sql create table ttm1_t1 using ttm1 tags('abcdef') +sql insert into ttm1_t1 values(now, 1) +sql select * from ttm1 where a=123456789012 +if $row != 0 then + return -1 +endi + system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file From e4e46768a64c3be441a31f64d983c8b07289e47f Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 18 Mar 2021 15:50:55 +0800 Subject: [PATCH 29/52] [TD-3353]: solve race condition coredump --- src/inc/tsdb.h | 30 ++++++++++-- src/query/src/qExecutor.c | 2 +- src/tsdb/inc/tsdbMemTable.h | 23 ++-------- src/tsdb/src/tsdbMemTable.c | 92 +++++++++++++++++-------------------- src/tsdb/src/tsdbRead.c | 18 ++++---- 5 files changed, 82 insertions(+), 83 deletions(-) diff --git a/src/inc/tsdb.h b/src/inc/tsdb.h index 09444bb8e4..493bdbe5de 100644 --- a/src/inc/tsdb.h +++ b/src/inc/tsdb.h @@ -25,6 +25,8 @@ #include "tdataformat.h" #include "tname.h" #include "hash.h" +#include "tlockfree.h" +#include "tlist.h" #ifdef __cplusplus extern "C" { @@ -172,10 +174,32 @@ typedef struct STsdbQueryCond { int32_t type; // data block load type: } STsdbQueryCond; +typedef struct STableData STableData; +typedef struct { + T_REF_DECLARE() + SRWLatch latch; + TSKEY keyFirst; + TSKEY keyLast; + int64_t numOfRows; + int32_t maxTables; + STableData **tData; + SList * actList; + SList * extraBuffList; + SList * bufBlockList; + int64_t pointsAdd; // TODO + int64_t storageAdd; // TODO +} SMemTable; + +typedef struct { + SMemTable* mem; + SMemTable* imem; + SMemTable mtable; + SMemTable* omem; +} SMemSnapshot; + typedef struct SMemRef { - int32_t ref; - void * mem; - void * imem; + int32_t ref; + SMemSnapshot snapshot; } SMemRef; typedef struct SDataBlockInfo { diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 54bc72b307..59e04c9cac 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -1840,7 +1840,7 @@ static void doFreeQueryHandle(SQueryRuntimeEnv* pRuntimeEnv) { pRuntimeEnv->pQueryHandle = NULL; SMemRef* pMemRef = &pQuery->memRef; - assert(pMemRef->ref == 0 && pMemRef->imem == NULL && pMemRef->mem == NULL); + assert(pMemRef->ref == 0 && pMemRef->snapshot.imem == NULL && pMemRef->snapshot.mem == NULL); } static void teardownQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv) { diff --git a/src/tsdb/inc/tsdbMemTable.h b/src/tsdb/inc/tsdbMemTable.h index bd64ed4a52..6046274af4 100644 --- a/src/tsdb/inc/tsdbMemTable.h +++ b/src/tsdb/inc/tsdbMemTable.h @@ -31,29 +31,14 @@ typedef struct { SSkipListIterator *pIter; } SCommitIter; -typedef struct { +struct STableData { uint64_t uid; TSKEY keyFirst; TSKEY keyLast; int64_t numOfRows; SSkipList* pData; T_REF_DECLARE() -} STableData; - -typedef struct { - T_REF_DECLARE() - SRWLatch latch; - TSKEY keyFirst; - TSKEY keyLast; - int64_t numOfRows; - int32_t maxTables; - STableData** tData; - SList* actList; - SList* extraBuffList; - SList* bufBlockList; - int64_t pointsAdd; // TODO - int64_t storageAdd; // TODO -} SMemTable; +}; enum { TSDB_UPDATE_META, TSDB_DROP_META }; @@ -77,8 +62,8 @@ typedef struct { int tsdbRefMemTable(STsdbRepo* pRepo, SMemTable* pMemTable); int tsdbUnRefMemTable(STsdbRepo* pRepo, SMemTable* pMemTable); -int tsdbTakeMemSnapshot(STsdbRepo* pRepo, SMemTable** pMem, SMemTable** pIMem, SArray* pATable); -void tsdbUnTakeMemSnapShot(STsdbRepo* pRepo, SMemTable* pMem, SMemTable* pIMem); +int tsdbTakeMemSnapshot(STsdbRepo* pRepo, SMemSnapshot* pSnapshot, SArray* pATable); +void tsdbUnTakeMemSnapShot(STsdbRepo* pRepo, SMemSnapshot* pSnapshot); void* tsdbAllocBytes(STsdbRepo* pRepo, int bytes); int tsdbAsyncCommit(STsdbRepo* pRepo); int tsdbLoadDataFromCache(STable* pTable, SSkipListIterator* pIter, TSKEY maxKey, int maxRowsToRead, SDataCols* pCols, diff --git a/src/tsdb/src/tsdbMemTable.c b/src/tsdb/src/tsdbMemTable.c index 6818f2ed14..20ec426018 100644 --- a/src/tsdb/src/tsdbMemTable.c +++ b/src/tsdb/src/tsdbMemTable.c @@ -124,88 +124,80 @@ int tsdbUnRefMemTable(STsdbRepo *pRepo, SMemTable *pMemTable) { return 0; } -int tsdbTakeMemSnapshot(STsdbRepo *pRepo, SMemTable **pMem, SMemTable **pIMem, SArray *pATable) { - SMemTable *tmem; +int tsdbTakeMemSnapshot(STsdbRepo *pRepo, SMemSnapshot *pSnapshot, SArray *pATable) { + memset(pSnapshot, 0, sizeof(*pSnapshot)); - // Get snap object if (tsdbLockRepo(pRepo) < 0) return -1; - tmem = pRepo->mem; - *pIMem = pRepo->imem; - tsdbRefMemTable(pRepo, tmem); - tsdbRefMemTable(pRepo, *pIMem); + pSnapshot->omem = pRepo->mem; + pSnapshot->imem = pRepo->imem; + tsdbRefMemTable(pRepo, pRepo->mem); + tsdbRefMemTable(pRepo, pRepo->imem); if (tsdbUnlockRepo(pRepo) < 0) return -1; - // Copy mem objects and ref needed STableData - if (tmem) { - taosRLockLatch(&(tmem->latch)); + if (pSnapshot->omem) { + taosRLockLatch(&(pSnapshot->omem->latch)); - *pMem = (SMemTable *)calloc(1, sizeof(**pMem)); - if (*pMem == NULL) { + pSnapshot->mem = &(pSnapshot->mtable); + + pSnapshot->mem->tData = (STableData **)calloc(pSnapshot->omem->maxTables, sizeof(STableData *)); + if (pSnapshot->mem->tData == NULL) { terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; - taosRUnLockLatch(&(tmem->latch)); - tsdbUnRefMemTable(pRepo, tmem); - tsdbUnRefMemTable(pRepo, *pIMem); - *pMem = NULL; - *pIMem = NULL; + taosRUnLockLatch(&(pSnapshot->omem->latch)); + tsdbUnRefMemTable(pRepo, pSnapshot->omem); + tsdbUnRefMemTable(pRepo, pSnapshot->imem); + pSnapshot->mem = NULL; + pSnapshot->imem = NULL; + pSnapshot->omem = NULL; return -1; } - (*pMem)->tData = (STableData **)calloc(tmem->maxTables, sizeof(STableData *)); - if ((*pMem)->tData == NULL) { - terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; - taosRUnLockLatch(&(tmem->latch)); - free(*pMem); - tsdbUnRefMemTable(pRepo, tmem); - tsdbUnRefMemTable(pRepo, *pIMem); - *pMem = NULL; - *pIMem = NULL; - return -1; - } - - (*pMem)->keyFirst = tmem->keyFirst; - (*pMem)->keyLast = tmem->keyLast; - (*pMem)->numOfRows = tmem->numOfRows; - (*pMem)->maxTables = tmem->maxTables; + pSnapshot->mem->keyFirst = pSnapshot->omem->keyFirst; + pSnapshot->mem->keyLast = pSnapshot->omem->keyLast; + pSnapshot->mem->numOfRows = pSnapshot->omem->numOfRows; + pSnapshot->mem->maxTables = pSnapshot->omem->maxTables; for (size_t i = 0; i < taosArrayGetSize(pATable); i++) { STable * pTable = *(STable **)taosArrayGet(pATable, i); int32_t tid = TABLE_TID(pTable); - STableData *pTableData = (tid < tmem->maxTables) ? tmem->tData[tid] : NULL; + STableData *pTableData = (tid < pSnapshot->omem->maxTables) ? pSnapshot->omem->tData[tid] : NULL; if ((pTableData == NULL) || (TABLE_UID(pTable) != pTableData->uid)) continue; - (*pMem)->tData[tid] = tmem->tData[tid]; - T_REF_INC(tmem->tData[tid]); + pSnapshot->mem->tData[tid] = pTableData; + T_REF_INC(pTableData); } - taosRUnLockLatch(&(tmem->latch)); + taosRUnLockLatch(&(pSnapshot->omem->latch)); } - tsdbUnRefMemTable(pRepo, tmem); - - tsdbDebug("vgId:%d take memory snapshot, pMem %p pIMem %p", REPO_ID(pRepo), *pMem, *pIMem); + tsdbDebug("vgId:%d take memory snapshot, pMem %p pIMem %p", REPO_ID(pRepo), pSnapshot->omem, pSnapshot->imem); return 0; } -void tsdbUnTakeMemSnapShot(STsdbRepo *pRepo, SMemTable *pMem, SMemTable *pIMem) { - tsdbDebug("vgId:%d untake memory snapshot, pMem %p pIMem %p", REPO_ID(pRepo), pMem, pIMem); +void tsdbUnTakeMemSnapShot(STsdbRepo *pRepo, SMemSnapshot *pSnapshot) { + tsdbDebug("vgId:%d untake memory snapshot, pMem %p pIMem %p", REPO_ID(pRepo), pSnapshot->omem, pSnapshot->imem); - if (pMem != NULL) { - for (size_t i = 0; i < pMem->maxTables; i++) { - STableData *pTableData = pMem->tData[i]; + if (pSnapshot->mem) { + ASSERT(pSnapshot->omem != NULL); + + for (size_t i = 0; i < pSnapshot->mem->maxTables; i++) { + STableData *pTableData = pSnapshot->mem->tData[i]; if (pTableData) { tsdbFreeTableData(pTableData); } } - free(pMem->tData); - free(pMem); + tfree(pSnapshot->mem->tData); + + tsdbUnRefMemTable(pRepo, pSnapshot->omem); } - if (pIMem != NULL) { - tsdbUnRefMemTable(pRepo, pIMem); - } + tsdbUnRefMemTable(pRepo, pSnapshot->imem); + + pSnapshot->mem = NULL; + pSnapshot->imem = NULL; + pSnapshot->omem = NULL; } void *tsdbAllocBytes(STsdbRepo *pRepo, int bytes) { diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index 7b7c244ba8..3426fe86c2 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -194,7 +194,7 @@ static void tsdbMayTakeMemSnapshot(STsdbQueryHandle* pQueryHandle, SArray* psTab SMemRef* pMemRef = pQueryHandle->pMemRef; if (pQueryHandle->pMemRef->ref++ == 0) { - tsdbTakeMemSnapshot(pQueryHandle->pTsdb, (SMemTable**)&(pMemRef->mem), (SMemTable**)&(pMemRef->imem), psTable); + tsdbTakeMemSnapshot(pQueryHandle->pTsdb, &(pMemRef->snapshot), psTable); } taosArrayDestroy(psTable); @@ -208,9 +208,7 @@ static void tsdbMayUnTakeMemSnapshot(STsdbQueryHandle* pQueryHandle) { } if (--pMemRef->ref == 0) { - tsdbUnTakeMemSnapShot(pQueryHandle->pTsdb, pMemRef->mem, pMemRef->imem); - pMemRef->mem = NULL; - pMemRef->imem = NULL; + tsdbUnTakeMemSnapShot(pQueryHandle->pTsdb, &(pMemRef->snapshot)); } pQueryHandle->pMemRef = NULL; @@ -229,10 +227,10 @@ int64_t tsdbGetNumOfRowsInMemTable(TsdbQueryHandleT* pHandle) { if (pMemRef == NULL) { return rows; } STableData* pMem = NULL; - STableData* pIMem = NULL; + STableData* pIMem = NULL; - SMemTable *pMemT = (SMemTable *)(pMemRef->mem); - SMemTable *pIMemT = (SMemTable *)(pMemRef->imem); + SMemTable* pMemT = pMemRef->snapshot.mem; + SMemTable* pIMemT = pMemRef->snapshot.imem; if (pMemT && pCheckInfo->tableId.tid < pMemT->maxTables) { pMem = pMemT->tData[pCheckInfo->tableId.tid]; @@ -605,7 +603,7 @@ static bool initTableMemIterator(STsdbQueryHandle* pHandle, STableCheckInfo* pCh int32_t order = pHandle->order; // no data in buffer, abort - if (pHandle->pMemRef->mem == NULL && pHandle->pMemRef->imem == NULL) { + if (pHandle->pMemRef->snapshot.mem == NULL && pHandle->pMemRef->snapshot.imem == NULL) { return false; } @@ -614,8 +612,8 @@ static bool initTableMemIterator(STsdbQueryHandle* pHandle, STableCheckInfo* pCh STableData* pMem = NULL; STableData* pIMem = NULL; - SMemTable* pMemT = pHandle->pMemRef->mem; - SMemTable* pIMemT = pHandle->pMemRef->imem; + SMemTable* pMemT = pHandle->pMemRef->snapshot.mem; + SMemTable* pIMemT = pHandle->pMemRef->snapshot.imem; if (pMemT && pCheckInfo->tableId.tid < pMemT->maxTables) { pMem = pMemT->tData[pCheckInfo->tableId.tid]; From 1f61557cbd79981ff66fab05bd4c967defe919b5 Mon Sep 17 00:00:00 2001 From: Elias Soong Date: Thu, 18 Mar 2021 15:56:26 +0800 Subject: [PATCH 30/52] [TD-2639] : improve expression of some sentences. --- documentation20/cn/03.architecture/docs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation20/cn/03.architecture/docs.md b/documentation20/cn/03.architecture/docs.md index 26d8bc55c2..87553fa8ad 100644 --- a/documentation20/cn/03.architecture/docs.md +++ b/documentation20/cn/03.architecture/docs.md @@ -145,7 +145,7 @@ TDengine 建议用数据采集点的名字(如上表中的D1001)来做表名。 在TDengine的设计里,**表用来代表一个具体的数据采集点,超级表用来代表一组相同类型的数据采集点集合**。当为某个具体数据采集点创建表时,用户使用超级表的定义做模板,同时指定该具体采集点(表)的标签值。与传统的关系型数据库相比,表(一个数据采集点)是带有静态标签的,而且这些标签可以事后增加、删除、修改。**一张超级表包含有多张表,这些表具有相同的时序数据schema,但带有不同的标签值**。 -当对多个具有相同数据类型的数据采集点进行聚合操作时,TDengine将先把满足标签过滤条件的表从超级表的中查找出来,然后再扫描这些表的时序数据,进行聚合操作,这样能将需要扫描的数据集大幅减少,从而大幅提高聚合计算的性能。 +当对多个具有相同数据类型的数据采集点进行聚合操作时,TDengine会先把满足标签过滤条件的表从超级表中找出来,然后再扫描这些表的时序数据,进行聚合操作,这样需要扫描的数据集会大幅减少,从而显著提高聚合计算的性能。 ## 集群与基本逻辑单元 From fdc0febbe6e9cf8d41f50fcaae51ba8ff48d1120 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 18 Mar 2021 16:00:55 +0800 Subject: [PATCH 31/52] [TD-3355]: Fix invalid table id problem caused by idpool --- src/mnode/inc/mnodeVgroup.h | 2 +- src/mnode/src/mnodeSdb.c | 2 +- src/mnode/src/mnodeTable.c | 36 ++++++++++++++++++++++++++++++------ src/mnode/src/mnodeVgroup.c | 27 ++++++++++++++++++++------- src/util/inc/tidpool.h | 2 +- src/util/src/tidpool.c | 24 ++++++++++++++++++++---- 6 files changed, 73 insertions(+), 20 deletions(-) diff --git a/src/mnode/inc/mnodeVgroup.h b/src/mnode/inc/mnodeVgroup.h index 2067ad04cc..02dc42a1f8 100644 --- a/src/mnode/inc/mnodeVgroup.h +++ b/src/mnode/inc/mnodeVgroup.h @@ -44,7 +44,7 @@ void mnodeDropVgroup(SVgObj *pVgroup, void *ahandle); void mnodeAlterVgroup(SVgObj *pVgroup, void *ahandle); int32_t mnodeGetAvailableVgroup(struct SMnodeMsg *pMsg, SVgObj **pVgroup, int32_t *sid); -void mnodeAddTableIntoVgroup(SVgObj *pVgroup, SCTableObj *pTable); +int32_t mnodeAddTableIntoVgroup(SVgObj *pVgroup, SCTableObj *pTable); void mnodeRemoveTableFromVgroup(SVgObj *pVgroup, SCTableObj *pTable); void mnodeSendDropVnodeMsg(int32_t vgId, SRpcEpSet *epSet, void *ahandle); void mnodeSendCreateVgroupMsg(SVgObj *pVgroup, void *ahandle); diff --git a/src/mnode/src/mnodeSdb.c b/src/mnode/src/mnodeSdb.c index 319b16e62a..7810c9f91e 100644 --- a/src/mnode/src/mnodeSdb.c +++ b/src/mnode/src/mnodeSdb.c @@ -552,7 +552,7 @@ static int32_t sdbInsertHash(SSdbTable *pTable, SSdbRow *pRow) { int32_t code = (*pTable->fpInsert)(pRow); if (code != TSDB_CODE_SUCCESS) { - sdbError("vgId:1, sdb:%s, failed to insert key:%s to hash, remove it", pTable->name, + sdbError("vgId:1, sdb:%s, failed to perform insert action for key:%s, remove it", pTable->name, sdbGetRowStr(pTable, pRow->pObj)); sdbDeleteHash(pTable, pRow); } diff --git a/src/mnode/src/mnodeTable.c b/src/mnode/src/mnodeTable.c index 1378847d0b..65b0408a8f 100644 --- a/src/mnode/src/mnodeTable.c +++ b/src/mnode/src/mnodeTable.c @@ -108,10 +108,12 @@ static int32_t mnodeChildTableActionDestroy(SSdbRow *pRow) { static int32_t mnodeChildTableActionInsert(SSdbRow *pRow) { SCTableObj *pTable = pRow->pObj; + int32_t code = 0; SVgObj *pVgroup = mnodeGetVgroup(pTable->vgId); if (pVgroup == NULL) { mError("ctable:%s, not in vgId:%d", pTable->info.tableId, pTable->vgId); + code = -1; } SDbObj *pDb = NULL; @@ -119,6 +121,7 @@ static int32_t mnodeChildTableActionInsert(SSdbRow *pRow) { pDb = mnodeGetDb(pVgroup->dbName); if (pDb == NULL) { mError("ctable:%s, vgId:%d not in db:%s", pTable->info.tableId, pVgroup->vgId, pVgroup->dbName); + code = -1; } } @@ -127,6 +130,7 @@ static int32_t mnodeChildTableActionInsert(SSdbRow *pRow) { pAcct = mnodeGetAcct(pDb->acct); if (pAcct == NULL) { mError("ctable:%s, acct:%s not exists", pTable->info.tableId, pDb->acct); + code = -1; } } @@ -139,6 +143,7 @@ static int32_t mnodeChildTableActionInsert(SSdbRow *pRow) { if (pAcct) pAcct->acctInfo.numOfTimeSeries += (pTable->superTable->numOfColumns - 1); } else { mError("table:%s:%p, correspond stable not found suid:%" PRIu64, pTable->info.tableId, pTable, pTable->suid); + code = -1; } } else { grantAdd(TSDB_GRANT_TIMESERIES, pTable->numOfColumns - 1); @@ -146,18 +151,31 @@ static int32_t mnodeChildTableActionInsert(SSdbRow *pRow) { } if (pDb) mnodeAddTableIntoDb(pDb); - if (pVgroup) mnodeAddTableIntoVgroup(pVgroup, pTable); + if (pVgroup) { + if (mnodeAddTableIntoVgroup(pVgroup, pTable) != 0) { + mError("table:%s, vgId:%d tid:%d, failed to perform insert action, uid:%" PRIu64 " suid:%" PRIu64, + pTable->info.tableId, pTable->vgId, pTable->tid, pTable->uid, pTable->suid); + code = -1; + } + } mnodeDecVgroupRef(pVgroup); mnodeDecDbRef(pDb); mnodeDecAcctRef(pAcct); - return TSDB_CODE_SUCCESS; + if (code == 0) { + mTrace("table:%s, vgId:%d tid:%d, perform insert action, uid:%" PRIu64 " suid:%" PRIu64, pTable->info.tableId, + pTable->vgId, pTable->tid, pTable->uid, pTable->suid); + } + + return code; } static int32_t mnodeChildTableActionDelete(SSdbRow *pRow) { SCTableObj *pTable = pRow->pObj; if (pTable->vgId == 0) { + mError("table:%s, vgId:%d tid:%d, failed to perform delete action, uid:%" PRIu64 " suid:%" PRIu64, + pTable->info.tableId, pTable->vgId, pTable->tid, pTable->uid, pTable->suid); return TSDB_CODE_MND_VGROUP_NOT_EXIST; } @@ -188,6 +206,8 @@ static int32_t mnodeChildTableActionDelete(SSdbRow *pRow) { mnodeDecDbRef(pDb); mnodeDecAcctRef(pAcct); + mTrace("table:%s, vgId:%d tid:%d, perform delete action, uid:%" PRIu64 " suid:%" PRIu64, pTable->info.tableId, + pTable->vgId, pTable->tid, pTable->uid, pTable->suid); return TSDB_CODE_SUCCESS; } @@ -399,13 +419,13 @@ static void mnodeAddTableIntoStable(SSTableObj *pStable, SCTableObj *pCtable) { if (pStable->vgHash == NULL) { pStable->vgHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_ENTRY_LOCK); - mDebug("table:%s, create hash:%p", pStable->info.tableId, pStable->vgHash); + mDebug("stable:%s, create vgId hash:%p", pStable->info.tableId, pStable->vgHash); } if (pStable->vgHash != NULL) { if (taosHashGet(pStable->vgHash, &pCtable->vgId, sizeof(pCtable->vgId)) == NULL) { taosHashPut(pStable->vgHash, &pCtable->vgId, sizeof(pCtable->vgId), &pCtable->vgId, sizeof(pCtable->vgId)); - mDebug("table:%s, vgId:%d is put into stable hash:%p, sizeOfVgList:%d", pStable->info.tableId, pCtable->vgId, + mDebug("stable:%s, vgId:%d is put into stable vgId hash:%p, sizeOfVgList:%d", pStable->info.tableId, pCtable->vgId, pStable->vgHash, taosHashGetSize(pStable->vgHash)); } } @@ -443,19 +463,21 @@ static int32_t mnodeSuperTableActionDestroy(SSdbRow *pRow) { static int32_t mnodeSuperTableActionInsert(SSdbRow *pRow) { SSTableObj *pStable = pRow->pObj; - SDbObj *pDb = mnodeGetDbByTableName(pStable->info.tableId); + SDbObj * pDb = mnodeGetDbByTableName(pStable->info.tableId); if (pDb != NULL && pDb->status == TSDB_DB_STATUS_READY) { mnodeAddSuperTableIntoDb(pDb); } mnodeDecDbRef(pDb); taosHashPut(tsSTableUidHash, &pStable->uid, sizeof(int64_t), &pStable, sizeof(int64_t)); + + mTrace("stable:%s, perform insert action, uid:%" PRIu64, pStable->info.tableId, pStable->uid); return TSDB_CODE_SUCCESS; } static int32_t mnodeSuperTableActionDelete(SSdbRow *pRow) { SSTableObj *pStable = pRow->pObj; - SDbObj *pDb = mnodeGetDbByTableName(pStable->info.tableId); + SDbObj * pDb = mnodeGetDbByTableName(pStable->info.tableId); if (pDb != NULL) { mnodeRemoveSuperTableFromDb(pDb); mnodeDropAllChildTablesInStable((SSTableObj *)pStable); @@ -463,6 +485,8 @@ static int32_t mnodeSuperTableActionDelete(SSdbRow *pRow) { mnodeDecDbRef(pDb); taosHashRemove(tsSTableUidHash, &pStable->uid, sizeof(int64_t)); + + mTrace("stable:%s, perform delete action, uid:%" PRIu64, pStable->info.tableId, pStable->uid); return TSDB_CODE_SUCCESS; } diff --git a/src/mnode/src/mnodeVgroup.c b/src/mnode/src/mnodeVgroup.c index 008a655597..ef45936eaa 100644 --- a/src/mnode/src/mnodeVgroup.c +++ b/src/mnode/src/mnodeVgroup.c @@ -443,6 +443,7 @@ int32_t mnodeGetAvailableVgroup(SMnodeMsg *pMsg, SVgObj **ppVgroup, int32_t *pSi mDebug("msg:%p, app:%p db:%s, no enough sid in vgId:%d", pMsg, pMsg->rpcMsg.ahandle, pDb->name, pVgroup->vgId); continue; } + mTrace("vgId:%d, alloc tid:%d", pVgroup->vgId, sid); *pSid = sid; *ppVgroup = pVgroup; @@ -507,6 +508,7 @@ int32_t mnodeGetAvailableVgroup(SMnodeMsg *pMsg, SVgObj **ppVgroup, int32_t *pSi pDb->vgListIndex = 0; pthread_mutex_unlock(&pDb->mutex); + mTrace("vgId:%d, alloc tid:%d", pVgroup->vgId, sid); return TSDB_CODE_SUCCESS; } @@ -832,26 +834,37 @@ static int32_t mnodeRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, v return numOfRows; } -void mnodeAddTableIntoVgroup(SVgObj *pVgroup, SCTableObj *pTable) { +int32_t mnodeAddTableIntoVgroup(SVgObj *pVgroup, SCTableObj *pTable) { int32_t idPoolSize = taosIdPoolMaxSize(pVgroup->idPool); if (pTable->tid > idPoolSize) { mnodeAllocVgroupIdPool(pVgroup); } if (pTable->tid >= 1) { - taosIdPoolMarkStatus(pVgroup->idPool, pTable->tid); - pVgroup->numOfTables++; - // The create vgroup message may be received later than the create table message - // and the writing order in sdb is therefore uncertain - // which will cause the reference count of the vgroup to be incorrect when restarting - // mnodeIncVgroupRef(pVgroup); + if (taosIdPoolMarkStatus(pVgroup->idPool, pTable->tid)) { + pVgroup->numOfTables++; + mTrace("table:%s, vgId:%d tid:%d, mark tid used, uid:%" PRIu64, pTable->info.tableId, pTable->vgId, pTable->tid, + pTable->uid); + // The create vgroup message may be received later than the create table message + // and the writing order in sdb is therefore uncertain + // which will cause the reference count of the vgroup to be incorrect when restarting + // mnodeIncVgroupRef(pVgroup); + } else { + mError("table:%s, vgId:%d tid:%d, failed to mark tid, uid:%" PRIu64, pTable->info.tableId, pTable->vgId, + pTable->tid, pTable->uid); + return -1; + } } + + return 0; } void mnodeRemoveTableFromVgroup(SVgObj *pVgroup, SCTableObj *pTable) { if (pTable->tid >= 1) { taosFreeId(pVgroup->idPool, pTable->tid); pVgroup->numOfTables--; + mTrace("table:%s, vgId:%d tid:%d, put tid back uid:%" PRIu64, pTable->info.tableId, pTable->vgId, pTable->tid, + pTable->uid); // The create vgroup message may be received later than the create table message // and the writing order in sdb is therefore uncertain // which will cause the reference count of the vgroup to be incorrect when restarting diff --git a/src/util/inc/tidpool.h b/src/util/inc/tidpool.h index bf35251631..e4439439ce 100644 --- a/src/util/inc/tidpool.h +++ b/src/util/inc/tidpool.h @@ -34,7 +34,7 @@ void taosIdPoolCleanUp(void *handle); int taosIdPoolNumOfUsed(void *handle); -void taosIdPoolMarkStatus(void *handle, int id); +bool taosIdPoolMarkStatus(void *handle, int id); #ifdef __cplusplus } diff --git a/src/util/src/tidpool.c b/src/util/src/tidpool.c index 53d81bb542..3955960539 100644 --- a/src/util/src/tidpool.c +++ b/src/util/src/tidpool.c @@ -104,10 +104,16 @@ void taosIdPoolCleanUp(void *handle) { int taosIdPoolNumOfUsed(void *handle) { id_pool_t *pIdPool = handle; - return pIdPool->maxId - pIdPool->numOfFree; + + pthread_mutex_lock(&pIdPool->mutex); + int ret = pIdPool->maxId - pIdPool->numOfFree; + pthread_mutex_unlock(&pIdPool->mutex); + + return ret; } -void taosIdPoolMarkStatus(void *handle, int id) { +bool taosIdPoolMarkStatus(void *handle, int id) { + bool ret = false; id_pool_t *pIdPool = handle; pthread_mutex_lock(&pIdPool->mutex); @@ -115,9 +121,14 @@ void taosIdPoolMarkStatus(void *handle, int id) { if (!pIdPool->freeList[slot]) { pIdPool->freeList[slot] = true; pIdPool->numOfFree--; + ret = true; + } else { + ret = false; + uError("pool:%p, id:%d is already used by other obj", pIdPool, id); } pthread_mutex_unlock(&pIdPool->mutex); + return ret; } int taosUpdateIdPool(id_pool_t *handle, int maxId) { @@ -147,6 +158,11 @@ int taosUpdateIdPool(id_pool_t *handle, int maxId) { } int taosIdPoolMaxSize(void *handle) { - id_pool_t *pIdPool = (id_pool_t*)handle; - return pIdPool->maxId; + id_pool_t *pIdPool = (id_pool_t *)handle; + + pthread_mutex_lock(&pIdPool->mutex); + int ret = pIdPool->maxId; + pthread_mutex_unlock(&pIdPool->mutex); + + return ret; } \ No newline at end of file From 681c314b44c53af19c556ac002228d381af2a4ea Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 18 Mar 2021 09:40:07 +0000 Subject: [PATCH 32/52] TD-3355 --- src/mnode/inc/mnodeVgroup.h | 2 +- src/mnode/src/mnodeTable.c | 25 +++++++++++-------------- src/mnode/src/mnodeVgroup.c | 4 ++-- src/util/src/tidpool.c | 1 - 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/mnode/inc/mnodeVgroup.h b/src/mnode/inc/mnodeVgroup.h index 02dc42a1f8..e052cdb83c 100644 --- a/src/mnode/inc/mnodeVgroup.h +++ b/src/mnode/inc/mnodeVgroup.h @@ -44,7 +44,7 @@ void mnodeDropVgroup(SVgObj *pVgroup, void *ahandle); void mnodeAlterVgroup(SVgObj *pVgroup, void *ahandle); int32_t mnodeGetAvailableVgroup(struct SMnodeMsg *pMsg, SVgObj **pVgroup, int32_t *sid); -int32_t mnodeAddTableIntoVgroup(SVgObj *pVgroup, SCTableObj *pTable); +int32_t mnodeAddTableIntoVgroup(SVgObj *pVgroup, SCTableObj *pTable, bool needCheck); void mnodeRemoveTableFromVgroup(SVgObj *pVgroup, SCTableObj *pTable); void mnodeSendDropVnodeMsg(int32_t vgId, SRpcEpSet *epSet, void *ahandle); void mnodeSendCreateVgroupMsg(SVgObj *pVgroup, void *ahandle); diff --git a/src/mnode/src/mnodeTable.c b/src/mnode/src/mnodeTable.c index 65b0408a8f..39eca8819d 100644 --- a/src/mnode/src/mnodeTable.c +++ b/src/mnode/src/mnodeTable.c @@ -152,7 +152,7 @@ static int32_t mnodeChildTableActionInsert(SSdbRow *pRow) { if (pDb) mnodeAddTableIntoDb(pDb); if (pVgroup) { - if (mnodeAddTableIntoVgroup(pVgroup, pTable) != 0) { + if (mnodeAddTableIntoVgroup(pVgroup, pTable, pRow->pMsg == NULL) != 0) { mError("table:%s, vgId:%d tid:%d, failed to perform insert action, uid:%" PRIu64 " suid:%" PRIu64, pTable->info.tableId, pTable->vgId, pTable->tid, pTable->uid, pTable->suid); code = -1; @@ -1912,15 +1912,14 @@ static int32_t mnodeDoCreateChildTableCb(SMnodeMsg *pMsg, int32_t code) { pMsg->rpcMsg.handle); if (pMsg->pBatchMasterMsg) { - ++pMsg->pBatchMasterMsg->successed; - if (pMsg->pBatchMasterMsg->successed + pMsg->pBatchMasterMsg->received - >= pMsg->pBatchMasterMsg->expected) { - dnodeSendRpcMWriteRsp(pMsg->pBatchMasterMsg, code); - } + ++pMsg->pBatchMasterMsg->successed; + if (pMsg->pBatchMasterMsg->successed + pMsg->pBatchMasterMsg->received >= pMsg->pBatchMasterMsg->expected) { + dnodeSendRpcMWriteRsp(pMsg->pBatchMasterMsg, code); + } - mnodeDestroySubMsg(pMsg); + mnodeDestroySubMsg(pMsg); - return TSDB_CODE_MND_ACTION_IN_PROGRESS; + return TSDB_CODE_MND_ACTION_IN_PROGRESS; } dnodeSendRpcMWriteRsp(pMsg, TSDB_CODE_SUCCESS); @@ -1935,9 +1934,8 @@ static int32_t mnodeDoCreateChildTableCb(SMnodeMsg *pMsg, int32_t code) { if (pMsg->pBatchMasterMsg) { ++pMsg->pBatchMasterMsg->received; pMsg->pBatchMasterMsg->code = code; - if (pMsg->pBatchMasterMsg->successed + pMsg->pBatchMasterMsg->received - >= pMsg->pBatchMasterMsg->expected) { - dnodeSendRpcMWriteRsp(pMsg->pBatchMasterMsg, code); + if (pMsg->pBatchMasterMsg->successed + pMsg->pBatchMasterMsg->received >= pMsg->pBatchMasterMsg->expected) { + dnodeSendRpcMWriteRsp(pMsg->pBatchMasterMsg, code); } mnodeDestroySubMsg(pMsg); @@ -2686,9 +2684,8 @@ static void mnodeProcessCreateChildTableRsp(SRpcMsg *rpcMsg) { if (pMsg->pBatchMasterMsg) { ++pMsg->pBatchMasterMsg->successed; - if (pMsg->pBatchMasterMsg->successed + pMsg->pBatchMasterMsg->received - >= pMsg->pBatchMasterMsg->expected) { - dnodeSendRpcMWriteRsp(pMsg->pBatchMasterMsg, rpcMsg->code); + if (pMsg->pBatchMasterMsg->successed + pMsg->pBatchMasterMsg->received >= pMsg->pBatchMasterMsg->expected) { + dnodeSendRpcMWriteRsp(pMsg->pBatchMasterMsg, rpcMsg->code); } mnodeDestroySubMsg(pMsg); diff --git a/src/mnode/src/mnodeVgroup.c b/src/mnode/src/mnodeVgroup.c index ef45936eaa..fdbf7ae398 100644 --- a/src/mnode/src/mnodeVgroup.c +++ b/src/mnode/src/mnodeVgroup.c @@ -834,14 +834,14 @@ static int32_t mnodeRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, v return numOfRows; } -int32_t mnodeAddTableIntoVgroup(SVgObj *pVgroup, SCTableObj *pTable) { +int32_t mnodeAddTableIntoVgroup(SVgObj *pVgroup, SCTableObj *pTable, bool needCheck) { int32_t idPoolSize = taosIdPoolMaxSize(pVgroup->idPool); if (pTable->tid > idPoolSize) { mnodeAllocVgroupIdPool(pVgroup); } if (pTable->tid >= 1) { - if (taosIdPoolMarkStatus(pVgroup->idPool, pTable->tid)) { + if (taosIdPoolMarkStatus(pVgroup->idPool, pTable->tid) || !needCheck) { pVgroup->numOfTables++; mTrace("table:%s, vgId:%d tid:%d, mark tid used, uid:%" PRIu64, pTable->info.tableId, pTable->vgId, pTable->tid, pTable->uid); diff --git a/src/util/src/tidpool.c b/src/util/src/tidpool.c index 3955960539..bd3f774543 100644 --- a/src/util/src/tidpool.c +++ b/src/util/src/tidpool.c @@ -124,7 +124,6 @@ bool taosIdPoolMarkStatus(void *handle, int id) { ret = true; } else { ret = false; - uError("pool:%p, id:%d is already used by other obj", pIdPool, id); } pthread_mutex_unlock(&pIdPool->mutex); From 7610e8111d637d8a77babc050ccb4680f0918d89 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Thu, 18 Mar 2021 17:43:09 +0800 Subject: [PATCH 33/52] Feature/sangshuduo/td 3317 taosdemo interlace (#5485) * [TD-3316] : add testcase for taosdemo limit and offset. check offset 0. * [TD-3316] : add testcase for taosdemo limit and offset. fix sample file import bug. * [TD-3316] : add test case for limit and offset. fix sample data issue. * [TD-3327] : fix taosdemo segfault when import data from sample data file. * [TD-3317] : make taosdemo support interlace mode. json parameter rows_per_tbl support. * [TD-3317] : support interlace mode. refactor * [TD-3317] : support interlace mode. refactor * [TD-3317] : support interlace mode insertion. refactor. * [TD-3317] : support interlace mode insertion. change json file. * [TD-3317] : support interlace mode insertion. fix multithread create table regression. * [TD-3317] : support interlace mode insertion. working but not perfect. * [TD-3317] : support interlace mode insertion. rename lowaTest with taosdemoTestWithJson * [TD-3317] : support interlace mode insertion. perfect * [TD-3317] : support interlace mode insertion. cleanup. * [TD-3317] : support interlace mode insertion. adjust algorithm of loop times. Co-authored-by: Shuduo Sang --- src/kit/taosdemo/taosdemo.c | 378 ++++++++++++++++++++---------------- 1 file changed, 211 insertions(+), 167 deletions(-) diff --git a/src/kit/taosdemo/taosdemo.c b/src/kit/taosdemo/taosdemo.c index 83195ca15d..355f738885 100644 --- a/src/kit/taosdemo/taosdemo.c +++ b/src/kit/taosdemo/taosdemo.c @@ -567,12 +567,19 @@ static FILE * g_fpOfInsertResult = NULL; #define debugPrint(fmt, ...) \ do { if (g_args.debug_print || g_args.verbose_print) \ fprintf(stderr, "DEBG: "fmt, __VA_ARGS__); } while(0) + #define verbosePrint(fmt, ...) \ do { if (g_args.verbose_print) \ fprintf(stderr, "VERB: "fmt, __VA_ARGS__); } while(0) +#define errorPrint(fmt, ...) \ + do { fprintf(stderr, "ERROR: "fmt, __VA_ARGS__); } while(0) + + /////////////////////////////////////////////////// +static void ERROR_EXIT(const char *msg) { perror(msg); exit(-1); } + void printHelp() { char indent[10] = " "; printf("%s%s%s%s\n", indent, "-f", indent, @@ -645,7 +652,7 @@ void parse_args(int argc, char *argv[], SArguments *arguments) { } else if (strcmp(argv[i], "-c") == 0) { char *configPath = argv[++i]; if (wordexp(configPath, &full_path, 0) != 0) { - fprintf(stderr, "Invalid path %s\n", configPath); + errorPrint( "Invalid path %s\n", configPath); return; } taos_options(TSDB_OPTION_CONFIGDIR, full_path.we_wordv[0]); @@ -694,8 +701,8 @@ void parse_args(int argc, char *argv[], SArguments *arguments) { && strcasecmp(argv[i], "DOUBLE") && strcasecmp(argv[i], "BINARY") && strcasecmp(argv[i], "NCHAR")) { - fprintf(stderr, "Invalid data_type!\n"); printHelp(); + ERROR_EXIT( "Invalid data_type!\n"); exit(EXIT_FAILURE); } sptr[0] = argv[i]; @@ -715,8 +722,8 @@ void parse_args(int argc, char *argv[], SArguments *arguments) { && strcasecmp(token, "DOUBLE") && strcasecmp(token, "BINARY") && strcasecmp(token, "NCHAR")) { - fprintf(stderr, "Invalid data_type!\n"); printHelp(); + ERROR_EXIT("Invalid data_type!\n"); exit(EXIT_FAILURE); } sptr[index++] = token; @@ -771,8 +778,8 @@ void parse_args(int argc, char *argv[], SArguments *arguments) { printHelp(); exit(0); } else { - fprintf(stderr, "wrong options\n"); printHelp(); + ERROR_EXIT("ERROR: wrong options\n"); exit(EXIT_FAILURE); } } @@ -858,7 +865,7 @@ static int queryDbExec(TAOS *taos, char *command, int type) { if (code != 0) { debugPrint("%s() LN%d - command: %s\n", __func__, __LINE__, command); - fprintf(stderr, "Failed to run %s, reason: %s\n", command, taos_errstr(res)); + errorPrint( "Failed to run %s, reason: %s\n", command, taos_errstr(res)); taos_free_result(res); //taos_close(taos); return -1; @@ -884,13 +891,13 @@ static void getResult(TAOS_RES *res, char* resultFileName) { if (resultFileName[0] != 0) { fp = fopen(resultFileName, "at"); if (fp == NULL) { - fprintf(stderr, "failed to open result file: %s, result will not save to file\n", resultFileName); + errorPrint("%s() LN%d, failed to open result file: %s, result will not save to file\n", __func__, __LINE__, resultFileName); } } char* databuf = (char*) calloc(1, 100*1024*1024); if (databuf == NULL) { - fprintf(stderr, "failed to malloc, warning: save result to file slowly!\n"); + errorPrint("%s() LN%d, failed to malloc, warning: save result to file slowly!\n", __func__, __LINE__); if (fp) fclose(fp); return ; @@ -1484,7 +1491,7 @@ static int xDumpResultToFile(const char* fname, TAOS_RES* tres) { FILE* fp = fopen(fname, "at"); if (fp == NULL) { - fprintf(stderr, "ERROR: failed to open file: %s\n", fname); + errorPrint("%s() LN%d, failed to open file: %s\n", __func__, __LINE__, fname); return -1; } @@ -1529,7 +1536,7 @@ static int getDbFromServer(TAOS * taos, SDbInfo** dbInfos) { int32_t code = taos_errno(res); if (code != 0) { - fprintf(stderr, "failed to run , reason: %s\n", taos_errstr(res)); + errorPrint( "failed to run , reason: %s\n", taos_errstr(res)); return -1; } @@ -1541,7 +1548,7 @@ static int getDbFromServer(TAOS * taos, SDbInfo** dbInfos) { dbInfos[count] = (SDbInfo *)calloc(1, sizeof(SDbInfo)); if (dbInfos[count] == NULL) { - fprintf(stderr, "failed to allocate memory for some dbInfo[%d]\n", count); + errorPrint( "failed to allocate memory for some dbInfo[%d]\n", count); return -1; } @@ -1576,7 +1583,7 @@ static int getDbFromServer(TAOS * taos, SDbInfo** dbInfos) { count++; if (count > MAX_DATABASE_COUNT) { - fprintf(stderr, "The database count overflow than %d\n", MAX_DATABASE_COUNT); + errorPrint( "The database count overflow than %d\n", MAX_DATABASE_COUNT); break; } } @@ -1590,7 +1597,7 @@ static void printfDbInfoForQueryToFile(char* filename, SDbInfo* dbInfos, int ind FILE *fp = fopen(filename, "at"); if (fp == NULL) { - fprintf(stderr, "failed to open file: %s\n", filename); + errorPrint( "failed to open file: %s\n", filename); return; } @@ -1646,7 +1653,7 @@ static void printfQuerySystemInfo(TAOS * taos) { res = taos_query(taos, "show databases;"); SDbInfo** dbInfos = (SDbInfo **)calloc(MAX_DATABASE_COUNT, sizeof(SDbInfo *)); if (dbInfos == NULL) { - fprintf(stderr, "failed to allocate memory\n"); + errorPrint("%s() LN%d, failed to allocate memory\n", __func__, __LINE__); return; } int dbCount = getDbFromServer(taos, dbInfos); @@ -1676,8 +1683,6 @@ static void printfQuerySystemInfo(TAOS * taos) { } -static void ERROR_EXIT(const char *msg) { perror(msg); exit(-1); } - static int postProceSql(char* host, uint16_t port, char* sqlstr) { char *req_fmt = "POST %s HTTP/1.1\r\nHost: %s:%d\r\nAccept: */*\r\nAuthorization: Basic %s\r\nContent-Length: %d\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\n%s"; @@ -1725,9 +1730,9 @@ static int postProceSql(char* host, uint16_t port, char* sqlstr) sockfd = socket(AF_INET, SOCK_STREAM, 0); if (sockfd < 0) { #ifdef WINDOWS - fprintf(stderr, "Could not create socket : %d" , WSAGetLastError()); + errorPrint( "Could not create socket : %d" , WSAGetLastError()); #endif - debugPrint("%s() LN%d sockfd=%d\n", __func__, __LINE__, sockfd); + debugPrint("%s() LN%d, sockfd=%d\n", __func__, __LINE__, sockfd); free(request_buf); ERROR_EXIT("ERROR opening socket"); } @@ -1847,7 +1852,7 @@ static int postProceSql(char* host, uint16_t port, char* sqlstr) static char* getTagValueFromTagSample(SSuperTable* stbInfo, int tagUsePos) { char* dataBuf = (char*)calloc(TSDB_MAX_SQL_LEN+1, 1); if (NULL == dataBuf) { - printf("calloc failed! size:%d\n", TSDB_MAX_SQL_LEN+1); + errorPrint("%s() LN%d, calloc failed! size:%d\n", __func__, __LINE__, TSDB_MAX_SQL_LEN+1); return NULL; } @@ -2140,7 +2145,7 @@ static int getSuperTableFromServer(TAOS * taos, char* dbName, int childTblCount = 10000; superTbls->childTblName = (char*)calloc(1, childTblCount * TSDB_TABLE_NAME_LEN); if (superTbls->childTblName == NULL) { - fprintf(stderr, "alloc memory failed!"); + errorPrint("%s() LN%d, alloc memory failed!\n", __func__, __LINE__); return -1; } getAllChildNameOfSuperTable(taos, dbName, @@ -2279,7 +2284,7 @@ static int createSuperTable(TAOS * taos, char* dbName, SSuperTable* superTbls, verbosePrint("%s() LN%d: %s\n", __func__, __LINE__, command); if (0 != queryDbExec(taos, command, NO_INSERT_TYPE)) { - fprintf(stderr, "create supertable %s failed!\n\n", + errorPrint( "create supertable %s failed!\n\n", superTbls->sTblName); return -1; } @@ -2293,7 +2298,7 @@ static int createDatabases() { int ret = 0; taos = taos_connect(g_Dbs.host, g_Dbs.user, g_Dbs.password, NULL, g_Dbs.port); if (taos == NULL) { - fprintf(stderr, "Failed to connect to TDengine, reason:%s\n", taos_errstr(NULL)); + errorPrint( "Failed to connect to TDengine, reason:%s\n", taos_errstr(NULL)); return -1; } char command[BUFFER_SIZE] = "\0"; @@ -2378,7 +2383,7 @@ static int createDatabases() { debugPrint("%s() %d command: %s\n", __func__, __LINE__, command); if (0 != queryDbExec(taos, command, NO_INSERT_TYPE)) { taos_close(taos); - fprintf(stderr, "\ncreate database %s failed!\n\n", g_Dbs.db[i].dbName); + errorPrint( "\ncreate database %s failed!\n\n", g_Dbs.db[i].dbName); return -1; } printf("\ncreate database %s success!\n\n", g_Dbs.db[i].dbName); @@ -2427,7 +2432,7 @@ static void* createTable(void *sarg) char *buffer = calloc(buff_len, 1); if (buffer == NULL) { - fprintf(stderr, "Memory allocated failed!"); + errorPrint("%s() LN%d, Memory allocated failed!\n", __func__, __LINE__); exit(-1); } @@ -2485,7 +2490,7 @@ static void* createTable(void *sarg) len = 0; verbosePrint("%s() LN%d %s\n", __func__, __LINE__, buffer); if (0 != queryDbExec(winfo->taos, buffer, NO_INSERT_TYPE)){ - fprintf(stderr, "queryDbExec() failed. buffer:\n%s\n", buffer); + errorPrint( "queryDbExec() failed. buffer:\n%s\n", buffer); free(buffer); return NULL; } @@ -2501,7 +2506,7 @@ static void* createTable(void *sarg) if (0 != len) { verbosePrint("%s() %d buffer: %s\n", __func__, __LINE__, buffer); if (0 != queryDbExec(winfo->taos, buffer, NO_INSERT_TYPE)) { - fprintf(stderr, "queryDbExec() failed. buffer:\n%s\n", buffer); + errorPrint( "queryDbExec() failed. buffer:\n%s\n", buffer); } } @@ -2546,7 +2551,7 @@ static int startMultiThreadCreateChildTable( db_name, g_Dbs.port); if (t_info->taos == NULL) { - fprintf(stderr, "Failed to connect to TDengine, reason:%s\n", taos_errstr(NULL)); + errorPrint( "Failed to connect to TDengine, reason:%s\n", taos_errstr(NULL)); free(pids); free(infos); return -1; @@ -2724,7 +2729,7 @@ static int readSampleFromCsvFileToMem( FILE* fp = fopen(superTblInfo->sampleFile, "r"); if (fp == NULL) { - fprintf(stderr, "Failed to open sample file: %s, reason:%s\n", + errorPrint( "Failed to open sample file: %s, reason:%s\n", superTblInfo->sampleFile, strerror(errno)); return -1; } @@ -2736,7 +2741,7 @@ static int readSampleFromCsvFileToMem( readLen = tgetline(&line, &n, fp); if (-1 == readLen) { if(0 != fseek(fp, 0, SEEK_SET)) { - fprintf(stderr, "Failed to fseek file: %s, reason:%s\n", + errorPrint( "Failed to fseek file: %s, reason:%s\n", superTblInfo->sampleFile, strerror(errno)); fclose(fp); return -1; @@ -2805,8 +2810,8 @@ static bool getColumnAndTagTypeFromInsertJsonFile(cJSON* stbInfo, SSuperTable* s int columnSize = cJSON_GetArraySize(columns); if (columnSize > MAX_COLUMN_COUNT) { - printf("ERROR: failed to read json, column size overflow, max column size is %d\n", - MAX_COLUMN_COUNT); + errorPrint("%s() LN%d, failed to read json, column size overflow, max column size is %d\n", + __func__, __LINE__, MAX_COLUMN_COUNT); goto PARSE_OVER; } @@ -2824,7 +2829,7 @@ static bool getColumnAndTagTypeFromInsertJsonFile(cJSON* stbInfo, SSuperTable* s if (countObj && countObj->type == cJSON_Number) { count = countObj->valueint; } else if (countObj && countObj->type != cJSON_Number) { - printf("ERROR: failed to read json, column count not found\n"); + errorPrint("%s() LN%d, failed to read json, column count not found\n", __func__, __LINE__); goto PARSE_OVER; } else { count = 1; @@ -2834,7 +2839,7 @@ static bool getColumnAndTagTypeFromInsertJsonFile(cJSON* stbInfo, SSuperTable* s memset(&columnCase, 0, sizeof(StrColumn)); cJSON *dataType = cJSON_GetObjectItem(column, "type"); if (!dataType || dataType->type != cJSON_String || dataType->valuestring == NULL) { - printf("ERROR: failed to read json, column type not found\n"); + errorPrint("%s() LN%d: failed to read json, column type not found\n", __func__, __LINE__); goto PARSE_OVER; } //tstrncpy(superTbls->columns[k].dataType, dataType->valuestring, MAX_TB_NAME_SIZE); @@ -2844,7 +2849,7 @@ static bool getColumnAndTagTypeFromInsertJsonFile(cJSON* stbInfo, SSuperTable* s if (dataLen && dataLen->type == cJSON_Number) { columnCase.dataLen = dataLen->valueint; } else if (dataLen && dataLen->type != cJSON_Number) { - printf("ERROR: failed to read json, column len not found\n"); + debugPrint("%s() LN%d: failed to read json, column len not found\n", __func__, __LINE__); goto PARSE_OVER; } else { columnCase.dataLen = 8; @@ -2863,13 +2868,13 @@ static bool getColumnAndTagTypeFromInsertJsonFile(cJSON* stbInfo, SSuperTable* s // tags cJSON *tags = cJSON_GetObjectItem(stbInfo, "tags"); if (!tags || tags->type != cJSON_Array) { - printf("ERROR: failed to read json, tags not found\n"); + debugPrint("%s() LN%d, failed to read json, tags not found\n", __func__, __LINE__); goto PARSE_OVER; } int tagSize = cJSON_GetArraySize(tags); if (tagSize > MAX_TAG_COUNT) { - printf("ERROR: failed to read json, tags size overflow, max tag size is %d\n", MAX_TAG_COUNT); + debugPrint("%s() LN%d, failed to read json, tags size overflow, max tag size is %d\n", __func__, __LINE__, MAX_TAG_COUNT); goto PARSE_OVER; } @@ -2991,47 +2996,47 @@ static bool getMetaFromInsertJsonFile(cJSON* root) { goto PARSE_OVER; } - cJSON* gInsertInterval = cJSON_GetObjectItem(root, "insert_interval"); - if (gInsertInterval && gInsertInterval->type == cJSON_Number) { - g_args.insert_interval = gInsertInterval->valueint; - } else if (!gInsertInterval) { - g_args.insert_interval = 0; - } else { - fprintf(stderr, "ERROR: failed to read json, insert_interval input mistake\n"); - goto PARSE_OVER; - } - - cJSON* rowsPerTbl = cJSON_GetObjectItem(root, "rows_per_tbl"); - if (rowsPerTbl && rowsPerTbl->type == cJSON_Number) { - g_args.rows_per_tbl = rowsPerTbl->valueint; - } else if (!rowsPerTbl) { - g_args.rows_per_tbl = 0; // 0 means progressive mode, > 0 mean interlace mode. max value is less or equ num_of_records_per_req - } else { - fprintf(stderr, "ERROR: failed to read json, rows_per_tbl input mistake\n"); - goto PARSE_OVER; - } + cJSON* gInsertInterval = cJSON_GetObjectItem(root, "insert_interval"); + if (gInsertInterval && gInsertInterval->type == cJSON_Number) { + g_args.insert_interval = gInsertInterval->valueint; + } else if (!gInsertInterval) { + g_args.insert_interval = 0; + } else { + errorPrint("%s() LN%d, failed to read json, insert_interval input mistake\n", __func__, __LINE__); + goto PARSE_OVER; + } - cJSON* maxSqlLen = cJSON_GetObjectItem(root, "max_sql_len"); - if (maxSqlLen && maxSqlLen->type == cJSON_Number) { - g_args.max_sql_len = maxSqlLen->valueint; - } else if (!maxSqlLen) { - g_args.max_sql_len = TSDB_PAYLOAD_SIZE; - } else { - fprintf(stderr, "ERROR: failed to read json, max_sql_len input mistake\n"); - goto PARSE_OVER; - } + cJSON* rowsPerTbl = cJSON_GetObjectItem(root, "rows_per_tbl"); + if (rowsPerTbl && rowsPerTbl->type == cJSON_Number) { + g_args.rows_per_tbl = rowsPerTbl->valueint; + } else if (!rowsPerTbl) { + g_args.rows_per_tbl = 0; // 0 means progressive mode, > 0 mean interlace mode. max value is less or equ num_of_records_per_req + } else { + errorPrint("%s() LN%d, failed to read json, rows_per_tbl input mistake\n", __func__, __LINE__); + goto PARSE_OVER; + } + + cJSON* maxSqlLen = cJSON_GetObjectItem(root, "max_sql_len"); + if (maxSqlLen && maxSqlLen->type == cJSON_Number) { + g_args.max_sql_len = maxSqlLen->valueint; + } else if (!maxSqlLen) { + g_args.max_sql_len = TSDB_PAYLOAD_SIZE; + } else { + errorPrint("%s() LN%d, failed to read json, max_sql_len input mistake\n", __func__, __LINE__); + goto PARSE_OVER; + } - cJSON* numRecPerReq = cJSON_GetObjectItem(root, "num_of_records_per_req"); - if (numRecPerReq && numRecPerReq->type == cJSON_Number) { - g_args.num_of_RPR = numRecPerReq->valueint; - } else if (!numRecPerReq) { - g_args.num_of_RPR = 100; - } else { - printf("ERROR: failed to read json, num_of_records_per_req not found\n"); - goto PARSE_OVER; - } - + cJSON* numRecPerReq = cJSON_GetObjectItem(root, "num_of_records_per_req"); + if (numRecPerReq && numRecPerReq->type == cJSON_Number) { + g_args.num_of_RPR = numRecPerReq->valueint; + } else if (!numRecPerReq) { + g_args.num_of_RPR = 100; + } else { + errorPrint("%s() LN%d, failed to read json, num_of_records_per_req not found\n", __func__, __LINE__); + goto PARSE_OVER; + } + cJSON *answerPrompt = cJSON_GetObjectItem(root, "confirm_parameter_prompt"); // yes, no, if (answerPrompt && answerPrompt->type == cJSON_String @@ -3058,7 +3063,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) { int dbSize = cJSON_GetArraySize(dbs); if (dbSize > MAX_DB_COUNT) { - fprintf(stderr, + errorPrint( "ERROR: failed to read json, databases size overflow, max database is %d\n", MAX_DB_COUNT); goto PARSE_OVER; @@ -3257,7 +3262,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) { int stbSize = cJSON_GetArraySize(stables); if (stbSize > MAX_SUPER_TABLE_COUNT) { - fprintf(stderr, + errorPrint( "ERROR: failed to read json, databases size overflow, max database is %d\n", MAX_SUPER_TABLE_COUNT); goto PARSE_OVER; @@ -3384,9 +3389,11 @@ static bool getMetaFromInsertJsonFile(cJSON* root) { cJSON *ts = cJSON_GetObjectItem(stbInfo, "start_timestamp"); if (ts && ts->type == cJSON_String && ts->valuestring != NULL) { - tstrncpy(g_Dbs.db[i].superTbls[j].startTimestamp, ts->valuestring, MAX_DB_NAME_SIZE); + tstrncpy(g_Dbs.db[i].superTbls[j].startTimestamp, + ts->valuestring, MAX_DB_NAME_SIZE); } else if (!ts) { - tstrncpy(g_Dbs.db[i].superTbls[j].startTimestamp, "now", MAX_DB_NAME_SIZE); + tstrncpy(g_Dbs.db[i].superTbls[j].startTimestamp, + "now", MAX_DB_NAME_SIZE); } else { printf("ERROR: failed to read json, start_timestamp not found\n"); goto PARSE_OVER; @@ -3493,7 +3500,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) { } else if (!rowsPerTbl) { g_Dbs.db[i].superTbls[j].rowsPerTbl = 0; // 0 means progressive mode, > 0 mean interlace mode. max value is less or equ num_of_records_per_req } else { - fprintf(stderr, "ERROR: failed to read json, rowsPerTbl input mistake\n"); + errorPrint("%s() LN%d, failed to read json, rowsPerTbl input mistake\n", __func__, __LINE__); goto PARSE_OVER; } @@ -3523,7 +3530,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) { } else if (!insertRows) { g_Dbs.db[i].superTbls[j].insertRows = 0x7FFFFFFFFFFFFFFF; } else { - fprintf(stderr, "failed to read json, insert_rows input mistake"); + errorPrint("%s() LN%d, failed to read json, insert_rows input mistake\n", __func__, __LINE__); goto PARSE_OVER; } @@ -3535,7 +3542,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) { __func__, __LINE__, g_args.insert_interval); g_Dbs.db[i].superTbls[j].insertInterval = g_args.insert_interval; } else { - fprintf(stderr, "failed to read json, insert_interval input mistake"); + errorPrint("%s() LN%d, failed to read json, insert_interval input mistake\n", __func__, __LINE__); goto PARSE_OVER; } @@ -3942,7 +3949,7 @@ static bool getInfoFromJsonFile(char* file) { } else if (SUBSCRIBE_TEST == g_args.test_mode) { ret = getMetaFromQueryJsonFile(root); } else { - printf("ERROR: input json file type error! please input correct file type: insert or query or subscribe\n"); + errorPrint("%s() LN%d, input json file type error! please input correct file type: insert or query or subscribe\n", __func__, __LINE__); goto PARSE_OVER; } @@ -4024,14 +4031,14 @@ static int generateRowData(char* dataBuf, int maxLen, int64_t timestamp, SSuper if ((0 == strncasecmp(stbInfo->columns[i].dataType, "binary", 6)) || (0 == strncasecmp(stbInfo->columns[i].dataType, "nchar", 5))) { if (stbInfo->columns[i].dataLen > TSDB_MAX_BINARY_LEN) { - printf("binary or nchar length overflow, max size:%u\n", + errorPrint( "binary or nchar length overflow, max size:%u\n", (uint32_t)TSDB_MAX_BINARY_LEN); return (-1); } char* buf = (char*)calloc(stbInfo->columns[i].dataLen+1, 1); if (NULL == buf) { - printf("calloc failed! size:%d\n", stbInfo->columns[i].dataLen); + errorPrint( "calloc failed! size:%d\n", stbInfo->columns[i].dataLen); return (-1); } rand_string(buf, stbInfo->columns[i].dataLen); @@ -4063,7 +4070,7 @@ static int generateRowData(char* dataBuf, int maxLen, int64_t timestamp, SSuper } else if (0 == strncasecmp(stbInfo->columns[i].dataType, "timestamp", 9)) { dataLen += snprintf(dataBuf + dataLen, maxLen - dataLen, "%"PRId64", ", rand_bigint()); } else { - printf("No support data type: %s\n", stbInfo->columns[i].dataType); + errorPrint( "No support data type: %s\n", stbInfo->columns[i].dataType); return (-1); } } @@ -4138,7 +4145,8 @@ static int prepareSampleDataForSTable(SSuperTable *superTblInfo) { sampleDataBuf = calloc( superTblInfo->lenOfOneRow * MAX_SAMPLES_ONCE_FROM_FILE, 1); if (sampleDataBuf == NULL) { - fprintf(stderr, "Failed to calloc %d Bytes, reason:%s\n", + errorPrint("%s() LN%d, Failed to calloc %d Bytes, reason:%s\n", + __func__, __LINE__, superTblInfo->lenOfOneRow * MAX_SAMPLES_ONCE_FROM_FILE, strerror(errno)); return -1; @@ -4148,7 +4156,7 @@ static int prepareSampleDataForSTable(SSuperTable *superTblInfo) { int ret = readSampleFromCsvFileToMem(superTblInfo); if (0 != ret) { - fprintf(stderr, "read sample from csv file failed.\n"); + errorPrint("%s() LN%d, read sample from csv file failed.\n", __func__, __LINE__); tmfree(sampleDataBuf); superTblInfo->sampleDataBuf = NULL; return -1; @@ -4157,29 +4165,26 @@ static int prepareSampleDataForSTable(SSuperTable *superTblInfo) { return 0; } -static int execInsert(threadInfo *winfo, char *buffer, int k) +static int execInsert(threadInfo *pThreadInfo, char *buffer, int k) { int affectedRows; - SSuperTable* superTblInfo = winfo->superTblInfo; + SSuperTable* superTblInfo = pThreadInfo->superTblInfo; + verbosePrint("[%d] %s() LN%d %s\n", pThreadInfo->threadID, + __func__, __LINE__, buffer); if (superTblInfo) { if (0 == strncasecmp(superTblInfo->insertMode, "taosc", strlen("taosc"))) { - verbosePrint("%s() LN%d %s\n", __func__, __LINE__, buffer); - affectedRows = queryDbExec(winfo->taos, buffer, INSERT_TYPE); + affectedRows = queryDbExec(pThreadInfo->taos, buffer, INSERT_TYPE); } else { - verbosePrint("%s() LN%d %s\n", __func__, __LINE__, buffer); - int retCode = postProceSql(g_Dbs.host, g_Dbs.port, buffer); - - if (0 != retCode) { + if (0 != postProceSql(g_Dbs.host, g_Dbs.port, buffer)) { affectedRows = -1; - printf("========restful return fail, threadID[%d]\n", winfo->threadID); + printf("========restful return fail, threadID[%d]\n", pThreadInfo->threadID); } else { affectedRows = k; } } } else { - verbosePrint("%s() LN%d %s\n", __func__, __LINE__, buffer); - affectedRows = queryDbExec(winfo->taos, buffer, 1); + affectedRows = queryDbExec(pThreadInfo->taos, buffer, 1); } return affectedRows; @@ -4195,8 +4200,9 @@ static void getTableName(char *pTblName, threadInfo* pThreadInfo, int tableSeq) superTblInfo->childTblName + (tableSeq - superTblInfo->childTblOffset) * TSDB_TABLE_NAME_LEN); } else { - verbosePrint("%s() LN%d: from=%d count=%d seq=%d\n", - __func__, __LINE__, pThreadInfo->start_table_from, + verbosePrint("[%d] %s() LN%d: from=%d count=%d seq=%d\n", + pThreadInfo->threadID, __func__, __LINE__, + pThreadInfo->start_table_from, pThreadInfo->ntables, tableSeq); snprintf(pTblName, TSDB_TABLE_NAME_LEN, "%s", superTblInfo->childTblName + tableSeq * TSDB_TABLE_NAME_LEN); @@ -4323,7 +4329,7 @@ static int generateSQLHead(char *tableName, int32_t tableSeq, threadInfo* pThrea tableSeq % superTblInfo->tagSampleCount); } if (NULL == tagsValBuf) { - fprintf(stderr, "tag buf failed to allocate memory\n"); + errorPrint("%s() LN%d, tag buf failed to allocate memory\n", __func__, __LINE__); return -1; } @@ -4396,13 +4402,14 @@ static int generateDataBuffer(char *pTblName, } static void* syncWriteInterlace(threadInfo *pThreadInfo) { - printf("### CBD: interlace write\n"); + debugPrint("[%d] %s() LN%d: ### interlace write\n", + pThreadInfo->threadID, __func__, __LINE__); SSuperTable* superTblInfo = pThreadInfo->superTblInfo; char* buffer = calloc(superTblInfo?superTblInfo->maxSqlLen:g_args.max_sql_len, 1); if (NULL == buffer) { - fprintf(stderr, "Failed to alloc %d Bytes, reason:%s\n", + errorPrint( "Failed to alloc %d Bytes, reason:%s\n", superTblInfo?superTblInfo->maxSqlLen:g_args.max_sql_len, strerror(errno)); return NULL; @@ -4437,8 +4444,8 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { int tableSeq = pThreadInfo->start_table_from; - debugPrint("%s() LN%d: start_table_from=%d ntables=%d insertRows=%"PRId64"\n", - __func__, __LINE__, pThreadInfo->start_table_from, + debugPrint("[%d] %s() LN%d: start_table_from=%d ntables=%d insertRows=%"PRId64"\n", + pThreadInfo->threadID, __func__, __LINE__, pThreadInfo->start_table_from, pThreadInfo->ntables, insertRows); int64_t startTime = pThreadInfo->start_time; @@ -4446,80 +4453,111 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { int batchPerTblTimes; int batchPerTbl; + assert(pThreadInfo->ntables > 0); + + if (rowsPerTbl > g_args.num_of_RPR) + rowsPerTbl = g_args.num_of_RPR; + + batchPerTbl = rowsPerTbl; if ((rowsPerTbl > 0) && (pThreadInfo->ntables > 1)) { - batchPerTblTimes = g_args.num_of_RPR / rowsPerTbl; - batchPerTbl = rowsPerTbl; + batchPerTblTimes = + (g_args.num_of_RPR / (rowsPerTbl * pThreadInfo->ntables)) + 1; } else { batchPerTblTimes = 1; - batchPerTbl = g_args.num_of_RPR; } int generatedRecPerTbl = 0; + bool flagSleep = true; + int sleepTimeTotal = 0; while(pThreadInfo->totalInsertRows < pThreadInfo->ntables * insertRows) { - if (insert_interval) { + if ((flagSleep) && (insert_interval)) { st = taosGetTimestampUs(); + flagSleep = false; } // generate data memset(buffer, 0, superTblInfo?superTblInfo->maxSqlLen:g_args.max_sql_len); char *pstr = buffer; - int recGenerated = 0; + int recOfBatch = 0; for (int i = 0; i < batchPerTblTimes; i ++) { getTableName(tableName, pThreadInfo, tableSeq); int headLen; if (i == 0) { - headLen = generateSQLHead(tableName, tableSeq, pThreadInfo, superTblInfo, pstr); + headLen = generateSQLHead(tableName, tableSeq, pThreadInfo, + superTblInfo, pstr); } else { - headLen = snprintf(pstr, TSDB_TABLE_NAME_LEN, "%s.%s values", + headLen = snprintf(pstr, TSDB_TABLE_NAME_LEN, "%s.%s values", pThreadInfo->db_name, tableName); } // generate data buffer - verbosePrint("%s() LN%d i=%d buffer:\n%s\n", - __func__, __LINE__, i, buffer); + verbosePrint("[%d] %s() LN%d i=%d buffer:\n%s\n", + pThreadInfo->threadID, __func__, __LINE__, i, buffer); pstr += headLen; int dataLen = 0; - printf("%s() LN%d i=%d batchPerTblTimes=%d batchPerTbl = %d\n", - __func__, __LINE__, i, batchPerTblTimes, batchPerTbl); - int numOfRecGenerated = generateDataTail( - tableName, tableSeq, pThreadInfo, superTblInfo, - batchPerTbl, pstr, insertRows, 0, - startTime + pThreadInfo->totalInsertRows * superTblInfo->timeStampStep, - &(pThreadInfo->samplePos), &dataLen); - verbosePrint("%s() LN%d numOfRecGenerated= %d\n", - __func__, __LINE__, numOfRecGenerated); + debugPrint("[%d] %s() LN%d i=%d batchPerTblTimes=%d batchPerTbl = %d\n", + pThreadInfo->threadID, __func__, __LINE__, + i, batchPerTblTimes, batchPerTbl); + generateDataTail( + tableName, tableSeq, pThreadInfo, superTblInfo, + batchPerTbl, pstr, insertRows, 0, + startTime + sleepTimeTotal + + pThreadInfo->totalInsertRows * superTblInfo->timeStampStep, + &(pThreadInfo->samplePos), &dataLen); pstr += dataLen; - recGenerated += numOfRecGenerated; + recOfBatch += batchPerTbl; + pThreadInfo->totalInsertRows += batchPerTbl; + debugPrint("[%d] %s() LN%d batchPerTbl=%d recOfBatch=%d\n", + pThreadInfo->threadID, __func__, __LINE__, + batchPerTbl, recOfBatch); tableSeq ++; if (insertMode == INTERLACE_INSERT_MODE) { if (tableSeq == pThreadInfo->start_table_from + pThreadInfo->ntables) { // turn to first table tableSeq = pThreadInfo->start_table_from; - generatedRecPerTbl += numOfRecGenerated; + generatedRecPerTbl += batchPerTbl; + flagSleep = true; + if (generatedRecPerTbl >= insertRows) + break; + + if (pThreadInfo->ntables * batchPerTbl < g_args.num_of_RPR) + break; } } int remainRows = insertRows - generatedRecPerTbl; - if (batchPerTbl > remainRows) + if ((remainRows > 0) && (batchPerTbl > remainRows)) batchPerTbl = remainRows; - if ((g_args.num_of_RPR - recGenerated) < batchPerTbl) + debugPrint("[%d] %s() LN%d generatedRecPerTbl=%d insertRows=%"PRId64"\n", + pThreadInfo->threadID, __func__, __LINE__, + generatedRecPerTbl, insertRows); + + if ((g_args.num_of_RPR - recOfBatch) < batchPerTbl) break; } - pThreadInfo->totalInsertRows += recGenerated; - printf("%s() LN%d recGenerated=%d totalInsertRows=%"PRId64" buffer:\n%s\n", - __func__, __LINE__, recGenerated, - pThreadInfo->totalInsertRows, buffer); - int affectedRows = execInsert(pThreadInfo, buffer, recGenerated); - if (affectedRows < 0) + debugPrint("[%d] %s() LN%d recOfBatch=%d totalInsertRows=%"PRId64"\n", + pThreadInfo->threadID, __func__, __LINE__, recOfBatch, + pThreadInfo->totalInsertRows); + verbosePrint("[%d] %s() LN%d, buffer=%s\n", + pThreadInfo->threadID, __func__, __LINE__, buffer); + + int affectedRows = execInsert(pThreadInfo, buffer, recOfBatch); + verbosePrint("[%d] %s() LN%d affectedRows=%d\n", pThreadInfo->threadID, + __func__, __LINE__, affectedRows); + if (affectedRows < 0) { + errorPrint("[%d] %s() LN%d execInsert affected rows: %d\n%s\n", + pThreadInfo->threadID, __func__, __LINE__, + affectedRows, buffer); goto free_and_statistics_interlace; + } pThreadInfo->totalAffectedRows += affectedRows; @@ -4539,15 +4577,16 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { lastPrintTime = currentPrintTime; } - if (insert_interval) { - et = taosGetTimestampUs(); + if ((insert_interval) && flagSleep) { + et = taosGetTimestampUs(); - if (insert_interval > ((et - st)/1000) ) { - int sleep_time = insert_interval - (et -st)/1000; - verbosePrint("%s() LN%d sleep: %d ms for insert interval\n", - __func__, __LINE__, sleep_time); - taosMsleep(sleep_time); // ms - } + if (insert_interval > ((et - st)/1000) ) { + int sleepTime = insert_interval - (et -st)/1000; +// verbosePrint("%s() LN%d sleep: %d ms for insert interval\n", +// __func__, __LINE__, sleepTime); + taosMsleep(sleepTime); // ms + sleepTimeTotal += insert_interval; + } } } @@ -4570,12 +4609,13 @@ free_and_statistics_interlace: 2 taosinsertdata , 1 thread: 10 tables * 20000 rows/s */ static void* syncWriteProgressive(threadInfo *pThreadInfo) { + debugPrint("%s() LN%d: ### progressive write\n", __func__, __LINE__); SSuperTable* superTblInfo = pThreadInfo->superTblInfo; char* buffer = calloc(superTblInfo?superTblInfo->maxSqlLen:g_args.max_sql_len, 1); if (NULL == buffer) { - fprintf(stderr, "Failed to alloc %d Bytes, reason:%s\n", + errorPrint( "Failed to alloc %d Bytes, reason:%s\n", superTblInfo?superTblInfo->maxSqlLen:g_args.max_sql_len, strerror(errno)); return NULL; @@ -4821,7 +4861,7 @@ static void startMultiThreadInsertData(int threads, char* db_name, } else if (0 == strncasecmp(precision, "us", 2)) { timePrec = TSDB_TIME_PRECISION_MICRO; } else { - fprintf(stderr, "No support precision: %s\n", precision); + errorPrint( "No support precision: %s\n", precision); exit(-1); } } @@ -4831,15 +4871,15 @@ static void startMultiThreadInsertData(int threads, char* db_name, if (0 == strncasecmp(superTblInfo->startTimestamp, "now", 3)) { start_time = taosGetTimestamp(timePrec); } else { - if (TSDB_CODE_SUCCESS != taosParseTime( - superTblInfo->startTimestamp, - &start_time, - strlen(superTblInfo->startTimestamp), - timePrec, 0)) { - fprintf(stderr, "ERROR to parse time!\n"); - exit(-1); - } - } + if (TSDB_CODE_SUCCESS != taosParseTime( + superTblInfo->startTimestamp, + &start_time, + strlen(superTblInfo->startTimestamp), + timePrec, 0)) { + errorPrint("%s() LN%d, failed to parse time!\n", __func__, __LINE__); + exit(-1); + } + } } else { start_time = 1500000000000; } @@ -4857,7 +4897,7 @@ static void startMultiThreadInsertData(int threads, char* db_name, if ((superTblInfo) && (0 == strncasecmp(superTblInfo->dataSource, "sample", strlen("sample")))) { if (0 != prepareSampleDataForSTable(superTblInfo)) { - fprintf(stderr, "prepare sample data for stable failed!\n"); + errorPrint("%s() LN%d, prepare sample data for stable failed!\n", __func__, __LINE__); exit(-1); } } @@ -4869,15 +4909,15 @@ static void startMultiThreadInsertData(int threads, char* db_name, g_Dbs.host, g_Dbs.user, g_Dbs.password, db_name, g_Dbs.port); if (NULL == taos) { - fprintf(stderr, "connect to server fail , reason: %s\n", - taos_errstr(NULL)); + errorPrint("%s() LN%d, connect to server fail , reason: %s\n", + __func__, __LINE__, taos_errstr(NULL)); exit(-1); } superTblInfo->childTblName = (char*)calloc(1, superTblInfo->childTblLimit * TSDB_TABLE_NAME_LEN); if (superTblInfo->childTblName == NULL) { - fprintf(stderr, "alloc memory failed!"); + errorPrint("%s() LN%d, alloc memory failed!\n", __func__, __LINE__); taos_close(taos); exit(-1); } @@ -4896,7 +4936,7 @@ static void startMultiThreadInsertData(int threads, char* db_name, if ((superTblInfo) && (0 == strncasecmp(superTblInfo->dataSource, "sample", strlen("sample")))) { if (0 != prepareSampleDataForSTable(superTblInfo)) { - fprintf(stderr, "prepare sample data for stable failed!\n"); + errorPrint("%s() LN%d, prepare sample data for stable failed!\n", __func__, __LINE__); exit(-1); } } @@ -4906,8 +4946,8 @@ static void startMultiThreadInsertData(int threads, char* db_name, g_Dbs.host, g_Dbs.user, g_Dbs.password, db_name, g_Dbs.port); if (NULL == taos) { - fprintf(stderr, "connect to server fail , reason: %s\n", - taos_errstr(NULL)); + errorPrint("%s() LN%d, connect to server fail , reason: %s\n", + __func__, __LINE__, taos_errstr(NULL)); exit(-1); } @@ -4926,7 +4966,7 @@ static void startMultiThreadInsertData(int threads, char* db_name, superTblInfo->childTblName = (char*)calloc(1, limit * TSDB_TABLE_NAME_LEN); if (superTblInfo->childTblName == NULL) { - fprintf(stderr, "alloc memory failed!"); + errorPrint("%s() LN%d, alloc memory failed!\n", __func__, __LINE__); taos_close(taos); exit(-1); } @@ -4957,7 +4997,7 @@ static void startMultiThreadInsertData(int threads, char* db_name, g_Dbs.host, g_Dbs.user, g_Dbs.password, db_name, g_Dbs.port); if (NULL == t_info->taos) { - fprintf(stderr, "connect to server fail from insert sub thread, reason: %s\n", + errorPrint( "connect to server fail from insert sub thread, reason: %s\n", taos_errstr(NULL)); exit(-1); } @@ -5001,6 +5041,10 @@ static void startMultiThreadInsertData(int threads, char* db_name, tsem_destroy(&(t_info->lock_sem)); taos_close(t_info->taos); + debugPrint("%s() LN%d, [%d] totalInsert=%"PRId64" totalAffected=%"PRId64"\n", + __func__, __LINE__, + t_info->threadID, t_info->totalInsertRows, + t_info->totalAffectedRows); if (superTblInfo) { superTblInfo->totalAffectedRows += t_info->totalAffectedRows; superTblInfo->totalInsertRows += t_info->totalInsertRows; @@ -5068,7 +5112,7 @@ void *readTable(void *sarg) { char *tb_prefix = rinfo->tb_prefix; FILE *fp = fopen(rinfo->fp, "a"); if (NULL == fp) { - fprintf(stderr, "fopen %s fail, reason:%s.\n", rinfo->fp, strerror(errno)); + errorPrint( "fopen %s fail, reason:%s.\n", rinfo->fp, strerror(errno)); return NULL; } @@ -5102,7 +5146,7 @@ void *readTable(void *sarg) { int32_t code = taos_errno(pSql); if (code != 0) { - fprintf(stderr, "Failed to query:%s\n", taos_errstr(pSql)); + errorPrint( "Failed to query:%s\n", taos_errstr(pSql)); taos_free_result(pSql); taos_close(taos); fclose(fp); @@ -5178,7 +5222,7 @@ void *readMetric(void *sarg) { int32_t code = taos_errno(pSql); if (code != 0) { - fprintf(stderr, "Failed to query:%s\n", taos_errstr(pSql)); + errorPrint( "Failed to query:%s\n", taos_errstr(pSql)); taos_free_result(pSql); taos_close(taos); fclose(fp); @@ -5216,7 +5260,7 @@ static int insertTestProcess() { debugPrint("%d result file: %s\n", __LINE__, g_Dbs.resultFile); g_fpOfInsertResult = fopen(g_Dbs.resultFile, "a"); if (NULL == g_fpOfInsertResult) { - fprintf(stderr, "Failed to open %s for save result\n", g_Dbs.resultFile); + errorPrint( "Failed to open %s for save result\n", g_Dbs.resultFile); return -1; } @@ -5407,7 +5451,7 @@ static int queryTestProcess() { NULL, g_queryInfo.port); if (taos == NULL) { - fprintf(stderr, "Failed to connect to TDengine, reason:%s\n", taos_errstr(NULL)); + errorPrint( "Failed to connect to TDengine, reason:%s\n", taos_errstr(NULL)); exit(-1); } @@ -5707,7 +5751,7 @@ static int subscribeTestProcess() { g_queryInfo.dbName, g_queryInfo.port); if (taos == NULL) { - fprintf(stderr, "Failed to connect to TDengine, reason:%s\n", taos_errstr(NULL)); + errorPrint( "Failed to connect to TDengine, reason:%s\n", taos_errstr(NULL)); exit(-1); } @@ -6065,7 +6109,7 @@ static void queryResult() { g_Dbs.db[0].dbName, g_Dbs.port); if (rInfo->taos == NULL) { - fprintf(stderr, "Failed to connect to TDengine, reason:%s\n", taos_errstr(NULL)); + errorPrint( "Failed to connect to TDengine, reason:%s\n", taos_errstr(NULL)); free(rInfo); exit(-1); } From 9e257230780a2f8406ef0c978e0ef5da6bc21e36 Mon Sep 17 00:00:00 2001 From: Ping Xiao Date: Thu, 18 Mar 2021 17:48:33 +0800 Subject: [PATCH 34/52] remove last_cache.py from full test --- tests/pytest/fulltest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index 46a1abf12c..d6849dea7d 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -275,7 +275,7 @@ python3 ./test.py -f functions/function_twa.py -r 1 python3 ./test.py -f functions/function_twa_test2.py python3 ./test.py -f functions/function_stddev_td2555.py python3 ./test.py -f insert/metadataUpdate.py -python3 ./test.py -f query/last_cache.py +#python3 ./test.py -f query/last_cache.py python3 ./test.py -f query/last_row_cache.py python3 ./test.py -f account/account_create.py python3 ./test.py -f alter/alter_table.py From 9122ca3b1d4b91ec939572b8cb9d75423ea378ca Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 18 Mar 2021 09:56:04 +0000 Subject: [PATCH 35/52] TD-3367 --- src/vnode/src/vnodeMain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vnode/src/vnodeMain.c b/src/vnode/src/vnodeMain.c index d25cf10774..ded39e67cc 100644 --- a/src/vnode/src/vnodeMain.c +++ b/src/vnode/src/vnodeMain.c @@ -147,7 +147,7 @@ static int32_t vnodeAlterImp(SVnodeObj *pVnode, SCreateVnodeMsg *pVnodeCfg) { vDebug("vgId:%d, tsdbchanged:%d syncchanged:%d while alter vnode", pVnode->vgId, tsdbCfgChanged, syncCfgChanged); - if (tsdbCfgChanged || syncCfgChanged) { + if (/*tsdbCfgChanged || */syncCfgChanged) { // vnode in non-ready state and still needs to return success instead of TSDB_CODE_VND_INVALID_STATUS // dbCfgVersion can be corrected by status msg if (!vnodeSetUpdatingStatus(pVnode)) { From a9ea81aaee54415406307b398c643c29533d333c Mon Sep 17 00:00:00 2001 From: Ping Xiao Date: Thu, 18 Mar 2021 18:13:44 +0800 Subject: [PATCH 36/52] update docker cluster script --- tests/pytest/cluster/clusterEnvSetup/basic.py | 39 +++++++++++----- .../clusterEnvSetup/buildClusterEnv.sh | 45 ++++++++++--------- .../clusterEnvSetup/cleanClusterEnv.sh | 39 ++++++++++++++++ 3 files changed, 92 insertions(+), 31 deletions(-) create mode 100755 tests/pytest/cluster/clusterEnvSetup/cleanClusterEnv.sh diff --git a/tests/pytest/cluster/clusterEnvSetup/basic.py b/tests/pytest/cluster/clusterEnvSetup/basic.py index d9b8e9ce4a..eb39051898 100644 --- a/tests/pytest/cluster/clusterEnvSetup/basic.py +++ b/tests/pytest/cluster/clusterEnvSetup/basic.py @@ -18,13 +18,15 @@ import argparse class BuildDockerCluser: - def __init__(self, hostName, user, password, configDir, numOfNodes, clusterVersion): + def __init__(self, hostName, user, password, configDir, numOfNodes, clusterVersion, dockerDir, removeFlag): self.hostName = hostName self.user = user self.password = password self.configDir = configDir self.numOfNodes = numOfNodes - self.clusterVersion = clusterVersion + self.clusterVersion = clusterVersion + self.dockerDir = dockerDir + self.removeFlag = removeFlag def getConnection(self): self.conn = taos.connect( @@ -42,14 +44,17 @@ class BuildDockerCluser: print("start arbitrator") os.system("docker exec -d $(docker ps|grep tdnode1|awk '{print $1}') tarbitrator") - def run(self): + def run(self): if self.numOfNodes < 2 or self.numOfNodes > 5: print("the number of nodes must be between 2 and 5") - exit(0) - os.system("./buildClusterEnv.sh -n %d -v %s" % (self.numOfNodes, self.clusterVersion)) + exit(0) + print("remove Flag value %s" % self.removeFlag) + if self.removeFlag == False: + os.system("./cleanClusterEnv.sh -d %s" % self.dockerDir) + os.system("./buildClusterEnv.sh -n %d -v %s -d %s" % (self.numOfNodes, self.clusterVersion, self.dockerDir)) self.getConnection() self.createDondes() - self.startArbitrator() + self.startArbitrator() parser = argparse.ArgumentParser() parser.add_argument( @@ -91,10 +96,24 @@ parser.add_argument( '-v', '--version', action='store', - default='2.0.14.1', + default='2.0.17.1', type=str, - help='the version of the cluster to be build, Default is 2.0.14.1') + help='the version of the cluster to be build, Default is 2.0.17.1') +parser.add_argument( + '-d', + '--docker-dir', + action='store', + default='/data', + type=str, + help='the data dir for docker, default is /data') +parser.add_argument( + '--flag', + action='store_true', + help='remove docker containers flag, default: True') args = parser.parse_args() -cluster = BuildDockerCluser(args.host, args.user, args.password, args.config_dir, args.num_of_nodes, args.version) -cluster.run() \ No newline at end of file +cluster = BuildDockerCluser(args.host, args.user, args.password, args.config_dir, args.num_of_nodes, args.version, args.docker_dir, args.flag) +cluster.run() + +# usage 1: python3 basic.py -n 2 --flag (flag is True) +# usage 2: python3 basic.py -n 2 (flag should be False when it is not specified) \ No newline at end of file diff --git a/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh b/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh index 968cdd1c1c..992ed8b8fb 100755 --- a/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh +++ b/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh @@ -1,18 +1,19 @@ #!/bin/bash echo "Executing buildClusterEnv.sh" -DOCKER_DIR=/data CURR_DIR=`pwd` -if [ $# != 4 ]; then +if [ $# != 6 ]; then echo "argument list need input : " echo " -n numOfNodes" - echo " -v version" + echo " -v version" + echo " -d docker dir" exit 1 fi NUM_OF_NODES= VERSION= -while getopts "n:v:" arg +DOCKER_DIR= +while getopts "n:v:d:" arg do case $arg in n) @@ -20,6 +21,9 @@ do ;; v) VERSION=$OPTARG + ;; + d) + DOCKER_DIR=$OPTARG ;; ?) echo "unkonwn argument" @@ -31,29 +35,28 @@ function addTaoscfg { for i in {1..5} do touch /data/node$i/cfg/taos.cfg - echo 'firstEp tdnode1:6030' > /data/node$i/cfg/taos.cfg - echo 'fqdn tdnode'$i >> /data/node$i/cfg/taos.cfg - echo 'arbitrator tdnode1:6042' >> /data/node$i/cfg/taos.cfg + echo 'firstEp tdnode1:6030' > $DOCKER_DIR/node$i/cfg/taos.cfg + echo 'fqdn tdnode'$i >> $DOCKER_DIR/node$i/cfg/taos.cfg + echo 'arbitrator tdnode1:6042' >> $DOCKER_DIR/node$i/cfg/taos.cfg done } function createDIR { for i in {1..5} do - mkdir -p /data/node$i/data - mkdir -p /data/node$i/log - mkdir -p /data/node$i/cfg - mkdir -p /data/node$i/core + mkdir -p $DOCKER_DIR/node$i/data + mkdir -p $DOCKER_DIR/node$i/log + mkdir -p $DOCKER_DIR/node$i/cfg + mkdir -p $DOCKER_DIR/node$i/core done } -function cleanEnv { +function cleanEnv { + echo "Clean up docker environment" for i in {1..5} - do - echo /data/node$i/data/* - rm -rf /data/node$i/data/* - echo /data/node$i/log/* - rm -rf /data/node$i/log/* + do + rm -rf $DOCKER_DIR/node$i/data/* + rm -rf $DOCKER_DIR/node$i/log/* done } @@ -98,19 +101,19 @@ function clusterUp { if [ $NUM_OF_NODES -eq 2 ]; then echo "create 2 dnodes" - PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION docker-compose up -d + PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz TARBITRATORPKG=TDengine-arbitrator-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION docker-compose up -d fi if [ $NUM_OF_NODES -eq 3 ]; then - PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION docker-compose -f docker-compose.yml -f node3.yml up -d + PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz TARBITRATORPKG=TDengine-arbitrator-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION docker-compose -f docker-compose.yml -f node3.yml up -d fi if [ $NUM_OF_NODES -eq 4 ]; then - PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION docker-compose -f docker-compose.yml -f node3.yml -f node4.yml up -d + PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz TARBITRATORPKG=TDengine-arbitrator-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION docker-compose -f docker-compose.yml -f node3.yml -f node4.yml up -d fi if [ $NUM_OF_NODES -eq 5 ]; then - PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION docker-compose -f docker-compose.yml -f node3.yml -f node4.yml -f node5.yml up -d + PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz TARBITRATORPKG=TDengine-arbitrator-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION docker-compose -f docker-compose.yml -f node3.yml -f node4.yml -f node5.yml up -d fi echo "docker compose finish" diff --git a/tests/pytest/cluster/clusterEnvSetup/cleanClusterEnv.sh b/tests/pytest/cluster/clusterEnvSetup/cleanClusterEnv.sh new file mode 100755 index 0000000000..006db3f4eb --- /dev/null +++ b/tests/pytest/cluster/clusterEnvSetup/cleanClusterEnv.sh @@ -0,0 +1,39 @@ +#!/bin/bash +echo "Executing cleanClusterEnv.sh" +CURR_DIR=`pwd` + +if [ $# != 2 ]; then + echo "argument list need input : " + echo " -d docker dir" + exit 1 +fi + +DOCKER_DIR= +while getopts "d:" arg +do + case $arg in + d) + DOCKER_DIR=$OPTARG + ;; + ?) + echo "unkonwn argument" + ;; + esac +done + +function removeDockerContainers { + cd $DOCKER_DIR + docker-compose down --remove-orphans +} + +function cleanEnv { + echo "Clean up docker environment" + for i in {1..5} + do + rm -rf $DOCKER_DIR/node$i/data/* + rm -rf $DOCKER_DIR/node$i/log/* + done +} + +removeDockerContainers +cleanEnv \ No newline at end of file From 388887efaa6245f8435cfbc03f3cb24bc976b9d7 Mon Sep 17 00:00:00 2001 From: Elias Soong Date: Thu, 18 Mar 2021 18:20:59 +0800 Subject: [PATCH 37/52] [TD-2354] : need reboot to take effect when alter CACHELAST option. --- documentation20/cn/12.taos-sql/docs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation20/cn/12.taos-sql/docs.md b/documentation20/cn/12.taos-sql/docs.md index 02352357e1..2248b11987 100644 --- a/documentation20/cn/12.taos-sql/docs.md +++ b/documentation20/cn/12.taos-sql/docs.md @@ -125,7 +125,7 @@ TDengine缺省的时间戳是毫秒精度,但通过修改配置参数enableMic ```mysql ALTER DATABASE db_name CACHELAST 0; ``` - CACHELAST 参数控制是否在内存中缓存数据子表的 last_row。缺省值为 0,取值范围 [0, 1]。其中 0 表示不启用、1 表示启用。(从 2.0.11 版本开始支持) + CACHELAST 参数控制是否在内存中缓存数据子表的 last_row。缺省值为 0,取值范围 [0, 1]。其中 0 表示不启用、1 表示启用。(从 2.0.11 版本开始支持,修改后需要重启服务器生效。) **Tips**: 以上所有参数修改后都可以用show databases来确认是否修改成功。 From e9ff56e37fd509b05181a441c71ac4adfebe7928 Mon Sep 17 00:00:00 2001 From: tomchon Date: Thu, 18 Mar 2021 18:54:36 +0800 Subject: [PATCH 38/52] [TD-2943] --- packaging/tools/remove.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/tools/remove.sh b/packaging/tools/remove.sh index 2f2660d446..e63889aff1 100755 --- a/packaging/tools/remove.sh +++ b/packaging/tools/remove.sh @@ -213,10 +213,10 @@ fi if echo $osinfo | grep -qwi "ubuntu" ; then # echo "this is ubuntu system" - ${csudo} rm -f /var/lib/dpkg/info/tdengine* || : + ${csudo} dpkg --force-all -P tdengine || : elif echo $osinfo | grep -qwi "debian" ; then # echo "this is debian system" - ${csudo} rm -f /var/lib/dpkg/info/tdengine* || : + ${csudo} dpkg --force-all -P tdengine || : elif echo $osinfo | grep -qwi "centos" ; then # echo "this is centos system" ${csudo} rpm -e --noscripts tdengine || : From 624a9191ceeb49afe68eb7bf90d522d4d6d5027b Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Thu, 18 Mar 2021 19:17:19 +0800 Subject: [PATCH 39/52] [TD-3357] : fix child table count if exists. (#5488) Co-authored-by: Shuduo Sang --- src/kit/taosdemo/taosdemo.c | 81 ++++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 36 deletions(-) diff --git a/src/kit/taosdemo/taosdemo.c b/src/kit/taosdemo/taosdemo.c index 355f738885..46f9a52afe 100644 --- a/src/kit/taosdemo/taosdemo.c +++ b/src/kit/taosdemo/taosdemo.c @@ -101,8 +101,8 @@ typedef enum CREATE_SUB_TALBE_MOD_EN { } CREATE_SUB_TALBE_MOD_EN; typedef enum TALBE_EXISTS_EN { - TBL_ALREADY_EXISTS, TBL_NO_EXISTS, + TBL_ALREADY_EXISTS, TBL_EXISTS_BUTT } TALBE_EXISTS_EN; @@ -2401,8 +2401,11 @@ static int createDatabases() { &g_Dbs.db[i].superTbls[j], g_Dbs.use_metric); } else { g_Dbs.db[i].superTbls[j].superTblExists = TBL_ALREADY_EXISTS; - ret = getSuperTableFromServer(taos, g_Dbs.db[i].dbName, + + if (g_Dbs.db[i].superTbls[j].childTblExists != TBL_ALREADY_EXISTS) { + ret = getSuperTableFromServer(taos, g_Dbs.db[i].dbName, &g_Dbs.db[i].superTbls[j]); + } } if (0 != ret) { @@ -2794,9 +2797,10 @@ void readSampleFromFileToMem(SSuperTable * supterTblInfo) { } } */ -static bool getColumnAndTagTypeFromInsertJsonFile(cJSON* stbInfo, SSuperTable* superTbls) { +static bool getColumnAndTagTypeFromInsertJsonFile( + cJSON* stbInfo, SSuperTable* superTbls) { bool ret = false; - + // columns cJSON *columns = cJSON_GetObjectItem(stbInfo, "columns"); if (columns && columns->type != cJSON_Array) { @@ -2807,7 +2811,7 @@ static bool getColumnAndTagTypeFromInsertJsonFile(cJSON* stbInfo, SSuperTable* s superTbls->tagCount = 0; return true; } - + int columnSize = cJSON_GetArraySize(columns); if (columnSize > MAX_COLUMN_COUNT) { errorPrint("%s() LN%d, failed to read json, column size overflow, max column size is %d\n", @@ -2819,7 +2823,7 @@ static bool getColumnAndTagTypeFromInsertJsonFile(cJSON* stbInfo, SSuperTable* s int index = 0; StrColumn columnCase; - //superTbls->columnCount = columnSize; + //superTbls->columnCount = columnSize; for (int k = 0; k < columnSize; ++k) { cJSON* column = cJSON_GetArrayItem(columns, k); if (column == NULL) continue; @@ -2827,7 +2831,7 @@ static bool getColumnAndTagTypeFromInsertJsonFile(cJSON* stbInfo, SSuperTable* s count = 1; cJSON* countObj = cJSON_GetObjectItem(column, "count"); if (countObj && countObj->type == cJSON_Number) { - count = countObj->valueint; + count = countObj->valueint; } else if (countObj && countObj->type != cJSON_Number) { errorPrint("%s() LN%d, failed to read json, column count not found\n", __func__, __LINE__); goto PARSE_OVER; @@ -2844,25 +2848,26 @@ static bool getColumnAndTagTypeFromInsertJsonFile(cJSON* stbInfo, SSuperTable* s } //tstrncpy(superTbls->columns[k].dataType, dataType->valuestring, MAX_TB_NAME_SIZE); tstrncpy(columnCase.dataType, dataType->valuestring, MAX_TB_NAME_SIZE); - + cJSON* dataLen = cJSON_GetObjectItem(column, "len"); if (dataLen && dataLen->type == cJSON_Number) { - columnCase.dataLen = dataLen->valueint; + columnCase.dataLen = dataLen->valueint; } else if (dataLen && dataLen->type != cJSON_Number) { debugPrint("%s() LN%d: failed to read json, column len not found\n", __func__, __LINE__); goto PARSE_OVER; } else { columnCase.dataLen = 8; } - + for (int n = 0; n < count; ++n) { - tstrncpy(superTbls->columns[index].dataType, columnCase.dataType, MAX_TB_NAME_SIZE); - superTbls->columns[index].dataLen = columnCase.dataLen; + tstrncpy(superTbls->columns[index].dataType, + columnCase.dataType, MAX_TB_NAME_SIZE); + superTbls->columns[index].dataLen = columnCase.dataLen; index++; } - } - superTbls->columnCount = index; - + } + superTbls->columnCount = index; + count = 1; index = 0; // tags @@ -2877,16 +2882,16 @@ static bool getColumnAndTagTypeFromInsertJsonFile(cJSON* stbInfo, SSuperTable* s debugPrint("%s() LN%d, failed to read json, tags size overflow, max tag size is %d\n", __func__, __LINE__, MAX_TAG_COUNT); goto PARSE_OVER; } - - //superTbls->tagCount = tagSize; + + //superTbls->tagCount = tagSize; for (int k = 0; k < tagSize; ++k) { cJSON* tag = cJSON_GetArrayItem(tags, k); if (tag == NULL) continue; - + count = 1; cJSON* countObj = cJSON_GetObjectItem(tag, "count"); if (countObj && countObj->type == cJSON_Number) { - count = countObj->valueint; + count = countObj->valueint; } else if (countObj && countObj->type != cJSON_Number) { printf("ERROR: failed to read json, column count not found\n"); goto PARSE_OVER; @@ -2902,23 +2907,23 @@ static bool getColumnAndTagTypeFromInsertJsonFile(cJSON* stbInfo, SSuperTable* s goto PARSE_OVER; } tstrncpy(columnCase.dataType, dataType->valuestring, MAX_TB_NAME_SIZE); - + cJSON* dataLen = cJSON_GetObjectItem(tag, "len"); if (dataLen && dataLen->type == cJSON_Number) { - columnCase.dataLen = dataLen->valueint; + columnCase.dataLen = dataLen->valueint; } else if (dataLen && dataLen->type != cJSON_Number) { printf("ERROR: failed to read json, column len not found\n"); goto PARSE_OVER; } else { columnCase.dataLen = 0; - } - + } + for (int n = 0; n < count; ++n) { tstrncpy(superTbls->tags[index].dataType, columnCase.dataType, MAX_TB_NAME_SIZE); - superTbls->tags[index].dataLen = columnCase.dataLen; + superTbls->tags[index].dataLen = columnCase.dataLen; index++; } - } + } superTbls->tagCount = index; ret = true; @@ -3103,8 +3108,10 @@ static bool getMetaFromInsertJsonFile(cJSON* root) { } cJSON *precision = cJSON_GetObjectItem(dbinfo, "precision"); - if (precision && precision->type == cJSON_String && precision->valuestring != NULL) { - tstrncpy(g_Dbs.db[i].dbCfg.precision, precision->valuestring, MAX_DB_NAME_SIZE); + if (precision && precision->type == cJSON_String + && precision->valuestring != NULL) { + tstrncpy(g_Dbs.db[i].dbCfg.precision, precision->valuestring, + MAX_DB_NAME_SIZE); } else if (!precision) { //tstrncpy(g_Dbs.db[i].dbCfg.precision, "ms", MAX_DB_NAME_SIZE); memset(g_Dbs.db[i].dbCfg.precision, 0, MAX_DB_NAME_SIZE); @@ -3330,13 +3337,13 @@ static bool getMetaFromInsertJsonFile(cJSON* root) { } else if (!childTblExists) { g_Dbs.db[i].superTbls[j].childTblExists = TBL_NO_EXISTS; } else { - printf("ERROR: failed to read json, child_table_exists not found\n"); + errorPrint("%s() LN%d, failed to read json, child_table_exists not found\n", __func__, __LINE__); goto PARSE_OVER; } cJSON* count = cJSON_GetObjectItem(stbInfo, "childtable_count"); if (!count || count->type != cJSON_Number || 0 >= count->valueint) { - printf("ERROR: failed to read json, childtable_count not found\n"); + errorPrint("%s() LN%d, failed to read json, childtable_count not found\n", __func__, __LINE__); goto PARSE_OVER; } g_Dbs.db[i].superTbls[j].childTblCount = count->valueint; @@ -3349,7 +3356,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) { } else if (!dataSource) { tstrncpy(g_Dbs.db[i].superTbls[j].dataSource, "rand", MAX_DB_NAME_SIZE); } else { - printf("ERROR: failed to read json, data_source not found\n"); + errorPrint("%s() LN%d, failed to read json, data_source not found\n", __func__, __LINE__); goto PARSE_OVER; } @@ -3546,12 +3553,14 @@ static bool getMetaFromInsertJsonFile(cJSON* root) { goto PARSE_OVER; } - if (NO_CREATE_SUBTBL == g_Dbs.db[i].superTbls[j].autoCreateTable +/* CBD if (NO_CREATE_SUBTBL == g_Dbs.db[i].superTbls[j].autoCreateTable || (TBL_ALREADY_EXISTS == g_Dbs.db[i].superTbls[j].childTblExists)) { continue; } + */ - int retVal = getColumnAndTagTypeFromInsertJsonFile(stbInfo, &g_Dbs.db[i].superTbls[j]); + int retVal = getColumnAndTagTypeFromInsertJsonFile( + stbInfo, &g_Dbs.db[i].superTbls[j]); if (false == retVal) { goto PARSE_OVER; } @@ -4500,7 +4509,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { pstr += headLen; int dataLen = 0; - debugPrint("[%d] %s() LN%d i=%d batchPerTblTimes=%d batchPerTbl = %d\n", + verbosePrint("[%d] %s() LN%d i=%d batchPerTblTimes=%d batchPerTbl = %d\n", pThreadInfo->threadID, __func__, __LINE__, i, batchPerTblTimes, batchPerTbl); generateDataTail( @@ -4512,7 +4521,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { pstr += dataLen; recOfBatch += batchPerTbl; pThreadInfo->totalInsertRows += batchPerTbl; - debugPrint("[%d] %s() LN%d batchPerTbl=%d recOfBatch=%d\n", + verbosePrint("[%d] %s() LN%d batchPerTbl=%d recOfBatch=%d\n", pThreadInfo->threadID, __func__, __LINE__, batchPerTbl, recOfBatch); @@ -4535,7 +4544,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { if ((remainRows > 0) && (batchPerTbl > remainRows)) batchPerTbl = remainRows; - debugPrint("[%d] %s() LN%d generatedRecPerTbl=%d insertRows=%"PRId64"\n", + verbosePrint("[%d] %s() LN%d generatedRecPerTbl=%d insertRows=%"PRId64"\n", pThreadInfo->threadID, __func__, __LINE__, generatedRecPerTbl, insertRows); @@ -4543,7 +4552,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { break; } - debugPrint("[%d] %s() LN%d recOfBatch=%d totalInsertRows=%"PRId64"\n", + verbosePrint("[%d] %s() LN%d recOfBatch=%d totalInsertRows=%"PRId64"\n", pThreadInfo->threadID, __func__, __LINE__, recOfBatch, pThreadInfo->totalInsertRows); verbosePrint("[%d] %s() LN%d, buffer=%s\n", From d8f1b34f5664fcfb4bec08b2ac18a46ea7057e02 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Thu, 18 Mar 2021 21:33:52 +0800 Subject: [PATCH 40/52] [TD-3356] : fix bug regarding limit offset with exist child table. (#5495) Co-authored-by: Shuduo Sang --- src/kit/taosdemo/taosdemo.c | 54 +++++++++---------------------------- 1 file changed, 13 insertions(+), 41 deletions(-) diff --git a/src/kit/taosdemo/taosdemo.c b/src/kit/taosdemo/taosdemo.c index 46f9a52afe..2647d32ef5 100644 --- a/src/kit/taosdemo/taosdemo.c +++ b/src/kit/taosdemo/taosdemo.c @@ -2044,7 +2044,8 @@ static int getChildNameOfSuperTableWithLimitAndOffset(TAOS * taos, //printf("==== sub table name: %s\n", pTblName); count++; if (count >= childTblCount - 1) { - char *tmp = realloc(childTblName, (size_t)childTblCount*1.5*TSDB_TABLE_NAME_LEN+1); + char *tmp = realloc(childTblName, + (size_t)childTblCount*1.5*TSDB_TABLE_NAME_LEN+1); if (tmp != NULL) { childTblName = tmp; childTblCount = (int)(childTblCount*1.5); @@ -2052,14 +2053,15 @@ static int getChildNameOfSuperTableWithLimitAndOffset(TAOS * taos, (size_t)((childTblCount-count)*TSDB_TABLE_NAME_LEN)); } else { // exit, if allocate more memory failed - printf("realloc fail for save child table name of %s.%s\n", dbName, sTblName); + errorPrint("%s() LN%d, realloc fail for save child table name of %s.%s\n", + __func__, __LINE__, dbName, sTblName); tmfree(childTblName); taos_free_result(res); taos_close(taos); exit(-1); } } - pTblName = childTblName + count * TSDB_TABLE_NAME_LEN; + pTblName = childTblName + count * TSDB_TABLE_NAME_LEN; } *childTblCountOfSuperTbl = count; @@ -2140,6 +2142,7 @@ static int getSuperTableFromServer(TAOS * taos, char* dbName, calcRowLen(superTbls); +/* if (TBL_ALREADY_EXISTS == superTbls->childTblExists) { //get all child table name use cmd: select tbname from superTblName; int childTblCount = 10000; @@ -2153,6 +2156,7 @@ static int getSuperTableFromServer(TAOS * taos, char* dbName, &superTbls->childTblName, &superTbls->childTblCount); } + */ return 0; } @@ -4356,7 +4360,7 @@ static int generateSQLHead(char *tableName, int32_t tableSeq, threadInfo* pThrea superTblInfo->maxSqlLen, "insert into %s.%s values", pThreadInfo->db_name, - superTblInfo->childTblName + tableSeq * TSDB_TABLE_NAME_LEN); + tableName); } else { len = snprintf(buffer, (superTblInfo?superTblInfo->maxSqlLen:g_args.max_sql_len), @@ -4561,10 +4565,10 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { int affectedRows = execInsert(pThreadInfo, buffer, recOfBatch); verbosePrint("[%d] %s() LN%d affectedRows=%d\n", pThreadInfo->threadID, __func__, __LINE__, affectedRows); - if (affectedRows < 0) { - errorPrint("[%d] %s() LN%d execInsert affected rows: %d\n%s\n", + if ((affectedRows < 0) || (recOfBatch != affectedRows)) { + errorPrint("[%d] %s() LN%d execInsert insert %d, affected rows: %d\n%s\n", pThreadInfo->threadID, __func__, __LINE__, - affectedRows, buffer); + recOfBatch, affectedRows, buffer); goto free_and_statistics_interlace; } @@ -4885,10 +4889,9 @@ static void startMultiThreadInsertData(int threads, char* db_name, &start_time, strlen(superTblInfo->startTimestamp), timePrec, 0)) { - errorPrint("%s() LN%d, failed to parse time!\n", __func__, __LINE__); - exit(-1); + ERROR_EXIT("failed to parse time!\n"); } - } + } } else { start_time = 1500000000000; } @@ -4911,36 +4914,6 @@ static void startMultiThreadInsertData(int threads, char* db_name, } } - if (superTblInfo && (superTblInfo->childTblOffset >= 0) - && (superTblInfo->childTblLimit > 0)) { - - TAOS* taos = taos_connect( - g_Dbs.host, g_Dbs.user, - g_Dbs.password, db_name, g_Dbs.port); - if (NULL == taos) { - errorPrint("%s() LN%d, connect to server fail , reason: %s\n", - __func__, __LINE__, taos_errstr(NULL)); - exit(-1); - } - - superTblInfo->childTblName = (char*)calloc(1, - superTblInfo->childTblLimit * TSDB_TABLE_NAME_LEN); - if (superTblInfo->childTblName == NULL) { - errorPrint("%s() LN%d, alloc memory failed!\n", __func__, __LINE__); - taos_close(taos); - exit(-1); - } - int childTblCount; - - getChildNameOfSuperTableWithLimitAndOffset( - taos, - db_name, superTblInfo->sTblName, - &superTblInfo->childTblName, &childTblCount, - superTblInfo->childTblLimit, - superTblInfo->childTblOffset); - taos_close(taos); - } - // read sample data from file first if ((superTblInfo) && (0 == strncasecmp(superTblInfo->dataSource, "sample", strlen("sample")))) { @@ -4950,7 +4923,6 @@ static void startMultiThreadInsertData(int threads, char* db_name, } } - TAOS* taos = taos_connect( g_Dbs.host, g_Dbs.user, g_Dbs.password, db_name, g_Dbs.port); From bee74151bbb4151193dee3add5519dc96689513b Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 18 Mar 2021 22:31:27 +0800 Subject: [PATCH 41/52] fix compile error --- src/util/src/tsocket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/src/tsocket.c b/src/util/src/tsocket.c index 8911b7e8ee..b33cdb8b80 100644 --- a/src/util/src/tsocket.c +++ b/src/util/src/tsocket.c @@ -485,7 +485,7 @@ int64_t taosCopyFds(SOCKET sfd, int32_t dfd, int64_t len) { return -1; } - writeLen = taosWriteMsg(dfd, temp, readLen); + writeLen = taosWriteMsg(dfd, temp, (int32_t)readLen); if (readLen != writeLen) { uError("copy error, readLen:%" PRId64 " writeLen:%" PRId64 " len:%" PRId64 " leftLen:%" PRId64 ", reason:%s", From 153a489e129935592527131ae48b61e3b78a5732 Mon Sep 17 00:00:00 2001 From: Ping Xiao Date: Fri, 19 Mar 2021 09:38:34 +0800 Subject: [PATCH 42/52] [TD-3365]: add test case for query filter on tag type --- tests/pytest/query/filter.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/tests/pytest/query/filter.py b/tests/pytest/query/filter.py index f107985f15..ceaca993b1 100644 --- a/tests/pytest/query/filter.py +++ b/tests/pytest/query/filter.py @@ -28,18 +28,18 @@ class TDTestCase: print("==============step1") tdSql.execute( - "create table if not exists st (ts timestamp, tagtype int, name nchar(16)) tags(dev nchar(50))") + "create table if not exists st (ts timestamp, tagtype int, name nchar(16), col4 binary(16)) tags(dev nchar(50), tag2 binary(16))") tdSql.execute( - 'CREATE TABLE if not exists dev_001 using st tags("dev_01")') + 'CREATE TABLE if not exists dev_001 using st tags("dev_01", "tag_01")') tdSql.execute( - 'CREATE TABLE if not exists dev_002 using st tags("dev_02")') + 'CREATE TABLE if not exists dev_002 using st tags("dev_02", "tag_02")') print("==============step2") tdSql.execute( - """INSERT INTO dev_001(ts, tagtype, name) VALUES('2020-05-13 10:00:00.000', 1, 'first'),('2020-05-13 10:00:00.001', 2, 'second'), - ('2020-05-13 10:00:00.002', 3, 'third') dev_002 VALUES('2020-05-13 10:00:00.003', 1, 'first'), ('2020-05-13 10:00:00.004', 2, 'second'), - ('2020-05-13 10:00:00.005', 3, 'third')""") + """INSERT INTO dev_001 VALUES('2020-05-13 10:00:00.000', 1, 'first', 'binary1'),('2020-05-13 10:00:00.001', 2, 'second', 'binary2'), + ('2020-05-13 10:00:00.002', 3, 'third' , 'binary3') dev_002 VALUES('2020-05-13 10:00:00.003', 1, 'first', 'binary4'), ('2020-05-13 10:00:00.004', 2, 'second', 'binary5'), + ('2020-05-13 10:00:00.005', 3, 'third', 'binary6')""") # > for timestamp type tdSql.query("select * from db.st where ts > '2020-05-13 10:00:00.002'") @@ -85,6 +85,9 @@ class TDTestCase: tdSql.query("select * from db.st where name = 'first'") tdSql.checkRows(2) + tdSql.error("select * from db.st where col1 = 1231231") + tdSql.error("select * from db.st where name = 1231231") + # <> for timestamp type tdSql.query("select * from db.st where ts <> '2020-05-13 10:00:00.002'") # tdSql.checkRows(4) @@ -105,6 +108,10 @@ class TDTestCase: tdSql.query("select * from db.st where name like '_econd'") tdSql.checkRows(2) + # for tag + tdSql.error("select * from db.st where dev=1") + tdSql.error("select * from db.st where tag2=1") + def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__) From 5586c23906338f800881f3c524e594ad9a5c05e6 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 19 Mar 2021 10:07:27 +0800 Subject: [PATCH 43/52] [td-3361]: fix crash caused by nchar type filter. --- src/client/src/tscSQLParser.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 3b65d0625f..ab13251c64 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -3092,18 +3092,26 @@ static int32_t doExtractColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, } int32_t retVal = TSDB_CODE_SUCCESS; + + int32_t bufLen = 0; + if (IS_NUMERIC_TYPE(pRight->value.nType)) { + bufLen = 60; + } else { + bufLen = pRight->value.nLen + 1; + } + if (pExpr->tokenId == TK_LE || pExpr->tokenId == TK_LT) { retVal = tVariantDump(&pRight->value, (char*)&pColumnFilter->upperBndd, colType, false); // TK_GT,TK_GE,TK_EQ,TK_NE are based on the pColumn->lowerBndd } else if (colType == TSDB_DATA_TYPE_BINARY) { - pColumnFilter->pz = (int64_t)calloc(1, pRight->value.nLen + TSDB_NCHAR_SIZE); + pColumnFilter->pz = (int64_t)calloc(1, bufLen * TSDB_NCHAR_SIZE); pColumnFilter->len = pRight->value.nLen; retVal = tVariantDump(&pRight->value, (char*)pColumnFilter->pz, colType, false); } else if (colType == TSDB_DATA_TYPE_NCHAR) { // pRight->value.nLen + 1 is larger than the actual nchar string length - pColumnFilter->pz = (int64_t)calloc(1, (pRight->value.nLen + 1) * TSDB_NCHAR_SIZE); + pColumnFilter->pz = (int64_t)calloc(1, bufLen * TSDB_NCHAR_SIZE); retVal = tVariantDump(&pRight->value, (char*)pColumnFilter->pz, colType, false); size_t len = twcslen((wchar_t*)pColumnFilter->pz); pColumnFilter->len = len * TSDB_NCHAR_SIZE; From 22698b8db09bba18d2cd97048f3fd84edbbe10b1 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 19 Mar 2021 10:51:55 +0800 Subject: [PATCH 44/52] [td-225]update the output column index. --- src/client/src/tscSQLParser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index ab13251c64..b724ee5750 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -2223,7 +2223,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col bool multiColOutput = taosArrayGetSize(pItem->pNode->pParam) > 1; setResultColName(name, pItem, cvtFunc.originFuncId, &pParamElem->pNode->colInfo, multiColOutput); - if (setExprInfoForFunctions(pCmd, pQueryInfo, pSchema, cvtFunc, name, colIndex + i, &index, finalResult) != 0) { + if (setExprInfoForFunctions(pCmd, pQueryInfo, pSchema, cvtFunc, name, colIndex++, &index, finalResult) != 0) { return TSDB_CODE_TSC_INVALID_SQL; } } From ae73ff2074736bc0ef95232f37699588cede955a Mon Sep 17 00:00:00 2001 From: Ping Xiao Date: Fri, 19 Mar 2021 11:12:06 +0800 Subject: [PATCH 45/52] update docker cluster script --- .../clusterEnvSetup/buildClusterEnv.sh | 10 +++++----- .../clusterEnvSetup/docker-compose.yml | 20 ++++++++++--------- .../pytest/cluster/clusterEnvSetup/node3.yml | 11 +++++----- .../pytest/cluster/clusterEnvSetup/node4.yml | 15 +++++++------- .../pytest/cluster/clusterEnvSetup/node5.yml | 11 +++++----- 5 files changed, 36 insertions(+), 31 deletions(-) diff --git a/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh b/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh index 992ed8b8fb..f6199649cd 100755 --- a/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh +++ b/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh @@ -34,7 +34,7 @@ done function addTaoscfg { for i in {1..5} do - touch /data/node$i/cfg/taos.cfg + touch $DOCKER_DIR/node$i/cfg/taos.cfg echo 'firstEp tdnode1:6030' > $DOCKER_DIR/node$i/cfg/taos.cfg echo 'fqdn tdnode'$i >> $DOCKER_DIR/node$i/cfg/taos.cfg echo 'arbitrator tdnode1:6042' >> $DOCKER_DIR/node$i/cfg/taos.cfg @@ -101,19 +101,19 @@ function clusterUp { if [ $NUM_OF_NODES -eq 2 ]; then echo "create 2 dnodes" - PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz TARBITRATORPKG=TDengine-arbitrator-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION docker-compose up -d + PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz TARBITRATORPKG=TDengine-arbitrator-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION DATADIR=$DOCKER_DIR docker-compose up -d fi if [ $NUM_OF_NODES -eq 3 ]; then - PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz TARBITRATORPKG=TDengine-arbitrator-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION docker-compose -f docker-compose.yml -f node3.yml up -d + PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz TARBITRATORPKG=TDengine-arbitrator-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION DATADIR=$DOCKER_DIR docker-compose -f docker-compose.yml -f node3.yml up -d fi if [ $NUM_OF_NODES -eq 4 ]; then - PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz TARBITRATORPKG=TDengine-arbitrator-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION docker-compose -f docker-compose.yml -f node3.yml -f node4.yml up -d + PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz TARBITRATORPKG=TDengine-arbitrator-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION DATADIR=$DOCKER_DIR docker-compose -f docker-compose.yml -f node3.yml -f node4.yml up -d fi if [ $NUM_OF_NODES -eq 5 ]; then - PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz TARBITRATORPKG=TDengine-arbitrator-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION docker-compose -f docker-compose.yml -f node3.yml -f node4.yml -f node5.yml up -d + PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz TARBITRATORPKG=TDengine-arbitrator-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION DATADIR=$DOCKER_DIR docker-compose -f docker-compose.yml -f node3.yml -f node4.yml -f node5.yml up -d fi echo "docker compose finish" diff --git a/tests/pytest/cluster/clusterEnvSetup/docker-compose.yml b/tests/pytest/cluster/clusterEnvSetup/docker-compose.yml index cb35abd9a1..80cd859cdf 100644 --- a/tests/pytest/cluster/clusterEnvSetup/docker-compose.yml +++ b/tests/pytest/cluster/clusterEnvSetup/docker-compose.yml @@ -9,6 +9,7 @@ services: - TARBITRATORPKG=${TARBITRATORPKG} - EXTRACTDIR=${DIR} - EXTRACTDIR2=${DIR2} + - DATADIR=${DATADIR} image: 'tdengine:${VERSION}' container_name: 'tdnode1' cap_add: @@ -32,19 +33,19 @@ services: volumes: # bind data directory - type: bind - source: /data/node1/data + source: ${DATADIR}/node1/data target: /var/lib/taos # bind log directory - type: bind - source: /data/node1/log + source: ${DATADIR}/node1/log target: /var/log/taos # bind configuration - type: bind - source: /data/node1/cfg + source: ${DATADIR}/node1/cfg target: /etc/taos # bind core dump path - type: bind - source: /data/node1/core + source: ${DATADIR}/node1/core target: /coredump - type: bind source: /data @@ -61,6 +62,7 @@ services: args: - PACKAGE=${PACKAGE} - EXTRACTDIR=${DIR} + - DATADIR=${DATADIR} image: 'tdengine:${VERSION}' container_name: 'tdnode2' cap_add: @@ -84,22 +86,22 @@ services: volumes: # bind data directory - type: bind - source: /data/node2/data + source: ${DATADIR}/node2/data target: /var/lib/taos # bind log directory - type: bind - source: /data/node2/log + source: ${DATADIR}/node2/log target: /var/log/taos # bind configuration - type: bind - source: /data/node2/cfg + source: ${DATADIR}/node2/cfg target: /etc/taos # bind core dump path - type: bind - source: /data/node2/core + source: ${DATADIR}/node2/core target: /coredump - type: bind - source: /data + source: ${DATADIR} target: /root hostname: tdnode2 networks: diff --git a/tests/pytest/cluster/clusterEnvSetup/node3.yml b/tests/pytest/cluster/clusterEnvSetup/node3.yml index 4f4f3a6f99..93044d24af 100644 --- a/tests/pytest/cluster/clusterEnvSetup/node3.yml +++ b/tests/pytest/cluster/clusterEnvSetup/node3.yml @@ -7,6 +7,7 @@ services: args: - PACKAGE=${PACKAGE} - EXTRACTDIR=${DIR} + - DATADIR=${DATADIR} image: 'tdengine:${VERSION}' container_name: 'tdnode3' cap_add: @@ -30,22 +31,22 @@ services: volumes: # bind data directory - type: bind - source: /data/node3/data + source: ${DATADIR}/node3/data target: /var/lib/taos # bind log directory - type: bind - source: /data/node3/log + source: ${DATADIR}/node3/log target: /var/log/taos # bind configuration - type: bind - source: /data/node3/cfg + source: ${DATADIR}/node3/cfg target: /etc/taos # bind core dump path - type: bind - source: /data/node3/core + source: ${DATADIR}/node3/core target: /coredump - type: bind - source: /data + source: ${DATADIR} target: /root hostname: tdnode3 networks: diff --git a/tests/pytest/cluster/clusterEnvSetup/node4.yml b/tests/pytest/cluster/clusterEnvSetup/node4.yml index c82a174cb8..1fc603b3b5 100644 --- a/tests/pytest/cluster/clusterEnvSetup/node4.yml +++ b/tests/pytest/cluster/clusterEnvSetup/node4.yml @@ -7,6 +7,7 @@ services: args: - PACKAGE=${PACKAGE} - EXTRACTDIR=${DIR} + - DATADIR=${DATADIR} image: 'tdengine:${VERSION}' container_name: 'tdnode4' cap_add: @@ -30,23 +31,23 @@ services: volumes: # bind data directory - type: bind - source: /data/node4/data + source: ${DATADIR}/node4/data target: /var/lib/taos # bind log directory - type: bind - source: /data/node4/log + source: ${DATADIR}/node4/log target: /var/log/taos # bind configuration - type: bind - source: /data/node4/cfg + source: ${DATADIR}/node4/cfg target: /etc/taos - # bind core dump path + # bind core dump path - type: bind - source: /data/node4/core + source: ${DATADIR}/node4/core target: /coredump - type: bind - source: /data - target: /root + source: ${DATADIR} + target: /root hostname: tdnode4 networks: taos_update_net: diff --git a/tests/pytest/cluster/clusterEnvSetup/node5.yml b/tests/pytest/cluster/clusterEnvSetup/node5.yml index 2e37e47512..5e3aba3b76 100644 --- a/tests/pytest/cluster/clusterEnvSetup/node5.yml +++ b/tests/pytest/cluster/clusterEnvSetup/node5.yml @@ -7,6 +7,7 @@ services: args: - PACKAGE=${PACKAGE} - EXTRACTDIR=${DIR} + - DATADIR=${DATADIR} image: 'tdengine:${VERSION}' container_name: 'tdnode5' cap_add: @@ -30,22 +31,22 @@ services: volumes: # bind data directory - type: bind - source: /data/node5/data + source: ${DATADIR}/node5/data target: /var/lib/taos # bind log directory - type: bind - source: /data/node5/log + source: ${DATADIR}/node5/log target: /var/log/taos # bind configuration - type: bind - source: /data/node5/cfg + source: ${DATADIR}/node5/cfg target: /etc/taos # bind core dump path - type: bind - source: /data/node5/core + source: ${DATADIR}/node5/core target: /coredump - type: bind - source: /data + source: ${DATADIR} target: /root hostname: tdnode5 networks: From d5bacb71c604c3e1754dcfc58dc50ca5c2180c1a Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Fri, 19 Mar 2021 11:51:13 +0800 Subject: [PATCH 46/52] [TD-3369] : fix taosdemo invalid write valgrind reports. (#5496) --- src/kit/taosdemo/taosdemo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kit/taosdemo/taosdemo.c b/src/kit/taosdemo/taosdemo.c index 2647d32ef5..13926e0712 100644 --- a/src/kit/taosdemo/taosdemo.c +++ b/src/kit/taosdemo/taosdemo.c @@ -997,7 +997,7 @@ void rand_string(char *str, int size) { if (size > 0) { //--size; int n; - for (n = 0; n < size; n++) { + for (n = 0; n < size - 1; n++) { int key = rand_tinyint() % (int)(sizeof(charset) - 1); str[n] = charset[key]; } From e9ea8814ecdab7611d26a381a1398ab38bd14c39 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 19 Mar 2021 05:30:31 +0000 Subject: [PATCH 47/52] TD-3372 --- src/inc/tp.h | 2 +- src/mnode/src/mnodeDb.c | 2 +- src/vnode/inc/vnodeInt.h | 2 +- src/vnode/src/vnodeWrite.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/inc/tp.h b/src/inc/tp.h index b0b787bf68..1d6570898e 100644 --- a/src/inc/tp.h +++ b/src/inc/tp.h @@ -22,7 +22,7 @@ extern "C" { int32_t tpInit(); void tpCleanUp(); -void tpUpdateTs(int32_t *seq, void *pMsg); +void tpUpdateTs(int32_t vgId, int64_t *seq, void *pMsg); #ifdef __cplusplus } diff --git a/src/mnode/src/mnodeDb.c b/src/mnode/src/mnodeDb.c index fcc88db740..b1c88ca718 100644 --- a/src/mnode/src/mnodeDb.c +++ b/src/mnode/src/mnodeDb.c @@ -55,7 +55,7 @@ int32_t mnodeProcessAlterDbMsg(SMnodeMsg *pMsg); #ifndef _TOPIC int32_t tpInit() { return 0; } void tpCleanUp() {} -void tpUpdateTs(int32_t *seq, void *pMsg) {} +void tpUpdateTs(int32_t vgId, int64_t *seq, void *pMsg) {} #endif static void mnodeDestroyDb(SDbObj *pDb) { diff --git a/src/vnode/inc/vnodeInt.h b/src/vnode/inc/vnodeInt.h index 91ddf5076b..4aa07196a7 100644 --- a/src/vnode/inc/vnodeInt.h +++ b/src/vnode/inc/vnodeInt.h @@ -40,7 +40,7 @@ typedef struct { int32_t queuedWMsg; int32_t queuedRMsg; int32_t flowctrlLevel; - int32_t sequence; // for topic + int64_t sequence; // for topic int8_t status; int8_t role; int8_t accessState; diff --git a/src/vnode/src/vnodeWrite.c b/src/vnode/src/vnodeWrite.c index 4b2616c7aa..9e95288423 100644 --- a/src/vnode/src/vnodeWrite.c +++ b/src/vnode/src/vnodeWrite.c @@ -142,7 +142,7 @@ static int32_t vnodeProcessSubmitMsg(SVnodeObj *pVnode, void *pCont, SRspRet *pR vTrace("vgId:%d, submit msg is processed", pVnode->vgId); if (pVnode->dbType == TSDB_DB_TYPE_TOPIC && pVnode->role == TAOS_SYNC_ROLE_MASTER) { - tpUpdateTs(&pVnode->sequence, pCont); + tpUpdateTs(pVnode->vgId, &pVnode->sequence, pCont); } // save insert result into item From 4afccbd0a59cca682158059036b549560eef585c Mon Sep 17 00:00:00 2001 From: Ping Xiao Date: Fri, 19 Mar 2021 13:36:30 +0800 Subject: [PATCH 48/52] [TD-3365]: update test case --- tests/pytest/query/filter.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/pytest/query/filter.py b/tests/pytest/query/filter.py index ceaca993b1..6d2ffbc8b1 100644 --- a/tests/pytest/query/filter.py +++ b/tests/pytest/query/filter.py @@ -85,8 +85,11 @@ class TDTestCase: tdSql.query("select * from db.st where name = 'first'") tdSql.checkRows(2) - tdSql.error("select * from db.st where col1 = 1231231") - tdSql.error("select * from db.st where name = 1231231") + tdSql.query("select * from db.st where col4 = 1231231") + tdSql.checkRows(0) + + tdSql.query("select * from db.st where name = 1231231") + tdSql.checkRows(0) # <> for timestamp type tdSql.query("select * from db.st where ts <> '2020-05-13 10:00:00.002'") @@ -109,8 +112,11 @@ class TDTestCase: tdSql.checkRows(2) # for tag - tdSql.error("select * from db.st where dev=1") - tdSql.error("select * from db.st where tag2=1") + tdSql.query("select * from db.st where dev=1") + tdSql.checkRows(0) + + tdSql.query("select * from db.st where tag2=1") + tdSql.checkRows(0) def stop(self): tdSql.close() From b043c45dbf28290296167d1c59209e53eb01b8ba Mon Sep 17 00:00:00 2001 From: Xiaxin Li Date: Fri, 19 Mar 2021 14:39:05 +0800 Subject: [PATCH 49/52] Add README-CN.md add README-CN.md --- README-CN.md | 265 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 265 insertions(+) create mode 100644 README-CN.md diff --git a/README-CN.md b/README-CN.md new file mode 100644 index 0000000000..9e3d5d991f --- /dev/null +++ b/README-CN.md @@ -0,0 +1,265 @@ +[![Build Status](https://travis-ci.org/taosdata/TDengine.svg?branch=master)](https://travis-ci.org/taosdata/TDengine) +[![Build status](https://ci.appveyor.com/api/projects/status/kf3pwh2or5afsgl9/branch/master?svg=true)](https://ci.appveyor.com/project/sangshuduo/tdengine-2n8ge/branch/master) +[![Coverage Status](https://coveralls.io/repos/github/taosdata/TDengine/badge.svg?branch=develop)](https://coveralls.io/github/taosdata/TDengine?branch=develop) +[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/4201/badge)](https://bestpractices.coreinfrastructure.org/projects/4201) +[![tdengine](https://snapcraft.io//tdengine/badge.svg)](https://snapcraft.io/tdengine) + +[![TDengine](TDenginelogo.png)](https://www.taosdata.com) + +# TDengine 简介 + +TDengine是涛思数据专为物联网、车联网、工业互联网、IT运维等设计和优化的大数据平台。除核心的快10倍以上的时序数据库功能外,还提供缓存、数据订阅、流式计算等功能,最大程度减少研发和运维的复杂度,且核心代码,包括集群功能全部开源(开源协议,AGPL v3.0)。 + +- 10 倍以上性能提升。定义了创新的数据存储结构,单核每秒就能处理至少2万次请求,插入数百万个数据点,读出一千万以上数据点,比现有通用数据库快了十倍以上。 +- 硬件或云服务成本降至1/5。由于超强性能,计算资源不到通用大数据方案的1/5;通过列式存储和先进的压缩算法,存储空间不到通用数据库的1/10。 +- 全栈时序数据处理引擎。将数据库、消息队列、缓存、流式计算等功能融合一起,应用无需再集成Kafka/Redis/HBase/Spark等软件,大幅降低应用开发和维护成本。 +- 强大的分析功能。无论是十年前还是一秒钟前的数据,指定时间范围即可查询。数据可在时间轴上或多个设备上进行聚合。即席查询可通过Shell/Python/R/Matlab随时进行。 +- 与第三方工具无缝连接。不用一行代码,即可与Telegraf, Grafana, EMQ X, Prometheus, Matlab, R集成。后续还将支持MQTT, OPC, Hadoop,Spark等, BI工具也将无缝连接。 +- 零运维成本、零学习成本。安装、集群一秒搞定,无需分库分表,实时备份。标准SQL,支持JDBC,RESTful,支持Python/Java/C/C++/Go/Node.JS, 与MySQL相似,零学习成本。 + +# 文档 + +TDengine是一个高效的存储、查询、分析时序大数据的平台,专为物联网、车联网、工业互联网、运维监测等优化而设计。您可以像使用关系型数据库MySQL一样来使用它,但建议您在使用前仔细阅读一遍下面的文档,特别是 [数据模型](https://www.taosdata.com/cn/documentation/architecture) 与 [数据建模](https://www.taosdata.com/cn/documentation/model)。除本文档之外,欢迎 [下载产品白皮书](https://www.taosdata.com/downloads/TDengine White Paper.pdf)。 + +# 生成 + +TDengine目前2.0版服务器仅能在Linux系统上安装和运行,后续会支持Windows、macOS等系统。客户端可以在Windows或Linux上安装和运行。任何OS的应用也可以选择RESTful接口连接服务器taosd。CPU支持X64/ARM64/MIPS64/Alpha64,后续会支持ARM32、RISC-V等CPU架构。用户可根据需求选择通过[源码](https://www.taosdata.com/cn/getting-started/#通过源码安装)或者[安装包](https://www.taosdata.com/cn/getting-started/#通过安装包安装)来安装。本快速指南仅适用于通过源码安装。 + +## 安装工具 + +### Ubuntu 16.04 及以上版本 & Debian: + +```bash +sudo apt-get install -y gcc cmake build-essential git +``` + +### Ubuntu 14.04: + +```bash +sudo apt-get install -y gcc cmake3 build-essential git binutils-2.26 +export PATH=/usr/lib/binutils-2.26/bin:$PATH +``` + +编译或打包 JDBC 驱动源码,需安装 Java JDK 8 或以上版本和 Apache Maven 2.7 或以上版本。 + +安装 OpenJDK 8: + +```bash +sudo apt-get install -y openjdk-8-jdk +``` + +安装 Apache Maven: + +```bash +sudo apt-get install -y maven +``` + +### CentOS 7: + +```bash +sudo yum install -y gcc gcc-c++ make cmake git +``` + +安装 OpenJDK 8: + +```bash +sudo yum install -y java-1.8.0-openjdk +``` + +安装 Apache Maven: + +```bash +sudo yum install -y maven +``` + +### CentOS 8 & Fedora: + +```bash +sudo dnf install -y gcc gcc-c++ make cmake epel-release git +``` + +安装 OpenJDK 8: + +```bash +sudo dnf install -y java-1.8.0-openjdk +``` + +安装 Apache Maven: + +```bash +sudo dnf install -y maven +``` + +## 获取源码 + +首先,你需要从 GitHub 克隆源码: + +```bash +git clone https://github.com/taosdata/TDengine.git +cd TDengine +``` + +Go 连接器和 Grafana 插件在其他独立仓库,如果安装它们的话,需要在 TDengine 目录下通过此命令安装: + +```bash +git submodule update --init --recursive +``` + +## 生成 TDengine + +### Linux 系统 + +```bash +mkdir debug && cd debug +cmake .. && cmake --build . +``` + +在X86-64、X86、arm64 和 arm32 平台上,TDengine 生成脚本可以自动检测机器架构。也可以手动配置 CPUTYPE 参数来指定 CPU 类型,如 aarch64 或 aarch32 等。 + +aarch64: + +```bash +cmake .. -DCPUTYPE=aarch64 && cmake --build . +``` + +aarch32: + +```bash +cmake .. -DCPUTYPE=aarch32 && cmake --build . +``` + +### Windows 系统 + +如果你使用的是 Visual Studio 2013 版本: + +打开 cmd.exe,执行 vcvarsall.bat 时,为 64 位操作系统指定“x86_amd64”,为 32 位操作系统指定“x86”。 + +```bash +mkdir debug && cd debug +"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" < x86_amd64 | x86 > +cmake .. -G "NMake Makefiles" +nmake +``` + +如果你使用的是 Visual Studio 2019 或 2017 版本: + +打开cmd.exe,执行 vcvarsall.bat 时,为 64 位操作系统指定“x64”,为 32 位操作系统指定“x86”。 + +```bash +mkdir debug && cd debug +"c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" < x64 | x86 > +cmake .. -G "NMake Makefiles" +nmake +``` + +你也可以从开始菜单中找到"Visual Studio < 2019 | 2017 >"菜单项,根据你的系统选择"x64 Native Tools Command Prompt for VS < 2019 | 2017 >"或"x86 Native Tools Command Prompt for VS < 2019 | 2017 >",打开命令行窗口,执行: + +```bash +mkdir debug && cd debug +cmake .. -G "NMake Makefiles" +nmake +``` + +### Mac OS X 系统 + +安装 Xcode 命令行工具和 cmake. 在 Catalina 和 Big Sur 操作系统上,需要安装 XCode 11.4+ 版本。 + +```bash +mkdir debug && cd debug +cmake .. && cmake --build . +``` + +# 安装 + +如果你不想安装,可以直接在shell中运行。生成完成后,安装 TDengine: +```bash +make install +``` + +用户可以在[文件目录结构](https://www.taosdata.com/cn/documentation/administrator)中了解更多在操作系统中生成的目录或文件。 + +安装成功后,在终端中启动 TDengine 服务: + +```bash +taosd +``` + +用户可以使用 TDengine Shell 来连接 TDengine 服务,在终端中,输入: + +```bash +taos +``` + +如果 TDengine Shell 连接服务成功,将会打印出欢迎消息和版本信息。如果失败,则会打印出错误消息。 + +## 快速运行 + +TDengine 生成后,在终端执行以下命令: + +```bash +./build/bin/taosd -c test/cfg +``` + +在另一个终端,使用 TDengine shell 连接服务器: + +```bash +./build/bin/taos -c test/cfg +``` + +"-c test/cfg"指定系统配置文件所在目录。 + +# 体验 TDengine + +在TDengine终端中,用户可以通过SQL命令来创建/删除数据库、表等,并进行插入查询操作。 + +```bash +create database demo; +use demo; +create table t (ts timestamp, speed int); +insert into t values ('2019-07-15 00:00:00', 10); +insert into t values ('2019-07-15 01:00:00', 20); +select * from t; + ts | speed | +=================================== + 19-07-15 00:00:00.000| 10| + 19-07-15 01:00:00.000| 20| +Query OK, 2 row(s) in set (0.001700s) +``` + +# 应用开发 + +## 官方连接器 + +TDengine 提供了丰富的应用程序开发接口,其中包括C/C++、Java、Python、Go、Node.js、C# 、RESTful 等,便于用户快速开发应用: + +- Java + +- C/C++ + +- Python + +- Go + +- RESTful API + +- Node.js + +## 第三方连接器 + +TDengine 社区生态中也有一些非常友好的第三方连接器,可以通过以下链接访问它们的源码。 + +- [Rust Connector](https://github.com/taosdata/TDengine/tree/master/tests/examples/rust) +- [.Net Core Connector](https://github.com/maikebing/Maikebing.EntityFrameworkCore.Taos) +- [Lua Connector](https://github.com/taosdata/TDengine/tree/develop/tests/examples/lua) + +# 运行和添加测试例 + +TDengine 的测试框架和所有测试例全部开源。 + +点击[这里](tests/How-To-Run-Test-And-How-To-Add-New-Test-Case.md),了解如何运行测试例和添加新的测试例。 + +# 成为社区贡献者 +点击[这里](https://www.taosdata.com/cn/contributor/),了解如何成为 TDengine 的贡献者。 + +#加入技术交流群 +TDengine官方社群「物联网大数据群」对外开放,欢迎您加入讨论。搜索微信号 "tdengine",加小T为好友,即可入群。 \ No newline at end of file From edf8eb59324f80194deb87e7e4d61bbf3f0946dd Mon Sep 17 00:00:00 2001 From: Xiaxin Li Date: Fri, 19 Mar 2021 14:51:16 +0800 Subject: [PATCH 50/52] Update README.md Add the link to switch interface language to Chinese. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 97ac9dffeb..0749f3982e 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ [![TDengine](TDenginelogo.png)](https://www.taosdata.com) +English | [简体中文](./README-CN.md) + # What is TDengine? TDengine is an open-sourced big data platform under [GNU AGPL v3.0](http://www.gnu.org/licenses/agpl-3.0.html), designed and optimized for the Internet of Things (IoT), Connected Cars, Industrial IoT, and IT Infrastructure and Application Monitoring. Besides the 10x faster time-series database, it provides caching, stream computing, message queuing and other functionalities to reduce the complexity and cost of development and operation. From c2296f76b0b1df90838c9c0da4a8d19672687b34 Mon Sep 17 00:00:00 2001 From: Xiaxin Li Date: Fri, 19 Mar 2021 14:52:40 +0800 Subject: [PATCH 51/52] Update README-CN.md Add the link to switch interface language to English. --- README-CN.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README-CN.md b/README-CN.md index 9e3d5d991f..d8aa481311 100644 --- a/README-CN.md +++ b/README-CN.md @@ -6,6 +6,8 @@ [![TDengine](TDenginelogo.png)](https://www.taosdata.com) +简体中文 | [English](./README.md) + # TDengine 简介 TDengine是涛思数据专为物联网、车联网、工业互联网、IT运维等设计和优化的大数据平台。除核心的快10倍以上的时序数据库功能外,还提供缓存、数据订阅、流式计算等功能,最大程度减少研发和运维的复杂度,且核心代码,包括集群功能全部开源(开源协议,AGPL v3.0)。 @@ -262,4 +264,4 @@ TDengine 的测试框架和所有测试例全部开源。 点击[这里](https://www.taosdata.com/cn/contributor/),了解如何成为 TDengine 的贡献者。 #加入技术交流群 -TDengine官方社群「物联网大数据群」对外开放,欢迎您加入讨论。搜索微信号 "tdengine",加小T为好友,即可入群。 \ No newline at end of file +TDengine官方社群「物联网大数据群」对外开放,欢迎您加入讨论。搜索微信号 "tdengine",加小T为好友,即可入群。 From 46791d86e1b2f5e1739f80f19ceec71d0b5f84ef Mon Sep 17 00:00:00 2001 From: Elias Soong Date: Fri, 19 Mar 2021 14:52:47 +0800 Subject: [PATCH 52/52] [TD-2639] : fix link url detail. --- README-CN.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README-CN.md b/README-CN.md index 9e3d5d991f..f30e748f83 100644 --- a/README-CN.md +++ b/README-CN.md @@ -19,7 +19,7 @@ TDengine是涛思数据专为物联网、车联网、工业互联网、IT运维 # 文档 -TDengine是一个高效的存储、查询、分析时序大数据的平台,专为物联网、车联网、工业互联网、运维监测等优化而设计。您可以像使用关系型数据库MySQL一样来使用它,但建议您在使用前仔细阅读一遍下面的文档,特别是 [数据模型](https://www.taosdata.com/cn/documentation/architecture) 与 [数据建模](https://www.taosdata.com/cn/documentation/model)。除本文档之外,欢迎 [下载产品白皮书](https://www.taosdata.com/downloads/TDengine White Paper.pdf)。 +TDengine是一个高效的存储、查询、分析时序大数据的平台,专为物联网、车联网、工业互联网、运维监测等优化而设计。您可以像使用关系型数据库MySQL一样来使用它,但建议您在使用前仔细阅读一遍下面的文档,特别是 [数据模型](https://www.taosdata.com/cn/documentation/architecture) 与 [数据建模](https://www.taosdata.com/cn/documentation/model)。除本文档之外,欢迎 [下载产品白皮书](https://www.taosdata.com/downloads/TDengine%20White%20Paper.pdf)。 # 生成 @@ -176,7 +176,7 @@ cmake .. && cmake --build . make install ``` -用户可以在[文件目录结构](https://www.taosdata.com/cn/documentation/administrator)中了解更多在操作系统中生成的目录或文件。 +用户可以在[文件目录结构](https://www.taosdata.com/cn/documentation/administrator#directories)中了解更多在操作系统中生成的目录或文件。 安装成功后,在终端中启动 TDengine 服务: