Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4e5fbb52
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
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看板
You need to sign in or sign up before continuing.
提交
4e5fbb52
编写于
7月 26, 2023
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/3.0' into feat/TD-24700
上级
ac4e2192
78bdb043
变更
39
隐藏空白更改
内联
并排
Showing
39 changed file
with
612 addition
and
205 deletion
+612
-205
docs/en/13-operation/10-monitor.md
docs/en/13-operation/10-monitor.md
+0
-13
docs/en/14-reference/03-connector/07-python.mdx
docs/en/14-reference/03-connector/07-python.mdx
+4
-5
docs/zh/17-operation/10-monitor.md
docs/zh/17-operation/10-monitor.md
+0
-13
include/common/tglobal.h
include/common/tglobal.h
+6
-0
include/libs/stream/tstream.h
include/libs/stream/tstream.h
+1
-1
include/os/os.h
include/os/os.h
+1
-0
include/os/osSysinfo.h
include/os/osSysinfo.h
+1
-0
source/common/src/tglobal.c
source/common/src/tglobal.c
+8
-0
source/dnode/mgmt/exe/dmMain.c
source/dnode/mgmt/exe/dmMain.c
+2
-0
source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
+12
-2
source/dnode/mgmt/node_mgmt/src/dmTransport.c
source/dnode/mgmt/node_mgmt/src/dmTransport.c
+1
-0
source/dnode/mnode/impl/inc/mndCluster.h
source/dnode/mnode/impl/inc/mndCluster.h
+1
-1
source/dnode/mnode/impl/src/mndCluster.c
source/dnode/mnode/impl/src/mndCluster.c
+2
-2
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+5
-3
source/dnode/mnode/impl/src/mndMain.c
source/dnode/mnode/impl/src/mndMain.c
+1
-1
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+1
-0
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+14
-17
source/dnode/vnode/src/tsdb/tsdbCache.c
source/dnode/vnode/src/tsdb/tsdbCache.c
+65
-38
source/dnode/vnode/src/tsdb/tsdbCommit2.c
source/dnode/vnode/src/tsdb/tsdbCommit2.c
+5
-1
source/dnode/vnode/src/tsdb/tsdbFile.c
source/dnode/vnode/src/tsdb/tsdbFile.c
+4
-1
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
+21
-21
source/dnode/vnode/src/tsdb/tsdbRead2.c
source/dnode/vnode/src/tsdb/tsdbRead2.c
+1
-1
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
+1
-1
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+16
-8
source/libs/executor/src/sortoperator.c
source/libs/executor/src/sortoperator.c
+7
-7
source/libs/executor/src/tfill.c
source/libs/executor/src/tfill.c
+11
-6
source/libs/executor/src/timesliceoperator.c
source/libs/executor/src/timesliceoperator.c
+6
-5
source/libs/executor/src/tsort.c
source/libs/executor/src/tsort.c
+36
-2
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+51
-11
source/libs/monitor/src/monMain.c
source/libs/monitor/src/monMain.c
+1
-1
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+2
-2
source/libs/parser/src/parUtil.c
source/libs/parser/src/parUtil.c
+2
-0
source/libs/stream/src/streamExec.c
source/libs/stream/src/streamExec.c
+3
-0
source/libs/stream/src/streamRecover.c
source/libs/stream/src/streamRecover.c
+1
-2
source/os/src/osSysinfo.c
source/os/src/osSysinfo.c
+12
-0
source/util/src/tutil.c
source/util/src/tutil.c
+2
-2
tests/script/tsim/parser/fill.sim
tests/script/tsim/parser/fill.sim
+100
-0
tests/system-test/0-others/taosdMonitor.py
tests/system-test/0-others/taosdMonitor.py
+0
-28
tests/system-test/2-query/interp.py
tests/system-test/2-query/interp.py
+205
-10
未找到文件。
docs/en/13-operation/10-monitor.md
浏览文件 @
4e5fbb52
...
...
@@ -214,19 +214,6 @@ The data of tdinsight dashboard is stored in `log` database (default. You can ch
|dnode
\_
ep|NCHAR|TAG|dnode endpoint|
|cluster
\_
id|NCHAR|TAG|cluster id|
### logs table
`logs`
table contains login information records.
|field|type|is
\_
tag|comment|
|:----|:---|:-----|:------|
|ts|TIMESTAMP||timestamp|
|level|VARCHAR||log level|
|content|NCHAR||log content|
|dnode
\_
id|INT|TAG|dnode id|
|dnode
\_
ep|NCHAR|TAG|dnode endpoint|
|cluster
\_
id|NCHAR|TAG|cluster id|
### log\_summary table
`log_summary`
table contains log summary information records.
...
...
docs/en/14-reference/03-connector/07-python.mdx
浏览文件 @
4e5fbb52
...
...
@@ -1007,13 +1007,12 @@ consumer.close()
### Other sample programs
| Example program links | Example program content |
| ------------------------------------------------------------------------------------------------------------- | ------------------- ---- |
| [bind_multi.py](https://github.com/taosdata/taos-connector-python/blob/main/examples/bind-multi.py) | parameter binding,
bind multiple rows at once |
| [bind_row.py](https://github.com/taosdata/taos-connector-python/blob/main/examples/bind-row.py) | bind_row.py
|-----------------------|-------------------------|
| [bind_multi.py](https://github.com/taosdata/taos-connector-python/blob/main/examples/bind-multi.py) | parameter binding, bind multiple rows at once |
| [bind_row.py](https://github.com/taosdata/taos-connector-python/blob/main/examples/bind-row.py) | parameter binding, bind one row at once |
| [insert_lines.py](https://github.com/taosdata/taos-connector-python/blob/main/examples/insert-lines.py) | InfluxDB line protocol writing |
| [json_tag.py](https://github.com/taosdata/taos-connector-python/blob/main/examples/json-tag.py) | Use JSON type tags |
| [tmq
.py](https://github.com/taosdata/taos-connector-python/blob/main/examples/tmq.py) | TMQ subscription
|
| [tmq
_consumer.py](https://github.com/taosdata/taos-connector-python/blob/main/examples/tmq_consumer.py) | TMQ subscription
|
## Other notes
...
...
docs/zh/17-operation/10-monitor.md
浏览文件 @
4e5fbb52
...
...
@@ -210,19 +210,6 @@ TDinsight dashboard 数据来源于 log 库(存放监控数据的默认db,
|dnode
\_
ep|NCHAR|TAG|dnode endpoint|
|cluster
\_
id|NCHAR|TAG|cluster id|
### logs 表
`logs`
表记录登录信息。
|field|type|is
\_
tag|comment|
|:----|:---|:-----|:------|
|ts|TIMESTAMP||timestamp|
|level|VARCHAR||log level|
|content|NCHAR||log content,长度不超过1024字节|
|dnode
\_
id|INT|TAG|dnode id|
|dnode
\_
ep|NCHAR|TAG|dnode endpoint|
|cluster
\_
id|NCHAR|TAG|cluster id|
### log\_summary 表
`log_summary`
记录日志统计信息。
...
...
include/common/tglobal.h
浏览文件 @
4e5fbb52
...
...
@@ -85,8 +85,14 @@ extern int64_t tsVndCommitMaxIntervalMs;
extern
int64_t
tsMndSdbWriteDelta
;
extern
int64_t
tsMndLogRetention
;
extern
int8_t
tsGrant
;
extern
int32_t
tsMndGrantMode
;
extern
bool
tsMndSkipGrant
;
// dnode
extern
int64_t
tsDndStart
;
extern
int64_t
tsDndStartOsUptime
;
extern
int64_t
tsDndUpTime
;
// monitor
extern
bool
tsEnableMonitor
;
extern
int32_t
tsMonitorInterval
;
...
...
include/libs/stream/tstream.h
浏览文件 @
4e5fbb52
...
...
@@ -598,7 +598,7 @@ int32_t streamProcessCheckRsp(SStreamTask* pTask, const SStreamTaskCheckRsp* pRs
int32_t
streamLaunchFillHistoryTask
(
SStreamTask
*
pTask
);
int32_t
streamTaskScanHistoryDataComplete
(
SStreamTask
*
pTask
);
int32_t
streamStartRecoverTask
(
SStreamTask
*
pTask
,
int8_t
igUntreated
);
void
streamHistoryTaskSetVerRangeStep2
(
SStreamTask
*
pTask
);
void
streamHistoryTaskSetVerRangeStep2
(
SStreamTask
*
pTask
,
int64_t
latestVer
);
bool
streamTaskRecoverScanStep1Finished
(
SStreamTask
*
pTask
);
bool
streamTaskRecoverScanStep2Finished
(
SStreamTask
*
pTask
);
...
...
include/os/os.h
浏览文件 @
4e5fbb52
...
...
@@ -53,6 +53,7 @@ extern "C" {
#else
#include <argp.h>
#include <sys/prctl.h>
#include <sys/sysinfo.h>
#if defined(_TD_X86_)
#include <cpuid.h>
#endif
...
...
include/os/osSysinfo.h
浏览文件 @
4e5fbb52
...
...
@@ -35,6 +35,7 @@ typedef struct {
bool
taosCheckSystemIsLittleEnd
();
void
taosGetSystemInfo
();
int64_t
taosGetOsUptime
();
int32_t
taosGetEmail
(
char
*
email
,
int32_t
maxLen
);
int32_t
taosGetOsReleaseName
(
char
*
releaseName
,
char
*
sName
,
char
*
ver
,
int32_t
maxLen
);
int32_t
taosGetCpuInfo
(
char
*
cpuModel
,
int32_t
maxLen
,
float
*
numOfCores
);
...
...
source/common/src/tglobal.c
浏览文件 @
4e5fbb52
...
...
@@ -77,8 +77,14 @@ int64_t tsVndCommitMaxIntervalMs = 600 * 1000;
int64_t
tsMndSdbWriteDelta
=
200
;
int64_t
tsMndLogRetention
=
2000
;
int8_t
tsGrant
=
1
;
int32_t
tsMndGrantMode
=
0
;
bool
tsMndSkipGrant
=
false
;
// dnode
int64_t
tsDndStart
=
0
;
int64_t
tsDndStartOsUptime
=
0
;
int64_t
tsDndUpTime
=
0
;
// monitor
bool
tsEnableMonitor
=
true
;
int32_t
tsMonitorInterval
=
30
;
...
...
@@ -506,6 +512,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
if
(
cfgAddInt64
(
pCfg
,
"mndSdbWriteDelta"
,
tsMndSdbWriteDelta
,
20
,
10000
,
CFG_SCOPE_SERVER
)
!=
0
)
return
-
1
;
if
(
cfgAddInt64
(
pCfg
,
"mndLogRetention"
,
tsMndLogRetention
,
500
,
10000
,
CFG_SCOPE_SERVER
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"grantMode"
,
tsMndGrantMode
,
0
,
10000
,
CFG_SCOPE_SERVER
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"skipGrant"
,
tsMndSkipGrant
,
CFG_SCOPE_SERVER
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"monitor"
,
tsEnableMonitor
,
CFG_SCOPE_SERVER
)
!=
0
)
return
-
1
;
...
...
@@ -915,6 +922,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
tsMndSdbWriteDelta
=
cfgGetItem
(
pCfg
,
"mndSdbWriteDelta"
)
->
i64
;
tsMndLogRetention
=
cfgGetItem
(
pCfg
,
"mndLogRetention"
)
->
i64
;
tsMndSkipGrant
=
cfgGetItem
(
pCfg
,
"skipGrant"
)
->
bval
;
tsMndGrantMode
=
cfgGetItem
(
pCfg
,
"grantMode"
)
->
i32
;
tsStartUdfd
=
cfgGetItem
(
pCfg
,
"udf"
)
->
bval
;
tstrncpy
(
tsUdfdResFuncs
,
cfgGetItem
(
pCfg
,
"udfdResFuncs"
)
->
str
,
sizeof
(
tsUdfdResFuncs
));
...
...
source/dnode/mgmt/exe/dmMain.c
浏览文件 @
4e5fbb52
...
...
@@ -373,6 +373,8 @@ int mainWindows(int argc, char **argv) {
dInfo
(
"start to init service"
);
dmSetSignalHandle
();
tsDndStart
=
taosGetTimestampMs
();
tsDndStartOsUptime
=
taosGetOsUptime
();
int32_t
code
=
dmRun
();
dInfo
(
"shutting down the service"
);
...
...
source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
浏览文件 @
4e5fbb52
...
...
@@ -24,12 +24,16 @@ static void *dmStatusThreadFp(void *param) {
const
static
int16_t
TRIM_FREQ
=
30
;
int32_t
trimCount
=
0
;
int32_t
upTimeCount
=
0
;
int64_t
upTime
=
0
;
while
(
1
)
{
taosMsleep
(
200
);
if
(
pMgmt
->
pData
->
dropped
||
pMgmt
->
pData
->
stopped
)
break
;
int64_t
curTime
=
taosGetTimestampMs
();
float
interval
=
(
curTime
-
lastTime
)
/
1000
.
0
f
;
if
(
curTime
<
lastTime
)
lastTime
=
curTime
;
float
interval
=
(
curTime
-
lastTime
)
/
1000
.
0
f
;
if
(
interval
>=
tsStatusInterval
)
{
dmSendStatusReq
(
pMgmt
);
lastTime
=
curTime
;
...
...
@@ -38,6 +42,11 @@ static void *dmStatusThreadFp(void *param) {
if
(
trimCount
==
0
)
{
taosMemoryTrim
(
0
);
}
if
((
upTimeCount
=
((
upTimeCount
+
1
)
&
63
))
==
0
)
{
upTime
=
taosGetOsUptime
()
-
tsDndStartOsUptime
;
tsDndUpTime
=
TMAX
(
tsDndUpTime
,
upTime
);
}
}
}
...
...
@@ -54,7 +63,8 @@ static void *dmMonitorThreadFp(void *param) {
if
(
pMgmt
->
pData
->
dropped
||
pMgmt
->
pData
->
stopped
)
break
;
int64_t
curTime
=
taosGetTimestampMs
();
float
interval
=
(
curTime
-
lastTime
)
/
1000
.
0
f
;
if
(
curTime
<
lastTime
)
lastTime
=
curTime
;
float
interval
=
(
curTime
-
lastTime
)
/
1000
.
0
f
;
if
(
interval
>=
tsMonitorInterval
)
{
(
*
pMgmt
->
sendMonitorReportFp
)();
lastTime
=
curTime
;
...
...
source/dnode/mgmt/node_mgmt/src/dmTransport.c
浏览文件 @
4e5fbb52
...
...
@@ -290,6 +290,7 @@ int32_t dmInitClient(SDnode *pDnode) {
rpcInit
.
cfp
=
(
RpcCfp
)
dmProcessRpcMsg
;
rpcInit
.
sessions
=
1024
;
rpcInit
.
connType
=
TAOS_CONN_CLIENT
;
rpcInit
.
user
=
TSDB_DEFAULT_USER
;
rpcInit
.
idleTime
=
tsShellActivityTimer
*
1000
;
rpcInit
.
parent
=
pDnode
;
rpcInit
.
rfp
=
rpcRfp
;
...
...
source/dnode/mnode/impl/inc/mndCluster.h
浏览文件 @
4e5fbb52
...
...
@@ -27,7 +27,7 @@ void mndCleanupCluster(SMnode *pMnode);
int32_t
mndGetClusterName
(
SMnode
*
pMnode
,
char
*
clusterName
,
int32_t
len
);
int64_t
mndGetClusterId
(
SMnode
*
pMnode
);
int64_t
mndGetClusterCreateTime
(
SMnode
*
pMnode
);
float
mndGetClusterUpTime
(
SMnode
*
pMnode
);
int64_t
mndGetClusterUpTime
(
SMnode
*
pMnode
);
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/src/mndCluster.c
浏览文件 @
4e5fbb52
...
...
@@ -123,7 +123,7 @@ static int32_t mndGetClusterUpTimeImp(SClusterObj *pCluster) {
#endif
}
floa
t
mndGetClusterUpTime
(
SMnode
*
pMnode
)
{
int64_
t
mndGetClusterUpTime
(
SMnode
*
pMnode
)
{
int64_t
upTime
=
0
;
void
*
pIter
=
NULL
;
SClusterObj
*
pCluster
=
mndAcquireCluster
(
pMnode
,
&
pIter
);
...
...
@@ -132,7 +132,7 @@ float mndGetClusterUpTime(SMnode *pMnode) {
mndReleaseCluster
(
pMnode
,
pCluster
,
pIter
);
}
return
upTime
/
86400
.
0
f
;
return
upTime
;
}
static
SSdbRaw
*
mndClusterActionEncode
(
SClusterObj
*
pCluster
)
{
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
4e5fbb52
...
...
@@ -655,6 +655,7 @@ static int32_t mndConfigDnode(SMnode *pMnode, SRpcMsg *pReq, SMCfgDnodeReq *pCfg
STrans
*
pTrans
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
bool
cfgAll
=
pCfgReq
->
dnodeId
==
-
1
;
int32_t
iter
=
0
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
void
*
pIter
=
NULL
;
...
...
@@ -662,7 +663,8 @@ static int32_t mndConfigDnode(SMnode *pMnode, SRpcMsg *pReq, SMCfgDnodeReq *pCfg
if
(
cfgAll
)
{
pIter
=
sdbFetch
(
pSdb
,
SDB_DNODE
,
pIter
,
(
void
**
)
&
pDnode
);
if
(
pIter
==
NULL
)
break
;
}
else
if
(
!
(
pDnode
=
mndAcquireDnode
(
pMnode
,
pCfgReq
->
dnodeId
)))
{
++
iter
;
}
else
if
(
!
(
pDnode
=
mndAcquireDnode
(
pMnode
,
pCfgReq
->
dnodeId
)))
{
goto
_OVER
;
}
...
...
@@ -699,7 +701,7 @@ static int32_t mndConfigDnode(SMnode *pMnode, SRpcMsg *pReq, SMCfgDnodeReq *pCfg
}
if
(
pTrans
&&
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
tsGrantHBInterval
=
TMIN
(
TMAX
(
5
,
iter
/
2
),
30
);
terrno
=
0
;
_OVER:
...
...
@@ -863,7 +865,7 @@ static int32_t mndProcessCreateDnodeReq(SRpcMsg *pReq) {
code
=
mndCreateDnode
(
pMnode
,
pReq
,
&
createReq
);
if
(
code
==
0
)
code
=
TSDB_CODE_ACTION_IN_PROGRESS
;
tsGrantHBInterval
=
5
;
_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_ACTION_IN_PROGRESS
)
{
mError
(
"dnode:%s:%d, failed to create since %s"
,
createReq
.
fqdn
,
createReq
.
port
,
terrstr
());
...
...
source/dnode/mnode/impl/src/mndMain.c
浏览文件 @
4e5fbb52
...
...
@@ -804,7 +804,7 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
if
(
pObj
->
id
==
pMnode
->
selfDnodeId
)
{
pClusterInfo
->
first_ep_dnode_id
=
pObj
->
id
;
tstrncpy
(
pClusterInfo
->
first_ep
,
pObj
->
pDnode
->
ep
,
sizeof
(
pClusterInfo
->
first_ep
));
pClusterInfo
->
master_uptime
=
mndGetClusterUpTime
(
pMnode
)
;
pClusterInfo
->
master_uptime
=
(
float
)
mndGetClusterUpTime
(
pMnode
)
/
86400
.
0
f
;
// pClusterInfo->master_uptime = (ms - pObj->stateStartTime) / (86400000.0f);
tstrncpy
(
desc
.
role
,
syncStr
(
TAOS_SYNC_STATE_LEADER
),
sizeof
(
desc
.
role
));
}
else
{
...
...
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
4e5fbb52
...
...
@@ -877,6 +877,7 @@ typedef struct SCacheRowsReader {
SSHashObj
*
pTableMap
;
SArray
*
pLDataIterArray
;
struct
SDataFileReader
*
pFileReader
;
STFileSet
*
pCurFileSet
;
STsdbReadSnap
*
pReadSnap
;
char
*
idstr
;
int64_t
lastTs
;
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
4e5fbb52
...
...
@@ -1087,16 +1087,14 @@ int32_t tqProcessTaskScanHistory(STQ* pTq, SRpcMsg* pMsg) {
int64_t
st
=
taosGetTimestampMs
();
// we have to continue retrying to successfully execute the scan history task.
while
(
1
)
{
int8_t
schedStatus
=
atomic_val_compare_exchange_8
(
&
pTask
->
status
.
schedStatus
,
TASK_SCHED_STATUS__INACTIVE
,
TASK_SCHED_STATUS__WAITING
);
if
(
schedStatus
==
TASK_SCHED_STATUS__INACTIVE
)
{
break
;
}
tqError
(
"s-task:%s failed to start scan history in current time window, unexpected sched-status:%d, retry in 100ms"
,
id
,
schedStatus
);
taosMsleep
(
100
);
int8_t
schedStatus
=
atomic_val_compare_exchange_8
(
&
pTask
->
status
.
schedStatus
,
TASK_SCHED_STATUS__INACTIVE
,
TASK_SCHED_STATUS__WAITING
);
if
(
schedStatus
!=
TASK_SCHED_STATUS__INACTIVE
)
{
tqError
(
"s-task:%s failed to start scan-history in first stream time window since already started, unexpected "
"sched-status:%d"
,
id
,
schedStatus
);
return
0
;
}
ASSERT
(
pTask
->
status
.
pauseAllowed
==
false
);
...
...
@@ -1156,16 +1154,15 @@ int32_t tqProcessTaskScanHistory(STQ* pTq, SRpcMsg* pMsg) {
taosMsleep
(
100
);
}
streamTaskHalt
(
pTask
);
// now we can stop the stream task execution
// todo upgrade the statu to be HALT from PAUSE or NORMAL
pStreamTask
->
status
.
taskStatus
=
TASK_STATUS__HALT
;
tqDebug
(
"s-task:%s level:%d status is set to halt by fill-history task:%s"
,
pStreamTask
->
id
.
idStr
,
pStreamTask
->
info
.
taskLevel
,
id
);
streamTaskHalt
(
pStreamTask
);
tqDebug
(
"s-task:%s level:%d is halt by fill-history task:%s"
,
pStreamTask
->
id
.
idStr
,
pStreamTask
->
info
.
taskLevel
,
id
);
// if it's an source task, extract the last version in wal.
streamHistoryTaskSetVerRangeStep2
(
pTask
);
pRange
=
&
pTask
->
dataRange
.
range
;
int64_t
latestVer
=
walReaderGetCurrentVer
(
pStreamTask
->
exec
.
pWalReader
);
streamHistoryTaskSetVerRangeStep2
(
pTask
,
latestVer
);
}
if
(
!
streamTaskRecoverScanStep1Finished
(
pTask
))
{
...
...
source/dnode/vnode/src/tsdb/tsdbCache.c
浏览文件 @
4e5fbb52
...
...
@@ -1949,35 +1949,39 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
STFileObj
**
pFileObj
=
state
->
pFileSet
->
farr
;
if
(
pFileObj
[
0
]
!=
NULL
||
pFileObj
[
3
]
!=
NULL
)
{
SDataFileReaderConfig
conf
=
{.
tsdb
=
state
->
pTsdb
,
.
szPage
=
state
->
pTsdb
->
pVnode
->
config
.
szPage
};
const
char
*
filesName
[
4
]
=
{
0
};
if
(
pFileObj
[
0
]
!=
NULL
)
{
conf
.
files
[
0
].
file
=
*
pFileObj
[
0
]
->
f
;
conf
.
files
[
0
].
exist
=
true
;
filesName
[
0
]
=
pFileObj
[
0
]
->
fname
;
if
(
state
->
pFileSet
!=
state
->
pr
->
pCurFileSet
)
{
SDataFileReaderConfig
conf
=
{.
tsdb
=
state
->
pTsdb
,
.
szPage
=
state
->
pTsdb
->
pVnode
->
config
.
tsdbPageSize
};
const
char
*
filesName
[
4
]
=
{
0
};
if
(
pFileObj
[
0
]
!=
NULL
)
{
conf
.
files
[
0
].
file
=
*
pFileObj
[
0
]
->
f
;
conf
.
files
[
0
].
exist
=
true
;
filesName
[
0
]
=
pFileObj
[
0
]
->
fname
;
conf
.
files
[
1
].
file
=
*
pFileObj
[
1
]
->
f
;
conf
.
files
[
1
].
exist
=
true
;
filesName
[
1
]
=
pFileObj
[
1
]
->
fname
;
conf
.
files
[
2
].
file
=
*
pFileObj
[
2
]
->
f
;
conf
.
files
[
2
].
exist
=
true
;
filesName
[
2
]
=
pFileObj
[
2
]
->
fname
;
}
conf
.
files
[
1
].
file
=
*
pFileObj
[
1
]
->
f
;
conf
.
files
[
1
].
exist
=
true
;
filesName
[
1
]
=
pFileObj
[
1
]
->
fname
;
if
(
pFileObj
[
3
]
!=
NULL
)
{
conf
.
files
[
3
].
exist
=
true
;
conf
.
files
[
3
].
file
=
*
pFileObj
[
3
]
->
f
;
filesName
[
3
]
=
pFileObj
[
3
]
->
fname
;
}
co
nf
.
files
[
2
].
file
=
*
pFileObj
[
2
]
->
f
;
conf
.
files
[
2
].
exist
=
true
;
filesName
[
2
]
=
pFileObj
[
2
]
->
fname
;
}
co
de
=
tsdbDataFileReaderOpen
(
filesName
,
&
conf
,
&
state
->
pr
->
pFileReader
)
;
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_err
;
}
if
(
pFileObj
[
3
]
!=
NULL
)
{
conf
.
files
[
3
].
exist
=
true
;
conf
.
files
[
3
].
file
=
*
pFileObj
[
3
]
->
f
;
filesName
[
3
]
=
pFileObj
[
3
]
->
fname
;
}
loadDataTomb
(
state
->
pr
,
state
->
pr
->
pFileReader
);
code
=
tsdbDataFileReaderOpen
(
filesName
,
&
conf
,
&
state
->
pr
->
pFileReader
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_err
;
state
->
pr
->
pCurFileSet
=
state
->
pFileSet
;
}
loadDataTomb
(
state
->
pr
,
state
->
pr
->
pFileReader
);
if
(
!
state
->
pIndexList
)
{
state
->
pIndexList
=
taosArrayInit
(
1
,
sizeof
(
SBrinBlk
));
}
else
{
...
...
@@ -2053,7 +2057,9 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
}
if
(
!
state
->
pLastRow
)
{
lastIterClose
(
&
state
->
pLastIter
);
if
(
state
->
pLastIter
)
{
lastIterClose
(
&
state
->
pLastIter
);
}
clearLastFileSet
(
state
);
state
->
state
=
SFSNEXTROW_FILESET
;
...
...
@@ -2154,7 +2160,9 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
}
if
(
!
state
->
pLastRow
)
{
lastIterClose
(
&
state
->
pLastIter
);
if
(
state
->
pLastIter
)
{
lastIterClose
(
&
state
->
pLastIter
);
}
*
ppRow
=
&
state
->
row
;
--
state
->
iRow
;
...
...
@@ -2214,19 +2222,6 @@ _err:
return
code
;
}
int32_t
clearNextRowFromFS
(
void
*
iter
)
{
int32_t
code
=
0
;
SFSNextRowIter
*
state
=
(
SFSNextRowIter
*
)
iter
;
if
(
!
state
)
{
return
code
;
}
clearLastFileSet
(
state
);
return
code
;
}
typedef
enum
SMEMNEXTROWSTATES
{
SMEMNEXTROW_ENTER
,
SMEMNEXTROW_NEXT
,
...
...
@@ -2346,6 +2341,36 @@ typedef struct CacheNextRowIter {
STsdb
*
pTsdb
;
}
CacheNextRowIter
;
int32_t
clearNextRowFromFS
(
void
*
iter
)
{
int32_t
code
=
0
;
SFSNextRowIter
*
state
=
(
SFSNextRowIter
*
)
iter
;
if
(
!
state
)
{
return
code
;
}
if
(
state
->
pLastIter
)
{
lastIterClose
(
&
state
->
pLastIter
);
}
if
(
state
->
pBlockData
)
{
tBlockDataDestroy
(
state
->
pBlockData
);
state
->
pBlockData
=
NULL
;
}
if
(
state
->
pTSRow
)
{
taosMemoryFree
(
state
->
pTSRow
);
state
->
pTSRow
=
NULL
;
}
if
(
state
->
pRowIter
->
pSkyline
)
{
taosArrayDestroy
(
state
->
pRowIter
->
pSkyline
);
state
->
pRowIter
->
pSkyline
=
NULL
;
}
return
code
;
}
static
void
clearLastFileSet
(
SFSNextRowIter
*
state
)
{
if
(
state
->
pLastIter
)
{
lastIterClose
(
&
state
->
pLastIter
);
...
...
@@ -2359,6 +2384,8 @@ static void clearLastFileSet(SFSNextRowIter *state) {
if
(
state
->
pr
->
pFileReader
)
{
tsdbDataFileReaderClose
(
&
state
->
pr
->
pFileReader
);
state
->
pr
->
pFileReader
=
NULL
;
state
->
pr
->
pCurFileSet
=
NULL
;
}
if
(
state
->
pTSRow
)
{
...
...
source/dnode/vnode/src/tsdb/tsdbCommit2.c
浏览文件 @
4e5fbb52
...
...
@@ -189,6 +189,10 @@ static int32_t tsdbCommitTombData(SCommitter2 *committer) {
committer
->
ctx
->
maxKey
=
committer
->
ctx
->
maxKey
+
1
;
}
if
(
record
->
ekey
>
committer
->
ctx
->
maxKey
)
{
committer
->
ctx
->
nextKey
=
record
->
ekey
;
}
record
->
skey
=
TMAX
(
record
->
skey
,
committer
->
ctx
->
minKey
);
record
->
ekey
=
TMIN
(
record
->
ekey
,
committer
->
ctx
->
maxKey
);
...
...
@@ -602,4 +606,4 @@ _exit:
tsdbInfo
(
"vgId:%d %s done"
,
TD_VID
(
pTsdb
->
pVnode
),
__func__
);
}
return
code
;
}
\ No newline at end of file
}
source/dnode/vnode/src/tsdb/tsdbFile.c
浏览文件 @
4e5fbb52
...
...
@@ -112,7 +112,10 @@ static char* getFileNamePrefix(STsdb *pTsdb, SDiskID did, int32_t fid, uint64_t
p
+=
titoa
(
TD_VID
(
pTsdb
->
pVnode
),
10
,
p
);
*
(
p
++
)
=
'f'
;
p
+=
titoa
(
fid
,
10
,
p
);
if
(
fid
<
0
)
{
*
(
p
++
)
=
'-'
;
}
p
+=
titoa
((
fid
<
0
)
?
-
fid
:
fid
,
10
,
p
);
memcpy
(
p
,
"ver"
,
3
);
p
+=
3
;
...
...
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
浏览文件 @
4e5fbb52
...
...
@@ -352,9 +352,9 @@ static int32_t extractSttBlockInfo(SLDataIter *pIter, const TSttBlkArray *pArray
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
uidComparFn
(
const
void
*
p1
,
const
void
*
p2
)
{
const
uint64_t
*
uid1
=
p1
;
const
uint64_t
*
uid2
=
p2
;
static
int32_t
uidComparFn
(
const
void
*
p1
,
const
void
*
p2
)
{
const
uint64_t
*
uid1
=
p1
;
const
uint64_t
*
uid2
=
p2
;
return
(
*
uid1
)
-
(
*
uid2
);
}
...
...
@@ -372,16 +372,16 @@ static bool existsFromSttBlkStatis(const TStatisBlkArray *pStatisBlkArray, uint6
}
}
// for (; i < TARRAY2_SIZE(pStatisBlkArray); ++i) {
// SStatisBlk *p = &pStatisBlkArray->data[i];
// if (p->minTbid.uid <= uid && p->maxTbid.uid >= uid) {
// break;
// }
//
// if (p->maxTbid.uid < uid) {
// break;
// }
// }
// for (; i < TARRAY2_SIZE(pStatisBlkArray); ++i) {
// SStatisBlk *p = &pStatisBlkArray->data[i];
// if (p->minTbid.uid <= uid && p->maxTbid.uid >= uid) {
// break;
// }
//
// if (p->maxTbid.uid < uid) {
// break;
// }
// }
if
(
i
>=
TARRAY2_SIZE
(
pStatisBlkArray
))
{
return
false
;
...
...
@@ -416,7 +416,7 @@ int32_t tLDataIterOpen2(struct SLDataIter *pIter, SSttFileReader *pSttFileReader
if
(
!
pBlockLoadInfo
->
sttBlockLoaded
)
{
int64_t
st
=
taosGetTimestampUs
();
const
TSttBlkArray
*
pSttBlkArray
=
NULL
;
const
TSttBlkArray
*
pSttBlkArray
=
NULL
;
pBlockLoadInfo
->
sttBlockLoaded
=
true
;
// load the stt block info for each stt-block
...
...
@@ -445,12 +445,12 @@ int32_t tLDataIterOpen2(struct SLDataIter *pIter, SSttFileReader *pSttFileReader
tsdbDebug
(
"load the stt file info completed, elapsed time:%.2fms, %s"
,
el
,
idStr
);
}
// bool exists = existsFromSttBlkStatis(pBlockLoadInfo->pSttStatisBlkArray, suid, uid, pIter->pReader);
// if (!exists) {
// pIter->iSttBlk = -1;
// pIter->pSttBlk = NULL;
// return TSDB_CODE_SUCCESS;
// }
// bool exists = existsFromSttBlkStatis(pBlockLoadInfo->pSttStatisBlkArray, suid, uid, pIter->pReader);
// if (!exists) {
// pIter->iSttBlk = -1;
// pIter->pSttBlk = NULL;
// return TSDB_CODE_SUCCESS;
// }
// find the start block, actually we could load the position to avoid repeatly searching for the start position when
// the skey is updated.
...
...
@@ -794,7 +794,7 @@ int32_t tMergeTreeOpen2(SMergeTree *pMTree, SMergeTreeConf *pConf) {
// open stt file reader if not
if
(
pSttFileReader
==
NULL
)
{
SSttFileReaderConfig
conf
=
{.
tsdb
=
pConf
->
pTsdb
,
.
szPage
=
pConf
->
pTsdb
->
pVnode
->
config
.
szPag
e
};
SSttFileReaderConfig
conf
=
{.
tsdb
=
pConf
->
pTsdb
,
.
szPage
=
pConf
->
pTsdb
->
pVnode
->
config
.
tsdbPageSiz
e
};
conf
.
file
[
0
]
=
*
pSttLevel
->
fobjArr
->
data
[
i
]
->
f
;
code
=
tsdbSttFileReaderOpen
(
pSttLevel
->
fobjArr
->
data
[
i
]
->
fname
,
&
conf
,
&
pSttFileReader
);
...
...
source/dnode/vnode/src/tsdb/tsdbRead2.c
浏览文件 @
4e5fbb52
...
...
@@ -189,7 +189,7 @@ static int32_t filesetIteratorNext(SFilesetIter* pIter, STsdbReader* pReader, bo
STFileObj
**
pFileObj
=
pReader
->
status
.
pCurrentFileset
->
farr
;
if
(
pFileObj
[
0
]
!=
NULL
||
pFileObj
[
3
]
!=
NULL
)
{
SDataFileReaderConfig
conf
=
{.
tsdb
=
pReader
->
pTsdb
,
.
szPage
=
pReader
->
pTsdb
->
pVnode
->
config
.
szPag
e
};
SDataFileReaderConfig
conf
=
{.
tsdb
=
pReader
->
pTsdb
,
.
szPage
=
pReader
->
pTsdb
->
pVnode
->
config
.
tsdbPageSiz
e
};
const
char
*
filesName
[
4
]
=
{
0
};
...
...
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
浏览文件 @
4e5fbb52
...
...
@@ -749,7 +749,7 @@ int32_t tsdbDFileSetCopy(STsdb *pTsdb, SDFileSet *pSetFrom, SDFileSet *pSetTo) {
int64_t
size
;
TdFilePtr
pOutFD
=
NULL
;
TdFilePtr
PInFD
=
NULL
;
int32_t
szPage
=
pTsdb
->
pVnode
->
config
.
szPag
e
;
int32_t
szPage
=
pTsdb
->
pVnode
->
config
.
tsdbPageSiz
e
;
char
fNameFrom
[
TSDB_FILENAME_LEN
];
char
fNameTo
[
TSDB_FILENAME_LEN
];
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
4e5fbb52
...
...
@@ -2941,15 +2941,23 @@ int32_t startGroupTableMergeScan(SOperatorInfo* pOperator) {
int32_t
tableStartIdx
=
pInfo
->
tableStartIndex
;
int32_t
tableEndIdx
=
pInfo
->
tableEndIndex
;
pInfo
->
sortBufSize
=
2048
*
pInfo
->
bufPageSize
;
int32_t
numOfBufPage
=
pInfo
->
sortBufSize
/
pInfo
->
bufPageSize
;
pInfo
->
pSortHandle
=
tsortCreateSortHandle
(
pInfo
->
pSortInfo
,
SORT_BLOCK_TS_MERGE
,
pInfo
->
bufPageSize
,
numOfBufPage
,
pInfo
->
pSortInputBlock
,
pTaskInfo
->
id
.
str
,
0
,
0
,
0
);
bool
hasLimit
=
pInfo
->
limitInfo
.
limit
.
limit
!=
-
1
||
pInfo
->
limitInfo
.
limit
.
offset
!=
-
1
;
int64_t
mergeLimit
=
-
1
;
if
(
pInfo
->
limitInfo
.
limit
.
limit
!=
-
1
||
pInfo
->
limitInfo
.
limit
.
offset
!=
-
1
)
{
mergeLimit
=
pInfo
->
limitInfo
.
limit
.
limit
+
pInfo
->
limitInfo
.
limit
.
offset
;
}
tsortSetMergeLimit
(
pInfo
->
pSortHandle
,
mergeLimit
);
if
(
hasLimit
)
{
mergeLimit
=
pInfo
->
limitInfo
.
limit
.
limit
+
pInfo
->
limitInfo
.
limit
.
offset
;
}
size_t
szRow
=
blockDataGetRowSize
(
pInfo
->
pResBlock
);
if
(
hasLimit
)
{
pInfo
->
pSortHandle
=
tsortCreateSortHandle
(
pInfo
->
pSortInfo
,
SORT_SINGLESOURCE_SORT
,
-
1
,
-
1
,
NULL
,
pTaskInfo
->
id
.
str
,
mergeLimit
,
szRow
+
8
,
tsPQSortMemThreshold
*
1024
*
1024
);
}
else
{
pInfo
->
sortBufSize
=
2048
*
pInfo
->
bufPageSize
;
int32_t
numOfBufPage
=
pInfo
->
sortBufSize
/
pInfo
->
bufPageSize
;
pInfo
->
pSortHandle
=
tsortCreateSortHandle
(
pInfo
->
pSortInfo
,
SORT_BLOCK_TS_MERGE
,
pInfo
->
bufPageSize
,
numOfBufPage
,
pInfo
->
pSortInputBlock
,
pTaskInfo
->
id
.
str
,
0
,
0
,
0
);
tsortSetMergeLimit
(
pInfo
->
pSortHandle
,
mergeLimit
);
}
tsortSetFetchRawDataFp
(
pInfo
->
pSortHandle
,
getTableDataBlockImpl
,
NULL
,
NULL
);
// one table has one data block
...
...
source/libs/executor/src/sortoperator.c
浏览文件 @
4e5fbb52
...
...
@@ -54,19 +54,19 @@ SOperatorInfo* createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode*
int32_t
numOfCols
=
0
;
pOperator
->
exprSupp
.
pExprInfo
=
createExprInfo
(
pSortNode
->
pExprs
,
NULL
,
&
numOfCols
);
pOperator
->
exprSupp
.
numOfExprs
=
numOfCols
;
calcSortOperMaxTupleLength
(
pInfo
,
pSortNode
->
pSortKeys
);
pInfo
->
maxRows
=
-
1
;
if
(
pSortNode
->
node
.
pLimit
)
{
SLimitNode
*
pLimit
=
(
SLimitNode
*
)
pSortNode
->
node
.
pLimit
;
if
(
pLimit
->
limit
>
0
)
pInfo
->
maxRows
=
pLimit
->
limit
;
}
int32_t
numOfOutputCols
=
0
;
int32_t
code
=
extractColMatchInfo
(
pSortNode
->
pTargets
,
pDescNode
,
&
numOfOutputCols
,
COL_MATCH_FROM_SLOT_ID
,
&
pInfo
->
matchInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
calcSortOperMaxTupleLength
(
pInfo
,
pSortNode
->
pSortKeys
);
pInfo
->
maxRows
=
-
1
;
if
(
pSortNode
->
node
.
pLimit
)
{
SLimitNode
*
pLimit
=
(
SLimitNode
*
)
pSortNode
->
node
.
pLimit
;
if
(
pLimit
->
limit
>
0
)
pInfo
->
maxRows
=
pLimit
->
limit
+
pLimit
->
offset
;
}
pOperator
->
exprSupp
.
pCtx
=
createSqlFunctionCtx
(
pOperator
->
exprSupp
.
pExprInfo
,
numOfCols
,
&
pOperator
->
exprSupp
.
rowEntryInfoOffset
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
...
...
source/libs/executor/src/tfill.c
浏览文件 @
4e5fbb52
...
...
@@ -66,20 +66,25 @@ static void setNullRow(SSDataBlock* pBlock, SFillInfo* pFillInfo, int32_t rowInd
}
static
void
doSetUserSpecifiedValue
(
SColumnInfoData
*
pDst
,
SVariant
*
pVar
,
int32_t
rowIndex
,
int64_t
currentKey
)
{
bool
isNull
=
(
TSDB_DATA_TYPE_NULL
==
pVar
->
nType
)
?
true
:
false
;
if
(
pDst
->
info
.
type
==
TSDB_DATA_TYPE_FLOAT
)
{
float
v
=
0
;
GET_TYPED_DATA
(
v
,
float
,
pVar
->
nType
,
&
pVar
->
i
);
colDataSetVal
(
pDst
,
rowIndex
,
(
char
*
)
&
v
,
false
);
GET_TYPED_DATA
(
v
,
float
,
pVar
->
nType
,
&
pVar
->
f
);
colDataSetVal
(
pDst
,
rowIndex
,
(
char
*
)
&
v
,
isNull
);
}
else
if
(
pDst
->
info
.
type
==
TSDB_DATA_TYPE_DOUBLE
)
{
double
v
=
0
;
GET_TYPED_DATA
(
v
,
double
,
pVar
->
nType
,
&
pVar
->
i
);
colDataSetVal
(
pDst
,
rowIndex
,
(
char
*
)
&
v
,
false
);
GET_TYPED_DATA
(
v
,
double
,
pVar
->
nType
,
&
pVar
->
d
);
colDataSetVal
(
pDst
,
rowIndex
,
(
char
*
)
&
v
,
isNull
);
}
else
if
(
IS_SIGNED_NUMERIC_TYPE
(
pDst
->
info
.
type
))
{
int64_t
v
=
0
;
GET_TYPED_DATA
(
v
,
int64_t
,
pVar
->
nType
,
&
pVar
->
i
);
colDataSetVal
(
pDst
,
rowIndex
,
(
char
*
)
&
v
,
false
);
colDataSetVal
(
pDst
,
rowIndex
,
(
char
*
)
&
v
,
isNull
);
}
else
if
(
IS_UNSIGNED_NUMERIC_TYPE
(
pDst
->
info
.
type
))
{
uint64_t
v
=
0
;
GET_TYPED_DATA
(
v
,
uint64_t
,
pVar
->
nType
,
&
pVar
->
u
);
colDataSetVal
(
pDst
,
rowIndex
,
(
char
*
)
&
v
,
isNull
);
}
else
if
(
pDst
->
info
.
type
==
TSDB_DATA_TYPE_TIMESTAMP
)
{
colDataSetVal
(
pDst
,
rowIndex
,
(
const
char
*
)
&
currentKey
,
false
);
colDataSetVal
(
pDst
,
rowIndex
,
(
const
char
*
)
&
currentKey
,
isNull
);
}
else
{
// varchar/nchar data
colDataSetNULL
(
pDst
,
rowIndex
);
}
...
...
source/libs/executor/src/timesliceoperator.c
浏览文件 @
4e5fbb52
...
...
@@ -312,6 +312,7 @@ static bool genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp
case
TSDB_FILL_SET_VALUE_F
:
{
SVariant
*
pVar
=
&
pSliceInfo
->
pFillColInfo
[
fillColIndex
].
fillVal
;
bool
isNull
=
(
TSDB_DATA_TYPE_NULL
==
pVar
->
nType
)
?
true
:
false
;
if
(
pDst
->
info
.
type
==
TSDB_DATA_TYPE_FLOAT
)
{
float
v
=
0
;
if
(
!
IS_VAR_DATA_TYPE
(
pVar
->
nType
))
{
...
...
@@ -319,7 +320,7 @@ static bool genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp
}
else
{
v
=
taosStr2Float
(
varDataVal
(
pVar
->
pz
),
NULL
);
}
colDataSetVal
(
pDst
,
rows
,
(
char
*
)
&
v
,
false
);
colDataSetVal
(
pDst
,
rows
,
(
char
*
)
&
v
,
isNull
);
}
else
if
(
pDst
->
info
.
type
==
TSDB_DATA_TYPE_DOUBLE
)
{
double
v
=
0
;
if
(
!
IS_VAR_DATA_TYPE
(
pVar
->
nType
))
{
...
...
@@ -327,7 +328,7 @@ static bool genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp
}
else
{
v
=
taosStr2Double
(
varDataVal
(
pVar
->
pz
),
NULL
);
}
colDataSetVal
(
pDst
,
rows
,
(
char
*
)
&
v
,
false
);
colDataSetVal
(
pDst
,
rows
,
(
char
*
)
&
v
,
isNull
);
}
else
if
(
IS_SIGNED_NUMERIC_TYPE
(
pDst
->
info
.
type
))
{
int64_t
v
=
0
;
if
(
!
IS_VAR_DATA_TYPE
(
pVar
->
nType
))
{
...
...
@@ -335,7 +336,7 @@ static bool genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp
}
else
{
v
=
taosStr2Int64
(
varDataVal
(
pVar
->
pz
),
NULL
,
10
);
}
colDataSetVal
(
pDst
,
rows
,
(
char
*
)
&
v
,
false
);
colDataSetVal
(
pDst
,
rows
,
(
char
*
)
&
v
,
isNull
);
}
else
if
(
IS_UNSIGNED_NUMERIC_TYPE
(
pDst
->
info
.
type
))
{
uint64_t
v
=
0
;
if
(
!
IS_VAR_DATA_TYPE
(
pVar
->
nType
))
{
...
...
@@ -343,7 +344,7 @@ static bool genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp
}
else
{
v
=
taosStr2UInt64
(
varDataVal
(
pVar
->
pz
),
NULL
,
10
);
}
colDataSetVal
(
pDst
,
rows
,
(
char
*
)
&
v
,
false
);
colDataSetVal
(
pDst
,
rows
,
(
char
*
)
&
v
,
isNull
);
}
else
if
(
IS_BOOLEAN_TYPE
(
pDst
->
info
.
type
))
{
bool
v
=
false
;
if
(
!
IS_VAR_DATA_TYPE
(
pVar
->
nType
))
{
...
...
@@ -351,7 +352,7 @@ static bool genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp
}
else
{
v
=
taosStr2Int8
(
varDataVal
(
pVar
->
pz
),
NULL
,
10
);
}
colDataSetVal
(
pDst
,
rows
,
(
char
*
)
&
v
,
false
);
colDataSetVal
(
pDst
,
rows
,
(
char
*
)
&
v
,
isNull
);
}
++
fillColIndex
;
...
...
source/libs/executor/src/tsort.c
浏览文件 @
4e5fbb52
...
...
@@ -51,6 +51,7 @@ struct SSortHandle {
uint32_t
tmpRowIdx
;
int64_t
mergeLimit
;
int64_t
currMergeLimitTs
;
int32_t
sourceId
;
SSDataBlock
*
pDataBlock
;
...
...
@@ -921,7 +922,8 @@ static int32_t sortBlocksToExtSource(SSortHandle* pHandle, SArray* aBlk, SBlockO
int32_t
nMergedRows
=
0
;
bool
mergeLimitReached
=
false
;
size_t
blkPgSz
=
pgHeaderSz
;
int64_t
lastPageBufTs
=
(
order
->
order
==
TSDB_ORDER_ASC
)
?
INT64_MAX
:
INT64_MIN
;
int64_t
currTs
=
(
order
->
order
==
TSDB_ORDER_ASC
)
?
INT64_MAX
:
INT64_MIN
;
while
(
nRows
<
totalRows
)
{
int32_t
minIdx
=
tMergeTreeGetChosenIndex
(
pTree
);
SSDataBlock
*
minBlk
=
taosArrayGetP
(
aBlk
,
minIdx
);
...
...
@@ -929,14 +931,21 @@ static int32_t sortBlocksToExtSource(SSortHandle* pHandle, SArray* aBlk, SBlockO
int32_t
bufInc
=
getPageBufIncForRow
(
minBlk
,
minRow
,
pHandle
->
pDataBlock
->
info
.
rows
);
if
(
blkPgSz
<=
pHandle
->
pageSize
&&
blkPgSz
+
bufInc
>
pHandle
->
pageSize
)
{
SColumnInfoData
*
tsCol
=
taosArrayGet
(
pHandle
->
pDataBlock
->
pDataBlock
,
order
->
slotId
);
lastPageBufTs
=
((
int64_t
*
)
tsCol
->
pData
)[
pHandle
->
pDataBlock
->
info
.
rows
-
1
];
appendDataBlockToPageBuf
(
pHandle
,
pHandle
->
pDataBlock
,
aPgId
);
nMergedRows
+=
pHandle
->
pDataBlock
->
info
.
rows
;
blockDataCleanup
(
pHandle
->
pDataBlock
);
blkPgSz
=
pgHeaderSz
;
bufInc
=
getPageBufIncForRow
(
minBlk
,
minRow
,
0
);
if
((
pHandle
->
mergeLimit
!=
-
1
)
&&
(
nMergedRows
>=
pHandle
->
mergeLimit
))
{
mergeLimitReached
=
true
;
if
((
lastPageBufTs
<
pHandle
->
currMergeLimitTs
&&
order
->
order
==
TSDB_ORDER_ASC
)
||
(
lastPageBufTs
>
pHandle
->
currMergeLimitTs
&&
order
->
order
==
TSDB_ORDER_DESC
))
{
pHandle
->
currMergeLimitTs
=
lastPageBufTs
;
}
break
;
}
}
...
...
@@ -955,8 +964,17 @@ static int32_t sortBlocksToExtSource(SSortHandle* pHandle, SArray* aBlk, SBlockO
}
if
(
pHandle
->
pDataBlock
->
info
.
rows
>
0
)
{
if
(
!
mergeLimitReached
)
{
SColumnInfoData
*
tsCol
=
taosArrayGet
(
pHandle
->
pDataBlock
->
pDataBlock
,
order
->
slotId
);
lastPageBufTs
=
((
int64_t
*
)
tsCol
->
pData
)[
pHandle
->
pDataBlock
->
info
.
rows
-
1
];
appendDataBlockToPageBuf
(
pHandle
,
pHandle
->
pDataBlock
,
aPgId
);
nMergedRows
+=
pHandle
->
pDataBlock
->
info
.
rows
;
if
((
pHandle
->
mergeLimit
!=
-
1
)
&&
(
nMergedRows
>=
pHandle
->
mergeLimit
))
{
mergeLimitReached
=
true
;
if
((
lastPageBufTs
<
pHandle
->
currMergeLimitTs
&&
order
->
order
==
TSDB_ORDER_ASC
)
||
(
lastPageBufTs
>
pHandle
->
currMergeLimitTs
&&
order
->
order
==
TSDB_ORDER_DESC
))
{
pHandle
->
currMergeLimitTs
=
lastPageBufTs
;
}
}
}
blockDataCleanup
(
pHandle
->
pDataBlock
);
}
...
...
@@ -982,11 +1000,24 @@ static int32_t createBlocksMergeSortInitialSources(SSortHandle* pHandle) {
SSortSource
*
pSrc
=
taosArrayGetP
(
pHandle
->
pOrderedSource
,
0
);
int32_t
szSort
=
0
;
if
(
pOrder
->
order
==
TSDB_ORDER_ASC
)
{
pHandle
->
currMergeLimitTs
=
INT64_MAX
;
}
else
{
pHandle
->
currMergeLimitTs
=
INT64_MIN
;
}
SArray
*
aBlkSort
=
taosArrayInit
(
8
,
POINTER_BYTES
);
SSHashObj
*
mUidBlk
=
tSimpleHashInit
(
64
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_UBIGINT
));
while
(
1
)
{
SSDataBlock
*
pBlk
=
pHandle
->
fetchfp
(
pSrc
->
param
);
if
(
pBlk
!=
NULL
)
{
SColumnInfoData
*
tsCol
=
taosArrayGet
(
pBlk
->
pDataBlock
,
pOrder
->
slotId
);
int64_t
firstRowTs
=
*
(
int64_t
*
)
tsCol
->
pData
;
if
((
pOrder
->
order
==
TSDB_ORDER_ASC
&&
firstRowTs
>
pHandle
->
currMergeLimitTs
)
||
(
pOrder
->
order
==
TSDB_ORDER_DESC
&&
firstRowTs
<
pHandle
->
currMergeLimitTs
))
{
continue
;
}
}
if
(
pBlk
!=
NULL
)
{
szSort
+=
blockDataGetSize
(
pBlk
);
...
...
@@ -1374,6 +1405,9 @@ static int32_t tsortOpenForPQSort(SSortHandle* pHandle) {
}
static
STupleHandle
*
tsortPQSortNextTuple
(
SSortHandle
*
pHandle
)
{
if
(
pHandle
->
pDataBlock
==
NULL
)
{
// when no input stream datablock
return
NULL
;
}
blockDataCleanup
(
pHandle
->
pDataBlock
);
blockDataEnsureCapacity
(
pHandle
->
pDataBlock
,
1
);
// abandon the top tuple if queue size bigger than max size
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
4e5fbb52
...
...
@@ -920,6 +920,7 @@ void appendSelectivityValue(SqlFunctionCtx* pCtx, int32_t rowIndex, int32_t pos)
void
replaceTupleData
(
STuplePos
*
pDestPos
,
STuplePos
*
pSourcePos
)
{
*
pDestPos
=
*
pSourcePos
;
}
#define COMPARE_MINMAX_DATA(type) (( (*(type*)&pDBuf->v) < (*(type*)&pSBuf->v) ) ^ isMinFunc)
int32_t
minMaxCombine
(
SqlFunctionCtx
*
pDestCtx
,
SqlFunctionCtx
*
pSourceCtx
,
int32_t
isMinFunc
)
{
SResultRowEntryInfo
*
pDResInfo
=
GET_RES_INFO
(
pDestCtx
);
SMinmaxResInfo
*
pDBuf
=
GET_ROWCELL_INTERBUF
(
pDResInfo
);
...
...
@@ -927,18 +928,57 @@ int32_t minMaxCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx, int3
SResultRowEntryInfo
*
pSResInfo
=
GET_RES_INFO
(
pSourceCtx
);
SMinmaxResInfo
*
pSBuf
=
GET_ROWCELL_INTERBUF
(
pSResInfo
);
int16_t
type
=
pDBuf
->
type
==
TSDB_DATA_TYPE_NULL
?
pSBuf
->
type
:
pDBuf
->
type
;
if
(
IS_FLOAT_TYPE
(
type
))
{
if
(
pSBuf
->
assign
&&
((((
*
(
double
*
)
&
pDBuf
->
v
)
<
(
*
(
double
*
)
&
pSBuf
->
v
))
^
isMinFunc
)
||
!
pDBuf
->
assign
))
{
*
(
double
*
)
&
pDBuf
->
v
=
*
(
double
*
)
&
pSBuf
->
v
;
replaceTupleData
(
&
pDBuf
->
tuplePos
,
&
pSBuf
->
tuplePos
);
pDBuf
->
assign
=
true
;
}
}
else
{
if
(
pSBuf
->
assign
&&
(((
pDBuf
->
v
<
pSBuf
->
v
)
^
isMinFunc
)
||
!
pDBuf
->
assign
))
{
pDBuf
->
v
=
pSBuf
->
v
;
replaceTupleData
(
&
pDBuf
->
tuplePos
,
&
pSBuf
->
tuplePos
);
pDBuf
->
assign
=
true
;
switch
(
type
)
{
case
TSDB_DATA_TYPE_DOUBLE
:
case
TSDB_DATA_TYPE_UBIGINT
:
case
TSDB_DATA_TYPE_BIGINT
:
if
(
pSBuf
->
assign
&&
(
COMPARE_MINMAX_DATA
(
int64_t
)
||
!
pDBuf
->
assign
))
{
pDBuf
->
v
=
pSBuf
->
v
;
replaceTupleData
(
&
pDBuf
->
tuplePos
,
&
pSBuf
->
tuplePos
);
pDBuf
->
assign
=
true
;
}
break
;
case
TSDB_DATA_TYPE_UINT
:
case
TSDB_DATA_TYPE_INT
:
if
(
pSBuf
->
assign
&&
(
COMPARE_MINMAX_DATA
(
int32_t
)
||
!
pDBuf
->
assign
))
{
pDBuf
->
v
=
pSBuf
->
v
;
replaceTupleData
(
&
pDBuf
->
tuplePos
,
&
pSBuf
->
tuplePos
);
pDBuf
->
assign
=
true
;
}
break
;
case
TSDB_DATA_TYPE_USMALLINT
:
case
TSDB_DATA_TYPE_SMALLINT
:
if
(
pSBuf
->
assign
&&
(
COMPARE_MINMAX_DATA
(
int16_t
)
||
!
pDBuf
->
assign
))
{
pDBuf
->
v
=
pSBuf
->
v
;
replaceTupleData
(
&
pDBuf
->
tuplePos
,
&
pSBuf
->
tuplePos
);
pDBuf
->
assign
=
true
;
}
break
;
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_UTINYINT
:
case
TSDB_DATA_TYPE_TINYINT
:
if
(
pSBuf
->
assign
&&
(
COMPARE_MINMAX_DATA
(
int8_t
)
||
!
pDBuf
->
assign
))
{
pDBuf
->
v
=
pSBuf
->
v
;
replaceTupleData
(
&
pDBuf
->
tuplePos
,
&
pSBuf
->
tuplePos
);
pDBuf
->
assign
=
true
;
}
break
;
case
TSDB_DATA_TYPE_FLOAT
:
{
if
(
pSBuf
->
assign
&&
(
COMPARE_MINMAX_DATA
(
double
)
||
!
pDBuf
->
assign
))
{
pDBuf
->
v
=
pSBuf
->
v
;
replaceTupleData
(
&
pDBuf
->
tuplePos
,
&
pSBuf
->
tuplePos
);
pDBuf
->
assign
=
true
;
}
break
;
}
default:
if
(
pSBuf
->
assign
&&
(
strcmp
((
char
*
)
&
pDBuf
->
v
,
(
char
*
)
&
pSBuf
->
v
)
||
!
pDBuf
->
assign
))
{
pDBuf
->
v
=
pSBuf
->
v
;
replaceTupleData
(
&
pDBuf
->
tuplePos
,
&
pSBuf
->
tuplePos
);
pDBuf
->
assign
=
true
;
}
break
;
}
pDResInfo
->
numOfRes
=
TMAX
(
pDResInfo
->
numOfRes
,
pSResInfo
->
numOfRes
);
pDResInfo
->
isNullRes
&=
pSResInfo
->
isNullRes
;
...
...
source/libs/monitor/src/monMain.c
浏览文件 @
4e5fbb52
...
...
@@ -547,7 +547,7 @@ void monSendReport() {
monGenGrantJson
(
pMonitor
);
monGenDnodeJson
(
pMonitor
);
monGenDiskJson
(
pMonitor
);
monGenLogJson
(
pMonitor
);
//monGenLogJson(pMonitor); // TS-3691
char
*
pCont
=
tjsonToString
(
pMonitor
->
pJson
);
// uDebugL("report cont:%s\n", pCont);
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
4e5fbb52
...
...
@@ -2935,14 +2935,14 @@ static int32_t createMultiResFuncsFromStar(STranslateContext* pCxt, SFunctionNod
static
int32_t
createTags
(
STranslateContext
*
pCxt
,
SNodeList
**
pOutput
)
{
if
(
QUERY_NODE_REAL_TABLE
!=
nodeType
(((
SSelectStmt
*
)
pCxt
->
pCurrStmt
)
->
pFromTable
))
{
return
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_TAGS_PC
,
"The _TAGS pseudo column can only be used for
subtable and super
table queries"
);
"The _TAGS pseudo column can only be used for
child table and super
table queries"
);
}
SRealTableNode
*
pTable
=
(
SRealTableNode
*
)(((
SSelectStmt
*
)
pCxt
->
pCurrStmt
)
->
pFromTable
);
const
STableMeta
*
pMeta
=
pTable
->
pMeta
;
if
(
TSDB_SUPER_TABLE
!=
pMeta
->
tableType
&&
TSDB_CHILD_TABLE
!=
pMeta
->
tableType
)
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_TAGS_PC
,
"The _TAGS pseudo column can only be used for
subtable and super
table queries"
);
"The _TAGS pseudo column can only be used for
child table and super
table queries"
);
}
SSchema
*
pTagsSchema
=
getTableTagSchema
(
pMeta
);
...
...
source/libs/parser/src/parUtil.c
浏览文件 @
4e5fbb52
...
...
@@ -164,6 +164,8 @@ static char* getSyntaxErrFormat(int32_t errCode) {
return
"%s function is not supported in fill query"
;
case
TSDB_CODE_PAR_INVALID_WINDOW_PC
:
return
"_WSTART, _WEND and _WDURATION can only be used in window query"
;
case
TSDB_CODE_PAR_INVALID_TAGS_PC
:
return
"Tags can only applied to super table and child table"
;
case
TSDB_CODE_PAR_WINDOW_NOT_ALLOWED_FUNC
:
return
"%s function is not supported in time window query"
;
case
TSDB_CODE_PAR_STREAM_NOT_ALLOWED_FUNC
:
...
...
source/libs/stream/src/streamExec.c
浏览文件 @
4e5fbb52
...
...
@@ -594,6 +594,9 @@ int32_t streamTryExec(SStreamTask* pTask) {
(
!
streamTaskShouldPause
(
&
pTask
->
status
)))
{
streamSchedExec
(
pTask
);
}
}
else
{
qDebug
(
"s-task:%s already started to exec by other thread, status:%s, sched-status:%d"
,
pTask
->
id
.
idStr
,
streamGetTaskStatusStr
(
pTask
->
status
.
taskStatus
),
pTask
->
status
.
schedStatus
);
}
return
0
;
...
...
source/libs/stream/src/streamRecover.c
浏览文件 @
4e5fbb52
...
...
@@ -654,9 +654,8 @@ int32_t streamTaskRecoverSetAllStepFinished(SStreamTask* pTask) {
return
qStreamRecoverSetAllStepFinished
(
exec
);
}
void
streamHistoryTaskSetVerRangeStep2
(
SStreamTask
*
pTask
)
{
void
streamHistoryTaskSetVerRangeStep2
(
SStreamTask
*
pTask
,
int64_t
latestVer
)
{
SVersionRange
*
pRange
=
&
pTask
->
dataRange
.
range
;
int64_t
latestVer
=
walReaderGetCurrentVer
(
pTask
->
exec
.
pWalReader
);
ASSERT
(
latestVer
>=
pRange
->
maxVer
);
int64_t
nextStartVer
=
pRange
->
maxVer
+
1
;
...
...
source/os/src/osSysinfo.c
浏览文件 @
4e5fbb52
...
...
@@ -961,6 +961,18 @@ char *taosGetCmdlineByPID(int pid) {
#endif
}
int64_t
taosGetOsUptime
()
{
#ifdef WINDOWS
#elif defined(_TD_DARWIN_64)
#else
struct
sysinfo
info
;
if
(
0
==
sysinfo
(
&
info
))
{
return
(
int64_t
)
info
.
uptime
*
1000
;
}
#endif
return
0
;
}
void
taosSetCoreDump
(
bool
enable
)
{
if
(
!
enable
)
return
;
#ifdef WINDOWS
...
...
source/util/src/tutil.c
浏览文件 @
4e5fbb52
...
...
@@ -351,10 +351,10 @@ int32_t titoa(uint64_t val, size_t radix, char str[]) {
int32_t
i
=
0
;
uint64_t
v
=
val
;
while
(
v
>
0
)
{
do
{
buf
[
i
++
]
=
s
[
v
%
radix
];
v
/=
radix
;
}
}
while
(
v
>
0
);
// reverse order
for
(
int32_t
j
=
0
;
j
<
i
;
++
j
)
{
...
...
tests/script/tsim/parser/fill.sim
浏览文件 @
4e5fbb52
...
...
@@ -1224,4 +1224,104 @@ if $data42 != NULL then
return -1
endi
print ===================== TD-3625 test fill value NULL
sql use $db
sql select _wstart,_wend,count(*) from tm0 where ts >= '2020-01-01 01:03:06.000' and ts <= '2020-01-01 01:03:10.000' interval(1s) fill(value, NULL);
if $rows != 5 then
return -1
endi
if $data02 != NULL then
return -1
endi
if $data12 != 1 then
return -1
endi
if $data22 != 1 then
return -1
endi
if $data32 != 1 then
return -1
endi
if $data42 != NULL then
return -1
endi
sql select _wstart,_wend,count(*),sum(k),avg(k) from tm0 where ts >= '2020-01-01 01:03:06.000' and ts <= '2020-01-01 01:03:10.000' interval(1s) fill(value, 1, NULL, 1);
if $rows != 5 then
return -1
endi
if $data02 != 1 then
return -1
endi
if $data12 != 1 then
return -1
endi
if $data22 != 1 then
return -1
endi
if $data32 != 1 then
return -1
endi
if $data42 != 1 then
return -1
endi
if $data03 != NULL then
return -1
endi
if $data13 != 7 then
return -1
endi
if $data23 != 8 then
return -1
endi
if $data33 != 9 then
return -1
endi
if $data43 != NULL then
return -1
endi
if $data04 != 1.000000000 then
return -1
endi
if $data14 != 7.000000000 then
return -1
endi
if $data24 != 8.000000000 then
return -1
endi
if $data34 != 9.000000000 then
return -1
endi
if $data44 != 1.000000000 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
tests/system-test/0-others/taosdMonitor.py
浏览文件 @
4e5fbb52
...
...
@@ -186,33 +186,6 @@ class RequestHandlerImpl(http.server.BaseHTTPRequestHandler):
tdLog
.
exit
(
"total is null!"
)
# log_infos ====================================
if
"log_infos"
not
in
infoDict
or
infoDict
[
"log_infos"
]
==
None
:
tdLog
.
exit
(
"log_infos is null!"
)
if
"logs"
not
in
infoDict
[
"log_infos"
]
or
len
(
infoDict
[
"log_infos"
][
"logs"
])
<
8
:
#!= 10:
tdLog
.
exit
(
"logs is null!"
)
if
"ts"
not
in
infoDict
[
"log_infos"
][
"logs"
][
0
]
or
len
(
infoDict
[
"log_infos"
][
"logs"
][
0
][
"ts"
])
<=
10
:
tdLog
.
exit
(
"ts is null!"
)
if
"level"
not
in
infoDict
[
"log_infos"
][
"logs"
][
0
]
or
infoDict
[
"log_infos"
][
"logs"
][
0
][
"level"
]
not
in
[
"error"
,
"info"
,
"debug"
,
"trace"
]:
tdLog
.
exit
(
"level is null!"
)
if
"content"
not
in
infoDict
[
"log_infos"
][
"logs"
][
0
]
or
len
(
infoDict
[
"log_infos"
][
"logs"
][
0
][
"ts"
])
<=
1
:
tdLog
.
exit
(
"content is null!"
)
if
"summary"
not
in
infoDict
[
"log_infos"
]
or
len
(
infoDict
[
"log_infos"
][
"summary"
])
!=
4
:
tdLog
.
exit
(
"summary is null!"
)
if
"total"
not
in
infoDict
[
"log_infos"
][
"summary"
][
0
]
or
infoDict
[
"log_infos"
][
"summary"
][
0
][
"total"
]
<
0
:
tdLog
.
exit
(
"total is null!"
)
if
"level"
not
in
infoDict
[
"log_infos"
][
"summary"
][
0
]
or
infoDict
[
"log_infos"
][
"summary"
][
0
][
"level"
]
not
in
[
"error"
,
"info"
,
"debug"
,
"trace"
]:
tdLog
.
exit
(
"level is null!"
)
def
do_GET
(
self
):
"""
process GET request
...
...
@@ -315,4 +288,3 @@ class TDTestCase:
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tests/system-test/2-query/interp.py
浏览文件 @
4e5fbb52
...
...
@@ -147,6 +147,57 @@ class TDTestCase:
tdSql
.
checkData
(
11
,
0
,
15
)
tdSql
.
checkData
(
12
,
0
,
1
)
for
col
in
col_list
:
tdSql
.
query
(
f
"select interp(
{
col
}
) from
{
dbname
}
.
{
tbname
}
range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(value, 1.0)"
)
tdSql
.
checkRows
(
13
)
tdSql
.
checkData
(
0
,
0
,
1
)
tdSql
.
checkData
(
1
,
0
,
5
)
tdSql
.
checkData
(
2
,
0
,
1
)
tdSql
.
checkData
(
3
,
0
,
1
)
tdSql
.
checkData
(
4
,
0
,
1
)
tdSql
.
checkData
(
5
,
0
,
1
)
tdSql
.
checkData
(
6
,
0
,
10
)
tdSql
.
checkData
(
7
,
0
,
1
)
tdSql
.
checkData
(
8
,
0
,
1
)
tdSql
.
checkData
(
9
,
0
,
1
)
tdSql
.
checkData
(
10
,
0
,
1
)
tdSql
.
checkData
(
11
,
0
,
15
)
tdSql
.
checkData
(
12
,
0
,
1
)
for
col
in
col_list
:
tdSql
.
query
(
f
"select interp(
{
col
}
) from
{
dbname
}
.
{
tbname
}
range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(value, true)"
)
tdSql
.
checkRows
(
13
)
tdSql
.
checkData
(
0
,
0
,
1
)
tdSql
.
checkData
(
1
,
0
,
5
)
tdSql
.
checkData
(
2
,
0
,
1
)
tdSql
.
checkData
(
3
,
0
,
1
)
tdSql
.
checkData
(
4
,
0
,
1
)
tdSql
.
checkData
(
5
,
0
,
1
)
tdSql
.
checkData
(
6
,
0
,
10
)
tdSql
.
checkData
(
7
,
0
,
1
)
tdSql
.
checkData
(
8
,
0
,
1
)
tdSql
.
checkData
(
9
,
0
,
1
)
tdSql
.
checkData
(
10
,
0
,
1
)
tdSql
.
checkData
(
11
,
0
,
15
)
tdSql
.
checkData
(
12
,
0
,
1
)
for
col
in
col_list
:
tdSql
.
query
(
f
"select interp(
{
col
}
) from
{
dbname
}
.
{
tbname
}
range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(value, NULL)"
)
tdSql
.
checkRows
(
13
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
checkData
(
1
,
0
,
5
)
tdSql
.
checkData
(
2
,
0
,
None
)
tdSql
.
checkData
(
3
,
0
,
None
)
tdSql
.
checkData
(
4
,
0
,
None
)
tdSql
.
checkData
(
5
,
0
,
None
)
tdSql
.
checkData
(
6
,
0
,
10
)
tdSql
.
checkData
(
7
,
0
,
None
)
tdSql
.
checkData
(
8
,
0
,
None
)
tdSql
.
checkData
(
9
,
0
,
None
)
tdSql
.
checkData
(
10
,
0
,
None
)
tdSql
.
checkData
(
11
,
0
,
15
)
tdSql
.
checkData
(
12
,
0
,
None
)
tdSql
.
query
(
f
"select interp(c4) from
{
dbname
}
.
{
tbname
}
range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(value, 1)"
)
tdSql
.
checkRows
(
13
)
tdSql
.
checkData
(
0
,
0
,
1.0
)
...
...
@@ -163,6 +214,54 @@ class TDTestCase:
tdSql
.
checkData
(
11
,
0
,
15.0
)
tdSql
.
checkData
(
12
,
0
,
1.0
)
tdSql
.
query
(
f
"select interp(c4) from
{
dbname
}
.
{
tbname
}
range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(value, 1.0)"
)
tdSql
.
checkRows
(
13
)
tdSql
.
checkData
(
0
,
0
,
1.0
)
tdSql
.
checkData
(
1
,
0
,
5.0
)
tdSql
.
checkData
(
2
,
0
,
1.0
)
tdSql
.
checkData
(
3
,
0
,
1.0
)
tdSql
.
checkData
(
4
,
0
,
1.0
)
tdSql
.
checkData
(
5
,
0
,
1.0
)
tdSql
.
checkData
(
6
,
0
,
10.0
)
tdSql
.
checkData
(
7
,
0
,
1.0
)
tdSql
.
checkData
(
8
,
0
,
1.0
)
tdSql
.
checkData
(
9
,
0
,
1.0
)
tdSql
.
checkData
(
10
,
0
,
1.0
)
tdSql
.
checkData
(
11
,
0
,
15.0
)
tdSql
.
checkData
(
12
,
0
,
1.0
)
tdSql
.
query
(
f
"select interp(c4) from
{
dbname
}
.
{
tbname
}
range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(value, true)"
)
tdSql
.
checkRows
(
13
)
tdSql
.
checkData
(
0
,
0
,
1.0
)
tdSql
.
checkData
(
1
,
0
,
5.0
)
tdSql
.
checkData
(
2
,
0
,
1.0
)
tdSql
.
checkData
(
3
,
0
,
1.0
)
tdSql
.
checkData
(
4
,
0
,
1.0
)
tdSql
.
checkData
(
5
,
0
,
1.0
)
tdSql
.
checkData
(
6
,
0
,
10.0
)
tdSql
.
checkData
(
7
,
0
,
1.0
)
tdSql
.
checkData
(
8
,
0
,
1.0
)
tdSql
.
checkData
(
9
,
0
,
1.0
)
tdSql
.
checkData
(
10
,
0
,
1.0
)
tdSql
.
checkData
(
11
,
0
,
15.0
)
tdSql
.
checkData
(
12
,
0
,
1.0
)
tdSql
.
query
(
f
"select interp(c4) from
{
dbname
}
.
{
tbname
}
range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(value, NULL)"
)
tdSql
.
checkRows
(
13
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
checkData
(
1
,
0
,
5.0
)
tdSql
.
checkData
(
2
,
0
,
None
)
tdSql
.
checkData
(
3
,
0
,
None
)
tdSql
.
checkData
(
4
,
0
,
None
)
tdSql
.
checkData
(
5
,
0
,
None
)
tdSql
.
checkData
(
6
,
0
,
10.0
)
tdSql
.
checkData
(
7
,
0
,
None
)
tdSql
.
checkData
(
8
,
0
,
None
)
tdSql
.
checkData
(
9
,
0
,
None
)
tdSql
.
checkData
(
10
,
0
,
None
)
tdSql
.
checkData
(
11
,
0
,
15.0
)
tdSql
.
checkData
(
12
,
0
,
None
)
tdSql
.
query
(
f
"select interp(c5) from
{
dbname
}
.
{
tbname
}
range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(value, 1)"
)
tdSql
.
checkRows
(
13
)
tdSql
.
checkData
(
0
,
0
,
1.0
)
...
...
@@ -179,6 +278,54 @@ class TDTestCase:
tdSql
.
checkData
(
11
,
0
,
15.0
)
tdSql
.
checkData
(
12
,
0
,
1.0
)
tdSql
.
query
(
f
"select interp(c5) from
{
dbname
}
.
{
tbname
}
range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(value, 1.0)"
)
tdSql
.
checkRows
(
13
)
tdSql
.
checkData
(
0
,
0
,
1.0
)
tdSql
.
checkData
(
1
,
0
,
5.0
)
tdSql
.
checkData
(
2
,
0
,
1.0
)
tdSql
.
checkData
(
3
,
0
,
1.0
)
tdSql
.
checkData
(
4
,
0
,
1.0
)
tdSql
.
checkData
(
5
,
0
,
1.0
)
tdSql
.
checkData
(
6
,
0
,
10.0
)
tdSql
.
checkData
(
7
,
0
,
1.0
)
tdSql
.
checkData
(
8
,
0
,
1.0
)
tdSql
.
checkData
(
9
,
0
,
1.0
)
tdSql
.
checkData
(
10
,
0
,
1.0
)
tdSql
.
checkData
(
11
,
0
,
15.0
)
tdSql
.
checkData
(
12
,
0
,
1.0
)
tdSql
.
query
(
f
"select interp(c5) from
{
dbname
}
.
{
tbname
}
range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(value, true)"
)
tdSql
.
checkRows
(
13
)
tdSql
.
checkData
(
0
,
0
,
1.0
)
tdSql
.
checkData
(
1
,
0
,
5.0
)
tdSql
.
checkData
(
2
,
0
,
1.0
)
tdSql
.
checkData
(
3
,
0
,
1.0
)
tdSql
.
checkData
(
4
,
0
,
1.0
)
tdSql
.
checkData
(
5
,
0
,
1.0
)
tdSql
.
checkData
(
6
,
0
,
10.0
)
tdSql
.
checkData
(
7
,
0
,
1.0
)
tdSql
.
checkData
(
8
,
0
,
1.0
)
tdSql
.
checkData
(
9
,
0
,
1.0
)
tdSql
.
checkData
(
10
,
0
,
1.0
)
tdSql
.
checkData
(
11
,
0
,
15.0
)
tdSql
.
checkData
(
12
,
0
,
1.0
)
tdSql
.
query
(
f
"select interp(c5) from
{
dbname
}
.
{
tbname
}
range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(value, NULL)"
)
tdSql
.
checkRows
(
13
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
checkData
(
1
,
0
,
5.0
)
tdSql
.
checkData
(
2
,
0
,
None
)
tdSql
.
checkData
(
3
,
0
,
None
)
tdSql
.
checkData
(
4
,
0
,
None
)
tdSql
.
checkData
(
5
,
0
,
None
)
tdSql
.
checkData
(
6
,
0
,
10.0
)
tdSql
.
checkData
(
7
,
0
,
None
)
tdSql
.
checkData
(
8
,
0
,
None
)
tdSql
.
checkData
(
9
,
0
,
None
)
tdSql
.
checkData
(
10
,
0
,
None
)
tdSql
.
checkData
(
11
,
0
,
15.0
)
tdSql
.
checkData
(
12
,
0
,
None
)
tdSql
.
query
(
f
"select interp(c6) from
{
dbname
}
.
{
tbname
}
range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(value, 1)"
)
tdSql
.
checkRows
(
13
)
tdSql
.
checkData
(
0
,
0
,
True
)
...
...
@@ -195,6 +342,54 @@ class TDTestCase:
tdSql
.
checkData
(
11
,
0
,
True
)
tdSql
.
checkData
(
12
,
0
,
True
)
tdSql
.
query
(
f
"select interp(c6) from
{
dbname
}
.
{
tbname
}
range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(value, 1.0)"
)
tdSql
.
checkRows
(
13
)
tdSql
.
checkData
(
0
,
0
,
True
)
tdSql
.
checkData
(
1
,
0
,
True
)
tdSql
.
checkData
(
2
,
0
,
True
)
tdSql
.
checkData
(
3
,
0
,
True
)
tdSql
.
checkData
(
4
,
0
,
True
)
tdSql
.
checkData
(
5
,
0
,
True
)
tdSql
.
checkData
(
6
,
0
,
True
)
tdSql
.
checkData
(
7
,
0
,
True
)
tdSql
.
checkData
(
8
,
0
,
True
)
tdSql
.
checkData
(
9
,
0
,
True
)
tdSql
.
checkData
(
10
,
0
,
True
)
tdSql
.
checkData
(
11
,
0
,
True
)
tdSql
.
checkData
(
12
,
0
,
True
)
tdSql
.
query
(
f
"select interp(c6) from
{
dbname
}
.
{
tbname
}
range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(value, true)"
)
tdSql
.
checkRows
(
13
)
tdSql
.
checkData
(
0
,
0
,
True
)
tdSql
.
checkData
(
1
,
0
,
True
)
tdSql
.
checkData
(
2
,
0
,
True
)
tdSql
.
checkData
(
3
,
0
,
True
)
tdSql
.
checkData
(
4
,
0
,
True
)
tdSql
.
checkData
(
5
,
0
,
True
)
tdSql
.
checkData
(
6
,
0
,
True
)
tdSql
.
checkData
(
7
,
0
,
True
)
tdSql
.
checkData
(
8
,
0
,
True
)
tdSql
.
checkData
(
9
,
0
,
True
)
tdSql
.
checkData
(
10
,
0
,
True
)
tdSql
.
checkData
(
11
,
0
,
True
)
tdSql
.
checkData
(
12
,
0
,
True
)
tdSql
.
query
(
f
"select interp(c6) from
{
dbname
}
.
{
tbname
}
range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(value, NULL)"
)
tdSql
.
checkRows
(
13
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
checkData
(
1
,
0
,
True
)
tdSql
.
checkData
(
2
,
0
,
None
)
tdSql
.
checkData
(
3
,
0
,
None
)
tdSql
.
checkData
(
4
,
0
,
None
)
tdSql
.
checkData
(
5
,
0
,
None
)
tdSql
.
checkData
(
6
,
0
,
True
)
tdSql
.
checkData
(
7
,
0
,
None
)
tdSql
.
checkData
(
8
,
0
,
None
)
tdSql
.
checkData
(
9
,
0
,
None
)
tdSql
.
checkData
(
10
,
0
,
None
)
tdSql
.
checkData
(
11
,
0
,
True
)
tdSql
.
checkData
(
12
,
0
,
None
)
## {} ...
tdSql
.
query
(
f
"select interp(c0) from
{
dbname
}
.
{
tbname
}
range('2020-02-01 00:00:01', '2020-02-01 00:00:04') every(1s) fill(value, 1)"
)
tdSql
.
checkRows
(
4
)
...
...
@@ -2587,25 +2782,25 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
'2020-02-02 00:00:00.000'
)
tdSql
.
checkData
(
0
,
2
,
Fals
e
)
tdSql
.
checkData
(
0
,
2
,
Non
e
)
tdSql
.
checkData
(
1
,
2
,
False
)
tdSql
.
checkData
(
2
,
2
,
Fals
e
)
tdSql
.
checkData
(
2
,
2
,
Non
e
)
tdSql
.
checkData
(
3
,
2
,
True
)
tdSql
.
checkData
(
4
,
2
,
Fals
e
)
tdSql
.
checkData
(
4
,
2
,
Non
e
)
tdSql
.
checkData
(
5
,
2
,
False
)
tdSql
.
checkData
(
6
,
2
,
Fals
e
)
tdSql
.
checkData
(
6
,
2
,
Non
e
)
tdSql
.
checkData
(
7
,
2
,
True
)
tdSql
.
checkData
(
8
,
2
,
Fals
e
)
tdSql
.
checkData
(
8
,
2
,
Non
e
)
tdSql
.
checkData
(
9
,
2
,
True
)
tdSql
.
checkData
(
10
,
2
,
Fals
e
)
tdSql
.
checkData
(
10
,
2
,
Non
e
)
tdSql
.
checkData
(
11
,
2
,
False
)
tdSql
.
checkData
(
12
,
2
,
Fals
e
)
tdSql
.
checkData
(
12
,
2
,
Non
e
)
tdSql
.
checkData
(
13
,
2
,
False
)
tdSql
.
checkData
(
14
,
2
,
Fals
e
)
tdSql
.
checkData
(
14
,
2
,
Non
e
)
tdSql
.
checkData
(
15
,
2
,
None
)
tdSql
.
checkData
(
16
,
2
,
Fals
e
)
tdSql
.
checkData
(
16
,
2
,
Non
e
)
tdSql
.
checkData
(
17
,
2
,
None
)
tdSql
.
checkData
(
18
,
2
,
Fals
e
)
tdSql
.
checkData
(
18
,
2
,
Non
e
)
tdSql
.
checkData
(
18
,
0
,
'2020-02-02 00:00:18.000'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录