diff --git a/.appveyor.yml b/.appveyor.yml index ee1dc91767da710bbc508801d88474a20eba60df..e7802b3d0d3cf969381b5fa2a99862b3df5aa05f 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,49 +1,49 @@ -version: 1.0.{build} -image: - - Visual Studio 2015 - - macos -environment: - matrix: - - ARCH: amd64 - - ARCH: x86 -matrix: - exclude: - - image: macos - ARCH: x86 -for: - - - matrix: - only: - - image: Visual Studio 2015 - clone_folder: c:\dev\TDengine - clone_depth: 1 - - init: - - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %ARCH% - - before_build: - - cd c:\dev\TDengine - - md build - - build_script: - - cd build - - cmake -G "NMake Makefiles" .. - - nmake install - - - matrix: - only: - - image: macos - clone_depth: 1 - - build_script: - - mkdir debug - - cd debug - - cmake .. > /dev/null - - make > /dev/null -notifications: -- provider: Email - to: - - sangshuduo@gmail.com - on_build_success: true - on_build_failure: true - on_build_status_changed: true +version: 1.0.{build} +image: + - Visual Studio 2015 + - macos +environment: + matrix: + - ARCH: amd64 + - ARCH: x86 +matrix: + exclude: + - image: macos + ARCH: x86 +for: + - + matrix: + only: + - image: Visual Studio 2015 + clone_folder: c:\dev\TDengine + clone_depth: 1 + + init: + - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %ARCH% + + before_build: + - cd c:\dev\TDengine + - md build + + build_script: + - cd build + - cmake -G "NMake Makefiles" .. -DBUILD_JDBC=false + - nmake install + - + matrix: + only: + - image: macos + clone_depth: 1 + + build_script: + - mkdir debug + - cd debug + - cmake .. > /dev/null + - make > /dev/null +notifications: +- provider: Email + to: + - sangshuduo@gmail.com + on_build_success: true + on_build_failure: true + on_build_status_changed: true diff --git a/cmake/env.inc b/cmake/env.inc index efcc9961767aec8555897e7a96fec91356017659..17ec6a535e4697b0ab3acbbb30b8c14bf328a8a2 100755 --- a/cmake/env.inc +++ b/cmake/env.inc @@ -14,11 +14,13 @@ MESSAGE(STATUS "Project binary files output path: " ${PROJECT_BINARY_DIR}) MESSAGE(STATUS "Project executable files output path: " ${EXECUTABLE_OUTPUT_PATH}) MESSAGE(STATUS "Project library files output path: " ${LIBRARY_OUTPUT_PATH}) -FIND_PROGRAM(TD_MVN_INSTALLED mvn) -IF (TD_MVN_INSTALLED) - MESSAGE(STATUS "MVN is installed and JDBC will be compiled") -ELSE () - MESSAGE(STATUS "MVN is not installed and JDBC is not compiled") +IF (TD_BUILD_JDBC) + FIND_PROGRAM(TD_MVN_INSTALLED mvn) + IF (TD_MVN_INSTALLED) + MESSAGE(STATUS "MVN is installed and JDBC will be compiled") + ELSE () + MESSAGE(STATUS "MVN is not installed and JDBC is not compiled") + ENDIF () ENDIF () # @@ -54,4 +56,4 @@ ELSE () SET(CMAKE_BUILD_TYPE "Debug") MESSAGE(STATUS "Build Debug Version as default") ENDIF() -ENDIF () \ No newline at end of file +ENDIF () diff --git a/cmake/input.inc b/cmake/input.inc index 00e0e1bc0f00fd8ba8e679f93d5f75e1b75e6bcd..5841a46567150608e354fdadd5f9b5658d88dcae 100755 --- a/cmake/input.inc +++ b/cmake/input.inc @@ -72,3 +72,9 @@ IF (${RANDOM_NETWORK_FAIL} MATCHES "true") SET(TD_RANDOM_NETWORK_FAIL TRUE) MESSAGE(STATUS "build with random-network-fail enabled") ENDIF () + +SET(TD_BUILD_JDBC TRUE) + +IF (${BUILD_JDBC} MATCHES "false") + SET(TD_BUILD_JDBC FALSE) +ENDIF () diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index fea966d94e7a3ed9aebbdce0fc8d50712663781e..363bb410858961975ce069b732ce2b7410a654cd 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -5648,11 +5648,17 @@ static int32_t setKeepOption(SSqlCmd* pCmd, SCreateDbMsg* pMsg, SCreateDbInfo* p tVariantListItem* p0 = taosArrayGet(pKeep, 0); switch (s) { case 1: { + if ((int32_t)p0->pVar.i64 <= 0) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg); + } pMsg->daysToKeep = htonl((int32_t)p0->pVar.i64); } break; case 2: { tVariantListItem* p1 = taosArrayGet(pKeep, 1); + if ((int32_t)p0->pVar.i64 <= 0 || (int32_t)p1->pVar.i64 <= 0) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg); + } pMsg->daysToKeep = htonl((int32_t)p0->pVar.i64); pMsg->daysToKeep1 = htonl((int32_t)p1->pVar.i64); break; @@ -5661,6 +5667,10 @@ static int32_t setKeepOption(SSqlCmd* pCmd, SCreateDbMsg* pMsg, SCreateDbInfo* p tVariantListItem* p1 = taosArrayGet(pKeep, 1); tVariantListItem* p2 = taosArrayGet(pKeep, 2); + if ((int32_t)p0->pVar.i64 <= 0 || (int32_t)p1->pVar.i64 <= 0 || (int32_t)p2->pVar.i64 <= 0) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg); + } + pMsg->daysToKeep = htonl((int32_t)p0->pVar.i64); pMsg->daysToKeep1 = htonl((int32_t)p1->pVar.i64); pMsg->daysToKeep2 = htonl((int32_t)p2->pVar.i64); diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index ed91695569695d9d2acaa586d6f3ad32104017f4..381d2804c1a2fa66cdef46232bdb9f2f05b2b6f1 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -817,6 +817,16 @@ static void doInitGlobalConfig(void) { cfg.unitType = TAOS_CFG_UTYPE_NONE; taosInitConfigOption(cfg); + cfg.option = "precision"; + cfg.ptr = &tsTimePrecision; + cfg.valType = TAOS_CFG_VTYPE_INT8; + cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW; + cfg.minValue = TSDB_MIN_PRECISION; + cfg.maxValue = TSDB_MAX_PRECISION; + cfg.ptrLength = 0; + cfg.unitType = TAOS_CFG_UTYPE_NONE; + taosInitConfigOption(cfg); + cfg.option = "comp"; cfg.ptr = &tsCompression; cfg.valType = TAOS_CFG_VTYPE_INT8; @@ -887,6 +897,16 @@ static void doInitGlobalConfig(void) { cfg.unitType = TAOS_CFG_UTYPE_NONE; taosInitConfigOption(cfg); + cfg.option = "cachelast"; + cfg.ptr = &tsCacheLastRow; + cfg.valType = TAOS_CFG_VTYPE_INT8; + cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW; + cfg.minValue = TSDB_MIN_DB_CACHE_LAST_ROW; + cfg.maxValue = TSDB_MAX_DB_CACHE_LAST_ROW; + cfg.ptrLength = 0; + cfg.unitType = TAOS_CFG_UTYPE_NONE; + taosInitConfigOption(cfg); + cfg.option = "mqttHostName"; cfg.ptr = tsMqttHostName; cfg.valType = TAOS_CFG_VTYPE_STRING; diff --git a/src/os/src/detail/osTime.c b/src/os/src/detail/osTime.c index 67e0c2642e42f66229c437e603f7062edf571f34..2956dd29ad77dd82f1ed3d161f7b26af310d7347 100644 --- a/src/os/src/detail/osTime.c +++ b/src/os/src/detail/osTime.c @@ -43,7 +43,7 @@ */ int64_t user_mktime64(const unsigned int year0, const unsigned int mon0, const unsigned int day, const unsigned int hour, - const unsigned int min, const unsigned int sec, int64_t timezone) + const unsigned int min, const unsigned int sec, int64_t time_zone) { unsigned int mon = mon0, year = year0; @@ -61,7 +61,7 @@ int64_t user_mktime64(const unsigned int year0, const unsigned int mon0, res = res*24; res = ((res + hour) * 60 + min) * 60 + sec; - return (res + timezone); + return (res + time_zone); } // ==== mktime() kernel code =================// diff --git a/tests/Jenkinsfile b/tests/Jenkinsfile index 74cbc352080822debb02d869bddb686c03089c36..a16b8fc1b655d5c8adb9b287d96fd1a03058ccab 100644 --- a/tests/Jenkinsfile +++ b/tests/Jenkinsfile @@ -29,8 +29,8 @@ pipeline { agent none environment{ - WK = '/var/lib/jenkins/workspace/TDinternal' - WKC= '/var/lib/jenkins/workspace/TDinternal/community' + WK = '/data/lib/jenkins/workspace/TDinternal' + WKC= '/data/lib/jenkins/workspace/TDinternal/community' } stages { diff --git a/tests/mas/Jenkinsfile b/tests/mas/Jenkinsfile index b2a1a5e1167844e777909cc9688186d85b90a707..0e6e94a037d3ba1a187e6bdad2070e9dc4d4a32f 100644 --- a/tests/mas/Jenkinsfile +++ b/tests/mas/Jenkinsfile @@ -29,8 +29,8 @@ pipeline { agent none environment{ - WK = '/var/lib/jenkins/workspace/TDinternal' - WKC= '/var/lib/jenkins/workspace/TDinternal/community' + WK = '/data/lib/jenkins/workspace/TDinternal' + WKC= '/data/lib/jenkins/workspace/TDinternal/community' } stages { diff --git a/tests/pytest/alter/alter_keep_exception.py b/tests/pytest/alter/alter_keep_exception.py new file mode 100644 index 0000000000000000000000000000000000000000..cddaaa55222785df81aa4c88b75733083d06be72 --- /dev/null +++ b/tests/pytest/alter/alter_keep_exception.py @@ -0,0 +1,44 @@ +################################################################### +# 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 -*- + +#TODO: after TD-4518 and TD-4510 is resolved, add the exception test case for these situations + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + tdSql.prepare() + + tdSql.error('alter database keep db 0') + tdSql.error('alter database keep db -10') + tdSql.error('alter database keep db -2147483648') + + #this is the test case problem for keep overflow + #the error is caught, but type is wrong. + #TODO: can be solved in the future, but improvement is minimal + tdSql.error('alter database keep db -2147483649') + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index 24ae0ad55766d22d11e556fa99e8b92f9028e5e9..7434d32b9de5eeaddcb4c1e3483612817bc2f0c3 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -333,4 +333,5 @@ python3 ./test.py -f tag_lite/alter_tag.py python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJson.py python3 test.py -f tools/taosdemoAllTest/taosdemoTestQueryWithJson.py python3 ./test.py -f tag_lite/drop_auto_create.py +python3 test.py -f alter/alter_keep_exception.py #======================p4-end=============== diff --git a/tests/pytest/functions/showOfflineThresholdIs864000.py b/tests/pytest/functions/showOfflineThresholdIs864000.py index 6cce869bf2144e37948c9eb6a3c9ca49352584ca..a7a1c2bf3f7d998b1ec0b0cd0e0747381e9bf4fa 100644 --- a/tests/pytest/functions/showOfflineThresholdIs864000.py +++ b/tests/pytest/functions/showOfflineThresholdIs864000.py @@ -25,7 +25,7 @@ class TDTestCase: def run(self): tdSql.query("show variables") - tdSql.checkData(51, 1, 864000) + tdSql.checkData(53, 1, 864000) def stop(self): tdSql.close() @@ -33,4 +33,4 @@ class TDTestCase: tdCases.addWindows(__file__, TDTestCase()) -tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/query/queryJoin.py b/tests/pytest/query/queryJoin.py index 59e01615b40d423f53e9b9b493d51277e15ff797..cd50a7bf452966306e6811e90802d9d160bfa68b 100644 --- a/tests/pytest/query/queryJoin.py +++ b/tests/pytest/query/queryJoin.py @@ -176,7 +176,15 @@ class TDTestCase: tdSql.error("select count(join_mt0.c1), first(join_mt0.c1), first(join_mt1.c9) from join_mt0, join_mt1 where join_mt0.t1=join_mt1.t1 and join_mt0.ts=join_mt1.ts interval(10a) group by join_mt0.t1, join_mt0.t2 order by join_mt0.t1 desc slimit 3") tdSql.error("select count(join_mt0.c1), first(join_mt0.c1) from join_mt0, join_mt1 where join_mt0.t1=join_mt1.t1 and join_mt0.ts=join_mt1.ts interval(10a) group by join_mt0.t1, join_mt0.t2, join_mt1.t1 order by join_mt0.ts desc, join_mt1.ts asc limit 10;") tdSql.error("select join_mt1.c1,join_mt0.c1 from join_mt1,join_mt0 where join_mt1.ts = join_mt0.ts and join_mt1.t1 = join_mt0.t1 order by t") - + #TD-4458 join on database which using precision us + tdSql.execute("create database test_join_us precision 'us'") + tdSql.execute("use test_join_us") + ts = 1538548685000000 + for i in range(2): + tdSql.execute("create table t%d (ts timestamp, i int)"%i) + tdSql.execute("insert into t%d values(%d,11)(%d,12)"%(i,ts,ts+1)) + tdSql.query("select t1.ts from t0,t1 where t0.ts = t1.ts") + tdSql.checkData(0,0,'2018-10-03 14:38:05.000000') def stop(self): tdSql.close() diff --git a/tests/script/general/db/alter_option.sim b/tests/script/general/db/alter_option.sim index 170ba21c28b7ff4a79a8f2375dc1d36ba91e6120..c3bb23855fceb877c1ed39c01524231d27edb4f4 100644 --- a/tests/script/general/db/alter_option.sim +++ b/tests/script/general/db/alter_option.sim @@ -129,8 +129,8 @@ sql alter database db keep 20 sql_error alter database db keep 10 sql_error alter database db keep 9 sql_error alter database db keep 1 -sql alter database db keep 0 -sql alter database db keep -1 +sql_error alter database db keep 0 +sql_error alter database db keep -1 sql_error alter database db keep 365001 print ============== step cache diff --git a/tests/script/general/db/topic1.sim b/tests/script/general/db/topic1.sim index 42613405afda7580003f58ae82f950880d60de62..2b4cce5e64bf7076eeb2f0f0e3c1dfbaa224b116 100644 --- a/tests/script/general/db/topic1.sim +++ b/tests/script/general/db/topic1.sim @@ -385,8 +385,8 @@ sql alter database db keep 20 sql_error alter database db keep 10 sql_error alter database db keep 9 sql_error alter database db keep 1 -sql alter database db keep 0 -sql alter database db keep -1 +sql_error alter database db keep 0 +sql_error alter database db keep -1 sql_error alter database db keep 365001 sql_error alter topic db keep 40 diff --git a/tests/test-all.sh b/tests/test-all.sh index 47e5de6aa0bd9821f6c30ba0dce6c03952f0a8a6..6e7963e787ca8a3593418be1af31bdbca58d6fd3 100755 --- a/tests/test-all.sh +++ b/tests/test-all.sh @@ -233,6 +233,10 @@ totalExampleFailed=0 if [ "${OS}" == "Linux" ]; then corepath=`grep -oP '.*(?=core_)' /proc/sys/kernel/core_pattern||grep -oP '.*(?=core-)' /proc/sys/kernel/core_pattern` + if [ -z "$corepath" ];then + echo "/coredump/core_%e_%p_%t" > /proc/sys/kernel/core_pattern || echo "Permission denied" + corepath="/coredump/" + fi fi if [ "$2" != "jdbc" ] && [ "$2" != "python" ] && [ "$2" != "unit" ] && [ "$2" != "example" ]; then