Merge branch 'develop' into feature/2.0tsdb
This commit is contained in:
commit
131be7b0da
231
.travis.yml
231
.travis.yml
|
@ -316,218 +316,19 @@ matrix:
|
||||||
fi
|
fi
|
||||||
- make > /dev/null
|
- make > /dev/null
|
||||||
|
|
||||||
- os: linux
|
# - os: osx
|
||||||
arch: arm64
|
# language: c
|
||||||
dist: bionic
|
# compiler: clang
|
||||||
language: c
|
# env: DESC="mac/clang build"
|
||||||
compiler: gcc
|
# git:
|
||||||
env: ENV_COVER=true
|
# - depth: 1
|
||||||
|
# addons:
|
||||||
git:
|
# homebrew:
|
||||||
- depth: 1
|
# - cmake
|
||||||
|
#
|
||||||
addons:
|
# script:
|
||||||
apt:
|
# - cd ${TRAVIS_BUILD_DIR}
|
||||||
packages:
|
# - mkdir debug
|
||||||
- build-essential
|
# - cd debug
|
||||||
- cmake
|
# - cmake .. > /dev/null
|
||||||
- net-tools
|
# - make > /dev/null
|
||||||
- python-pip
|
|
||||||
- python-setuptools
|
|
||||||
- python3-pip
|
|
||||||
- python3-setuptools
|
|
||||||
- lcov
|
|
||||||
- psmisc
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
- cd ${TRAVIS_BUILD_DIR}
|
|
||||||
- mkdir debug
|
|
||||||
- cd debug
|
|
||||||
|
|
||||||
script:
|
|
||||||
- if [ "${TRAVIS_CPU_ARCH}" == "arm64" ];
|
|
||||||
then cmake -DCOVER=true .. -DCPUTYPE=aarch64 > /dev/null;
|
|
||||||
else cmake -DCOVER=true .. > /dev/null;
|
|
||||||
fi
|
|
||||||
- make > /dev/null
|
|
||||||
|
|
||||||
after_success:
|
|
||||||
- |-
|
|
||||||
case $TRAVIS_OS_NAME in
|
|
||||||
linux)
|
|
||||||
cd ${TRAVIS_BUILD_DIR}/debug
|
|
||||||
make install > /dev/null || travis_terminate $?
|
|
||||||
pip install numpy
|
|
||||||
pip install --user ${TRAVIS_BUILD_DIR}/src/connector/python/linux/python2/
|
|
||||||
pip3 install numpy
|
|
||||||
pip3 install --user ${TRAVIS_BUILD_DIR}/src/connector/python/linux/python3/
|
|
||||||
cd ${TRAVIS_BUILD_DIR}/tests
|
|
||||||
./test-all.sh smoke COVER
|
|
||||||
TEST_RESULT=$?
|
|
||||||
pkill taosd
|
|
||||||
sleep 1
|
|
||||||
cd ${TRAVIS_BUILD_DIR}
|
|
||||||
lcov -d . --capture --rc lcov_branch_coverage=1 -o coverage.info
|
|
||||||
lcov --remove coverage.info '*/tests/*' '*/test/*' '*/deps/*' '*/plugins/*' -o coverage.info
|
|
||||||
lcov -l --rc lcov_branch_coverage=1 coverage.info || travis_terminate $?
|
|
||||||
gem install coveralls-lcov
|
|
||||||
# Color setting
|
|
||||||
RED='\033[0;31m'
|
|
||||||
GREEN='\033[1;32m'
|
|
||||||
GREEN_DARK='\033[0;32m'
|
|
||||||
GREEN_UNDERLINE='\033[4;32m'
|
|
||||||
NC='\033[0m'
|
|
||||||
coveralls-lcov coverage.info
|
|
||||||
if [ "$?" -eq "0" ]; then
|
|
||||||
echo -e "${GREEN} ## Uploaded to Coveralls.io! ## ${NC}"
|
|
||||||
else
|
|
||||||
echo -e "${RED} ## Coveralls.io not collect coverage report! ## ${NC} "
|
|
||||||
fi
|
|
||||||
bash <(curl -s https://codecov.io/bash) -y .codecov.yml -f coverage.info
|
|
||||||
if [ "$?" -eq "0" ]; then
|
|
||||||
echo -e "${GREEN} ## Uploaded to Codecov! ## ${NC} "
|
|
||||||
else
|
|
||||||
echo -e "${RED} ## Codecov did not collect coverage report! ## ${NC} "
|
|
||||||
fi
|
|
||||||
if [ "$TEST_RESULT" -ne "0" ]; then
|
|
||||||
travis_terminate $?
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
arch: arm64
|
|
||||||
dist: bionic
|
|
||||||
language: c
|
|
||||||
|
|
||||||
git:
|
|
||||||
- depth: 1
|
|
||||||
|
|
||||||
compiler: gcc
|
|
||||||
env: DESC="linux/gcc build and test"
|
|
||||||
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- build-essential
|
|
||||||
- cmake
|
|
||||||
- net-tools
|
|
||||||
- python-pip
|
|
||||||
- python-setuptools
|
|
||||||
- python3-pip
|
|
||||||
- python3-setuptools
|
|
||||||
- valgrind
|
|
||||||
- psmisc
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
- cd ${TRAVIS_BUILD_DIR}
|
|
||||||
- mkdir debug
|
|
||||||
- cd debug
|
|
||||||
|
|
||||||
script:
|
|
||||||
- if [ "${TRAVIS_CPU_ARCH}" == "arm64" ];
|
|
||||||
then cmake .. -DCPUTYPE=aarch64 > /dev/null;
|
|
||||||
else cmake .. > /dev/null;
|
|
||||||
fi
|
|
||||||
- make > /dev/null
|
|
||||||
|
|
||||||
after_success:
|
|
||||||
- travis_wait 20
|
|
||||||
- |-
|
|
||||||
case $TRAVIS_OS_NAME in
|
|
||||||
linux)
|
|
||||||
cd ${TRAVIS_BUILD_DIR}/debug
|
|
||||||
make install > /dev/null || travis_terminate $?
|
|
||||||
pip install numpy
|
|
||||||
pip install --user ${TRAVIS_BUILD_DIR}/src/connector/python/linux/python2/
|
|
||||||
pip3 install numpy
|
|
||||||
pip3 install --user ${TRAVIS_BUILD_DIR}/src/connector/python/linux/python3/
|
|
||||||
cd ${TRAVIS_BUILD_DIR}/tests
|
|
||||||
./test-all.sh smoke || travis_terminate $?
|
|
||||||
cd ${TRAVIS_BUILD_DIR}/tests/pytest
|
|
||||||
./valgrind-test.sh 2>&1 > mem-error-out.log
|
|
||||||
sleep 1
|
|
||||||
# Color setting
|
|
||||||
RED='\033[0;31m'
|
|
||||||
GREEN='\033[1;32m'
|
|
||||||
GREEN_DARK='\033[0;32m'
|
|
||||||
GREEN_UNDERLINE='\033[4;32m'
|
|
||||||
NC='\033[0m'
|
|
||||||
grep 'start to execute\|ERROR SUMMARY' mem-error-out.log|grep -v 'grep'|uniq|tee uniq-mem-error-out.log
|
|
||||||
for memError in `grep 'ERROR SUMMARY' uniq-mem-error-out.log | awk '{print $4}'`
|
|
||||||
do
|
|
||||||
if [ -n "$memError" ]; then
|
|
||||||
if [ "$memError" -gt 12 ]; then
|
|
||||||
echo -e "${RED} ## Memory errors number valgrind reports is $memError.\
|
|
||||||
More than our threshold! ## ${NC}"
|
|
||||||
travis_terminate $memError
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
grep 'start to execute\|definitely lost:' mem-error-out.log|grep -v 'grep'|uniq|tee uniq-definitely-lost-out.log
|
|
||||||
for defiMemError in `grep 'definitely lost:' uniq-definitely-lost-out.log | awk '{print $7}'`
|
|
||||||
do
|
|
||||||
if [ -n "$defiMemError" ]; then
|
|
||||||
if [ "$defiMemError" -gt 13 ]; then
|
|
||||||
echo -e "${RED} ## Memory errors number valgrind reports \
|
|
||||||
Definitely lost is $defiMemError. More than our threshold! ## ${NC}"
|
|
||||||
travis_terminate $defiMemError
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
arch: arm64
|
|
||||||
dist: bionic
|
|
||||||
language: c
|
|
||||||
compiler: gcc
|
|
||||||
env: COVERITY_SCAN=true
|
|
||||||
git:
|
|
||||||
- depth: 1
|
|
||||||
|
|
||||||
script:
|
|
||||||
- echo "this job is for coverity scan"
|
|
||||||
|
|
||||||
addons:
|
|
||||||
coverity_scan:
|
|
||||||
# GitHub project metadata
|
|
||||||
# ** specific to your project **
|
|
||||||
project:
|
|
||||||
name: TDengine
|
|
||||||
version: 2.x
|
|
||||||
description: TDengine
|
|
||||||
|
|
||||||
# Where email notification of build analysis results will be sent
|
|
||||||
notification_email: sdsang@taosdata.com, slguan@taosdata.com
|
|
||||||
|
|
||||||
# Commands to prepare for build_command
|
|
||||||
# ** likely specific to your build **
|
|
||||||
build_command_prepend: cmake . > /dev/null
|
|
||||||
|
|
||||||
# The command that will be added as an argument to "cov-build" to compile your project for analysis,
|
|
||||||
# ** likely specific to your build **
|
|
||||||
build_command: make
|
|
||||||
|
|
||||||
# Pattern to match selecting branches that will run analysis. We recommend leaving this set to 'coverity_scan'.
|
|
||||||
# Take care in resource usage, and consider the build frequency allowances per
|
|
||||||
# https://scan.coverity.com/faq#frequency
|
|
||||||
branch_pattern: coverity_scan
|
|
||||||
|
|
||||||
# - os: osx
|
|
||||||
# language: c
|
|
||||||
# compiler: clang
|
|
||||||
# env: DESC="mac/clang build"
|
|
||||||
# git:
|
|
||||||
# - depth: 1
|
|
||||||
# addons:
|
|
||||||
# homebrew:
|
|
||||||
# - cmake
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
# - cd ${TRAVIS_BUILD_DIR}
|
|
||||||
# - mkdir debug
|
|
||||||
# - cd debug
|
|
||||||
# - cmake .. > /dev/null
|
|
||||||
# - make > /dev/null
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ STable从属于库,一个STable只属于一个库,但一个库可以有一
|
||||||
|
|
||||||
说明:
|
说明:
|
||||||
|
|
||||||
1. TAGS列总长度不能超过64k bytes;
|
1. TAGS列总长度不能超过16k bytes;
|
||||||
2. TAGS列的数据类型不能是timestamp;
|
2. TAGS列的数据类型不能是timestamp;
|
||||||
3. TAGS列名不能与其他列名相同;
|
3. TAGS列名不能与其他列名相同;
|
||||||
4. TAGS列名不能为预留关键字.
|
4. TAGS列名不能为预留关键字.
|
||||||
|
|
|
@ -22,7 +22,7 @@ New keyword "tags" is introduced, where tag_name is the tag name, and tag_type i
|
||||||
|
|
||||||
Note:
|
Note:
|
||||||
|
|
||||||
1. The bytes of all tags together shall be less than 64k
|
1. The bytes of all tags together shall be less than 16k
|
||||||
2. Tag's data type can not be time stamp
|
2. Tag's data type can not be time stamp
|
||||||
3. Tag name shall be different from the field name
|
3. Tag name shall be different from the field name
|
||||||
4. Tag name shall not be the same as system keywords
|
4. Tag name shall not be the same as system keywords
|
||||||
|
|
|
@ -63,7 +63,7 @@ TDengine缺省的时间戳是毫秒精度,但通过修改配置参数enableMic
|
||||||
| 3 | BIGINT | 8 | 长整型,范围 [-2^63+1, 2^63-1], -2^63用于NULL |
|
| 3 | BIGINT | 8 | 长整型,范围 [-2^63+1, 2^63-1], -2^63用于NULL |
|
||||||
| 4 | FLOAT | 4 | 浮点型,有效位数6-7,范围 [-3.4E38, 3.4E38] |
|
| 4 | FLOAT | 4 | 浮点型,有效位数6-7,范围 [-3.4E38, 3.4E38] |
|
||||||
| 5 | DOUBLE | 8 | 双精度浮点型,有效位数15-16,范围 [-1.7E308, 1.7E308] |
|
| 5 | DOUBLE | 8 | 双精度浮点型,有效位数15-16,范围 [-1.7E308, 1.7E308] |
|
||||||
| 6 | BINARY | 自定义 | 用于记录字符串,理论上,最长可以有65526字节,但由于每行数据最多64K字节,实际上限一般小于理论值。 binary仅支持字符串输入,字符串两端使用单引号引用,否则英文全部自动转化为小写。使用时须指定大小,如binary(20)定义了最长为20个字符的字符串,每个字符占1byte的存储空间。如果用户字符串超出20字节将会报错。对于字符串内的单引号,可以用转义字符反斜线加单引号来表示, 即 **\’**。 |
|
| 6 | BINARY | 自定义 | 用于记录字符串,理论上,最长可以有16374字节,但由于每行数据最多16K字节,实际上限一般小于理论值。 binary仅支持字符串输入,字符串两端使用单引号引用,否则英文全部自动转化为小写。使用时须指定大小,如binary(20)定义了最长为20个字符的字符串,每个字符占1byte的存储空间。如果用户字符串超出20字节将会报错。对于字符串内的单引号,可以用转义字符反斜线加单引号来表示, 即 **\’**。 |
|
||||||
| 7 | SMALLINT | 2 | 短整型, 范围 [-32767, 32767], -32768用于NULL |
|
| 7 | SMALLINT | 2 | 短整型, 范围 [-32767, 32767], -32768用于NULL |
|
||||||
| 8 | TINYINT | 1 | 单字节整型,范围 [-127, 127], -128用于NULL |
|
| 8 | TINYINT | 1 | 单字节整型,范围 [-127, 127], -128用于NULL |
|
||||||
| 9 | BOOL | 1 | 布尔型,{true, false} |
|
| 9 | BOOL | 1 | 布尔型,{true, false} |
|
||||||
|
@ -106,7 +106,7 @@ TDengine缺省的时间戳是毫秒精度,但通过修改配置参数enableMic
|
||||||
```mysql
|
```mysql
|
||||||
CREATE TABLE [IF NOT EXISTS] tb_name (timestamp_field_name TIMESTAMP, field1_name data_type1 [, field2_name data_type2 ...])
|
CREATE TABLE [IF NOT EXISTS] tb_name (timestamp_field_name TIMESTAMP, field1_name data_type1 [, field2_name data_type2 ...])
|
||||||
```
|
```
|
||||||
说明:1)表的第一个字段必须是TIMESTAMP,并且系统自动将其设为主键;2)表的每行长度不能超过64K字节;3)使用数据类型binary或nchar,需指定其最长的字节数,如binary(20),表示20字节。
|
说明:1)表的第一个字段必须是TIMESTAMP,并且系统自动将其设为主键;2)表的每行长度不能超过16K字节;3)使用数据类型binary或nchar,需指定其最长的字节数,如binary(20),表示20字节。
|
||||||
|
|
||||||
|
|
||||||
- **删除数据表**
|
- **删除数据表**
|
||||||
|
|
|
@ -39,7 +39,7 @@ The full list of data types is listed below. For string types of data, we will
|
||||||
| 6 | DOUBLE | 8 | A standard nullable double float type with 15-16 significant digits and a range of [-1.7E308, 1.7E308] |
|
| 6 | DOUBLE | 8 | A standard nullable double float type with 15-16 significant digits and a range of [-1.7E308, 1.7E308] |
|
||||||
| 7 | BOOL | 1 | A nullable boolean type, [**`true`**, **`false`**] |
|
| 7 | BOOL | 1 | A nullable boolean type, [**`true`**, **`false`**] |
|
||||||
| 8 | TIMESTAMP | 8 | A nullable timestamp type with the same usage as the primary column timestamp |
|
| 8 | TIMESTAMP | 8 | A nullable timestamp type with the same usage as the primary column timestamp |
|
||||||
| 9 | BINARY(*M*) | *M* | A nullable string type whose length is *M*, error should be threw with exceeded chars, the maximum length of *M* is 65526, but as maximum row size is 64K bytes, the actual upper limit will generally less than 65526. This type of string only supports ASCii encoded chars. |
|
| 9 | BINARY(*M*) | *M* | A nullable string type whose length is *M*, error should be threw with exceeded chars, the maximum length of *M* is 16374, but as maximum row size is 16K bytes, the actual upper limit will generally less than 16374. This type of string only supports ASCii encoded chars. |
|
||||||
| 10 | NCHAR(*M*) | 4 * *M* | A nullable string type whose length is *M*, error should be threw with exceeded chars. The **`NCHAR`** type supports Unicode encoded chars. |
|
| 10 | NCHAR(*M*) | 4 * *M* | A nullable string type whose length is *M*, error should be threw with exceeded chars. The **`NCHAR`** type supports Unicode encoded chars. |
|
||||||
|
|
||||||
All the keywords in a SQL statement are case-insensitive, but strings values are case-sensitive and must be quoted by a pair of `'` or `"`. To quote a `'` or a `"` , you can use the escape character `\`.
|
All the keywords in a SQL statement are case-insensitive, but strings values are case-sensitive and must be quoted by a pair of `'` or `"`. To quote a `'` or a `"` , you can use the escape character `\`.
|
||||||
|
@ -86,7 +86,7 @@ All the keywords in a SQL statement are case-insensitive, but strings values are
|
||||||
|
|
||||||
1) The first column must be a `timestamp`, and the system will set it as the primary key.
|
1) The first column must be a `timestamp`, and the system will set it as the primary key.
|
||||||
|
|
||||||
2) The record size is limited to 64k bytes
|
2) The record size is limited to 16k bytes
|
||||||
|
|
||||||
3) For `binary` or `nchar` data types, the length must be specified. For example, binary(20) means a binary data type with 20 bytes.
|
3) For `binary` or `nchar` data types, the length must be specified. For example, binary(20) means a binary data type with 20 bytes.
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TDENGINE_TSCSECONARYMERGE_H
|
#ifndef TDENGINE_TSCLOCALMERGE_H
|
||||||
#define TDENGINE_TSCSECONARYMERGE_H
|
#define TDENGINE_TSCLOCALMERGE_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -28,13 +28,6 @@ extern "C" {
|
||||||
|
|
||||||
#define MAX_NUM_OF_SUBQUERY_RETRY 3
|
#define MAX_NUM_OF_SUBQUERY_RETRY 3
|
||||||
|
|
||||||
/*
|
|
||||||
* @version 0.1
|
|
||||||
* @date 2018/01/05
|
|
||||||
* @author liaohj
|
|
||||||
* management of client-side reducer for metric query
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct SQLFunctionCtx;
|
struct SQLFunctionCtx;
|
||||||
|
|
||||||
typedef struct SLocalDataSource {
|
typedef struct SLocalDataSource {
|
||||||
|
@ -60,7 +53,6 @@ typedef struct SLocalReducer {
|
||||||
char * prevRowOfInput;
|
char * prevRowOfInput;
|
||||||
tFilePage * pResultBuf;
|
tFilePage * pResultBuf;
|
||||||
int32_t nResultBufSize;
|
int32_t nResultBufSize;
|
||||||
// char * pBufForInterpo; // intermediate buffer for interpolation
|
|
||||||
tFilePage * pTempBuffer;
|
tFilePage * pTempBuffer;
|
||||||
struct SQLFunctionCtx *pCtx;
|
struct SQLFunctionCtx *pCtx;
|
||||||
int32_t rowSize; // size of each intermediate result.
|
int32_t rowSize; // size of each intermediate result.
|
||||||
|
@ -81,13 +73,8 @@ typedef struct SLocalReducer {
|
||||||
} SLocalReducer;
|
} SLocalReducer;
|
||||||
|
|
||||||
typedef struct SSubqueryState {
|
typedef struct SSubqueryState {
|
||||||
/*
|
int32_t numOfRemain; // the number of remain unfinished subquery
|
||||||
* the number of completed retrieval subquery, once this value equals to numOfVnodes,
|
int32_t numOfTotal; // the number of total sub-queries
|
||||||
* all retrieval are completed.Local merge is launched.
|
|
||||||
*/
|
|
||||||
int32_t numOfCompleted;
|
|
||||||
int32_t numOfTotal; // number of total sub-queries
|
|
||||||
int32_t code; // code from subqueries
|
|
||||||
uint64_t numOfRetrievedRows; // total number of points in this query
|
uint64_t numOfRetrievedRows; // total number of points in this query
|
||||||
} SSubqueryState;
|
} SSubqueryState;
|
||||||
|
|
||||||
|
@ -128,4 +115,4 @@ int32_t tscDoLocalMerge(SSqlObj *pSql);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // TDENGINE_TSCSECONARYMERGE_H
|
#endif // TDENGINE_TSCLOCALMERGE_H
|
||||||
|
|
|
@ -26,11 +26,9 @@ extern "C" {
|
||||||
void tscFetchDatablockFromSubquery(SSqlObj* pSql);
|
void tscFetchDatablockFromSubquery(SSqlObj* pSql);
|
||||||
|
|
||||||
void tscSetupOutputColumnIndex(SSqlObj* pSql);
|
void tscSetupOutputColumnIndex(SSqlObj* pSql);
|
||||||
int32_t tscLaunchSecondPhaseSubqueries(SSqlObj* pSql);
|
|
||||||
void tscJoinQueryCallback(void* param, TAOS_RES* tres, int code);
|
void tscJoinQueryCallback(void* param, TAOS_RES* tres, int code);
|
||||||
|
|
||||||
SJoinSupporter* tscCreateJoinSupporter(SSqlObj* pSql, SSubqueryState* pState, int32_t index);
|
SJoinSupporter* tscCreateJoinSupporter(SSqlObj* pSql, SSubqueryState* pState, int32_t index);
|
||||||
void tscDestroyJoinSupporter(SJoinSupporter* pSupporter);
|
|
||||||
|
|
||||||
int32_t tscHandleMasterJoinQuery(SSqlObj* pSql);
|
int32_t tscHandleMasterJoinQuery(SSqlObj* pSql);
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,8 @@ typedef struct SJoinSupporter {
|
||||||
SSubqueryState* pState;
|
SSubqueryState* pState;
|
||||||
SSqlObj* pObj; // parent SqlObj
|
SSqlObj* pObj; // parent SqlObj
|
||||||
int32_t subqueryIndex; // index of sub query
|
int32_t subqueryIndex; // index of sub query
|
||||||
int64_t interval; // interval time
|
int64_t intervalTime; // interval time
|
||||||
|
int64_t slidingTime; // sliding time
|
||||||
SLimitVal limit; // limit info
|
SLimitVal limit; // limit info
|
||||||
uint64_t uid; // query meter uid
|
uint64_t uid; // query meter uid
|
||||||
SArray* colList; // previous query information, no need to use this attribute, and the corresponding attribution
|
SArray* colList; // previous query information, no need to use this attribute, and the corresponding attribution
|
||||||
|
|
|
@ -192,7 +192,7 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setOptions(JNIEnv
|
||||||
const char *tz1 = (*env)->GetStringUTFChars(env, optionValue, NULL);
|
const char *tz1 = (*env)->GetStringUTFChars(env, optionValue, NULL);
|
||||||
if (tz1 && strlen(tz1) != 0) {
|
if (tz1 && strlen(tz1) != 0) {
|
||||||
res = taos_options(TSDB_OPTION_TIMEZONE, tz1);
|
res = taos_options(TSDB_OPTION_TIMEZONE, tz1);
|
||||||
jniTrace("set timezone to %s, result:%d", timezone, res);
|
jniTrace("set timezone to %s, result:%d", tz1, res);
|
||||||
} else {
|
} else {
|
||||||
jniTrace("input timezone is empty");
|
jniTrace("input timezone is empty");
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,6 @@ int32_t tscGetNumOfTags(const STableMeta* pTableMeta) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pTableMeta->tableType == TSDB_SUPER_TABLE || pTableMeta->tableType == TSDB_CHILD_TABLE) {
|
if (pTableMeta->tableType == TSDB_SUPER_TABLE || pTableMeta->tableType == TSDB_CHILD_TABLE) {
|
||||||
assert(tinfo.numOfTags >= 0);
|
|
||||||
return tinfo.numOfTags;
|
return tinfo.numOfTags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -646,10 +646,6 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
||||||
|
|
||||||
size_t numOfOutput = tscSqlExprNumOfExprs(pQueryInfo);
|
size_t numOfOutput = tscSqlExprNumOfExprs(pQueryInfo);
|
||||||
pQueryMsg->numOfOutput = htons(numOfOutput);
|
pQueryMsg->numOfOutput = htons(numOfOutput);
|
||||||
if (numOfOutput < 0) {
|
|
||||||
tscError("%p illegal value of number of output columns in query msg: %d", pSql, numOfOutput);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// set column list ids
|
// set column list ids
|
||||||
size_t numOfCols = taosArrayGetSize(pQueryInfo->colList);
|
size_t numOfCols = taosArrayGetSize(pQueryInfo->colList);
|
||||||
|
@ -663,7 +659,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
||||||
if (pCol->colIndex.columnIndex >= tscGetNumOfColumns(pTableMeta) || pColSchema->type < TSDB_DATA_TYPE_BOOL ||
|
if (pCol->colIndex.columnIndex >= tscGetNumOfColumns(pTableMeta) || pColSchema->type < TSDB_DATA_TYPE_BOOL ||
|
||||||
pColSchema->type > TSDB_DATA_TYPE_NCHAR) {
|
pColSchema->type > TSDB_DATA_TYPE_NCHAR) {
|
||||||
tscError("%p sid:%d uid:%" PRIu64" id:%s, column index out of range, numOfColumns:%d, index:%d, column name:%s",
|
tscError("%p sid:%d uid:%" PRIu64" id:%s, column index out of range, numOfColumns:%d, index:%d, column name:%s",
|
||||||
pSql, pTableMeta->sid, pTableMeta->uid, pTableMetaInfo->name, tscGetNumOfColumns(pTableMeta), pCol->colIndex,
|
pSql, pTableMeta->sid, pTableMeta->uid, pTableMetaInfo->name, tscGetNumOfColumns(pTableMeta), pCol->colIndex.columnIndex,
|
||||||
pColSchema->name);
|
pColSchema->name);
|
||||||
|
|
||||||
return TSDB_CODE_TSC_INVALID_SQL;
|
return TSDB_CODE_TSC_INVALID_SQL;
|
||||||
|
@ -783,7 +779,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
||||||
(pColSchema->type < TSDB_DATA_TYPE_BOOL || pColSchema->type > TSDB_DATA_TYPE_NCHAR)) {
|
(pColSchema->type < TSDB_DATA_TYPE_BOOL || pColSchema->type > TSDB_DATA_TYPE_NCHAR)) {
|
||||||
tscError("%p sid:%d uid:%" PRIu64 " id:%s, tag index out of range, totalCols:%d, numOfTags:%d, index:%d, column name:%s",
|
tscError("%p sid:%d uid:%" PRIu64 " id:%s, tag index out of range, totalCols:%d, numOfTags:%d, index:%d, column name:%s",
|
||||||
pSql, pTableMeta->sid, pTableMeta->uid, pTableMetaInfo->name, total, numOfTagColumns,
|
pSql, pTableMeta->sid, pTableMeta->uid, pTableMetaInfo->name, total, numOfTagColumns,
|
||||||
pCol->colIndex, pColSchema->name);
|
pCol->colIndex.columnIndex, pColSchema->name);
|
||||||
|
|
||||||
return TSDB_CODE_TSC_INVALID_SQL;
|
return TSDB_CODE_TSC_INVALID_SQL;
|
||||||
}
|
}
|
||||||
|
@ -982,7 +978,7 @@ int32_t tscBuildDropDbMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
||||||
SCMDropDbMsg *pDropDbMsg = (SCMDropDbMsg*)pCmd->payload;
|
SCMDropDbMsg *pDropDbMsg = (SCMDropDbMsg*)pCmd->payload;
|
||||||
|
|
||||||
STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0);
|
STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0);
|
||||||
strncpy(pDropDbMsg->db, pTableMetaInfo->name, tListLen(pDropDbMsg->db));
|
tstrncpy(pDropDbMsg->db, pTableMetaInfo->name, sizeof(pDropDbMsg->db));
|
||||||
pDropDbMsg->ignoreNotExists = pInfo->pDCLInfo->existsCheck ? 1 : 0;
|
pDropDbMsg->ignoreNotExists = pInfo->pDCLInfo->existsCheck ? 1 : 0;
|
||||||
|
|
||||||
pCmd->msgType = TSDB_MSG_TYPE_CM_DROP_DB;
|
pCmd->msgType = TSDB_MSG_TYPE_CM_DROP_DB;
|
||||||
|
@ -1052,7 +1048,7 @@ int32_t tscBuildDropAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
||||||
|
|
||||||
SCMDropUserMsg *pDropMsg = (SCMDropUserMsg*)pCmd->payload;
|
SCMDropUserMsg *pDropMsg = (SCMDropUserMsg*)pCmd->payload;
|
||||||
STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0);
|
STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0);
|
||||||
strcpy(pDropMsg->user, pTableMetaInfo->name);
|
tstrncpy(pDropMsg->user, pTableMetaInfo->name, sizeof(pDropMsg->user));
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1812,6 +1808,7 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) {
|
||||||
|
|
||||||
// todo handle out of memory case
|
// todo handle out of memory case
|
||||||
if (pTableMetaInfo->pTableMeta == NULL) {
|
if (pTableMetaInfo->pTableMeta == NULL) {
|
||||||
|
free(pTableMeta);
|
||||||
return TSDB_CODE_TSC_OUT_OF_MEMORY;
|
return TSDB_CODE_TSC_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2324,6 +2321,7 @@ int tscGetSTableVgroupInfo(SSqlObj *pSql, int32_t clauseIndex) {
|
||||||
|
|
||||||
SQueryInfo *pNewQueryInfo = NULL;
|
SQueryInfo *pNewQueryInfo = NULL;
|
||||||
if ((code = tscGetQueryInfoDetailSafely(&pNew->cmd, 0, &pNewQueryInfo)) != TSDB_CODE_SUCCESS) {
|
if ((code = tscGetQueryInfoDetailSafely(&pNew->cmd, 0, &pNewQueryInfo)) != TSDB_CODE_SUCCESS) {
|
||||||
|
tscFreeSqlObj(pNew);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -584,7 +584,7 @@ char *taos_errstr(TAOS_RES *tres) {
|
||||||
|
|
||||||
void taos_config(int debug, char *log_path) {
|
void taos_config(int debug, char *log_path) {
|
||||||
uDebugFlag = debug;
|
uDebugFlag = debug;
|
||||||
strcpy(tsLogDir, log_path);
|
tstrncpy(tsLogDir, log_path, TSDB_FILENAME_LEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *taos_get_server_info(TAOS *taos) {
|
char *taos_get_server_info(TAOS *taos) {
|
||||||
|
@ -719,6 +719,7 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
|
||||||
if (sqlLen > tsMaxSQLStringLen) {
|
if (sqlLen > tsMaxSQLStringLen) {
|
||||||
tscError("%p sql too long", pSql);
|
tscError("%p sql too long", pSql);
|
||||||
pRes->code = TSDB_CODE_TSC_INVALID_SQL;
|
pRes->code = TSDB_CODE_TSC_INVALID_SQL;
|
||||||
|
tfree(pSql);
|
||||||
return pRes->code;
|
return pRes->code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -727,6 +728,7 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
|
||||||
pRes->code = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
pRes->code = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
||||||
tscError("%p failed to malloc sql string buffer", pSql);
|
tscError("%p failed to malloc sql string buffer", pSql);
|
||||||
tscTrace("%p Valid SQL result:%d, %s pObj:%p", pSql, pRes->code, taos_errstr(taos), pObj);
|
tscTrace("%p Valid SQL result:%d, %s pObj:%p", pSql, pRes->code, taos_errstr(taos), pObj);
|
||||||
|
tfree(pSql);
|
||||||
return pRes->code;
|
return pRes->code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -851,6 +853,7 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
|
||||||
if (tblListLen > MAX_TABLE_NAME_LENGTH) {
|
if (tblListLen > MAX_TABLE_NAME_LENGTH) {
|
||||||
tscError("%p tableNameList too long, length:%d, maximum allowed:%d", pSql, tblListLen, MAX_TABLE_NAME_LENGTH);
|
tscError("%p tableNameList too long, length:%d, maximum allowed:%d", pSql, tblListLen, MAX_TABLE_NAME_LENGTH);
|
||||||
pRes->code = TSDB_CODE_TSC_INVALID_SQL;
|
pRes->code = TSDB_CODE_TSC_INVALID_SQL;
|
||||||
|
tfree(pSql);
|
||||||
return pRes->code;
|
return pRes->code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -858,6 +861,7 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
|
||||||
if (str == NULL) {
|
if (str == NULL) {
|
||||||
pRes->code = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
pRes->code = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
||||||
tscError("%p failed to malloc sql string buffer", pSql);
|
tscError("%p failed to malloc sql string buffer", pSql);
|
||||||
|
tfree(pSql);
|
||||||
return pRes->code;
|
return pRes->code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -873,6 +877,7 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
|
||||||
free(str);
|
free(str);
|
||||||
|
|
||||||
if (pRes->code != TSDB_CODE_SUCCESS) {
|
if (pRes->code != TSDB_CODE_SUCCESS) {
|
||||||
|
tscFreeSqlObj(pSql);
|
||||||
return pRes->code;
|
return pRes->code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ static void tscProcessStreamTimer(void *handle, void *tmrId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// launch stream computing in a new thread
|
// launch stream computing in a new thread
|
||||||
SSchedMsg schedMsg;
|
SSchedMsg schedMsg = { 0 };
|
||||||
schedMsg.fp = tscProcessStreamLaunchQuery;
|
schedMsg.fp = tscProcessStreamLaunchQuery;
|
||||||
schedMsg.ahandle = pStream;
|
schedMsg.ahandle = pStream;
|
||||||
schedMsg.thandle = (void *)1;
|
schedMsg.thandle = (void *)1;
|
||||||
|
@ -239,7 +239,7 @@ static void tscProcessStreamRetrieveResult(void *param, TAOS_RES *res, int numOf
|
||||||
/* no resuls in the query range, retry */
|
/* no resuls in the query range, retry */
|
||||||
// todo set retry dynamic time
|
// todo set retry dynamic time
|
||||||
int32_t retry = tsProjectExecInterval;
|
int32_t retry = tsProjectExecInterval;
|
||||||
tscError("%p stream:%p, retrieve no data, code:%d, retry in %" PRId64 "ms", pSql, pStream, numOfRows, retry);
|
tscError("%p stream:%p, retrieve no data, code:%d, retry in %" PRId32 "ms", pSql, pStream, numOfRows, retry);
|
||||||
|
|
||||||
tscSetRetryTimer(pStream, pStream->pSql, retry);
|
tscSetRetryTimer(pStream, pStream->pSql, retry);
|
||||||
return;
|
return;
|
||||||
|
@ -250,7 +250,7 @@ static void tscProcessStreamRetrieveResult(void *param, TAOS_RES *res, int numOf
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tscTrace("%p stream:%p, query on:%s, fetch result completed, fetched rows:%d", pSql, pStream, pTableMetaInfo->name,
|
tscTrace("%p stream:%p, query on:%s, fetch result completed, fetched rows:%" PRId64, pSql, pStream, pTableMetaInfo->name,
|
||||||
pStream->numOfRes);
|
pStream->numOfRes);
|
||||||
|
|
||||||
// release the metric/meter meta information reference, so data in cache can be updated
|
// release the metric/meter meta information reference, so data in cache can be updated
|
||||||
|
|
|
@ -291,7 +291,7 @@ static int tscLoadSubscriptionProgress(SSub* pSub) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
taosArraySort(progress, tscCompareSubscriptionProgress);
|
taosArraySort(progress, tscCompareSubscriptionProgress);
|
||||||
tscTrace("subscription progress loaded, %d tables: %s", taosArrayGetSize(progress), pSub->topic);
|
tscTrace("subscription progress loaded, %z tables: %s", taosArrayGetSize(progress), pSub->topic);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ TAOS_SUB *taos_subscribe(TAOS *taos, int restart, const char* topic, const char
|
||||||
|
|
||||||
pSub->interval = interval;
|
pSub->interval = interval;
|
||||||
if (fp != NULL) {
|
if (fp != NULL) {
|
||||||
tscTrace("asynchronize subscription, create new timer", topic);
|
tscTrace("asynchronize subscription, create new timer: %s", topic);
|
||||||
pSub->fp = fp;
|
pSub->fp = fp;
|
||||||
pSub->param = param;
|
pSub->param = param;
|
||||||
taosTmrReset(tscProcessSubscriptionTimer, interval, pSub, tscTmr, &pSub->pTimer);
|
taosTmrReset(tscProcessSubscriptionTimer, interval, pSub, tscTmr, &pSub->pTimer);
|
||||||
|
@ -435,7 +435,9 @@ void taos_unsubscribe(TAOS_SUB *tsub, int keepProgress) {
|
||||||
} else {
|
} else {
|
||||||
char path[256];
|
char path[256];
|
||||||
sprintf(path, "%s/subscribe/%s", tsDataDir, pSub->topic);
|
sprintf(path, "%s/subscribe/%s", tsDataDir, pSub->topic);
|
||||||
remove(path);
|
if (remove(path) != 0) {
|
||||||
|
tscError("failed to remove progress file, topic = %s, error = %s", pSub->topic, strerror(errno));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tscFreeSqlObj(pSub->pSql);
|
tscFreeSqlObj(pSub->pSql);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -220,7 +220,7 @@ static int taos_options_imp(TSDB_OPTION option, const char *pStr) {
|
||||||
|
|
||||||
if (strlen(tsLocale) == 0) { // locale does not set yet
|
if (strlen(tsLocale) == 0) { // locale does not set yet
|
||||||
char* defaultLocale = setlocale(LC_CTYPE, "");
|
char* defaultLocale = setlocale(LC_CTYPE, "");
|
||||||
strcpy(tsLocale, defaultLocale);
|
tstrncpy(tsLocale, defaultLocale, sizeof(tsLocale));
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the user specified locale
|
// set the user specified locale
|
||||||
|
@ -304,7 +304,7 @@ static int taos_options_imp(TSDB_OPTION option, const char *pStr) {
|
||||||
assert(cfg != NULL);
|
assert(cfg != NULL);
|
||||||
|
|
||||||
if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_OPTION) {
|
if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_OPTION) {
|
||||||
strcpy(tsTimezone, pStr);
|
tstrncpy(tsTimezone, pStr, sizeof(tsTimezone));
|
||||||
tsSetTimeZone();
|
tsSetTimeZone();
|
||||||
cfg->cfgStatus = TAOS_CFG_CSTATUS_OPTION;
|
cfg->cfgStatus = TAOS_CFG_CSTATUS_OPTION;
|
||||||
tscTrace("timezone set:%s, input:%s by taos_options", tsTimezone, pStr);
|
tscTrace("timezone set:%s, input:%s by taos_options", tsTimezone, pStr);
|
||||||
|
|
|
@ -1840,7 +1840,7 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, void (*fp)(), void
|
||||||
size_t size = taosArrayGetSize(pNewQueryInfo->colList);
|
size_t size = taosArrayGetSize(pNewQueryInfo->colList);
|
||||||
|
|
||||||
tscTrace(
|
tscTrace(
|
||||||
"%p new subquery:%p, tableIndex:%d, vgroupIndex:%d, type:%d, exprInfo:%d, colList:%d,"
|
"%p new subquery:%p, tableIndex:%d, vgroupIndex:%d, type:%d, exprInfo:%z, colList:%z,"
|
||||||
"fieldInfo:%d, name:%s, qrang:%" PRId64 " - %" PRId64 " order:%d, limit:%" PRId64,
|
"fieldInfo:%d, name:%s, qrang:%" PRId64 " - %" PRId64 " order:%d, limit:%" PRId64,
|
||||||
pSql, pNew, tableIndex, pTableMetaInfo->vgroupIndex, pNewQueryInfo->type, tscSqlExprNumOfExprs(pNewQueryInfo),
|
pSql, pNew, tableIndex, pTableMetaInfo->vgroupIndex, pNewQueryInfo->type, tscSqlExprNumOfExprs(pNewQueryInfo),
|
||||||
size, pNewQueryInfo->fieldsInfo.numOfOutput, pFinalInfo->name, pNewQueryInfo->window.skey,
|
size, pNewQueryInfo->fieldsInfo.numOfOutput, pFinalInfo->name, pNewQueryInfo->window.skey,
|
||||||
|
@ -2002,7 +2002,7 @@ void tscTryQueryNextVnode(SSqlObj* pSql, __async_cb_func_t fp) {
|
||||||
|
|
||||||
int32_t totalVgroups = pTableMetaInfo->vgroupList->numOfVgroups;
|
int32_t totalVgroups = pTableMetaInfo->vgroupList->numOfVgroups;
|
||||||
while (++pTableMetaInfo->vgroupIndex < totalVgroups) {
|
while (++pTableMetaInfo->vgroupIndex < totalVgroups) {
|
||||||
tscTrace("%p results from vgroup index:%d completed, try next:%d. total vgroups:%d. current numOfRes:%d", pSql,
|
tscTrace("%p results from vgroup index:%d completed, try next:%d. total vgroups:%d. current numOfRes:%" PRId64, pSql,
|
||||||
pTableMetaInfo->vgroupIndex - 1, pTableMetaInfo->vgroupIndex, totalVgroups, pRes->numOfClauseTotal);
|
pTableMetaInfo->vgroupIndex - 1, pTableMetaInfo->vgroupIndex, totalVgroups, pRes->numOfClauseTotal);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -407,11 +407,7 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) {
|
||||||
pMnodeInfo->nodeId = htonl(pMnodeInfo->nodeId);
|
pMnodeInfo->nodeId = htonl(pMnodeInfo->nodeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDMVgroupAccess *pVgAcccess = pStatusRsp->vgAccess;
|
vnodeSetAccess(pStatusRsp->vgAccess, pCfg->numOfVnodes);
|
||||||
for (int32_t i = 0; i < pCfg->numOfVnodes; ++i) {
|
|
||||||
pVgAcccess[i].vgId = htonl(pVgAcccess[i].vgId);
|
|
||||||
}
|
|
||||||
|
|
||||||
dnodeProcessModuleStatus(pCfg->moduleStatus);
|
dnodeProcessModuleStatus(pCfg->moduleStatus);
|
||||||
dnodeUpdateDnodeCfg(pCfg);
|
dnodeUpdateDnodeCfg(pCfg);
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ typedef enum {
|
||||||
typedef struct taosField {
|
typedef struct taosField {
|
||||||
char name[65];
|
char name[65];
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
uint16_t bytes;
|
int16_t bytes;
|
||||||
} TAOS_FIELD;
|
} TAOS_FIELD;
|
||||||
|
|
||||||
#ifdef _TD_GO_DLL_
|
#ifdef _TD_GO_DLL_
|
||||||
|
|
|
@ -209,8 +209,8 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size);
|
||||||
#define TSDB_MAX_SQL_SHOW_LEN 256
|
#define TSDB_MAX_SQL_SHOW_LEN 256
|
||||||
#define TSDB_MAX_ALLOWED_SQL_LEN (8*1024*1024U) // sql length should be less than 8mb
|
#define TSDB_MAX_ALLOWED_SQL_LEN (8*1024*1024U) // sql length should be less than 8mb
|
||||||
|
|
||||||
#define TSDB_MAX_BYTES_PER_ROW 65535
|
#define TSDB_MAX_BYTES_PER_ROW 16384
|
||||||
#define TSDB_MAX_TAGS_LEN 65535
|
#define TSDB_MAX_TAGS_LEN 16384
|
||||||
#define TSDB_MAX_TAGS 128
|
#define TSDB_MAX_TAGS 128
|
||||||
|
|
||||||
#define TSDB_AUTH_LEN 16
|
#define TSDB_AUTH_LEN 16
|
||||||
|
|
|
@ -113,12 +113,12 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_QUERY_ID, 0, 0x030C, "mnode inva
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_STREAM_ID, 0, 0x030D, "mnode invalid stream id")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_STREAM_ID, 0, 0x030D, "mnode invalid stream id")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_CONN_ID, 0, 0x030E, "mnode invalid connection")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_CONN_ID, 0, 0x030E, "mnode invalid connection")
|
||||||
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_SDB_OBJ_ALREADY_THERE, 0, 0x0320, "[sdb] object already there")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_SDB_OBJ_ALREADY_THERE, 0, 0x0320, "sdb object already there")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_SDB_ERROR, 0, 0x0321, "[sdb] app error")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_SDB_ERROR, 0, 0x0321, "sdb app error")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_SDB_INVALID_TABLE_TYPE, 0, 0x0322, "[sdb] invalid table type")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_SDB_INVALID_TABLE_TYPE, 0, 0x0322, "sdb invalid table type")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_SDB_OBJ_NOT_THERE, 0, 0x0323, "[sdb] object not there")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_SDB_OBJ_NOT_THERE, 0, 0x0323, "sdb object not there")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_SDB_INVAID_META_ROW, 0, 0x0324, "[sdb] invalid meta row")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_SDB_INVAID_META_ROW, 0, 0x0324, "sdb invalid meta row")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_SDB_INVAID_KEY_TYPE, 0, 0x0325, "[sdb] invalid key type")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_SDB_INVAID_KEY_TYPE, 0, 0x0325, "sdb invalid key type")
|
||||||
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_DNODE_ALREADY_EXIST, 0, 0x0330, "mnode dnode already exist")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_DNODE_ALREADY_EXIST, 0, 0x0330, "mnode dnode already exist")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_DNODE_NOT_EXIST, 0, 0x0331, "mnode dnode not exist")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_DNODE_NOT_EXIST, 0, 0x0331, "mnode dnode not exist")
|
||||||
|
@ -179,6 +179,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_VND_NO_DISK_PERMISSIONS, 0, 0x0506, "vnode no d
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_VND_NO_SUCH_FILE_OR_DIR, 0, 0x0507, "vnode no such file or directory")
|
TAOS_DEFINE_ERROR(TSDB_CODE_VND_NO_SUCH_FILE_OR_DIR, 0, 0x0507, "vnode no such file or directory")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_VND_OUT_OF_MEMORY, 0, 0x0508, "vnode out of memory")
|
TAOS_DEFINE_ERROR(TSDB_CODE_VND_OUT_OF_MEMORY, 0, 0x0508, "vnode out of memory")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_VND_APP_ERROR, 0, 0x0509, "vnode app error")
|
TAOS_DEFINE_ERROR(TSDB_CODE_VND_APP_ERROR, 0, 0x0509, "vnode app error")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_VND_NO_WRITE_AUTH, 0, 0x0214, "vnode no write auth")
|
||||||
|
|
||||||
// tsdb
|
// tsdb
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_INVALID_TABLE_ID, 0, 0x0600, "tsdb invalid table id")
|
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_INVALID_TABLE_ID, 0, 0x0600, "tsdb invalid table id")
|
||||||
|
|
|
@ -543,6 +543,7 @@ typedef struct {
|
||||||
int32_t dnodeId;
|
int32_t dnodeId;
|
||||||
uint32_t moduleStatus;
|
uint32_t moduleStatus;
|
||||||
uint32_t numOfVnodes;
|
uint32_t numOfVnodes;
|
||||||
|
uint32_t reserved;
|
||||||
} SDMDnodeCfg;
|
} SDMDnodeCfg;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -58,6 +58,7 @@ void* vnodeGetWal(void *pVnode);
|
||||||
|
|
||||||
int32_t vnodeProcessWrite(void *pVnode, int qtype, void *pHead, void *item);
|
int32_t vnodeProcessWrite(void *pVnode, int qtype, void *pHead, void *item);
|
||||||
void vnodeBuildStatusMsg(void * param);
|
void vnodeBuildStatusMsg(void * param);
|
||||||
|
void vnodeSetAccess(SDMVgroupAccess *pAccess, int32_t numOfVnodes);
|
||||||
|
|
||||||
int32_t vnodeProcessRead(void *pVnode, SReadMsg *pReadMsg);
|
int32_t vnodeProcessRead(void *pVnode, SReadMsg *pReadMsg);
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,8 @@ typedef struct SVgObj {
|
||||||
int32_t lbDnodeId;
|
int32_t lbDnodeId;
|
||||||
int32_t lbTime;
|
int32_t lbTime;
|
||||||
int8_t inUse;
|
int8_t inUse;
|
||||||
int8_t reserved[13];
|
int8_t accessState;
|
||||||
|
int8_t reserved[12];
|
||||||
int8_t updateEnd[1];
|
int8_t updateEnd[1];
|
||||||
int32_t refCount;
|
int32_t refCount;
|
||||||
struct SVgObj *prev, *next;
|
struct SVgObj *prev, *next;
|
||||||
|
|
|
@ -34,7 +34,8 @@ void mnodeUpdateAllDbVgroups(SDbObj *pAlterDb);
|
||||||
|
|
||||||
void * mnodeGetNextVgroup(void *pIter, SVgObj **pVgroup);
|
void * mnodeGetNextVgroup(void *pIter, SVgObj **pVgroup);
|
||||||
void mnodeUpdateVgroup(SVgObj *pVgroup);
|
void mnodeUpdateVgroup(SVgObj *pVgroup);
|
||||||
void mnodeUpdateVgroupStatus(SVgObj *pVgroup, SDnodeObj *dnodeId, SVnodeLoad *pVload);
|
void mnodeUpdateVgroupStatus(SVgObj *pVgroup, SDnodeObj *pDnode, SVnodeLoad *pVload);
|
||||||
|
void mnodeCheckUnCreatedVgroup(SDnodeObj *pDnode, SVnodeLoad *pVloads, int32_t openVnodes);
|
||||||
|
|
||||||
int32_t mnodeCreateVgroup(struct SMnodeMsg *pMsg, SDbObj *pDb);
|
int32_t mnodeCreateVgroup(struct SMnodeMsg *pMsg, SDbObj *pDb);
|
||||||
void mnodeDropVgroup(SVgObj *pVgroup, void *ahandle);
|
void mnodeDropVgroup(SVgObj *pVgroup, void *ahandle);
|
||||||
|
|
|
@ -39,6 +39,7 @@ static int32_t mnodeAcctActionDestroy(SSdbOper *pOper) {
|
||||||
static int32_t mnodeAcctActionInsert(SSdbOper *pOper) {
|
static int32_t mnodeAcctActionInsert(SSdbOper *pOper) {
|
||||||
SAcctObj *pAcct = pOper->pObj;
|
SAcctObj *pAcct = pOper->pObj;
|
||||||
memset(&pAcct->acctInfo, 0, sizeof(SAcctInfo));
|
memset(&pAcct->acctInfo, 0, sizeof(SAcctInfo));
|
||||||
|
pAcct->acctInfo.accessState = TSDB_VN_ALL_ACCCESS;
|
||||||
pthread_mutex_init(&pAcct->mutex, NULL);
|
pthread_mutex_init(&pAcct->mutex, NULL);
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -335,6 +335,19 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t openVnodes = htons(pStatus->openVnodes);
|
int32_t openVnodes = htons(pStatus->openVnodes);
|
||||||
|
int32_t contLen = sizeof(SDMStatusRsp) + openVnodes * sizeof(SDMVgroupAccess);
|
||||||
|
SDMStatusRsp *pRsp = rpcMallocCont(contLen);
|
||||||
|
if (pRsp == NULL) {
|
||||||
|
mnodeDecDnodeRef(pDnode);
|
||||||
|
return TSDB_CODE_MND_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
pRsp->dnodeCfg.dnodeId = htonl(pDnode->dnodeId);
|
||||||
|
pRsp->dnodeCfg.moduleStatus = htonl((int32_t)pDnode->isMgmt);
|
||||||
|
pRsp->dnodeCfg.numOfVnodes = htonl(openVnodes);
|
||||||
|
mnodeGetMnodeInfos(&pRsp->mnodes);
|
||||||
|
SDMVgroupAccess *pAccess = (SDMVgroupAccess *)((char *)pRsp + sizeof(SDMStatusRsp));
|
||||||
|
|
||||||
for (int32_t j = 0; j < openVnodes; ++j) {
|
for (int32_t j = 0; j < openVnodes; ++j) {
|
||||||
SVnodeLoad *pVload = &pStatus->load[j];
|
SVnodeLoad *pVload = &pStatus->load[j];
|
||||||
pVload->vgId = htonl(pVload->vgId);
|
pVload->vgId = htonl(pVload->vgId);
|
||||||
|
@ -347,6 +360,8 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
|
||||||
mnodeSendDropVnodeMsg(pVload->vgId, &ipSet, NULL);
|
mnodeSendDropVnodeMsg(pVload->vgId, &ipSet, NULL);
|
||||||
} else {
|
} else {
|
||||||
mnodeUpdateVgroupStatus(pVgroup, pDnode, pVload);
|
mnodeUpdateVgroupStatus(pVgroup, pDnode, pVload);
|
||||||
|
pAccess->vgId = htonl(pVload->vgId);
|
||||||
|
pAccess->accessState = pVgroup->accessState;
|
||||||
mnodeDecVgroupRef(pVgroup);
|
mnodeDecVgroupRef(pVgroup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -366,25 +381,12 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
|
||||||
balanceNotify();
|
balanceNotify();
|
||||||
}
|
}
|
||||||
|
|
||||||
mnodeDecDnodeRef(pDnode);
|
if (openVnodes != pDnode->openVnodes) {
|
||||||
|
mnodeCheckUnCreatedVgroup(pDnode, pStatus->load, openVnodes);
|
||||||
int32_t contLen = sizeof(SDMStatusRsp) + TSDB_MAX_VNODES * sizeof(SDMVgroupAccess);
|
|
||||||
SDMStatusRsp *pRsp = rpcMallocCont(contLen);
|
|
||||||
if (pRsp == NULL) {
|
|
||||||
return TSDB_CODE_MND_OUT_OF_MEMORY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pDnode->lastAccess = tsAccessSquence;
|
pDnode->lastAccess = tsAccessSquence;
|
||||||
|
mnodeDecDnodeRef(pDnode);
|
||||||
mnodeGetMnodeInfos(&pRsp->mnodes);
|
|
||||||
|
|
||||||
pRsp->dnodeCfg.dnodeId = htonl(pDnode->dnodeId);
|
|
||||||
pRsp->dnodeCfg.moduleStatus = htonl((int32_t)pDnode->isMgmt);
|
|
||||||
pRsp->dnodeCfg.numOfVnodes = 0;
|
|
||||||
|
|
||||||
contLen = sizeof(SDMStatusRsp);
|
|
||||||
|
|
||||||
//TODO: set vnode access
|
|
||||||
|
|
||||||
pMsg->rpcRsp.len = contLen;
|
pMsg->rpcRsp.len = contLen;
|
||||||
pMsg->rpcRsp.rsp = pRsp;
|
pMsg->rpcRsp.rsp = pRsp;
|
||||||
|
|
|
@ -74,6 +74,7 @@ static int32_t mnodeVgroupActionInsert(SSdbOper *pOper) {
|
||||||
pVgroup->pDb = pDb;
|
pVgroup->pDb = pDb;
|
||||||
pVgroup->prev = NULL;
|
pVgroup->prev = NULL;
|
||||||
pVgroup->next = NULL;
|
pVgroup->next = NULL;
|
||||||
|
pVgroup->accessState = TSDB_VN_ALL_ACCCESS;
|
||||||
|
|
||||||
int32_t size = sizeof(SChildTableObj *) * pDb->cfg.maxTables;
|
int32_t size = sizeof(SChildTableObj *) * pDb->cfg.maxTables;
|
||||||
pVgroup->tableList = calloc(pDb->cfg.maxTables, sizeof(SChildTableObj *));
|
pVgroup->tableList = calloc(pDb->cfg.maxTables, sizeof(SChildTableObj *));
|
||||||
|
@ -255,6 +256,8 @@ void mnodeUpdateVgroup(SVgObj *pVgroup) {
|
||||||
mnodeSendCreateVgroupMsg(pVgroup, NULL);
|
mnodeSendCreateVgroupMsg(pVgroup, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mnodeCheckUnCreatedVgroup(SDnodeObj *pDnode, SVnodeLoad *pVloads, int32_t openVnodes) {}
|
||||||
|
|
||||||
void mnodeUpdateVgroupStatus(SVgObj *pVgroup, SDnodeObj *pDnode, SVnodeLoad *pVload) {
|
void mnodeUpdateVgroupStatus(SVgObj *pVgroup, SDnodeObj *pDnode, SVnodeLoad *pVload) {
|
||||||
bool dnodeExist = false;
|
bool dnodeExist = false;
|
||||||
for (int32_t i = 0; i < pVgroup->numOfVnodes; ++i) {
|
for (int32_t i = 0; i < pVgroup->numOfVnodes; ++i) {
|
||||||
|
@ -324,6 +327,7 @@ int32_t mnodeCreateVgroup(SMnodeMsg *pMsg, SDbObj *pDb) {
|
||||||
strcpy(pVgroup->dbName, pDb->name);
|
strcpy(pVgroup->dbName, pDb->name);
|
||||||
pVgroup->numOfVnodes = pDb->cfg.replications;
|
pVgroup->numOfVnodes = pDb->cfg.replications;
|
||||||
pVgroup->createdTime = taosGetTimestampMs();
|
pVgroup->createdTime = taosGetTimestampMs();
|
||||||
|
pVgroup->accessState = TSDB_VN_ALL_ACCCESS;
|
||||||
if (balanceAllocVnodes(pVgroup) != 0) {
|
if (balanceAllocVnodes(pVgroup) != 0) {
|
||||||
mError("db:%s, no enough dnode to alloc %d vnodes to vgroup", pDb->name, pVgroup->numOfVnodes);
|
mError("db:%s, no enough dnode to alloc %d vnodes to vgroup", pDb->name, pVgroup->numOfVnodes);
|
||||||
free(pVgroup);
|
free(pVgroup);
|
||||||
|
|
|
@ -1216,7 +1216,6 @@ static int32_t tableApplyFunctionsOnBlock(SQueryRuntimeEnv *pRuntimeEnv, SDataBl
|
||||||
|
|
||||||
// interval query with limit applied
|
// interval query with limit applied
|
||||||
int32_t numOfRes = 0;
|
int32_t numOfRes = 0;
|
||||||
|
|
||||||
if (isIntervalQuery(pQuery)) {
|
if (isIntervalQuery(pQuery)) {
|
||||||
numOfRes = doCheckQueryCompleted(pRuntimeEnv, lastKey, pWindowResInfo);
|
numOfRes = doCheckQueryCompleted(pRuntimeEnv, lastKey, pWindowResInfo);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -120,6 +120,7 @@ static FORCE_INLINE int32_t isValidNumber(const SSQLToken* pToken) {
|
||||||
|
|
||||||
type = TK_FLOAT;
|
type = TK_FLOAT;
|
||||||
goto _end;
|
goto _end;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case '0': {
|
case '0': {
|
||||||
|
|
|
@ -117,6 +117,8 @@ extern "C" {
|
||||||
|
|
||||||
#define POW2(x) ((x) * (x))
|
#define POW2(x) ((x) * (x))
|
||||||
|
|
||||||
|
int taosRand(void);
|
||||||
|
|
||||||
int32_t strdequote(char *src);
|
int32_t strdequote(char *src);
|
||||||
|
|
||||||
size_t strtrim(char *src);
|
size_t strtrim(char *src);
|
||||||
|
|
|
@ -95,9 +95,6 @@ void* taosArrayGetP(const SArray* pArray, size_t index) {
|
||||||
assert(index < pArray->size);
|
assert(index < pArray->size);
|
||||||
|
|
||||||
void* d = TARRAY_GET_ELEM(pArray, index);
|
void* d = TARRAY_GET_ELEM(pArray, index);
|
||||||
if (d == NULL) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return *(void**)d;
|
return *(void**)d;
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@ static FORCE_INLINE void taosCacheReleaseNode(SCacheObj *pCacheObj, SCacheDataNo
|
||||||
int32_t size = pNode->size;
|
int32_t size = pNode->size;
|
||||||
taosHashRemove(pCacheObj->pHashTable, pNode->key, pNode->keySize);
|
taosHashRemove(pCacheObj->pHashTable, pNode->key, pNode->keySize);
|
||||||
|
|
||||||
uTrace("key:%s is removed from cache,total:%d,size:%ldbytes", pNode->key, pCacheObj->totalSize, size);
|
uTrace("key:%s is removed from cache,total:%" PRId64 ",size:%dbytes", pNode->key, pCacheObj->totalSize, size);
|
||||||
if (pCacheObj->freeFp) pCacheObj->freeFp(pNode->data);
|
if (pCacheObj->freeFp) pCacheObj->freeFp(pNode->data);
|
||||||
free(pNode);
|
free(pNode);
|
||||||
}
|
}
|
||||||
|
@ -288,7 +288,7 @@ void *taosCachePut(SCacheObj *pCacheObj, const char *key, const void *pData, siz
|
||||||
if (NULL != pNode) {
|
if (NULL != pNode) {
|
||||||
pCacheObj->totalSize += pNode->size;
|
pCacheObj->totalSize += pNode->size;
|
||||||
|
|
||||||
uTrace("key:%s %p added into cache, added:%" PRIu64 ", expire:%" PRIu64 ", total:%d, size:%" PRId64 " bytes",
|
uTrace("key:%s %p added into cache, added:%" PRIu64 ", expire:%" PRIu64 ", total:%" PRId64 ", size:%" PRId64 " bytes",
|
||||||
key, pNode, pNode->addedTime, pNode->expiredTime, pCacheObj->totalSize, dataSize);
|
key, pNode, pNode->addedTime, pNode->expiredTime, pCacheObj->totalSize, dataSize);
|
||||||
} else {
|
} else {
|
||||||
uError("key:%s failed to added into cache, out of memory", key);
|
uError("key:%s failed to added into cache, out of memory", key);
|
||||||
|
@ -433,7 +433,6 @@ void taosCacheEmpty(SCacheObj *pCacheObj) {
|
||||||
__cache_wr_lock(pCacheObj);
|
__cache_wr_lock(pCacheObj);
|
||||||
while (taosHashIterNext(pIter)) {
|
while (taosHashIterNext(pIter)) {
|
||||||
if (pCacheObj->deleting == 1) {
|
if (pCacheObj->deleting == 1) {
|
||||||
taosHashDestroyIter(pIter);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -507,7 +506,7 @@ void taosAddToTrash(SCacheObj *pCacheObj, SCacheDataNode *pNode) {
|
||||||
|
|
||||||
void taosRemoveFromTrashCan(SCacheObj *pCacheObj, STrashElem *pElem) {
|
void taosRemoveFromTrashCan(SCacheObj *pCacheObj, STrashElem *pElem) {
|
||||||
if (pElem->pData->signature != (uint64_t)pElem->pData) {
|
if (pElem->pData->signature != (uint64_t)pElem->pData) {
|
||||||
uError("key:sig:%d %p data has been released, ignore", pElem->pData->signature, pElem->pData);
|
uError("key:sig:0x%" PRIx64 " %p data has been released, ignore", pElem->pData->signature, pElem->pData);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -561,7 +560,6 @@ void taosTrashCanEmpty(SCacheObj *pCacheObj, bool force) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(pCacheObj->numOfElemsInTrash >= 0);
|
|
||||||
__cache_unlock(pCacheObj);
|
__cache_unlock(pCacheObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -551,7 +551,7 @@ int tsDecompressTimestampImp(const char *const input, const int nelements, char
|
||||||
delta_of_delta = 0;
|
delta_of_delta = 0;
|
||||||
} else {
|
} else {
|
||||||
if (is_bigendian()) {
|
if (is_bigendian()) {
|
||||||
memcpy(&dd1 + LONG_BYTES - nbytes, input + ipos, nbytes);
|
memcpy(((char *)(&dd1)) + LONG_BYTES - nbytes, input + ipos, nbytes);
|
||||||
} else {
|
} else {
|
||||||
memcpy(&dd1, input + ipos, nbytes);
|
memcpy(&dd1, input + ipos, nbytes);
|
||||||
}
|
}
|
||||||
|
@ -576,7 +576,7 @@ int tsDecompressTimestampImp(const char *const input, const int nelements, char
|
||||||
delta_of_delta = 0;
|
delta_of_delta = 0;
|
||||||
} else {
|
} else {
|
||||||
if (is_bigendian()) {
|
if (is_bigendian()) {
|
||||||
memcpy(&dd2 + LONG_BYTES - nbytes, input + ipos, nbytes);
|
memcpy(((char *)(&dd2)) + LONG_BYTES - nbytes, input + ipos, nbytes);
|
||||||
} else {
|
} else {
|
||||||
memcpy(&dd2, input + ipos, nbytes);
|
memcpy(&dd2, input + ipos, nbytes);
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ static void taosReadInt32Config(SGlobalCfg *cfg, char *input_value) {
|
||||||
*option = value;
|
*option = value;
|
||||||
cfg->cfgStatus = TAOS_CFG_CSTATUS_FILE;
|
cfg->cfgStatus = TAOS_CFG_CSTATUS_FILE;
|
||||||
} else {
|
} else {
|
||||||
uWarn("config option:%s, input value:%s, is configured by %s, use %s", cfg->option, input_value,
|
uWarn("config option:%s, input value:%s, is configured by %s, use %d", cfg->option, input_value,
|
||||||
tsCfgStatusStr[cfg->cfgStatus], *option);
|
tsCfgStatusStr[cfg->cfgStatus], *option);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,11 @@ static void taosReadDirectoryConfig(SGlobalCfg *cfg, char *input_value) {
|
||||||
} else {
|
} else {
|
||||||
if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_FILE) {
|
if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_FILE) {
|
||||||
wordexp_t full_path;
|
wordexp_t full_path;
|
||||||
wordexp(input_value, &full_path, 0);
|
if (0 != wordexp(input_value, &full_path, 0)) {
|
||||||
|
printf("\nconfig dir: %s wordexp fail! reason:%s\n", input_value, strerror(errno));
|
||||||
|
wordfree(&full_path);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (full_path.we_wordv != NULL && full_path.we_wordv[0] != NULL) {
|
if (full_path.we_wordv != NULL && full_path.we_wordv[0] != NULL) {
|
||||||
strcpy(option, full_path.we_wordv[0]);
|
strcpy(option, full_path.we_wordv[0]);
|
||||||
}
|
}
|
||||||
|
@ -115,8 +119,13 @@ static void taosReadDirectoryConfig(SGlobalCfg *cfg, char *input_value) {
|
||||||
struct stat dirstat;
|
struct stat dirstat;
|
||||||
if (stat(option, &dirstat) < 0) {
|
if (stat(option, &dirstat) < 0) {
|
||||||
int code = mkdir(option, 0755);
|
int code = mkdir(option, 0755);
|
||||||
uPrint("config option:%s, input value:%s, directory not exist, create with return code:%d",
|
if (code < 0) {
|
||||||
|
uError("config option:%s, input value:%s, directory not exist, create fail with return code:%d",
|
||||||
cfg->option, input_value, code);
|
cfg->option, input_value, code);
|
||||||
|
} else {
|
||||||
|
uPrint("config option:%s, input value:%s, directory not exist, create with return code:%d",
|
||||||
|
cfg->option, input_value, code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cfg->cfgStatus = TAOS_CFG_CSTATUS_FILE;
|
cfg->cfgStatus = TAOS_CFG_CSTATUS_FILE;
|
||||||
} else {
|
} else {
|
||||||
|
@ -240,7 +249,12 @@ void taosReadGlobalLogCfg() {
|
||||||
sdbDebugFlag = 135;
|
sdbDebugFlag = 135;
|
||||||
|
|
||||||
wordexp_t full_path;
|
wordexp_t full_path;
|
||||||
wordexp(configDir, &full_path, 0);
|
if ( 0 != wordexp(configDir, &full_path, 0)) {
|
||||||
|
printf("\nconfig file: %s wordexp fail! reason:%s\n", configDir, strerror(errno));
|
||||||
|
wordfree(&full_path);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (full_path.we_wordv != NULL && full_path.we_wordv[0] != NULL) {
|
if (full_path.we_wordv != NULL && full_path.we_wordv[0] != NULL) {
|
||||||
if (strlen(full_path.we_wordv[0]) >= TSDB_FILENAME_LEN) {
|
if (strlen(full_path.we_wordv[0]) >= TSDB_FILENAME_LEN) {
|
||||||
printf("\nconfig file: %s path overflow max len %d, all variables are set to default\n", full_path.we_wordv[0], TSDB_FILENAME_LEN - 1);
|
printf("\nconfig file: %s path overflow max len %d, all variables are set to default\n", full_path.we_wordv[0], TSDB_FILENAME_LEN - 1);
|
||||||
|
|
|
@ -140,7 +140,7 @@ void print_char_as_binary(char input) {
|
||||||
void generate_key(unsigned char* key) {
|
void generate_key(unsigned char* key) {
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < 8; i++) {
|
||||||
key[i] = rand() % 255;
|
key[i] = taosRand() % 255;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <errno.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
|
@ -566,5 +566,6 @@ static int tdRestoreKVStore(SKVStore *pStore) {
|
||||||
_err:
|
_err:
|
||||||
taosHashDestroyIter(pIter);
|
taosHashDestroyIter(pIter);
|
||||||
tfree(buf);
|
tfree(buf);
|
||||||
|
taosHashDestroyIter(pIter);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
|
@ -142,6 +142,10 @@ static void *taosThreadToOpenNewFile(void *param) {
|
||||||
umask(0);
|
umask(0);
|
||||||
|
|
||||||
int32_t fd = open(name, O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU | S_IRWXG | S_IRWXO);
|
int32_t fd = open(name, O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU | S_IRWXG | S_IRWXO);
|
||||||
|
if (fd < 0) {
|
||||||
|
uError("open new log file fail! fd:%d reason:%s", fd, strerror(errno));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
taosLockFile(fd);
|
taosLockFile(fd);
|
||||||
lseek(fd, 0, SEEK_SET);
|
lseek(fd, 0, SEEK_SET);
|
||||||
|
|
||||||
|
@ -184,7 +188,7 @@ void taosResetLog() {
|
||||||
tsLogObj.lines = tsLogObj.maxLines + 10;
|
tsLogObj.lines = tsLogObj.maxLines + 10;
|
||||||
|
|
||||||
taosOpenNewLogFile();
|
taosOpenNewLogFile();
|
||||||
remove(lastName);
|
(void)remove(lastName);
|
||||||
|
|
||||||
uPrint("==================================");
|
uPrint("==================================");
|
||||||
uPrint(" reset log file ");
|
uPrint(" reset log file ");
|
||||||
|
@ -229,7 +233,9 @@ static void taosGetLogFileName(char *fn) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(tsLogObj.logName, fn);
|
if (strlen(fn) < LOG_FILE_NAME_LEN) {
|
||||||
|
strcpy(tsLogObj.logName, fn);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) {
|
static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) {
|
||||||
|
@ -249,15 +255,20 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) {
|
||||||
tsLogObj.fileNum = maxFileNum;
|
tsLogObj.fileNum = maxFileNum;
|
||||||
taosGetLogFileName(fn);
|
taosGetLogFileName(fn);
|
||||||
|
|
||||||
strcpy(name, fn);
|
if (strlen(fn) < LOG_FILE_NAME_LEN + 50 - 2) {
|
||||||
strcat(name, ".0");
|
strcpy(name, fn);
|
||||||
|
strcat(name, ".0");
|
||||||
|
}
|
||||||
|
|
||||||
// if none of the log files exist, open 0, if both exists, open the old one
|
// if none of the log files exist, open 0, if both exists, open the old one
|
||||||
if (stat(name, &logstat0) < 0) {
|
if (stat(name, &logstat0) < 0) {
|
||||||
tsLogObj.flag = 0;
|
tsLogObj.flag = 0;
|
||||||
} else {
|
} else {
|
||||||
strcpy(name, fn);
|
if (strlen(fn) < LOG_FILE_NAME_LEN + 50 - 2) {
|
||||||
strcat(name, ".1");
|
strcpy(name, fn);
|
||||||
|
strcat(name, ".1");
|
||||||
|
}
|
||||||
|
|
||||||
if (stat(name, &logstat1) < 0) {
|
if (stat(name, &logstat1) < 0) {
|
||||||
tsLogObj.flag = 1;
|
tsLogObj.flag = 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -279,7 +290,10 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) {
|
||||||
|
|
||||||
// only an estimate for number of lines
|
// only an estimate for number of lines
|
||||||
struct stat filestat;
|
struct stat filestat;
|
||||||
fstat(tsLogObj.logHandle->fd, &filestat);
|
if (fstat(tsLogObj.logHandle->fd, &filestat) < 0) {
|
||||||
|
printf("\nfailed to fstat log file:%s, reason:%s\n", name, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
size = (int32_t)filestat.st_size;
|
size = (int32_t)filestat.st_size;
|
||||||
tsLogObj.lines = size / 60;
|
tsLogObj.lines = size / 60;
|
||||||
|
|
||||||
|
|
|
@ -169,7 +169,9 @@ void taosGetNoteName(char *fn, taosNoteInfo * pNote)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(pNote->taosNoteName, fn);
|
if (strlen(fn) < NOTE_FILE_NAME_LEN) {
|
||||||
|
strcpy(pNote->taosNoteName, fn);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int taosOpenNoteWithMaxLines(char *fn, int maxLines, int maxNoteNum, taosNoteInfo * pNote)
|
int taosOpenNoteWithMaxLines(char *fn, int maxLines, int maxNoteNum, taosNoteInfo * pNote)
|
||||||
|
@ -182,14 +184,18 @@ int taosOpenNoteWithMaxLines(char *fn, int maxLines, int maxNoteNum, taosNoteInf
|
||||||
pNote->taosNoteFileNum = maxNoteNum;
|
pNote->taosNoteFileNum = maxNoteNum;
|
||||||
taosGetNoteName(fn, pNote);
|
taosGetNoteName(fn, pNote);
|
||||||
|
|
||||||
|
if (strlen(fn) > NOTE_FILE_NAME_LEN * 2 - 2) {
|
||||||
|
fprintf(stderr, "the len of file name overflow:%s\n", fn);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
strcpy(name, fn);
|
strcpy(name, fn);
|
||||||
strcat(name, ".0");
|
strcat(name, ".0");
|
||||||
|
|
||||||
// if none of the note files exist, open 0, if both exists, open the old one
|
// if none of the note files exist, open 0, if both exists, open the old one
|
||||||
if (stat(name, ¬estat0) < 0) {
|
if (stat(name, ¬estat0) < 0) {
|
||||||
pNote->taosNoteFlag = 0;
|
pNote->taosNoteFlag = 0;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
strcpy(name, fn);
|
strcpy(name, fn);
|
||||||
strcat(name, ".1");
|
strcat(name, ".1");
|
||||||
if (stat(name, ¬estat1) < 0) {
|
if (stat(name, ¬estat1) < 0) {
|
||||||
|
@ -214,7 +220,10 @@ int taosOpenNoteWithMaxLines(char *fn, int maxLines, int maxNoteNum, taosNoteInf
|
||||||
|
|
||||||
// only an estimate for number of lines
|
// only an estimate for number of lines
|
||||||
struct stat filestat;
|
struct stat filestat;
|
||||||
fstat(pNote->taosNoteFd, &filestat);
|
if (fstat(pNote->taosNoteFd, &filestat) < 0) {
|
||||||
|
fprintf(stderr, "failed to fstat note file:%s reason:%s\n", name, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
size = (int)filestat.st_size;
|
size = (int)filestat.st_size;
|
||||||
pNote->taosNoteLines = size / 60;
|
pNote->taosNoteLines = size / 60;
|
||||||
|
|
||||||
|
@ -226,7 +235,7 @@ int taosOpenNoteWithMaxLines(char *fn, int maxLines, int maxNoteNum, taosNoteInf
|
||||||
void taosNotePrint(taosNoteInfo * pNote, const char * const format, ...)
|
void taosNotePrint(taosNoteInfo * pNote, const char * const format, ...)
|
||||||
{
|
{
|
||||||
va_list argpointer;
|
va_list argpointer;
|
||||||
char buffer[MAX_NOTE_LINE_SIZE];
|
char buffer[MAX_NOTE_LINE_SIZE+2];
|
||||||
int len;
|
int len;
|
||||||
struct tm Tm, *ptm;
|
struct tm Tm, *ptm;
|
||||||
struct timeval timeSecs;
|
struct timeval timeSecs;
|
||||||
|
|
|
@ -38,7 +38,7 @@ static FORCE_INLINE int32_t getSkipListNodeRandomHeight(SSkipList *pSkipList) {
|
||||||
const uint32_t factor = 4;
|
const uint32_t factor = 4;
|
||||||
|
|
||||||
int32_t n = 1;
|
int32_t n = 1;
|
||||||
while ((rand() % factor) == 0 && n <= pSkipList->maxLevel) {
|
while ((taosRand() % factor) == 0 && n <= pSkipList->maxLevel) {
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -278,7 +278,7 @@ int taosOpenUdpSocket(uint32_t ip, uint16_t port) {
|
||||||
/* bind socket to local address */
|
/* bind socket to local address */
|
||||||
if (bind(sockFd, (struct sockaddr *)&localAddr, sizeof(localAddr)) < 0) {
|
if (bind(sockFd, (struct sockaddr *)&localAddr, sizeof(localAddr)) < 0) {
|
||||||
uError("failed to bind udp socket: %d (%s), 0x%x:%hu", errno, strerror(errno), ip, port);
|
uError("failed to bind udp socket: %d (%s), 0x%x:%hu", errno, strerror(errno), ip, port);
|
||||||
taosCloseSocket(sockFd);
|
close(sockFd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ int taosOpenTcpClientSocket(uint32_t destIp, uint16_t destPort, uint32_t clientI
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
//uError("failed to connect socket, ip:0x%x, port:%hu(%s)", destIp, destPort, strerror(errno));
|
//uError("failed to connect socket, ip:0x%x, port:%hu(%s)", destIp, destPort, strerror(errno));
|
||||||
taosCloseSocket(sockFd);
|
close(sockFd);
|
||||||
sockFd = -1;
|
sockFd = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,49 +72,6 @@ void deltaToUtcInitOnce() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t user_mktime(struct tm * tm)
|
|
||||||
{
|
|
||||||
#define TAOS_MINUTE 60
|
|
||||||
#define TAOS_HOUR (60*TAOS_MINUTE)
|
|
||||||
#define TAOS_DAY (24*TAOS_HOUR)
|
|
||||||
#define TAOS_YEAR (365*TAOS_DAY)
|
|
||||||
|
|
||||||
static int month[12] = {
|
|
||||||
0,
|
|
||||||
TAOS_DAY*(31),
|
|
||||||
TAOS_DAY*(31+29),
|
|
||||||
TAOS_DAY*(31+29+31),
|
|
||||||
TAOS_DAY*(31+29+31+30),
|
|
||||||
TAOS_DAY*(31+29+31+30+31),
|
|
||||||
TAOS_DAY*(31+29+31+30+31+30),
|
|
||||||
TAOS_DAY*(31+29+31+30+31+30+31),
|
|
||||||
TAOS_DAY*(31+29+31+30+31+30+31+31),
|
|
||||||
TAOS_DAY*(31+29+31+30+31+30+31+31+30),
|
|
||||||
TAOS_DAY*(31+29+31+30+31+30+31+31+30+31),
|
|
||||||
TAOS_DAY*(31+29+31+30+31+30+31+31+30+31+30)
|
|
||||||
};
|
|
||||||
|
|
||||||
int64_t res;
|
|
||||||
int year;
|
|
||||||
|
|
||||||
year= tm->tm_year - 70;
|
|
||||||
res= TAOS_YEAR*year + TAOS_DAY*((year+1)/4);
|
|
||||||
res+= month[tm->tm_mon];
|
|
||||||
|
|
||||||
if(tm->tm_mon > 1 && ((year+2)%4)) {
|
|
||||||
res-= TAOS_DAY;
|
|
||||||
}
|
|
||||||
|
|
||||||
res+= TAOS_DAY*(tm->tm_mday-1);
|
|
||||||
res+= TAOS_HOUR*tm->tm_hour;
|
|
||||||
res+= TAOS_MINUTE*tm->tm_min;
|
|
||||||
res+= tm->tm_sec;
|
|
||||||
|
|
||||||
return res + m_deltaUtc;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int64_t parseFraction(char* str, char** end, int32_t timePrec);
|
static int64_t parseFraction(char* str, char** end, int32_t timePrec);
|
||||||
static int32_t parseTimeWithTz(char* timestr, int64_t* time, int32_t timePrec);
|
static int32_t parseTimeWithTz(char* timestr, int64_t* time, int32_t timePrec);
|
||||||
static int32_t parseLocaltime(char* timestr, int64_t* time, int32_t timePrec);
|
static int32_t parseLocaltime(char* timestr, int64_t* time, int32_t timePrec);
|
||||||
|
|
|
@ -139,7 +139,7 @@ static void unlockTimerList(timer_list_t* list) {
|
||||||
int64_t tid = taosGetPthreadId();
|
int64_t tid = taosGetPthreadId();
|
||||||
if (atomic_val_compare_exchange_64(&(list->lockedBy), tid, 0) != tid) {
|
if (atomic_val_compare_exchange_64(&(list->lockedBy), tid, 0) != tid) {
|
||||||
assert(false);
|
assert(false);
|
||||||
tmrError("%d trying to unlock a timer list not locked by current thread.", tid);
|
tmrError("%" PRId64 " trying to unlock a timer list not locked by current thread.", tid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,6 +290,7 @@ static void addToExpired(tmr_obj_t* head) {
|
||||||
SSchedMsg schedMsg;
|
SSchedMsg schedMsg;
|
||||||
schedMsg.fp = NULL;
|
schedMsg.fp = NULL;
|
||||||
schedMsg.tfp = processExpiredTimer;
|
schedMsg.tfp = processExpiredTimer;
|
||||||
|
schedMsg.msg = NULL;
|
||||||
schedMsg.ahandle = head;
|
schedMsg.ahandle = head;
|
||||||
schedMsg.thandle = NULL;
|
schedMsg.thandle = NULL;
|
||||||
taosScheduleTask(tmrQhandle, &schedMsg);
|
taosScheduleTask(tmrQhandle, &schedMsg);
|
||||||
|
@ -513,14 +514,17 @@ static void taosTmrModuleInit(void) {
|
||||||
tmrError("failed to create the mutex for wheel, reason:%s", strerror(errno));
|
tmrError("failed to create the mutex for wheel, reason:%s", strerror(errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
pthread_mutex_lock(&wheel->mutex);
|
||||||
wheel->nextScanAt = now + wheel->resolution;
|
wheel->nextScanAt = now + wheel->resolution;
|
||||||
wheel->index = 0;
|
wheel->index = 0;
|
||||||
wheel->slots = (tmr_obj_t**)calloc(wheel->size, sizeof(tmr_obj_t*));
|
wheel->slots = (tmr_obj_t**)calloc(wheel->size, sizeof(tmr_obj_t*));
|
||||||
if (wheel->slots == NULL) {
|
if (wheel->slots == NULL) {
|
||||||
tmrError("failed to allocate wheel slots");
|
tmrError("failed to allocate wheel slots");
|
||||||
|
pthread_mutex_unlock(&wheel->mutex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
timerMap.size += wheel->size;
|
timerMap.size += wheel->size;
|
||||||
|
pthread_mutex_unlock(&wheel->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
timerMap.count = 0;
|
timerMap.count = 0;
|
||||||
|
|
|
@ -27,6 +27,33 @@
|
||||||
#include "tulog.h"
|
#include "tulog.h"
|
||||||
#include "taoserror.h"
|
#include "taoserror.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef WINDOWS
|
||||||
|
int taosRand(void)
|
||||||
|
{
|
||||||
|
return rand();
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
int taosRand(void)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
int seed;
|
||||||
|
|
||||||
|
fd = open("/dev/urandom", 0);
|
||||||
|
if (fd < 0) {
|
||||||
|
seed = time(0);
|
||||||
|
} else {
|
||||||
|
int len = read(fd, &seed, sizeof(seed));
|
||||||
|
if (len < 0) {
|
||||||
|
seed = time(0);
|
||||||
|
}
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
return seed;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int32_t strdequote(char *z) {
|
int32_t strdequote(char *z) {
|
||||||
if (z == NULL) {
|
if (z == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -434,8 +461,10 @@ void getTmpfilePath(const char *fileNamePrefix, char *dstPath) {
|
||||||
|
|
||||||
strcpy(tmpPath, tmpDir);
|
strcpy(tmpPath, tmpDir);
|
||||||
strcat(tmpPath, tdengineTmpFileNamePrefix);
|
strcat(tmpPath, tdengineTmpFileNamePrefix);
|
||||||
strcat(tmpPath, fileNamePrefix);
|
if (strlen(tmpPath) + strlen(fileNamePrefix) + strlen("-%d-%s") < PATH_MAX) {
|
||||||
strcat(tmpPath, "-%d-%s");
|
strcat(tmpPath, fileNamePrefix);
|
||||||
|
strcat(tmpPath, "-%d-%s");
|
||||||
|
}
|
||||||
|
|
||||||
char rand[8] = {0};
|
char rand[8] = {0};
|
||||||
taosRandStr(rand, tListLen(rand) - 1);
|
taosRandStr(rand, tListLen(rand) - 1);
|
||||||
|
@ -447,7 +476,7 @@ void taosRandStr(char* str, int32_t size) {
|
||||||
int32_t len = 39;
|
int32_t len = 39;
|
||||||
|
|
||||||
for(int32_t i = 0; i < size; ++i) {
|
for(int32_t i = 0; i < size; ++i) {
|
||||||
str[i] = set[rand()%len];
|
str[i] = set[taosRand()%len];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -557,7 +586,7 @@ bool taosGetVersionNumber(char *versionStr, int *versionNubmer) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int versionNumberPos[4] = {0};
|
int versionNumberPos[5] = {0};
|
||||||
int len = strlen(versionStr);
|
int len = strlen(versionStr);
|
||||||
int dot = 0;
|
int dot = 0;
|
||||||
for (int pos = 0; pos < len && dot < 4; ++pos) {
|
for (int pos = 0; pos < len && dot < 4; ++pos) {
|
||||||
|
@ -709,7 +738,7 @@ void taosRemoveDir(char *rootDir) {
|
||||||
if (de->d_type & DT_DIR) {
|
if (de->d_type & DT_DIR) {
|
||||||
taosRemoveDir(filename);
|
taosRemoveDir(filename);
|
||||||
} else {
|
} else {
|
||||||
remove(filename);
|
(void)remove(filename);
|
||||||
uPrint("file:%s is removed", filename);
|
uPrint("file:%s is removed", filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ typedef struct {
|
||||||
int32_t refCount; // reference count
|
int32_t refCount; // reference count
|
||||||
int status;
|
int status;
|
||||||
int8_t role;
|
int8_t role;
|
||||||
|
int8_t accessState;
|
||||||
int64_t version; // current version
|
int64_t version; // current version
|
||||||
int64_t fversion; // version on saved data file
|
int64_t fversion; // version on saved data file
|
||||||
void *wqueue;
|
void *wqueue;
|
||||||
|
|
|
@ -195,6 +195,7 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) {
|
||||||
pVnode->version = 0;
|
pVnode->version = 0;
|
||||||
pVnode->tsdbCfg.tsdbId = pVnode->vgId;
|
pVnode->tsdbCfg.tsdbId = pVnode->vgId;
|
||||||
pVnode->rootDir = strdup(rootDir);
|
pVnode->rootDir = strdup(rootDir);
|
||||||
|
pVnode->accessState = TSDB_VN_ALL_ACCCESS;
|
||||||
|
|
||||||
int32_t code = vnodeReadCfg(pVnode);
|
int32_t code = vnodeReadCfg(pVnode);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
@ -431,6 +432,20 @@ void vnodeBuildStatusMsg(void *param) {
|
||||||
taosHashDestroyIter(pIter);
|
taosHashDestroyIter(pIter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void vnodeSetAccess(SDMVgroupAccess *pAccess, int32_t numOfVnodes) {
|
||||||
|
for (int32_t i = 0; i < numOfVnodes; ++i) {
|
||||||
|
pAccess[i].vgId = htonl(pAccess[i].vgId);
|
||||||
|
SVnodeObj *pVnode = vnodeAccquireVnode(pAccess[i].vgId);
|
||||||
|
if (pVnode != NULL) {
|
||||||
|
pVnode->accessState = pAccess[i].accessState;
|
||||||
|
if (pVnode->accessState != TSDB_VN_ALL_ACCCESS) {
|
||||||
|
vTrace("vgId:%d, access state is set to %d", pAccess[i].vgId)
|
||||||
|
}
|
||||||
|
vnodeRelease(pVnode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void vnodeCleanUp(SVnodeObj *pVnode) {
|
static void vnodeCleanUp(SVnodeObj *pVnode) {
|
||||||
// remove from hash, so new messages wont be consumed
|
// remove from hash, so new messages wont be consumed
|
||||||
taosHashRemove(tsDnodeVnodesHash, (const char *)&pVnode->vgId, sizeof(int32_t));
|
taosHashRemove(tsDnodeVnodesHash, (const char *)&pVnode->vgId, sizeof(int32_t));
|
||||||
|
|
|
@ -53,6 +53,10 @@ int32_t vnodeProcessWrite(void *param1, int qtype, void *param2, void *item) {
|
||||||
if (vnodeProcessWriteMsgFp[pHead->msgType] == NULL)
|
if (vnodeProcessWriteMsgFp[pHead->msgType] == NULL)
|
||||||
return TSDB_CODE_VND_MSG_NOT_PROCESSED;
|
return TSDB_CODE_VND_MSG_NOT_PROCESSED;
|
||||||
|
|
||||||
|
if (!(pVnode->accessState & TSDB_VN_WRITE_ACCCESS)) {
|
||||||
|
return TSDB_CODE_VND_NO_WRITE_AUTH;
|
||||||
|
}
|
||||||
|
|
||||||
if (pHead->version == 0) { // from client or CQ
|
if (pHead->version == 0) { // from client or CQ
|
||||||
if (pVnode->status != TAOS_VN_STATUS_READY)
|
if (pVnode->status != TAOS_VN_STATUS_READY)
|
||||||
return TSDB_CODE_VND_INVALID_VGROUP_ID; // it may be in deleting or closing state
|
return TSDB_CODE_VND_INVALID_VGROUP_ID; // it may be in deleting or closing state
|
||||||
|
|
|
@ -114,46 +114,46 @@ sql drop table tb
|
||||||
sql drop table mt
|
sql drop table mt
|
||||||
|
|
||||||
sleep 3000
|
sleep 3000
|
||||||
## ALTER TABLE WHILE STREAMING [TBASE271]
|
### ALTER TABLE WHILE STREAMING [TBASE271]
|
||||||
sql create table tb1 (ts timestamp, c1 int, c2 nchar(5), c3 int)
|
#sql create table tb1 (ts timestamp, c1 int, c2 nchar(5), c3 int)
|
||||||
sql create table strm as select count(*), avg(c1), first(c2), sum(c3) from tb1 interval(2s)
|
#sql create table strm as select count(*), avg(c1), first(c2), sum(c3) from tb1 interval(2s)
|
||||||
sql select * from strm
|
#sql select * from strm
|
||||||
if $rows != 0 then
|
#if $rows != 0 then
|
||||||
return -1
|
# return -1
|
||||||
endi
|
#endi
|
||||||
#sleep 12000
|
##sleep 12000
|
||||||
sql insert into tb1 values (now, 1, 'taos', 1)
|
#sql insert into tb1 values (now, 1, 'taos', 1)
|
||||||
sleep 20000
|
#sleep 20000
|
||||||
sql select * from strm
|
#sql select * from strm
|
||||||
print rows = $rows
|
#print rows = $rows
|
||||||
if $rows != 1 then
|
#if $rows != 1 then
|
||||||
return -1
|
# return -1
|
||||||
endi
|
#endi
|
||||||
if $data04 != 1 then
|
#if $data04 != 1 then
|
||||||
return -1
|
# return -1
|
||||||
endi
|
#endi
|
||||||
sql alter table tb1 drop column c3
|
#sql alter table tb1 drop column c3
|
||||||
sleep 6000
|
#sleep 6000
|
||||||
sql insert into tb1 values (now, 2, 'taos')
|
#sql insert into tb1 values (now, 2, 'taos')
|
||||||
sleep 30000
|
#sleep 30000
|
||||||
sql select * from strm
|
#sql select * from strm
|
||||||
if $rows != 2 then
|
#if $rows != 2 then
|
||||||
return -1
|
# return -1
|
||||||
endi
|
#endi
|
||||||
if $data04 != 1 then
|
#if $data04 != 1 then
|
||||||
return -1
|
# return -1
|
||||||
endi
|
#endi
|
||||||
sql alter table tb1 add column c3 int
|
#sql alter table tb1 add column c3 int
|
||||||
sleep 6000
|
#sleep 6000
|
||||||
sql insert into tb1 values (now, 3, 'taos', 3);
|
#sql insert into tb1 values (now, 3, 'taos', 3);
|
||||||
sleep 3000
|
#sleep 3000
|
||||||
sql select * from strm
|
#sql select * from strm
|
||||||
if $rows != 3 then
|
#if $rows != 3 then
|
||||||
return -1
|
# return -1
|
||||||
endi
|
#endi
|
||||||
if $data04 != 1 then
|
#if $data04 != 1 then
|
||||||
return -1
|
# return -1
|
||||||
endi
|
#endi
|
||||||
|
|
||||||
## ALTER TABLE AND INSERT BY COLUMNS
|
## ALTER TABLE AND INSERT BY COLUMNS
|
||||||
sql create table mt (ts timestamp, c1 int, c2 int) tags(t1 int)
|
sql create table mt (ts timestamp, c1 int, c2 int) tags(t1 int)
|
||||||
|
|
|
@ -61,6 +61,7 @@ run general/parser/limit1_stb.sim
|
||||||
|
|
||||||
print ================== restart server to commit data into disk
|
print ================== restart server to commit data into disk
|
||||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
sleep 5000
|
||||||
system sh/exec.sh -n dnode1 -s start
|
system sh/exec.sh -n dnode1 -s start
|
||||||
print ================== server restart completed
|
print ================== server restart completed
|
||||||
|
|
||||||
|
|
|
@ -206,68 +206,70 @@ endi
|
||||||
|
|
||||||
################# binary
|
################# binary
|
||||||
sql alter table st41 set tag tag_binary = "shanghai"
|
sql alter table st41 set tag tag_binary = "shanghai"
|
||||||
sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
if $data23 != shanghai then
|
if $data00 != shanghai then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
##### test 'space' case
|
##### test 'space' case
|
||||||
#$tagvalue = '
|
system_content echo ' ' | sed 's/ //g' | tr -d '\n' # Construct an empty result for later result checking
|
||||||
#$tagvalue = $tagvalue '
|
|
||||||
#sql alter table st41 set tag tag_binary = $tagvalue
|
|
||||||
sql alter table st41 set tag tag_binary = ""
|
sql alter table st41 set tag tag_binary = ""
|
||||||
#sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
#if $data23 != $tagvalue then
|
if $data00 != $system_content then
|
||||||
# return -1
|
print expect [ $system_content ], actual [ $data00 ]
|
||||||
#endi
|
|
||||||
sql alter table st41 set tag tag_binary = "NULL"
|
|
||||||
sql describe st41
|
|
||||||
if $data23 != NULL then
|
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
sql alter table st41 set tag tag_binary = "NULL"
|
||||||
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
|
if $data00 != NULL then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
sql alter table st41 set tag tag_binary = NULL
|
sql alter table st41 set tag tag_binary = NULL
|
||||||
sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
if $data23 != NULL then
|
if $data00 != NULL then
|
||||||
print ==8== expect: NULL, actually: $data23
|
print ==8== expect: NULL, actually: $data23
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
################### nchar
|
################### nchar
|
||||||
sql alter table st41 set tag tag_nchar = "<22><>˼<EFBFBD><CBBC><EFBFBD><EFBFBD>"
|
sql alter table st41 set tag tag_nchar = "<22><>˼<EFBFBD><CBBC><EFBFBD><EFBFBD>"
|
||||||
sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
#sleep 1000
|
#sleep 1000
|
||||||
#if $data33 != <20><>˼<EFBFBD><CBBC><EFBFBD><EFBFBD> then
|
#if $data01 != <20><>˼<EFBFBD><CBBC><EFBFBD><EFBFBD> then
|
||||||
# print ==== expect <20><>˼<EFBFBD><CBBC><EFBFBD><EFBFBD>, actually $data33
|
# print ==== expect <20><>˼<EFBFBD><CBBC><EFBFBD><EFBFBD>, actually $data01
|
||||||
# return -1
|
# return -1
|
||||||
#endi
|
#endi
|
||||||
##### test 'space' case
|
##### test 'space' case
|
||||||
#$tagvalue = '
|
#$tagvalue = '
|
||||||
#$tagvalue = $tagvalue '
|
#$tagvalue = $tagvalue '
|
||||||
sql alter table st41 set tag tag_nchar = ''
|
sql alter table st41 set tag tag_nchar = ''
|
||||||
#sql describe st41
|
#sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
#if $data33 != $tagvalue then
|
#if $data01 != $tagvalue then
|
||||||
# return -1
|
# return -1
|
||||||
#endi
|
#endi
|
||||||
sql alter table st41 set tag tag_nchar = "NULL"
|
sql alter table st41 set tag tag_nchar = "NULL"
|
||||||
sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
if $data33 != NULL then
|
if $data01 != NULL then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql alter table st41 set tag tag_nchar = NULL
|
sql alter table st41 set tag tag_nchar = NULL
|
||||||
#sql describe st41
|
#sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
#if $data33 != then
|
#if $data01 != then
|
||||||
# print ==9== expect , actually $data33
|
# print ==9== expect , actually $data01
|
||||||
# return -1
|
# return -1
|
||||||
#endi
|
#endi
|
||||||
|
|
||||||
################### int
|
################### int
|
||||||
sql alter table st41 set tag tag_int = -2147483647
|
sql alter table st41 set tag tag_int = -2147483647
|
||||||
sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
if $data43 != -2147483647 then
|
if $data02 != -2147483647 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql alter table st41 set tag tag_int = 2147483647
|
sql alter table st41 set tag tag_int = 2147483647
|
||||||
sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
if $data43 != 2147483647 then
|
if $data02 != 2147483647 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -275,19 +277,19 @@ sql_error alter table st41 set tag tag_int = -2147483648
|
||||||
sql_error alter table st41 set tag tag_int = 2147483648
|
sql_error alter table st41 set tag tag_int = 2147483648
|
||||||
|
|
||||||
sql alter table st41 set tag tag_int = '-379'
|
sql alter table st41 set tag tag_int = '-379'
|
||||||
sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
if $data43 != -379 then
|
if $data02 != -379 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql alter table st41 set tag tag_int = -2000
|
sql alter table st41 set tag tag_int = -2000
|
||||||
sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
if $data43 != -2000 then
|
if $data02 != -2000 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql alter table st41 set tag tag_int = NULL
|
sql alter table st41 set tag tag_int = NULL
|
||||||
sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
if $data43 != NULL then
|
if $data02 != NULL then
|
||||||
print ==10== expect: NULL, actually: $data43
|
print ==10== expect: NULL, actually: $data02
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql alter table st41 set tag tag_int = 'NULL'
|
sql alter table st41 set tag tag_int = 'NULL'
|
||||||
|
@ -296,34 +298,34 @@ sql_error alter table st41 set tag tag_int = abc379
|
||||||
|
|
||||||
################### bool
|
################### bool
|
||||||
sql alter table st41 set tag tag_bool = 'true'
|
sql alter table st41 set tag tag_bool = 'true'
|
||||||
sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
if $data53 != true then
|
if $data03 != 1 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql alter table st41 set tag tag_bool = 'false'
|
sql alter table st41 set tag tag_bool = 'false'
|
||||||
sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
if $data53 != false then
|
if $data03 != 0 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql alter table st41 set tag tag_bool = 0
|
sql alter table st41 set tag tag_bool = 0
|
||||||
sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
if $data53 != false then
|
if $data03 != 0 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql alter table st41 set tag tag_bool = 123
|
sql alter table st41 set tag tag_bool = 123
|
||||||
sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
if $data53 != true then
|
if $data03 != 1 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql alter table st41 set tag tag_bool = 'NULL'
|
sql alter table st41 set tag tag_bool = 'NULL'
|
||||||
sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
if $data53 != NULL then
|
if $data03 != NULL then
|
||||||
print ==14== expect: NULL, actually: $data53
|
print ==14== expect: NULL, actually: $data03
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql alter table st41 set tag tag_bool = NULL
|
sql alter table st41 set tag tag_bool = NULL
|
||||||
sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
if $data53 != NULL then
|
if $data03 != NULL then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -333,50 +335,51 @@ sql_error alter table st41 set tag tag_bool = abc379
|
||||||
|
|
||||||
################### float
|
################### float
|
||||||
sql alter table st41 set tag tag_float = -32
|
sql alter table st41 set tag tag_float = -32
|
||||||
sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
if $data63 != -32.000000 then
|
if $data04 != -32.00000 then
|
||||||
|
print expect -32.00000 actual $data04
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql alter table st41 set tag tag_float = 54.123456
|
sql alter table st41 set tag tag_float = 54.123456
|
||||||
sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
if $data63 != 54.123455 then
|
if $data04 != 54.123455 then
|
||||||
print ==15== expect: 54.123455, actually: $data63
|
print ==15== expect: 54.123455, actually: $data04
|
||||||
# return -1
|
# return -1
|
||||||
endi
|
endi
|
||||||
sql alter table st41 set tag tag_float = 54.12345
|
sql alter table st41 set tag tag_float = 54.12345
|
||||||
sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
if $data63 != 54.123451 then
|
if $data04 != 54.12345 then
|
||||||
print ==16== expect: 54.123451, actually: $data63
|
print ==16== expect: 54.12345, actually: $data04
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql alter table st41 set tag tag_float = 54.12345678
|
sql alter table st41 set tag tag_float = 54.12345678
|
||||||
sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
if $data63 != 54.123455 then
|
if $data04 != 54.12346 then
|
||||||
print ==11== expect: 54.123455, actually : $data63
|
print ==11== expect: 54.12346, actually : $data04
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql alter table st41 set tag tag_float = NULL
|
sql alter table st41 set tag tag_float = NULL
|
||||||
sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
if $data63 != NULL then
|
if $data04 != NULL then
|
||||||
print ==12== expect: NULL, actually : $data63
|
print ==12== expect: NULL, actually : $data04
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql alter table st41 set tag tag_float = 'NULL'
|
sql alter table st41 set tag tag_float = 'NULL'
|
||||||
sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
if $data63 != NULL then
|
if $data04 != NULL then
|
||||||
print ==17== expect: NULL, actually : $data63
|
print ==17== expect: NULL, actually : $data04
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql alter table st41 set tag tag_float = '54.123456'
|
sql alter table st41 set tag tag_float = '54.123456'
|
||||||
sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
if $data63 != 54.123455 then
|
if $data04 != 54.12346 then
|
||||||
print ==18== expect: 54.123455, actually : $data63
|
print ==18== expect: 54.12346, actually : $data04
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql alter table st41 set tag tag_float = '-54.123456'
|
sql alter table st41 set tag tag_float = '-54.123456'
|
||||||
sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
if $data63 != -54.123455 then
|
if $data04 != -54.12346 then
|
||||||
print ==19== expect: -54.123455, actually : $data63
|
print ==19== expect: -54.12346, actually : $data04
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql_error alter table st41 set tag tag_float = ''
|
sql_error alter table st41 set tag tag_float = ''
|
||||||
|
@ -387,30 +390,32 @@ sql_error alter table st41 set tag tag_float = abc
|
||||||
|
|
||||||
################### double
|
################### double
|
||||||
sql alter table st41 set tag tag_double = -92
|
sql alter table st41 set tag tag_double = -92
|
||||||
sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
if $data73 != -92.000000 then
|
if $data05 != -92.000000000 then
|
||||||
|
print expect -92.000000000 actual $data05
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql alter table st41 set tag tag_double = 184
|
sql alter table st41 set tag tag_double = 184
|
||||||
sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
if $data73 != 184.000000 then
|
if $data05 != 184.000000000 then
|
||||||
|
print expect 184.000000000 actual $data05
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql alter table st41 set tag tag_double = '-2456'
|
sql alter table st41 set tag tag_double = '-2456'
|
||||||
sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
if $data73 != -2456.000000 then
|
if $data05 != -2456.000000000 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql alter table st41 set tag tag_double = NULL
|
sql alter table st41 set tag tag_double = NULL
|
||||||
sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
if $data73 != NULL then
|
if $data05 != NULL then
|
||||||
print ==13== expect: NULL, actually : $data73
|
print ==13== expect: NULL, actually : $data05
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql alter table st41 set tag tag_double = 'NULL'
|
sql alter table st41 set tag tag_double = 'NULL'
|
||||||
sql describe st41
|
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||||
if $data73 != NULL then
|
if $data05 != NULL then
|
||||||
print ==20== expect: NULL, actually : $data73
|
print ==20== expect: NULL, actually : $data05
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql_error alter table st41 set tag tag_double = ''
|
sql_error alter table st41 set tag tag_double = ''
|
||||||
|
@ -427,23 +432,22 @@ sql alter table st51 set tag tag_bigint = '-379'
|
||||||
sql alter table st51 set tag tag_bigint = -2000
|
sql alter table st51 set tag tag_bigint = -2000
|
||||||
sql alter table st51 set tag tag_bigint = NULL
|
sql alter table st51 set tag tag_bigint = NULL
|
||||||
sql alter table st51 set tag tag_bigint = 9223372036854775807
|
sql alter table st51 set tag tag_bigint = 9223372036854775807
|
||||||
sql describe st51
|
sql select tag_bigint, tag_smallint, tag_tinyint from st51
|
||||||
if $data23 != 9223372036854775807 then
|
if $data00 != 9223372036854775807 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql alter table st51 set tag tag_bigint = 9223372036854775808
|
sql alter table st51 set tag tag_bigint = 9223372036854775808
|
||||||
sql describe st51
|
sql select tag_bigint, tag_smallint, tag_tinyint from st51
|
||||||
if $data23 != 9223372036854775807 then
|
if $data00 != 9223372036854775807 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql alter table st51 set tag tag_bigint = -9223372036854775807
|
sql alter table st51 set tag tag_bigint = -9223372036854775807
|
||||||
sql describe st51
|
sql select tag_bigint, tag_smallint, tag_tinyint from st51
|
||||||
if $data23 != -9223372036854775807 then
|
if $data00 != -9223372036854775807 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql_error alter table st51 set tag tag_bigint = -9223372036854775808
|
sql_error alter table st51 set tag tag_bigint = -9223372036854775808
|
||||||
|
|
||||||
|
|
||||||
sql alter table st51 set tag tag_bigint = 'NULL'
|
sql alter table st51 set tag tag_bigint = 'NULL'
|
||||||
sql_error alter table st51 set tag tag_bigint = ''
|
sql_error alter table st51 set tag tag_bigint = ''
|
||||||
sql_error alter table st51 set tag tag_bigint = abc379
|
sql_error alter table st51 set tag tag_bigint = abc379
|
||||||
|
@ -452,15 +456,15 @@ sql_error alter table st51 set tag tag_bigint = abc379
|
||||||
sql alter table st51 set tag tag_smallint = -2000
|
sql alter table st51 set tag tag_smallint = -2000
|
||||||
sql alter table st51 set tag tag_smallint = NULL
|
sql alter table st51 set tag tag_smallint = NULL
|
||||||
sql alter table st51 set tag tag_smallint = 32767
|
sql alter table st51 set tag tag_smallint = 32767
|
||||||
sql describe st51
|
sql select tag_bigint, tag_smallint, tag_tinyint from st51
|
||||||
if $data33 != 32767 then
|
if $data01 != 32767 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql_error alter table st51 set tag tag_smallint = 32768
|
sql_error alter table st51 set tag tag_smallint = 32768
|
||||||
|
|
||||||
sql alter table st51 set tag tag_smallint = -32767
|
sql alter table st51 set tag tag_smallint = -32767
|
||||||
sql describe st51
|
sql select tag_bigint, tag_smallint, tag_tinyint from st51
|
||||||
if $data33 != -32767 then
|
if $data01 != -32767 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql_error alter table st51 set tag tag_smallint = -32768
|
sql_error alter table st51 set tag tag_smallint = -32768
|
||||||
|
@ -473,13 +477,13 @@ sql_error alter table st51 set tag tag_smallint = abc379
|
||||||
sql alter table st51 set tag tag_tinyint = -127
|
sql alter table st51 set tag tag_tinyint = -127
|
||||||
sql alter table st51 set tag tag_tinyint = NULL
|
sql alter table st51 set tag tag_tinyint = NULL
|
||||||
sql alter table st51 set tag tag_tinyint = 127
|
sql alter table st51 set tag tag_tinyint = 127
|
||||||
sql describe st51
|
sql select tag_bigint, tag_smallint, tag_tinyint from st51
|
||||||
if $data43 != 127 then
|
if $data02 != 127 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql alter table st51 set tag tag_tinyint = -127
|
sql alter table st51 set tag tag_tinyint = -127
|
||||||
sql describe st51
|
sql select tag_bigint, tag_smallint, tag_tinyint from st51
|
||||||
if $data43 != -127 then
|
if $data02 != -127 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql_error alter table st51 set tag tag_tinyint = '-128'
|
sql_error alter table st51 set tag tag_tinyint = '-128'
|
||||||
|
|
|
@ -82,26 +82,22 @@ sleep 2000
|
||||||
run general/parser/groupby.sim
|
run general/parser/groupby.sim
|
||||||
sleep 2000
|
sleep 2000
|
||||||
run general/parser/set_tag_vals.sim
|
run general/parser/set_tag_vals.sim
|
||||||
|
|
||||||
sleep 2000
|
sleep 2000
|
||||||
run general/parser/slimit_alter_tags.sim # persistent failed
|
run general/parser/slimit_alter_tags.sim # persistent failed
|
||||||
|
|
||||||
sleep 2000
|
sleep 2000
|
||||||
run general/parser/join.sim
|
run general/parser/join.sim
|
||||||
sleep 2000
|
sleep 2000
|
||||||
run general/parser/join_multivnode.sim
|
run general/parser/join_multivnode.sim
|
||||||
|
|
||||||
sleep 2000
|
sleep 2000
|
||||||
#run general/parser/repeatAlter.sim
|
run general/parser/repeatAlter.sim
|
||||||
sleep 2000
|
|
||||||
#run general/parser/repeatStream.sim
|
|
||||||
|
|
||||||
sleep 2000
|
sleep 2000
|
||||||
run general/parser/binary_escapeCharacter.sim
|
run general/parser/binary_escapeCharacter.sim
|
||||||
sleep 2000
|
sleep 2000
|
||||||
run general/parser/bug.sim
|
run general/parser/bug.sim
|
||||||
|
|
||||||
sleep 2000
|
#sleep 2000
|
||||||
run general/parser/stream_on_sys.sim
|
#run general/parser/repeatStream.sim
|
||||||
sleep 2000
|
#sleep 2000
|
||||||
run general/parser/stream.sim
|
#run general/parser/stream_on_sys.sim
|
||||||
|
#sleep 2000
|
||||||
|
#run general/parser/stream.sim
|
|
@ -100,7 +100,7 @@ cd ../../../debug; make
|
||||||
./test.sh -f general/insert/query_multi_file.sim
|
./test.sh -f general/insert/query_multi_file.sim
|
||||||
./test.sh -f general/insert/tcp.sim
|
./test.sh -f general/insert/tcp.sim
|
||||||
|
|
||||||
#./test.sh -f general/parser/alter.sim
|
./test.sh -f general/parser/alter.sim
|
||||||
./test.sh -f general/parser/alter1.sim
|
./test.sh -f general/parser/alter1.sim
|
||||||
./test.sh -f general/parser/alter_stable.sim
|
./test.sh -f general/parser/alter_stable.sim
|
||||||
./test.sh -f general/parser/auto_create_tb.sim
|
./test.sh -f general/parser/auto_create_tb.sim
|
||||||
|
@ -117,10 +117,10 @@ cd ../../../debug; make
|
||||||
./test.sh -f general/parser/import_commit3.sim
|
./test.sh -f general/parser/import_commit3.sim
|
||||||
./test.sh -f general/parser/insert_tb.sim
|
./test.sh -f general/parser/insert_tb.sim
|
||||||
./test.sh -f general/parser/first_last.sim
|
./test.sh -f general/parser/first_last.sim
|
||||||
#unsupport ./test.sh -f general/parser/import_file.sim
|
#./test.sh -f general/parser/import_file.sim
|
||||||
./test.sh -f general/parser/lastrow.sim
|
./test.sh -f general/parser/lastrow.sim
|
||||||
./test.sh -f general/parser/nchar.sim
|
./test.sh -f general/parser/nchar.sim
|
||||||
#unsupport ./test.sh -f general/parser/null_char.sim
|
#./test.sh -f general/parser/null_char.sim
|
||||||
./test.sh -f general/parser/single_row_in_tb.sim
|
./test.sh -f general/parser/single_row_in_tb.sim
|
||||||
./test.sh -f general/parser/select_from_cache_disk.sim
|
./test.sh -f general/parser/select_from_cache_disk.sim
|
||||||
./test.sh -f general/parser/mixed_blocks.sim
|
./test.sh -f general/parser/mixed_blocks.sim
|
||||||
|
@ -147,10 +147,10 @@ cd ../../../debug; make
|
||||||
./test.sh -f general/parser/join_multivnode.sim
|
./test.sh -f general/parser/join_multivnode.sim
|
||||||
./test.sh -f general/parser/binary_escapeCharacter.sim
|
./test.sh -f general/parser/binary_escapeCharacter.sim
|
||||||
./test.sh -f general/parser/bug.sim
|
./test.sh -f general/parser/bug.sim
|
||||||
#unsupport ./test.sh -f general/parser/stream_on_sys.sim
|
#./test.sh -f general/parser/stream_on_sys.sim
|
||||||
./test.sh -f general/parser/stream.sim
|
./test.sh -f general/parser/stream.sim
|
||||||
#unsupport ./test.sh -f general/parser/repeatAlter.sim
|
./test.sh -f general/parser/repeatAlter.sim
|
||||||
#unsupport ./test.sh -f general/parser/repeatStream.sim
|
#./test.sh -f general/parser/repeatStream.sim
|
||||||
|
|
||||||
./test.sh -f general/stable/disk.sim
|
./test.sh -f general/stable/disk.sim
|
||||||
./test.sh -f general/stable/dnode3.sim
|
./test.sh -f general/stable/dnode3.sim
|
||||||
|
@ -159,20 +159,20 @@ cd ../../../debug; make
|
||||||
./test.sh -f general/stable/values.sim
|
./test.sh -f general/stable/values.sim
|
||||||
./test.sh -f general/stable/vnode3.sim
|
./test.sh -f general/stable/vnode3.sim
|
||||||
|
|
||||||
#./test.sh -f general/stream/metrics_1.sim
|
./test.sh general/stream/stream_1.sim
|
||||||
#./test.sh -f general/stream/metrics_del.sim
|
./test.sh general/stream/stream_2.sim
|
||||||
#./test.sh -f general/stream/metrics_n.sim
|
./test.sh general/stream/stream_3.sim
|
||||||
#./test.sh -f general/stream/metrics_replica1_vnoden.sim
|
./test.sh general/stream/stream_restart.sim
|
||||||
|
./test.sh general/stream/table_1.sim
|
||||||
|
./test.sh general/stream/metrics_1.sim
|
||||||
|
./test.sh general/stream/table_n.sim
|
||||||
|
./test.sh general/stream/metrics_n.sim
|
||||||
|
./test.sh general/stream/table_del.sim
|
||||||
|
./test.sh general/stream/metrics_del.sim
|
||||||
|
./test.sh general/stream/table_replica1_vnoden.sim
|
||||||
|
./test.sh general/stream/metrics_replica1_vnoden.sim
|
||||||
#./test.sh -f general/stream/new_stream.sim
|
#./test.sh -f general/stream/new_stream.sim
|
||||||
#./test.sh -f general/stream/restart_stream.sim
|
#./test.sh -f general/stream/restart_stream.sim
|
||||||
#./test.sh -f general/stream/stream_1.sim
|
|
||||||
#./test.sh -f general/stream/stream_2.sim
|
|
||||||
#./test.sh -f general/stream/stream_3.sim
|
|
||||||
#./test.sh -f general/stream/stream_restart.sim
|
|
||||||
#./test.sh -f general/stream/table_1.sim
|
|
||||||
#./test.sh -f general/stream/table_del.sim
|
|
||||||
#./test.sh -f general/stream/table_n.sim
|
|
||||||
#./test.sh -f general/stream/table_replica1_vnoden.sim
|
|
||||||
|
|
||||||
./test.sh -f general/table/autocreate.sim
|
./test.sh -f general/table/autocreate.sim
|
||||||
./test.sh -f general/table/basic1.sim
|
./test.sh -f general/table/basic1.sim
|
||||||
|
@ -337,7 +337,7 @@ cd ../../../debug; make
|
||||||
./test.sh -f unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim
|
./test.sh -f unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim
|
||||||
./test.sh -f unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim
|
./test.sh -f unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim
|
||||||
./test.sh -f unique/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim
|
./test.sh -f unique/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim
|
||||||
#./test.sh -f unique/arbitrator/dn3_mn1_vnode_delDir.sim # unsupport
|
#./test.sh -f unique/arbitrator/dn3_mn1_vnode_delDir.sim
|
||||||
./test.sh -f unique/arbitrator/dn3_mn1_vnode_nomaster.sim
|
./test.sh -f unique/arbitrator/dn3_mn1_vnode_nomaster.sim
|
||||||
./test.sh -f unique/arbitrator/dn3_mn2_killDnode.sim
|
./test.sh -f unique/arbitrator/dn3_mn2_killDnode.sim
|
||||||
./test.sh -f unique/arbitrator/insert_duplicationTs.sim
|
./test.sh -f unique/arbitrator/insert_duplicationTs.sim
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
system sh/stop_dnodes.sh
|
system sh/stop_dnodes.sh
|
||||||
system sh/deploy.sh -n dnode1 -i 1
|
system sh/deploy.sh -n dnode1 -i 1
|
||||||
system sh/exec.sh -n dnode1 -s start
|
system sh/exec.sh -n dnode1 -s start
|
||||||
|
#system sh/exec.sh -n monitor -s 1
|
||||||
|
system sh/exec.sh -n monitorInterval -s 1
|
||||||
sleep 3000
|
sleep 3000
|
||||||
sql connect
|
sql connect
|
||||||
|
|
||||||
|
@ -25,13 +27,16 @@ endi
|
||||||
if $data05 != 0/10 then
|
if $data05 != 0/10 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
if $data06 != 0.000/unlimited then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
print =============== check usage account
|
print =============== check usage account
|
||||||
sql create database d1
|
sql create database d1 wal 2
|
||||||
sql create database d2
|
sql create database d2 wal 2
|
||||||
sql create database d3
|
sql create database d3 wal 2
|
||||||
sql create database d4
|
sql create database d4 wal 2
|
||||||
sql create database d5
|
sql create database d5 wal 2
|
||||||
|
|
||||||
sql create table d1.t1 (ts timestamp, i int);
|
sql create table d1.t1 (ts timestamp, i int);
|
||||||
sql create user u1 pass "u1"
|
sql create user u1 pass "u1"
|
||||||
|
@ -53,6 +58,75 @@ endi
|
||||||
if $data05 != 0/10 then
|
if $data05 != 0/10 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
if $data06 != 0.000/unlimited then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== step2
|
||||||
|
sql alter account root pass "taosdata" tseries 10 storage 1073741824 streams 10 dbs 5 users 5
|
||||||
|
sql show accounts
|
||||||
|
print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
if $data00 != root then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data02 != 4/5 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data03 != 5/5 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data04 != 1/10 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data05 != 0/10 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data06 != 0.000/1.000 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== step3
|
||||||
|
sql alter account root pass "taosdata" tseries 10 storage 16 streams 10 dbs 5 users 5
|
||||||
|
sql show accounts
|
||||||
|
print $data00 $data01 $data02 $data03 $data04 $data05 $data06
|
||||||
|
if $data00 != root then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data02 != 4/5 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data03 != 5/5 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data04 != 1/10 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data05 != 0/10 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data06 != 0.000/0.000 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== step4
|
||||||
|
sql insert into d1.t1 values(now + 1s, 1)
|
||||||
|
sql insert into d1.t1 values(now + 2s, 2)
|
||||||
|
|
||||||
|
# no write auth
|
||||||
|
sleep 3000
|
||||||
|
sql_error insert into d1.t1 values(now + 3s, 2)
|
||||||
|
sql_error insert into d1.t1 values(now + 4s, 2)
|
||||||
|
|
||||||
|
sql alter account root pass "taosdata" tseries 10 storage 36 streams 10 dbs 5 users 5
|
||||||
|
sleep 3000
|
||||||
|
sql insert into d1.t1 values(now + 5s, 1)
|
||||||
|
sql insert into d1.t1 values(now + 6s, 2)
|
||||||
|
|
||||||
|
# no write auth
|
||||||
|
sleep 3000
|
||||||
|
sql_error insert into d1.t1 values(now + 7s, 2)
|
||||||
|
sql_error insert into d1.t1 values(now + 8s, 2)
|
||||||
|
|
||||||
|
|
||||||
print =============== check grant
|
print =============== check grant
|
||||||
sql_error create database d6
|
sql_error create database d6
|
||||||
|
|
Loading…
Reference in New Issue