Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6b17c1ca
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看板
提交
6b17c1ca
编写于
6月 02, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' of
https://github.com/taosdata/TDengine
into feat/row_refact
上级
39f6e308
6c5ec227
变更
124
展开全部
显示空白变更内容
内联
并排
Showing
124 changed file
with
3180 addition
and
1495 deletion
+3180
-1495
docs-cn/14-reference/02-rest-api/02-rest-api.mdx
docs-cn/14-reference/02-rest-api/02-rest-api.mdx
+1
-1
include/common/tdatablock.h
include/common/tdatablock.h
+3
-48
include/common/tglobal.h
include/common/tglobal.h
+2
-1
include/common/tmsg.h
include/common/tmsg.h
+17
-12
include/common/tmsgdef.h
include/common/tmsgdef.h
+1
-0
include/libs/executor/executor.h
include/libs/executor/executor.h
+0
-12
include/libs/function/function.h
include/libs/function/function.h
+1
-76
include/libs/nodes/nodes.h
include/libs/nodes/nodes.h
+1
-0
include/libs/nodes/plannodes.h
include/libs/nodes/plannodes.h
+23
-14
include/libs/parser/parser.h
include/libs/parser/parser.h
+1
-0
include/libs/planner/planner.h
include/libs/planner/planner.h
+1
-1
include/util/taoserror.h
include/util/taoserror.h
+1
-0
include/util/tlist.h
include/util/tlist.h
+1
-1
source/client/inc/clientInt.h
source/client/inc/clientInt.h
+1
-0
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+1
-0
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+1
-0
source/client/src/clientSml.c
source/client/src/clientSml.c
+41
-5
source/client/test/clientTests.cpp
source/client/test/clientTests.cpp
+20
-20
source/client/test/smlTest.cpp
source/client/test/smlTest.cpp
+23
-1
source/common/src/systable.c
source/common/src/systable.c
+2
-0
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+128
-13
source/common/src/tglobal.c
source/common/src/tglobal.c
+6
-2
source/common/src/tmsg.c
source/common/src/tmsg.c
+2
-0
source/dnode/mgmt/exe/dmMain.c
source/dnode/mgmt/exe/dmMain.c
+1
-1
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
+36
-10
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
+28
-27
source/dnode/mgmt/node_mgmt/src/dmEnv.c
source/dnode/mgmt/node_mgmt/src/dmEnv.c
+5
-5
source/dnode/mgmt/node_util/src/dmEps.c
source/dnode/mgmt/node_util/src/dmEps.c
+4
-2
source/dnode/mgmt/node_util/src/dmFile.c
source/dnode/mgmt/node_util/src/dmFile.c
+1
-1
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+1
-0
source/dnode/mnode/impl/inc/mndTopic.h
source/dnode/mnode/impl/inc/mndTopic.h
+2
-0
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+11
-1
source/dnode/mnode/impl/src/mndMnode.c
source/dnode/mnode/impl/src/mndMnode.c
+4
-4
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+1
-1
source/dnode/mnode/impl/src/mndTopic.c
source/dnode/mnode/impl/src/mndTopic.c
+50
-0
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+1
-1
source/dnode/vnode/CMakeLists.txt
source/dnode/vnode/CMakeLists.txt
+1
-1
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+3
-0
source/dnode/vnode/src/inc/meta.h
source/dnode/vnode/src/inc/meta.h
+6
-6
source/dnode/vnode/src/inc/sma.h
source/dnode/vnode/src/inc/sma.h
+2
-0
source/dnode/vnode/src/inc/vnd.h
source/dnode/vnode/src/inc/vnd.h
+1
-1
source/dnode/vnode/src/meta/metaOpen.c
source/dnode/vnode/src/meta/metaOpen.c
+12
-12
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+3
-3
source/dnode/vnode/src/meta/metaSma.c
source/dnode/vnode/src/meta/metaSma.c
+2
-2
source/dnode/vnode/src/meta/metaTable.c
source/dnode/vnode/src/meta/metaTable.c
+6
-6
source/dnode/vnode/src/sma/sma.c
source/dnode/vnode/src/sma/sma.c
+12
-4
source/dnode/vnode/src/sma/smaEnv.c
source/dnode/vnode/src/sma/smaEnv.c
+6
-6
source/dnode/vnode/src/sma/smaRollup.c
source/dnode/vnode/src/sma/smaRollup.c
+15
-15
source/dnode/vnode/src/sma/smaTimeRange.c
source/dnode/vnode/src/sma/smaTimeRange.c
+43
-43
source/dnode/vnode/src/sma/smaTimeRange2.c
source/dnode/vnode/src/sma/smaTimeRange2.c
+1084
-0
source/dnode/vnode/src/tq/tqPush.c
source/dnode/vnode/src/tq/tqPush.c
+26
-28
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+25
-25
source/dnode/vnode/src/tsdb/tsdbFS.c
source/dnode/vnode/src/tsdb/tsdbFS.c
+36
-36
source/dnode/vnode/src/tsdb/tsdbFile.c
source/dnode/vnode/src/tsdb/tsdbFile.c
+4
-4
source/dnode/vnode/src/tsdb/tsdbMemTable2.c
source/dnode/vnode/src/tsdb/tsdbMemTable2.c
+3
-3
source/dnode/vnode/src/tsdb/tsdbOpen.c
source/dnode/vnode/src/tsdb/tsdbOpen.c
+3
-3
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+4
-4
source/dnode/vnode/src/tsdb/tsdbReadImpl.c
source/dnode/vnode/src/tsdb/tsdbReadImpl.c
+27
-27
source/dnode/vnode/src/tsdb/tsdbWrite.c
source/dnode/vnode/src/tsdb/tsdbWrite.c
+6
-6
source/dnode/vnode/src/vnd/vnodeBufPool.c
source/dnode/vnode/src/vnd/vnodeBufPool.c
+3
-3
source/dnode/vnode/src/vnd/vnodeCommit.c
source/dnode/vnode/src/vnd/vnodeCommit.c
+9
-9
source/dnode/vnode/src/vnd/vnodeOpen.c
source/dnode/vnode/src/vnd/vnodeOpen.c
+14
-14
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+10
-9
source/dnode/vnode/src/vnd/vnodeSync.c
source/dnode/vnode/src/vnd/vnodeSync.c
+8
-6
source/dnode/vnode/test/tsdbSmaTest.cpp
source/dnode/vnode/test/tsdbSmaTest.cpp
+7
-7
source/libs/executor/inc/executil.h
source/libs/executor/inc/executil.h
+2
-11
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+3
-2
source/libs/executor/src/executil.c
source/libs/executor/src/executil.c
+2
-40
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+45
-156
source/libs/executor/src/groupoperator.c
source/libs/executor/src/groupoperator.c
+7
-5
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+1
-1
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+324
-222
source/libs/function/inc/builtinsimpl.h
source/libs/function/inc/builtinsimpl.h
+4
-0
source/libs/function/inc/taggfunction.h
source/libs/function/inc/taggfunction.h
+0
-7
source/libs/function/src/builtins.c
source/libs/function/src/builtins.c
+27
-23
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+290
-44
source/libs/function/src/taggfunction.c
source/libs/function/src/taggfunction.c
+2
-1
source/libs/function/src/texpr.c
source/libs/function/src/texpr.c
+0
-14
source/libs/function/src/tudf.c
source/libs/function/src/tudf.c
+3
-1
source/libs/nodes/src/nodesCloneFuncs.c
source/libs/nodes/src/nodesCloneFuncs.c
+2
-1
source/libs/nodes/src/nodesCodeFuncs.c
source/libs/nodes/src/nodesCodeFuncs.c
+8
-0
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+4
-0
source/libs/parser/inc/parInt.h
source/libs/parser/inc/parInt.h
+1
-0
source/libs/parser/src/parInsert.c
source/libs/parser/src/parInsert.c
+19
-0
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+16
-1
source/libs/planner/src/planLogicCreater.c
source/libs/planner/src/planLogicCreater.c
+1
-0
source/libs/planner/src/planPhysiCreater.c
source/libs/planner/src/planPhysiCreater.c
+14
-3
source/libs/planner/src/planSpliter.c
source/libs/planner/src/planSpliter.c
+87
-32
source/libs/planner/test/planOtherTest.cpp
source/libs/planner/test/planOtherTest.cpp
+6
-0
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+4
-4
source/libs/wal/src/walWrite.c
source/libs/wal/src/walWrite.c
+1
-1
source/util/src/terror.c
source/util/src/terror.c
+2
-1
source/util/src/tlist.c
source/util/src/tlist.c
+1
-1
source/util/src/tworker.c
source/util/src/tworker.c
+2
-2
tests/script/tsim/bnode/basic1.sim
tests/script/tsim/bnode/basic1.sim
+2
-2
tests/script/tsim/db/alter_option.sim
tests/script/tsim/db/alter_option.sim
+15
-15
tests/script/tsim/db/alter_replica_13.sim
tests/script/tsim/db/alter_replica_13.sim
+29
-12
tests/script/tsim/dnode/basic1.sim
tests/script/tsim/dnode/basic1.sim
+2
-2
tests/script/tsim/mnode/basic1.sim
tests/script/tsim/mnode/basic1.sim
+6
-6
tests/script/tsim/mnode/basic2.sim
tests/script/tsim/mnode/basic2.sim
+3
-3
tests/script/tsim/mnode/basic3.sim
tests/script/tsim/mnode/basic3.sim
+4
-4
tests/script/tsim/mnode/basic4.sim
tests/script/tsim/mnode/basic4.sim
+22
-22
tests/script/tsim/qnode/basic1.sim
tests/script/tsim/qnode/basic1.sim
+2
-2
tests/script/tsim/query/explain.sim
tests/script/tsim/query/explain.sim
+1
-1
tests/script/tsim/query/scalarNull.sim
tests/script/tsim/query/scalarNull.sim
+1
-1
tests/script/tsim/query/udf.sim
tests/script/tsim/query/udf.sim
+1
-1
tests/script/tsim/snode/basic1.sim
tests/script/tsim/snode/basic1.sim
+2
-2
tests/script/tsim/stream/basic0.sim
tests/script/tsim/stream/basic0.sim
+2
-1
tests/script/tsim/sync/3Replica1VgElect.sim
tests/script/tsim/sync/3Replica1VgElect.sim
+27
-27
tests/script/tsim/sync/3Replica5VgElect.sim
tests/script/tsim/sync/3Replica5VgElect.sim
+135
-135
tests/script/tsim/sync/oneReplica1VgElect.sim
tests/script/tsim/sync/oneReplica1VgElect.sim
+12
-12
tests/script/tsim/sync/oneReplica1VgElectWithInsert.sim
tests/script/tsim/sync/oneReplica1VgElectWithInsert.sim
+12
-12
tests/script/tsim/sync/oneReplica5VgElect.sim
tests/script/tsim/sync/oneReplica5VgElect.sim
+30
-30
tests/script/tsim/sync/threeReplica1VgElect.sim
tests/script/tsim/sync/threeReplica1VgElect.sim
+21
-21
tests/script/tsim/sync/threeReplica1VgElectWihtInsert.sim
tests/script/tsim/sync/threeReplica1VgElectWihtInsert.sim
+39
-39
tests/script/tsim/trans/create_db.sim
tests/script/tsim/trans/create_db.sim
+1
-1
tests/system-test/0-others/taosdMonitor.py
tests/system-test/0-others/taosdMonitor.py
+1
-1
tests/system-test/1-insert/influxdb_line_taosc_insert.py
tests/system-test/1-insert/influxdb_line_taosc_insert.py
+2
-2
tests/system-test/1-insert/opentsdb_json_taosc_insert.py
tests/system-test/1-insert/opentsdb_json_taosc_insert.py
+5
-5
tests/system-test/1-insert/opentsdb_telnet_line_taosc_insert.py
...system-test/1-insert/opentsdb_telnet_line_taosc_insert.py
+3
-3
tests/system-test/2-query/mavg.py
tests/system-test/2-query/mavg.py
+12
-9
tests/system-test/fulltest.sh
tests/system-test/fulltest.sh
+1
-0
tests/test/c/sdbDump.c
tests/test/c/sdbDump.c
+1
-0
tests/test/c/tmqSim.c
tests/test/c/tmqSim.c
+104
-8
未找到文件。
docs-cn/14-reference/02-rest-api/02-rest-api.mdx
浏览文件 @
6b17c1ca
...
@@ -16,7 +16,7 @@ RESTful 接口不依赖于任何 TDengine 的库,因此客户端不需要安
...
@@ -16,7 +16,7 @@ RESTful 接口不依赖于任何 TDengine 的库,因此客户端不需要安
在已经安装 TDengine 服务器端的情况下,可以按照如下方式进行验证。
在已经安装 TDengine 服务器端的情况下,可以按照如下方式进行验证。
下面以 Ubuntu 环境中使用 curl 工具(确认已经安装)来验证 RESTful 接口的正常。
下面以 Ubuntu 环境中使用 curl 工具(确认已经安装)来验证 RESTful 接口的正常
,验证前请确认 taosAdapter 服务已开启,在 Linux 系统上此服务默认由 systemd 管理,使用命令 `systemctl start taosadapter` 启动
。
下面示例是列出所有的数据库,请把 h1.taosdata.com 和 6041(缺省值)替换为实际运行的 TDengine 服务 FQDN 和端口号:
下面示例是列出所有的数据库,请把 h1.taosdata.com 和 6041(缺省值)替换为实际运行的 TDengine 服务 FQDN 和端口号:
...
...
include/common/tdatablock.h
浏览文件 @
6b17c1ca
...
@@ -227,6 +227,9 @@ int32_t blockDataTrimFirstNRows(SSDataBlock* pBlock, size_t n);
...
@@ -227,6 +227,9 @@ int32_t blockDataTrimFirstNRows(SSDataBlock* pBlock, size_t n);
SSDataBlock
*
createOneDataBlock
(
const
SSDataBlock
*
pDataBlock
,
bool
copyData
);
SSDataBlock
*
createOneDataBlock
(
const
SSDataBlock
*
pDataBlock
,
bool
copyData
);
void
blockCompressEncode
(
const
SSDataBlock
*
pBlock
,
char
*
data
,
int32_t
*
dataLen
,
int32_t
numOfCols
,
int8_t
needCompress
);
const
char
*
blockCompressDecode
(
SSDataBlock
*
pBlock
,
int32_t
numOfCols
,
int32_t
numOfRows
,
const
char
*
pData
);
void
blockDebugShowData
(
const
SArray
*
dataBlocks
);
void
blockDebugShowData
(
const
SArray
*
dataBlocks
);
int32_t
buildSubmitReqFromDataBlock
(
SSubmitReq
**
pReq
,
const
SArray
*
pDataBlocks
,
STSchema
*
pTSchema
,
int32_t
vgId
,
int32_t
buildSubmitReqFromDataBlock
(
SSubmitReq
**
pReq
,
const
SArray
*
pDataBlocks
,
STSchema
*
pTSchema
,
int32_t
vgId
,
...
@@ -246,54 +249,6 @@ static FORCE_INLINE int32_t blockCompressColData(SColumnInfoData* pColRes, int32
...
@@ -246,54 +249,6 @@ static FORCE_INLINE int32_t blockCompressColData(SColumnInfoData* pColRes, int32
colSize
+
COMP_OVERFLOW_BYTES
,
compressed
,
NULL
,
0
);
colSize
+
COMP_OVERFLOW_BYTES
,
compressed
,
NULL
,
0
);
}
}
static
FORCE_INLINE
void
blockCompressEncode
(
const
SSDataBlock
*
pBlock
,
char
*
data
,
int32_t
*
dataLen
,
int32_t
numOfCols
,
int8_t
needCompress
)
{
int32_t
*
actualLen
=
(
int32_t
*
)
data
;
data
+=
sizeof
(
int32_t
);
uint64_t
*
groupId
=
(
uint64_t
*
)
data
;
data
+=
sizeof
(
uint64_t
);
int32_t
*
colSizes
=
(
int32_t
*
)
data
;
data
+=
numOfCols
*
sizeof
(
int32_t
);
*
dataLen
=
(
numOfCols
*
sizeof
(
int32_t
)
+
sizeof
(
uint64_t
)
+
sizeof
(
int32_t
));
int32_t
numOfRows
=
pBlock
->
info
.
rows
;
for
(
int32_t
col
=
0
;
col
<
numOfCols
;
++
col
)
{
SColumnInfoData
*
pColRes
=
(
SColumnInfoData
*
)
taosArrayGet
(
pBlock
->
pDataBlock
,
col
);
// copy the null bitmap
if
(
IS_VAR_DATA_TYPE
(
pColRes
->
info
.
type
))
{
size_t
metaSize
=
numOfRows
*
sizeof
(
int32_t
);
memcpy
(
data
,
pColRes
->
varmeta
.
offset
,
metaSize
);
data
+=
metaSize
;
(
*
dataLen
)
+=
metaSize
;
}
else
{
int32_t
len
=
BitmapLen
(
numOfRows
);
memcpy
(
data
,
pColRes
->
nullbitmap
,
len
);
data
+=
len
;
(
*
dataLen
)
+=
len
;
}
if
(
needCompress
)
{
colSizes
[
col
]
=
blockCompressColData
(
pColRes
,
numOfRows
,
data
,
needCompress
);
data
+=
colSizes
[
col
];
(
*
dataLen
)
+=
colSizes
[
col
];
}
else
{
colSizes
[
col
]
=
colDataGetLength
(
pColRes
,
numOfRows
);
(
*
dataLen
)
+=
colSizes
[
col
];
memmove
(
data
,
pColRes
->
pData
,
colSizes
[
col
]);
data
+=
colSizes
[
col
];
}
colSizes
[
col
]
=
htonl
(
colSizes
[
col
]);
}
*
actualLen
=
*
dataLen
;
*
groupId
=
pBlock
->
info
.
groupId
;
}
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
include/common/tglobal.h
浏览文件 @
6b17c1ca
...
@@ -45,6 +45,8 @@ extern bool tsEnableSlaveQuery;
...
@@ -45,6 +45,8 @@ extern bool tsEnableSlaveQuery;
extern
bool
tsPrintAuth
;
extern
bool
tsPrintAuth
;
extern
int64_t
tsTickPerMin
[
3
];
extern
int64_t
tsTickPerMin
[
3
];
extern
int32_t
tsCountAlwaysReturnValue
;
// multi-process
// multi-process
extern
int32_t
tsMultiProcess
;
extern
int32_t
tsMultiProcess
;
extern
int32_t
tsMnodeShmSize
;
extern
int32_t
tsMnodeShmSize
;
...
@@ -102,7 +104,6 @@ extern int32_t tsMaxStreamComputDelay;
...
@@ -102,7 +104,6 @@ extern int32_t tsMaxStreamComputDelay;
extern
int32_t
tsStreamCompStartDelay
;
extern
int32_t
tsStreamCompStartDelay
;
extern
int32_t
tsRetryStreamCompDelay
;
extern
int32_t
tsRetryStreamCompDelay
;
extern
float
tsStreamComputDelayRatio
;
// the delayed computing ration of the whole time window
extern
float
tsStreamComputDelayRatio
;
// the delayed computing ration of the whole time window
extern
int32_t
tsProjectExecInterval
;
extern
int64_t
tsMaxRetentWindow
;
extern
int64_t
tsMaxRetentWindow
;
// build info
// build info
...
...
include/common/tmsg.h
浏览文件 @
6b17c1ca
...
@@ -571,13 +571,6 @@ int32_t tSerializeSGetUserAuthRsp(void* buf, int32_t bufLen, SGetUserAuthRsp* pR
...
@@ -571,13 +571,6 @@ int32_t tSerializeSGetUserAuthRsp(void* buf, int32_t bufLen, SGetUserAuthRsp* pR
int32_t
tDeserializeSGetUserAuthRsp
(
void
*
buf
,
int32_t
bufLen
,
SGetUserAuthRsp
*
pRsp
);
int32_t
tDeserializeSGetUserAuthRsp
(
void
*
buf
,
int32_t
bufLen
,
SGetUserAuthRsp
*
pRsp
);
void
tFreeSGetUserAuthRsp
(
SGetUserAuthRsp
*
pRsp
);
void
tFreeSGetUserAuthRsp
(
SGetUserAuthRsp
*
pRsp
);
typedef
struct
{
int16_t
colId
;
// column id
int16_t
colIndex
;
// column index in colList if it is a normal column or index in tagColList if a tag
int16_t
flag
;
// denote if it is a tag or a normal column
char
name
[
TSDB_DB_FNAME_LEN
];
}
SColIndex
;
typedef
struct
{
typedef
struct
{
int16_t
lowerRelOptr
;
int16_t
lowerRelOptr
;
int16_t
upperRelOptr
;
int16_t
upperRelOptr
;
...
@@ -779,6 +772,7 @@ typedef struct {
...
@@ -779,6 +772,7 @@ typedef struct {
int8_t
cacheLastRow
;
int8_t
cacheLastRow
;
int32_t
numOfRetensions
;
int32_t
numOfRetensions
;
SArray
*
pRetensions
;
SArray
*
pRetensions
;
int8_t
schemaless
;
}
SDbCfgRsp
;
}
SDbCfgRsp
;
int32_t
tSerializeSDbCfgRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SDbCfgRsp
*
pRsp
);
int32_t
tSerializeSDbCfgRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SDbCfgRsp
*
pRsp
);
...
@@ -2353,19 +2347,19 @@ typedef struct {
...
@@ -2353,19 +2347,19 @@ typedef struct {
STSma
*
tSma
;
STSma
*
tSma
;
}
STSmaWrapper
;
}
STSmaWrapper
;
static
FORCE_INLINE
void
t
d
DestroyTSma
(
STSma
*
pSma
)
{
static
FORCE_INLINE
void
tDestroyTSma
(
STSma
*
pSma
)
{
if
(
pSma
)
{
if
(
pSma
)
{
taosMemoryFreeClear
(
pSma
->
expr
);
taosMemoryFreeClear
(
pSma
->
expr
);
taosMemoryFreeClear
(
pSma
->
tagsFilter
);
taosMemoryFreeClear
(
pSma
->
tagsFilter
);
}
}
}
}
static
FORCE_INLINE
void
t
d
DestroyTSmaWrapper
(
STSmaWrapper
*
pSW
,
bool
deepCopy
)
{
static
FORCE_INLINE
void
tDestroyTSmaWrapper
(
STSmaWrapper
*
pSW
,
bool
deepCopy
)
{
if
(
pSW
)
{
if
(
pSW
)
{
if
(
pSW
->
tSma
)
{
if
(
pSW
->
tSma
)
{
if
(
deepCopy
)
{
if
(
deepCopy
)
{
for
(
uint32_t
i
=
0
;
i
<
pSW
->
number
;
++
i
)
{
for
(
uint32_t
i
=
0
;
i
<
pSW
->
number
;
++
i
)
{
t
d
DestroyTSma
(
pSW
->
tSma
+
i
);
tDestroyTSma
(
pSW
->
tSma
+
i
);
}
}
}
}
taosMemoryFreeClear
(
pSW
->
tSma
);
taosMemoryFreeClear
(
pSW
->
tSma
);
...
@@ -2373,8 +2367,8 @@ static FORCE_INLINE void tdDestroyTSmaWrapper(STSmaWrapper* pSW, bool deepCopy)
...
@@ -2373,8 +2367,8 @@ static FORCE_INLINE void tdDestroyTSmaWrapper(STSmaWrapper* pSW, bool deepCopy)
}
}
}
}
static
FORCE_INLINE
void
*
t
d
FreeTSmaWrapper
(
STSmaWrapper
*
pSW
,
bool
deepCopy
)
{
static
FORCE_INLINE
void
*
tFreeTSmaWrapper
(
STSmaWrapper
*
pSW
,
bool
deepCopy
)
{
t
d
DestroyTSmaWrapper
(
pSW
,
deepCopy
);
tDestroyTSmaWrapper
(
pSW
,
deepCopy
);
taosMemoryFreeClear
(
pSW
);
taosMemoryFreeClear
(
pSW
);
return
NULL
;
return
NULL
;
}
}
...
@@ -2401,6 +2395,17 @@ static int32_t tDecodeTSmaWrapper(SDecoder* pDecoder, STSmaWrapper* pReq) {
...
@@ -2401,6 +2395,17 @@ static int32_t tDecodeTSmaWrapper(SDecoder* pDecoder, STSmaWrapper* pReq) {
return
0
;
return
0
;
}
}
typedef
struct
{
int64_t
tsmaIndexUid
;
STimeWindow
queryWindow
;
}
SVGetTsmaExpWndsReq
;
typedef
struct
{
int64_t
tsmaIndexUid
;
int32_t
numExpWnds
;
TSKEY
*
expWndsStartTs
;
}
SVGetTsmaExpWndsRsp
;
typedef
struct
{
typedef
struct
{
int
idx
;
int
idx
;
}
SMCreateFullTextReq
;
}
SMCreateFullTextReq
;
...
...
include/common/tmsgdef.h
浏览文件 @
6b17c1ca
...
@@ -205,6 +205,7 @@ enum {
...
@@ -205,6 +205,7 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_VND_CANCEL_SMA
,
"vnode-cancel-sma"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_CANCEL_SMA
,
"vnode-cancel-sma"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_DROP_SMA
,
"vnode-drop-sma"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_DROP_SMA
,
"vnode-drop-sma"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_SUBMIT_RSMA
,
"vnode-submit-rsma"
,
SSubmitReq
,
SSubmitRsp
)
TD_DEF_MSG_TYPE
(
TDMT_VND_SUBMIT_RSMA
,
"vnode-submit-rsma"
,
SSubmitReq
,
SSubmitRsp
)
TD_DEF_MSG_TYPE
(
TDMT_VND_GET_TSMA_EXP_WNDS
,
"vnode-get-tsma-expired-windows"
,
SVGetTsmaExpWndsReq
,
SVGetTsmaExpWndsRsp
)
TD_DEF_MSG_TYPE
(
TDMT_VND_SYNC_TIMEOUT
,
"vnode-sync-timeout"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_SYNC_TIMEOUT
,
"vnode-sync-timeout"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_SYNC_PING
,
"vnode-sync-ping"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_SYNC_PING
,
"vnode-sync-ping"
,
NULL
,
NULL
)
...
...
include/libs/executor/executor.h
浏览文件 @
6b17c1ca
...
@@ -156,18 +156,6 @@ int64_t qGetQueriedTableUid(qTaskInfo_t tinfo);
...
@@ -156,18 +156,6 @@ int64_t qGetQueriedTableUid(qTaskInfo_t tinfo);
*/
*/
int32_t
qGetQualifiedTableIdList
(
void
*
pTableList
,
const
char
*
tagCond
,
int32_t
tagCondLen
,
SArray
*
pTableIdList
);
int32_t
qGetQualifiedTableIdList
(
void
*
pTableList
,
const
char
*
tagCond
,
int32_t
tagCondLen
,
SArray
*
pTableIdList
);
/**
* Create the table group according to the group by tags info
* @param pTableIdList
* @param skey
* @param groupInfo
* @param groupByIndex
* @param numOfIndex
* @return
*/
// int32_t qCreateTableGroupByGroupExpr(SArray* pTableIdList, TSKEY skey, STableGroupInfo groupInfo, SColIndex*
// groupByIndex, int32_t numOfIndex);
/**
/**
* Update the table id list of a given query.
* Update the table id list of a given query.
* @param uid child table uid
* @param uid child table uid
...
...
include/libs/function/function.h
浏览文件 @
6b17c1ca
...
@@ -61,56 +61,9 @@ typedef struct SFileBlockInfo {
...
@@ -61,56 +61,9 @@ typedef struct SFileBlockInfo {
#define TSDB_BLOCK_DIST_STEP_ROWS 8
#define TSDB_BLOCK_DIST_STEP_ROWS 8
#define MAX_INTERVAL_TIME_WINDOW 1000000 // maximum allowed time windows in final results
#define MAX_INTERVAL_TIME_WINDOW 1000000 // maximum allowed time windows in final results
#define FUNCTION_TYPE_SCALAR 1
#define FUNCTION_TYPE_AGG 2
#define TOP_BOTTOM_QUERY_LIMIT 100
#define TOP_BOTTOM_QUERY_LIMIT 100
#define FUNCTIONS_NAME_MAX_LENGTH 16
#define FUNCTIONS_NAME_MAX_LENGTH 16
#define FUNCTION_INVALID_ID -1
#define FUNCTION_COUNT 0
#define FUNCTION_SUM 1
#define FUNCTION_AVG 2
#define FUNCTION_MIN 3
#define FUNCTION_MAX 4
#define FUNCTION_STDDEV 5
#define FUNCTION_PERCT 6
#define FUNCTION_APERCT 7
#define FUNCTION_FIRST 8
#define FUNCTION_LAST 9
#define FUNCTION_LAST_ROW 10
#define FUNCTION_TOP 11
#define FUNCTION_BOTTOM 12
#define FUNCTION_SPREAD 13
#define FUNCTION_TWA 14
#define FUNCTION_LEASTSQR 15
#define FUNCTION_TS 16
#define FUNCTION_TS_DUMMY 17
#define FUNCTION_TAG_DUMMY 18
#define FUNCTION_TS_COMP 19
#define FUNCTION_TAG 20
#define FUNCTION_PRJ 21
#define FUNCTION_TAGPRJ 22
#define FUNCTION_ARITHM 23
#define FUNCTION_DIFF 24
#define FUNCTION_FIRST_DST 25
#define FUNCTION_LAST_DST 26
#define FUNCTION_STDDEV_DST 27
#define FUNCTION_INTERP 28
#define FUNCTION_RATE 29
#define FUNCTION_IRATE 30
#define FUNCTION_TID_TAG 31
#define FUNCTION_DERIVATIVE 32
#define FUNCTION_BLKINFO 33
#define FUNCTION_COV 38
typedef
struct
SResultRowEntryInfo
{
typedef
struct
SResultRowEntryInfo
{
bool
initialized
:
1
;
// output buffer has been initialized
bool
initialized
:
1
;
// output buffer has been initialized
bool
complete
:
1
;
// query has completed
bool
complete
:
1
;
// query has completed
...
@@ -180,10 +133,9 @@ typedef struct SqlFunctionCtx {
...
@@ -180,10 +133,9 @@ typedef struct SqlFunctionCtx {
char
*
pOutput
;
// final result output buffer, point to sdata->data
char
*
pOutput
;
// final result output buffer, point to sdata->data
int32_t
numOfParams
;
int32_t
numOfParams
;
SFunctParam
*
param
;
// input parameter, e.g., top(k, 20), the number of results for top query is kept in param
SFunctParam
*
param
;
// input parameter, e.g., top(k, 20), the number of results for top query is kept in param
int64_t
*
ptsList
;
// corresponding timestamp array list
int64_t
*
ptsList
;
// corresponding timestamp array list
, todo remove it
SColumnInfoData
*
pTsOutput
;
// corresponding output buffer for timestamp of each result, e.g., top/bottom*/
SColumnInfoData
*
pTsOutput
;
// corresponding output buffer for timestamp of each result, e.g., top/bottom*/
int32_t
offset
;
int32_t
offset
;
SVariant
tag
;
struct
SResultRowEntryInfo
*
resultInfo
;
struct
SResultRowEntryInfo
*
resultInfo
;
SSubsidiaryResInfo
subsidiaries
;
SSubsidiaryResInfo
subsidiaries
;
SPoint1
start
;
SPoint1
start
;
...
@@ -210,9 +162,6 @@ enum {
...
@@ -210,9 +162,6 @@ enum {
typedef
struct
tExprNode
{
typedef
struct
tExprNode
{
int32_t
nodeType
;
int32_t
nodeType
;
union
{
union
{
SSchema
*
pSchema
;
// column node
struct
SVariant
*
pVal
;
// value node
struct
{
// function node
struct
{
// function node
char
functionName
[
FUNCTIONS_NAME_MAX_LENGTH
];
// todo refactor
char
functionName
[
FUNCTIONS_NAME_MAX_LENGTH
];
// todo refactor
int32_t
functionId
;
int32_t
functionId
;
...
@@ -255,47 +204,23 @@ struct SScalarParam {
...
@@ -255,47 +204,23 @@ struct SScalarParam {
int32_t
getResultDataInfo
(
int32_t
dataType
,
int32_t
dataBytes
,
int32_t
functionId
,
int32_t
param
,
SResultDataInfo
*
pInfo
,
int16_t
extLength
,
int32_t
getResultDataInfo
(
int32_t
dataType
,
int32_t
dataBytes
,
int32_t
functionId
,
int32_t
param
,
SResultDataInfo
*
pInfo
,
int16_t
extLength
,
bool
isSuperTable
);
bool
isSuperTable
);
bool
qIsValidUdf
(
SArray
*
pUdfInfo
,
const
char
*
name
,
int32_t
len
,
int32_t
*
functionId
);
void
resetResultRowEntryResult
(
SqlFunctionCtx
*
pCtx
,
int32_t
num
);
void
resetResultRowEntryResult
(
SqlFunctionCtx
*
pCtx
,
int32_t
num
);
void
cleanupResultRowEntry
(
struct
SResultRowEntryInfo
*
pCell
);
void
cleanupResultRowEntry
(
struct
SResultRowEntryInfo
*
pCell
);
int32_t
getNumOfResult
(
SqlFunctionCtx
*
pCtx
,
int32_t
num
,
SSDataBlock
*
pResBlock
);
int32_t
getNumOfResult
(
SqlFunctionCtx
*
pCtx
,
int32_t
num
,
SSDataBlock
*
pResBlock
);
bool
isRowEntryCompleted
(
struct
SResultRowEntryInfo
*
pEntry
);
bool
isRowEntryCompleted
(
struct
SResultRowEntryInfo
*
pEntry
);
bool
isRowEntryInitialized
(
struct
SResultRowEntryInfo
*
pEntry
);
bool
isRowEntryInitialized
(
struct
SResultRowEntryInfo
*
pEntry
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// fill api
struct
SFillInfo
;
struct
SFillColInfo
;
typedef
struct
SPoint
{
typedef
struct
SPoint
{
int64_t
key
;
int64_t
key
;
void
*
val
;
void
*
val
;
}
SPoint
;
}
SPoint
;
//void taosFillSetStartInfo(struct SFillInfo* pFillInfo, int32_t numOfRows, TSKEY endKey);
//void taosResetFillInfo(struct SFillInfo* pFillInfo, TSKEY startTimestamp);
//void taosFillSetInputDataBlock(struct SFillInfo* pFillInfo, const struct SSDataBlock* pInput);
//struct SFillColInfo* createFillColInfo(SExprInfo* pExpr, int32_t numOfOutput, const SValueNode* val);
//bool taosFillHasMoreResults(struct SFillInfo* pFillInfo);
//
//struct SFillInfo* taosCreateFillInfo(int32_t order, TSKEY skey, int32_t numOfTags, int32_t capacity, int32_t numOfCols,
// SInterval* pInterval, int32_t fillType,
// struct SFillColInfo* pCol, const char* id);
//
//void* taosDestroyFillInfo(struct SFillInfo *pFillInfo);
//int64_t taosFillResultDataBlock(struct SFillInfo* pFillInfo, void** output, int32_t capacity);
//int64_t getFillInfoStart(struct SFillInfo *pFillInfo);
int32_t
taosGetLinearInterpolationVal
(
SPoint
*
point
,
int32_t
outputType
,
SPoint
*
point1
,
SPoint
*
point2
,
int32_t
inputType
);
int32_t
taosGetLinearInterpolationVal
(
SPoint
*
point
,
int32_t
outputType
,
SPoint
*
point1
,
SPoint
*
point2
,
int32_t
inputType
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// udf api
// udf api
struct
SUdfInfo
;
struct
SUdfInfo
;
void
qAddUdfInfo
(
uint64_t
id
,
struct
SUdfInfo
*
pUdfInfo
);
void
qRemoveUdfInfo
(
uint64_t
id
,
struct
SUdfInfo
*
pUdfInfo
);
/**
/**
* create udfd proxy, called once in process that call doSetupUdf/callUdfxxx/doTeardownUdf
* create udfd proxy, called once in process that call doSetupUdf/callUdfxxx/doTeardownUdf
* @return error code
* @return error code
...
...
include/libs/nodes/nodes.h
浏览文件 @
6b17c1ca
...
@@ -212,6 +212,7 @@ typedef enum ENodeType {
...
@@ -212,6 +212,7 @@ typedef enum ENodeType {
QUERY_NODE_PHYSICAL_PLAN_INTERVAL
,
QUERY_NODE_PHYSICAL_PLAN_INTERVAL
,
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL
,
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL
,
QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL
,
QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL
,
QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL
,
QUERY_NODE_PHYSICAL_PLAN_FILL
,
QUERY_NODE_PHYSICAL_PLAN_FILL
,
QUERY_NODE_PHYSICAL_PLAN_SESSION_WINDOW
,
QUERY_NODE_PHYSICAL_PLAN_SESSION_WINDOW
,
QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION_WINDOW
,
QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION_WINDOW
,
...
...
include/libs/nodes/plannodes.h
浏览文件 @
6b17c1ca
...
@@ -106,6 +106,12 @@ typedef struct SMergeLogicNode {
...
@@ -106,6 +106,12 @@ typedef struct SMergeLogicNode {
typedef
enum
EWindowType
{
WINDOW_TYPE_INTERVAL
=
1
,
WINDOW_TYPE_SESSION
,
WINDOW_TYPE_STATE
}
EWindowType
;
typedef
enum
EWindowType
{
WINDOW_TYPE_INTERVAL
=
1
,
WINDOW_TYPE_SESSION
,
WINDOW_TYPE_STATE
}
EWindowType
;
typedef
enum
EStreamIntervalAlgorithm
{
STREAM_INTERVAL_ALGO_FINAL
=
1
,
STREAM_INTERVAL_ALGO_SEMI
,
STREAM_INTERVAL_ALGO_SINGLE
}
EStreamIntervalAlgorithm
;
typedef
struct
SWindowLogicNode
{
typedef
struct
SWindowLogicNode
{
SLogicNode
node
;
SLogicNode
node
;
EWindowType
winType
;
EWindowType
winType
;
...
@@ -121,6 +127,7 @@ typedef struct SWindowLogicNode {
...
@@ -121,6 +127,7 @@ typedef struct SWindowLogicNode {
int8_t
triggerType
;
int8_t
triggerType
;
int64_t
watermark
;
int64_t
watermark
;
double
filesFactor
;
double
filesFactor
;
EStreamIntervalAlgorithm
stmInterAlgo
;
}
SWindowLogicNode
;
}
SWindowLogicNode
;
typedef
struct
SFillLogicNode
{
typedef
struct
SFillLogicNode
{
...
@@ -301,6 +308,8 @@ typedef struct SIntervalPhysiNode {
...
@@ -301,6 +308,8 @@ typedef struct SIntervalPhysiNode {
}
SIntervalPhysiNode
;
}
SIntervalPhysiNode
;
typedef
SIntervalPhysiNode
SStreamIntervalPhysiNode
;
typedef
SIntervalPhysiNode
SStreamIntervalPhysiNode
;
typedef
SIntervalPhysiNode
SStreamFinalIntervalPhysiNode
;
typedef
SIntervalPhysiNode
SStreamSemiIntervalPhysiNode
;
typedef
struct
SFillPhysiNode
{
typedef
struct
SFillPhysiNode
{
SPhysiNode
node
;
SPhysiNode
node
;
...
...
include/libs/parser/parser.h
浏览文件 @
6b17c1ca
...
@@ -49,6 +49,7 @@ typedef struct SParseContext {
...
@@ -49,6 +49,7 @@ typedef struct SParseContext {
const
char
*
pUser
;
const
char
*
pUser
;
bool
isSuperUser
;
bool
isSuperUser
;
bool
async
;
bool
async
;
int8_t
schemalessType
;
}
SParseContext
;
}
SParseContext
;
int32_t
qParseSql
(
SParseContext
*
pCxt
,
SQuery
**
pQuery
);
int32_t
qParseSql
(
SParseContext
*
pCxt
,
SQuery
**
pQuery
);
...
...
include/libs/planner/planner.h
浏览文件 @
6b17c1ca
include/util/taoserror.h
浏览文件 @
6b17c1ca
...
@@ -675,6 +675,7 @@ int32_t* taosGetErrno();
...
@@ -675,6 +675,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_SML_INVALID_PROTOCOL_TYPE TAOS_DEF_ERROR_CODE(0, 0x3000)
#define TSDB_CODE_SML_INVALID_PROTOCOL_TYPE TAOS_DEF_ERROR_CODE(0, 0x3000)
#define TSDB_CODE_SML_INVALID_PRECISION_TYPE TAOS_DEF_ERROR_CODE(0, 0x3001)
#define TSDB_CODE_SML_INVALID_PRECISION_TYPE TAOS_DEF_ERROR_CODE(0, 0x3001)
#define TSDB_CODE_SML_INVALID_DATA TAOS_DEF_ERROR_CODE(0, 0x3002)
#define TSDB_CODE_SML_INVALID_DATA TAOS_DEF_ERROR_CODE(0, 0x3002)
#define TSDB_CODE_SML_INVALID_DB_CONF TAOS_DEF_ERROR_CODE(0, 0x3003)
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
include/util/tlist.h
浏览文件 @
6b17c1ca
...
@@ -229,7 +229,7 @@ int32_t tdListAppend(SList *list, void *data);
...
@@ -229,7 +229,7 @@ int32_t tdListAppend(SList *list, void *data);
SListNode
*
tdListPopHead
(
SList
*
list
);
SListNode
*
tdListPopHead
(
SList
*
list
);
SListNode
*
tdListPopTail
(
SList
*
list
);
SListNode
*
tdListPopTail
(
SList
*
list
);
SListNode
*
tdListGetHead
(
SList
*
list
);
SListNode
*
tdListGetHead
(
SList
*
list
);
SListNode
*
t
s
ListGetTail
(
SList
*
list
);
SListNode
*
t
d
ListGetTail
(
SList
*
list
);
SListNode
*
tdListPopNode
(
SList
*
list
,
SListNode
*
node
);
SListNode
*
tdListPopNode
(
SList
*
list
,
SListNode
*
node
);
void
tdListMove
(
SList
*
src
,
SList
*
dst
);
void
tdListMove
(
SList
*
src
,
SList
*
dst
);
void
tdListDiscard
(
SList
*
list
);
void
tdListDiscard
(
SList
*
list
);
...
...
source/client/inc/clientInt.h
浏览文件 @
6b17c1ca
...
@@ -151,6 +151,7 @@ typedef struct STscObj {
...
@@ -151,6 +151,7 @@ typedef struct STscObj {
int32_t
numOfReqs
;
// number of sqlObj bound to this connection
int32_t
numOfReqs
;
// number of sqlObj bound to this connection
SAppInstInfo
*
pAppInfo
;
SAppInstInfo
*
pAppInfo
;
SHashObj
*
pRequests
;
SHashObj
*
pRequests
;
int8_t
schemalessType
;
}
STscObj
;
}
STscObj
;
typedef
struct
SResultColumn
{
typedef
struct
SResultColumn
{
...
...
source/client/src/clientEnv.c
浏览文件 @
6b17c1ca
...
@@ -161,6 +161,7 @@ void *createTscObj(const char *user, const char *auth, const char *db, int32_t c
...
@@ -161,6 +161,7 @@ void *createTscObj(const char *user, const char *auth, const char *db, int32_t c
taosThreadMutexInit
(
&
pObj
->
mutex
,
NULL
);
taosThreadMutexInit
(
&
pObj
->
mutex
,
NULL
);
pObj
->
id
=
taosAddRef
(
clientConnRefPool
,
pObj
);
pObj
->
id
=
taosAddRef
(
clientConnRefPool
,
pObj
);
pObj
->
schemalessType
=
0
;
tscDebug
(
"connObj created, 0x%"
PRIx64
,
pObj
->
id
);
tscDebug
(
"connObj created, 0x%"
PRIx64
,
pObj
->
id
);
return
pObj
;
return
pObj
;
...
...
source/client/src/clientImpl.c
浏览文件 @
6b17c1ca
...
@@ -176,6 +176,7 @@ int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery, SStmtC
...
@@ -176,6 +176,7 @@ int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery, SStmtC
.
pTransporter
=
pTscObj
->
pAppInfo
->
pTransporter
,
.
pTransporter
=
pTscObj
->
pAppInfo
->
pTransporter
,
.
pStmtCb
=
pStmtCb
,
.
pStmtCb
=
pStmtCb
,
.
pUser
=
pTscObj
->
user
,
.
pUser
=
pTscObj
->
user
,
.
schemalessType
=
pTscObj
->
schemalessType
,
.
isSuperUser
=
(
0
==
strcmp
(
pTscObj
->
user
,
TSDB_DEFAULT_USER
))};
.
isSuperUser
=
(
0
==
strcmp
(
pTscObj
->
user
,
TSDB_DEFAULT_USER
))};
cxt
.
mgmtEpSet
=
getEpSet_s
(
&
pTscObj
->
pAppInfo
->
mgmtEp
);
cxt
.
mgmtEpSet
=
getEpSet_s
(
&
pTscObj
->
pAppInfo
->
mgmtEp
);
...
...
source/client/src/clientSml.c
浏览文件 @
6b17c1ca
...
@@ -960,10 +960,10 @@ static int32_t smlParseInfluxString(const char* sql, SSmlLineInfo *elements, SSm
...
@@ -960,10 +960,10 @@ static int32_t smlParseInfluxString(const char* sql, SSmlLineInfo *elements, SSm
return
TSDB_CODE_SML_INVALID_DATA
;
return
TSDB_CODE_SML_INVALID_DATA
;
}
}
elements
->
colsLen
=
sql
-
elements
->
cols
;
elements
->
colsLen
=
sql
-
elements
->
cols
;
if
(
elements
->
colsLen
==
0
)
{
//
if(elements->colsLen == 0) {
smlBuildInvalidDataMsg
(
msg
,
"cols is empty"
,
NULL
);
//
smlBuildInvalidDataMsg(msg, "cols is empty", NULL);
return
TSDB_CODE_SML_INVALID_DATA
;
//
return TSDB_CODE_SML_INVALID_DATA;
}
//
}
// parse timestamp
// parse timestamp
JUMP_SPACE
(
sql
)
JUMP_SPACE
(
sql
)
...
@@ -1124,7 +1124,7 @@ static int32_t smlParseTelnetString(SSmlHandle *info, const char* sql, SSmlTable
...
@@ -1124,7 +1124,7 @@ static int32_t smlParseTelnetString(SSmlHandle *info, const char* sql, SSmlTable
}
}
static
int32_t
smlParseCols
(
const
char
*
data
,
int32_t
len
,
SArray
*
cols
,
char
*
childTableName
,
bool
isTag
,
SHashObj
*
dumplicateKey
,
SSmlMsgBuf
*
msg
){
static
int32_t
smlParseCols
(
const
char
*
data
,
int32_t
len
,
SArray
*
cols
,
char
*
childTableName
,
bool
isTag
,
SHashObj
*
dumplicateKey
,
SSmlMsgBuf
*
msg
){
if
(
isTag
&&
len
==
0
){
if
(
len
==
0
){
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -2318,6 +2318,28 @@ cleanup:
...
@@ -2318,6 +2318,28 @@ cleanup:
return
code
;
return
code
;
}
}
static
int32_t
isSchemalessDb
(
SSmlHandle
*
info
){
SName
name
;
tNameSetDbName
(
&
name
,
info
->
taos
->
acctId
,
info
->
taos
->
db
,
strlen
(
info
->
taos
->
db
));
char
dbFname
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
tNameGetFullDbName
(
&
name
,
dbFname
);
SDbCfgInfo
pInfo
=
{
0
};
SEpSet
ep
=
getEpSet_s
(
&
info
->
taos
->
pAppInfo
->
mgmtEp
);
int32_t
code
=
catalogGetDBCfg
(
info
->
pCatalog
,
info
->
taos
->
pAppInfo
->
pTransporter
,
&
ep
,
dbFname
,
&
pInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
info
->
pRequest
->
code
=
code
;
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"catalogGetDBCfg error, code:"
,
tstrerror
(
code
));
return
code
;
}
if
(
!
pInfo
.
schemaless
){
info
->
pRequest
->
code
=
TSDB_CODE_SML_INVALID_DB_CONF
;
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"can not insert into schemaless db:"
,
dbFname
);
return
TSDB_CODE_SML_INVALID_DB_CONF
;
}
return
TSDB_CODE_SUCCESS
;
}
/**
/**
* taos_schemaless_insert() parse and insert data points into database according to
* taos_schemaless_insert() parse and insert data points into database according to
* different protocol.
* different protocol.
...
@@ -2351,6 +2373,19 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr
...
@@ -2351,6 +2373,19 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr
return
(
TAOS_RES
*
)
request
;
return
(
TAOS_RES
*
)
request
;
}
}
info
->
taos
->
schemalessType
=
1
;
if
(
request
->
pDb
==
NULL
){
request
->
code
=
TSDB_CODE_PAR_DB_NOT_SPECIFIED
;
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"Database not specified"
,
NULL
);
goto
end
;
}
if
(
isSchemalessDb
(
info
)
!=
TSDB_CODE_SUCCESS
){
request
->
code
=
TSDB_CODE_SML_INVALID_DB_CONF
;
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"Cannot write data to a non schemaless database"
,
NULL
);
goto
end
;
}
if
(
!
lines
)
{
if
(
!
lines
)
{
request
->
code
=
TSDB_CODE_SML_INVALID_DATA
;
request
->
code
=
TSDB_CODE_SML_INVALID_DATA
;
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"lines is null"
,
NULL
);
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"lines is null"
,
NULL
);
...
@@ -2372,6 +2407,7 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr
...
@@ -2372,6 +2407,7 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr
info
->
pRequest
->
code
=
smlProcess
(
info
,
lines
,
numLines
);
info
->
pRequest
->
code
=
smlProcess
(
info
,
lines
,
numLines
);
end:
end:
uDebug
(
"result:%s"
,
info
->
msgBuf
.
buf
);
smlDestroyInfo
(
info
);
smlDestroyInfo
(
info
);
return
(
TAOS_RES
*
)
request
;
return
(
TAOS_RES
*
)
request
;
}
}
...
...
source/client/test/clientTests.cpp
浏览文件 @
6b17c1ca
...
@@ -567,6 +567,7 @@ TEST(testCase, insert_test) {
...
@@ -567,6 +567,7 @@ TEST(testCase, insert_test) {
taos_free_result(pRes);
taos_free_result(pRes);
taos_close(pConn);
taos_close(pConn);
}
}
#endif
TEST
(
testCase
,
projection_query_tables
)
{
TEST
(
testCase
,
projection_query_tables
)
{
TAOS
*
pConn
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS
*
pConn
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
...
@@ -625,23 +626,23 @@ TEST(testCase, projection_query_tables) {
...
@@ -625,23 +626,23 @@ TEST(testCase, projection_query_tables) {
printf
(
"start to insert next table
\n
"
);
printf
(
"start to insert next table
\n
"
);
for(int32_t i = 0; i < 1000000; i += 20) {
//
for(int32_t i = 0; i < 1000000; i += 20) {
char sql[1024] = {0};
//
char sql[1024] = {0};
sprintf(sql,
//
sprintf(sql,
"insert into tu2 values(now+%da, %d)(now+%da, %d)(now+%da, %d)(now+%da, %d)"
//
"insert into tu2 values(now+%da, %d)(now+%da, %d)(now+%da, %d)(now+%da, %d)"
"(now+%da, %d)(now+%da, %d)(now+%da, %d)(now+%da, %d)(now+%da, %d)(now+%da, %d)"
//
"(now+%da, %d)(now+%da, %d)(now+%da, %d)(now+%da, %d)(now+%da, %d)(now+%da, %d)"
"(now+%da, %d)(now+%da, %d)(now+%da, %d)(now+%da, %d)"
//
"(now+%da, %d)(now+%da, %d)(now+%da, %d)(now+%da, %d)"
"(now+%da, %d)(now+%da, %d)(now+%da, %d)(now+%da, %d)(now+%da, %d)(now+%da, %d)",
//
"(now+%da, %d)(now+%da, %d)(now+%da, %d)(now+%da, %d)(now+%da, %d)(now+%da, %d)",
i, i, i + 1, i + 1, i + 2, i + 2, i + 3, i + 3, i + 4, i + 4, i + 5, i + 5, i + 6, i + 6, i + 7, i + 7,
//
i, i, i + 1, i + 1, i + 2, i + 2, i + 3, i + 3, i + 4, i + 4, i + 5, i + 5, i + 6, i + 6, i + 7, i + 7,
i + 8, i + 8, i + 9, i + 9, i + 10, i + 10, i + 11, i + 11, i + 12, i + 12, i + 13, i + 13, i + 14, i + 14,
//
i + 8, i + 8, i + 9, i + 9, i + 10, i + 10, i + 11, i + 11, i + 12, i + 12, i + 13, i + 13, i + 14, i + 14,
i + 15, i + 15, i + 16, i + 16, i + 17, i + 17, i + 18, i + 18, i + 19, i + 19);
//
i + 15, i + 15, i + 16, i + 16, i + 17, i + 17, i + 18, i + 18, i + 19, i + 19);
TAOS_RES* p = taos_query(pConn, sql);
//
TAOS_RES* p = taos_query(pConn, sql);
if (taos_errno(p) != 0) {
//
if (taos_errno(p) != 0) {
printf("failed to insert data, reason:%s\n", taos_errstr(p));
//
printf("failed to insert data, reason:%s\n", taos_errstr(p));
}
//
}
//
taos_free_result(p);
//
taos_free_result(p);
}
//
}
// pRes = taos_query(pConn, "select * from tu");
// pRes = taos_query(pConn, "select * from tu");
// if (taos_errno(pRes) != 0) {
// if (taos_errno(pRes) != 0) {
...
@@ -663,7 +664,7 @@ TEST(testCase, projection_query_tables) {
...
@@ -663,7 +664,7 @@ TEST(testCase, projection_query_tables) {
// taos_free_result(pRes);
// taos_free_result(pRes);
taos_close
(
pConn
);
taos_close
(
pConn
);
}
}
#if 0
TEST(testCase, projection_query_stables) {
TEST(testCase, projection_query_stables) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
ASSERT_NE(pConn, nullptr);
ASSERT_NE(pConn, nullptr);
...
@@ -692,8 +693,6 @@ TEST(testCase, projection_query_stables) {
...
@@ -692,8 +693,6 @@ TEST(testCase, projection_query_stables) {
taos_close(pConn);
taos_close(pConn);
}
}
#endif
TEST(testCase, agg_query_tables) {
TEST(testCase, agg_query_tables) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
ASSERT_NE(pConn, nullptr);
ASSERT_NE(pConn, nullptr);
...
@@ -734,5 +733,6 @@ TEST(testCase, agg_query_tables) {
...
@@ -734,5 +733,6 @@ TEST(testCase, agg_query_tables) {
taos_free_result(pRes);
taos_free_result(pRes);
taos_close(pConn);
taos_close(pConn);
}
}
#endif
#pragma GCC diagnostic pop
#pragma GCC diagnostic pop
source/client/test/smlTest.cpp
浏览文件 @
6b17c1ca
...
@@ -1259,3 +1259,25 @@ TEST(testCase, sml_TD15742_Test) {
...
@@ -1259,3 +1259,25 @@ TEST(testCase, sml_TD15742_Test) {
destroyRequest
(
request
);
destroyRequest
(
request
);
smlDestroyInfo
(
info
);
smlDestroyInfo
(
info
);
}
}
TEST
(
testCase
,
sml_params_Test
)
{
TAOS
*
taos
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
ASSERT_NE
(
taos
,
nullptr
);
TAOS_RES
*
pRes
=
taos_query
(
taos
,
"create database if not exists param"
);
taos_free_result
(
pRes
);
const
char
*
sql
[]
=
{
"test_ms,t0=t c0=f 1626006833641"
,
};
TAOS_RES
*
res
=
taos_schemaless_insert
(
taos
,
(
char
**
)
sql
,
1
,
TSDB_SML_LINE_PROTOCOL
,
TSDB_SML_TIMESTAMP_MILLI_SECONDS
);
ASSERT_EQ
(
taos_errno
(
res
),
TSDB_CODE_PAR_DB_NOT_SPECIFIED
);
taos_free_result
(
pRes
);
pRes
=
taos_query
(
taos
,
"use param"
);
taos_free_result
(
pRes
);
res
=
taos_schemaless_insert
(
taos
,
(
char
**
)
sql
,
1
,
TSDB_SML_LINE_PROTOCOL
,
TSDB_SML_TIMESTAMP_MILLI_SECONDS
);
ASSERT_EQ
(
taos_errno
(
res
),
TSDB_CODE_SML_INVALID_DB_CONF
);
taos_free_result
(
pRes
);
}
source/common/src/systable.c
浏览文件 @
6b17c1ca
...
@@ -91,6 +91,8 @@ static const SSysDbTableSchema userDBSchema[] = {
...
@@ -91,6 +91,8 @@ static const SSysDbTableSchema userDBSchema[] = {
{.
name
=
"precision"
,
.
bytes
=
2
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"precision"
,
.
bytes
=
2
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"single_stable"
,
.
bytes
=
1
,
.
type
=
TSDB_DATA_TYPE_TINYINT
},
{.
name
=
"single_stable"
,
.
bytes
=
1
,
.
type
=
TSDB_DATA_TYPE_TINYINT
},
{.
name
=
"status"
,
.
bytes
=
10
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"status"
,
.
bytes
=
10
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"schemaless"
,
.
bytes
=
1
,
.
type
=
TSDB_DATA_TYPE_TINYINT
},
// {.name = "update", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, // disable update
// {.name = "update", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, // disable update
};
};
...
...
source/common/src/tdatablock.c
浏览文件 @
6b17c1ca
...
@@ -356,13 +356,18 @@ int32_t blockDataUpdateTsWindow(SSDataBlock* pDataBlock, int32_t tsColumnIndex)
...
@@ -356,13 +356,18 @@ int32_t blockDataUpdateTsWindow(SSDataBlock* pDataBlock, int32_t tsColumnIndex)
}
}
int32_t
index
=
(
tsColumnIndex
==
-
1
)
?
0
:
tsColumnIndex
;
int32_t
index
=
(
tsColumnIndex
==
-
1
)
?
0
:
tsColumnIndex
;
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
index
);
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
index
);
if
(
pColInfoData
->
info
.
type
!=
TSDB_DATA_TYPE_TIMESTAMP
)
{
if
(
pColInfoData
->
info
.
type
!=
TSDB_DATA_TYPE_TIMESTAMP
)
{
return
0
;
return
0
;
}
}
pDataBlock
->
info
.
window
.
skey
=
*
(
TSKEY
*
)
colDataGetData
(
pColInfoData
,
0
);
TSKEY
skey
=
*
(
TSKEY
*
)
colDataGetData
(
pColInfoData
,
0
);
pDataBlock
->
info
.
window
.
ekey
=
*
(
TSKEY
*
)
colDataGetData
(
pColInfoData
,
(
pDataBlock
->
info
.
rows
-
1
));
TSKEY
ekey
=
*
(
TSKEY
*
)
colDataGetData
(
pColInfoData
,
(
pDataBlock
->
info
.
rows
-
1
));
pDataBlock
->
info
.
window
.
skey
=
TMIN
(
skey
,
ekey
);
pDataBlock
->
info
.
window
.
ekey
=
TMAX
(
skey
,
ekey
);
return
0
;
return
0
;
}
}
...
@@ -1274,12 +1279,11 @@ static void doShiftBitmap(char* nullBitmap, size_t n, size_t total) {
...
@@ -1274,12 +1279,11 @@ static void doShiftBitmap(char* nullBitmap, size_t n, size_t total) {
}
else
{
}
else
{
int32_t
tail
=
n
%
8
;
int32_t
tail
=
n
%
8
;
int32_t
i
=
0
;
int32_t
i
=
0
;
uint8_t
*
p
=
(
uint8_t
*
)
nullBitmap
;
uint8_t
*
p
=
(
uint8_t
*
)
nullBitmap
;
while
(
i
<
len
)
{
uint8_t
v
=
p
[
i
];
p
[
i
]
=
0
;
if
(
n
<
8
)
{
while
(
i
<
len
)
{
uint8_t
v
=
p
[
i
];
// source bitmap value
p
[
i
]
=
(
v
<<
tail
);
p
[
i
]
=
(
v
<<
tail
);
if
(
i
<
len
-
1
)
{
if
(
i
<
len
-
1
)
{
...
@@ -1289,9 +1293,24 @@ static void doShiftBitmap(char* nullBitmap, size_t n, size_t total) {
...
@@ -1289,9 +1293,24 @@ static void doShiftBitmap(char* nullBitmap, size_t n, size_t total) {
i
+=
1
;
i
+=
1
;
}
}
}
else
if
(
n
>
8
)
{
int32_t
gap
=
len
-
newLen
;
while
(
i
<
newLen
)
{
uint8_t
v
=
p
[
i
+
gap
];
p
[
i
]
=
(
v
<<
tail
);
if
(
i
<
newLen
-
1
)
{
uint8_t
next
=
p
[
i
+
gap
+
1
];
p
[
i
]
|=
(
next
>>
(
8
-
tail
));
}
i
+=
1
;
}
}
}
}
}
}
static
void
colDataTrimFirstNRows
(
SColumnInfoData
*
pColInfoData
,
size_t
n
,
size_t
total
)
{
static
void
colDataTrimFirstNRows
(
SColumnInfoData
*
pColInfoData
,
size_t
n
,
size_t
total
)
{
if
(
IS_VAR_DATA_TYPE
(
pColInfoData
->
info
.
type
))
{
if
(
IS_VAR_DATA_TYPE
(
pColInfoData
->
info
.
type
))
{
memmove
(
pColInfoData
->
varmeta
.
offset
,
&
pColInfoData
->
varmeta
.
offset
[
n
],
(
total
-
n
)
*
sizeof
(
int32_t
));
memmove
(
pColInfoData
->
varmeta
.
offset
,
&
pColInfoData
->
varmeta
.
offset
[
n
],
(
total
-
n
)
*
sizeof
(
int32_t
));
...
@@ -1803,3 +1822,99 @@ SSubmitReq* tdBlockToSubmit(const SArray* pBlocks, const STSchema* pTSchema, boo
...
@@ -1803,3 +1822,99 @@ SSubmitReq* tdBlockToSubmit(const SArray* pBlocks, const STSchema* pTSchema, boo
taosArrayDestroy
(
tagArray
);
taosArrayDestroy
(
tagArray
);
return
ret
;
return
ret
;
}
}
void
blockCompressEncode
(
const
SSDataBlock
*
pBlock
,
char
*
data
,
int32_t
*
dataLen
,
int32_t
numOfCols
,
int8_t
needCompress
)
{
int32_t
*
actualLen
=
(
int32_t
*
)
data
;
data
+=
sizeof
(
int32_t
);
uint64_t
*
groupId
=
(
uint64_t
*
)
data
;
data
+=
sizeof
(
uint64_t
);
int32_t
*
colSizes
=
(
int32_t
*
)
data
;
data
+=
numOfCols
*
sizeof
(
int32_t
);
*
dataLen
=
(
numOfCols
*
sizeof
(
int32_t
)
+
sizeof
(
uint64_t
)
+
sizeof
(
int32_t
));
int32_t
numOfRows
=
pBlock
->
info
.
rows
;
for
(
int32_t
col
=
0
;
col
<
numOfCols
;
++
col
)
{
SColumnInfoData
*
pColRes
=
(
SColumnInfoData
*
)
taosArrayGet
(
pBlock
->
pDataBlock
,
col
);
// copy the null bitmap
if
(
IS_VAR_DATA_TYPE
(
pColRes
->
info
.
type
))
{
size_t
metaSize
=
numOfRows
*
sizeof
(
int32_t
);
memcpy
(
data
,
pColRes
->
varmeta
.
offset
,
metaSize
);
data
+=
metaSize
;
(
*
dataLen
)
+=
metaSize
;
}
else
{
int32_t
len
=
BitmapLen
(
numOfRows
);
memcpy
(
data
,
pColRes
->
nullbitmap
,
len
);
data
+=
len
;
(
*
dataLen
)
+=
len
;
}
if
(
needCompress
)
{
colSizes
[
col
]
=
blockCompressColData
(
pColRes
,
numOfRows
,
data
,
needCompress
);
data
+=
colSizes
[
col
];
(
*
dataLen
)
+=
colSizes
[
col
];
}
else
{
colSizes
[
col
]
=
colDataGetLength
(
pColRes
,
numOfRows
);
(
*
dataLen
)
+=
colSizes
[
col
];
memmove
(
data
,
pColRes
->
pData
,
colSizes
[
col
]);
data
+=
colSizes
[
col
];
}
colSizes
[
col
]
=
htonl
(
colSizes
[
col
]);
}
*
actualLen
=
*
dataLen
;
*
groupId
=
pBlock
->
info
.
groupId
;
}
const
char
*
blockCompressDecode
(
SSDataBlock
*
pBlock
,
int32_t
numOfCols
,
int32_t
numOfRows
,
const
char
*
pData
)
{
blockDataEnsureCapacity
(
pBlock
,
numOfRows
);
const
char
*
pStart
=
pData
;
int32_t
dataLen
=
*
(
int32_t
*
)
pStart
;
pStart
+=
sizeof
(
int32_t
);
pBlock
->
info
.
groupId
=
*
(
uint64_t
*
)
pStart
;
pStart
+=
sizeof
(
uint64_t
);
int32_t
*
colLen
=
(
int32_t
*
)
pStart
;
pStart
+=
sizeof
(
int32_t
)
*
numOfCols
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
colLen
[
i
]
=
htonl
(
colLen
[
i
]);
ASSERT
(
colLen
[
i
]
>=
0
);
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
if
(
IS_VAR_DATA_TYPE
(
pColInfoData
->
info
.
type
))
{
pColInfoData
->
varmeta
.
length
=
colLen
[
i
];
pColInfoData
->
varmeta
.
allocLen
=
colLen
[
i
];
memcpy
(
pColInfoData
->
varmeta
.
offset
,
pStart
,
sizeof
(
int32_t
)
*
numOfRows
);
pStart
+=
sizeof
(
int32_t
)
*
numOfRows
;
if
(
colLen
[
i
]
>
0
)
{
taosMemoryFreeClear
(
pColInfoData
->
pData
);
pColInfoData
->
pData
=
taosMemoryMalloc
(
colLen
[
i
]);
}
}
else
{
memcpy
(
pColInfoData
->
nullbitmap
,
pStart
,
BitmapLen
(
numOfRows
));
pStart
+=
BitmapLen
(
numOfRows
);
}
if
(
colLen
[
i
]
>
0
)
{
memcpy
(
pColInfoData
->
pData
,
pStart
,
colLen
[
i
]);
}
// TODO
// setting this flag to true temporarily so aggregate function on stable will
// examine NULL value for non-primary key column
pColInfoData
->
hasNull
=
true
;
pStart
+=
colLen
[
i
];
}
ASSERT
(
pStart
-
pData
==
dataLen
);
return
pStart
;
}
\ No newline at end of file
source/common/src/tglobal.c
浏览文件 @
6b17c1ca
...
@@ -109,6 +109,9 @@ int32_t tsCompressColData = -1;
...
@@ -109,6 +109,9 @@ int32_t tsCompressColData = -1;
*/
*/
int32_t
tsCompatibleModel
=
1
;
int32_t
tsCompatibleModel
=
1
;
// count/hyperloglog function always return values in case of all NULL data or Empty data set.
int32_t
tsCountAlwaysReturnValue
=
1
;
// 10 ms for sliding time, the value will changed in case of time precision changed
// 10 ms for sliding time, the value will changed in case of time precision changed
int32_t
tsMinSlidingTime
=
10
;
int32_t
tsMinSlidingTime
=
10
;
...
@@ -130,7 +133,6 @@ int32_t tsRetryStreamCompDelay = 10 * 1000;
...
@@ -130,7 +133,6 @@ int32_t tsRetryStreamCompDelay = 10 * 1000;
// The delayed computing ration. 10% of the whole computing time window by default.
// The delayed computing ration. 10% of the whole computing time window by default.
float
tsStreamComputDelayRatio
=
0
.
1
f
;
float
tsStreamComputDelayRatio
=
0
.
1
f
;
int32_t
tsProjectExecInterval
=
10000
;
// every 10sec, the projection will be executed once
int64_t
tsMaxRetentWindow
=
24
*
3600L
;
// maximum time window tolerance
int64_t
tsMaxRetentWindow
=
24
*
3600L
;
// maximum time window tolerance
// the maximum allowed query buffer size during query processing for each data node.
// the maximum allowed query buffer size during query processing for each data node.
...
@@ -374,6 +376,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
...
@@ -374,6 +376,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
if
(
cfgAddInt32
(
pCfg
,
"minSlidingTime"
,
tsMinSlidingTime
,
10
,
1000000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"minSlidingTime"
,
tsMinSlidingTime
,
10
,
1000000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"minIntervalTime"
,
tsMinIntervalTime
,
1
,
1000000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"minIntervalTime"
,
tsMinIntervalTime
,
1
,
1000000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"maxNumOfDistinctRes"
,
tsMaxNumOfDistinctResults
,
10
*
10000
,
10000
*
10000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"maxNumOfDistinctRes"
,
tsMaxNumOfDistinctResults
,
10
*
10000
,
10000
*
10000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"countAlwaysReturnValue"
,
tsCountAlwaysReturnValue
,
0
,
1
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"maxStreamCompDelay"
,
tsMaxStreamComputDelay
,
10
,
1000000000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"maxStreamCompDelay"
,
tsMaxStreamComputDelay
,
10
,
1000000000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"maxFirstStreamCompDelay"
,
tsStreamCompStartDelay
,
1000
,
1000000000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"maxFirstStreamCompDelay"
,
tsStreamCompStartDelay
,
1000
,
1000000000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"retryStreamCompDelay"
,
tsRetryStreamCompDelay
,
10
,
1000000000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"retryStreamCompDelay"
,
tsRetryStreamCompDelay
,
10
,
1000000000
,
0
)
!=
0
)
return
-
1
;
...
@@ -567,6 +570,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
...
@@ -567,6 +570,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
tsMinSlidingTime
=
cfgGetItem
(
pCfg
,
"minSlidingTime"
)
->
i32
;
tsMinSlidingTime
=
cfgGetItem
(
pCfg
,
"minSlidingTime"
)
->
i32
;
tsMinIntervalTime
=
cfgGetItem
(
pCfg
,
"minIntervalTime"
)
->
i32
;
tsMinIntervalTime
=
cfgGetItem
(
pCfg
,
"minIntervalTime"
)
->
i32
;
tsMaxNumOfDistinctResults
=
cfgGetItem
(
pCfg
,
"maxNumOfDistinctRes"
)
->
i32
;
tsMaxNumOfDistinctResults
=
cfgGetItem
(
pCfg
,
"maxNumOfDistinctRes"
)
->
i32
;
tsCountAlwaysReturnValue
=
cfgGetItem
(
pCfg
,
"countAlwaysReturnValue"
)
->
i32
;
tsMaxStreamComputDelay
=
cfgGetItem
(
pCfg
,
"maxStreamCompDelay"
)
->
i32
;
tsMaxStreamComputDelay
=
cfgGetItem
(
pCfg
,
"maxStreamCompDelay"
)
->
i32
;
tsStreamCompStartDelay
=
cfgGetItem
(
pCfg
,
"maxFirstStreamCompDelay"
)
->
i32
;
tsStreamCompStartDelay
=
cfgGetItem
(
pCfg
,
"maxFirstStreamCompDelay"
)
->
i32
;
tsRetryStreamCompDelay
=
cfgGetItem
(
pCfg
,
"retryStreamCompDelay"
)
->
i32
;
tsRetryStreamCompDelay
=
cfgGetItem
(
pCfg
,
"retryStreamCompDelay"
)
->
i32
;
...
...
source/common/src/tmsg.c
浏览文件 @
6b17c1ca
...
@@ -2278,6 +2278,7 @@ int32_t tSerializeSDbCfgRsp(void *buf, int32_t bufLen, const SDbCfgRsp *pRsp) {
...
@@ -2278,6 +2278,7 @@ int32_t tSerializeSDbCfgRsp(void *buf, int32_t bufLen, const SDbCfgRsp *pRsp) {
if
(
tEncodeI8
(
&
encoder
,
pRetension
->
freqUnit
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRetension
->
freqUnit
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRetension
->
keepUnit
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRetension
->
keepUnit
)
<
0
)
return
-
1
;
}
}
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
schemaless
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
...
@@ -2326,6 +2327,7 @@ int32_t tDeserializeSDbCfgRsp(void *buf, int32_t bufLen, SDbCfgRsp *pRsp) {
...
@@ -2326,6 +2327,7 @@ int32_t tDeserializeSDbCfgRsp(void *buf, int32_t bufLen, SDbCfgRsp *pRsp) {
return
-
1
;
return
-
1
;
}
}
}
}
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
schemaless
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
tDecoderClear
(
&
decoder
);
...
...
source/dnode/mgmt/exe/dmMain.c
浏览文件 @
6b17c1ca
...
@@ -216,7 +216,7 @@ int main(int argc, char const *argv[]) {
...
@@ -216,7 +216,7 @@ int main(int argc, char const *argv[]) {
return
-
1
;
return
-
1
;
}
}
dInfo
(
"start to
ru
n dnode"
);
dInfo
(
"start to
ope
n dnode"
);
dmSetSignalHandle
();
dmSetSignalHandle
();
int32_t
code
=
dmRun
();
int32_t
code
=
dmRun
();
dInfo
(
"shutting down the service"
);
dInfo
(
"shutting down the service"
);
...
...
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
浏览文件 @
6b17c1ca
...
@@ -180,6 +180,24 @@ static void vmGenerateWrapperCfg(SVnodeMgmt *pMgmt, SCreateVnodeReq *pCreate, SW
...
@@ -180,6 +180,24 @@ static void vmGenerateWrapperCfg(SVnodeMgmt *pMgmt, SCreateVnodeReq *pCreate, SW
snprintf
(
pCfg
->
path
,
sizeof
(
pCfg
->
path
),
"%s%svnode%d"
,
pMgmt
->
path
,
TD_DIRSEP
,
pCreate
->
vgId
);
snprintf
(
pCfg
->
path
,
sizeof
(
pCfg
->
path
),
"%s%svnode%d"
,
pMgmt
->
path
,
TD_DIRSEP
,
pCreate
->
vgId
);
}
}
static
int32_t
vmTsmaAdjustDays
(
SVnodeCfg
*
pCfg
,
SCreateVnodeReq
*
pReq
)
{
if
(
pReq
->
isTsma
)
{
SMsgHead
*
smaMsg
=
pReq
->
pTsma
;
uint32_t
contLen
=
(
uint32_t
)(
htonl
(
smaMsg
->
contLen
)
-
sizeof
(
SMsgHead
));
return
smaGetTSmaDays
(
pCfg
,
POINTER_SHIFT
(
smaMsg
,
sizeof
(
SMsgHead
)),
contLen
,
&
pCfg
->
tsdbCfg
.
days
);
}
return
0
;
}
static
int32_t
vmTsmaProcessCreate
(
SVnode
*
pVnode
,
SCreateVnodeReq
*
pReq
)
{
if
(
pReq
->
isTsma
)
{
SMsgHead
*
smaMsg
=
pReq
->
pTsma
;
uint32_t
contLen
=
(
uint32_t
)(
htonl
(
smaMsg
->
contLen
)
-
sizeof
(
SMsgHead
));
return
vnodeProcessCreateTSma
(
pVnode
,
POINTER_SHIFT
(
smaMsg
,
sizeof
(
SMsgHead
)),
contLen
);
}
return
0
;
}
int32_t
vmProcessCreateVnodeReq
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
int32_t
vmProcessCreateVnodeReq
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
SCreateVnodeReq
createReq
=
{
0
};
SCreateVnodeReq
createReq
=
{
0
};
SVnodeCfg
vnodeCfg
=
{
0
};
SVnodeCfg
vnodeCfg
=
{
0
};
...
@@ -195,6 +213,13 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
...
@@ -195,6 +213,13 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
dDebug
(
"vgId:%d, create vnode req is received, tsma:%d standby:%d"
,
createReq
.
vgId
,
createReq
.
isTsma
,
dDebug
(
"vgId:%d, create vnode req is received, tsma:%d standby:%d"
,
createReq
.
vgId
,
createReq
.
isTsma
,
createReq
.
standby
);
createReq
.
standby
);
vmGenerateVnodeCfg
(
&
createReq
,
&
vnodeCfg
);
vmGenerateVnodeCfg
(
&
createReq
,
&
vnodeCfg
);
if
(
vmTsmaAdjustDays
(
&
vnodeCfg
,
&
createReq
)
<
0
)
{
dError
(
"vgId:%d, failed to adjust tsma days since %s"
,
createReq
.
vgId
,
terrstr
());
code
=
terrno
;
goto
_OVER
;
}
vmGenerateWrapperCfg
(
pMgmt
,
&
createReq
,
&
wrapperCfg
);
vmGenerateWrapperCfg
(
pMgmt
,
&
createReq
,
&
wrapperCfg
);
SVnodeObj
*
pVnode
=
vmAcquireVnode
(
pMgmt
,
createReq
.
vgId
);
SVnodeObj
*
pVnode
=
vmAcquireVnode
(
pMgmt
,
createReq
.
vgId
);
...
@@ -203,14 +228,16 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
...
@@ -203,14 +228,16 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
tFreeSCreateVnodeReq
(
&
createReq
);
tFreeSCreateVnodeReq
(
&
createReq
);
vmReleaseVnode
(
pMgmt
,
pVnode
);
vmReleaseVnode
(
pMgmt
,
pVnode
);
terrno
=
TSDB_CODE_NODE_ALREADY_DEPLOYED
;
terrno
=
TSDB_CODE_NODE_ALREADY_DEPLOYED
;
return
-
1
;
code
=
terrno
;
goto
_OVER
;
}
}
snprintf
(
path
,
TSDB_FILENAME_LEN
,
"vnode%svnode%d"
,
TD_DIRSEP
,
vnodeCfg
.
vgId
);
snprintf
(
path
,
TSDB_FILENAME_LEN
,
"vnode%svnode%d"
,
TD_DIRSEP
,
vnodeCfg
.
vgId
);
if
(
vnodeCreate
(
path
,
&
vnodeCfg
,
pMgmt
->
pTfs
)
<
0
)
{
if
(
vnodeCreate
(
path
,
&
vnodeCfg
,
pMgmt
->
pTfs
)
<
0
)
{
tFreeSCreateVnodeReq
(
&
createReq
);
tFreeSCreateVnodeReq
(
&
createReq
);
dError
(
"vgId:%d, failed to create vnode since %s"
,
createReq
.
vgId
,
terrstr
());
dError
(
"vgId:%d, failed to create vnode since %s"
,
createReq
.
vgId
,
terrstr
());
return
-
1
;
code
=
terrno
;
goto
_OVER
;
}
}
SVnode
*
pImpl
=
vnodeOpen
(
path
,
pMgmt
->
pTfs
,
pMgmt
->
msgCb
);
SVnode
*
pImpl
=
vnodeOpen
(
path
,
pMgmt
->
pTfs
,
pMgmt
->
msgCb
);
...
@@ -227,14 +254,11 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
...
@@ -227,14 +254,11 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
goto
_OVER
;
goto
_OVER
;
}
}
if
(
createReq
.
isTsma
)
{
code
=
vmTsmaProcessCreate
(
pImpl
,
&
createReq
);
SMsgHead
*
smaMsg
=
createReq
.
pTsma
;
if
(
code
!=
0
)
{
uint32_t
contLen
=
(
uint32_t
)(
htonl
(
smaMsg
->
contLen
)
-
sizeof
(
SMsgHead
));
if
(
vnodeProcessCreateTSma
(
pImpl
,
POINTER_SHIFT
(
smaMsg
,
sizeof
(
SMsgHead
)),
contLen
)
<
0
)
{
dError
(
"vgId:%d, failed to create tsma since %s"
,
createReq
.
vgId
,
terrstr
());
dError
(
"vgId:%d, failed to create tsma since %s"
,
createReq
.
vgId
,
terrstr
());
code
=
terrno
;
code
=
terrno
;
goto
_OVER
;
goto
_OVER
;
};
}
}
code
=
vnodeStart
(
pImpl
);
code
=
vnodeStart
(
pImpl
);
...
@@ -253,6 +277,8 @@ _OVER:
...
@@ -253,6 +277,8 @@ _OVER:
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
vnodeClose
(
pImpl
);
vnodeClose
(
pImpl
);
vnodeDestroy
(
path
,
pMgmt
->
pTfs
);
vnodeDestroy
(
path
,
pMgmt
->
pTfs
);
}
else
{
dInfo
(
"vgId:%d, vnode is created"
,
createReq
.
vgId
);
}
}
tFreeSCreateVnodeReq
(
&
createReq
);
tFreeSCreateVnodeReq
(
&
createReq
);
...
...
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
浏览文件 @
6b17c1ca
...
@@ -91,51 +91,52 @@ static void vmProcessFetchQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
...
@@ -91,51 +91,52 @@ static void vmProcessFetchQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
}
}
static
void
vmProcessWriteQueue
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
static
void
vmProcessWriteQueue
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
int32_t
code
=
0
;
SRpcMsg
*
pMsg
=
NULL
;
SVnodeObj
*
pVnode
=
pInfo
->
ahandle
;
SVnodeObj
*
pVnode
=
pInfo
->
ahandle
;
SArray
*
pArray
=
taosArrayInit
(
numOfMsgs
,
sizeof
(
SRpcMsg
*
));
int64_t
sync
=
vnodeGetSyncHandle
(
pVnode
->
pImpl
);
if
(
pArray
==
NULL
)
{
SArray
*
pArray
=
taosArrayInit
(
numOfMsgs
,
sizeof
(
SRpcMsg
**
));
dError
(
"failed to process %d msgs in write-queue since %s"
,
numOfMsgs
,
terrstr
());
return
;
}
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
for
(
int32_t
m
=
0
;
m
<
numOfMsgs
;
m
++
)
{
SRpcMsg
*
pMsg
=
NULL
;
if
(
taosGetQitem
(
qall
,
(
void
**
)
&
pMsg
)
==
0
)
continue
;
if
(
taosGetQitem
(
qall
,
(
void
**
)
&
pMsg
)
==
0
)
continue
;
dTrace
(
"vgId:%d, get msg:%p from vnode-write queue, type:%s"
,
pVnode
->
vgId
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
));
dTrace
(
"msg:%p, get from vnode-write queue"
,
pMsg
);
if
(
taosArrayPush
(
pArray
,
&
pMsg
)
==
NULL
)
{
if
(
taosArrayPush
(
pArray
,
&
pMsg
)
==
NULL
)
{
d
Trace
(
"msg:%p, failed to push to array since %s"
,
pMsg
,
terrstr
()
);
d
Error
(
"vgId:%d, failed to push msg:%p to vnode-write array"
,
pVnode
->
vgId
,
pMsg
);
vmSendRsp
(
pMsg
,
TSDB_CODE_OUT_OF_MEMORY
);
vmSendRsp
(
pMsg
,
TSDB_CODE_OUT_OF_MEMORY
);
}
}
}
}
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
pArray
);
i
++
)
{
for
(
int
32_t
m
=
0
;
m
<
taosArrayGetSize
(
pArray
);
m
++
)
{
SRpcMsg
*
pMsg
=
*
(
SRpcMsg
**
)
taosArrayGet
(
pArray
,
i
);
pMsg
=
*
(
SRpcMsg
**
)
taosArrayGet
(
pArray
,
m
);
SRpcMsg
rsp
=
{.
info
=
pMsg
->
info
}
;
code
=
vnodePreprocessReq
(
pVnode
->
pImpl
,
pMsg
)
;
vnodePreprocessReq
(
pVnode
->
pImpl
,
pMsg
);
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
continue
;
if
(
code
!=
0
)
{
dError
(
"vgId:%d, msg:%p failed to process since %s"
,
pVnode
->
vgId
,
pMsg
,
tstrerror
(
code
));
vmSendRsp
(
pMsg
,
code
);
continue
;
}
int32_t
ret
=
syncPropose
(
vnodeGetSyncHandle
(
pVnode
->
pImpl
),
pMsg
,
false
);
code
=
syncPropose
(
sync
,
pMsg
,
false
);
if
(
ret
==
TAOS_SYNC_PROPOSE_NOT_LEADER
)
{
if
(
code
==
TAOS_SYNC_PROPOSE_SUCCESS
)
{
dTrace
(
"msg:%p, is redirect since not leader, vgId:%d "
,
pMsg
,
pVnode
->
vgId
);
continue
;
rsp
.
code
=
TSDB_CODE_RPC_REDIRECT
;
}
else
if
(
code
==
TAOS_SYNC_PROPOSE_NOT_LEADER
)
{
SEpSet
newEpSet
;
dTrace
(
"vgId:%d, msg:%p is redirect since not leader"
,
pVnode
->
vgId
,
pMsg
);
syncGetEpSet
(
vnodeGetSyncHandle
(
pVnode
->
pImpl
),
&
newEpSet
);
SEpSet
newEpSet
=
{
0
};
syncGetEpSet
(
sync
,
&
newEpSet
);
newEpSet
.
inUse
=
(
newEpSet
.
inUse
+
1
)
%
newEpSet
.
numOfEps
;
newEpSet
.
inUse
=
(
newEpSet
.
inUse
+
1
)
%
newEpSet
.
numOfEps
;
SRpcMsg
rsp
=
{.
code
=
TSDB_CODE_RPC_REDIRECT
,
.
info
=
pMsg
->
info
};
tmsgSendRedirectRsp
(
&
rsp
,
&
newEpSet
);
tmsgSendRedirectRsp
(
&
rsp
,
&
newEpSet
);
}
else
if
(
ret
==
TAOS_SYNC_PROPOSE_OTHER_ERROR
)
{
rsp
.
code
=
TSDB_CODE_SYN_INTERNAL_ERROR
;
tmsgSendRsp
(
&
rsp
);
}
else
if
(
ret
==
TAOS_SYNC_PROPOSE_SUCCESS
)
{
// send response in applyQ
}
else
{
}
else
{
assert
(
0
);
dError
(
"vgId:%d, msg:%p failed to process since %s"
,
pVnode
->
vgId
,
pMsg
,
tstrerror
(
code
));
vmSendRsp
(
pMsg
,
code
);
}
}
}
}
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
i
++
)
{
SRpcMsg
*
pMsg
=
*
(
SRpcMsg
**
)
taosArrayGet
(
pArray
,
i
);
pMsg
=
*
(
SRpcMsg
**
)
taosArrayGet
(
pArray
,
i
);
dTrace
(
"
msg:%p, is freed"
,
pMsg
);
dTrace
(
"
vgId:%d, msg:%p, is freed"
,
pVnode
->
vgId
,
pMsg
);
rpcFreeCont
(
pMsg
->
pCont
);
rpcFreeCont
(
pMsg
->
pCont
);
taosFreeQitem
(
pMsg
);
taosFreeQitem
(
pMsg
);
}
}
...
...
source/dnode/mgmt/node_mgmt/src/dmEnv.c
浏览文件 @
6b17c1ca
...
@@ -50,26 +50,26 @@ static int32_t dmInitMonitor() {
...
@@ -50,26 +50,26 @@ static int32_t dmInitMonitor() {
}
}
int32_t
dmInit
(
int8_t
rtype
)
{
int32_t
dmInit
(
int8_t
rtype
)
{
dInfo
(
"start to init env"
);
dInfo
(
"start to init
dnode
env"
);
if
(
dmCheckRepeatInit
(
dmInstance
())
!=
0
)
return
-
1
;
if
(
dmCheckRepeatInit
(
dmInstance
())
!=
0
)
return
-
1
;
if
(
dmInitSystem
()
!=
0
)
return
-
1
;
if
(
dmInitSystem
()
!=
0
)
return
-
1
;
if
(
dmInitMonitor
()
!=
0
)
return
-
1
;
if
(
dmInitMonitor
()
!=
0
)
return
-
1
;
if
(
dmInitDnode
(
dmInstance
(),
rtype
)
!=
0
)
return
-
1
;
if
(
dmInitDnode
(
dmInstance
(),
rtype
)
!=
0
)
return
-
1
;
dInfo
(
"env is initialized"
);
dInfo
(
"
dnode
env is initialized"
);
return
0
;
return
0
;
}
}
static
int32_t
dmCheckRepeatCleanup
(
SDnode
*
pDnode
)
{
static
int32_t
dmCheckRepeatCleanup
(
SDnode
*
pDnode
)
{
if
(
atomic_val_compare_exchange_8
(
&
pDnode
->
once
,
DND_ENV_READY
,
DND_ENV_CLEANUP
)
!=
DND_ENV_READY
)
{
if
(
atomic_val_compare_exchange_8
(
&
pDnode
->
once
,
DND_ENV_READY
,
DND_ENV_CLEANUP
)
!=
DND_ENV_READY
)
{
dError
(
"env is already cleaned up"
);
dError
(
"
dnode
env is already cleaned up"
);
return
-
1
;
return
-
1
;
}
}
return
0
;
return
0
;
}
}
void
dmCleanup
()
{
void
dmCleanup
()
{
dDebug
(
"start to cleanup env"
);
dDebug
(
"start to cleanup
dnode
env"
);
SDnode
*
pDnode
=
dmInstance
();
SDnode
*
pDnode
=
dmInstance
();
if
(
dmCheckRepeatCleanup
(
pDnode
)
!=
0
)
return
;
if
(
dmCheckRepeatCleanup
(
pDnode
)
!=
0
)
return
;
dmCleanupDnode
(
pDnode
);
dmCleanupDnode
(
pDnode
);
...
@@ -79,7 +79,7 @@ void dmCleanup() {
...
@@ -79,7 +79,7 @@ void dmCleanup() {
udfcClose
();
udfcClose
();
udfStopUdfd
();
udfStopUdfd
();
taosStopCacheRefreshWorker
();
taosStopCacheRefreshWorker
();
dInfo
(
"env is cleaned up"
);
dInfo
(
"
dnode
env is cleaned up"
);
taosCloseLog
();
taosCloseLog
();
taosCleanupCfg
();
taosCleanupCfg
();
...
...
source/dnode/mgmt/node_util/src/dmEps.c
浏览文件 @
6b17c1ca
...
@@ -148,7 +148,6 @@ int32_t dmReadEps(SDnodeData *pData) {
...
@@ -148,7 +148,6 @@ int32_t dmReadEps(SDnodeData *pData) {
code
=
0
;
code
=
0
;
dDebug
(
"succcessed to read file %s"
,
file
);
dDebug
(
"succcessed to read file %s"
,
file
);
dmPrintEps
(
pData
);
_OVER:
_OVER:
if
(
content
!=
NULL
)
taosMemoryFree
(
content
);
if
(
content
!=
NULL
)
taosMemoryFree
(
content
);
...
@@ -162,6 +161,7 @@ _OVER:
...
@@ -162,6 +161,7 @@ _OVER:
taosArrayPush
(
pData
->
dnodeEps
,
&
dnodeEp
);
taosArrayPush
(
pData
->
dnodeEps
,
&
dnodeEp
);
}
}
dDebug
(
"reset dnode list on startup"
);
dmResetEps
(
pData
,
pData
->
dnodeEps
);
dmResetEps
(
pData
,
pData
->
dnodeEps
);
if
(
dmIsEpChanged
(
pData
,
pData
->
dnodeId
,
tsLocalEp
))
{
if
(
dmIsEpChanged
(
pData
,
pData
->
dnodeId
,
tsLocalEp
))
{
...
@@ -236,11 +236,13 @@ void dmUpdateEps(SDnodeData *pData, SArray *eps) {
...
@@ -236,11 +236,13 @@ void dmUpdateEps(SDnodeData *pData, SArray *eps) {
int32_t
numOfEpsOld
=
(
int32_t
)
taosArrayGetSize
(
pData
->
dnodeEps
);
int32_t
numOfEpsOld
=
(
int32_t
)
taosArrayGetSize
(
pData
->
dnodeEps
);
if
(
numOfEps
!=
numOfEpsOld
)
{
if
(
numOfEps
!=
numOfEpsOld
)
{
dDebug
(
"new dnode list get from mnode"
);
dmResetEps
(
pData
,
eps
);
dmResetEps
(
pData
,
eps
);
dmWriteEps
(
pData
);
dmWriteEps
(
pData
);
}
else
{
}
else
{
int32_t
size
=
numOfEps
*
sizeof
(
SDnodeEp
);
int32_t
size
=
numOfEps
*
sizeof
(
SDnodeEp
);
if
(
memcmp
(
pData
->
dnodeEps
->
pData
,
eps
->
pData
,
size
)
!=
0
)
{
if
(
memcmp
(
pData
->
dnodeEps
->
pData
,
eps
->
pData
,
size
)
!=
0
)
{
dDebug
(
"new dnode list get from mnode"
);
dmResetEps
(
pData
,
eps
);
dmResetEps
(
pData
,
eps
);
dmWriteEps
(
pData
);
dmWriteEps
(
pData
);
}
}
...
@@ -282,7 +284,7 @@ static void dmResetEps(SDnodeData *pData, SArray *dnodeEps) {
...
@@ -282,7 +284,7 @@ static void dmResetEps(SDnodeData *pData, SArray *dnodeEps) {
static
void
dmPrintEps
(
SDnodeData
*
pData
)
{
static
void
dmPrintEps
(
SDnodeData
*
pData
)
{
int32_t
numOfEps
=
(
int32_t
)
taosArrayGetSize
(
pData
->
dnodeEps
);
int32_t
numOfEps
=
(
int32_t
)
taosArrayGetSize
(
pData
->
dnodeEps
);
dDebug
(
"print dnode
ep
list, num:%d"
,
numOfEps
);
dDebug
(
"print dnode list, num:%d"
,
numOfEps
);
for
(
int32_t
i
=
0
;
i
<
numOfEps
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
numOfEps
;
i
++
)
{
SDnodeEp
*
pEp
=
taosArrayGet
(
pData
->
dnodeEps
,
i
);
SDnodeEp
*
pEp
=
taosArrayGet
(
pData
->
dnodeEps
,
i
);
dDebug
(
"dnode:%d, fqdn:%s port:%u is_mnode:%d"
,
pEp
->
id
,
pEp
->
ep
.
fqdn
,
pEp
->
ep
.
port
,
pEp
->
isMnode
);
dDebug
(
"dnode:%d, fqdn:%s port:%u is_mnode:%d"
,
pEp
->
id
,
pEp
->
ep
.
fqdn
,
pEp
->
ep
.
port
,
pEp
->
isMnode
);
...
...
source/dnode/mgmt/node_util/src/dmFile.c
浏览文件 @
6b17c1ca
...
@@ -135,7 +135,7 @@ TdFilePtr dmCheckRunning(const char *dataDir) {
...
@@ -135,7 +135,7 @@ TdFilePtr dmCheckRunning(const char *dataDir) {
return
NULL
;
return
NULL
;
}
}
dDebug
(
"
file:%s is locked
"
,
filepath
);
dDebug
(
"
lock file:%s to prevent repeated starts
"
,
filepath
);
return
pFile
;
return
pFile
;
}
}
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
6b17c1ca
...
@@ -255,6 +255,7 @@ typedef struct {
...
@@ -255,6 +255,7 @@ typedef struct {
int8_t
hashMethod
;
// default is 1
int8_t
hashMethod
;
// default is 1
int32_t
numOfRetensions
;
int32_t
numOfRetensions
;
SArray
*
pRetensions
;
SArray
*
pRetensions
;
int8_t
schemaless
;
}
SDbCfg
;
}
SDbCfg
;
typedef
struct
{
typedef
struct
{
...
...
source/dnode/mnode/impl/inc/mndTopic.h
浏览文件 @
6b17c1ca
...
@@ -37,6 +37,8 @@ const char *mndTopicGetShowName(const char topic[TSDB_TOPIC_FNAME_LEN]);
...
@@ -37,6 +37,8 @@ const char *mndTopicGetShowName(const char topic[TSDB_TOPIC_FNAME_LEN]);
int32_t
mndSetTopicCommitLogs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SMqTopicObj
*
pTopic
);
int32_t
mndSetTopicCommitLogs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SMqTopicObj
*
pTopic
);
bool
mndCheckColAndTagModifiable
(
SMnode
*
pMnode
,
int64_t
suid
,
const
SArray
*
colIds
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
6b17c1ca
...
@@ -115,6 +115,7 @@ static SSdbRaw *mndDbActionEncode(SDbObj *pDb) {
...
@@ -115,6 +115,7 @@ static SSdbRaw *mndDbActionEncode(SDbObj *pDb) {
SDB_SET_INT8
(
pRaw
,
dataPos
,
pRetension
->
freqUnit
,
_OVER
)
SDB_SET_INT8
(
pRaw
,
dataPos
,
pRetension
->
freqUnit
,
_OVER
)
SDB_SET_INT8
(
pRaw
,
dataPos
,
pRetension
->
keepUnit
,
_OVER
)
SDB_SET_INT8
(
pRaw
,
dataPos
,
pRetension
->
keepUnit
,
_OVER
)
}
}
SDB_SET_INT8
(
pRaw
,
dataPos
,
pDb
->
cfg
.
schemaless
,
_OVER
)
SDB_SET_RESERVE
(
pRaw
,
dataPos
,
DB_RESERVE_SIZE
,
_OVER
)
SDB_SET_RESERVE
(
pRaw
,
dataPos
,
DB_RESERVE_SIZE
,
_OVER
)
SDB_SET_DATALEN
(
pRaw
,
dataPos
,
_OVER
)
SDB_SET_DATALEN
(
pRaw
,
dataPos
,
_OVER
)
...
@@ -192,6 +193,7 @@ static SSdbRow *mndDbActionDecode(SSdbRaw *pRaw) {
...
@@ -192,6 +193,7 @@ static SSdbRow *mndDbActionDecode(SSdbRaw *pRaw) {
}
}
}
}
}
}
SDB_GET_INT8
(
pRaw
,
dataPos
,
&
pDb
->
cfg
.
schemaless
,
_OVER
)
SDB_GET_RESERVE
(
pRaw
,
dataPos
,
DB_RESERVE_SIZE
,
_OVER
)
SDB_GET_RESERVE
(
pRaw
,
dataPos
,
DB_RESERVE_SIZE
,
_OVER
)
taosInitRWLatch
(
&
pDb
->
lock
);
taosInitRWLatch
(
&
pDb
->
lock
);
...
@@ -380,6 +382,7 @@ static int32_t mndCheckDbCfg(SMnode *pMnode, SDbCfg *pCfg) {
...
@@ -380,6 +382,7 @@ static int32_t mndCheckDbCfg(SMnode *pMnode, SDbCfg *pCfg) {
if
(
pCfg
->
replications
<
TSDB_MIN_DB_REPLICA
||
pCfg
->
replications
>
TSDB_MAX_DB_REPLICA
)
return
-
1
;
if
(
pCfg
->
replications
<
TSDB_MIN_DB_REPLICA
||
pCfg
->
replications
>
TSDB_MAX_DB_REPLICA
)
return
-
1
;
if
(
pCfg
->
replications
!=
1
&&
pCfg
->
replications
!=
3
)
return
-
1
;
if
(
pCfg
->
replications
!=
1
&&
pCfg
->
replications
!=
3
)
return
-
1
;
if
(
pCfg
->
strict
<
TSDB_DB_STRICT_OFF
||
pCfg
->
strict
>
TSDB_DB_STRICT_ON
)
return
-
1
;
if
(
pCfg
->
strict
<
TSDB_DB_STRICT_OFF
||
pCfg
->
strict
>
TSDB_DB_STRICT_ON
)
return
-
1
;
if
(
pCfg
->
schemaless
<
TSDB_DB_SCHEMALESS_OFF
||
pCfg
->
schemaless
>
TSDB_DB_SCHEMALESS_ON
)
return
-
1
;
if
(
pCfg
->
cacheLastRow
<
TSDB_MIN_DB_CACHE_LAST_ROW
||
pCfg
->
cacheLastRow
>
TSDB_MAX_DB_CACHE_LAST_ROW
)
return
-
1
;
if
(
pCfg
->
cacheLastRow
<
TSDB_MIN_DB_CACHE_LAST_ROW
||
pCfg
->
cacheLastRow
>
TSDB_MAX_DB_CACHE_LAST_ROW
)
return
-
1
;
if
(
pCfg
->
hashMethod
!=
1
)
return
-
1
;
if
(
pCfg
->
hashMethod
!=
1
)
return
-
1
;
if
(
pCfg
->
replications
>
mndGetDnodeSize
(
pMnode
))
{
if
(
pCfg
->
replications
>
mndGetDnodeSize
(
pMnode
))
{
...
@@ -411,6 +414,8 @@ static void mndSetDefaultDbCfg(SDbCfg *pCfg) {
...
@@ -411,6 +414,8 @@ static void mndSetDefaultDbCfg(SDbCfg *pCfg) {
if
(
pCfg
->
strict
<
0
)
pCfg
->
strict
=
TSDB_DEFAULT_DB_STRICT
;
if
(
pCfg
->
strict
<
0
)
pCfg
->
strict
=
TSDB_DEFAULT_DB_STRICT
;
if
(
pCfg
->
cacheLastRow
<
0
)
pCfg
->
cacheLastRow
=
TSDB_DEFAULT_CACHE_LAST_ROW
;
if
(
pCfg
->
cacheLastRow
<
0
)
pCfg
->
cacheLastRow
=
TSDB_DEFAULT_CACHE_LAST_ROW
;
if
(
pCfg
->
numOfRetensions
<
0
)
pCfg
->
numOfRetensions
=
0
;
if
(
pCfg
->
numOfRetensions
<
0
)
pCfg
->
numOfRetensions
=
0
;
if
(
pCfg
->
schemaless
<
0
)
pCfg
->
schemaless
=
TSDB_DB_SCHEMALESS_OFF
;
}
}
static
int32_t
mndSetCreateDbRedoLogs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SVgObj
*
pVgroups
)
{
static
int32_t
mndSetCreateDbRedoLogs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SVgObj
*
pVgroups
)
{
...
@@ -521,6 +526,7 @@ static int32_t mndCreateDb(SMnode *pMnode, SRpcMsg *pReq, SCreateDbReq *pCreate,
...
@@ -521,6 +526,7 @@ static int32_t mndCreateDb(SMnode *pMnode, SRpcMsg *pReq, SCreateDbReq *pCreate,
.
strict
=
pCreate
->
strict
,
.
strict
=
pCreate
->
strict
,
.
cacheLastRow
=
pCreate
->
cacheLastRow
,
.
cacheLastRow
=
pCreate
->
cacheLastRow
,
.
hashMethod
=
1
,
.
hashMethod
=
1
,
.
schemaless
=
pCreate
->
schemaless
,
};
};
dbObj
.
cfg
.
numOfRetensions
=
pCreate
->
numOfRetensions
;
dbObj
.
cfg
.
numOfRetensions
=
pCreate
->
numOfRetensions
;
...
@@ -899,6 +905,7 @@ static int32_t mndProcessGetDbCfgReq(SRpcMsg *pReq) {
...
@@ -899,6 +905,7 @@ static int32_t mndProcessGetDbCfgReq(SRpcMsg *pReq) {
cfgRsp
.
cacheLastRow
=
pDb
->
cfg
.
cacheLastRow
;
cfgRsp
.
cacheLastRow
=
pDb
->
cfg
.
cacheLastRow
;
cfgRsp
.
numOfRetensions
=
pDb
->
cfg
.
numOfRetensions
;
cfgRsp
.
numOfRetensions
=
pDb
->
cfg
.
numOfRetensions
;
cfgRsp
.
pRetensions
=
pDb
->
cfg
.
pRetensions
;
cfgRsp
.
pRetensions
=
pDb
->
cfg
.
pRetensions
;
cfgRsp
.
schemaless
=
pDb
->
cfg
.
schemaless
;
int32_t
contLen
=
tSerializeSDbCfgRsp
(
NULL
,
0
,
&
cfgRsp
);
int32_t
contLen
=
tSerializeSDbCfgRsp
(
NULL
,
0
,
&
cfgRsp
);
void
*
pRsp
=
rpcMallocCont
(
contLen
);
void
*
pRsp
=
rpcMallocCont
(
contLen
);
...
@@ -1542,8 +1549,11 @@ static void dumpDbInfoData(SSDataBlock *pBlock, SDbObj *pDb, SShowObj *pShow, in
...
@@ -1542,8 +1549,11 @@ static void dumpDbInfoData(SSDataBlock *pBlock, SDbObj *pDb, SShowObj *pShow, in
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
numOfStables
,
false
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
numOfStables
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
statusB
,
false
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
statusB
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
schemaless
,
false
);
}
}
}
}
...
...
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
6b17c1ca
...
@@ -655,7 +655,7 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
...
@@ -655,7 +655,7 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
b1
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
b1
,
false
);
const
char
*
roles
=
"
OFFLINE
"
;
const
char
*
roles
=
"
offline
"
;
if
(
pObj
->
id
==
pMnode
->
selfDnodeId
)
{
if
(
pObj
->
id
==
pMnode
->
selfDnodeId
)
{
roles
=
syncStr
(
TAOS_SYNC_STATE_LEADER
);
roles
=
syncStr
(
TAOS_SYNC_STATE_LEADER
);
}
}
...
@@ -667,9 +667,9 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
...
@@ -667,9 +667,9 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
b2
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
b2
,
false
);
const
char
*
status
=
"
READY
"
;
const
char
*
status
=
"
ready
"
;
if
(
objStatus
==
SDB_STATUS_CREATING
)
status
=
"
CREATING
"
;
if
(
objStatus
==
SDB_STATUS_CREATING
)
status
=
"
creating
"
;
if
(
objStatus
==
SDB_STATUS_DROPPING
)
status
=
"
DROPPING
"
;
if
(
objStatus
==
SDB_STATUS_DROPPING
)
status
=
"
dropping
"
;
char
b3
[
9
+
VARSTR_HEADER_SIZE
]
=
{
0
};
char
b3
[
9
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
b3
,
status
,
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
STR_WITH_MAXSIZE_TO_VARSTR
(
b3
,
status
,
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
...
...
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
6b17c1ca
...
@@ -390,7 +390,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
...
@@ -390,7 +390,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
mInfo
(
"rebalance calculation completed, rebalanced vg:"
);
mInfo
(
"rebalance calculation completed, rebalanced vg:"
);
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pOutput
->
rebVgs
);
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pOutput
->
rebVgs
);
i
++
)
{
SMqRebOutputVg
*
pOutputRebVg
=
taosArrayGet
(
pOutput
->
rebVgs
,
i
);
SMqRebOutputVg
*
pOutputRebVg
=
taosArrayGet
(
pOutput
->
rebVgs
,
i
);
mInfo
(
"vgId:%d moved from consumer %"
PRId64
" to consumer %"
PRId64
,
pOutputRebVg
->
pVgEp
->
vgId
,
mInfo
(
"vgId:%d
,
moved from consumer %"
PRId64
" to consumer %"
PRId64
,
pOutputRebVg
->
pVgEp
->
vgId
,
pOutputRebVg
->
oldConsumerId
,
pOutputRebVg
->
newConsumerId
);
pOutputRebVg
->
oldConsumerId
,
pOutputRebVg
->
newConsumerId
);
}
}
...
...
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
6b17c1ca
...
@@ -70,6 +70,56 @@ const char *mndTopicGetShowName(const char topic[TSDB_TOPIC_FNAME_LEN]) {
...
@@ -70,6 +70,56 @@ const char *mndTopicGetShowName(const char topic[TSDB_TOPIC_FNAME_LEN]) {
return
strchr
(
topic
,
'.'
)
+
1
;
return
strchr
(
topic
,
'.'
)
+
1
;
}
}
bool
mndCheckColAndTagModifiable
(
SMnode
*
pMnode
,
int64_t
suid
,
const
SArray
*
colAndTagIds
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
void
*
pIter
=
NULL
;
bool
found
=
false
;
while
(
1
)
{
SMqTopicObj
*
pTopic
=
NULL
;
pIter
=
sdbFetch
(
pSdb
,
SDB_TOPIC
,
pIter
,
(
void
**
)
&
pTopic
);
if
(
pIter
==
NULL
)
break
;
if
(
pTopic
->
subType
!=
TOPIC_SUB_TYPE__COLUMN
)
{
sdbRelease
(
pSdb
,
pTopic
);
continue
;
}
SNode
*
pAst
=
NULL
;
if
(
nodesStringToNode
(
pTopic
->
ast
,
&
pAst
)
!=
0
)
{
ASSERT
(
0
);
return
false
;
}
SHashObj
*
pColHash
=
NULL
;
SNodeList
*
pNodeList
;
nodesCollectColumns
((
SSelectStmt
*
)
pAst
,
SQL_CLAUSE_FROM
,
NULL
,
COLLECT_COL_TYPE_ALL
,
&
pNodeList
);
SNode
*
pNode
=
NULL
;
FOREACH
(
pNode
,
pNodeList
)
{
SColumnNode
*
pCol
=
(
SColumnNode
*
)
pNode
;
if
(
pCol
->
tableId
!=
suid
)
goto
NEXT
;
if
(
pColHash
==
NULL
)
{
pColHash
=
taosHashInit
(
0
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_SMALLINT
),
false
,
HASH_NO_LOCK
);
}
if
(
pCol
->
colId
>
0
)
{
taosHashPut
(
pColHash
,
&
pCol
->
colId
,
sizeof
(
int16_t
),
NULL
,
0
);
}
}
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
colAndTagIds
);
i
++
)
{
int16_t
*
pColId
=
taosArrayGet
(
colAndTagIds
,
i
);
if
(
taosHashGet
(
pColHash
,
pColId
,
sizeof
(
int16_t
))
!=
NULL
)
{
found
=
true
;
goto
NEXT
;
}
}
NEXT:
sdbRelease
(
pSdb
,
pTopic
);
nodesDestroyNode
(
pAst
);
if
(
found
)
return
false
;
}
return
true
;
}
SSdbRaw
*
mndTopicActionEncode
(
SMqTopicObj
*
pTopic
)
{
SSdbRaw
*
mndTopicActionEncode
(
SMqTopicObj
*
pTopic
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
6b17c1ca
...
@@ -705,7 +705,7 @@ static int32_t mndRetrieveVgroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
...
@@ -705,7 +705,7 @@ static int32_t mndRetrieveVgroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
}
}
char
buf1
[
20
]
=
{
0
};
char
buf1
[
20
]
=
{
0
};
const
char
*
role
=
online
?
syncStr
(
pVgroup
->
vnodeGid
[
i
].
role
)
:
"
OFFLINE
"
;
const
char
*
role
=
online
?
syncStr
(
pVgroup
->
vnodeGid
[
i
].
role
)
:
"
offline
"
;
STR_WITH_MAXSIZE_TO_VARSTR
(
buf1
,
role
,
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
STR_WITH_MAXSIZE_TO_VARSTR
(
buf1
,
role
,
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
...
...
source/dnode/vnode/CMakeLists.txt
浏览文件 @
6b17c1ca
...
@@ -32,7 +32,7 @@ target_sources(
...
@@ -32,7 +32,7 @@ target_sources(
"src/sma/smaEnv.c"
"src/sma/smaEnv.c"
"src/sma/smaOpen.c"
"src/sma/smaOpen.c"
"src/sma/smaRollup.c"
"src/sma/smaRollup.c"
"src/sma/smaTimeRange.c"
"src/sma/smaTimeRange
2
.c"
# tsdb
# tsdb
"src/tsdb/tsdbCommit.c"
"src/tsdb/tsdbCommit.c"
...
...
source/dnode/vnode/inc/vnode.h
浏览文件 @
6b17c1ca
...
@@ -147,6 +147,9 @@ bool tqNextDataBlockFilterOut(STqReadHandle *pHandle, SHashObj *filterOutUids
...
@@ -147,6 +147,9 @@ bool tqNextDataBlockFilterOut(STqReadHandle *pHandle, SHashObj *filterOutUids
int32_t
tqRetrieveDataBlock
(
SArray
**
ppCols
,
STqReadHandle
*
pHandle
,
uint64_t
*
pGroupId
,
uint64_t
*
pUid
,
int32_t
tqRetrieveDataBlock
(
SArray
**
ppCols
,
STqReadHandle
*
pHandle
,
uint64_t
*
pGroupId
,
uint64_t
*
pUid
,
int32_t
*
pNumOfRows
,
int16_t
*
pNumOfCols
);
int32_t
*
pNumOfRows
,
int16_t
*
pNumOfCols
);
// sma
int32_t
smaGetTSmaDays
(
SVnodeCfg
*
pCfg
,
void
*
pCont
,
uint32_t
contLen
,
int32_t
*
days
);
// need to reposition
// need to reposition
// structs
// structs
...
...
source/dnode/vnode/src/inc/meta.h
浏览文件 @
6b17c1ca
...
@@ -28,12 +28,12 @@ typedef struct SMetaDB SMetaDB;
...
@@ -28,12 +28,12 @@ typedef struct SMetaDB SMetaDB;
// metaDebug ==================
// metaDebug ==================
// clang-format off
// clang-format off
#define metaFatal(...) do { if (metaDebugFlag & DEBUG_FATAL) { taosPrintLog("M
E
TA FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} while(0)
#define metaFatal(...) do { if (metaDebugFlag & DEBUG_FATAL) { taosPrintLog("MTA FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} while(0)
#define metaError(...) do { if (metaDebugFlag & DEBUG_ERROR) { taosPrintLog("M
E
TA ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while(0)
#define metaError(...) do { if (metaDebugFlag & DEBUG_ERROR) { taosPrintLog("MTA ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while(0)
#define metaWarn(...) do { if (metaDebugFlag & DEBUG_WARN) { taosPrintLog("M
E
TA WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} while(0)
#define metaWarn(...) do { if (metaDebugFlag & DEBUG_WARN) { taosPrintLog("MTA WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} while(0)
#define metaInfo(...) do { if (metaDebugFlag & DEBUG_INFO) { taosPrintLog("M
E
TA ", DEBUG_INFO, 255, __VA_ARGS__); }} while(0)
#define metaInfo(...) do { if (metaDebugFlag & DEBUG_INFO) { taosPrintLog("MTA ", DEBUG_INFO, 255, __VA_ARGS__); }} while(0)
#define metaDebug(...) do { if (metaDebugFlag & DEBUG_DEBUG) { taosPrintLog("M
E
TA ", DEBUG_DEBUG, metaDebugFlag, __VA_ARGS__); }} while(0)
#define metaDebug(...) do { if (metaDebugFlag & DEBUG_DEBUG) { taosPrintLog("MTA ", DEBUG_DEBUG, metaDebugFlag, __VA_ARGS__); }} while(0)
#define metaTrace(...) do { if (metaDebugFlag & DEBUG_TRACE) { taosPrintLog("M
E
TA ", DEBUG_TRACE, metaDebugFlag, __VA_ARGS__); }} while(0)
#define metaTrace(...) do { if (metaDebugFlag & DEBUG_TRACE) { taosPrintLog("MTA ", DEBUG_TRACE, metaDebugFlag, __VA_ARGS__); }} while(0)
// clang-format on
// clang-format on
// metaOpen ==================
// metaOpen ==================
...
...
source/dnode/vnode/src/inc/sma.h
浏览文件 @
6b17c1ca
...
@@ -223,6 +223,8 @@ int32_t tdUpdateExpiredWindowImpl(SSma *pSma, const SSubmitReq *pMsg, int64_t ve
...
@@ -223,6 +223,8 @@ int32_t tdUpdateExpiredWindowImpl(SSma *pSma, const SSubmitReq *pMsg, int64_t ve
// TODO: This is the basic params, and should wrap the params to a queryHandle.
// TODO: This is the basic params, and should wrap the params to a queryHandle.
int32_t
tdGetTSmaDataImpl
(
SSma
*
pSma
,
char
*
pData
,
int64_t
indexUid
,
TSKEY
querySKey
,
int32_t
nMaxResult
);
int32_t
tdGetTSmaDataImpl
(
SSma
*
pSma
,
char
*
pData
,
int64_t
indexUid
,
TSKEY
querySKey
,
int32_t
nMaxResult
);
int32_t
tdGetTSmaDaysImpl
(
SVnodeCfg
*
pCfg
,
void
*
pCont
,
uint32_t
contLen
,
int32_t
*
days
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/dnode/vnode/src/inc/vnd.h
浏览文件 @
6b17c1ca
...
@@ -84,7 +84,7 @@ int32_t vnodeAsyncCommit(SVnode* pVnode);
...
@@ -84,7 +84,7 @@ int32_t vnodeAsyncCommit(SVnode* pVnode);
int32_t
vnodeSyncOpen
(
SVnode
*
pVnode
,
char
*
path
);
int32_t
vnodeSyncOpen
(
SVnode
*
pVnode
,
char
*
path
);
void
vnodeSyncStart
(
SVnode
*
pVnode
);
void
vnodeSyncStart
(
SVnode
*
pVnode
);
void
vnodeSyncClose
(
SVnode
*
pVnode
);
void
vnodeSyncClose
(
SVnode
*
pVnode
);
void
vnodeSyncAlter
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
);
int32_t
vnodeSyncAlter
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/dnode/vnode/src/meta/metaOpen.c
浏览文件 @
6b17c1ca
...
@@ -53,42 +53,42 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) {
...
@@ -53,42 +53,42 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) {
// open env
// open env
ret
=
tdbOpen
(
pMeta
->
path
,
pVnode
->
config
.
szPage
,
pVnode
->
config
.
szCache
,
&
pMeta
->
pEnv
);
ret
=
tdbOpen
(
pMeta
->
path
,
pVnode
->
config
.
szPage
,
pVnode
->
config
.
szCache
,
&
pMeta
->
pEnv
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
metaError
(
"vgId:%d failed to open meta env since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
metaError
(
"vgId:%d
,
failed to open meta env since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
// open pTbDb
// open pTbDb
ret
=
tdbTbOpen
(
"table.db"
,
sizeof
(
STbDbKey
),
-
1
,
tbDbKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pTbDb
);
ret
=
tdbTbOpen
(
"table.db"
,
sizeof
(
STbDbKey
),
-
1
,
tbDbKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pTbDb
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
metaError
(
"vgId:%d failed to open meta table db since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
metaError
(
"vgId:%d
,
failed to open meta table db since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
// open pSkmDb
// open pSkmDb
ret
=
tdbTbOpen
(
"schema.db"
,
sizeof
(
SSkmDbKey
),
-
1
,
skmDbKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pSkmDb
);
ret
=
tdbTbOpen
(
"schema.db"
,
sizeof
(
SSkmDbKey
),
-
1
,
skmDbKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pSkmDb
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
metaError
(
"vgId:%d failed to open meta schema db since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
metaError
(
"vgId:%d
,
failed to open meta schema db since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
// open pUidIdx
// open pUidIdx
ret
=
tdbTbOpen
(
"uid.idx"
,
sizeof
(
tb_uid_t
),
sizeof
(
int64_t
),
uidIdxKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pUidIdx
);
ret
=
tdbTbOpen
(
"uid.idx"
,
sizeof
(
tb_uid_t
),
sizeof
(
int64_t
),
uidIdxKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pUidIdx
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
metaError
(
"vgId:%d failed to open meta uid idx since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
metaError
(
"vgId:%d
,
failed to open meta uid idx since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
// open pNameIdx
// open pNameIdx
ret
=
tdbTbOpen
(
"name.idx"
,
-
1
,
sizeof
(
tb_uid_t
),
NULL
,
pMeta
->
pEnv
,
&
pMeta
->
pNameIdx
);
ret
=
tdbTbOpen
(
"name.idx"
,
-
1
,
sizeof
(
tb_uid_t
),
NULL
,
pMeta
->
pEnv
,
&
pMeta
->
pNameIdx
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
metaError
(
"vgId:%d failed to open meta name index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
metaError
(
"vgId:%d
,
failed to open meta name index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
// open pCtbIdx
// open pCtbIdx
ret
=
tdbTbOpen
(
"ctb.idx"
,
sizeof
(
SCtbIdxKey
),
0
,
ctbIdxKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pCtbIdx
);
ret
=
tdbTbOpen
(
"ctb.idx"
,
sizeof
(
SCtbIdxKey
),
0
,
ctbIdxKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pCtbIdx
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
metaError
(
"vgId:%d failed to open meta child table index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
metaError
(
"vgId:%d
,
failed to open meta child table index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
...
@@ -100,14 +100,14 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) {
...
@@ -100,14 +100,14 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) {
taosMkDir
(
indexFullPath
);
taosMkDir
(
indexFullPath
);
ret
=
indexOpen
(
indexOptsCreate
(),
indexFullPath
,
(
SIndex
**
)
&
pMeta
->
pTagIvtIdx
);
ret
=
indexOpen
(
indexOptsCreate
(),
indexFullPath
,
(
SIndex
**
)
&
pMeta
->
pTagIvtIdx
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
metaError
(
"vgId:%d failed to open meta tag index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
metaError
(
"vgId:%d
,
failed to open meta tag index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
#else
#else
ret
=
tdbTbOpen
(
"tag.idx"
,
-
1
,
0
,
tagIdxKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pTagIdx
);
ret
=
tdbTbOpen
(
"tag.idx"
,
-
1
,
0
,
tagIdxKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pTagIdx
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
metaError
(
"vgId:%d failed to open meta tag index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
metaError
(
"vgId:%d
,
failed to open meta tag index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
#endif
#endif
...
@@ -115,24 +115,24 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) {
...
@@ -115,24 +115,24 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) {
// open pTtlIdx
// open pTtlIdx
ret
=
tdbTbOpen
(
"ttl.idx"
,
sizeof
(
STtlIdxKey
),
0
,
ttlIdxKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pTtlIdx
);
ret
=
tdbTbOpen
(
"ttl.idx"
,
sizeof
(
STtlIdxKey
),
0
,
ttlIdxKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pTtlIdx
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
metaError
(
"vgId:%d failed to open meta ttl index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
metaError
(
"vgId:%d
,
failed to open meta ttl index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
// open pSmaIdx
// open pSmaIdx
ret
=
tdbTbOpen
(
"sma.idx"
,
sizeof
(
SSmaIdxKey
),
0
,
smaIdxKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pSmaIdx
);
ret
=
tdbTbOpen
(
"sma.idx"
,
sizeof
(
SSmaIdxKey
),
0
,
smaIdxKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pSmaIdx
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
metaError
(
"vgId:%d failed to open meta sma index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
metaError
(
"vgId:%d
,
failed to open meta sma index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
// open index
// open index
if
(
metaOpenIdx
(
pMeta
)
<
0
)
{
if
(
metaOpenIdx
(
pMeta
)
<
0
)
{
metaError
(
"vgId:%d failed to open meta index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
metaError
(
"vgId:%d
,
failed to open meta index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
metaDebug
(
"vgId:%d meta is opened"
,
TD_VID
(
pVnode
));
metaDebug
(
"vgId:%d
,
meta is opened"
,
TD_VID
(
pVnode
));
*
ppMeta
=
pMeta
;
*
ppMeta
=
pMeta
;
return
0
;
return
0
;
...
...
source/dnode/vnode/src/meta/metaQuery.c
浏览文件 @
6b17c1ca
...
@@ -425,7 +425,7 @@ STSmaWrapper *metaGetSmaInfoByTable(SMeta *pMeta, tb_uid_t uid, bool deepCopy) {
...
@@ -425,7 +425,7 @@ STSmaWrapper *metaGetSmaInfoByTable(SMeta *pMeta, tb_uid_t uid, bool deepCopy) {
for
(
int
i
=
0
;
i
<
pSW
->
number
;
++
i
)
{
for
(
int
i
=
0
;
i
<
pSW
->
number
;
++
i
)
{
smaId
=
*
(
tb_uid_t
*
)
taosArrayGet
(
pSmaIds
,
i
);
smaId
=
*
(
tb_uid_t
*
)
taosArrayGet
(
pSmaIds
,
i
);
if
(
metaGetTableEntryByUid
(
&
mr
,
smaId
)
<
0
)
{
if
(
metaGetTableEntryByUid
(
&
mr
,
smaId
)
<
0
)
{
metaWarn
(
"vgId:%d no entry for tbId: %"
PRIi64
", smaId: %"
PRIi64
,
TD_VID
(
pMeta
->
pVnode
),
uid
,
smaId
);
metaWarn
(
"vgId:%d
,
no entry for tbId: %"
PRIi64
", smaId: %"
PRIi64
,
TD_VID
(
pMeta
->
pVnode
),
uid
,
smaId
);
continue
;
continue
;
}
}
pTSma
=
pSW
->
tSma
+
smaIdx
;
pTSma
=
pSW
->
tSma
+
smaIdx
;
...
@@ -464,7 +464,7 @@ STSmaWrapper *metaGetSmaInfoByTable(SMeta *pMeta, tb_uid_t uid, bool deepCopy) {
...
@@ -464,7 +464,7 @@ STSmaWrapper *metaGetSmaInfoByTable(SMeta *pMeta, tb_uid_t uid, bool deepCopy) {
_err:
_err:
metaReaderClear
(
&
mr
);
metaReaderClear
(
&
mr
);
taosArrayDestroy
(
pSmaIds
);
taosArrayDestroy
(
pSmaIds
);
t
d
FreeTSmaWrapper
(
pSW
,
deepCopy
);
tFreeTSmaWrapper
(
pSW
,
deepCopy
);
return
NULL
;
return
NULL
;
}
}
...
@@ -473,7 +473,7 @@ STSma *metaGetSmaInfoByIndex(SMeta *pMeta, int64_t indexUid) {
...
@@ -473,7 +473,7 @@ STSma *metaGetSmaInfoByIndex(SMeta *pMeta, int64_t indexUid) {
SMetaReader
mr
=
{
0
};
SMetaReader
mr
=
{
0
};
metaReaderInit
(
&
mr
,
pMeta
,
0
);
metaReaderInit
(
&
mr
,
pMeta
,
0
);
if
(
metaGetTableEntryByUid
(
&
mr
,
indexUid
)
<
0
)
{
if
(
metaGetTableEntryByUid
(
&
mr
,
indexUid
)
<
0
)
{
metaWarn
(
"vgId:%d failed to get table entry for smaId: %"
PRIi64
,
TD_VID
(
pMeta
->
pVnode
),
indexUid
);
metaWarn
(
"vgId:%d
,
failed to get table entry for smaId: %"
PRIi64
,
TD_VID
(
pMeta
->
pVnode
),
indexUid
);
metaReaderClear
(
&
mr
);
metaReaderClear
(
&
mr
);
return
NULL
;
return
NULL
;
}
}
...
...
source/dnode/vnode/src/meta/metaSma.c
浏览文件 @
6b17c1ca
...
@@ -57,12 +57,12 @@ int32_t metaCreateTSma(SMeta *pMeta, int64_t version, SSmaCfg *pCfg) {
...
@@ -57,12 +57,12 @@ int32_t metaCreateTSma(SMeta *pMeta, int64_t version, SSmaCfg *pCfg) {
if
(
metaHandleSmaEntry
(
pMeta
,
&
me
)
<
0
)
goto
_err
;
if
(
metaHandleSmaEntry
(
pMeta
,
&
me
)
<
0
)
goto
_err
;
metaDebug
(
"vgId:%d tsma is created, name:%s uid: %"
PRId64
,
TD_VID
(
pMeta
->
pVnode
),
pCfg
->
indexName
,
pCfg
->
indexUid
);
metaDebug
(
"vgId:%d
,
tsma is created, name:%s uid: %"
PRId64
,
TD_VID
(
pMeta
->
pVnode
),
pCfg
->
indexName
,
pCfg
->
indexUid
);
return
0
;
return
0
;
_err:
_err:
metaError
(
"vgId:%d failed to create tsma: %s uid: %"
PRId64
" since %s"
,
TD_VID
(
pMeta
->
pVnode
),
pCfg
->
indexName
,
metaError
(
"vgId:%d
,
failed to create tsma: %s uid: %"
PRId64
" since %s"
,
TD_VID
(
pMeta
->
pVnode
),
pCfg
->
indexName
,
pCfg
->
indexUid
,
tstrerror
(
terrno
));
pCfg
->
indexUid
,
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
...
...
source/dnode/vnode/src/meta/metaTable.c
浏览文件 @
6b17c1ca
...
@@ -79,12 +79,12 @@ int metaCreateSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
...
@@ -79,12 +79,12 @@ int metaCreateSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
if
(
metaHandleEntry
(
pMeta
,
&
me
)
<
0
)
goto
_err
;
if
(
metaHandleEntry
(
pMeta
,
&
me
)
<
0
)
goto
_err
;
metaDebug
(
"vgId:%d super table is created, name:%s uid: %"
PRId64
,
TD_VID
(
pMeta
->
pVnode
),
pReq
->
name
,
pReq
->
suid
);
metaDebug
(
"vgId:%d
,
super table is created, name:%s uid: %"
PRId64
,
TD_VID
(
pMeta
->
pVnode
),
pReq
->
name
,
pReq
->
suid
);
return
0
;
return
0
;
_err:
_err:
metaError
(
"vgId:%d failed to create super table: %s uid: %"
PRId64
" since %s"
,
TD_VID
(
pMeta
->
pVnode
),
pReq
->
name
,
metaError
(
"vgId:%d
,
failed to create super table: %s uid: %"
PRId64
" since %s"
,
TD_VID
(
pMeta
->
pVnode
),
pReq
->
name
,
pReq
->
suid
,
tstrerror
(
terrno
));
pReq
->
suid
,
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
...
@@ -153,7 +153,7 @@ _drop_super_table:
...
@@ -153,7 +153,7 @@ _drop_super_table:
_exit:
_exit:
tdbFree
(
pKey
);
tdbFree
(
pKey
);
tdbFree
(
pData
);
tdbFree
(
pData
);
metaDebug
(
"vgId:%d super table %s uid:%"
PRId64
" is dropped"
,
TD_VID
(
pMeta
->
pVnode
),
pReq
->
name
,
pReq
->
suid
);
metaDebug
(
"vgId:%d
,
super table %s uid:%"
PRId64
" is dropped"
,
TD_VID
(
pMeta
->
pVnode
),
pReq
->
name
,
pReq
->
suid
);
return
0
;
return
0
;
}
}
...
@@ -269,12 +269,12 @@ int metaCreateTable(SMeta *pMeta, int64_t version, SVCreateTbReq *pReq) {
...
@@ -269,12 +269,12 @@ int metaCreateTable(SMeta *pMeta, int64_t version, SVCreateTbReq *pReq) {
if
(
metaHandleEntry
(
pMeta
,
&
me
)
<
0
)
goto
_err
;
if
(
metaHandleEntry
(
pMeta
,
&
me
)
<
0
)
goto
_err
;
metaDebug
(
"vgId:%d table %s uid %"
PRId64
" is created, type:%"
PRId8
,
TD_VID
(
pMeta
->
pVnode
),
pReq
->
name
,
pReq
->
uid
,
metaDebug
(
"vgId:%d
,
table %s uid %"
PRId64
" is created, type:%"
PRId8
,
TD_VID
(
pMeta
->
pVnode
),
pReq
->
name
,
pReq
->
uid
,
pReq
->
type
);
pReq
->
type
);
return
0
;
return
0
;
_err:
_err:
metaError
(
"vgId:%d failed to create table:%s type:%s since %s"
,
TD_VID
(
pMeta
->
pVnode
),
pReq
->
name
,
metaError
(
"vgId:%d
,
failed to create table:%s type:%s since %s"
,
TD_VID
(
pMeta
->
pVnode
),
pReq
->
name
,
pReq
->
type
==
TSDB_CHILD_TABLE
?
"child table"
:
"normal table"
,
tstrerror
(
terrno
));
pReq
->
type
==
TSDB_CHILD_TABLE
?
"child table"
:
"normal table"
,
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
...
@@ -604,7 +604,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
...
@@ -604,7 +604,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
}
}
taosArrayPush
(
pTagArray
,
&
val
);
taosArrayPush
(
pTagArray
,
&
val
);
}
else
{
}
else
{
STagVal
val
=
{
0
};
STagVal
val
=
{
.
cid
=
pCol
->
colId
};
if
(
tTagGet
(
pOldTag
,
&
val
))
{
if
(
tTagGet
(
pOldTag
,
&
val
))
{
taosArrayPush
(
pTagArray
,
&
val
);
taosArrayPush
(
pTagArray
,
&
val
);
}
}
...
...
source/dnode/vnode/src/sma/sma.c
浏览文件 @
6b17c1ca
...
@@ -20,7 +20,7 @@ int32_t tdProcessTSmaInsert(SSma* pSma, int64_t indexUid, const char* msg) {
...
@@ -20,7 +20,7 @@ int32_t tdProcessTSmaInsert(SSma* pSma, int64_t indexUid, const char* msg) {
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
((
code
=
tdProcessTSmaInsertImpl
(
pSma
,
indexUid
,
msg
))
<
0
)
{
if
((
code
=
tdProcessTSmaInsertImpl
(
pSma
,
indexUid
,
msg
))
<
0
)
{
smaWarn
(
"vgId:%d insert tsma data failed since %s"
,
SMA_VID
(
pSma
),
tstrerror
(
terrno
));
smaWarn
(
"vgId:%d
,
insert tsma data failed since %s"
,
SMA_VID
(
pSma
),
tstrerror
(
terrno
));
}
}
// TODO: destroy SSDataBlocks(msg)
// TODO: destroy SSDataBlocks(msg)
return
code
;
return
code
;
...
@@ -30,7 +30,7 @@ int32_t tdProcessTSmaCreate(SSma* pSma, int64_t version, const char* msg) {
...
@@ -30,7 +30,7 @@ int32_t tdProcessTSmaCreate(SSma* pSma, int64_t version, const char* msg) {
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
((
code
=
tdProcessTSmaCreateImpl
(
pSma
,
version
,
msg
))
<
0
)
{
if
((
code
=
tdProcessTSmaCreateImpl
(
pSma
,
version
,
msg
))
<
0
)
{
smaWarn
(
"vgId:%d create tsma failed since %s"
,
SMA_VID
(
pSma
),
tstrerror
(
terrno
));
smaWarn
(
"vgId:%d
,
create tsma failed since %s"
,
SMA_VID
(
pSma
),
tstrerror
(
terrno
));
}
}
// TODO: destroy SSDataBlocks(msg)
// TODO: destroy SSDataBlocks(msg)
return
code
;
return
code
;
...
@@ -39,7 +39,7 @@ int32_t tdProcessTSmaCreate(SSma* pSma, int64_t version, const char* msg) {
...
@@ -39,7 +39,7 @@ int32_t tdProcessTSmaCreate(SSma* pSma, int64_t version, const char* msg) {
int32_t
tdUpdateExpireWindow
(
SSma
*
pSma
,
const
SSubmitReq
*
pMsg
,
int64_t
version
)
{
int32_t
tdUpdateExpireWindow
(
SSma
*
pSma
,
const
SSubmitReq
*
pMsg
,
int64_t
version
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
((
code
=
tdUpdateExpiredWindowImpl
(
pSma
,
pMsg
,
version
))
<
0
)
{
if
((
code
=
tdUpdateExpiredWindowImpl
(
pSma
,
pMsg
,
version
))
<
0
)
{
smaWarn
(
"vgId:%d update expired sma window failed since %s"
,
SMA_VID
(
pSma
),
tstrerror
(
terrno
));
smaWarn
(
"vgId:%d
,
update expired sma window failed since %s"
,
SMA_VID
(
pSma
),
tstrerror
(
terrno
));
}
}
return
code
;
return
code
;
}
}
...
@@ -47,7 +47,15 @@ int32_t tdUpdateExpireWindow(SSma* pSma, const SSubmitReq* pMsg, int64_t version
...
@@ -47,7 +47,15 @@ int32_t tdUpdateExpireWindow(SSma* pSma, const SSubmitReq* pMsg, int64_t version
int32_t
tdGetTSmaData
(
SSma
*
pSma
,
char
*
pData
,
int64_t
indexUid
,
TSKEY
querySKey
,
int32_t
nMaxResult
)
{
int32_t
tdGetTSmaData
(
SSma
*
pSma
,
char
*
pData
,
int64_t
indexUid
,
TSKEY
querySKey
,
int32_t
nMaxResult
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
((
code
=
tdGetTSmaDataImpl
(
pSma
,
pData
,
indexUid
,
querySKey
,
nMaxResult
))
<
0
)
{
if
((
code
=
tdGetTSmaDataImpl
(
pSma
,
pData
,
indexUid
,
querySKey
,
nMaxResult
))
<
0
)
{
smaWarn
(
"vgId:%d get tSma data failed since %s"
,
SMA_VID
(
pSma
),
tstrerror
(
terrno
));
smaWarn
(
"vgId:%d, get tSma data failed since %s"
,
SMA_VID
(
pSma
),
tstrerror
(
terrno
));
}
return
code
;
}
int32_t
smaGetTSmaDays
(
SVnodeCfg
*
pCfg
,
void
*
pCont
,
uint32_t
contLen
,
int32_t
*
days
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
((
code
=
tdGetTSmaDaysImpl
(
pCfg
,
pCont
,
contLen
,
days
))
<
0
)
{
smaWarn
(
"vgId:%d get tSma days failed since %s"
,
pCfg
->
vgId
,
tstrerror
(
terrno
));
}
}
return
code
;
return
code
;
}
}
source/dnode/vnode/src/sma/smaEnv.c
浏览文件 @
6b17c1ca
...
@@ -222,7 +222,7 @@ int32_t tdRefSmaStat(SSma *pSma, SSmaStat *pStat) {
...
@@ -222,7 +222,7 @@ int32_t tdRefSmaStat(SSma *pSma, SSmaStat *pStat) {
if
(
!
pStat
)
return
0
;
if
(
!
pStat
)
return
0
;
int
ref
=
T_REF_INC
(
pStat
);
int
ref
=
T_REF_INC
(
pStat
);
smaDebug
(
"vgId:%d ref sma stat:%p, val:%d"
,
SMA_VID
(
pSma
),
pStat
,
ref
);
smaDebug
(
"vgId:%d
,
ref sma stat:%p, val:%d"
,
SMA_VID
(
pSma
),
pStat
,
ref
);
return
0
;
return
0
;
}
}
...
@@ -230,7 +230,7 @@ int32_t tdUnRefSmaStat(SSma *pSma, SSmaStat *pStat) {
...
@@ -230,7 +230,7 @@ int32_t tdUnRefSmaStat(SSma *pSma, SSmaStat *pStat) {
if
(
!
pStat
)
return
0
;
if
(
!
pStat
)
return
0
;
int
ref
=
T_REF_DEC
(
pStat
);
int
ref
=
T_REF_DEC
(
pStat
);
smaDebug
(
"vgId:%d unref sma stat:%p, val:%d"
,
SMA_VID
(
pSma
),
pStat
,
ref
);
smaDebug
(
"vgId:%d
,
unref sma stat:%p, val:%d"
,
SMA_VID
(
pSma
),
pStat
,
ref
);
return
0
;
return
0
;
}
}
...
@@ -278,7 +278,7 @@ static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType) {
...
@@ -278,7 +278,7 @@ static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType) {
void
*
tdFreeSmaStatItem
(
SSmaStatItem
*
pSmaStatItem
)
{
void
*
tdFreeSmaStatItem
(
SSmaStatItem
*
pSmaStatItem
)
{
if
(
pSmaStatItem
)
{
if
(
pSmaStatItem
)
{
t
d
DestroyTSma
(
pSmaStatItem
->
pTSma
);
tDestroyTSma
(
pSmaStatItem
->
pTSma
);
taosMemoryFreeClear
(
pSmaStatItem
->
pTSma
);
taosMemoryFreeClear
(
pSmaStatItem
->
pTSma
);
taosHashCleanup
(
pSmaStatItem
->
expiredWindows
);
taosHashCleanup
(
pSmaStatItem
->
expiredWindows
);
taosMemoryFreeClear
(
pSmaStatItem
);
taosMemoryFreeClear
(
pSmaStatItem
);
...
@@ -321,7 +321,7 @@ int32_t tdDestroySmaState(SSmaStat *pSmaStat, int8_t smaType) {
...
@@ -321,7 +321,7 @@ int32_t tdDestroySmaState(SSmaStat *pSmaStat, int8_t smaType) {
int32_t
tdLockSma
(
SSma
*
pSma
)
{
int32_t
tdLockSma
(
SSma
*
pSma
)
{
int
code
=
taosThreadMutexLock
(
&
pSma
->
mutex
);
int
code
=
taosThreadMutexLock
(
&
pSma
->
mutex
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
smaError
(
"vgId:%d failed to lock td since %s"
,
SMA_VID
(
pSma
),
strerror
(
errno
));
smaError
(
"vgId:%d
,
failed to lock td since %s"
,
SMA_VID
(
pSma
),
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
code
);
terrno
=
TAOS_SYSTEM_ERROR
(
code
);
return
-
1
;
return
-
1
;
}
}
...
@@ -334,7 +334,7 @@ int32_t tdUnLockSma(SSma *pSma) {
...
@@ -334,7 +334,7 @@ int32_t tdUnLockSma(SSma *pSma) {
pSma
->
locked
=
false
;
pSma
->
locked
=
false
;
int
code
=
taosThreadMutexUnlock
(
&
pSma
->
mutex
);
int
code
=
taosThreadMutexUnlock
(
&
pSma
->
mutex
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
smaError
(
"vgId:%d failed to unlock td since %s"
,
SMA_VID
(
pSma
),
strerror
(
errno
));
smaError
(
"vgId:%d
,
failed to unlock td since %s"
,
SMA_VID
(
pSma
),
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
code
);
terrno
=
TAOS_SYSTEM_ERROR
(
code
);
return
-
1
;
return
-
1
;
}
}
...
@@ -376,7 +376,7 @@ int32_t tdCheckAndInitSmaEnv(SSma *pSma, int8_t smaType) {
...
@@ -376,7 +376,7 @@ int32_t tdCheckAndInitSmaEnv(SSma *pSma, int8_t smaType) {
if
(
did
.
level
<
0
||
did
.
id
<
0
)
{
if
(
did
.
level
<
0
||
did
.
id
<
0
)
{
tdUnLockSma
(
pSma
);
tdUnLockSma
(
pSma
);
smaError
(
"vgId:%d init sma env failed since invalid did(%d,%d)"
,
SMA_VID
(
pSma
),
did
.
level
,
did
.
id
);
smaError
(
"vgId:%d
,
init sma env failed since invalid did(%d,%d)"
,
SMA_VID
(
pSma
),
did
.
level
,
did
.
id
);
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
...
...
source/dnode/vnode/src/sma/smaRollup.c
浏览文件 @
6b17c1ca
...
@@ -58,30 +58,30 @@ static FORCE_INLINE int32_t tdUpdateTbUidListImpl(SSma *pSma, tb_uid_t *suid, SA
...
@@ -58,30 +58,30 @@ static FORCE_INLINE int32_t tdUpdateTbUidListImpl(SSma *pSma, tb_uid_t *suid, SA
if
(
!
suid
||
!
tbUids
)
{
if
(
!
suid
||
!
tbUids
)
{
terrno
=
TSDB_CODE_INVALID_PTR
;
terrno
=
TSDB_CODE_INVALID_PTR
;
smaError
(
"vgId:%d failed to get rsma info for uid:%"
PRIi64
" since %s"
,
SMA_VID
(
pSma
),
*
suid
,
terrstr
(
terrno
));
smaError
(
"vgId:%d
,
failed to get rsma info for uid:%"
PRIi64
" since %s"
,
SMA_VID
(
pSma
),
*
suid
,
terrstr
(
terrno
));
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
pRSmaInfo
=
taosHashGet
(
SMA_STAT_INFO_HASH
(
pStat
),
suid
,
sizeof
(
tb_uid_t
));
pRSmaInfo
=
taosHashGet
(
SMA_STAT_INFO_HASH
(
pStat
),
suid
,
sizeof
(
tb_uid_t
));
if
(
!
pRSmaInfo
||
!
(
pRSmaInfo
=
*
(
SRSmaInfo
**
)
pRSmaInfo
))
{
if
(
!
pRSmaInfo
||
!
(
pRSmaInfo
=
*
(
SRSmaInfo
**
)
pRSmaInfo
))
{
smaError
(
"vgId:%d failed to get rsma info for uid:%"
PRIi64
,
SMA_VID
(
pSma
),
*
suid
);
smaError
(
"vgId:%d
,
failed to get rsma info for uid:%"
PRIi64
,
SMA_VID
(
pSma
),
*
suid
);
terrno
=
TSDB_CODE_TDB_INVALID_SMA_STAT
;
terrno
=
TSDB_CODE_TDB_INVALID_SMA_STAT
;
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
if
(
pRSmaInfo
->
taskInfo
[
0
]
&&
(
qUpdateQualifiedTableId
(
pRSmaInfo
->
taskInfo
[
0
],
tbUids
,
true
)
!=
0
))
{
if
(
pRSmaInfo
->
taskInfo
[
0
]
&&
(
qUpdateQualifiedTableId
(
pRSmaInfo
->
taskInfo
[
0
],
tbUids
,
true
)
!=
0
))
{
smaError
(
"vgId:%d update tbUidList failed for uid:%"
PRIi64
" since %s"
,
SMA_VID
(
pSma
),
*
suid
,
terrstr
(
terrno
));
smaError
(
"vgId:%d
,
update tbUidList failed for uid:%"
PRIi64
" since %s"
,
SMA_VID
(
pSma
),
*
suid
,
terrstr
(
terrno
));
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
else
{
}
else
{
smaDebug
(
"vgId:%d update tbUidList succeed for qTaskInfo:%p with suid:%"
PRIi64
", uid:%"
PRIi64
,
SMA_VID
(
pSma
),
smaDebug
(
"vgId:%d
,
update tbUidList succeed for qTaskInfo:%p with suid:%"
PRIi64
", uid:%"
PRIi64
,
SMA_VID
(
pSma
),
pRSmaInfo
->
taskInfo
[
0
],
*
suid
,
*
(
int64_t
*
)
taosArrayGet
(
tbUids
,
0
));
pRSmaInfo
->
taskInfo
[
0
],
*
suid
,
*
(
int64_t
*
)
taosArrayGet
(
tbUids
,
0
));
}
}
if
(
pRSmaInfo
->
taskInfo
[
1
]
&&
(
qUpdateQualifiedTableId
(
pRSmaInfo
->
taskInfo
[
1
],
tbUids
,
true
)
!=
0
))
{
if
(
pRSmaInfo
->
taskInfo
[
1
]
&&
(
qUpdateQualifiedTableId
(
pRSmaInfo
->
taskInfo
[
1
],
tbUids
,
true
)
!=
0
))
{
smaError
(
"vgId:%d update tbUidList failed for uid:%"
PRIi64
" since %s"
,
SMA_VID
(
pSma
),
*
suid
,
terrstr
(
terrno
));
smaError
(
"vgId:%d
,
update tbUidList failed for uid:%"
PRIi64
" since %s"
,
SMA_VID
(
pSma
),
*
suid
,
terrstr
(
terrno
));
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
else
{
}
else
{
smaDebug
(
"vgId:%d update tbUidList succeed for qTaskInfo:%p with suid:%"
PRIi64
", uid:%"
PRIi64
,
SMA_VID
(
pSma
),
smaDebug
(
"vgId:%d
,
update tbUidList succeed for qTaskInfo:%p with suid:%"
PRIi64
", uid:%"
PRIi64
,
SMA_VID
(
pSma
),
pRSmaInfo
->
taskInfo
[
1
],
*
suid
,
*
(
int64_t
*
)
taosArrayGet
(
tbUids
,
0
));
pRSmaInfo
->
taskInfo
[
1
],
*
suid
,
*
(
int64_t
*
)
taosArrayGet
(
tbUids
,
0
));
}
}
...
@@ -170,14 +170,14 @@ int32_t tdProcessRSmaCreate(SVnode *pVnode, SVCreateStbReq *pReq) {
...
@@ -170,14 +170,14 @@ int32_t tdProcessRSmaCreate(SVnode *pVnode, SVCreateStbReq *pReq) {
SMeta
*
pMeta
=
pVnode
->
pMeta
;
SMeta
*
pMeta
=
pVnode
->
pMeta
;
SMsgCb
*
pMsgCb
=
&
pVnode
->
msgCb
;
SMsgCb
*
pMsgCb
=
&
pVnode
->
msgCb
;
if
(
!
pReq
->
rollup
)
{
if
(
!
pReq
->
rollup
)
{
smaTrace
(
"vgId:%d return directly since no rollup for stable %s %"
PRIi64
,
SMA_VID
(
pSma
),
pReq
->
name
,
pReq
->
suid
);
smaTrace
(
"vgId:%d
,
return directly since no rollup for stable %s %"
PRIi64
,
SMA_VID
(
pSma
),
pReq
->
name
,
pReq
->
suid
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
SRSmaParam
*
param
=
&
pReq
->
pRSmaParam
;
SRSmaParam
*
param
=
&
pReq
->
pRSmaParam
;
if
((
param
->
qmsg1Len
==
0
)
&&
(
param
->
qmsg2Len
==
0
))
{
if
((
param
->
qmsg1Len
==
0
)
&&
(
param
->
qmsg2Len
==
0
))
{
smaWarn
(
"vgId:%d no qmsg1/qmsg2 for rollup stable %s %"
PRIi64
,
SMA_VID
(
pSma
),
pReq
->
name
,
pReq
->
suid
);
smaWarn
(
"vgId:%d
,
no qmsg1/qmsg2 for rollup stable %s %"
PRIi64
,
SMA_VID
(
pSma
),
pReq
->
name
,
pReq
->
suid
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -192,7 +192,7 @@ int32_t tdProcessRSmaCreate(SVnode *pVnode, SVCreateStbReq *pReq) {
...
@@ -192,7 +192,7 @@ int32_t tdProcessRSmaCreate(SVnode *pVnode, SVCreateStbReq *pReq) {
pRSmaInfo
=
taosHashGet
(
SMA_STAT_INFO_HASH
(
pStat
),
&
pReq
->
suid
,
sizeof
(
tb_uid_t
));
pRSmaInfo
=
taosHashGet
(
SMA_STAT_INFO_HASH
(
pStat
),
&
pReq
->
suid
,
sizeof
(
tb_uid_t
));
if
(
pRSmaInfo
)
{
if
(
pRSmaInfo
)
{
smaWarn
(
"vgId:%d rsma info already exists for stb: %s, %"
PRIi64
,
SMA_VID
(
pSma
),
pReq
->
name
,
pReq
->
suid
);
smaWarn
(
"vgId:%d
,
rsma info already exists for stb: %s, %"
PRIi64
,
SMA_VID
(
pSma
),
pReq
->
name
,
pReq
->
suid
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -238,7 +238,7 @@ int32_t tdProcessRSmaCreate(SVnode *pVnode, SVCreateStbReq *pReq) {
...
@@ -238,7 +238,7 @@ int32_t tdProcessRSmaCreate(SVnode *pVnode, SVCreateStbReq *pReq) {
TSDB_CODE_SUCCESS
)
{
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
else
{
}
else
{
smaDebug
(
"vgId:%d register rsma info succeed for suid:%"
PRIi64
,
SMA_VID
(
pSma
),
pReq
->
suid
);
smaDebug
(
"vgId:%d
,
register rsma info succeed for suid:%"
PRIi64
,
SMA_VID
(
pSma
),
pReq
->
suid
);
}
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -372,11 +372,11 @@ static FORCE_INLINE int32_t tdExecuteRSmaImpl(SSma *pSma, const void *pMsg, int3
...
@@ -372,11 +372,11 @@ static FORCE_INLINE int32_t tdExecuteRSmaImpl(SSma *pSma, const void *pMsg, int3
SArray
*
pResult
=
NULL
;
SArray
*
pResult
=
NULL
;
if
(
!
taskInfo
)
{
if
(
!
taskInfo
)
{
smaDebug
(
"vgId:%d no qTaskInfo to execute rsma %"
PRIi8
" task for suid:%"
PRIu64
,
SMA_VID
(
pSma
),
level
,
suid
);
smaDebug
(
"vgId:%d
,
no qTaskInfo to execute rsma %"
PRIi8
" task for suid:%"
PRIu64
,
SMA_VID
(
pSma
),
level
,
suid
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
smaDebug
(
"vgId:%d execute rsma %"
PRIi8
" task for qTaskInfo:%p suid:%"
PRIu64
,
SMA_VID
(
pSma
),
level
,
taskInfo
,
suid
);
smaDebug
(
"vgId:%d
,
execute rsma %"
PRIi8
" task for qTaskInfo:%p suid:%"
PRIu64
,
SMA_VID
(
pSma
),
level
,
taskInfo
,
suid
);
qSetStreamInput
(
taskInfo
,
pMsg
,
inputType
,
true
);
qSetStreamInput
(
taskInfo
,
pMsg
,
inputType
,
true
);
while
(
1
)
{
while
(
1
)
{
...
@@ -414,7 +414,7 @@ static FORCE_INLINE int32_t tdExecuteRSmaImpl(SSma *pSma, const void *pMsg, int3
...
@@ -414,7 +414,7 @@ static FORCE_INLINE int32_t tdExecuteRSmaImpl(SSma *pSma, const void *pMsg, int3
}
}
taosMemoryFreeClear
(
pReq
);
taosMemoryFreeClear
(
pReq
);
}
else
{
}
else
{
smaDebug
(
"vgId:%d no rsma % "
PRIi8
" data generated since %s"
,
SMA_VID
(
pSma
),
level
,
tstrerror
(
terrno
));
smaDebug
(
"vgId:%d
,
no rsma % "
PRIi8
" data generated since %s"
,
SMA_VID
(
pSma
),
level
,
tstrerror
(
terrno
));
}
}
taosArrayDestroy
(
pResult
);
taosArrayDestroy
(
pResult
);
...
@@ -435,11 +435,11 @@ static int32_t tdExecuteRSma(SSma *pSma, const void *pMsg, int32_t inputType, tb
...
@@ -435,11 +435,11 @@ static int32_t tdExecuteRSma(SSma *pSma, const void *pMsg, int32_t inputType, tb
pRSmaInfo
=
taosHashGet
(
SMA_STAT_INFO_HASH
(
pStat
),
&
suid
,
sizeof
(
tb_uid_t
));
pRSmaInfo
=
taosHashGet
(
SMA_STAT_INFO_HASH
(
pStat
),
&
suid
,
sizeof
(
tb_uid_t
));
if
(
!
pRSmaInfo
||
!
(
pRSmaInfo
=
*
(
SRSmaInfo
**
)
pRSmaInfo
))
{
if
(
!
pRSmaInfo
||
!
(
pRSmaInfo
=
*
(
SRSmaInfo
**
)
pRSmaInfo
))
{
smaDebug
(
"vgId:%d no rsma info for suid:%"
PRIu64
,
SMA_VID
(
pSma
),
suid
);
smaDebug
(
"vgId:%d
,
no rsma info for suid:%"
PRIu64
,
SMA_VID
(
pSma
),
suid
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
if
(
!
pRSmaInfo
->
taskInfo
[
0
])
{
if
(
!
pRSmaInfo
->
taskInfo
[
0
])
{
smaDebug
(
"vgId:%d no rsma qTaskInfo for suid:%"
PRIu64
,
SMA_VID
(
pSma
),
suid
);
smaDebug
(
"vgId:%d
,
no rsma qTaskInfo for suid:%"
PRIu64
,
SMA_VID
(
pSma
),
suid
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
...
source/dnode/vnode/src/sma/smaTimeRange.c
浏览文件 @
6b17c1ca
...
@@ -326,13 +326,13 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
...
@@ -326,13 +326,13 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
if
(
!
pDataBlocks
)
{
if
(
!
pDataBlocks
)
{
terrno
=
TSDB_CODE_INVALID_PTR
;
terrno
=
TSDB_CODE_INVALID_PTR
;
smaWarn
(
"vgId:%d insert tSma data failed since pDataBlocks is NULL"
,
SMA_VID
(
pSma
));
smaWarn
(
"vgId:%d
,
insert tSma data failed since pDataBlocks is NULL"
,
SMA_VID
(
pSma
));
return
terrno
;
return
terrno
;
}
}
if
(
taosArrayGetSize
(
pDataBlocks
)
<=
0
)
{
if
(
taosArrayGetSize
(
pDataBlocks
)
<=
0
)
{
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
smaWarn
(
"vgId:%d insert tSma data failed since pDataBlocks is empty"
,
SMA_VID
(
pSma
));
smaWarn
(
"vgId:%d
,
insert tSma data failed since pDataBlocks is empty"
,
SMA_VID
(
pSma
));
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
...
@@ -487,11 +487,11 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
...
@@ -487,11 +487,11 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
smaCloseDBF
(
&
tSmaH
.
dFile
);
smaCloseDBF
(
&
tSmaH
.
dFile
);
}
}
tdSetTSmaDataFile
(
&
tSmaH
,
indexUid
,
fid
);
tdSetTSmaDataFile
(
&
tSmaH
,
indexUid
,
fid
);
smaDebug
(
"
@@@ vgId:%d
write to DBF %s, days:%d, interval:%"
PRIi64
", storageLevel:%"
PRIi32
smaDebug
(
"
vgId:%d,
write to DBF %s, days:%d, interval:%"
PRIi64
", storageLevel:%"
PRIi32
" queryKey:%"
PRIi64
,
" queryKey:%"
PRIi64
,
SMA_VID
(
pSma
),
tSmaH
.
dFile
.
path
,
minutePerFile
,
tSmaH
.
interval
,
storageLevel
,
testSkey
);
SMA_VID
(
pSma
),
tSmaH
.
dFile
.
path
,
minutePerFile
,
tSmaH
.
interval
,
storageLevel
,
testSkey
);
if
(
smaOpenDBF
(
pEnv
->
dbEnv
,
&
tSmaH
.
dFile
)
!=
0
)
{
if
(
smaOpenDBF
(
pEnv
->
dbEnv
,
&
tSmaH
.
dFile
)
!=
0
)
{
smaWarn
(
"vgId:%d open DB file %s failed since %s"
,
SMA_VID
(
pSma
),
smaWarn
(
"vgId:%d
,
open DB file %s failed since %s"
,
SMA_VID
(
pSma
),
tSmaH
.
dFile
.
path
?
tSmaH
.
dFile
.
path
:
"path is NULL"
,
tstrerror
(
terrno
));
tSmaH
.
dFile
.
path
?
tSmaH
.
dFile
.
path
:
"path is NULL"
,
tstrerror
(
terrno
));
tdDestroyTSmaWriteH
(
&
tSmaH
);
tdDestroyTSmaWriteH
(
&
tSmaH
);
tdUnRefSmaStat
(
pSma
,
pStat
);
tdUnRefSmaStat
(
pSma
,
pStat
);
...
@@ -501,7 +501,7 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
...
@@ -501,7 +501,7 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
}
}
if
(
tdInsertTSmaBlocks
(
&
tSmaH
,
&
smaKey
,
SMA_KEY_LEN
,
dataBuf
,
tlen
,
&
pEnv
->
txn
)
!=
0
)
{
if
(
tdInsertTSmaBlocks
(
&
tSmaH
,
&
smaKey
,
SMA_KEY_LEN
,
dataBuf
,
tlen
,
&
pEnv
->
txn
)
!=
0
)
{
smaWarn
(
"vgId:%d insert tsma data blocks fail for index %"
PRIi64
", skey %"
PRIi64
", groupId %"
PRIi64
smaWarn
(
"vgId:%d
,
insert tsma data blocks fail for index %"
PRIi64
", skey %"
PRIi64
", groupId %"
PRIi64
" since %s"
,
" since %s"
,
SMA_VID
(
pSma
),
indexUid
,
skey
,
groupId
,
tstrerror
(
terrno
));
SMA_VID
(
pSma
),
indexUid
,
skey
,
groupId
,
tstrerror
(
terrno
));
tdSmaEndCommit
(
pEnv
);
tdSmaEndCommit
(
pEnv
);
...
@@ -510,14 +510,14 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
...
@@ -510,14 +510,14 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
smaDebug
(
"vgId:%d insert tsma data blocks success for index %"
PRIi64
", skey %"
PRIi64
", groupId %"
PRIi64
,
smaDebug
(
"vgId:%d
,
insert tsma data blocks success for index %"
PRIi64
", skey %"
PRIi64
", groupId %"
PRIi64
,
SMA_VID
(
pSma
),
indexUid
,
skey
,
groupId
);
SMA_VID
(
pSma
),
indexUid
,
skey
,
groupId
);
// TODO:tsdbEndTSmaCommit();
// TODO:tsdbEndTSmaCommit();
// Step 3: reset the SSmaStat
// Step 3: reset the SSmaStat
tdResetExpiredWindow
(
pSma
,
pStat
,
indexUid
,
skey
);
tdResetExpiredWindow
(
pSma
,
pStat
,
indexUid
,
skey
);
}
else
{
}
else
{
smaWarn
(
"vgId:%d invalid data skey:%"
PRIi64
", tlen %"
PRIi32
" during insert tSma data for %"
PRIi64
,
smaWarn
(
"vgId:%d
,
invalid data skey:%"
PRIi64
", tlen %"
PRIi32
" during insert tSma data for %"
PRIi64
,
SMA_VID
(
pSma
),
skey
,
tlen
,
indexUid
);
SMA_VID
(
pSma
),
skey
,
tlen
,
indexUid
);
}
}
}
}
...
@@ -532,7 +532,7 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
...
@@ -532,7 +532,7 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
int32_t
tdDropTSmaData
(
SSma
*
pSma
,
int64_t
indexUid
)
{
int32_t
tdDropTSmaData
(
SSma
*
pSma
,
int64_t
indexUid
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
((
code
=
tdDropTSmaDataImpl
(
pSma
,
indexUid
))
<
0
)
{
if
((
code
=
tdDropTSmaDataImpl
(
pSma
,
indexUid
))
<
0
)
{
smaWarn
(
"vgId:%d drop tSma data failed since %s"
,
SMA_VID
(
pSma
),
tstrerror
(
terrno
));
smaWarn
(
"vgId:%d
,
drop tSma data failed since %s"
,
SMA_VID
(
pSma
),
tstrerror
(
terrno
));
}
}
return
code
;
return
code
;
}
}
...
@@ -553,11 +553,11 @@ static int32_t tdInsertTSmaBlocks(STSmaWriteH *pSmaH, void *smaKey, int32_t keyL
...
@@ -553,11 +553,11 @@ static int32_t tdInsertTSmaBlocks(STSmaWriteH *pSmaH, void *smaKey, int32_t keyL
// TODO: insert tsma data blocks into B+Tree(TTB)
// TODO: insert tsma data blocks into B+Tree(TTB)
if
(
smaSaveSmaToDB
(
pDBFile
,
smaKey
,
keyLen
,
pData
,
dataLen
,
txn
)
!=
0
)
{
if
(
smaSaveSmaToDB
(
pDBFile
,
smaKey
,
keyLen
,
pData
,
dataLen
,
txn
)
!=
0
)
{
smaWarn
(
"vgId:%d insert tsma data blocks into %s: smaKey %"
PRIx64
"-%"
PRIx64
", dataLen %"
PRIu32
" fail"
,
smaWarn
(
"vgId:%d
,
insert tsma data blocks into %s: smaKey %"
PRIx64
"-%"
PRIx64
", dataLen %"
PRIu32
" fail"
,
SMA_VID
(
pSmaH
->
pSma
),
pDBFile
->
path
,
*
(
int64_t
*
)
smaKey
,
*
(
int64_t
*
)
POINTER_SHIFT
(
smaKey
,
8
),
dataLen
);
SMA_VID
(
pSmaH
->
pSma
),
pDBFile
->
path
,
*
(
int64_t
*
)
smaKey
,
*
(
int64_t
*
)
POINTER_SHIFT
(
smaKey
,
8
),
dataLen
);
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
smaDebug
(
"vgId:%d insert tsma data blocks into %s: smaKey %"
PRIx64
"-%"
PRIx64
", dataLen %"
PRIu32
" succeed"
,
smaDebug
(
"vgId:%d
,
insert tsma data blocks into %s: smaKey %"
PRIx64
"-%"
PRIx64
", dataLen %"
PRIu32
" succeed"
,
SMA_VID
(
pSmaH
->
pSma
),
pDBFile
->
path
,
*
(
int64_t
*
)
smaKey
,
*
(
int64_t
*
)
POINTER_SHIFT
(
smaKey
,
8
),
dataLen
);
SMA_VID
(
pSmaH
->
pSma
),
pDBFile
->
path
,
*
(
int64_t
*
)
smaKey
,
*
(
int64_t
*
)
POINTER_SHIFT
(
smaKey
,
8
),
dataLen
);
#ifdef _TEST_SMA_PRINT_DEBUG_LOG_
#ifdef _TEST_SMA_PRINT_DEBUG_LOG_
...
@@ -565,7 +565,7 @@ static int32_t tdInsertTSmaBlocks(STSmaWriteH *pSmaH, void *smaKey, int32_t keyL
...
@@ -565,7 +565,7 @@ static int32_t tdInsertTSmaBlocks(STSmaWriteH *pSmaH, void *smaKey, int32_t keyL
void
*
data
=
tdGetSmaDataByKey
(
pDBFile
,
smaKey
,
keyLen
,
&
valueSize
);
void
*
data
=
tdGetSmaDataByKey
(
pDBFile
,
smaKey
,
keyLen
,
&
valueSize
);
ASSERT
(
data
!=
NULL
);
ASSERT
(
data
!=
NULL
);
for
(
uint32_t
v
=
0
;
v
<
valueSize
;
v
+=
8
)
{
for
(
uint32_t
v
=
0
;
v
<
valueSize
;
v
+=
8
)
{
smaWarn
(
"vgId:%d insert sma data val[%d] %"
PRIi64
,
REPO_ID
(
pSmaH
->
pTsdb
),
v
,
*
(
int64_t
*
)
POINTER_SHIFT
(
data
,
v
));
smaWarn
(
"vgId:%d
,
insert sma data val[%d] %"
PRIi64
,
REPO_ID
(
pSmaH
->
pTsdb
),
v
,
*
(
int64_t
*
)
POINTER_SHIFT
(
data
,
v
));
}
}
#endif
#endif
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -594,11 +594,11 @@ static int32_t tdResetExpiredWindow(SSma *pSma, SSmaStat *pStat, int64_t indexUi
...
@@ -594,11 +594,11 @@ static int32_t tdResetExpiredWindow(SSma *pSma, SSmaStat *pStat, int64_t indexUi
if
(
taosHashRemove
(
pItem
->
expiredWindows
,
&
skey
,
sizeof
(
TSKEY
))
!=
0
)
{
if
(
taosHashRemove
(
pItem
->
expiredWindows
,
&
skey
,
sizeof
(
TSKEY
))
!=
0
)
{
// error handling
// error handling
tdUnRefSmaStat
(
pSma
,
pStat
);
tdUnRefSmaStat
(
pSma
,
pStat
);
smaWarn
(
"vgId:%d remove skey %"
PRIi64
" from expired window for sma index %"
PRIi64
" fail"
,
SMA_VID
(
pSma
),
skey
,
smaWarn
(
"vgId:%d
,
remove skey %"
PRIi64
" from expired window for sma index %"
PRIi64
" fail"
,
SMA_VID
(
pSma
),
skey
,
indexUid
);
indexUid
);
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
smaDebug
(
"vgId:%d remove skey %"
PRIi64
" from expired window for sma index %"
PRIi64
" succeed"
,
SMA_VID
(
pSma
),
smaDebug
(
"vgId:%d
,
remove skey %"
PRIi64
" from expired window for sma index %"
PRIi64
" succeed"
,
SMA_VID
(
pSma
),
skey
,
indexUid
);
skey
,
indexUid
);
// TODO: use a standalone interface to received state upate notification from stream computing module.
// TODO: use a standalone interface to received state upate notification from stream computing module.
/**
/**
...
@@ -612,7 +612,7 @@ static int32_t tdResetExpiredWindow(SSma *pSma, SSmaStat *pStat, int64_t indexUi
...
@@ -612,7 +612,7 @@ static int32_t tdResetExpiredWindow(SSma *pSma, SSmaStat *pStat, int64_t indexUi
}
else
{
}
else
{
// error handling
// error handling
tdUnRefSmaStat
(
pSma
,
pStat
);
tdUnRefSmaStat
(
pSma
,
pStat
);
smaWarn
(
"vgId:%d expired window %"
PRIi64
" not exists for sma index %"
PRIi64
,
SMA_VID
(
pSma
),
skey
,
indexUid
);
smaWarn
(
"vgId:%d
,
expired window %"
PRIi64
" not exists for sma index %"
PRIi64
,
SMA_VID
(
pSma
),
skey
,
indexUid
);
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
...
@@ -632,19 +632,19 @@ static int32_t tdDropTSmaDataImpl(SSma *pSma, int64_t indexUid) {
...
@@ -632,19 +632,19 @@ static int32_t tdDropTSmaDataImpl(SSma *pSma, int64_t indexUid) {
// clear local cache
// clear local cache
if
(
pEnv
)
{
if
(
pEnv
)
{
smaDebug
(
"vgId:%d drop tSma local cache for %"
PRIi64
,
SMA_VID
(
pSma
),
indexUid
);
smaDebug
(
"vgId:%d
,
drop tSma local cache for %"
PRIi64
,
SMA_VID
(
pSma
),
indexUid
);
SSmaStatItem
*
pItem
=
taosHashGet
(
SMA_ENV_STAT_ITEMS
(
pEnv
),
&
indexUid
,
sizeof
(
indexUid
));
SSmaStatItem
*
pItem
=
taosHashGet
(
SMA_ENV_STAT_ITEMS
(
pEnv
),
&
indexUid
,
sizeof
(
indexUid
));
if
((
pItem
)
||
((
pItem
=
*
(
SSmaStatItem
**
)
pItem
)))
{
if
((
pItem
)
||
((
pItem
=
*
(
SSmaStatItem
**
)
pItem
)))
{
if
(
tdSmaStatIsDropped
(
pItem
))
{
if
(
tdSmaStatIsDropped
(
pItem
))
{
smaDebug
(
"vgId:%d tSma stat is already dropped for %"
PRIi64
,
SMA_VID
(
pSma
),
indexUid
);
smaDebug
(
"vgId:%d
,
tSma stat is already dropped for %"
PRIi64
,
SMA_VID
(
pSma
),
indexUid
);
return
TSDB_CODE_TDB_INVALID_ACTION
;
// TODO: duplicate drop msg would be intercepted by mnode
return
TSDB_CODE_TDB_INVALID_ACTION
;
// TODO: duplicate drop msg would be intercepted by mnode
}
}
tdWLockSmaEnv
(
pEnv
);
tdWLockSmaEnv
(
pEnv
);
if
(
tdSmaStatIsDropped
(
pItem
))
{
if
(
tdSmaStatIsDropped
(
pItem
))
{
tdUnLockSmaEnv
(
pEnv
);
tdUnLockSmaEnv
(
pEnv
);
smaDebug
(
"vgId:%d tSma stat is already dropped for %"
PRIi64
,
SMA_VID
(
pSma
),
indexUid
);
smaDebug
(
"vgId:%d
,
tSma stat is already dropped for %"
PRIi64
,
SMA_VID
(
pSma
),
indexUid
);
return
TSDB_CODE_TDB_INVALID_ACTION
;
// TODO: duplicate drop msg would be intercepted by mnode
return
TSDB_CODE_TDB_INVALID_ACTION
;
// TODO: duplicate drop msg would be intercepted by mnode
}
}
tdSmaStatSetDropped
(
pItem
);
tdSmaStatSetDropped
(
pItem
);
...
@@ -654,19 +654,19 @@ static int32_t tdDropTSmaDataImpl(SSma *pSma, int64_t indexUid) {
...
@@ -654,19 +654,19 @@ static int32_t tdDropTSmaDataImpl(SSma *pSma, int64_t indexUid) {
int32_t
refVal
=
INT32_MAX
;
int32_t
refVal
=
INT32_MAX
;
while
(
true
)
{
while
(
true
)
{
if
((
refVal
=
T_REF_VAL_GET
(
SMA_ENV_STAT
(
pEnv
)))
<=
0
)
{
if
((
refVal
=
T_REF_VAL_GET
(
SMA_ENV_STAT
(
pEnv
)))
<=
0
)
{
smaDebug
(
"vgId:%d drop index %"
PRIi64
" since refVal=%d"
,
SMA_VID
(
pSma
),
indexUid
,
refVal
);
smaDebug
(
"vgId:%d
,
drop index %"
PRIi64
" since refVal=%d"
,
SMA_VID
(
pSma
),
indexUid
,
refVal
);
break
;
break
;
}
}
smaDebug
(
"vgId:%d wait 1s to drop index %"
PRIi64
" since refVal=%d"
,
SMA_VID
(
pSma
),
indexUid
,
refVal
);
smaDebug
(
"vgId:%d
,
wait 1s to drop index %"
PRIi64
" since refVal=%d"
,
SMA_VID
(
pSma
),
indexUid
,
refVal
);
taosSsleep
(
1
);
taosSsleep
(
1
);
if
(
++
nSleep
>
SMA_DROP_EXPIRED_TIME
)
{
if
(
++
nSleep
>
SMA_DROP_EXPIRED_TIME
)
{
smaDebug
(
"vgId:%d drop index %"
PRIi64
" after wait %d (refVal=%d)"
,
SMA_VID
(
pSma
),
indexUid
,
nSleep
,
refVal
);
smaDebug
(
"vgId:%d
,
drop index %"
PRIi64
" after wait %d (refVal=%d)"
,
SMA_VID
(
pSma
),
indexUid
,
nSleep
,
refVal
);
break
;
break
;
};
};
}
}
tdFreeSmaStatItem
(
pItem
);
tdFreeSmaStatItem
(
pItem
);
smaDebug
(
"vgId:%d getTSmaDataImpl failed since no index %"
PRIi64
" in local cache"
,
SMA_VID
(
pSma
),
indexUid
);
smaDebug
(
"vgId:%d
,
getTSmaDataImpl failed since no index %"
PRIi64
" in local cache"
,
SMA_VID
(
pSma
),
indexUid
);
}
}
}
}
// clear sma data files
// clear sma data files
...
@@ -690,7 +690,7 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
...
@@ -690,7 +690,7 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
if
(
!
pEnv
)
{
if
(
!
pEnv
)
{
terrno
=
TSDB_CODE_INVALID_PTR
;
terrno
=
TSDB_CODE_INVALID_PTR
;
smaWarn
(
"vgId:%d getTSmaDataImpl failed since pTSmaEnv is NULL"
,
SMA_VID
(
pSma
));
smaWarn
(
"vgId:%d
,
getTSmaDataImpl failed since pTSmaEnv is NULL"
,
SMA_VID
(
pSma
));
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
...
@@ -703,7 +703,7 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
...
@@ -703,7 +703,7 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
// it's NULL.
// it's NULL.
tdUnRefSmaStat
(
pSma
,
pStat
);
tdUnRefSmaStat
(
pSma
,
pStat
);
terrno
=
TSDB_CODE_TDB_INVALID_ACTION
;
terrno
=
TSDB_CODE_TDB_INVALID_ACTION
;
smaDebug
(
"vgId:%d getTSmaDataImpl failed since no index %"
PRIi64
,
SMA_VID
(
pSma
),
indexUid
);
smaDebug
(
"vgId:%d
,
getTSmaDataImpl failed since no index %"
PRIi64
,
SMA_VID
(
pSma
),
indexUid
);
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
...
@@ -722,17 +722,17 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
...
@@ -722,17 +722,17 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
if
(
!
tdSmaStatIsOK
(
pItem
,
&
smaStat
))
{
// TODO: multiple check for large scale sma query
if
(
!
tdSmaStatIsOK
(
pItem
,
&
smaStat
))
{
// TODO: multiple check for large scale sma query
tdUnRefSmaStat
(
pSma
,
pStat
);
tdUnRefSmaStat
(
pSma
,
pStat
);
terrno
=
TSDB_CODE_TDB_INVALID_SMA_STAT
;
terrno
=
TSDB_CODE_TDB_INVALID_SMA_STAT
;
smaWarn
(
"vgId:%d getTSmaDataImpl failed from index %"
PRIi64
" since %s %"
PRIi8
,
SMA_VID
(
pSma
),
indexUid
,
smaWarn
(
"vgId:%d
,
getTSmaDataImpl failed from index %"
PRIi64
" since %s %"
PRIi8
,
SMA_VID
(
pSma
),
indexUid
,
tstrerror
(
terrno
),
smaStat
);
tstrerror
(
terrno
),
smaStat
);
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
if
(
taosHashGet
(
pItem
->
expiredWindows
,
&
querySKey
,
sizeof
(
TSKEY
)))
{
if
(
taosHashGet
(
pItem
->
expiredWindows
,
&
querySKey
,
sizeof
(
TSKEY
)))
{
// TODO: mark this window as expired.
// TODO: mark this window as expired.
smaDebug
(
"vgId:%d skey %"
PRIi64
" of window exists in expired window for index %"
PRIi64
,
SMA_VID
(
pSma
),
querySKey
,
smaDebug
(
"vgId:%d
,
skey %"
PRIi64
" of window exists in expired window for index %"
PRIi64
,
SMA_VID
(
pSma
),
querySKey
,
indexUid
);
indexUid
);
}
else
{
}
else
{
smaDebug
(
"vgId:%d skey %"
PRIi64
" of window not in expired window for index %"
PRIi64
,
SMA_VID
(
pSma
),
querySKey
,
smaDebug
(
"vgId:%d
,
skey %"
PRIi64
" of window not in expired window for index %"
PRIi64
,
SMA_VID
(
pSma
),
querySKey
,
indexUid
);
indexUid
);
}
}
...
@@ -750,7 +750,7 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
...
@@ -750,7 +750,7 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
smaDebug
(
"### vgId:%d read from DBF %s days:%d, interval:%"
PRIi64
", storageLevel:%"
PRIi8
" queryKey:%"
PRIi64
,
smaDebug
(
"### vgId:%d read from DBF %s days:%d, interval:%"
PRIi64
", storageLevel:%"
PRIi8
" queryKey:%"
PRIi64
,
SMA_VID
(
pSma
),
tReadH
.
dFile
.
path
,
tReadH
.
days
,
tReadH
.
interval
,
tReadH
.
storageLevel
,
querySKey
);
SMA_VID
(
pSma
),
tReadH
.
dFile
.
path
,
tReadH
.
days
,
tReadH
.
interval
,
tReadH
.
storageLevel
,
querySKey
);
if
(
smaOpenDBF
(
pEnv
->
dbEnv
,
&
tReadH
.
dFile
)
!=
0
)
{
if
(
smaOpenDBF
(
pEnv
->
dbEnv
,
&
tReadH
.
dFile
)
!=
0
)
{
smaWarn
(
"vgId:%d open DBF %s failed since %s"
,
SMA_VID
(
pSma
),
tReadH
.
dFile
.
path
,
tstrerror
(
terrno
));
smaWarn
(
"vgId:%d
,
open DBF %s failed since %s"
,
SMA_VID
(
pSma
),
tReadH
.
dFile
.
path
,
tstrerror
(
terrno
));
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
...
@@ -759,13 +759,13 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
...
@@ -759,13 +759,13 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
int64_t
queryGroupId
=
0
;
int64_t
queryGroupId
=
0
;
tdEncodeTSmaKey
(
queryGroupId
,
querySKey
,
(
void
**
)
&
pSmaKey
);
tdEncodeTSmaKey
(
queryGroupId
,
querySKey
,
(
void
**
)
&
pSmaKey
);
smaDebug
(
"vgId:%d get sma data from %s: smaKey %"
PRIx64
"-%"
PRIx64
", keyLen %d"
,
SMA_VID
(
pSma
),
tReadH
.
dFile
.
path
,
smaDebug
(
"vgId:%d
,
get sma data from %s: smaKey %"
PRIx64
"-%"
PRIx64
", keyLen %d"
,
SMA_VID
(
pSma
),
tReadH
.
dFile
.
path
,
*
(
int64_t
*
)
smaKey
,
*
(
int64_t
*
)
POINTER_SHIFT
(
smaKey
,
8
),
SMA_KEY_LEN
);
*
(
int64_t
*
)
smaKey
,
*
(
int64_t
*
)
POINTER_SHIFT
(
smaKey
,
8
),
SMA_KEY_LEN
);
void
*
result
=
NULL
;
void
*
result
=
NULL
;
int32_t
valueSize
=
0
;
int32_t
valueSize
=
0
;
if
(
!
(
result
=
smaGetSmaDataByKey
(
&
tReadH
.
dFile
,
smaKey
,
SMA_KEY_LEN
,
&
valueSize
)))
{
if
(
!
(
result
=
smaGetSmaDataByKey
(
&
tReadH
.
dFile
,
smaKey
,
SMA_KEY_LEN
,
&
valueSize
)))
{
smaWarn
(
"vgId:%d get sma data failed from smaIndex %"
PRIi64
", smaKey %"
PRIx64
"-%"
PRIx64
" since %s"
,
smaWarn
(
"vgId:%d
,
get sma data failed from smaIndex %"
PRIi64
", smaKey %"
PRIx64
"-%"
PRIx64
" since %s"
,
SMA_VID
(
pSma
),
indexUid
,
*
(
int64_t
*
)
smaKey
,
*
(
int64_t
*
)
POINTER_SHIFT
(
smaKey
,
8
),
tstrerror
(
terrno
));
SMA_VID
(
pSma
),
indexUid
,
*
(
int64_t
*
)
smaKey
,
*
(
int64_t
*
)
POINTER_SHIFT
(
smaKey
,
8
),
tstrerror
(
terrno
));
smaCloseDBF
(
&
tReadH
.
dFile
);
smaCloseDBF
(
&
tReadH
.
dFile
);
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
...
@@ -774,7 +774,7 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
...
@@ -774,7 +774,7 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
#ifdef _TEST_SMA_PRINT_DEBUG_LOG_
#ifdef _TEST_SMA_PRINT_DEBUG_LOG_
for
(
uint32_t
v
=
0
;
v
<
valueSize
;
v
+=
8
)
{
for
(
uint32_t
v
=
0
;
v
<
valueSize
;
v
+=
8
)
{
smaWarn
(
"vgId:%d get sma data v[%d]=%"
PRIi64
,
SMA_VID
(
pSma
),
v
,
*
(
int64_t
*
)
POINTER_SHIFT
(
result
,
v
));
smaWarn
(
"vgId:%d
,
get sma data v[%d]=%"
PRIi64
,
SMA_VID
(
pSma
),
v
,
*
(
int64_t
*
)
POINTER_SHIFT
(
result
,
v
));
}
}
#endif
#endif
taosMemoryFreeClear
(
result
);
// TODO: fill the result to output
taosMemoryFreeClear
(
result
);
// TODO: fill the result to output
...
@@ -828,7 +828,7 @@ int32_t tdDropTSma(SSma *pSma, char *pMsg) {
...
@@ -828,7 +828,7 @@ int32_t tdDropTSma(SSma *pSma, char *pMsg) {
// TODO: send msg to stream computing to drop tSma
// TODO: send msg to stream computing to drop tSma
// if ((send msg to stream computing) < 0) {
// if ((send msg to stream computing) < 0) {
// t
d
DestroyTSma(&vCreateSmaReq);
// tDestroyTSma(&vCreateSmaReq);
// return -1;
// return -1;
// }
// }
//
//
...
@@ -888,7 +888,7 @@ static int32_t tdSetExpiredWindow(SSma *pSma, SHashObj *pItemsHash, int64_t inde
...
@@ -888,7 +888,7 @@ static int32_t tdSetExpiredWindow(SSma *pSma, SHashObj *pItemsHash, int64_t inde
terrno
=
TSDB_CODE_TDB_NO_SMA_INDEX_IN_META
;
terrno
=
TSDB_CODE_TDB_NO_SMA_INDEX_IN_META
;
taosHashCleanup
(
pItem
->
expiredWindows
);
taosHashCleanup
(
pItem
->
expiredWindows
);
taosMemoryFree
(
pItem
);
taosMemoryFree
(
pItem
);
smaWarn
(
"vgId:%d set expire window, get tsma meta failed for smaIndex %"
PRIi64
" since %s"
,
SMA_VID
(
pSma
),
smaWarn
(
"vgId:%d
,
set expire window, get tsma meta failed for smaIndex %"
PRIi64
" since %s"
,
SMA_VID
(
pSma
),
indexUid
,
tstrerror
(
terrno
));
indexUid
,
tstrerror
(
terrno
));
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
...
@@ -915,12 +915,12 @@ static int32_t tdSetExpiredWindow(SSma *pSma, SHashObj *pItemsHash, int64_t inde
...
@@ -915,12 +915,12 @@ static int32_t tdSetExpiredWindow(SSma *pSma, SHashObj *pItemsHash, int64_t inde
taosHashCleanup
(
pItem
->
expiredWindows
);
taosHashCleanup
(
pItem
->
expiredWindows
);
taosMemoryFreeClear
(
pItem
->
pTSma
);
taosMemoryFreeClear
(
pItem
->
pTSma
);
taosHashRemove
(
pItemsHash
,
&
indexUid
,
sizeof
(
indexUid
));
taosHashRemove
(
pItemsHash
,
&
indexUid
,
sizeof
(
indexUid
));
smaWarn
(
"vgId:%d smaIndex %"
PRIi64
", put skey %"
PRIi64
" to expire window fail"
,
SMA_VID
(
pSma
),
indexUid
,
smaWarn
(
"vgId:%d
,
smaIndex %"
PRIi64
", put skey %"
PRIi64
" to expire window fail"
,
SMA_VID
(
pSma
),
indexUid
,
winSKey
);
winSKey
);
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
smaDebug
(
"vgId:%d smaIndex %"
PRIi64
", put skey %"
PRIi64
" to expire window succeed"
,
SMA_VID
(
pSma
),
indexUid
,
smaDebug
(
"vgId:%d
,
smaIndex %"
PRIi64
", put skey %"
PRIi64
" to expire window succeed"
,
SMA_VID
(
pSma
),
indexUid
,
winSKey
);
winSKey
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -935,18 +935,18 @@ static int32_t tdSetExpiredWindow(SSma *pSma, SHashObj *pItemsHash, int64_t inde
...
@@ -935,18 +935,18 @@ static int32_t tdSetExpiredWindow(SSma *pSma, SHashObj *pItemsHash, int64_t inde
int32_t
tdUpdateExpiredWindowImpl
(
SSma
*
pSma
,
const
SSubmitReq
*
pMsg
,
int64_t
version
)
{
int32_t
tdUpdateExpiredWindowImpl
(
SSma
*
pSma
,
const
SSubmitReq
*
pMsg
,
int64_t
version
)
{
// no time-range-sma, just return success
// no time-range-sma, just return success
if
(
atomic_load_16
(
&
SMA_TSMA_NUM
(
pSma
))
<=
0
)
{
if
(
atomic_load_16
(
&
SMA_TSMA_NUM
(
pSma
))
<=
0
)
{
smaTrace
(
"vgId:%d not update expire window since no tSma"
,
SMA_VID
(
pSma
));
smaTrace
(
"vgId:%d
,
not update expire window since no tSma"
,
SMA_VID
(
pSma
));
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
if
(
!
SMA_META
(
pSma
))
{
if
(
!
SMA_META
(
pSma
))
{
terrno
=
TSDB_CODE_INVALID_PTR
;
terrno
=
TSDB_CODE_INVALID_PTR
;
smaError
(
"vgId:%d update expire window failed since no meta ptr"
,
SMA_VID
(
pSma
));
smaError
(
"vgId:%d
,
update expire window failed since no meta ptr"
,
SMA_VID
(
pSma
));
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
if
(
tdCheckAndInitSmaEnv
(
pSma
,
TSDB_SMA_TYPE_TIME_RANGE
)
<
0
)
{
if
(
tdCheckAndInitSmaEnv
(
pSma
,
TSDB_SMA_TYPE_TIME_RANGE
)
<
0
)
{
smaError
(
"vgId:%d init sma env failed since %s"
,
SMA_VID
(
pSma
),
terrstr
(
terrno
));
smaError
(
"vgId:%d
,
init sma env failed since %s"
,
SMA_VID
(
pSma
),
terrstr
(
terrno
));
terrno
=
TSDB_CODE_TDB_INIT_FAILED
;
terrno
=
TSDB_CODE_TDB_INIT_FAILED
;
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
...
@@ -982,25 +982,25 @@ int32_t tdUpdateExpiredWindowImpl(SSma *pSma, const SSubmitReq *pMsg, int64_t ve
...
@@ -982,25 +982,25 @@ int32_t tdUpdateExpiredWindowImpl(SSma *pSma, const SSubmitReq *pMsg, int64_t ve
SSubmitBlkIter
blkIter
=
{
0
};
SSubmitBlkIter
blkIter
=
{
0
};
if
(
tInitSubmitBlkIter
(
&
msgIter
,
pBlock
,
&
blkIter
)
<
0
)
{
if
(
tInitSubmitBlkIter
(
&
msgIter
,
pBlock
,
&
blkIter
)
<
0
)
{
pSW
=
t
d
FreeTSmaWrapper
(
pSW
,
false
);
pSW
=
tFreeTSmaWrapper
(
pSW
,
false
);
break
;
break
;
}
}
while
(
true
)
{
while
(
true
)
{
STSRow
*
row
=
tGetSubmitBlkNext
(
&
blkIter
);
STSRow
*
row
=
tGetSubmitBlkNext
(
&
blkIter
);
if
(
!
row
)
{
if
(
!
row
)
{
pSW
=
t
d
FreeTSmaWrapper
(
pSW
,
false
);
pSW
=
tFreeTSmaWrapper
(
pSW
,
false
);
break
;
break
;
}
}
if
(
!
pSW
||
(
pTSma
&&
(
pTSma
->
tableUid
!=
msgIter
.
suid
)))
{
if
(
!
pSW
||
(
pTSma
&&
(
pTSma
->
tableUid
!=
msgIter
.
suid
)))
{
if
(
pSW
)
{
if
(
pSW
)
{
pSW
=
t
d
FreeTSmaWrapper
(
pSW
,
false
);
pSW
=
tFreeTSmaWrapper
(
pSW
,
false
);
}
}
if
(
!
(
pSW
=
metaGetSmaInfoByTable
(
SMA_META
(
pSma
),
msgIter
.
suid
,
false
)))
{
if
(
!
(
pSW
=
metaGetSmaInfoByTable
(
SMA_META
(
pSma
),
msgIter
.
suid
,
false
)))
{
break
;
break
;
}
}
if
((
pSW
->
number
)
<=
0
||
!
pSW
->
tSma
)
{
if
((
pSW
->
number
)
<=
0
||
!
pSW
->
tSma
)
{
pSW
=
t
d
FreeTSmaWrapper
(
pSW
,
false
);
pSW
=
tFreeTSmaWrapper
(
pSW
,
false
);
break
;
break
;
}
}
...
@@ -1020,12 +1020,12 @@ int32_t tdUpdateExpiredWindowImpl(SSma *pSma, const SSubmitReq *pMsg, int64_t ve
...
@@ -1020,12 +1020,12 @@ int32_t tdUpdateExpiredWindowImpl(SSma *pSma, const SSubmitReq *pMsg, int64_t ve
if
(
lastWinSKey
!=
winSKey
)
{
if
(
lastWinSKey
!=
winSKey
)
{
lastWinSKey
=
winSKey
;
lastWinSKey
=
winSKey
;
if
(
tdSetExpiredWindow
(
pSma
,
pItemsHash
,
pTSma
->
indexUid
,
winSKey
,
version
)
<
0
)
{
if
(
tdSetExpiredWindow
(
pSma
,
pItemsHash
,
pTSma
->
indexUid
,
winSKey
,
version
)
<
0
)
{
pSW
=
t
d
FreeTSmaWrapper
(
pSW
,
false
);
pSW
=
tFreeTSmaWrapper
(
pSW
,
false
);
tdUnRefSmaStat
(
pSma
,
pStat
);
tdUnRefSmaStat
(
pSma
,
pStat
);
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
}
else
{
}
else
{
smaDebug
(
"vgId:%d smaIndex %"
PRIi64
", put skey %"
PRIi64
" to expire window ignore as duplicated"
,
smaDebug
(
"vgId:%d
,
smaIndex %"
PRIi64
", put skey %"
PRIi64
" to expire window ignore as duplicated"
,
SMA_VID
(
pSma
),
pTSma
->
indexUid
,
winSKey
);
SMA_VID
(
pSma
),
pTSma
->
indexUid
,
winSKey
);
}
}
}
}
...
...
source/dnode/vnode/src/sma/smaTimeRange2.c
0 → 100644
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tq/tqPush.c
浏览文件 @
6b17c1ca
...
@@ -20,6 +20,28 @@ void tqTmrRspFunc(void* param, void* tmrId) {
...
@@ -20,6 +20,28 @@ void tqTmrRspFunc(void* param, void* tmrId) {
atomic_store_8
(
&
pHandle
->
pushHandle
.
tmrStopped
,
1
);
atomic_store_8
(
&
pHandle
->
pushHandle
.
tmrStopped
,
1
);
}
}
static
int32_t
tqLoopExecFromQueue
(
STQ
*
pTq
,
STqHandle
*
pHandle
,
SStreamDataSubmit
**
ppSubmit
,
SMqDataBlkRsp
*
pRsp
)
{
SStreamDataSubmit
*
pSubmit
=
*
ppSubmit
;
while
(
pSubmit
!=
NULL
)
{
ASSERT
(
pSubmit
->
ver
==
pHandle
->
pushHandle
.
processedVer
+
1
);
if
(
tqDataExec
(
pTq
,
&
pHandle
->
execHandle
,
pSubmit
->
data
,
pRsp
,
0
)
<
0
)
{
/*ASSERT(0);*/
}
// update processed
atomic_store_64
(
&
pHandle
->
pushHandle
.
processedVer
,
pSubmit
->
ver
);
streamQSetSuccess
(
&
pHandle
->
pushHandle
.
inputQ
);
streamDataSubmitRefDec
(
pSubmit
);
if
(
pRsp
->
blockNum
>
0
)
{
*
ppSubmit
=
pSubmit
;
return
0
;
}
else
{
pSubmit
=
streamQNextItem
(
&
pHandle
->
pushHandle
.
inputQ
);
}
}
*
ppSubmit
=
pSubmit
;
return
-
1
;
}
int32_t
tqExecFromInputQ
(
STQ
*
pTq
,
STqHandle
*
pHandle
)
{
int32_t
tqExecFromInputQ
(
STQ
*
pTq
,
STqHandle
*
pHandle
)
{
SMqDataBlkRsp
rsp
=
{
0
};
SMqDataBlkRsp
rsp
=
{
0
};
// 1. guard and set status executing
// 1. guard and set status executing
...
@@ -42,38 +64,14 @@ int32_t tqExecFromInputQ(STQ* pTq, STqHandle* pHandle) {
...
@@ -42,38 +64,14 @@ int32_t tqExecFromInputQ(STQ* pTq, STqHandle* pHandle) {
}
}
// 3. exec, after each success, update processed ver
// 3. exec, after each success, update processed ver
// first run
// first run
while
(
pSubmit
!=
NULL
)
{
if
(
tqLoopExecFromQueue
(
pTq
,
pHandle
,
&
pSubmit
,
&
rsp
)
==
0
)
{
ASSERT
(
pSubmit
->
ver
==
pHandle
->
pushHandle
.
processedVer
+
1
);
if
(
tqDataExec
(
pTq
,
&
pHandle
->
execHandle
,
pSubmit
->
data
,
&
rsp
,
0
)
<
0
)
{
/*ASSERT(0);*/
}
// update processed
atomic_store_64
(
&
pHandle
->
pushHandle
.
processedVer
,
pSubmit
->
ver
);
streamQSetSuccess
(
&
pHandle
->
pushHandle
.
inputQ
);
streamDataSubmitRefDec
(
pSubmit
);
if
(
rsp
.
blockNum
>
0
)
{
goto
SEND_RSP
;
goto
SEND_RSP
;
}
else
{
pSubmit
=
streamQNextItem
(
&
pHandle
->
pushHandle
.
inputQ
);
}
}
}
// set exec status closing
// set exec status closing
atomic_store_8
(
&
pHandle
->
pushHandle
.
execStatus
,
TASK_STATUS__CLOSING
);
atomic_store_8
(
&
pHandle
->
pushHandle
.
execStatus
,
TASK_STATUS__CLOSING
);
// second run
// second run
while
(
pSubmit
!=
NULL
)
{
if
(
tqLoopExecFromQueue
(
pTq
,
pHandle
,
&
pSubmit
,
&
rsp
)
==
0
)
{
ASSERT
(
pSubmit
->
ver
==
pHandle
->
pushHandle
.
processedVer
+
1
);
if
(
tqDataExec
(
pTq
,
&
pHandle
->
execHandle
,
pSubmit
->
data
,
&
rsp
,
0
)
<
0
)
{
/*ASSERT(0);*/
}
// update processed
atomic_store_64
(
&
pHandle
->
pushHandle
.
processedVer
,
pSubmit
->
ver
);
streamQSetSuccess
(
&
pHandle
->
pushHandle
.
inputQ
);
streamDataSubmitRefDec
(
pSubmit
);
if
(
rsp
.
blockNum
>
0
)
{
goto
SEND_RSP
;
goto
SEND_RSP
;
}
else
{
pSubmit
=
streamQNextItem
(
&
pHandle
->
pushHandle
.
inputQ
);
}
}
}
// set exec status idle
// set exec status idle
atomic_store_8
(
&
pHandle
->
pushHandle
.
execStatus
,
TASK_STATUS__IDLE
);
atomic_store_8
(
&
pHandle
->
pushHandle
.
execStatus
,
TASK_STATUS__IDLE
);
...
...
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
6b17c1ca
...
@@ -120,7 +120,7 @@ int tsdbApplyRtnOnFSet(STsdb *pRepo, SDFileSet *pSet, SRtn *pRtn) {
...
@@ -120,7 +120,7 @@ int tsdbApplyRtnOnFSet(STsdb *pRepo, SDFileSet *pSet, SRtn *pRtn) {
tsdbInitDFileSet
(
pRepo
,
&
nSet
,
did
,
pSet
->
fid
,
FS_TXN_VERSION
(
pfs
));
tsdbInitDFileSet
(
pRepo
,
&
nSet
,
did
,
pSet
->
fid
,
FS_TXN_VERSION
(
pfs
));
if
(
tsdbCopyDFileSet
(
pSet
,
&
nSet
)
<
0
)
{
if
(
tsdbCopyDFileSet
(
pSet
,
&
nSet
)
<
0
)
{
tsdbError
(
"vgId:%d failed to copy FSET %d from level %d to level %d since %s"
,
REPO_ID
(
pRepo
),
pSet
->
fid
,
tsdbError
(
"vgId:%d
,
failed to copy FSET %d from level %d to level %d since %s"
,
REPO_ID
(
pRepo
),
pSet
->
fid
,
TSDB_FSET_LEVEL
(
pSet
),
did
.
level
,
tstrerror
(
terrno
));
TSDB_FSET_LEVEL
(
pSet
),
did
.
level
,
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
...
@@ -129,7 +129,7 @@ int tsdbApplyRtnOnFSet(STsdb *pRepo, SDFileSet *pSet, SRtn *pRtn) {
...
@@ -129,7 +129,7 @@ int tsdbApplyRtnOnFSet(STsdb *pRepo, SDFileSet *pSet, SRtn *pRtn) {
return
-
1
;
return
-
1
;
}
}
tsdbInfo
(
"vgId:%d FSET %d is copied from level %d disk id %d to level %d disk id %d"
,
REPO_ID
(
pRepo
),
pSet
->
fid
,
tsdbInfo
(
"vgId:%d
,
FSET %d is copied from level %d disk id %d to level %d disk id %d"
,
REPO_ID
(
pRepo
),
pSet
->
fid
,
TSDB_FSET_LEVEL
(
pSet
),
TSDB_FSET_ID
(
pSet
),
did
.
level
,
did
.
id
);
TSDB_FSET_LEVEL
(
pSet
),
TSDB_FSET_ID
(
pSet
),
did
.
level
,
did
.
id
);
}
else
{
}
else
{
// On a correct level
// On a correct level
...
@@ -170,7 +170,7 @@ int tsdbCommit(STsdb *pRepo) {
...
@@ -170,7 +170,7 @@ int tsdbCommit(STsdb *pRepo) {
tsdbSeekCommitIter
(
&
commith
,
commith
.
rtn
.
minKey
);
tsdbSeekCommitIter
(
&
commith
,
commith
.
rtn
.
minKey
);
while
((
pSet
=
tsdbFSIterNext
(
&
(
commith
.
fsIter
))))
{
while
((
pSet
=
tsdbFSIterNext
(
&
(
commith
.
fsIter
))))
{
if
(
pSet
->
fid
<
commith
.
rtn
.
minFid
)
{
if
(
pSet
->
fid
<
commith
.
rtn
.
minFid
)
{
tsdbInfo
(
"vgId:%d FSET %d on level %d disk id %d expires, remove it"
,
REPO_ID
(
pRepo
),
pSet
->
fid
,
tsdbInfo
(
"vgId:%d
,
FSET %d on level %d disk id %d expires, remove it"
,
REPO_ID
(
pRepo
),
pSet
->
fid
,
TSDB_FSET_LEVEL
(
pSet
),
TSDB_FSET_ID
(
pSet
));
TSDB_FSET_LEVEL
(
pSet
),
TSDB_FSET_ID
(
pSet
));
}
else
{
}
else
{
break
;
break
;
...
@@ -236,14 +236,14 @@ void tsdbGetRtnSnap(STsdb *pRepo, SRtn *pRtn) {
...
@@ -236,14 +236,14 @@ void tsdbGetRtnSnap(STsdb *pRepo, SRtn *pRtn) {
pRtn
->
minFid
=
(
int
)(
TSDB_KEY_FID
(
minKey
,
pCfg
->
days
,
pCfg
->
precision
));
pRtn
->
minFid
=
(
int
)(
TSDB_KEY_FID
(
minKey
,
pCfg
->
days
,
pCfg
->
precision
));
pRtn
->
midFid
=
(
int
)(
TSDB_KEY_FID
(
midKey
,
pCfg
->
days
,
pCfg
->
precision
));
pRtn
->
midFid
=
(
int
)(
TSDB_KEY_FID
(
midKey
,
pCfg
->
days
,
pCfg
->
precision
));
pRtn
->
maxFid
=
(
int
)(
TSDB_KEY_FID
(
maxKey
,
pCfg
->
days
,
pCfg
->
precision
));
pRtn
->
maxFid
=
(
int
)(
TSDB_KEY_FID
(
maxKey
,
pCfg
->
days
,
pCfg
->
precision
));
tsdbDebug
(
"vgId:%d now:%"
PRId64
" minKey:%"
PRId64
" minFid:%d, midFid:%d, maxFid:%d"
,
REPO_ID
(
pRepo
),
now
,
minKey
,
tsdbDebug
(
"vgId:%d
,
now:%"
PRId64
" minKey:%"
PRId64
" minFid:%d, midFid:%d, maxFid:%d"
,
REPO_ID
(
pRepo
),
now
,
minKey
,
pRtn
->
minFid
,
pRtn
->
midFid
,
pRtn
->
maxFid
);
pRtn
->
minFid
,
pRtn
->
midFid
,
pRtn
->
maxFid
);
}
}
static
void
tsdbStartCommit
(
STsdb
*
pRepo
)
{
static
void
tsdbStartCommit
(
STsdb
*
pRepo
)
{
STsdbMemTable
*
pMem
=
pRepo
->
imem
;
STsdbMemTable
*
pMem
=
pRepo
->
imem
;
tsdbInfo
(
"vgId:%d start to commit"
,
REPO_ID
(
pRepo
));
tsdbInfo
(
"vgId:%d
,
start to commit"
,
REPO_ID
(
pRepo
));
tsdbStartFSTxn
(
pRepo
,
0
,
0
);
tsdbStartFSTxn
(
pRepo
,
0
,
0
);
}
}
...
@@ -252,7 +252,7 @@ static void tsdbEndCommit(STsdb *pTsdb, int eno) {
...
@@ -252,7 +252,7 @@ static void tsdbEndCommit(STsdb *pTsdb, int eno) {
tsdbEndFSTxn
(
pTsdb
);
tsdbEndFSTxn
(
pTsdb
);
tsdbMemTableDestroy
(
pTsdb
->
imem
);
tsdbMemTableDestroy
(
pTsdb
->
imem
);
pTsdb
->
imem
=
NULL
;
pTsdb
->
imem
=
NULL
;
tsdbInfo
(
"vgId:%d commit over, %s"
,
REPO_ID
(
pTsdb
),
(
eno
==
TSDB_CODE_SUCCESS
)
?
"succeed"
:
"failed"
);
tsdbInfo
(
"vgId:%d
,
commit over, %s"
,
REPO_ID
(
pTsdb
),
(
eno
==
TSDB_CODE_SUCCESS
)
?
"succeed"
:
"failed"
);
}
}
static
int
tsdbInitCommitH
(
SCommitH
*
pCommith
,
STsdb
*
pRepo
)
{
static
int
tsdbInitCommitH
(
SCommitH
*
pCommith
,
STsdb
*
pRepo
)
{
...
@@ -425,7 +425,7 @@ static int tsdbCommitToFile(SCommitH *pCommith, SDFileSet *pSet, int fid) {
...
@@ -425,7 +425,7 @@ static int tsdbCommitToFile(SCommitH *pCommith, SDFileSet *pSet, int fid) {
if
(
tsdbWriteBlockIdx
(
TSDB_COMMIT_HEAD_FILE
(
pCommith
),
pCommith
->
aBlkIdx
,
(
void
**
)(
&
(
TSDB_COMMIT_BUF
(
pCommith
))))
<
if
(
tsdbWriteBlockIdx
(
TSDB_COMMIT_HEAD_FILE
(
pCommith
),
pCommith
->
aBlkIdx
,
(
void
**
)(
&
(
TSDB_COMMIT_BUF
(
pCommith
))))
<
0
)
{
0
)
{
tsdbError
(
"vgId:%d failed to write SBlockIdx part to FSET %d since %s"
,
REPO_ID
(
pRepo
),
fid
,
tstrerror
(
terrno
));
tsdbError
(
"vgId:%d
,
failed to write SBlockIdx part to FSET %d since %s"
,
REPO_ID
(
pRepo
),
fid
,
tstrerror
(
terrno
));
tsdbCloseCommitFile
(
pCommith
,
true
);
tsdbCloseCommitFile
(
pCommith
,
true
);
// revert the file change
// revert the file change
tsdbApplyDFileSetChange
(
TSDB_COMMIT_WRITE_FSET
(
pCommith
),
pSet
);
tsdbApplyDFileSetChange
(
TSDB_COMMIT_WRITE_FSET
(
pCommith
),
pSet
);
...
@@ -433,7 +433,7 @@ static int tsdbCommitToFile(SCommitH *pCommith, SDFileSet *pSet, int fid) {
...
@@ -433,7 +433,7 @@ static int tsdbCommitToFile(SCommitH *pCommith, SDFileSet *pSet, int fid) {
}
}
if
(
tsdbUpdateDFileSetHeader
(
&
(
pCommith
->
wSet
))
<
0
)
{
if
(
tsdbUpdateDFileSetHeader
(
&
(
pCommith
->
wSet
))
<
0
)
{
tsdbError
(
"vgId:%d failed to update FSET %d header since %s"
,
REPO_ID
(
pRepo
),
fid
,
tstrerror
(
terrno
));
tsdbError
(
"vgId:%d
,
failed to update FSET %d header since %s"
,
REPO_ID
(
pRepo
),
fid
,
tstrerror
(
terrno
));
tsdbCloseCommitFile
(
pCommith
,
true
);
tsdbCloseCommitFile
(
pCommith
,
true
);
// revert the file change
// revert the file change
tsdbApplyDFileSetChange
(
TSDB_COMMIT_WRITE_FSET
(
pCommith
),
pSet
);
tsdbApplyDFileSetChange
(
TSDB_COMMIT_WRITE_FSET
(
pCommith
),
pSet
);
...
@@ -543,7 +543,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
...
@@ -543,7 +543,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
return
-
1
;
return
-
1
;
}
}
tsdbDebug
(
"vgId:%d FSET %d at level %d disk id %d is opened to read to commit"
,
REPO_ID
(
pRepo
),
TSDB_FSET_FID
(
pSet
),
tsdbDebug
(
"vgId:%d
,
FSET %d at level %d disk id %d is opened to read to commit"
,
REPO_ID
(
pRepo
),
TSDB_FSET_FID
(
pSet
),
TSDB_FSET_LEVEL
(
pSet
),
TSDB_FSET_ID
(
pSet
));
TSDB_FSET_LEVEL
(
pSet
),
TSDB_FSET_ID
(
pSet
));
}
else
{
}
else
{
pCommith
->
isRFileSet
=
false
;
pCommith
->
isRFileSet
=
false
;
...
@@ -555,7 +555,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
...
@@ -555,7 +555,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
tsdbInitDFileSet
(
pRepo
,
pWSet
,
did
,
fid
,
FS_TXN_VERSION
(
REPO_FS
(
pRepo
)));
tsdbInitDFileSet
(
pRepo
,
pWSet
,
did
,
fid
,
FS_TXN_VERSION
(
REPO_FS
(
pRepo
)));
if
(
tsdbCreateDFileSet
(
pRepo
,
pWSet
,
true
)
<
0
)
{
if
(
tsdbCreateDFileSet
(
pRepo
,
pWSet
,
true
)
<
0
)
{
tsdbError
(
"vgId:%d failed to create FSET %d at level %d disk id %d since %s"
,
REPO_ID
(
pRepo
),
tsdbError
(
"vgId:%d
,
failed to create FSET %d at level %d disk id %d since %s"
,
REPO_ID
(
pRepo
),
TSDB_FSET_FID
(
pWSet
),
TSDB_FSET_LEVEL
(
pWSet
),
TSDB_FSET_ID
(
pWSet
),
tstrerror
(
terrno
));
TSDB_FSET_FID
(
pWSet
),
TSDB_FSET_LEVEL
(
pWSet
),
TSDB_FSET_ID
(
pWSet
),
tstrerror
(
terrno
));
if
(
pCommith
->
isRFileSet
)
{
if
(
pCommith
->
isRFileSet
)
{
tsdbCloseAndUnsetFSet
(
&
(
pCommith
->
readh
));
tsdbCloseAndUnsetFSet
(
&
(
pCommith
->
readh
));
...
@@ -566,7 +566,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
...
@@ -566,7 +566,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
pCommith
->
isDFileSame
=
false
;
pCommith
->
isDFileSame
=
false
;
pCommith
->
isLFileSame
=
false
;
pCommith
->
isLFileSame
=
false
;
tsdbDebug
(
"vgId:%d FSET %d at level %d disk id %d is created to commit"
,
REPO_ID
(
pRepo
),
TSDB_FSET_FID
(
pWSet
),
tsdbDebug
(
"vgId:%d
,
FSET %d at level %d disk id %d is created to commit"
,
REPO_ID
(
pRepo
),
TSDB_FSET_FID
(
pWSet
),
TSDB_FSET_LEVEL
(
pWSet
),
TSDB_FSET_ID
(
pWSet
));
TSDB_FSET_LEVEL
(
pWSet
),
TSDB_FSET_ID
(
pWSet
));
}
else
{
}
else
{
did
.
level
=
TSDB_FSET_LEVEL
(
pSet
);
did
.
level
=
TSDB_FSET_LEVEL
(
pSet
);
...
@@ -579,7 +579,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
...
@@ -579,7 +579,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
SDFile
*
pWHeadf
=
TSDB_COMMIT_HEAD_FILE
(
pCommith
);
SDFile
*
pWHeadf
=
TSDB_COMMIT_HEAD_FILE
(
pCommith
);
tsdbInitDFile
(
pRepo
,
pWHeadf
,
did
,
fid
,
FS_TXN_VERSION
(
REPO_FS
(
pRepo
)),
TSDB_FILE_HEAD
);
tsdbInitDFile
(
pRepo
,
pWHeadf
,
did
,
fid
,
FS_TXN_VERSION
(
REPO_FS
(
pRepo
)),
TSDB_FILE_HEAD
);
if
(
tsdbCreateDFile
(
pRepo
,
pWHeadf
,
true
,
TSDB_FILE_HEAD
)
<
0
)
{
if
(
tsdbCreateDFile
(
pRepo
,
pWHeadf
,
true
,
TSDB_FILE_HEAD
)
<
0
)
{
tsdbError
(
"vgId:%d failed to create file %s to commit since %s"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pWHeadf
),
tsdbError
(
"vgId:%d
,
failed to create file %s to commit since %s"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pWHeadf
),
tstrerror
(
terrno
));
tstrerror
(
terrno
));
if
(
pCommith
->
isRFileSet
)
{
if
(
pCommith
->
isRFileSet
)
{
...
@@ -594,7 +594,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
...
@@ -594,7 +594,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
tsdbInitDFileEx
(
pWDataf
,
pRDataf
);
tsdbInitDFileEx
(
pWDataf
,
pRDataf
);
// if (tsdbOpenDFile(pWDataf, O_WRONLY) < 0) {
// if (tsdbOpenDFile(pWDataf, O_WRONLY) < 0) {
if
(
tsdbOpenDFile
(
pWDataf
,
TD_FILE_WRITE
)
<
0
)
{
if
(
tsdbOpenDFile
(
pWDataf
,
TD_FILE_WRITE
)
<
0
)
{
tsdbError
(
"vgId:%d failed to open file %s to commit since %s"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pWDataf
),
tsdbError
(
"vgId:%d
,
failed to open file %s to commit since %s"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pWDataf
),
tstrerror
(
terrno
));
tstrerror
(
terrno
));
tsdbCloseDFileSet
(
pWSet
);
tsdbCloseDFileSet
(
pWSet
);
...
@@ -615,7 +615,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
...
@@ -615,7 +615,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
// if (tsdbOpenDFile(pWLastf, O_WRONLY) < 0) {
// if (tsdbOpenDFile(pWLastf, O_WRONLY) < 0) {
if
(
tsdbOpenDFile
(
pWLastf
,
TD_FILE_WRITE
)
<
0
)
{
if
(
tsdbOpenDFile
(
pWLastf
,
TD_FILE_WRITE
)
<
0
)
{
tsdbError
(
"vgId:%d failed to open file %s to commit since %s"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pWLastf
),
tsdbError
(
"vgId:%d
,
failed to open file %s to commit since %s"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pWLastf
),
tstrerror
(
terrno
));
tstrerror
(
terrno
));
tsdbCloseDFileSet
(
pWSet
);
tsdbCloseDFileSet
(
pWSet
);
...
@@ -630,7 +630,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
...
@@ -630,7 +630,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
pCommith
->
isLFileSame
=
false
;
pCommith
->
isLFileSame
=
false
;
if
(
tsdbCreateDFile
(
pRepo
,
pWLastf
,
true
,
TSDB_FILE_LAST
)
<
0
)
{
if
(
tsdbCreateDFile
(
pRepo
,
pWLastf
,
true
,
TSDB_FILE_LAST
)
<
0
)
{
tsdbError
(
"vgId:%d failed to create file %s to commit since %s"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pWLastf
),
tsdbError
(
"vgId:%d
,
failed to create file %s to commit since %s"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pWLastf
),
tstrerror
(
terrno
));
tstrerror
(
terrno
));
tsdbCloseDFileSet
(
pWSet
);
tsdbCloseDFileSet
(
pWSet
);
...
@@ -647,11 +647,11 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
...
@@ -647,11 +647,11 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
SDFile
*
pWSmadF
=
TSDB_COMMIT_SMAD_FILE
(
pCommith
);
SDFile
*
pWSmadF
=
TSDB_COMMIT_SMAD_FILE
(
pCommith
);
if
(
!
taosCheckExistFile
(
TSDB_FILE_FULL_NAME
(
pRSmadF
)))
{
if
(
!
taosCheckExistFile
(
TSDB_FILE_FULL_NAME
(
pRSmadF
)))
{
tsdbDebug
(
"vgId:%d create data file %s as not exist"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pRSmadF
));
tsdbDebug
(
"vgId:%d
,
create data file %s as not exist"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pRSmadF
));
tsdbInitDFile
(
pRepo
,
pWSmadF
,
did
,
fid
,
FS_TXN_VERSION
(
REPO_FS
(
pRepo
)),
TSDB_FILE_SMAD
);
tsdbInitDFile
(
pRepo
,
pWSmadF
,
did
,
fid
,
FS_TXN_VERSION
(
REPO_FS
(
pRepo
)),
TSDB_FILE_SMAD
);
if
(
tsdbCreateDFile
(
pRepo
,
pWSmadF
,
true
,
TSDB_FILE_SMAD
)
<
0
)
{
if
(
tsdbCreateDFile
(
pRepo
,
pWSmadF
,
true
,
TSDB_FILE_SMAD
)
<
0
)
{
tsdbError
(
"vgId:%d failed to create file %s to commit since %s"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pWSmadF
),
tsdbError
(
"vgId:%d
,
failed to create file %s to commit since %s"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pWSmadF
),
tstrerror
(
terrno
));
tstrerror
(
terrno
));
tsdbCloseDFileSet
(
pWSet
);
tsdbCloseDFileSet
(
pWSet
);
...
@@ -664,7 +664,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
...
@@ -664,7 +664,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
}
else
{
}
else
{
tsdbInitDFileEx
(
pWSmadF
,
pRSmadF
);
tsdbInitDFileEx
(
pWSmadF
,
pRSmadF
);
if
(
tsdbOpenDFile
(
pWSmadF
,
O_RDWR
)
<
0
)
{
if
(
tsdbOpenDFile
(
pWSmadF
,
O_RDWR
)
<
0
)
{
tsdbError
(
"vgId:%d failed to open file %s to commit since %s"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pWSmadF
),
tsdbError
(
"vgId:%d
,
failed to open file %s to commit since %s"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pWSmadF
),
tstrerror
(
terrno
));
tstrerror
(
terrno
));
tsdbCloseDFileSet
(
pWSet
);
tsdbCloseDFileSet
(
pWSet
);
...
@@ -683,7 +683,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
...
@@ -683,7 +683,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
if
((
pCommith
->
isLFileSame
)
&&
taosCheckExistFile
(
TSDB_FILE_FULL_NAME
(
pRSmalF
)))
{
if
((
pCommith
->
isLFileSame
)
&&
taosCheckExistFile
(
TSDB_FILE_FULL_NAME
(
pRSmalF
)))
{
tsdbInitDFileEx
(
pWSmalF
,
pRSmalF
);
tsdbInitDFileEx
(
pWSmalF
,
pRSmalF
);
if
(
tsdbOpenDFile
(
pWSmalF
,
O_RDWR
)
<
0
)
{
if
(
tsdbOpenDFile
(
pWSmalF
,
O_RDWR
)
<
0
)
{
tsdbError
(
"vgId:%d failed to open file %s to commit since %s"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pWSmalF
),
tsdbError
(
"vgId:%d
,
failed to open file %s to commit since %s"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pWSmalF
),
tstrerror
(
terrno
));
tstrerror
(
terrno
));
tsdbCloseDFileSet
(
pWSet
);
tsdbCloseDFileSet
(
pWSet
);
...
@@ -694,11 +694,11 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
...
@@ -694,11 +694,11 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
}
}
}
}
}
else
{
}
else
{
tsdbDebug
(
"vgId:%d create data file %s as not exist"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pRSmalF
));
tsdbDebug
(
"vgId:%d
,
create data file %s as not exist"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pRSmalF
));
tsdbInitDFile
(
pRepo
,
pWSmalF
,
did
,
fid
,
FS_TXN_VERSION
(
REPO_FS
(
pRepo
)),
TSDB_FILE_SMAL
);
tsdbInitDFile
(
pRepo
,
pWSmalF
,
did
,
fid
,
FS_TXN_VERSION
(
REPO_FS
(
pRepo
)),
TSDB_FILE_SMAL
);
if
(
tsdbCreateDFile
(
pRepo
,
pWSmalF
,
true
,
TSDB_FILE_SMAL
)
<
0
)
{
if
(
tsdbCreateDFile
(
pRepo
,
pWSmalF
,
true
,
TSDB_FILE_SMAL
)
<
0
)
{
tsdbError
(
"vgId:%d failed to create file %s to commit since %s"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pWSmalF
),
tsdbError
(
"vgId:%d
,
failed to create file %s to commit since %s"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pWSmalF
),
tstrerror
(
terrno
));
tstrerror
(
terrno
));
tsdbCloseDFileSet
(
pWSet
);
tsdbCloseDFileSet
(
pWSet
);
...
@@ -899,7 +899,7 @@ static int tsdbCommitToTable(SCommitH *pCommith, int tid) {
...
@@ -899,7 +899,7 @@ static int tsdbCommitToTable(SCommitH *pCommith, int tid) {
}
}
if
(
tsdbWriteBlockInfo
(
pCommith
)
<
0
)
{
if
(
tsdbWriteBlockInfo
(
pCommith
)
<
0
)
{
tsdbError
(
"vgId:%d failed to write SBlockInfo part into file %s since %s"
,
TSDB_COMMIT_REPO_ID
(
pCommith
),
tsdbError
(
"vgId:%d
,
failed to write SBlockInfo part into file %s since %s"
,
TSDB_COMMIT_REPO_ID
(
pCommith
),
TSDB_FILE_FULL_NAME
(
TSDB_COMMIT_HEAD_FILE
(
pCommith
)),
tstrerror
(
terrno
));
TSDB_FILE_FULL_NAME
(
TSDB_COMMIT_HEAD_FILE
(
pCommith
)),
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
...
@@ -941,7 +941,7 @@ static int tsdbMoveBlkIdx(SCommitH *pCommith, SBlockIdx *pIdx) {
...
@@ -941,7 +941,7 @@ static int tsdbMoveBlkIdx(SCommitH *pCommith, SBlockIdx *pIdx) {
}
}
if
(
tsdbMoveBlock
(
pCommith
,
bidx
)
<
0
)
{
if
(
tsdbMoveBlock
(
pCommith
,
bidx
)
<
0
)
{
tsdbError
(
"vgId:%d failed to move block into file %s since %s"
,
TSDB_COMMIT_REPO_ID
(
pCommith
),
tsdbError
(
"vgId:%d
,
failed to move block into file %s since %s"
,
TSDB_COMMIT_REPO_ID
(
pCommith
),
TSDB_FILE_FULL_NAME
(
TSDB_COMMIT_HEAD_FILE
(
pCommith
)),
tstrerror
(
terrno
));
TSDB_FILE_FULL_NAME
(
TSDB_COMMIT_HEAD_FILE
(
pCommith
)),
tstrerror
(
terrno
));
taosMemoryFreeClear
(
pTSchema
);
taosMemoryFreeClear
(
pTSchema
);
return
-
1
;
return
-
1
;
...
@@ -951,7 +951,7 @@ static int tsdbMoveBlkIdx(SCommitH *pCommith, SBlockIdx *pIdx) {
...
@@ -951,7 +951,7 @@ static int tsdbMoveBlkIdx(SCommitH *pCommith, SBlockIdx *pIdx) {
}
}
if
(
tsdbWriteBlockInfo
(
pCommith
)
<
0
)
{
if
(
tsdbWriteBlockInfo
(
pCommith
)
<
0
)
{
tsdbError
(
"vgId:%d failed to write SBlockInfo part into file %s since %s"
,
TSDB_COMMIT_REPO_ID
(
pCommith
),
tsdbError
(
"vgId:%d
,
failed to write SBlockInfo part into file %s since %s"
,
TSDB_COMMIT_REPO_ID
(
pCommith
),
TSDB_FILE_FULL_NAME
(
TSDB_COMMIT_HEAD_FILE
(
pCommith
)),
tstrerror
(
terrno
));
TSDB_FILE_FULL_NAME
(
TSDB_COMMIT_HEAD_FILE
(
pCommith
)),
tstrerror
(
terrno
));
taosMemoryFreeClear
(
pTSchema
);
taosMemoryFreeClear
(
pTSchema
);
return
-
1
;
return
-
1
;
...
@@ -1221,7 +1221,7 @@ int tsdbWriteBlockImpl(STsdb *pRepo, STable *pTable, SDFile *pDFile, SDFile *pDF
...
@@ -1221,7 +1221,7 @@ int tsdbWriteBlockImpl(STsdb *pRepo, STable *pTable, SDFile *pDFile, SDFile *pDF
pBlock
->
blkVer
=
SBlockVerLatest
;
pBlock
->
blkVer
=
SBlockVerLatest
;
pBlock
->
aggrOffset
=
(
uint64_t
)
offsetAggr
;
pBlock
->
aggrOffset
=
(
uint64_t
)
offsetAggr
;
tsdbDebug
(
"vgId:%d uid:%"
PRId64
" a block of data is written to file %s, offset %"
PRId64
tsdbDebug
(
"vgId:%d
,
uid:%"
PRId64
" a block of data is written to file %s, offset %"
PRId64
" numOfRows %d len %d numOfCols %"
PRId16
" keyFirst %"
PRId64
" keyLast %"
PRId64
,
" numOfRows %d len %d numOfCols %"
PRId16
" keyFirst %"
PRId64
" keyLast %"
PRId64
,
REPO_ID
(
pRepo
),
TABLE_UID
(
pTable
),
TSDB_FILE_FULL_NAME
(
pDFile
),
offset
,
rowsToWrite
,
pBlock
->
len
,
REPO_ID
(
pRepo
),
TABLE_UID
(
pTable
),
TSDB_FILE_FULL_NAME
(
pDFile
),
offset
,
rowsToWrite
,
pBlock
->
len
,
pBlock
->
numOfCols
,
pBlock
->
keyFirst
,
pBlock
->
keyLast
);
pBlock
->
numOfCols
,
pBlock
->
keyFirst
,
pBlock
->
keyLast
);
...
...
source/dnode/vnode/src/tsdb/tsdbFS.c
浏览文件 @
6b17c1ca
...
@@ -260,7 +260,7 @@ int tsdbOpenFS(STsdb *pRepo) {
...
@@ -260,7 +260,7 @@ int tsdbOpenFS(STsdb *pRepo) {
tsdbGetRtnSnap
(
pRepo
,
&
pRepo
->
rtn
);
tsdbGetRtnSnap
(
pRepo
,
&
pRepo
->
rtn
);
if
(
taosCheckExistFile
(
current
))
{
if
(
taosCheckExistFile
(
current
))
{
if
(
tsdbOpenFSFromCurrent
(
pRepo
)
<
0
)
{
if
(
tsdbOpenFSFromCurrent
(
pRepo
)
<
0
)
{
tsdbError
(
"vgId:%d failed to open FS since %s"
,
REPO_ID
(
pRepo
),
tstrerror
(
terrno
));
tsdbError
(
"vgId:%d
,
failed to open FS since %s"
,
REPO_ID
(
pRepo
),
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
...
@@ -271,19 +271,19 @@ int tsdbOpenFS(STsdb *pRepo) {
...
@@ -271,19 +271,19 @@ int tsdbOpenFS(STsdb *pRepo) {
}
else
{
}
else
{
// should skip expired fileset inside of the function
// should skip expired fileset inside of the function
if
(
tsdbRestoreCurrent
(
pRepo
)
<
0
)
{
if
(
tsdbRestoreCurrent
(
pRepo
)
<
0
)
{
tsdbError
(
"vgId:%d failed to restore current file since %s"
,
REPO_ID
(
pRepo
),
tstrerror
(
terrno
));
tsdbError
(
"vgId:%d
,
failed to restore current file since %s"
,
REPO_ID
(
pRepo
),
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
}
}
if
(
tsdbScanAndTryFixFS
(
pRepo
)
<
0
)
{
if
(
tsdbScanAndTryFixFS
(
pRepo
)
<
0
)
{
tsdbError
(
"vgId:%d failed to scan and fix FS since %s"
,
REPO_ID
(
pRepo
),
tstrerror
(
terrno
));
tsdbError
(
"vgId:%d
,
failed to scan and fix FS since %s"
,
REPO_ID
(
pRepo
),
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
// // Load meta cache if has meta file
// // Load meta cache if has meta file
// if ((!(pRepo->state & TSDB_STATE_BAD_META)) && tsdbLoadMetaCache(pRepo, true) < 0) {
// if ((!(pRepo->state & TSDB_STATE_BAD_META)) && tsdbLoadMetaCache(pRepo, true) < 0) {
// tsdbError("vgId:%d failed to open FS while loading meta cache since %s", REPO_ID(pRepo), tstrerror(terrno));
// tsdbError("vgId:%d
,
failed to open FS while loading meta cache since %s", REPO_ID(pRepo), tstrerror(terrno));
// return -1;
// return -1;
// }
// }
...
@@ -607,7 +607,7 @@ static int tsdbOpenFSFromCurrent(STsdb *pRepo) {
...
@@ -607,7 +607,7 @@ static int tsdbOpenFSFromCurrent(STsdb *pRepo) {
// current file exists, try to recover
// current file exists, try to recover
pFile
=
taosOpenFile
(
current
,
TD_FILE_READ
);
pFile
=
taosOpenFile
(
current
,
TD_FILE_READ
);
if
(
pFile
==
NULL
)
{
if
(
pFile
==
NULL
)
{
tsdbError
(
"vgId:%d failed to open file %s since %s"
,
REPO_ID
(
pRepo
),
current
,
strerror
(
errno
));
tsdbError
(
"vgId:%d
,
failed to open file %s since %s"
,
REPO_ID
(
pRepo
),
current
,
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
goto
_err
;
goto
_err
;
}
}
...
@@ -618,20 +618,20 @@ static int tsdbOpenFSFromCurrent(STsdb *pRepo) {
...
@@ -618,20 +618,20 @@ static int tsdbOpenFSFromCurrent(STsdb *pRepo) {
int
nread
=
(
int
)
taosReadFile
(
pFile
,
buffer
,
TSDB_FILE_HEAD_SIZE
);
int
nread
=
(
int
)
taosReadFile
(
pFile
,
buffer
,
TSDB_FILE_HEAD_SIZE
);
if
(
nread
<
0
)
{
if
(
nread
<
0
)
{
tsdbError
(
"vgId:%d failed to read %d bytes from file %s since %s"
,
REPO_ID
(
pRepo
),
TSDB_FILENAME_LEN
,
current
,
tsdbError
(
"vgId:%d
,
failed to read %d bytes from file %s since %s"
,
REPO_ID
(
pRepo
),
TSDB_FILENAME_LEN
,
current
,
strerror
(
errno
));
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
goto
_err
;
goto
_err
;
}
}
if
(
nread
<
TSDB_FILE_HEAD_SIZE
)
{
if
(
nread
<
TSDB_FILE_HEAD_SIZE
)
{
tsdbError
(
"vgId:%d failed to read header of file %s, read bytes:%d"
,
REPO_ID
(
pRepo
),
current
,
nread
);
tsdbError
(
"vgId:%d
,
failed to read header of file %s, read bytes:%d"
,
REPO_ID
(
pRepo
),
current
,
nread
);
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
goto
_err
;
goto
_err
;
}
}
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)
buffer
,
TSDB_FILE_HEAD_SIZE
))
{
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)
buffer
,
TSDB_FILE_HEAD_SIZE
))
{
tsdbError
(
"vgId:%d header of file %s failed checksum check"
,
REPO_ID
(
pRepo
),
current
);
tsdbError
(
"vgId:%d
,
header of file %s failed checksum check"
,
REPO_ID
(
pRepo
),
current
);
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
goto
_err
;
goto
_err
;
}
}
...
@@ -652,19 +652,19 @@ static int tsdbOpenFSFromCurrent(STsdb *pRepo) {
...
@@ -652,19 +652,19 @@ static int tsdbOpenFSFromCurrent(STsdb *pRepo) {
nread
=
(
int
)
taosReadFile
(
pFile
,
buffer
,
fsheader
.
len
);
nread
=
(
int
)
taosReadFile
(
pFile
,
buffer
,
fsheader
.
len
);
if
(
nread
<
0
)
{
if
(
nread
<
0
)
{
tsdbError
(
"vgId:%d failed to read file %s since %s"
,
REPO_ID
(
pRepo
),
current
,
strerror
(
errno
));
tsdbError
(
"vgId:%d
,
failed to read file %s since %s"
,
REPO_ID
(
pRepo
),
current
,
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
goto
_err
;
goto
_err
;
}
}
if
(
nread
<
fsheader
.
len
)
{
if
(
nread
<
fsheader
.
len
)
{
tsdbError
(
"vgId:%d failed to read %d bytes from file %s"
,
REPO_ID
(
pRepo
),
fsheader
.
len
,
current
);
tsdbError
(
"vgId:%d
,
failed to read %d bytes from file %s"
,
REPO_ID
(
pRepo
),
fsheader
.
len
,
current
);
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
goto
_err
;
goto
_err
;
}
}
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)
buffer
,
fsheader
.
len
))
{
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)
buffer
,
fsheader
.
len
))
{
tsdbError
(
"vgId:%d file %s is corrupted since wrong checksum"
,
REPO_ID
(
pRepo
),
current
);
tsdbError
(
"vgId:%d
,
file %s is corrupted since wrong checksum"
,
REPO_ID
(
pRepo
),
current
);
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
goto
_err
;
goto
_err
;
}
}
...
@@ -694,7 +694,7 @@ static int tsdbScanAndTryFixFS(STsdb *pRepo) {
...
@@ -694,7 +694,7 @@ static int tsdbScanAndTryFixFS(STsdb *pRepo) {
SFSStatus
*
pStatus
=
pfs
->
cstatus
;
SFSStatus
*
pStatus
=
pfs
->
cstatus
;
// if (tsdbScanAndTryFixMFile(pRepo) < 0) {
// if (tsdbScanAndTryFixMFile(pRepo) < 0) {
// tsdbError("vgId:%d failed to fix MFile since %s", REPO_ID(pRepo), tstrerror(terrno));
// tsdbError("vgId:%d
,
failed to fix MFile since %s", REPO_ID(pRepo), tstrerror(terrno));
// return -1;
// return -1;
// }
// }
...
@@ -704,7 +704,7 @@ static int tsdbScanAndTryFixFS(STsdb *pRepo) {
...
@@ -704,7 +704,7 @@ static int tsdbScanAndTryFixFS(STsdb *pRepo) {
SDFileSet
*
pSet
=
(
SDFileSet
*
)
taosArrayGet
(
pStatus
->
df
,
i
);
SDFileSet
*
pSet
=
(
SDFileSet
*
)
taosArrayGet
(
pStatus
->
df
,
i
);
if
(
tsdbScanAndTryFixDFileSet
(
pRepo
,
pSet
)
<
0
)
{
if
(
tsdbScanAndTryFixDFileSet
(
pRepo
,
pSet
)
<
0
)
{
tsdbError
(
"vgId:%d failed to fix MFile since %s"
,
REPO_ID
(
pRepo
),
tstrerror
(
terrno
));
tsdbError
(
"vgId:%d
,
failed to fix MFile since %s"
,
REPO_ID
(
pRepo
),
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
}
}
...
@@ -724,7 +724,7 @@ static int tsdbScanRootDir(STsdb *pRepo) {
...
@@ -724,7 +724,7 @@ static int tsdbScanRootDir(STsdb *pRepo) {
tsdbGetRootDir
(
REPO_ID
(
pRepo
),
pRepo
->
dir
,
rootDir
);
tsdbGetRootDir
(
REPO_ID
(
pRepo
),
pRepo
->
dir
,
rootDir
);
STfsDir
*
tdir
=
tfsOpendir
(
REPO_TFS
(
pRepo
),
rootDir
);
STfsDir
*
tdir
=
tfsOpendir
(
REPO_TFS
(
pRepo
),
rootDir
);
if
(
tdir
==
NULL
)
{
if
(
tdir
==
NULL
)
{
tsdbError
(
"vgId:%d failed to open directory %s since %s"
,
REPO_ID
(
pRepo
),
rootDir
,
tstrerror
(
terrno
));
tsdbError
(
"vgId:%d
,
failed to open directory %s since %s"
,
REPO_ID
(
pRepo
),
rootDir
,
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
...
@@ -741,7 +741,7 @@ static int tsdbScanRootDir(STsdb *pRepo) {
...
@@ -741,7 +741,7 @@ static int tsdbScanRootDir(STsdb *pRepo) {
// }
// }
(
void
)
tfsRemoveFile
(
pf
);
(
void
)
tfsRemoveFile
(
pf
);
tsdbDebug
(
"vgId:%d invalid file %s is removed"
,
REPO_ID
(
pRepo
),
pf
->
aname
);
tsdbDebug
(
"vgId:%d
,
invalid file %s is removed"
,
REPO_ID
(
pRepo
),
pf
->
aname
);
}
}
tfsClosedir
(
tdir
);
tfsClosedir
(
tdir
);
...
@@ -758,7 +758,7 @@ static int tsdbScanDataDir(STsdb *pRepo) {
...
@@ -758,7 +758,7 @@ static int tsdbScanDataDir(STsdb *pRepo) {
tsdbGetDataDir
(
REPO_ID
(
pRepo
),
pRepo
->
dir
,
dataDir
);
tsdbGetDataDir
(
REPO_ID
(
pRepo
),
pRepo
->
dir
,
dataDir
);
STfsDir
*
tdir
=
tfsOpendir
(
REPO_TFS
(
pRepo
),
dataDir
);
STfsDir
*
tdir
=
tfsOpendir
(
REPO_TFS
(
pRepo
),
dataDir
);
if
(
tdir
==
NULL
)
{
if
(
tdir
==
NULL
)
{
tsdbError
(
"vgId:%d failed to open directory %s since %s"
,
REPO_ID
(
pRepo
),
dataDir
,
tstrerror
(
terrno
));
tsdbError
(
"vgId:%d
,
failed to open directory %s since %s"
,
REPO_ID
(
pRepo
),
dataDir
,
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
...
@@ -767,7 +767,7 @@ static int tsdbScanDataDir(STsdb *pRepo) {
...
@@ -767,7 +767,7 @@ static int tsdbScanDataDir(STsdb *pRepo) {
if
(
!
tsdbIsTFileInFS
(
pfs
,
pf
))
{
if
(
!
tsdbIsTFileInFS
(
pfs
,
pf
))
{
(
void
)
tfsRemoveFile
(
pf
);
(
void
)
tfsRemoveFile
(
pf
);
tsdbDebug
(
"vgId:%d invalid file %s is removed"
,
REPO_ID
(
pRepo
),
pf
->
aname
);
tsdbDebug
(
"vgId:%d
,
invalid file %s is removed"
,
REPO_ID
(
pRepo
),
pf
->
aname
);
}
}
}
}
...
@@ -811,7 +811,7 @@ static int tsdbRestoreDFileSet(STsdb *pRepo) {
...
@@ -811,7 +811,7 @@ static int tsdbRestoreDFileSet(STsdb *pRepo) {
fArray
=
taosArrayInit
(
1024
,
sizeof
(
STfsFile
));
fArray
=
taosArrayInit
(
1024
,
sizeof
(
STfsFile
));
if
(
fArray
==
NULL
)
{
if
(
fArray
==
NULL
)
{
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
tsdbError
(
"vgId:%d failed to restore DFileSet while open directory %s since %s"
,
REPO_ID
(
pRepo
),
dataDir
,
tsdbError
(
"vgId:%d
,
failed to restore DFileSet while open directory %s since %s"
,
REPO_ID
(
pRepo
),
dataDir
,
tstrerror
(
terrno
));
tstrerror
(
terrno
));
regfree
(
&
regex
);
regfree
(
&
regex
);
return
-
1
;
return
-
1
;
...
@@ -819,7 +819,7 @@ static int tsdbRestoreDFileSet(STsdb *pRepo) {
...
@@ -819,7 +819,7 @@ static int tsdbRestoreDFileSet(STsdb *pRepo) {
tdir
=
tfsOpendir
(
REPO_TFS
(
pRepo
),
dataDir
);
tdir
=
tfsOpendir
(
REPO_TFS
(
pRepo
),
dataDir
);
if
(
tdir
==
NULL
)
{
if
(
tdir
==
NULL
)
{
tsdbError
(
"vgId:%d failed to restore DFileSet while open directory %s since %s"
,
REPO_ID
(
pRepo
),
dataDir
,
tsdbError
(
"vgId:%d
,
failed to restore DFileSet while open directory %s since %s"
,
REPO_ID
(
pRepo
),
dataDir
,
tstrerror
(
terrno
));
tstrerror
(
terrno
));
taosArrayDestroy
(
fArray
);
taosArrayDestroy
(
fArray
);
regfree
(
&
regex
);
regfree
(
&
regex
);
...
@@ -840,12 +840,12 @@ static int tsdbRestoreDFileSet(STsdb *pRepo) {
...
@@ -840,12 +840,12 @@ static int tsdbRestoreDFileSet(STsdb *pRepo) {
}
}
}
else
if
(
code
==
REG_NOMATCH
)
{
}
else
if
(
code
==
REG_NOMATCH
)
{
// Not match
// Not match
tsdbInfo
(
"vgId:%d invalid file %s exists, remove it"
,
REPO_ID
(
pRepo
),
pf
->
aname
);
tsdbInfo
(
"vgId:%d
,
invalid file %s exists, remove it"
,
REPO_ID
(
pRepo
),
pf
->
aname
);
(
void
)
tfsRemoveFile
(
pf
);
(
void
)
tfsRemoveFile
(
pf
);
continue
;
continue
;
}
else
{
}
else
{
// Has other error
// Has other error
tsdbError
(
"vgId:%d failed to restore DFileSet Array while run regexec since %s"
,
REPO_ID
(
pRepo
),
strerror
(
code
));
tsdbError
(
"vgId:%d
,
failed to restore DFileSet Array while run regexec since %s"
,
REPO_ID
(
pRepo
),
strerror
(
code
));
terrno
=
TAOS_SYSTEM_ERROR
(
code
);
terrno
=
TAOS_SYSTEM_ERROR
(
code
);
tfsClosedir
(
tdir
);
tfsClosedir
(
tdir
);
taosArrayDestroy
(
fArray
);
taosArrayDestroy
(
fArray
);
...
@@ -876,7 +876,7 @@ static int tsdbRestoreDFileSet(STsdb *pRepo) {
...
@@ -876,7 +876,7 @@ static int tsdbRestoreDFileSet(STsdb *pRepo) {
SDFile
*
pDFile
=
TSDB_DFILE_IN_SET
(
&
fset
,
ftype
);
SDFile
*
pDFile
=
TSDB_DFILE_IN_SET
(
&
fset
,
ftype
);
if
(
index
>=
taosArrayGetSize
(
fArray
))
{
if
(
index
>=
taosArrayGetSize
(
fArray
))
{
tsdbError
(
"vgId:%d incomplete DFileSet, fid:%d"
,
REPO_ID
(
pRepo
),
fset
.
fid
);
tsdbError
(
"vgId:%d
,
incomplete DFileSet, fid:%d"
,
REPO_ID
(
pRepo
),
fset
.
fid
);
taosArrayDestroy
(
fArray
);
taosArrayDestroy
(
fArray
);
return
-
1
;
return
-
1
;
}
}
...
@@ -902,14 +902,14 @@ static int tsdbRestoreDFileSet(STsdb *pRepo) {
...
@@ -902,14 +902,14 @@ static int tsdbRestoreDFileSet(STsdb *pRepo) {
fset
.
fid
=
tfid
;
fset
.
fid
=
tfid
;
}
else
{
}
else
{
if
(
tfid
!=
fset
.
fid
)
{
if
(
tfid
!=
fset
.
fid
)
{
tsdbError
(
"vgId:%d incomplete dFileSet, fid:%d"
,
REPO_ID
(
pRepo
),
fset
.
fid
);
tsdbError
(
"vgId:%d
,
incomplete dFileSet, fid:%d"
,
REPO_ID
(
pRepo
),
fset
.
fid
);
taosArrayDestroy
(
fArray
);
taosArrayDestroy
(
fArray
);
return
-
1
;
return
-
1
;
}
}
}
}
if
(
ttype
!=
ftype
)
{
if
(
ttype
!=
ftype
)
{
tsdbError
(
"vgId:%d incomplete dFileSet, fid:%d"
,
REPO_ID
(
pRepo
),
fset
.
fid
);
tsdbError
(
"vgId:%d
,
incomplete dFileSet, fid:%d"
,
REPO_ID
(
pRepo
),
fset
.
fid
);
taosArrayDestroy
(
fArray
);
taosArrayDestroy
(
fArray
);
return
-
1
;
return
-
1
;
}
}
...
@@ -918,14 +918,14 @@ static int tsdbRestoreDFileSet(STsdb *pRepo) {
...
@@ -918,14 +918,14 @@ static int tsdbRestoreDFileSet(STsdb *pRepo) {
// if (tsdbOpenDFile(pDFile, O_RDONLY) < 0) {
// if (tsdbOpenDFile(pDFile, O_RDONLY) < 0) {
if
(
tsdbOpenDFile
(
pDFile
,
TD_FILE_READ
)
<
0
)
{
if
(
tsdbOpenDFile
(
pDFile
,
TD_FILE_READ
)
<
0
)
{
tsdbError
(
"vgId:%d failed to open DFile %s since %s"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pDFile
),
tsdbError
(
"vgId:%d
,
failed to open DFile %s since %s"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pDFile
),
tstrerror
(
terrno
));
tstrerror
(
terrno
));
taosArrayDestroy
(
fArray
);
taosArrayDestroy
(
fArray
);
return
-
1
;
return
-
1
;
}
}
if
(
tsdbLoadDFileHeader
(
pDFile
,
&
(
pDFile
->
info
))
<
0
)
{
if
(
tsdbLoadDFileHeader
(
pDFile
,
&
(
pDFile
->
info
))
<
0
)
{
tsdbError
(
"vgId:%d failed to load DFile %s header since %s"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pDFile
),
tsdbError
(
"vgId:%d
,
failed to load DFile %s header since %s"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pDFile
),
tstrerror
(
terrno
));
tstrerror
(
terrno
));
taosArrayDestroy
(
fArray
);
taosArrayDestroy
(
fArray
);
return
-
1
;
return
-
1
;
...
@@ -943,7 +943,7 @@ static int tsdbRestoreDFileSet(STsdb *pRepo) {
...
@@ -943,7 +943,7 @@ static int tsdbRestoreDFileSet(STsdb *pRepo) {
if
(
pDFile
->
info
.
size
!=
file_size
)
{
if
(
pDFile
->
info
.
size
!=
file_size
)
{
int64_t
tfsize
=
pDFile
->
info
.
size
;
int64_t
tfsize
=
pDFile
->
info
.
size
;
pDFile
->
info
.
size
=
file_size
;
pDFile
->
info
.
size
=
file_size
;
tsdbInfo
(
"vgId:%d file %s header size is changed from %"
PRId64
" to %"
PRId64
,
REPO_ID
(
pRepo
),
tsdbInfo
(
"vgId:%d
,
file %s header size is changed from %"
PRId64
" to %"
PRId64
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pDFile
),
tfsize
,
pDFile
->
info
.
size
);
TSDB_FILE_FULL_NAME
(
pDFile
),
tfsize
,
pDFile
->
info
.
size
);
}
}
}
}
...
@@ -952,7 +952,7 @@ static int tsdbRestoreDFileSet(STsdb *pRepo) {
...
@@ -952,7 +952,7 @@ static int tsdbRestoreDFileSet(STsdb *pRepo) {
index
++
;
index
++
;
}
}
tsdbInfo
(
"vgId:%d FSET %d is restored"
,
REPO_ID
(
pRepo
),
fset
.
fid
);
tsdbInfo
(
"vgId:%d
,
FSET %d is restored"
,
REPO_ID
(
pRepo
),
fset
.
fid
);
taosArrayPush
(
pfs
->
cstatus
->
df
,
&
fset
);
taosArrayPush
(
pfs
->
cstatus
->
df
,
&
fset
);
}
}
...
@@ -965,18 +965,18 @@ static int tsdbRestoreDFileSet(STsdb *pRepo) {
...
@@ -965,18 +965,18 @@ static int tsdbRestoreDFileSet(STsdb *pRepo) {
static
int
tsdbRestoreCurrent
(
STsdb
*
pRepo
)
{
static
int
tsdbRestoreCurrent
(
STsdb
*
pRepo
)
{
// // Loop to recover mfile
// // Loop to recover mfile
// if (tsdbRestoreMeta(pRepo) < 0) {
// if (tsdbRestoreMeta(pRepo) < 0) {
// tsdbError("vgId:%d failed to restore current since %s", REPO_ID(pRepo), tstrerror(terrno));
// tsdbError("vgId:%d
,
failed to restore current since %s", REPO_ID(pRepo), tstrerror(terrno));
// return -1;
// return -1;
// }
// }
// Loop to recover dfile set
// Loop to recover dfile set
if
(
tsdbRestoreDFileSet
(
pRepo
)
<
0
)
{
if
(
tsdbRestoreDFileSet
(
pRepo
)
<
0
)
{
tsdbError
(
"vgId:%d failed to restore DFileSet since %s"
,
REPO_ID
(
pRepo
),
tstrerror
(
terrno
));
tsdbError
(
"vgId:%d
,
failed to restore DFileSet since %s"
,
REPO_ID
(
pRepo
),
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
if
(
tsdbSaveFSStatus
(
pRepo
,
pRepo
->
fs
->
cstatus
)
<
0
)
{
if
(
tsdbSaveFSStatus
(
pRepo
,
pRepo
->
fs
->
cstatus
)
<
0
)
{
tsdbError
(
"vgId:%d failed to restore current since %s"
,
REPO_ID
(
pRepo
),
tstrerror
(
terrno
));
tsdbError
(
"vgId:%d
,
failed to restore current since %s"
,
REPO_ID
(
pRepo
),
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
...
@@ -1024,11 +1024,11 @@ static void tsdbScanAndTryFixDFilesHeader(STsdb *pRepo, int32_t *nExpired) {
...
@@ -1024,11 +1024,11 @@ static void tsdbScanAndTryFixDFilesHeader(STsdb *pRepo, int32_t *nExpired) {
if
(
fset
.
fid
<
pRepo
->
rtn
.
minFid
)
{
if
(
fset
.
fid
<
pRepo
->
rtn
.
minFid
)
{
++*
nExpired
;
++*
nExpired
;
}
}
tsdbDebug
(
"vgId:%d scan DFileSet %d header"
,
REPO_ID
(
pRepo
),
fset
.
fid
);
tsdbDebug
(
"vgId:%d
,
scan DFileSet %d header"
,
REPO_ID
(
pRepo
),
fset
.
fid
);
// if (tsdbOpenDFileSet(&fset, O_RDWR) < 0) {
// if (tsdbOpenDFileSet(&fset, O_RDWR) < 0) {
if
(
tsdbOpenDFileSet
(
&
fset
,
TD_FILE_WRITE
|
TD_FILE_READ
)
<
0
)
{
if
(
tsdbOpenDFileSet
(
&
fset
,
TD_FILE_WRITE
|
TD_FILE_READ
)
<
0
)
{
tsdbError
(
"vgId:%d failed to open DFileSet %d since %s, continue"
,
REPO_ID
(
pRepo
),
fset
.
fid
,
tstrerror
(
terrno
));
tsdbError
(
"vgId:%d
,
failed to open DFileSet %d since %s, continue"
,
REPO_ID
(
pRepo
),
fset
.
fid
,
tstrerror
(
terrno
));
continue
;
continue
;
}
}
...
@@ -1038,14 +1038,14 @@ static void tsdbScanAndTryFixDFilesHeader(STsdb *pRepo, int32_t *nExpired) {
...
@@ -1038,14 +1038,14 @@ static void tsdbScanAndTryFixDFilesHeader(STsdb *pRepo, int32_t *nExpired) {
if
((
tsdbLoadDFileHeader
(
pDFile
,
&
info
)
<
0
)
||
pDFile
->
info
.
size
!=
info
.
size
||
if
((
tsdbLoadDFileHeader
(
pDFile
,
&
info
)
<
0
)
||
pDFile
->
info
.
size
!=
info
.
size
||
pDFile
->
info
.
magic
!=
info
.
magic
)
{
pDFile
->
info
.
magic
!=
info
.
magic
)
{
if
(
tsdbUpdateDFileHeader
(
pDFile
)
<
0
)
{
if
(
tsdbUpdateDFileHeader
(
pDFile
)
<
0
)
{
tsdbError
(
"vgId:%d failed to update DFile header of %s since %s, continue"
,
REPO_ID
(
pRepo
),
tsdbError
(
"vgId:%d
,
failed to update DFile header of %s since %s, continue"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pDFile
),
tstrerror
(
terrno
));
TSDB_FILE_FULL_NAME
(
pDFile
),
tstrerror
(
terrno
));
}
else
{
}
else
{
tsdbInfo
(
"vgId:%d DFile header of %s is updated"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pDFile
));
tsdbInfo
(
"vgId:%d
,
DFile header of %s is updated"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pDFile
));
TSDB_FILE_FSYNC
(
pDFile
);
TSDB_FILE_FSYNC
(
pDFile
);
}
}
}
else
{
}
else
{
tsdbDebug
(
"vgId:%d DFile header of %s is correct"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pDFile
));
tsdbDebug
(
"vgId:%d
,
DFile header of %s is correct"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pDFile
));
}
}
}
}
...
...
source/dnode/vnode/src/tsdb/tsdbFile.c
浏览文件 @
6b17c1ca
...
@@ -181,7 +181,7 @@ static int tsdbScanAndTryFixDFile(STsdb *pRepo, SDFile *pDFile) {
...
@@ -181,7 +181,7 @@ static int tsdbScanAndTryFixDFile(STsdb *pRepo, SDFile *pDFile) {
tsdbInitDFileEx
(
&
df
,
pDFile
);
tsdbInitDFileEx
(
&
df
,
pDFile
);
if
(
!
taosCheckExistFile
(
TSDB_FILE_FULL_NAME
(
pDFile
)))
{
if
(
!
taosCheckExistFile
(
TSDB_FILE_FULL_NAME
(
pDFile
)))
{
tsdbError
(
"vgId:%d data file %s not exit, report to upper layer to fix it"
,
REPO_ID
(
pRepo
),
tsdbError
(
"vgId:%d
,
data file %s not exit, report to upper layer to fix it"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pDFile
));
TSDB_FILE_FULL_NAME
(
pDFile
));
// pRepo->state |= TSDB_STATE_BAD_DATA;
// pRepo->state |= TSDB_STATE_BAD_DATA;
TSDB_FILE_SET_STATE
(
pDFile
,
TSDB_FILE_STATE_BAD
);
TSDB_FILE_SET_STATE
(
pDFile
,
TSDB_FILE_STATE_BAD
);
...
@@ -211,17 +211,17 @@ static int tsdbScanAndTryFixDFile(STsdb *pRepo, SDFile *pDFile) {
...
@@ -211,17 +211,17 @@ static int tsdbScanAndTryFixDFile(STsdb *pRepo, SDFile *pDFile) {
}
}
tsdbCloseDFile
(
&
df
);
tsdbCloseDFile
(
&
df
);
tsdbInfo
(
"vgId:%d file %s is truncated from %"
PRId64
" to %"
PRId64
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pDFile
),
tsdbInfo
(
"vgId:%d
,
file %s is truncated from %"
PRId64
" to %"
PRId64
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pDFile
),
file_size
,
pDFile
->
info
.
size
);
file_size
,
pDFile
->
info
.
size
);
}
else
if
(
pDFile
->
info
.
size
>
file_size
)
{
}
else
if
(
pDFile
->
info
.
size
>
file_size
)
{
tsdbError
(
"vgId:%d data file %s has wrong size %"
PRId64
" expected %"
PRId64
", report to upper layer to fix it"
,
tsdbError
(
"vgId:%d
,
data file %s has wrong size %"
PRId64
" expected %"
PRId64
", report to upper layer to fix it"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pDFile
),
file_size
,
pDFile
->
info
.
size
);
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pDFile
),
file_size
,
pDFile
->
info
.
size
);
// pRepo->state |= TSDB_STATE_BAD_DATA;
// pRepo->state |= TSDB_STATE_BAD_DATA;
TSDB_FILE_SET_STATE
(
pDFile
,
TSDB_FILE_STATE_BAD
);
TSDB_FILE_SET_STATE
(
pDFile
,
TSDB_FILE_STATE_BAD
);
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
return
0
;
return
0
;
}
else
{
}
else
{
tsdbDebug
(
"vgId:%d file %s passes the scan"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pDFile
));
tsdbDebug
(
"vgId:%d
,
file %s passes the scan"
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pDFile
));
}
}
return
0
;
return
0
;
...
...
source/dnode/vnode/src/tsdb/tsdbMemTable2.c
浏览文件 @
6b17c1ca
...
@@ -118,7 +118,7 @@ int32_t tsdbInsertTableData2(STsdb *pTsdb, int64_t version, SVSubmitBlk *pSubmit
...
@@ -118,7 +118,7 @@ int32_t tsdbInsertTableData2(STsdb *pTsdb, int64_t version, SVSubmitBlk *pSubmit
code
=
tsdbGetOrCreateMemData
(
pMemTable
,
pSubmitBlk
->
suid
,
pSubmitBlk
->
uid
,
&
pMemData
);
code
=
tsdbGetOrCreateMemData
(
pMemTable
,
pSubmitBlk
->
suid
,
pSubmitBlk
->
uid
,
&
pMemData
);
if
(
code
)
{
if
(
code
)
{
tsdbError
(
"vgId:%d failed to create/get table data since %s"
,
TD_VID
(
pTsdb
->
pVnode
),
tstrerror
(
code
));
tsdbError
(
"vgId:%d
,
failed to create/get table data since %s"
,
TD_VID
(
pTsdb
->
pVnode
),
tstrerror
(
code
));
goto
_err
;
goto
_err
;
}
}
...
@@ -192,13 +192,13 @@ int32_t tsdbDeleteTableData2(STsdb *pTsdb, int64_t version, tb_uid_t suid, tb_ui
...
@@ -192,13 +192,13 @@ int32_t tsdbDeleteTableData2(STsdb *pTsdb, int64_t version, tb_uid_t suid, tb_ui
// update the state of pMemTable, pMemData, last and lastrow (todo)
// update the state of pMemTable, pMemData, last and lastrow (todo)
}
}
tsdbDebug
(
"vgId:%d delete data from table suid:%"
PRId64
" uid:%"
PRId64
" sKey:%"
PRId64
" eKey:%"
PRId64
tsdbDebug
(
"vgId:%d
,
delete data from table suid:%"
PRId64
" uid:%"
PRId64
" sKey:%"
PRId64
" eKey:%"
PRId64
" since %s"
,
" since %s"
,
TD_VID
(
pTsdb
->
pVnode
),
suid
,
uid
,
sKey
,
eKey
,
tstrerror
(
code
));
TD_VID
(
pTsdb
->
pVnode
),
suid
,
uid
,
sKey
,
eKey
,
tstrerror
(
code
));
return
code
;
return
code
;
_err:
_err:
tsdbError
(
"vgId:%d failed to delete data from table suid:%"
PRId64
" uid:%"
PRId64
" sKey:%"
PRId64
" eKey:%"
PRId64
tsdbError
(
"vgId:%d
,
failed to delete data from table suid:%"
PRId64
" uid:%"
PRId64
" sKey:%"
PRId64
" eKey:%"
PRId64
" since %s"
,
" since %s"
,
TD_VID
(
pTsdb
->
pVnode
),
suid
,
uid
,
sKey
,
eKey
,
tstrerror
(
code
));
TD_VID
(
pTsdb
->
pVnode
),
suid
,
uid
,
sKey
,
eKey
,
tstrerror
(
code
));
return
code
;
return
code
;
...
...
source/dnode/vnode/src/tsdb/tsdbOpen.c
浏览文件 @
6b17c1ca
...
@@ -74,7 +74,7 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *pKee
...
@@ -74,7 +74,7 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *pKee
goto
_err
;
goto
_err
;
}
}
tsdbDebug
(
"vgId:%d tsdb is opened for %s, days:%d, keep:%d,%d,%d"
,
TD_VID
(
pVnode
),
pTsdb
->
path
,
pTsdb
->
keepCfg
.
days
,
tsdbDebug
(
"vgId:%d
,
tsdb is opened for %s, days:%d, keep:%d,%d,%d"
,
TD_VID
(
pVnode
),
pTsdb
->
path
,
pTsdb
->
keepCfg
.
days
,
pTsdb
->
keepCfg
.
keep0
,
pTsdb
->
keepCfg
.
keep1
,
pTsdb
->
keepCfg
.
keep2
);
pTsdb
->
keepCfg
.
keep0
,
pTsdb
->
keepCfg
.
keep1
,
pTsdb
->
keepCfg
.
keep2
);
*
ppTsdb
=
pTsdb
;
*
ppTsdb
=
pTsdb
;
...
@@ -99,7 +99,7 @@ int tsdbClose(STsdb **pTsdb) {
...
@@ -99,7 +99,7 @@ int tsdbClose(STsdb **pTsdb) {
int
tsdbLockRepo
(
STsdb
*
pTsdb
)
{
int
tsdbLockRepo
(
STsdb
*
pTsdb
)
{
int
code
=
taosThreadMutexLock
(
&
pTsdb
->
mutex
);
int
code
=
taosThreadMutexLock
(
&
pTsdb
->
mutex
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
tsdbError
(
"vgId:%d failed to lock tsdb since %s"
,
REPO_ID
(
pTsdb
),
strerror
(
errno
));
tsdbError
(
"vgId:%d
,
failed to lock tsdb since %s"
,
REPO_ID
(
pTsdb
),
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
code
);
terrno
=
TAOS_SYSTEM_ERROR
(
code
);
return
-
1
;
return
-
1
;
}
}
...
@@ -112,7 +112,7 @@ int tsdbUnlockRepo(STsdb *pTsdb) {
...
@@ -112,7 +112,7 @@ int tsdbUnlockRepo(STsdb *pTsdb) {
pTsdb
->
repoLocked
=
false
;
pTsdb
->
repoLocked
=
false
;
int
code
=
taosThreadMutexUnlock
(
&
pTsdb
->
mutex
);
int
code
=
taosThreadMutexUnlock
(
&
pTsdb
->
mutex
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
tsdbError
(
"vgId:%d failed to unlock tsdb since %s"
,
REPO_ID
(
pTsdb
),
strerror
(
errno
));
tsdbError
(
"vgId:%d
,
failed to unlock tsdb since %s"
,
REPO_ID
(
pTsdb
),
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
code
);
terrno
=
TAOS_SYSTEM_ERROR
(
code
);
return
-
1
;
return
-
1
;
}
}
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
6b17c1ca
...
@@ -352,15 +352,15 @@ static STsdb* getTsdbByRetentions(SVnode* pVnode, STsdbReadHandle* pReadHandle,
...
@@ -352,15 +352,15 @@ static STsdb* getTsdbByRetentions(SVnode* pVnode, STsdbReadHandle* pReadHandle,
}
}
if
(
level
==
TSDB_RETENTION_L0
)
{
if
(
level
==
TSDB_RETENTION_L0
)
{
tsdbDebug
(
"vgId:%d read handle %p rsma level %d is selected to query"
,
TD_VID
(
pVnode
),
pReadHandle
,
tsdbDebug
(
"vgId:%d
,
read handle %p rsma level %d is selected to query"
,
TD_VID
(
pVnode
),
pReadHandle
,
TSDB_RETENTION_L0
);
TSDB_RETENTION_L0
);
return
VND_RSMA0
(
pVnode
);
return
VND_RSMA0
(
pVnode
);
}
else
if
(
level
==
TSDB_RETENTION_L1
)
{
}
else
if
(
level
==
TSDB_RETENTION_L1
)
{
tsdbDebug
(
"vgId:%d read handle %p rsma level %d is selected to query"
,
TD_VID
(
pVnode
),
pReadHandle
,
tsdbDebug
(
"vgId:%d
,
read handle %p rsma level %d is selected to query"
,
TD_VID
(
pVnode
),
pReadHandle
,
TSDB_RETENTION_L1
);
TSDB_RETENTION_L1
);
return
VND_RSMA1
(
pVnode
);
return
VND_RSMA1
(
pVnode
);
}
else
{
}
else
{
tsdbDebug
(
"vgId:%d read handle %p rsma level %d is selected to query"
,
TD_VID
(
pVnode
),
pReadHandle
,
tsdbDebug
(
"vgId:%d
,
read handle %p rsma level %d is selected to query"
,
TD_VID
(
pVnode
),
pReadHandle
,
TSDB_RETENTION_L2
);
TSDB_RETENTION_L2
);
return
VND_RSMA2
(
pVnode
);
return
VND_RSMA2
(
pVnode
);
}
}
...
@@ -3555,7 +3555,7 @@ int32_t tsdbRetrieveDataBlockStatisInfo(tsdbReaderT* pTsdbReadHandle, SColumnDat
...
@@ -3555,7 +3555,7 @@ int32_t tsdbRetrieveDataBlockStatisInfo(tsdbReaderT* pTsdbReadHandle, SColumnDat
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
tsdbDebug
(
"vgId:%d succeed to load block statis part for uid %"
PRIu64
,
REPO_ID
(
pHandle
->
pTsdb
),
tsdbDebug
(
"vgId:%d
,
succeed to load block statis part for uid %"
PRIu64
,
REPO_ID
(
pHandle
->
pTsdb
),
TSDB_READ_TABLE_UID
(
&
pHandle
->
rhelper
));
TSDB_READ_TABLE_UID
(
&
pHandle
->
rhelper
));
int16_t
*
colIds
=
pHandle
->
suppInfo
.
defaultLoadColumn
->
pData
;
int16_t
*
colIds
=
pHandle
->
suppInfo
.
defaultLoadColumn
->
pData
;
...
...
source/dnode/vnode/src/tsdb/tsdbReadImpl.c
浏览文件 @
6b17c1ca
...
@@ -87,7 +87,7 @@ int tsdbSetAndOpenReadFSet(SReadH *pReadh, SDFileSet *pSet) {
...
@@ -87,7 +87,7 @@ int tsdbSetAndOpenReadFSet(SReadH *pReadh, SDFileSet *pSet) {
TSDB_FSET_SET_CLOSED
(
TSDB_READ_FSET
(
pReadh
));
TSDB_FSET_SET_CLOSED
(
TSDB_READ_FSET
(
pReadh
));
// if (tsdbOpenDFileSet(TSDB_READ_FSET(pReadh), O_RDONLY) < 0) {
// if (tsdbOpenDFileSet(TSDB_READ_FSET(pReadh), O_RDONLY) < 0) {
if
(
tsdbOpenDFileSet
(
TSDB_READ_FSET
(
pReadh
),
TD_FILE_READ
)
<
0
)
{
if
(
tsdbOpenDFileSet
(
TSDB_READ_FSET
(
pReadh
),
TD_FILE_READ
)
<
0
)
{
tsdbError
(
"vgId:%d failed to open file set %d since %s"
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FSET_FID
(
pSet
),
tsdbError
(
"vgId:%d
,
failed to open file set %d since %s"
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FSET_FID
(
pSet
),
tstrerror
(
terrno
));
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
...
@@ -107,7 +107,7 @@ int tsdbLoadBlockIdx(SReadH *pReadh) {
...
@@ -107,7 +107,7 @@ int tsdbLoadBlockIdx(SReadH *pReadh) {
if
(
pHeadf
->
info
.
offset
<=
0
)
return
0
;
if
(
pHeadf
->
info
.
offset
<=
0
)
return
0
;
if
(
tsdbSeekDFile
(
pHeadf
,
pHeadf
->
info
.
offset
,
SEEK_SET
)
<
0
)
{
if
(
tsdbSeekDFile
(
pHeadf
,
pHeadf
->
info
.
offset
,
SEEK_SET
)
<
0
)
{
tsdbError
(
"vgId:%d failed to load SBlockIdx part while seek file %s since %s, offset:%u len :%u"
,
tsdbError
(
"vgId:%d
,
failed to load SBlockIdx part while seek file %s since %s, offset:%u len :%u"
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pHeadf
),
tstrerror
(
terrno
),
pHeadf
->
info
.
offset
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pHeadf
),
tstrerror
(
terrno
),
pHeadf
->
info
.
offset
,
pHeadf
->
info
.
len
);
pHeadf
->
info
.
len
);
return
-
1
;
return
-
1
;
...
@@ -117,7 +117,7 @@ int tsdbLoadBlockIdx(SReadH *pReadh) {
...
@@ -117,7 +117,7 @@ int tsdbLoadBlockIdx(SReadH *pReadh) {
int64_t
nread
=
tsdbReadDFile
(
pHeadf
,
TSDB_READ_BUF
(
pReadh
),
pHeadf
->
info
.
len
);
int64_t
nread
=
tsdbReadDFile
(
pHeadf
,
TSDB_READ_BUF
(
pReadh
),
pHeadf
->
info
.
len
);
if
(
nread
<
0
)
{
if
(
nread
<
0
)
{
tsdbError
(
"vgId:%d failed to load SBlockIdx part while read file %s since %s, offset:%u len :%u"
,
tsdbError
(
"vgId:%d
,
failed to load SBlockIdx part while read file %s since %s, offset:%u len :%u"
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pHeadf
),
tstrerror
(
terrno
),
pHeadf
->
info
.
offset
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pHeadf
),
tstrerror
(
terrno
),
pHeadf
->
info
.
offset
,
pHeadf
->
info
.
len
);
pHeadf
->
info
.
len
);
return
-
1
;
return
-
1
;
...
@@ -125,14 +125,14 @@ int tsdbLoadBlockIdx(SReadH *pReadh) {
...
@@ -125,14 +125,14 @@ int tsdbLoadBlockIdx(SReadH *pReadh) {
if
(
nread
<
pHeadf
->
info
.
len
)
{
if
(
nread
<
pHeadf
->
info
.
len
)
{
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
tsdbError
(
"vgId:%d SBlockIdx part in file %s is corrupted, offset:%u expected bytes:%u read bytes: %"
PRId64
,
tsdbError
(
"vgId:%d
,
SBlockIdx part in file %s is corrupted, offset:%u expected bytes:%u read bytes: %"
PRId64
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pHeadf
),
pHeadf
->
info
.
offset
,
pHeadf
->
info
.
len
,
nread
);
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pHeadf
),
pHeadf
->
info
.
offset
,
pHeadf
->
info
.
len
,
nread
);
return
-
1
;
return
-
1
;
}
}
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)
TSDB_READ_BUF
(
pReadh
),
pHeadf
->
info
.
len
))
{
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)
TSDB_READ_BUF
(
pReadh
),
pHeadf
->
info
.
len
))
{
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
tsdbError
(
"vgId:%d SBlockIdx part in file %s is corrupted since wrong checksum, offset:%u len :%u"
,
tsdbError
(
"vgId:%d
,
SBlockIdx part in file %s is corrupted since wrong checksum, offset:%u len :%u"
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pHeadf
),
pHeadf
->
info
.
offset
,
pHeadf
->
info
.
len
);
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pHeadf
),
pHeadf
->
info
.
offset
,
pHeadf
->
info
.
len
);
return
-
1
;
return
-
1
;
}
}
...
@@ -209,7 +209,7 @@ int tsdbLoadBlockInfo(SReadH *pReadh, void *pTarget) {
...
@@ -209,7 +209,7 @@ int tsdbLoadBlockInfo(SReadH *pReadh, void *pTarget) {
SBlockIdx
*
pBlkIdx
=
pReadh
->
pBlkIdx
;
SBlockIdx
*
pBlkIdx
=
pReadh
->
pBlkIdx
;
if
(
tsdbSeekDFile
(
pHeadf
,
pBlkIdx
->
offset
,
SEEK_SET
)
<
0
)
{
if
(
tsdbSeekDFile
(
pHeadf
,
pBlkIdx
->
offset
,
SEEK_SET
)
<
0
)
{
tsdbError
(
"vgId:%d failed to load SBlockInfo part while seek file %s since %s, offset:%u len:%u"
,
tsdbError
(
"vgId:%d
,
failed to load SBlockInfo part while seek file %s since %s, offset:%u len:%u"
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pHeadf
),
tstrerror
(
terrno
),
pBlkIdx
->
offset
,
pBlkIdx
->
len
);
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pHeadf
),
tstrerror
(
terrno
),
pBlkIdx
->
offset
,
pBlkIdx
->
len
);
return
-
1
;
return
-
1
;
}
}
...
@@ -218,21 +218,21 @@ int tsdbLoadBlockInfo(SReadH *pReadh, void *pTarget) {
...
@@ -218,21 +218,21 @@ int tsdbLoadBlockInfo(SReadH *pReadh, void *pTarget) {
int64_t
nread
=
tsdbReadDFile
(
pHeadf
,
(
void
*
)(
pReadh
->
pBlkInfo
),
pBlkIdx
->
len
);
int64_t
nread
=
tsdbReadDFile
(
pHeadf
,
(
void
*
)(
pReadh
->
pBlkInfo
),
pBlkIdx
->
len
);
if
(
nread
<
0
)
{
if
(
nread
<
0
)
{
tsdbError
(
"vgId:%d failed to load SBlockInfo part while read file %s since %s, offset:%u len :%u"
,
tsdbError
(
"vgId:%d
,
failed to load SBlockInfo part while read file %s since %s, offset:%u len :%u"
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pHeadf
),
tstrerror
(
terrno
),
pBlkIdx
->
offset
,
pBlkIdx
->
len
);
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pHeadf
),
tstrerror
(
terrno
),
pBlkIdx
->
offset
,
pBlkIdx
->
len
);
return
-
1
;
return
-
1
;
}
}
if
(
nread
<
pBlkIdx
->
len
)
{
if
(
nread
<
pBlkIdx
->
len
)
{
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
tsdbError
(
"vgId:%d SBlockInfo part in file %s is corrupted, offset:%u expected bytes:%u read bytes:%"
PRId64
,
tsdbError
(
"vgId:%d
,
SBlockInfo part in file %s is corrupted, offset:%u expected bytes:%u read bytes:%"
PRId64
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pHeadf
),
pBlkIdx
->
offset
,
pBlkIdx
->
len
,
nread
);
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pHeadf
),
pBlkIdx
->
offset
,
pBlkIdx
->
len
,
nread
);
return
-
1
;
return
-
1
;
}
}
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)(
pReadh
->
pBlkInfo
),
pBlkIdx
->
len
))
{
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)(
pReadh
->
pBlkInfo
),
pBlkIdx
->
len
))
{
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
tsdbError
(
"vgId:%d SBlockInfo part in file %s is corrupted since wrong checksum, offset:%u len :%u"
,
tsdbError
(
"vgId:%d
,
SBlockInfo part in file %s is corrupted since wrong checksum, offset:%u len :%u"
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pHeadf
),
pBlkIdx
->
offset
,
pBlkIdx
->
len
);
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pHeadf
),
pBlkIdx
->
offset
,
pBlkIdx
->
len
);
return
-
1
;
return
-
1
;
}
}
...
@@ -467,7 +467,7 @@ int tsdbLoadBlockStatis(SReadH *pReadh, SBlock *pBlock) {
...
@@ -467,7 +467,7 @@ int tsdbLoadBlockStatis(SReadH *pReadh, SBlock *pBlock) {
ASSERT
(
pBlock
->
numOfSubBlocks
<=
1
);
ASSERT
(
pBlock
->
numOfSubBlocks
<=
1
);
if
(
!
pBlock
->
aggrStat
)
{
if
(
!
pBlock
->
aggrStat
)
{
tsdbDebug
(
"vgId:%d no need to load block statis part for uid %"
PRIu64
" since not exist"
,
REPO_ID
(
pReadh
->
pRepo
),
tsdbDebug
(
"vgId:%d
,
no need to load block statis part for uid %"
PRIu64
" since not exist"
,
REPO_ID
(
pReadh
->
pRepo
),
TSDB_READ_TABLE_UID
(
pReadh
));
TSDB_READ_TABLE_UID
(
pReadh
));
return
TSDB_STATIS_NONE
;
return
TSDB_STATIS_NONE
;
}
}
...
@@ -475,7 +475,7 @@ int tsdbLoadBlockStatis(SReadH *pReadh, SBlock *pBlock) {
...
@@ -475,7 +475,7 @@ int tsdbLoadBlockStatis(SReadH *pReadh, SBlock *pBlock) {
SDFile
*
pDFileAggr
=
pBlock
->
last
?
TSDB_READ_SMAL_FILE
(
pReadh
)
:
TSDB_READ_SMAD_FILE
(
pReadh
);
SDFile
*
pDFileAggr
=
pBlock
->
last
?
TSDB_READ_SMAL_FILE
(
pReadh
)
:
TSDB_READ_SMAD_FILE
(
pReadh
);
if
(
tsdbSeekDFile
(
pDFileAggr
,
pBlock
->
aggrOffset
,
SEEK_SET
)
<
0
)
{
if
(
tsdbSeekDFile
(
pDFileAggr
,
pBlock
->
aggrOffset
,
SEEK_SET
)
<
0
)
{
tsdbError
(
"vgId:%d failed to load block statis part for uid %"
PRIu64
" while seek file %s to offset %"
PRIu64
tsdbError
(
"vgId:%d
,
failed to load block statis part for uid %"
PRIu64
" while seek file %s to offset %"
PRIu64
" since %s"
,
" since %s"
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_READ_TABLE_UID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFileAggr
),
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_READ_TABLE_UID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFileAggr
),
(
uint64_t
)
pBlock
->
aggrOffset
,
tstrerror
(
terrno
));
(
uint64_t
)
pBlock
->
aggrOffset
,
tstrerror
(
terrno
));
...
@@ -487,7 +487,7 @@ int tsdbLoadBlockStatis(SReadH *pReadh, SBlock *pBlock) {
...
@@ -487,7 +487,7 @@ int tsdbLoadBlockStatis(SReadH *pReadh, SBlock *pBlock) {
int64_t
nreadAggr
=
tsdbReadDFile
(
pDFileAggr
,
(
void
*
)(
pReadh
->
pAggrBlkData
),
sizeAggr
);
int64_t
nreadAggr
=
tsdbReadDFile
(
pDFileAggr
,
(
void
*
)(
pReadh
->
pAggrBlkData
),
sizeAggr
);
if
(
nreadAggr
<
0
)
{
if
(
nreadAggr
<
0
)
{
tsdbError
(
"vgId:%d failed to load block statis part for uid %"
PRIu64
tsdbError
(
"vgId:%d
,
failed to load block statis part for uid %"
PRIu64
" while read file %s since %s, offset:%"
PRIu64
" len :%"
PRIzu
,
" while read file %s since %s, offset:%"
PRIu64
" len :%"
PRIzu
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_READ_TABLE_UID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFileAggr
),
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_READ_TABLE_UID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFileAggr
),
tstrerror
(
terrno
),
(
uint64_t
)
pBlock
->
aggrOffset
,
sizeAggr
);
tstrerror
(
terrno
),
(
uint64_t
)
pBlock
->
aggrOffset
,
sizeAggr
);
...
@@ -496,7 +496,7 @@ int tsdbLoadBlockStatis(SReadH *pReadh, SBlock *pBlock) {
...
@@ -496,7 +496,7 @@ int tsdbLoadBlockStatis(SReadH *pReadh, SBlock *pBlock) {
if
(
nreadAggr
<
sizeAggr
)
{
if
(
nreadAggr
<
sizeAggr
)
{
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
tsdbError
(
"vgId:%d block statis part for uid %"
PRIu64
" in file %s is corrupted, offset:%"
PRIu64
tsdbError
(
"vgId:%d
,
block statis part for uid %"
PRIu64
" in file %s is corrupted, offset:%"
PRIu64
" expected bytes:%"
PRIzu
" read bytes: %"
PRId64
,
" expected bytes:%"
PRIzu
" read bytes: %"
PRId64
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_READ_TABLE_UID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFileAggr
),
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_READ_TABLE_UID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFileAggr
),
(
uint64_t
)
pBlock
->
aggrOffset
,
sizeAggr
,
nreadAggr
);
(
uint64_t
)
pBlock
->
aggrOffset
,
sizeAggr
,
nreadAggr
);
...
@@ -505,7 +505,7 @@ int tsdbLoadBlockStatis(SReadH *pReadh, SBlock *pBlock) {
...
@@ -505,7 +505,7 @@ int tsdbLoadBlockStatis(SReadH *pReadh, SBlock *pBlock) {
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)(
pReadh
->
pAggrBlkData
),
(
uint32_t
)
sizeAggr
))
{
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)(
pReadh
->
pAggrBlkData
),
(
uint32_t
)
sizeAggr
))
{
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
tsdbError
(
"vgId:%d block statis part for uid %"
PRIu64
tsdbError
(
"vgId:%d
,
block statis part for uid %"
PRIu64
"in file %s is corrupted since wrong checksum, offset:%"
PRIu64
" len :%"
PRIzu
,
"in file %s is corrupted since wrong checksum, offset:%"
PRIu64
" len :%"
PRIzu
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_READ_TABLE_UID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFileAggr
),
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_READ_TABLE_UID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFileAggr
),
(
uint64_t
)
pBlock
->
aggrOffset
,
sizeAggr
);
(
uint64_t
)
pBlock
->
aggrOffset
,
sizeAggr
);
...
@@ -518,7 +518,7 @@ static int tsdbLoadBlockOffset(SReadH *pReadh, SBlock *pBlock) {
...
@@ -518,7 +518,7 @@ static int tsdbLoadBlockOffset(SReadH *pReadh, SBlock *pBlock) {
ASSERT
(
pBlock
->
numOfSubBlocks
<=
1
);
ASSERT
(
pBlock
->
numOfSubBlocks
<=
1
);
SDFile
*
pDFile
=
(
pBlock
->
last
)
?
TSDB_READ_LAST_FILE
(
pReadh
)
:
TSDB_READ_DATA_FILE
(
pReadh
);
SDFile
*
pDFile
=
(
pBlock
->
last
)
?
TSDB_READ_LAST_FILE
(
pReadh
)
:
TSDB_READ_DATA_FILE
(
pReadh
);
if
(
tsdbSeekDFile
(
pDFile
,
pBlock
->
offset
,
SEEK_SET
)
<
0
)
{
if
(
tsdbSeekDFile
(
pDFile
,
pBlock
->
offset
,
SEEK_SET
)
<
0
)
{
tsdbError
(
"vgId:%d failed to load block head part while seek file %s to offset %"
PRId64
" since %s"
,
tsdbError
(
"vgId:%d
,
failed to load block head part while seek file %s to offset %"
PRId64
" since %s"
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
(
int64_t
)
pBlock
->
offset
,
tstrerror
(
terrno
));
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
(
int64_t
)
pBlock
->
offset
,
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
...
@@ -528,14 +528,14 @@ static int tsdbLoadBlockOffset(SReadH *pReadh, SBlock *pBlock) {
...
@@ -528,14 +528,14 @@ static int tsdbLoadBlockOffset(SReadH *pReadh, SBlock *pBlock) {
int64_t
nread
=
tsdbReadDFile
(
pDFile
,
(
void
*
)(
pReadh
->
pBlkData
),
size
);
int64_t
nread
=
tsdbReadDFile
(
pDFile
,
(
void
*
)(
pReadh
->
pBlkData
),
size
);
if
(
nread
<
0
)
{
if
(
nread
<
0
)
{
tsdbError
(
"vgId:%d failed to load block head part while read file %s since %s, offset:%"
PRId64
" len :%"
PRIzu
,
tsdbError
(
"vgId:%d
,
failed to load block head part while read file %s since %s, offset:%"
PRId64
" len :%"
PRIzu
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
tstrerror
(
terrno
),
(
int64_t
)
pBlock
->
offset
,
size
);
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
tstrerror
(
terrno
),
(
int64_t
)
pBlock
->
offset
,
size
);
return
-
1
;
return
-
1
;
}
}
if
(
nread
<
size
)
{
if
(
nread
<
size
)
{
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
tsdbError
(
"vgId:%d block head part in file %s is corrupted, offset:%"
PRId64
" expected bytes:%"
PRIzu
tsdbError
(
"vgId:%d
,
block head part in file %s is corrupted, offset:%"
PRId64
" expected bytes:%"
PRIzu
" read bytes: %"
PRId64
,
" read bytes: %"
PRId64
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
(
int64_t
)
pBlock
->
offset
,
size
,
nread
);
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
(
int64_t
)
pBlock
->
offset
,
size
,
nread
);
return
-
1
;
return
-
1
;
...
@@ -543,7 +543,7 @@ static int tsdbLoadBlockOffset(SReadH *pReadh, SBlock *pBlock) {
...
@@ -543,7 +543,7 @@ static int tsdbLoadBlockOffset(SReadH *pReadh, SBlock *pBlock) {
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)(
pReadh
->
pBlkData
),
(
uint32_t
)
size
))
{
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)(
pReadh
->
pBlkData
),
(
uint32_t
)
size
))
{
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
tsdbError
(
"vgId:%d block head part in file %s is corrupted since wrong checksum, offset:%"
PRId64
" len :%"
PRIzu
,
tsdbError
(
"vgId:%d
,
block head part in file %s is corrupted since wrong checksum, offset:%"
PRId64
" len :%"
PRIzu
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
(
int64_t
)
pBlock
->
offset
,
size
);
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
(
int64_t
)
pBlock
->
offset
,
size
);
return
-
1
;
return
-
1
;
}
}
...
@@ -671,14 +671,14 @@ static int tsdbLoadBlockDataImpl(SReadH *pReadh, SBlock *pBlock, SDataCols *pDat
...
@@ -671,14 +671,14 @@ static int tsdbLoadBlockDataImpl(SReadH *pReadh, SBlock *pBlock, SDataCols *pDat
SBlockData
*
pBlockData
=
(
SBlockData
*
)
TSDB_READ_BUF
(
pReadh
);
SBlockData
*
pBlockData
=
(
SBlockData
*
)
TSDB_READ_BUF
(
pReadh
);
if
(
tsdbSeekDFile
(
pDFile
,
pBlock
->
offset
,
SEEK_SET
)
<
0
)
{
if
(
tsdbSeekDFile
(
pDFile
,
pBlock
->
offset
,
SEEK_SET
)
<
0
)
{
tsdbError
(
"vgId:%d failed to load block data part while seek file %s to offset %"
PRId64
" since %s"
,
tsdbError
(
"vgId:%d
,
failed to load block data part while seek file %s to offset %"
PRId64
" since %s"
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
(
int64_t
)
pBlock
->
offset
,
tstrerror
(
terrno
));
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
(
int64_t
)
pBlock
->
offset
,
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
int64_t
nread
=
tsdbReadDFile
(
pDFile
,
TSDB_READ_BUF
(
pReadh
),
pBlock
->
len
);
int64_t
nread
=
tsdbReadDFile
(
pDFile
,
TSDB_READ_BUF
(
pReadh
),
pBlock
->
len
);
if
(
nread
<
0
)
{
if
(
nread
<
0
)
{
tsdbError
(
"vgId:%d failed to load block data part while read file %s since %s, offset:%"
PRId64
" len :%d"
,
tsdbError
(
"vgId:%d
,
failed to load block data part while read file %s since %s, offset:%"
PRId64
" len :%d"
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
tstrerror
(
terrno
),
(
int64_t
)
pBlock
->
offset
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
tstrerror
(
terrno
),
(
int64_t
)
pBlock
->
offset
,
pBlock
->
len
);
pBlock
->
len
);
return
-
1
;
return
-
1
;
...
@@ -686,7 +686,7 @@ static int tsdbLoadBlockDataImpl(SReadH *pReadh, SBlock *pBlock, SDataCols *pDat
...
@@ -686,7 +686,7 @@ static int tsdbLoadBlockDataImpl(SReadH *pReadh, SBlock *pBlock, SDataCols *pDat
if
(
nread
<
pBlock
->
len
)
{
if
(
nread
<
pBlock
->
len
)
{
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
tsdbError
(
"vgId:%d block data part in file %s is corrupted, offset:%"
PRId64
tsdbError
(
"vgId:%d
,
block data part in file %s is corrupted, offset:%"
PRId64
" expected bytes:%d read bytes: %"
PRId64
,
" expected bytes:%d read bytes: %"
PRId64
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
(
int64_t
)
pBlock
->
offset
,
pBlock
->
len
,
nread
);
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
(
int64_t
)
pBlock
->
offset
,
pBlock
->
len
,
nread
);
return
-
1
;
return
-
1
;
...
@@ -695,7 +695,7 @@ static int tsdbLoadBlockDataImpl(SReadH *pReadh, SBlock *pBlock, SDataCols *pDat
...
@@ -695,7 +695,7 @@ static int tsdbLoadBlockDataImpl(SReadH *pReadh, SBlock *pBlock, SDataCols *pDat
int32_t
tsize
=
(
int32_t
)
tsdbBlockStatisSize
(
pBlock
->
numOfCols
,
(
uint32_t
)
pBlock
->
blkVer
);
int32_t
tsize
=
(
int32_t
)
tsdbBlockStatisSize
(
pBlock
->
numOfCols
,
(
uint32_t
)
pBlock
->
blkVer
);
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)
TSDB_READ_BUF
(
pReadh
),
tsize
))
{
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)
TSDB_READ_BUF
(
pReadh
),
tsize
))
{
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
tsdbError
(
"vgId:%d block head part in file %s is corrupted since wrong checksum, offset:%"
PRId64
" len :%d"
,
tsdbError
(
"vgId:%d
,
block head part in file %s is corrupted since wrong checksum, offset:%"
PRId64
" len :%d"
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
(
int64_t
)
pBlock
->
offset
,
tsize
);
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
(
int64_t
)
pBlock
->
offset
,
tsize
);
return
-
1
;
return
-
1
;
}
}
...
@@ -750,7 +750,7 @@ static int tsdbLoadBlockDataImpl(SReadH *pReadh, SBlock *pBlock, SDataCols *pDat
...
@@ -750,7 +750,7 @@ static int tsdbLoadBlockDataImpl(SReadH *pReadh, SBlock *pBlock, SDataCols *pDat
pBlockCol
?
pBlockCol
->
blen
:
0
,
pBlock
->
algorithm
,
pBlock
->
numOfRows
,
pBlockCol
?
pBlockCol
->
blen
:
0
,
pBlock
->
algorithm
,
pBlock
->
numOfRows
,
tLenBitmap
,
pDataCols
->
maxPoints
,
TSDB_READ_COMP_BUF
(
pReadh
),
tLenBitmap
,
pDataCols
->
maxPoints
,
TSDB_READ_COMP_BUF
(
pReadh
),
(
int
)
taosTSizeof
(
TSDB_READ_COMP_BUF
(
pReadh
)))
<
0
)
{
(
int
)
taosTSizeof
(
TSDB_READ_COMP_BUF
(
pReadh
)))
<
0
)
{
tsdbError
(
"vgId:%d file %s is broken at column %d block offset %"
PRId64
" column offset %u"
,
tsdbError
(
"vgId:%d
,
file %s is broken at column %d block offset %"
PRId64
" column offset %u"
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
tcolId
,
(
int64_t
)
pBlock
->
offset
,
toffset
);
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
tcolId
,
(
int64_t
)
pBlock
->
offset
,
toffset
);
return
-
1
;
return
-
1
;
}
}
...
@@ -945,21 +945,21 @@ static int tsdbLoadColData(SReadH *pReadh, SDFile *pDFile, SBlock *pBlock, SBloc
...
@@ -945,21 +945,21 @@ static int tsdbLoadColData(SReadH *pReadh, SDFile *pDFile, SBlock *pBlock, SBloc
int64_t
offset
=
pBlock
->
offset
+
tsdbBlockStatisSize
(
pBlock
->
numOfCols
,
(
uint32_t
)
pBlock
->
blkVer
)
+
int64_t
offset
=
pBlock
->
offset
+
tsdbBlockStatisSize
(
pBlock
->
numOfCols
,
(
uint32_t
)
pBlock
->
blkVer
)
+
tsdbGetBlockColOffset
(
pBlockCol
);
tsdbGetBlockColOffset
(
pBlockCol
);
if
(
tsdbSeekDFile
(
pDFile
,
offset
,
SEEK_SET
)
<
0
)
{
if
(
tsdbSeekDFile
(
pDFile
,
offset
,
SEEK_SET
)
<
0
)
{
tsdbError
(
"vgId:%d failed to load block column data while seek file %s to offset %"
PRId64
" since %s"
,
tsdbError
(
"vgId:%d
,
failed to load block column data while seek file %s to offset %"
PRId64
" since %s"
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
offset
,
tstrerror
(
terrno
));
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
offset
,
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
int64_t
nread
=
tsdbReadDFile
(
pDFile
,
TSDB_READ_BUF
(
pReadh
),
pBlockCol
->
len
);
int64_t
nread
=
tsdbReadDFile
(
pDFile
,
TSDB_READ_BUF
(
pReadh
),
pBlockCol
->
len
);
if
(
nread
<
0
)
{
if
(
nread
<
0
)
{
tsdbError
(
"vgId:%d failed to load block column data while read file %s since %s, offset:%"
PRId64
" len :%d"
,
tsdbError
(
"vgId:%d
,
failed to load block column data while read file %s since %s, offset:%"
PRId64
" len :%d"
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
tstrerror
(
terrno
),
offset
,
pBlockCol
->
len
);
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
tstrerror
(
terrno
),
offset
,
pBlockCol
->
len
);
return
-
1
;
return
-
1
;
}
}
if
(
nread
<
pBlockCol
->
len
)
{
if
(
nread
<
pBlockCol
->
len
)
{
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
tsdbError
(
"vgId:%d block column data in file %s is corrupted, offset:%"
PRId64
" expected bytes:%d"
PRIzu
tsdbError
(
"vgId:%d
,
block column data in file %s is corrupted, offset:%"
PRId64
" expected bytes:%d"
PRIzu
" read bytes: %"
PRId64
,
" read bytes: %"
PRId64
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
offset
,
pBlockCol
->
len
,
nread
);
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
offset
,
pBlockCol
->
len
,
nread
);
return
-
1
;
return
-
1
;
...
@@ -968,7 +968,7 @@ static int tsdbLoadColData(SReadH *pReadh, SDFile *pDFile, SBlock *pBlock, SBloc
...
@@ -968,7 +968,7 @@ static int tsdbLoadColData(SReadH *pReadh, SDFile *pDFile, SBlock *pBlock, SBloc
if
(
tsdbCheckAndDecodeColumnData
(
pDataCol
,
pReadh
->
pBuf
,
pBlockCol
->
len
,
pBlockCol
->
blen
,
pBlock
->
algorithm
,
if
(
tsdbCheckAndDecodeColumnData
(
pDataCol
,
pReadh
->
pBuf
,
pBlockCol
->
len
,
pBlockCol
->
blen
,
pBlock
->
algorithm
,
pBlock
->
numOfRows
,
tLenBitmap
,
pCfg
->
maxRows
,
pReadh
->
pCBuf
,
pBlock
->
numOfRows
,
tLenBitmap
,
pCfg
->
maxRows
,
pReadh
->
pCBuf
,
(
int32_t
)
taosTSizeof
(
pReadh
->
pCBuf
))
<
0
)
{
(
int32_t
)
taosTSizeof
(
pReadh
->
pCBuf
))
<
0
)
{
tsdbError
(
"vgId:%d file %s is broken at column %d offset %"
PRId64
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pDFile
),
tsdbError
(
"vgId:%d
,
file %s is broken at column %d offset %"
PRId64
,
REPO_ID
(
pRepo
),
TSDB_FILE_FULL_NAME
(
pDFile
),
pBlockCol
->
colId
,
offset
);
pBlockCol
->
colId
,
offset
);
return
-
1
;
return
-
1
;
}
}
...
...
source/dnode/vnode/src/tsdb/tsdbWrite.c
浏览文件 @
6b17c1ca
...
@@ -28,7 +28,7 @@ int tsdbInsertData(STsdb *pTsdb, int64_t version, SSubmitReq *pMsg, SSubmitRsp *
...
@@ -28,7 +28,7 @@ int tsdbInsertData(STsdb *pTsdb, int64_t version, SSubmitReq *pMsg, SSubmitRsp *
// scan and convert
// scan and convert
if
(
tsdbScanAndConvertSubmitMsg
(
pTsdb
,
pMsg
)
<
0
)
{
if
(
tsdbScanAndConvertSubmitMsg
(
pTsdb
,
pMsg
)
<
0
)
{
if
(
terrno
!=
TSDB_CODE_TDB_TABLE_RECONFIGURE
)
{
if
(
terrno
!=
TSDB_CODE_TDB_TABLE_RECONFIGURE
)
{
tsdbError
(
"vgId:%d failed to insert data since %s"
,
REPO_ID
(
pTsdb
),
tstrerror
(
terrno
));
tsdbError
(
"vgId:%d
,
failed to insert data since %s"
,
REPO_ID
(
pTsdb
),
tstrerror
(
terrno
));
}
}
return
-
1
;
return
-
1
;
}
}
...
@@ -59,7 +59,7 @@ static FORCE_INLINE int tsdbCheckRowRange(STsdb *pTsdb, STable *pTable, STSRow *
...
@@ -59,7 +59,7 @@ static FORCE_INLINE int tsdbCheckRowRange(STsdb *pTsdb, STable *pTable, STSRow *
TSKEY now) {
TSKEY now) {
TSKEY rowKey = TD_ROW_KEY(row);
TSKEY rowKey = TD_ROW_KEY(row);
if (rowKey < minKey || rowKey > maxKey) {
if (rowKey < minKey || rowKey > maxKey) {
tsdbError("vgId:%d table %s tid %d uid %" PRIu64 " timestamp is out of range! now %" PRId64 " minKey %" PRId64
tsdbError("vgId:%d
,
table %s tid %d uid %" PRIu64 " timestamp is out of range! now %" PRId64 " minKey %" PRId64
" maxKey %" PRId64 " row key %" PRId64,
" maxKey %" PRId64 " row key %" PRId64,
REPO_ID(pTsdb), TABLE_CHAR_NAME(pTable), TABLE_TID(pTable), TABLE_UID(pTable), now, minKey, maxKey,
REPO_ID(pTsdb), TABLE_CHAR_NAME(pTable), TABLE_TID(pTable), TABLE_UID(pTable), now, minKey, maxKey,
rowKey);
rowKey);
...
@@ -75,7 +75,7 @@ static FORCE_INLINE int tsdbCheckRowRange(STsdb *pTsdb, tb_uid_t uid, STSRow *ro
...
@@ -75,7 +75,7 @@ static FORCE_INLINE int tsdbCheckRowRange(STsdb *pTsdb, tb_uid_t uid, STSRow *ro
TSKEY
now
)
{
TSKEY
now
)
{
TSKEY
rowKey
=
TD_ROW_KEY
(
row
);
TSKEY
rowKey
=
TD_ROW_KEY
(
row
);
if
(
rowKey
<
minKey
||
rowKey
>
maxKey
)
{
if
(
rowKey
<
minKey
||
rowKey
>
maxKey
)
{
tsdbError
(
"vgId:%d table uid %"
PRIu64
" timestamp is out of range! now %"
PRId64
" minKey %"
PRId64
tsdbError
(
"vgId:%d
,
table uid %"
PRIu64
" timestamp is out of range! now %"
PRId64
" minKey %"
PRId64
" maxKey %"
PRId64
" row key %"
PRId64
,
" maxKey %"
PRId64
" row key %"
PRId64
,
REPO_ID
(
pTsdb
),
uid
,
now
,
minKey
,
maxKey
,
rowKey
);
REPO_ID
(
pTsdb
),
uid
,
now
,
minKey
,
maxKey
,
rowKey
);
terrno
=
TSDB_CODE_TDB_TIMESTAMP_OUT_OF_RANGE
;
terrno
=
TSDB_CODE_TDB_TIMESTAMP_OUT_OF_RANGE
;
...
@@ -115,7 +115,7 @@ int tsdbScanAndConvertSubmitMsg(STsdb *pTsdb, SSubmitReq *pMsg) {
...
@@ -115,7 +115,7 @@ int tsdbScanAndConvertSubmitMsg(STsdb *pTsdb, SSubmitReq *pMsg) {
#if 0
#if 0
if (pBlock->tid <= 0 || pBlock->tid >= pMeta->maxTables) {
if (pBlock->tid <= 0 || pBlock->tid >= pMeta->maxTables) {
tsdbError("vgId:%d failed to get table to insert data, uid %" PRIu64 " tid %d", REPO_ID(pTsdb), pBlock->uid,
tsdbError("vgId:%d
,
failed to get table to insert data, uid %" PRIu64 " tid %d", REPO_ID(pTsdb), pBlock->uid,
pBlock->tid);
pBlock->tid);
terrno = TSDB_CODE_TDB_INVALID_TABLE_ID;
terrno = TSDB_CODE_TDB_INVALID_TABLE_ID;
return -1;
return -1;
...
@@ -123,14 +123,14 @@ int tsdbScanAndConvertSubmitMsg(STsdb *pTsdb, SSubmitReq *pMsg) {
...
@@ -123,14 +123,14 @@ int tsdbScanAndConvertSubmitMsg(STsdb *pTsdb, SSubmitReq *pMsg) {
STable *pTable = pMeta->tables[pBlock->tid];
STable *pTable = pMeta->tables[pBlock->tid];
if (pTable == NULL || TABLE_UID(pTable) != pBlock->uid) {
if (pTable == NULL || TABLE_UID(pTable) != pBlock->uid) {
tsdbError("vgId:%d failed to get table to insert data, uid %" PRIu64 " tid %d", REPO_ID(pTsdb), pBlock->uid,
tsdbError("vgId:%d
,
failed to get table to insert data, uid %" PRIu64 " tid %d", REPO_ID(pTsdb), pBlock->uid,
pBlock->tid);
pBlock->tid);
terrno = TSDB_CODE_TDB_INVALID_TABLE_ID;
terrno = TSDB_CODE_TDB_INVALID_TABLE_ID;
return -1;
return -1;
}
}
if (TABLE_TYPE(pTable) == TSDB_SUPER_TABLE) {
if (TABLE_TYPE(pTable) == TSDB_SUPER_TABLE) {
tsdbError("vgId:%d invalid action trying to insert a super table %s", REPO_ID(pTsdb), TABLE_CHAR_NAME(pTable));
tsdbError("vgId:%d
,
invalid action trying to insert a super table %s", REPO_ID(pTsdb), TABLE_CHAR_NAME(pTable));
terrno = TSDB_CODE_TDB_INVALID_ACTION;
terrno = TSDB_CODE_TDB_INVALID_ACTION;
return -1;
return -1;
}
}
...
...
source/dnode/vnode/src/vnd/vnodeBufPool.c
浏览文件 @
6b17c1ca
...
@@ -30,7 +30,7 @@ int vnodeOpenBufPool(SVnode *pVnode, int64_t size) {
...
@@ -30,7 +30,7 @@ int vnodeOpenBufPool(SVnode *pVnode, int64_t size) {
// create pool
// create pool
ret
=
vnodeBufPoolCreate
(
size
,
&
pPool
);
ret
=
vnodeBufPoolCreate
(
size
,
&
pPool
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
vError
(
"vgId:%d failed to open vnode buffer pool since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
vError
(
"vgId:%d
,
failed to open vnode buffer pool since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
vnodeCloseBufPool
(
pVnode
);
vnodeCloseBufPool
(
pVnode
);
return
-
1
;
return
-
1
;
}
}
...
@@ -40,7 +40,7 @@ int vnodeOpenBufPool(SVnode *pVnode, int64_t size) {
...
@@ -40,7 +40,7 @@ int vnodeOpenBufPool(SVnode *pVnode, int64_t size) {
pVnode
->
pPool
=
pPool
;
pVnode
->
pPool
=
pPool
;
}
}
vDebug
(
"vgId:%d vnode buffer pool is opened, pool size: %"
PRId64
,
TD_VID
(
pVnode
),
size
);
vDebug
(
"vgId:%d
,
vnode buffer pool is opened, pool size: %"
PRId64
,
TD_VID
(
pVnode
),
size
);
return
0
;
return
0
;
}
}
...
@@ -53,7 +53,7 @@ int vnodeCloseBufPool(SVnode *pVnode) {
...
@@ -53,7 +53,7 @@ int vnodeCloseBufPool(SVnode *pVnode) {
vnodeBufPoolDestroy
(
pPool
);
vnodeBufPoolDestroy
(
pPool
);
}
}
vDebug
(
"vgId:%d vnode buffer pool is closed"
,
TD_VID
(
pVnode
));
vDebug
(
"vgId:%d
,
vnode buffer pool is closed"
,
TD_VID
(
pVnode
));
return
0
;
return
0
;
}
}
...
...
source/dnode/vnode/src/vnd/vnodeCommit.c
浏览文件 @
6b17c1ca
...
@@ -42,29 +42,29 @@ int vnodeBegin(SVnode *pVnode) {
...
@@ -42,29 +42,29 @@ int vnodeBegin(SVnode *pVnode) {
// begin meta
// begin meta
if
(
metaBegin
(
pVnode
->
pMeta
)
<
0
)
{
if
(
metaBegin
(
pVnode
->
pMeta
)
<
0
)
{
vError
(
"vgId:%d failed to begin meta since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
vError
(
"vgId:%d
,
failed to begin meta since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
// begin tsdb
// begin tsdb
if
(
pVnode
->
pSma
)
{
if
(
pVnode
->
pSma
)
{
if
(
tsdbBegin
(
VND_RSMA0
(
pVnode
))
<
0
)
{
if
(
tsdbBegin
(
VND_RSMA0
(
pVnode
))
<
0
)
{
vError
(
"vgId:%d failed to begin rsma0 since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
vError
(
"vgId:%d
,
failed to begin rsma0 since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
if
(
tsdbBegin
(
VND_RSMA1
(
pVnode
))
<
0
)
{
if
(
tsdbBegin
(
VND_RSMA1
(
pVnode
))
<
0
)
{
vError
(
"vgId:%d failed to begin rsma1 since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
vError
(
"vgId:%d
,
failed to begin rsma1 since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
if
(
tsdbBegin
(
VND_RSMA2
(
pVnode
))
<
0
)
{
if
(
tsdbBegin
(
VND_RSMA2
(
pVnode
))
<
0
)
{
vError
(
"vgId:%d failed to begin rsma2 since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
vError
(
"vgId:%d
,
failed to begin rsma2 since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
}
else
{
}
else
{
if
(
tsdbBegin
(
pVnode
->
pTsdb
)
<
0
)
{
if
(
tsdbBegin
(
pVnode
->
pTsdb
)
<
0
)
{
vError
(
"vgId:%d failed to begin tsdb since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
vError
(
"vgId:%d
,
failed to begin tsdb since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
}
}
...
@@ -110,7 +110,7 @@ int vnodeSaveInfo(const char *dir, const SVnodeInfo *pInfo) {
...
@@ -110,7 +110,7 @@ int vnodeSaveInfo(const char *dir, const SVnodeInfo *pInfo) {
// free info binary
// free info binary
taosMemoryFree
(
data
);
taosMemoryFree
(
data
);
vInfo
(
"vgId:%d vnode info is saved, fname: %s"
,
pInfo
->
config
.
vgId
,
fname
);
vInfo
(
"vgId:%d
,
vnode info is saved, fname: %s"
,
pInfo
->
config
.
vgId
,
fname
);
return
0
;
return
0
;
...
@@ -132,7 +132,7 @@ int vnodeCommitInfo(const char *dir, const SVnodeInfo *pInfo) {
...
@@ -132,7 +132,7 @@ int vnodeCommitInfo(const char *dir, const SVnodeInfo *pInfo) {
return
-
1
;
return
-
1
;
}
}
vInfo
(
"vgId:%d vnode info is committed"
,
pInfo
->
config
.
vgId
);
vInfo
(
"vgId:%d
,
vnode info is committed"
,
pInfo
->
config
.
vgId
);
return
0
;
return
0
;
}
}
...
@@ -210,7 +210,7 @@ int vnodeCommit(SVnode *pVnode) {
...
@@ -210,7 +210,7 @@ int vnodeCommit(SVnode *pVnode) {
SVnodeInfo
info
=
{
0
};
SVnodeInfo
info
=
{
0
};
char
dir
[
TSDB_FILENAME_LEN
];
char
dir
[
TSDB_FILENAME_LEN
];
vInfo
(
"vgId:%d start to commit, version: %"
PRId64
,
TD_VID
(
pVnode
),
pVnode
->
state
.
applied
);
vInfo
(
"vgId:%d
,
start to commit, version: %"
PRId64
,
TD_VID
(
pVnode
),
pVnode
->
state
.
applied
);
pVnode
->
onCommit
=
pVnode
->
inUse
;
pVnode
->
onCommit
=
pVnode
->
inUse
;
pVnode
->
inUse
=
NULL
;
pVnode
->
inUse
=
NULL
;
...
@@ -268,7 +268,7 @@ int vnodeCommit(SVnode *pVnode) {
...
@@ -268,7 +268,7 @@ int vnodeCommit(SVnode *pVnode) {
pVnode
->
pPool
=
pVnode
->
onCommit
;
pVnode
->
pPool
=
pVnode
->
onCommit
;
pVnode
->
onCommit
=
NULL
;
pVnode
->
onCommit
=
NULL
;
vInfo
(
"vgId:%d commit over"
,
TD_VID
(
pVnode
));
vInfo
(
"vgId:%d
,
commit over"
,
TD_VID
(
pVnode
));
return
0
;
return
0
;
}
}
...
...
source/dnode/vnode/src/vnd/vnodeOpen.c
浏览文件 @
6b17c1ca
...
@@ -23,13 +23,13 @@ int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) {
...
@@ -23,13 +23,13 @@ int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) {
// check config
// check config
if
(
vnodeCheckCfg
(
pCfg
)
<
0
)
{
if
(
vnodeCheckCfg
(
pCfg
)
<
0
)
{
vError
(
"vgId:%d failed to create vnode since: %s"
,
pCfg
->
vgId
,
tstrerror
(
terrno
));
vError
(
"vgId:%d
,
failed to create vnode since: %s"
,
pCfg
->
vgId
,
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
// create vnode env
// create vnode env
if
(
tfsMkdir
(
pTfs
,
path
)
<
0
)
{
if
(
tfsMkdir
(
pTfs
,
path
)
<
0
)
{
vError
(
"vgId:%d failed to create vnode since: %s"
,
pCfg
->
vgId
,
tstrerror
(
terrno
));
vError
(
"vgId:%d
,
failed to create vnode since: %s"
,
pCfg
->
vgId
,
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
...
@@ -39,11 +39,11 @@ int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) {
...
@@ -39,11 +39,11 @@ int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) {
info
.
state
.
applied
=
-
1
;
info
.
state
.
applied
=
-
1
;
if
(
vnodeSaveInfo
(
dir
,
&
info
)
<
0
||
vnodeCommitInfo
(
dir
,
&
info
)
<
0
)
{
if
(
vnodeSaveInfo
(
dir
,
&
info
)
<
0
||
vnodeCommitInfo
(
dir
,
&
info
)
<
0
)
{
vError
(
"vgId:%d failed to save vnode config since %s"
,
pCfg
->
vgId
,
tstrerror
(
terrno
));
vError
(
"vgId:%d
,
failed to save vnode config since %s"
,
pCfg
->
vgId
,
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
vInfo
(
"vgId:%d vnode is created"
,
pCfg
->
vgId
);
vInfo
(
"vgId:%d
,
vnode is created"
,
pCfg
->
vgId
);
return
0
;
return
0
;
}
}
...
@@ -70,7 +70,7 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) {
...
@@ -70,7 +70,7 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) {
pVnode
=
(
SVnode
*
)
taosMemoryCalloc
(
1
,
sizeof
(
*
pVnode
)
+
strlen
(
path
)
+
1
);
pVnode
=
(
SVnode
*
)
taosMemoryCalloc
(
1
,
sizeof
(
*
pVnode
)
+
strlen
(
path
)
+
1
);
if
(
pVnode
==
NULL
)
{
if
(
pVnode
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
vError
(
"vgId:%d failed to open vnode since %s"
,
info
.
config
.
vgId
,
tstrerror
(
terrno
));
vError
(
"vgId:%d
,
failed to open vnode since %s"
,
info
.
config
.
vgId
,
tstrerror
(
terrno
));
return
NULL
;
return
NULL
;
}
}
...
@@ -86,25 +86,25 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) {
...
@@ -86,25 +86,25 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) {
// open buffer pool
// open buffer pool
if
(
vnodeOpenBufPool
(
pVnode
,
pVnode
->
config
.
isHeap
?
0
:
pVnode
->
config
.
szBuf
/
3
)
<
0
)
{
if
(
vnodeOpenBufPool
(
pVnode
,
pVnode
->
config
.
isHeap
?
0
:
pVnode
->
config
.
szBuf
/
3
)
<
0
)
{
vError
(
"vgId:%d failed to open vnode buffer pool since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
vError
(
"vgId:%d
,
failed to open vnode buffer pool since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
// open meta
// open meta
if
(
metaOpen
(
pVnode
,
&
pVnode
->
pMeta
)
<
0
)
{
if
(
metaOpen
(
pVnode
,
&
pVnode
->
pMeta
)
<
0
)
{
vError
(
"vgId:%d failed to open vnode meta since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
vError
(
"vgId:%d
,
failed to open vnode meta since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
// open tsdb
// open tsdb
if
(
!
VND_IS_RSMA
(
pVnode
)
&&
tsdbOpen
(
pVnode
,
&
VND_TSDB
(
pVnode
),
VNODE_TSDB_DIR
,
NULL
)
<
0
)
{
if
(
!
VND_IS_RSMA
(
pVnode
)
&&
tsdbOpen
(
pVnode
,
&
VND_TSDB
(
pVnode
),
VNODE_TSDB_DIR
,
NULL
)
<
0
)
{
vError
(
"vgId:%d failed to open vnode tsdb since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
vError
(
"vgId:%d
,
failed to open vnode tsdb since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
// open sma
// open sma
if
(
smaOpen
(
pVnode
))
{
if
(
smaOpen
(
pVnode
))
{
vError
(
"vgId:%d failed to open vnode sma since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
vError
(
"vgId:%d
,
failed to open vnode sma since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
...
@@ -113,7 +113,7 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) {
...
@@ -113,7 +113,7 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) {
taosRealPath
(
tdir
,
NULL
,
sizeof
(
tdir
));
taosRealPath
(
tdir
,
NULL
,
sizeof
(
tdir
));
pVnode
->
pWal
=
walOpen
(
tdir
,
&
(
pVnode
->
config
.
walCfg
));
pVnode
->
pWal
=
walOpen
(
tdir
,
&
(
pVnode
->
config
.
walCfg
));
if
(
pVnode
->
pWal
==
NULL
)
{
if
(
pVnode
->
pWal
==
NULL
)
{
vError
(
"vgId:%d failed to open vnode wal since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
vError
(
"vgId:%d
,
failed to open vnode wal since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
...
@@ -122,27 +122,27 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) {
...
@@ -122,27 +122,27 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) {
taosRealPath
(
tdir
,
NULL
,
sizeof
(
tdir
));
taosRealPath
(
tdir
,
NULL
,
sizeof
(
tdir
));
pVnode
->
pTq
=
tqOpen
(
tdir
,
pVnode
,
pVnode
->
pWal
);
pVnode
->
pTq
=
tqOpen
(
tdir
,
pVnode
,
pVnode
->
pWal
);
if
(
pVnode
->
pTq
==
NULL
)
{
if
(
pVnode
->
pTq
==
NULL
)
{
vError
(
"vgId:%d failed to open vnode tq since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
vError
(
"vgId:%d
,
failed to open vnode tq since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
// open query
// open query
if
(
vnodeQueryOpen
(
pVnode
))
{
if
(
vnodeQueryOpen
(
pVnode
))
{
vError
(
"vgId:%d failed to open vnode query since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
vError
(
"vgId:%d
,
failed to open vnode query since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_err
;
goto
_err
;
}
}
// vnode begin
// vnode begin
if
(
vnodeBegin
(
pVnode
)
<
0
)
{
if
(
vnodeBegin
(
pVnode
)
<
0
)
{
vError
(
"vgId:%d failed to begin since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
vError
(
"vgId:%d
,
failed to begin since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_err
;
goto
_err
;
}
}
// open sync
// open sync
if
(
vnodeSyncOpen
(
pVnode
,
dir
))
{
if
(
vnodeSyncOpen
(
pVnode
,
dir
))
{
vError
(
"vgId:%d failed to open sync since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
vError
(
"vgId:%d
,
failed to open sync since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_err
;
goto
_err
;
}
}
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
6b17c1ca
...
@@ -25,6 +25,7 @@ static int vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq, in
...
@@ -25,6 +25,7 @@ static int vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq, in
static
int
vnodeProcessCreateTSmaReq
(
SVnode
*
pVnode
,
int64_t
version
,
void
*
pReq
,
int32_t
len
,
SRpcMsg
*
pRsp
);
static
int
vnodeProcessCreateTSmaReq
(
SVnode
*
pVnode
,
int64_t
version
,
void
*
pReq
,
int32_t
len
,
SRpcMsg
*
pRsp
);
int32_t
vnodePreprocessReq
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
)
{
int32_t
vnodePreprocessReq
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
)
{
int32_t
code
=
0
;
SDecoder
dc
=
{
0
};
SDecoder
dc
=
{
0
};
switch
(
pMsg
->
msgType
)
{
switch
(
pMsg
->
msgType
)
{
...
@@ -89,13 +90,13 @@ int32_t vnodePreprocessReq(SVnode *pVnode, SRpcMsg *pMsg) {
...
@@ -89,13 +90,13 @@ int32_t vnodePreprocessReq(SVnode *pVnode, SRpcMsg *pMsg) {
}
break
;
}
break
;
case
TDMT_VND_ALTER_REPLICA
:
{
case
TDMT_VND_ALTER_REPLICA
:
{
vnodeSyncAlter
(
pVnode
,
pMsg
);
code
=
vnodeSyncAlter
(
pVnode
,
pMsg
);
}
break
;
}
break
;
default:
default:
break
;
break
;
}
}
return
0
;
return
code
;
}
}
int
vnodeProcessWriteReq
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
int64_t
version
,
SRpcMsg
*
pRsp
)
{
int
vnodeProcessWriteReq
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
int64_t
version
,
SRpcMsg
*
pRsp
)
{
...
@@ -104,7 +105,7 @@ int vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRpcMsg
...
@@ -104,7 +105,7 @@ int vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRpcMsg
int
len
;
int
len
;
int
ret
;
int
ret
;
vTrace
(
"vgId:%d start to process write request %s, version %"
PRId64
,
TD_VID
(
pVnode
),
TMSG_INFO
(
pMsg
->
msgType
),
vTrace
(
"vgId:%d
,
start to process write request %s, version %"
PRId64
,
TD_VID
(
pVnode
),
TMSG_INFO
(
pMsg
->
msgType
),
version
);
version
);
pVnode
->
state
.
applied
=
version
;
pVnode
->
state
.
applied
=
version
;
...
@@ -164,16 +165,16 @@ int vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRpcMsg
...
@@ -164,16 +165,16 @@ int vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRpcMsg
break
;
break
;
}
}
v
Debug
(
"vgId:%d
process %s request success, version: %"
PRId64
,
TD_VID
(
pVnode
),
TMSG_INFO
(
pMsg
->
msgType
),
version
);
v
Trace
(
"vgId:%d,
process %s request success, version: %"
PRId64
,
TD_VID
(
pVnode
),
TMSG_INFO
(
pMsg
->
msgType
),
version
);
if
(
tqPushMsg
(
pVnode
->
pTq
,
pMsg
->
pCont
,
pMsg
->
contLen
,
pMsg
->
msgType
,
version
)
<
0
)
{
if
(
tqPushMsg
(
pVnode
->
pTq
,
pMsg
->
pCont
,
pMsg
->
contLen
,
pMsg
->
msgType
,
version
)
<
0
)
{
vError
(
"vgId:%d failed to push msg to TQ since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
vError
(
"vgId:%d
,
failed to push msg to TQ since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
// commit if need
// commit if need
if
(
vnodeShouldCommit
(
pVnode
))
{
if
(
vnodeShouldCommit
(
pVnode
))
{
vInfo
(
"vgId:%d commit at version %"
PRId64
,
TD_VID
(
pVnode
),
version
);
vInfo
(
"vgId:%d
,
commit at version %"
PRId64
,
TD_VID
(
pVnode
),
version
);
// commit current change
// commit current change
vnodeCommit
(
pVnode
);
vnodeCommit
(
pVnode
);
...
@@ -184,7 +185,7 @@ int vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRpcMsg
...
@@ -184,7 +185,7 @@ int vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRpcMsg
return
0
;
return
0
;
_err:
_err:
v
Debug
(
"vgId:%d
process %s request failed since %s, version: %"
PRId64
,
TD_VID
(
pVnode
),
TMSG_INFO
(
pMsg
->
msgType
),
v
Error
(
"vgId:%d,
process %s request failed since %s, version: %"
PRId64
,
TD_VID
(
pVnode
),
TMSG_INFO
(
pMsg
->
msgType
),
tstrerror
(
terrno
),
version
);
tstrerror
(
terrno
),
version
);
return
-
1
;
return
-
1
;
}
}
...
@@ -828,13 +829,13 @@ static int vnodeProcessCreateTSmaReq(SVnode *pVnode, int64_t version, void *pReq
...
@@ -828,13 +829,13 @@ static int vnodeProcessCreateTSmaReq(SVnode *pVnode, int64_t version, void *pReq
}
}
tDecoderClear
(
&
coder
);
tDecoderClear
(
&
coder
);
vDebug
(
"vgId:%d success to create tsma %s:%"
PRIi64
" version %"
PRIi64
" for table %"
PRIi64
,
TD_VID
(
pVnode
),
vDebug
(
"vgId:%d
,
success to create tsma %s:%"
PRIi64
" version %"
PRIi64
" for table %"
PRIi64
,
TD_VID
(
pVnode
),
req
.
indexName
,
req
.
indexUid
,
version
,
req
.
tableUid
);
req
.
indexName
,
req
.
indexUid
,
version
,
req
.
tableUid
);
return
0
;
return
0
;
_err:
_err:
tDecoderClear
(
&
coder
);
tDecoderClear
(
&
coder
);
vError
(
"vgId:%d failed to create tsma %s:%"
PRIi64
" version %"
PRIi64
"for table %"
PRIi64
" since %s"
,
vError
(
"vgId:%d
,
failed to create tsma %s:%"
PRIi64
" version %"
PRIi64
"for table %"
PRIi64
" since %s"
,
TD_VID
(
pVnode
),
req
.
indexName
,
req
.
indexUid
,
version
,
req
.
tableUid
,
terrstr
(
terrno
));
TD_VID
(
pVnode
),
req
.
indexName
,
req
.
indexUid
,
version
,
req
.
tableUid
,
terrstr
(
terrno
));
return
-
1
;
return
-
1
;
}
}
...
...
source/dnode/vnode/src/vnd/vnodeSync.c
浏览文件 @
6b17c1ca
...
@@ -50,13 +50,11 @@ int32_t vnodeSyncOpen(SVnode *pVnode, char *path) {
...
@@ -50,13 +50,11 @@ int32_t vnodeSyncOpen(SVnode *pVnode, char *path) {
return
0
;
return
0
;
}
}
void
vnodeSyncAlter
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
)
{
int32_t
vnodeSyncAlter
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
)
{
SAlterVnodeReq
req
=
{
0
};
SAlterVnodeReq
req
=
{
0
};
if
(
tDeserializeSAlterVnodeReq
((
char
*
)
pMsg
->
pCont
+
sizeof
(
SMsgHead
),
pMsg
->
contLen
-
sizeof
(
SMsgHead
),
&
req
)
!=
0
)
{
if
(
tDeserializeSAlterVnodeReq
((
char
*
)
pMsg
->
pCont
+
sizeof
(
SMsgHead
),
pMsg
->
contLen
-
sizeof
(
SMsgHead
),
&
req
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
terrno
=
TSDB_CODE_INVALID_MSG
;
vError
(
"vgId:%d, failed to alter replica since %s"
,
TD_VID
(
pVnode
),
terrstr
());
return
TSDB_CODE_INVALID_MSG
;
SRpcMsg
rsp
=
{.
info
=
pMsg
->
info
,
.
code
=
terrno
};
tmsgSendRsp
(
&
rsp
);
}
}
vInfo
(
"vgId:%d, start to alter vnode replica to %d"
,
TD_VID
(
pVnode
),
req
.
replica
);
vInfo
(
"vgId:%d, start to alter vnode replica to %d"
,
TD_VID
(
pVnode
),
req
.
replica
);
...
@@ -68,11 +66,15 @@ void vnodeSyncAlter(SVnode *pVnode, SRpcMsg *pMsg) {
...
@@ -68,11 +66,15 @@ void vnodeSyncAlter(SVnode *pVnode, SRpcMsg *pMsg) {
vInfo
(
"vgId:%d, replica:%d %s:%u"
,
TD_VID
(
pVnode
),
r
,
pNode
->
nodeFqdn
,
pNode
->
nodePort
);
vInfo
(
"vgId:%d, replica:%d %s:%u"
,
TD_VID
(
pVnode
),
r
,
pNode
->
nodeFqdn
,
pNode
->
nodePort
);
}
}
if
(
syncReconfig
(
pVnode
->
sync
,
&
cfg
)
!=
0
)
{
int32_t
code
=
syncReconfig
(
pVnode
->
sync
,
&
cfg
);
vError
(
"vgId:%d, failed to propose sync reconfig since %s"
,
TD_VID
(
pVnode
),
terrstr
());
if
(
code
==
TAOS_SYNC_PROPOSE_SUCCESS
)
{
// todo refactor
SRpcMsg
rsp
=
{.
info
=
pMsg
->
info
,
.
code
=
terrno
};
SRpcMsg
rsp
=
{.
info
=
pMsg
->
info
,
.
code
=
terrno
};
tmsgSendRsp
(
&
rsp
);
tmsgSendRsp
(
&
rsp
);
return
TSDB_CODE_ACTION_IN_PROGRESS
;
}
}
return
code
;
}
}
void
vnodeSyncStart
(
SVnode
*
pVnode
)
{
void
vnodeSyncStart
(
SVnode
*
pVnode
)
{
...
...
source/dnode/vnode/test/tsdbSmaTest.cpp
浏览文件 @
6b17c1ca
...
@@ -147,8 +147,8 @@ TEST(testCase, tSma_Meta_Encode_Decode_Test) {
...
@@ -147,8 +147,8 @@ TEST(testCase, tSma_Meta_Encode_Decode_Test) {
// resource release
// resource release
taosMemoryFreeClear
(
pSW
);
taosMemoryFreeClear
(
pSW
);
t
d
DestroyTSma
(
&
tSma
);
tDestroyTSma
(
&
tSma
);
t
d
DestroyTSmaWrapper
(
&
dstTSmaWrapper
);
tDestroyTSmaWrapper
(
&
dstTSmaWrapper
);
}
}
#endif
#endif
...
@@ -218,7 +218,7 @@ TEST(testCase, tSma_metaDB_Put_Get_Del_Test) {
...
@@ -218,7 +218,7 @@ TEST(testCase, tSma_metaDB_Put_Get_Del_Test) {
printf
(
"tagsFilter1 = %s
\n
"
,
qSmaCfg
->
tagsFilter
!=
NULL
?
qSmaCfg
->
tagsFilter
:
""
);
printf
(
"tagsFilter1 = %s
\n
"
,
qSmaCfg
->
tagsFilter
!=
NULL
?
qSmaCfg
->
tagsFilter
:
""
);
EXPECT_STRCASEEQ
(
qSmaCfg
->
indexName
,
smaIndexName1
);
EXPECT_STRCASEEQ
(
qSmaCfg
->
indexName
,
smaIndexName1
);
EXPECT_EQ
(
qSmaCfg
->
tableUid
,
tSma
.
tableUid
);
EXPECT_EQ
(
qSmaCfg
->
tableUid
,
tSma
.
tableUid
);
t
d
DestroyTSma
(
qSmaCfg
);
tDestroyTSma
(
qSmaCfg
);
taosMemoryFreeClear
(
qSmaCfg
);
taosMemoryFreeClear
(
qSmaCfg
);
qSmaCfg
=
metaGetSmaInfoByIndex
(
pMeta
,
indexUid2
,
true
);
qSmaCfg
=
metaGetSmaInfoByIndex
(
pMeta
,
indexUid2
,
true
);
...
@@ -229,7 +229,7 @@ TEST(testCase, tSma_metaDB_Put_Get_Del_Test) {
...
@@ -229,7 +229,7 @@ TEST(testCase, tSma_metaDB_Put_Get_Del_Test) {
printf
(
"tagsFilter2 = %s
\n
"
,
qSmaCfg
->
tagsFilter
!=
NULL
?
qSmaCfg
->
tagsFilter
:
""
);
printf
(
"tagsFilter2 = %s
\n
"
,
qSmaCfg
->
tagsFilter
!=
NULL
?
qSmaCfg
->
tagsFilter
:
""
);
EXPECT_STRCASEEQ
(
qSmaCfg
->
indexName
,
smaIndexName2
);
EXPECT_STRCASEEQ
(
qSmaCfg
->
indexName
,
smaIndexName2
);
EXPECT_EQ
(
qSmaCfg
->
interval
,
tSma
.
interval
);
EXPECT_EQ
(
qSmaCfg
->
interval
,
tSma
.
interval
);
t
d
DestroyTSma
(
qSmaCfg
);
tDestroyTSma
(
qSmaCfg
);
taosMemoryFreeClear
(
qSmaCfg
);
taosMemoryFreeClear
(
qSmaCfg
);
// get index name by table uid
// get index name by table uid
...
@@ -265,7 +265,7 @@ TEST(testCase, tSma_metaDB_Put_Get_Del_Test) {
...
@@ -265,7 +265,7 @@ TEST(testCase, tSma_metaDB_Put_Get_Del_Test) {
EXPECT_EQ
((
pSW
->
tSma
+
1
)
->
indexUid
,
indexUid2
);
EXPECT_EQ
((
pSW
->
tSma
+
1
)
->
indexUid
,
indexUid2
);
EXPECT_EQ
((
pSW
->
tSma
+
1
)
->
tableUid
,
tbUid
);
EXPECT_EQ
((
pSW
->
tSma
+
1
)
->
tableUid
,
tbUid
);
t
d
DestroyTSmaWrapper
(
pSW
);
tDestroyTSmaWrapper
(
pSW
);
taosMemoryFreeClear
(
pSW
);
taosMemoryFreeClear
(
pSW
);
// get all sma table uids
// get all sma table uids
...
@@ -282,7 +282,7 @@ TEST(testCase, tSma_metaDB_Put_Get_Del_Test) {
...
@@ -282,7 +282,7 @@ TEST(testCase, tSma_metaDB_Put_Get_Del_Test) {
metaRemoveSmaFromDb
(
pMeta
,
indexUid1
);
metaRemoveSmaFromDb
(
pMeta
,
indexUid1
);
metaRemoveSmaFromDb
(
pMeta
,
indexUid2
);
metaRemoveSmaFromDb
(
pMeta
,
indexUid2
);
t
d
DestroyTSma
(
&
tSma
);
tDestroyTSma
(
&
tSma
);
metaClose
(
pMeta
);
metaClose
(
pMeta
);
}
}
#endif
#endif
...
@@ -576,7 +576,7 @@ TEST(testCase, tSma_Data_Insert_Query_Test) {
...
@@ -576,7 +576,7 @@ TEST(testCase, tSma_Data_Insert_Query_Test) {
taosArrayDestroy
(
pDataBlocks
);
taosArrayDestroy
(
pDataBlocks
);
// release meta
// release meta
t
d
DestroyTSma
(
&
tSma
);
tDestroyTSma
(
&
tSma
);
tfsClose
(
pTsdb
->
pTfs
);
tfsClose
(
pTsdb
->
pTfs
);
tsdbClose
(
pTsdb
);
tsdbClose
(
pTsdb
);
metaClose
(
pMeta
);
metaClose
(
pMeta
);
...
...
source/libs/executor/inc/executil.h
浏览文件 @
6b17c1ca
...
@@ -75,6 +75,7 @@ typedef struct SResultRowInfo {
...
@@ -75,6 +75,7 @@ typedef struct SResultRowInfo {
int32_t
size
;
// number of result set
int32_t
size
;
// number of result set
int32_t
capacity
;
// max capacity
int32_t
capacity
;
// max capacity
SResultRowPosition
cur
;
SResultRowPosition
cur
;
SList
*
openWindow
;
}
SResultRowInfo
;
}
SResultRowInfo
;
struct
SqlFunctionCtx
;
struct
SqlFunctionCtx
;
...
@@ -83,7 +84,6 @@ size_t getResultRowSize(struct SqlFunctionCtx* pCtx, int32_t numOfOutput);
...
@@ -83,7 +84,6 @@ size_t getResultRowSize(struct SqlFunctionCtx* pCtx, int32_t numOfOutput);
int32_t
initResultRowInfo
(
SResultRowInfo
*
pResultRowInfo
,
int32_t
size
);
int32_t
initResultRowInfo
(
SResultRowInfo
*
pResultRowInfo
,
int32_t
size
);
void
cleanupResultRowInfo
(
SResultRowInfo
*
pResultRowInfo
);
void
cleanupResultRowInfo
(
SResultRowInfo
*
pResultRowInfo
);
int32_t
numOfClosedResultRows
(
SResultRowInfo
*
pResultRowInfo
);
void
closeAllResultRows
(
SResultRowInfo
*
pResultRowInfo
);
void
closeAllResultRows
(
SResultRowInfo
*
pResultRowInfo
);
void
initResultRow
(
SResultRow
*
pResultRow
);
void
initResultRow
(
SResultRow
*
pResultRow
);
...
@@ -92,15 +92,6 @@ bool isResultRowClosed(SResultRow* pResultRow);
...
@@ -92,15 +92,6 @@ bool isResultRowClosed(SResultRow* pResultRow);
struct
SResultRowEntryInfo
*
getResultCell
(
const
SResultRow
*
pRow
,
int32_t
index
,
const
int32_t
*
offset
);
struct
SResultRowEntryInfo
*
getResultCell
(
const
SResultRow
*
pRow
,
int32_t
index
,
const
int32_t
*
offset
);
static
FORCE_INLINE
SResultRow
*
getResultRow
(
SDiskbasedBuf
*
pBuf
,
SResultRowInfo
*
pResultRowInfo
,
int32_t
slot
)
{
ASSERT
(
pResultRowInfo
!=
NULL
&&
slot
>=
0
&&
slot
<
pResultRowInfo
->
size
);
SResultRowPosition
*
pos
=
&
pResultRowInfo
->
pPosition
[
slot
];
SFilePage
*
bufPage
=
(
SFilePage
*
)
getBufPage
(
pBuf
,
pos
->
pageId
);
SResultRow
*
pRow
=
(
SResultRow
*
)((
char
*
)
bufPage
+
pos
->
offset
);
return
pRow
;
}
static
FORCE_INLINE
SResultRow
*
getResultRowByPos
(
SDiskbasedBuf
*
pBuf
,
SResultRowPosition
*
pos
)
{
static
FORCE_INLINE
SResultRow
*
getResultRowByPos
(
SDiskbasedBuf
*
pBuf
,
SResultRowPosition
*
pos
)
{
SFilePage
*
bufPage
=
(
SFilePage
*
)
getBufPage
(
pBuf
,
pos
->
pageId
);
SFilePage
*
bufPage
=
(
SFilePage
*
)
getBufPage
(
pBuf
,
pos
->
pageId
);
SResultRow
*
pRow
=
(
SResultRow
*
)((
char
*
)
bufPage
+
pos
->
offset
);
SResultRow
*
pRow
=
(
SResultRow
*
)((
char
*
)
bufPage
+
pos
->
offset
);
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
6b17c1ca
...
@@ -454,13 +454,14 @@ typedef struct SIntervalAggOperatorInfo {
...
@@ -454,13 +454,14 @@ typedef struct SIntervalAggOperatorInfo {
STimeWindow
win
;
// query time range
STimeWindow
win
;
// query time range
bool
timeWindowInterpo
;
// interpolation needed or not
bool
timeWindowInterpo
;
// interpolation needed or not
char
**
pRow
;
// previous row/tuple of already processed datablock
char
**
pRow
;
// previous row/tuple of already processed datablock
SArray
*
pInterpCols
;
// interpolation columns
STableQueryInfo
*
pCurrent
;
// current tableQueryInfo struct
STableQueryInfo
*
pCurrent
;
// current tableQueryInfo struct
int32_t
order
;
// current SSDataBlock scan order
int32_t
order
;
// current SSDataBlock scan order
EOPTR_EXEC_MODEL
execModel
;
// operator execution model [batch model|stream model]
EOPTR_EXEC_MODEL
execModel
;
// operator execution model [batch model|stream model]
SArray
*
pUpdatedWindow
;
// updated time window due to the input data block from the downstream operator.
SArray
*
pUpdatedWindow
;
// updated time window due to the input data block from the downstream operator.
STimeWindowAggSupp
twAggSup
;
STimeWindowAggSupp
twAggSup
;
struct
SFillInfo
*
pFillInfo
;
// fill info
bool
invertible
;
bool
invertible
;
SArray
*
pPrevValues
;
// SArray<SGroupKeys> used to keep the previous not null value for interpolation.
}
SIntervalAggOperatorInfo
;
}
SIntervalAggOperatorInfo
;
typedef
struct
SStreamFinalIntervalOperatorInfo
{
typedef
struct
SStreamFinalIntervalOperatorInfo
{
...
@@ -832,7 +833,7 @@ int32_t getNumOfRowsInTimeWindow(SDataBlockInfo* pDataBlockInfo, TSKEY* pPrimary
...
@@ -832,7 +833,7 @@ int32_t getNumOfRowsInTimeWindow(SDataBlockInfo* pDataBlockInfo, TSKEY* pPrimary
int32_t
order
);
int32_t
order
);
int32_t
binarySearchForKey
(
char
*
pValue
,
int
num
,
TSKEY
key
,
int
order
);
int32_t
binarySearchForKey
(
char
*
pValue
,
int
num
,
TSKEY
key
,
int
order
);
int32_t
initStreamAggSupporter
(
SStreamAggSupporter
*
pSup
,
const
char
*
pKey
);
int32_t
initStreamAggSupporter
(
SStreamAggSupporter
*
pSup
,
const
char
*
pKey
);
SResultRow
*
getNewResultRow
_rv
(
SDiskbasedBuf
*
pResultBuf
,
int64_t
tableGroupId
,
int32_t
interBufSize
);
SResultRow
*
getNewResultRow
(
SDiskbasedBuf
*
pResultBuf
,
int64_t
tableGroupId
,
int32_t
interBufSize
);
SResultWindowInfo
*
getSessionTimeWindow
(
SArray
*
pWinInfos
,
TSKEY
ts
,
int64_t
gap
,
SResultWindowInfo
*
getSessionTimeWindow
(
SArray
*
pWinInfos
,
TSKEY
ts
,
int64_t
gap
,
int32_t
*
pIndex
);
int32_t
*
pIndex
);
int32_t
updateSessionWindowInfo
(
SResultWindowInfo
*
pWinInfo
,
TSKEY
*
pTs
,
int32_t
rows
,
int32_t
updateSessionWindowInfo
(
SResultWindowInfo
*
pWinInfo
,
TSKEY
*
pTs
,
int32_t
rows
,
...
...
source/libs/executor/src/executil.c
浏览文件 @
6b17c1ca
...
@@ -101,20 +101,8 @@ void resetResultRowInfo(STaskRuntimeEnv *pRuntimeEnv, SResultRowInfo *pResultRow
...
@@ -101,20 +101,8 @@ void resetResultRowInfo(STaskRuntimeEnv *pRuntimeEnv, SResultRowInfo *pResultRow
pResultRowInfo
->
size
=
0
;
pResultRowInfo
->
size
=
0
;
}
}
int32_t
numOfClosedResultRows
(
SResultRowInfo
*
pResultRowInfo
)
{
int32_t
i
=
0
;
// while (i < pResultRowInfo->size && pResultRowInfo->pResult[i]->closed) {
// ++i;
// }
return
i
;
}
void
closeAllResultRows
(
SResultRowInfo
*
pResultRowInfo
)
{
void
closeAllResultRows
(
SResultRowInfo
*
pResultRowInfo
)
{
assert
(
pResultRowInfo
->
size
>=
0
&&
pResultRowInfo
->
capacity
>=
pResultRowInfo
->
size
);
// do nothing
for
(
int32_t
i
=
0
;
i
<
pResultRowInfo
->
size
;
++
i
)
{
}
}
}
bool
isResultRowClosed
(
SResultRow
*
pRow
)
{
bool
isResultRowClosed
(
SResultRow
*
pRow
)
{
...
@@ -258,32 +246,6 @@ int32_t getNumOfTotalRes(SGroupResInfo* pGroupResInfo) {
...
@@ -258,32 +246,6 @@ int32_t getNumOfTotalRes(SGroupResInfo* pGroupResInfo) {
return
(
int32_t
)
taosArrayGetSize
(
pGroupResInfo
->
pRows
);
return
(
int32_t
)
taosArrayGetSize
(
pGroupResInfo
->
pRows
);
}
}
static
int64_t
getNumOfResultWindowRes
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SResultRowPosition
*
pos
,
int32_t
*
rowCellInfoOffset
)
{
STaskAttr
*
pQueryAttr
=
pRuntimeEnv
->
pQueryAttr
;
ASSERT
(
0
);
for
(
int32_t
j
=
0
;
j
<
pQueryAttr
->
numOfOutput
;
++
j
)
{
int32_t
functionId
=
0
;
//pQueryAttr->pExpr1[j].base.functionId;
/*
* ts, tag, tagprj function can not decide the output number of current query
* the number of output result is decided by main output
*/
if
(
functionId
==
FUNCTION_TS
||
functionId
==
FUNCTION_TAG
||
functionId
==
FUNCTION_TAGPRJ
)
{
continue
;
}
// SResultRowEntryInfo *pResultInfo = getResultCell(pResultRow, j, rowCellInfoOffset);
// assert(pResultInfo != NULL);
//
// if (pResultInfo->numOfRes > 0) {
// return pResultInfo->numOfRes;
// }
}
return
0
;
}
static
int32_t
tableResultComparFn
(
const
void
*
pLeft
,
const
void
*
pRight
,
void
*
param
)
{
static
int32_t
tableResultComparFn
(
const
void
*
pLeft
,
const
void
*
pRight
,
void
*
param
)
{
int32_t
left
=
*
(
int32_t
*
)
pLeft
;
int32_t
left
=
*
(
int32_t
*
)
pLeft
;
int32_t
right
=
*
(
int32_t
*
)
pRight
;
int32_t
right
=
*
(
int32_t
*
)
pRight
;
...
@@ -381,7 +343,7 @@ static int32_t mergeIntoGroupResultImplRv(STaskRuntimeEnv *pRuntimeEnv, SGroupRe
...
@@ -381,7 +343,7 @@ static int32_t mergeIntoGroupResultImplRv(STaskRuntimeEnv *pRuntimeEnv, SGroupRe
}
}
int64_t
num
=
getNumOfResultWindowRes
(
pRuntimeEnv
,
&
pResultRowCell
->
pos
,
rowCellInfoOffset
);
int64_t
num
=
0
;
//
getNumOfResultWindowRes(pRuntimeEnv, &pResultRowCell->pos, rowCellInfoOffset);
if
(
num
<=
0
)
{
if
(
num
<=
0
)
{
continue
;
continue
;
}
}
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
6b17c1ca
...
@@ -239,36 +239,6 @@ static bool hasNull(SColumn* pColumn, SColumnDataAgg* pStatis) {
...
@@ -239,36 +239,6 @@ static bool hasNull(SColumn* pColumn, SColumnDataAgg* pStatis) {
return
true
;
return
true
;
}
}
static
void
prepareResultListBuffer
(
SResultRowInfo
*
pResultRowInfo
,
jmp_buf
env
)
{
int64_t
newCapacity
=
0
;
// more than the capacity, reallocate the resources
if
(
pResultRowInfo
->
size
<
pResultRowInfo
->
capacity
)
{
return
;
}
if
(
pResultRowInfo
->
capacity
>
10000
)
{
newCapacity
=
(
int64_t
)(
pResultRowInfo
->
capacity
*
1
.
25
);
}
else
{
newCapacity
=
(
int64_t
)(
pResultRowInfo
->
capacity
*
1
.
5
);
}
if
(
newCapacity
<=
pResultRowInfo
->
capacity
)
{
newCapacity
+=
4
;
}
char
*
p
=
taosMemoryRealloc
(
pResultRowInfo
->
pPosition
,
newCapacity
*
sizeof
(
SResultRowPosition
));
if
(
p
==
NULL
)
{
longjmp
(
env
,
TSDB_CODE_OUT_OF_MEMORY
);
}
pResultRowInfo
->
pPosition
=
(
SResultRowPosition
*
)
p
;
int32_t
inc
=
(
int32_t
)
newCapacity
-
pResultRowInfo
->
capacity
;
memset
(
&
pResultRowInfo
->
pPosition
[
pResultRowInfo
->
capacity
],
0
,
sizeof
(
SResultRowPosition
)
*
inc
);
pResultRowInfo
->
capacity
=
(
int32_t
)
newCapacity
;
}
static
bool
chkResultRowFromKey
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SResultRowInfo
*
pResultRowInfo
,
char
*
pData
,
static
bool
chkResultRowFromKey
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SResultRowInfo
*
pResultRowInfo
,
char
*
pData
,
int16_t
bytes
,
bool
masterscan
,
uint64_t
uid
)
{
int16_t
bytes
,
bool
masterscan
,
uint64_t
uid
)
{
bool
existed
=
false
;
bool
existed
=
false
;
...
@@ -306,7 +276,7 @@ static bool chkResultRowFromKey(STaskRuntimeEnv* pRuntimeEnv, SResultRowInfo* pR
...
@@ -306,7 +276,7 @@ static bool chkResultRowFromKey(STaskRuntimeEnv* pRuntimeEnv, SResultRowInfo* pR
return
p1
!=
NULL
;
return
p1
!=
NULL
;
}
}
SResultRow
*
getNewResultRow
_rv
(
SDiskbasedBuf
*
pResultBuf
,
int64_t
tableGroupId
,
int32_t
interBufSize
)
{
SResultRow
*
getNewResultRow
(
SDiskbasedBuf
*
pResultBuf
,
int64_t
tableGroupId
,
int32_t
interBufSize
)
{
SFilePage
*
pData
=
NULL
;
SFilePage
*
pData
=
NULL
;
// in the first scan, new space needed for results
// in the first scan, new space needed for results
...
@@ -375,6 +345,8 @@ SResultRow* doSetResultOutBufByKey(SDiskbasedBuf* pResultBuf, SResultRowInfo* pR
...
@@ -375,6 +345,8 @@ SResultRow* doSetResultOutBufByKey(SDiskbasedBuf* pResultBuf, SResultRowInfo* pR
// In case of group by column query, the required SResultRow object must be existInCurrentResusltRowInfo in the
// In case of group by column query, the required SResultRow object must be existInCurrentResusltRowInfo in the
// pResultRowInfo object.
// pResultRowInfo object.
if
(
p1
!=
NULL
)
{
if
(
p1
!=
NULL
)
{
// todo
pResult
=
getResultRowByPos
(
pResultBuf
,
p1
);
pResult
=
getResultRowByPos
(
pResultBuf
,
p1
);
ASSERT
(
pResult
->
pageId
==
p1
->
pageId
&&
pResult
->
offset
==
p1
->
offset
);
ASSERT
(
pResult
->
pageId
==
p1
->
pageId
&&
pResult
->
offset
==
p1
->
offset
);
}
}
...
@@ -383,34 +355,28 @@ SResultRow* doSetResultOutBufByKey(SDiskbasedBuf* pResultBuf, SResultRowInfo* pR
...
@@ -383,34 +355,28 @@ SResultRow* doSetResultOutBufByKey(SDiskbasedBuf* pResultBuf, SResultRowInfo* pR
// 1. close current opened time window
// 1. close current opened time window
if
(
pResultRowInfo
->
cur
.
pageId
!=
-
1
&&
((
pResult
==
NULL
)
||
(
pResult
->
pageId
!=
pResultRowInfo
->
cur
.
pageId
&&
if
(
pResultRowInfo
->
cur
.
pageId
!=
-
1
&&
((
pResult
==
NULL
)
||
(
pResult
->
pageId
!=
pResultRowInfo
->
cur
.
pageId
&&
pResult
->
offset
!=
pResultRowInfo
->
cur
.
offset
)))
{
pResult
->
offset
!=
pResultRowInfo
->
cur
.
offset
)))
{
// todo extract function
SResultRowPosition
pos
=
pResultRowInfo
->
cur
;
SResultRowPosition
pos
=
pResultRowInfo
->
cur
;
SFilePage
*
pPage
=
getBufPage
(
pResultBuf
,
pos
.
pageId
);
SFilePage
*
pPage
=
getBufPage
(
pResultBuf
,
pos
.
pageId
);
SResultRow
*
pRow
=
(
SResultRow
*
)((
char
*
)
pPage
+
pos
.
offset
);
closeResultRow
(
pRow
);
releaseBufPage
(
pResultBuf
,
pPage
);
releaseBufPage
(
pResultBuf
,
pPage
);
}
}
// allocate a new buffer page
// allocate a new buffer page
prepareResultListBuffer
(
pResultRowInfo
,
pTaskInfo
->
env
);
if
(
pResult
==
NULL
)
{
if
(
pResult
==
NULL
)
{
ASSERT
(
pSup
->
resultRowSize
>
0
);
ASSERT
(
pSup
->
resultRowSize
>
0
);
pResult
=
getNewResultRow_rv
(
pResultBuf
,
groupId
,
pSup
->
resultRowSize
);
pResult
=
getNewResultRow
(
pResultBuf
,
groupId
,
pSup
->
resultRowSize
);
initResultRow
(
pResult
);
initResultRow
(
pResult
);
// add a new result set for a new group
// add a new result set for a new group
SResultRowPosition
pos
=
{.
pageId
=
pResult
->
pageId
,
.
offset
=
pResult
->
offset
};
SResultRowPosition
pos
=
{.
pageId
=
pResult
->
pageId
,
.
offset
=
pResult
->
offset
};
taosHashPut
(
pSup
->
pResultRowHashTable
,
pSup
->
keyBuf
,
GET_RES_WINDOW_KEY_LEN
(
bytes
),
&
pos
,
taosHashPut
(
pSup
->
pResultRowHashTable
,
pSup
->
keyBuf
,
GET_RES_WINDOW_KEY_LEN
(
bytes
),
&
pos
,
sizeof
(
SResultRowPosition
));
sizeof
(
SResultRowPosition
));
}
}
// 2. set the new time window to be the new active time window
// 2. set the new time window to be the new active time window
pResultRowInfo
->
pPosition
[
pResultRowInfo
->
size
++
]
=
(
SResultRowPosition
){.
pageId
=
pResult
->
pageId
,
.
offset
=
pResult
->
offset
};
pResultRowInfo
->
cur
=
(
SResultRowPosition
){.
pageId
=
pResult
->
pageId
,
.
offset
=
pResult
->
offset
};
pResultRowInfo
->
cur
=
(
SResultRowPosition
){.
pageId
=
pResult
->
pageId
,
.
offset
=
pResult
->
offset
};
// too many time window in query
// too many time window in query
if
(
pResultRowInfo
->
size
>
MAX_INTERVAL_TIME_WINDOW
)
{
if
(
taosHashGetSize
(
pSup
->
pResultRowHashTable
)
>
MAX_INTERVAL_TIME_WINDOW
)
{
longjmp
(
pTaskInfo
->
env
,
TSDB_CODE_QRY_TOO_MANY_TIMEWINDOW
);
longjmp
(
pTaskInfo
->
env
,
TSDB_CODE_QRY_TOO_MANY_TIMEWINDOW
);
}
}
...
@@ -585,11 +551,13 @@ void initExecTimeWindowInfo(SColumnInfoData* pColData, STimeWindow* pQueryWindow
...
@@ -585,11 +551,13 @@ void initExecTimeWindowInfo(SColumnInfoData* pColData, STimeWindow* pQueryWindow
colDataAppendInt64
(
pColData
,
4
,
&
pQueryWindow
->
ekey
);
colDataAppendInt64
(
pColData
,
4
,
&
pQueryWindow
->
ekey
);
}
}
void
doApplyFunctions
(
SExecTaskInfo
*
taskInfo
,
SqlFunctionCtx
*
pCtx
,
STimeWindow
*
pWin
,
void
doApplyFunctions
(
SExecTaskInfo
*
taskInfo
,
SqlFunctionCtx
*
pCtx
,
STimeWindow
*
pWin
,
SColumnInfoData
*
pTimeWindowData
,
int32_t
offset
,
int32_t
forwardStep
,
TSKEY
*
tsCol
,
SColumnInfoData
*
pTimeWindowData
,
int32_t
offset
,
int32_t
forwardStep
,
TSKEY
*
tsCol
,
int32_t
numOfTotal
,
int32_t
numOfOutput
,
int32_t
order
)
{
int32_t
numOfTotal
,
int32_t
numOfOutput
,
int32_t
order
)
{
for
(
int32_t
k
=
0
;
k
<
numOfOutput
;
++
k
)
{
for
(
int32_t
k
=
0
;
k
<
numOfOutput
;
++
k
)
{
// keep it temporarily
// keep it temporarily
// todo no need this??
bool
hasAgg
=
pCtx
[
k
].
input
.
colDataAggIsSet
;
bool
hasAgg
=
pCtx
[
k
].
input
.
colDataAggIsSet
;
int32_t
numOfRows
=
pCtx
[
k
].
input
.
numOfRows
;
int32_t
numOfRows
=
pCtx
[
k
].
input
.
numOfRows
;
int32_t
startOffset
=
pCtx
[
k
].
input
.
startRowIndex
;
int32_t
startOffset
=
pCtx
[
k
].
input
.
startRowIndex
;
...
@@ -609,6 +577,7 @@ void doApplyFunctions(SExecTaskInfo* taskInfo, SqlFunctionCtx* pCtx, STimeWindow
...
@@ -609,6 +577,7 @@ void doApplyFunctions(SExecTaskInfo* taskInfo, SqlFunctionCtx* pCtx, STimeWindow
if
(
fmIsWindowPseudoColumnFunc
(
pCtx
[
k
].
functionId
))
{
if
(
fmIsWindowPseudoColumnFunc
(
pCtx
[
k
].
functionId
))
{
SResultRowEntryInfo
*
pEntryInfo
=
GET_RES_INFO
(
&
pCtx
[
k
]);
SResultRowEntryInfo
*
pEntryInfo
=
GET_RES_INFO
(
&
pCtx
[
k
]);
char
*
p
=
GET_ROWCELL_INTERBUF
(
pEntryInfo
);
char
*
p
=
GET_ROWCELL_INTERBUF
(
pEntryInfo
);
SColumnInfoData
idata
=
{
0
};
SColumnInfoData
idata
=
{
0
};
...
@@ -620,11 +589,11 @@ void doApplyFunctions(SExecTaskInfo* taskInfo, SqlFunctionCtx* pCtx, STimeWindow
...
@@ -620,11 +589,11 @@ void doApplyFunctions(SExecTaskInfo* taskInfo, SqlFunctionCtx* pCtx, STimeWindow
SScalarParam
tw
=
{.
numOfRows
=
5
,
.
columnData
=
pTimeWindowData
};
SScalarParam
tw
=
{.
numOfRows
=
5
,
.
columnData
=
pTimeWindowData
};
pCtx
[
k
].
sfp
.
process
(
&
tw
,
1
,
&
out
);
pCtx
[
k
].
sfp
.
process
(
&
tw
,
1
,
&
out
);
pEntryInfo
->
numOfRes
=
1
;
pEntryInfo
->
numOfRes
=
1
;
continue
;
}
else
{
}
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
(
functionNeedToExecute
(
&
pCtx
[
k
])
&&
pCtx
[
k
].
fpSet
.
process
!=
NULL
)
{
if
(
functionNeedToExecute
(
&
pCtx
[
k
])
&&
pCtx
[
k
].
fpSet
.
process
!=
NULL
)
{
code
=
pCtx
[
k
].
fpSet
.
process
(
&
pCtx
[
k
]);
code
=
pCtx
[
k
].
fpSet
.
process
(
&
pCtx
[
k
]);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
qError
(
"%s apply functions error, code: %s"
,
GET_TASKID
(
taskInfo
),
tstrerror
(
code
));
qError
(
"%s apply functions error, code: %s"
,
GET_TASKID
(
taskInfo
),
tstrerror
(
code
));
taskInfo
->
code
=
code
;
taskInfo
->
code
=
code
;
...
@@ -637,6 +606,7 @@ void doApplyFunctions(SExecTaskInfo* taskInfo, SqlFunctionCtx* pCtx, STimeWindow
...
@@ -637,6 +606,7 @@ void doApplyFunctions(SExecTaskInfo* taskInfo, SqlFunctionCtx* pCtx, STimeWindow
pCtx
[
k
].
input
.
startRowIndex
=
startOffset
;
pCtx
[
k
].
input
.
startRowIndex
=
startOffset
;
pCtx
[
k
].
input
.
numOfRows
=
numOfRows
;
pCtx
[
k
].
input
.
numOfRows
=
numOfRows
;
}
}
}
}
}
static
FORCE_INLINE
TSKEY
reviseWindowEkey
(
STaskAttr
*
pQueryAttr
,
STimeWindow
*
pWindow
)
{
static
FORCE_INLINE
TSKEY
reviseWindowEkey
(
STaskAttr
*
pQueryAttr
,
STimeWindow
*
pWindow
)
{
...
@@ -774,7 +744,10 @@ static int32_t doAggregateImpl(SOperatorInfo* pOperator, TSKEY startTs, SqlFunct
...
@@ -774,7 +744,10 @@ static int32_t doAggregateImpl(SOperatorInfo* pOperator, TSKEY startTs, SqlFunct
for
(
int32_t
k
=
0
;
k
<
pOperator
->
numOfExprs
;
++
k
)
{
for
(
int32_t
k
=
0
;
k
<
pOperator
->
numOfExprs
;
++
k
)
{
if
(
functionNeedToExecute
(
&
pCtx
[
k
]))
{
if
(
functionNeedToExecute
(
&
pCtx
[
k
]))
{
// todo add a dummy funtion to avoid process check
// todo add a dummy funtion to avoid process check
if
(
pCtx
[
k
].
fpSet
.
process
!=
NULL
)
{
if
(
pCtx
[
k
].
fpSet
.
process
==
NULL
)
{
continue
;
}
int32_t
code
=
pCtx
[
k
].
fpSet
.
process
(
&
pCtx
[
k
]);
int32_t
code
=
pCtx
[
k
].
fpSet
.
process
(
&
pCtx
[
k
]);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
qError
(
"%s aggregate function error happens, code: %s"
,
GET_TASKID
(
pOperator
->
pTaskInfo
),
tstrerror
(
code
));
qError
(
"%s aggregate function error happens, code: %s"
,
GET_TASKID
(
pOperator
->
pTaskInfo
),
tstrerror
(
code
));
...
@@ -782,7 +755,6 @@ static int32_t doAggregateImpl(SOperatorInfo* pOperator, TSKEY startTs, SqlFunct
...
@@ -782,7 +755,6 @@ static int32_t doAggregateImpl(SOperatorInfo* pOperator, TSKEY startTs, SqlFunct
}
}
}
}
}
}
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -1218,7 +1190,6 @@ static void* destroySqlFunctionCtx(SqlFunctionCtx* pCtx, int32_t numOfOutput) {
...
@@ -1218,7 +1190,6 @@ static void* destroySqlFunctionCtx(SqlFunctionCtx* pCtx, int32_t numOfOutput) {
taosVariantDestroy
(
&
pCtx
[
i
].
param
[
j
].
param
);
taosVariantDestroy
(
&
pCtx
[
i
].
param
[
j
].
param
);
}
}
taosVariantDestroy
(
&
pCtx
[
i
].
tag
);
taosMemoryFreeClear
(
pCtx
[
i
].
subsidiaries
.
pCtx
);
taosMemoryFreeClear
(
pCtx
[
i
].
subsidiaries
.
pCtx
);
taosMemoryFree
(
pCtx
[
i
].
input
.
pData
);
taosMemoryFree
(
pCtx
[
i
].
input
.
pData
);
taosMemoryFree
(
pCtx
[
i
].
input
.
pColumnDataAgg
);
taosMemoryFree
(
pCtx
[
i
].
input
.
pColumnDataAgg
);
...
@@ -1248,9 +1219,9 @@ void setTaskKilled(SExecTaskInfo* pTaskInfo) { pTaskInfo->code = TSDB_CODE_TSC_Q
...
@@ -1248,9 +1219,9 @@ void setTaskKilled(SExecTaskInfo* pTaskInfo) { pTaskInfo->code = TSDB_CODE_TSC_Q
static
bool
isCachedLastQuery
(
STaskAttr
*
pQueryAttr
)
{
static
bool
isCachedLastQuery
(
STaskAttr
*
pQueryAttr
)
{
for
(
int32_t
i
=
0
;
i
<
pQueryAttr
->
numOfOutput
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pQueryAttr
->
numOfOutput
;
++
i
)
{
int32_t
functionId
=
getExprFunctionId
(
&
pQueryAttr
->
pExpr1
[
i
]);
int32_t
functionId
=
getExprFunctionId
(
&
pQueryAttr
->
pExpr1
[
i
]);
if
(
functionId
==
FUNCTION_LAST
||
functionId
==
FUNCTION_LAST_DST
)
{
//
if (functionId == FUNCTION_LAST || functionId == FUNCTION_LAST_DST) {
continue
;
//
continue;
}
//
}
return
false
;
return
false
;
}
}
...
@@ -1300,7 +1271,7 @@ static int32_t updateBlockLoadStatus(STaskAttr* pQuery, int32_t status) {
...
@@ -1300,7 +1271,7 @@ static int32_t updateBlockLoadStatus(STaskAttr* pQuery, int32_t status) {
for
(
int32_t
i
=
0
;
i
<
pQuery
->
numOfOutput
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pQuery
->
numOfOutput
;
++
i
)
{
int32_t
functionId
=
getExprFunctionId
(
&
pQuery
->
pExpr1
[
i
]);
int32_t
functionId
=
getExprFunctionId
(
&
pQuery
->
pExpr1
[
i
]);
#if 0
if (functionId == FUNCTION_TS || functionId == FUNCTION_TS_DUMMY || functionId == FUNCTION_TAG ||
if (functionId == FUNCTION_TS || functionId == FUNCTION_TS_DUMMY || functionId == FUNCTION_TAG ||
functionId == FUNCTION_TAG_DUMMY) {
functionId == FUNCTION_TAG_DUMMY) {
continue;
continue;
...
@@ -1311,6 +1282,8 @@ static int32_t updateBlockLoadStatus(STaskAttr* pQuery, int32_t status) {
...
@@ -1311,6 +1282,8 @@ static int32_t updateBlockLoadStatus(STaskAttr* pQuery, int32_t status) {
} else {
} else {
hasOtherFunc = true;
hasOtherFunc = true;
}
}
#endif
}
}
if
(
hasFirstLastFunc
&&
status
==
BLK_DATA_NOT_LOAD
)
{
if
(
hasFirstLastFunc
&&
status
==
BLK_DATA_NOT_LOAD
)
{
...
@@ -1786,41 +1759,13 @@ void updateOutputBuf(SOptrBasicInfo* pBInfo, int32_t* bufCapacity, int32_t numOf
...
@@ -1786,41 +1759,13 @@ void updateOutputBuf(SOptrBasicInfo* pBInfo, int32_t* bufCapacity, int32_t numOf
// set the correct pointer after the memory buffer reallocated.
// set the correct pointer after the memory buffer reallocated.
int32_t
functionId
=
pBInfo
->
pCtx
[
i
].
functionId
;
int32_t
functionId
=
pBInfo
->
pCtx
[
i
].
functionId
;
#if 0
if (functionId == FUNCTION_TOP || functionId == FUNCTION_BOTTOM || functionId == FUNCTION_DIFF ||
if (functionId == FUNCTION_TOP || functionId == FUNCTION_BOTTOM || functionId == FUNCTION_DIFF ||
functionId == FUNCTION_DERIVATIVE) {
functionId == FUNCTION_DERIVATIVE) {
// if (i > 0) pBInfo->pCtx[i].pTsOutput = pBInfo->pCtx[i - 1].pOutput;
// if (i > 0) pBInfo->pCtx[i].pTsOutput = pBInfo->pCtx[i - 1].pOutput;
}
}
}
#endif
}
void
copyTsColoum
(
SSDataBlock
*
pRes
,
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
)
{
bool
needCopyTs
=
false
;
int32_t
tsNum
=
0
;
char
*
src
=
NULL
;
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
i
++
)
{
int32_t
functionId
=
pCtx
[
i
].
functionId
;
if
(
functionId
==
FUNCTION_DIFF
||
functionId
==
FUNCTION_DERIVATIVE
)
{
needCopyTs
=
true
;
if
(
i
>
0
&&
pCtx
[
i
-
1
].
functionId
==
FUNCTION_TS_DUMMY
)
{
SColumnInfoData
*
pColRes
=
taosArrayGet
(
pRes
->
pDataBlock
,
i
-
1
);
// find ts data
src
=
pColRes
->
pData
;
}
}
else
if
(
functionId
==
FUNCTION_TS_DUMMY
)
{
tsNum
++
;
}
}
if
(
!
needCopyTs
)
return
;
if
(
tsNum
<
2
)
return
;
if
(
src
==
NULL
)
return
;
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
i
++
)
{
int32_t
functionId
=
pCtx
[
i
].
functionId
;
if
(
functionId
==
FUNCTION_TS_DUMMY
)
{
SColumnInfoData
*
pColRes
=
taosArrayGet
(
pRes
->
pDataBlock
,
i
);
memcpy
(
pColRes
->
pData
,
src
,
pColRes
->
info
.
bytes
*
pRes
->
info
.
rows
);
}
}
}
}
}
...
@@ -2577,47 +2522,7 @@ int32_t setSDataBlockFromFetchRsp(SSDataBlock* pRes, SLoadRemoteDataInfo* pLoadI
...
@@ -2577,47 +2522,7 @@ int32_t setSDataBlockFromFetchRsp(SSDataBlock* pRes, SLoadRemoteDataInfo* pLoadI
int32_t
compLen
,
int32_t
numOfOutput
,
int64_t
startTs
,
uint64_t
*
total
,
int32_t
compLen
,
int32_t
numOfOutput
,
int64_t
startTs
,
uint64_t
*
total
,
SArray
*
pColList
)
{
SArray
*
pColList
)
{
if
(
pColList
==
NULL
)
{
// data from other sources
if
(
pColList
==
NULL
)
{
// data from other sources
blockDataEnsureCapacity
(
pRes
,
numOfRows
);
blockCompressDecode
(
pRes
,
numOfOutput
,
numOfRows
,
pData
);
int32_t
dataLen
=
*
(
int32_t
*
)
pData
;
pData
+=
sizeof
(
int32_t
);
pRes
->
info
.
groupId
=
*
(
uint64_t
*
)
pData
;
pData
+=
sizeof
(
uint64_t
);
int32_t
*
colLen
=
(
int32_t
*
)
pData
;
char
*
pStart
=
pData
+
sizeof
(
int32_t
)
*
numOfOutput
;
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
++
i
)
{
colLen
[
i
]
=
htonl
(
colLen
[
i
]);
ASSERT
(
colLen
[
i
]
>=
0
);
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pRes
->
pDataBlock
,
i
);
if
(
IS_VAR_DATA_TYPE
(
pColInfoData
->
info
.
type
))
{
pColInfoData
->
varmeta
.
length
=
colLen
[
i
];
pColInfoData
->
varmeta
.
allocLen
=
colLen
[
i
];
memcpy
(
pColInfoData
->
varmeta
.
offset
,
pStart
,
sizeof
(
int32_t
)
*
numOfRows
);
pStart
+=
sizeof
(
int32_t
)
*
numOfRows
;
if
(
colLen
[
i
]
>
0
)
{
taosMemoryFreeClear
(
pColInfoData
->
pData
);
pColInfoData
->
pData
=
taosMemoryMalloc
(
colLen
[
i
]);
}
}
else
{
memcpy
(
pColInfoData
->
nullbitmap
,
pStart
,
BitmapLen
(
numOfRows
));
pStart
+=
BitmapLen
(
numOfRows
);
}
if
(
colLen
[
i
]
>
0
)
{
memcpy
(
pColInfoData
->
pData
,
pStart
,
colLen
[
i
]);
}
// TODO setting this flag to true temporarily so aggregate function on stable will
// examine NULL value for non-primary key column
pColInfoData
->
hasNull
=
true
;
pStart
+=
colLen
[
i
];
}
}
else
{
// extract data according to pColList
}
else
{
// extract data according to pColList
ASSERT
(
numOfOutput
==
taosArrayGetSize
(
pColList
));
ASSERT
(
numOfOutput
==
taosArrayGetSize
(
pColList
));
char
*
pStart
=
pData
;
char
*
pStart
=
pData
;
...
@@ -3587,7 +3492,7 @@ int32_t aggDecodeResultRow(SOperatorInfo* pOperator, char* result) {
...
@@ -3587,7 +3492,7 @@ int32_t aggDecodeResultRow(SOperatorInfo* pOperator, char* result) {
offset
+=
sizeof
(
int32_t
);
offset
+=
sizeof
(
int32_t
);
uint64_t
tableGroupId
=
*
(
uint64_t
*
)(
result
+
offset
);
uint64_t
tableGroupId
=
*
(
uint64_t
*
)(
result
+
offset
);
SResultRow
*
resultRow
=
getNewResultRow
_rv
(
pSup
->
pResultBuf
,
tableGroupId
,
pSup
->
resultRowSize
);
SResultRow
*
resultRow
=
getNewResultRow
(
pSup
->
pResultBuf
,
tableGroupId
,
pSup
->
resultRowSize
);
if
(
!
resultRow
)
{
if
(
!
resultRow
)
{
return
TSDB_CODE_TSC_INVALID_INPUT
;
return
TSDB_CODE_TSC_INVALID_INPUT
;
}
}
...
@@ -3610,10 +3515,6 @@ int32_t aggDecodeResultRow(SOperatorInfo* pOperator, char* result) {
...
@@ -3610,10 +3515,6 @@ int32_t aggDecodeResultRow(SOperatorInfo* pOperator, char* result) {
offset
+=
valueLen
;
offset
+=
valueLen
;
initResultRow
(
resultRow
);
initResultRow
(
resultRow
);
prepareResultListBuffer
(
&
pInfo
->
resultRowInfo
,
pOperator
->
pTaskInfo
->
env
);
// pInfo->resultRowInfo.cur = pInfo->resultRowInfo.size;
// pInfo->resultRowInfo.pPosition[pInfo->resultRowInfo.size++] =
// (SResultRowPosition){.pageId = resultRow->pageId, .offset = resultRow->offset};
pInfo
->
resultRowInfo
.
cur
=
(
SResultRowPosition
){.
pageId
=
resultRow
->
pageId
,
.
offset
=
resultRow
->
offset
};
pInfo
->
resultRowInfo
.
cur
=
(
SResultRowPosition
){.
pageId
=
resultRow
->
pageId
,
.
offset
=
resultRow
->
offset
};
}
}
...
@@ -3905,18 +3806,6 @@ static SSDataBlock* doFill(SOperatorInfo* pOperator) {
...
@@ -3905,18 +3806,6 @@ static SSDataBlock* doFill(SOperatorInfo* pOperator) {
}
}
}
}
// todo set the attribute of query scan count
static
int32_t
getNumOfScanTimes
(
STaskAttr
*
pQueryAttr
)
{
for
(
int32_t
i
=
0
;
i
<
pQueryAttr
->
numOfOutput
;
++
i
)
{
int32_t
functionId
=
getExprFunctionId
(
&
pQueryAttr
->
pExpr1
[
i
]);
if
(
functionId
==
FUNCTION_STDDEV
||
functionId
==
FUNCTION_PERCT
)
{
return
2
;
}
}
return
1
;
}
static
void
destroyOperatorInfo
(
SOperatorInfo
*
pOperator
)
{
static
void
destroyOperatorInfo
(
SOperatorInfo
*
pOperator
)
{
if
(
pOperator
==
NULL
)
{
if
(
pOperator
==
NULL
)
{
return
;
return
;
...
...
source/libs/executor/src/groupoperator.c
浏览文件 @
6b17c1ca
...
@@ -110,9 +110,11 @@ static bool groupKeyCompare(SArray* pGroupCols, SArray* pGroupColVals, SSDataBlo
...
@@ -110,9 +110,11 @@ static bool groupKeyCompare(SArray* pGroupCols, SArray* pGroupColVals, SSDataBlo
return
true
;
return
true
;
}
}
static
void
recordNewGroupKeys
(
SArray
*
pGroupCols
,
SArray
*
pGroupColVals
,
SSDataBlock
*
pBlock
,
int32_t
rowIndex
,
int32_t
numOfGroupCols
)
{
static
void
recordNewGroupKeys
(
SArray
*
pGroupCols
,
SArray
*
pGroupColVals
,
SSDataBlock
*
pBlock
,
int32_t
rowIndex
)
{
SColumnDataAgg
*
pColAgg
=
NULL
;
SColumnDataAgg
*
pColAgg
=
NULL
;
size_t
numOfGroupCols
=
taosArrayGetSize
(
pGroupCols
);
for
(
int32_t
i
=
0
;
i
<
numOfGroupCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfGroupCols
;
++
i
)
{
SColumn
*
pCol
=
taosArrayGet
(
pGroupCols
,
i
);
SColumn
*
pCol
=
taosArrayGet
(
pGroupCols
,
i
);
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pBlock
->
pDataBlock
,
pCol
->
slotId
);
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pBlock
->
pDataBlock
,
pCol
->
slotId
);
...
@@ -208,7 +210,7 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
...
@@ -208,7 +210,7 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
for
(
int32_t
j
=
0
;
j
<
pBlock
->
info
.
rows
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
pBlock
->
info
.
rows
;
++
j
)
{
// Compare with the previous row of this column, and do not set the output buffer again if they are identical.
// Compare with the previous row of this column, and do not set the output buffer again if they are identical.
if
(
!
pInfo
->
isInit
)
{
if
(
!
pInfo
->
isInit
)
{
recordNewGroupKeys
(
pInfo
->
pGroupCols
,
pInfo
->
pGroupColVals
,
pBlock
,
j
,
numOfGroupCols
);
recordNewGroupKeys
(
pInfo
->
pGroupCols
,
pInfo
->
pGroupColVals
,
pBlock
,
j
);
pInfo
->
isInit
=
true
;
pInfo
->
isInit
=
true
;
num
++
;
num
++
;
continue
;
continue
;
...
@@ -223,7 +225,7 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
...
@@ -223,7 +225,7 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
// The first row of a new block does not belongs to the previous existed group
// The first row of a new block does not belongs to the previous existed group
if
(
j
==
0
)
{
if
(
j
==
0
)
{
num
++
;
num
++
;
recordNewGroupKeys
(
pInfo
->
pGroupCols
,
pInfo
->
pGroupColVals
,
pBlock
,
j
,
numOfGroupCols
);
recordNewGroupKeys
(
pInfo
->
pGroupCols
,
pInfo
->
pGroupColVals
,
pBlock
,
j
);
continue
;
continue
;
}
}
...
@@ -238,7 +240,7 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
...
@@ -238,7 +240,7 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
// assign the group keys or user input constant values if required
// assign the group keys or user input constant values if required
doAssignGroupKeys
(
pCtx
,
pOperator
->
numOfExprs
,
pBlock
->
info
.
rows
,
rowIndex
);
doAssignGroupKeys
(
pCtx
,
pOperator
->
numOfExprs
,
pBlock
->
info
.
rows
,
rowIndex
);
recordNewGroupKeys
(
pInfo
->
pGroupCols
,
pInfo
->
pGroupColVals
,
pBlock
,
j
,
numOfGroupCols
);
recordNewGroupKeys
(
pInfo
->
pGroupCols
,
pInfo
->
pGroupColVals
,
pBlock
,
j
);
num
=
1
;
num
=
1
;
}
}
...
@@ -409,7 +411,7 @@ static void doHashPartition(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
...
@@ -409,7 +411,7 @@ static void doHashPartition(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
int32_t
numOfGroupCols
=
taosArrayGetSize
(
pInfo
->
pGroupCols
);
int32_t
numOfGroupCols
=
taosArrayGetSize
(
pInfo
->
pGroupCols
);
for
(
int32_t
j
=
0
;
j
<
pBlock
->
info
.
rows
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
pBlock
->
info
.
rows
;
++
j
)
{
recordNewGroupKeys
(
pInfo
->
pGroupCols
,
pInfo
->
pGroupColVals
,
pBlock
,
j
,
numOfGroupCols
);
recordNewGroupKeys
(
pInfo
->
pGroupCols
,
pInfo
->
pGroupColVals
,
pBlock
,
j
);
int32_t
len
=
buildGroupKeys
(
pInfo
->
keyBuf
,
pInfo
->
pGroupColVals
);
int32_t
len
=
buildGroupKeys
(
pInfo
->
keyBuf
,
pInfo
->
pGroupColVals
);
SDataGroupInfo
*
pGInfo
=
NULL
;
SDataGroupInfo
*
pGInfo
=
NULL
;
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
6b17c1ca
...
@@ -531,7 +531,7 @@ SOperatorInfo* createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode,
...
@@ -531,7 +531,7 @@ SOperatorInfo* createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode,
}
}
pInfo
->
scanInfo
=
(
SScanInfo
){.
numOfAsc
=
pTableScanNode
->
scanSeq
[
0
],
.
numOfDesc
=
pTableScanNode
->
scanSeq
[
1
]};
pInfo
->
scanInfo
=
(
SScanInfo
){.
numOfAsc
=
pTableScanNode
->
scanSeq
[
0
],
.
numOfDesc
=
pTableScanNode
->
scanSeq
[
1
]};
//
pInfo->scanInfo = (SScanInfo){.numOfAsc = 0, .numOfDesc = 1}; // for debug purpose
//
pInfo->scanInfo = (SScanInfo){.numOfAsc = 0, .numOfDesc = 1}; // for debug purpose
pInfo
->
readHandle
=
*
readHandle
;
pInfo
->
readHandle
=
*
readHandle
;
pInfo
->
interval
=
extractIntervalInfo
(
pTableScanNode
);
pInfo
->
interval
=
extractIntervalInfo
(
pTableScanNode
);
...
...
source/libs/executor/src/timewindowoperator.c
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
source/libs/function/inc/builtinsimpl.h
浏览文件 @
6b17c1ca
...
@@ -140,6 +140,10 @@ bool uniqueFunctionSetup(SqlFunctionCtx *pCtx, SResultRowEntryInfo* pResultInfo)
...
@@ -140,6 +140,10 @@ bool uniqueFunctionSetup(SqlFunctionCtx *pCtx, SResultRowEntryInfo* pResultInfo)
int32_t
uniqueFunction
(
SqlFunctionCtx
*
pCtx
);
int32_t
uniqueFunction
(
SqlFunctionCtx
*
pCtx
);
//int32_t uniqueFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock);
//int32_t uniqueFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock);
bool
getTwaFuncEnv
(
struct
SFunctionNode
*
pFunc
,
SFuncExecEnv
*
pEnv
);
bool
twaFunctionSetup
(
SqlFunctionCtx
*
pCtx
,
SResultRowEntryInfo
*
pResultInfo
);
int32_t
twaFunction
(
SqlFunctionCtx
*
pCtx
);
int32_t
twaFinalize
(
struct
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
);
bool
getSelectivityFuncEnv
(
SFunctionNode
*
pFunc
,
SFuncExecEnv
*
pEnv
);
bool
getSelectivityFuncEnv
(
SFunctionNode
*
pFunc
,
SFuncExecEnv
*
pEnv
);
...
...
source/libs/function/inc/taggfunction.h
浏览文件 @
6b17c1ca
...
@@ -52,13 +52,6 @@ typedef struct SInterpInfoDetail {
...
@@ -52,13 +52,6 @@ typedef struct SInterpInfoDetail {
int8_t
primaryCol
;
int8_t
primaryCol
;
}
SInterpInfoDetail
;
}
SInterpInfoDetail
;
typedef
struct
STwaInfo
{
int8_t
hasResult
;
// flag to denote has value
double
dOutput
;
SPoint1
p
;
STimeWindow
win
;
}
STwaInfo
;
bool
topbot_datablock_filter
(
SqlFunctionCtx
*
pCtx
,
const
char
*
minval
,
const
char
*
maxval
);
bool
topbot_datablock_filter
(
SqlFunctionCtx
*
pCtx
,
const
char
*
minval
,
const
char
*
maxval
);
/**
/**
...
...
source/libs/function/src/builtins.c
浏览文件 @
6b17c1ca
...
@@ -18,7 +18,6 @@
...
@@ -18,7 +18,6 @@
#include "querynodes.h"
#include "querynodes.h"
#include "scalar.h"
#include "scalar.h"
#include "taoserror.h"
#include "taoserror.h"
#include "tdatablock.h"
static
int32_t
buildFuncErrMsg
(
char
*
pErrBuf
,
int32_t
len
,
int32_t
errCode
,
const
char
*
pFormat
,
...)
{
static
int32_t
buildFuncErrMsg
(
char
*
pErrBuf
,
int32_t
len
,
int32_t
errCode
,
const
char
*
pFormat
,
...)
{
va_list
vArgList
;
va_list
vArgList
;
...
@@ -362,7 +361,7 @@ static int32_t translateElapsed(SFunctionNode* pFunc, char* pErrBuf, int32_t len
...
@@ -362,7 +361,7 @@ static int32_t translateElapsed(SFunctionNode* pFunc, char* pErrBuf, int32_t len
pValue
->
notReserved
=
true
;
pValue
->
notReserved
=
true
;
uint8_t
paraType
=
((
SExprNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
1
))
->
resType
.
type
;
paraType
=
((
SExprNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
1
))
->
resType
.
type
;
if
(
!
IS_INTEGER_TYPE
(
paraType
))
{
if
(
!
IS_INTEGER_TYPE
(
paraType
))
{
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
}
...
@@ -456,7 +455,7 @@ static int32_t translateHLL(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
...
@@ -456,7 +455,7 @@ static int32_t translateHLL(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
"The input parameter of HYPERLOGLOG function can only be column"
);
"The input parameter of HYPERLOGLOG function can only be column"
);
}
}
pFunc
->
node
.
resType
=
(
SDataType
){.
bytes
=
tDataTypes
[
TSDB_DATA_TYPE_
UBIGINT
].
bytes
,
.
type
=
TSDB_DATA_TYPE_U
BIGINT
};
pFunc
->
node
.
resType
=
(
SDataType
){.
bytes
=
tDataTypes
[
TSDB_DATA_TYPE_
BIGINT
].
bytes
,
.
type
=
TSDB_DATA_TYPE_
BIGINT
};
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -464,12 +463,9 @@ static bool validateStateOper(const SValueNode* pVal) {
...
@@ -464,12 +463,9 @@ static bool validateStateOper(const SValueNode* pVal) {
if
(
TSDB_DATA_TYPE_BINARY
!=
pVal
->
node
.
resType
.
type
)
{
if
(
TSDB_DATA_TYPE_BINARY
!=
pVal
->
node
.
resType
.
type
)
{
return
false
;
return
false
;
}
}
return
(
0
==
strcasecmp
(
varDataVal
(
pVal
->
datum
.
p
),
"GT"
)
||
return
(
0
==
strcasecmp
(
varDataVal
(
pVal
->
datum
.
p
),
"GT"
)
||
0
==
strcasecmp
(
varDataVal
(
pVal
->
datum
.
p
),
"GE"
)
||
0
==
strcasecmp
(
varDataVal
(
pVal
->
datum
.
p
),
"GE"
)
||
0
==
strcasecmp
(
varDataVal
(
pVal
->
datum
.
p
),
"LT"
)
||
0
==
strcasecmp
(
varDataVal
(
pVal
->
datum
.
p
),
"LE"
)
||
0
==
strcasecmp
(
varDataVal
(
pVal
->
datum
.
p
),
"LT"
)
||
0
==
strcasecmp
(
varDataVal
(
pVal
->
datum
.
p
),
"EQ"
)
||
0
==
strcasecmp
(
varDataVal
(
pVal
->
datum
.
p
),
"NE"
));
0
==
strcasecmp
(
varDataVal
(
pVal
->
datum
.
p
),
"LE"
)
||
0
==
strcasecmp
(
varDataVal
(
pVal
->
datum
.
p
),
"EQ"
)
||
0
==
strcasecmp
(
varDataVal
(
pVal
->
datum
.
p
),
"NE"
));
}
}
static
int32_t
translateStateCount
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
static
int32_t
translateStateCount
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
...
@@ -553,7 +549,6 @@ static int32_t translateStateDuration(SFunctionNode* pFunc, char* pErrBuf, int32
...
@@ -553,7 +549,6 @@ static int32_t translateStateDuration(SFunctionNode* pFunc, char* pErrBuf, int32
"STATEDURATION function time unit parameter should be greater than db precision"
);
"STATEDURATION function time unit parameter should be greater than db precision"
);
}
}
pValue
->
notReserved
=
true
;
pValue
->
notReserved
=
true
;
}
}
...
@@ -838,7 +833,7 @@ static int32_t translateConcatImpl(SFunctionNode* pFunc, char* pErrBuf, int32_t
...
@@ -838,7 +833,7 @@ static int32_t translateConcatImpl(SFunctionNode* pFunc, char* pErrBuf, int32_t
int32_t
resultBytes
=
0
;
int32_t
resultBytes
=
0
;
int32_t
sepBytes
=
0
;
int32_t
sepBytes
=
0
;
//concat_ws separator should be constant string
//
concat_ws separator should be constant string
if
(
hasSep
)
{
if
(
hasSep
)
{
SNode
*
pPara
=
nodesListGetNode
(
pFunc
->
pParameterList
,
0
);
SNode
*
pPara
=
nodesListGetNode
(
pFunc
->
pParameterList
,
0
);
if
(
nodeType
(
pPara
)
!=
QUERY_NODE_VALUE
)
{
if
(
nodeType
(
pPara
)
!=
QUERY_NODE_VALUE
)
{
...
@@ -964,7 +959,7 @@ static bool validateTimezoneFormat(const SValueNode* pVal) {
...
@@ -964,7 +959,7 @@ static bool validateTimezoneFormat(const SValueNode* pVal) {
return
false
;
return
false
;
}
}
char
*
tz
=
varDataVal
(
pVal
->
datum
.
p
);
char
*
tz
=
varDataVal
(
pVal
->
datum
.
p
);
int32_t
len
=
varDataLen
(
pVal
->
datum
.
p
);
int32_t
len
=
varDataLen
(
pVal
->
datum
.
p
);
if
(
len
==
0
)
{
if
(
len
==
0
)
{
...
@@ -1010,18 +1005,18 @@ static bool validateTimezoneFormat(const SValueNode* pVal) {
...
@@ -1010,18 +1005,18 @@ static bool validateTimezoneFormat(const SValueNode* pVal) {
void
static
addTimezoneParam
(
SNodeList
*
pList
)
{
void
static
addTimezoneParam
(
SNodeList
*
pList
)
{
char
buf
[
6
]
=
{
0
};
char
buf
[
6
]
=
{
0
};
time_t
t
=
taosTime
(
NULL
);
time_t
t
=
taosTime
(
NULL
);
struct
tm
*
tmInfo
=
taosLocalTime
(
&
t
,
NULL
);
struct
tm
*
tmInfo
=
taosLocalTime
(
&
t
,
NULL
);
strftime
(
buf
,
sizeof
(
buf
),
"%z"
,
tmInfo
);
strftime
(
buf
,
sizeof
(
buf
),
"%z"
,
tmInfo
);
int32_t
len
=
(
int32_t
)
strlen
(
buf
);
int32_t
len
=
(
int32_t
)
strlen
(
buf
);
SValueNode
*
pVal
=
(
SValueNode
*
)
nodesMakeNode
(
QUERY_NODE_VALUE
);
SValueNode
*
pVal
=
(
SValueNode
*
)
nodesMakeNode
(
QUERY_NODE_VALUE
);
pVal
->
literal
=
strndup
(
buf
,
len
);
pVal
->
literal
=
strndup
(
buf
,
len
);
pVal
->
isDuration
=
false
;
pVal
->
isDuration
=
false
;
pVal
->
translate
=
true
;
pVal
->
translate
=
true
;
pVal
->
node
.
resType
.
type
=
TSDB_DATA_TYPE_BINARY
;
pVal
->
node
.
resType
.
type
=
TSDB_DATA_TYPE_BINARY
;
pVal
->
node
.
resType
.
bytes
=
len
+
VARSTR_HEADER_SIZE
;
pVal
->
node
.
resType
.
bytes
=
len
+
VARSTR_HEADER_SIZE
;
pVal
->
node
.
resType
.
precision
=
TSDB_TIME_PRECISION_MILLI
;
pVal
->
node
.
resType
.
precision
=
TSDB_TIME_PRECISION_MILLI
;
pVal
->
datum
.
p
=
taosMemoryCalloc
(
1
,
len
+
VARSTR_HEADER_SIZE
+
1
);
pVal
->
datum
.
p
=
taosMemoryCalloc
(
1
,
len
+
VARSTR_HEADER_SIZE
+
1
);
varDataSetLen
(
pVal
->
datum
.
p
,
len
);
varDataSetLen
(
pVal
->
datum
.
p
,
len
);
strncpy
(
varDataVal
(
pVal
->
datum
.
p
),
pVal
->
literal
,
len
);
strncpy
(
varDataVal
(
pVal
->
datum
.
p
),
pVal
->
literal
,
len
);
...
@@ -1034,25 +1029,24 @@ static int32_t translateToIso8601(SFunctionNode* pFunc, char* pErrBuf, int32_t l
...
@@ -1034,25 +1029,24 @@ static int32_t translateToIso8601(SFunctionNode* pFunc, char* pErrBuf, int32_t l
return
invaildFuncParaNumErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
return
invaildFuncParaNumErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
}
//param0
//
param0
uint8_t
paraType
=
((
SExprNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
0
))
->
resType
.
type
;
uint8_t
paraType
=
((
SExprNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
0
))
->
resType
.
type
;
if
(
!
IS_INTEGER_TYPE
(
paraType
)
&&
TSDB_DATA_TYPE_TIMESTAMP
!=
paraType
)
{
if
(
!
IS_INTEGER_TYPE
(
paraType
)
&&
TSDB_DATA_TYPE_TIMESTAMP
!=
paraType
)
{
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
}
//param1
//
param1
if
(
numOfParams
==
2
)
{
if
(
numOfParams
==
2
)
{
SValueNode
*
pValue
=
(
SValueNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
1
);
SValueNode
*
pValue
=
(
SValueNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
1
);
if
(
!
validateTimezoneFormat
(
pValue
))
{
if
(
!
validateTimezoneFormat
(
pValue
))
{
return
buildFuncErrMsg
(
pErrBuf
,
len
,
TSDB_CODE_FUNC_FUNTION_ERROR
,
return
buildFuncErrMsg
(
pErrBuf
,
len
,
TSDB_CODE_FUNC_FUNTION_ERROR
,
"Invalid timzone format"
);
"Invalid timzone format"
);
}
}
}
else
{
//
add default client timezone
}
else
{
//
add default client timezone
addTimezoneParam
(
pFunc
->
pParameterList
);
addTimezoneParam
(
pFunc
->
pParameterList
);
}
}
//set result type
//
set result type
pFunc
->
node
.
resType
=
(
SDataType
){.
bytes
=
64
,
.
type
=
TSDB_DATA_TYPE_BINARY
};
pFunc
->
node
.
resType
=
(
SDataType
){.
bytes
=
64
,
.
type
=
TSDB_DATA_TYPE_BINARY
};
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -1312,6 +1306,16 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
...
@@ -1312,6 +1306,16 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.
finalizeFunc
=
firstLastFinalize
,
.
finalizeFunc
=
firstLastFinalize
,
.
combineFunc
=
lastCombine
,
.
combineFunc
=
lastCombine
,
},
},
{
.
name
=
"twa"
,
.
type
=
FUNCTION_TYPE_TWA
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_TIMELINE_FUNC
,
.
translateFunc
=
translateInNumOutDou
,
.
getEnvFunc
=
getTwaFuncEnv
,
.
initFunc
=
twaFunctionSetup
,
.
processFunc
=
twaFunction
,
.
finalizeFunc
=
twaFinalize
},
{
{
.
name
=
"histogram"
,
.
name
=
"histogram"
,
.
type
=
FUNCTION_TYPE_HISTOGRAM
,
.
type
=
FUNCTION_TYPE_HISTOGRAM
,
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
source/libs/function/src/taggfunction.c
浏览文件 @
6b17c1ca
...
@@ -236,7 +236,7 @@ bool isRowEntryCompleted(struct SResultRowEntryInfo* pEntry) {
...
@@ -236,7 +236,7 @@ bool isRowEntryCompleted(struct SResultRowEntryInfo* pEntry) {
bool
isRowEntryInitialized
(
struct
SResultRowEntryInfo
*
pEntry
)
{
bool
isRowEntryInitialized
(
struct
SResultRowEntryInfo
*
pEntry
)
{
return
pEntry
->
initialized
;
return
pEntry
->
initialized
;
}
}
#if 0
int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionId, int32_t param, SResultDataInfo* pInfo, int16_t extLength,
int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionId, int32_t param, SResultDataInfo* pInfo, int16_t extLength,
bool isSuperTable/*, SUdfInfo* pUdfInfo*/) {
bool isSuperTable/*, SUdfInfo* pUdfInfo*/) {
if (!isValidDataType(dataType)) {
if (!isValidDataType(dataType)) {
...
@@ -470,6 +470,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
...
@@ -470,6 +470,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
return TSDB_CODE_SUCCESS;
return TSDB_CODE_SUCCESS;
}
}
#endif
static
bool
function_setup
(
SqlFunctionCtx
*
pCtx
,
SResultRowEntryInfo
*
pResultInfo
)
{
static
bool
function_setup
(
SqlFunctionCtx
*
pCtx
,
SResultRowEntryInfo
*
pResultInfo
)
{
if
(
pResultInfo
->
initialized
)
{
if
(
pResultInfo
->
initialized
)
{
...
...
source/libs/function/src/texpr.c
浏览文件 @
6b17c1ca
...
@@ -36,12 +36,7 @@ void tExprTreeDestroy(tExprNode *pNode, void (*fp)(void *)) {
...
@@ -36,12 +36,7 @@ void tExprTreeDestroy(tExprNode *pNode, void (*fp)(void *)) {
if
(
pNode
->
nodeType
==
TEXPR_BINARYEXPR_NODE
||
pNode
->
nodeType
==
TEXPR_UNARYEXPR_NODE
)
{
if
(
pNode
->
nodeType
==
TEXPR_BINARYEXPR_NODE
||
pNode
->
nodeType
==
TEXPR_UNARYEXPR_NODE
)
{
doExprTreeDestroy
(
&
pNode
,
fp
);
doExprTreeDestroy
(
&
pNode
,
fp
);
}
else
if
(
pNode
->
nodeType
==
TEXPR_VALUE_NODE
)
{
taosVariantDestroy
(
pNode
->
pVal
);
}
else
if
(
pNode
->
nodeType
==
TEXPR_COL_NODE
)
{
taosMemoryFreeClear
(
pNode
->
pSchema
);
}
}
taosMemoryFree
(
pNode
);
taosMemoryFree
(
pNode
);
}
}
...
@@ -49,15 +44,6 @@ static void doExprTreeDestroy(tExprNode **pExpr, void (*fp)(void *)) {
...
@@ -49,15 +44,6 @@ static void doExprTreeDestroy(tExprNode **pExpr, void (*fp)(void *)) {
if
(
*
pExpr
==
NULL
)
{
if
(
*
pExpr
==
NULL
)
{
return
;
return
;
}
}
int32_t
type
=
(
*
pExpr
)
->
nodeType
;
if
(
type
==
TEXPR_VALUE_NODE
)
{
taosVariantDestroy
((
*
pExpr
)
->
pVal
);
taosMemoryFree
((
*
pExpr
)
->
pVal
);
}
else
if
(
type
==
TEXPR_COL_NODE
)
{
taosMemoryFree
((
*
pExpr
)
->
pSchema
);
}
taosMemoryFree
(
*
pExpr
);
taosMemoryFree
(
*
pExpr
);
*
pExpr
=
NULL
;
*
pExpr
=
NULL
;
}
}
...
...
source/libs/function/src/tudf.c
浏览文件 @
6b17c1ca
...
@@ -66,7 +66,7 @@ void udfUdfdExit(uv_process_t *process, int64_t exitStatus, int termSignal) {
...
@@ -66,7 +66,7 @@ void udfUdfdExit(uv_process_t *process, int64_t exitStatus, int termSignal) {
}
}
static
int32_t
udfSpawnUdfd
(
SUdfdData
*
pData
)
{
static
int32_t
udfSpawnUdfd
(
SUdfdData
*
pData
)
{
fnInfo
(
"
dnode start spawning
udfd"
);
fnInfo
(
"
start to init
udfd"
);
uv_process_options_t
options
=
{
0
};
uv_process_options_t
options
=
{
0
};
char
path
[
PATH_MAX
]
=
{
0
};
char
path
[
PATH_MAX
]
=
{
0
};
...
@@ -140,6 +140,8 @@ static int32_t udfSpawnUdfd(SUdfdData* pData) {
...
@@ -140,6 +140,8 @@ static int32_t udfSpawnUdfd(SUdfdData* pData) {
if
(
err
!=
0
)
{
if
(
err
!=
0
)
{
fnError
(
"can not spawn udfd. path: %s, error: %s"
,
path
,
uv_strerror
(
err
));
fnError
(
"can not spawn udfd. path: %s, error: %s"
,
path
,
uv_strerror
(
err
));
}
else
{
fnInfo
(
"udfd is initialized"
);
}
}
return
err
;
return
err
;
}
}
...
...
source/libs/nodes/src/nodesCloneFuncs.c
浏览文件 @
6b17c1ca
...
@@ -142,7 +142,7 @@ static SNode* valueNodeCopy(const SValueNode* pSrc, SValueNode* pDst) {
...
@@ -142,7 +142,7 @@ static SNode* valueNodeCopy(const SValueNode* pSrc, SValueNode* pDst) {
break
;
break
;
case
TSDB_DATA_TYPE_NCHAR
:
case
TSDB_DATA_TYPE_NCHAR
:
case
TSDB_DATA_TYPE_VARCHAR
:
case
TSDB_DATA_TYPE_VARCHAR
:
case
TSDB_DATA_TYPE_VARBINARY
:{
case
TSDB_DATA_TYPE_VARBINARY
:
{
int32_t
len
=
varDataTLen
(
pSrc
->
datum
.
p
)
+
1
;
int32_t
len
=
varDataTLen
(
pSrc
->
datum
.
p
)
+
1
;
pDst
->
datum
.
p
=
taosMemoryCalloc
(
1
,
len
);
pDst
->
datum
.
p
=
taosMemoryCalloc
(
1
,
len
);
if
(
NULL
==
pDst
->
datum
.
p
)
{
if
(
NULL
==
pDst
->
datum
.
p
)
{
...
@@ -399,6 +399,7 @@ static SNode* logicWindowCopy(const SWindowLogicNode* pSrc, SWindowLogicNode* pD
...
@@ -399,6 +399,7 @@ static SNode* logicWindowCopy(const SWindowLogicNode* pSrc, SWindowLogicNode* pD
COPY_SCALAR_FIELD
(
triggerType
);
COPY_SCALAR_FIELD
(
triggerType
);
COPY_SCALAR_FIELD
(
watermark
);
COPY_SCALAR_FIELD
(
watermark
);
COPY_SCALAR_FIELD
(
filesFactor
);
COPY_SCALAR_FIELD
(
filesFactor
);
COPY_SCALAR_FIELD
(
stmInterAlgo
);
return
(
SNode
*
)
pDst
;
return
(
SNode
*
)
pDst
;
}
}
...
...
source/libs/nodes/src/nodesCodeFuncs.c
浏览文件 @
6b17c1ca
...
@@ -230,6 +230,10 @@ const char* nodesNodeName(ENodeType type) {
...
@@ -230,6 +230,10 @@ const char* nodesNodeName(ENodeType type) {
return
"PhysiInterval"
;
return
"PhysiInterval"
;
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL
:
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL
:
return
"PhysiStreamInterval"
;
return
"PhysiStreamInterval"
;
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL
:
return
"PhysiStreamFinalInterval"
;
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL
:
return
"PhysiStreamSemiInterval"
;
case
QUERY_NODE_PHYSICAL_PLAN_FILL
:
case
QUERY_NODE_PHYSICAL_PLAN_FILL
:
return
"PhysiFill"
;
return
"PhysiFill"
;
case
QUERY_NODE_PHYSICAL_PLAN_SESSION_WINDOW
:
case
QUERY_NODE_PHYSICAL_PLAN_SESSION_WINDOW
:
...
@@ -3611,6 +3615,8 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
...
@@ -3611,6 +3615,8 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
return
physiSortNodeToJson
(
pObj
,
pJson
);
return
physiSortNodeToJson
(
pObj
,
pJson
);
case
QUERY_NODE_PHYSICAL_PLAN_INTERVAL
:
case
QUERY_NODE_PHYSICAL_PLAN_INTERVAL
:
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL
:
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL
:
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL
:
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL
:
return
physiIntervalNodeToJson
(
pObj
,
pJson
);
return
physiIntervalNodeToJson
(
pObj
,
pJson
);
case
QUERY_NODE_PHYSICAL_PLAN_FILL
:
case
QUERY_NODE_PHYSICAL_PLAN_FILL
:
return
physiFillNodeToJson
(
pObj
,
pJson
);
return
physiFillNodeToJson
(
pObj
,
pJson
);
...
@@ -3728,6 +3734,8 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
...
@@ -3728,6 +3734,8 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
return
jsonToPhysiSortNode
(
pJson
,
pObj
);
return
jsonToPhysiSortNode
(
pJson
,
pObj
);
case
QUERY_NODE_PHYSICAL_PLAN_INTERVAL
:
case
QUERY_NODE_PHYSICAL_PLAN_INTERVAL
:
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL
:
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL
:
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL
:
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL
:
return
jsonToPhysiIntervalNode
(
pJson
,
pObj
);
return
jsonToPhysiIntervalNode
(
pJson
,
pObj
);
case
QUERY_NODE_PHYSICAL_PLAN_FILL
:
case
QUERY_NODE_PHYSICAL_PLAN_FILL
:
return
jsonToPhysiFillNode
(
pJson
,
pObj
);
return
jsonToPhysiFillNode
(
pJson
,
pObj
);
...
...
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
6b17c1ca
...
@@ -260,6 +260,10 @@ SNodeptr nodesMakeNode(ENodeType type) {
...
@@ -260,6 +260,10 @@ SNodeptr nodesMakeNode(ENodeType type) {
return
makeNode
(
type
,
sizeof
(
SIntervalPhysiNode
));
return
makeNode
(
type
,
sizeof
(
SIntervalPhysiNode
));
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL
:
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL
:
return
makeNode
(
type
,
sizeof
(
SStreamIntervalPhysiNode
));
return
makeNode
(
type
,
sizeof
(
SStreamIntervalPhysiNode
));
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL
:
return
makeNode
(
type
,
sizeof
(
SStreamFinalIntervalPhysiNode
));
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL
:
return
makeNode
(
type
,
sizeof
(
SStreamSemiIntervalPhysiNode
));
case
QUERY_NODE_PHYSICAL_PLAN_FILL
:
case
QUERY_NODE_PHYSICAL_PLAN_FILL
:
return
makeNode
(
type
,
sizeof
(
SFillPhysiNode
));
return
makeNode
(
type
,
sizeof
(
SFillPhysiNode
));
case
QUERY_NODE_PHYSICAL_PLAN_SESSION_WINDOW
:
case
QUERY_NODE_PHYSICAL_PLAN_SESSION_WINDOW
:
...
...
source/libs/parser/inc/parInt.h
浏览文件 @
6b17c1ca
...
@@ -32,6 +32,7 @@ int32_t authenticate(SParseContext* pParseCxt, SQuery* pQuery);
...
@@ -32,6 +32,7 @@ int32_t authenticate(SParseContext* pParseCxt, SQuery* pQuery);
int32_t
translate
(
SParseContext
*
pParseCxt
,
SQuery
*
pQuery
);
int32_t
translate
(
SParseContext
*
pParseCxt
,
SQuery
*
pQuery
);
int32_t
extractResultSchema
(
const
SNode
*
pRoot
,
int32_t
*
numOfCols
,
SSchema
**
pSchema
);
int32_t
extractResultSchema
(
const
SNode
*
pRoot
,
int32_t
*
numOfCols
,
SSchema
**
pSchema
);
int32_t
calculateConstant
(
SParseContext
*
pParseCxt
,
SQuery
*
pQuery
);
int32_t
calculateConstant
(
SParseContext
*
pParseCxt
,
SQuery
*
pQuery
);
int32_t
isNotSchemalessDb
(
SParseContext
*
pContext
,
char
*
dbName
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/libs/parser/src/parInsert.c
浏览文件 @
6b17c1ca
...
@@ -1335,6 +1335,8 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) {
...
@@ -1335,6 +1335,8 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) {
SName
name
;
SName
name
;
CHECK_CODE
(
createSName
(
&
name
,
&
tbnameToken
,
pCxt
->
pComCxt
->
acctId
,
pCxt
->
pComCxt
->
db
,
&
pCxt
->
msg
));
CHECK_CODE
(
createSName
(
&
name
,
&
tbnameToken
,
pCxt
->
pComCxt
->
acctId
,
pCxt
->
pComCxt
->
db
,
&
pCxt
->
msg
));
CHECK_CODE
(
isNotSchemalessDb
(
pCxt
->
pComCxt
,
name
.
dbname
));
tNameExtractFullName
(
&
name
,
tbFName
);
tNameExtractFullName
(
&
name
,
tbFName
);
CHECK_CODE
(
taosHashPut
(
pCxt
->
pTableNameHashObj
,
tbFName
,
strlen
(
tbFName
),
&
name
,
sizeof
(
SName
)));
CHECK_CODE
(
taosHashPut
(
pCxt
->
pTableNameHashObj
,
tbFName
,
strlen
(
tbFName
),
&
name
,
sizeof
(
SName
)));
char
dbFName
[
TSDB_DB_FNAME_LEN
];
char
dbFName
[
TSDB_DB_FNAME_LEN
];
...
@@ -1411,6 +1413,23 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) {
...
@@ -1411,6 +1413,23 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) {
return
buildOutput
(
pCxt
);
return
buildOutput
(
pCxt
);
}
}
int32_t
isNotSchemalessDb
(
SParseContext
*
pContext
,
char
*
dbName
){
SName
name
;
tNameSetDbName
(
&
name
,
pContext
->
acctId
,
dbName
,
strlen
(
dbName
));
char
dbFname
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
tNameGetFullDbName
(
&
name
,
dbFname
);
SDbCfgInfo
pInfo
=
{
0
};
int32_t
code
=
catalogGetDBCfg
(
pContext
->
pCatalog
,
pContext
->
pTransporter
,
&
pContext
->
mgmtEpSet
,
dbFname
,
&
pInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
parserError
(
"catalogGetDBCfg error, code:%s, dbFName:%s"
,
tstrerror
(
code
),
dbFname
);
return
code
;
}
if
(
pInfo
.
schemaless
){
parserError
(
"can not insert into schemaless db:%s"
,
dbFname
);
return
TSDB_CODE_SML_INVALID_DB_CONF
;
}
return
TSDB_CODE_SUCCESS
;
}
// INSERT INTO
// INSERT INTO
// tb_name
// tb_name
// [USING stb_name [(tag1_name, ...)] TAGS (tag1_value, ...)]
// [USING stb_name [(tag1_name, ...)] TAGS (tag1_value, ...)]
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
source/libs/planner/src/planLogicCreater.c
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
source/libs/planner/src/planPhysiCreater.c
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
source/libs/planner/src/planSpliter.c
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
source/libs/planner/test/planOtherTest.cpp
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
source/libs/sync/src/syncMain.c
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
source/libs/wal/src/walWrite.c
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
source/util/src/terror.c
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
source/util/src/tlist.c
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
source/util/src/tworker.c
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/script/tsim/bnode/basic1.sim
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/script/tsim/db/alter_option.sim
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/script/tsim/db/alter_replica_13.sim
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/script/tsim/dnode/basic1.sim
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/script/tsim/mnode/basic1.sim
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/script/tsim/mnode/basic2.sim
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/script/tsim/mnode/basic3.sim
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/script/tsim/mnode/basic4.sim
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/script/tsim/qnode/basic1.sim
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/script/tsim/query/explain.sim
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/script/tsim/query/scalarNull.sim
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/script/tsim/query/udf.sim
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/script/tsim/snode/basic1.sim
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/script/tsim/stream/basic0.sim
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/script/tsim/sync/3Replica1VgElect.sim
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/script/tsim/sync/3Replica5VgElect.sim
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/script/tsim/sync/oneReplica1VgElect.sim
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/script/tsim/sync/oneReplica1VgElectWithInsert.sim
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/script/tsim/sync/oneReplica5VgElect.sim
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/script/tsim/sync/threeReplica1VgElect.sim
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/script/tsim/sync/threeReplica1VgElectWihtInsert.sim
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/script/tsim/trans/create_db.sim
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/system-test/0-others/taosdMonitor.py
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/system-test/1-insert/influxdb_line_taosc_insert.py
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/system-test/1-insert/opentsdb_json_taosc_insert.py
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/system-test/1-insert/opentsdb_telnet_line_taosc_insert.py
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/system-test/2-query/mavg.py
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/system-test/fulltest.sh
100644 → 100755
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/test/c/sdbDump.c
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
tests/test/c/tmqSim.c
浏览文件 @
6b17c1ca
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录