Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
824aed42
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看板
提交
824aed42
编写于
3月 03, 2023
作者:
wmmhello
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'feature/3_liaohj' of
https://github.com/taosdata/TDengine
into feature/3_liaohj
上级
6c68b36d
8d73d3df
变更
37
隐藏空白更改
内联
并排
Showing
37 changed file
with
742 addition
and
148 deletion
+742
-148
Jenkinsfile2
Jenkinsfile2
+3
-3
include/common/tmsg.h
include/common/tmsg.h
+7
-0
include/libs/nodes/cmdnodes.h
include/libs/nodes/cmdnodes.h
+1
-0
packaging/release.bat
packaging/release.bat
+2
-2
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+1
-1
source/common/src/tglobal.c
source/common/src/tglobal.c
+2
-4
source/common/src/tmsg.c
source/common/src/tmsg.c
+14
-0
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+2
-1
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+7
-0
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+48
-4
source/dnode/mnode/sdb/src/sdbHash.c
source/dnode/mnode/sdb/src/sdbHash.c
+1
-0
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+1
-0
source/dnode/vnode/src/tq/tqExec.c
source/dnode/vnode/src/tq/tqExec.c
+1
-1
source/dnode/vnode/src/tsdb/tsdbCache.c
source/dnode/vnode/src/tsdb/tsdbCache.c
+78
-21
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
+3
-1
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+2
-1
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+44
-22
source/libs/command/src/command.c
source/libs/command/src/command.c
+10
-6
source/libs/executor/src/eventwindowoperator.c
source/libs/executor/src/eventwindowoperator.c
+2
-1
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+11
-1
source/libs/scalar/src/sclvector.c
source/libs/scalar/src/sclvector.c
+1
-0
source/libs/stream/src/streamDispatch.c
source/libs/stream/src/streamDispatch.c
+1
-1
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+1
-1
source/libs/transport/src/transSvr.c
source/libs/transport/src/transSvr.c
+13
-4
source/libs/wal/src/walWrite.c
source/libs/wal/src/walWrite.c
+13
-0
source/os/src/osTimer.c
source/os/src/osTimer.c
+20
-19
tests/develop-test/2-query/show_create_db.py
tests/develop-test/2-query/show_create_db.py
+6
-6
tests/parallel_test/cases.task
tests/parallel_test/cases.task
+7
-1
tests/parallel_test/container_build.sh
tests/parallel_test/container_build.sh
+27
-0
tests/script/api/insertSameTs.c
tests/script/api/insertSameTs.c
+136
-0
tests/script/api/makefile
tests/script/api/makefile
+1
-0
tests/script/tsim/stream/basic0.sim
tests/script/tsim/stream/basic0.sim
+47
-15
tests/script/tsim/trans/create_stb.sim
tests/script/tsim/trans/create_stb.sim
+72
-0
tests/system-test/0-others/show.py
tests/system-test/0-others/show.py
+91
-16
tests/system-test/2-query/projectionDesc.py
tests/system-test/2-query/projectionDesc.py
+48
-0
tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb.py
tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb.py
+1
-1
tools/shell/src/shellEngine.c
tools/shell/src/shellEngine.c
+17
-15
未找到文件。
Jenkinsfile2
浏览文件 @
824aed42
...
...
@@ -40,7 +40,7 @@ def check_docs() {
sh '''
cd ${WKC}
git reset --hard
git clean -f
xd
git clean -f
rm -rf examples/rust/
git remote prune origin
git fetch
...
...
@@ -86,7 +86,7 @@ def pre_test(){
git fetch
cd ${WKC}
git reset --hard
git clean -f
xd
git clean -f
rm -rf examples/rust/
git remote prune origin
git fetch
...
...
@@ -201,7 +201,7 @@ def pre_test_win(){
'''
bat '''
cd %WIN_COMMUNITY_ROOT%
git clean -f
xd
git clean -f
git reset --hard
git remote prune origin
git fetch
...
...
include/common/tmsg.h
浏览文件 @
824aed42
...
...
@@ -929,12 +929,19 @@ typedef struct {
int32_t
minRows
;
int32_t
maxRows
;
int32_t
walFsyncPeriod
;
int16_t
hashPrefix
;
int16_t
hashSuffix
;
int8_t
walLevel
;
int8_t
precision
;
int8_t
compression
;
int8_t
replications
;
int8_t
strict
;
int8_t
cacheLast
;
int32_t
tsdbPageSize
;
int32_t
walRetentionPeriod
;
int32_t
walRollPeriod
;
int64_t
walRetentionSize
;
int64_t
walSegmentSize
;
int32_t
numOfRetensions
;
SArray
*
pRetensions
;
int8_t
schemaless
;
...
...
include/libs/nodes/cmdnodes.h
浏览文件 @
824aed42
...
...
@@ -265,6 +265,7 @@ typedef struct SShowStmt {
typedef
struct
SShowCreateDatabaseStmt
{
ENodeType
type
;
char
dbName
[
TSDB_DB_NAME_LEN
];
char
dbFName
[
TSDB_DB_FNAME_LEN
];
void
*
pCfg
;
// SDbCfgInfo
}
SShowCreateDatabaseStmt
;
...
...
packaging/release.bat
浏览文件 @
824aed42
...
...
@@ -46,9 +46,9 @@ rd /s /Q C:\TDengine
cmake
--install
.
if
not
%errorlevel%
==
0
(
call
:RUNFAILED
build
x64
failed
&
exit
/b
1
)
cd
%package_dir%
iscc
/DMyAppInstallName
=
"
%packagServerName
_x64
%
"
/DMyAppVersion
=
"
%
2"
/DMyAppExcludeSource
=
""
tools
\tdengine.iss
/O
..\release
iscc
/DMyAppInstallName
=
"
%packagServerName
_x64
%
"
/DMyAppVersion
=
"
%
2"
/DCusName
=
"TDengine"
/DCusPrompt
=
"taos"
/DMyAppExcludeSource
=
""
tools
\tdengine.iss
/O
..\release
if
not
%errorlevel%
==
0
(
call
:RUNFAILED
package
%packagServerName
_x64
%
failed
&
exit
/b
1
)
iscc
/DMyAppInstallName
=
"
%packagClientName
_x64
%
"
/DMyAppVersion
=
"
%
2"
/DMyAppExcludeSource
=
"taosd.exe"
tools
\tdengine.iss
/O
..\release
iscc
/DMyAppInstallName
=
"
%packagClientName
_x64
%
"
/DMyAppVersion
=
"
%
2"
/DCusName
=
"TDengine"
/DCusPrompt
=
"taos"
/DMyAppExcludeSource
=
"taosd.exe"
tools
\tdengine.iss
/O
..\release
if
not
%errorlevel%
==
0
(
call
:RUNFAILED
package
%packagClientName
_x64
%
failed
&
exit
/b
1
)
goto
EXIT0
...
...
source/common/src/tdatablock.c
浏览文件 @
824aed42
...
...
@@ -2003,7 +2003,7 @@ char* dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** pDataBuf)
switch
(
pColInfoData
->
info
.
type
)
{
case
TSDB_DATA_TYPE_TIMESTAMP
:
memset
(
pBuf
,
0
,
sizeof
(
pBuf
));
formatTimestamp
(
pBuf
,
*
(
uint64_t
*
)
var
,
TSDB_TIME_PRECISION_MILLI
);
formatTimestamp
(
pBuf
,
*
(
uint64_t
*
)
var
,
pColInfoData
->
info
.
precision
);
len
+=
snprintf
(
dumpBuf
+
len
,
size
-
len
,
" %25s |"
,
pBuf
);
if
(
len
>=
size
-
1
)
return
dumpBuf
;
break
;
...
...
source/common/src/tglobal.c
浏览文件 @
824aed42
...
...
@@ -41,8 +41,8 @@ bool tsPrintAuth = false;
// queue & threads
int32_t
tsNumOfRpcThreads
=
1
;
int32_t
tsNumOfRpcSessions
=
5
000
;
int32_t
tsTimeToGetAvailableConn
=
1
00000
;
int32_t
tsNumOfRpcSessions
=
6
000
;
int32_t
tsTimeToGetAvailableConn
=
5
00000
;
int32_t
tsNumOfCommitThreads
=
2
;
int32_t
tsNumOfTaskQueueThreads
=
4
;
int32_t
tsNumOfMnodeQueryThreads
=
4
;
...
...
@@ -521,7 +521,6 @@ static int32_t taosUpdateServerCfg(SConfig *pCfg) {
pItem
=
cfgGetItem
(
tsCfg
,
"numOfRpcSessions"
);
if
(
pItem
!=
NULL
&&
pItem
->
stype
==
CFG_STYPE_DEFAULT
)
{
tsNumOfRpcSessions
=
2000
;
tsNumOfRpcSessions
=
TRANGE
(
tsNumOfRpcSessions
,
100
,
10000
);
pItem
->
i32
=
tsNumOfRpcSessions
;
pItem
->
stype
=
stype
;
...
...
@@ -529,7 +528,6 @@ static int32_t taosUpdateServerCfg(SConfig *pCfg) {
pItem
=
cfgGetItem
(
tsCfg
,
"timeToGetAvailableConn"
);
if
(
pItem
!=
NULL
&&
pItem
->
stype
==
CFG_STYPE_DEFAULT
)
{
tsTimeToGetAvailableConn
=
1000
;
tsTimeToGetAvailableConn
=
TRANGE
(
tsTimeToGetAvailableConn
,
20
,
1000000
);
pItem
->
i32
=
tsTimeToGetAvailableConn
;
pItem
->
stype
=
stype
;
...
...
source/common/src/tmsg.c
浏览文件 @
824aed42
...
...
@@ -2865,12 +2865,19 @@ int32_t tSerializeSDbCfgRsp(void *buf, int32_t bufLen, const SDbCfgRsp *pRsp) {
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
minRows
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
maxRows
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
walFsyncPeriod
)
<
0
)
return
-
1
;
if
(
tEncodeI16
(
&
encoder
,
pRsp
->
hashPrefix
)
<
0
)
return
-
1
;
if
(
tEncodeI16
(
&
encoder
,
pRsp
->
hashSuffix
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
walLevel
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
precision
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
compression
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
replications
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
strict
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
cacheLast
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
tsdbPageSize
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
walRetentionPeriod
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
walRollPeriod
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pRsp
->
walRetentionSize
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pRsp
->
walSegmentSize
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
numOfRetensions
)
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
pRsp
->
numOfRetensions
;
++
i
)
{
SRetention
*
pRetension
=
taosArrayGet
(
pRsp
->
pRetensions
,
i
);
...
...
@@ -2905,12 +2912,19 @@ int32_t tDeserializeSDbCfgRsp(void *buf, int32_t bufLen, SDbCfgRsp *pRsp) {
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
minRows
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
maxRows
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
walFsyncPeriod
)
<
0
)
return
-
1
;
if
(
tDecodeI16
(
&
decoder
,
&
pRsp
->
hashPrefix
)
<
0
)
return
-
1
;
if
(
tDecodeI16
(
&
decoder
,
&
pRsp
->
hashSuffix
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
walLevel
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
precision
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
compression
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
replications
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
strict
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
cacheLast
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
tsdbPageSize
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
walRetentionPeriod
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
walRollPeriod
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pRsp
->
walRetentionSize
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pRsp
->
walSegmentSize
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
numOfRetensions
)
<
0
)
return
-
1
;
if
(
pRsp
->
numOfRetensions
>
0
)
{
pRsp
->
pRetensions
=
taosArrayInit
(
pRsp
->
numOfRetensions
,
sizeof
(
SRetention
));
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
824aed42
...
...
@@ -108,7 +108,8 @@ typedef enum {
TRN_STAGE_UNDO_ACTION
=
3
,
TRN_STAGE_COMMIT
=
4
,
TRN_STAGE_COMMIT_ACTION
=
5
,
TRN_STAGE_FINISHED
=
6
TRN_STAGE_FINISHED
=
6
,
TRN_STAGE_PRE_FINISH
=
7
}
ETrnStage
;
typedef
enum
{
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
824aed42
...
...
@@ -887,12 +887,19 @@ static int32_t mndProcessGetDbCfgReq(SRpcMsg *pReq) {
cfgRsp
.
minRows
=
pDb
->
cfg
.
minRows
;
cfgRsp
.
maxRows
=
pDb
->
cfg
.
maxRows
;
cfgRsp
.
walFsyncPeriod
=
pDb
->
cfg
.
walFsyncPeriod
;
cfgRsp
.
hashPrefix
=
pDb
->
cfg
.
hashPrefix
;
cfgRsp
.
hashSuffix
=
pDb
->
cfg
.
hashSuffix
;
cfgRsp
.
walLevel
=
pDb
->
cfg
.
walLevel
;
cfgRsp
.
precision
=
pDb
->
cfg
.
precision
;
cfgRsp
.
compression
=
pDb
->
cfg
.
compression
;
cfgRsp
.
replications
=
pDb
->
cfg
.
replications
;
cfgRsp
.
strict
=
pDb
->
cfg
.
strict
;
cfgRsp
.
cacheLast
=
pDb
->
cfg
.
cacheLast
;
cfgRsp
.
tsdbPageSize
=
pDb
->
cfg
.
tsdbPageSize
;
cfgRsp
.
walRetentionPeriod
=
pDb
->
cfg
.
walRetentionPeriod
;
cfgRsp
.
walRollPeriod
=
pDb
->
cfg
.
walRollPeriod
;
cfgRsp
.
walRetentionSize
=
pDb
->
cfg
.
walRetentionSize
;
cfgRsp
.
walSegmentSize
=
pDb
->
cfg
.
walSegmentSize
;
cfgRsp
.
numOfRetensions
=
pDb
->
cfg
.
numOfRetensions
;
cfgRsp
.
pRetensions
=
pDb
->
cfg
.
pRetensions
;
cfgRsp
.
schemaless
=
pDb
->
cfg
.
schemaless
;
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
824aed42
...
...
@@ -460,6 +460,8 @@ static const char *mndTransStr(ETrnStage stage) {
return
"commitAction"
;
case
TRN_STAGE_FINISHED
:
return
"finished"
;
case
TRN_STAGE_PRE_FINISH
:
return
"pre-finish"
;
default:
return
"invalid"
;
}
...
...
@@ -600,10 +602,15 @@ static int32_t mndTransActionUpdate(SSdb *pSdb, STrans *pOld, STrans *pNew) {
}
if
(
pOld
->
stage
==
TRN_STAGE_ROLLBACK
)
{
pOld
->
stage
=
TRN_STAGE_
RE
DO_ACTION
;
pOld
->
stage
=
TRN_STAGE_
UN
DO_ACTION
;
mTrace
(
"trans:%d, stage from rollback to undoAction since perform update action"
,
pNew
->
id
);
}
if
(
pOld
->
stage
==
TRN_STAGE_PRE_FINISH
)
{
pOld
->
stage
=
TRN_STAGE_FINISHED
;
mTrace
(
"trans:%d, stage from pre-finish to finished since perform update action"
,
pNew
->
id
);
}
return
0
;
}
...
...
@@ -933,6 +940,16 @@ static int32_t mndTransRollback(SMnode *pMnode, STrans *pTrans) {
return
0
;
}
static
int32_t
mndTransPreFinish
(
SMnode
*
pMnode
,
STrans
*
pTrans
)
{
mInfo
(
"trans:%d, pre-finish transaction"
,
pTrans
->
id
);
if
(
mndTransSync
(
pMnode
,
pTrans
)
!=
0
)
{
mError
(
"trans:%d, failed to pre-finish since %s"
,
pTrans
->
id
,
terrstr
());
return
-
1
;
}
mInfo
(
"trans:%d, pre-finish finished"
,
pTrans
->
id
);
return
0
;
}
static
void
mndTransSendRpcRsp
(
SMnode
*
pMnode
,
STrans
*
pTrans
)
{
bool
sendRsp
=
false
;
int32_t
code
=
pTrans
->
code
;
...
...
@@ -1439,7 +1456,7 @@ static bool mndTransPerformCommitActionStage(SMnode *pMnode, STrans *pTrans) {
if
(
code
==
0
)
{
pTrans
->
code
=
0
;
pTrans
->
stage
=
TRN_STAGE_FINISHED
;
pTrans
->
stage
=
TRN_STAGE_FINISHED
;
// TRN_STAGE_PRE_FINISH is not necessary
mInfo
(
"trans:%d, stage from commitAction to finished"
,
pTrans
->
id
);
continueExec
=
true
;
}
else
{
...
...
@@ -1457,8 +1474,8 @@ static bool mndTransPerformUndoActionStage(SMnode *pMnode, STrans *pTrans) {
int32_t
code
=
mndTransExecuteUndoActions
(
pMnode
,
pTrans
);
if
(
code
==
0
)
{
pTrans
->
stage
=
TRN_STAGE_
FINISHED
;
mInfo
(
"trans:%d, stage from undoAction to
finished
"
,
pTrans
->
id
);
pTrans
->
stage
=
TRN_STAGE_
PRE_FINISH
;
mInfo
(
"trans:%d, stage from undoAction to
pre-finish
"
,
pTrans
->
id
);
continueExec
=
true
;
}
else
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
{
mInfo
(
"trans:%d, stage keep on undoAction since %s"
,
pTrans
->
id
,
tstrerror
(
code
));
...
...
@@ -1491,6 +1508,25 @@ static bool mndTransPerformRollbackStage(SMnode *pMnode, STrans *pTrans) {
return
continueExec
;
}
static
bool
mndTransPerfromPreFinishedStage
(
SMnode
*
pMnode
,
STrans
*
pTrans
)
{
if
(
mndCannotExecuteTransAction
(
pMnode
))
return
false
;
bool
continueExec
=
true
;
int32_t
code
=
mndTransPreFinish
(
pMnode
,
pTrans
);
if
(
code
==
0
)
{
pTrans
->
stage
=
TRN_STAGE_FINISHED
;
mInfo
(
"trans:%d, stage from pre-finish to finish"
,
pTrans
->
id
);
continueExec
=
true
;
}
else
{
pTrans
->
failedTimes
++
;
mError
(
"trans:%d, stage keep on pre-finish since %s, failedTimes:%d"
,
pTrans
->
id
,
terrstr
(),
pTrans
->
failedTimes
);
continueExec
=
false
;
}
return
continueExec
;
}
static
bool
mndTransPerfromFinishedStage
(
SMnode
*
pMnode
,
STrans
*
pTrans
)
{
bool
continueExec
=
false
;
...
...
@@ -1547,6 +1583,14 @@ void mndTransExecute(SMnode *pMnode, STrans *pTrans, bool isLeader) {
case
TRN_STAGE_UNDO_ACTION
:
continueExec
=
mndTransPerformUndoActionStage
(
pMnode
,
pTrans
);
break
;
case
TRN_STAGE_PRE_FINISH
:
if
(
isLeader
)
{
continueExec
=
mndTransPerfromPreFinishedStage
(
pMnode
,
pTrans
);
}
else
{
mInfo
(
"trans:%d, can not pre-finish since not leader"
,
pTrans
->
id
);
continueExec
=
false
;
}
break
;
case
TRN_STAGE_FINISHED
:
continueExec
=
mndTransPerfromFinishedStage
(
pMnode
,
pTrans
);
break
;
...
...
source/dnode/mnode/sdb/src/sdbHash.c
浏览文件 @
824aed42
...
...
@@ -160,6 +160,7 @@ static int32_t sdbInsertRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow *
if
(
insertFp
!=
NULL
)
{
code
=
(
*
insertFp
)(
pSdb
,
pRow
->
pObj
);
if
(
code
!=
0
)
{
if
(
terrno
==
0
)
terrno
=
TSDB_CODE_MND_TRANS_UNKNOW_ERROR
;
code
=
terrno
;
taosHashRemove
(
hash
,
pRow
->
pObj
,
keySize
);
sdbFreeRow
(
pSdb
,
pRow
,
false
);
...
...
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
824aed42
...
...
@@ -766,6 +766,7 @@ typedef struct SCacheRowsReader {
TdThreadMutex
readerMutex
;
SVnode
*
pVnode
;
STSchema
*
pSchema
;
STSchema
*
pCurrSchema
;
uint64_t
uid
;
uint64_t
suid
;
char
**
transferBuf
;
// todo remove it soon
...
...
source/dnode/vnode/src/tq/tqExec.c
浏览文件 @
824aed42
...
...
@@ -147,7 +147,7 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMeta
}
tqDebug
(
"tmqsnap task execute end, get %p"
,
pDataBlock
);
if
(
pDataBlock
!=
NULL
)
{
if
(
pDataBlock
!=
NULL
&&
pDataBlock
->
info
.
rows
>
0
)
{
if
(
pRsp
->
withTbName
)
{
if
(
pOffset
->
type
==
TMQ_OFFSET__LOG
)
{
int64_t
uid
=
pExec
->
pExecReader
->
lastBlkUid
;
...
...
source/dnode/vnode/src/tsdb/tsdbCache.c
浏览文件 @
824aed42
...
...
@@ -1390,17 +1390,57 @@ _err:
return
code
;
}
static
int32_t
mergeLast
(
tb_uid_t
uid
,
STsdb
*
pTsdb
,
SArray
**
ppLastArray
,
SCacheRowsReader
*
pr
)
{
int32_t
code
=
0
;
static
int32_t
cloneTSchema
(
STSchema
*
pSrc
,
STSchema
**
ppDst
)
{
int32_t
len
=
sizeof
(
STSchema
)
+
sizeof
(
STColumn
)
*
pSrc
->
numOfCols
;
*
ppDst
=
taosMemoryMalloc
(
len
);
if
(
NULL
==
*
ppDst
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
memcpy
(
*
ppDst
,
pSrc
,
len
);
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
updateTSchema
(
int32_t
sversion
,
SCacheRowsReader
*
pReader
,
uint64_t
uid
)
{
if
(
NULL
==
pReader
->
pCurrSchema
&&
sversion
==
pReader
->
pSchema
->
version
)
{
return
cloneTSchema
(
pReader
->
pSchema
,
&
pReader
->
pCurrSchema
);
}
if
(
NULL
!=
pReader
->
pCurrSchema
&&
sversion
==
pReader
->
pCurrSchema
->
version
)
{
return
TSDB_CODE_SUCCESS
;
}
taosMemoryFreeClear
(
pReader
->
pCurrSchema
);
return
metaGetTbTSchemaEx
(
pReader
->
pTsdb
->
pVnode
->
pMeta
,
pReader
->
suid
,
uid
,
sversion
,
&
pReader
->
pCurrSchema
);
}
static
int32_t
initLastColArray
(
STSchema
*
pTSchema
,
SArray
**
ppColArray
)
{
SArray
*
pColArray
=
taosArrayInit
(
pTSchema
->
numOfCols
,
sizeof
(
SLastCol
));
if
(
NULL
==
pColArray
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
for
(
int32_t
i
=
0
;
i
<
pTSchema
->
numOfCols
;
++
i
)
{
SLastCol
col
=
{.
ts
=
0
,
.
colVal
=
COL_VAL_NULL
(
pTSchema
->
columns
[
i
].
colId
,
pTSchema
->
columns
[
i
].
type
)};
taosArrayPush
(
pColArray
,
&
col
);
}
*
ppColArray
=
pColArray
;
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
mergeLast
(
tb_uid_t
uid
,
STsdb
*
pTsdb
,
SArray
**
ppLastArray
,
SCacheRowsReader
*
pr
)
{
STSchema
*
pTSchema
=
pr
->
pSchema
;
// metaGetTbTSchema(pTsdb->pVnode->pMeta, uid, -1, 1);
int16_t
nCol
=
pTSchema
->
numOfCols
;
int16_t
iCol
=
0
;
int16_t
nLastCol
=
pTSchema
->
numOfCols
;
int16_t
noneCol
=
0
;
bool
setNoneCol
=
false
;
SArray
*
pColArray
=
taosArrayInit
(
nCol
,
sizeof
(
SLastCol
));
bool
hasRow
=
false
;
SArray
*
pColArray
=
NULL
;
SColVal
*
pColVal
=
&
(
SColVal
){
0
};
int32_t
code
=
initLastColArray
(
pTSchema
,
&
pColArray
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
return
code
;
}
TSKEY
lastRowTs
=
TSKEY_MAX
;
CacheNextRowIter
iter
=
{
0
};
...
...
@@ -1415,6 +1455,15 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCach
break
;
}
hasRow
=
true
;
code
=
updateTSchema
(
TSDBROW_SVERSION
(
pRow
),
pr
,
uid
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
goto
_err
;
}
pTSchema
=
pr
->
pCurrSchema
;
int16_t
nCol
=
pTSchema
->
numOfCols
;
TSKEY
rowTs
=
TSDBROW_TS
(
pRow
);
if
(
lastRowTs
==
TSKEY_MAX
)
{
...
...
@@ -1422,28 +1471,27 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCach
STColumn
*
pTColumn
=
&
pTSchema
->
columns
[
0
];
*
pColVal
=
COL_VAL_VALUE
(
pTColumn
->
colId
,
pTColumn
->
type
,
(
SValue
){.
val
=
lastRowTs
});
if
(
taosArrayPush
(
pColArray
,
&
(
SLastCol
){.
ts
=
lastRowTs
,
.
colVal
=
*
pColVal
})
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_err
;
}
taosArraySet
(
pColArray
,
0
,
&
(
SLastCol
){.
ts
=
lastRowTs
,
.
colVal
=
*
pColVal
});
for
(
iCol
=
1
;
iCol
<
nCol
;
++
iCol
)
{
for
(
int16_t
iCol
=
1
;
iCol
<
nCol
;
++
iCol
)
{
if
(
iCol
>=
nLastCol
)
{
break
;
}
SLastCol
*
pCol
=
taosArrayGet
(
pColArray
,
iCol
);
if
(
pCol
->
colVal
.
cid
!=
pTSchema
->
columns
[
iCol
].
colId
)
{
continue
;
}
tsdbRowGetColVal
(
pRow
,
pTSchema
,
iCol
,
pColVal
);
SLastCol
lastCol
=
{.
ts
=
lastRowTs
,
.
colVal
=
*
pColVal
};
*
pCol
=
(
SLastCol
)
{.
ts
=
lastRowTs
,
.
colVal
=
*
pColVal
};
if
(
IS_VAR_DATA_TYPE
(
pColVal
->
type
)
&&
pColVal
->
value
.
nData
>
0
)
{
lastCol
.
colVal
.
value
.
pData
=
taosMemoryMalloc
(
lastCol
.
colVal
.
value
.
nData
);
if
(
lastCol
.
colVal
.
value
.
pData
==
NULL
)
{
pCol
->
colVal
.
value
.
pData
=
taosMemoryMalloc
(
pCol
->
colVal
.
value
.
nData
);
if
(
pCol
->
colVal
.
value
.
pData
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_err
;
}
memcpy
(
lastCol
.
colVal
.
value
.
pData
,
pColVal
->
value
.
pData
,
pColVal
->
value
.
nData
);
}
if
(
taosArrayPush
(
pColArray
,
&
lastCol
)
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_err
;
memcpy
(
pCol
->
colVal
.
value
.
pData
,
pColVal
->
value
.
pData
,
pColVal
->
value
.
nData
);
}
if
(
!
COL_VAL_IS_VALUE
(
pColVal
)
&&
!
setNoneCol
)
{
...
...
@@ -1461,10 +1509,16 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCach
// merge into pColArray
setNoneCol
=
false
;
for
(
iCol
=
noneCol
;
iCol
<
nCol
;
++
iCol
)
{
for
(
int16_t
iCol
=
noneCol
;
iCol
<
nCol
;
++
iCol
)
{
if
(
iCol
>=
nLastCol
)
{
break
;
}
// high version's column value
SLastCol
*
lastColVal
=
(
SLastCol
*
)
taosArrayGet
(
pColArray
,
iCol
);
SColVal
*
tColVal
=
&
lastColVal
->
colVal
;
if
(
lastColVal
->
colVal
.
cid
!=
pTSchema
->
columns
[
iCol
].
colId
)
{
continue
;
}
SColVal
*
tColVal
=
&
lastColVal
->
colVal
;
tsdbRowGetColVal
(
pRow
,
pTSchema
,
iCol
,
pColVal
);
if
(
!
COL_VAL_IS_VALUE
(
tColVal
)
&&
COL_VAL_IS_VALUE
(
pColVal
))
{
...
...
@@ -1494,6 +1548,9 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCach
//*ppLastArray = NULL;
// taosArrayDestroy(pColArray);
//} else {
if
(
!
hasRow
)
{
taosArrayClear
(
pColArray
);
}
*
ppLastArray
=
pColArray
;
//}
...
...
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
浏览文件 @
824aed42
...
...
@@ -209,6 +209,8 @@ void* tsdbCacherowsReaderClose(void* pReader) {
taosMemoryFree
(
p
->
pSchema
);
}
taosMemoryFree
(
p
->
pCurrSchema
);
destroyLastBlockLoadInfo
(
p
->
pLoadInfo
);
taosMemoryFree
((
void
*
)
p
->
idstr
);
...
...
@@ -303,7 +305,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
for
(
int32_t
i
=
0
;
i
<
pr
->
pSchema
->
numOfCols
;
++
i
)
{
struct
STColumn
*
pCol
=
&
pr
->
pSchema
->
columns
[
i
];
SLastCol
p
=
{.
ts
=
INT64_MIN
,
.
colVal
.
type
=
pCol
->
type
};
SLastCol
p
=
{.
ts
=
INT64_MIN
,
.
colVal
.
type
=
pCol
->
type
,
.
colVal
.
flag
=
CV_FLAG_NULL
};
if
(
IS_VAR_DATA_TYPE
(
pCol
->
type
))
{
p
.
colVal
.
value
.
pData
=
taosMemoryCalloc
(
pCol
->
bytes
,
sizeof
(
char
));
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
824aed42
...
...
@@ -3512,6 +3512,7 @@ static int32_t checkForNeighborFileBlock(STsdbReader* pReader, STableBlockScanIn
CHECK_FILEBLOCK_STATE
*
state
)
{
SFileBlockDumpInfo
*
pDumpInfo
=
&
pReader
->
status
.
fBlockDumpInfo
;
SBlockData
*
pBlockData
=
&
pReader
->
status
.
fileBlockData
;
bool
asc
=
ASCENDING_TRAVERSE
(
pReader
->
order
);
*
state
=
CHECK_FILEBLOCK_QUIT
;
int32_t
step
=
ASCENDING_TRAVERSE
(
pReader
->
order
)
?
1
:
-
1
;
...
...
@@ -3522,7 +3523,7 @@ static int32_t checkForNeighborFileBlock(STsdbReader* pReader, STableBlockScanIn
if
(
loadNeighbor
&&
(
code
==
TSDB_CODE_SUCCESS
))
{
pDumpInfo
->
rowIndex
=
doMergeRowsInFileBlockImpl
(
pBlockData
,
pDumpInfo
->
rowIndex
,
key
,
pMerger
,
&
pReader
->
verRange
,
step
);
if
(
pDumpInfo
->
rowIndex
>=
pDumpInfo
->
totalRows
)
{
if
(
(
pDumpInfo
->
rowIndex
>=
pDumpInfo
->
totalRows
&&
asc
)
||
(
pDumpInfo
->
rowIndex
<
0
&&
!
asc
)
)
{
*
state
=
CHECK_FILEBLOCK_CONT
;
}
}
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
824aed42
...
...
@@ -599,16 +599,10 @@ static int32_t vnodeProcessTrimReq(SVnode *pVnode, int64_t version, void *pReq,
vInfo
(
"vgId:%d, trim vnode request will be processed, time:%d"
,
pVnode
->
config
.
vgId
,
trimReq
.
timestamp
);
// process
#if 0
code = tsdbDoRetention(pVnode->pTsdb, trimReq.timestamp);
if (code) goto _exit;
code = smaDoRetention(pVnode->pSma, trimReq.timestamp);
if (code) goto _exit;
#else
// process
vnodeAsyncRentention
(
pVnode
,
trimReq
.
timestamp
);
#endif
tsem_wait
(
&
pVnode
->
canCommit
);
tsem_post
(
&
pVnode
->
canCommit
);
_exit:
return
code
;
...
...
@@ -633,18 +627,7 @@ static int32_t vnodeProcessDropTtlTbReq(SVnode *pVnode, int64_t version, void *p
tqUpdateTbUidList
(
pVnode
->
pTq
,
tbUids
,
false
);
}
#if 0
// process
ret = tsdbDoRetention(pVnode->pTsdb, ttlReq.timestamp);
if (ret) goto end;
ret = smaDoRetention(pVnode->pSma, ttlReq.timestamp);
if (ret) goto end;
#else
vnodeAsyncRentention
(
pVnode
,
ttlReq
.
timestamp
);
tsem_wait
(
&
pVnode
->
canCommit
);
tsem_post
(
&
pVnode
->
canCommit
);
#endif
end:
taosArrayDestroy
(
tbUids
);
...
...
@@ -1228,6 +1211,44 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq
tDecoderClear
(
&
dc
);
}
// scan
TSKEY
now
=
taosGetTimestamp
(
pVnode
->
config
.
tsdbCfg
.
precision
);
TSKEY
minKey
=
now
-
tsTickPerMin
[
pVnode
->
config
.
tsdbCfg
.
precision
]
*
pVnode
->
config
.
tsdbCfg
.
keep2
;
TSKEY
maxKey
=
tsMaxKeyByPrecision
[
pVnode
->
config
.
tsdbCfg
.
precision
];
for
(
int32_t
i
=
0
;
i
<
TARRAY_SIZE
(
pSubmitReq
->
aSubmitTbData
);
++
i
)
{
SSubmitTbData
*
pSubmitTbData
=
taosArrayGet
(
pSubmitReq
->
aSubmitTbData
,
i
);
if
(
pSubmitTbData
->
flags
&
SUBMIT_REQ_COLUMN_DATA_FORMAT
)
{
if
(
TARRAY_SIZE
(
pSubmitTbData
->
aCol
)
<=
0
)
{
code
=
TSDB_CODE_INVALID_MSG
;
goto
_exit
;
}
SColData
*
pColData
=
(
SColData
*
)
taosArrayGet
(
pSubmitTbData
->
aCol
,
0
);
TSKEY
*
aKey
=
(
TSKEY
*
)(
pColData
->
pData
);
for
(
int32_t
iRow
=
0
;
iRow
<
pColData
->
nVal
;
iRow
++
)
{
if
(
aKey
[
iRow
]
<
minKey
||
aKey
[
iRow
]
>
maxKey
||
(
iRow
>
0
&&
aKey
[
iRow
]
<=
aKey
[
iRow
-
1
]))
{
code
=
TSDB_CODE_INVALID_MSG
;
vError
(
"vgId:%d %s failed since %s, version:%"
PRId64
,
TD_VID
(
pVnode
),
__func__
,
tstrerror
(
terrno
),
version
);
goto
_exit
;
}
}
}
else
{
int32_t
nRow
=
TARRAY_SIZE
(
pSubmitTbData
->
aRowP
);
SRow
**
aRow
=
(
SRow
**
)
TARRAY_DATA
(
pSubmitTbData
->
aRowP
);
for
(
int32_t
iRow
=
0
;
iRow
<
nRow
;
++
iRow
)
{
if
(
aRow
[
iRow
]
->
ts
<
minKey
||
aRow
[
iRow
]
->
ts
>
maxKey
||
(
iRow
>
0
&&
aRow
[
iRow
]
->
ts
<=
aRow
[
iRow
-
1
]
->
ts
))
{
code
=
TSDB_CODE_INVALID_MSG
;
vError
(
"vgId:%d %s failed since %s, version:%"
PRId64
,
TD_VID
(
pVnode
),
__func__
,
tstrerror
(
terrno
),
version
);
goto
_exit
;
}
}
}
}
for
(
int32_t
i
=
0
;
i
<
TARRAY_SIZE
(
pSubmitReq
->
aSubmitTbData
);
++
i
)
{
SSubmitTbData
*
pSubmitTbData
=
taosArrayGet
(
pSubmitReq
->
aSubmitTbData
,
i
);
...
...
@@ -1647,7 +1668,8 @@ static int32_t vnodeProcessCompactVnodeReq(SVnode *pVnode, int64_t version, void
return
vnodeProcessCompactVnodeReqImpl
(
pVnode
,
version
,
pReq
,
len
,
pRsp
);
}
#ifndef TD_ENTERPRISE
int32_t
vnodeProcessCompactVnodeReqImpl
(
SVnode
*
pVnode
,
int64_t
version
,
void
*
pReq
,
int32_t
len
,
SRpcMsg
*
pRsp
)
{
return
0
;
}
int32_t
vnodeProcessCompactVnodeReqImpl
(
SVnode
*
pVnode
,
int64_t
version
,
void
*
pReq
,
int32_t
len
,
SRpcMsg
*
pRsp
)
{
return
0
;
}
#endif
source/libs/command/src/command.c
浏览文件 @
824aed42
...
...
@@ -248,13 +248,13 @@ static const char* cacheModelStr(int8_t cacheModel) {
return
TSDB_CACHE_MODEL_NONE_STR
;
}
static
void
setCreateDBResultIntoDataBlock
(
SSDataBlock
*
pBlock
,
char
*
dbFName
,
SDbCfgInfo
*
pCfg
)
{
static
void
setCreateDBResultIntoDataBlock
(
SSDataBlock
*
pBlock
,
char
*
db
Name
,
char
*
db
FName
,
SDbCfgInfo
*
pCfg
)
{
blockDataEnsureCapacity
(
pBlock
,
1
);
pBlock
->
info
.
rows
=
1
;
SColumnInfoData
*
pCol1
=
taosArrayGet
(
pBlock
->
pDataBlock
,
0
);
char
buf1
[
SHOW_CREATE_DB_RESULT_FIELD1_LEN
]
=
{
0
};
STR_TO_VARSTR
(
buf1
,
db
F
Name
);
STR_TO_VARSTR
(
buf1
,
dbName
);
colDataSetVal
(
pCol1
,
0
,
buf1
,
false
);
SColumnInfoData
*
pCol2
=
taosArrayGet
(
pBlock
->
pDataBlock
,
1
);
...
...
@@ -277,16 +277,20 @@ static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbFName, S
}
char
*
retentions
=
buildRetension
(
pCfg
->
pRetensions
);
int32_t
dbFNameLen
=
strlen
(
dbFName
);
int32_t
hashPrefix
=
(
pCfg
->
hashPrefix
>
(
dbFNameLen
+
1
))
?
(
pCfg
->
hashPrefix
-
dbFNameLen
-
1
)
:
0
;
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
,
"CREATE DATABASE `%s` BUFFER %d CACHESIZE %d CACHEMODEL '%s' COMP %d DURATION %dm "
"WAL_FSYNC_PERIOD %d MAXROWS %d MINROWS %d STT_TRIGGER %d KEEP %dm,%dm,%dm PAGES %d PAGESIZE %d PRECISION '%s' REPLICA %d "
"WAL_LEVEL %d VGROUPS %d SINGLE_STABLE %d"
,
dbFName
,
pCfg
->
buffer
,
pCfg
->
cacheSize
,
cacheModelStr
(
pCfg
->
cacheLast
),
pCfg
->
compression
,
pCfg
->
daysPerFile
,
"WAL_LEVEL %d VGROUPS %d SINGLE_STABLE %d TABLE_PREFIX %d TABLE_SUFFIX %d TSDB_PAGESIZE %d "
"WAL_RETENTION_PERIOD %d WAL_RETENTION_SIZE %"
PRId64
" WAL_ROLL_PERIOD %d WAL_SEGMENT_SIZE %"
PRId64
,
dbName
,
pCfg
->
buffer
,
pCfg
->
cacheSize
,
cacheModelStr
(
pCfg
->
cacheLast
),
pCfg
->
compression
,
pCfg
->
daysPerFile
,
pCfg
->
walFsyncPeriod
,
pCfg
->
maxRows
,
pCfg
->
minRows
,
pCfg
->
sstTrigger
,
pCfg
->
daysToKeep0
,
pCfg
->
daysToKeep1
,
pCfg
->
daysToKeep2
,
pCfg
->
pages
,
pCfg
->
pageSize
,
prec
,
pCfg
->
replications
,
pCfg
->
walLevel
,
pCfg
->
numOfVgroups
,
1
==
pCfg
->
numOfStables
);
1
==
pCfg
->
numOfStables
,
hashPrefix
,
pCfg
->
hashSuffix
,
pCfg
->
tsdbPageSize
,
pCfg
->
walRetentionPeriod
,
pCfg
->
walRetentionSize
,
pCfg
->
walRollPeriod
,
pCfg
->
walSegmentSize
);
if
(
retentions
)
{
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
+
len
,
" RETENTIONS %s"
,
retentions
);
...
...
@@ -404,7 +408,7 @@ static int32_t execShowCreateDatabase(SShowCreateDatabaseStmt* pStmt, SRetrieveT
SSDataBlock
*
pBlock
=
NULL
;
int32_t
code
=
buildCreateDBResultDataBlock
(
&
pBlock
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
setCreateDBResultIntoDataBlock
(
pBlock
,
pStmt
->
dbName
,
pStmt
->
pCfg
);
setCreateDBResultIntoDataBlock
(
pBlock
,
pStmt
->
dbName
,
pStmt
->
dbFName
,
pStmt
->
pCfg
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
buildRetrieveTableRsp
(
pBlock
,
SHOW_CREATE_DB_RESULT_COLS
,
pRsp
);
...
...
source/libs/executor/src/eventwindowoperator.c
浏览文件 @
824aed42
...
...
@@ -29,7 +29,7 @@ typedef struct SEventWindowOperatorInfo {
SWindowRowsSup
winSup
;
int32_t
tsSlotId
;
// primary timestamp column slot id
STimeWindowAggSupp
twAggSup
;
uint64_t
groupId
;
// current group id, used to identify the data block from different groups
uint64_t
groupId
;
// current group id, used to identify the data block from different groups
SFilterInfo
*
pStartCondInfo
;
SFilterInfo
*
pEndCondInfo
;
bool
inWindow
;
...
...
@@ -310,6 +310,7 @@ int32_t eventWindowAggImpl(SOperatorInfo* pOperator, SEventWindowOperatorInfo* p
pSup
->
rowEntryInfoOffset
,
pTaskInfo
);
pRes
->
info
.
rows
+=
pInfo
->
pRow
->
numOfRows
;
pInfo
->
pRow
->
numOfRows
=
0
;
pInfo
->
inWindow
=
false
;
rowIndex
+=
1
;
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
824aed42
...
...
@@ -1211,7 +1211,8 @@ static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SD
}
else
{
res
=
translateNormalValue
(
pCxt
,
pVal
,
targetDt
,
strict
);
}
pVal
->
node
.
resType
=
targetDt
;
pVal
->
node
.
resType
.
type
=
targetDt
.
type
;
pVal
->
node
.
resType
.
bytes
=
targetDt
.
bytes
;
pVal
->
node
.
resType
.
scale
=
pVal
->
unit
;
pVal
->
translate
=
true
;
if
(
!
strict
&&
TSDB_DATA_TYPE_UBIGINT
==
pVal
->
node
.
resType
.
type
&&
pVal
->
datum
.
u
<=
INT64_MAX
)
{
...
...
@@ -2796,6 +2797,10 @@ static int32_t translateOrderBy(STranslateContext* pCxt, SSelectStmt* pSelect) {
bool
other
;
int32_t
code
=
translateOrderByPosition
(
pCxt
,
pSelect
->
pProjectionList
,
pSelect
->
pOrderByList
,
&
other
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
0
==
LIST_LENGTH
(
pSelect
->
pOrderByList
))
{
NODES_DESTORY_LIST
(
pSelect
->
pOrderByList
);
return
TSDB_CODE_SUCCESS
;
}
if
(
!
other
)
{
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -6477,6 +6482,11 @@ static int32_t translateShowCreateDatabase(STranslateContext* pCxt, SShowCreateD
if
(
NULL
==
pStmt
->
pCfg
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
SName
name
;
tNameSetDbName
(
&
name
,
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
dbName
,
strlen
(
pStmt
->
dbName
));
tNameGetFullDbName
(
&
name
,
pStmt
->
dbFName
);
return
getDBCfg
(
pCxt
,
pStmt
->
dbName
,
(
SDbCfgInfo
*
)
pStmt
->
pCfg
);
}
...
...
source/libs/scalar/src/sclvector.c
浏览文件 @
824aed42
...
...
@@ -915,6 +915,7 @@ int32_t vectorConvertSingleCol(SScalarParam *input, SScalarParam *output, int32_
SDataType
t
=
{.
type
=
type
};
t
.
bytes
=
IS_VAR_DATA_TYPE
(
t
.
type
)
?
input
->
columnData
->
info
.
bytes
:
tDataTypes
[
type
].
bytes
;
t
.
precision
=
input
->
columnData
->
info
.
precision
;
int32_t
code
=
sclCreateColumnInfoData
(
&
t
,
input
->
numOfRows
,
output
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
source/libs/stream/src/streamDispatch.c
浏览文件 @
824aed42
...
...
@@ -278,6 +278,7 @@ int32_t streamDispatchOneRecoverFinishReq(SStreamTask* pTask, const SStreamRecov
msg
.
contLen
=
tlen
+
sizeof
(
SMsgHead
);
msg
.
pCont
=
buf
;
msg
.
msgType
=
TDMT_STREAM_RECOVER_FINISH
;
msg
.
info
.
noResp
=
1
;
tmsgSendReq
(
pEpSet
,
&
msg
);
...
...
@@ -522,4 +523,3 @@ FREE:
taosFreeQitem
(
pBlock
);
return
code
;
}
source/libs/transport/src/transCli.c
浏览文件 @
824aed42
...
...
@@ -1173,7 +1173,7 @@ static void cliHandleBatchReq(SCliBatch* pBatch, SCliThrd* pThrd) {
addr
.
sin_port
=
(
uint16_t
)
htons
(
pList
->
port
);
tTrace
(
"%s conn %p try to connect to %s"
,
pTransInst
->
label
,
conn
,
pList
->
dst
);
int32_t
fd
=
taosCreateSocketWithTimeout
(
TRANS_CONN_TIMEOUT
*
4
);
int32_t
fd
=
taosCreateSocketWithTimeout
(
TRANS_CONN_TIMEOUT
*
10
);
if
(
fd
==
-
1
)
{
tError
(
"%s conn %p failed to create socket, reason:%s"
,
transLabel
(
pTransInst
),
conn
,
tstrerror
(
TAOS_SYSTEM_ERROR
(
errno
)));
...
...
source/libs/transport/src/transSvr.c
浏览文件 @
824aed42
...
...
@@ -677,14 +677,21 @@ void uvOnAcceptCb(uv_stream_t* stream, int status) {
SServerObj
*
pObj
=
container_of
(
stream
,
SServerObj
,
server
);
uv_tcp_t
*
cli
=
(
uv_tcp_t
*
)
taosMemoryMalloc
(
sizeof
(
uv_tcp_t
));
uv_tcp_init
(
pObj
->
loop
,
cli
)
;
if
(
cli
==
NULL
)
return
;
if
(
uv_accept
(
stream
,
(
uv_stream_t
*
)
cli
)
==
0
)
{
int
err
=
uv_tcp_init
(
pObj
->
loop
,
cli
);
if
(
err
!=
0
)
{
tError
(
"failed to create tcp: %s"
,
uv_err_name
(
err
));
taosMemoryFree
(
cli
);
return
;
}
err
=
uv_accept
(
stream
,
(
uv_stream_t
*
)
cli
);
if
(
err
==
0
)
{
#if defined(WINDOWS) || defined(DARWIN)
if
(
pObj
->
numOfWorkerReady
<
pObj
->
numOfThreads
)
{
tError
(
"worker-threads are not ready for all, need %d instead of %d."
,
pObj
->
numOfThreads
,
pObj
->
numOfWorkerReady
);
uv_close
((
uv_handle_t
*
)
cli
,
NULL
);
uv_close
((
uv_handle_t
*
)
cli
,
uvFreeCb
);
return
;
}
#endif
...
...
@@ -700,8 +707,10 @@ void uvOnAcceptCb(uv_stream_t* stream, int status) {
uv_write2
(
wr
,
(
uv_stream_t
*
)
&
(
pObj
->
pipe
[
pObj
->
workerIdx
][
0
]),
&
buf
,
1
,
(
uv_stream_t
*
)
cli
,
uvOnPipeWriteCb
);
}
else
{
if
(
!
uv_is_closing
((
uv_handle_t
*
)
cli
))
{
uv_close
((
uv_handle_t
*
)
cli
,
NULL
);
tError
(
"failed to accept tcp: %s"
,
uv_err_name
(
err
));
uv_close
((
uv_handle_t
*
)
cli
,
uvFreeCb
);
}
else
{
tError
(
"failed to accept tcp: %s"
,
uv_err_name
(
err
));
taosMemoryFree
(
cli
);
}
}
...
...
source/libs/wal/src/walWrite.c
浏览文件 @
824aed42
...
...
@@ -387,20 +387,33 @@ END:
int32_t
walRollImpl
(
SWal
*
pWal
)
{
int32_t
code
=
0
;
if
(
pWal
->
pIdxFile
!=
NULL
)
{
code
=
taosFsyncFile
(
pWal
->
pIdxFile
);
if
(
code
!=
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
goto
END
;
}
code
=
taosCloseFile
(
&
pWal
->
pIdxFile
);
if
(
code
!=
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
goto
END
;
}
}
if
(
pWal
->
pLogFile
!=
NULL
)
{
code
=
taosFsyncFile
(
pWal
->
pLogFile
);
if
(
code
!=
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
goto
END
;
}
code
=
taosCloseFile
(
&
pWal
->
pLogFile
);
if
(
code
!=
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
goto
END
;
}
}
TdFilePtr
pIdxFile
,
pLogFile
;
// create new file
int64_t
newFileFirstVer
=
pWal
->
vers
.
lastVer
+
1
;
...
...
source/os/src/osTimer.c
浏览文件 @
824aed42
...
...
@@ -114,27 +114,28 @@ static void *taosProcessAlarmSignal(void *tharg) {
taosThreadCleanupPush
(
taosDeleteTimer
,
&
timerId
);
struct
itimerspec
ts
;
ts
.
it_value
.
tv_sec
=
0
;
ts
.
it_value
.
tv_nsec
=
1000000
*
MSECONDS_PER_TICK
;
ts
.
it_interval
.
tv_sec
=
0
;
ts
.
it_interval
.
tv_nsec
=
1000000
*
MSECONDS_PER_TICK
;
if
(
timer_settime
(
timerId
,
0
,
&
ts
,
NULL
))
{
// printf("Failed to init timer");
return
NULL
;
}
int
signo
;
while
(
!
stopTimer
)
{
if
(
sigwait
(
&
sigset
,
&
signo
))
{
// printf("Failed to wait signal: number %d", signo);
continue
;
do
{
struct
itimerspec
ts
;
ts
.
it_value
.
tv_sec
=
0
;
ts
.
it_value
.
tv_nsec
=
1000000
*
MSECONDS_PER_TICK
;
ts
.
it_interval
.
tv_sec
=
0
;
ts
.
it_interval
.
tv_nsec
=
1000000
*
MSECONDS_PER_TICK
;
if
(
timer_settime
(
timerId
,
0
,
&
ts
,
NULL
))
{
// printf("Failed to init timer");
break
;
}
/* //printf("Signal handling: number %d ......\n", signo); */
callback
(
0
);
}
int
signo
;
while
(
!
stopTimer
)
{
if
(
sigwait
(
&
sigset
,
&
signo
))
{
// printf("Failed to wait signal: number %d", signo);
continue
;
}
/* //printf("Signal handling: number %d ......\n", signo); */
callback
(
0
);
}
}
while
(
0
);
taosThreadCleanupPop
(
1
);
...
...
tests/develop-test/2-query/show_create_db.py
浏览文件 @
824aed42
...
...
@@ -42,17 +42,17 @@ class TDTestCase:
tdSql
.
query
(
'show create database scd;'
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
'scd'
)
tdSql
.
checkData
(
0
,
1
,
"CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 1 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0"
)
tdSql
.
checkData
(
0
,
1
,
"CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 1 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0
TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0
"
)
tdSql
.
query
(
'show create database scd2;'
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
'scd2'
)
tdSql
.
checkData
(
0
,
1
,
"CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0"
)
tdSql
.
checkData
(
0
,
1
,
"CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0
TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0
"
)
tdSql
.
query
(
'show create database scd4'
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
'scd4'
)
tdSql
.
checkData
(
0
,
1
,
"CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0"
)
tdSql
.
checkData
(
0
,
1
,
"CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0
TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0
"
)
self
.
restartTaosd
(
1
,
dbname
=
'scd'
)
...
...
@@ -60,17 +60,17 @@ class TDTestCase:
tdSql
.
query
(
'show create database scd;'
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
'scd'
)
tdSql
.
checkData
(
0
,
1
,
"CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 1 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0"
)
tdSql
.
checkData
(
0
,
1
,
"CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 1 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0
TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0
"
)
tdSql
.
query
(
'show create database scd2;'
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
'scd2'
)
tdSql
.
checkData
(
0
,
1
,
"CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0"
)
tdSql
.
checkData
(
0
,
1
,
"CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0
TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0
"
)
tdSql
.
query
(
'show create database scd4'
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
'scd4'
)
tdSql
.
checkData
(
0
,
1
,
"CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0"
)
tdSql
.
checkData
(
0
,
1
,
"CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0
TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0
"
)
tdSql
.
execute
(
'drop database scd'
)
...
...
tests/parallel_test/cases.task
浏览文件 @
824aed42
...
...
@@ -632,6 +632,8 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/case_when.py -R
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -R
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py -R
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/update_data.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/tb_100w_data_order.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/delete_stable.py
...
...
@@ -655,6 +657,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/csum.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/function_diff.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tagFilter.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py
,,n,system-test,python3 ./test.py -f 2-query/queryQnode.py
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode1mnode.py
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode2mnode.py -N 5
...
...
@@ -738,7 +741,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdateWithConsume.py -N 3 -n 3
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot0.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot1.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDelete-1ctb.py
#
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDelete-1ctb.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDelete-multiCtb.py -N 3 -n 3
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropStb.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropStbCtb.py
...
...
@@ -854,6 +857,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/sml.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/case_when.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-21561.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/between.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/distinct.py -Q 3
...
...
@@ -952,6 +956,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/interp.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/case_when.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-21561.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/between.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/distinct.py -Q 4
...
...
@@ -1070,6 +1075,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_data.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_data.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/odbc.py
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-21561.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-20582.py
...
...
tests/parallel_test/container_build.sh
浏览文件 @
824aed42
...
...
@@ -51,10 +51,24 @@ else
REP_DIR
=
/home/TDinternal
REP_REAL_PATH
=
$WORKDIR
/TDinternal
REP_MOUNT_PARAM
=
$REP_REAL_PATH
:/home/TDinternal
fi
date
docker run
\
-v
$REP_MOUNT_PARAM
\
-v
/root/.cargo/registry:/root/.cargo/registry
\
-v
/root/.cargo/git:/root/.cargo/git
\
-v
/root/go/pkg/mod:/root/go/pkg/mod
\
-v
/root/.cache/go-build:/root/.cache/go-build
\
-v
${
REP_REAL_PATH
}
/enterprise/src/plugins/taosx/target:
${
REP_DIR
}
/enterprise/src/plugins/taosx/target
\
-v
${
REP_REAL_PATH
}
/community/tools/taosws-rs/target:
${
REP_DIR
}
/community/tools/taosws-rs/target
\
-v
${
REP_REAL_PATH
}
/community/contrib/cJson/:
${
REP_DIR
}
/community/contrib/cJson
\
-v
${
REP_REAL_PATH
}
/community/contrib/googletest/:
${
REP_DIR
}
/community/contrib/googletest
\
-v
${
REP_REAL_PATH
}
/community/contrib/cpp-stub/:
${
REP_DIR
}
/community/contrib/cpp-stub
\
-v
${
REP_REAL_PATH
}
/community/contrib/libuv/:
${
REP_DIR
}
/community/contrib/libuv
\
-v
${
REP_REAL_PATH
}
/community/contrib/lz4/:
${
REP_DIR
}
/community/contrib/lz4
\
-v
${
REP_REAL_PATH
}
/community/contrib/zlib/:
${
REP_DIR
}
/community/contrib/zlib
\
-v
${
REP_REAL_PATH
}
/community/contrib/jemalloc/:
${
REP_DIR
}
/community/contrib/jemalloc
\
--rm
--ulimit
core
=
-1
taos_test:v1.0 sh
-c
"pip uninstall taospy -y;pip3 install taospy==2.7.2;cd
$REP_DIR
;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_TAOSX=true;make -j || exit 1"
if
[[
-d
${
WORKDIR
}
/debugNoSan
]]
;
then
...
...
@@ -70,6 +84,19 @@ mv ${REP_REAL_PATH}/debug ${WORKDIR}/debugNoSan
date
docker run
\
-v
$REP_MOUNT_PARAM
\
-v
/root/.cargo/registry:/root/.cargo/registry
\
-v
/root/.cargo/git:/root/.cargo/git
\
-v
/root/go/pkg/mod:/root/go/pkg/mod
\
-v
/root/.cache/go-build:/root/.cache/go-build
\
-v
${
REP_REAL_PATH
}
/enterprise/src/plugins/taosx/target:
${
REP_DIR
}
/enterprise/src/plugins/taosx/target
\
-v
${
REP_REAL_PATH
}
/community/tools/taosws-rs/target:
${
REP_DIR
}
/community/tools/taosws-rs/target
\
-v
${
REP_REAL_PATH
}
/community/contrib/cJson/:
${
REP_DIR
}
/community/contrib/cJson
\
-v
${
REP_REAL_PATH
}
/community/contrib/googletest/:
${
REP_DIR
}
/community/contrib/googletest
\
-v
${
REP_REAL_PATH
}
/community/contrib/cpp-stub/:
${
REP_DIR
}
/community/contrib/cpp-stub
\
-v
${
REP_REAL_PATH
}
/community/contrib/libuv/:
${
REP_DIR
}
/community/contrib/libuv
\
-v
${
REP_REAL_PATH
}
/community/contrib/lz4/:
${
REP_DIR
}
/community/contrib/lz4
\
-v
${
REP_REAL_PATH
}
/community/contrib/zlib/:
${
REP_DIR
}
/community/contrib/zlib
\
-v
${
REP_REAL_PATH
}
/community/contrib/jemalloc/:
${
REP_DIR
}
/community/contrib/jemalloc
\
--rm
--ulimit
core
=
-1
taos_test:v1.0 sh
-c
"pip uninstall taospy -y;pip3 install taospy==2.7.2;cd
$REP_DIR
;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_SANITIZER=1 -DTOOLS_SANITIZE=true -DTOOLS_BUILD_TYPE=Debug -DBUILD_TAOSX=true;make -j || exit 1 "
mv
${
REP_REAL_PATH
}
/debug
${
WORKDIR
}
/debugSan
...
...
tests/script/api/insertSameTs.c
0 → 100644
浏览文件 @
824aed42
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// TAOS standard API example. The same syntax as MySQL, but only a subset
// to compile: gcc -o demo demo.c -ltaos
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "taos.h" // TAOS header file
static
void
queryDB
(
TAOS
*
taos
,
char
*
command
)
{
int
i
;
TAOS_RES
*
pSql
=
NULL
;
int32_t
code
=
-
1
;
for
(
i
=
0
;
i
<
5
;
i
++
)
{
if
(
NULL
!=
pSql
)
{
taos_free_result
(
pSql
);
pSql
=
NULL
;
}
pSql
=
taos_query
(
taos
,
command
);
code
=
taos_errno
(
pSql
);
if
(
0
==
code
)
{
break
;
}
}
if
(
code
!=
0
)
{
fprintf
(
stderr
,
"Failed to run %s, reason: %s
\n
"
,
command
,
taos_errstr
(
pSql
));
taos_free_result
(
pSql
);
taos_close
(
taos
);
exit
(
EXIT_FAILURE
);
}
taos_free_result
(
pSql
);
}
void
Test
(
TAOS
*
taos
,
char
*
qstr
);
int
main
(
int
argc
,
char
*
argv
[])
{
char
qstr
[
1024
];
// connect to server
if
(
argc
<
2
)
{
printf
(
"please input server-ip
\n
"
);
return
0
;
}
TAOS
*
taos
=
taos_connect
(
argv
[
1
],
"root"
,
"taosdata"
,
NULL
,
0
);
if
(
taos
==
NULL
)
{
printf
(
"failed to connect to server, reason:%s
\n
"
,
"null taos"
/*taos_errstr(taos)*/
);
exit
(
1
);
}
Test
(
taos
,
qstr
);
taos_close
(
taos
);
taos_cleanup
();
}
void
Test
(
TAOS
*
taos
,
char
*
qstr
)
{
queryDB
(
taos
,
"drop database if exists demo"
);
queryDB
(
taos
,
"create database demo vgroups 1 minrows 10"
);
TAOS_RES
*
result
;
queryDB
(
taos
,
"use demo"
);
queryDB
(
taos
,
"create table m1 (ts timestamp, ti tinyint, si smallint, i int, bi bigint, f float, d double, b binary(10))"
);
printf
(
"success to create table
\n
"
);
int
i
=
0
;
for
(
int32_t
n
=
0
;
n
<
10
;
++
n
)
{
for
(
i
=
0
;
i
<
10
;
++
i
)
{
int32_t
v
=
n
*
10
+
i
;
sprintf
(
qstr
,
"insert into m1 values (%"
PRId64
", %d, %d, %d, %d, %f, %lf, '%s')"
,
(
uint64_t
)
1546300800000
,
v
,
v
,
v
,
v
*
10000000
,
v
*
1
.
0
,
v
*
2
.
0
,
"hello"
);
printf
(
"qstr: %s
\n
"
,
qstr
);
TAOS_RES
*
result1
=
taos_query
(
taos
,
qstr
);
if
(
result1
==
NULL
||
taos_errno
(
result1
)
!=
0
)
{
printf
(
"failed to insert row, reason:%s
\n
"
,
taos_errstr
(
result1
));
taos_free_result
(
result1
);
exit
(
1
);
}
else
{
printf
(
"insert row: %i
\n
"
,
v
);
}
taos_free_result
(
result1
);
strcpy
(
qstr
,
"flush database demo"
);
result1
=
taos_query
(
taos
,
qstr
);
if
(
result1
==
NULL
||
taos_errno
(
result1
)
!=
0
)
{
printf
(
"failed to fluash database, reason:%s
\n
"
,
taos_errstr
(
result1
));
taos_free_result
(
result1
);
exit
(
1
);
}
taos_free_result
(
result1
);
}
}
// query the records
sprintf
(
qstr
,
"SELECT * FROM m1 order by ts desc"
);
result
=
taos_query
(
taos
,
qstr
);
if
(
result
==
NULL
||
taos_errno
(
result
)
!=
0
)
{
printf
(
"failed to select, reason:%s
\n
"
,
taos_errstr
(
result
));
taos_free_result
(
result
);
exit
(
1
);
}
TAOS_ROW
row
;
int
rows
=
0
;
int
num_fields
=
taos_field_count
(
result
);
TAOS_FIELD
*
fields
=
taos_fetch_fields
(
result
);
printf
(
"num_fields = %d
\n
"
,
num_fields
);
printf
(
"select * from table order by ts desc, result:
\n
"
);
// fetch the records row by row
while
((
row
=
taos_fetch_row
(
result
)))
{
char
temp
[
1024
]
=
{
0
};
rows
++
;
taos_print_row
(
temp
,
row
,
fields
,
num_fields
);
printf
(
"%s
\n
"
,
temp
);
}
taos_free_result
(
result
);
}
tests/script/api/makefile
浏览文件 @
824aed42
...
...
@@ -14,6 +14,7 @@ exe:
gcc
$(CFLAGS)
./batchprepare.c
-o
$(ROOT)
batchprepare
$(LFLAGS)
gcc
$(CFLAGS)
./stopquery.c
-o
$(ROOT)
stopquery
$(LFLAGS)
gcc
$(CFLAGS)
./dbTableRoute.c
-o
$(ROOT)
dbTableRoute
$(LFLAGS)
gcc
$(CFLAGS)
./insertSameTs.c
-o
$(ROOT)
insertSameTs
$(LFLAGS)
clean
:
rm
$(ROOT)
batchprepare
...
...
tests/script/tsim/stream/basic0.sim
浏览文件 @
824aed42
...
...
@@ -48,24 +48,35 @@ sleep 100
#===================================================================
print =============== query data from child table
$loop_count = 0
loop0:
sleep 200
$loop_count = $loop_count + 1
if $loop_count == 20 then
return -1
endi
sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb
print rows: $rows
print $data00 $data01 $data02 $data03
if $rows != 1 then
return -1
goto loop0
endi
if $data01 != 234 then
return -1
goto loop0
endi
if $data02 != 234 then
return -1
goto loop0
endi
if $data03 != 234 then
print expect 234, actual $data03
return -1
goto loop0
endi
#===================================================================
...
...
@@ -77,23 +88,34 @@ sleep 100
#===================================================================
print =============== query data from child table
$loop_count = 0
loop1:
sleep 200
$loop_count = $loop_count + 1
if $loop_count == 20 then
return -1
endi
sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb
print rows: $rows
print $data00 $data01 $data02 $data03
if $rows != 1 then
return -
1
goto loop
1
endi
if $data01 != -111 then
return -
1
goto loop
1
endi
if $data02 != 234 then
return -
1
goto loop
1
endi
if $data03 != 123 then
return -
1
goto loop
1
endi
#===================================================================
...
...
@@ -105,36 +127,46 @@ sleep 100
#===================================================================
print =============== query data from child table
$loop_count = 0
loop2:
sleep 200
$loop_count = $loop_count + 1
if $loop_count == 20 then
return -1
endi
sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb
print rows: $rows
print $data00 $data01 $data02 $data03
print $data10 $data11 $data12 $data13
if $rows != 2 then
return -1
goto loop2
endi
if $data01 != -111 then
return -1
goto loop2
endi
if $data02 != 234 then
return -1
goto loop2
endi
if $data03 != 123 then
return -1
goto loop2
endi
if $data11 != 789 then
return -1
goto loop2
endi
if $data12 != 789 then
return -1
goto loop2
endi
if $data13 != 789 then
return -1
goto loop2
endi
_OVER:
...
...
tests/script/tsim/trans/create_stb.sim
0 → 100644
浏览文件 @
824aed42
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
system sh/deploy.sh -n dnode3 -i 3
system sh/deploy.sh -n dnode4 -i 4
system sh/cfg.sh -n dnode1 -c transPullupInterval -v 1
system sh/cfg.sh -n dnode2 -c transPullupInterval -v 1
system sh/cfg.sh -n dnode3 -c transPullupInterval -v 1
system sh/cfg.sh -n dnode4 -c transPullupInterval -v 1
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start
system sh/exec.sh -n dnode4 -s start
sql connect
print =============== step1: create dnodes
sql create dnode $hostname port 7200
sql create dnode $hostname port 7300
sql create dnode $hostname port 7400
$x = 0
step1:
$x = $x + 1
sleep 1000
if $x == 10 then
return -1
endi
sql select * from information_schema.ins_dnodes -x step1
if $data(1)[4] != ready then
goto step1
endi
if $data(2)[4] != ready then
goto step1
endi
if $data(3)[4] != ready then
goto step1
endi
print =============== step2: create mnode 2 and 3
sql create mnode on dnode 2
sql create mnode on dnode 3
sql create database db vgroups 2
print =============== step3: kill dnode4
system sh/exec.sh -n dnode4 -s stop -x SIGKILL
sql use db
sql_error create table stb (ts timestamp, i int) tags (j int)
print =============== step4: create database
sql show transactions
if $rows != 1 then
return -1
endi
sleep 3000
system sh/exec.sh -n dnode4 -s start
$wt = 0
step4:
$wt = $wt + 1
sleep 1000
if $wt == 200 then
print ====> transaction already running
return -1
endi
sql show transactions
if $rows != 0 then
print wait 1 seconds to alter
goto step4
endi
tests/system-test/0-others/show.py
浏览文件 @
824aed42
...
...
@@ -11,14 +11,13 @@
# -*- coding: utf-8 -*-
import
re
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.common
import
*
from
util.sqlset
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
,
replicaVar
=
1
):
self
.
replicaVar
=
int
(
replicaVar
)
...
...
@@ -28,10 +27,35 @@ class TDTestCase:
self
.
ins_param_list
=
[
'dnodes'
,
'mnodes'
,
'qnodes'
,
'cluster'
,
'functions'
,
'users'
,
'grants'
,
'topics'
,
'subscriptions'
,
'streams'
]
self
.
perf_param
=
[
'apps'
,
'connections'
,
'consumers'
,
'queries'
,
'transactions'
]
self
.
perf_param_list
=
[
'apps'
,
'connections'
,
'consumers'
,
'queries'
,
'trans'
]
self
.
dbname
=
"db"
self
.
vgroups
=
10
self
.
stbname
=
f
'`
{
tdCom
.
getLongName
(
5
)
}
`'
self
.
tbname
=
f
'`
{
tdCom
.
getLongName
(
3
)
}
`'
self
.
db_param
=
{
"database"
:
f
"
{
self
.
dbname
}
"
,
"buffer"
:
100
,
"cachemodel"
:
"'none'"
,
"cachesize"
:
1
,
"comp"
:
2
,
"maxrows"
:
1000
,
"minrows"
:
200
,
"pages"
:
512
,
"pagesize"
:
16
,
"precision"
:
"'ms'"
,
"replica"
:
1
,
"wal_level"
:
1
,
"wal_fsync_period"
:
6000
,
"wal_roll_period"
:
0
,
"wal_segment_size"
:
1024
,
"vgroups"
:
self
.
vgroups
,
"stt_trigger"
:
1
,
"tsdb_pagesize"
:
16
}
def
ins_check
(
self
):
tdSql
.
prepare
()
for
param
in
self
.
ins_param_list
:
if
param
.
lower
()
==
'qnodes'
:
tdSql
.
execute
(
'create qnode on dnode 1'
)
tdSql
.
query
(
f
'show
{
param
}
'
)
show_result
=
tdSql
.
queryResult
tdSql
.
query
(
f
'select * from information_schema.ins_
{
param
}
'
)
...
...
@@ -59,11 +83,32 @@ class TDTestCase:
tag_sql
+=
f
"
{
k
}
{
v
}
, "
create_stb_sql
=
f
'create stable
{
stbname
}
(
{
column_sql
[:
-
2
]
}
) tags (
{
tag_sql
[:
-
2
]
}
)'
return
create_stb_sql
def
show_sql
(
self
):
tdSql
.
prepare
()
tdSql
.
execute
(
'use db'
)
stbname
=
f
'`
{
tdCom
.
getLongName
(
5
)
}
`'
tbname
=
f
'`
{
tdCom
.
getLongName
(
3
)
}
`'
def
set_create_database_sql
(
self
,
sql_dict
):
create_sql
=
'create'
for
key
,
value
in
sql_dict
.
items
():
create_sql
+=
f
'
{
key
}
{
value
}
'
return
create_sql
def
show_create_sql
(
self
):
create_db_sql
=
self
.
set_create_database_sql
(
self
.
db_param
)
print
(
create_db_sql
)
tdSql
.
execute
(
create_db_sql
)
tdSql
.
query
(
f
'show create database
{
self
.
dbname
}
'
)
tdSql
.
checkEqual
(
self
.
dbname
,
tdSql
.
queryResult
[
0
][
0
])
for
key
,
value
in
self
.
db_param
.
items
():
if
key
==
'database'
:
continue
else
:
param
=
f
'
{
key
}
{
value
}
'
if
param
in
tdSql
.
queryResult
[
0
][
1
].
lower
():
tdLog
.
info
(
f
'show create database check success with
{
key
}
{
value
}
'
)
continue
else
:
tdLog
.
exit
(
f
"show create database check failed with
{
key
}
{
value
}
"
)
tdSql
.
query
(
'show vnodes 1'
)
tdSql
.
checkRows
(
self
.
vgroups
)
tdSql
.
execute
(
f
'use
{
self
.
dbname
}
'
)
column_dict
=
{
'`ts`'
:
'timestamp'
,
'`col1`'
:
'tinyint'
,
...
...
@@ -98,25 +143,56 @@ class TDTestCase:
'`t14`'
:
'timestamp'
}
create_table_sql
=
self
.
set_stb_sql
(
stbname
,
column_dict
,
tag_dict
)
create_table_sql
=
self
.
set_stb_sql
(
s
elf
.
s
tbname
,
column_dict
,
tag_dict
)
tdSql
.
execute
(
create_table_sql
)
tdSql
.
query
(
f
'show create
table
{
stbname
}
'
)
tdSql
.
query
(
f
'show create
stable
{
self
.
stbname
}
'
)
query_result
=
tdSql
.
queryResult
tdSql
.
checkEqual
(
query_result
[
0
][
1
].
lower
(),
create_table_sql
)
tdSql
.
execute
(
f
'create table
{
tbname
}
using
{
stbname
}
tags(1,1,1,1,1,1,1,1,1.000000e+00,1.000000e+00,true,"abc","abc123",0)'
)
tdSql
.
execute
(
f
'create table
{
self
.
tbname
}
using
{
self
.
stbname
}
tags(1,1,1,1,1,1,1,1,1.000000e+00,1.000000e+00,true,"abc","abc123",0)'
)
tag_sql
=
'('
for
tag_keys
in
tag_dict
.
keys
():
tag_sql
+=
f
'
{
tag_keys
}
, '
tags
=
f
'
{
tag_sql
[:
-
2
]
}
)'
sql
=
f
'create table
{
tbname
}
using
{
stbname
}
{
tags
}
tags (1, 1, 1, 1, 1, 1, 1, 1, 1.000000e+00, 1.000000e+00, true, "abc", "abc123", 0)'
tdSql
.
query
(
f
'show create table
{
tbname
}
'
)
sql
=
f
'create table
{
self
.
tbname
}
using
{
self
.
stbname
}
{
tags
}
tags (1, 1, 1, 1, 1, 1, 1, 1, 1.000000e+00, 1.000000e+00, true, "abc", "abc123", 0)'
tdSql
.
query
(
f
'show create table
{
self
.
tbname
}
'
)
query_result
=
tdSql
.
queryResult
tdSql
.
checkEqual
(
query_result
[
0
][
1
].
lower
(),
sql
)
tdSql
.
execute
(
'drop database db'
)
tdSql
.
execute
(
f
'drop database
{
self
.
dbname
}
'
)
def
check_gitinfo
(
self
):
taosd_gitinfo_sql
=
''
tdSql
.
query
(
'show dnode 1 variables'
)
for
i
in
tdSql
.
queryResult
:
if
i
[
1
].
lower
()
==
"gitinfo"
:
taosd_gitinfo_sql
=
f
"gitinfo:
{
i
[
2
]
}
"
taos_gitinfo_sql
=
''
tdSql
.
query
(
'show local variables'
)
for
i
in
tdSql
.
queryResult
:
if
i
[
0
].
lower
()
==
"gitinfo"
:
taos_gitinfo_sql
=
f
"gitinfo:
{
i
[
1
]
}
"
taos_info
=
os
.
popen
(
'taos -V'
).
read
()
taos_gitinfo
=
re
.
findall
(
"^gitinfo.*"
,
taos_info
,
re
.
M
)
tdSql
.
checkEqual
(
taos_gitinfo_sql
,
taos_gitinfo
[
0
])
taosd_info
=
os
.
popen
(
'taosd -V'
).
read
()
taosd_gitinfo
=
re
.
findall
(
"^gitinfo.*"
,
taosd_info
,
re
.
M
)
tdSql
.
checkEqual
(
taosd_gitinfo_sql
,
taosd_gitinfo
[
0
])
def
show_base
(
self
):
for
sql
in
[
'dnodes'
,
'mnodes'
,
'cluster'
]:
tdSql
.
query
(
f
'show
{
sql
}
'
)
print
(
tdSql
.
queryResult
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
'show grants'
)
grants_info
=
tdSql
.
queryResult
tdSql
.
query
(
'show licences'
)
licences_info
=
tdSql
.
queryResult
tdSql
.
checkEqual
(
grants_info
,
licences_info
)
def
run
(
self
):
self
.
check_gitinfo
()
self
.
show_base
()
self
.
ins_check
()
self
.
perf_check
()
self
.
show_sql
()
self
.
show_
create_
sql
()
def
stop
(
self
):
tdSql
.
close
()
...
...
@@ -124,4 +200,3 @@ class TDTestCase:
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/system-test/2-query/projectionDesc.py
0 → 100644
浏览文件 @
824aed42
from
wsgiref.headers
import
tspecials
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
import
numpy
as
np
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
,
replicaVar
=
1
):
self
.
replicaVar
=
int
(
replicaVar
)
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
self
.
rowNum
=
10
self
.
batchNum
=
5
self
.
ts
=
1537146000000
def
run
(
self
):
dbname
=
"db"
tdSql
.
prepare
()
intData
=
[]
floatData
=
[]
tdSql
.
execute
(
f
'''create table
{
dbname
}
.stb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))'''
)
tdSql
.
execute
(
f
"create table
{
dbname
}
.stb_1 using
{
dbname
}
.stb tags('beijing')"
)
for
n
in
range
(
self
.
batchNum
):
for
i
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
f
"insert into
{
dbname
}
.stb_1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
%
(
self
.
ts
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
0.1
,
i
+
0.1
,
i
%
2
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
))
intData
.
append
(
i
+
1
)
floatData
.
append
(
i
+
0.1
)
tdSql
.
execute
(
f
"flush database
{
dbname
}
"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.stb_1 order by ts desc"
)
tdSql
.
checkRows
(
1
)
#tdSql.checkData(0,0,1537146000000)
tdSql
.
checkData
(
0
,
1
,
10
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.stb_1 order by 'aaa' desc"
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb.py
浏览文件 @
824aed42
...
...
@@ -200,7 +200,7 @@ class TDTestCase:
tdLog
.
info
(
"pkill consume processor"
)
tdCom
.
killProcessor
(
"tmq_sim"
)
#
time.sleep(10)
time
.
sleep
(
10
)
# reinit consume info, and start tmq_sim, then check consume result
tmqCom
.
initConsumerTable
()
...
...
tools/shell/src/shellEngine.c
浏览文件 @
824aed42
...
...
@@ -1048,26 +1048,28 @@ void *shellThreadLoop(void *arg) {
taosGetOldTerminalMode
();
taosThreadCleanupPush
(
shellCleanup
,
NULL
);
char
*
command
=
taosMemoryMalloc
(
SHELL_MAX_COMMAND_SIZE
);
if
(
command
==
NULL
)
{
printf
(
"failed to malloc command
\r\n
"
);
return
NULL
;
}
do
{
memset
(
command
,
0
,
SHELL_MAX_COMMAND_SIZE
);
taosSetTerminalMode
();
if
(
shellReadCommand
(
command
)
!=
0
)
{
char
*
command
=
taosMemoryMalloc
(
SHELL_MAX_COMMAND_SIZE
);
if
(
command
==
NULL
)
{
printf
(
"failed to malloc command
\r\n
"
);
break
;
}
taosResetTerminalMode
();
}
while
(
shellRunCommand
(
command
,
true
)
==
0
);
do
{
memset
(
command
,
0
,
SHELL_MAX_COMMAND_SIZE
);
taosSetTerminalMode
();
if
(
shellReadCommand
(
command
)
!=
0
)
{
break
;
}
taosMemoryFreeClear
(
command
);
shellWriteHistory
();
shellExit
();
taosResetTerminalMode
();
}
while
(
shellRunCommand
(
command
,
true
)
==
0
);
taosMemoryFreeClear
(
command
);
shellWriteHistory
();
shellExit
();
}
while
(
0
);
taosThreadCleanupPop
(
1
);
return
NULL
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录