Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
880359dd
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
880359dd
编写于
5月 27, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' of
https://github.com/taosdata/TDengine
into enh/tsdb_optimize
上级
62a3c271
e31d9299
变更
22
显示空白变更内容
内联
并排
Showing
22 changed file
with
194 addition
and
116 deletion
+194
-116
include/util/taoserror.h
include/util/taoserror.h
+1
-0
source/client/inc/clientSml.h
source/client/inc/clientSml.h
+1
-1
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+1
-0
source/client/src/clientSml.c
source/client/src/clientSml.c
+39
-31
source/client/src/clientSmlJson.c
source/client/src/clientSmlJson.c
+13
-3
source/client/src/clientSmlLine.c
source/client/src/clientSmlLine.c
+9
-1
source/client/src/clientSmlTelnet.c
source/client/src/clientSmlTelnet.c
+5
-1
source/client/src/clientTmq.c
source/client/src/clientTmq.c
+4
-2
source/client/test/clientTests.cpp
source/client/test/clientTests.cpp
+12
-3
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+9
-2
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+9
-3
source/dnode/vnode/src/tsdb/tsdbCache.c
source/dnode/vnode/src/tsdb/tsdbCache.c
+45
-30
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
+12
-12
source/dnode/vnode/src/tsdb/tsdbMemTable.c
source/dnode/vnode/src/tsdb/tsdbMemTable.c
+3
-3
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+2
-1
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+4
-7
source/libs/parser/src/parUtil.c
source/libs/parser/src/parUtil.c
+1
-1
source/libs/stream/src/streamExec.c
source/libs/stream/src/streamExec.c
+5
-1
source/libs/stream/src/streamMeta.c
source/libs/stream/src/streamMeta.c
+5
-1
source/util/src/terror.c
source/util/src/terror.c
+1
-0
tests/parallel_test/cases.task
tests/parallel_test/cases.task
+2
-2
tests/script/tsim/query/udfpy.sim
tests/script/tsim/query/udfpy.sim
+11
-11
未找到文件。
include/util/taoserror.h
浏览文件 @
880359dd
...
@@ -409,6 +409,7 @@ int32_t* taosGetErrno();
...
@@ -409,6 +409,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_MNODE_ALREADY_IS_VOTER TAOS_DEF_ERROR_CODE(0, 0x0413) // internal
#define TSDB_CODE_MNODE_ALREADY_IS_VOTER TAOS_DEF_ERROR_CODE(0, 0x0413) // internal
#define TSDB_CODE_MNODE_ONLY_TWO_MNODE TAOS_DEF_ERROR_CODE(0, 0x0414) // internal
#define TSDB_CODE_MNODE_ONLY_TWO_MNODE TAOS_DEF_ERROR_CODE(0, 0x0414) // internal
#define TSDB_CODE_MNODE_NO_NEED_RESTORE TAOS_DEF_ERROR_CODE(0, 0x0415) // internal
#define TSDB_CODE_MNODE_NO_NEED_RESTORE TAOS_DEF_ERROR_CODE(0, 0x0415) // internal
#define TSDB_CODE_DNODE_ONLY_USE_WHEN_OFFLINE TAOS_DEF_ERROR_CODE(0, 0x0416)
// vnode
// vnode
// #define TSDB_CODE_VND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0500) // 2.x
// #define TSDB_CODE_VND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0500) // 2.x
...
...
source/client/inc/clientSml.h
浏览文件 @
880359dd
...
@@ -251,7 +251,7 @@ int32_t smlClearForRerun(SSmlHandle *info);
...
@@ -251,7 +251,7 @@ int32_t smlClearForRerun(SSmlHandle *info);
int32_t
smlParseValue
(
SSmlKv
*
pVal
,
SSmlMsgBuf
*
msg
);
int32_t
smlParseValue
(
SSmlKv
*
pVal
,
SSmlMsgBuf
*
msg
);
uint8_t
smlGetTimestampLen
(
int64_t
num
);
uint8_t
smlGetTimestampLen
(
int64_t
num
);
void
clearColValArray
(
SArray
*
pCols
);
void
clearColValArray
(
SArray
*
pCols
);
void
smlDestroyTableInfo
(
SSmlHandle
*
info
,
SSmlTableInfo
*
tag
);
void
smlDestroyTableInfo
(
void
*
para
);
void
freeSSmlKv
(
void
*
data
);
void
freeSSmlKv
(
void
*
data
);
int32_t
smlParseInfluxString
(
SSmlHandle
*
info
,
char
*
sql
,
char
*
sqlEnd
,
SSmlLineInfo
*
elements
);
int32_t
smlParseInfluxString
(
SSmlHandle
*
info
,
char
*
sql
,
char
*
sqlEnd
,
SSmlLineInfo
*
elements
);
...
...
source/client/src/clientImpl.c
浏览文件 @
880359dd
...
@@ -1757,6 +1757,7 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int
...
@@ -1757,6 +1757,7 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int
return
TSDB_CODE_TSC_INTERNAL_ERROR
;
return
TSDB_CODE_TSC_INTERNAL_ERROR
;
}
}
taosMemoryFreeClear
(
pResultInfo
->
convertJson
);
pResultInfo
->
convertJson
=
taosMemoryCalloc
(
1
,
dataLen
);
pResultInfo
->
convertJson
=
taosMemoryCalloc
(
1
,
dataLen
);
if
(
pResultInfo
->
convertJson
==
NULL
)
return
TSDB_CODE_OUT_OF_MEMORY
;
if
(
pResultInfo
->
convertJson
==
NULL
)
return
TSDB_CODE_OUT_OF_MEMORY
;
char
*
p1
=
pResultInfo
->
convertJson
;
char
*
p1
=
pResultInfo
->
convertJson
;
...
...
source/client/src/clientSml.c
浏览文件 @
880359dd
...
@@ -230,6 +230,16 @@ void getTableUid(SSmlHandle *info, SSmlLineInfo *currElement, SSmlTableInfo *tin
...
@@ -230,6 +230,16 @@ void getTableUid(SSmlHandle *info, SSmlLineInfo *currElement, SSmlTableInfo *tin
}
}
}
}
static
void
smlDestroySTableMeta
(
void
*
para
)
{
SSmlSTableMeta
*
meta
=
*
(
SSmlSTableMeta
**
)
para
;
taosHashCleanup
(
meta
->
tagHash
);
taosHashCleanup
(
meta
->
colHash
);
taosArrayDestroy
(
meta
->
tags
);
taosArrayDestroy
(
meta
->
cols
);
taosMemoryFreeClear
(
meta
->
tableMeta
);
taosMemoryFree
(
meta
);
}
SSmlSTableMeta
*
smlBuildSTableMeta
(
bool
isDataFormat
)
{
SSmlSTableMeta
*
smlBuildSTableMeta
(
bool
isDataFormat
)
{
SSmlSTableMeta
*
meta
=
(
SSmlSTableMeta
*
)
taosMemoryCalloc
(
sizeof
(
SSmlSTableMeta
),
1
);
SSmlSTableMeta
*
meta
=
(
SSmlSTableMeta
*
)
taosMemoryCalloc
(
sizeof
(
SSmlSTableMeta
),
1
);
if
(
!
meta
)
{
if
(
!
meta
)
{
...
@@ -264,7 +274,7 @@ SSmlSTableMeta *smlBuildSTableMeta(bool isDataFormat) {
...
@@ -264,7 +274,7 @@ SSmlSTableMeta *smlBuildSTableMeta(bool isDataFormat) {
return
meta
;
return
meta
;
cleanup:
cleanup:
taosMemoryFree
(
meta
);
smlDestroySTableMeta
(
meta
);
return
NULL
;
return
NULL
;
}
}
...
@@ -1035,6 +1045,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) {
...
@@ -1035,6 +1045,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) {
}
}
}
}
taosMemoryFreeClear
(
sTableData
->
tableMeta
);
sTableData
->
tableMeta
=
pTableMeta
;
sTableData
->
tableMeta
=
pTableMeta
;
uDebug
(
"SML:0x%"
PRIx64
"modify schema uid:%"
PRIu64
", sversion:%d, tversion:%d"
,
info
->
id
,
pTableMeta
->
uid
,
uDebug
(
"SML:0x%"
PRIx64
"modify schema uid:%"
PRIu64
", sversion:%d, tversion:%d"
,
info
->
id
,
pTableMeta
->
uid
,
pTableMeta
->
sversion
,
pTableMeta
->
tversion
)
tmp
=
(
SSmlSTableMeta
**
)
taosHashIterate
(
info
->
superTables
,
tmp
);
pTableMeta
->
sversion
,
pTableMeta
->
tversion
)
tmp
=
(
SSmlSTableMeta
**
)
taosHashIterate
(
info
->
superTables
,
tmp
);
...
@@ -1093,15 +1104,6 @@ static void smlInsertMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols) {
...
@@ -1093,15 +1104,6 @@ static void smlInsertMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols) {
}
}
}
}
static
void
smlDestroySTableMeta
(
SSmlSTableMeta
*
meta
)
{
taosHashCleanup
(
meta
->
tagHash
);
taosHashCleanup
(
meta
->
colHash
);
taosArrayDestroy
(
meta
->
tags
);
taosArrayDestroy
(
meta
->
cols
);
taosMemoryFree
(
meta
->
tableMeta
);
taosMemoryFree
(
meta
);
}
static
int32_t
smlUpdateMeta
(
SHashObj
*
metaHash
,
SArray
*
metaArray
,
SArray
*
cols
,
bool
isTag
,
SSmlMsgBuf
*
msg
)
{
static
int32_t
smlUpdateMeta
(
SHashObj
*
metaHash
,
SArray
*
metaArray
,
SArray
*
cols
,
bool
isTag
,
SSmlMsgBuf
*
msg
)
{
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
cols
);
++
i
)
{
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
cols
);
++
i
)
{
SSmlKv
*
kv
=
(
SSmlKv
*
)
taosArrayGet
(
cols
,
i
);
SSmlKv
*
kv
=
(
SSmlKv
*
)
taosArrayGet
(
cols
,
i
);
...
@@ -1141,7 +1143,8 @@ static int32_t smlUpdateMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols
...
@@ -1141,7 +1143,8 @@ static int32_t smlUpdateMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
void
smlDestroyTableInfo
(
SSmlHandle
*
info
,
SSmlTableInfo
*
tag
)
{
void
smlDestroyTableInfo
(
void
*
para
)
{
SSmlTableInfo
*
tag
=
*
(
SSmlTableInfo
**
)
para
;
for
(
size_t
i
=
0
;
i
<
taosArrayGetSize
(
tag
->
cols
);
i
++
)
{
for
(
size_t
i
=
0
;
i
<
taosArrayGetSize
(
tag
->
cols
);
i
++
)
{
SHashObj
*
kvHash
=
(
SHashObj
*
)
taosArrayGetP
(
tag
->
cols
,
i
);
SHashObj
*
kvHash
=
(
SHashObj
*
)
taosArrayGetP
(
tag
->
cols
,
i
);
taosHashCleanup
(
kvHash
);
taosHashCleanup
(
kvHash
);
...
@@ -1178,18 +1181,18 @@ void smlDestroyInfo(SSmlHandle *info) {
...
@@ -1178,18 +1181,18 @@ void smlDestroyInfo(SSmlHandle *info) {
qDestroyQuery
(
info
->
pQuery
);
qDestroyQuery
(
info
->
pQuery
);
// destroy info->childTables
// destroy info->childTables
SSmlTableInfo
**
oneTable
=
(
SSmlTableInfo
**
)
taosHashIterate
(
info
->
childTables
,
NULL
);
//
SSmlTableInfo **oneTable = (SSmlTableInfo **)taosHashIterate(info->childTables, NULL);
while
(
oneTable
)
{
//
while (oneTable) {
smlDestroyTableInfo
(
info
,
*
oneTable
);
// smlDestroyTableInfo(
oneTable);
oneTable
=
(
SSmlTableInfo
**
)
taosHashIterate
(
info
->
childTables
,
oneTable
);
//
oneTable = (SSmlTableInfo **)taosHashIterate(info->childTables, oneTable);
}
//
}
// destroy info->superTables
// destroy info->superTables
SSmlSTableMeta
**
oneSTable
=
(
SSmlSTableMeta
**
)
taosHashIterate
(
info
->
superTables
,
NULL
);
//
SSmlSTableMeta **oneSTable = (SSmlSTableMeta **)taosHashIterate(info->superTables, NULL);
while
(
oneSTable
)
{
//
while (oneSTable) {
smlDestroySTableMeta
(
*
oneSTable
);
//
smlDestroySTableMeta(*oneSTable);
oneSTable
=
(
SSmlSTableMeta
**
)
taosHashIterate
(
info
->
superTables
,
oneSTable
);
//
oneSTable = (SSmlSTableMeta **)taosHashIterate(info->superTables, oneSTable);
}
//
}
// destroy info->pVgHash
// destroy info->pVgHash
taosHashCleanup
(
info
->
pVgHash
);
taosHashCleanup
(
info
->
pVgHash
);
...
@@ -1248,6 +1251,8 @@ SSmlHandle *smlBuildSmlInfo(TAOS *taos) {
...
@@ -1248,6 +1251,8 @@ SSmlHandle *smlBuildSmlInfo(TAOS *taos) {
info
->
childTables
=
taosHashInit
(
16
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
HASH_NO_LOCK
);
info
->
childTables
=
taosHashInit
(
16
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
HASH_NO_LOCK
);
info
->
tableUids
=
taosHashInit
(
16
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
HASH_NO_LOCK
);
info
->
tableUids
=
taosHashInit
(
16
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
HASH_NO_LOCK
);
info
->
superTables
=
taosHashInit
(
16
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
HASH_NO_LOCK
);
info
->
superTables
=
taosHashInit
(
16
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
HASH_NO_LOCK
);
taosHashSetFreeFp
(
info
->
superTables
,
smlDestroySTableMeta
);
taosHashSetFreeFp
(
info
->
childTables
,
smlDestroyTableInfo
);
info
->
id
=
smlGenId
();
info
->
id
=
smlGenId
();
info
->
pQuery
=
smlInitHandle
();
info
->
pQuery
=
smlInitHandle
();
...
@@ -1354,6 +1359,9 @@ static int32_t smlParseLineBottom(SSmlHandle *info) {
...
@@ -1354,6 +1359,9 @@ static int32_t smlParseLineBottom(SSmlHandle *info) {
uDebug
(
"SML:0x%"
PRIx64
" smlParseLineBottom add meta, format:%d, linenum:%d"
,
info
->
id
,
info
->
dataFormat
,
uDebug
(
"SML:0x%"
PRIx64
" smlParseLineBottom add meta, format:%d, linenum:%d"
,
info
->
id
,
info
->
dataFormat
,
info
->
lineNum
);
info
->
lineNum
);
SSmlSTableMeta
*
meta
=
smlBuildSTableMeta
(
info
->
dataFormat
);
SSmlSTableMeta
*
meta
=
smlBuildSTableMeta
(
info
->
dataFormat
);
if
(
meta
==
NULL
){
return
TSDB_CODE_OUT_OF_MEMORY
;
}
taosHashPut
(
info
->
superTables
,
elements
->
measure
,
elements
->
measureLen
,
&
meta
,
POINTER_BYTES
);
taosHashPut
(
info
->
superTables
,
elements
->
measure
,
elements
->
measureLen
,
&
meta
,
POINTER_BYTES
);
terrno
=
0
;
terrno
=
0
;
smlInsertMeta
(
meta
->
tagHash
,
meta
->
tags
,
tinfo
->
tags
);
smlInsertMeta
(
meta
->
tagHash
,
meta
->
tags
,
tinfo
->
tags
);
...
@@ -1473,18 +1481,18 @@ static void smlPrintStatisticInfo(SSmlHandle *info) {
...
@@ -1473,18 +1481,18 @@ static void smlPrintStatisticInfo(SSmlHandle *info) {
int32_t
smlClearForRerun
(
SSmlHandle
*
info
)
{
int32_t
smlClearForRerun
(
SSmlHandle
*
info
)
{
info
->
reRun
=
false
;
info
->
reRun
=
false
;
// clear info->childTables
// clear info->childTables
SSmlTableInfo
**
oneTable
=
(
SSmlTableInfo
**
)
taosHashIterate
(
info
->
childTables
,
NULL
);
//
SSmlTableInfo **oneTable = (SSmlTableInfo **)taosHashIterate(info->childTables, NULL);
while
(
oneTable
)
{
//
while (oneTable) {
smlDestroyTableInfo
(
info
,
*
oneTable
);
//
smlDestroyTableInfo(info, *oneTable);
oneTable
=
(
SSmlTableInfo
**
)
taosHashIterate
(
info
->
childTables
,
oneTable
);
//
oneTable = (SSmlTableInfo **)taosHashIterate(info->childTables, oneTable);
}
//
}
// clear info->superTables
// clear info->superTables
SSmlSTableMeta
**
oneSTable
=
(
SSmlSTableMeta
**
)
taosHashIterate
(
info
->
superTables
,
NULL
);
//
SSmlSTableMeta **oneSTable = (SSmlSTableMeta **)taosHashIterate(info->superTables, NULL);
while
(
oneSTable
)
{
//
while (oneSTable) {
smlDestroySTableMeta
(
*
oneSTable
);
//
smlDestroySTableMeta(*oneSTable);
oneSTable
=
(
SSmlSTableMeta
**
)
taosHashIterate
(
info
->
superTables
,
oneSTable
);
//
oneSTable = (SSmlSTableMeta **)taosHashIterate(info->superTables, oneSTable);
}
//
}
taosHashClear
(
info
->
childTables
);
taosHashClear
(
info
->
childTables
);
taosHashClear
(
info
->
superTables
);
taosHashClear
(
info
->
superTables
);
...
...
source/client/src/clientSmlJson.c
浏览文件 @
880359dd
...
@@ -695,6 +695,10 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo
...
@@ -695,6 +695,10 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
sMeta
=
smlBuildSTableMeta
(
info
->
dataFormat
);
sMeta
=
smlBuildSTableMeta
(
info
->
dataFormat
);
if
(
sMeta
==
NULL
){
taosMemoryFreeClear
(
pTableMeta
);
return
TSDB_CODE_OUT_OF_MEMORY
;
}
sMeta
->
tableMeta
=
pTableMeta
;
sMeta
->
tableMeta
=
pTableMeta
;
taosHashPut
(
info
->
superTables
,
elements
->
measure
,
elements
->
measureLen
,
&
sMeta
,
POINTER_BYTES
);
taosHashPut
(
info
->
superTables
,
elements
->
measure
,
elements
->
measureLen
,
&
sMeta
,
POINTER_BYTES
);
for
(
int
i
=
pTableMeta
->
tableInfo
.
numOfColumns
;
i
<
pTableMeta
->
tableInfo
.
numOfTags
+
pTableMeta
->
tableInfo
.
numOfColumns
;
i
++
){
for
(
int
i
=
pTableMeta
->
tableInfo
.
numOfColumns
;
i
<
pTableMeta
->
tableInfo
.
numOfTags
+
pTableMeta
->
tableInfo
.
numOfColumns
;
i
++
){
...
@@ -784,7 +788,7 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo
...
@@ -784,7 +788,7 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo
tinfo
->
tableDataCtx
=
smlInitTableDataCtx
(
info
->
pQuery
,
info
->
currSTableMeta
);
tinfo
->
tableDataCtx
=
smlInitTableDataCtx
(
info
->
pQuery
,
info
->
currSTableMeta
);
if
(
tinfo
->
tableDataCtx
==
NULL
)
{
if
(
tinfo
->
tableDataCtx
==
NULL
)
{
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"smlInitTableDataCtx error"
,
NULL
);
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"smlInitTableDataCtx error"
,
NULL
);
smlDestroyTableInfo
(
info
,
tinfo
);
smlDestroyTableInfo
(
&
tinfo
);
return
TSDB_CODE_SML_INVALID_DATA
;
return
TSDB_CODE_SML_INVALID_DATA
;
}
}
}
}
...
@@ -1048,12 +1052,18 @@ static int32_t smlParseJSONExt(SSmlHandle *info, char *payload) {
...
@@ -1048,12 +1052,18 @@ static int32_t smlParseJSONExt(SSmlHandle *info, char *payload) {
return
TSDB_CODE_TSC_INVALID_JSON
;
return
TSDB_CODE_TSC_INVALID_JSON
;
}
}
info
->
lineNum
=
payloadNum
;
info
->
dataFormat
=
true
;
if
(
unlikely
(
info
->
lines
!=
NULL
))
{
if
(
unlikely
(
info
->
lines
!=
NULL
))
{
for
(
int
i
=
0
;
i
<
info
->
lineNum
;
i
++
)
{
taosArrayDestroyEx
(
info
->
lines
[
i
].
colArray
,
freeSSmlKv
);
if
(
info
->
lines
[
i
].
measureTagsLen
!=
0
)
taosMemoryFree
(
info
->
lines
[
i
].
measureTag
);
}
taosMemoryFree
(
info
->
lines
);
taosMemoryFree
(
info
->
lines
);
info
->
lines
=
NULL
;
info
->
lines
=
NULL
;
}
}
info
->
lineNum
=
payloadNum
;
info
->
dataFormat
=
true
;
ret
=
smlClearForRerun
(
info
);
ret
=
smlClearForRerun
(
info
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
return
ret
;
...
...
source/client/src/clientSmlLine.c
浏览文件 @
880359dd
...
@@ -168,6 +168,10 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin
...
@@ -168,6 +168,10 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
sMeta
=
smlBuildSTableMeta
(
info
->
dataFormat
);
sMeta
=
smlBuildSTableMeta
(
info
->
dataFormat
);
if
(
sMeta
==
NULL
){
taosMemoryFreeClear
(
pTableMeta
);
return
TSDB_CODE_OUT_OF_MEMORY
;
}
sMeta
->
tableMeta
=
pTableMeta
;
sMeta
->
tableMeta
=
pTableMeta
;
taosHashPut
(
info
->
superTables
,
currElement
->
measure
,
currElement
->
measureLen
,
&
sMeta
,
POINTER_BYTES
);
taosHashPut
(
info
->
superTables
,
currElement
->
measure
,
currElement
->
measureLen
,
&
sMeta
,
POINTER_BYTES
);
for
(
int
i
=
pTableMeta
->
tableInfo
.
numOfColumns
;
for
(
int
i
=
pTableMeta
->
tableInfo
.
numOfColumns
;
...
@@ -326,7 +330,7 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin
...
@@ -326,7 +330,7 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin
info
->
currSTableMeta
->
uid
=
tinfo
->
uid
;
info
->
currSTableMeta
->
uid
=
tinfo
->
uid
;
tinfo
->
tableDataCtx
=
smlInitTableDataCtx
(
info
->
pQuery
,
info
->
currSTableMeta
);
tinfo
->
tableDataCtx
=
smlInitTableDataCtx
(
info
->
pQuery
,
info
->
currSTableMeta
);
if
(
tinfo
->
tableDataCtx
==
NULL
)
{
if
(
tinfo
->
tableDataCtx
==
NULL
)
{
smlDestroyTableInfo
(
info
,
tinfo
);
smlDestroyTableInfo
(
&
tinfo
);
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"smlInitTableDataCtx error"
,
NULL
);
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"smlInitTableDataCtx error"
,
NULL
);
return
TSDB_CODE_SML_INVALID_DATA
;
return
TSDB_CODE_SML_INVALID_DATA
;
}
}
...
@@ -372,6 +376,10 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin
...
@@ -372,6 +376,10 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
*
tmp
=
smlBuildSTableMeta
(
info
->
dataFormat
);
*
tmp
=
smlBuildSTableMeta
(
info
->
dataFormat
);
if
(
*
tmp
==
NULL
){
taosMemoryFreeClear
(
pTableMeta
);
return
TSDB_CODE_OUT_OF_MEMORY
;
}
(
*
tmp
)
->
tableMeta
=
pTableMeta
;
(
*
tmp
)
->
tableMeta
=
pTableMeta
;
taosHashPut
(
info
->
superTables
,
currElement
->
measure
,
currElement
->
measureLen
,
tmp
,
POINTER_BYTES
);
taosHashPut
(
info
->
superTables
,
currElement
->
measure
,
currElement
->
measureLen
,
tmp
,
POINTER_BYTES
);
...
...
source/client/src/clientSmlTelnet.c
浏览文件 @
880359dd
...
@@ -91,6 +91,10 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS
...
@@ -91,6 +91,10 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
sMeta
=
smlBuildSTableMeta
(
info
->
dataFormat
);
sMeta
=
smlBuildSTableMeta
(
info
->
dataFormat
);
if
(
sMeta
==
NULL
){
taosMemoryFreeClear
(
pTableMeta
);
return
TSDB_CODE_OUT_OF_MEMORY
;
}
sMeta
->
tableMeta
=
pTableMeta
;
sMeta
->
tableMeta
=
pTableMeta
;
taosHashPut
(
info
->
superTables
,
elements
->
measure
,
elements
->
measureLen
,
&
sMeta
,
POINTER_BYTES
);
taosHashPut
(
info
->
superTables
,
elements
->
measure
,
elements
->
measureLen
,
&
sMeta
,
POINTER_BYTES
);
for
(
int
i
=
pTableMeta
->
tableInfo
.
numOfColumns
;
i
<
pTableMeta
->
tableInfo
.
numOfTags
+
pTableMeta
->
tableInfo
.
numOfColumns
;
i
++
){
for
(
int
i
=
pTableMeta
->
tableInfo
.
numOfColumns
;
i
<
pTableMeta
->
tableInfo
.
numOfTags
+
pTableMeta
->
tableInfo
.
numOfColumns
;
i
++
){
...
@@ -212,7 +216,7 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS
...
@@ -212,7 +216,7 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS
tinfo
->
tableDataCtx
=
smlInitTableDataCtx
(
info
->
pQuery
,
info
->
currSTableMeta
);
tinfo
->
tableDataCtx
=
smlInitTableDataCtx
(
info
->
pQuery
,
info
->
currSTableMeta
);
if
(
tinfo
->
tableDataCtx
==
NULL
)
{
if
(
tinfo
->
tableDataCtx
==
NULL
)
{
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"smlInitTableDataCtx error"
,
NULL
);
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"smlInitTableDataCtx error"
,
NULL
);
smlDestroyTableInfo
(
info
,
tinfo
);
smlDestroyTableInfo
(
&
tinfo
);
return
TSDB_CODE_SML_INVALID_DATA
;
return
TSDB_CODE_SML_INVALID_DATA
;
}
}
}
}
...
...
source/client/src/clientTmq.c
浏览文件 @
880359dd
...
@@ -27,6 +27,8 @@
...
@@ -27,6 +27,8 @@
#define EMPTY_BLOCK_POLL_IDLE_DURATION 10
#define EMPTY_BLOCK_POLL_IDLE_DURATION 10
#define DEFAULT_AUTO_COMMIT_INTERVAL 5000
#define DEFAULT_AUTO_COMMIT_INTERVAL 5000
#define OFFSET_IS_RESET_OFFSET(_of) ((_of) < 0)
typedef
void
(
*
__tmq_askep_fn_t
)(
tmq_t
*
pTmq
,
int32_t
code
,
SDataBuf
*
pBuf
,
void
*
pParam
);
typedef
void
(
*
__tmq_askep_fn_t
)(
tmq_t
*
pTmq
,
int32_t
code
,
SDataBuf
*
pBuf
,
void
*
pParam
);
struct
SMqMgmt
{
struct
SMqMgmt
{
...
@@ -2626,12 +2628,12 @@ int32_t tmq_offset_seek(tmq_t* tmq, const char* pTopicName, int32_t vgId, int64_
...
@@ -2626,12 +2628,12 @@ int32_t tmq_offset_seek(tmq_t* tmq, const char* pTopicName, int32_t vgId, int64_
SVgOffsetInfo
*
pOffsetInfo
=
&
pVg
->
offsetInfo
;
SVgOffsetInfo
*
pOffsetInfo
=
&
pVg
->
offsetInfo
;
int32_t
type
=
pOffsetInfo
->
currentOffset
.
type
;
int32_t
type
=
pOffsetInfo
->
currentOffset
.
type
;
if
(
type
!=
TMQ_OFFSET__LOG
)
{
if
(
type
!=
TMQ_OFFSET__LOG
&&
!
OFFSET_IS_RESET_OFFSET
(
type
)
)
{
tscError
(
"consumer:0x%"
PRIx64
" offset type:%d not wal version, seek not allowed"
,
tmq
->
consumerId
,
type
);
tscError
(
"consumer:0x%"
PRIx64
" offset type:%d not wal version, seek not allowed"
,
tmq
->
consumerId
,
type
);
return
TSDB_CODE_INVALID_PARA
;
return
TSDB_CODE_INVALID_PARA
;
}
}
if
(
offset
<
pOffsetInfo
->
walVerBegin
||
offset
>
pOffsetInfo
->
walVerEnd
)
{
if
(
type
==
TMQ_OFFSET__LOG
&&
(
offset
<
pOffsetInfo
->
walVerBegin
||
offset
>
pOffsetInfo
->
walVerEnd
)
)
{
tscError
(
"consumer:0x%"
PRIx64
" invalid seek params, offset:%"
PRId64
", valid range:[%"
PRId64
", %"
PRId64
"]"
,
tscError
(
"consumer:0x%"
PRIx64
" invalid seek params, offset:%"
PRId64
", valid range:[%"
PRId64
", %"
PRId64
"]"
,
tmq
->
consumerId
,
offset
,
pOffsetInfo
->
walVerBegin
,
pOffsetInfo
->
walVerEnd
);
tmq
->
consumerId
,
offset
,
pOffsetInfo
->
walVerBegin
,
pOffsetInfo
->
walVerEnd
);
return
TSDB_CODE_INVALID_PARA
;
return
TSDB_CODE_INVALID_PARA
;
...
...
source/client/test/clientTests.cpp
浏览文件 @
880359dd
...
@@ -1100,7 +1100,7 @@ TEST(clientCase, sub_tb_test) {
...
@@ -1100,7 +1100,7 @@ TEST(clientCase, sub_tb_test) {
// 创建订阅 topics 列表
// 创建订阅 topics 列表
tmq_list_t
*
topicList
=
tmq_list_new
();
tmq_list_t
*
topicList
=
tmq_list_new
();
tmq_list_append
(
topicList
,
"t
opic_t
1"
);
tmq_list_append
(
topicList
,
"t1"
);
// 启动订阅
// 启动订阅
tmq_subscribe
(
tmq
,
topicList
);
tmq_subscribe
(
tmq
,
topicList
);
...
@@ -1118,7 +1118,7 @@ TEST(clientCase, sub_tb_test) {
...
@@ -1118,7 +1118,7 @@ TEST(clientCase, sub_tb_test) {
tmq_topic_assignment
*
pAssign
=
NULL
;
tmq_topic_assignment
*
pAssign
=
NULL
;
int32_t
numOfAssign
=
0
;
int32_t
numOfAssign
=
0
;
int32_t
code
=
tmq_get_topic_assignment
(
tmq
,
"t
opic_t
1"
,
&
pAssign
,
&
numOfAssign
);
int32_t
code
=
tmq_get_topic_assignment
(
tmq
,
"t1"
,
&
pAssign
,
&
numOfAssign
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
printf
(
"error occurs:%s
\n
"
,
tmq_err2str
(
code
));
printf
(
"error occurs:%s
\n
"
,
tmq_err2str
(
code
));
tmq_consumer_close
(
tmq
);
tmq_consumer_close
(
tmq
);
...
@@ -1127,7 +1127,16 @@ TEST(clientCase, sub_tb_test) {
...
@@ -1127,7 +1127,16 @@ TEST(clientCase, sub_tb_test) {
return
;
return
;
}
}
tmq_offset_seek
(
tmq
,
"topic_t1"
,
pAssign
[
0
].
vgId
,
0
);
tmq_offset_seek
(
tmq
,
"t1"
,
pAssign
[
0
].
vgId
,
4
);
code
=
tmq_get_topic_assignment
(
tmq
,
"t1"
,
&
pAssign
,
&
numOfAssign
);
if
(
code
!=
0
)
{
printf
(
"error occurs:%s
\n
"
,
tmq_err2str
(
code
));
tmq_consumer_close
(
tmq
);
taos_close
(
pConn
);
fprintf
(
stderr
,
"%d msg consumed, include %d rows
\n
"
,
msgCnt
,
totalRows
);
return
;
}
while
(
1
)
{
while
(
1
)
{
TAOS_RES
*
pRes
=
tmq_consumer_poll
(
tmq
,
timeout
);
TAOS_RES
*
pRes
=
tmq_consumer_poll
(
tmq
,
timeout
);
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
880359dd
...
@@ -986,8 +986,15 @@ static int32_t mndProcessDropDnodeReq(SRpcMsg *pReq) {
...
@@ -986,8 +986,15 @@ static int32_t mndProcessDropDnodeReq(SRpcMsg *pReq) {
}
}
int32_t
numOfVnodes
=
mndGetVnodesNum
(
pMnode
,
pDnode
->
id
);
int32_t
numOfVnodes
=
mndGetVnodesNum
(
pMnode
,
pDnode
->
id
);
if
((
numOfVnodes
>
0
||
pMObj
!=
NULL
||
pSObj
!=
NULL
||
pQObj
!=
NULL
)
&&
!
force
)
{
if
(
numOfVnodes
>
0
||
pMObj
!=
NULL
||
pSObj
!=
NULL
||
pQObj
!=
NULL
)
{
if
(
!
mndIsDnodeOnline
(
pDnode
,
taosGetTimestampMs
()))
{
bool
isonline
=
mndIsDnodeOnline
(
pDnode
,
taosGetTimestampMs
());
if
(
isonline
&&
force
)
{
terrno
=
TSDB_CODE_DNODE_ONLY_USE_WHEN_OFFLINE
;
mError
(
"dnode:%d, failed to drop since %s, vnodes:%d mnode:%d qnode:%d snode:%d"
,
pDnode
->
id
,
terrstr
(),
numOfVnodes
,
pMObj
!=
NULL
,
pQObj
!=
NULL
,
pSObj
!=
NULL
);
goto
_OVER
;
}
if
(
!
isonline
&&
!
force
)
{
terrno
=
TSDB_CODE_DNODE_OFFLINE
;
terrno
=
TSDB_CODE_DNODE_OFFLINE
;
mError
(
"dnode:%d, failed to drop since %s, vnodes:%d mnode:%d qnode:%d snode:%d"
,
pDnode
->
id
,
terrstr
(),
mError
(
"dnode:%d, failed to drop since %s, vnodes:%d mnode:%d qnode:%d snode:%d"
,
pDnode
->
id
,
terrstr
(),
numOfVnodes
,
pMObj
!=
NULL
,
pQObj
!=
NULL
,
pSObj
!=
NULL
);
numOfVnodes
,
pMObj
!=
NULL
,
pQObj
!=
NULL
,
pSObj
!=
NULL
);
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
880359dd
...
@@ -510,8 +510,6 @@ int32_t tqProcessVgWalInfoReq(STQ* pTq, SRpcMsg* pMsg) {
...
@@ -510,8 +510,6 @@ int32_t tqProcessVgWalInfoReq(STQ* pTq, SRpcMsg* pMsg) {
int64_t
sver
=
0
,
ever
=
0
;
int64_t
sver
=
0
,
ever
=
0
;
walReaderValidVersionRange
(
pHandle
->
execHandle
.
pTqReader
->
pWalReader
,
&
sver
,
&
ever
);
walReaderValidVersionRange
(
pHandle
->
execHandle
.
pTqReader
->
pWalReader
,
&
sver
,
&
ever
);
int64_t
currentVer
=
walReaderGetCurrentVer
(
pHandle
->
execHandle
.
pTqReader
->
pWalReader
);
SMqDataRsp
dataRsp
=
{
0
};
SMqDataRsp
dataRsp
=
{
0
};
tqInitDataRsp
(
&
dataRsp
,
&
req
);
tqInitDataRsp
(
&
dataRsp
,
&
req
);
...
@@ -537,7 +535,12 @@ int32_t tqProcessVgWalInfoReq(STQ* pTq, SRpcMsg* pMsg) {
...
@@ -537,7 +535,12 @@ int32_t tqProcessVgWalInfoReq(STQ* pTq, SRpcMsg* pMsg) {
dataRsp
.
rspOffset
.
type
=
TMQ_OFFSET__LOG
;
dataRsp
.
rspOffset
.
type
=
TMQ_OFFSET__LOG
;
if
(
reqOffset
.
type
==
TMQ_OFFSET__LOG
)
{
if
(
reqOffset
.
type
==
TMQ_OFFSET__LOG
)
{
int64_t
currentVer
=
walReaderGetCurrentVer
(
pHandle
->
execHandle
.
pTqReader
->
pWalReader
);
if
(
currentVer
==
-
1
)
{
// not start to read data from wal yet, return req offset directly
dataRsp
.
rspOffset
.
version
=
reqOffset
.
version
;
}
else
{
dataRsp
.
rspOffset
.
version
=
currentVer
;
// return current consume offset value
dataRsp
.
rspOffset
.
version
=
currentVer
;
// return current consume offset value
}
}
else
if
(
reqOffset
.
type
==
TMQ_OFFSET__RESET_EARLIEAST
)
{
}
else
if
(
reqOffset
.
type
==
TMQ_OFFSET__RESET_EARLIEAST
)
{
dataRsp
.
rspOffset
.
version
=
sver
;
// not consume yet, set the earliest position
dataRsp
.
rspOffset
.
version
=
sver
;
// not consume yet, set the earliest position
}
else
if
(
reqOffset
.
type
==
TMQ_OFFSET__RESET_LATEST
)
{
}
else
if
(
reqOffset
.
type
==
TMQ_OFFSET__RESET_LATEST
)
{
...
@@ -1085,6 +1088,7 @@ int32_t tqProcessTaskRecover2Req(STQ* pTq, int64_t sversion, char* msg, int32_t
...
@@ -1085,6 +1088,7 @@ int32_t tqProcessTaskRecover2Req(STQ* pTq, int64_t sversion, char* msg, int32_t
qDebug
(
"s-task:%s set the start wal offset to be:%"
PRId64
,
pTask
->
id
.
idStr
,
sversion
);
qDebug
(
"s-task:%s set the start wal offset to be:%"
PRId64
,
pTask
->
id
.
idStr
,
sversion
);
walReaderSeekVer
(
pTask
->
exec
.
pWalReader
,
sversion
);
walReaderSeekVer
(
pTask
->
exec
.
pWalReader
,
sversion
);
pTask
->
chkInfo
.
currentVer
=
sversion
;
if
(
atomic_load_8
(
&
pTask
->
status
.
taskStatus
)
==
TASK_STATUS__DROPPING
)
{
if
(
atomic_load_8
(
&
pTask
->
status
.
taskStatus
)
==
TASK_STATUS__DROPPING
)
{
streamMetaReleaseTask
(
pTq
->
pStreamMeta
,
pTask
);
streamMetaReleaseTask
(
pTq
->
pStreamMeta
,
pTask
);
...
@@ -1280,6 +1284,8 @@ int32_t tqProcessTaskDispatchRsp(STQ* pTq, SRpcMsg* pMsg) {
...
@@ -1280,6 +1284,8 @@ int32_t tqProcessTaskDispatchRsp(STQ* pTq, SRpcMsg* pMsg) {
int32_t
tqProcessTaskDropReq
(
STQ
*
pTq
,
int64_t
sversion
,
char
*
msg
,
int32_t
msgLen
)
{
int32_t
tqProcessTaskDropReq
(
STQ
*
pTq
,
int64_t
sversion
,
char
*
msg
,
int32_t
msgLen
)
{
SVDropStreamTaskReq
*
pReq
=
(
SVDropStreamTaskReq
*
)
msg
;
SVDropStreamTaskReq
*
pReq
=
(
SVDropStreamTaskReq
*
)
msg
;
tqDebug
(
"vgId:%d receive msg to drop stream task:0x%x"
,
TD_VID
(
pTq
->
pVnode
),
pReq
->
taskId
);
streamMetaRemoveTask
(
pTq
->
pStreamMeta
,
pReq
->
taskId
);
streamMetaRemoveTask
(
pTq
->
pStreamMeta
,
pReq
->
taskId
);
return
0
;
return
0
;
}
}
...
...
source/dnode/vnode/src/tsdb/tsdbCache.c
浏览文件 @
880359dd
...
@@ -703,6 +703,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
...
@@ -703,6 +703,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
*
pTmpLastCol
=
*
pLastCol
;
*
pTmpLastCol
=
*
pLastCol
;
pLastCol
=
pTmpLastCol
;
pLastCol
=
pTmpLastCol
;
reallocVarData
(
&
pLastCol
->
colVal
);
size_t
charge
=
sizeof
(
*
pLastCol
);
size_t
charge
=
sizeof
(
*
pLastCol
);
if
(
IS_VAR_DATA_TYPE
(
pLastCol
->
colVal
.
type
))
{
if
(
IS_VAR_DATA_TYPE
(
pLastCol
->
colVal
.
type
))
{
charge
+=
pLastCol
->
colVal
.
value
.
nData
;
charge
+=
pLastCol
->
colVal
.
value
.
nData
;
...
@@ -789,7 +790,9 @@ static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastA
...
@@ -789,7 +790,9 @@ static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastA
code
=
-
1
;
code
=
-
1
;
}
}
taosArraySet
(
pLastArray
,
idxKey
->
idx
,
pLastCol
);
SLastCol
lastCol
=
*
pLastCol
;
reallocVarData
(
&
lastCol
.
colVal
);
taosArraySet
(
pLastArray
,
idxKey
->
idx
,
&
lastCol
);
taosArrayRemove
(
remainCols
,
j
);
taosArrayRemove
(
remainCols
,
j
);
taosMemoryFree
(
values_list
[
i
]);
taosMemoryFree
(
values_list
[
i
]);
...
@@ -825,7 +828,7 @@ int32_t tsdbCacheGetBatch(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCache
...
@@ -825,7 +828,7 @@ int32_t tsdbCacheGetBatch(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCache
SLastCol
*
pLastCol
=
(
SLastCol
*
)
taosLRUCacheValue
(
pCache
,
h
);
SLastCol
*
pLastCol
=
(
SLastCol
*
)
taosLRUCacheValue
(
pCache
,
h
);
SLastCol
lastCol
=
*
pLastCol
;
SLastCol
lastCol
=
*
pLastCol
;
//
reallocVarData(&lastCol.colVal);
reallocVarData
(
&
lastCol
.
colVal
);
taosArrayPush
(
pLastArray
,
&
lastCol
);
taosArrayPush
(
pLastArray
,
&
lastCol
);
if
(
h
)
{
if
(
h
)
{
...
@@ -853,8 +856,8 @@ int32_t tsdbCacheGetBatch(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCache
...
@@ -853,8 +856,8 @@ int32_t tsdbCacheGetBatch(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCache
SLastCol
lastCol
=
*
pLastCol
;
SLastCol
lastCol
=
*
pLastCol
;
reallocVarData
(
&
lastCol
.
colVal
);
reallocVarData
(
&
lastCol
.
colVal
);
taosArraySet
(
pLastArray
,
idxKey
->
idx
,
&
lastCol
);
taosArraySet
(
pLastArray
,
idxKey
->
idx
,
&
lastCol
);
if
(
h
)
{
if
(
h
)
{
taosLRUCacheRelease
(
pCache
,
h
,
false
);
taosLRUCacheRelease
(
pCache
,
h
,
false
);
}
}
...
@@ -940,10 +943,10 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE
...
@@ -940,10 +943,10 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE
int
num_keys
=
pTSchema
->
numOfCols
;
int
num_keys
=
pTSchema
->
numOfCols
;
char
**
keys_list
=
taosMemoryCalloc
(
num_keys
*
2
,
sizeof
(
char
*
));
char
**
keys_list
=
taosMemoryCalloc
(
num_keys
*
2
,
sizeof
(
char
*
));
size_t
*
keys_list_sizes
=
taosMemoryCalloc
(
num_keys
*
2
,
sizeof
(
size_t
));
size_t
*
keys_list_sizes
=
taosMemoryCalloc
(
num_keys
*
2
,
sizeof
(
size_t
));
const
size_t
klen
=
ROCKS_KEY_LEN
;
for
(
int
i
=
0
;
i
<
num_keys
;
++
i
)
{
for
(
int
i
=
0
;
i
<
num_keys
;
++
i
)
{
int16_t
cid
=
pTSchema
->
columns
[
i
].
colId
;
int16_t
cid
=
pTSchema
->
columns
[
i
].
colId
;
size_t
klen
=
ROCKS_KEY_LEN
;
char
*
keys
=
taosMemoryCalloc
(
2
,
sizeof
(
SLastKey
));
char
*
keys
=
taosMemoryCalloc
(
2
,
sizeof
(
SLastKey
));
((
SLastKey
*
)
keys
)[
0
]
=
(
SLastKey
){.
ltype
=
1
,
.
uid
=
uid
,
.
cid
=
cid
};
((
SLastKey
*
)
keys
)[
0
]
=
(
SLastKey
){.
ltype
=
1
,
.
uid
=
uid
,
.
cid
=
cid
};
((
SLastKey
*
)
keys
)[
1
]
=
(
SLastKey
){.
ltype
=
0
,
.
uid
=
uid
,
.
cid
=
cid
};
((
SLastKey
*
)
keys
)[
1
]
=
(
SLastKey
){.
ltype
=
0
,
.
uid
=
uid
,
.
cid
=
cid
};
...
@@ -960,39 +963,35 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE
...
@@ -960,39 +963,35 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE
rocksMayWrite
(
pTsdb
,
true
,
false
,
false
);
rocksMayWrite
(
pTsdb
,
true
,
false
,
false
);
rocksdb_multi_get
(
pTsdb
->
rCache
.
db
,
pTsdb
->
rCache
.
readoptions
,
num_keys
*
2
,
(
const
char
*
const
*
)
keys_list
,
rocksdb_multi_get
(
pTsdb
->
rCache
.
db
,
pTsdb
->
rCache
.
readoptions
,
num_keys
*
2
,
(
const
char
*
const
*
)
keys_list
,
keys_list_sizes
,
values_list
,
values_list_sizes
,
errs
);
keys_list_sizes
,
values_list
,
values_list_sizes
,
errs
);
for
(
int
i
=
0
;
i
<
num_keys
;
++
i
)
{
taosMemoryFree
(
keys_list
[
i
]);
}
for
(
int
i
=
0
;
i
<
num_keys
*
2
;
++
i
)
{
for
(
int
i
=
0
;
i
<
num_keys
*
2
;
++
i
)
{
if
(
errs
[
i
])
{
rocksdb_free
(
errs
[
i
]);
rocksdb_free
(
errs
[
i
]);
}
}
taosMemoryFree
(
keys_list
);
}
taosMemoryFree
(
keys_list_sizes
);
taosMemoryFree
(
errs
);
taosMemoryFree
(
errs
);
rocksdb_writebatch_t
*
wb
=
pTsdb
->
rCache
.
writebatch
;
rocksdb_writebatch_t
*
wb
=
pTsdb
->
rCache
.
writebatch
;
for
(
int
i
=
0
;
i
<
num_keys
;
++
i
)
{
for
(
int
i
=
0
;
i
<
num_keys
;
++
i
)
{
SLastCol
*
pLastCol
=
tsdbCacheDeserialize
(
values_list
[
i
]);
SLastCol
*
pLastCol
=
tsdbCacheDeserialize
(
values_list
[
i
]);
if
(
NULL
!=
pLastCol
&&
(
pLastCol
->
ts
<=
eKey
&&
pLastCol
->
ts
>=
sKey
))
{
if
(
NULL
!=
pLastCol
&&
(
pLastCol
->
ts
<=
eKey
&&
pLastCol
->
ts
>=
sKey
))
{
SLastKey
*
key
=
&
(
SLastKey
){.
ltype
=
1
,
.
uid
=
uid
,
.
cid
=
pLastCol
->
colVal
.
cid
};
rocksdb_writebatch_delete
(
wb
,
keys_list
[
i
],
klen
);
size_t
klen
=
ROCKS_KEY_LEN
;
rocksdb_writebatch_delete
(
wb
,
(
char
*
)
key
,
klen
);
taosLRUCacheErase
(
pTsdb
->
lruCache
,
key
,
klen
);
}
}
taosLRUCacheErase
(
pTsdb
->
lruCache
,
keys_list
[
i
],
klen
);
pLastCol
=
tsdbCacheDeserialize
(
values_list
[
i
+
num_keys
]);
pLastCol
=
tsdbCacheDeserialize
(
values_list
[
i
+
num_keys
]);
if
(
NULL
!=
pLastCol
&&
(
pLastCol
->
ts
<=
eKey
&&
pLastCol
->
ts
>=
sKey
))
{
if
(
NULL
!=
pLastCol
&&
(
pLastCol
->
ts
<=
eKey
&&
pLastCol
->
ts
>=
sKey
))
{
SLastKey
*
key
=
&
(
SLastKey
){.
ltype
=
0
,
.
uid
=
uid
,
.
cid
=
pLastCol
->
colVal
.
cid
};
rocksdb_writebatch_delete
(
wb
,
keys_list
[
num_keys
+
i
],
klen
);
size_t
klen
=
ROCKS_KEY_LEN
;
rocksdb_writebatch_delete
(
wb
,
(
char
*
)
key
,
klen
);
taosLRUCacheErase
(
pTsdb
->
lruCache
,
key
,
klen
);
}
}
taosLRUCacheErase
(
pTsdb
->
lruCache
,
keys_list
[
num_keys
+
i
],
klen
);
rocksdb_free
(
values_list
[
i
]);
rocksdb_free
(
values_list
[
i
]);
rocksdb_free
(
values_list
[
i
+
num_keys
]);
rocksdb_free
(
values_list
[
i
+
num_keys
]);
}
}
for
(
int
i
=
0
;
i
<
num_keys
;
++
i
)
{
taosMemoryFree
(
keys_list
[
i
]);
}
taosMemoryFree
(
keys_list
);
taosMemoryFree
(
keys_list_sizes
);
taosMemoryFree
(
values_list
);
taosMemoryFree
(
values_list
);
taosMemoryFree
(
values_list_sizes
);
taosMemoryFree
(
values_list_sizes
);
...
@@ -1871,10 +1870,14 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
...
@@ -1871,10 +1870,14 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
if
(
isLast
&&
(
pColData
->
flag
&
HAS_VALUE
))
{
if
(
isLast
&&
(
pColData
->
flag
&
HAS_VALUE
))
{
skipBlock
=
false
;
skipBlock
=
false
;
break
;
break
;
}
else
if
(
pColData
->
flag
&
(
HAS_VALUE
|
HAS_NULL
))
{
}
/*
else if (pColData->flag & (HAS_VALUE | HAS_NULL)) {
skipBlock = false;
skipBlock = false;
break;
break;
}*/
}
}
if
(
!
isLast
)
{
skipBlock
=
false
;
}
}
if
(
skipBlock
)
{
if
(
skipBlock
)
{
...
@@ -1908,6 +1911,9 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
...
@@ -1908,6 +1911,9 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
if
(
checkRemainingRow
)
{
if
(
checkRemainingRow
)
{
bool
skipBlock
=
true
;
bool
skipBlock
=
true
;
int
inputColIndex
=
0
;
int
inputColIndex
=
0
;
if
(
aCols
[
0
]
==
PRIMARYKEY_TIMESTAMP_COL_ID
)
{
++
inputColIndex
;
}
for
(
int
colIndex
=
0
;
colIndex
<
state
->
pBlockData
->
nColData
;
++
colIndex
)
{
for
(
int
colIndex
=
0
;
colIndex
<
state
->
pBlockData
->
nColData
;
++
colIndex
)
{
SColData
*
pColData
=
&
state
->
pBlockData
->
aColData
[
colIndex
];
SColData
*
pColData
=
&
state
->
pBlockData
->
aColData
[
colIndex
];
int16_t
cid
=
pColData
->
cid
;
int16_t
cid
=
pColData
->
cid
;
...
@@ -1916,15 +1922,19 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
...
@@ -1916,15 +1922,19 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
if
(
isLast
&&
(
pColData
->
flag
&
HAS_VALUE
))
{
if
(
isLast
&&
(
pColData
->
flag
&
HAS_VALUE
))
{
skipBlock
=
false
;
skipBlock
=
false
;
break
;
break
;
}
else
if
(
pColData
->
flag
&
(
HAS_VALUE
|
HAS_NULL
))
{
}
/*
else if (pColData->flag & (HAS_VALUE | HAS_NULL)) {
skipBlock = false;
skipBlock = false;
break;
break;
}
}*/
++
inputColIndex
;
++
inputColIndex
;
}
}
}
}
if
(
!
isLast
)
{
skipBlock
=
false
;
}
if
(
skipBlock
)
{
if
(
skipBlock
)
{
if
(
--
state
->
iBlock
<
0
)
{
if
(
--
state
->
iBlock
<
0
)
{
tsdbDataFReaderClose
(
state
->
pDataFReader
);
tsdbDataFReaderClose
(
state
->
pDataFReader
);
...
@@ -2145,10 +2155,15 @@ static bool tsdbKeyDeleted(TSDBKEY *key, SArray *pSkyline, int64_t *iSkyline) {
...
@@ -2145,10 +2155,15 @@ static bool tsdbKeyDeleted(TSDBKEY *key, SArray *pSkyline, int64_t *iSkyline) {
return
false
;
return
false
;
}
else
if
(
key
->
ts
>=
pItemFront
->
ts
&&
key
->
ts
<=
pItemBack
->
ts
)
{
}
else
if
(
key
->
ts
>=
pItemFront
->
ts
&&
key
->
ts
<=
pItemBack
->
ts
)
{
if
(
key
->
version
<=
pItemFront
->
version
||
(
key
->
ts
==
pItemBack
->
ts
&&
key
->
version
<=
pItemBack
->
version
))
{
if
(
key
->
version
<=
pItemFront
->
version
||
(
key
->
ts
==
pItemBack
->
ts
&&
key
->
version
<=
pItemBack
->
version
))
{
// if (key->version <= pItemFront->version || key->version <= pItemBack->version) {
return
true
;
return
true
;
}
else
{
if
(
*
iSkyline
>
1
)
{
--*
iSkyline
;
}
else
{
}
else
{
return
false
;
return
false
;
}
}
}
}
else
{
}
else
{
if
(
*
iSkyline
>
1
)
{
if
(
*
iSkyline
>
1
)
{
--*
iSkyline
;
--*
iSkyline
;
...
@@ -2959,7 +2974,7 @@ static int32_t mergeLastRowCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray,
...
@@ -2959,7 +2974,7 @@ static int32_t mergeLastRowCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray,
do
{
do
{
TSDBROW
*
pRow
=
NULL
;
TSDBROW
*
pRow
=
NULL
;
nextRowIterGet
(
&
iter
,
&
pRow
,
&
ignoreEarlierTs
,
tru
e
,
TARRAY_DATA
(
aColArray
),
TARRAY_SIZE
(
aColArray
));
nextRowIterGet
(
&
iter
,
&
pRow
,
&
ignoreEarlierTs
,
fals
e
,
TARRAY_DATA
(
aColArray
),
TARRAY_SIZE
(
aColArray
));
if
(
!
pRow
)
{
if
(
!
pRow
)
{
break
;
break
;
...
...
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
浏览文件 @
880359dd
...
@@ -315,14 +315,14 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
...
@@ -315,14 +315,14 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
tsdbCacheGetBatch
(
pr
->
pTsdb
,
pKeyInfo
->
uid
,
pRow
,
pr
,
ltype
);
tsdbCacheGetBatch
(
pr
->
pTsdb
,
pKeyInfo
->
uid
,
pRow
,
pr
,
ltype
);
// tsdbCacheGet(pr->pTsdb, pKeyInfo->uid, pRow, pr, ltype);
// tsdbCacheGet(pr->pTsdb, pKeyInfo->uid, pRow, pr, ltype);
if
(
TARRAY_SIZE
(
pRow
)
<=
0
)
{
if
(
TARRAY_SIZE
(
pRow
)
<=
0
)
{
//
taosArrayClearEx(pRow, freeItem);
taosArrayClearEx
(
pRow
,
freeItem
);
taosArrayClear
(
pRow
);
//
taosArrayClear(pRow);
continue
;
continue
;
}
}
SLastCol
*
pColVal
=
taosArrayGet
(
pRow
,
0
);
SLastCol
*
pColVal
=
taosArrayGet
(
pRow
,
0
);
if
(
COL_VAL_IS_NONE
(
&
pColVal
->
colVal
))
{
if
(
COL_VAL_IS_NONE
(
&
pColVal
->
colVal
))
{
//
taosArrayClearEx(pRow, freeItem);
taosArrayClearEx
(
pRow
,
freeItem
);
taosArrayClear
(
pRow
);
//
taosArrayClear(pRow);
continue
;
continue
;
}
}
...
@@ -381,8 +381,8 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
...
@@ -381,8 +381,8 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
}
}
}
}
//
taosArrayClearEx(pRow, freeItem);
taosArrayClearEx
(
pRow
,
freeItem
);
taosArrayClear
(
pRow
);
//
taosArrayClear(pRow);
}
}
if
(
hasRes
)
{
if
(
hasRes
)
{
...
@@ -394,20 +394,20 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
...
@@ -394,20 +394,20 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
tsdbCacheGetBatch
(
pr
->
pTsdb
,
uid
,
pRow
,
pr
,
ltype
);
tsdbCacheGetBatch
(
pr
->
pTsdb
,
uid
,
pRow
,
pr
,
ltype
);
if
(
TARRAY_SIZE
(
pRow
)
<=
0
)
{
if
(
TARRAY_SIZE
(
pRow
)
<=
0
)
{
//
taosArrayClearEx(pRow, freeItem);
taosArrayClearEx
(
pRow
,
freeItem
);
taosArrayClear
(
pRow
);
//
taosArrayClear(pRow);
continue
;
continue
;
}
}
SLastCol
*
pColVal
=
(
SLastCol
*
)
taosArrayGet
(
pRow
,
0
);
SLastCol
*
pColVal
=
(
SLastCol
*
)
taosArrayGet
(
pRow
,
0
);
if
(
COL_VAL_IS_NONE
(
&
pColVal
->
colVal
))
{
if
(
COL_VAL_IS_NONE
(
&
pColVal
->
colVal
))
{
//
taosArrayClearEx(pRow, freeItem);
taosArrayClearEx
(
pRow
,
freeItem
);
taosArrayClear
(
pRow
);
//
taosArrayClear(pRow);
continue
;
continue
;
}
}
saveOneRow
(
pRow
,
pResBlock
,
pr
,
slotIds
,
dstSlotIds
,
pRes
,
pr
->
idstr
);
saveOneRow
(
pRow
,
pResBlock
,
pr
,
slotIds
,
dstSlotIds
,
pRes
,
pr
->
idstr
);
//
taosArrayClearEx(pRow, freeItem);
taosArrayClearEx
(
pRow
,
freeItem
);
taosArrayClear
(
pRow
);
//
taosArrayClear(pRow);
taosArrayPush
(
pTableUidList
,
&
uid
);
taosArrayPush
(
pTableUidList
,
&
uid
);
...
...
source/dnode/vnode/src/tsdb/tsdbMemTable.c
浏览文件 @
880359dd
...
@@ -190,9 +190,9 @@ int32_t tsdbDeleteTableData(STsdb *pTsdb, int64_t version, tb_uid_t suid, tb_uid
...
@@ -190,9 +190,9 @@ int32_t tsdbDeleteTableData(STsdb *pTsdb, int64_t version, tb_uid_t suid, tb_uid
tsdbCacheDeleteLast(pTsdb->lruCache, pTbData->uid, eKey);
tsdbCacheDeleteLast(pTsdb->lruCache, pTbData->uid, eKey);
}
}
*/
*/
if
(
eKey
>=
pTbData
->
maxKey
&&
sKey
<=
pTbData
->
maxKey
)
{
//
if (eKey >= pTbData->maxKey && sKey <= pTbData->maxKey) {
tsdbCacheDel
(
pTsdb
,
suid
,
uid
,
sKey
,
eKey
);
tsdbCacheDel
(
pTsdb
,
suid
,
uid
,
sKey
,
eKey
);
}
//
}
tsdbTrace
(
"vgId:%d, delete data from table suid:%"
PRId64
" uid:%"
PRId64
" skey:%"
PRId64
" eKey:%"
PRId64
tsdbTrace
(
"vgId:%d, delete data from table suid:%"
PRId64
" uid:%"
PRId64
" skey:%"
PRId64
" eKey:%"
PRId64
" at version %"
PRId64
,
" at version %"
PRId64
,
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
880359dd
...
@@ -1848,7 +1848,7 @@ static bool isCleanFileDataBlock(STsdbReader* pReader, SFileDataBlockInfo* pBloc
...
@@ -1848,7 +1848,7 @@ static bool isCleanFileDataBlock(STsdbReader* pReader, SFileDataBlockInfo* pBloc
SDataBlockToLoadInfo
info
=
{
0
};
SDataBlockToLoadInfo
info
=
{
0
};
getBlockToLoadInfo
(
&
info
,
pBlockInfo
,
pBlock
,
pScanInfo
,
keyInBuf
,
pLastBlockReader
,
pReader
);
getBlockToLoadInfo
(
&
info
,
pBlockInfo
,
pBlock
,
pScanInfo
,
keyInBuf
,
pLastBlockReader
,
pReader
);
bool
isCleanFileBlock
=
!
(
info
.
overlapWithNeighborBlock
||
info
.
hasDupTs
||
info
.
overlapWithKeyInBuf
||
bool
isCleanFileBlock
=
!
(
info
.
overlapWithNeighborBlock
||
info
.
hasDupTs
||
info
.
overlapWithKeyInBuf
||
info
.
overlapWithDelInfo
||
info
.
overlapWithLastBlock
);
info
.
overlapWithDelInfo
||
info
.
overlapWithLastBlock
||
info
.
partiallyRequired
);
return
isCleanFileBlock
;
return
isCleanFileBlock
;
}
}
...
@@ -3440,6 +3440,7 @@ static int32_t buildBlockFromBufferSequentially(STsdbReader* pReader) {
...
@@ -3440,6 +3440,7 @@ static int32_t buildBlockFromBufferSequentially(STsdbReader* pReader) {
if
(
!
hasNexTable
)
{
if
(
!
hasNexTable
)
{
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
pBlockScanInfo
=
pStatus
->
pTableIter
;
}
}
initMemDataIterator
(
*
pBlockScanInfo
,
pReader
);
initMemDataIterator
(
*
pBlockScanInfo
,
pReader
);
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
880359dd
...
@@ -8008,6 +8008,9 @@ static int32_t buildKVRowForAllTags(STranslateContext* pCxt, SCreateSubTableClau
...
@@ -8008,6 +8008,9 @@ static int32_t buildKVRowForAllTags(STranslateContext* pCxt, SCreateSubTableClau
if
(
pTagSchema
->
type
==
TSDB_DATA_TYPE_JSON
)
{
if
(
pTagSchema
->
type
==
TSDB_DATA_TYPE_JSON
)
{
isJson
=
true
;
isJson
=
true
;
code
=
buildJsonTagVal
(
pCxt
,
pTagSchema
,
pVal
,
pTagArray
,
ppTag
);
code
=
buildJsonTagVal
(
pCxt
,
pTagSchema
,
pVal
,
pTagArray
,
ppTag
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
nodesDestroyNode
((
SNode
*
)
pVal
);
}
taosArrayPush
(
tagName
,
pTagSchema
->
name
);
taosArrayPush
(
tagName
,
pTagSchema
->
name
);
}
else
if
(
pVal
->
node
.
resType
.
type
!=
TSDB_DATA_TYPE_NULL
&&
!
pVal
->
isNull
)
{
}
else
if
(
pVal
->
node
.
resType
.
type
!=
TSDB_DATA_TYPE_NULL
&&
!
pVal
->
isNull
)
{
char
*
tmpVal
=
nodesGetValueFromNode
(
pVal
);
char
*
tmpVal
=
nodesGetValueFromNode
(
pVal
);
...
@@ -8328,13 +8331,7 @@ static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pS
...
@@ -8328,13 +8331,7 @@ static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pS
SArray
*
pTagVals
=
taosArrayInit
(
1
,
sizeof
(
STagVal
));
SArray
*
pTagVals
=
taosArrayInit
(
1
,
sizeof
(
STagVal
));
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
STag
*
pTag
=
NULL
;
STag
*
pTag
=
NULL
;
do
{
code
=
parseJsontoTagData
(
pStmt
->
pVal
->
literal
,
pTagVals
,
&
pTag
,
&
pCxt
->
msgBuf
);
code
=
parseJsontoTagData
(
pStmt
->
pVal
->
literal
,
pTagVals
,
&
pTag
,
&
pCxt
->
msgBuf
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
break
;
}
}
while
(
0
);
taosArrayDestroy
(
pTagVals
);
taosArrayDestroy
(
pTagVals
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
return
code
;
...
...
source/libs/parser/src/parUtil.c
浏览文件 @
880359dd
...
@@ -416,7 +416,7 @@ int32_t parseJsontoTagData(const char* json, SArray* pTagVals, STag** ppTag, voi
...
@@ -416,7 +416,7 @@ int32_t parseJsontoTagData(const char* json, SArray* pTagVals, STag** ppTag, voi
end:
end:
taosHashCleanup
(
keyHash
);
taosHashCleanup
(
keyHash
);
if
(
retCode
==
TSDB_CODE_SUCCESS
)
{
if
(
retCode
==
TSDB_CODE_SUCCESS
)
{
tTagNew
(
pTagVals
,
1
,
true
,
ppTag
);
retCode
=
tTagNew
(
pTagVals
,
1
,
true
,
ppTag
);
}
}
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
pTagVals
);
++
i
)
{
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
pTagVals
);
++
i
)
{
STagVal
*
p
=
(
STagVal
*
)
taosArrayGet
(
pTagVals
,
i
);
STagVal
*
p
=
(
STagVal
*
)
taosArrayGet
(
pTagVals
,
i
);
...
...
source/libs/stream/src/streamExec.c
浏览文件 @
880359dd
...
@@ -327,8 +327,12 @@ int32_t streamExecForAll(SStreamTask* pTask) {
...
@@ -327,8 +327,12 @@ int32_t streamExecForAll(SStreamTask* pTask) {
while
(
1
)
{
while
(
1
)
{
if
(
streamTaskShouldPause
(
&
pTask
->
status
))
{
if
(
streamTaskShouldPause
(
&
pTask
->
status
))
{
if
(
batchSize
>
1
)
{
break
;
}
else
{
return
0
;
return
0
;
}
}
}
SStreamQueueItem
*
qItem
=
streamQueueNextItem
(
pTask
->
inputQueue
);
SStreamQueueItem
*
qItem
=
streamQueueNextItem
(
pTask
->
inputQueue
);
if
(
qItem
==
NULL
)
{
if
(
qItem
==
NULL
)
{
...
...
source/libs/stream/src/streamMeta.c
浏览文件 @
880359dd
...
@@ -268,12 +268,14 @@ void streamMetaRemoveTask(SStreamMeta* pMeta, int32_t taskId) {
...
@@ -268,12 +268,14 @@ void streamMetaRemoveTask(SStreamMeta* pMeta, int32_t taskId) {
SStreamTask
**
ppTask
=
(
SStreamTask
**
)
taosHashGet
(
pMeta
->
pTasks
,
&
taskId
,
sizeof
(
int32_t
));
SStreamTask
**
ppTask
=
(
SStreamTask
**
)
taosHashGet
(
pMeta
->
pTasks
,
&
taskId
,
sizeof
(
int32_t
));
if
(
ppTask
)
{
if
(
ppTask
)
{
SStreamTask
*
pTask
=
*
ppTask
;
SStreamTask
*
pTask
=
*
ppTask
;
taosHashRemove
(
pMeta
->
pTasks
,
&
taskId
,
sizeof
(
int32_t
));
taosHashRemove
(
pMeta
->
pTasks
,
&
taskId
,
sizeof
(
int32_t
));
tdbTbDelete
(
pMeta
->
pTaskDb
,
&
taskId
,
sizeof
(
int32_t
),
pMeta
->
txn
);
tdbTbDelete
(
pMeta
->
pTaskDb
,
&
taskId
,
sizeof
(
int32_t
),
pMeta
->
txn
);
atomic_store_8
(
&
pTask
->
status
.
taskStatus
,
TASK_STATUS__DROPPING
);
atomic_store_8
(
&
pTask
->
status
.
taskStatus
,
TASK_STATUS__DROPPING
);
int32_t
num
=
taosArrayGetSize
(
pMeta
->
pTaskList
);
int32_t
num
=
taosArrayGetSize
(
pMeta
->
pTaskList
);
qDebug
(
"s-task:%s set the drop task flag, remain running s-task:%d"
,
pTask
->
id
.
idStr
,
num
-
1
);
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
int32_t
*
pTaskId
=
taosArrayGet
(
pMeta
->
pTaskList
,
i
);
int32_t
*
pTaskId
=
taosArrayGet
(
pMeta
->
pTaskList
,
i
);
if
(
*
pTaskId
==
taskId
)
{
if
(
*
pTaskId
==
taskId
)
{
...
@@ -283,6 +285,8 @@ void streamMetaRemoveTask(SStreamMeta* pMeta, int32_t taskId) {
...
@@ -283,6 +285,8 @@ void streamMetaRemoveTask(SStreamMeta* pMeta, int32_t taskId) {
}
}
streamMetaReleaseTask
(
pMeta
,
pTask
);
streamMetaReleaseTask
(
pMeta
,
pTask
);
}
else
{
qDebug
(
"vgId:%d failed to find the task:0x%x, it may be dropped already"
,
pMeta
->
vgId
,
taskId
);
}
}
taosWUnLockLatch
(
&
pMeta
->
lock
);
taosWUnLockLatch
(
&
pMeta
->
lock
);
...
...
source/util/src/terror.c
浏览文件 @
880359dd
...
@@ -325,6 +325,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MNODE_NOT_CATCH_UP, "Mnode didn't catch th
...
@@ -325,6 +325,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MNODE_NOT_CATCH_UP, "Mnode didn't catch th
TAOS_DEFINE_ERROR
(
TSDB_CODE_MNODE_ALREADY_IS_VOTER
,
"Mnode already is a leader"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MNODE_ALREADY_IS_VOTER
,
"Mnode already is a leader"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MNODE_ONLY_TWO_MNODE
,
"Only two mnodes exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MNODE_ONLY_TWO_MNODE
,
"Only two mnodes exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MNODE_NO_NEED_RESTORE
,
"No need to restore on this dnode"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MNODE_NO_NEED_RESTORE
,
"No need to restore on this dnode"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DNODE_ONLY_USE_WHEN_OFFLINE
,
"Please use this command when the dnode is offline"
)
// vnode
// vnode
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_INVALID_VGROUP_ID
,
"Vnode is closed or removed"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_INVALID_VGROUP_ID
,
"Vnode is closed or removed"
)
...
...
tests/parallel_test/cases.task
浏览文件 @
880359dd
...
@@ -571,7 +571,7 @@
...
@@ -571,7 +571,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/alter_replica.py -N 3
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/alter_replica.py -N 3
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/influxdb_line_taosc_insert.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/influxdb_line_taosc_insert.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/opentsdb_telnet_line_taosc_insert.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/opentsdb_telnet_line_taosc_insert.py
#
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/opentsdb_json_taosc_insert.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/opentsdb_json_taosc_insert.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/test_stmt_muti_insert_query.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/test_stmt_muti_insert_query.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/test_stmt_set_tbname_tag.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/test_stmt_set_tbname_tag.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/alter_stable.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/alter_stable.py
...
@@ -1089,7 +1089,7 @@
...
@@ -1089,7 +1089,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/timetruncate.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/timetruncate.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/diff.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/diff.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/Timediff.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/Timediff.py -Q 4
#
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/json_tag.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/json_tag.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/top.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/top.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/bottom.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/bottom.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/percentile.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/percentile.py -Q 4
...
...
tests/script/tsim/query/udfpy.sim
浏览文件 @
880359dd
...
@@ -281,17 +281,17 @@ if $data20 != 8.000000000 then
...
@@ -281,17 +281,17 @@ if $data20 != 8.000000000 then
return -1
return -1
endi
endi
sql create aggregate function pycumsum as '/tmp/pyudf/pycumsum.py' outputtype double bufSize 128 language 'python';
#
sql create aggregate function pycumsum as '/tmp/pyudf/pycumsum.py' outputtype double bufSize 128 language 'python';
sql select pycumsum(f2) from udf.t2
#
sql select pycumsum(f2) from udf.t2
print ======= pycumsum
#
print ======= pycumsum
print $rows $data00
#
print $rows $data00
if $rows != 1 then
#
if $rows != 1 then
return -1
#
return -1
endi
#
endi
if $data00 != 20.000000000 then
#
if $data00 != 20.000000000 then
return -1
#
return -1
endi
#
endi
sql drop function pycumsum
#
sql drop function pycumsum
sql create or replace function bit_and as '/tmp/udf/libbitand.so' outputtype int
sql create or replace function bit_and as '/tmp/udf/libbitand.so' outputtype int
sql select func_version from information_schema.ins_functions where name='bit_and'
sql select func_version from information_schema.ins_functions where name='bit_and'
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录