Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
38a6d02c
T
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
38a6d02c
编写于
3月 11, 2023
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/main' into fix/main_bugfix_wxy
上级
11e55f02
f3ad6375
变更
58
展开全部
隐藏空白更改
内联
并排
Showing
58 changed file
with
2524 addition
and
2277 deletion
+2524
-2277
Jenkinsfile2
Jenkinsfile2
+2
-3
cmake/taosadapter_CMakeLists.txt.in
cmake/taosadapter_CMakeLists.txt.in
+1
-1
cmake/taostools_CMakeLists.txt.in
cmake/taostools_CMakeLists.txt.in
+1
-1
docs/zh/08-connector/30-python.mdx
docs/zh/08-connector/30-python.mdx
+1
-1
include/common/tmsg.h
include/common/tmsg.h
+8
-3
include/util/taoserror.h
include/util/taoserror.h
+1
-0
source/client/src/clientSml.c
source/client/src/clientSml.c
+74
-49
source/client/src/clientSmlLine.c
source/client/src/clientSmlLine.c
+5
-3
source/common/src/systable.c
source/common/src/systable.c
+2
-0
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+2
-2
source/common/src/tmsg.c
source/common/src/tmsg.c
+41
-1
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
+2
-0
source/dnode/mgmt/mgmt_vnode/src/vmInt.c
source/dnode/mgmt/mgmt_vnode/src/vmInt.c
+1
-1
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+1
-1
source/dnode/mnode/impl/inc/mndVgroup.h
source/dnode/mnode/impl/inc/mndVgroup.h
+2
-1
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+12
-0
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+3
-0
source/dnode/mnode/impl/src/mndMnode.c
source/dnode/mnode/impl/src/mndMnode.c
+3
-0
source/dnode/mnode/impl/src/mndUser.c
source/dnode/mnode/impl/src/mndUser.c
+5
-1
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+11
-7
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+4
-3
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+7
-3
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+20
-1
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+2
-1
source/libs/executor/src/executil.c
source/libs/executor/src/executil.c
+0
-2
source/libs/executor/src/executor.c
source/libs/executor/src/executor.c
+1
-4
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+35
-10
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+1
-2
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+1
-1
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+1
-0
source/libs/parser/src/parInsertSml.c
source/libs/parser/src/parInsertSml.c
+1
-0
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+6
-3
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+2023
-2018
source/libs/parser/test/parAlterToBalanceTest.cpp
source/libs/parser/test/parAlterToBalanceTest.cpp
+13
-0
source/libs/scalar/src/scalar.c
source/libs/scalar/src/scalar.c
+6
-0
source/libs/scalar/src/sclfunc.c
source/libs/scalar/src/sclfunc.c
+5
-5
source/libs/sync/inc/syncReplication.h
source/libs/sync/inc/syncReplication.h
+1
-1
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+6
-11
source/libs/sync/src/syncPipeline.c
source/libs/sync/src/syncPipeline.c
+2
-1
source/libs/sync/src/syncReplication.c
source/libs/sync/src/syncReplication.c
+9
-0
source/libs/sync/src/syncSnapshot.c
source/libs/sync/src/syncSnapshot.c
+3
-7
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+37
-59
source/os/src/osRand.c
source/os/src/osRand.c
+9
-1
source/util/src/terror.c
source/util/src/terror.c
+6
-5
tests/parallel_test/cases.task
tests/parallel_test/cases.task
+1
-1
tests/parallel_test/run_case.sh
tests/parallel_test/run_case.sh
+7
-0
tests/parallel_test/run_container.sh
tests/parallel_test/run_container.sh
+0
-2
tests/script/tsim/db/alter_option.sim
tests/script/tsim/db/alter_option.sim
+0
-2
tests/script/tsim/dnode/offline_reason.sim
tests/script/tsim/dnode/offline_reason.sim
+24
-24
tests/script/tsim/stream/checkStreamSTable1.sim
tests/script/tsim/stream/checkStreamSTable1.sim
+71
-0
tests/script/tsim/tag/tbNameIn.sim
tests/script/tsim/tag/tbNameIn.sim
+10
-0
tests/system-test/2-query/mavg.py
tests/system-test/2-query/mavg.py
+0
-2
tests/system-test/2-query/odbc.py
tests/system-test/2-query/odbc.py
+1
-1
tests/system-test/7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py
tests/system-test/7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py
+11
-11
tests/system-test/7-tmq/tmqConsFromTsdb1-mutilVg.py
tests/system-test/7-tmq/tmqConsFromTsdb1-mutilVg.py
+10
-10
tests/system-test/7-tmq/tmqConsFromTsdb1.py
tests/system-test/7-tmq/tmqConsFromTsdb1.py
+8
-9
tools/shell/inc/shellInt.h
tools/shell/inc/shellInt.h
+1
-1
tools/shell/src/shellArguments.c
tools/shell/src/shellArguments.c
+3
-1
未找到文件。
Jenkinsfile2
浏览文件 @
38a6d02c
...
...
@@ -313,7 +313,8 @@ def pre_test_build_win() {
bat '''
cd %WIN_CONNECTOR_ROOT%
python.exe -m pip install --upgrade pip
python -m pip install .
python -m pip uninstall taospy -y
python -m pip install taospy==2.7.3
xcopy /e/y/i/f %WIN_INTERNAL_ROOT%\\debug\\build\\lib\\taos.dll C:\\Windows\\System32
'''
return 1
...
...
@@ -331,8 +332,6 @@ def run_win_test() {
bat '''
echo "windows test ..."
cd %WIN_CONNECTOR_ROOT%
python.exe -m pip install --upgrade pip
python -m pip install .
xcopy /e/y/i/f %WIN_INTERNAL_ROOT%\\debug\\build\\lib\\taos.dll C:\\Windows\\System32
ls -l C:\\Windows\\System32\\taos.dll
time /t
...
...
cmake/taosadapter_CMakeLists.txt.in
浏览文件 @
38a6d02c
...
...
@@ -2,7 +2,7 @@
# taosadapter
ExternalProject_Add(taosadapter
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
GIT_TAG
97d717d
GIT_TAG
d8059ff
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
BINARY_DIR ""
#BUILD_IN_SOURCE TRUE
...
...
cmake/taostools_CMakeLists.txt.in
浏览文件 @
38a6d02c
...
...
@@ -2,7 +2,7 @@
# taos-tools
ExternalProject_Add(taos-tools
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
GIT_TAG
0111c66
GIT_TAG
41d4f95
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
BINARY_DIR ""
#BUILD_IN_SOURCE TRUE
...
...
docs/zh/08-connector/30-python.mdx
浏览文件 @
38a6d02c
...
...
@@ -32,7 +32,7 @@ Python 连接器的源码托管在 [GitHub](https://github.com/taosdata/taos-con
### 准备
1. 安装 Python。新近版本 taospy 包要求 Python 3.6+。早期版本 taospy 包要求 Python 3.7+。taos-ws-py 包要求 Python 3.7+。如果系统上还没有 Python 可参考 [Python BeginnersGuide](https://wiki.python.org/moin/BeginnersGuide/Download) 安装。
1. 安装 Python。新近版本 taospy 包要求 Python 3.6
.2
+。早期版本 taospy 包要求 Python 3.7+。taos-ws-py 包要求 Python 3.7+。如果系统上还没有 Python 可参考 [Python BeginnersGuide](https://wiki.python.org/moin/BeginnersGuide/Download) 安装。
2. 安装 [pip](https://pypi.org/project/pip/)。大部分情况下 Python 的安装包都自带了 pip 工具, 如果没有请参考 [pip documentation](https://pip.pypa.io/en/stable/installation/) 安装。
3. 如果使用原生连接,还需[安装客户端驱动](../#安装客户端驱动)。客户端软件包含了 TDengine 客户端动态链接库(libtaos.so 或 taos.dll) 和 TDengine CLI。
...
...
include/common/tmsg.h
浏览文件 @
38a6d02c
...
...
@@ -845,6 +845,7 @@ typedef struct {
int8_t
cacheLast
;
int8_t
replications
;
int32_t
sstTrigger
;
int32_t
minRows
;
}
SAlterDbReq
;
int32_t
tSerializeSAlterDbReq
(
void
*
buf
,
int32_t
bufLen
,
SAlterDbReq
*
pReq
);
...
...
@@ -1292,9 +1293,10 @@ int32_t tSerializeSDropIdxReq(void* buf, int32_t bufLen, SDropIndexReq* pReq);
int32_t
tDeserializeSDropIdxReq
(
void
*
buf
,
int32_t
bufLen
,
SDropIndexReq
*
pReq
);
typedef
struct
{
int64_t
dbUid
;
char
db
[
TSDB_DB_FNAME_LEN
];
int64_t
compactStartTime
;
int64_t
dbUid
;
char
db
[
TSDB_DB_FNAME_LEN
];
int64_t
compactStartTime
;
STimeWindow
tw
;
}
SCompactVnodeReq
;
int32_t
tSerializeSCompactVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCompactVnodeReq
*
pReq
);
...
...
@@ -1315,6 +1317,9 @@ typedef struct {
int8_t
strict
;
int8_t
cacheLast
;
int64_t
reserved
[
8
];
// 1st modification
int16_t
sttTrigger
;
int32_t
minRows
;
}
SAlterVnodeConfigReq
;
int32_t
tSerializeSAlterVnodeConfigReq
(
void
*
buf
,
int32_t
bufLen
,
SAlterVnodeConfigReq
*
pReq
);
...
...
include/util/taoserror.h
浏览文件 @
38a6d02c
...
...
@@ -240,6 +240,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_MND_TOO_MANY_USERS TAOS_DEF_ERROR_CODE(0, 0x0355)
#define TSDB_CODE_MND_INVALID_ALTER_OPER TAOS_DEF_ERROR_CODE(0, 0x0356)
#define TSDB_CODE_MND_AUTH_FAILURE TAOS_DEF_ERROR_CODE(0, 0x0357)
#define TSDB_CODE_MND_USER_NOT_AVAILABLE TAOS_DEF_ERROR_CODE(0, 0x0358)
// mnode-stable-part1
#define TSDB_CODE_MND_STB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0360)
...
...
source/client/src/clientSml.c
浏览文件 @
38a6d02c
...
...
@@ -1213,6 +1213,12 @@ static int32_t smlParseLineBottom(SSmlHandle *info) {
static
int32_t
smlInsertData
(
SSmlHandle
*
info
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
(
info
->
pRequest
->
dbList
==
NULL
){
info
->
pRequest
->
dbList
=
taosArrayInit
(
1
,
TSDB_DB_FNAME_LEN
);
}
void
*
data
=
taosArrayReserve
(
info
->
pRequest
->
dbList
,
1
);
memcpy
(
data
,
info
->
pRequest
->
pDb
,
TSDB_DB_FNAME_LEN
>
strlen
(
info
->
pRequest
->
pDb
)
?
strlen
(
info
->
pRequest
->
pDb
)
:
TSDB_DB_FNAME_LEN
);
SSmlTableInfo
**
oneTable
=
(
SSmlTableInfo
**
)
taosHashIterate
(
info
->
childTables
,
NULL
);
while
(
oneTable
)
{
SSmlTableInfo
*
tableData
=
*
oneTable
;
...
...
@@ -1221,6 +1227,11 @@ static int32_t smlInsertData(SSmlHandle *info) {
tstrncpy
(
pName
.
dbname
,
info
->
pRequest
->
pDb
,
sizeof
(
pName
.
dbname
));
memcpy
(
pName
.
tname
,
tableData
->
childTableName
,
strlen
(
tableData
->
childTableName
));
if
(
info
->
pRequest
->
tableList
==
NULL
){
info
->
pRequest
->
tableList
=
taosArrayInit
(
1
,
sizeof
(
SName
));
}
taosArrayPush
(
info
->
pRequest
->
tableList
,
&
pName
);
SRequestConnInfo
conn
=
{
0
};
conn
.
pTrans
=
info
->
taos
->
pAppInfo
->
pTransporter
;
conn
.
requestId
=
info
->
pRequest
->
requestId
;
...
...
@@ -1422,6 +1433,7 @@ static int smlProcess(SSmlHandle *info, char *lines[], char *rawLine, char *rawL
do
{
code
=
smlModifyDBSchemas
(
info
);
if
(
code
==
0
)
break
;
taosMsleep
(
200
);
}
while
(
retryNum
++
<
taosHashGetSize
(
info
->
superTables
)
*
MAX_RETRY_TIMES
);
if
(
code
!=
0
)
{
...
...
@@ -1446,62 +1458,75 @@ TAOS_RES *taos_schemaless_insert_inner(TAOS *taos, char *lines[], char *rawLine,
terrno
=
TSDB_CODE_TSC_DISCONNECTED
;
return
NULL
;
}
SRequestObj
*
request
=
NULL
;
SSmlHandle
*
info
=
NULL
;
while
(
1
){
request
=
(
SRequestObj
*
)
createRequest
(
*
(
int64_t
*
)
taos
,
TSDB_SQL_INSERT
,
reqid
);
if
(
request
==
NULL
)
{
uError
(
"SML:taos_schemaless_insert error request is null"
);
return
NULL
;
}
SRequestObj
*
request
=
(
SRequestObj
*
)
createRequest
(
*
(
int64_t
*
)
taos
,
TSDB_SQL_INSERT
,
reqid
);
if
(
request
==
NULL
)
{
uError
(
"SML:taos_schemaless_insert error request is null"
);
return
NULL
;
}
info
=
smlBuildSmlInfo
(
taos
);
if
(
info
==
NULL
)
{
request
->
code
=
TSDB_CODE_OUT_OF_MEMORY
;
uError
(
"SML:taos_schemaless_insert error SSmlHandle is null"
);
return
(
TAOS_RES
*
)
request
;
}
info
->
pRequest
=
request
;
info
->
isRawLine
=
rawLine
!=
NULL
;
info
->
ttl
=
ttl
;
info
->
precision
=
precision
;
info
->
protocol
=
(
TSDB_SML_PROTOCOL_TYPE
)
protocol
;
info
->
msgBuf
.
buf
=
info
->
pRequest
->
msgBuf
;
info
->
msgBuf
.
len
=
ERROR_MSG_BUF_DEFAULT_SIZE
;
info
->
lineNum
=
numLines
;
SSmlMsgBuf
msg
=
{
ERROR_MSG_BUF_DEFAULT_SIZE
,
request
->
msgBuf
};
if
(
request
->
pDb
==
NULL
)
{
request
->
code
=
TSDB_CODE_PAR_DB_NOT_SPECIFIED
;
smlBuildInvalidDataMsg
(
&
msg
,
"Database not specified"
,
NULL
);
goto
end
;
}
SSmlHandle
*
info
=
smlBuildSmlInfo
(
taos
);
if
(
info
==
NULL
)
{
request
->
code
=
TSDB_CODE_OUT_OF_MEMORY
;
uError
(
"SML:taos_schemaless_insert error SSmlHandle is null"
);
return
(
TAOS_RES
*
)
request
;
}
info
->
pRequest
=
request
;
info
->
isRawLine
=
rawLine
!=
NULL
;
info
->
ttl
=
ttl
;
info
->
precision
=
precision
;
info
->
protocol
=
(
TSDB_SML_PROTOCOL_TYPE
)
protocol
;
info
->
msgBuf
.
buf
=
info
->
pRequest
->
msgBuf
;
info
->
msgBuf
.
len
=
ERROR_MSG_BUF_DEFAULT_SIZE
;
info
->
lineNum
=
numLines
;
SSmlMsgBuf
msg
=
{
ERROR_MSG_BUF_DEFAULT_SIZE
,
request
->
msgBuf
};
if
(
request
->
pDb
==
NULL
)
{
request
->
code
=
TSDB_CODE_PAR_DB_NOT_SPECIFIED
;
smlBuildInvalidDataMsg
(
&
msg
,
"Database not specified"
,
NULL
);
goto
end
;
}
if
(
protocol
<
TSDB_SML_LINE_PROTOCOL
||
protocol
>
TSDB_SML_JSON_PROTOCOL
)
{
request
->
code
=
TSDB_CODE_SML_INVALID_PROTOCOL_TYPE
;
smlBuildInvalidDataMsg
(
&
msg
,
"protocol invalidate"
,
NULL
);
goto
end
;
}
if
(
protocol
<
TSDB_SML_LINE_PROTOCOL
||
protocol
>
TSDB_SML_JSON_PROTOCOL
)
{
request
->
code
=
TSDB_CODE_SML_INVALID_PROTOCOL_TYPE
;
smlBuildInvalidDataMsg
(
&
msg
,
"protocol invalidate"
,
NULL
);
goto
end
;
}
if
(
protocol
==
TSDB_SML_LINE_PROTOCOL
&&
(
precision
<
TSDB_SML_TIMESTAMP_NOT_CONFIGURED
||
precision
>
TSDB_SML_TIMESTAMP_NANO_SECONDS
))
{
request
->
code
=
TSDB_CODE_SML_INVALID_PRECISION_TYPE
;
smlBuildInvalidDataMsg
(
&
msg
,
"precision invalidate for line protocol"
,
NULL
);
goto
end
;
}
if
(
protocol
==
TSDB_SML_LINE_PROTOCOL
&&
(
precision
<
TSDB_SML_TIMESTAMP_NOT_CONFIGURED
||
precision
>
TSDB_SML_TIMESTAMP_NANO_SECONDS
))
{
request
->
code
=
TSDB_CODE_SML_INVALID_PRECISION_TYPE
;
smlBuildInvalidDataMsg
(
&
msg
,
"precision invalidate for line protocol"
,
NULL
);
goto
end
;
}
if
(
protocol
==
TSDB_SML_JSON_PROTOCOL
)
{
numLines
=
1
;
}
else
if
(
numLines
<=
0
)
{
request
->
code
=
TSDB_CODE_SML_INVALID_DATA
;
smlBuildInvalidDataMsg
(
&
msg
,
"line num is invalid"
,
NULL
);
goto
end
;
}
if
(
protocol
==
TSDB_SML_JSON_PROTOCOL
)
{
numLines
=
1
;
}
else
if
(
numLines
<=
0
)
{
request
->
code
=
TSDB_CODE_SML_INVALID_DATA
;
smlBuildInvalidDataMsg
(
&
msg
,
"line num is invalid"
,
NULL
);
goto
end
;
code
=
smlProcess
(
info
,
lines
,
rawLine
,
rawLineEnd
,
numLines
);
request
->
code
=
code
;
info
->
cost
.
endTime
=
taosGetTimestampUs
();
info
->
cost
.
code
=
code
;
smlPrintStatisticInfo
(
info
);
if
(
code
==
TSDB_CODE_TDB_INVALID_TABLE_SCHEMA_VER
||
code
==
TSDB_CODE_SDB_OBJ_CREATING
){
refreshMeta
(
request
->
pTscObj
,
request
);
uInfo
(
"SML:%"
PRIx64
" ver is old retry or object is creating code:%d"
,
info
->
id
,
code
);
smlDestroyInfo
(
info
);
info
=
NULL
;
taos_free_result
(
request
);
request
=
NULL
;
continue
;
}
break
;
}
code
=
smlProcess
(
info
,
lines
,
rawLine
,
rawLineEnd
,
numLines
);
request
->
code
=
code
;
info
->
cost
.
endTime
=
taosGetTimestampUs
();
info
->
cost
.
code
=
code
;
smlPrintStatisticInfo
(
info
);
end:
smlDestroyInfo
(
info
);
return
(
TAOS_RES
*
)
request
;
...
...
source/client/src/clientSmlLine.c
浏览文件 @
38a6d02c
...
...
@@ -436,7 +436,7 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin
// bind data
ret
=
smlBuildCol
(
info
->
currTableDataCtx
,
info
->
currSTableMeta
->
schema
,
&
kv
,
cnt
+
1
);
if
(
unlikely
(
ret
!=
TSDB_CODE_SUCCESS
))
{
u
Error
(
"smlBuildCol error, retry"
);
u
Debug
(
"smlBuildCol error, retry"
);
info
->
dataFormat
=
false
;
info
->
reRun
=
true
;
return
TSDB_CODE_SUCCESS
;
...
...
@@ -582,8 +582,10 @@ int32_t smlParseInfluxString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine
.
i
=
ts
,
.
length
=
(
size_t
)
tDataTypes
[
TSDB_DATA_TYPE_TIMESTAMP
].
bytes
};
if
(
info
->
dataFormat
)
{
smlBuildCol
(
info
->
currTableDataCtx
,
info
->
currSTableMeta
->
schema
,
&
kv
,
0
);
smlBuildRow
(
info
->
currTableDataCtx
);
ret
=
smlBuildCol
(
info
->
currTableDataCtx
,
info
->
currSTableMeta
->
schema
,
&
kv
,
0
);
if
(
ret
!=
TSDB_CODE_SUCCESS
){
return
ret
;}
ret
=
smlBuildRow
(
info
->
currTableDataCtx
);
if
(
ret
!=
TSDB_CODE_SUCCESS
){
return
ret
;}
clearColValArray
(
info
->
currTableDataCtx
->
pValues
);
}
else
{
taosArraySet
(
elements
->
colArray
,
0
,
&
kv
);
...
...
source/common/src/systable.c
浏览文件 @
38a6d02c
...
...
@@ -33,6 +33,7 @@ static const SSysDbTableSchema dnodesSchema[] = {
{.
name
=
"support_vnodes"
,
.
bytes
=
2
,
.
type
=
TSDB_DATA_TYPE_SMALLINT
,
.
sysInfo
=
true
},
{.
name
=
"status"
,
.
bytes
=
10
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
,
.
sysInfo
=
true
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
,
.
sysInfo
=
true
},
{.
name
=
"reboot_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
,
.
sysInfo
=
true
},
{.
name
=
"note"
,
.
bytes
=
256
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
,
.
sysInfo
=
true
},
};
...
...
@@ -42,6 +43,7 @@ static const SSysDbTableSchema mnodesSchema[] = {
{.
name
=
"role"
,
.
bytes
=
12
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
,
.
sysInfo
=
true
},
{.
name
=
"status"
,
.
bytes
=
9
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
,
.
sysInfo
=
true
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
,
.
sysInfo
=
true
},
{.
name
=
"reboot_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
,
.
sysInfo
=
true
},
};
static
const
SSysDbTableSchema
modulesSchema
[]
=
{
...
...
source/common/src/tdatablock.c
浏览文件 @
38a6d02c
...
...
@@ -2044,8 +2044,8 @@ char* dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** pDataBuf)
if
(
len
>=
size
-
1
)
return
dumpBuf
;
break
;
case
TSDB_DATA_TYPE_DOUBLE
:
// len += snprintf(dumpBuf + len, size - len, " %15l
f |", *(double*)var);
//
if (len >= size - 1) return dumpBuf;
len
+=
snprintf
(
dumpBuf
+
len
,
size
-
len
,
" %15
f |"
,
*
(
double
*
)
var
);
if
(
len
>=
size
-
1
)
return
dumpBuf
;
break
;
case
TSDB_DATA_TYPE_BOOL
:
len
+=
snprintf
(
dumpBuf
+
len
,
size
-
len
,
" %15d |"
,
*
(
bool
*
)
var
);
...
...
source/common/src/tmsg.c
浏览文件 @
38a6d02c
...
...
@@ -2219,6 +2219,10 @@ int32_t tSerializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) {
if
(
tEncodeI8
(
&
encoder
,
pReq
->
cacheLast
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
replications
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
sstTrigger
)
<
0
)
return
-
1
;
// 1st modification
if
(
tEncodeI32
(
&
encoder
,
pReq
->
minRows
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
...
...
@@ -2246,6 +2250,13 @@ int32_t tDeserializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) {
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
cacheLast
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
replications
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
sstTrigger
)
<
0
)
return
-
1
;
// 1st modification
if
(
!
tDecodeIsEnd
(
&
decoder
))
{
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
minRows
)
<
0
)
return
-
1
;
}
else
{
pReq
->
minRows
=
-
1
;
}
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
...
...
@@ -4115,6 +4126,11 @@ int32_t tSerializeSCompactVnodeReq(void *buf, int32_t bufLen, SCompactVnodeReq *
if
(
tEncodeI64
(
&
encoder
,
pReq
->
dbUid
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
db
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
compactStartTime
)
<
0
)
return
-
1
;
// 1.1 add tw.skey and tw.ekey
if
(
tEncodeI64
(
&
encoder
,
pReq
->
tw
.
skey
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
tw
.
ekey
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
...
...
@@ -4127,11 +4143,21 @@ int32_t tDeserializeSCompactVnodeReq(void *buf, int32_t bufLen, SCompactVnodeReq
tDecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
dbUid
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
db
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
compactStartTime
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
// 1.1
if
(
tDecodeIsEnd
(
&
decoder
))
{
pReq
->
tw
.
skey
=
TSKEY_MIN
;
pReq
->
tw
.
ekey
=
TSKEY_MAX
;
}
else
{
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
tw
.
skey
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
tw
.
ekey
)
<
0
)
return
-
1
;
}
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
return
0
;
}
...
...
@@ -4157,6 +4183,11 @@ int32_t tSerializeSAlterVnodeConfigReq(void *buf, int32_t bufLen, SAlterVnodeCon
for
(
int32_t
i
=
0
;
i
<
8
;
++
i
)
{
if
(
tEncodeI64
(
&
encoder
,
pReq
->
reserved
[
i
])
<
0
)
return
-
1
;
}
// 1st modification
if
(
tEncodeI16
(
&
encoder
,
pReq
->
sttTrigger
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
minRows
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
...
...
@@ -4186,6 +4217,15 @@ int32_t tDeserializeSAlterVnodeConfigReq(void *buf, int32_t bufLen, SAlterVnodeC
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
reserved
[
i
])
<
0
)
return
-
1
;
}
// 1st modification
if
(
tDecodeIsEnd
(
&
decoder
))
{
pReq
->
sttTrigger
=
-
1
;
pReq
->
minRows
=
-
1
;
}
else
{
if
(
tDecodeI16
(
&
decoder
,
&
pReq
->
sttTrigger
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
minRows
)
<
0
)
return
-
1
;
}
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
return
0
;
...
...
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
浏览文件 @
38a6d02c
...
...
@@ -20,6 +20,8 @@ void vmGetVnodeLoads(SVnodeMgmt *pMgmt, SMonVloadInfo *pInfo, bool isReset) {
pInfo
->
pVloads
=
taosArrayInit
(
pMgmt
->
state
.
totalVnodes
,
sizeof
(
SVnodeLoad
));
if
(
pInfo
->
pVloads
==
NULL
)
return
;
tfsUpdateSize
(
pMgmt
->
pTfs
);
taosThreadRwlockRdlock
(
&
pMgmt
->
lock
);
void
*
pIter
=
taosHashIterate
(
pMgmt
->
hash
,
NULL
);
...
...
source/dnode/mgmt/mgmt_vnode/src/vmInt.c
浏览文件 @
38a6d02c
...
...
@@ -124,7 +124,7 @@ void vmCloseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode, bool commitAndRemoveWal)
vmFreeQueue
(
pMgmt
,
pVnode
);
if
(
commitAndRemoveWal
)
{
dInfo
(
"vgId:%d, commit data"
,
pVnode
->
vgId
);
dInfo
(
"vgId:%d, commit data
for vnode split
"
,
pVnode
->
vgId
);
vnodeSyncCommit
(
pVnode
->
pImpl
);
vnodeBegin
(
pVnode
->
pImpl
);
dInfo
(
"vgId:%d, commit data finished"
,
pVnode
->
vgId
);
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
38a6d02c
...
...
@@ -543,7 +543,7 @@ void* tDecodeSMqConsumerObj(const void* buf, SMqConsumerObj* pConsumer
typedef
struct
{
int32_t
vgId
;
char
*
qmsg
;
//
SubPlanToString
char
*
qmsg
;
//
SubPlanToString
SEpSet
epSet
;
}
SMqVgEp
;
...
...
source/dnode/mnode/impl/inc/mndVgroup.h
浏览文件 @
38a6d02c
...
...
@@ -43,7 +43,8 @@ int32_t mndAddDropVnodeAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVg
int32_t
mndSetMoveVgroupsInfoToTrans
(
SMnode
*
,
STrans
*
pTrans
,
int32_t
dropDnodeId
,
bool
force
);
int32_t
mndBuildAlterVgroupAction
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pOldDb
,
SDbObj
*
pNewDb
,
SVgObj
*
pVgroup
,
SArray
*
pArray
);
int32_t
mndBuildCompactVgroupAction
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
,
int64_t
compactTs
);
int32_t
mndBuildCompactVgroupAction
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
,
int64_t
compactTs
,
STimeWindow
tw
);
void
*
mndBuildCreateVnodeReq
(
SMnode
*
,
SDnodeObj
*
pDnode
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
,
int32_t
*
pContLen
);
void
*
mndBuildDropVnodeReq
(
SMnode
*
,
SDnodeObj
*
pDnode
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
,
int32_t
*
pContLen
);
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
38a6d02c
...
...
@@ -725,6 +725,18 @@ static int32_t mndSetDbCfgFromAlterDbReq(SDbObj *pDb, SAlterDbReq *pAlter) {
terrno
=
0
;
}
if
(
pAlter
->
sstTrigger
>
0
&&
pAlter
->
sstTrigger
!=
pDb
->
cfg
.
sstTrigger
)
{
pDb
->
cfg
.
sstTrigger
=
pAlter
->
sstTrigger
;
pDb
->
vgVersion
++
;
terrno
=
0
;
}
if
(
pAlter
->
minRows
>
0
&&
pAlter
->
minRows
!=
pDb
->
cfg
.
minRows
)
{
pDb
->
cfg
.
minRows
=
pAlter
->
minRows
;
pDb
->
vgVersion
++
;
terrno
=
0
;
}
return
terrno
;
}
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
38a6d02c
...
...
@@ -1074,6 +1074,9 @@ static int32_t mndRetrieveDnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataSetVal
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pDnode
->
createdTime
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataSetVal
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pDnode
->
rebootTime
,
false
);
char
*
b
=
taosMemoryCalloc
(
VARSTR_HEADER_SIZE
+
strlen
(
offlineReason
[
pDnode
->
offlineReason
])
+
1
,
1
);
STR_TO_VARSTR
(
b
,
online
?
""
:
offlineReason
[
pDnode
->
offlineReason
]);
...
...
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
38a6d02c
...
...
@@ -644,6 +644,9 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataSetVal
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pObj
->
createdTime
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataSetVal
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pObj
->
stateStartTime
,
false
);
numOfRows
++
;
sdbRelease
(
pSdb
,
pObj
);
}
...
...
source/dnode/mnode/impl/src/mndUser.c
浏览文件 @
38a6d02c
...
...
@@ -337,7 +337,11 @@ SUserObj *mndAcquireUser(SMnode *pMnode, const char *userName) {
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SUserObj
*
pUser
=
sdbAcquire
(
pSdb
,
SDB_USER
,
userName
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_USER_NOT_EXIST
;
if
(
terrno
==
TSDB_CODE_SDB_OBJ_NOT_THERE
)
{
terrno
=
TSDB_CODE_MND_USER_NOT_EXIST
;
}
else
{
terrno
=
TSDB_CODE_MND_USER_NOT_AVAILABLE
;
}
}
return
pUser
;
}
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
38a6d02c
...
...
@@ -319,6 +319,8 @@ static void *mndBuildAlterVnodeConfigReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pV
alterReq
.
walLevel
=
pDb
->
cfg
.
walLevel
;
alterReq
.
strict
=
pDb
->
cfg
.
strict
;
alterReq
.
cacheLast
=
pDb
->
cfg
.
cacheLast
;
alterReq
.
sttTrigger
=
pDb
->
cfg
.
sstTrigger
;
alterReq
.
minRows
=
pDb
->
cfg
.
minRows
;
mInfo
(
"vgId:%d, build alter vnode config req"
,
pVgroup
->
vgId
);
int32_t
contLen
=
tSerializeSAlterVnodeConfigReq
(
NULL
,
0
,
&
alterReq
);
...
...
@@ -2209,11 +2211,12 @@ _OVER:
bool
mndVgroupInDb
(
SVgObj
*
pVgroup
,
int64_t
dbUid
)
{
return
!
pVgroup
->
isTsma
&&
pVgroup
->
dbUid
==
dbUid
;
}
static
void
*
mndBuildCompactVnodeReq
(
SMnode
*
pMnode
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
,
int32_t
*
pContLen
,
int64_t
compactTs
)
{
static
void
*
mndBuildCompactVnodeReq
(
SMnode
*
pMnode
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
,
int32_t
*
pContLen
,
int64_t
compactTs
,
STimeWindow
tw
)
{
SCompactVnodeReq
compactReq
=
{
0
};
compactReq
.
dbUid
=
pDb
->
uid
;
compactReq
.
compactStartTime
=
compactTs
;
compactReq
.
tw
=
tw
;
tstrncpy
(
compactReq
.
db
,
pDb
->
name
,
TSDB_DB_FNAME_LEN
);
mInfo
(
"vgId:%d, build compact vnode config req"
,
pVgroup
->
vgId
);
...
...
@@ -2239,13 +2242,13 @@ static void *mndBuildCompactVnodeReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgrou
return
pReq
;
}
static
int32_t
mndAddCompactVnodeAction
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
,
int64_t
compactTs
)
{
static
int32_t
mndAddCompactVnodeAction
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
,
int64_t
compactTs
,
STimeWindow
tw
)
{
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetVgroupEpset
(
pMnode
,
pVgroup
);
int32_t
contLen
=
0
;
void
*
pReq
=
mndBuildCompactVnodeReq
(
pMnode
,
pDb
,
pVgroup
,
&
contLen
,
compactTs
);
void
*
pReq
=
mndBuildCompactVnodeReq
(
pMnode
,
pDb
,
pVgroup
,
&
contLen
,
compactTs
,
tw
);
if
(
pReq
==
NULL
)
return
-
1
;
action
.
pCont
=
pReq
;
...
...
@@ -2260,7 +2263,8 @@ static int32_t mndAddCompactVnodeAction(SMnode *pMnode, STrans *pTrans, SDbObj *
return
0
;
}
int32_t
mndBuildCompactVgroupAction
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
,
int64_t
compactTs
)
{
if
(
mndAddCompactVnodeAction
(
pMnode
,
pTrans
,
pDb
,
pVgroup
,
compactTs
)
!=
0
)
return
-
1
;
int32_t
mndBuildCompactVgroupAction
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
,
int64_t
compactTs
,
STimeWindow
tw
)
{
if
(
mndAddCompactVnodeAction
(
pMnode
,
pTrans
,
pDb
,
pVgroup
,
compactTs
,
tw
)
!=
0
)
return
-
1
;
return
0
;
}
\ No newline at end of file
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
38a6d02c
...
...
@@ -457,9 +457,10 @@ struct SCommitInfo {
};
struct
SCompactInfo
{
SVnode
*
pVnode
;
int32_t
flag
;
int64_t
commitID
;
SVnode
*
pVnode
;
int32_t
flag
;
int64_t
commitID
;
STimeWindow
tw
;
};
#ifdef __cplusplus
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
38a6d02c
...
...
@@ -983,11 +983,15 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) {
pTask
->
tbSink
.
vnode
=
pTq
->
pVnode
;
pTask
->
tbSink
.
tbSinkFunc
=
tqSinkToTablePipeline2
;
/*A(pTask->tbSink.pSchemaWrapper);*/
/*A(pTask->tbSink.pSchemaWrapper->pSchema);*/
int32_t
version
=
1
;
SMetaInfo
info
=
{
0
};
int32_t
code
=
metaGetInfo
(
pTq
->
pVnode
->
pMeta
,
pTask
->
tbSink
.
stbUid
,
&
info
,
NULL
);
if
(
code
==
TSDB_CODE_SUCCESS
)
{
version
=
info
.
skmVer
;
}
pTask
->
tbSink
.
pTSchema
=
tBuildTSchema
(
pTask
->
tbSink
.
pSchemaWrapper
->
pSchema
,
pTask
->
tbSink
.
pSchemaWrapper
->
nCols
,
1
);
tBuildTSchema
(
pTask
->
tbSink
.
pSchemaWrapper
->
pSchema
,
pTask
->
tbSink
.
pSchemaWrapper
->
nCols
,
version
);
ASSERT
(
pTask
->
tbSink
.
pTSchema
);
}
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
38a6d02c
...
...
@@ -211,6 +211,11 @@ static int32_t vnodePreProcessSubmitMsg(SVnode *pVnode, SRpcMsg *pMsg) {
SDecoder
*
pCoder
=
&
(
SDecoder
){
0
};
if
(
taosHton64
(((
SSubmitReq2Msg
*
)
pMsg
->
pCont
)
->
version
)
!=
1
)
{
code
=
TSDB_CODE_INVALID_MSG
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
tDecoderInit
(
pCoder
,
(
uint8_t
*
)
pMsg
->
pCont
+
sizeof
(
SSubmitReq2Msg
),
pMsg
->
contLen
-
sizeof
(
SSubmitReq2Msg
));
if
(
tStartDecode
(
pCoder
)
<
0
)
{
...
...
@@ -1218,6 +1223,11 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq
for
(
int32_t
i
=
0
;
i
<
TARRAY_SIZE
(
pSubmitReq
->
aSubmitTbData
);
++
i
)
{
SSubmitTbData
*
pSubmitTbData
=
taosArrayGet
(
pSubmitReq
->
aSubmitTbData
,
i
);
if
(
pSubmitTbData
->
pCreateTbReq
&&
pSubmitTbData
->
pCreateTbReq
->
uid
==
0
)
{
code
=
TSDB_CODE_INVALID_MSG
;
goto
_exit
;
}
if
(
pSubmitTbData
->
flags
&
SUBMIT_REQ_COLUMN_DATA_FORMAT
)
{
if
(
TARRAY_SIZE
(
pSubmitTbData
->
aCol
)
<=
0
)
{
code
=
TSDB_CODE_INVALID_MSG
;
...
...
@@ -1531,6 +1541,14 @@ static int32_t vnodeProcessAlterConfigReq(SVnode *pVnode, int64_t version, void
}
}
if
(
req
.
sttTrigger
!=
-
1
&&
req
.
sttTrigger
!=
pVnode
->
config
.
sttTrigger
)
{
pVnode
->
config
.
sttTrigger
=
req
.
sttTrigger
;
}
if
(
req
.
minRows
!=
-
1
&&
req
.
minRows
!=
pVnode
->
config
.
tsdbCfg
.
minRows
)
{
pVnode
->
config
.
tsdbCfg
.
minRows
=
req
.
minRows
;
}
if
(
walChanged
)
{
walAlter
(
pVnode
->
pWal
,
&
pVnode
->
config
.
walCfg
);
}
...
...
@@ -1646,7 +1664,7 @@ _err:
}
static
int32_t
vnodeProcessDropIndexReq
(
SVnode
*
pVnode
,
int64_t
version
,
void
*
pReq
,
int32_t
len
,
SRpcMsg
*
pRsp
)
{
SDropIndexReq
req
=
{
0
};
pRsp
->
msgType
=
TDMT_VND_
CREATE
_INDEX_RSP
;
pRsp
->
msgType
=
TDMT_VND_
DROP
_INDEX_RSP
;
pRsp
->
code
=
TSDB_CODE_SUCCESS
;
pRsp
->
pCont
=
NULL
;
pRsp
->
contLen
=
0
;
...
...
@@ -1655,6 +1673,7 @@ static int32_t vnodeProcessDropIndexReq(SVnode *pVnode, int64_t version, void *p
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
metaDropIndexFromSTable
(
pVnode
->
pMeta
,
version
,
&
req
)
<
0
)
{
pRsp
->
code
=
terrno
;
return
-
1
;
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
38a6d02c
...
...
@@ -121,7 +121,8 @@ enum {
STREAM_RECOVER_STEP__NONE
=
0
,
STREAM_RECOVER_STEP__PREPARE1
,
STREAM_RECOVER_STEP__PREPARE2
,
STREAM_RECOVER_STEP__SCAN
,
STREAM_RECOVER_STEP__SCAN1
,
STREAM_RECOVER_STEP__SCAN2
,
};
typedef
struct
{
...
...
source/libs/executor/src/executil.c
浏览文件 @
38a6d02c
...
...
@@ -957,9 +957,7 @@ static int32_t doFilterByTagCond(STableListInfo* pListInfo, SArray* pUidList, SN
STUidTagInfo
*
pInfo
=
taosArrayGet
(
pUidTagList
,
i
);
taosArrayPush
(
pUidList
,
&
pInfo
->
uid
);
}
terrno
=
0
;
goto
end
;
}
else
{
if
((
condType
==
FILTER_NO_LOGIC
||
condType
==
FILTER_AND
)
&&
status
!=
SFLT_NOT_INDEX
)
{
code
=
metaGetTableTagsByUids
(
metaHandle
,
pListInfo
->
suid
,
pUidTagList
);
...
...
source/libs/executor/src/executor.c
浏览文件 @
38a6d02c
...
...
@@ -1110,11 +1110,8 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
STableScanInfo
*
pTableScanInfo
=
pInfo
->
pTableScanOp
->
info
;
int32_t
numOfTables
=
tableListGetSize
(
pTaskInfo
->
pTableInfoList
);
#ifndef NDEBUG
qDebug
(
"switch to next table %"
PRId64
" (cursor %d), %"
PRId64
" rows returned"
,
uid
,
pTableScanInfo
->
currentTable
,
pInfo
->
pTableScanOp
->
resultInfo
.
totalRows
);
qDebug
(
"switch to next table %"
PRId64
" ts %"
PRId64
"% "
PRId64
" rows returned"
,
uid
,
ts
,
pInfo
->
pTableScanOp
->
resultInfo
.
totalRows
);
pInfo
->
pTableScanOp
->
resultInfo
.
totalRows
=
0
;
#endif
bool
found
=
false
;
for
(
int32_t
i
=
0
;
i
<
numOfTables
;
i
++
)
{
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
38a6d02c
...
...
@@ -1608,8 +1608,6 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) {
if
(
pTaskInfo
->
streamInfo
.
prepareStatus
.
type
==
TMQ_OFFSET__SNAPSHOT_DATA
)
{
SSDataBlock
*
pResult
=
doTableScan
(
pInfo
->
pTableScanOp
);
if
(
pResult
&&
pResult
->
info
.
rows
>
0
)
{
qDebug
(
"queue scan tsdb return %d rows min:%"
PRId64
" max:%"
PRId64
,
pResult
->
info
.
rows
,
pResult
->
info
.
window
.
skey
,
pResult
->
info
.
window
.
ekey
);
qDebug
(
"queue scan tsdb return %d rows min:%"
PRId64
" max:%"
PRId64
" wal curVersion:%"
PRId64
,
pResult
->
info
.
rows
,
pResult
->
info
.
window
.
skey
,
pResult
->
info
.
window
.
ekey
,
pInfo
->
tqReader
->
pWalReader
->
curVersion
);
pTaskInfo
->
streamInfo
.
returned
=
1
;
...
...
@@ -1724,9 +1722,9 @@ static void setBlockGroupIdByUid(SStreamScanInfo* pInfo, SSDataBlock* pBlock) {
}
}
static
void
doCheckUpdate
(
SStreamScanInfo
*
pInfo
,
TSKEY
endKey
)
{
static
void
doCheckUpdate
(
SStreamScanInfo
*
pInfo
,
TSKEY
endKey
,
SSDataBlock
*
pBlock
)
{
if
(
pInfo
->
pUpdateInfo
)
{
checkUpdateData
(
pInfo
,
true
,
p
Info
->
pRes
,
true
);
checkUpdateData
(
pInfo
,
true
,
p
Block
,
true
);
pInfo
->
twAggSup
.
maxTs
=
TMAX
(
pInfo
->
twAggSup
.
maxTs
,
endKey
);
if
(
pInfo
->
pUpdateDataRes
->
info
.
rows
>
0
)
{
pInfo
->
updateResIndex
=
0
;
...
...
@@ -1758,11 +1756,13 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
pTSInfo
->
base
.
cond
.
endVersion
=
pTaskInfo
->
streamInfo
.
fillHistoryVer1
;
qDebug
(
"stream recover step 1, from %"
PRId64
" to %"
PRId64
,
pTSInfo
->
base
.
cond
.
startVersion
,
pTSInfo
->
base
.
cond
.
endVersion
);
pTaskInfo
->
streamInfo
.
recoverStep
=
STREAM_RECOVER_STEP__SCAN1
;
}
else
{
pTSInfo
->
base
.
cond
.
startVersion
=
pTaskInfo
->
streamInfo
.
fillHistoryVer1
+
1
;
pTSInfo
->
base
.
cond
.
endVersion
=
pTaskInfo
->
streamInfo
.
fillHistoryVer2
;
qDebug
(
"stream recover step 2, from %"
PRId64
" to %"
PRId64
,
pTSInfo
->
base
.
cond
.
startVersion
,
pTSInfo
->
base
.
cond
.
endVersion
);
pTaskInfo
->
streamInfo
.
recoverStep
=
STREAM_RECOVER_STEP__SCAN2
;
}
/*resetTableScanInfo(pTSInfo, pWin);*/
...
...
@@ -1772,11 +1772,11 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
pTSInfo
->
scanTimes
=
0
;
pTSInfo
->
currentGroupId
=
-
1
;
pTaskInfo
->
streamInfo
.
recoverStep
=
STREAM_RECOVER_STEP__SCAN
;
pTaskInfo
->
streamInfo
.
recoverScanFinished
=
false
;
}
if
(
pTaskInfo
->
streamInfo
.
recoverStep
==
STREAM_RECOVER_STEP__SCAN
)
{
if
(
pTaskInfo
->
streamInfo
.
recoverStep
==
STREAM_RECOVER_STEP__SCAN1
||
pTaskInfo
->
streamInfo
.
recoverStep
==
STREAM_RECOVER_STEP__SCAN2
)
{
if
(
pInfo
->
blockRecoverContiCnt
>
100
)
{
pInfo
->
blockRecoverTotCnt
+=
pInfo
->
blockRecoverContiCnt
;
pInfo
->
blockRecoverContiCnt
=
0
;
...
...
@@ -1789,6 +1789,27 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
printDataBlock
(
pInfo
->
pRecoverRes
,
"scan recover"
);
return
pInfo
->
pRecoverRes
;
}
break
;
case
STREAM_SCAN_FROM_UPDATERES
:
{
generateScanRange
(
pInfo
,
pInfo
->
pUpdateDataRes
,
pInfo
->
pUpdateRes
);
prepareRangeScan
(
pInfo
,
pInfo
->
pUpdateRes
,
&
pInfo
->
updateResIndex
);
pInfo
->
scanMode
=
STREAM_SCAN_FROM_DATAREADER_RANGE
;
return
pInfo
->
pUpdateRes
;
}
break
;
case
STREAM_SCAN_FROM_DATAREADER_RANGE
:
{
SSDataBlock
*
pSDB
=
doRangeScan
(
pInfo
,
pInfo
->
pUpdateRes
,
pInfo
->
primaryTsIndex
,
&
pInfo
->
updateResIndex
);
if
(
pSDB
)
{
STableScanInfo
*
pTableScanInfo
=
pInfo
->
pTableScanOp
->
info
;
uint64_t
version
=
getReaderMaxVersion
(
pTableScanInfo
->
base
.
dataReader
);
updateInfoSetScanRange
(
pInfo
->
pUpdateInfo
,
&
pTableScanInfo
->
base
.
cond
.
twindows
,
pInfo
->
groupId
,
version
);
pSDB
->
info
.
type
=
pInfo
->
scanMode
==
STREAM_SCAN_FROM_DATAREADER_RANGE
?
STREAM_NORMAL
:
STREAM_PULL_DATA
;
checkUpdateData
(
pInfo
,
true
,
pSDB
,
false
);
// printDataBlock(pSDB, "stream scan update");
calBlockTbName
(
pInfo
,
pSDB
);
return
pSDB
;
}
blockDataCleanup
(
pInfo
->
pUpdateDataRes
);
pInfo
->
scanMode
=
STREAM_SCAN_FROM_READERHANDLE
;
}
break
;
default:
break
;
}
...
...
@@ -1798,8 +1819,12 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
pInfo
->
blockRecoverContiCnt
++
;
calBlockTbName
(
pInfo
,
pInfo
->
pRecoverRes
);
if
(
pInfo
->
pUpdateInfo
)
{
TSKEY
maxTs
=
updateInfoFillBlockData
(
pInfo
->
pUpdateInfo
,
pInfo
->
pRecoverRes
,
pInfo
->
primaryTsIndex
);
pInfo
->
twAggSup
.
maxTs
=
TMAX
(
pInfo
->
twAggSup
.
maxTs
,
maxTs
);
if
(
pTaskInfo
->
streamInfo
.
recoverStep
==
STREAM_RECOVER_STEP__SCAN1
)
{
TSKEY
maxTs
=
updateInfoFillBlockData
(
pInfo
->
pUpdateInfo
,
pInfo
->
pRecoverRes
,
pInfo
->
primaryTsIndex
);
pInfo
->
twAggSup
.
maxTs
=
TMAX
(
pInfo
->
twAggSup
.
maxTs
,
maxTs
);
}
else
{
doCheckUpdate
(
pInfo
,
pInfo
->
pRecoverRes
->
info
.
window
.
ekey
,
pInfo
->
pRecoverRes
);
}
}
if
(
pInfo
->
pCreateTbRes
->
info
.
rows
>
0
)
{
pInfo
->
scanMode
=
STREAM_SCAN_FROM_RES
;
...
...
@@ -1910,7 +1935,7 @@ FETCH_NEXT_BLOCK:
switch
(
pInfo
->
scanMode
)
{
case
STREAM_SCAN_FROM_RES
:
{
pInfo
->
scanMode
=
STREAM_SCAN_FROM_READERHANDLE
;
doCheckUpdate
(
pInfo
,
pInfo
->
pRes
->
info
.
window
.
ekey
);
doCheckUpdate
(
pInfo
,
pInfo
->
pRes
->
info
.
window
.
ekey
,
pInfo
->
pRes
);
doFilter
(
pInfo
->
pRes
,
pOperator
->
exprSupp
.
pFilterInfo
,
NULL
);
pInfo
->
pRes
->
info
.
dataLoad
=
1
;
blockDataUpdateTsWindow
(
pInfo
->
pRes
,
pInfo
->
primaryTsIndex
);
...
...
@@ -2011,7 +2036,7 @@ FETCH_NEXT_BLOCK:
return
pInfo
->
pCreateTbRes
;
}
doCheckUpdate
(
pInfo
,
pBlockInfo
->
window
.
ekey
);
doCheckUpdate
(
pInfo
,
pBlockInfo
->
window
.
ekey
,
pInfo
->
pRes
);
doFilter
(
pInfo
->
pRes
,
pOperator
->
exprSupp
.
pFilterInfo
,
NULL
);
pInfo
->
pRes
->
info
.
dataLoad
=
1
;
blockDataUpdateTsWindow
(
pInfo
->
pRes
,
pInfo
->
primaryTsIndex
);
...
...
source/libs/executor/src/timewindowoperator.c
浏览文件 @
38a6d02c
...
...
@@ -4805,10 +4805,9 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
setInverFunction
(
pSup
->
pCtx
,
pOperator
->
exprSupp
.
numOfExprs
,
pBlock
->
info
.
type
);
}
doStreamIntervalAggImpl
(
pOperator
,
pBlock
,
pBlock
->
info
.
id
.
groupId
,
pInfo
->
pUpdatedMap
);
pInfo
->
twAggSup
.
maxTs
=
TMAX
(
pInfo
->
twAggSup
.
maxTs
,
pBlock
->
info
.
window
.
ekey
);
pInfo
->
twAggSup
.
minTs
=
TMIN
(
pInfo
->
twAggSup
.
minTs
,
pBlock
->
info
.
window
.
skey
);
doStreamIntervalAggImpl
(
pOperator
,
pBlock
,
pBlock
->
info
.
id
.
groupId
,
pInfo
->
pUpdatedMap
);
}
pOperator
->
status
=
OP_RES_TO_RETURN
;
removeDeleteResults
(
pInfo
->
pUpdatedMap
,
pInfo
->
pDelWins
);
...
...
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
38a6d02c
...
...
@@ -1462,7 +1462,7 @@ SListCell* nodesListErase(SNodeList* pList, SListCell* pCell) {
}
void
nodesListInsertList
(
SNodeList
*
pTarget
,
SListCell
*
pPos
,
SNodeList
*
pSrc
)
{
if
(
NULL
==
pTarget
||
NULL
==
pPos
||
NULL
==
pSrc
)
{
if
(
NULL
==
pTarget
||
NULL
==
pPos
||
NULL
==
pSrc
||
NULL
==
pSrc
->
pHead
)
{
return
;
}
...
...
source/libs/parser/inc/sql.y
浏览文件 @
38a6d02c
...
...
@@ -236,6 +236,7 @@ alter_db_option(A) ::= REPLICA NK_INTEGER(B).
//alter_db_option(A) ::= STRICT NK_STRING(B). { A.type = DB_OPTION_STRICT; A.val = B; }
alter_db_option(A) ::= WAL_LEVEL NK_INTEGER(B). { A.type = DB_OPTION_WAL; A.val = B; }
alter_db_option(A) ::= STT_TRIGGER NK_INTEGER(B). { A.type = DB_OPTION_STT_TRIGGER; A.val = B; }
alter_db_option(A) ::= MINROWS NK_INTEGER(B). { A.type = DB_OPTION_MINROWS; A.val = B; }
%type integer_list { SNodeList* }
%destructor integer_list { nodesDestroyList($$); }
...
...
source/libs/parser/src/parInsertSml.c
浏览文件 @
38a6d02c
...
...
@@ -201,6 +201,7 @@ int32_t smlBuildCol(STableDataCxt* pTableCxt, SSchema* schema, void* data, int32
SSmlKv
*
kv
=
(
SSmlKv
*
)
data
;
if
(
kv
->
keyLen
!=
strlen
(
pColSchema
->
name
)
||
memcmp
(
kv
->
key
,
pColSchema
->
name
,
kv
->
keyLen
)
!=
0
||
kv
->
type
!=
pColSchema
->
type
){
ret
=
TSDB_CODE_SML_INVALID_DATA
;
uError
(
"SML smlBuildCol error col not same %s"
,
pColSchema
->
name
);
goto
end
;
}
if
(
kv
->
type
==
TSDB_DATA_TYPE_NCHAR
)
{
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
38a6d02c
...
...
@@ -2500,9 +2500,8 @@ static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) {
STempTableNode
*
pTempTable
=
(
STempTableNode
*
)
pTable
;
code
=
translateSubquery
(
pCxt
,
pTempTable
->
pSubquery
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
QUERY_NODE_SELECT_STMT
==
nodeType
(
pTempTable
->
pSubquery
)
&&
((
SSelectStmt
*
)
pTempTable
->
pSubquery
)
->
isEmptyResult
&&
isSelectStmt
(
pCxt
->
pCurrStmt
))
{
if
(
QUERY_NODE_SELECT_STMT
==
nodeType
(
pTempTable
->
pSubquery
)
&&
((
SSelectStmt
*
)
pTempTable
->
pSubquery
)
->
isEmptyResult
&&
isSelectStmt
(
pCxt
->
pCurrStmt
))
{
((
SSelectStmt
*
)
pCxt
->
pCurrStmt
)
->
isEmptyResult
=
true
;
}
...
...
@@ -2935,6 +2934,9 @@ static int32_t translateSelectList(STranslateContext* pCxt, SSelectStmt* pSelect
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
translateFillValues
(
pCxt
,
pSelect
);
}
if
(
NULL
==
pSelect
->
pProjectionList
||
0
>=
pSelect
->
pProjectionList
->
length
)
{
code
=
TSDB_CODE_PAR_INVALID_SELECTED_EXPR
;
}
return
code
;
}
...
...
@@ -4251,6 +4253,7 @@ static void buildAlterDbReq(STranslateContext* pCxt, SAlterDatabaseStmt* pStmt,
pReq
->
cacheLastSize
=
pStmt
->
pOptions
->
cacheLastSize
;
pReq
->
replications
=
pStmt
->
pOptions
->
replica
;
pReq
->
sstTrigger
=
pStmt
->
pOptions
->
sstTrigger
;
pReq
->
minRows
=
pStmt
->
pOptions
->
minRowsPerBlock
;
return
;
}
...
...
source/libs/parser/src/sql.c
浏览文件 @
38a6d02c
此差异已折叠。
点击以展开。
source/libs/parser/test/parAlterToBalanceTest.cpp
浏览文件 @
38a6d02c
...
...
@@ -108,6 +108,7 @@ TEST_F(ParserInitialATest, alterDnode) {
* | REPLICA int_value -- todo: enum 1, 3, default 1, unit replica
* | WAL_LEVEL int_value -- enum 1, 2, default 1
* | STT_TRIGGER int_value -- rang [1, 16], default 8
* | MINROWS int_value -- rang [10, 1000], default 100
* }
*/
TEST_F
(
ParserInitialATest
,
alterDatabase
)
{
...
...
@@ -133,6 +134,7 @@ TEST_F(ParserInitialATest, alterDatabase) {
expect
.
cacheLastSize
=
-
1
;
expect
.
replications
=
-
1
;
expect
.
sstTrigger
=
-
1
;
expect
.
minRows
=
-
1
;
};
auto
setAlterDbBuffer
=
[
&
](
int32_t
buffer
)
{
expect
.
buffer
=
buffer
;
};
auto
setAlterDbPageSize
=
[
&
](
int32_t
pageSize
)
{
expect
.
pageSize
=
pageSize
;
};
...
...
@@ -150,6 +152,7 @@ TEST_F(ParserInitialATest, alterDatabase) {
auto
setAlterDbCacheModel
=
[
&
](
int8_t
cacheModel
)
{
expect
.
cacheLast
=
cacheModel
;
};
auto
setAlterDbReplica
=
[
&
](
int8_t
replications
)
{
expect
.
replications
=
replications
;
};
auto
setAlterDbSttTrigger
=
[
&
](
int8_t
sstTrigger
)
{
expect
.
sstTrigger
=
sstTrigger
;
};
auto
setAlterDbMinRows
=
[
&
](
int32_t
minRows
)
{
expect
.
minRows
=
minRows
;
};
setCheckDdlFunc
([
&
](
const
SQuery
*
pQuery
,
ParserStage
stage
)
{
ASSERT_EQ
(
nodeType
(
pQuery
->
pRoot
),
QUERY_NODE_ALTER_DATABASE_STMT
);
...
...
@@ -170,6 +173,7 @@ TEST_F(ParserInitialATest, alterDatabase) {
ASSERT_EQ
(
req
.
cacheLast
,
expect
.
cacheLast
);
ASSERT_EQ
(
req
.
replications
,
expect
.
replications
);
ASSERT_EQ
(
req
.
sstTrigger
,
expect
.
sstTrigger
);
ASSERT_EQ
(
req
.
minRows
,
expect
.
minRows
);
});
const
int32_t
MINUTE_PER_DAY
=
MILLISECOND_PER_DAY
/
MILLISECOND_PER_MINUTE
;
...
...
@@ -277,6 +281,15 @@ TEST_F(ParserInitialATest, alterDatabase) {
setAlterDbSttTrigger
(
16
);
run
(
"ALTER DATABASE test STT_TRIGGER 16"
);
clearAlterDbReq
();
initAlterDb
(
"test"
);
setAlterDbMinRows
(
10
);
run
(
"ALTER DATABASE test MINROWS 10"
);
setAlterDbMinRows
(
50
);
run
(
"ALTER DATABASE test MINROWS 50"
);
setAlterDbMinRows
(
1000
);
run
(
"ALTER DATABASE test MINROWS 1000"
);
clearAlterDbReq
();
}
TEST_F
(
ParserInitialATest
,
alterDatabaseSemanticCheck
)
{
...
...
source/libs/scalar/src/scalar.c
浏览文件 @
38a6d02c
...
...
@@ -59,6 +59,8 @@ int32_t sclCreateColumnInfoData(SDataType *pType, int32_t numOfRows, SScalarPara
pParam
->
columnData
=
pColumnData
;
pParam
->
colAlloced
=
true
;
pParam
->
numOfRows
=
numOfRows
;
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -740,6 +742,10 @@ int32_t sclExecFunction(SFunctionNode *node, SScalarCtx *ctx, SScalarParam *outp
SCL_ERR_JRET
(
code
);
}
if
(
rowNum
==
0
)
{
goto
_return
;
}
code
=
(
*
ffpSet
.
process
)(
params
,
paramNum
,
output
);
if
(
code
)
{
sclError
(
"scalar function exec failed, funcId:%d, code:%s"
,
node
->
funcId
,
tstrerror
(
code
));
...
...
source/libs/scalar/src/sclfunc.c
浏览文件 @
38a6d02c
...
...
@@ -1055,9 +1055,9 @@ int32_t toISO8601Function(SScalarParam *pInput, int32_t inputNum, SScalarParam *
if
(
tsDigits
==
TSDB_TIME_PRECISION_MILLI_DIGITS
)
{
timeVal
=
timeVal
/
1000
;
}
else
if
(
tsDigits
==
TSDB_TIME_PRECISION_MICRO_DIGITS
)
{
timeVal
=
timeVal
/
(
1000
*
1000
);
timeVal
=
timeVal
/
((
int64_t
)(
1000
*
1000
)
);
}
else
if
(
tsDigits
==
TSDB_TIME_PRECISION_NANO_DIGITS
)
{
timeVal
=
timeVal
/
(
1000
*
1000
*
1000
);
timeVal
=
timeVal
/
((
int64_t
)(
1000
*
1000
*
1000
)
);
}
else
{
colDataSetNULL
(
pOutput
->
columnData
,
i
);
continue
;
...
...
@@ -1317,19 +1317,19 @@ int32_t timeTruncateFunction(SScalarParam *pInput, int32_t inputNum, SScalarPara
case
86400000
:
{
/* 1d */
if
(
tsDigits
==
TSDB_TIME_PRECISION_MILLI_DIGITS
)
{
if
(
ignoreTz
)
{
timeVal
=
timeVal
-
(
timeVal
+
offsetFromTz
(
timezone
,
1000
))
%
(
86400L
*
1000
);
timeVal
=
timeVal
-
(
timeVal
+
offsetFromTz
(
timezone
,
1000
))
%
(
((
int64_t
)
86400
)
*
1000
);
}
else
{
timeVal
=
timeVal
/
1000
/
86400
*
86400
*
1000
;
}
}
else
if
(
tsDigits
==
TSDB_TIME_PRECISION_MICRO_DIGITS
)
{
if
(
ignoreTz
)
{
timeVal
=
timeVal
-
(
timeVal
+
offsetFromTz
(
timezone
,
1000000
))
%
(
86400L
*
1000000
);
timeVal
=
timeVal
-
(
timeVal
+
offsetFromTz
(
timezone
,
1000000
))
%
(
((
int64_t
)
86400
)
*
1000000
);
}
else
{
timeVal
=
timeVal
/
1000000
/
86400
*
86400
*
1000000
;
}
}
else
if
(
tsDigits
==
TSDB_TIME_PRECISION_NANO_DIGITS
)
{
if
(
ignoreTz
)
{
timeVal
=
timeVal
-
(
timeVal
+
offsetFromTz
(
timezone
,
1000000000
))
%
(
86400L
*
1000000000
);
timeVal
=
timeVal
-
(
timeVal
+
offsetFromTz
(
timezone
,
1000000000
))
%
(
((
int64_t
)
86400
)
*
1000000000
);
}
else
{
timeVal
=
timeVal
/
1000000000
/
86400
*
86400
*
1000000000
;
}
...
...
source/libs/sync/inc/syncReplication.h
浏览文件 @
38a6d02c
...
...
@@ -51,7 +51,7 @@ int32_t syncNodeHeartbeatPeers(SSyncNode* pSyncNode);
int32_t
syncNodeSendHeartbeat
(
SSyncNode
*
pSyncNode
,
const
SRaftId
*
pDestId
,
SRpcMsg
*
pMsg
);
int32_t
syncNodeReplicate
(
SSyncNode
*
pSyncNode
);
int32_t
syncNodeReplicate
One
(
SSyncNode
*
pSyncNode
,
SRaftId
*
pDestId
,
bool
snapshot
);
int32_t
syncNodeReplicate
Reset
(
SSyncNode
*
pSyncNode
,
SRaftId
*
pDestId
);
int32_t
syncNodeReplicateWithoutLock
(
SSyncNode
*
pNode
);
int32_t
syncNodeSendAppendEntries
(
SSyncNode
*
pNode
,
const
SRaftId
*
destRaftId
,
SRpcMsg
*
pRpcMsg
);
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
38a6d02c
...
...
@@ -301,7 +301,7 @@ int32_t syncBeginSnapshot(int64_t rid, int64_t lastApplyIndex) {
syncNodeRelease
(
pSyncNode
);
return
0
;
}
logRetention
=
TMAX
(
logRetention
,
lastApplyIndex
-
pSyncNode
->
minMatchIndex
);
logRetention
=
TMAX
(
logRetention
,
lastApplyIndex
-
pSyncNode
->
minMatchIndex
+
logRetention
);
}
_DEL_WAL:
...
...
@@ -1082,21 +1082,15 @@ void syncNodePreClose(SSyncNode* pSyncNode) {
ASSERT
(
pSyncNode
->
pFsm
!=
NULL
);
ASSERT
(
pSyncNode
->
pFsm
->
FpApplyQueueItems
!=
NULL
);
while
(
1
)
{
int32_t
aqItems
=
pSyncNode
->
pFsm
->
FpApplyQueueItems
(
pSyncNode
->
pFsm
);
sTrace
(
"vgId:%d, pre close, %d items in apply queue"
,
pSyncNode
->
vgId
,
aqItems
);
if
(
aqItems
==
0
||
aqItems
==
-
1
)
{
break
;
}
taosMsleep
(
20
);
}
// stop elect timer
syncNodeStopElectTimer
(
pSyncNode
);
// stop heartbeat timer
syncNodeStopHeartbeatTimer
(
pSyncNode
);
// stop ping timer
syncNodeStopPingTimer
(
pSyncNode
);
// clean rsp
syncRespCleanRsp
(
pSyncNode
->
pSyncRespMgr
);
}
...
...
@@ -1120,10 +1114,11 @@ void syncNodeClose(SSyncNode* pSyncNode) {
if
(
pSyncNode
==
NULL
)
return
;
sNInfo
(
pSyncNode
,
"sync close, node:%p"
,
pSyncNode
);
syncRespCleanRsp
(
pSyncNode
->
pSyncRespMgr
);
syncNodeStopPingTimer
(
pSyncNode
);
syncNodeStopElectTimer
(
pSyncNode
);
syncNodeStopHeartbeatTimer
(
pSyncNode
);
syncNodeLogReplMgrDestroy
(
pSyncNode
);
syncRespMgrDestroy
(
pSyncNode
->
pSyncRespMgr
);
...
...
source/libs/sync/src/syncPipeline.c
浏览文件 @
38a6d02c
...
...
@@ -742,7 +742,8 @@ int32_t syncLogReplMgrProcessReplyAsRecovery(SSyncLogReplMgr* pMgr, SSyncNode* p
if
(
pMsg
->
matchIndex
<
pNode
->
pLogBuf
->
matchIndex
)
{
term
=
syncLogReplMgrGetPrevLogTerm
(
pMgr
,
pNode
,
index
+
1
);
if
(
term
<
0
||
(
term
!=
pMsg
->
lastMatchTerm
&&
(
index
+
1
==
firstVer
||
index
==
firstVer
)))
{
if
((
index
+
1
<
firstVer
)
||
(
term
<
0
)
||
(
term
!=
pMsg
->
lastMatchTerm
&&
(
index
+
1
==
firstVer
||
index
==
firstVer
)))
{
ASSERT
(
term
>=
0
||
terrno
==
TSDB_CODE_WAL_LOG_NOT_EXIST
);
if
(
syncNodeStartSnapshot
(
pNode
,
&
destId
)
<
0
)
{
sError
(
"vgId:%d, failed to start snapshot for peer dnode:%d"
,
pNode
->
vgId
,
DID
(
&
destId
));
...
...
source/libs/sync/src/syncReplication.c
浏览文件 @
38a6d02c
...
...
@@ -48,6 +48,15 @@
int32_t
syncNodeMaybeSendAppendEntries
(
SSyncNode
*
pSyncNode
,
const
SRaftId
*
destRaftId
,
SRpcMsg
*
pRpcMsg
);
int32_t
syncNodeReplicateReset
(
SSyncNode
*
pNode
,
SRaftId
*
pDestId
)
{
SSyncLogBuffer
*
pBuf
=
pNode
->
pLogBuf
;
taosThreadMutexLock
(
&
pBuf
->
mutex
);
SSyncLogReplMgr
*
pMgr
=
syncNodeGetLogReplMgr
(
pNode
,
pDestId
);
syncLogReplMgrReset
(
pMgr
);
taosThreadMutexUnlock
(
&
pBuf
->
mutex
);
return
0
;
}
int32_t
syncNodeReplicate
(
SSyncNode
*
pNode
)
{
SSyncLogBuffer
*
pBuf
=
pNode
->
pLogBuf
;
taosThreadMutexLock
(
&
pBuf
->
mutex
);
...
...
source/libs/sync/src/syncSnapshot.c
浏览文件 @
38a6d02c
...
...
@@ -992,8 +992,7 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) {
if
(
pMsg
->
ack
==
SYNC_SNAPSHOT_SEQ_END
)
{
syncLogRecvSyncSnapshotRsp
(
pSyncNode
,
pMsg
,
"process seq end"
);
snapshotSenderStop
(
pSender
,
true
);
SSyncLogReplMgr
*
pMgr
=
syncNodeGetLogReplMgr
(
pSyncNode
,
&
pMsg
->
srcId
);
syncLogReplMgrReset
(
pMgr
);
syncNodeReplicateReset
(
pSyncNode
,
&
pMsg
->
srcId
);
return
0
;
}
...
...
@@ -1018,8 +1017,7 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) {
syncLogRecvSyncSnapshotRsp
(
pSyncNode
,
pMsg
,
"receive error ack"
);
sSError
(
pSender
,
"snapshot sender receive error ack:%d, my seq:%d"
,
pMsg
->
ack
,
pSender
->
seq
);
snapshotSenderStop
(
pSender
,
true
);
SSyncLogReplMgr
*
pMgr
=
syncNodeGetLogReplMgr
(
pSyncNode
,
&
pMsg
->
srcId
);
syncLogReplMgrReset
(
pMgr
);
syncNodeReplicateReset
(
pSyncNode
,
&
pMsg
->
srcId
);
return
-
1
;
}
...
...
@@ -1027,8 +1025,6 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) {
_ERROR:
snapshotSenderStop
(
pSender
,
true
);
SSyncLogReplMgr
*
pMgr
=
syncNodeGetLogReplMgr
(
pSyncNode
,
&
pMsg
->
srcId
);
syncLogReplMgrReset
(
pMgr
);
syncNodeReplicateReset
(
pSyncNode
,
&
pMsg
->
srcId
);
return
-
1
;
}
source/libs/transport/src/transCli.c
浏览文件 @
38a6d02c
...
...
@@ -425,21 +425,6 @@ void cliHandleResp(SCliConn* conn) {
tDebug
(
"%s conn %p ref by app"
,
CONN_GET_INST_LABEL
(
conn
),
conn
);
}
// if (TMSG_INFO(pHead->msgType - 1) != 0) {
// char buf[128] = {0};
// sprintf(buf, "%s", TMSG_INFO(pHead->msgType - 1));
// int* count = taosHashGet(pThrd->msgCount, TMSG_INFO(pHead->msgType - 1), strlen(TMSG_INFO(pHead->msgType - 1)));
// if (NULL == 0) {
// int localCount = 1;
// taosHashPut(pThrd->msgCount, TMSG_INFO(pHead->msgType - 1), strlen(TMSG_INFO(pHead->msgType - 1)), &localCount,
// sizeof(localCount));
// } else {
// int localCount = *count - 1;
// taosHashPut(pThrd->msgCount, TMSG_INFO(pHead->msgType - 1), strlen(TMSG_INFO(pHead->msgType - 1)), &localCount,
// sizeof(localCount));
// }
// }
STraceId
*
trace
=
&
transMsg
.
info
.
traceId
;
tGDebug
(
"%s conn %p %s received from %s, local info:%s, len:%d, code str:%s"
,
CONN_GET_INST_LABEL
(
conn
),
conn
,
TMSG_INFO
(
pHead
->
msgType
),
conn
->
dst
,
conn
->
src
,
pHead
->
msgLen
,
tstrerror
(
transMsg
.
code
));
...
...
@@ -1118,19 +1103,6 @@ void cliSend(SCliConn* pConn) {
msgLen
=
(
int32_t
)
ntohl
((
uint32_t
)(
pHead
->
msgLen
));
}
// if (tmsgIsValid(pHead->msgType)) {
// char buf[128] = {0};
// sprintf(buf, "%s", TMSG_INFO(pHead->msgType));
// int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf));
// if (NULL == 0) {
// int localCount = 1;
// taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount));
// } else {
// int localCount = *count + 1;
// taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount));
// }
// }
tGDebug
(
"%s conn %p %s is sent to %s, local info %s, len:%d"
,
CONN_GET_INST_LABEL
(
pConn
),
pConn
,
TMSG_INFO
(
pHead
->
msgType
),
pConn
->
dst
,
pConn
->
src
,
msgLen
);
...
...
@@ -1525,16 +1497,19 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) {
destroyCmsg
(
pMsg
);
return
;
}
if
(
tmsgIsValid
(
pMsg
->
msg
.
msgType
))
{
char
buf
[
128
]
=
{
0
};
sprintf
(
buf
,
"%s"
,
TMSG_INFO
(
pMsg
->
msg
.
msgType
));
int
*
count
=
taosHashGet
(
pThrd
->
msgCount
,
buf
,
sizeof
(
buf
));
if
(
NULL
==
0
)
{
int
localCount
=
1
;
taosHashPut
(
pThrd
->
msgCount
,
buf
,
sizeof
(
buf
),
&
localCount
,
sizeof
(
localCount
));
}
else
{
int
localCount
=
*
count
+
1
;
taosHashPut
(
pThrd
->
msgCount
,
buf
,
sizeof
(
buf
),
&
localCount
,
sizeof
(
localCount
));
if
(
rpcDebugFlag
&
DEBUG_TRACE
)
{
if
(
tmsgIsValid
(
pMsg
->
msg
.
msgType
))
{
char
buf
[
128
]
=
{
0
};
sprintf
(
buf
,
"%s"
,
TMSG_INFO
(
pMsg
->
msg
.
msgType
));
int
*
count
=
taosHashGet
(
pThrd
->
msgCount
,
buf
,
sizeof
(
buf
));
if
(
NULL
==
0
)
{
int
localCount
=
1
;
taosHashPut
(
pThrd
->
msgCount
,
buf
,
sizeof
(
buf
),
&
localCount
,
sizeof
(
localCount
));
}
else
{
int
localCount
=
*
count
+
1
;
taosHashPut
(
pThrd
->
msgCount
,
buf
,
sizeof
(
buf
),
&
localCount
,
sizeof
(
localCount
));
}
}
}
...
...
@@ -1782,18 +1757,20 @@ static void cliAsyncCb(uv_async_t* handle) {
QUEUE_MOVE
(
&
item
->
qmsg
,
&
wq
);
taosThreadMutexUnlock
(
&
item
->
mtx
);
void
*
pIter
=
taosHashIterate
(
pThrd
->
msgCount
,
NULL
);
while
(
pIter
!=
NULL
)
{
int
*
count
=
pIter
;
size_t
len
=
0
;
char
*
key
=
taosHashGetKey
(
pIter
,
&
len
);
if
(
*
count
!=
0
)
{
tDebug
(
"key: %s count: %d"
,
key
,
*
count
);
}
if
(
rpcDebugFlag
&
DEBUG_TRACE
)
{
void
*
pIter
=
taosHashIterate
(
pThrd
->
msgCount
,
NULL
);
while
(
pIter
!=
NULL
)
{
int
*
count
=
pIter
;
size_t
len
=
0
;
char
*
key
=
taosHashGetKey
(
pIter
,
&
len
);
if
(
*
count
!=
0
)
{
tDebug
(
"key: %s count: %d"
,
key
,
*
count
);
}
pIter
=
taosHashIterate
(
pThrd
->
msgCount
,
pIter
);
pIter
=
taosHashIterate
(
pThrd
->
msgCount
,
pIter
);
}
tDebug
(
"all conn count: %d"
,
pThrd
->
newConnCount
);
}
tDebug
(
"all conn count: %d"
,
pThrd
->
newConnCount
);
int8_t
supportBatch
=
pTransInst
->
supportBatch
;
if
(
supportBatch
==
0
)
{
...
...
@@ -2379,17 +2356,18 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
tGTrace
(
"%s conn %p extract epset from msg"
,
CONN_GET_INST_LABEL
(
pConn
),
pConn
);
}
}
if
(
tmsgIsValid
(
pResp
->
msgType
-
1
))
{
char
buf
[
128
]
=
{
0
};
sprintf
(
buf
,
"%s"
,
TMSG_INFO
(
pResp
->
msgType
-
1
));
int
*
count
=
taosHashGet
(
pThrd
->
msgCount
,
buf
,
sizeof
(
buf
));
if
(
NULL
==
0
)
{
int
localCount
=
0
;
taosHashPut
(
pThrd
->
msgCount
,
buf
,
sizeof
(
buf
),
&
localCount
,
sizeof
(
localCount
));
}
else
{
int
localCount
=
*
count
-
1
;
taosHashPut
(
pThrd
->
msgCount
,
buf
,
sizeof
(
buf
),
&
localCount
,
sizeof
(
localCount
));
if
(
rpcDebugFlag
&
DEBUG_TRACE
)
{
if
(
tmsgIsValid
(
pResp
->
msgType
-
1
))
{
char
buf
[
128
]
=
{
0
};
sprintf
(
buf
,
"%s"
,
TMSG_INFO
(
pResp
->
msgType
-
1
));
int
*
count
=
taosHashGet
(
pThrd
->
msgCount
,
buf
,
sizeof
(
buf
));
if
(
NULL
==
0
)
{
int
localCount
=
0
;
taosHashPut
(
pThrd
->
msgCount
,
buf
,
sizeof
(
buf
),
&
localCount
,
sizeof
(
localCount
));
}
else
{
int
localCount
=
*
count
-
1
;
taosHashPut
(
pThrd
->
msgCount
,
buf
,
sizeof
(
buf
),
&
localCount
,
sizeof
(
localCount
));
}
}
}
if
(
pCtx
->
pSem
!=
NULL
)
{
...
...
source/os/src/osRand.c
浏览文件 @
38a6d02c
...
...
@@ -25,7 +25,15 @@
void
taosSeedRand
(
uint32_t
seed
)
{
return
srand
(
seed
);
}
uint32_t
taosRand
(
void
)
{
return
rand
();
}
uint32_t
taosRand
(
void
)
{
#ifdef WINDOWS
unsigned
int
pSeed
;
rand_s
(
&
pSeed
);
return
pSeed
;
#else
return
rand
();
#endif
}
uint32_t
taosRandR
(
uint32_t
*
pSeed
)
{
#ifdef WINDOWS
...
...
source/util/src/terror.c
浏览文件 @
38a6d02c
...
...
@@ -184,6 +184,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_ACCTS, "Too many accounts")
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_USER_ALREADY_EXIST
,
"User already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_USER_NOT_EXIST
,
"Invalid user"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_USER_FORMAT
,
"Invalid user format"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_USER_NOT_AVAILABLE
,
"User not available"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_PASS_FORMAT
,
"Invalid password format"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_NO_USER_FROM_CONN
,
"Can not get user from conn"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TOO_MANY_USERS
,
"Too many users"
)
...
...
@@ -211,8 +212,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC_BUFSIZE, "Invalid func bufSize"
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_FUNC_COMMENT
,
"Invalid func comment"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_FUNC_RETRIEVE
,
"Invalid func retrieve msg"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TAG_INDEX_ALREADY_EXIST
,
"
Tag
index already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TAG_INDEX_NOT_EXIST
,
"
Tag index not exists
"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TAG_INDEX_ALREADY_EXIST
,
"index already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TAG_INDEX_NOT_EXIST
,
"
index not exist
"
)
// mnode-db
...
...
@@ -301,9 +302,9 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_STREAMS, "Too many streams")
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_TARGET_TABLE
,
"Cannot write the same stable as other stream"
)
// mnode-sma
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_SMA_ALREADY_EXIST
,
"
SMA
already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_SMA_NOT_EXIST
,
"
SMA does
not exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_SMA_OPTION
,
"Invalid sma option"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_SMA_ALREADY_EXIST
,
"
index
already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_SMA_NOT_EXIST
,
"
index
not exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_SMA_OPTION
,
"Invalid sma
index
option"
)
// dnode
TAOS_DEFINE_ERROR
(
TSDB_CODE_DNODE_OFFLINE
,
"Dnode is offline"
)
...
...
tests/parallel_test/cases.task
浏览文件 @
38a6d02c
...
...
@@ -733,7 +733,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg-mutilCtb.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-1ctb-funcNFilter.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb-funcNFilter.py
#
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqAutoCreateTbl.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDnodeRestart.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDnodeRestart1.py
...
...
tests/parallel_test/run_case.sh
浏览文件 @
38a6d02c
...
...
@@ -69,12 +69,19 @@ ulimit -c unlimited
md5sum
/usr/lib/libtaos.so.1
md5sum
/home/TDinternal/debug/build/lib/libtaos.so
#define taospy 2.7.3
pip3 list|grep taospy
pip3 uninstall taospy
-y
pip3
install
taospy
==
2.7.3
$TIMEOUT_CMD
$cmd
RET
=
$?
echo
"cmd exit code:
$RET
"
md5sum
/usr/lib/libtaos.so.1
md5sum
/home/TDinternal/debug/build/lib/libtaos.so
if
[
$RET
-ne
0
]
;
then
pwd
fi
...
...
tests/parallel_test/run_container.sh
浏览文件 @
38a6d02c
...
...
@@ -130,8 +130,6 @@ docker run \
-v
${
SOURCEDIR
}
:/usr/local/src/
\
-v
"
$TMP_DIR
/thread_volume/
$thread_no
/sim:
${
SIM_DIR
}
"
\
-v
${
TMP_DIR
}
/thread_volume/
$thread_no
/coredump:
$coredump_dir
\
-v
$WORKDIR
/taos-connector-python/taos:/usr/local/lib/python3.8/site-packages/taos:ro
\
-v
$WORKDIR
/taos-connector-python/taosrest:/usr/local/lib/python3.8/site-packages/taosrest:ro
\
--rm
--ulimit
core
=
-1
taos_test:v1.0
$CONTAINER_TESTDIR
/tests/parallel_test/run_case.sh
-d
"
$exec_dir
"
-c
"
$cmd
"
$extra_param
ret
=
$?
exit
$ret
...
...
tests/script/tsim/db/alter_option.sim
浏览文件 @
38a6d02c
...
...
@@ -285,8 +285,6 @@ sql_error alter database db keep -1
print ============== modify minrows
sql_error alter database db minrows 8
sql_error alter database db minrows 200
sql_error alter database db minrows 11
sql_error alter database db minrows 8000
sql_error alter database db minrows 8001
...
...
tests/script/tsim/dnode/offline_reason.sim
浏览文件 @
38a6d02c
...
...
@@ -8,10 +8,10 @@ sql connect
sql create dnode $hostname port 7200
sql select * from information_schema.ins_dnodes
print dnode1 off: $data(1)[
6
]
print dnode2 off: $data(2)[
6
]
print dnode1 off: $data(1)[
7
]
print dnode2 off: $data(2)[
7
]
if $data(2)[
6
] != @status not received@ then
if $data(2)[
7
] != @status not received@ then
return -1
endi
...
...
@@ -50,9 +50,9 @@ step3:
return -1
endi
sql select * from information_schema.ins_dnodes
print dnode1 off: $data(1)[
6
]
print dnode2 off: $data(2)[
6
]
if $data(2)[
6
] != @status msg timeout@ then
print dnode1 off: $data(1)[
7
]
print dnode2 off: $data(2)[
7
]
if $data(2)[
7
] != @status msg timeout@ then
goto step3
endi
...
...
@@ -77,9 +77,9 @@ step5:
endi
sql select * from information_schema.ins_dnodes
print dnode1 off: $data(1)[
6
]
print dnode2 off: $data(3)[
6
]
if $data(3)[
6
] != @dnodeId not match@ then
print dnode1 off: $data(1)[
7
]
print dnode2 off: $data(3)[
7
]
if $data(3)[
7
] != @dnodeId not match@ then
goto step5
endi
...
...
@@ -98,10 +98,10 @@ step6:
endi
sql select * from information_schema.ins_dnodes
print dnode1 off: $data(1)[
6
]
print dnode2 off: $data(3)[
6
]
print dnode3 off: $data(4)[6
]
if $data(4)[
6
] != @interval not match@ then
print dnode1 off: $data(1)[
7
]
print dnode2 off: $data(3)[
7
]
print dnode3 off: $data(4)[6
7
if $data(4)[
7
] != @interval not match@ then
goto step6
endi
...
...
@@ -120,11 +120,11 @@ step7:
endi
sql select * from information_schema.ins_dnodes
print dnode1 off: $data(1)[
6
]
print dnode3 off: $data(3)[
6
]
print dnode4 off: $data(4)[
6
]
print dnode5 off: $data(5)[
6
]
if $data(5)[
6
] != @locale not match@ then
print dnode1 off: $data(1)[
7
]
print dnode3 off: $data(3)[
7
]
print dnode4 off: $data(4)[
7
]
print dnode5 off: $data(5)[
7
]
if $data(5)[
7
] != @locale not match@ then
goto step7
endi
...
...
@@ -143,12 +143,12 @@ step8:
endi
sql select * from information_schema.ins_dnodes
print dnode1 off: $data(1)[
6
]
print dnode3 off: $data(3)[
6
]
print dnode4 off: $data(4)[
6
]
print dnode5 off: $data(5)[
6
]
print dnode6 off: $data(6)[
6
]
if $data(6)[
6
] != @charset not match@ then
print dnode1 off: $data(1)[
7
]
print dnode3 off: $data(3)[
7
]
print dnode4 off: $data(4)[
7
]
print dnode5 off: $data(5)[
7
]
print dnode6 off: $data(6)[
7
]
if $data(6)[
7
] != @charset not match@ then
goto step8
endi
...
...
tests/script/tsim/stream/checkStreamSTable1.sim
0 → 100644
浏览文件 @
38a6d02c
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
print ===== step1
system sh/exec.sh -n dnode1 -s start
sleep 50
sql connect
print ===== step2
sql create database test vgroups 4;
sql use test;
sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int);
sql create table t1 using st tags(1,1,1);
sql create table t2 using st tags(2,2,2);
sql create stream streams1 trigger at_once into streamt1 as select _wstart, count(*) c1, count(a) c2 from st interval(1s) ;
sql insert into t1 values(1648791211000,1,2,3);
sql insert into t1 values(1648791212000,2,2,3);
$loop_count = 0
loop0:
sleep 300
$loop_count = $loop_count + 1
if $loop_count == 10 then
return -1
endi
print 1 select * from streamt1;
sql select * from streamt1;
if $rows != 2 then
print rows=$rows
goto loop0
endi
print drop stream streams1
sql drop stream streams1;
print alter table streamt1 add column c3 double
sql alter table streamt1 add column c3 double;
print create stream streams1 trigger at_once into streamt1 as select _wstart, count(*) c1, count(a) c2, avg(b) c3 from st interval(1s) ;
sql create stream streams1 trigger at_once into streamt1 as select _wstart, count(*) c1, count(a) c2, avg(b) c3 from st interval(1s) ;
sql insert into t2 values(1648791213000,1,2,3);
sql insert into t1 values(1648791214000,1,2,3);
$loop_count = 0
loop1:
sleep 300
$loop_count = $loop_count + 1
if $loop_count == 10 then
return -1
endi
print 2 select * from streamt1;
sql select * from streamt1;
if $rows != 4 then
print rows=$rows
goto loop1
endi
print ======over
system sh/stop_dnodes.sh
tests/script/tsim/tag/tbNameIn.sim
浏览文件 @
38a6d02c
...
...
@@ -99,4 +99,14 @@ if $rows != 7 then
return -1
endi
sql select * from st1 where tbname in('tb1') and tbname in ('tb2');
if $rows != 0 then
return -1
endi
sql select * from st1 where tbname in ('tb1') and tbname != 'tb1';
if $rows != 0 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
tests/system-test/2-query/mavg.py
浏览文件 @
38a6d02c
...
...
@@ -716,8 +716,6 @@ class TDTestCase:
tdSql
.
checkRows
(
2
)
# partition by col
tdSql
.
query
(
f
"select c1 , mavg(c1,3) from
{
dbname
}
.stb1 partition by c1"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
f
"select c1 , mavg(c1,1) from
{
dbname
}
.stb1 partition by c1"
)
tdSql
.
checkRows
(
40
)
tdSql
.
query
(
f
"select c1, c2, c3, c4, mavg(c1,3) from
{
dbname
}
.stb1 partition by tbname "
)
...
...
tests/system-test/2-query/odbc.py
浏览文件 @
38a6d02c
...
...
@@ -22,7 +22,7 @@ class TDTestCase:
tdSql
.
execute
(
"insert into db.ctb using db.stb tags(1) (ts, c1) values (now, 1)"
)
tdSql
.
query
(
"select count(*) from information_schema.ins_columns"
)
tdSql
.
checkData
(
0
,
0
,
2
69
)
tdSql
.
checkData
(
0
,
0
,
2
71
)
tdSql
.
query
(
"select * from information_schema.ins_columns where table_name = 'ntb'"
)
tdSql
.
checkRows
(
14
)
...
...
tests/system-test/7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py
浏览文件 @
38a6d02c
...
...
@@ -18,8 +18,8 @@ from tmqCommon import *
class
TDTestCase
:
def
__init__
(
self
):
self
.
vgroups
=
4
self
.
ctbNum
=
3
000
self
.
rowsPerTbl
=
7
0
self
.
ctbNum
=
1
000
self
.
rowsPerTbl
=
10
0
def
init
(
self
,
conn
,
logSql
,
replicaVar
=
1
):
self
.
replicaVar
=
int
(
replicaVar
)
...
...
@@ -112,15 +112,15 @@ class TDTestCase:
# init consume info, and start tmq_sim, then check consume result
tdLog
.
info
(
"insert consume info to consume processor"
)
consumerId
=
3
expectrowcnt
=
math
.
ceil
(
paraDict
[
"rowsPerTbl"
]
*
paraDict
[
"ctbNum"
]
/
3
)
expectrowcnt
=
math
.
ceil
(
paraDict
[
"rowsPerTbl"
]
*
paraDict
[
"ctbNum"
])
topicList
=
topicNameList
[
0
]
ifcheckdata
=
1
ifManualCommit
=
1
keyList
=
'group.id:cgrp
1, enable.auto.commit:true, auto.commit.interval.ms:10
00, auto.offset.reset:earliest'
keyList
=
'group.id:cgrp
3, enable.auto.commit:true, auto.commit.interval.ms:1
00, auto.offset.reset:earliest'
tmqCom
.
insertConsumerInfo
(
consumerId
,
expectrowcnt
,
topicList
,
keyList
,
ifcheckdata
,
ifManualCommit
)
consumerId
=
4
expectrowcnt
=
math
.
ceil
(
paraDict
[
"rowsPerTbl"
]
*
paraDict
[
"ctbNum"
]
*
2
/
3
)
expectrowcnt
=
math
.
ceil
(
paraDict
[
"rowsPerTbl"
]
*
paraDict
[
"ctbNum"
])
tmqCom
.
insertConsumerInfo
(
consumerId
,
expectrowcnt
,
topicList
,
keyList
,
ifcheckdata
,
ifManualCommit
)
tdLog
.
info
(
"start consume processor 0"
)
...
...
@@ -131,8 +131,8 @@ class TDTestCase:
resultList
=
tmqCom
.
selectConsumeResult
(
expectRows
)
actConsumeTotalRows
=
resultList
[
0
]
+
resultList
[
1
]
if
not
(
totalRowsInserted
==
actConsumeTotalRows
):
tdLog
.
info
(
"sum of two consume rows: %d should be equal to total inserted rows: %d"
%
(
actConsumeTotalRows
,
totalRowsInserted
))
tdLog
.
info
(
"sum of two consume rows: %d should be greater than or equal to total inserted rows: %d"
%
(
actConsumeTotalRows
,
totalRowsInserted
))
if
not
(
totalRowsInserted
<=
actConsumeTotalRows
):
tdLog
.
exit
(
"%d tmq consume rows error!"
%
consumerId
)
time
.
sleep
(
10
)
...
...
@@ -188,7 +188,7 @@ class TDTestCase:
topicList
=
topicNameList
[
0
]
ifcheckdata
=
1
ifManualCommit
=
1
keyList
=
'group.id:cgrp
1, enable.auto.commit:true, auto.commit.interval.ms:10
00, auto.offset.reset:earliest'
keyList
=
'group.id:cgrp
4, enable.auto.commit:true, auto.commit.interval.ms:1
00, auto.offset.reset:earliest'
tmqCom
.
insertConsumerInfo
(
consumerId
,
expectrowcnt
,
topicList
,
keyList
,
ifcheckdata
,
ifManualCommit
)
tdLog
.
info
(
"start consume processor 0"
)
...
...
@@ -216,9 +216,9 @@ class TDTestCase:
actConsumeTotalRows
=
resultList
[
0
]
if
not
(
actConsumeTotalRows
>
0
and
actConsumeTotalRows
<
totalRowsInserted
):
tdLog
.
info
(
"act consume rows: %d"
%
(
actConsumeTotalRows
))
tdLog
.
info
(
"and second consume rows should be between 0 and %d"
%
(
totalRowsInserted
))
tdLog
.
info
(
"act consume rows: %d"
%
(
actConsumeTotalRows
))
tdLog
.
info
(
"and second consume rows should be between 0 and %d"
%
(
totalRowsInserted
))
if
not
(
actConsumeTotalRows
>
0
and
actConsumeTotalRows
<=
totalRowsInserted
):
tdLog
.
exit
(
"%d tmq consume rows error!"
%
consumerId
)
time
.
sleep
(
10
)
...
...
tests/system-test/7-tmq/tmqConsFromTsdb1-mutilVg.py
浏览文件 @
38a6d02c
...
...
@@ -18,7 +18,7 @@ from tmqCommon import *
class
TDTestCase
:
def
__init__
(
self
):
self
.
vgroups
=
4
self
.
ctbNum
=
10
self
.
ctbNum
=
4
self
.
rowsPerTbl
=
10000
def
init
(
self
,
conn
,
logSql
,
replicaVar
=
1
):
...
...
@@ -41,7 +41,7 @@ class TDTestCase:
'ctbStartIdx'
:
0
,
'ctbNum'
:
10
,
'rowsPerTbl'
:
10000
,
'batchNum'
:
10
,
'batchNum'
:
10
00
,
'startTs'
:
1640966400000
,
# 2022-01-01 00:00:00.000
'pollDelay'
:
3
,
'showMsg'
:
1
,
...
...
@@ -112,15 +112,15 @@ class TDTestCase:
# init consume info, and start tmq_sim, then check consume result
tdLog
.
info
(
"insert consume info to consume processor"
)
consumerId
=
3
expectrowcnt
=
math
.
ceil
(
paraDict
[
"rowsPerTbl"
]
*
paraDict
[
"ctbNum"
]
/
3
)
expectrowcnt
=
math
.
ceil
(
paraDict
[
"rowsPerTbl"
]
*
paraDict
[
"ctbNum"
])
topicList
=
topicNameList
[
0
]
ifcheckdata
=
1
ifManualCommit
=
1
keyList
=
'group.id:cgrp
1
, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest'
keyList
=
'group.id:cgrp
3
, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest'
tmqCom
.
insertConsumerInfo
(
consumerId
,
expectrowcnt
,
topicList
,
keyList
,
ifcheckdata
,
ifManualCommit
)
consumerId
=
4
expectrowcnt
=
math
.
ceil
(
paraDict
[
"rowsPerTbl"
]
*
paraDict
[
"ctbNum"
]
*
2
/
3
)
expectrowcnt
=
math
.
ceil
(
paraDict
[
"rowsPerTbl"
]
*
paraDict
[
"ctbNum"
])
tmqCom
.
insertConsumerInfo
(
consumerId
,
expectrowcnt
,
topicList
,
keyList
,
ifcheckdata
,
ifManualCommit
)
tdLog
.
info
(
"start consume processor 0"
)
...
...
@@ -130,9 +130,9 @@ class TDTestCase:
expectRows
=
2
resultList
=
tmqCom
.
selectConsumeResult
(
expectRows
)
actConsumeTotalRows
=
resultList
[
0
]
+
resultList
[
1
]
if
not
(
totalRowsInserted
==
actConsumeTotalRows
):
tdLog
.
info
(
"sum of two consume rows: %d should be equal to total inserted rows: %d"
%
(
actConsumeTotalRows
,
totalRowsInserted
))
tdLog
.
info
(
"sum of two consume rows: %d should be greater than or equal to total inserted rows: %d"
%
(
actConsumeTotalRows
,
totalRowsInserted
))
if
not
(
totalRowsInserted
<=
actConsumeTotalRows
):
tdLog
.
exit
(
"%d tmq consume rows error!"
%
consumerId
)
time
.
sleep
(
10
)
...
...
@@ -188,7 +188,7 @@ class TDTestCase:
topicList
=
topicNameList
[
0
]
ifcheckdata
=
1
ifManualCommit
=
1
keyList
=
'group.id:cgrp
1
, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest'
keyList
=
'group.id:cgrp
4
, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest'
tmqCom
.
insertConsumerInfo
(
consumerId
,
expectrowcnt
,
topicList
,
keyList
,
ifcheckdata
,
ifManualCommit
)
tdLog
.
info
(
"start consume processor 0"
)
...
...
@@ -216,7 +216,7 @@ class TDTestCase:
actConsumeTotalRows
=
resultList
[
0
]
if
not
(
actConsumeTotalRows
>
0
and
actConsumeTotalRows
<
totalRowsInserted
):
if
not
(
actConsumeTotalRows
>
0
and
actConsumeTotalRows
<
=
totalRowsInserted
):
tdLog
.
info
(
"act consume rows: %d"
%
(
actConsumeTotalRows
))
tdLog
.
info
(
"and second consume rows should be between 0 and %d"
%
(
totalRowsInserted
))
tdLog
.
exit
(
"%d tmq consume rows error!"
%
consumerId
)
...
...
tests/system-test/7-tmq/tmqConsFromTsdb1.py
浏览文件 @
38a6d02c
...
...
@@ -41,7 +41,7 @@ class TDTestCase:
'ctbStartIdx'
:
0
,
'ctbNum'
:
10
,
'rowsPerTbl'
:
10000
,
'batchNum'
:
10
,
'batchNum'
:
10
0
,
'startTs'
:
1640966400000
,
# 2022-01-01 00:00:00.000
'pollDelay'
:
3
,
'showMsg'
:
1
,
...
...
@@ -87,7 +87,7 @@ class TDTestCase:
'rowsPerTbl'
:
10000
,
'batchNum'
:
10
,
'startTs'
:
1640966400000
,
# 2022-01-01 00:00:00.000
'pollDelay'
:
25
,
'pollDelay'
:
10
,
'showMsg'
:
1
,
'showRow'
:
1
,
'snapshot'
:
1
}
...
...
@@ -116,7 +116,7 @@ class TDTestCase:
topicList
=
topicNameList
[
0
]
ifcheckdata
=
1
ifManualCommit
=
1
keyList
=
'group.id:cgrp
1
, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest'
keyList
=
'group.id:cgrp
3
, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest'
tmqCom
.
insertConsumerInfo
(
consumerId
,
expectrowcnt
,
topicList
,
keyList
,
ifcheckdata
,
ifManualCommit
)
consumerId
=
4
...
...
@@ -131,8 +131,8 @@ class TDTestCase:
resultList
=
tmqCom
.
selectConsumeResult
(
expectRows
)
actConsumeTotalRows
=
resultList
[
0
]
+
resultList
[
1
]
tdLog
.
info
(
"sum of two consume rows: %d should be equal to total inserted rows: %d"
%
(
actConsumeTotalRows
,
totalRowsInserted
))
if
not
(
totalRowsInserted
==
actConsumeTotalRows
):
tdLog
.
info
(
"sum of two consume rows: %d should be equal to total inserted rows: %d"
%
(
actConsumeTotalRows
,
totalRowsInserted
))
tdLog
.
exit
(
"%d tmq consume rows error!"
%
consumerId
)
time
.
sleep
(
10
)
...
...
@@ -188,7 +188,7 @@ class TDTestCase:
topicList
=
topicNameList
[
0
]
ifcheckdata
=
1
ifManualCommit
=
1
keyList
=
'group.id:cgrp
1
, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest'
keyList
=
'group.id:cgrp
4
, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest'
tmqCom
.
insertConsumerInfo
(
consumerId
,
expectrowcnt
,
topicList
,
keyList
,
ifcheckdata
,
ifManualCommit
)
tdLog
.
info
(
"start consume processor 0"
)
...
...
@@ -213,12 +213,11 @@ class TDTestCase:
expectRows
=
1
resultList
=
tmqCom
.
selectConsumeResult
(
expectRows
)
actConsumeTotalRows
=
resultList
[
0
]
if
not
(
actConsumeTotalRows
>
0
and
actConsumeTotalRows
<
totalRowsInserted
):
tdLog
.
info
(
"act consume rows: %d"
%
(
actConsumeTotalRows
))
tdLog
.
info
(
"and second consume rows should be between 0 and %d"
%
(
totalRowsInserted
))
tdLog
.
info
(
"act consume rows: %d"
%
(
actConsumeTotalRows
))
tdLog
.
info
(
"and second consume rows should be between 0 and %d"
%
(
totalRowsInserted
))
if
not
((
actConsumeTotalRows
>
0
)
and
(
actConsumeTotalRows
<=
totalRowsInserted
)):
tdLog
.
exit
(
"%d tmq consume rows error!"
%
consumerId
)
time
.
sleep
(
10
)
...
...
tools/shell/inc/shellInt.h
浏览文件 @
38a6d02c
...
...
@@ -83,7 +83,7 @@ typedef struct {
const
char
*
clientVersion
;
char
cusName
[
32
];
char
promptHeader
[
32
];
c
onst
char
*
promptContinue
;
c
har
promptContinue
[
32
]
;
const
char
*
osname
;
int32_t
promptSize
;
char
programVersion
[
256
];
...
...
tools/shell/src/shellArguments.c
浏览文件 @
38a6d02c
...
...
@@ -411,7 +411,9 @@ int32_t shellParseArgs(int32_t argc, char *argv[]) {
"Copyright (c) 2022 by %s, all rights reserved.
\r\n\r\n
"
;
strcpy
(
shell
.
info
.
cusName
,
cusName
);
sprintf
(
shell
.
info
.
promptHeader
,
"%s> "
,
cusPrompt
);
shell
.
info
.
promptContinue
=
TAOS_CONSOLE_PROMPT_CONTINUE
;
char
promptContinueFormat
[
32
]
=
{
0
};
sprintf
(
promptContinueFormat
,
"%%%zus> "
,
strlen
(
cusPrompt
));
sprintf
(
shell
.
info
.
promptContinue
,
promptContinueFormat
,
" "
);
shell
.
info
.
promptSize
=
strlen
(
shell
.
info
.
promptHeader
);
snprintf
(
shell
.
info
.
programVersion
,
sizeof
(
shell
.
info
.
programVersion
),
"version: %s compatible_version: %s
\n
gitinfo: %s
\n
buildInfo: %s"
,
version
,
compatible_version
,
gitinfo
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录