diff --git a/.gitignore b/.gitignore index 77c52b2ee2..c5d90eea50 100644 --- a/.gitignore +++ b/.gitignore @@ -66,3 +66,14 @@ CMakeError.log /test/cfg /src/.vs *.o +src/connector/jdbc/.settings/ +tests/comparisonTest/cassandra/cassandratest/.classpath +tests/comparisonTest/cassandra/cassandratest/.project +tests/comparisonTest/cassandra/cassandratest/.settings/ +tests/comparisonTest/opentsdb/opentsdbtest/.classpath +tests/comparisonTest/opentsdb/opentsdbtest/.factorypath +tests/comparisonTest/opentsdb/opentsdbtest/.project +tests/comparisonTest/opentsdb/opentsdbtest/.settings/ +tests/examples/JDBC/JDBCDemo/.classpath +tests/examples/JDBC/JDBCDemo/.project +tests/examples/JDBC/JDBCDemo/.settings/ diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index 3794a0a228..f5911ca0c9 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -7,4 +7,8 @@ ADD_SUBDIRECTORY(regex) ADD_SUBDIRECTORY(iconv) ADD_SUBDIRECTORY(lz4) ADD_SUBDIRECTORY(cJson) -ADD_SUBDIRECTORY(MQTT-C) +#ADD_SUBDIRECTORY(MsvcLibX) + +IF (NOT TD_WINDOWS) + ADD_SUBDIRECTORY(MQTT-C) +ENDIF () \ No newline at end of file diff --git a/deps/MQTT-C/CMakeLists.txt b/deps/MQTT-C/CMakeLists.txt index cb288a4193..ea5d4238d5 100644 --- a/deps/MQTT-C/CMakeLists.txt +++ b/deps/MQTT-C/CMakeLists.txt @@ -10,11 +10,11 @@ option(MQTT_C_TESTS "Build MQTT-C tests?" OFF) list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) # MQTT-C library -add_library(mqttc STATIC +ADD_LIBRARY(mqttc STATIC src/mqtt_pal.c src/mqtt.c ) -target_include_directories(mqttc PUBLIC include) +TARGET_INCLUDE_DIRECTORIES(mqttc PUBLIC include) target_link_libraries(mqttc PUBLIC $<$:ws2_32> ) @@ -30,7 +30,7 @@ endif() # Configure with mbed TLS support if(MQTT_C_MbedTLS_SUPPORT) find_package(MbedTLS REQUIRED) - target_include_directories(mqttc PUBLIC ${MBEDTLS_INCLUDE_DIRS}) + TARGET_INCLUDE_DIRECTORIES(mqttc PUBLIC ${MBEDTLS_INCLUDE_DIRS}) target_link_libraries(mqttc INTERFACE ${MBEDTLS_LIBRARY}) target_compile_definitions(mqttc PUBLIC MQTT_USE_MBEDTLS) endif() @@ -70,7 +70,7 @@ if(MQTT_C_TESTS) add_executable(tests tests.c) target_link_libraries(tests ${CMOCKA_LIBRARY} mqttc) - target_include_directories(tests PRIVATE ${CMOCKA_INCLUDE_DIR}) + TARGET_INCLUDE_DIRECTORIES(tests PRIVATE ${CMOCKA_INCLUDE_DIR}) endif() # Install includes and library diff --git a/deps/cJson/CMakeLists.txt b/deps/cJson/CMakeLists.txt index 43b31589b3..2fe1975065 100644 --- a/deps/cJson/CMakeLists.txt +++ b/deps/cJson/CMakeLists.txt @@ -1,4 +1,4 @@ -aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/src SOURCE_LIST) +AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src SOURCE_LIST) -add_library(cJson ${SOURCE_LIST}) -target_include_directories(cJson PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/inc) \ No newline at end of file +ADD_LIBRARY(cJson ${SOURCE_LIST}) +TARGET_INCLUDE_DIRECTORIES(cJson PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/inc) \ No newline at end of file diff --git a/deps/iconv/CMakeLists.txt b/deps/iconv/CMakeLists.txt index 944cb400e0..286070fa90 100644 --- a/deps/iconv/CMakeLists.txt +++ b/deps/iconv/CMakeLists.txt @@ -1,9 +1,11 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) PROJECT(TDengine) -IF (TD_WINDOWS_64) +IF (TD_WINDOWS) LIST(APPEND SRC iconv.c) LIST(APPEND SRC localcharset.c) INCLUDE_DIRECTORIES(.) + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /WX-") + SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /WX-") ADD_LIBRARY(iconv ${SRC}) ENDIF () \ No newline at end of file diff --git a/deps/iconv/iconv.h b/deps/iconv/iconv.h index 83358ce987..a461cef544 100644 --- a/deps/iconv/iconv.h +++ b/deps/iconv/iconv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2003, 2005-2006, 2008-2009 Free Software Foundation, Inc. +/* Copyright (C) 1999-2003, 2005-2006, 2008-2009 Free Software Foundation, Inc. This file is part of the GNU LIBICONV Library. The GNU LIBICONV Library is free software; you can redistribute it diff --git a/deps/lz4/CMakeLists.txt b/deps/lz4/CMakeLists.txt index a142d8d468..c3762ffe73 100644 --- a/deps/lz4/CMakeLists.txt +++ b/deps/lz4/CMakeLists.txt @@ -1,4 +1,9 @@ -aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/src SOURCE_LIST) +AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src SOURCE_LIST) -add_library(lz4 ${SOURCE_LIST}) -target_include_directories(lz4 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/inc) \ No newline at end of file +IF (TD_WINDOWS) + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /WX-") + SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /WX-") +ENDIF() + +ADD_LIBRARY(lz4 ${SOURCE_LIST}) +TARGET_INCLUDE_DIRECTORIES(lz4 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/inc) \ No newline at end of file diff --git a/deps/pthread/CMakeLists.txt b/deps/pthread/CMakeLists.txt index a218d05bab..04e5be7472 100644 --- a/deps/pthread/CMakeLists.txt +++ b/deps/pthread/CMakeLists.txt @@ -1,7 +1,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) PROJECT(TDengine) -IF (TD_WINDOWS_64) +IF (TD_WINDOWS) INCLUDE_DIRECTORIES(.) LIST(APPEND SRC pthread.c) ADD_LIBRARY(pthread ${SRC}) diff --git a/deps/pthread/pthread_mutex_consistent.c b/deps/pthread/pthread_mutex_consistent.c index 3e05635007..2d68213ce1 100644 --- a/deps/pthread/pthread_mutex_consistent.c +++ b/deps/pthread/pthread_mutex_consistent.c @@ -1,4 +1,4 @@ -/* +/* * pthread_mutex_consistent.c * * Description: diff --git a/deps/regex/CMakeLists.txt b/deps/regex/CMakeLists.txt index 8f8396caa4..054b093d07 100644 --- a/deps/regex/CMakeLists.txt +++ b/deps/regex/CMakeLists.txt @@ -1,7 +1,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) PROJECT(TDengine) -IF (TD_WINDOWS_64) +IF (TD_WINDOWS) INCLUDE_DIRECTORIES(inc .) LIST(APPEND SRC regex.c) ADD_LIBRARY(regex ${SRC}) diff --git a/deps/zlib-1.2.11/CMakeLists.txt b/deps/zlib-1.2.11/CMakeLists.txt index c69e54a1b0..686e6fcff5 100644 --- a/deps/zlib-1.2.11/CMakeLists.txt +++ b/deps/zlib-1.2.11/CMakeLists.txt @@ -1,7 +1,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) PROJECT(TDengine) -IF (TD_LINUX_64) +IF (TD_LINUX_64 OR TD_WINDOWS_64) INCLUDE_DIRECTORIES(inc) AUX_SOURCE_DIRECTORY(src SRC) ADD_LIBRARY(z ${SRC}) diff --git a/deps/zlib-1.2.11/inc/zconf.h b/deps/zlib-1.2.11/inc/zconf.h index 97b1e279ef..9b83d3a898 100644 --- a/deps/zlib-1.2.11/inc/zconf.h +++ b/deps/zlib-1.2.11/inc/zconf.h @@ -14,177 +14,177 @@ * Even better than compiling with -DZ_PREFIX would be to use configure to set * this permanently in zconf.h using "./configure --zprefix". */ -#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ -# define Z_PREFIX_SET +#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ +#define Z_PREFIX_SET /* all linked symbols and init macros */ -# define _dist_code z__dist_code -# define _length_code z__length_code -# define _tr_align z__tr_align -# define _tr_flush_bits z__tr_flush_bits -# define _tr_flush_block z__tr_flush_block -# define _tr_init z__tr_init -# define _tr_stored_block z__tr_stored_block -# define _tr_tally z__tr_tally -# define adler32 z_adler32 -# define adler32_combine z_adler32_combine -# define adler32_combine64 z_adler32_combine64 -# define adler32_z z_adler32_z -# ifndef Z_SOLO -# define compress z_compress -# define compress2 z_compress2 -# define compressBound z_compressBound -# endif -# define crc32 z_crc32 -# define crc32_combine z_crc32_combine -# define crc32_combine64 z_crc32_combine64 -# define crc32_z z_crc32_z -# define deflate z_deflate -# define deflateBound z_deflateBound -# define deflateCopy z_deflateCopy -# define deflateEnd z_deflateEnd -# define deflateGetDictionary z_deflateGetDictionary -# define deflateInit z_deflateInit -# define deflateInit2 z_deflateInit2 -# define deflateInit2_ z_deflateInit2_ -# define deflateInit_ z_deflateInit_ -# define deflateParams z_deflateParams -# define deflatePending z_deflatePending -# define deflatePrime z_deflatePrime -# define deflateReset z_deflateReset -# define deflateResetKeep z_deflateResetKeep -# define deflateSetDictionary z_deflateSetDictionary -# define deflateSetHeader z_deflateSetHeader -# define deflateTune z_deflateTune -# define deflate_copyright z_deflate_copyright -# define get_crc_table z_get_crc_table -# ifndef Z_SOLO -# define gz_error z_gz_error -# define gz_intmax z_gz_intmax -# define gz_strwinerror z_gz_strwinerror -# define gzbuffer z_gzbuffer -# define gzclearerr z_gzclearerr -# define gzclose z_gzclose -# define gzclose_r z_gzclose_r -# define gzclose_w z_gzclose_w -# define gzdirect z_gzdirect -# define gzdopen z_gzdopen -# define gzeof z_gzeof -# define gzerror z_gzerror -# define gzflush z_gzflush -# define gzfread z_gzfread -# define gzfwrite z_gzfwrite -# define gzgetc z_gzgetc -# define gzgetc_ z_gzgetc_ -# define gzgets z_gzgets -# define gzoffset z_gzoffset -# define gzoffset64 z_gzoffset64 -# define gzopen z_gzopen -# define gzopen64 z_gzopen64 -# ifdef _WIN32 -# define gzopen_w z_gzopen_w -# endif -# define gzprintf z_gzprintf -# define gzputc z_gzputc -# define gzputs z_gzputs -# define gzread z_gzread -# define gzrewind z_gzrewind -# define gzseek z_gzseek -# define gzseek64 z_gzseek64 -# define gzsetparams z_gzsetparams -# define gztell z_gztell -# define gztell64 z_gztell64 -# define gzungetc z_gzungetc -# define gzvprintf z_gzvprintf -# define gzwrite z_gzwrite -# endif -# define inflate z_inflate -# define inflateBack z_inflateBack -# define inflateBackEnd z_inflateBackEnd -# define inflateBackInit z_inflateBackInit -# define inflateBackInit_ z_inflateBackInit_ -# define inflateCodesUsed z_inflateCodesUsed -# define inflateCopy z_inflateCopy -# define inflateEnd z_inflateEnd -# define inflateGetDictionary z_inflateGetDictionary -# define inflateGetHeader z_inflateGetHeader -# define inflateInit z_inflateInit -# define inflateInit2 z_inflateInit2 -# define inflateInit2_ z_inflateInit2_ -# define inflateInit_ z_inflateInit_ -# define inflateMark z_inflateMark -# define inflatePrime z_inflatePrime -# define inflateReset z_inflateReset -# define inflateReset2 z_inflateReset2 -# define inflateResetKeep z_inflateResetKeep -# define inflateSetDictionary z_inflateSetDictionary -# define inflateSync z_inflateSync -# define inflateSyncPoint z_inflateSyncPoint -# define inflateUndermine z_inflateUndermine -# define inflateValidate z_inflateValidate -# define inflate_copyright z_inflate_copyright -# define inflate_fast z_inflate_fast -# define inflate_table z_inflate_table -# ifndef Z_SOLO -# define uncompress z_uncompress -# define uncompress2 z_uncompress2 -# endif -# define zError z_zError -# ifndef Z_SOLO -# define zcalloc z_zcalloc -# define zcfree z_zcfree -# endif -# define zlibCompileFlags z_zlibCompileFlags -# define zlibVersion z_zlibVersion +#define _dist_code z__dist_code +#define _length_code z__length_code +#define _tr_align z__tr_align +#define _tr_flush_bits z__tr_flush_bits +#define _tr_flush_block z__tr_flush_block +#define _tr_init z__tr_init +#define _tr_stored_block z__tr_stored_block +#define _tr_tally z__tr_tally +#define adler32 z_adler32 +#define adler32_combine z_adler32_combine +#define adler32_combine64 z_adler32_combine64 +#define adler32_z z_adler32_z +#ifndef Z_SOLO +#define compress z_compress +#define compress2 z_compress2 +#define compressBound z_compressBound +#endif +#define crc32 z_crc32 +#define crc32_combine z_crc32_combine +#define crc32_combine64 z_crc32_combine64 +#define crc32_z z_crc32_z +#define deflate z_deflate +#define deflateBound z_deflateBound +#define deflateCopy z_deflateCopy +#define deflateEnd z_deflateEnd +#define deflateGetDictionary z_deflateGetDictionary +#define deflateInit z_deflateInit +#define deflateInit2 z_deflateInit2 +#define deflateInit2_ z_deflateInit2_ +#define deflateInit_ z_deflateInit_ +#define deflateParams z_deflateParams +#define deflatePending z_deflatePending +#define deflatePrime z_deflatePrime +#define deflateReset z_deflateReset +#define deflateResetKeep z_deflateResetKeep +#define deflateSetDictionary z_deflateSetDictionary +#define deflateSetHeader z_deflateSetHeader +#define deflateTune z_deflateTune +#define deflate_copyright z_deflate_copyright +#define get_crc_table z_get_crc_table +#ifndef Z_SOLO +#define gz_error z_gz_error +#define gz_intmax z_gz_intmax +#define gz_strwinerror z_gz_strwinerror +#define gzbuffer z_gzbuffer +#define gzclearerr z_gzclearerr +#define gzclose z_gzclose +#define gzclose_r z_gzclose_r +#define gzclose_w z_gzclose_w +#define gzdirect z_gzdirect +#define gzdopen z_gzdopen +#define gzeof z_gzeof +#define gzerror z_gzerror +#define gzflush z_gzflush +#define gzfread z_gzfread +#define gzfwrite z_gzfwrite +#define gzgetc z_gzgetc +#define gzgetc_ z_gzgetc_ +#define gzgets z_gzgets +#define gzoffset z_gzoffset +#define gzoffset64 z_gzoffset64 +#define gzopen z_gzopen +#define gzopen64 z_gzopen64 +#ifdef _WIN32 +#define gzopen_w z_gzopen_w +#endif +#define gzprintf z_gzprintf +#define gzputc z_gzputc +#define gzputs z_gzputs +#define gzread z_gzread +#define gzrewind z_gzrewind +#define gzseek z_gzseek +#define gzseek64 z_gzseek64 +#define gzsetparams z_gzsetparams +#define gztell z_gztell +#define gztell64 z_gztell64 +#define gzungetc z_gzungetc +#define gzvprintf z_gzvprintf +#define gzwrite z_gzwrite +#endif +#define inflate z_inflate +#define inflateBack z_inflateBack +#define inflateBackEnd z_inflateBackEnd +#define inflateBackInit z_inflateBackInit +#define inflateBackInit_ z_inflateBackInit_ +#define inflateCodesUsed z_inflateCodesUsed +#define inflateCopy z_inflateCopy +#define inflateEnd z_inflateEnd +#define inflateGetDictionary z_inflateGetDictionary +#define inflateGetHeader z_inflateGetHeader +#define inflateInit z_inflateInit +#define inflateInit2 z_inflateInit2 +#define inflateInit2_ z_inflateInit2_ +#define inflateInit_ z_inflateInit_ +#define inflateMark z_inflateMark +#define inflatePrime z_inflatePrime +#define inflateReset z_inflateReset +#define inflateReset2 z_inflateReset2 +#define inflateResetKeep z_inflateResetKeep +#define inflateSetDictionary z_inflateSetDictionary +#define inflateSync z_inflateSync +#define inflateSyncPoint z_inflateSyncPoint +#define inflateUndermine z_inflateUndermine +#define inflateValidate z_inflateValidate +#define inflate_copyright z_inflate_copyright +#define inflate_fast z_inflate_fast +#define inflate_table z_inflate_table +#ifndef Z_SOLO +#define uncompress z_uncompress +#define uncompress2 z_uncompress2 +#endif +#define zError z_zError +#ifndef Z_SOLO +#define zcalloc z_zcalloc +#define zcfree z_zcfree +#endif +#define zlibCompileFlags z_zlibCompileFlags +#define zlibVersion z_zlibVersion /* all zlib typedefs in zlib.h and zconf.h */ -# define Byte z_Byte -# define Bytef z_Bytef -# define alloc_func z_alloc_func -# define charf z_charf -# define free_func z_free_func -# ifndef Z_SOLO -# define gzFile z_gzFile -# endif -# define gz_header z_gz_header -# define gz_headerp z_gz_headerp -# define in_func z_in_func -# define intf z_intf -# define out_func z_out_func -# define uInt z_uInt -# define uIntf z_uIntf -# define uLong z_uLong -# define uLongf z_uLongf -# define voidp z_voidp -# define voidpc z_voidpc -# define voidpf z_voidpf +#define Byte z_Byte +#define Bytef z_Bytef +#define alloc_func z_alloc_func +#define charf z_charf +#define free_func z_free_func +#ifndef Z_SOLO +#define gzFile z_gzFile +#endif +#define gz_header z_gz_header +#define gz_headerp z_gz_headerp +#define in_func z_in_func +#define intf z_intf +#define out_func z_out_func +#define uInt z_uInt +#define uIntf z_uIntf +#define uLong z_uLong +#define uLongf z_uLongf +#define voidp z_voidp +#define voidpc z_voidpc +#define voidpf z_voidpf /* all zlib structs in zlib.h and zconf.h */ -# define gz_header_s z_gz_header_s -# define internal_state z_internal_state +#define gz_header_s z_gz_header_s +#define internal_state z_internal_state #endif #if defined(__MSDOS__) && !defined(MSDOS) -# define MSDOS +#define MSDOS #endif #if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) -# define OS2 +#define OS2 #endif #if defined(_WINDOWS) && !defined(WINDOWS) -# define WINDOWS +#define WINDOWS #endif #if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) -# ifndef WIN32 -# define WIN32 -# endif +#ifndef WIN32 +#define WIN32 +#endif #endif #if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) -# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) -# ifndef SYS16BIT -# define SYS16BIT -# endif -# endif +#if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +#ifndef SYS16BIT +#define SYS16BIT +#endif +#endif #endif /* @@ -192,73 +192,73 @@ * than 64k bytes at a time (needed on systems with 16-bit int). */ #ifdef SYS16BIT -# define MAXSEG_64K +#define MAXSEG_64K #endif #ifdef MSDOS -# define UNALIGNED_OK +#define UNALIGNED_OK #endif #ifdef __STDC_VERSION__ -# ifndef STDC -# define STDC -# endif -# if __STDC_VERSION__ >= 199901L -# ifndef STDC99 -# define STDC99 -# endif -# endif +#ifndef STDC +#define STDC +#endif +#if __STDC_VERSION__ >= 199901L +#ifndef STDC99 +#define STDC99 +#endif +#endif #endif #if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) -# define STDC +#define STDC #endif #if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) -# define STDC +#define STDC #endif #if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) -# define STDC +#define STDC #endif #if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) -# define STDC +#define STDC #endif -#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ -# define STDC +#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +#define STDC #endif #ifndef STDC -# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ -# define const /* note: need a more gentle solution here */ -# endif +#ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +#define const /* note: need a more gentle solution here */ +#endif #endif #if defined(ZLIB_CONST) && !defined(z_const) -# define z_const const +#define z_const const #else -# define z_const +#define z_const #endif #ifdef Z_SOLO - typedef uint64_t z_size_t; +typedef uint64_t z_size_t; #else -# define z_longlong int64_t -# if defined(NO_SIZE_T) - typedef unsigned NO_SIZE_T z_size_t; -# elif defined(STDC) -# include - typedef size_t z_size_t; -# else - typedef uint64_t z_size_t; -# endif -# undef z_longlong +#define z_longlong int64_t +#if defined(NO_SIZE_T) +typedef unsigned NO_SIZE_T z_size_t; +#elif defined(STDC) +#include +typedef size_t z_size_t; +#else +typedef uint64_t z_size_t; +#endif +#undef z_longlong #endif /* Maximum value for memLevel in deflateInit2 */ #ifndef MAX_MEM_LEVEL -# ifdef MAXSEG_64K -# define MAX_MEM_LEVEL 8 -# else -# define MAX_MEM_LEVEL 9 -# endif +#ifdef MAXSEG_64K +#define MAX_MEM_LEVEL 8 +#else +#define MAX_MEM_LEVEL 9 +#endif #endif /* Maximum value for windowBits in deflateInit2 and inflateInit2. @@ -267,7 +267,7 @@ * gzip.) */ #ifndef MAX_WBITS -# define MAX_WBITS 15 /* 32K LZ77 window */ +#define MAX_WBITS 15 /* 32K LZ77 window */ #endif /* The memory requirements for deflate are (in bytes): @@ -283,22 +283,22 @@ for small objects. */ - /* Type declarations */ +/* Type declarations */ #ifndef OF /* function prototypes */ -# ifdef STDC -# define OF(args) args -# else -# define OF(args) () -# endif +#ifdef STDC +#define OF(args) args +#else +#define OF(args) () +#endif #endif #ifndef Z_ARG /* function prototypes for stdarg */ -# if defined(STDC) || defined(Z_HAVE_STDARG_H) -# define Z_ARG(args) args -# else -# define Z_ARG(args) () -# endif +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +#define Z_ARG(args) args +#else +#define Z_ARG(args) () +#endif #endif /* The following definitions for FAR are needed only for MSDOS mixed @@ -308,153 +308,153 @@ * just define FAR to be empty. */ #ifdef SYS16BIT -# if defined(M_I86SM) || defined(M_I86MM) - /* MSC small or medium model */ -# define SMALL_MEDIUM -# ifdef _MSC_VER -# define FAR _far -# else -# define FAR far -# endif -# endif -# if (defined(__SMALL__) || defined(__MEDIUM__)) - /* Turbo C small or medium model */ -# define SMALL_MEDIUM -# ifdef __BORLANDC__ -# define FAR _far -# else -# define FAR far -# endif -# endif +#if defined(M_I86SM) || defined(M_I86MM) +/* MSC small or medium model */ +#define SMALL_MEDIUM +#ifdef _MSC_VER +#define FAR _far +#else +#define FAR far +#endif +#endif +#if (defined(__SMALL__) || defined(__MEDIUM__)) +/* Turbo C small or medium model */ +#define SMALL_MEDIUM +#ifdef __BORLANDC__ +#define FAR _far +#else +#define FAR far +#endif +#endif #endif #if defined(WINDOWS) || defined(WIN32) - /* If building or using zlib as a DLL, define ZLIB_DLL. - * This is not mandatory, but it offers a little performance increase. - */ -# ifdef ZLIB_DLL -# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) -# ifdef ZLIB_INTERNAL -# define ZEXTERN extern __declspec(dllexport) -# else -# define ZEXTERN extern __declspec(dllimport) -# endif -# endif -# endif /* ZLIB_DLL */ - /* If building or using zlib with the WINAPI/WINAPIV calling convention, - * define ZLIB_WINAPI. - * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. - */ -# ifdef ZLIB_WINAPI -# ifdef FAR -# undef FAR -# endif -# include - /* No need for _export, use ZLIB.DEF instead. */ - /* For complete Windows compatibility, use WINAPI, not __stdcall. */ -# define ZEXPORT WINAPI -# ifdef WIN32 -# define ZEXPORTVA WINAPIV -# else -# define ZEXPORTVA FAR CDECL -# endif -# endif +/* If building or using zlib as a DLL, define ZLIB_DLL. + * This is not mandatory, but it offers a little performance increase. + */ +#ifdef ZLIB_DLL +#if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +#ifdef ZLIB_INTERNAL +#define ZEXTERN extern __declspec(dllexport) +#else +#define ZEXTERN extern __declspec(dllimport) +#endif +#endif +#endif /* ZLIB_DLL */ + /* If building or using zlib with the WINAPI/WINAPIV calling convention, + * define ZLIB_WINAPI. + * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. + */ +#ifdef ZLIB_WINAPI +#ifdef FAR +#undef FAR +#endif +#include +/* No need for _export, use ZLIB.DEF instead. */ +/* For complete Windows compatibility, use WINAPI, not __stdcall. */ +#define ZEXPORT WINAPI +#ifdef WIN32 +#define ZEXPORTVA WINAPIV +#else +#define ZEXPORTVA FAR CDECL +#endif +#endif #endif -#if defined (__BEOS__) -# ifdef ZLIB_DLL -# ifdef ZLIB_INTERNAL -# define ZEXPORT __declspec(dllexport) -# define ZEXPORTVA __declspec(dllexport) -# else -# define ZEXPORT __declspec(dllimport) -# define ZEXPORTVA __declspec(dllimport) -# endif -# endif +#if defined(__BEOS__) +#ifdef ZLIB_DLL +#ifdef ZLIB_INTERNAL +#define ZEXPORT __declspec(dllexport) +#define ZEXPORTVA __declspec(dllexport) +#else +#define ZEXPORT __declspec(dllimport) +#define ZEXPORTVA __declspec(dllimport) +#endif +#endif #endif #ifndef ZEXTERN -# define ZEXTERN extern +#define ZEXTERN extern #endif #ifndef ZEXPORT -# define ZEXPORT +#define ZEXPORT #endif #ifndef ZEXPORTVA -# define ZEXPORTVA +#define ZEXPORTVA #endif #ifndef FAR -# define FAR +#define FAR #endif #if !defined(__MACTYPES__) -typedef unsigned char Byte; /* 8 bits */ +typedef unsigned char Byte; /* 8 bits */ #endif -typedef unsigned int uInt; /* 16 bits or more */ -typedef uint64_t uLong; /* 32 bits or more */ +typedef unsigned int uInt; /* 16 bits or more */ +typedef uint64_t uLong; /* 32 bits or more */ #ifdef SMALL_MEDIUM - /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ -# define Bytef Byte FAR +/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +#define Bytef Byte FAR #else - typedef Byte FAR Bytef; +typedef Byte FAR Bytef; #endif -typedef char FAR charf; -typedef int FAR intf; -typedef uInt FAR uIntf; +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; typedef uLong FAR uLongf; #ifdef STDC - typedef void const *voidpc; - typedef void FAR *voidpf; - typedef void *voidp; +typedef void const *voidpc; +typedef void FAR *voidpf; +typedef void * voidp; #else - typedef Byte const *voidpc; - typedef Byte FAR *voidpf; - typedef Byte *voidp; +typedef Byte const *voidpc; +typedef Byte FAR *voidpf; +typedef Byte * voidp; #endif #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) -# include -# if (UINT_MAX == 0xffffffffUL) -# define Z_U4 unsigned -# elif (ULONG_MAX == 0xffffffffUL) -# define Z_U4 uint64_t -# elif (USHRT_MAX == 0xffffffffUL) -# define Z_U4 unsigned short -# endif +#include +#if (UINT_MAX == 0xffffffffUL) +#define Z_U4 unsigned +#elif (ULONG_MAX == 0xffffffffUL) +#define Z_U4 uint64_t +#elif (USHRT_MAX == 0xffffffffUL) +#define Z_U4 unsigned short +#endif #endif #ifdef Z_U4 - typedef Z_U4 z_crc_t; +typedef Z_U4 z_crc_t; #else - typedef uint64_t z_crc_t; +typedef uint64_t z_crc_t; #endif -#if 1 /* was set to #if 1 by ./configure */ -# define Z_HAVE_UNISTD_H +#if 1 /* was set to #if 1 by ./configure */ +#define Z_HAVE_UNISTD_H #endif -#if 1 /* was set to #if 1 by ./configure */ -# define Z_HAVE_STDARG_H +#if 1 /* was set to #if 1 by ./configure */ +#define Z_HAVE_STDARG_H #endif #ifdef STDC -# ifndef Z_SOLO -# include /* for off_t */ -# endif +#ifndef Z_SOLO +#include /* for off_t */ +#endif #endif #if defined(STDC) || defined(Z_HAVE_STDARG_H) -# ifndef Z_SOLO -# include /* for va_list */ -# endif +#ifndef Z_SOLO +#include /* for va_list */ +#endif #endif #ifdef _WIN32 -# ifndef Z_SOLO -# include /* for wchar_t */ -# endif +#ifndef Z_SOLO +#include /* for wchar_t */ +#endif #endif /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and @@ -464,71 +464,76 @@ typedef uLong FAR uLongf; * equivalently requesting no 64-bit operations */ #if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 -# undef _LARGEFILE64_SOURCE +#undef _LARGEFILE64_SOURCE #endif #if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) -# define Z_HAVE_UNISTD_H +#define Z_HAVE_UNISTD_H #endif #ifndef Z_SOLO -# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) -# include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ -# ifdef VMS -# include /* for off_t */ -# endif -# ifndef z_off_t -# define z_off_t off_t -# endif -# endif +#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) +#if (_WIN64) +#include +#include +#else +#include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ +#endif +#ifdef VMS +#include /* for off_t */ +#endif +#ifndef z_off_t +#define z_off_t off_t +#endif +#endif #endif -#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 -# define Z_LFS64 +#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE - 0 +#define Z_LFS64 #endif #if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) -# define Z_LARGE64 +#define Z_LARGE64 #endif -#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) -# define Z_WANT64 +#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS - 0 == 64 && defined(Z_LFS64) +#define Z_WANT64 #endif #if !defined(SEEK_SET) && !defined(Z_SOLO) -# define SEEK_SET 0 /* Seek from beginning of file. */ -# define SEEK_CUR 1 /* Seek from current position. */ -# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#define SEEK_SET 0 /* Seek from beginning of file. */ +#define SEEK_CUR 1 /* Seek from current position. */ +#define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ #endif #ifndef z_off_t -# define z_off_t int64_t +#define z_off_t int64_t #endif #if !defined(_WIN32) && defined(Z_LARGE64) -# define z_off64_t off64_t +#define z_off64_t off64_t #else -# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) -# define z_off64_t __int64 -# else -# define z_off64_t z_off_t -# endif +#if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) +#define z_off64_t __int64 +#else +#define z_off64_t z_off_t +#endif #endif /* MVS linker does not support external names larger than 8 bytes */ #if defined(__MVS__) - #pragma map(deflateInit_,"DEIN") - #pragma map(deflateInit2_,"DEIN2") - #pragma map(deflateEnd,"DEEND") - #pragma map(deflateBound,"DEBND") - #pragma map(inflateInit_,"ININ") - #pragma map(inflateInit2_,"ININ2") - #pragma map(inflateEnd,"INEND") - #pragma map(inflateSync,"INSY") - #pragma map(inflateSetDictionary,"INSEDI") - #pragma map(compressBound,"CMBND") - #pragma map(inflate_table,"INTABL") - #pragma map(inflate_fast,"INFA") - #pragma map(inflate_copyright,"INCOPY") +#pragma map(deflateInit_, "DEIN") +#pragma map(deflateInit2_, "DEIN2") +#pragma map(deflateEnd, "DEEND") +#pragma map(deflateBound, "DEBND") +#pragma map(inflateInit_, "ININ") +#pragma map(inflateInit2_, "ININ2") +#pragma map(inflateEnd, "INEND") +#pragma map(inflateSync, "INSY") +#pragma map(inflateSetDictionary, "INSEDI") +#pragma map(compressBound, "CMBND") +#pragma map(inflate_table, "INTABL") +#pragma map(inflate_fast, "INFA") +#pragma map(inflate_copyright, "INCOPY") #endif #endif /* ZCONF_H */ diff --git a/deps/zlib-1.2.11/src/zconf.h b/deps/zlib-1.2.11/src/zconf.h index d71de993e1..361c098281 100644 --- a/deps/zlib-1.2.11/src/zconf.h +++ b/deps/zlib-1.2.11/src/zconf.h @@ -472,7 +472,12 @@ typedef uLong FAR uLongf; #endif #ifndef Z_SOLO # if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) -# include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ +#if (_WIN64) +#include +#include +#else +#include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ +#endif # ifdef VMS # include /* for off_t */ # endif diff --git a/documentation20/webdocs/markdowndocs/Connections with other Tools-ch.md b/documentation20/webdocs/markdowndocs/Connections with other Tools-ch.md index 34be7d1e76..d62a525e28 100644 --- a/documentation20/webdocs/markdowndocs/Connections with other Tools-ch.md +++ b/documentation20/webdocs/markdowndocs/Connections with other Tools-ch.md @@ -31,7 +31,7 @@ TDengine的Grafana插件在安装包的/usr/local/taos/connector/grafana目录 ![img](../assets/add_datasource3.jpg) -* Host: TDengine 集群的中任意一台服务器的 IP 地址与 TDengine RESTful 接口的端口号(6020),默认 http://localhost:6020。 +* Host: TDengine 集群的中任意一台服务器的 IP 地址与 TDengine RESTful 接口的端口号(6041),默认 http://localhost:6041 * User:TDengine 用户名。 * Password:TDengine 用户密码。 diff --git a/documentation20/webdocs/markdowndocs/Getting Started-ch.md b/documentation20/webdocs/markdowndocs/Getting Started-ch.md index 7704a6a4e7..210f0921ba 100644 --- a/documentation20/webdocs/markdowndocs/Getting Started-ch.md +++ b/documentation20/webdocs/markdowndocs/Getting Started-ch.md @@ -53,9 +53,12 @@ systemctl start taosd systemctl status taosd ``` -如果TDengine服务正常工作,那么您可以通过TDengine的命令行程序`taos`来访问并体验TDengine。 - -**注:_systemctl_ 命令需要 _root_ 权限来运行,如果您非 _root_ 用户,请在命令前添加 _sudo_** +如果TDengine服务正常工作,那么您可以通过TDengine的命令行程序`taos`来访问并体验TDengine。 + +**注意:** + +- systemctl命令需要 _root_ 权限来运行,如果您非 _root_ 用户,请在命令前添加 sudo +- 为更好的获得产品反馈,改善产品,TDengine会采集基本的使用信息,但您可以修改系统配置文件taos.cfg里的配置参数telemetryReporting, 将其设为0,就可将其关闭。 ## TDengine命令行程序 diff --git a/documentation20/webdocs/markdowndocs/administrator-ch.md b/documentation20/webdocs/markdowndocs/administrator-ch.md index cf3dcef716..470c718af1 100644 --- a/documentation20/webdocs/markdowndocs/administrator-ch.md +++ b/documentation20/webdocs/markdowndocs/administrator-ch.md @@ -39,7 +39,7 @@ Raw DataSize = numOfTables * rowSizePerTable * rowsPerTable 用户可以通过参数keep,设置数据在磁盘中的最大保存时长。为进一步减少存储成本,TDengine还提供多级存储,最冷的数据可以存放在最廉价的存储介质上,应用的访问不用做任何调整,只是读取速度降低了。 -为提高速度,可以配置多快硬盘,这样可以并发写入或读取数据。 +为提高速度,可以配置多快硬盘,这样可以并发写入或读取数据。需要提醒的是,TDengine采取多副本的方式提供数据的高可靠,因此不再需要采用昂贵的磁盘阵列。 ### 物理机或虚拟机台数 @@ -80,11 +80,11 @@ TDengine系统后台服务由taosd提供,可以在配置文件taos.cfg里修 下面仅仅列出一些重要的配置参数,更多的参数请看配置文件里的说明。各个参数的详细介绍及作用请看前述章节,而且这些参数的缺省配置都是工作的,一般无需设置。**注意:配置修改后,需要重启*taosd*服务才能生效。** -- firstEp: taosd启动时,主动连接的集群中第一个dnode的end point, 缺省值为 localhost:6030。 -- secondEp: taosd启动时,如果first连接不上,尝试连接集群中第二个dnode的end point, 缺省值为空。 -- fqdn:数据节点的FQDN。如果为空,将自动获取操作系统配置的第一个, 缺省值为空。 +- firstEp: taosd启动时,主动连接的集群中第一个dnode的end point, 默认值为localhost:6030。 +- secondEp: taosd启动时,如果first连接不上,尝试连接集群中第二个dnode的end point, 默认值为空。 +- fqdn:数据节点的FQDN。如果为空,将自动获取操作系统配置的第一个, 默认值为空。 - serverPort:taosd启动后,对外服务的端口号,默认值为6030。 -- httpPort: RESTful服务使用的端口号,所有的HTTP请求(TCP)都需要向该接口发起查询/写入请求。 +- httpPort: RESTful服务使用的端口号,所有的HTTP请求(TCP)都需要向该接口发起查询/写入请求, 默认值为6041。 - dataDir: 数据文件目录,所有的数据文件都将写入该目录。默认值:/var/lib/taos。 - logDir:日志文件目录,客户端和服务器的运行日志文件将写入该目录。默认值:/var/log/taos。 - arbitrator:系统中裁决器的end point, 缺省值为空。 @@ -92,9 +92,9 @@ TDengine系统后台服务由taosd提供,可以在配置文件taos.cfg里修 - debugFlag:运行日志开关。131(输出错误和警告日志),135( 输出错误、警告和调试日志),143( 输出错误、警告、调试和跟踪日志)。默认值:131或135(不同模块有不同的默认值)。 - numOfLogLines:单个日志文件允许的最大行数。默认值:10,000,000行。 - maxSQLLength:单条SQL语句允许最长限制。默认值:65380字节。 -- maxBinaryDisplayWidth:Shell中binary 和 nchar字段的显示宽度上限,超过此限制的部分将被隐藏。默认值:30。可在 shell 中通过命令 set max_binary_display_width nn动态修改此选项。 +- telemetryReporting: 是否允许 TDengine 采集和上报基本使用信息,0表示不允许,1表示允许。 默认值:1。 -**注意:**对于端口,TDengine会使用从serverPort起11个连续的TCP和UDP端口号,请务必在防火墙打开。因此如果是缺省配置,需要打开从6030都6040共11个端口,而且必须TCP和UDP都打开。 +**注意:**对于端口,TDengine会使用从serverPort起12个连续的TCP和UDP端口号,请务必在防火墙打开。因此如果是缺省配置,需要打开从6030都6041共12个端口,而且必须TCP和UDP都打开。 不同应用场景的数据往往具有不同的数据特征,比如保留天数、副本数、采集频次、记录大小、采集点的数量、压缩等都可完全不同。为获得在存储上的最高效率,TDengine提供如下存储相关的系统配置参数: @@ -142,6 +142,7 @@ TDengine系统的前台交互客户端应用程序为taos,它与taosd共享同 - secondEp: taos启动时,如果first连接不上,尝试连接集群中第二个taosd实例的end point, 缺省值为空。 - charset:字符集编码。系统中动态获取,如果自动获取失败,需要用户在配置文件设置或通过API设置。 - locale:系统区位信息及编码格式。系统中动态获取,如果自动获取失败,需要用户在配置文件设置或通过API设置。 +- maxBinaryDisplayWidth:Shell中binary 和 nchar字段的显示宽度上限,超过此限制的部分将被隐藏。默认值:30。可在 shell 中通过命令 set max_binary_display_width *nn* 动态修改此选项。 日志的配置参数,与server的配置参数完全一样。 @@ -152,19 +153,19 @@ TDengine系统的前台交互客户端应用程序为taos,它与taosd共享同 系统管理员可以在CLI界面里添加、删除用户,也可以修改密码。CLI里SQL语法如下: ``` -CREATE USER user_name PASS ‘password’; +CREATE USER PASS <‘password’>; ``` 创建用户,并指定用户名和密码,密码需要用单引号引起来 ``` -DROP USER user_name; +DROP USER ; ``` 删除用户,限root用户使用 ``` -ALTER USER user_name PASS ‘password’; +ALTER USER PASS <‘password’>; ``` 修改用户密码, 为避免被转换为小写,密码需要用单引号引用 @@ -173,7 +174,9 @@ ALTER USER user_name PASS ‘password’; SHOW USERS; ``` -显示所有用户 +显示所有用户 + +**注意:**SQL 语法中,< >表示需要用户输入的部分,但请不要输入< >本身 ## 数据导入 diff --git a/documentation20/webdocs/markdowndocs/connector-ch.md b/documentation20/webdocs/markdowndocs/connector-ch.md index 4f40ae7ea1..2cd12c3779 100644 --- a/documentation20/webdocs/markdowndocs/connector-ch.md +++ b/documentation20/webdocs/markdowndocs/connector-ch.md @@ -338,16 +338,11 @@ TDengine 目前支持时间戳、数字、字符、布尔类型,与 Java 对 maven 项目中使用如下 pom.xml 配置即可: ```xml - - - com.taosdata.jdbc - taos-jdbcdriver - 2.0.0 - jar - system - {localdir}/connector/taos-jdbcdriver-2.0.0-dist.jar - - + + com.taosdata.jdbc + taos-jdbcdriver + 2.0.1 + ``` ### 源码编译打包 @@ -752,9 +747,9 @@ http://:/rest/sql 参数说明: - IP: 集群中的任一台主机 -- PORT: 配置文件中httpPort配置项,缺省为6020 +- PORT: 配置文件中httpPort配置项,缺省为6041 -例如:http://192.168.0.1:6020/rest/sql 是指向IP地址为192.168.0.1的URL. +例如:http://192.168.0.1:6041/rest/sql 是指向IP地址为192.168.0.1的URL. HTTP请求的Header里需带有身份认证信息,TDengine支持Basic认证与自定义认证两种机制,后续版本将提供标准安全的数字签名机制来做身份验证。 @@ -814,7 +809,7 @@ curl -u username:password -d '' :/rest/sql HTTP请求中需要带有授权码``,用于身份识别。授权码通常由管理员提供,可简单的通过发送`HTTP GET`请求来获取授权码,操作如下: ``` -curl http://:6020/rest/login// +curl http://:6041/rest/login// ``` 其中,`ip`是TDengine数据库的IP地址,`username`为数据库用户名,`password`为数据库密码,返回值为`JSON`格式,各字段含义如下: @@ -828,7 +823,7 @@ curl http://:6020/rest/login// 获取授权码示例: ``` -curl http://192.168.0.1:6020/rest/login/root/taosdata +curl http://192.168.0.1:6041/rest/login/root/taosdata ``` 返回值: @@ -846,7 +841,7 @@ curl http://192.168.0.1:6020/rest/login/root/taosdata - 在demo库里查询表d1001的所有记录: ``` -curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'select * from demo.d1001' 192.168.0.1:6020/rest/sql` +curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'select * from demo.d1001' 192.168.0.1:6041/rest/sql ``` 返回值: @@ -865,7 +860,7 @@ curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'select * from demo.d1001 - 创建库demo: ``` -curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'create database demo' 192.168.0.1:6020/rest/sql` +curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'create database demo' 192.168.0.1:6041/rest/sql ``` 返回值: @@ -885,7 +880,7 @@ curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'create database demo' 19 HTTP请求URL采用`sqlt`时,返回结果集的时间戳将采用Unix时间戳格式表示,例如 ``` -curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'select * from demo.d1001' 192.168.0.1:6020/rest/sqlt +curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'select * from demo.d1001' 192.168.0.1:6041/rest/sqlt ``` 返回值: @@ -906,7 +901,7 @@ curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'select * from demo.d1001 HTTP请求URL采用`sqlutc`时,返回结果集的时间戳将采用UTC时间字符串表示,例如 ``` - curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'select * from demo.t1' 192.168.0.1:6020/rest/sqlutc + curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'select * from demo.t1' 192.168.0.1:6041/rest/sqlutc ``` 返回值: @@ -927,7 +922,7 @@ HTTP请求URL采用`sqlutc`时,返回结果集的时间戳将采用UTC时间 下面仅列出一些与RESTFul接口有关的配置参数,其他系统参数请看配置文件里的说明。注意:配置修改后,需要重启taosd服务才能生效 -- httpPort: 对外提供RESTFul服务的端口号,默认绑定到6020 +- httpPort: 对外提供RESTFul服务的端口号,默认绑定到6041 - httpMaxThreads: 启动的线程数量,默认为2 - restfulRowLimit: 返回结果集(JSON格式)的最大条数,默认值为10240 - httpEnableCompress: 是否支持压缩,默认不支持,目前TDengine仅支持gzip压缩格式 @@ -1099,3 +1094,18 @@ promise2.then(function(result) { [这里](https://github.com/taosdata/TDengine/tree/master/tests/examples/nodejs/node-example-raw.js)同样是一个使用NodeJS 连接器建表,插入天气数据并查询插入的数据的代码示例,但和上面不同的是,该示例只使用`cursor`. +[1]: https://search.maven.org/artifact/com.taosdata.jdbc/taos-jdbcdriver +[2]: https://mvnrepository.com/artifact/com.taosdata.jdbc/taos-jdbcdriver +[3]: https://github.com/taosdata/TDengine +[4]: https://www.taosdata.com/blog/2019/12/03/jdbcdriver%e6%89%be%e4%b8%8d%e5%88%b0%e5%8a%a8%e6%80%81%e9%93%be%e6%8e%a5%e5%ba%93/ +[5]: https://github.com/brettwooldridge/HikariCP +[6]: https://github.com/alibaba/druid +[7]: https://github.com/taosdata/TDengine/issues +[8]: https://search.maven.org/artifact/com.taosdata.jdbc/taos-jdbcdriver +[9]: https://mvnrepository.com/artifact/com.taosdata.jdbc/taos-jdbcdriver +[10]: https://maven.aliyun.com/mvn/search +[11]: https://github.com/taosdata/TDengine/tree/develop/tests/examples/JDBC/SpringJdbcTemplate +[12]: https://github.com/taosdata/TDengine/tree/develop/tests/examples/JDBC/springbootdemo +[13]: https://www.taosdata.com/cn/documentation20/administrator/#%E5%AE%A2%E6%88%B7%E7%AB%AF%E9%85%8D%E7%BD%AE +[14]: https://www.taosdata.com/cn/documentation20/connector/#Windows +[15]: https://www.taosdata.com/cn/getting-started/#%E5%BF%AB%E9%80%9F%E4%B8%8A%E6%89%8B \ No newline at end of file diff --git a/minidevops/grafana/tdengine/partials/config.html b/minidevops/grafana/tdengine/partials/config.html index 801a753271..f12eb86354 100644 --- a/minidevops/grafana/tdengine/partials/config.html +++ b/minidevops/grafana/tdengine/partials/config.html @@ -3,7 +3,7 @@
Host - +
diff --git a/minidevops/run.sh b/minidevops/run.sh index 15e74d0e5a..8e03d6e888 100755 --- a/minidevops/run.sh +++ b/minidevops/run.sh @@ -1,35 +1,28 @@ #!/bin/bash #set -x -LP=`pwd` -#echo $LP docker rm -f `docker ps -a -q` docker network rm minidevops docker network create --ip-range 172.15.1.255/24 --subnet 172.15.1.1/16 minidevops -#docker run -d --net="host" --pid="host" -v "/:/host:ro" quay.io/prometheus/node-exporter --path.rootfs=/host -docker run -d --net minidevops --ip 172.15.1.11 -v $LP/grafana:/var/lib/grafana/plugins -p 3000:3000 grafana/grafana -#docker run -d --net minidevops --ip 172.15.1.11 -v /Users/tom/Documents/minidevops/grafana:/var/lib/grafana/plugins -p 3000:3000 grafana/grafana +docker run -d --net minidevops --ip 172.15.1.11 -v $(pwd)/grafana:/var/lib/grafana/plugins -p 3000:3000 grafana/grafana -TDENGINE=`docker run -d --net minidevops --ip 172.15.1.6 -p 6030:6030 -p 6020:6020 -p 6031:6031 -p 6032:6032 -p 6033:6033 -p 6034:6034 -p 6035:6035 -p 6036:6036 -p 6037:6037 -p 6038:6038 -p 6039:6039 tdengine/tdengine:1.6.4.5` -docker cp /etc/localtime $TDENGINE:/etc/localtime +docker run -d --net minidevops --ip 172.15.1.6 -p 6030:6030 -p 6020:6020 -p 6031:6031 -p 6032:6032 -p 6033:6033 -p 6034:6034 -p 6035:6035 -p 6036:6036 -p 6037:6037 -p 6038:6038 -p 6039:6039 -p 6040:6040 -p 6041:6041 -h '172.15.1.6' tdengine/tdengine:2.0.0.0 -BLMPROMETHEUS=`docker run -d --net minidevops --ip 172.15.1.7 -p 10203:10203 tdengine/blm_prometheus 172.15.1.6` +docker run -d --net minidevops --ip 172.15.1.7 -v $(pwd)/taos:/etc/taos -p 10203:10203 tdengine/blm_prometheus:2.0.0.0 -tdengine-name 172.15.1.6 -tdengine-api-port 6041 -BLMPTELEGRAF=`docker run -d --net minidevops --ip 172.15.1.8 -p 10202:10202 tdengine/blm_telegraf 172.15.1.6` +docker run -d --net minidevops --ip 172.15.1.8 -p 10202:10202 tdengine/blm_telegraf:2.0.0.0 -host 172.15.1.6 -docker run -d --net minidevops --ip 172.15.1.9 -v $LP/prometheus:/etc/prometheus -p 9090:9090 prom/prometheus -#docker run -d --net minidevops --ip 172.15.1.9 -v /Users/tom/Documents/minidevops/prometheus:/etc/prometheus -p 9090:9090 prom/prometheus +docker run -d --net minidevops --ip 172.15.1.9 -v $(pwd)/prometheus:/etc/prometheus -p 9090:9090 prom/prometheus -docker run -d --net minidevops --ip 172.15.1.10 -v $LP/telegraf:/etc/telegraf -p 8092:8092 -p 8094:8094 -p 8125:8125 telegraf -#docker run -d --net minidevops --ip 172.15.1.10 -v /Users/tom/Documents/minidevops/telegraf:/etc/telegraf -p 8092:8092 -p 8094:8094 -p 8125:8125 telegraf +docker run -d --net minidevops --ip 172.15.1.10 -v $(pwd)/telegraf:/etc/telegraf -p 8092:8092 -p 8094:8094 -p 8125:8125 telegraf sleep 10 -curl -X POST http://localhost:3000/api/datasources --header "Content-Type:application/json" -u admin:admin -d '{"Name": "TDengine","Type": "tdengine","TypeLogoUrl": "public/plugins/tdengine/img/taosdata_logo.png","Access": "proxy","Url": "http://172.15.1.6:6020","BasicAuth": false,"isDefault": true,"jsonData": {},"readOnly": false}' +curl -X POST http://localhost:3000/api/datasources --header "Content-Type:application/json" -u admin:admin -d '{"Name": "TDengine","Type": "tdengine","TypeLogoUrl": "public/plugins/tdengine/img/taosdata_logo.png","Access": "proxy","Url": "http://172.15.1.6:6041","BasicAuth": false,"isDefault": true,"jsonData": {},"readOnly": false}' curl -X POST http://localhost:3000/api/dashboards/db --header "Content-Type:application/json" -u admin:admin -d '{"dashboard":{"annotations":{"list":[{"builtIn":1,"datasource":"-- Grafana --","enable":true,"hide":true,"iconColor":"rgba(0, 211, 255, 1)","name":"Annotations & Alerts","type":"dashboard"}]},"editable":true,"gnetId":null,"graphTooltip":0,"id":1,"links":[],"panels":[{"datasource":null,"gridPos":{"h":8,"w":6,"x":0,"y":0},"id":6,"options":{"fieldOptions":{"calcs":["mean"],"defaults":{"color":{"mode":"thresholds"},"links":[{"title":"","url":""}],"mappings":[],"max":100,"min":0,"thresholds":{"mode":"absolute","steps":[{"color":"green","value":null},{"color":"red","value":80}]},"unit":"percent"},"overrides":[],"values":false},"orientation":"auto","showThresholdLabels":false,"showThresholdMarkers":true},"pluginVersion":"6.6.0","targets":[{"refId":"A","sql":"select last_row(value) from telegraf.mem where field=\"used_percent\""}],"timeFrom":null,"timeShift":null,"title":"Memory used percent","type":"gauge"},{"aliasColors":{},"bars":false,"dashLength":10,"dashes":false,"datasource":null,"fill":1,"fillGradient":0,"gridPos":{"h":8,"w":12,"x":6,"y":0},"hiddenSeries":false,"id":8,"legend":{"avg":false,"current":false,"max":false,"min":false,"show":true,"total":false,"values":false},"lines":true,"linewidth":1,"nullPointMode":"null","options":{"dataLinks":[]},"percentage":false,"pointradius":2,"points":false,"renderer":"flot","seriesOverrides":[],"spaceLength":10,"stack":false,"steppedLine":false,"targets":[{"alias":"MEMUSED-PERCENT","refId":"A","sql":"select avg(value) from telegraf.mem where field=\"used_percent\" interval(1m)"}],"thresholds":[],"timeFrom":null,"timeRegions":[],"timeShift":null,"title":"MEM","tooltip":{"shared":true,"sort":0,"value_type":"individual"},"type":"graph","xaxis":{"buckets":null,"mode":"time","name":null,"show":true,"values":[]},"yaxes":[{"format":"short","label":null,"logBase":1,"max":null,"min":null,"show":true},{"format":"short","label":null,"logBase":1,"max":null,"min":null,"show":true}],"yaxis":{"align":false,"alignLevel":null}},{"datasource":null,"gridPos":{"h":3,"w":18,"x":0,"y":8},"id":10,"options":{"displayMode":"lcd","fieldOptions":{"calcs":["mean"],"defaults":{"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"green","value":null}]},"unit":"percent"},"overrides":[],"values":false},"orientation":"auto","showUnfilled":true},"pluginVersion":"6.6.0","targets":[{"alias":"CPU-SYS","refId":"A","sql":"select last_row(value) from telegraf.cpu where field=\"usage_system\""},{"alias":"CPU-IDLE","refId":"B","sql":"select last_row(value) from telegraf.cpu where field=\"usage_idle\""},{"alias":"CPU-USER","refId":"C","sql":"select last_row(value) from telegraf.cpu where field=\"usage_user\""}],"timeFrom":null,"timeShift":null,"title":"CPU-USED","type":"bargauge"},{"aliasColors":{},"bars":false,"dashLength":10,"dashes":false,"datasource":"TDengine","description":"General CPU monitor","fill":1,"fillGradient":0,"gridPos":{"h":9,"w":18,"x":0,"y":11},"hiddenSeries":false,"id":2,"legend":{"avg":false,"current":false,"max":false,"min":false,"show":true,"total":false,"values":false},"lines":true,"linewidth":1,"nullPointMode":"null","options":{"dataLinks":[]},"percentage":false,"pointradius":2,"points":false,"renderer":"flot","seriesOverrides":[],"spaceLength":10,"stack":false,"steppedLine":false,"targets":[{"alias":"CPU-USER","refId":"A","sql":"select avg(value) from telegraf.cpu where field=\"usage_user\" and cpu=\"cpu-total\" interval(1m)"},{"alias":"CPU-SYS","refId":"B","sql":"select avg(value) from telegraf.cpu where field=\"usage_system\" and cpu=\"cpu-total\" interval(1m)"},{"alias":"CPU-IDLE","refId":"C","sql":"select avg(value) from telegraf.cpu where field=\"usage_idle\" and cpu=\"cpu-total\" interval(1m)"}],"thresholds":[],"timeFrom":null,"timeRegions":[],"timeShift":null,"title":"CPU","tooltip":{"shared":true,"sort":0,"value_type":"individual"},"type":"graph","xaxis":{"buckets":null,"mode":"time","name":null,"show":true,"values":[]},"yaxes":[{"format":"short","label":null,"logBase":1,"max":null,"min":null,"show":true},{"format":"short","label":null,"logBase":1,"max":null,"min":null,"show":true}],"yaxis":{"align":false,"alignLevel":null}}],"refresh":"10s","schemaVersion":22,"style":"dark","tags":["demo"],"templating":{"list":[]},"time":{"from":"now-3h","to":"now"},"timepicker":{"refresh_intervals":["5s","10s","30s","1m","5m","15m","30m","1h","2h","1d"]},"timezone":"","title":"TDengineDashboardDemo","id":null,"uid":null,"version":0}}' diff --git a/minidevops/taos/taos.cfg b/minidevops/taos/taos.cfg new file mode 100644 index 0000000000..b20ce9d755 --- /dev/null +++ b/minidevops/taos/taos.cfg @@ -0,0 +1 @@ +debugFlag 135 diff --git a/packaging/deb/makedeb.sh b/packaging/deb/makedeb.sh index 55fbd96d3f..7bcb856291 100755 --- a/packaging/deb/makedeb.sh +++ b/packaging/deb/makedeb.sh @@ -47,7 +47,6 @@ cp ${compile_dir}/../packaging/cfg/taos.cfg ${pkg_dir}${install_home_pat cp ${compile_dir}/../packaging/deb/taosd ${pkg_dir}${install_home_path}/init.d cp ${compile_dir}/../packaging/tools/post.sh ${pkg_dir}${install_home_path}/script cp ${compile_dir}/../packaging/tools/preun.sh ${pkg_dir}${install_home_path}/script -cp ${compile_dir}/build/bin/taosdump ${pkg_dir}${install_home_path}/bin cp ${compile_dir}/build/bin/taosdemo ${pkg_dir}${install_home_path}/bin cp ${compile_dir}/build/bin/taosd ${pkg_dir}${install_home_path}/bin cp ${compile_dir}/build/bin/taos ${pkg_dir}${install_home_path}/bin diff --git a/packaging/docker/Dockerfile b/packaging/docker/Dockerfile index 22c1bc1902..3fb34e8286 100644 --- a/packaging/docker/Dockerfile +++ b/packaging/docker/Dockerfile @@ -5,14 +5,13 @@ WORKDIR /root COPY tdengine.tar.gz /root/ RUN tar -zxf tdengine.tar.gz WORKDIR /root/TDengine-server/ -RUN sh install.sh +RUN sh install.sh -e no ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib" ENV LANG=en_US.UTF-8 ENV LANGUAGE=en_US:en ENV LC_ALL=en_US.UTF-8 -EXPOSE 6020 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 -EXPOSE 6043 6044 6045 6046 6047 6048 6049 6050 +EXPOSE 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 CMD ["taosd"] VOLUME [ "/var/lib/taos", "/var/log/taos","/etc/taos/" ] diff --git a/packaging/docker/dockerbuild.sh b/packaging/docker/dockerbuild.sh index aeea6a2a95..a0ac49bed1 100755 --- a/packaging/docker/dockerbuild.sh +++ b/packaging/docker/dockerbuild.sh @@ -2,5 +2,5 @@ set -x $1 docker build --rm -f "Dockerfile" -t tdengine/tdengine:$1 "." -docker login -u tdengine -p ******** #replace the docker registry username and password -docker push tdengine/tdengine:$1 \ No newline at end of file +docker login -u tdengine -p $2 #replace the docker registry username and password +docker push tdengine/tdengine:$1 diff --git a/packaging/rpm/tdengine.spec b/packaging/rpm/tdengine.spec index ef02fb90fc..2fac159b04 100644 --- a/packaging/rpm/tdengine.spec +++ b/packaging/rpm/tdengine.spec @@ -58,7 +58,6 @@ cp %{_compiledir}/../packaging/tools/preun.sh %{buildroot}%{homepath}/scri cp %{_compiledir}/build/bin/taos %{buildroot}%{homepath}/bin cp %{_compiledir}/build/bin/taosd %{buildroot}%{homepath}/bin cp %{_compiledir}/build/bin/taosdemo %{buildroot}%{homepath}/bin -cp %{_compiledir}/build/bin/taosdump %{buildroot}%{homepath}/bin cp %{_compiledir}/build/lib/${libfile} %{buildroot}%{homepath}/driver cp %{_compiledir}/../src/inc/taos.h %{buildroot}%{homepath}/include cp %{_compiledir}/../src/inc/taoserror.h %{buildroot}%{homepath}/include @@ -134,7 +133,6 @@ if [ $1 -eq 0 ];then ${csudo} rm -f ${bin_link_dir}/taos || : ${csudo} rm -f ${bin_link_dir}/taosd || : ${csudo} rm -f ${bin_link_dir}/taosdemo || : - ${csudo} rm -f ${bin_link_dir}/taosdump || : ${csudo} rm -f ${cfg_link_dir}/* || : ${csudo} rm -f ${inc_link_dir}/taos.h || : ${csudo} rm -f ${inc_link_dir}/taoserror.h || : diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index ce5c052e97..0700ed4682 100644 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -22,6 +22,7 @@ cfg_install_dir="/etc/taos" bin_link_dir="/usr/bin" lib_link_dir="/usr/lib" +lib64_link_dir="/usr/lib64" inc_link_dir="/usr/include" #install main path @@ -165,7 +166,6 @@ function install_bin() { ${csudo} rm -f ${bin_link_dir}/taos || : ${csudo} rm -f ${bin_link_dir}/taosd || : ${csudo} rm -f ${bin_link_dir}/taosdemo || : - ${csudo} rm -f ${bin_link_dir}/taosdump || : ${csudo} rm -f ${bin_link_dir}/rmtaos || : ${csudo} rm -f ${bin_link_dir}/tarbitrator || : @@ -174,7 +174,6 @@ function install_bin() { #Make link [ -x ${install_main_dir}/bin/taos ] && ${csudo} ln -s ${install_main_dir}/bin/taos ${bin_link_dir}/taos || : [ -x ${install_main_dir}/bin/taosd ] && ${csudo} ln -s ${install_main_dir}/bin/taosd ${bin_link_dir}/taosd || : - [ -x ${install_main_dir}/bin/taosdump ] && ${csudo} ln -s ${install_main_dir}/bin/taosdump ${bin_link_dir}/taosdump || : [ -x ${install_main_dir}/bin/taosdemo ] && ${csudo} ln -s ${install_main_dir}/bin/taosdemo ${bin_link_dir}/taosdemo || : [ -x ${install_main_dir}/bin/remove.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/rmtaos || : [ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo} ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || : @@ -189,6 +188,7 @@ function install_bin() { function install_lib() { # Remove links ${csudo} rm -f ${lib_link_dir}/libtaos.* || : + ${csudo} rm -f ${lib64_link_dir}/libtaos.* || : #${csudo} rm -rf ${v15_java_app_dir} || : ${csudo} cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo} chmod 777 ${install_main_dir}/driver/* @@ -196,6 +196,9 @@ function install_lib() { ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1 ${csudo} ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so + ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || : + ${csudo} ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || : + #if [ "$verMode" == "cluster" ]; then # # Compatible with version 1.5 # ${csudo} mkdir -p ${v15_java_app_dir} diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh index 1cb412d9dd..1d65dd8069 100755 --- a/packaging/tools/makepkg.sh +++ b/packaging/tools/makepkg.sh @@ -36,7 +36,7 @@ if [ "$pagMode" == "lite" ]; then strip ${build_dir}/bin/taos bin_files="${build_dir}/bin/taosd ${build_dir}/bin/taos ${script_dir}/remove.sh" else - bin_files="${build_dir}/bin/taosd ${build_dir}/bin/taos ${build_dir}/bin/taosdemo ${build_dir}/bin/taosdump ${build_dir}/bin/tarbitrator ${script_dir}/remove.sh" + bin_files="${build_dir}/bin/taosd ${build_dir}/bin/taos ${build_dir}/bin/taosdemo ${build_dir}/bin/tarbitrator ${script_dir}/remove.sh" fi lib_files="${build_dir}/lib/libtaos.so.${version}" diff --git a/packaging/tools/post.sh b/packaging/tools/post.sh index cffe06e30c..e9a742e632 100755 --- a/packaging/tools/post.sh +++ b/packaging/tools/post.sh @@ -21,6 +21,7 @@ inc_dir="/usr/local/taos/include" cfg_install_dir="/etc/taos" bin_link_dir="/usr/bin" lib_link_dir="/usr/lib" +lib64_link_dir="/usr/lib64" inc_link_dir="/usr/include" service_config_dir="/etc/systemd/system" @@ -74,16 +75,19 @@ function install_include() { function install_lib() { ${csudo} rm -f ${lib_link_dir}/libtaos* || : + ${csudo} rm -f ${lib64_link_dir}/libtaos* || : ${csudo} ln -s ${lib_dir}/libtaos.* ${lib_link_dir}/libtaos.so.1 ${csudo} ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so + + ${csudo} ln -s ${lib_dir}/libtaos.* ${lib64_link_dir}/libtaos.so.1 || : + ${csudo} ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || : } function install_bin() { # Remove links ${csudo} rm -f ${bin_link_dir}/taos || : ${csudo} rm -f ${bin_link_dir}/taosd || : - ${csudo} rm -f ${bin_link_dir}/taosdump || : ${csudo} rm -f ${bin_link_dir}/taosdemo || : ${csudo} rm -f ${bin_link_dir}/rmtaos || : @@ -92,7 +96,6 @@ function install_bin() { #Make link [ -x ${bin_dir}/taos ] && ${csudo} ln -s ${bin_dir}/taos ${bin_link_dir}/taos || : [ -x ${bin_dir}/taosd ] && ${csudo} ln -s ${bin_dir}/taosd ${bin_link_dir}/taosd || : - [ -x ${bin_dir}/taosdump ] && ${csudo} ln -s ${bin_dir}/taosdump ${bin_link_dir}/taosdump || : [ -x ${bin_dir}/taosdemo ] && ${csudo} ln -s ${bin_dir}/taosdemo ${bin_link_dir}/taosdemo || : # [ -x ${bin_dir}/remove.sh ] && ${csudo} ln -s ${bin_dir}/remove.sh ${bin_link_dir}/rmtaos || : } diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt index eaebd2f19d..987c309add 100644 --- a/src/client/CMakeLists.txt +++ b/src/client/CMakeLists.txt @@ -37,7 +37,7 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM)) ADD_SUBDIRECTORY(tests) -ELSEIF (TD_WINDOWS_64) +ELSEIF (TD_WINDOWS) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/jni/windows) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/jni/windows/win32) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/pthread) diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h index 4fd9549e75..3ad4cd9455 100644 --- a/src/client/inc/tsclient.h +++ b/src/client/inc/tsclient.h @@ -158,7 +158,7 @@ typedef struct SParamInfo { int32_t idx; char type; uint8_t timePrec; - short bytes; + int16_t bytes; uint32_t offset; } SParamInfo; diff --git a/src/client/src/tscPrepare.c b/src/client/src/tscPrepare.c index 3ddfc1c341..0df1c7ddc5 100644 --- a/src/client/src/tscPrepare.c +++ b/src/client/src/tscPrepare.c @@ -298,7 +298,7 @@ static int doBindParam(char* data, SParamInfo* param, TAOS_BIND* bind) { break; case TSDB_DATA_TYPE_BINARY: - if ((*bind->length) > param->bytes) { + if ((*bind->length) > (uintptr_t)param->bytes) { return TSDB_CODE_TSC_INVALID_VALUE; } size = (short)*bind->length; diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index a9dee643b2..0cce4195e7 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -1987,7 +1987,8 @@ int tscProcessUseDbRsp(SSqlObj *pSql) { return 0; } -int tscProcessDropDbRsp(SSqlObj *UNUSED_PARAM(pSql)) { +int tscProcessDropDbRsp(SSqlObj *pSql) { + pSql->pTscObj->db[0] = 0; taosCacheEmpty(tscCacheHandle); return 0; } diff --git a/src/client/src/tscStream.c b/src/client/src/tscStream.c index 20b5e86090..6235e0aeba 100644 --- a/src/client/src/tscStream.c +++ b/src/client/src/tscStream.c @@ -220,15 +220,16 @@ static void tscProcessStreamRetrieveResult(void *param, TAOS_RES *res, int numOf STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(&pSql->cmd, 0, 0); if (numOfRows > 0) { // when reaching here the first execution of stream computing is successful. - pStream->numOfRes += numOfRows; for(int32_t i = 0; i < numOfRows; ++i) { TAOS_ROW row = taos_fetch_row(res); - tscDebug("%p stream:%p fetch result", pSql, pStream); - tscStreamFillTimeGap(pStream, *(TSKEY*)row[0]); - pStream->stime = *(TSKEY *)row[0]; - - // user callback function - (*pStream->fp)(pStream->param, res, row); + if (row != NULL) { + tscDebug("%p stream:%p fetch result", pSql, pStream); + tscStreamFillTimeGap(pStream, *(TSKEY*)row[0]); + pStream->stime = *(TSKEY *)row[0]; + // user callback function + (*pStream->fp)(pStream->param, res, row); + pStream->numOfRes++; + } } if (!pStream->isProject) { diff --git a/src/client/src/tscSub.c b/src/client/src/tscSub.c index 9569987de0..81d73236a4 100644 --- a/src/client/src/tscSub.c +++ b/src/client/src/tscSub.c @@ -203,6 +203,7 @@ static void tscProcessSubscriptionTimer(void *handle, void *tmrId) { static SArray* getTableList( SSqlObj* pSql ) { const char* p = strstr( pSql->sqlstr, " from " ); + assert(p != NULL); // we are sure this is a 'select' statement char* sql = alloca(strlen(p) + 32); sprintf(sql, "select tbid(tbname)%s", p); diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index e856481a9a..05114cc324 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -1,6 +1,12 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) PROJECT(TDengine) +IF (TD_WINDOWS) + INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/pthread) + INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/iconv) + INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/regex) +ENDIF () + INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/inc) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/os/inc) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/util/inc) diff --git a/src/common/src/tdataformat.c b/src/common/src/tdataformat.c index a185a9de7b..0be0216174 100644 --- a/src/common/src/tdataformat.c +++ b/src/common/src/tdataformat.c @@ -565,7 +565,7 @@ int tdSetKVRowDataOfCol(SKVRow *orow, int16_t colId, int8_t type, void *value) { nrow = malloc(kvRowLen(row) + sizeof(SColIdx) + diff); if (nrow == NULL) return -1; - kvRowSetLen(nrow, kvRowLen(row) + sizeof(SColIdx) + diff); + kvRowSetLen(nrow, kvRowLen(row) + (int16_t)sizeof(SColIdx) + diff); kvRowSetNCols(nrow, kvRowNCols(row) + 1); if (ptr == NULL) { @@ -573,10 +573,10 @@ int tdSetKVRowDataOfCol(SKVRow *orow, int16_t colId, int8_t type, void *value) { memcpy(kvRowValues(nrow), kvRowValues(row), POINTER_DISTANCE(kvRowEnd(row), kvRowValues(row))); int colIdx = kvRowNCols(nrow) - 1; kvRowColIdxAt(nrow, colIdx)->colId = colId; - kvRowColIdxAt(nrow, colIdx)->offset = POINTER_DISTANCE(kvRowEnd(row), kvRowValues(row)); + kvRowColIdxAt(nrow, colIdx)->offset = (int16_t)(POINTER_DISTANCE(kvRowEnd(row), kvRowValues(row))); memcpy(kvRowColVal(nrow, kvRowColIdxAt(nrow, colIdx)), value, diff); } else { - int16_t tlen = POINTER_DISTANCE(ptr, kvRowColIdx(row)); + int16_t tlen = (int16_t)(POINTER_DISTANCE(ptr, kvRowColIdx(row))); if (tlen > 0) { memcpy(kvRowColIdx(nrow), kvRowColIdx(row), tlen); memcpy(kvRowValues(nrow), kvRowValues(row), ((SColIdx *)ptr)->offset); @@ -617,7 +617,7 @@ int tdSetKVRowDataOfCol(SKVRow *orow, int16_t colId, int8_t type, void *value) { kvRowSetNCols(nrow, kvRowNCols(row)); // Copy part ahead - nlen = POINTER_DISTANCE(ptr, kvRowColIdx(row)); + nlen = (int16_t)(POINTER_DISTANCE(ptr, kvRowColIdx(row))); ASSERT(nlen % sizeof(SColIdx) == 0); if (nlen > 0) { ASSERT(((SColIdx *)ptr)->offset > 0); diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index c3dc078428..0cd3196ad0 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -92,7 +92,7 @@ int32_t tsStreamCompStartDelay = 10000; int32_t tsStreamCompRetryDelay = 10; // The delayed computing ration. 10% of the whole computing time window by default. -float tsStreamComputDelayRatio = 0.1; +float tsStreamComputDelayRatio = 0.1f; int32_t tsProjectExecInterval = 10000; // every 10sec, the projection will be executed once int64_t tsMaxRetentWindow = 24 * 3600L; // maximum time window tolerance @@ -126,7 +126,7 @@ int32_t tsMnodeEqualVnodeNum = 4; // restful int32_t tsEnableHttpModule = 1; int32_t tsRestRowLimit = 10240; -uint16_t tsHttpPort = 6020; // only tcp, range tcp[6020] +uint16_t tsHttpPort = 6041; // only tcp, range tcp[6041] int32_t tsHttpCacheSessions = 1000; int32_t tsHttpSessionExpire = 36000; int32_t tsHttpMaxThreads = 2; @@ -173,8 +173,8 @@ float tsTotalTmpDirGB = 0; float tsTotalDataDirGB = 0; float tsAvailTmpDirectorySpace = 0; float tsAvailDataDirGB = 0; -float tsReservedTmpDirectorySpace = 0.1; -float tsMinimalDataDirGB = 0.5; +float tsReservedTmpDirectorySpace = 0.1f; +float tsMinimalDataDirGB = 0.5f; int32_t tsTotalMemoryMB = 0; int32_t tsVersion = 0; @@ -294,7 +294,7 @@ bool taosCfgDynamicOptions(char *msg) { return false; } -static void doInitGlobalConfig() { +static void doInitGlobalConfig(void) { SGlobalCfg cfg = {0}; // ip address @@ -405,8 +405,8 @@ static void doInitGlobalConfig() { cfg.ptr = &tsRatioOfQueryThreads; cfg.valType = TAOS_CFG_VTYPE_FLOAT; cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG; - cfg.minValue = 0.1; - cfg.maxValue = 0.9; + cfg.minValue = 0.1f; + cfg.maxValue = 0.9f; cfg.ptrLength = 0; cfg.unitType = TAOS_CFG_UTYPE_NONE; taosInitConfigOption(cfg); @@ -607,8 +607,8 @@ static void doInitGlobalConfig() { cfg.ptr = &tsStreamComputDelayRatio; cfg.valType = TAOS_CFG_VTYPE_FLOAT; cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW; - cfg.minValue = 0.1; - cfg.maxValue = 0.9; + cfg.minValue = 0.1f; + cfg.maxValue = 0.9f; cfg.ptrLength = 0; cfg.unitType = TAOS_CFG_UTYPE_NONE; taosInitConfigOption(cfg); @@ -870,7 +870,7 @@ static void doInitGlobalConfig() { cfg.ptr = &tsMinimalLogDirGB; cfg.valType = TAOS_CFG_VTYPE_FLOAT; cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW; - cfg.minValue = 0.001; + cfg.minValue = 0.001f; cfg.maxValue = 10000000; cfg.ptrLength = 0; cfg.unitType = TAOS_CFG_UTYPE_GB; @@ -880,7 +880,7 @@ static void doInitGlobalConfig() { cfg.ptr = &tsReservedTmpDirectorySpace; cfg.valType = TAOS_CFG_VTYPE_FLOAT; cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW; - cfg.minValue = 0.001; + cfg.minValue = 0.001f; cfg.maxValue = 10000000; cfg.ptrLength = 0; cfg.unitType = TAOS_CFG_UTYPE_GB; @@ -890,7 +890,7 @@ static void doInitGlobalConfig() { cfg.ptr = &tsMinimalDataDirGB; cfg.valType = TAOS_CFG_VTYPE_FLOAT; cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW; - cfg.minValue = 0.001; + cfg.minValue = 0.001f; cfg.maxValue = 10000000; cfg.ptrLength = 0; cfg.unitType = TAOS_CFG_UTYPE_GB; @@ -1256,7 +1256,7 @@ static void doInitGlobalConfig() { cfg.valType = TAOS_CFG_VTYPE_INT32; cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT; cfg.minValue = 1; - cfg.maxValue = 0x7fffffff; + cfg.maxValue = 65536; cfg.ptrLength = 0; cfg.unitType = TAOS_CFG_UTYPE_NONE; taosInitConfigOption(cfg); @@ -1338,7 +1338,7 @@ int taosGetFqdnPortFromEp(const char *ep, char *fqdn, uint16_t *port) { */ bool taosCheckBalanceCfgOptions(const char *option, int32_t *vnodeId, int32_t *dnodeId) { - int len = strlen(option); + int len = (int)strlen(option); if (strncasecmp(option, "vnode:", 6) != 0) { return false; } diff --git a/src/common/src/tname.c b/src/common/src/tname.c index 15ec68fc66..d80ddb0ee2 100644 --- a/src/common/src/tname.c +++ b/src/common/src/tname.c @@ -6,7 +6,7 @@ #include "ttokendef.h" // todo refactor -__attribute__((unused)) static FORCE_INLINE const char* skipSegments(const char* input, char delim, int32_t num) { +UNUSED_FUNC static FORCE_INLINE const char* skipSegments(const char* input, char delim, int32_t num) { for (int32_t i = 0; i < num; ++i) { while (*input != 0 && *input++ != delim) { }; @@ -14,7 +14,7 @@ __attribute__((unused)) static FORCE_INLINE const char* skipSegments(const char* return input; } -__attribute__((unused)) static FORCE_INLINE size_t copy(char* dst, const char* src, char delimiter) { +UNUSED_FUNC static FORCE_INLINE size_t copy(char* dst, const char* src, char delimiter) { size_t len = 0; while (*src != delimiter && *src != 0) { *dst++ = *src++; @@ -120,11 +120,11 @@ void extractTableNameFromToken(SSQLToken* pToken, SSQLToken* pTable) { char* r = strnchr(pToken->z, sep, pToken->n, false); if (r != NULL) { // record the table name token - pTable->n = r - pToken->z; + pTable->n = (uint32_t)(r - pToken->z); pTable->z = pToken->z; r += 1; - pToken->n -= (r - pToken->z); + pToken->n -= (uint32_t)(r - pToken->z); pToken->z = r; } } diff --git a/src/common/src/ttypes.c b/src/common/src/ttypes.c index 44b1d9fc38..3910d80ecf 100644 --- a/src/common/src/ttypes.c +++ b/src/common/src/ttypes.c @@ -204,8 +204,8 @@ static void getStatics_i64(const TSKEY *primaryKey, const void *pData, int32_t n static void getStatics_f(const TSKEY *primaryKey, const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, int64_t *sum, int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) { float *data = (float *)pData; - float fmin = DBL_MAX; - float fmax = -DBL_MAX; + float fmin = FLT_MAX; + float fmax = -FLT_MAX; double dsum = 0; *minIndex = 0; *maxIndex = 0; diff --git a/src/common/src/tvariant.c b/src/common/src/tvariant.c index 2906b3f0ac..5460d21252 100644 --- a/src/common/src/tvariant.c +++ b/src/common/src/tvariant.c @@ -101,19 +101,19 @@ void tVariantCreateFromBinary(tVariant *pVar, const char *pz, size_t len, uint32 break; } case TSDB_DATA_TYPE_NCHAR: { // here we get the nchar length from raw binary bits length - int32_t lenInwchar = len / TSDB_NCHAR_SIZE; + size_t lenInwchar = len / TSDB_NCHAR_SIZE; pVar->wpz = calloc(1, (lenInwchar + 1) * TSDB_NCHAR_SIZE); wcsncpy(pVar->wpz, (wchar_t *)pz, lenInwchar); pVar->wpz[lenInwchar] = 0; - pVar->nLen = len; + pVar->nLen = (int32_t)len; break; } case TSDB_DATA_TYPE_BINARY: { // todo refactor, extract a method pVar->pz = calloc(len, sizeof(char)); memcpy(pVar->pz, pz, len); - pVar->nLen = len; + pVar->nLen = (int32_t)len; break; } @@ -185,7 +185,7 @@ int32_t tVariantToString(tVariant *pVar, char *dst) { case TSDB_DATA_TYPE_NCHAR: { dst[0] = '\''; taosUcs4ToMbs(pVar->wpz, (twcslen(pVar->wpz) + 1) * TSDB_NCHAR_SIZE, dst + 1); - int32_t len = strlen(dst); + int32_t len = (int32_t)strlen(dst); dst[len] = '\''; dst[len + 1] = 0; return len + 1; @@ -361,11 +361,11 @@ static int32_t toBinary(tVariant *pVariant, char **pDest, int32_t *pDestSize) { pBuf = realloc(pBuf, newSize + 1); } - taosUcs4ToMbs(pVariant->wpz, newSize, pBuf); + taosUcs4ToMbs(pVariant->wpz, (int32_t)newSize, pBuf); free(pVariant->wpz); pBuf[newSize] = 0; } else { - taosUcs4ToMbs(pVariant->wpz, newSize, *pDest); + taosUcs4ToMbs(pVariant->wpz, (int32_t)newSize, *pDest); } } else { @@ -384,7 +384,7 @@ static int32_t toBinary(tVariant *pVariant, char **pDest, int32_t *pDestSize) { *pDest = pBuf; } - *pDestSize = strlen(*pDest); + *pDestSize = (int32_t)strlen(*pDest); return 0; } @@ -428,7 +428,7 @@ static int32_t toNchar(tVariant *pVariant, char **pDest, int32_t *pDestSize) { taosMbsToUcs4(pDst, nLen, *pDest, (nLen + 1) * TSDB_NCHAR_SIZE, &output); if (pDestSize != NULL) { - *pDestSize = output; + *pDestSize = (int32_t)output; } } @@ -682,7 +682,7 @@ int32_t tVariantDump(tVariant *pVariant, char *payload, int16_t type, bool inclu float fv = (float)pVariant->i64Key; SET_FLOAT_VAL_ALIGN(payload, &fv); #else - *((float *)payload) = pVariant->i64Key; + *((float *)payload) = (float)pVariant->i64Key; #endif } else if (pVariant->nType == TSDB_DATA_TYPE_DOUBLE || pVariant->nType == TSDB_DATA_TYPE_FLOAT) { #ifdef _TD_ARM_32_ @@ -735,7 +735,7 @@ int32_t tVariantDump(tVariant *pVariant, char *payload, int16_t type, bool inclu double dv = (double)(pVariant->i64Key); SET_DOUBLE_VAL_ALIGN(payload, &dv); #else - *((double *)payload) = pVariant->i64Key; + *((double *)payload) = (double)pVariant->i64Key; #endif } else if (pVariant->nType == TSDB_DATA_TYPE_DOUBLE || pVariant->nType == TSDB_DATA_TYPE_FLOAT) { #ifdef _TD_ARM_32_ diff --git a/src/connector/grafana/tdengine/dist/partials/config.html b/src/connector/grafana/tdengine/dist/partials/config.html index 801a753271..f12eb86354 100644 --- a/src/connector/grafana/tdengine/dist/partials/config.html +++ b/src/connector/grafana/tdengine/dist/partials/config.html @@ -3,7 +3,7 @@
Host - +
diff --git a/src/connector/grafana/tdengine/src/partials/config.html b/src/connector/grafana/tdengine/src/partials/config.html index 801a753271..f12eb86354 100644 --- a/src/connector/grafana/tdengine/src/partials/config.html +++ b/src/connector/grafana/tdengine/src/partials/config.html @@ -3,7 +3,7 @@
Host - +
diff --git a/src/connector/jdbc/deploy-pom.xml b/src/connector/jdbc/deploy-pom.xml new file mode 100755 index 0000000000..b73bb010e0 --- /dev/null +++ b/src/connector/jdbc/deploy-pom.xml @@ -0,0 +1,218 @@ + + + 4.0.0 + + com.taosdata.jdbc + taos-jdbcdriver + 2.0.0-SNAPSHOT + jar + + + JDBCDriver + https://github.com/taosdata/TDengine/tree/master/src/connector/jdbc + TDengine JDBC Driver + + + + + GNU AFFERO GENERAL PUBLIC LICENSE Version 3 + https://github.com/taosdata/TDengine/blob/master/LICENSE + repo + + + + + scm:git:git://github.com/taosdata/TDengine.git + scm:git:git@github.com:taosdata/TDengine.git + https://github.com/taosdata/TDengine/tree/master/src/connector/jdbc + HEAD + + + + + taosdata + support@taosdata.com + https://www.taosdata.com/ + https://www.taosdata.com/ + + + + + + + commons-logging + commons-logging + 1.2 + + + * + * + + + + + org.apache.commons + commons-lang3 + 3.5 + + + junit + junit + 4.13 + test + + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 3.0.0 + + + src/main/assembly/assembly-jar.xml + + + + + make-assembly + package + + single + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.6.1 + + UTF-8 + 11 + 11 + true + true + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.2.1 + + + attach-sources + + jar + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.2.0 + + UTF-8 + UTF-8 + UTF-8 + + + + attach-javadocs + + jar + + + none + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.6 + + + sign-artifacts + verify + + sign + + + + + + org.apache.maven.plugins + maven-deploy-plugin + 2.8.2 + + + default-deploy + deploy + + deploy + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + true + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.7 + true + + ossrh-td + https://oss.sonatype.org/ + true + + + + org.apache.maven.plugins + maven-release-plugin + 2.5.3 + + true + false + forked-path + -Dgpg.passphrase=${gpg.passphrase} + + + + org.apache.maven.scm + maven-scm-provider-gitexe + 1.11.2 + + + + + + + + + + ossrh-td + https://oss.sonatype.org/content/repositories/snapshots + + + ossrh-td + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBJNIConnector.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBJNIConnector.java index e9acffe0e3..13fa2eda81 100755 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBJNIConnector.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBJNIConnector.java @@ -97,7 +97,7 @@ public class TSDBJNIConnector { this.taos = this.connectImp(host, port, dbName, user, password); if (this.taos == TSDBConstants.JNI_NULL_POINTER) { - throw new SQLException(TSDBConstants.WrapErrMsg(this.getErrMsg(null)), "", this.getErrCode(null)); + throw new SQLException(TSDBConstants.WrapErrMsg(this.getErrMsg(0L)), "", this.getErrCode(0l)); } return true; @@ -115,7 +115,7 @@ public class TSDBJNIConnector { freeResultSet(taosResultSetPointer); } - long pSql = 0l; + Long pSql = 0l; try { pSql = this.executeQueryImp(sql.getBytes(TaosGlobalConfig.getCharset()), this.taos); } catch (Exception e) { @@ -124,16 +124,11 @@ public class TSDBJNIConnector { throw new SQLException(TSDBConstants.WrapErrMsg("Unsupported encoding")); } int code = this.getErrCode(pSql); - - if (code < 0) { + if (code != 0) { affectedRows = -1; - if (code == TSDBConstants.JNI_TDENGINE_ERROR) { - this.freeResultSet(pSql); - throw new SQLException(TSDBConstants.WrapErrMsg(this.getErrMsg(pSql)), "", this.getErrCode(pSql)); - } else { - this.freeResultSet(pSql); - throw new SQLException(TSDBConstants.FixErrMsg(code), "", this.getErrCode(pSql)); - } + String err_msg = this.getErrMsg(pSql); + this.freeResultSet(pSql); + throw new SQLException(TSDBConstants.WrapErrMsg(err_msg), "", code); } // Try retrieving result set for the executed SQL using the current connection pointer. If the executed @@ -151,20 +146,20 @@ public class TSDBJNIConnector { /** * Get recent error code by connection */ - public int getErrCode(Long pSql) { - return Math.abs(this.getErrCodeImp(this.taos, pSql)); + public int getErrCode(long pSql) { + return this.getErrCodeImp(this.taos, pSql); } - private native int getErrCodeImp(long connection, Long pSql); + private native int getErrCodeImp(long connection, long pSql); /** * Get recent error message by connection */ - public String getErrMsg(Long pSql) { - return this.getErrMsgImp(this.taos, pSql); + public String getErrMsg(long pSql) { + return this.getErrMsgImp(pSql); } - private native String getErrMsgImp(long connection, Long pSql); + private native String getErrMsgImp(long pSql); /** * Get resultset pointer @@ -248,7 +243,7 @@ public class TSDBJNIConnector { public void closeConnection() throws SQLException { int code = this.closeConnectionImp(this.taos); if (code < 0) { - throw new SQLException(TSDBConstants.FixErrMsg(code), "", this.getErrCode(null)); + throw new SQLException(TSDBConstants.FixErrMsg(code), "", this.getErrCode(0l)); } else if (code == 0) { this.taos = TSDBConstants.JNI_NULL_POINTER; } else { diff --git a/src/dnode/src/dnodeTelemetry.c b/src/dnode/src/dnodeTelemetry.c index 60277a275a..892fd1d903 100644 --- a/src/dnode/src/dnodeTelemetry.c +++ b/src/dnode/src/dnodeTelemetry.c @@ -22,8 +22,16 @@ #include "tsocket.h" #include "tbuffer.h" #include "mnode.h" +#include "mnodeDef.h" +#include "mnodeDb.h" +#include "mnodeDnode.h" #include "mnodeCluster.h" +#include "mnodeDnode.h" +#include "mnodeVgroup.h" +#include "mnodeMnode.h" +#include "mnodeTable.h" #include "mnodeSdb.h" +#include "mnodeAcct.h" #include "dnode.h" #include "dnodeInt.h" #include "dnodeTelemetry.h" @@ -33,7 +41,7 @@ static pthread_t tsTelemetryThread; #define TELEMETRY_SERVER "telemetry.taosdata.com" #define TELEMETRY_PORT 80 -#define REPORT_INTERVAL 86400 +#define REPORT_INTERVAL 86400 static void beginObject(SBufferWriter* bw) { tbufWriteChar(bw, '{'); @@ -170,18 +178,23 @@ static void addVersionInfo(SBufferWriter* bw) { addStringField(bw, "version", version); addStringField(bw, "buildInfo", buildinfo); addStringField(bw, "gitInfo", gitinfo); - //addStringField(&bw, "installAt", "2020-08-01T00:00:00Z"); } static void addRuntimeInfo(SBufferWriter* bw) { - // addIntField(&bw, "numOfDnode", 1); - // addIntField(&bw, "numOfVnode", 1); - // addIntField(&bw, "numOfStable", 1); - // addIntField(&bw, "numOfTable", 1); - // addIntField(&bw, "numOfRows", 1); - // addStringField(&bw, "startAt", "2020-08-01T00:00:00Z"); - // addStringField(&bw, "memoryUsage", "10240 kB"); - // addStringField(&bw, "diskUsage", "10240 MB"); + addIntField(bw, "numOfDnode", mnodeGetDnodesNum()); + addIntField(bw, "numOfMnode", mnodeGetMnodesNum()); + addIntField(bw, "numOfVgroup", mnodeGetVgroupNum()); + addIntField(bw, "numOfDatabase", mnodeGetDbNum()); + addIntField(bw, "numOfSuperTable", mnodeGetSuperTableNum()); + addIntField(bw, "numOfChildTable", mnodeGetChildTableNum()); + + SAcctInfo info; + mnodeGetStatOfAllAcct(&info); + addIntField(bw, "numOfColumn", info.numOfTimeSeries); + addIntField(bw, "numOfPoint", info.totalPoints); + addIntField(bw, "totalStorage", info.totalStorage); + addIntField(bw, "compStorage", info.compStorage); + // addStringField(bw, "installTime", "2020-08-01T00:00:00Z"); } static void sendTelemetryReport() { @@ -220,28 +233,29 @@ static void sendTelemetryReport() { taosWriteSocket(fd, tbufGetData(&bw, false), contLen); tbufCloseWriter(&bw); - taosReadSocket(fd, buf, 10); // read something to avoid nginx error 499 + // read something to avoid nginx error 499 + if (taosReadSocket(fd, buf, 10) < 0) { + dTrace("failed to receive response, reason:%s", strerror(errno)); + } taosCloseSocket(fd); } static void* telemetryThread(void* param) { - int timeToWait = 0; + struct timespec end = {0}; + clock_gettime(CLOCK_REALTIME, &end); + end.tv_sec += 300; // wait 5 minutes before send first report + while (1) { - if (timeToWait <= 0) { - if (sdbIsMaster()) { - sendTelemetryReport(); - } - timeToWait = REPORT_INTERVAL; + if (sem_timedwait(&tsExitSem, &end) == 0) { + break; + } else if (errno != ETIMEDOUT) { + continue; } - int startAt = taosGetTimestampSec(); - struct timespec timeout = {.tv_sec = 0, .tv_nsec = 0}; - clock_gettime(CLOCK_REALTIME, &timeout); - timeout.tv_sec += timeToWait; - if (sem_timedwait(&tsExitSem, &timeout) == 0) { - break; + if (sdbIsMaster()) { + sendTelemetryReport(); } - timeToWait -= (taosGetTimestampSec() - startAt); + end.tv_sec += REPORT_INTERVAL; } return NULL; diff --git a/src/inc/taos.h b/src/inc/taos.h index 1d609bc7db..f3cc9bb4d7 100644 --- a/src/inc/taos.h +++ b/src/inc/taos.h @@ -72,8 +72,8 @@ DLL_EXPORT void taos_close(TAOS *taos); typedef struct TAOS_BIND { int buffer_type; void * buffer; - unsigned long buffer_length; // unused - unsigned long *length; + uintptr_t buffer_length; // unused + uintptr_t *length; int * is_null; int is_unsigned; // unused int * error; // unused diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index 0b47971353..265bf47d6d 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -206,7 +206,7 @@ typedef struct SSubmitMsg { SMsgHead header; int32_t length; int32_t numOfBlocks; - SSubmitBlk blocks[]; + char blocks[]; } SSubmitMsg; typedef struct { @@ -680,7 +680,7 @@ typedef struct STableMetaMsg { typedef struct SMultiTableMeta { int32_t numOfTables; int32_t contLen; - STableMetaMsg metas[]; + char metas[]; } SMultiTableMeta; typedef struct { diff --git a/src/kit/shell/CMakeLists.txt b/src/kit/shell/CMakeLists.txt index 3695f694f3..445d4f6951 100644 --- a/src/kit/shell/CMakeLists.txt +++ b/src/kit/shell/CMakeLists.txt @@ -22,7 +22,7 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM)) # ENDIF () SET_TARGET_PROPERTIES(shell PROPERTIES OUTPUT_NAME taos) -ELSEIF (TD_WINDOWS_64) +ELSEIF (TD_WINDOWS) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/pthread) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/regex) LIST(APPEND SRC ./src/shellEngine.c) diff --git a/src/kit/taosdemo/taosdemo.c b/src/kit/taosdemo/taosdemo.c index 79cfbe2a37..bebcf26277 100644 --- a/src/kit/taosdemo/taosdemo.c +++ b/src/kit/taosdemo/taosdemo.c @@ -43,9 +43,10 @@ extern char configDir[]; #define MAX_DB_NAME_SIZE 64 #define MAX_TB_NAME_SIZE 64 #define MAX_DATA_SIZE 1024 -#define MAX_NUM_DATATYPE 8 +#define MAX_NUM_DATATYPE 30 #define OPT_ABORT 1 /* –abort */ #define STRING_LEN 512 +#define MAX_PREPARED_RAND 1000000 /* The options we understand. */ static struct argp_option options[] = { @@ -175,6 +176,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) { } sptr[index++] = token; token = strsep(&running, ", "); + if (index >= MAX_NUM_DATATYPE) break; } } break; @@ -311,6 +313,8 @@ int generateData(char *res, char **data_type, int num_of_cols, int64_t timestamp void rand_string(char *str, int size); +void init_rand_data(); + double getCurrentTime(); void callBack(void *param, TAOS_RES *res, int code); @@ -361,7 +365,7 @@ int main(int argc, char *argv[]) { arguments.num_of_DPT = 100000; arguments.num_of_RPR = 1000; arguments.use_metric = true; - arguments.insert_only = false; + arguments.insert_only = true; // end change argp_parse(&argp, argc, argv, 0, 0, &arguments); @@ -403,6 +407,7 @@ int main(int argc, char *argv[]) { taos_close(qtaos); return 0; } + init_rand_data(); memset(dataString, 0, STRING_LEN); int len = 0; @@ -411,7 +416,7 @@ int main(int argc, char *argv[]) { do_aggreFunc = false; } for (; count_data_type <= MAX_NUM_DATATYPE; count_data_type++) { - if (strcasecmp(data_type[count_data_type], "") == 0) { + if (data_type[count_data_type] == NULL) { break; } @@ -1169,6 +1174,66 @@ double getCurrentTime() { return tv.tv_sec + tv.tv_usec / 1E6; } +int32_t randint[MAX_PREPARED_RAND]; +int64_t randbigint[MAX_PREPARED_RAND]; +float randfloat[MAX_PREPARED_RAND]; +double randdouble[MAX_PREPARED_RAND]; + +int32_t rand_tinyint(){ + static int cursor; + cursor++; + cursor = cursor % MAX_PREPARED_RAND; + return randint[cursor] % 128; + +} + +int32_t rand_smallint(){ + static int cursor; + cursor++; + cursor = cursor % MAX_PREPARED_RAND; + return randint[cursor] % 32767; +} + +int32_t rand_int(){ + static int cursor; + cursor++; + cursor = cursor % MAX_PREPARED_RAND; + return randint[cursor]; +} + +int64_t rand_bigint(){ + static int cursor; + cursor++; + cursor = cursor % MAX_PREPARED_RAND; + return randbigint[cursor]; + +} + +float rand_float(){ + static int cursor; + cursor++; + cursor = cursor % MAX_PREPARED_RAND; + return randfloat[cursor]; + +} + +double rand_double() { + static int cursor; + cursor++; + cursor = cursor % MAX_PREPARED_RAND; + return randdouble[cursor]; + +} + +void init_rand_data(){ + for (int i = 0; i < MAX_PREPARED_RAND; i++){ + randint[i] = (int)(rand() % 10); + randbigint[i] = (int64_t)(rand() % 2147483648); + randfloat[i] = (float)(rand() / 1000.0); + randdouble[i] = (double)(rand() / 1000000.0); + } +} + int32_t generateData(char *res, char **data_type, int num_of_cols, int64_t timestamp, int len_of_binary) { memset(res, 0, MAX_DATA_SIZE); char *pstr = res; @@ -1176,7 +1241,7 @@ int32_t generateData(char *res, char **data_type, int num_of_cols, int64_t times int c = 0; for (; c < MAX_NUM_DATATYPE; c++) { - if (strcasecmp(data_type[c], "") == 0) { + if (data_type[c] == NULL) { break; } } @@ -1188,17 +1253,17 @@ int32_t generateData(char *res, char **data_type, int num_of_cols, int64_t times for (int i = 0; i < num_of_cols; i++) { if (strcasecmp(data_type[i % c], "tinyint") == 0) { - pstr += sprintf(pstr, ", %d", (int)(rand() % 128)); + pstr += sprintf(pstr, ", %d", rand_tinyint() ); } else if (strcasecmp(data_type[i % c], "smallint") == 0) { - pstr += sprintf(pstr, ", %d", (int)(rand() % 32767)); + pstr += sprintf(pstr, ", %d", rand_smallint()); } else if (strcasecmp(data_type[i % c], "int") == 0) { - pstr += sprintf(pstr, ", %d", (int)(rand() % 10)); + pstr += sprintf(pstr, ", %d", rand_int()); } else if (strcasecmp(data_type[i % c], "bigint") == 0) { - pstr += sprintf(pstr, ", %" PRId64, rand() % 2147483648); + pstr += sprintf(pstr, ", %" PRId64, rand_bigint()); } else if (strcasecmp(data_type[i % c], "float") == 0) { - pstr += sprintf(pstr, ", %10.4f", (float)(rand() / 1000.0)); + pstr += sprintf(pstr, ", %10.4f", rand_float()); } else if (strcasecmp(data_type[i % c], "double") == 0) { - double t = (double)(rand() / 1000000.0); + double t = rand_double(); pstr += sprintf(pstr, ", %20.8f", t); } else if (strcasecmp(data_type[i % c], "bool") == 0) { bool b = rand() & 1; diff --git a/src/kit/taosdump/taosdump.c b/src/kit/taosdump/taosdump.c index ee98c711e0..8a05c893e8 100644 --- a/src/kit/taosdump/taosdump.c +++ b/src/kit/taosdump/taosdump.c @@ -29,6 +29,7 @@ #include #include +#include "os.h" #include "taos.h" #include "taosdef.h" #include "taosmsg.h" @@ -191,7 +192,7 @@ struct arguments { char *user; char *password; uint16_t port; - char cversion[TSDB_FILENAME_LEN+1]; + char cversion[12]; uint16_t mysqlFlag; // output file char outpath[TSDB_FILENAME_LEN+1]; @@ -248,7 +249,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) { fprintf(stderr, "Invalid client vesion %s\n", arg); return -1; } - strcpy(arguments->cversion, full_path.we_wordv[0]); + tstrncpy(arguments->cversion, full_path.we_wordv[0], 11); wordfree(&full_path); break; // output file path @@ -257,7 +258,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) { fprintf(stderr, "Invalid path %s\n", arg); return -1; } - strcpy(arguments->outpath, full_path.we_wordv[0]); + tstrncpy(arguments->outpath, full_path.we_wordv[0], TSDB_FILENAME_LEN); wordfree(&full_path); break; case 'i': @@ -266,7 +267,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) { fprintf(stderr, "Invalid path %s\n", arg); return -1; } - strcpy(arguments->inpath, full_path.we_wordv[0]); + tstrncpy(arguments->inpath, full_path.we_wordv[0], TSDB_FILENAME_LEN); wordfree(&full_path); break; case 'c': @@ -274,7 +275,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) { fprintf(stderr, "Invalid path %s\n", arg); return -1; } - strcpy(configDir, full_path.we_wordv[0]); + tstrncpy(configDir, full_path.we_wordv[0], TSDB_FILENAME_LEN); wordfree(&full_path); break; case 'e': @@ -430,7 +431,7 @@ int main(int argc, char *argv[]) { printf("==============================\n"); if (tsArguments.cversion[0] != 0){ - strcpy(version, tsArguments.cversion); + tstrncpy(version, tsArguments.cversion, 11); } if (taosCheckParam(&tsArguments) < 0) { @@ -513,7 +514,7 @@ int taosGetTableRecordInfo(char *table, STableRecordInfo *pTableRecordInfo, TAOS while ((row = taos_fetch_row(result)) != NULL) { isSet = true; pTableRecordInfo->isMetric = true; - strcpy(pTableRecordInfo->tableRecord.metric, table); + tstrncpy(pTableRecordInfo->tableRecord.metric, table, TSDB_TABLE_NAME_LEN); break; } @@ -541,9 +542,9 @@ int32_t taosSaveAllNormalTableToTempFile(TAOS *taosCon, char*meter, char* metric } } - memset(tableRecord.name, 0, sizeof(STableRecord)); - strcpy(tableRecord.name, meter); - strcpy(tableRecord.metric, metric); + memset(&tableRecord, 0, sizeof(STableRecord)); + tstrncpy(tableRecord.name, meter, TSDB_TABLE_NAME_LEN); + tstrncpy(tableRecord.metric, metric, TSDB_TABLE_NAME_LEN); taosTWrite(*fd, &tableRecord, sizeof(STableRecord)); return 0; @@ -587,7 +588,7 @@ int32_t taosSaveTableOfMetricToTempFile(TAOS *taosCon, char* metric, struct argu taos_free_result(result); for (int32_t loopCnt = 0; loopCnt < numOfThread; loopCnt++) { sprintf(tmpFileName, ".tables.tmp.%d", loopCnt); - remove(tmpFileName); + (void)remove(tmpFileName); } free(tmpCommand); return -1; @@ -596,9 +597,9 @@ int32_t taosSaveTableOfMetricToTempFile(TAOS *taosCon, char* metric, struct argu numOfThread++; } - memset(tableRecord.name, 0, sizeof(STableRecord)); - strncpy(tableRecord.name, (char *)row[0], fields[0].bytes); - strcpy(tableRecord.metric, metric); + memset(&tableRecord, 0, sizeof(STableRecord)); + tstrncpy(tableRecord.name, (char *)row[0], fields[0].bytes); + tstrncpy(tableRecord.metric, metric, TSDB_TABLE_NAME_LEN); taosTWrite(fd, &tableRecord, sizeof(STableRecord)); @@ -606,12 +607,16 @@ int32_t taosSaveTableOfMetricToTempFile(TAOS *taosCon, char* metric, struct argu if (numOfTable >= arguments->table_batch) { numOfTable = 0; - taosClose(fd); + close(fd); fd = -1; } } - taosClose(fd); - fd = -1; + + if (fd >= 0) { + close(fd); + fd = -1; + } + taos_free_result(result); *totalNumOfThread = numOfThread; @@ -846,13 +851,14 @@ int taosGetTableDes(char *table, STableDef *tableDes, TAOS* taosCon, bool isSupe if (code != 0) { fprintf(stderr, "failed to run command %s\n", tempCommand); free(tempCommand); + free(tbuf); taos_free_result(tmpResult); return -1; } TAOS_FIELD *fields = taos_fetch_fields(tmpResult); - strcpy(tableDes->name, table); + tstrncpy(tableDes->name, table, TSDB_COL_NAME_LEN); while ((row = taos_fetch_row(tmpResult)) != NULL) { strncpy(tableDes->cols[count].field, (char *)row[TSDB_DESCRIBE_METRIC_FIELD_INDEX], @@ -871,6 +877,7 @@ int taosGetTableDes(char *table, STableDef *tableDes, TAOS* taosCon, bool isSupe if (isSuperTable) { free(tempCommand); + free(tbuf); return count; } @@ -886,6 +893,7 @@ int taosGetTableDes(char *table, STableDef *tableDes, TAOS* taosCon, bool isSupe if (code != 0) { fprintf(stderr, "failed to run command %s\n", tempCommand); free(tempCommand); + free(tbuf); taos_free_result(tmpResult); return -1; } @@ -896,6 +904,7 @@ int taosGetTableDes(char *table, STableDef *tableDes, TAOS* taosCon, bool isSupe if (NULL == row) { fprintf(stderr, " fetch failed to run command %s\n", tempCommand); free(tempCommand); + free(tbuf); taos_free_result(tmpResult); return -1; } @@ -956,6 +965,7 @@ int taosGetTableDes(char *table, STableDef *tableDes, TAOS* taosCon, bool isSupe } free(tempCommand); + free(tbuf); return count; } @@ -1056,6 +1066,7 @@ void* taosDumpOutWorkThreadFp(void *arg) fp = fopen(tmpFileName, "w"); if (fp == NULL) { fprintf(stderr, "failed to open file %s\n", tmpFileName); + close(fd); return NULL; } @@ -1067,16 +1078,20 @@ void* taosDumpOutWorkThreadFp(void *arg) if (code != 0) { fprintf(stderr, "invalid database %s\n", pThread->dbName); taos_free_result(tmpResult); + fclose(fp); + close(fd); return NULL; } fprintf(fp, "USE %s\n\n", pThread->dbName); - while (read(fd, &tableRecord, sizeof(STableRecord)) > 0) { + while (1) { + ssize_t readLen = read(fd, &tableRecord, sizeof(STableRecord)); + if (readLen <= 0) break; taosDumpTable(tableRecord.name, tableRecord.metric, &tsArguments, fp, pThread->taosCon); } taos_free_result(tmpResult); - taosClose(fd); + close(fd); fclose(fp); return NULL; @@ -1090,7 +1105,7 @@ static void taosStartDumpOutWorkThreads(struct arguments* args, int32_t numOfTh SThreadParaObj *pThread = threadObj + t; pThread->threadIndex = t; pThread->totalThreads = numOfThread; - strcpy(pThread->dbName, dbName); + tstrncpy(pThread->dbName, dbName, TSDB_TABLE_NAME_LEN); pThread->taosCon = taos_connect(args->host, args->user, args->password, NULL, args->port); if (pThread->taosCon == NULL) { @@ -1189,7 +1204,7 @@ int32_t taosDumpCreateSuperTableClause(TAOS* taosCon, char* dbName, FILE *fp) fprintf(stderr, "failed to open temp file: %s\n", tmpFileName); taos_free_result(tmpResult); free(tmpCommand); - remove(".stables.tmp"); + (void)remove(".stables.tmp"); exit(-1); } @@ -1200,14 +1215,17 @@ int32_t taosDumpCreateSuperTableClause(TAOS* taosCon, char* dbName, FILE *fp) } taos_free_result(tmpResult); - lseek(fd, 0, SEEK_SET); + (void)lseek(fd, 0, SEEK_SET); - while (read(fd, &tableRecord, sizeof(STableRecord)) > 0) { + while (1) { + ssize_t readLen = read(fd, &tableRecord, sizeof(STableRecord)); + if (readLen <= 0) break; + (void)taosDumpStable(tableRecord.name, fp, taosCon); } - taosClose(fd); - remove(".stables.tmp"); + close(fd); + (void)remove(".stables.tmp"); free(tmpCommand); return 0; @@ -1269,7 +1287,7 @@ int taosDumpDb(SDbInfo *dbInfo, struct arguments *arguments, FILE *fp, TAOS *tao taos_free_result(tmpResult); for (int32_t loopCnt = 0; loopCnt < numOfThread; loopCnt++) { sprintf(tmpFileName, ".tables.tmp.%d", loopCnt); - remove(tmpFileName); + (void)remove(tmpFileName); } free(tmpCommand); return -1; @@ -1279,8 +1297,8 @@ int taosDumpDb(SDbInfo *dbInfo, struct arguments *arguments, FILE *fp, TAOS *tao } memset(&tableRecord, 0, sizeof(STableRecord)); - strncpy(tableRecord.name, (char *)row[TSDB_SHOW_TABLES_NAME_INDEX], fields[TSDB_SHOW_TABLES_NAME_INDEX].bytes); - strncpy(tableRecord.metric, (char *)row[TSDB_SHOW_TABLES_METRIC_INDEX], fields[TSDB_SHOW_TABLES_METRIC_INDEX].bytes); + tstrncpy(tableRecord.name, (char *)row[TSDB_SHOW_TABLES_NAME_INDEX], fields[TSDB_SHOW_TABLES_NAME_INDEX].bytes); + tstrncpy(tableRecord.metric, (char *)row[TSDB_SHOW_TABLES_METRIC_INDEX], fields[TSDB_SHOW_TABLES_METRIC_INDEX].bytes); taosTWrite(fd, &tableRecord, sizeof(STableRecord)); @@ -1288,19 +1306,23 @@ int taosDumpDb(SDbInfo *dbInfo, struct arguments *arguments, FILE *fp, TAOS *tao if (numOfTable >= arguments->table_batch) { numOfTable = 0; - taosClose(fd); + close(fd); fd = -1; } } - taosClose(fd); - fd = -1; + + if (fd >= 0) { + close(fd); + fd = -1; + } + taos_free_result(tmpResult); // start multi threads to dumpout taosStartDumpOutWorkThreads(arguments, numOfThread, dbInfo->name); for (int loopCnt = 0; loopCnt < numOfThread; loopCnt++) { sprintf(tmpFileName, ".tables.tmp.%d", loopCnt); - remove(tmpFileName); + (void)remove(tmpFileName); } free(tmpCommand); @@ -1718,6 +1740,10 @@ int convertNCharToReadable(char *str, int size, char *buf, int bufsize) { while (size > 0) { if (*pstr == '\0') break; int byte_width = mbtowc(&wc, pstr, MB_CUR_MAX); + if (byte_width < 0) { + fprintf(stderr, "mbtowc() return fail.\n"); + exit(-1); + } if ((int)wc < 256) { pbuf = stpcpy(pbuf, ascii_literal_list[(int)wc]); @@ -1736,16 +1762,16 @@ int convertNCharToReadable(char *str, int size, char *buf, int bufsize) { void taosDumpCharset(FILE *fp) { char charsetline[256]; - fseek(fp, 0, SEEK_SET); + (void)fseek(fp, 0, SEEK_SET); sprintf(charsetline, "#!%s\n", tsCharset); - fwrite(charsetline, strlen(charsetline), 1, fp); + (void)fwrite(charsetline, strlen(charsetline), 1, fp); } void taosLoadFileCharset(FILE *fp, char *fcharset) { char * line = NULL; size_t line_size = 0; - fseek(fp, 0, SEEK_SET); + (void)fseek(fp, 0, SEEK_SET); ssize_t size = getline(&line, &line_size, fp); if (size <= 2) { goto _exit_no_charset; @@ -1764,7 +1790,7 @@ void taosLoadFileCharset(FILE *fp, char *fcharset) { return; _exit_no_charset: - fseek(fp, 0, SEEK_SET); + (void)fseek(fp, 0, SEEK_SET); *fcharset = '\0'; taosTFree(line); return; @@ -1814,7 +1840,7 @@ static void taosParseDirectory(const char *directoryName, const char *prefix, ch } int fileNum = 0; - while (fscanf(fp, "%s", fileArray[fileNum++])) { + while (fscanf(fp, "%128s", fileArray[fileNum++])) { if (strcmp(fileArray[fileNum-1], tsDbSqlFile) == 0) { fileNum--; } @@ -1825,6 +1851,7 @@ static void taosParseDirectory(const char *directoryName, const char *prefix, ch if (fileNum != totalFiles) { fprintf(stderr, "ERROR: directory:%s changed while read\n", directoryName); + pclose(fp); exit(0); } @@ -1842,7 +1869,7 @@ static void taosCheckTablesSQLFile(const char *directoryName) exit(0); } - while (fscanf(fp, "%s", tsDbSqlFile)) { + while (fscanf(fp, "%128s", tsDbSqlFile)) { break; } @@ -1900,20 +1927,6 @@ static FILE* taosOpenDumpInFile(char *fptr) { char *fname = full_path.we_wordv[0]; - if (access(fname, F_OK) != 0) { - fprintf(stderr, "ERROR: file %s is not exist\n", fptr); - - wordfree(&full_path); - return NULL; - } - - if (access(fname, R_OK) != 0) { - fprintf(stderr, "ERROR: file %s is not readable\n", fptr); - - wordfree(&full_path); - return NULL; - } - FILE *f = fopen(fname, "r"); if (f == NULL) { fprintf(stderr, "ERROR: failed to open file %s\n", fname); diff --git a/src/kit/taosnetwork/client.c b/src/kit/taosnetwork/client.c index b2c7f729b5..706359ec20 100644 --- a/src/kit/taosnetwork/client.c +++ b/src/kit/taosnetwork/client.c @@ -43,7 +43,7 @@ typedef struct Arguments { static struct argp_option options[] = { {0, 'h', "host", 0, "The host to connect to TDEngine. Default is localhost.", 0}, - {0, 'p', "port", 0, "The TCP or UDP port number to use for the connection. Default is 6020.", 1}, + {0, 'p', "port", 0, "The TCP or UDP port number to use for the connection. Default is 6041.", 1}, {0, 'm', "max port", 0, "The max TCP or UDP port number to use for the connection. Default is 6050.", 2}}; static error_t parse_opt(int key, char *arg, struct argp_state *state) { @@ -145,7 +145,7 @@ void *checkUPort(void *sarg) { } int main(int argc, char *argv[]) { - SArguments arguments = {"127.0.0.1", 6020, 6050}; + SArguments arguments = {"127.0.0.1", 6041, 6050}; argp_parse(&argp, argc, argv, 0, 0, &arguments); diff --git a/src/mnode/inc/mnodeAcct.h b/src/mnode/inc/mnodeAcct.h index 44c3fc3cb8..744a62f948 100644 --- a/src/mnode/inc/mnodeAcct.h +++ b/src/mnode/inc/mnodeAcct.h @@ -24,6 +24,7 @@ extern "C" { int32_t mnodeInitAccts(); void mnodeCleanupAccts(); +void mnodeGetStatOfAllAcct(SAcctInfo* pAcctInfo); void * mnodeGetAcct(char *acctName); void * mnodeGetNextAcct(void *pIter, SAcctObj **pAcct); void mnodeIncAcctRef(SAcctObj *pAcct); diff --git a/src/mnode/inc/mnodeDb.h b/src/mnode/inc/mnodeDb.h index ca6c2a86a2..7cbd08ed92 100644 --- a/src/mnode/inc/mnodeDb.h +++ b/src/mnode/inc/mnodeDb.h @@ -30,6 +30,7 @@ enum _TSDB_DB_STATUS { // api int32_t mnodeInitDbs(); void mnodeCleanupDbs(); +int64_t mnodeGetDbNum(); SDbObj *mnodeGetDb(char *db); SDbObj *mnodeGetDbByTableId(char *db); void * mnodeGetNextDb(void *pIter, SDbObj **pDb); diff --git a/src/mnode/inc/mnodeTable.h b/src/mnode/inc/mnodeTable.h index 78ef0e37e8..ed0dbe4ecf 100644 --- a/src/mnode/inc/mnodeTable.h +++ b/src/mnode/inc/mnodeTable.h @@ -24,6 +24,8 @@ extern "C" { int32_t mnodeInitTables(); void mnodeCleanupTables(); +int64_t mnodeGetSuperTableNum(); +int64_t mnodeGetChildTableNum(); void * mnodeGetTable(char *tableId); void mnodeIncTableRef(void *pTable); void mnodeDecTableRef(void *pTable); diff --git a/src/mnode/inc/mnodeVgroup.h b/src/mnode/inc/mnodeVgroup.h index 9c5b201e93..7aa662b81c 100644 --- a/src/mnode/inc/mnodeVgroup.h +++ b/src/mnode/inc/mnodeVgroup.h @@ -24,6 +24,7 @@ struct SMnodeMsg; int32_t mnodeInitVgroups(); void mnodeCleanupVgroups(); +int64_t mnodeGetVgroupNum(); SVgObj *mnodeGetVgroup(int32_t vgId); void mnodeIncVgroupRef(SVgObj *pVgroup); void mnodeDecVgroupRef(SVgObj *pVgroup); diff --git a/src/mnode/src/mnodeAcct.c b/src/mnode/src/mnodeAcct.c index 5244bc3e85..b0a12979cd 100644 --- a/src/mnode/src/mnodeAcct.c +++ b/src/mnode/src/mnodeAcct.c @@ -23,6 +23,7 @@ #include "mnodeDb.h" #include "mnodeSdb.h" #include "mnodeUser.h" +#include "mnodeVgroup.h" #include "tglobal.h" @@ -130,6 +131,37 @@ void mnodeCleanupAccts() { tsAcctSdb = NULL; } +void mnodeGetStatOfAllAcct(SAcctInfo* pAcctInfo) { + memset(pAcctInfo, 0, sizeof(*pAcctInfo)); + + void *pIter = NULL; + SAcctObj *pAcct = NULL; + while (1) { + pIter = mnodeGetNextAcct(pIter, &pAcct); + if (pAcct == NULL) { + break; + } + pAcctInfo->numOfDbs += pAcct->acctInfo.numOfDbs; + pAcctInfo->numOfTimeSeries += pAcct->acctInfo.numOfTimeSeries; + mnodeDecAcctRef(pAcct); + } + sdbFreeIter(pIter); + + SVgObj *pVgroup = NULL; + pIter = NULL; + while (1) { + pIter = mnodeGetNextVgroup(pIter, &pVgroup); + if (pVgroup == NULL) { + break; + } + pAcctInfo->totalStorage += pVgroup->totalStorage; + pAcctInfo->compStorage += pVgroup->compStorage; + pAcctInfo->totalPoints += pVgroup->pointsWritten; + mnodeDecVgroupRef(pVgroup); + } + sdbFreeIter(pIter); +} + void *mnodeGetAcct(char *name) { return sdbGetRow(tsAcctSdb, name); } diff --git a/src/mnode/src/mnodeDb.c b/src/mnode/src/mnodeDb.c index 11013a8ef9..803e44cea2 100644 --- a/src/mnode/src/mnodeDb.c +++ b/src/mnode/src/mnodeDb.c @@ -61,6 +61,10 @@ static int32_t mnodeDbActionDestroy(SSdbOper *pOper) { return TSDB_CODE_SUCCESS; } +int64_t mnodeGetDbNum() { + return sdbGetNumOfRows(tsDbSdb); +} + static int32_t mnodeDbActionInsert(SSdbOper *pOper) { SDbObj *pDb = pOper->pObj; SAcctObj *pAcct = mnodeGetAcct(pDb->acct); diff --git a/src/mnode/src/mnodeDnode.c b/src/mnode/src/mnodeDnode.c index b68095ea3d..261f63d5cf 100644 --- a/src/mnode/src/mnodeDnode.c +++ b/src/mnode/src/mnodeDnode.c @@ -331,18 +331,50 @@ static void mnodeProcessCfgDnodeMsgRsp(SRpcMsg *rpcMsg) { } static bool mnodeCheckClusterCfgPara(const SClusterCfg *clusterCfg) { - if (clusterCfg->numOfMnodes != htonl(tsNumOfMnodes)) return false; - if (clusterCfg->enableBalance != htonl(tsEnableBalance)) return false; - if (clusterCfg->mnodeEqualVnodeNum != htonl(tsMnodeEqualVnodeNum)) return false; - if (clusterCfg->offlineThreshold != htonl(tsOfflineThreshold)) return false; - if (clusterCfg->statusInterval != htonl(tsStatusInterval)) return false; - if (clusterCfg->maxtablesPerVnode != htonl(tsMaxTablePerVnode)) return false; - if (clusterCfg->maxVgroupsPerDb != htonl(tsMaxVgroupsPerDb)) return false; - - if (0 != strncasecmp(clusterCfg->arbitrator, tsArbitrator, strlen(tsArbitrator))) return false; - if (0 != strncasecmp(clusterCfg->timezone, tsTimezone, strlen(tsTimezone))) return false; - if (0 != strncasecmp(clusterCfg->locale, tsLocale, strlen(tsLocale))) return false; - if (0 != strncasecmp(clusterCfg->charset, tsCharset, strlen(tsCharset))) return false; + if (clusterCfg->numOfMnodes != htonl(tsNumOfMnodes)) { + mError("\"numOfMnodes\"[%d - %d] cfg parameters inconsistent", clusterCfg->numOfMnodes, htonl(tsNumOfMnodes)); + return false; + } + if (clusterCfg->enableBalance != htonl(tsEnableBalance)) { + mError("\"balance\"[%d - %d] cfg parameters inconsistent", clusterCfg->enableBalance, htonl(tsEnableBalance)); + return false; + } + if (clusterCfg->mnodeEqualVnodeNum != htonl(tsMnodeEqualVnodeNum)) { + mError("\"mnodeEqualVnodeNum\"[%d - %d] cfg parameters inconsistent", clusterCfg->mnodeEqualVnodeNum, htonl(tsMnodeEqualVnodeNum)); + return false; + } + if (clusterCfg->offlineThreshold != htonl(tsOfflineThreshold)) { + mError("\"offlineThreshold\"[%d - %d] cfg parameters inconsistent", clusterCfg->offlineThreshold, htonl(tsOfflineThreshold)); + return false; + } + if (clusterCfg->statusInterval != htonl(tsStatusInterval)) { + mError("\"statusInterval\"[%d - %d] cfg parameters inconsistent", clusterCfg->statusInterval, htonl(tsStatusInterval)); + return false; + } + if (clusterCfg->maxtablesPerVnode != htonl(tsMaxTablePerVnode)) { + mError("\"maxTablesPerVnode\"[%d - %d] cfg parameters inconsistent", clusterCfg->maxtablesPerVnode, htonl(tsMaxTablePerVnode)); + return false; + } + if (clusterCfg->maxVgroupsPerDb != htonl(tsMaxVgroupsPerDb)) { + mError("\"maxVgroupsPerDb\"[%d - %d] cfg parameters inconsistent", clusterCfg->maxVgroupsPerDb, htonl(tsMaxVgroupsPerDb)); + return false; + } + if (0 != strncasecmp(clusterCfg->arbitrator, tsArbitrator, strlen(tsArbitrator))) { + mError("\"arbitrator\"[%s - %s] cfg parameters inconsistent", clusterCfg->arbitrator, tsArbitrator); + return false; + } + if (0 != strncasecmp(clusterCfg->timezone, tsTimezone, strlen(tsTimezone))) { + mError("\"timezone\"[%s - %s] cfg parameters inconsistent", clusterCfg->timezone, tsTimezone); + return false; + } + if (0 != strncasecmp(clusterCfg->locale, tsLocale, strlen(tsLocale))) { + mError("\"locale\"[%s - %s] cfg parameters inconsistent", clusterCfg->locale, tsLocale); + return false; + } + if (0 != strncasecmp(clusterCfg->charset, tsCharset, strlen(tsCharset))) { + mError("\"charset\"[%s - %s] cfg parameters inconsistent.", clusterCfg->charset, tsCharset); + return false; + } return true; } diff --git a/src/mnode/src/mnodeTable.c b/src/mnode/src/mnodeTable.c index 73dc7dbd54..0912a6f3ff 100644 --- a/src/mnode/src/mnodeTable.c +++ b/src/mnode/src/mnodeTable.c @@ -375,6 +375,14 @@ static void mnodeCleanupChildTables() { tsChildTableSdb = NULL; } +int64_t mnodeGetSuperTableNum() { + return sdbGetNumOfRows(tsSuperTableSdb); +} + +int64_t mnodeGetChildTableNum() { + return sdbGetNumOfRows(tsChildTableSdb); +} + static void mnodeAddTableIntoStable(SSuperTableObj *pStable, SChildTableObj *pCtable) { atomic_add_fetch_32(&pStable->numOfTables, 1); @@ -1345,7 +1353,7 @@ int32_t mnodeRetrieveShowSuperTables(SShowObj *pShow, char *data, int32_t rows, pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - int16_t len = strnlen(stableName, TSDB_DB_NAME_LEN - 1); + int16_t len = strnlen(stableName, TSDB_TABLE_NAME_LEN - 1); *(int16_t*) pWrite = len; pWrite += sizeof(int16_t); // todo refactor diff --git a/src/mnode/src/mnodeVgroup.c b/src/mnode/src/mnodeVgroup.c index b3acf5d4d0..e1c81db0ac 100644 --- a/src/mnode/src/mnodeVgroup.c +++ b/src/mnode/src/mnodeVgroup.c @@ -309,7 +309,7 @@ void mnodeUpdateVgroupStatus(SVgObj *pVgroup, SDnodeObj *pDnode, SVnodeLoad *pVl for (int32_t i = 0; i < pVgroup->numOfVnodes; ++i) { SVnodeGid *pVgid = &pVgroup->vnodeGid[i]; if (pVgid->pDnode == pDnode) { - mTrace("dnode:%d, receive status from dnode, vgId:%d status is %d", pVgroup->vgId, pDnode->dnodeId, pVgid->role); + mTrace("dnode:%d, receive status from dnode, vgId:%d status is %d", pDnode->dnodeId, pVgroup->vgId, pVgid->role); pVgid->role = pVload->role; if (pVload->role == TAOS_SYNC_ROLE_MASTER) { pVgroup->inUse = i; @@ -605,6 +605,10 @@ void mnodeCleanupVgroups() { tsVgroupSdb = NULL; } +int64_t mnodeGetVgroupNum() { + return sdbGetNumOfRows(tsVgroupSdb); +} + static int32_t mnodeGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) { SDbObj *pDb = mnodeGetDb(pShow->db); if (pDb == NULL) { diff --git a/src/os/inc/osDarwin.h b/src/os/inc/osDarwin.h index 8628a0f3ac..c1a950fbe6 100644 --- a/src/os/inc/osDarwin.h +++ b/src/os/inc/osDarwin.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef TDENGINE_PLATFORM_LINUX_H -#define TDENGINE_PLATFORM_LINUX_H +#ifndef TDENGINE_OS_DARWIN_H +#define TDENGINE_OS_DARWIN_H #ifdef __cplusplus extern "C" { diff --git a/src/os/inc/osFile.h b/src/os/inc/osFile.h index 6e48e80ca4..e99c64c2e0 100644 --- a/src/os/inc/osFile.h +++ b/src/os/inc/osFile.h @@ -56,6 +56,22 @@ int32_t taosFileRename(char *fullPath, char *suffix, char delimiter, char **dstP // TAOS_OS_FUNC_FILE_GETTMPFILEPATH void taosGetTmpfilePath(const char *fileNamePrefix, char *dstPath); +#ifdef TAOS_OS_FUNC_FILE_ISDIR + #define S_ISDIR(m) (((m) & 0170000) == (0040000)) +#endif + +#ifdef TAOS_OS_FUNC_FILE_ISREG + #define S_ISREG(m) !(S_ISDIR(m)) +#endif + +#ifdef TAOS_OS_FUNC_FILE_ISLNK + #define S_ISLNK(m) 0 +#endif + +#ifndef TAOS_OS_FUNC_FILE_FTRUNCATE + #define taosFtruncate ftruncate +#endif + #ifdef __cplusplus } #endif diff --git a/src/os/inc/osLinux32.h b/src/os/inc/osLinux32.h index b62b086d0f..93e917e797 100644 --- a/src/os/inc/osLinux32.h +++ b/src/os/inc/osLinux32.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef TDENGINE_OS_LINUX64_H -#define TDENGINE_OS_LINUX64_H +#ifndef TDENGINE_OS_LINUX32_H +#define TDENGINE_OS_LINUX32_H #ifdef __cplusplus extern "C" { diff --git a/src/os/inc/osMemory.h b/src/os/inc/osMemory.h index aaac8c68e3..37d9dc9828 100644 --- a/src/os/inc/osMemory.h +++ b/src/os/inc/osMemory.h @@ -74,9 +74,9 @@ void taosTMemset(void *ptr, int c); #define taosCalloc(num, size) taos_calloc(num, size, __FILE__, __LINE__) #define taosRealloc(ptr, size) taos_realloc(ptr, size, __FILE__, __LINE__) #define taosFree(ptr) taos_free(ptr, __FILE__, __LINE__) - #define taosStrdup(str) taos_strdup(str, __FILE__, __LINE__) - #define taosStrndup(str, size) taos_strndup(str, size, __FILE__, __LINE__) - #define taosGetline(lineptr, n, stream) taos_getline(lineptr, n, stream, __FILE__, __LINE__) + //#define taosStrdup(str) taos_strdup(str, __FILE__, __LINE__) + //#define taosStrndup(str, size) taos_strndup(str, size, __FILE__, __LINE__) + //#define taosGetline(lineptr, n, stream) taos_getline(lineptr, n, stream, __FILE__, __LINE__) #endif #endif diff --git a/src/os/inc/osSemphone.h b/src/os/inc/osSemphone.h index 300f1e8ef1..c4fc98988a 100644 --- a/src/os/inc/osSemphone.h +++ b/src/os/inc/osSemphone.h @@ -31,6 +31,7 @@ extern "C" { // TAOS_OS_FUNC_SEMPHONE_PTHREAD bool taosCheckPthreadValid(pthread_t thread); int64_t taosGetPthreadId(); +void taosResetPthread(pthread_t *thread); #ifdef __cplusplus } diff --git a/src/os/inc/osWindows.h b/src/os/inc/osWindows.h index a8c2243253..1118b3c64b 100644 --- a/src/os/inc/osWindows.h +++ b/src/os/inc/osWindows.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef TDENGINE_PLATFORM_WINDOWS_H -#define TDENGINE_PLATFORM_WINDOWS_H +#ifndef TDENGINE_OS_WINDOWS_H +#define TDENGINE_OS_WINDOWS_H #include #include @@ -60,10 +60,15 @@ extern "C" { #define TAOS_OS_FUNC_DIR #define TAOS_OS_FUNC_FILE +#define TAOS_OS_FUNC_FILE_ISREG +#define TAOS_OS_FUNC_FILE_ISDIR +#define TAOS_OS_FUNC_FILE_ISLNK #define TAOS_OS_FUNC_FILE_SENDIFLE #define taosFSendFile(outfile, infile, offset, count) taosFSendFileImp(outfile, infile, offset, size) #define taosTSendFile(dfd, sfd, offset, size) taosTSendFileImp(dfd, sfd, offset, size) #define TAOS_OS_FUNC_FILE_GETTMPFILEPATH +#define TAOS_OS_FUNC_FILE_FTRUNCATE + extern int taosFtruncate(int fd, int64_t length); #define TAOS_OS_FUNC_MATH #define SWAP(a, b, c) \ @@ -87,6 +92,7 @@ extern "C" { #define taosCloseSocket(fd) closesocket(fd) #define TAOS_OS_FUNC_STRING_WCHAR + int twcslen(const wchar_t *wcs); #define TAOS_OS_FUNC_STRING_GETLINE #define TAOS_OS_FUNC_STRING_STR2INT64 #ifdef _TD_GO_DLL_ @@ -97,7 +103,7 @@ extern "C" { #endif #define TAOS_OS_FUNC_STRING_STRDUP #define taosStrdupImp(str) _strdup(str) - #define taosStrndupImp(str, size) _strndup(str, size) + #define taosStrndupImp(str, size) _strndup(str, size) #define TAOS_OS_FUNC_SYSINFO @@ -154,6 +160,9 @@ char * strndup(const char *s, size_t n); #define TCP_KEEPCNT 0x1234 #define TCP_KEEPIDLE 0x1234 #define TCP_KEEPINTVL 0x1234 +#define SHUT_RDWR SD_BOTH +#define SHUT_RD SD_RECEIVE +#define SHUT_WR SD_SEND #define LOCK_EX 1 #define LOCK_NB 2 diff --git a/src/os/src/darwin/darwinSysInfo.c b/src/os/src/darwin/darwinSysInfo.c index 108cc6239f..f8aa02dcff 100644 --- a/src/os/src/darwin/darwinSysInfo.c +++ b/src/os/src/darwin/darwinSysInfo.c @@ -41,7 +41,7 @@ static void taosGetSystemLocale() { if (cfg_locale && cfg_locale->cfgStatus < TAOS_CFG_CSTATUS_DEFAULT) { char *locale = setlocale(LC_CTYPE, "chs"); if (locale != NULL) { - strncpy(tsLocale, locale, TSDB_LOCALE_LEN - 1); + tstrncpy(tsLocale, locale, TSDB_LOCALE_LEN); cfg_locale->cfgStatus = TAOS_CFG_CSTATUS_DEFAULT; uInfo("locale not configured, set to default:%s", tsLocale); } diff --git a/src/os/src/detail/CMakeLists.txt b/src/os/src/detail/CMakeLists.txt index 5902a9356b..3ea7f97985 100644 --- a/src/os/src/detail/CMakeLists.txt +++ b/src/os/src/detail/CMakeLists.txt @@ -1,6 +1,12 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) PROJECT(TDengine) +IF (TD_WINDOWS) + INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/pthread) + INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/iconv) + INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/regex) +ENDIF () + INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/inc) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/os/inc) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/util/inc) diff --git a/src/os/src/detail/osFile.c b/src/os/src/detail/osFile.c index 516b7bb19e..8f055dd812 100644 --- a/src/os/src/detail/osFile.c +++ b/src/os/src/detail/osFile.c @@ -70,7 +70,7 @@ ssize_t taosTReadImp(int fd, void *buf, size_t count) { char * tbuf = (char *)buf; while (leftbytes > 0) { - readbytes = read(fd, (void *)tbuf, leftbytes); + readbytes = read(fd, (void *)tbuf, (uint32_t)leftbytes); if (readbytes < 0) { if (errno == EINTR) { continue; @@ -94,7 +94,7 @@ ssize_t taosTWriteImp(int fd, void *buf, size_t n) { char * tbuf = (char *)buf; while (nleft > 0) { - nwritten = write(fd, (void *)tbuf, nleft); + nwritten = write(fd, (void *)tbuf, (uint32_t)nleft); if (nwritten < 0) { if (errno == EINTR) { continue; @@ -105,7 +105,7 @@ ssize_t taosTWriteImp(int fd, void *buf, size_t n) { tbuf += nwritten; } - return n; + return (ssize_t)n; } #ifndef TAOS_OS_FUNC_FILE_SENDIFLE diff --git a/src/os/src/detail/osRand.c b/src/os/src/detail/osRand.c index edb8642bd6..b322a88684 100644 --- a/src/os/src/detail/osRand.c +++ b/src/os/src/detail/osRand.c @@ -26,11 +26,11 @@ uint32_t taosSafeRand(void) { fd = open("/dev/urandom", 0); if (fd < 0) { - seed = time(0); + seed = (int)time(0); } else { int len = read(fd, &seed, sizeof(seed)); if (len < 0) { - seed = time(0); + seed = (int)time(0); } close(fd); } diff --git a/src/os/src/detail/osSemphone.c b/src/os/src/detail/osSemphone.c index 82b916b4d7..1f1ef268c6 100644 --- a/src/os/src/detail/osSemphone.c +++ b/src/os/src/detail/osSemphone.c @@ -20,5 +20,6 @@ bool taosCheckPthreadValid(pthread_t thread) { return thread != 0; } int64_t taosGetPthreadId() { return (int64_t)pthread_self(); } +void taosResetPthread(pthread_t *thread) { *thread = 0; } #endif \ No newline at end of file diff --git a/src/os/src/detail/osTime.c b/src/os/src/detail/osTime.c index 6d41692d80..ced1643d2b 100644 --- a/src/os/src/detail/osTime.c +++ b/src/os/src/detail/osTime.c @@ -165,7 +165,7 @@ int32_t parseTimezone(char* str, int64_t* tzOffset) { char* sep = strchr(&str[i], ':'); if (sep != NULL) { - int32_t len = sep - &str[i]; + int32_t len = (int32_t)(sep - &str[i]); hour = strnatoi(&str[i], len); i += len + 1; @@ -212,7 +212,8 @@ int32_t parseTimeWithTz(char* timestr, int64_t* time, int32_t timePrec) { /* mktime will be affected by TZ, set by using taos_options */ #ifdef WINDOWS - int64_t seconds = gmtime(&tm); + int64_t seconds = user_mktime64(tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); + //int64_t seconds = gmtime(&tm); #else int64_t seconds = timegm(&tm); #endif diff --git a/src/os/src/windows/w64File.c b/src/os/src/windows/w64File.c index f2c59c3639..5549c078a5 100644 --- a/src/os/src/windows/w64File.c +++ b/src/os/src/windows/w64File.c @@ -15,6 +15,7 @@ #define _DEFAULT_SOURCE #include "os.h" +#include "tulog.h" void taosGetTmpfilePath(const char *fileNamePrefix, char *dstPath) { const char* tdengineTmpFileNamePrefix = "tdengine-"; @@ -77,4 +78,9 @@ int taosFSendFileImp(FILE* out_file, FILE* in_file, int64_t* offset, int32_t cou ssize_t taosTSendFileImp(int dfd, int sfd, off_t *offset, size_t size) { uError("taosTSendFileImp no implemented yet"); return 0; +} + +int taosFtruncate(int fd, int64_t length) { + uError("taosFtruncate no implemented yet"); + return 0; } \ No newline at end of file diff --git a/src/os/src/windows/w64Socket.c b/src/os/src/windows/w64Socket.c index cdf46825e8..dbe501b645 100644 --- a/src/os/src/windows/w64Socket.c +++ b/src/os/src/windows/w64Socket.c @@ -13,6 +13,7 @@ * along with this program. If not, see . */ +#include "os.h" #include #include #include @@ -33,7 +34,7 @@ void taosWinSocketInit() { } } -int taosSetNonblocking(SOCKET sock, int on) { +int taosSetNonblocking(int sock, int on) { u_long mode; if (on) { mode = 1; diff --git a/src/os/src/windows/w64String.c b/src/os/src/windows/w64String.c index 8057c89a55..e3ac7d8832 100644 --- a/src/os/src/windows/w64String.c +++ b/src/os/src/windows/w64String.c @@ -67,7 +67,7 @@ char *getpass(const char *prefix) { } char *strndup(const char *s, size_t n) { - int len = strlen(s); + size_t len = strlen(s); if (len >= n) { len = n; } @@ -78,13 +78,13 @@ char *strndup(const char *s, size_t n) { return r; } -size_t twcslen(const wchar_t *wcs) { +int twcslen(const wchar_t *wcs) { int *wstr = (int *)wcs; if (NULL == wstr) { return 0; } - size_t n = 0; + int n = 0; while (1) { if (0 == *wstr++) { break; diff --git a/src/os/src/windows/w64Sysinfo.c b/src/os/src/windows/w64Sysinfo.c index 0a680ac0b7..27869e1eec 100644 --- a/src/os/src/windows/w64Sysinfo.c +++ b/src/os/src/windows/w64Sysinfo.c @@ -43,7 +43,7 @@ static void taosGetSystemLocale() { if (cfg_locale && cfg_locale->cfgStatus < TAOS_CFG_CSTATUS_DEFAULT) { char *locale = setlocale(LC_CTYPE, "chs"); if (locale != NULL) { - tstrncpy(tsLocale, locale, sizeof(tsLocale)); + tstrncpy(tsLocale, locale, TSDB_LOCALE_LEN);; cfg_locale->cfgStatus = TAOS_CFG_CSTATUS_DEFAULT; uInfo("locale not configured, set to default:%s", tsLocale); } diff --git a/src/rpc/src/rpcCache.c b/src/rpc/src/rpcCache.c index 3f76b202c9..751f03e52a 100644 --- a/src/rpc/src/rpcCache.c +++ b/src/rpc/src/rpcCache.c @@ -82,7 +82,7 @@ void *rpcOpenConnCache(int maxSessions, void (*cleanFp)(void *), void *tmrCtrl, pCache->cleanFp = cleanFp; pCache->tmrCtrl = tmrCtrl; pCache->lockedBy = calloc(sizeof(int64_t), maxSessions); - taosTmrReset(rpcCleanConnCache, pCache->keepTimer * 2, pCache, pCache->tmrCtrl, &pCache->pTimer); + taosTmrReset(rpcCleanConnCache, (int32_t)(pCache->keepTimer * 2), pCache, pCache->tmrCtrl, &pCache->pTimer); pthread_mutex_init(&pCache->mutex, NULL); @@ -226,7 +226,7 @@ static void rpcCleanConnCache(void *handle, void *tmrId) { } // tTrace("timer, total connections in cache:%d", pCache->total); - taosTmrReset(rpcCleanConnCache, pCache->keepTimer * 2, pCache, pCache->tmrCtrl, &pCache->pTimer); + taosTmrReset(rpcCleanConnCache, (int32_t)(pCache->keepTimer * 2), pCache, pCache->tmrCtrl, &pCache->pTimer); } static void rpcRemoveExpiredNodes(SConnCache *pCache, SConnHash *pNode, int hash, uint64_t time) { diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index 1ae378483a..c8cf3ee6cf 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -33,7 +33,7 @@ #include "rpcHead.h" #define RPC_MSG_OVERHEAD (sizeof(SRpcReqContext) + sizeof(SRpcHead) + sizeof(SRpcDigest)) -#define rpcHeadFromCont(cont) ((SRpcHead *) (cont - sizeof(SRpcHead))) +#define rpcHeadFromCont(cont) ((SRpcHead *) ((char*)cont - sizeof(SRpcHead))) #define rpcContFromHead(msg) (msg + sizeof(SRpcHead)) #define rpcMsgLenFromCont(contLen) (contLen + sizeof(SRpcHead)) #define rpcContLenFromMsg(msgLen) (msgLen - sizeof(SRpcHead)) @@ -359,7 +359,7 @@ void rpcSendRequest(void *shandle, const SRpcEpSet *pEpSet, SRpcMsg *pMsg) { SRpcReqContext *pContext; int contLen = rpcCompressRpcMsg(pMsg->pCont, pMsg->contLen); - pContext = (SRpcReqContext *) (pMsg->pCont-sizeof(SRpcHead)-sizeof(SRpcReqContext)); + pContext = (SRpcReqContext *) ((char*)pMsg->pCont-sizeof(SRpcHead)-sizeof(SRpcReqContext)); pContext->ahandle = pMsg->ahandle; pContext->signature = pContext; pContext->pRpc = (SRpcInfo *)shandle; @@ -492,7 +492,7 @@ int rpcGetConnInfo(void *thandle, SRpcConnInfo *pInfo) { void rpcSendRecv(void *shandle, SRpcEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { SRpcReqContext *pContext; - pContext = (SRpcReqContext *) (pMsg->pCont-sizeof(SRpcHead)-sizeof(SRpcReqContext)); + pContext = (SRpcReqContext *) ((char*)pMsg->pCont-sizeof(SRpcHead)-sizeof(SRpcReqContext)); memset(pRsp, 0, sizeof(SRpcMsg)); @@ -654,7 +654,7 @@ static SRpcConn *rpcAllocateClientConn(SRpcInfo *pRpc) { pConn->pRpc = pRpc; pConn->sid = sid; - pConn->tranId = (uint16_t)(random() & 0xFFFF); + pConn->tranId = (uint16_t)(taosRand() & 0xFFFF); pConn->ownId = htonl(pConn->sid); pConn->linkUid = (uint32_t)((int64_t)pConn + (int64_t)getpid() + (int64_t)pConn->tranId); pConn->spi = pRpc->spi; diff --git a/src/rpc/src/rpcTcp.c b/src/rpc/src/rpcTcp.c index 7fa05af9b0..c69456b8e2 100644 --- a/src/rpc/src/rpcTcp.c +++ b/src/rpc/src/rpcTcp.c @@ -81,7 +81,7 @@ void *taosInitTcpServer(uint32_t ip, uint16_t port, char *label, int numOfThread } pServerObj->fd = -1; - pServerObj->thread = 0; + taosResetPthread(&pServerObj->thread); pServerObj->ip = ip; pServerObj->port = port; tstrncpy(pServerObj->label, label, sizeof(pServerObj->label)); @@ -104,7 +104,7 @@ void *taosInitTcpServer(uint32_t ip, uint16_t port, char *label, int numOfThread pThreadObj = pServerObj->pThreadObj; for (int i = 0; i < numOfThreads; ++i) { pThreadObj->pollFd = -1; - pThreadObj->thread = 0; + taosResetPthread(&pThreadObj->thread); pThreadObj->processData = fp; tstrncpy(pThreadObj->label, label, sizeof(pThreadObj->label)); pThreadObj->shandle = shandle; diff --git a/src/rpc/src/rpcUdp.c b/src/rpc/src/rpcUdp.c index f75375e2fe..7e59210cae 100644 --- a/src/rpc/src/rpcUdp.c +++ b/src/rpc/src/rpcUdp.c @@ -144,7 +144,9 @@ void taosStopUdpConnection(void *handle) { for (int i = 0; i < pSet->threads; ++i) { pConn = pSet->udpConn + i; - if (pConn->thread) pthread_join(pConn->thread, NULL); + if (taosCheckPthreadValid(pConn->thread)) { + pthread_join(pConn->thread, NULL); + } taosTFree(pConn->buffer); // tTrace("%s UDP thread is closed, index:%d", pConn->label, i); } diff --git a/src/tsdb/tests/CMakeLists.txt b/src/tsdb/tests/CMakeLists.txt index b330109340..a3477aef95 100644 --- a/src/tsdb/tests/CMakeLists.txt +++ b/src/tsdb/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST) +AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST) add_executable(tsdbTests ${SOURCE_LIST}) target_link_libraries(tsdbTests gtest gtest_main pthread common tsdb tutil trpc) diff --git a/src/util/inc/tchecksum.h b/src/util/inc/tchecksum.h index 54043d68e1..495aaf33e8 100644 --- a/src/util/inc/tchecksum.h +++ b/src/util/inc/tchecksum.h @@ -53,7 +53,12 @@ static FORCE_INLINE int taosCheckChecksum(const uint8_t *stream, uint32_t ssize, static FORCE_INLINE int taosCheckChecksumWhole(const uint8_t *stream, uint32_t ssize) { if (ssize < sizeof(TSCKSUM)) return 0; + +#if (_WIN64) + return 1; +#else return *((TSCKSUM *)(stream + ssize - sizeof(TSCKSUM))) == (*crc32c)(0, stream, (size_t)(ssize - sizeof(TSCKSUM))); +#endif } #ifdef __cplusplus diff --git a/src/util/inc/tcoding.h b/src/util/inc/tcoding.h index 907c69bf01..9300094e35 100644 --- a/src/util/inc/tcoding.h +++ b/src/util/inc/tcoding.h @@ -196,14 +196,14 @@ static FORCE_INLINE void *taosDecodeFixedI64(void *buf, int64_t *value) { static FORCE_INLINE int taosEncodeVariantU16(void **buf, uint16_t value) { int i = 0; while (value >= ENCODE_LIMIT) { - if (buf != NULL) ((uint8_t *)(*buf))[i] = (value | ENCODE_LIMIT); + if (buf != NULL) ((uint8_t *)(*buf))[i] = (uint8_t)(value | ENCODE_LIMIT); value >>= 7; i++; ASSERT(i < 3); } if (buf != NULL) { - ((uint8_t *)(*buf))[i] = value; + ((uint8_t *)(*buf))[i] = (uint8_t)value; *buf = POINTER_SHIFT(*buf, i + 1); } @@ -292,14 +292,14 @@ static FORCE_INLINE void *taosDecodeVariantI32(void *buf, int32_t *value) { static FORCE_INLINE int taosEncodeVariantU64(void **buf, uint64_t value) { int i = 0; while (value >= ENCODE_LIMIT) { - if (buf != NULL) ((uint8_t *)(*buf))[i] = (value | ENCODE_LIMIT); + if (buf != NULL) ((uint8_t *)(*buf))[i] = (uint8_t)(value | ENCODE_LIMIT); value >>= 7; i++; ASSERT(i < 10); } if (buf != NULL) { - ((uint8_t *)(*buf))[i] = value; + ((uint8_t *)(*buf))[i] = (uint8_t)value; *buf = POINTER_SHIFT(*buf, i + 1); } @@ -346,7 +346,7 @@ static FORCE_INLINE int taosEncodeString(void **buf, char *value) { memcpy(*buf, value, size); *buf = POINTER_SHIFT(*buf, size); } - tlen += size; + tlen += (int)size; return tlen; } diff --git a/src/util/inc/tconfig.h b/src/util/inc/tconfig.h index 79b19ff79d..0520cf29a8 100644 --- a/src/util/inc/tconfig.h +++ b/src/util/inc/tconfig.h @@ -68,7 +68,7 @@ typedef struct { int8_t cfgStatus; int8_t unitType; int8_t valType; - uint32_t ptrLength; + int32_t ptrLength; } SGlobalCfg; extern SGlobalCfg tsGlobalConfig[]; diff --git a/src/util/inc/tstoken.h b/src/util/inc/tstoken.h index 7b0e498d76..258e62cf8a 100644 --- a/src/util/inc/tstoken.h +++ b/src/util/inc/tstoken.h @@ -82,7 +82,7 @@ static FORCE_INLINE int32_t isValidNumber(const SSQLToken* pToken) { const char* z = pToken->z; int32_t type = TK_ILLEGAL; - int32_t i = 0; + uint32_t i = 0; for(; i < pToken->n; ++i) { switch (z[i]) { case '+': diff --git a/src/util/src/hash.c b/src/util/src/hash.c index a70256666f..9e262916ce 100644 --- a/src/util/src/hash.c +++ b/src/util/src/hash.c @@ -69,7 +69,7 @@ static FORCE_INLINE void __wr_unlock(void *lock, int32_t type) { static FORCE_INLINE int32_t taosHashCapacity(int32_t length) { int32_t len = MIN(length, HASH_MAX_CAPACITY); - uint32_t i = 4; + int32_t i = 4; while (i < len) i = (i << 1u); return i; } @@ -167,7 +167,7 @@ SHashObj *taosHashInit(size_t capacity, _hash_fn_t fn, bool update, SHashLockTyp } // the max slots is not defined by user - pHashObj->capacity = taosHashCapacity(capacity); + pHashObj->capacity = taosHashCapacity((int32_t)capacity); assert((pHashObj->capacity & (pHashObj->capacity - 1)) == 0); pHashObj->hashFp = fn; diff --git a/src/util/src/talgo.c b/src/util/src/talgo.c index 6879461953..4b96e62e91 100644 --- a/src/util/src/talgo.c +++ b/src/util/src/talgo.c @@ -24,7 +24,7 @@ } while (0); static void median(void *src, size_t size, size_t s, size_t e, const void *param, __ext_compar_fn_t comparFn, void* buf) { - int32_t mid = ((e - s) >> 1u) + s; + int32_t mid = ((int32_t)(e - s) >> 1u) + (int32_t)s; if (comparFn(elePtrAt(src, size, mid), elePtrAt(src, size, s), param) == 1) { doswap(elePtrAt(src, size, mid), elePtrAt(src, size, s), size, buf); @@ -152,14 +152,14 @@ static void tqsortImpl(void *src, int32_t start, int32_t end, size_t size, const void taosqsort(void *src, size_t numOfElem, size_t size, const void* param, __ext_compar_fn_t comparFn) { char *buf = calloc(1, size); // prepare the swap buffer - tqsortImpl(src, 0, numOfElem - 1, size, param, comparFn, buf); + tqsortImpl(src, 0, (int32_t)numOfElem - 1, (int32_t)size, param, comparFn, buf); taosTFree(buf); } void * taosbsearch(const void *key, const void *base, size_t nmemb, size_t size, __compar_fn_t compar, int flags) { // TODO: need to check the correctness of this function int l = 0; - int r = nmemb; + int r = (int)nmemb; int idx = 0; int comparison; diff --git a/src/util/src/tarray.c b/src/util/src/tarray.c index 19225e998a..65147b38de 100755 --- a/src/util/src/tarray.c +++ b/src/util/src/tarray.c @@ -120,8 +120,8 @@ void* taosArrayInsert(SArray* pArray, size_t index, void* pData) { void* dst = TARRAY_GET_ELEM(pArray, index); - int32_t remain = pArray->size - index; - memmove(dst + pArray->elemSize, dst, pArray->elemSize * remain); + int32_t remain = (int32_t)(pArray->size - index); + memmove((char*)dst + pArray->elemSize, (char*)dst, pArray->elemSize * remain); memcpy(dst, pData, pArray->elemSize); pArray->size += 1; @@ -138,7 +138,7 @@ void taosArrayRemove(SArray* pArray, size_t index) { } size_t remain = pArray->size - index - 1; - memmove(pArray->pData + index * pArray->elemSize, pArray->pData + (index + 1) * pArray->elemSize, remain * pArray->elemSize); + memmove((char*)pArray->pData + index * pArray->elemSize, (char*)pArray->pData + (index + 1) * pArray->elemSize, remain * pArray->elemSize); pArray->size -= 1; } diff --git a/src/util/src/tbuffer.c b/src/util/src/tbuffer.c index 4af435798c..240f744ea3 100644 --- a/src/util/src/tbuffer.c +++ b/src/util/src/tbuffer.c @@ -17,7 +17,6 @@ #include #include #include -#include #include "tbuffer.h" #include "exception.h" #include diff --git a/src/util/src/tcache.c b/src/util/src/tcache.c index b6df852876..e1ba80c9d0 100644 --- a/src/util/src/tcache.c +++ b/src/util/src/tcache.c @@ -101,7 +101,7 @@ static FORCE_INLINE void taosCacheReleaseNode(SCacheObj *pCacheObj, SCacheDataNo assert(0); return; } - + pCacheObj->totalSize -= pNode->size; int32_t size = taosHashGetSize(pCacheObj->pHashTable); assert(size > 0); @@ -472,7 +472,7 @@ SCacheDataNode *taosCreateCacheNode(const char *key, size_t keyLen, const char * memcpy(pNewNode->data, pData, size); pNewNode->key = (char *)pNewNode + sizeof(SCacheDataNode) + size; - pNewNode->keySize = keyLen; + pNewNode->keySize = (uint16_t)keyLen; memcpy(pNewNode->key, key, keyLen); diff --git a/src/util/src/tcompression.c b/src/util/src/tcompression.c index b085e26e07..c20ba59ac9 100644 --- a/src/util/src/tcompression.c +++ b/src/util/src/tcompression.c @@ -52,14 +52,13 @@ #include "tscompression.h" #include "taosdef.h" -const int TEST_NUMBER = 1; +static const int TEST_NUMBER = 1; #define is_bigendian() ((*(char *)&TEST_NUMBER) == 0) #define SIMPLE8B_MAX_INT64 ((uint64_t)2305843009213693951L) -bool safeInt64Add(int64_t a, int64_t b) { - if ((a > 0 && b > INT64_MAX - a) || (a < 0 && b < INT64_MIN - a)) return false; - return true; -} +#define safeInt64Add(a, b) (((a >= 0) && (b <= INT64_MAX - a)) || ((a < 0) && (b >= INT64_MIN - a))) +#define ZIGZAG_ENCODE(T, v) ((u##T)((v) >> (sizeof(T) * 8 - 1))) ^ (((u##T)(v)) << 1) // zigzag encode +#define ZIGZAG_DECODE(T, v) ((v) >> 1) ^ -((T)((v)&1)) // zigzag decode /* * Compress Integer (Simple8B). @@ -90,7 +89,7 @@ int tsCompressINTImp(const char *const input, const int nelements, char *const o break; default: perror("Wrong integer types.\n"); - exit(1); + return -1; } int byte_limit = nelements * word_length + 1; @@ -125,11 +124,11 @@ int tsCompressINTImp(const char *const input, const int nelements, char *const o int64_t diff = curr_value - prev_value_tmp; // Zigzag encode the value. - uint64_t zigzag_value = (diff >> (LONG_BYTES * BITS_PER_BYTE - 1)) ^ (diff << 1); + uint64_t zigzag_value = ZIGZAG_ENCODE(int64_t, diff); if (zigzag_value >= SIMPLE8B_MAX_INT64) goto _copy_and_exit; - char tmp_bit; + int64_t tmp_bit; if (zigzag_value == 0) { // Take care here, __builtin_clzl give wrong anser for value 0; tmp_bit = 0; @@ -171,7 +170,7 @@ int tsCompressINTImp(const char *const input, const int nelements, char *const o break; } int64_t diff = curr_value - prev_value; - uint64_t zigzag_value = (diff >> (LONG_BYTES * BITS_PER_BYTE - 1)) ^ (diff << 1); + uint64_t zigzag_value = ZIGZAG_ENCODE(int64_t, diff); buffer |= ((zigzag_value & INT64MASK(bit)) << (bit * k + 4)); i++; prev_value = curr_value; @@ -211,7 +210,7 @@ int tsDecompressINTImp(const char *const input, const int nelements, char *const break; default: perror("Wrong integer types.\n"); - exit(1); + return -1; } // If not compressed. @@ -248,30 +247,30 @@ int tsDecompressINTImp(const char *const input, const int nelements, char *const } else { zigzag_value = ((w >> (4 + bit * i)) & INT64MASK(bit)); } - int64_t diff = (zigzag_value >> 1) ^ -(zigzag_value & 1); + int64_t diff = ZIGZAG_DECODE(int64_t, zigzag_value); int64_t curr_value = diff + prev_value; prev_value = curr_value; switch (type) { case TSDB_DATA_TYPE_BIGINT: - *((int64_t *)output + _pos) = curr_value; + *((int64_t *)output + _pos) = (int64_t)curr_value; _pos++; break; case TSDB_DATA_TYPE_INT: - *((int32_t *)output + _pos) = curr_value; + *((int32_t *)output + _pos) = (int32_t)curr_value; _pos++; break; case TSDB_DATA_TYPE_SMALLINT: - *((int16_t *)output + _pos) = curr_value; + *((int16_t *)output + _pos) = (int16_t)curr_value; _pos++; break; case TSDB_DATA_TYPE_TINYINT: - *((int8_t *)output + _pos) = curr_value; + *((int8_t *)output + _pos) = (int8_t)curr_value; _pos++; break; default: perror("Wrong integer types.\n"); - exit(1); + return -1; } count++; if (count == nelements) break; @@ -309,7 +308,7 @@ int tsCompressBoolImp(const char *const input, const int nelements, char *const output[pos] |= t; } else { perror("Wrong bool value.\n"); - exit(1); + return -1; } } @@ -365,7 +364,7 @@ int tsCompressBoolRLEImp(const char *const input, const int nelements, char *con output[_pos++] = (counter << 1) | INT8MASK(0); } else { perror("Wrong bool value!\n"); - exit(1); + return -1; } } @@ -417,7 +416,7 @@ int tsDecompressStringImp(const char *const input, int compressedSize, char *con char msg[128] = {0}; sprintf(msg, "decomp_size:%d, Error decompress in LZ4 algorithm!\n", decompressed_size); perror(msg); - exit(EXIT_FAILURE); + return -1; } return decompressed_size; @@ -427,7 +426,7 @@ int tsDecompressStringImp(const char *const input, int compressedSize, char *con return compressedSize - 1; } else { perror("Wrong compressed string indicator!\n"); - exit(EXIT_FAILURE); + return -1; } } @@ -454,21 +453,21 @@ int tsCompressTimestampImp(const char *const input, const int nelements, char *c if (!safeInt64Add(curr_delta, -prev_delta)) goto _exit_over; int64_t delta_of_delta = curr_delta - prev_delta; // zigzag encode the value. - uint64_t zigzag_value = (delta_of_delta >> (LONG_BYTES * BITS_PER_BYTE - 1)) ^ (delta_of_delta << 1); + uint64_t zigzag_value = ZIGZAG_ENCODE(int64_t, delta_of_delta); if (i % 2 == 0) { flags = 0; dd1 = zigzag_value; if (dd1 == 0) { flag1 = 0; } else { - flag1 = LONG_BYTES - BUILDIN_CLZL(dd1) / BITS_PER_BYTE; + flag1 = (uint8_t)(LONG_BYTES - BUILDIN_CLZL(dd1) / BITS_PER_BYTE); } } else { dd2 = zigzag_value; if (dd2 == 0) { flag2 = 0; } else { - flag2 = LONG_BYTES - BUILDIN_CLZL(dd2) / BITS_PER_BYTE; + flag2 = (uint8_t)(LONG_BYTES - BUILDIN_CLZL(dd2) / BITS_PER_BYTE); } flags = flag1 | (flag2 << 4); // Encode the flag. @@ -555,7 +554,7 @@ int tsDecompressTimestampImp(const char *const input, const int nelements, char } else { memcpy(&dd1, input + ipos, nbytes); } - delta_of_delta = (dd1 >> 1) ^ -(dd1 & 1); + delta_of_delta = ZIGZAG_DECODE(int64_t, dd1); } ipos += nbytes; if (opos == 0) { @@ -581,7 +580,7 @@ int tsDecompressTimestampImp(const char *const input, const int nelements, char memcpy(&dd2, input + ipos, nbytes); } // zigzag_decoding - delta_of_delta = (dd2 >> 1) ^ -(dd2 & 1); + delta_of_delta = ZIGZAG_DECODE(int64_t, dd2); } ipos += nbytes; prev_delta = delta_of_delta + prev_delta; @@ -643,12 +642,12 @@ int tsCompressDoubleImp(const char *const input, const int nelements, char *cons uint8_t flag; if (trailing_zeros > leading_zeros) { - nbytes = LONG_BYTES - trailing_zeros / BITS_PER_BYTE; + nbytes = (uint8_t)(LONG_BYTES - trailing_zeros / BITS_PER_BYTE); if (nbytes > 0) nbytes--; flag = ((uint8_t)1 << 3) | nbytes; } else { - nbytes = LONG_BYTES - leading_zeros / BITS_PER_BYTE; + nbytes = (uint8_t)(LONG_BYTES - leading_zeros / BITS_PER_BYTE); if (nbytes > 0) nbytes--; flag = nbytes; } @@ -790,12 +789,12 @@ int tsCompressFloatImp(const char *const input, const int nelements, char *const uint8_t flag; if (trailing_zeros > leading_zeros) { - nbytes = FLOAT_BYTES - trailing_zeros / BITS_PER_BYTE; + nbytes = (uint8_t)(FLOAT_BYTES - trailing_zeros / BITS_PER_BYTE); if (nbytes > 0) nbytes--; flag = ((uint8_t)1 << 3) | nbytes; } else { - nbytes = FLOAT_BYTES - leading_zeros / BITS_PER_BYTE; + nbytes = (uint8_t)(FLOAT_BYTES - leading_zeros / BITS_PER_BYTE); if (nbytes > 0) nbytes--; flag = nbytes; } diff --git a/src/util/src/tconfig.c b/src/util/src/tconfig.c index 9fc9386b42..ccf4ea7317 100644 --- a/src/util/src/tconfig.c +++ b/src/util/src/tconfig.c @@ -98,7 +98,7 @@ static void taosReadInt16Config(SGlobalCfg *cfg, char *input_value) { } static void taosReadDirectoryConfig(SGlobalCfg *cfg, char *input_value) { - int length = strlen(input_value); + int length = (int)strlen(input_value); char *option = (char *)cfg->ptr; if (length <= 0 || length > cfg->ptrLength) { uError("config option:%s, input value:%s, length out of range[0, %d], use default value:%s", @@ -150,7 +150,7 @@ static void taosReadIpStrConfig(SGlobalCfg *cfg, char *input_value) { } static void taosReadStringConfig(SGlobalCfg *cfg, char *input_value) { - int length = strlen(input_value); + int length = (int) strlen(input_value); char *option = (char *)cfg->ptr; if (length <= 0 || length > cfg->ptrLength) { uError("config option:%s, input value:%s, length out of range[0, %d], use default value:%s", @@ -283,7 +283,7 @@ void taosReadGlobalLogCfg() { option = value = NULL; olen = vlen = 0; - getline(&line, &len, fp); + taosGetline(&line, &len, fp); line[len - 1] = 0; paGetToken(line, &option, &olen); @@ -329,7 +329,7 @@ bool taosReadGlobalCfg() { option = value = NULL; olen = vlen = 0; - getline(&line, &len, fp); + taosGetline(&line, &len, fp); line[len - 1] = 0; paGetToken(line, &option, &olen); diff --git a/src/util/src/tcrc32c.c b/src/util/src/tcrc32c.c index 3ef10b1b0d..502116f9c2 100644 --- a/src/util/src/tcrc32c.c +++ b/src/util/src/tcrc32c.c @@ -1353,12 +1353,12 @@ uint32_t crc32c_hw(uint32_t crc, crc_stream buf, size_t len) { #endif // #ifndef _TD_ARM_ void taosResolveCRC() { -#ifndef _TD_ARM_ +#if defined _TD_ARM_ || defined WINDOWS + crc32c = crc32c_sf; +#else int sse42; SSE42(sse42); crc32c = sse42 ? crc32c_hw : crc32c_sf; -#else - crc32c = crc32c_sf; #endif /* return sse42 ? crc32c_hw(crci, bytes, len) : crc32c_sf(crci, bytes, len); */ diff --git a/src/util/src/terror.c b/src/util/src/terror.c index aa6925464e..1eb6893cbc 100644 --- a/src/util/src/terror.c +++ b/src/util/src/terror.c @@ -49,7 +49,7 @@ static int tsCompareTaosError(const void* a, const void* b) { } static pthread_once_t tsErrorInit = PTHREAD_ONCE_INIT; -static void tsSortError() { +static void tsSortError(void) { qsort(errors, sizeof(errors)/sizeof(errors[0]), sizeof(errors[0]), tsCompareTaosError); } diff --git a/src/util/src/thashutil.c b/src/util/src/thashutil.c index 33f0d6d430..681d73db3d 100644 --- a/src/util/src/thashutil.c +++ b/src/util/src/thashutil.c @@ -78,7 +78,7 @@ uint32_t taosIntHash_64(const char *key, uint32_t UNUSED_PARAM(len)) { uint64_t hash = val >> 16U; hash += (val & 0xFFFFU); - return hash; + return (uint32_t)hash; } _hash_fn_t taosGetDefaultHashFunction(int32_t type) { diff --git a/src/util/src/tkvstore.c b/src/util/src/tkvstore.c index 7cd2108591..c026aed5f2 100644 --- a/src/util/src/tkvstore.c +++ b/src/util/src/tkvstore.c @@ -120,7 +120,7 @@ SKVStore *tdOpenKVStore(char *fname, iterFunc iFunc, afterFunc aFunc, void *appH version, KVSTORE_FILE_VERSION); } - if (ftruncate(pStore->fd, info.size) < 0) { + if (taosFtruncate(pStore->fd, info.size) < 0) { uError("failed to truncate %s to %" PRId64 " size since %s", pStore->fname, info.size, strerror(errno)); terrno = TAOS_SYSTEM_ERROR(errno); goto _err; @@ -296,7 +296,7 @@ int tdDropKVStoreRecord(SKVStore *pStore, uint64_t uid) { return -1; } - pStore->info.magic = taosCalcChecksum(pStore->info.magic, (uint8_t *)buf, POINTER_DISTANCE(pBuf, buf)); + pStore->info.magic = taosCalcChecksum(pStore->info.magic, (uint8_t *)buf, (uint32_t)POINTER_DISTANCE(pBuf, buf)); pStore->info.size += POINTER_DISTANCE(pBuf, buf); pStore->info.nDels++; pStore->info.nRecords--; @@ -498,7 +498,7 @@ static void *tdDecodeKVRecord(void *buf, SKVRecord *pRecord) { static int tdRestoreKVStore(SKVStore *pStore) { char tbuf[128] = "\0"; void * buf = NULL; - int maxBufSize = 0; + int64_t maxBufSize = 0; SKVRecord rInfo = {0}; SHashMutableIterator *pIter = NULL; @@ -535,7 +535,7 @@ static int tdRestoreKVStore(SKVStore *pStore) { maxBufSize = MAX(maxBufSize, rInfo.size); - if (lseek(pStore->fd, rInfo.size, SEEK_CUR) < 0) { + if (lseek(pStore->fd, (off_t)rInfo.size, SEEK_CUR) < 0) { uError("failed to lseek file %s since %s", pStore->fname, strerror(errno)); terrno = TAOS_SYSTEM_ERROR(errno); goto _err; @@ -548,7 +548,7 @@ static int tdRestoreKVStore(SKVStore *pStore) { buf = malloc(maxBufSize); if (buf == NULL) { - uError("failed to allocate %d bytes in KV store %s", maxBufSize, pStore->fname); + uError("failed to allocate %" PRId64 " bytes in KV store %s", maxBufSize, pStore->fname); terrno = TAOS_SYSTEM_ERROR(errno); goto _err; } @@ -563,7 +563,7 @@ static int tdRestoreKVStore(SKVStore *pStore) { while (taosHashIterNext(pIter)) { SKVRecord *pRecord = taosHashIterGet(pIter); - if (lseek(pStore->fd, pRecord->offset + sizeof(SKVRecord), SEEK_SET) < 0) { + if (lseek(pStore->fd, (off_t)(pRecord->offset + sizeof(SKVRecord)), SEEK_SET) < 0) { uError("failed to lseek file %s since %s, offset %" PRId64, pStore->fname, strerror(errno), pRecord->offset); terrno = TAOS_SYSTEM_ERROR(errno); goto _err; @@ -577,7 +577,7 @@ static int tdRestoreKVStore(SKVStore *pStore) { } if (pStore->iFunc) { - if ((*pStore->iFunc)(pStore->appH, buf, pRecord->size) < 0) { + if ((*pStore->iFunc)(pStore->appH, buf, (int)pRecord->size) < 0) { uError("failed to restore record uid %" PRIu64 " in kv store %s at offset %" PRId64 " size %" PRId64 " since %s", pRecord->uid, pStore->fname, pRecord->offset, pRecord->size, tstrerror(terrno)); diff --git a/src/util/src/tlog.c b/src/util/src/tlog.c index 913989bf52..cf6ccdcbce 100644 --- a/src/util/src/tlog.c +++ b/src/util/src/tlog.c @@ -65,7 +65,7 @@ typedef struct { int32_t tsAsyncLog = 1; float tsTotalLogDirGB = 0; float tsAvailLogDirGB = 0; -float tsMinimalLogDirGB = 0.1; +float tsMinimalLogDirGB = 0.1f; char tsLogDir[TSDB_FILENAME_LEN] = "/var/log/taos"; static SLogObj tsLogObj = { .fileNum = 1 }; diff --git a/src/util/src/tmempool.c b/src/util/src/tmempool.c index 4a899ebb48..a3d1035500 100644 --- a/src/util/src/tmempool.c +++ b/src/util/src/tmempool.c @@ -13,11 +13,7 @@ * along with this program. If not, see . */ -#include -#include -#include -#include - +#include "os.h" #include "tulog.h" #include "tmempool.h" #include "tutil.h" diff --git a/src/util/src/tsched.c b/src/util/src/tsched.c index 39155bc0fd..cf7f5c10d4 100644 --- a/src/util/src/tsched.c +++ b/src/util/src/tsched.c @@ -192,12 +192,12 @@ void taosCleanUpScheduler(void *param) { pSched->stop = true; for (int i = 0; i < pSched->numOfThreads; ++i) { - if (pSched->qthread[i]) { + if (taosCheckPthreadValid(pSched->qthread[i])) { tsem_post(&pSched->fullSem); } } for (int i = 0; i < pSched->numOfThreads; ++i) { - if (pSched->qthread[i]) { + if (taosCheckPthreadValid(pSched->qthread[i])) { pthread_join(pSched->qthread[i], NULL); } } diff --git a/src/util/src/tskiplist.c b/src/util/src/tskiplist.c index 14029fbd81..303c2440bf 100644 --- a/src/util/src/tskiplist.c +++ b/src/util/src/tskiplist.c @@ -19,7 +19,7 @@ #include "tutil.h" #include "tcompare.h" -__attribute__ ((unused)) static FORCE_INLINE void recordNodeEachLevel(SSkipList *pSkipList, int32_t level) { // record link count in each level +UNUSED_FUNC static FORCE_INLINE void recordNodeEachLevel(SSkipList *pSkipList, int32_t level) { // record link count in each level #if SKIP_LIST_RECORD_PERFORMANCE for (int32_t i = 0; i < level; ++i) { pSkipList->state.nLevelNodeCnt[i]++; @@ -27,7 +27,7 @@ __attribute__ ((unused)) static FORCE_INLINE void recordNodeEachLevel(SSkipList #endif } -__attribute__ ((unused)) static FORCE_INLINE void removeNodeEachLevel(SSkipList *pSkipList, int32_t level) { +UNUSED_FUNC static FORCE_INLINE void removeNodeEachLevel(SSkipList *pSkipList, int32_t level) { #if SKIP_LIST_RECORD_PERFORMANCE for (int32_t i = 0; i < level; ++i) { pSkipList->state.nLevelNodeCnt[i]--; @@ -132,7 +132,7 @@ static bool initForwardBackwardPtr(SSkipList* pSkipList) { pSkipList->pTail = (SSkipListNode*) ((char*) pSkipList->pHead + SL_NODE_HEADER_SIZE(maxLevel)); pSkipList->pTail->level = pSkipList->maxLevel; - for(int32_t i = 0; i < maxLevel; ++i) { + for (uint32_t i = 0; i < maxLevel; ++i) { SL_GET_FORWARD_POINTER(pSkipList->pHead, i) = pSkipList->pTail; SL_GET_BACKWARD_POINTER(pSkipList->pTail, i) = pSkipList->pHead; } @@ -177,7 +177,7 @@ SSkipList *tSkipListCreate(uint8_t maxLevel, uint8_t keyType, uint8_t keyLen, ui } } - srand(time(NULL)); + srand((uint32_t)time(NULL)); #if SKIP_LIST_RECORD_PERFORMANCE pSkipList->state.nTotalMemSize += sizeof(SSkipList); diff --git a/src/util/src/ttimer.c b/src/util/src/ttimer.c index b2982d353f..0222a6d80a 100644 --- a/src/util/src/ttimer.c +++ b/src/util/src/ttimer.c @@ -445,7 +445,7 @@ bool taosTmrStopA(tmr_h* timerId) { bool taosTmrReset(TAOS_TMR_CALLBACK fp, int mseconds, void* param, void* handle, tmr_h* pTmrId) { tmr_ctrl_t* ctrl = (tmr_ctrl_t*)handle; if (ctrl == NULL || ctrl->label[0] == 0) { - return NULL; + return false; } uintptr_t id = (uintptr_t)*pTmrId; @@ -491,7 +491,7 @@ static void taosTmrModuleInit(void) { return; } - for (int i = 0; i < tsMaxTmrCtrl - 1; ++i) { + for (uint32_t i = 0; i < tsMaxTmrCtrl - 1; ++i) { tmr_ctrl_t* ctrl = tmrCtrls + i; ctrl->next = ctrl + 1; } diff --git a/src/util/src/tutil.c b/src/util/src/tutil.c index f4b6ae629d..6c4af437b2 100644 --- a/src/util/src/tutil.c +++ b/src/util/src/tutil.c @@ -273,7 +273,7 @@ char *strbetween(char *string, char *begin, char *end) { char *_begin = strstr(string, begin); if (_begin != NULL) { char *_end = strstr(_begin + strlen(begin), end); - int size = _end - _begin; + int size = (int)(_end - _begin); if (_end != NULL && size > 0) { result = (char *)calloc(1, size); memcpy(result, _begin + strlen(begin), size - +strlen(begin)); @@ -332,7 +332,7 @@ bool taosGetVersionNumber(char *versionStr, int *versionNubmer) { } int versionNumberPos[5] = {0}; - int len = strlen(versionStr); + int len = (int)strlen(versionStr); int dot = 0; for (int pos = 0; pos < len && dot < 4; ++pos) { if (versionStr[pos] == '.') { diff --git a/src/util/src/version.c b/src/util/src/version.c index 0d5e08ce75..d12c2f339e 100644 --- a/src/util/src/version.c +++ b/src/util/src/version.c @@ -1,7 +1,7 @@ char version[12] = "2.0.0.0"; char compatible_version[12] = "2.0.0.0"; -char gitinfo[48] = "3264067e97300c84caa61ac909d548c9ca56de6b"; -char gitinfoOfInternal[48] = "da88f4a2474737d1f9c76adcf0ff7fd0975e7342"; -char buildinfo[64] = "Built by root at 2020-04-01 14:38"; +char gitinfo[48] = "8df8b7d9930342dd34ba13df160a7d538fad7bc7"; +char gitinfoOfInternal[48] = "bad4f040145fba581d1ab0c5dd718a5ede3e209f"; +char buildinfo[64] = "Built by root at 2020-08-03 17:23"; -void libtaos_1_6_5_4_Linux_x64() {}; +void libtaos_2_0_0_0_Linux_x64() {}; diff --git a/src/util/tests/CMakeLists.txt b/src/util/tests/CMakeLists.txt index 8687a8005d..09523cbfb4 100644 --- a/src/util/tests/CMakeLists.txt +++ b/src/util/tests/CMakeLists.txt @@ -10,6 +10,6 @@ IF (HEADER_GTEST_INCLUDE_DIR AND LIB_GTEST_STATIC_DIR) INCLUDE_DIRECTORIES(${HEADER_GTEST_INCLUDE_DIR}) AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST) - ADD_EXECUTABLE(utilTest ${SOURCE_LIST}) + ADD_EXECUTABLE(utilTest ./cacheTest.cpp ./hashTest.cpp) TARGET_LINK_LIBRARIES(utilTest tutil common osdetail gtest pthread gcov) ENDIF() diff --git a/tests/perftest-scripts/coverage_test.sh b/tests/perftest-scripts/coverage_test.sh index 152e20756b..6644cc62a3 100755 --- a/tests/perftest-scripts/coverage_test.sh +++ b/tests/perftest-scripts/coverage_test.sh @@ -32,7 +32,14 @@ function buildTDengine { echo "repo need to pull" git reset --hard git pull + fi + [ -d $TDENGINE_DIR/debug ] || mkdir $TDENGINE_DIR/debug + cd $TDENGINE_DIR/debug + [ -f $TDENGINE_DIR/debug/build/bin/taosd ] || need_rebuild=true + + if $need_rebuild ; then + echo "rebuild.." LOCAL_COMMIT=`git rev-parse --short @` rm -rf * @@ -46,10 +53,9 @@ function buildTDengine { function runGeneralCaseOneByOne { while read -r line; do if [[ $line =~ ^./test.sh* ]]; then - general_case=`echo $line | grep -w general` + case=`echo $line | grep -w "general\|unique\/mnode\/mgmt33.sim\|unique\/stable\/dnode3.sim\|unique\/cluster\/balance3.sim\|unique\/arbitrator\/offline_replica2_alterTable_online.sim"|awk '{print $NF}'` - if [ -n "$general_case" ]; then - case=`echo $line |grep general| awk '{print $NF}'` + if [ -n "$case" ]; then ./test.sh -f $case > /dev/null 2>&1 && \ echo -e "${GREEN}$case success${NC}" | tee -a $TDENGINE_COVERAGE_REPORT || \ echo -e "${RED}$case failed${NC}" | tee -a $TDENGINE_COVERAGE_REPORT @@ -90,14 +96,14 @@ function runTest { sleep 10 cd $TDENGINE_DIR/src/connector/jdbc - mvn clean package - mvn test | tee -a $TDENGINE_COVERAGE_REPORT + mvn clean package > /dev/null 2>&1 + mvn test > /dev/null 2>&1 | tee -a $TDENGINE_COVERAGE_REPORT # Test C Demo stopTaosd $TDENGINE_DIR/debug/build/bin/taosd -c $TDENGINE_DIR/debug/test/cfg > /dev/null & sleep 10 - yes | $TDENGINE_DIR/debug/build/bin/demo 127.0.0.1 | tee -a $TDENGINE_COVERAGE_REPORT + yes | $TDENGINE_DIR/debug/build/bin/demo 127.0.0.1 > /dev/null 2>&1 | tee -a $TDENGINE_COVERAGE_REPORT # Test waltest dataDir=`grep dataDir $TDENGINE_DIR/debug/test/cfg/taos.cfg|awk '{print $2}'` @@ -105,14 +111,14 @@ function runTest { echo "dataDir: $dataDir" | tee -a $TDENGINE_COVERAGE_REPORT echo "walDir: $walDir" | tee -a $TDENGINE_COVERAGE_REPORT if [ -n "$walDir" ]; then - yes | $TDENGINE_DIR/debug/build/bin/waltest -p $walDir | tee -a $TDENGINE_COVERAGE_REPORT + yes | $TDENGINE_DIR/debug/build/bin/waltest -p $walDir > dev/null 2>&1 | tee -a $TDENGINE_COVERAGE_REPORT fi # run Unit Test echo "Run Unit Test: utilTest, queryTest and cliTest" - $TDENGINE_DIR/debug/build/bin/utilTest > /dev/null && echo "utilTest pass!" || echo "utilTest failed!" - $TDENGINE_DIR/debug/build/bin/queryTest > /dev/null && echo "queryTest pass!" || echo "queryTest failed!" - $TDENGINE_DIR/debug/build/bin/cliTest > /dev/null && echo "cliTest pass!" || echo "cliTest failed!" + $TDENGINE_DIR/debug/build/bin/utilTest > /dev/null 2>&1 && echo "utilTest pass!" || echo "utilTest failed!" + $TDENGINE_DIR/debug/build/bin/queryTest > /dev/null 2>&1 && echo "queryTest pass!" || echo "queryTest failed!" + $TDENGINE_DIR/debug/build/bin/cliTest > /dev/null 2>&1 && echo "cliTest pass!" || echo "cliTest failed!" stopTaosd } diff --git a/tests/perftest-scripts/tdinternal_coverage_test.sh b/tests/perftest-scripts/tdinternal_coverage_test.sh index 91d204baf9..654c06cd0b 100755 --- a/tests/perftest-scripts/tdinternal_coverage_test.sh +++ b/tests/perftest-scripts/tdinternal_coverage_test.sh @@ -100,23 +100,30 @@ function runTest { sleep 10 cd $TDINTERNAL_DIR/community/src/connector/jdbc - mvn clean package - mvn test | tee -a $TDINTERNAL_COVERAGE_REPORT + mvn clean package > /dev/null + mvn test > /dev/null | tee -a $TDINTERNAL_COVERAGE_REPORT # Test C Demo stopTaosd $TDINTERNAL_DIR/debug/build/bin/taosd -c $TDINTERNAL_DIR/debug/test/cfg > /dev/null & sleep 10 - yes | $TDINTERNAL_DIR/debug/build/bin/demo 127.0.0.1 | tee -a $TDINTERNAL_COVERAGE_REPORT + yes | $TDINTERNAL_DIR/debug/build/bin/demo 127.0.0.1 > /dev/null | tee -a $TDINTERNAL_COVERAGE_REPORT # Test waltest dataDir=`grep dataDir $TDINTERNAL_DIR/debug/test/cfg/taos.cfg|awk '{print $2}'` walDir=`find $dataDir -name "wal"|head -n1` - echo "dataDir: $dataDir\nwalDir: $walDir" | tee -a $TDINTERNAL_COVERAGE_REPORT + echo "dataDir: $dataDir" | tee -a $TDINTERNAL_COVERAGE_REPORT + echo "walDir: $walDir" | tee -a $TDINTERNAL_COVERAGE_REPORT if [ -n "$walDir" ]; then - yes | $TDINTERNAL_DIR/debug/build/bin/waltest -p $walDir | tee -a $TDINTERNAL_COVERAGE_REPORT + yes | $TDINTERNAL_DIR/debug/build/bin/waltest -p $walDir > /dev/null | tee -a $TDINTERNAL_COVERAGE_REPORT fi + # run Unit Test + echo "Run Unit Test: utilTest, queryTest and cliTest" + $TDINTERNAL_DIR/debug/build/bin/utilTest > /dev/null 2>&1 && echo "utilTest pass!" || echo "utilTest failed!" + $TDINTERNAL_DIR/debug/build/bin/queryTest > /dev/null 2>&1 && echo "queryTest pass!" || echo "queryTest failed!" + $TDINTERNAL_DIR/debug/build/bin/cliTest > /dev/null 2>&1 && echo "cliTest pass!" || echo "cliTest failed!" + stopTaosd } diff --git a/tests/pytest/util/dnodes-default.py b/tests/pytest/util/dnodes-default.py index ec3865f4f2..085e083149 100644 --- a/tests/pytest/util/dnodes-default.py +++ b/tests/pytest/util/dnodes-default.py @@ -39,6 +39,7 @@ class TDSimClient: "udebugFlag": "135", "jnidebugFlag": "135", "qdebugFlag": "135", + "telemetryReporting": "0", } def init(self, path): self.__init__() diff --git a/tests/pytest/util/dnodes-no-random-fail.py b/tests/pytest/util/dnodes-no-random-fail.py index 485c1b4b3f..2627575e61 100644 --- a/tests/pytest/util/dnodes-no-random-fail.py +++ b/tests/pytest/util/dnodes-no-random-fail.py @@ -36,6 +36,7 @@ class TDSimClient: "udebugFlag": "135", "jnidebugFlag": "135", "qdebugFlag": "135", + "telemetryReporting": "0", } def init(self, path): diff --git a/tests/pytest/util/dnodes-random-fail.py b/tests/pytest/util/dnodes-random-fail.py index 7c4edde47f..4f4cdcc0d0 100644 --- a/tests/pytest/util/dnodes-random-fail.py +++ b/tests/pytest/util/dnodes-random-fail.py @@ -36,6 +36,7 @@ class TDSimClient: "udebugFlag": "135", "jnidebugFlag": "135", "qdebugFlag": "135", + "telemetryReporting": "0", } def init(self, path): diff --git a/tests/script/general/http/autocreate.sim b/tests/script/general/http/autocreate.sim index 7c1fdcd0f8..d6efbdbd65 100644 --- a/tests/script/general/http/autocreate.sim +++ b/tests/script/general/http/autocreate.sim @@ -18,8 +18,8 @@ sql create table if not exists db.win_cpu(ts timestamp,f_percent_dpc_time double print =============== step2 - auto create -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'import into db.win_cpu_windows_1_processor using db.win_cpu tags('windows','1','Processor') values(1564641722000,0.000000,95.598305,0.000000,0.000000,0.000000,0.000000);' 127.0.0.1:6020/rest/sql -print curl 127.0.0.1:6020/rest/sql -----> $system_content +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'import into db.win_cpu_windows_1_processor using db.win_cpu tags('windows','1','Processor') values(1564641722000,0.000000,95.598305,0.000000,0.000000,0.000000,0.000000);' 127.0.0.1:6041/rest/sql +print curl 127.0.0.1:6041/rest/sql -----> $system_content #if $system_content != @{"status":"succ","head":["ts","i"],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10],["2017-12-25 21:28:51.022",11]],"rows":11}@ then # return -1 #endi diff --git a/tests/script/general/http/grafana.sim b/tests/script/general/http/grafana.sim index d2c31a0e59..74b1e5637a 100644 --- a/tests/script/general/http/grafana.sim +++ b/tests/script/general/http/grafana.sim @@ -52,50 +52,50 @@ sql insert into t3 values('2017-12-25 21:27:41', 3) print =============== step2 - login -system_content curl 127.0.0.1:6020/grafana/ +system_content curl 127.0.0.1:6041/grafana/ print 1-> $system_content if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then return -1 endi -system_content curl 127.0.0.1:6020/grafana/xx +system_content curl 127.0.0.1:6041/grafana/xx print 2-> $system_content if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then return -1 endi -system_content curl 127.0.0.1:6020/grafana/login/xx/xx/ +system_content curl 127.0.0.1:6041/grafana/login/xx/xx/ print 3-> $system_content if $system_content != @{"status":"error","code":849,"desc":"Invalid user"}@ then return -1 endi -system_content curl 127.0.0.1:6020/grafana/root/1/123/1/1/3 +system_content curl 127.0.0.1:6041/grafana/root/1/123/1/1/3 print 4-> $system_content if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then return -1 endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:6020/grafana/login/1/root/1/ +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:6041/grafana/login/1/root/1/ print 5-> $system_content if $system_content != @{"status":"error","code":849,"desc":"Invalid user"}@ then return -1 endi -system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 127.0.0.1:6020/grafana/root/1/login +system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 127.0.0.1:6041/grafana/root/1/login print 6-> $system_content if $system_content != @{"status":"error","code":5010,"desc":"invalid type of Authorization"}@ then return -1 endi -system_content curl -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 127.0.0.1:6020/grafana/root/1/login +system_content curl -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 127.0.0.1:6041/grafana/root/1/login print 7-> $system_content if $system_content != @{"status":"error","code":5010,"desc":"invalid type of Authorization"}@ then return -1 endi sleep 3000 -system_content curl 127.0.0.1:6020/grafana/login/root/taosdata +system_content curl 127.0.0.1:6041/grafana/login/root/taosdata print 8-> $system_content if $system_content != @{"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"}@ then return -1 @@ -103,7 +103,7 @@ endi print =============== step3 - heartbeat -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6020/grafana/d1/table_gc +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6041/grafana/d1/table_gc print 9-> $system_content if $system_content != @{"message":"Grafana server receive a quest from you!"}@ then return -1 @@ -111,19 +111,19 @@ endi print =============== step4 - search -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6020/grafana/heartbeat +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6041/grafana/heartbeat print 10-> $system_content if $system_content != @{"message":"Grafana server receive a quest from you!"}@ then return -1 endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6020/grafana/d1/table_invalid/search +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6041/grafana/d1/table_invalid/search print 11-> $system_content if $system_content != @{"message":"Grafana server receive a quest from you!"}@ then return -1 endi -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' 127.0.0.1:6020/grafana/d1/m1/search +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' 127.0.0.1:6041/grafana/d1/m1/search print 12-> $system_content if $system_content != @{"message":"Grafana server receive a quest from you!"}@ then return -1 @@ -131,49 +131,49 @@ endi print =============== step5 - query -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"taosd","sql":"select first(v1) from d1.m1 where ts > 1514208523020 and ts < 1514208523030 interval(1m)"},{"refId":"B","alias":"system","sql":"select first(v2) from d1.m1 where ts > 1514208523020 and ts < 1514208523030 interval(1m)"}]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"taosd","sql":"select first(v1) from d1.m1 where ts > 1514208523020 and ts < 1514208523030 interval(1m)"},{"refId":"B","alias":"system","sql":"select first(v2) from d1.m1 where ts > 1514208523020 and ts < 1514208523030 interval(1m)"}]' 127.0.0.1:6041/grafana/query print 13-> $system_content if $system_content != @[{"refId":"A","target":"taosd","datapoints":[[2,1514208480000]]},{"refId":"B","target":"system","datapoints":[[5.10000,1514208480000]]}]@ then return -1 endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select first(v1) from d1.m1 where ts > 1514208523020 and ts < 1514208523030 interval(1m)"},{"refId":"B","alias":"","sql":"select first(v2) from d1.m1 where ts > 1514208523020 and ts < 1514208523030 interval(1m)"}]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select first(v1) from d1.m1 where ts > 1514208523020 and ts < 1514208523030 interval(1m)"},{"refId":"B","alias":"","sql":"select first(v2) from d1.m1 where ts > 1514208523020 and ts < 1514208523030 interval(1m)"}]' 127.0.0.1:6041/grafana/query print 14-> $system_content if $system_content != @[{"refId":"A","target":"A","datapoints":[[2,1514208480000]]},{"refId":"B","target":"B","datapoints":[[5.10000,1514208480000]]}]@ then return -1 endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select count(v1) from d1.m1"},{"refId":"B","alias":"","sql":"select count(v2) from d1.m1"}]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select count(v1) from d1.m1"},{"refId":"B","alias":"","sql":"select count(v2) from d1.m1"}]' 127.0.0.1:6041/grafana/query print 15-> $system_content if $system_content != @[{"refId":"A","target":"A","datapoints":[[3,"-"]]},{"refId":"B","target":"B","datapoints":[[3,"-"]]}]@ then return -1 endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select count(v1) from d1.m1"},{"refId":"B","alias":"","sql":"select count(v2) from d1.m1"}]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select count(v1) from d1.m1"},{"refId":"B","alias":"","sql":"select count(v2) from d1.m1"}]' 127.0.0.1:6041/grafana/query print 15-> $system_content if $system_content != @[{"refId":"A","target":"A","datapoints":[[3,"-"]]},{"refId":"B","target":"B","datapoints":[[3,"-"]]}]@ then return -1 endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select count(i) from d1.mt group by a"},{"refId":"B","alias":"","sql":"select sum(i) from d1.mt group by b"}]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select count(i) from d1.mt group by a"},{"refId":"B","alias":"","sql":"select sum(i) from d1.mt group by b"}]' 127.0.0.1:6041/grafana/query print 16-> $system_content if $system_content != @[{"refId":"A","target":"{a:1,}","datapoints":[[5,"-"]]},{"refId":"A","target":"{a:2,}","datapoints":[[4,"-"]]},{"refId":"A","target":"{a:3,}","datapoints":[[3,"-"]]},{"refId":"B","target":"{b:a}","datapoints":[[5,"-"]]},{"refId":"B","target":"{b:b}","datapoints":[[8,"-"]]},{"refId":"B","target":"{b:c}","datapoints":[[9,"-"]]}]@ then return -1 endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"count","sql":"select count(i) from d1.mt group by a"},{"refId":"B","alias":"sum-","sql":"select sum(i) from d1.mt group by b"}]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"count","sql":"select count(i) from d1.mt group by a"},{"refId":"B","alias":"sum-","sql":"select sum(i) from d1.mt group by b"}]' 127.0.0.1:6041/grafana/query print 17-> $system_content if $system_content != @[{"refId":"A","target":"count{a:1,}","datapoints":[[5,"-"]]},{"refId":"A","target":"count{a:2,}","datapoints":[[4,"-"]]},{"refId":"A","target":"count{a:3,}","datapoints":[[3,"-"]]},{"refId":"B","target":"sum-{b:a}","datapoints":[[5,"-"]]},{"refId":"B","target":"sum-{b:b}","datapoints":[[8,"-"]]},{"refId":"B","target":"sum-{b:c}","datapoints":[[9,"-"]]}]@ then return -1 endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"count","sql":"select count(i) from d1.mt interval(1m) group by a "}]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"count","sql":"select count(i) from d1.mt interval(1m) group by a "}]' 127.0.0.1:6041/grafana/query print 18-> $system_content if $system_content != @[{"refId":"A","target":"count{a:1,}","datapoints":[[1,1514208300000],[1,1514208360000],[1,1514208420000],[1,1514208480000],[1,1514208540000]]},{"refId":"A","target":"count{a:2,}","datapoints":[[1,1514208300000],[1,1514208360000],[1,1514208420000],[1,1514208480000]]},{"refId":"A","target":"count{a:3,}","datapoints":[[1,1514208300000],[1,1514208360000],[1,1514208420000]]}]@ then return -1 endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select sum(v2), count(v1) from d1.m1"},{"refId":"B","alias":"","sql":"select count(v2), sum(v2) from d1.m1"}]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select sum(v2), count(v1) from d1.m1"},{"refId":"B","alias":"","sql":"select count(v2), sum(v2) from d1.m1"}]' 127.0.0.1:6041/grafana/query print 19-> $system_content if $system_content != @[{"refId":"A","target":"{count(v1):3}","datapoints":[[15.299999714,"-"]]},{"refId":"B","target":"{sum(v2):15.299999714}","datapoints":[[3,"-"]]}]@ then return -1 diff --git a/tests/script/general/http/grafana_bug.sim b/tests/script/general/http/grafana_bug.sim index 708af23cfc..9c6a8a7000 100644 --- a/tests/script/general/http/grafana_bug.sim +++ b/tests/script/general/http/grafana_bug.sim @@ -33,7 +33,7 @@ sql insert into tb2 values('2020-01-04 00:00:00.000', 22, 214, 224) print =============== step1 - one query, 1 column, with timestamp -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query print step1-> $system_content if $system_content != @[{"refId":"A","target":"A","datapoints":[[null,1577980800000],[null,1578067200000]]}]@ then return -1 @@ -41,7 +41,7 @@ endi print =============== step2 - one query, 2 column, with timestamp -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query print step2-> $system_content if $system_content != @[{"refId":"A","target":"A","datapoints":[[2,1577980800000],[2,1578067200000]]}]@ then return -1 @@ -49,80 +49,80 @@ endi print =============== step3 - one query, 3 column, with timestamp -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val,val1 from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val,val1 from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query print step3.1-> $system_content if $system_content != @[{"refId":"A","target":"{val1:13,}","datapoints":[[2,1577980800000]]},{"refId":"A","target":"{val1:14,}","datapoints":[[2,1578067200000]]}]@ then return -1 endi -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val,val1 from db.tb "} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val,val1 from db.tb "} ]' 127.0.0.1:6041/grafana/query print step3.2-> $system_content if $system_content != @[{"refId":"A","target":"{val1:11,}","datapoints":[[1,1577808000000]]},{"refId":"A","target":"{val1:12,}","datapoints":[[1,1577894400000]]},{"refId":"A","target":"{val1:13,}","datapoints":[[2,1577980800000]]},{"refId":"A","target":"{val1:14,}","datapoints":[[2,1578067200000]]}]@ then return -1 endi -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val1,val from db.tb "} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val1,val from db.tb "} ]' 127.0.0.1:6041/grafana/query print step3.3-> $system_content if $system_content != @[{"refId":"A","target":"{val:1,}","datapoints":[[11,1577808000000],[12,1577894400000]]},{"refId":"A","target":"{val:2,}","datapoints":[[13,1577980800000],[14,1578067200000]]}]@ then return -1 endi print =============== step4 - one query, 4 column, with timestamp -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val2,val1,val from db.tb "} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val2,val1,val from db.tb "} ]' 127.0.0.1:6041/grafana/query print step4.1-> $system_content if $system_content != @[{"refId":"A","target":"{val1:11,, val:1,}","datapoints":[[21,1577808000000]]},{"refId":"A","target":"{val1:12,, val:1,}","datapoints":[[22,1577894400000]]},{"refId":"A","target":"{val1:13,, val:2,}","datapoints":[[23,1577980800000]]},{"refId":"A","target":"{val1:14,, val:2,}","datapoints":[[24,1578067200000]]}]@ then return -1 endi -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val,val1,val2 from db.tb "} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val,val1,val2 from db.tb "} ]' 127.0.0.1:6041/grafana/query print step4.2-> $system_content if $system_content != @[{"refId":"A","target":"{val1:11,, val2:21,}","datapoints":[[1,1577808000000]]},{"refId":"A","target":"{val1:12,, val2:22,}","datapoints":[[1,1577894400000]]},{"refId":"A","target":"{val1:13,, val2:23,}","datapoints":[[2,1577980800000]]},{"refId":"A","target":"{val1:14,, val2:24,}","datapoints":[[2,1578067200000]]}]@ then return -1 endi print =============== step5 - one query, 1 column, no timestamp -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query print step1-> $system_content if $system_content != @[{"refId":"A","target":"A","datapoints":[[2,"-"],[2,"-"]]}]@ then return -1 endi print =============== step6 - one query, 2 column, no timestamp -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select val1,val2 from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select val1,val2 from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query print step1-> $system_content if $system_content != @[{"refId":"A","target":"{val2:23,}","datapoints":[[13,"-"]]},{"refId":"A","target":"{val2:24,}","datapoints":[[14,"-"]]}]@ then return -1 endi print =============== step7 - one query, 3 column, no timestamp -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select val1,val2,val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select val1,val2,val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query print step1-> $system_content if $system_content != @[{"refId":"A","target":"{val2:23,, val:2,}","datapoints":[[13,"-"]]},{"refId":"A","target":"{val2:24,, val:2,}","datapoints":[[14,"-"]]}]@ then return -1 endi -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select val1,val2,val from db.tb"} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select val1,val2,val from db.tb"} ]' 127.0.0.1:6041/grafana/query print step1-> $system_content if $system_content != @[{"refId":"A","target":"{val2:21,, val:1,}","datapoints":[[11,"-"]]},{"refId":"A","target":"{val2:22,, val:1,}","datapoints":[[12,"-"]]},{"refId":"A","target":"{val2:23,, val:2,}","datapoints":[[13,"-"]]},{"refId":"A","target":"{val2:24,, val:2,}","datapoints":[[14,"-"]]}]@ then return -1 endi print =============== step8 - one query, no return -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select val1,val2,val from db.tb where ts >= 1677980800000 "} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select val1,val2,val from db.tb where ts >= 1677980800000 "} ]' 127.0.0.1:6041/grafana/query print step1-> $system_content if $system_content != @[]@ then return -1 endi print =============== step9 - one query, insert sql -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"insert into db.t2 values(now, 1) "} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"insert into db.t2 values(now, 1) "} ]' 127.0.0.1:6041/grafana/query print step1-> $system_content if $system_content != @[]@ then return -1 endi print =============== step10 - one query, error sql -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select * from db.tt "} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select * from db.tt "} ]' 127.0.0.1:6041/grafana/query print step1-> $system_content if $system_content != @[]@ then return -1 @@ -130,7 +130,7 @@ endi print =============== step11 - two query, 1 column, with timestamp, 1 column, with timestamp -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"","sql":"select ts from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"","sql":"select ts from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query print step1-> $system_content if $system_content != @[{"refId":"B","target":"BB","datapoints":[[null,1577980800000],[null,1578067200000]]},{"refId":"A","target":"A","datapoints":[[null,1577980800000],[null,1578067200000]]}]@ then return -1 @@ -138,98 +138,98 @@ endi print =============== step12 - two query, 1 column, with timestamp, 2 column, with timestamp -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"","sql":"select ts,val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"","sql":"select ts,val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query print step1-> $system_content if $system_content != @[{"refId":"B","target":"BB","datapoints":[[null,1577980800000],[null,1578067200000]]},{"refId":"A","target":"A","datapoints":[[2,1577980800000],[2,1578067200000]]}]@ then return -1 endi print =============== step13 - two query, 1 column, with timestamp, 3 column, with timestamp -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"","sql":"select ts,val,val1 from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"","sql":"select ts,val,val1 from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query print step1-> $system_content if $system_content != @[{"refId":"B","target":"BB","datapoints":[[null,1577980800000],[null,1578067200000]]},{"refId":"A","target":"{val1:13,}","datapoints":[[2,1577980800000]]},{"refId":"A","target":"{val1:14,}","datapoints":[[2,1578067200000]]}]@ then return -1 endi print =============== step14 - two query, 2 column, with timestamp, 2 column, with timestamp -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val2 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val2 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query print step1-> $system_content if $system_content != @[{"refId":"B","target":"BB","datapoints":[[223,1577980800000],[224,1578067200000]]},{"refId":"A","target":"AA","datapoints":[[2,1577980800000],[2,1578067200000]]}]@ then return -1 endi print =============== step15 - two query, 2 column, with timestamp, 3 column, with timestamp -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val2, val1 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val2, val1 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query print step1-> $system_content if $system_content != @[{"refId":"B","target":"BB{val1:213,}","datapoints":[[223,1577980800000]]},{"refId":"B","target":"BB{val1:214,}","datapoints":[[224,1578067200000]]},{"refId":"A","target":"AA","datapoints":[[2,1577980800000],[2,1578067200000]]}]@ then return -1 endi print =============== step16 - two query, 3 column, with timestamp, 4 column, with timestamp -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val, val1, val2, val1 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val,val1 from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val, val1, val2, val1 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val,val1 from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query print step1-> $system_content if $system_content != @[{"refId":"B","target":"BB{val1:213,, val2:223,, val1:213,}","datapoints":[[22,1577980800000]]},{"refId":"B","target":"BB{val1:214,, val2:224,, val1:214,}","datapoints":[[22,1578067200000]]},{"refId":"A","target":"AA{val1:13,}","datapoints":[[2,1577980800000]]},{"refId":"A","target":"AA{val1:14,}","datapoints":[[2,1578067200000]]}]@ then return -1 endi print =============== step17 - two query, 2 column, with timestamp, no return -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val from db.tb where ts >= 1677980800000 "} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val from db.tb where ts >= 1677980800000 "} ]' 127.0.0.1:6041/grafana/query print step1-> $system_content if $system_content != @[{"refId":"B","target":"BB","datapoints":[[22,1577980800000],[22,1578067200000]]}]@ then return -1 endi print =============== step18 - two query, 2 column, with timestamp, invalid sql -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val from db.tb222 where ts >= 1677980800000 "} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val from db.tb222 where ts >= 1677980800000 "} ]' 127.0.0.1:6041/grafana/query print step1-> $system_content if $system_content != @[{"refId":"B","target":"BB","datapoints":[[22,1577980800000],[22,1578067200000]]}]@ then return -1 endi print =============== step19 - two query, 2 column, with timestamp, insert sql -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"insert into db.t2 values(now, 1)"} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"insert into db.t2 values(now, 1)"} ]' 127.0.0.1:6041/grafana/query print step1-> $system_content if $system_content != @[{"refId":"B","target":"BB","datapoints":[[22,1577980800000],[22,1578067200000]]}]@ then return -1 endi print =============== step20 - two query, 1 column, no timestamp, 1 column, with timestamp -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query print step1-> $system_content if $system_content != @[{"refId":"B","target":"BB","datapoints":[[22,"-"],[22,"-"]]},{"refId":"A","target":"AA","datapoints":[[null,1577980800000],[null,1578067200000]]}]@ then return -1 endi print =============== step21 - two query, 1 column, no timestamp, 2 column, with timestamp -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val2 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val2 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query print step1-> $system_content if $system_content != @[{"refId":"B","target":"BB","datapoints":[[22,"-"],[22,"-"]]},{"refId":"A","target":"AA","datapoints":[[223,1577980800000],[224,1578067200000]]}]@ then return -1 endi print =============== step22 - two query, 1 column, no timestamp, 3 column, with timestamp -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val1, val2 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val1, val2 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query print step1-> $system_content if $system_content != @[{"refId":"B","target":"BB","datapoints":[[22,"-"],[22,"-"]]},{"refId":"A","target":"AA{val2:223,}","datapoints":[[213,1577980800000]]},{"refId":"A","target":"AA{val2:224,}","datapoints":[[214,1578067200000]]}]@ then return -1 endi print =============== step23 - two query, 2 column, no timestamp, 1 column, no timestamp -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val1,val2 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select val1 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val1,val2 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select val1 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query print step1-> $system_content if $system_content != @[{"refId":"B","target":"BB{val2:223,}","datapoints":[[213,"-"]]},{"refId":"B","target":"BB{val2:224,}","datapoints":[[214,"-"]]},{"refId":"A","target":"AA","datapoints":[[213,"-"],[214,"-"]]}]@ then return -1 endi print =============== step24 - two query, 2 column, no timestamp, 2 column, no timestamp -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val1,val2 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select val,val1 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val1,val2 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select val,val1 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query print step1-> $system_content if $system_content != @[{"refId":"B","target":"BB{val2:223,}","datapoints":[[213,"-"]]},{"refId":"B","target":"BB{val2:224,}","datapoints":[[214,"-"]]},{"refId":"A","target":"AA{val1:213,}","datapoints":[[22,"-"]]},{"refId":"A","target":"AA{val1:214,}","datapoints":[[22,"-"]]}]@ then return -1 endi print =============== step25 - two query, 2 column, no timestamp, 3 column, no timestamp -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val1,val2 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select val,val1,val2 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val1,val2 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select val,val1,val2 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query print step1-> $system_content if $system_content != @[{"refId":"B","target":"BB{val2:223,}","datapoints":[[213,"-"]]},{"refId":"B","target":"BB{val2:224,}","datapoints":[[214,"-"]]},{"refId":"A","target":"AA{val1:213,, val2:223,}","datapoints":[[22,"-"]]},{"refId":"A","target":"AA{val1:214,, val2:224,}","datapoints":[[22,"-"]]}]@ then return -1 diff --git a/tests/script/general/http/prepare.sim b/tests/script/general/http/prepare.sim index d5b8920190..1645c1a7e9 100644 --- a/tests/script/general/http/prepare.sim +++ b/tests/script/general/http/prepare.sim @@ -34,8 +34,8 @@ sleep 4000 print =============== step2 - login -system_content curl 127.0.0.1:6020/rest/login/root/taosdata -print curl 127.0.0.1:6020/rest/login/root/taosdata -----> $system_content +system_content curl 127.0.0.1:6041/rest/login/root/taosdata +print curl 127.0.0.1:6041/rest/login/root/taosdata -----> $system_content if $system_content != @{"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"}@ then return -1 @@ -45,8 +45,8 @@ return print =============== step3 - query data -system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwia2V5IjoiYkVsOExjdkxVZDdhOHFkdE5abXRPTnJ5cDIwMW1hMDQiLCJzdWIiOiJyb290In0.k7CkgmpOJImIkLqZqzASlPmkdeEw7Wfk4XUrqGZX-LQ' -d 'select * from t1' 127.0.0.1:6020/rest/sql/d1 -print curl 127.0.0.1:6020/rest/sql/d1 -----> $system_content +system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwia2V5IjoiYkVsOExjdkxVZDdhOHFkdE5abXRPTnJ5cDIwMW1hMDQiLCJzdWIiOiJyb290In0.k7CkgmpOJImIkLqZqzASlPmkdeEw7Wfk4XUrqGZX-LQ' -d 'select * from t1' 127.0.0.1:6041/rest/sql/d1 +print curl 127.0.0.1:6041/rest/sql/d1 -----> $system_content if $system_content != @{"status":"succ","head":["ts","i","b"],"data":[["2017-12-25 21:28:54.022",14,"44\\\\\"\"44"],["2017-12-25 21:28:53.022",13,"33\\\\\"33"],["2017-12-25 21:28:52.022",12,"22\\\\11"],["2017-12-25 21:28:51.022",11,"11\\\\11"],["2017-12-25 21:28:49.022",9,"99\\99"],["2017-12-25 21:28:48.022",8,"88\"\"88"],["2017-12-25 21:28:47.022",7,"77\"7\""],["2017-12-25 21:28:46.022",6,"66'6'"],["2017-12-25 21:28:45.022",5,"55'"],["2017-12-25 21:28:44.022",4,"44\""],["2017-12-25 21:28:43.022",3,"33"],["2017-12-25 21:28:42.022",2,"22"],["2017-12-25 21:28:41.022",1,"11"]],"rows":13}@ then return -1 endi diff --git a/tests/script/general/http/restful.sim b/tests/script/general/http/restful.sim index a647399758..ff0e823c6d 100644 --- a/tests/script/general/http/restful.sim +++ b/tests/script/general/http/restful.sim @@ -30,8 +30,8 @@ sql insert into table_rest values('2017-12-25 21:28:50.022', 10) print =============== step2 - login -system_content curl 127.0.0.1:6020/rest/login/root/taosdata -print curl 127.0.0.1:6020/rest/login/root/taosdata -----> $system_content +system_content curl 127.0.0.1:6041/rest/login/root/taosdata +print curl 127.0.0.1:6041/rest/login/root/taosdata -----> $system_content if $system_content != {"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"} then return -1 @@ -39,44 +39,44 @@ endi print =============== step3 - query data -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_rest' 127.0.0.1:6020/rest/sql -print curl 127.0.0.1:6020/rest/sql -----> $system_content +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_rest' 127.0.0.1:6041/rest/sql +print curl 127.0.0.1:6041/rest/sql -----> $system_content if $system_content != @{"status":"succ","head":["ts","i"],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10]],"rows":10}@ then return -1 endi print =============== step4 - insert data -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.table_rest values('2017-12-25 21:28:51.022', 11)" 127.0.0.1:6020/rest/sql -print curl 127.0.0.1:6020/rest/sql -----> $system_content +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.table_rest values('2017-12-25 21:28:51.022', 11)" 127.0.0.1:6041/rest/sql +print curl 127.0.0.1:6041/rest/sql -----> $system_content if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[1]],"rows":1}@ then return -1 endi print =============== step5 - query data -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_rest' 127.0.0.1:6020/rest/sql -print curl 127.0.0.1:6020/rest/sql -----> $system_content +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_rest' 127.0.0.1:6041/rest/sql +print curl 127.0.0.1:6041/rest/sql -----> $system_content if $system_content != @{"status":"succ","head":["ts","i"],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10],["2017-12-25 21:28:51.022",11]],"rows":11}@ then return -1 endi print =============== step6 - query no db data -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show dnodes' 127.0.0.1:6020/rest/sql -print curl 127.0.0.1:6020/rest/sql -----> $system_content +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show dnodes' 127.0.0.1:6041/rest/sql +print curl 127.0.0.1:6041/rest/sql -----> $system_content print =============== step7 - change password sql create user u1 PASS 'abcd@1234' sql create user u2 PASS 'abcd_1234' -system_content curl 127.0.0.1:6020/rest/login/u1/abcd@1234 -print curl 127.0.0.1:6020/rest/login/u1/abcd@1234 -----> $system_content +system_content curl 127.0.0.1:6041/rest/login/u1/abcd@1234 +print curl 127.0.0.1:6041/rest/login/u1/abcd@1234 -----> $system_content if $system_content != @{"status":"succ","code":0,"desc":"jIlItaLFFIPa8qdtNZmtONryp201ma04SXX8PEJowKAB/46k1gwnPNryp201ma04"}@ then return -1 endi -system_content curl 127.0.0.1:6020/rest/login/u2/aabcd_1234 -print curl 127.0.0.1:6020/rest/login/u2/abcd_1234 -----> $system_content +system_content curl 127.0.0.1:6041/rest/login/u2/aabcd_1234 +print curl 127.0.0.1:6041/rest/login/u2/abcd_1234 -----> $system_content if $system_content != @{"status":"error","code":3,"desc":"Authentication failure"}@ then return -1 endi diff --git a/tests/script/general/http/restful_full.sim b/tests/script/general/http/restful_full.sim index 43511b31d8..0b3cfaa160 100644 --- a/tests/script/general/http/restful_full.sim +++ b/tests/script/general/http/restful_full.sim @@ -12,57 +12,57 @@ print ============================ dnode1 start print =============== step1 - login -system_content curl 127.0.0.1:6020/rest/ +system_content curl 127.0.0.1:6041/rest/ print 1-> $system_content if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then return -1 endi -system_content curl 127.0.0.1:6020/rest/xx +system_content curl 127.0.0.1:6041/rest/xx print 2-> $system_content if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then return -1 endi -system_content curl 127.0.0.1:6020/rest/login +system_content curl 127.0.0.1:6041/rest/login print 3-> $system_content if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then return -1 endi #4 -system_content curl 127.0.0.1:6020/rest/login/root +system_content curl 127.0.0.1:6041/rest/login/root print 4-> $system_content if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then return -1 endi -system_content curl 127.0.0.1:6020/rest/login/root/123 +system_content curl 127.0.0.1:6041/rest/login/root/123 print 5-> $system_content if $system_content != @{"status":"error","code":3,"desc":"Authentication failure"}@ then return -1 endi -system_content curl 127.0.0.1:6020/rest/login/root/123/1/1/3 +system_content curl 127.0.0.1:6041/rest/login/root/123/1/1/3 print 6-> $system_content if $system_content != @{"status":"error","code":3,"desc":"Authentication failure"}@ then return -1 endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:6020/rest/login/root/1 +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:6041/rest/login/root/1 print 7-> $system_content if $system_content != @{"status":"error","code":3,"desc":"Authentication failure"}@ then return -1 endi #8 -system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 127.0.0.1:6020/rest/login/root/1 +system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 127.0.0.1:6041/rest/login/root/1 print 8-> $system_content if $system_content != @{"status":"error","code":5010,"desc":"invalid type of Authorization"}@ then return -1 endi -system_content curl -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 127.0.0.1:6020/rest/login/root/1 +system_content curl -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 127.0.0.1:6041/rest/login/root/1 print 9-> $system_content if $system_content != @{"status":"error","code":5010,"desc":"invalid type of Authorization"}@ then return -1 @@ -70,7 +70,7 @@ endi sleep 3000 -system_content curl 127.0.0.1:6020/rest/login/root/taosdata/ +system_content curl 127.0.0.1:6041/rest/login/root/taosdata/ print 10-> $system_content if $system_content != @{"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"}@ then return -1 @@ -79,52 +79,52 @@ endi print =============== step2 - no db #11 -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:6020/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:6041/rest/sql print 11-> $system_content if $system_content != @{"status":"succ","head":["name","created_time","ntables","vgroups","replica","quorum","days","keep1,keep2,keep(D)","cache(MB)","blocks","minrows","maxrows","wallevel","fsync","comp","precision","status"],"data":[],"rows":0}@ then return -1 endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create database d1' 127.0.0.1:6020/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create database d1' 127.0.0.1:6041/rest/sql print 12-> $system_content if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[0]],"rows":0}@ then return -1 endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create database d1' 127.0.0.1:6020/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create database d1' 127.0.0.1:6041/rest/sql print 13-> $system_content if $system_content != @{"status":"error","code":897,"desc":"Database already exists"}@ then return -1 endi #14 -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '' 127.0.0.1:6020/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '' 127.0.0.1:6041/rest/sql print 14-> $system_content if $system_content != @{"status":"error","code":5012,"desc":"no sql input"}@ then return -1 endi -#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'use d1' 127.0.0.1:6020/rest/sql +#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'use d1' 127.0.0.1:6041/rest/sql #print 15-> $system_content #if $system_content != @{"status":"error","code":5017,"desc":"no need to execute use db cmd"}@ then #if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[1]],"rows":1}@ then # return -1 #endi -#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' use d1' 127.0.0.1:6020/rest/sql +#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' use d1' 127.0.0.1:6041/rest/sql #print 16-> $system_content #if $system_content != @{"status":"error","code":5017,"desc":"no need to execute use db cmd"}@ then # return -1 #endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' used1' 127.0.0.1:6020/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' used1' 127.0.0.1:6041/rest/sql print 17-> $system_content if $system_content != @{"status":"error","code":512,"desc":"invalid SQL: invalid SQL: syntax error near 'used1'"}@ then return -1 endi #18 -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' show tables;' 127.0.0.1:6020/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' show tables;' 127.0.0.1:6041/rest/sql print 18-> $system_content if $system_content != @{"status":"error","code":896,"desc":"Database not specified or available"}@ then return -1 @@ -133,44 +133,44 @@ endi print =============== step3 - db #19 -#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' show tables;' 127.0.0.1:6020/rest/sql/d4 +#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' show tables;' 127.0.0.1:6041/rest/sql/d4 #print 19-> $system_content #if $system_content != @{"status":"error","code":1000,"desc":"invalid DB"}@ then # return -1 #endi -#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' show tables;' 127.0.0.1:6020/rest/sql/d1 +#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' show tables;' 127.0.0.1:6041/rest/sql/d1 #print 20-> $system_content #if $system_content != @{"status":"succ","head":["name","created time","columns","metric"],"data":[],"rows":0}@ then # return -1 #endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d1.t1;' 127.0.0.1:6020/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d1.t1;' 127.0.0.1:6041/rest/sql print 21-> $system_content if $system_content != @{"status":"error","code":866,"desc":"Table does not exist"}@ then return -1 endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' create table d1.t1 (ts timestamp, speed int)' 127.0.0.1:6020/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' create table d1.t1 (ts timestamp, speed int)' 127.0.0.1:6041/rest/sql print 22-> $system_content if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[0]],"rows":0}@ then return -1 endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d1.t1 ' 127.0.0.1:6020/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d1.t1 ' 127.0.0.1:6041/rest/sql print 23-> $system_content if $system_content != @{"status":"succ","head":["ts","speed"],"data":[],"rows":0}@ then return -1 endi #24 -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:41.022', 1)" 127.0.0.1:6020/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:41.022', 1)" 127.0.0.1:6041/rest/sql print 24-> $system_content if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[1]],"rows":1}@ then return -1 endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d1.t1 ' 127.0.0.1:6020/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d1.t1 ' 127.0.0.1:6041/rest/sql print 25-> $system_content if $system_content != @{"status":"succ","head":["ts","speed"],"data":[["2017-12-25 21:28:41.022",1]],"rows":1}@ then return -1 @@ -178,53 +178,53 @@ endi #26 print 25-> no print -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:42.022', 2)" 127.0.0.1:6020/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:42.022', 2)" 127.0.0.1:6041/rest/sql -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:43.022', 3)" 127.0.0.1:6020/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:43.022', 3)" 127.0.0.1:6041/rest/sql -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:44.022', 4)" 127.0.0.1:6020/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:44.022', 4)" 127.0.0.1:6041/rest/sql -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:45.022', 5)" 127.0.0.1:6020/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:45.022', 5)" 127.0.0.1:6041/rest/sql -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:46.022', 6)" 127.0.0.1:6020/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:46.022', 6)" 127.0.0.1:6041/rest/sql -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:47.022', 7)" 127.0.0.1:6020/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:47.022', 7)" 127.0.0.1:6041/rest/sql -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:48.022', 8)" 127.0.0.1:6020/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:48.022', 8)" 127.0.0.1:6041/rest/sql -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:49.022', 9)" 127.0.0.1:6020/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:49.022', 9)" 127.0.0.1:6041/rest/sql -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:50.022', 10)" 127.0.0.1:6020/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:50.022', 10)" 127.0.0.1:6041/rest/sql -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:51.022', 11)" 127.0.0.1:6020/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:51.022', 11)" 127.0.0.1:6041/rest/sql #27 -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d1.t1 ' 127.0.0.1:6020/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d1.t1 ' 127.0.0.1:6041/rest/sql print 27-> $system_content if $system_content != @{"status":"succ","head":["ts","speed"],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10],["2017-12-25 21:28:51.022",11]],"rows":11}@ then return -1 endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create database d2' 127.0.0.1:6020/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create database d2' 127.0.0.1:6041/rest/sql print 28-> $system_content if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[0]],"rows":0}@ then return -1 endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' create table d2.t1 (ts timestamp, speed int)' 127.0.0.1:6020/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' create table d2.t1 (ts timestamp, speed int)' 127.0.0.1:6041/rest/sql print 29-> $system_content if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[0]],"rows":0}@ then return -1 endi #30 -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d2.t1 values('2017-12-25 21:28:41.022', 1)" 127.0.0.1:6020/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d2.t1 values('2017-12-25 21:28:41.022', 1)" 127.0.0.1:6041/rest/sql print 30-> $system_content if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[1]],"rows":1}@ then return -1 endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d2.t1 ' 127.0.0.1:6020/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d2.t1 ' 127.0.0.1:6041/rest/sql print 31-> $system_content if $system_content != @{"status":"succ","head":["ts","speed"],"data":[["2017-12-25 21:28:41.022",1]],"rows":1}@ then return -1 diff --git a/tests/script/general/http/restful_insert.sim b/tests/script/general/http/restful_insert.sim index b36a92c003..ecdaef987e 100644 --- a/tests/script/general/http/restful_insert.sim +++ b/tests/script/general/http/restful_insert.sim @@ -28,8 +28,8 @@ sql create table d1.table_rest9 (ts timestamp, i int) print =============== step2 - login -system_content curl 127.0.0.1:6020/rest/login/root/taosdata -print curl 127.0.0.1:6020/rest/login/root/taosdata -----> $system_content +system_content curl 127.0.0.1:6041/rest/login/root/taosdata +print curl 127.0.0.1:6041/rest/login/root/taosdata -----> $system_content if $system_content != {"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"} then return -1 @@ -37,17 +37,17 @@ endi print =============== step3 - query data -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6020/rest/sql -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6020/rest/sql -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6020/rest/sql -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6020/rest/sql -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6020/rest/sql -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6020/rest/sql -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6020/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6041/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6041/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6041/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6041/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6041/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6041/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6041/rest/sql print =============== step5 - query data -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_rest1' 127.0.0.1:6020/rest/sql -print curl 127.0.0.1:6020/rest/sql -----> $system_content +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_rest1' 127.0.0.1:6041/rest/sql +print curl 127.0.0.1:6041/rest/sql -----> $system_content system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/http/restful_limit.sim b/tests/script/general/http/restful_limit.sim index 8ee12f1c37..a88bdec912 100644 --- a/tests/script/general/http/restful_limit.sim +++ b/tests/script/general/http/restful_limit.sim @@ -37,10 +37,10 @@ while $i < 2 $i = $i + 1 endw -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'select * from db0.st0 limit 100' 127.0.0.1:6020/rest/sql -print curl 127.0.0.1:6020/rest/sql -----> $system_content +system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'select * from db0.st0 limit 100' 127.0.0.1:6041/rest/sql +print curl 127.0.0.1:6041/rest/sql -----> $system_content -#system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d "select * from db0.st0 where tbname in ('tb0', 'tb1') limit 1000" 127.0.0.1:6020/rest/sql -#print curl 127.0.0.1:6020/rest/sql -----> $system_content +#system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d "select * from db0.st0 where tbname in ('tb0', 'tb1') limit 1000" 127.0.0.1:6041/rest/sql +#print curl 127.0.0.1:6041/rest/sql -----> $system_content system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/http/telegraf.sim b/tests/script/general/http/telegraf.sim index 1ed73f04ad..a845c2b12f 100644 --- a/tests/script/general/http/telegraf.sim +++ b/tests/script/general/http/telegraf.sim @@ -13,231 +13,231 @@ sql connect print ============================ dnode1 start print =============== step1 - parse -system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/ +system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/ print $system_content if $system_content != @{"status":"error","code":5022,"desc":"database name can not be null"}@ then return -1 endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/ +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/ print $system_content if $system_content != @{"status":"error","code":5022,"desc":"database name can not be null"}@ then return -1 endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/d123456789012345678901234567890123456 +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/d123456789012345678901234567890123456 print $system_content if $system_content != @{"status":"error","code":5023,"desc":"database name too long"}@ then return -1 endi -system_content curl -u root:taosdata -d '[]' 127.0.0.1:6020/telegraf/db/root/taosdata1 +system_content curl -u root:taosdata -d '[]' 127.0.0.1:6041/telegraf/db/root/taosdata1 print $system_content if $system_content != @{"status":"error","code":5027,"desc":"metric name not find"}@ then return -1 endi -system_content curl -u root:taosdata -d '{}' 127.0.0.1:6020/telegraf/db/root/taosdata1 +system_content curl -u root:taosdata -d '{}' 127.0.0.1:6041/telegraf/db/root/taosdata1 print $system_content if $system_content != @{"status":"error","code":5027,"desc":"metric name not find"}@ then return -1 endi -system_content curl -u root:taosdata -d '[{}]' 127.0.0.1:6020/telegraf/db/root/taosdata1 +system_content curl -u root:taosdata -d '[{}]' 127.0.0.1:6041/telegraf/db/root/taosdata1 print $system_content if $system_content != @{"status":"error","code":5027,"desc":"metric name not find"}@ then return -1 endi -system_content curl -u root:taosdata -d '{"metrics": []}' 127.0.0.1:6020/telegraf/db/root/taosdata1 +system_content curl -u root:taosdata -d '{"metrics": []}' 127.0.0.1:6041/telegraf/db/root/taosdata1 print $system_content if $system_content != @{"status":"error","code":5025,"desc":"metrics size is 0"}@ then return -1 endi -system_content curl -u root:taosdata -d '{"metrics": [{}]}' 127.0.0.1:6020/telegraf/db/root/taosdata1 +system_content curl -u root:taosdata -d '{"metrics": [{}]}' 127.0.0.1:6041/telegraf/db/root/taosdata1 print $system_content if $system_content != @{"status":"error","code":5027,"desc":"metric name not find"}@ then return -1 endi -system_content curl -u root:taosdata -d '{"metrics": 12}' 127.0.0.1:6020/telegraf/db/root/taosdata1 +system_content curl -u root:taosdata -d '{"metrics": 12}' 127.0.0.1:6041/telegraf/db/root/taosdata1 print $system_content if $system_content != @{"status":"error","code":5025,"desc":"metrics size is 0"}@ then return -1 endi -#system_content curl -u root:taosdata -d '{"metrics": [{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}]}' 127.0.0.1:6020/telegraf/db/root/taosdata1 +#system_content curl -u root:taosdata -d '{"metrics": [{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}]}' 127.0.0.1:6041/telegraf/db/root/taosdata1 #print $system_content #if $system_content != @{"status":"error","code":5026,"desc":"metrics size can not more than 50"}@ then # return -1 #endi -system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1 +system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1 print $system_content if $system_content != @{"status":"error","code":5027,"desc":"metric name not find"}@ then return -1 endi -system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":111,"tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1 +system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":111,"tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1 print $system_content if $system_content != @{"status":"error","code":5028,"desc":"metric name type should be string"}@ then return -1 endi -system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1 +system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1 print $system_content if $system_content != @{"status":"error","code":5029,"desc":"metric name length is 0"}@ then return -1 endi -system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1 +system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1 print $system_content if $system_content != @{"status":"error","code":5030,"desc":"metric name length too long"}@ then return -1 endi -system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"}}' 127.0.0.1:6020/telegraf/db/root/taosdata1 +system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"}}' 127.0.0.1:6041/telegraf/db/root/taosdata1 print $system_content if $system_content != @{"status":"error","code":5031,"desc":"timestamp not find"}@ then return -1 endi -system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":""}' 127.0.0.1:6020/telegraf/db/root/taosdata1 +system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":""}' 127.0.0.1:6041/telegraf/db/root/taosdata1 print $system_content if $system_content != @{"status":"error","code":5032,"desc":"timestamp type should be integer"}@ then return -1 endi -system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":-1}' 127.0.0.1:6020/telegraf/db/root/taosdata1 +system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":-1}' 127.0.0.1:6041/telegraf/db/root/taosdata1 print $system_content if $system_content != @{"status":"error","code":5033,"desc":"timestamp value smaller than 0"}@ then return -1 endi -system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1 +system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1 print $system_content if $system_content != @{"status":"error","code":5034,"desc":"tags not find"}@ then return -1 endi -system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1 +system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1 print $system_content if $system_content != @{"status":"error","code":5035,"desc":"tags size is 0"}@ then return -1 endi -system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":"","timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1 +system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":"","timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1 print $system_content if $system_content != @{"status":"error","code":5035,"desc":"tags size is 0"}@ then return -1 endi -#system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor","host":"windows","instance":"1","objectname":"Processor","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata +#system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor","host":"windows","instance":"1","objectname":"Processor","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata #print $system_content #if $system_content != @{"status":"error","code":5036,"desc":"tags size too long"}@ then # return -1 #endi -system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1 +system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1 print $system_content if $system_content != @{"status":"error","code":5035,"desc":"tags size is 0"}@ then return -1 endi -system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"":"windows"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1 +system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"":"windows"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1 print $system_content if $system_content != @{"status":"error","code":5038,"desc":"tag name is null"}@ then return -1 endi -#system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host111111111111222222222222222222222":""},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1 +#system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host111111111111222222222222222222222":""},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1 #print $system_content #if $system_content != @{"status":"error","code":5039,"desc":"tag name length too long"}@ then # return -1 #endi -system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":true},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1 +system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":true},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1 print $system_content if $system_content != @{"status":"error","code":5040,"desc":"tag value type should be number or string"}@ then return -1 endi -system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":""},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1 +system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":""},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1 print $system_content if $system_content != @{"status":"error","code":5041,"desc":"tag value is null"}@ then return -1 endi -system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"5022":"111"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1 +system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"5022":"111"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1 print $system_content if $system_content != @{"status":"error","code":5042,"desc":"table is null"}@ then return -1 endi -system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1 +system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1 print $system_content if $system_content != @{"status":"error","code":5043,"desc":"table name length too long"}@ then return -1 endi -system_content curl -u root:taosdata -d '{"fields":{},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1 +system_content curl -u root:taosdata -d '{"fields":{},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1 print $system_content if $system_content != @{"status":"error","code":5045,"desc":"fields size is 0"}@ then return -1 endi -system_content curl -u root:taosdata -d '{"fields":{"":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1 +system_content curl -u root:taosdata -d '{"fields":{"":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1 print $system_content if $system_content != @{"status":"error","code":5048,"desc":"field name is null"}@ then return -1 endi -system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":"","Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1 +system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":"","Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1 print $system_content if $system_content != @{"status":"error","code":5051,"desc":"field value is null"}@ then return -1 endi -system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":true,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1 +system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":true,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1 print $system_content if $system_content != @{"status":"error","code":5050,"desc":"field value type should be number or string"}@ then return -1 endi -system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1564641722000}' 127.0.0.1:6020/telegraf/db +system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1564641722000}' 127.0.0.1:6041/telegraf/db print $system_content @@ -248,7 +248,7 @@ endi sleep 3000 print =============== step2 - insert single data -system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1564641722000}' 127.0.0.1:6020/telegraf/db/ +system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1564641722000}' 127.0.0.1:6041/telegraf/db/ print $system_content @@ -256,7 +256,7 @@ print $system_content # return -1 #endi -system_content curl -u root:taosdata -d 'select * from db.win_cpu_windows_1_Processor' 127.0.0.1:6020/rest/sql/ +system_content curl -u root:taosdata -d 'select * from db.win_cpu_windows_1_Processor' 127.0.0.1:6041/rest/sql/ print $system_content @@ -265,7 +265,7 @@ print $system_content #endi print =============== step3 - multi-query data -system_content curl -u root:taosdata -d '{"metrics": [{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"window1","instance":"1","objectname":"Processor"},"timestamp":1564641723000},{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"window2","instance":"1","objectname":"Processor"},"timestamp":1564641723000}]}' 127.0.0.1:6020/telegraf/db/ +system_content curl -u root:taosdata -d '{"metrics": [{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"window1","instance":"1","objectname":"Processor"},"timestamp":1564641723000},{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"window2","instance":"1","objectname":"Processor"},"timestamp":1564641723000}]}' 127.0.0.1:6041/telegraf/db/ print $system_content @@ -273,7 +273,7 @@ if $system_content != @{"metrics":[{"metric":"win_cpu","stable":"win_cpu","table return -1 endi -system_content curl -u root:taosdata -d 'select * from db.win_cpu_window1_1_Processor' 127.0.0.1:6020/rest/sql/ +system_content curl -u root:taosdata -d 'select * from db.win_cpu_window1_1_Processor' 127.0.0.1:6041/rest/sql/ print $system_content @@ -281,7 +281,7 @@ print $system_content # return -1 #endi -system_content curl -u root:taosdata -d 'select count(*) from db.win_cpu' 127.0.0.1:6020/rest/sql/ +system_content curl -u root:taosdata -d 'select count(*) from db.win_cpu' 127.0.0.1:6041/rest/sql/ print $system_content diff --git a/tests/script/general/parser/bug.sim b/tests/script/general/parser/bug.sim index 82f6518d73..f97905d76c 100644 --- a/tests/script/general/parser/bug.sim +++ b/tests/script/general/parser/bug.sim @@ -38,6 +38,6 @@ sql insert into t2 values(1575880055000, 2); sql select st1.ts, st1.f1, st2.f2 from db.st1, db.st2 where st1.t1=st2.t2 and st1.ts=st2.ts -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select st1.ts, st1.f1, st2.f2 from db.st1, db.st2 where st1.t1=st2.t2 and st1.ts=st2.ts' 127.0.0.1:6020/restful/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select st1.ts, st1.f1, st2.f2 from db.st1, db.st2 where st1.t1=st2.t2 and st1.ts=st2.ts' 127.0.0.1:6041/restful/sql system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/unique/http/admin.sim b/tests/script/unique/http/admin.sim index aeead817c1..cca2d096f6 100644 --- a/tests/script/unique/http/admin.sim +++ b/tests/script/unique/http/admin.sim @@ -31,63 +31,63 @@ sql insert into table_admin values('2017-12-25 21:28:50.022', 10) print =============== step1 - login -system_content curl 127.0.0.1:6020/admin/ +system_content curl 127.0.0.1:6041/admin/ print 1-> $system_content if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then return -1 endi -system_content curl 127.0.0.1:6020/admin/xx +system_content curl 127.0.0.1:6041/admin/xx print 2-> $system_content if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then return -1 endi -system_content curl 127.0.0.1:6020/admin/login +system_content curl 127.0.0.1:6041/admin/login print 3-> $system_content if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then return -1 endi -system_content curl 127.0.0.1:6020/admin/login/root +system_content curl 127.0.0.1:6041/admin/login/root print 4-> $system_content if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then return -1 endi -system_content curl 127.0.0.1:6020/admin/login/root/123 +system_content curl 127.0.0.1:6041/admin/login/root/123 print 5-> $system_content if $system_content != @{"status":"error","code":3,"desc":"Authentication failure"}@ then return -1 endi -system_content curl 127.0.0.1:6020/admin/login/root/123/1/1/3 +system_content curl 127.0.0.1:6041/admin/login/root/123/1/1/3 print 6-> $system_content if $system_content != @{"status":"error","code":3,"desc":"Authentication failure"}@ then return -1 endi -system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.' -d 'show databases' 127.0.0.1:6020/admin/login/root/1 +system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.' -d 'show databases' 127.0.0.1:6041/admin/login/root/1 print 7-> $system_content if $system_content != @{"status":"error","code":5010,"desc":"invalid type of Authorization"}@ then return -1 endi -system_content curl -H 'Authorization: Taosd eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' 127.0.0.1:6020/admin/login/root/1 +system_content curl -H 'Authorization: Taosd eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' 127.0.0.1:6041/admin/login/root/1 print 8-> $system_content if $system_content != @{"status":"error","code":5053,"desc":"parse http auth token error"}@ then return -1 endi sleep 3000 -system_content curl 127.0.0.1:6020/admin/login/root/taosdata +system_content curl 127.0.0.1:6041/admin/login/root/taosdata print 9 -----> $system_content if $system_content != {"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"} then return -1 endi -#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:6020/admin/login/root/1 +#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:6041/admin/login/root/1 #print 10-> $system_content #if $system_content != @{"status":"error","code":29,"desc":"failed to connect to server"}@ then # return -1 @@ -95,14 +95,14 @@ endi print =============== step2 - logout -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6020/admin/logout +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6041/admin/logout print 10 -----> $system_content if $system_content != @{"status":"succ","code":0,"desc":"logout success"}@ then return -1 endi -system_content curl 127.0.0.1:6020/admin/logout +system_content curl 127.0.0.1:6041/admin/logout print 11 -----> $system_content if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then @@ -111,69 +111,69 @@ endi print =============== step3 - info -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6020/admin/info -print curl 127.0.0.1:6020/admin/info -----> $system_content +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6041/admin/info +print curl 127.0.0.1:6041/admin/info -----> $system_content if $system_content != {"status":"succ","data":[{"dbs":1,"tables":1,"users":3,"mnodes":1,"dnodes":1}]} then return -1 endi print =============== step4 - meta -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show mnodes' 127.0.0.1:6020/admin/meta -print curl 127.0.0.1:6020/admin/meta -----> $system_content +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show mnodes' 127.0.0.1:6041/admin/meta +print curl 127.0.0.1:6041/admin/meta -----> $system_content #if $system_content != @{"status":"succ","head":["column type","column name","column bytes"],"data":[["binary","IP",16],["timestamp","created time",8],["binary","status",10],["binary","role",10],["binary","public ip",16]],"rows":5}@ then # return -1 #endi print =============== step5 - query data -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' 127.0.0.1:6020/admin/sql -print curl 127.0.0.1:6020/admin/all -----> $system_content +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' 127.0.0.1:6041/admin/sql +print curl 127.0.0.1:6041/admin/all -----> $system_content if $system_content != @{"status":"succ","head":["ts","i"],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10]],"rows":10}@ then return -1 endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' 127.0.0.1:6020/admin/sql -print curl 127.0.0.1:6020/admin/sql -----> $system_content +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' 127.0.0.1:6041/admin/sql +print curl 127.0.0.1:6041/admin/sql -----> $system_content if $system_content != @{"status":"succ","head":["ts","i"],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10]],"rows":10}@ then return -1 endi print =============== step6 - insert data -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.table_admin values('2017-12-25 21:28:51.022', 11)" 127.0.0.1:6020/admin/sql -print curl 127.0.0.1:6020/admin/sql -----> $system_content +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.table_admin values('2017-12-25 21:28:51.022', 11)" 127.0.0.1:6041/admin/sql +print curl 127.0.0.1:6041/admin/sql -----> $system_content if $system_content != @{"status":"succ","head":["affect_rows"],"data":[[1]],"rows":1}@ then return -1 endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' 127.0.0.1:6020/admin/all -print curl 127.0.0.1:6020/admin/all -----> $system_content +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' 127.0.0.1:6041/admin/all +print curl 127.0.0.1:6041/admin/all -----> $system_content if $system_content != @{"status":"succ","head":["ts","i"],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10],["2017-12-25 21:28:51.022",11]],"rows":11}@ then return -1 endi -#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' 127.0.0.1:6020/admin/sql -#print curl 127.0.0.1:6020/admin/sql -----> $system_content +#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' 127.0.0.1:6041/admin/sql +#print curl 127.0.0.1:6041/admin/sql -----> $system_content #if $system_content != @{"status":"succ","head":["ts","i"],"data":[["2017-12-25 21:28:51.022",11],["2017-12-25 21:28:50.022",10],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:42.022",2]],"rows":10}@ then # return -1 #endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6020/admin/info -print curl 127.0.0.1:6020/admin/info -----> $system_content +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6041/admin/info +print curl 127.0.0.1:6041/admin/info -----> $system_content if $system_content != {"status":"succ","data":[{"dbs":1,"tables":1,"users":3,"mnodes":1,"dnodes":1}]} then return -1 endi print =============== step7 - use dbs -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'use d1;' 127.0.0.1:6020/admin/all +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'use d1;' 127.0.0.1:6041/admin/all print 23-> $system_content if $system_content != @{"status":"error","code":5017,"desc":"no need to execute use db cmd"}@ then return -1 endi print =============== step8 - monitor dbs -#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show dnodes;show mnodes;' 127.0.0.1:6020/admin/sqls +#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show dnodes;show mnodes;' 127.0.0.1:6041/admin/sqls #print 24-> $system_content #if $system_content != @[{"status":"succ","head":["IP","created time","open vnodes","free vnodes","status","balance state"],"data":[["127.0.0.1","2018-09-04 #11:16:13.985",1,3,"ready","balanced"]],"rows":1},{"status":"succ","head":["IP","created time","status","role"],"data":[["127.0.0.1","2018-09-04 11:16:13.371","serving","master"]],"rows":1}]@ then # return -1 diff --git a/tests/script/unique/http/opentsdb.sim b/tests/script/unique/http/opentsdb.sim index 4c7803c3da..e14d0de8f2 100644 --- a/tests/script/unique/http/opentsdb.sim +++ b/tests/script/unique/http/opentsdb.sim @@ -11,92 +11,92 @@ sql connect print ============================ dnode1 start print =============== step1 - parse -system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/ +system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/ print $system_content if $system_content != @{"status":"error","code":5057,"desc":"database name can not be null"}@ then return -1 endi -system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db123456789012345678901234567890db +system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db123456789012345678901234567890db print $system_content if $system_content != @{"status":"error","code":5058,"desc":"database name too long"}@ then return -1 endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/ +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/ print $system_content if $system_content != @{"status":"error","code":5057,"desc":"database name can not be null"}@ then return -1 endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put2 +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put2 print $system_content if $system_content != @{"status":"error","code":5009,"desc":"http url parse error"}@ then return -1 endi -system_content curl -u root:taosdata -d '[]' 127.0.0.1:6020/opentsdb/db/put +system_content curl -u root:taosdata -d '[]' 127.0.0.1:6041/opentsdb/db/put print $system_content if $system_content != @{"status":"error","code":5060,"desc":"metrics size is 0"}@ then return -1 endi -system_content curl -u root:taosdata -d '[' 127.0.0.1:6020/opentsdb/db/put +system_content curl -u root:taosdata -d '[' 127.0.0.1:6041/opentsdb/db/put print $system_content if $system_content != @{"status":"error","code":5059,"desc":"invalid opentsdb json fromat"}@ then return -1 endi -system_content curl -u root:taosdata -d '{}' 127.0.0.1:6020/opentsdb/db/put +system_content curl -u root:taosdata -d '{}' 127.0.0.1:6041/opentsdb/db/put print $system_content if $system_content != @{"status":"error","code":5060,"desc":"metrics size is 0"}@ then return -1 endi -system_content curl -u root:taosdata -d '[{}]' 127.0.0.1:6020/opentsdb/db/put +system_content curl -u root:taosdata -d '[{}]' 127.0.0.1:6041/opentsdb/db/put print $system_content if $system_content != @{"status":"error","code":5062,"desc":"metric name not find"}@ then return -1 endi -system_content curl -u root:taosdata -d '[{"metric": 1,"timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put +system_content curl -u root:taosdata -d '[{"metric": 1,"timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put print $system_content if $system_content != @{"status":"error","code":5063,"desc":"metric name type should be string"}@ then return -1 endi -system_content curl -u root:taosdata -d '[{"metric": "","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put +system_content curl -u root:taosdata -d '[{"metric": "","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put print $system_content if $system_content != @{"status":"error","code":5064,"desc":"metric name length is 0"}@ then return -1 endi -system_content curl -u root:taosdata -d '[{"metric": "ab1234567890123456789012345678ab1234567890123456789012345678","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put +system_content curl -u root:taosdata -d '[{"metric": "ab1234567890123456789012345678ab1234567890123456789012345678","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put print $system_content if $system_content != @{"errors":[{"datapoint":{"metric":"ab1234567890123456789012345678ab1234567890123456789012345678","stable":"ab1234567890123456789012345678ab1234567890123456789012345678_d_bbb","table":"ab1234567890123456789012345678ab1234567890123456789012345678_d_bbb_lga_1_web01","timestamp":1346846400,"value":18.000000,"tags":{"dc":"lga","group1":"1","host":"web01"},"status":"error","code":1547,"desc":"Timestamp data out of range"}}],"failed":1,"success":0,"affected_rows":0}@ then return -1 endi -system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put +system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put print $system_content if $system_content != @{"status":"error","code":5066,"desc":"timestamp not find"}@ then return -1 endi -system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": "2","value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put +system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": "2","value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put print $system_content if $system_content != @{"status":"error","code":5067,"desc":"timestamp type should be integer"}@ then return -1 endi -system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": -1,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put +system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": -1,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put print $system_content if $system_content != @{"status":"error","code":5068,"desc":"timestamp value smaller than 0"}@ then return -1 endi -system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put +system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put print $system_content if $system_content != @{"status":"error","code":5078,"desc":"value not find"}@ then return -1 @@ -104,49 +104,49 @@ endi ####### -system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18}]' 127.0.0.1:6020/opentsdb/db/put +system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18}]' 127.0.0.1:6041/opentsdb/db/put print $system_content if $system_content != @{"status":"error","code":5069,"desc":"tags not find"}@ then return -1 endi -system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {}}]' 127.0.0.1:6020/opentsdb/db/put +system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {}}]' 127.0.0.1:6041/opentsdb/db/put print $system_content if $system_content != @{"status":"error","code":5070,"desc":"tags size is 0"}@ then return -1 endi -system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": 0}]' 127.0.0.1:6020/opentsdb/db/put +system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": 0}]' 127.0.0.1:6041/opentsdb/db/put print $system_content if $system_content != @{"status":"error","code":5070,"desc":"tags size is 0"}@ then return -1 endi -system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","group1": "1","group1": "1","group1": "1","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put +system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","group1": "1","group1": "1","group1": "1","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put print $system_content if $system_content != @{"errors":[{"datapoint":{"metric":"sys_cpu","stable":"sys_cpu_d_bbbbbbb","table":"sys_cpu_d_bbbbbbb_lga_1_1_1_1_1_web01","timestamp":1346846400,"value":18.000000,"tags":{"dc":"lga","group1":"1","group1":"1","group1":"1","group1":"1","group1":"1","host":"web01"},"status":"error","code":866,"desc":"failed to create table"}}],"failed":1,"success":0,"affected_rows":0}@ then return -1 endi -system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"": "web01"}}]' 127.0.0.1:6020/opentsdb/db/put +system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"": "web01"}}]' 127.0.0.1:6041/opentsdb/db/put print $system_content if $system_content != @{"status":"error","code":5073,"desc":"tag name is null"}@ then return -1 endi -system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host01123456789001123456789001123456789001123456789001123456789001123456789": "01"}}]' 127.0.0.1:6020/opentsdb/db/put +system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host01123456789001123456789001123456789001123456789001123456789001123456789": "01"}}]' 127.0.0.1:6041/opentsdb/db/put print $system_content if $system_content != @{"status":"error","code":5074,"desc":"tag name length too long"}@ then return -1 endi -system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web011234567890011234567890011234567890011234567890011234567890011234567890011234567890011234567890"}}]' 127.0.0.1:6020/opentsdb/db/put +system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web011234567890011234567890011234567890011234567890011234567890011234567890011234567890011234567890"}}]' 127.0.0.1:6041/opentsdb/db/put print $system_content if $system_content != @{"status":"error","code":5077,"desc":"tag value can not more than 64"}@ then return -1 endi -system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": ""}}]' 127.0.0.1:6020/opentsdb/db/put +system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": ""}}]' 127.0.0.1:6041/opentsdb/db/put print $system_content if $system_content != @{"status":"error","code":5076,"desc":"tag value is null"}@ then return -1 @@ -155,26 +155,26 @@ endi sleep 3000 print =============== step2 - insert single data -system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400000,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put +system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400000,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put print $system_content if $system_content != @{"errors":[{"datapoint":{"metric":"sys_cpu","stable":"sys_cpu_d_bbb","table":"sys_cpu_d_bbb_lga_1_web01","timestamp":1346846400000,"value":18.000000,"tags":{"dc":"lga","group1":"1","host":"web01"},"affected_rows":1,"status":"succ"}}],"failed":0,"success":1,"affected_rows":1}@ then return -1 endi -system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400000,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put +system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400000,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put print $system_content if $system_content != @{"errors":[{"datapoint":{"metric":"sys_cpu","stable":"sys_cpu_d_bbb","table":"sys_cpu_d_bbb_lga_1_web01","timestamp":1346846400000,"value":18.000000,"tags":{"dc":"lga","group1":"1","host":"web01"},"affected_rows":1,"status":"succ"}}],"failed":0,"success":1,"affected_rows":1}@ then return -1 endi -system_content curl -u root:taosdata -d 'select * from db.sys_cpu_d_bbb_lga_1_web01' 127.0.0.1:6020/rest/sql/ +system_content curl -u root:taosdata -d 'select * from db.sys_cpu_d_bbb_lga_1_web01' 127.0.0.1:6041/rest/sql/ print $system_content if $system_content != @{"status":"succ","head":["ts","value"],"data":[["2012-09-05 20:00:00.000",18.000000000]],"rows":1}@ then return -1 endi print =============== step3 - multi-query data -system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846405000,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846402000,"value": 18,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put +system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846405000,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846402000,"value": 18,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put print $system_content @@ -182,7 +182,7 @@ if $system_content != @{"errors":[{"datapoint":{"metric":"sys_cpu","stable":"sys return -1 endi -system_content curl -u root:taosdata -d 'select * from db.sys_cpu_d_bbb_lga_1_web01' 127.0.0.1:6020/rest/sql/ +system_content curl -u root:taosdata -d 'select * from db.sys_cpu_d_bbb_lga_1_web01' 127.0.0.1:6041/rest/sql/ print $system_content @@ -190,7 +190,7 @@ if $system_content != @{"status":"succ","head":["ts","value"],"data":[["2012-09- return -1 endi -system_content curl -u root:taosdata -d 'select count(*) from db.sys_cpu_d_bbb' 127.0.0.1:6020/rest/sql/ +system_content curl -u root:taosdata -d 'select count(*) from db.sys_cpu_d_bbb' 127.0.0.1:6041/rest/sql/ print $system_content @@ -199,7 +199,7 @@ if $system_content != @{"status":"succ","head":["count(*)"],"data":[[3]],"rows": endi print =============== step4 - summary-put data -system_content curl -u root:taosdata -d '[{"metric": "sys_mem","timestamp": 1346846400000,"value": 8,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_mem","timestamp": 1346846405000,"value": 9,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put?details=false +system_content curl -u root:taosdata -d '[{"metric": "sys_mem","timestamp": 1346846400000,"value": 8,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_mem","timestamp": 1346846405000,"value": 9,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put?details=false print $system_content @@ -207,7 +207,7 @@ if $system_content != @{"failed":0,"success":2}@ then return -1 endi -system_content curl -u root:taosdata -d 'select * from db.sys_mem_d_bbb_lga_1_web01' 127.0.0.1:6020/rest/sql/ +system_content curl -u root:taosdata -d 'select * from db.sys_mem_d_bbb_lga_1_web01' 127.0.0.1:6041/rest/sql/ print $system_content @@ -215,7 +215,7 @@ if $system_content != @{"status":"succ","head":["ts","value"],"data":[["2012-09- return -1 endi -system_content curl -u root:taosdata -d 'select count(*) from db.sys_mem_d_bbb' 127.0.0.1:6020/rest/sql/ +system_content curl -u root:taosdata -d 'select count(*) from db.sys_mem_d_bbb' 127.0.0.1:6041/rest/sql/ print $system_content @@ -225,13 +225,13 @@ endi print =============== step5 - prepare data -system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846402000,"value": 19,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846402,"value": 19,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put -system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846403000,"value": 20,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846403,"value": 20,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put -system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846404000,"value": 21,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846404,"value": 21,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put -system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846405000,"value": 22,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846405,"value": 22,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put -system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846406000,"value": 23,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846406,"value": 23,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put +system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846402000,"value": 19,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846402,"value": 19,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put +system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846403000,"value": 20,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846403,"value": 20,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put +system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846404000,"value": 21,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846404,"value": 21,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put +system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846405000,"value": 22,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846405,"value": 22,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put +system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846406000,"value": 23,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846406,"value": 23,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put -system_content curl -u root:taosdata -d 'select count(*) from db.sys_cpu_d_bbb' 127.0.0.1:6020/rest/sql/ +system_content curl -u root:taosdata -d 'select count(*) from db.sys_cpu_d_bbb' 127.0.0.1:6041/rest/sql/ print $system_content if $system_content != @{"status":"succ","head":["count(*)"],"data":[[7]],"rows":1}@ then return -1 diff --git a/tests/tsim/src/simExe.c b/tests/tsim/src/simExe.c index fdec38b4c7..1078b32981 100644 --- a/tests/tsim/src/simExe.c +++ b/tests/tsim/src/simExe.c @@ -590,7 +590,7 @@ int simExecuteRestFulCommand(SScript *script, char *command) { bool simCreateRestFulConnect(SScript *script, char *user, char *pass) { char command[4096]; - sprintf(command, "curl 127.0.0.1:6020/rest/login/%s/%s", user, pass); + sprintf(command, "curl 127.0.0.1:6041/rest/login/%s/%s", user, pass); bool success = false; for (int attempt = 0; attempt < 10; ++attempt) { @@ -815,7 +815,7 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) { bool simExecuteRestFulSqlCommand(SScript *script, char *rest) { SCmdLine *line = &script->lines[script->linePos]; char command[4096]; - sprintf(command, "curl -H 'Authorization: Taosd %s' -d \"%s\" 127.0.0.1:6020/rest/sql", script->auth, rest); + sprintf(command, "curl -H 'Authorization: Taosd %s' -d \"%s\" 127.0.0.1:6041/rest/sql", script->auth, rest); int ret = -1; for (int attempt = 0; attempt < 10; ++attempt) { @@ -947,7 +947,7 @@ bool simExecuteSqlErrorCmd(SScript *script, char *rest) { TAOS_RES* pSql = NULL; if (simAsyncQuery) { char command[4096]; - sprintf(command, "curl -H 'Authorization: Taosd %s' -d '%s' 127.0.0.1:6020/rest/sql", script->auth, rest); + sprintf(command, "curl -H 'Authorization: Taosd %s' -d '%s' 127.0.0.1:6041/rest/sql", script->auth, rest); ret = simExecuteRestFulCommand(script, command); } else {