Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2f9aeeb5
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看板
提交
2f9aeeb5
编写于
10月 09, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(stream): support define table name
上级
0575cc26
变更
26
隐藏空白更改
内联
并排
Showing
26 changed file
with
357 addition
and
289 deletion
+357
-289
include/common/tcommon.h
include/common/tcommon.h
+3
-1
include/common/tdatablock.h
include/common/tdatablock.h
+2
-1
include/common/tmsg.h
include/common/tmsg.h
+5
-5
include/libs/executor/executor.h
include/libs/executor/executor.h
+1
-8
source/client/src/clientRawBlockWrite.c
source/client/src/clientRawBlockWrite.c
+35
-34
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+37
-0
source/common/src/tmsg.c
source/common/src/tmsg.c
+2
-2
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+1
-0
source/dnode/mnode/impl/src/mndStream.c
source/dnode/mnode/impl/src/mndStream.c
+15
-1
source/dnode/vnode/src/meta/metaSnapshot.c
source/dnode/vnode/src/meta/metaSnapshot.c
+103
-97
source/dnode/vnode/src/meta/metaTable.c
source/dnode/vnode/src/meta/metaTable.c
+1
-1
source/dnode/vnode/src/sma/smaRollup.c
source/dnode/vnode/src/sma/smaRollup.c
+1
-4
source/dnode/vnode/src/tq/tqSink.c
source/dnode/vnode/src/tq/tqSink.c
+38
-31
source/libs/executor/inc/executil.h
source/libs/executor/inc/executil.h
+3
-1
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+5
-1
source/libs/executor/src/executil.c
source/libs/executor/src/executil.c
+20
-16
source/libs/executor/src/executor.c
source/libs/executor/src/executor.c
+6
-54
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+7
-1
source/libs/executor/src/groupoperator.c
source/libs/executor/src/groupoperator.c
+35
-0
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+1
-21
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+18
-1
source/libs/parser/src/parInsert.c
source/libs/parser/src/parInsert.c
+4
-4
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+4
-4
source/libs/stream/src/streamData.c
source/libs/stream/src/streamData.c
+1
-0
source/libs/stream/src/streamDispatch.c
source/libs/stream/src/streamDispatch.c
+8
-1
source/libs/stream/src/streamState.c
source/libs/stream/src/streamState.c
+1
-0
未找到文件。
include/common/tcommon.h
浏览文件 @
2f9aeeb5
...
@@ -157,7 +157,7 @@ typedef struct SDataBlockInfo {
...
@@ -157,7 +157,7 @@ typedef struct SDataBlockInfo {
int32_t
rowSize
;
int32_t
rowSize
;
uint64_t
uid
;
// the uid of table, from which current data block comes
uint64_t
uid
;
// the uid of table, from which current data block comes
uint16_t
blockId
;
// block id, generated by physical planner
uint16_t
blockId
;
// block id, generated by physical planner
uint64_t
groupId
;
// no need to serialize
uint64_t
groupId
;
int16_t
hasVarCol
;
int16_t
hasVarCol
;
uint32_t
capacity
;
uint32_t
capacity
;
// TODO: optimize and remove following
// TODO: optimize and remove following
...
@@ -166,6 +166,8 @@ typedef struct SDataBlockInfo {
...
@@ -166,6 +166,8 @@ typedef struct SDataBlockInfo {
EStreamType
type
;
// used for stream, do not serialize
EStreamType
type
;
// used for stream, do not serialize
STimeWindow
calWin
;
// used for stream, do not serialize
STimeWindow
calWin
;
// used for stream, do not serialize
TSKEY
watermark
;
// used for stream
TSKEY
watermark
;
// used for stream
char
parTbName
[
TSDB_TABLE_NAME_LEN
];
// used for stream
}
SDataBlockInfo
;
}
SDataBlockInfo
;
typedef
struct
SSDataBlock
{
typedef
struct
SSDataBlock
{
...
...
include/common/tdatablock.h
浏览文件 @
2f9aeeb5
...
@@ -235,7 +235,8 @@ void blockDataFreeRes(SSDataBlock* pBlock);
...
@@ -235,7 +235,8 @@ void blockDataFreeRes(SSDataBlock* pBlock);
SSDataBlock
*
createOneDataBlock
(
const
SSDataBlock
*
pDataBlock
,
bool
copyData
);
SSDataBlock
*
createOneDataBlock
(
const
SSDataBlock
*
pDataBlock
,
bool
copyData
);
SSDataBlock
*
createSpecialDataBlock
(
EStreamType
type
);
SSDataBlock
*
createSpecialDataBlock
(
EStreamType
type
);
int32_t
blockDataAppendColInfo
(
SSDataBlock
*
pBlock
,
SColumnInfoData
*
pColInfoData
);
SSDataBlock
*
blockCopyOneRow
(
const
SSDataBlock
*
pDataBlock
,
int32_t
rowIdx
);
int32_t
blockDataAppendColInfo
(
SSDataBlock
*
pBlock
,
SColumnInfoData
*
pColInfoData
);
SColumnInfoData
createColumnInfoData
(
int16_t
type
,
int32_t
bytes
,
int16_t
colId
);
SColumnInfoData
createColumnInfoData
(
int16_t
type
,
int32_t
bytes
,
int16_t
colId
);
SColumnInfoData
*
bdGetColumnInfoData
(
const
SSDataBlock
*
pBlock
,
int32_t
index
);
SColumnInfoData
*
bdGetColumnInfoData
(
const
SSDataBlock
*
pBlock
,
int32_t
index
);
...
...
include/common/tmsg.h
浏览文件 @
2f9aeeb5
...
@@ -676,7 +676,6 @@ typedef struct {
...
@@ -676,7 +676,6 @@ typedef struct {
col_id_t
colId
;
col_id_t
colId
;
int16_t
slotId
;
int16_t
slotId
;
};
};
bool
output
;
// TODO remove it later
int8_t
type
;
int8_t
type
;
int32_t
bytes
;
int32_t
bytes
;
...
@@ -1395,8 +1394,9 @@ typedef struct {
...
@@ -1395,8 +1394,9 @@ typedef struct {
int32_t
numOfCols
;
int32_t
numOfCols
;
int64_t
skey
;
int64_t
skey
;
int64_t
ekey
;
int64_t
ekey
;
int64_t
version
;
// for stream
int64_t
version
;
// for stream
TSKEY
watermark
;
// for stream
TSKEY
watermark
;
// for stream
char
parTbName
[
TSDB_TABLE_NAME_LEN
];
// for stream
char
data
[];
char
data
[];
}
SRetrieveTableRsp
;
}
SRetrieveTableRsp
;
...
@@ -2025,7 +2025,7 @@ typedef struct SVCreateTbReq {
...
@@ -2025,7 +2025,7 @@ typedef struct SVCreateTbReq {
int8_t
type
;
int8_t
type
;
union
{
union
{
struct
{
struct
{
char
*
n
ame
;
// super table name
char
*
stbN
ame
;
// super table name
uint8_t
tagNum
;
uint8_t
tagNum
;
tb_uid_t
suid
;
tb_uid_t
suid
;
SArray
*
tagName
;
SArray
*
tagName
;
...
@@ -2045,7 +2045,7 @@ static FORCE_INLINE void tdDestroySVCreateTbReq(SVCreateTbReq* req) {
...
@@ -2045,7 +2045,7 @@ static FORCE_INLINE void tdDestroySVCreateTbReq(SVCreateTbReq* req) {
taosMemoryFreeClear
(
req
->
comment
);
taosMemoryFreeClear
(
req
->
comment
);
if
(
req
->
type
==
TSDB_CHILD_TABLE
)
{
if
(
req
->
type
==
TSDB_CHILD_TABLE
)
{
taosMemoryFreeClear
(
req
->
ctb
.
pTag
);
taosMemoryFreeClear
(
req
->
ctb
.
pTag
);
taosMemoryFreeClear
(
req
->
ctb
.
n
ame
);
taosMemoryFreeClear
(
req
->
ctb
.
stbN
ame
);
taosArrayDestroy
(
req
->
ctb
.
tagName
);
taosArrayDestroy
(
req
->
ctb
.
tagName
);
req
->
ctb
.
tagName
=
NULL
;
req
->
ctb
.
tagName
=
NULL
;
}
else
if
(
req
->
type
==
TSDB_NORMAL_TABLE
)
{
}
else
if
(
req
->
type
==
TSDB_NORMAL_TABLE
)
{
...
...
include/libs/executor/executor.h
浏览文件 @
2f9aeeb5
...
@@ -89,13 +89,6 @@ qTaskInfo_t qCreateQueueExecTaskInfo(void* msg, SReadHandle* readers, int32_t* n
...
@@ -89,13 +89,6 @@ qTaskInfo_t qCreateQueueExecTaskInfo(void* msg, SReadHandle* readers, int32_t* n
*/
*/
int32_t
qSetMultiStreamInput
(
qTaskInfo_t
tinfo
,
const
void
*
pBlocks
,
size_t
numOfBlocks
,
int32_t
type
);
int32_t
qSetMultiStreamInput
(
qTaskInfo_t
tinfo
,
const
void
*
pBlocks
,
size_t
numOfBlocks
,
int32_t
type
);
/**
* @brief Cleanup SSDataBlock for StreamScanInfo
*
* @param tinfo
*/
void
tdCleanupStreamInputDataBlock
(
qTaskInfo_t
tinfo
);
/**
/**
* Update the table id list, add or remove.
* Update the table id list, add or remove.
*
*
...
@@ -137,7 +130,7 @@ int32_t qGetQueryTableSchemaVersion(qTaskInfo_t tinfo, char* dbName, char* table
...
@@ -137,7 +130,7 @@ int32_t qGetQueryTableSchemaVersion(qTaskInfo_t tinfo, char* dbName, char* table
* @return
* @return
*/
*/
int32_t
qExecTaskOpt
(
qTaskInfo_t
tinfo
,
SArray
*
pResList
,
uint64_t
*
useconds
,
bool
*
hasMore
,
SLocalFetch
*
pLocal
);
int32_t
qExecTaskOpt
(
qTaskInfo_t
tinfo
,
SArray
*
pResList
,
uint64_t
*
useconds
,
bool
*
hasMore
,
SLocalFetch
*
pLocal
);
int32_t
qExecTask
(
qTaskInfo_t
tinfo
,
SSDataBlock
**
pBlock
,
uint64_t
*
useconds
);
int32_t
qExecTask
(
qTaskInfo_t
tinfo
,
SSDataBlock
**
pBlock
,
uint64_t
*
useconds
);
/**
/**
...
...
source/client/src/clientRawBlockWrite.c
浏览文件 @
2f9aeeb5
...
@@ -225,10 +225,10 @@ _err:
...
@@ -225,10 +225,10 @@ _err:
return
string
;
return
string
;
}
}
static
void
buildChildElement
(
cJSON
*
json
,
SVCreateTbReq
*
pCreateReq
)
{
static
void
buildChildElement
(
cJSON
*
json
,
SVCreateTbReq
*
pCreateReq
)
{
STag
*
pTag
=
(
STag
*
)
pCreateReq
->
ctb
.
pTag
;
STag
*
pTag
=
(
STag
*
)
pCreateReq
->
ctb
.
pTag
;
char
*
sname
=
pCreateReq
->
ctb
.
n
ame
;
char
*
sname
=
pCreateReq
->
ctb
.
stbN
ame
;
char
*
name
=
pCreateReq
->
name
;
char
*
name
=
pCreateReq
->
name
;
SArray
*
tagName
=
pCreateReq
->
ctb
.
tagName
;
SArray
*
tagName
=
pCreateReq
->
ctb
.
tagName
;
int64_t
id
=
pCreateReq
->
uid
;
int64_t
id
=
pCreateReq
->
uid
;
uint8_t
tagNum
=
pCreateReq
->
ctb
.
tagNum
;
uint8_t
tagNum
=
pCreateReq
->
ctb
.
tagNum
;
...
@@ -302,14 +302,14 @@ static void buildChildElement(cJSON* json, SVCreateTbReq* pCreateReq){
...
@@ -302,14 +302,14 @@ static void buildChildElement(cJSON* json, SVCreateTbReq* pCreateReq){
cJSON_AddItemToArray
(
tags
,
tag
);
cJSON_AddItemToArray
(
tags
,
tag
);
}
}
end:
end:
cJSON_AddItemToObject
(
json
,
"tags"
,
tags
);
cJSON_AddItemToObject
(
json
,
"tags"
,
tags
);
taosArrayDestroy
(
pTagVals
);
taosArrayDestroy
(
pTagVals
);
}
}
static
char
*
buildCreateCTableJson
(
SVCreateTbReq
*
pCreateReq
,
int32_t
nReqs
)
{
static
char
*
buildCreateCTableJson
(
SVCreateTbReq
*
pCreateReq
,
int32_t
nReqs
)
{
char
*
string
=
NULL
;
char
*
string
=
NULL
;
cJSON
*
json
=
cJSON_CreateObject
();
cJSON
*
json
=
cJSON_CreateObject
();
if
(
json
==
NULL
)
{
if
(
json
==
NULL
)
{
return
NULL
;
return
NULL
;
}
}
...
@@ -325,7 +325,7 @@ static char* buildCreateCTableJson(SVCreateTbReq* pCreateReq, int32_t nReqs) {
...
@@ -325,7 +325,7 @@ static char* buildCreateCTableJson(SVCreateTbReq* pCreateReq, int32_t nReqs) {
buildChildElement
(
json
,
pCreateReq
);
buildChildElement
(
json
,
pCreateReq
);
cJSON
*
createList
=
cJSON_CreateArray
();
cJSON
*
createList
=
cJSON_CreateArray
();
for
(
int
i
=
0
;
nReqs
>
1
&&
i
<
nReqs
;
i
++
)
{
for
(
int
i
=
0
;
nReqs
>
1
&&
i
<
nReqs
;
i
++
)
{
cJSON
*
create
=
cJSON_CreateObject
();
cJSON
*
create
=
cJSON_CreateObject
();
buildChildElement
(
create
,
pCreateReq
+
i
);
buildChildElement
(
create
,
pCreateReq
+
i
);
cJSON_AddItemToArray
(
createList
,
create
);
cJSON_AddItemToArray
(
createList
,
create
);
...
@@ -355,7 +355,8 @@ static char* processCreateTable(SMqMetaRsp* metaRsp) {
...
@@ -355,7 +355,8 @@ static char* processCreateTable(SMqMetaRsp* metaRsp) {
if
(
pCreateReq
->
type
==
TSDB_CHILD_TABLE
)
{
if
(
pCreateReq
->
type
==
TSDB_CHILD_TABLE
)
{
string
=
buildCreateCTableJson
(
req
.
pReqs
,
req
.
nReqs
);
string
=
buildCreateCTableJson
(
req
.
pReqs
,
req
.
nReqs
);
}
else
if
(
pCreateReq
->
type
==
TSDB_NORMAL_TABLE
)
{
}
else
if
(
pCreateReq
->
type
==
TSDB_NORMAL_TABLE
)
{
string
=
buildCreateTableJson
(
&
pCreateReq
->
ntb
.
schemaRow
,
NULL
,
pCreateReq
->
name
,
pCreateReq
->
uid
,
TSDB_NORMAL_TABLE
);
string
=
buildCreateTableJson
(
&
pCreateReq
->
ntb
.
schemaRow
,
NULL
,
pCreateReq
->
name
,
pCreateReq
->
uid
,
TSDB_NORMAL_TABLE
);
}
}
}
}
...
@@ -374,15 +375,15 @@ _exit:
...
@@ -374,15 +375,15 @@ _exit:
static
char
*
processAutoCreateTable
(
STaosxRsp
*
rsp
)
{
static
char
*
processAutoCreateTable
(
STaosxRsp
*
rsp
)
{
ASSERT
(
rsp
->
createTableNum
!=
0
);
ASSERT
(
rsp
->
createTableNum
!=
0
);
SDecoder
*
decoder
=
taosMemoryCalloc
(
rsp
->
createTableNum
,
sizeof
(
SDecoder
));
SDecoder
*
decoder
=
taosMemoryCalloc
(
rsp
->
createTableNum
,
sizeof
(
SDecoder
));
SVCreateTbReq
*
pCreateReq
=
taosMemoryCalloc
(
rsp
->
createTableNum
,
sizeof
(
SVCreateTbReq
));
SVCreateTbReq
*
pCreateReq
=
taosMemoryCalloc
(
rsp
->
createTableNum
,
sizeof
(
SVCreateTbReq
));
char
*
string
=
NULL
;
char
*
string
=
NULL
;
// loop to create table
// loop to create table
for
(
int32_t
iReq
=
0
;
iReq
<
rsp
->
createTableNum
;
iReq
++
)
{
for
(
int32_t
iReq
=
0
;
iReq
<
rsp
->
createTableNum
;
iReq
++
)
{
// decode
// decode
void
**
data
=
taosArrayGet
(
rsp
->
createTableReq
,
iReq
);
void
**
data
=
taosArrayGet
(
rsp
->
createTableReq
,
iReq
);
int32_t
*
len
=
taosArrayGet
(
rsp
->
createTableLen
,
iReq
);
int32_t
*
len
=
taosArrayGet
(
rsp
->
createTableLen
,
iReq
);
tDecoderInit
(
&
decoder
[
iReq
],
*
data
,
*
len
);
tDecoderInit
(
&
decoder
[
iReq
],
*
data
,
*
len
);
if
(
tDecodeSVCreateTbReq
(
&
decoder
[
iReq
],
pCreateReq
+
iReq
)
<
0
)
{
if
(
tDecodeSVCreateTbReq
(
&
decoder
[
iReq
],
pCreateReq
+
iReq
)
<
0
)
{
goto
_exit
;
goto
_exit
;
...
@@ -393,7 +394,7 @@ static char* processAutoCreateTable(STaosxRsp* rsp) {
...
@@ -393,7 +394,7 @@ static char* processAutoCreateTable(STaosxRsp* rsp) {
string
=
buildCreateCTableJson
(
pCreateReq
,
rsp
->
createTableNum
);
string
=
buildCreateCTableJson
(
pCreateReq
,
rsp
->
createTableNum
);
_exit:
_exit:
for
(
int
i
=
0
;
i
<
rsp
->
createTableNum
;
i
++
)
{
for
(
int
i
=
0
;
i
<
rsp
->
createTableNum
;
i
++
)
{
tDecoderClear
(
&
decoder
[
i
]);
tDecoderClear
(
&
decoder
[
i
]);
taosMemoryFreeClear
(
pCreateReq
[
i
].
comment
);
taosMemoryFreeClear
(
pCreateReq
[
i
].
comment
);
if
(
pCreateReq
[
i
].
type
==
TSDB_CHILD_TABLE
)
{
if
(
pCreateReq
[
i
].
type
==
TSDB_CHILD_TABLE
)
{
...
@@ -828,10 +829,10 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) {
...
@@ -828,10 +829,10 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) {
if
(
pCreateReq
->
type
==
TSDB_CHILD_TABLE
)
{
if
(
pCreateReq
->
type
==
TSDB_CHILD_TABLE
)
{
STableMeta
*
pTableMeta
=
NULL
;
STableMeta
*
pTableMeta
=
NULL
;
SName
sName
=
{
0
};
SName
sName
=
{
0
};
toName
(
pTscObj
->
acctId
,
pRequest
->
pDb
,
pCreateReq
->
ctb
.
n
ame
,
&
sName
);
toName
(
pTscObj
->
acctId
,
pRequest
->
pDb
,
pCreateReq
->
ctb
.
stbN
ame
,
&
sName
);
code
=
catalogGetTableMeta
(
pCatalog
,
&
conn
,
&
sName
,
&
pTableMeta
);
code
=
catalogGetTableMeta
(
pCatalog
,
&
conn
,
&
sName
,
&
pTableMeta
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
uError
(
"taosCreateTable:catalogGetTableMeta failed. table name: %s"
,
pCreateReq
->
ctb
.
n
ame
);
uError
(
"taosCreateTable:catalogGetTableMeta failed. table name: %s"
,
pCreateReq
->
ctb
.
stbN
ame
);
goto
end
;
goto
end
;
}
}
...
@@ -1661,12 +1662,12 @@ end:
...
@@ -1661,12 +1662,12 @@ end:
}
}
static
int32_t
tmqWriteRawMetaDataImpl
(
TAOS
*
taos
,
void
*
data
,
int32_t
dataLen
)
{
static
int32_t
tmqWriteRawMetaDataImpl
(
TAOS
*
taos
,
void
*
data
,
int32_t
dataLen
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
SHashObj
*
pVgHash
=
NULL
;
SHashObj
*
pVgHash
=
NULL
;
SQuery
*
pQuery
=
NULL
;
SQuery
*
pQuery
=
NULL
;
SMqTaosxRspObj
rspObj
=
{
0
};
SMqTaosxRspObj
rspObj
=
{
0
};
SDecoder
decoder
=
{
0
};
SDecoder
decoder
=
{
0
};
STableMeta
*
pTableMeta
=
NULL
;
STableMeta
*
pTableMeta
=
NULL
;
terrno
=
TSDB_CODE_SUCCESS
;
terrno
=
TSDB_CODE_SUCCESS
;
SRequestObj
*
pRequest
=
(
SRequestObj
*
)
createRequest
(
*
(
int64_t
*
)
taos
,
TSDB_SQL_INSERT
);
SRequestObj
*
pRequest
=
(
SRequestObj
*
)
createRequest
(
*
(
int64_t
*
)
taos
,
TSDB_SQL_INSERT
);
...
@@ -1745,13 +1746,13 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
...
@@ -1745,13 +1746,13 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
// find schema data info
// find schema data info
int32_t
schemaLen
=
0
;
int32_t
schemaLen
=
0
;
void
*
schemaData
=
NULL
;
void
*
schemaData
=
NULL
;
for
(
int
j
=
0
;
j
<
rspObj
.
rsp
.
createTableNum
;
j
++
)
{
for
(
int
j
=
0
;
j
<
rspObj
.
rsp
.
createTableNum
;
j
++
)
{
void
**
dataTmp
=
taosArrayGet
(
rspObj
.
rsp
.
createTableReq
,
j
);
void
**
dataTmp
=
taosArrayGet
(
rspObj
.
rsp
.
createTableReq
,
j
);
int32_t
*
lenTmp
=
taosArrayGet
(
rspObj
.
rsp
.
createTableLen
,
j
);
int32_t
*
lenTmp
=
taosArrayGet
(
rspObj
.
rsp
.
createTableLen
,
j
);
SDecoder
decoderTmp
=
{
0
};
SDecoder
decoderTmp
=
{
0
};
SVCreateTbReq
pCreateReq
=
{
0
};
SVCreateTbReq
pCreateReq
=
{
0
};
tDecoderInit
(
&
decoderTmp
,
*
dataTmp
,
*
lenTmp
);
tDecoderInit
(
&
decoderTmp
,
*
dataTmp
,
*
lenTmp
);
if
(
tDecodeSVCreateTbReq
(
&
decoderTmp
,
&
pCreateReq
)
<
0
)
{
if
(
tDecodeSVCreateTbReq
(
&
decoderTmp
,
&
pCreateReq
)
<
0
)
{
...
@@ -1761,11 +1762,11 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
...
@@ -1761,11 +1762,11 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
goto
end
;
goto
end
;
}
}
ASSERT
(
pCreateReq
.
type
==
TSDB_CHILD_TABLE
);
ASSERT
(
pCreateReq
.
type
==
TSDB_CHILD_TABLE
);
if
(
strcmp
(
tbName
,
pCreateReq
.
name
)
==
0
)
{
if
(
strcmp
(
tbName
,
pCreateReq
.
name
)
==
0
)
{
schemaLen
=
*
lenTmp
;
schemaLen
=
*
lenTmp
;
schemaData
=
*
dataTmp
;
schemaData
=
*
dataTmp
;
strcpy
(
pName
.
tname
,
pCreateReq
.
ctb
.
n
ame
);
strcpy
(
pName
.
tname
,
pCreateReq
.
ctb
.
stbN
ame
);
tDecoderClear
(
&
decoderTmp
);
tDecoderClear
(
&
decoderTmp
);
taosMemoryFreeClear
(
pCreateReq
.
comment
);
taosMemoryFreeClear
(
pCreateReq
.
comment
);
taosArrayDestroy
(
pCreateReq
.
ctb
.
tagName
);
taosArrayDestroy
(
pCreateReq
.
ctb
.
tagName
);
...
@@ -1843,8 +1844,8 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
...
@@ -1843,8 +1844,8 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
uint64_t
uid
=
pTableMeta
->
uid
;
uint64_t
uid
=
pTableMeta
->
uid
;
int16_t
sver
=
pTableMeta
->
sversion
;
int16_t
sver
=
pTableMeta
->
sversion
;
void
*
blkSchema
=
POINTER_SHIFT
(
blk
,
sizeof
(
SSubmitBlk
));
void
*
blkSchema
=
POINTER_SHIFT
(
blk
,
sizeof
(
SSubmitBlk
));
if
(
schemaData
)
{
if
(
schemaData
)
{
memcpy
(
blkSchema
,
schemaData
,
schemaLen
);
memcpy
(
blkSchema
,
schemaData
,
schemaLen
);
}
}
STSRow
*
rowData
=
POINTER_SHIFT
(
blkSchema
,
schemaLen
);
STSRow
*
rowData
=
POINTER_SHIFT
(
blkSchema
,
schemaLen
);
...
@@ -1952,7 +1953,7 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
...
@@ -1952,7 +1953,7 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
launchQueryImpl
(
pRequest
,
pQuery
,
true
,
NULL
);
launchQueryImpl
(
pRequest
,
pQuery
,
true
,
NULL
);
code
=
pRequest
->
code
;
code
=
pRequest
->
code
;
end:
end:
tDeleteSTaosxRsp
(
&
rspObj
.
rsp
);
tDeleteSTaosxRsp
(
&
rspObj
.
rsp
);
rspObj
.
resInfo
.
pRspMsg
=
NULL
;
rspObj
.
resInfo
.
pRspMsg
=
NULL
;
doFreeReqResultInfo
(
&
rspObj
.
resInfo
);
doFreeReqResultInfo
(
&
rspObj
.
resInfo
);
...
@@ -1969,7 +1970,7 @@ char* tmq_get_json_meta(TAOS_RES* res) {
...
@@ -1969,7 +1970,7 @@ char* tmq_get_json_meta(TAOS_RES* res) {
return
NULL
;
return
NULL
;
}
}
if
(
TD_RES_TMQ_METADATA
(
res
))
{
if
(
TD_RES_TMQ_METADATA
(
res
))
{
SMqTaosxRspObj
*
pMetaDataRspObj
=
(
SMqTaosxRspObj
*
)
res
;
SMqTaosxRspObj
*
pMetaDataRspObj
=
(
SMqTaosxRspObj
*
)
res
;
return
processAutoCreateTable
(
&
pMetaDataRspObj
->
rsp
);
return
processAutoCreateTable
(
&
pMetaDataRspObj
->
rsp
);
}
}
...
...
source/common/src/tdatablock.c
浏览文件 @
2f9aeeb5
...
@@ -1346,6 +1346,43 @@ SSDataBlock* createSpecialDataBlock(EStreamType type) {
...
@@ -1346,6 +1346,43 @@ SSDataBlock* createSpecialDataBlock(EStreamType type) {
return
pBlock
;
return
pBlock
;
}
}
SSDataBlock
*
blockCopyOneRow
(
const
SSDataBlock
*
pDataBlock
,
int32_t
rowIdx
)
{
if
(
pDataBlock
==
NULL
)
{
return
NULL
;
}
SSDataBlock
*
pBlock
=
createDataBlock
();
pBlock
->
info
=
pDataBlock
->
info
;
pBlock
->
info
.
rows
=
0
;
pBlock
->
info
.
capacity
=
0
;
size_t
numOfCols
=
taosArrayGetSize
(
pDataBlock
->
pDataBlock
);
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
*
p
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
i
);
SColumnInfoData
colInfo
=
{.
hasNull
=
true
,
.
info
=
p
->
info
};
blockDataAppendColInfo
(
pBlock
,
&
colInfo
);
}
int32_t
code
=
blockDataEnsureCapacity
(
pBlock
,
1
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
terrno
=
code
;
blockDataDestroy
(
pBlock
);
return
NULL
;
}
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
*
pDst
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
SColumnInfoData
*
pSrc
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
i
);
void
*
pData
=
colDataGetData
(
pSrc
,
rowIdx
);
bool
isNull
=
colDataIsNull
(
pSrc
,
pDataBlock
->
info
.
rows
,
rowIdx
,
NULL
);
colDataAppend
(
pDst
,
0
,
pData
,
isNull
);
}
pBlock
->
info
.
rows
=
1
;
return
pBlock
;
}
SSDataBlock
*
createOneDataBlock
(
const
SSDataBlock
*
pDataBlock
,
bool
copyData
)
{
SSDataBlock
*
createOneDataBlock
(
const
SSDataBlock
*
pDataBlock
,
bool
copyData
)
{
if
(
pDataBlock
==
NULL
)
{
if
(
pDataBlock
==
NULL
)
{
return
NULL
;
return
NULL
;
...
...
source/common/src/tmsg.c
浏览文件 @
2f9aeeb5
...
@@ -5075,7 +5075,7 @@ int tEncodeSVCreateTbReq(SEncoder *pCoder, const SVCreateTbReq *pReq) {
...
@@ -5075,7 +5075,7 @@ int tEncodeSVCreateTbReq(SEncoder *pCoder, const SVCreateTbReq *pReq) {
}
}
if
(
pReq
->
type
==
TSDB_CHILD_TABLE
)
{
if
(
pReq
->
type
==
TSDB_CHILD_TABLE
)
{
if
(
tEncodeCStr
(
pCoder
,
pReq
->
ctb
.
n
ame
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pCoder
,
pReq
->
ctb
.
stbN
ame
)
<
0
)
return
-
1
;
if
(
tEncodeU8
(
pCoder
,
pReq
->
ctb
.
tagNum
)
<
0
)
return
-
1
;
if
(
tEncodeU8
(
pCoder
,
pReq
->
ctb
.
tagNum
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pCoder
,
pReq
->
ctb
.
suid
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pCoder
,
pReq
->
ctb
.
suid
)
<
0
)
return
-
1
;
if
(
tEncodeTag
(
pCoder
,
(
const
STag
*
)
pReq
->
ctb
.
pTag
)
<
0
)
return
-
1
;
if
(
tEncodeTag
(
pCoder
,
(
const
STag
*
)
pReq
->
ctb
.
pTag
)
<
0
)
return
-
1
;
...
@@ -5112,7 +5112,7 @@ int tDecodeSVCreateTbReq(SDecoder *pCoder, SVCreateTbReq *pReq) {
...
@@ -5112,7 +5112,7 @@ int tDecodeSVCreateTbReq(SDecoder *pCoder, SVCreateTbReq *pReq) {
}
}
if
(
pReq
->
type
==
TSDB_CHILD_TABLE
)
{
if
(
pReq
->
type
==
TSDB_CHILD_TABLE
)
{
if
(
tDecodeCStr
(
pCoder
,
&
pReq
->
ctb
.
n
ame
)
<
0
)
return
-
1
;
if
(
tDecodeCStr
(
pCoder
,
&
pReq
->
ctb
.
stbN
ame
)
<
0
)
return
-
1
;
if
(
tDecodeU8
(
pCoder
,
&
pReq
->
ctb
.
tagNum
)
<
0
)
return
-
1
;
if
(
tDecodeU8
(
pCoder
,
&
pReq
->
ctb
.
tagNum
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pCoder
,
&
pReq
->
ctb
.
suid
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pCoder
,
&
pReq
->
ctb
.
suid
)
<
0
)
return
-
1
;
if
(
tDecodeTag
(
pCoder
,
(
STag
**
)
&
pReq
->
ctb
.
pTag
)
<
0
)
return
-
1
;
if
(
tDecodeTag
(
pCoder
,
(
STag
**
)
&
pReq
->
ctb
.
pTag
)
<
0
)
return
-
1
;
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
2f9aeeb5
...
@@ -639,6 +639,7 @@ typedef struct {
...
@@ -639,6 +639,7 @@ typedef struct {
char
*
physicalPlan
;
char
*
physicalPlan
;
SArray
*
tasks
;
// SArray<SArray<SStreamTask>>
SArray
*
tasks
;
// SArray<SArray<SStreamTask>>
SSchemaWrapper
outputSchema
;
SSchemaWrapper
outputSchema
;
SSchemaWrapper
tagSchema
;
}
SStreamObj
;
}
SStreamObj
;
int32_t
tEncodeSStreamObj
(
SEncoder
*
pEncoder
,
const
SStreamObj
*
pObj
);
int32_t
tEncodeSStreamObj
(
SEncoder
*
pEncoder
,
const
SStreamObj
*
pObj
);
...
...
source/dnode/mnode/impl/src/mndStream.c
浏览文件 @
2f9aeeb5
...
@@ -343,6 +343,20 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj,
...
@@ -343,6 +343,20 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj,
goto
FAIL
;
goto
FAIL
;
}
}
pObj
->
tagSchema
.
nCols
=
pCreate
->
numOfTags
;
if
(
pCreate
->
numOfTags
)
{
pObj
->
tagSchema
.
pSchema
=
taosMemoryCalloc
(
pCreate
->
numOfTags
,
sizeof
(
SSchema
));
}
ASSERT
(
pCreate
->
numOfTags
==
taosArrayGetSize
(
pCreate
->
pTags
));
for
(
int32_t
i
=
0
;
i
<
pCreate
->
numOfTags
;
i
++
)
{
SField
*
pField
=
taosArrayGet
(
pCreate
->
pTags
,
i
);
pObj
->
tagSchema
.
pSchema
[
i
].
colId
=
pObj
->
outputSchema
.
nCols
+
i
+
1
;
pObj
->
tagSchema
.
pSchema
[
i
].
bytes
=
pField
->
bytes
;
pObj
->
tagSchema
.
pSchema
[
i
].
flags
=
pField
->
flags
;
pObj
->
tagSchema
.
pSchema
[
i
].
type
=
pField
->
type
;
memcpy
(
pObj
->
tagSchema
.
pSchema
[
i
].
name
,
pField
->
name
,
TSDB_COL_NAME_LEN
);
}
FAIL:
FAIL:
if
(
pAst
!=
NULL
)
nodesDestroyNode
(
pAst
);
if
(
pAst
!=
NULL
)
nodesDestroyNode
(
pAst
);
if
(
pPlan
!=
NULL
)
qDestroyQueryPlan
(
pPlan
);
if
(
pPlan
!=
NULL
)
qDestroyQueryPlan
(
pPlan
);
...
@@ -673,7 +687,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
...
@@ -673,7 +687,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
mError
(
"stream:%s, failed to create since %s"
,
createStreamReq
.
name
,
terrstr
());
mError
(
"stream:%s, failed to create since %s"
,
createStreamReq
.
name
,
terrstr
());
goto
_OVER
;
goto
_OVER
;
}
}
mndTransSetDbName
(
pTrans
,
createStreamReq
.
sourceDB
,
streamObj
.
targetDb
);
// hack way
mndTransSetDbName
(
pTrans
,
createStreamReq
.
sourceDB
,
streamObj
.
targetDb
);
// hack way
mInfo
(
"trans:%d, used to create stream:%s"
,
pTrans
->
id
,
createStreamReq
.
name
);
mInfo
(
"trans:%d, used to create stream:%s"
,
pTrans
->
id
,
createStreamReq
.
name
);
// create stb for stream
// create stb for stream
...
...
source/dnode/vnode/src/meta/metaSnapshot.c
浏览文件 @
2f9aeeb5
...
@@ -196,11 +196,11 @@ _err:
...
@@ -196,11 +196,11 @@ _err:
return
code
;
return
code
;
}
}
typedef
struct
STableInfoForChildTable
{
typedef
struct
STableInfoForChildTable
{
char
*
tableName
;
char
*
tableName
;
SSchemaWrapper
*
schemaRow
;
SSchemaWrapper
*
schemaRow
;
SSchemaWrapper
*
tagRow
;
SSchemaWrapper
*
tagRow
;
}
STableInfoForChildTable
;
}
STableInfoForChildTable
;
static
void
destroySTableInfoForChildTable
(
void
*
data
)
{
static
void
destroySTableInfoForChildTable
(
void
*
data
)
{
STableInfoForChildTable
*
pData
=
(
STableInfoForChildTable
*
)
data
;
STableInfoForChildTable
*
pData
=
(
STableInfoForChildTable
*
)
data
;
...
@@ -209,35 +209,35 @@ static void destroySTableInfoForChildTable(void* data) {
...
@@ -209,35 +209,35 @@ static void destroySTableInfoForChildTable(void* data) {
tDeleteSSchemaWrapper
(
pData
->
tagRow
);
tDeleteSSchemaWrapper
(
pData
->
tagRow
);
}
}
static
void
MoveToSnapShotVersion
(
SSnapContext
*
ctx
){
static
void
MoveToSnapShotVersion
(
SSnapContext
*
ctx
)
{
tdbTbcClose
(
ctx
->
pCur
);
tdbTbcClose
(
ctx
->
pCur
);
tdbTbcOpen
(
ctx
->
pMeta
->
pTbDb
,
&
ctx
->
pCur
,
NULL
);
tdbTbcOpen
(
ctx
->
pMeta
->
pTbDb
,
&
ctx
->
pCur
,
NULL
);
STbDbKey
key
=
{.
version
=
ctx
->
snapVersion
,
.
uid
=
INT64_MAX
};
STbDbKey
key
=
{.
version
=
ctx
->
snapVersion
,
.
uid
=
INT64_MAX
};
int
c
=
0
;
int
c
=
0
;
tdbTbcMoveTo
(
ctx
->
pCur
,
&
key
,
sizeof
(
key
),
&
c
);
tdbTbcMoveTo
(
ctx
->
pCur
,
&
key
,
sizeof
(
key
),
&
c
);
if
(
c
<
0
)
{
if
(
c
<
0
)
{
tdbTbcMoveToPrev
(
ctx
->
pCur
);
tdbTbcMoveToPrev
(
ctx
->
pCur
);
}
}
}
}
static
int32_t
MoveToPosition
(
SSnapContext
*
ctx
,
int64_t
ver
,
int64_t
uid
){
static
int32_t
MoveToPosition
(
SSnapContext
*
ctx
,
int64_t
ver
,
int64_t
uid
)
{
tdbTbcClose
(
ctx
->
pCur
);
tdbTbcClose
(
ctx
->
pCur
);
tdbTbcOpen
(
ctx
->
pMeta
->
pTbDb
,
&
ctx
->
pCur
,
NULL
);
tdbTbcOpen
(
ctx
->
pMeta
->
pTbDb
,
&
ctx
->
pCur
,
NULL
);
STbDbKey
key
=
{.
version
=
ver
,
.
uid
=
uid
};
STbDbKey
key
=
{.
version
=
ver
,
.
uid
=
uid
};
int
c
=
0
;
int
c
=
0
;
tdbTbcMoveTo
(
ctx
->
pCur
,
&
key
,
sizeof
(
key
),
&
c
);
tdbTbcMoveTo
(
ctx
->
pCur
,
&
key
,
sizeof
(
key
),
&
c
);
return
c
;
return
c
;
}
}
static
void
MoveToFirst
(
SSnapContext
*
ctx
){
static
void
MoveToFirst
(
SSnapContext
*
ctx
)
{
tdbTbcClose
(
ctx
->
pCur
);
tdbTbcClose
(
ctx
->
pCur
);
tdbTbcOpen
(
ctx
->
pMeta
->
pTbDb
,
&
ctx
->
pCur
,
NULL
);
tdbTbcOpen
(
ctx
->
pMeta
->
pTbDb
,
&
ctx
->
pCur
,
NULL
);
tdbTbcMoveToFirst
(
ctx
->
pCur
);
tdbTbcMoveToFirst
(
ctx
->
pCur
);
}
}
static
void
saveSuperTableInfoForChildTable
(
SMetaEntry
*
me
,
SHashObj
*
suidInfo
)
{
static
void
saveSuperTableInfoForChildTable
(
SMetaEntry
*
me
,
SHashObj
*
suidInfo
)
{
STableInfoForChildTable
*
data
=
(
STableInfoForChildTable
*
)
taosHashGet
(
suidInfo
,
&
me
->
uid
,
sizeof
(
tb_uid_t
));
STableInfoForChildTable
*
data
=
(
STableInfoForChildTable
*
)
taosHashGet
(
suidInfo
,
&
me
->
uid
,
sizeof
(
tb_uid_t
));
if
(
data
)
{
if
(
data
)
{
return
;
return
;
}
}
STableInfoForChildTable
dataTmp
=
{
0
};
STableInfoForChildTable
dataTmp
=
{
0
};
...
@@ -248,9 +248,10 @@ static void saveSuperTableInfoForChildTable(SMetaEntry *me, SHashObj *suidInfo){
...
@@ -248,9 +248,10 @@ static void saveSuperTableInfoForChildTable(SMetaEntry *me, SHashObj *suidInfo){
taosHashPut
(
suidInfo
,
&
me
->
uid
,
sizeof
(
tb_uid_t
),
&
dataTmp
,
sizeof
(
STableInfoForChildTable
));
taosHashPut
(
suidInfo
,
&
me
->
uid
,
sizeof
(
tb_uid_t
),
&
dataTmp
,
sizeof
(
STableInfoForChildTable
));
}
}
int32_t
buildSnapContext
(
SMeta
*
pMeta
,
int64_t
snapVersion
,
int64_t
suid
,
int8_t
subType
,
bool
withMeta
,
SSnapContext
**
ctxRet
){
int32_t
buildSnapContext
(
SMeta
*
pMeta
,
int64_t
snapVersion
,
int64_t
suid
,
int8_t
subType
,
bool
withMeta
,
SSnapContext
**
ctxRet
)
{
SSnapContext
*
ctx
=
taosMemoryCalloc
(
1
,
sizeof
(
SSnapContext
));
SSnapContext
*
ctx
=
taosMemoryCalloc
(
1
,
sizeof
(
SSnapContext
));
if
(
ctx
==
NULL
)
return
-
1
;
if
(
ctx
==
NULL
)
return
-
1
;
*
ctxRet
=
ctx
;
*
ctxRet
=
ctx
;
ctx
->
pMeta
=
pMeta
;
ctx
->
pMeta
=
pMeta
;
ctx
->
snapVersion
=
snapVersion
;
ctx
->
snapVersion
=
snapVersion
;
...
@@ -259,36 +260,37 @@ int32_t buildSnapContext(SMeta* pMeta, int64_t snapVersion, int64_t suid, int8_t
...
@@ -259,36 +260,37 @@ int32_t buildSnapContext(SMeta* pMeta, int64_t snapVersion, int64_t suid, int8_t
ctx
->
queryMetaOrData
=
withMeta
;
ctx
->
queryMetaOrData
=
withMeta
;
ctx
->
withMeta
=
withMeta
;
ctx
->
withMeta
=
withMeta
;
ctx
->
idVersion
=
taosHashInit
(
100
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
true
,
HASH_NO_LOCK
);
ctx
->
idVersion
=
taosHashInit
(
100
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
true
,
HASH_NO_LOCK
);
if
(
ctx
->
idVersion
==
NULL
)
{
if
(
ctx
->
idVersion
==
NULL
)
{
return
-
1
;
return
-
1
;
}
}
ctx
->
suidInfo
=
taosHashInit
(
100
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
true
,
HASH_NO_LOCK
);
ctx
->
suidInfo
=
taosHashInit
(
100
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
true
,
HASH_NO_LOCK
);
if
(
ctx
->
suidInfo
==
NULL
)
{
if
(
ctx
->
suidInfo
==
NULL
)
{
return
-
1
;
return
-
1
;
}
}
taosHashSetFreeFp
(
ctx
->
suidInfo
,
destroySTableInfoForChildTable
);
taosHashSetFreeFp
(
ctx
->
suidInfo
,
destroySTableInfoForChildTable
);
ctx
->
index
=
0
;
ctx
->
index
=
0
;
ctx
->
idList
=
taosArrayInit
(
100
,
sizeof
(
int64_t
));
ctx
->
idList
=
taosArrayInit
(
100
,
sizeof
(
int64_t
));
void
*
pKey
=
NULL
;
void
*
pKey
=
NULL
;
void
*
pVal
=
NULL
;
void
*
pVal
=
NULL
;
int
vLen
=
0
,
kLen
=
0
;
int
vLen
=
0
,
kLen
=
0
;
metaDebug
(
"tmqsnap init snapVersion:%"
PRIi64
,
ctx
->
snapVersion
);
metaDebug
(
"tmqsnap init snapVersion:%"
PRIi64
,
ctx
->
snapVersion
);
MoveToFirst
(
ctx
);
MoveToFirst
(
ctx
);
while
(
1
)
{
while
(
1
)
{
int32_t
ret
=
tdbTbcNext
(
ctx
->
pCur
,
&
pKey
,
&
kLen
,
&
pVal
,
&
vLen
);
int32_t
ret
=
tdbTbcNext
(
ctx
->
pCur
,
&
pKey
,
&
kLen
,
&
pVal
,
&
vLen
);
if
(
ret
<
0
)
break
;
if
(
ret
<
0
)
break
;
STbDbKey
*
tmp
=
(
STbDbKey
*
)
pKey
;
STbDbKey
*
tmp
=
(
STbDbKey
*
)
pKey
;
if
(
tmp
->
version
>
ctx
->
snapVersion
)
break
;
if
(
tmp
->
version
>
ctx
->
snapVersion
)
break
;
SIdInfo
*
idData
=
(
SIdInfo
*
)
taosHashGet
(
ctx
->
idVersion
,
&
tmp
->
uid
,
sizeof
(
tb_uid_t
));
SIdInfo
*
idData
=
(
SIdInfo
*
)
taosHashGet
(
ctx
->
idVersion
,
&
tmp
->
uid
,
sizeof
(
tb_uid_t
));
if
(
idData
)
{
if
(
idData
)
{
continue
;
continue
;
}
}
if
(
tdbTbGet
(
pMeta
->
pUidIdx
,
&
tmp
->
uid
,
sizeof
(
tb_uid_t
),
NULL
,
NULL
)
<
0
)
{
// check if table exist for now, need optimize later
if
(
tdbTbGet
(
pMeta
->
pUidIdx
,
&
tmp
->
uid
,
sizeof
(
tb_uid_t
),
NULL
,
NULL
)
<
0
)
{
// check if table exist for now, need optimize later
continue
;
continue
;
}
}
...
@@ -296,9 +298,9 @@ int32_t buildSnapContext(SMeta* pMeta, int64_t snapVersion, int64_t suid, int8_t
...
@@ -296,9 +298,9 @@ int32_t buildSnapContext(SMeta* pMeta, int64_t snapVersion, int64_t suid, int8_t
SMetaEntry
me
=
{
0
};
SMetaEntry
me
=
{
0
};
tDecoderInit
(
&
dc
,
pVal
,
vLen
);
tDecoderInit
(
&
dc
,
pVal
,
vLen
);
metaDecodeEntry
(
&
dc
,
&
me
);
metaDecodeEntry
(
&
dc
,
&
me
);
if
(
ctx
->
subType
==
TOPIC_SUB_TYPE__TABLE
)
{
if
(
ctx
->
subType
==
TOPIC_SUB_TYPE__TABLE
)
{
if
((
me
.
uid
!=
ctx
->
suid
&&
me
.
type
==
TSDB_SUPER_TABLE
)
||
if
((
me
.
uid
!=
ctx
->
suid
&&
me
.
type
==
TSDB_SUPER_TABLE
)
||
(
me
.
ctbEntry
.
suid
!=
ctx
->
suid
&&
me
.
type
==
TSDB_CHILD_TABLE
)){
(
me
.
ctbEntry
.
suid
!=
ctx
->
suid
&&
me
.
type
==
TSDB_CHILD_TABLE
))
{
tDecoderClear
(
&
dc
);
tDecoderClear
(
&
dc
);
continue
;
continue
;
}
}
...
@@ -314,13 +316,13 @@ int32_t buildSnapContext(SMeta* pMeta, int64_t snapVersion, int64_t suid, int8_t
...
@@ -314,13 +316,13 @@ int32_t buildSnapContext(SMeta* pMeta, int64_t snapVersion, int64_t suid, int8_t
taosHashClear
(
ctx
->
idVersion
);
taosHashClear
(
ctx
->
idVersion
);
MoveToSnapShotVersion
(
ctx
);
MoveToSnapShotVersion
(
ctx
);
while
(
1
)
{
while
(
1
)
{
int32_t
ret
=
tdbTbcPrev
(
ctx
->
pCur
,
&
pKey
,
&
kLen
,
&
pVal
,
&
vLen
);
int32_t
ret
=
tdbTbcPrev
(
ctx
->
pCur
,
&
pKey
,
&
kLen
,
&
pVal
,
&
vLen
);
if
(
ret
<
0
)
break
;
if
(
ret
<
0
)
break
;
STbDbKey
*
tmp
=
(
STbDbKey
*
)
pKey
;
STbDbKey
*
tmp
=
(
STbDbKey
*
)
pKey
;
SIdInfo
*
idData
=
(
SIdInfo
*
)
taosHashGet
(
ctx
->
idVersion
,
&
tmp
->
uid
,
sizeof
(
tb_uid_t
));
SIdInfo
*
idData
=
(
SIdInfo
*
)
taosHashGet
(
ctx
->
idVersion
,
&
tmp
->
uid
,
sizeof
(
tb_uid_t
));
if
(
idData
)
{
if
(
idData
)
{
continue
;
continue
;
}
}
SIdInfo
info
=
{.
version
=
tmp
->
version
,
.
index
=
0
};
SIdInfo
info
=
{.
version
=
tmp
->
version
,
.
index
=
0
};
...
@@ -330,27 +332,28 @@ int32_t buildSnapContext(SMeta* pMeta, int64_t snapVersion, int64_t suid, int8_t
...
@@ -330,27 +332,28 @@ int32_t buildSnapContext(SMeta* pMeta, int64_t snapVersion, int64_t suid, int8_t
SMetaEntry
me
=
{
0
};
SMetaEntry
me
=
{
0
};
tDecoderInit
(
&
dc
,
pVal
,
vLen
);
tDecoderInit
(
&
dc
,
pVal
,
vLen
);
metaDecodeEntry
(
&
dc
,
&
me
);
metaDecodeEntry
(
&
dc
,
&
me
);
if
(
ctx
->
subType
==
TOPIC_SUB_TYPE__TABLE
)
{
if
(
ctx
->
subType
==
TOPIC_SUB_TYPE__TABLE
)
{
if
((
me
.
uid
!=
ctx
->
suid
&&
me
.
type
==
TSDB_SUPER_TABLE
)
||
if
((
me
.
uid
!=
ctx
->
suid
&&
me
.
type
==
TSDB_SUPER_TABLE
)
||
(
me
.
ctbEntry
.
suid
!=
ctx
->
suid
&&
me
.
type
==
TSDB_CHILD_TABLE
)){
(
me
.
ctbEntry
.
suid
!=
ctx
->
suid
&&
me
.
type
==
TSDB_CHILD_TABLE
))
{
tDecoderClear
(
&
dc
);
tDecoderClear
(
&
dc
);
continue
;
continue
;
}
}
}
}
if
((
ctx
->
subType
==
TOPIC_SUB_TYPE__DB
&&
me
.
type
==
TSDB_SUPER_TABLE
)
if
((
ctx
->
subType
==
TOPIC_SUB_TYPE__DB
&&
me
.
type
==
TSDB_SUPER_TABLE
)
||
||
(
ctx
->
subType
==
TOPIC_SUB_TYPE__TABLE
&&
me
.
uid
==
ctx
->
suid
))
{
(
ctx
->
subType
==
TOPIC_SUB_TYPE__TABLE
&&
me
.
uid
==
ctx
->
suid
))
{
saveSuperTableInfoForChildTable
(
&
me
,
ctx
->
suidInfo
);
saveSuperTableInfoForChildTable
(
&
me
,
ctx
->
suidInfo
);
}
}
tDecoderClear
(
&
dc
);
tDecoderClear
(
&
dc
);
}
}
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
ctx
->
idList
);
i
++
)
{
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
ctx
->
idList
);
i
++
)
{
int64_t
*
uid
=
taosArrayGet
(
ctx
->
idList
,
i
);
int64_t
*
uid
=
taosArrayGet
(
ctx
->
idList
,
i
);
SIdInfo
*
idData
=
(
SIdInfo
*
)
taosHashGet
(
ctx
->
idVersion
,
uid
,
sizeof
(
int64_t
));
SIdInfo
*
idData
=
(
SIdInfo
*
)
taosHashGet
(
ctx
->
idVersion
,
uid
,
sizeof
(
int64_t
));
ASSERT
(
idData
);
ASSERT
(
idData
);
idData
->
index
=
i
;
idData
->
index
=
i
;
metaDebug
(
"tmqsnap init idVersion uid:%"
PRIi64
" version:%"
PRIi64
" index:%d"
,
*
uid
,
idData
->
version
,
idData
->
index
);
metaDebug
(
"tmqsnap init idVersion uid:%"
PRIi64
" version:%"
PRIi64
" index:%d"
,
*
uid
,
idData
->
version
,
idData
->
index
);
}
}
tdbFree
(
pKey
);
tdbFree
(
pKey
);
...
@@ -358,7 +361,7 @@ int32_t buildSnapContext(SMeta* pMeta, int64_t snapVersion, int64_t suid, int8_t
...
@@ -358,7 +361,7 @@ int32_t buildSnapContext(SMeta* pMeta, int64_t snapVersion, int64_t suid, int8_t
return
TDB_CODE_SUCCESS
;
return
TDB_CODE_SUCCESS
;
}
}
int32_t
destroySnapContext
(
SSnapContext
*
ctx
){
int32_t
destroySnapContext
(
SSnapContext
*
ctx
)
{
tdbTbcClose
(
ctx
->
pCur
);
tdbTbcClose
(
ctx
->
pCur
);
taosArrayDestroy
(
ctx
->
idList
);
taosArrayDestroy
(
ctx
->
idList
);
taosHashCleanup
(
ctx
->
idVersion
);
taosHashCleanup
(
ctx
->
idVersion
);
...
@@ -367,12 +370,12 @@ int32_t destroySnapContext(SSnapContext* ctx){
...
@@ -367,12 +370,12 @@ int32_t destroySnapContext(SSnapContext* ctx){
return
0
;
return
0
;
}
}
static
int32_t
buildNormalChildTableInfo
(
SVCreateTbReq
*
req
,
void
**
pBuf
,
int32_t
*
contLen
)
{
static
int32_t
buildNormalChildTableInfo
(
SVCreateTbReq
*
req
,
void
**
pBuf
,
int32_t
*
contLen
)
{
int32_t
ret
=
0
;
int32_t
ret
=
0
;
SVCreateTbBatchReq
reqs
=
{
0
};
SVCreateTbBatchReq
reqs
=
{
0
};
reqs
.
pArray
=
taosArrayInit
(
1
,
sizeof
(
struct
SVCreateTbReq
));
reqs
.
pArray
=
taosArrayInit
(
1
,
sizeof
(
struct
SVCreateTbReq
));
if
(
NULL
==
reqs
.
pArray
){
if
(
NULL
==
reqs
.
pArray
)
{
ret
=
-
1
;
ret
=
-
1
;
goto
end
;
goto
end
;
}
}
...
@@ -380,7 +383,7 @@ static int32_t buildNormalChildTableInfo(SVCreateTbReq *req, void **pBuf, int32_
...
@@ -380,7 +383,7 @@ static int32_t buildNormalChildTableInfo(SVCreateTbReq *req, void **pBuf, int32_
reqs
.
nReqs
=
1
;
reqs
.
nReqs
=
1
;
tEncodeSize
(
tEncodeSVCreateTbBatchReq
,
&
reqs
,
*
contLen
,
ret
);
tEncodeSize
(
tEncodeSVCreateTbBatchReq
,
&
reqs
,
*
contLen
,
ret
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
ret
=
-
1
;
ret
=
-
1
;
goto
end
;
goto
end
;
}
}
...
@@ -405,7 +408,7 @@ end:
...
@@ -405,7 +408,7 @@ end:
return
ret
;
return
ret
;
}
}
static
int32_t
buildSuperTableInfo
(
SVCreateStbReq
*
req
,
void
**
pBuf
,
int32_t
*
contLen
)
{
static
int32_t
buildSuperTableInfo
(
SVCreateStbReq
*
req
,
void
**
pBuf
,
int32_t
*
contLen
)
{
int32_t
ret
=
0
;
int32_t
ret
=
0
;
tEncodeSize
(
tEncodeSVCreateStbReq
,
req
,
*
contLen
,
ret
);
tEncodeSize
(
tEncodeSVCreateStbReq
,
req
,
*
contLen
,
ret
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
...
@@ -418,7 +421,7 @@ static int32_t buildSuperTableInfo(SVCreateStbReq *req, void **pBuf, int32_t *co
...
@@ -418,7 +421,7 @@ static int32_t buildSuperTableInfo(SVCreateStbReq *req, void **pBuf, int32_t *co
return
-
1
;
return
-
1
;
}
}
SEncoder
encoder
=
{
0
};
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
POINTER_SHIFT
(
*
pBuf
,
sizeof
(
SMsgHead
)),
*
contLen
);
tEncoderInit
(
&
encoder
,
POINTER_SHIFT
(
*
pBuf
,
sizeof
(
SMsgHead
)),
*
contLen
);
if
(
tEncodeSVCreateStbReq
(
&
encoder
,
req
)
<
0
)
{
if
(
tEncodeSVCreateStbReq
(
&
encoder
,
req
)
<
0
)
{
taosMemoryFreeClear
(
*
pBuf
);
taosMemoryFreeClear
(
*
pBuf
);
...
@@ -429,16 +432,16 @@ static int32_t buildSuperTableInfo(SVCreateStbReq *req, void **pBuf, int32_t *co
...
@@ -429,16 +432,16 @@ static int32_t buildSuperTableInfo(SVCreateStbReq *req, void **pBuf, int32_t *co
return
0
;
return
0
;
}
}
int32_t
setForSnapShot
(
SSnapContext
*
ctx
,
int64_t
uid
){
int32_t
setForSnapShot
(
SSnapContext
*
ctx
,
int64_t
uid
)
{
int
c
=
0
;
int
c
=
0
;
if
(
uid
==
0
)
{
if
(
uid
==
0
)
{
ctx
->
index
=
0
;
ctx
->
index
=
0
;
return
c
;
return
c
;
}
}
SIdInfo
*
idInfo
=
(
SIdInfo
*
)
taosHashGet
(
ctx
->
idVersion
,
&
uid
,
sizeof
(
tb_uid_t
));
SIdInfo
*
idInfo
=
(
SIdInfo
*
)
taosHashGet
(
ctx
->
idVersion
,
&
uid
,
sizeof
(
tb_uid_t
));
if
(
!
idInfo
)
{
if
(
!
idInfo
)
{
return
-
1
;
return
-
1
;
}
}
...
@@ -447,17 +450,17 @@ int32_t setForSnapShot(SSnapContext* ctx, int64_t uid){
...
@@ -447,17 +450,17 @@ int32_t setForSnapShot(SSnapContext* ctx, int64_t uid){
return
c
;
return
c
;
}
}
int32_t
getMetafromSnapShot
(
SSnapContext
*
ctx
,
void
**
pBuf
,
int32_t
*
contLen
,
int16_t
*
type
,
int64_t
*
uid
)
{
int32_t
getMetafromSnapShot
(
SSnapContext
*
ctx
,
void
**
pBuf
,
int32_t
*
contLen
,
int16_t
*
type
,
int64_t
*
uid
)
{
int32_t
ret
=
0
;
int32_t
ret
=
0
;
void
*
pKey
=
NULL
;
void
*
pKey
=
NULL
;
void
*
pVal
=
NULL
;
void
*
pVal
=
NULL
;
int
vLen
=
0
,
kLen
=
0
;
int
vLen
=
0
,
kLen
=
0
;
while
(
1
)
{
while
(
1
)
{
if
(
ctx
->
index
>=
taosArrayGetSize
(
ctx
->
idList
))
{
if
(
ctx
->
index
>=
taosArrayGetSize
(
ctx
->
idList
))
{
metaDebug
(
"tmqsnap get meta end"
);
metaDebug
(
"tmqsnap get meta end"
);
ctx
->
index
=
0
;
ctx
->
index
=
0
;
ctx
->
queryMetaOrData
=
false
;
// change to get data
ctx
->
queryMetaOrData
=
false
;
// change to get data
return
0
;
return
0
;
}
}
...
@@ -468,7 +471,7 @@ int32_t getMetafromSnapShot(SSnapContext* ctx, void **pBuf, int32_t *contLen, in
...
@@ -468,7 +471,7 @@ int32_t getMetafromSnapShot(SSnapContext* ctx, void **pBuf, int32_t *contLen, in
*
uid
=
*
uidTmp
;
*
uid
=
*
uidTmp
;
ret
=
MoveToPosition
(
ctx
,
idInfo
->
version
,
*
uidTmp
);
ret
=
MoveToPosition
(
ctx
,
idInfo
->
version
,
*
uidTmp
);
if
(
ret
==
0
)
{
if
(
ret
==
0
)
{
break
;
break
;
}
}
metaDebug
(
"tmqsnap get meta not exist uid:%"
PRIi64
" version:%"
PRIi64
,
*
uid
,
idInfo
->
version
);
metaDebug
(
"tmqsnap get meta not exist uid:%"
PRIi64
" version:%"
PRIi64
,
*
uid
,
idInfo
->
version
);
...
@@ -479,10 +482,10 @@ int32_t getMetafromSnapShot(SSnapContext* ctx, void **pBuf, int32_t *contLen, in
...
@@ -479,10 +482,10 @@ int32_t getMetafromSnapShot(SSnapContext* ctx, void **pBuf, int32_t *contLen, in
SMetaEntry
me
=
{
0
};
SMetaEntry
me
=
{
0
};
tDecoderInit
(
&
dc
,
pVal
,
vLen
);
tDecoderInit
(
&
dc
,
pVal
,
vLen
);
metaDecodeEntry
(
&
dc
,
&
me
);
metaDecodeEntry
(
&
dc
,
&
me
);
metaDebug
(
"tmqsnap get meta uid:%"
PRIi64
" name:%s index:%d"
,
*
uid
,
me
.
name
,
ctx
->
index
-
1
);
metaDebug
(
"tmqsnap get meta uid:%"
PRIi64
" name:%s index:%d"
,
*
uid
,
me
.
name
,
ctx
->
index
-
1
);
if
((
ctx
->
subType
==
TOPIC_SUB_TYPE__DB
&&
me
.
type
==
TSDB_SUPER_TABLE
)
if
((
ctx
->
subType
==
TOPIC_SUB_TYPE__DB
&&
me
.
type
==
TSDB_SUPER_TABLE
)
||
||
(
ctx
->
subType
==
TOPIC_SUB_TYPE__TABLE
&&
me
.
uid
==
ctx
->
suid
))
{
(
ctx
->
subType
==
TOPIC_SUB_TYPE__TABLE
&&
me
.
uid
==
ctx
->
suid
))
{
SVCreateStbReq
req
=
{
0
};
SVCreateStbReq
req
=
{
0
};
req
.
name
=
me
.
name
;
req
.
name
=
me
.
name
;
req
.
suid
=
me
.
uid
;
req
.
suid
=
me
.
uid
;
...
@@ -494,9 +497,10 @@ int32_t getMetafromSnapShot(SSnapContext* ctx, void **pBuf, int32_t *contLen, in
...
@@ -494,9 +497,10 @@ int32_t getMetafromSnapShot(SSnapContext* ctx, void **pBuf, int32_t *contLen, in
ret
=
buildSuperTableInfo
(
&
req
,
pBuf
,
contLen
);
ret
=
buildSuperTableInfo
(
&
req
,
pBuf
,
contLen
);
*
type
=
TDMT_VND_CREATE_STB
;
*
type
=
TDMT_VND_CREATE_STB
;
}
else
if
((
ctx
->
subType
==
TOPIC_SUB_TYPE__DB
&&
me
.
type
==
TSDB_CHILD_TABLE
)
}
else
if
((
ctx
->
subType
==
TOPIC_SUB_TYPE__DB
&&
me
.
type
==
TSDB_CHILD_TABLE
)
||
||
(
ctx
->
subType
==
TOPIC_SUB_TYPE__TABLE
&&
me
.
type
==
TSDB_CHILD_TABLE
&&
me
.
ctbEntry
.
suid
==
ctx
->
suid
))
{
(
ctx
->
subType
==
TOPIC_SUB_TYPE__TABLE
&&
me
.
type
==
TSDB_CHILD_TABLE
&&
me
.
ctbEntry
.
suid
==
ctx
->
suid
))
{
STableInfoForChildTable
*
data
=
(
STableInfoForChildTable
*
)
taosHashGet
(
ctx
->
suidInfo
,
&
me
.
ctbEntry
.
suid
,
sizeof
(
tb_uid_t
));
STableInfoForChildTable
*
data
=
(
STableInfoForChildTable
*
)
taosHashGet
(
ctx
->
suidInfo
,
&
me
.
ctbEntry
.
suid
,
sizeof
(
tb_uid_t
));
ASSERT
(
data
);
ASSERT
(
data
);
SVCreateTbReq
req
=
{
0
};
SVCreateTbReq
req
=
{
0
};
...
@@ -506,16 +510,16 @@ int32_t getMetafromSnapShot(SSnapContext* ctx, void **pBuf, int32_t *contLen, in
...
@@ -506,16 +510,16 @@ int32_t getMetafromSnapShot(SSnapContext* ctx, void **pBuf, int32_t *contLen, in
req
.
commentLen
=
-
1
;
req
.
commentLen
=
-
1
;
req
.
ctb
.
suid
=
me
.
ctbEntry
.
suid
;
req
.
ctb
.
suid
=
me
.
ctbEntry
.
suid
;
req
.
ctb
.
tagNum
=
data
->
tagRow
->
nCols
;
req
.
ctb
.
tagNum
=
data
->
tagRow
->
nCols
;
req
.
ctb
.
n
ame
=
data
->
tableName
;
req
.
ctb
.
stbN
ame
=
data
->
tableName
;
SArray
*
tagName
=
taosArrayInit
(
req
.
ctb
.
tagNum
,
TSDB_COL_NAME_LEN
);
SArray
*
tagName
=
taosArrayInit
(
req
.
ctb
.
tagNum
,
TSDB_COL_NAME_LEN
);
STag
*
p
=
(
STag
*
)
me
.
ctbEntry
.
pTags
;
STag
*
p
=
(
STag
*
)
me
.
ctbEntry
.
pTags
;
if
(
tTagIsJson
(
p
))
{
if
(
tTagIsJson
(
p
))
{
if
(
p
->
nTag
!=
0
)
{
if
(
p
->
nTag
!=
0
)
{
SSchema
*
schema
=
&
data
->
tagRow
->
pSchema
[
0
];
SSchema
*
schema
=
&
data
->
tagRow
->
pSchema
[
0
];
taosArrayPush
(
tagName
,
schema
->
name
);
taosArrayPush
(
tagName
,
schema
->
name
);
}
}
}
else
{
}
else
{
SArray
*
pTagVals
=
NULL
;
SArray
*
pTagVals
=
NULL
;
if
(
tTagToValArray
((
const
STag
*
)
p
,
&
pTagVals
)
!=
0
)
{
if
(
tTagToValArray
((
const
STag
*
)
p
,
&
pTagVals
)
!=
0
)
{
ASSERT
(
0
);
ASSERT
(
0
);
...
@@ -523,36 +527,36 @@ int32_t getMetafromSnapShot(SSnapContext* ctx, void **pBuf, int32_t *contLen, in
...
@@ -523,36 +527,36 @@ int32_t getMetafromSnapShot(SSnapContext* ctx, void **pBuf, int32_t *contLen, in
int16_t
nCols
=
taosArrayGetSize
(
pTagVals
);
int16_t
nCols
=
taosArrayGetSize
(
pTagVals
);
for
(
int
j
=
0
;
j
<
nCols
;
++
j
)
{
for
(
int
j
=
0
;
j
<
nCols
;
++
j
)
{
STagVal
*
pTagVal
=
(
STagVal
*
)
taosArrayGet
(
pTagVals
,
j
);
STagVal
*
pTagVal
=
(
STagVal
*
)
taosArrayGet
(
pTagVals
,
j
);
for
(
int
i
=
0
;
i
<
data
->
tagRow
->
nCols
;
i
++
)
{
for
(
int
i
=
0
;
i
<
data
->
tagRow
->
nCols
;
i
++
)
{
SSchema
*
schema
=
&
data
->
tagRow
->
pSchema
[
i
];
SSchema
*
schema
=
&
data
->
tagRow
->
pSchema
[
i
];
if
(
schema
->
colId
==
pTagVal
->
cid
)
{
if
(
schema
->
colId
==
pTagVal
->
cid
)
{
taosArrayPush
(
tagName
,
schema
->
name
);
taosArrayPush
(
tagName
,
schema
->
name
);
}
}
}
}
}
}
taosArrayDestroy
(
pTagVals
);
taosArrayDestroy
(
pTagVals
);
}
}
// SIdInfo* sidInfo = (SIdInfo*)taosHashGet(ctx->idVersion, &me.ctbEntry.suid, sizeof(tb_uid_t));
// SIdInfo* sidInfo = (SIdInfo*)taosHashGet(ctx->idVersion, &me.ctbEntry.suid, sizeof(tb_uid_t));
// if(sidInfo->version >= idInfo->version){
// if(sidInfo->version >= idInfo->version){
// // need parse tag
// // need parse tag
// STag* p = (STag*)me.ctbEntry.pTags;
// STag* p = (STag*)me.ctbEntry.pTags;
// SArray* pTagVals = NULL;
// SArray* pTagVals = NULL;
// if (tTagToValArray((const STag*)p, &pTagVals) != 0) {
// if (tTagToValArray((const STag*)p, &pTagVals) != 0) {
// }
// }
//
//
// int16_t nCols = taosArrayGetSize(pTagVals);
// int16_t nCols = taosArrayGetSize(pTagVals);
// for (int j = 0; j < nCols; ++j) {
// for (int j = 0; j < nCols; ++j) {
// STagVal* pTagVal = (STagVal*)taosArrayGet(pTagVals, j);
// STagVal* pTagVal = (STagVal*)taosArrayGet(pTagVals, j);
// }
// }
// }else{
// }else{
req
.
ctb
.
pTag
=
me
.
ctbEntry
.
pTags
;
req
.
ctb
.
pTag
=
me
.
ctbEntry
.
pTags
;
// }
// }
req
.
ctb
.
tagName
=
tagName
;
req
.
ctb
.
tagName
=
tagName
;
ret
=
buildNormalChildTableInfo
(
&
req
,
pBuf
,
contLen
);
ret
=
buildNormalChildTableInfo
(
&
req
,
pBuf
,
contLen
);
*
type
=
TDMT_VND_CREATE_TABLE
;
*
type
=
TDMT_VND_CREATE_TABLE
;
taosArrayDestroy
(
tagName
);
taosArrayDestroy
(
tagName
);
}
else
if
(
ctx
->
subType
==
TOPIC_SUB_TYPE__DB
)
{
}
else
if
(
ctx
->
subType
==
TOPIC_SUB_TYPE__DB
)
{
SVCreateTbReq
req
=
{
0
};
SVCreateTbReq
req
=
{
0
};
req
.
type
=
TSDB_NORMAL_TABLE
;
req
.
type
=
TSDB_NORMAL_TABLE
;
req
.
name
=
me
.
name
;
req
.
name
=
me
.
name
;
...
@@ -561,7 +565,7 @@ int32_t getMetafromSnapShot(SSnapContext* ctx, void **pBuf, int32_t *contLen, in
...
@@ -561,7 +565,7 @@ int32_t getMetafromSnapShot(SSnapContext* ctx, void **pBuf, int32_t *contLen, in
req
.
ntb
.
schemaRow
=
me
.
ntbEntry
.
schemaRow
;
req
.
ntb
.
schemaRow
=
me
.
ntbEntry
.
schemaRow
;
ret
=
buildNormalChildTableInfo
(
&
req
,
pBuf
,
contLen
);
ret
=
buildNormalChildTableInfo
(
&
req
,
pBuf
,
contLen
);
*
type
=
TDMT_VND_CREATE_TABLE
;
*
type
=
TDMT_VND_CREATE_TABLE
;
}
else
{
}
else
{
ASSERT
(
0
);
ASSERT
(
0
);
}
}
tDecoderClear
(
&
dc
);
tDecoderClear
(
&
dc
);
...
@@ -569,14 +573,14 @@ int32_t getMetafromSnapShot(SSnapContext* ctx, void **pBuf, int32_t *contLen, in
...
@@ -569,14 +573,14 @@ int32_t getMetafromSnapShot(SSnapContext* ctx, void **pBuf, int32_t *contLen, in
return
ret
;
return
ret
;
}
}
SMetaTableInfo
getUidfromSnapShot
(
SSnapContext
*
ctx
){
SMetaTableInfo
getUidfromSnapShot
(
SSnapContext
*
ctx
)
{
SMetaTableInfo
result
=
{
0
};
SMetaTableInfo
result
=
{
0
};
void
*
pKey
=
NULL
;
void
*
pKey
=
NULL
;
void
*
pVal
=
NULL
;
void
*
pVal
=
NULL
;
int
vLen
,
kLen
;
int
vLen
,
kLen
;
while
(
1
)
{
while
(
1
)
{
if
(
ctx
->
index
>=
taosArrayGetSize
(
ctx
->
idList
))
{
if
(
ctx
->
index
>=
taosArrayGetSize
(
ctx
->
idList
))
{
metaDebug
(
"tmqsnap get uid info end"
);
metaDebug
(
"tmqsnap get uid info end"
);
return
result
;
return
result
;
}
}
...
@@ -586,7 +590,7 @@ SMetaTableInfo getUidfromSnapShot(SSnapContext* ctx){
...
@@ -586,7 +590,7 @@ SMetaTableInfo getUidfromSnapShot(SSnapContext* ctx){
ASSERT
(
idInfo
);
ASSERT
(
idInfo
);
int32_t
ret
=
MoveToPosition
(
ctx
,
idInfo
->
version
,
*
uidTmp
);
int32_t
ret
=
MoveToPosition
(
ctx
,
idInfo
->
version
,
*
uidTmp
);
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
metaDebug
(
"tmqsnap getUidfromSnapShot not exist uid:%"
PRIi64
" version:%"
PRIi64
,
*
uidTmp
,
idInfo
->
version
);
metaDebug
(
"tmqsnap getUidfromSnapShot not exist uid:%"
PRIi64
" version:%"
PRIi64
,
*
uidTmp
,
idInfo
->
version
);
continue
;
continue
;
}
}
...
@@ -595,10 +599,11 @@ SMetaTableInfo getUidfromSnapShot(SSnapContext* ctx){
...
@@ -595,10 +599,11 @@ SMetaTableInfo getUidfromSnapShot(SSnapContext* ctx){
SMetaEntry
me
=
{
0
};
SMetaEntry
me
=
{
0
};
tDecoderInit
(
&
dc
,
pVal
,
vLen
);
tDecoderInit
(
&
dc
,
pVal
,
vLen
);
metaDecodeEntry
(
&
dc
,
&
me
);
metaDecodeEntry
(
&
dc
,
&
me
);
metaDebug
(
"tmqsnap get uid info uid:%"
PRIi64
" name:%s index:%d"
,
me
.
uid
,
me
.
name
,
ctx
->
index
-
1
);
metaDebug
(
"tmqsnap get uid info uid:%"
PRIi64
" name:%s index:%d"
,
me
.
uid
,
me
.
name
,
ctx
->
index
-
1
);
if
(
ctx
->
subType
==
TOPIC_SUB_TYPE__DB
&&
me
.
type
==
TSDB_CHILD_TABLE
){
if
(
ctx
->
subType
==
TOPIC_SUB_TYPE__DB
&&
me
.
type
==
TSDB_CHILD_TABLE
)
{
STableInfoForChildTable
*
data
=
(
STableInfoForChildTable
*
)
taosHashGet
(
ctx
->
suidInfo
,
&
me
.
ctbEntry
.
suid
,
sizeof
(
tb_uid_t
));
STableInfoForChildTable
*
data
=
(
STableInfoForChildTable
*
)
taosHashGet
(
ctx
->
suidInfo
,
&
me
.
ctbEntry
.
suid
,
sizeof
(
tb_uid_t
));
result
.
uid
=
me
.
uid
;
result
.
uid
=
me
.
uid
;
result
.
suid
=
me
.
ctbEntry
.
suid
;
result
.
suid
=
me
.
ctbEntry
.
suid
;
result
.
schema
=
tCloneSSchemaWrapper
(
data
->
schemaRow
);
result
.
schema
=
tCloneSSchemaWrapper
(
data
->
schemaRow
);
...
@@ -612,15 +617,16 @@ SMetaTableInfo getUidfromSnapShot(SSnapContext* ctx){
...
@@ -612,15 +617,16 @@ SMetaTableInfo getUidfromSnapShot(SSnapContext* ctx){
result
.
schema
=
tCloneSSchemaWrapper
(
&
me
.
ntbEntry
.
schemaRow
);
result
.
schema
=
tCloneSSchemaWrapper
(
&
me
.
ntbEntry
.
schemaRow
);
tDecoderClear
(
&
dc
);
tDecoderClear
(
&
dc
);
break
;
break
;
}
else
if
(
ctx
->
subType
==
TOPIC_SUB_TYPE__TABLE
&&
me
.
type
==
TSDB_CHILD_TABLE
&&
me
.
ctbEntry
.
suid
==
ctx
->
suid
)
{
}
else
if
(
ctx
->
subType
==
TOPIC_SUB_TYPE__TABLE
&&
me
.
type
==
TSDB_CHILD_TABLE
&&
me
.
ctbEntry
.
suid
==
ctx
->
suid
)
{
STableInfoForChildTable
*
data
=
(
STableInfoForChildTable
*
)
taosHashGet
(
ctx
->
suidInfo
,
&
me
.
ctbEntry
.
suid
,
sizeof
(
tb_uid_t
));
STableInfoForChildTable
*
data
=
(
STableInfoForChildTable
*
)
taosHashGet
(
ctx
->
suidInfo
,
&
me
.
ctbEntry
.
suid
,
sizeof
(
tb_uid_t
));
result
.
uid
=
me
.
uid
;
result
.
uid
=
me
.
uid
;
result
.
suid
=
me
.
ctbEntry
.
suid
;
result
.
suid
=
me
.
ctbEntry
.
suid
;
strcpy
(
result
.
tbName
,
me
.
name
);
strcpy
(
result
.
tbName
,
me
.
name
);
result
.
schema
=
tCloneSSchemaWrapper
(
data
->
schemaRow
);
result
.
schema
=
tCloneSSchemaWrapper
(
data
->
schemaRow
);
tDecoderClear
(
&
dc
);
tDecoderClear
(
&
dc
);
break
;
break
;
}
else
{
}
else
{
metaDebug
(
"tmqsnap get uid continue"
);
metaDebug
(
"tmqsnap get uid continue"
);
tDecoderClear
(
&
dc
);
tDecoderClear
(
&
dc
);
continue
;
continue
;
...
...
source/dnode/vnode/src/meta/metaTable.c
浏览文件 @
2f9aeeb5
...
@@ -382,7 +382,7 @@ int metaCreateTable(SMeta *pMeta, int64_t version, SVCreateTbReq *pReq, STableMe
...
@@ -382,7 +382,7 @@ int metaCreateTable(SMeta *pMeta, int64_t version, SVCreateTbReq *pReq, STableMe
}
}
if
(
pReq
->
type
==
TSDB_CHILD_TABLE
)
{
if
(
pReq
->
type
==
TSDB_CHILD_TABLE
)
{
tb_uid_t
suid
=
metaGetTableEntryUidByName
(
pMeta
,
pReq
->
ctb
.
n
ame
);
tb_uid_t
suid
=
metaGetTableEntryUidByName
(
pMeta
,
pReq
->
ctb
.
stbN
ame
);
if
(
suid
!=
pReq
->
ctb
.
suid
)
{
if
(
suid
!=
pReq
->
ctb
.
suid
)
{
terrno
=
TSDB_CODE_PAR_TABLE_NOT_EXIST
;
terrno
=
TSDB_CODE_PAR_TABLE_NOT_EXIST
;
return
-
1
;
return
-
1
;
...
...
source/dnode/vnode/src/sma/smaRollup.c
浏览文件 @
2f9aeeb5
...
@@ -326,7 +326,6 @@ static int32_t tdSetRSmaInfoItemParams(SSma *pSma, SRSmaParam *param, SRSmaStat
...
@@ -326,7 +326,6 @@ static int32_t tdSetRSmaInfoItemParams(SSma *pSma, SRSmaParam *param, SRSmaStat
terrno
=
TSDB_CODE_RSMA_STREAM_STATE_OPEN
;
terrno
=
TSDB_CODE_RSMA_STREAM_STATE_OPEN
;
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
SReadHandle
handle
=
{
SReadHandle
handle
=
{
.
meta
=
pVnode
->
pMeta
,
.
meta
=
pVnode
->
pMeta
,
...
@@ -692,7 +691,7 @@ static int32_t tdRSmaExecAndSubmitResult(SSma *pSma, qTaskInfo_t taskInfo, SRSma
...
@@ -692,7 +691,7 @@ static int32_t tdRSmaExecAndSubmitResult(SSma *pSma, qTaskInfo_t taskInfo, SRSma
while
(
1
)
{
while
(
1
)
{
uint64_t
ts
;
uint64_t
ts
;
bool
hasMore
=
false
;
bool
hasMore
=
false
;
int32_t
code
=
qExecTaskOpt
(
taskInfo
,
pResList
,
&
ts
,
&
hasMore
,
NULL
);
int32_t
code
=
qExecTaskOpt
(
taskInfo
,
pResList
,
&
ts
,
&
hasMore
,
NULL
);
if
(
code
<
0
)
{
if
(
code
<
0
)
{
if
(
code
==
TSDB_CODE_QRY_IN_EXEC
)
{
if
(
code
==
TSDB_CODE_QRY_IN_EXEC
)
{
...
@@ -1821,11 +1820,9 @@ static int32_t tdRSmaFetchAllResult(SSma *pSma, SRSmaInfo *pInfo) {
...
@@ -1821,11 +1820,9 @@ static int32_t tdRSmaFetchAllResult(SSma *pSma, SRSmaInfo *pInfo) {
goto
_err
;
goto
_err
;
}
}
if
(
tdRSmaExecAndSubmitResult
(
pSma
,
taskInfo
,
pItem
,
pInfo
->
pTSchema
,
pInfo
->
suid
)
<
0
)
{
if
(
tdRSmaExecAndSubmitResult
(
pSma
,
taskInfo
,
pItem
,
pInfo
->
pTSchema
,
pInfo
->
suid
)
<
0
)
{
tdCleanupStreamInputDataBlock
(
taskInfo
);
goto
_err
;
goto
_err
;
}
}
tdCleanupStreamInputDataBlock
(
taskInfo
);
smaDebug
(
"vgId:%d, suid:%"
PRIi64
" level:%"
PRIi8
" nScanned:%"
PRIi8
" maxDelay:%d, fetch finished"
,
smaDebug
(
"vgId:%d, suid:%"
PRIi64
" level:%"
PRIi8
" nScanned:%"
PRIi8
" maxDelay:%d, fetch finished"
,
SMA_VID
(
pSma
),
pInfo
->
suid
,
i
,
pItem
->
nScanned
,
pItem
->
maxDelay
);
SMA_VID
(
pSma
),
pInfo
->
suid
,
i
,
pItem
->
nScanned
,
pItem
->
maxDelay
);
}
else
{
}
else
{
...
...
source/dnode/vnode/src/tq/tqSink.c
浏览文件 @
2f9aeeb5
...
@@ -48,8 +48,9 @@ int32_t tqBuildDeleteReq(SVnode* pVnode, const char* stbFullName, const SSDataBl
...
@@ -48,8 +48,9 @@ int32_t tqBuildDeleteReq(SVnode* pVnode, const char* stbFullName, const SSDataBl
return
0
;
return
0
;
}
}
SSubmitReq
*
tqBlockToSubmit
(
SVnode
*
pVnode
,
const
SArray
*
pBlocks
,
const
STSchema
*
pTSchema
,
SSchemaWrapper
*
pTagSchemaWrapper
,
bool
createTb
,
SSubmitReq
*
tqBlockToSubmit
(
SVnode
*
pVnode
,
const
SArray
*
pBlocks
,
const
STSchema
*
pTSchema
,
int64_t
suid
,
const
char
*
stbFullName
,
SBatchDeleteReq
*
pDeleteReq
)
{
SSchemaWrapper
*
pTagSchemaWrapper
,
bool
createTb
,
int64_t
suid
,
const
char
*
stbFullName
,
SBatchDeleteReq
*
pDeleteReq
)
{
SSubmitReq
*
ret
=
NULL
;
SSubmitReq
*
ret
=
NULL
;
SArray
*
schemaReqs
=
NULL
;
SArray
*
schemaReqs
=
NULL
;
SArray
*
schemaReqSz
=
NULL
;
SArray
*
schemaReqSz
=
NULL
;
...
@@ -89,40 +90,46 @@ SSubmitReq* tqBlockToSubmit(SVnode* pVnode, const SArray* pBlocks, const STSchem
...
@@ -89,40 +90,46 @@ SSubmitReq* tqBlockToSubmit(SVnode* pVnode, const SArray* pBlocks, const STSchem
return
NULL
;
return
NULL
;
}
}
SArray
*
tagName
=
taosArrayInit
(
1
,
TSDB_COL_NAME_LEN
);
SArray
*
tagName
=
taosArrayInit
(
1
,
TSDB_COL_NAME_LEN
);
char
tagNameStr
[
TSDB_COL_NAME_LEN
]
=
{
0
};
char
tagNameStr
[
TSDB_COL_NAME_LEN
]
=
{
0
};
strcpy
(
tagNameStr
,
"group_id"
);
strcpy
(
tagNameStr
,
"group_id"
);
taosArrayPush
(
tagName
,
tagNameStr
);
taosArrayPush
(
tagName
,
tagNameStr
);
// STag* pTag = NULL;
// STag* pTag = NULL;
// taosArrayClear(tagArray);
// taosArrayClear(tagArray);
// SArray *tagName = taosArrayInit(1, TSDB_COL_NAME_LEN);
// SArray *tagName = taosArrayInit(1, TSDB_COL_NAME_LEN);
// for(int j = 0; j < pTagSchemaWrapper->nCols; j++){
// for(int j = 0; j < pTagSchemaWrapper->nCols; j++){
// STagVal tagVal = {
// STagVal tagVal = {
// .cid = pTagSchemaWrapper->pSchema[j].colId,
// .cid = pTagSchemaWrapper->pSchema[j].colId,
// .type = pTagSchemaWrapper->pSchema[j].type,
// .type = pTagSchemaWrapper->pSchema[j].type,
// .i64 = (int64_t)pDataBlock->info.groupId,
// .i64 = (int64_t)pDataBlock->info.groupId,
// };
// };
// taosArrayPush(tagArray, &tagVal);
// taosArrayPush(tagArray, &tagVal);
// taosArrayPush(tagName, pTagSchemaWrapper->pSchema[j].name);
// taosArrayPush(tagName, pTagSchemaWrapper->pSchema[j].name);
// }
// }
//
//
// tTagNew(tagArray, 1, false, &pTag);
// tTagNew(tagArray, 1, false, &pTag);
// if (pTag == NULL) {
// if (pTag == NULL) {
// terrno = TSDB_CODE_OUT_OF_MEMORY;
// terrno = TSDB_CODE_OUT_OF_MEMORY;
// taosArrayDestroy(tagArray);
// taosArrayDestroy(tagArray);
// taosArrayDestroy(tagName);
// taosArrayDestroy(tagName);
// return NULL;
// return NULL;
// }
// }
SVCreateTbReq
createTbReq
=
{
0
};
SVCreateTbReq
createTbReq
=
{
0
};
SName
name
=
{
0
};
tNameFromString
(
&
name
,
stbFullName
,
T_NAME_ACCT
|
T_NAME_DB
|
T_NAME_TABLE
);
createTbReq
.
name
=
buildCtbNameByGroupId
(
stbFullName
,
pDataBlock
->
info
.
groupId
);
createTbReq
.
ctb
.
name
=
strdup
((
char
*
)
tNameGetTableName
(
&
name
));
// strdup(stbFullName);
createTbReq
.
flags
=
0
;
createTbReq
.
flags
=
0
;
createTbReq
.
type
=
TSDB_CHILD_TABLE
;
createTbReq
.
type
=
TSDB_CHILD_TABLE
;
SName
name
=
{
0
};
tNameFromString
(
&
name
,
stbFullName
,
T_NAME_ACCT
|
T_NAME_DB
|
T_NAME_TABLE
);
createTbReq
.
ctb
.
stbName
=
strdup
((
char
*
)
tNameGetTableName
(
&
name
));
// strdup(stbFullName);
if
(
pDataBlock
->
info
.
parTbName
[
0
])
{
createTbReq
.
name
=
strdup
(
pDataBlock
->
info
.
parTbName
);
}
else
{
createTbReq
.
name
=
buildCtbNameByGroupId
(
stbFullName
,
pDataBlock
->
info
.
groupId
);
}
createTbReq
.
ctb
.
suid
=
suid
;
createTbReq
.
ctb
.
suid
=
suid
;
createTbReq
.
ctb
.
pTag
=
(
uint8_t
*
)
pTag
;
createTbReq
.
ctb
.
pTag
=
(
uint8_t
*
)
pTag
;
createTbReq
.
ctb
.
tagNum
=
taosArrayGetSize
(
tagArray
);
createTbReq
.
ctb
.
tagNum
=
taosArrayGetSize
(
tagArray
);
...
@@ -261,8 +268,8 @@ void tqTableSink(SStreamTask* pTask, void* vnode, int64_t ver, void* data) {
...
@@ -261,8 +268,8 @@ void tqTableSink(SStreamTask* pTask, void* vnode, int64_t ver, void* data) {
ASSERT
(
pTask
->
tbSink
.
pTSchema
);
ASSERT
(
pTask
->
tbSink
.
pTSchema
);
deleteReq
.
deleteReqs
=
taosArrayInit
(
0
,
sizeof
(
SSingleDeleteReq
));
deleteReq
.
deleteReqs
=
taosArrayInit
(
0
,
sizeof
(
SSingleDeleteReq
));
SSubmitReq
*
submitReq
=
tqBlockToSubmit
(
pVnode
,
pRes
,
pTask
->
tbSink
.
pTSchema
,
pTask
->
tbSink
.
pSchemaWrapper
,
true
,
pTask
->
tbSink
.
stbUid
,
SSubmitReq
*
submitReq
=
tqBlockToSubmit
(
pVnode
,
pRes
,
pTask
->
tbSink
.
pTSchema
,
pTask
->
tbSink
.
pSchemaWrapper
,
true
,
pTask
->
tbSink
.
stbFullName
,
&
deleteReq
);
pTask
->
tbSink
.
stb
Uid
,
pTask
->
tbSink
.
stb
FullName
,
&
deleteReq
);
tqDebug
(
"vgId:%d, task %d convert blocks over, put into write-queue"
,
TD_VID
(
pVnode
),
pTask
->
taskId
);
tqDebug
(
"vgId:%d, task %d convert blocks over, put into write-queue"
,
TD_VID
(
pVnode
),
pTask
->
taskId
);
...
...
source/libs/executor/inc/executil.h
浏览文件 @
2f9aeeb5
...
@@ -74,7 +74,8 @@ typedef struct SResultRowPosition {
...
@@ -74,7 +74,8 @@ typedef struct SResultRowPosition {
typedef
struct
SResKeyPos
{
typedef
struct
SResKeyPos
{
SResultRowPosition
pos
;
SResultRowPosition
pos
;
uint64_t
groupId
;
uint64_t
groupId
;
char
key
[];
// char parTbName[TSDB_TABLE_NAME_LEN];
char
key
[];
}
SResKeyPos
;
}
SResKeyPos
;
typedef
struct
SResultRowInfo
{
typedef
struct
SResultRowInfo
{
...
@@ -123,6 +124,7 @@ SArray* extractPartitionColInfo(SNodeList* pNodeList);
...
@@ -123,6 +124,7 @@ SArray* extractPartitionColInfo(SNodeList* pNodeList);
SArray
*
extractColMatchInfo
(
SNodeList
*
pNodeList
,
SDataBlockDescNode
*
pOutputNodeList
,
int32_t
*
numOfOutputCols
,
SArray
*
extractColMatchInfo
(
SNodeList
*
pNodeList
,
SDataBlockDescNode
*
pOutputNodeList
,
int32_t
*
numOfOutputCols
,
int32_t
type
);
int32_t
type
);
void
createExprFromOneNode
(
SExprInfo
*
pExp
,
SNode
*
pNode
,
int16_t
slotId
);
void
createExprFromTargetNode
(
SExprInfo
*
pExp
,
STargetNode
*
pTargetNode
);
void
createExprFromTargetNode
(
SExprInfo
*
pExp
,
STargetNode
*
pTargetNode
);
SExprInfo
*
createExprInfo
(
SNodeList
*
pNodeList
,
SNodeList
*
pGroupKeys
,
int32_t
*
numOfExprs
);
SExprInfo
*
createExprInfo
(
SNodeList
*
pNodeList
,
SNodeList
*
pGroupKeys
,
int32_t
*
numOfExprs
);
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
2f9aeeb5
...
@@ -460,6 +460,8 @@ typedef struct SPartitionBySupporter {
...
@@ -460,6 +460,8 @@ typedef struct SPartitionBySupporter {
typedef
struct
SPartitionDataInfo
{
typedef
struct
SPartitionDataInfo
{
uint64_t
groupId
;
uint64_t
groupId
;
char
*
tbname
;
SArray
*
tags
;
SArray
*
rowIds
;
SArray
*
rowIds
;
}
SPartitionDataInfo
;
}
SPartitionDataInfo
;
...
@@ -617,6 +619,7 @@ typedef struct SStreamIntervalOperatorInfo {
...
@@ -617,6 +619,7 @@ typedef struct SStreamIntervalOperatorInfo {
SArray
*
pChildren
;
SArray
*
pChildren
;
SStreamState
*
pState
;
SStreamState
*
pState
;
SWinKey
delKey
;
SWinKey
delKey
;
SHashObj
*
pGroupIdTbNameMap
;
// uint64_t -> char[TSDB_TABLE_NAME_LEN]
}
SStreamIntervalOperatorInfo
;
}
SStreamIntervalOperatorInfo
;
typedef
struct
SAggOperatorInfo
{
typedef
struct
SAggOperatorInfo
{
...
@@ -771,6 +774,7 @@ typedef struct SStreamPartitionOperatorInfo {
...
@@ -771,6 +774,7 @@ typedef struct SStreamPartitionOperatorInfo {
SOptrBasicInfo
binfo
;
SOptrBasicInfo
binfo
;
SPartitionBySupporter
partitionSup
;
SPartitionBySupporter
partitionSup
;
SExprSupp
scalarSup
;
SExprSupp
scalarSup
;
SExprSupp
tbnameCalSup
;
SHashObj
*
pPartitions
;
SHashObj
*
pPartitions
;
void
*
parIte
;
void
*
parIte
;
SSDataBlock
*
pInputDataBlock
;
SSDataBlock
*
pInputDataBlock
;
...
@@ -1085,7 +1089,7 @@ void copyUpdateDataBlock(SSDataBlock* pDest, SSDataBlock* pSource, int32_t tsCol
...
@@ -1085,7 +1089,7 @@ void copyUpdateDataBlock(SSDataBlock* pDest, SSDataBlock* pSource, int32_t tsCol
bool
groupbyTbname
(
SNodeList
*
pGroupList
);
bool
groupbyTbname
(
SNodeList
*
pGroupList
);
int32_t
generateGroupIdMap
(
STableListInfo
*
pTableListInfo
,
SReadHandle
*
pHandle
,
SNodeList
*
groupKey
);
int32_t
generateGroupIdMap
(
STableListInfo
*
pTableListInfo
,
SReadHandle
*
pHandle
,
SNodeList
*
groupKey
);
void
*
destroySqlFunctionCtx
(
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
);
void
*
destroySqlFunctionCtx
(
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
);
int32_t
buildDataBlockFromGroupRes
(
S
ExecTaskInfo
*
pTaskInfo
,
SStreamState
*
pState
,
SSDataBlock
*
pBlock
,
SExprSupp
*
pSup
,
int32_t
buildDataBlockFromGroupRes
(
S
OperatorInfo
*
pOperator
,
SStreamState
*
pState
,
SSDataBlock
*
pBlock
,
SExprSupp
*
pSup
,
SGroupResInfo
*
pGroupResInfo
);
SGroupResInfo
*
pGroupResInfo
);
int32_t
setOutputBuf
(
SStreamState
*
pState
,
STimeWindow
*
win
,
SResultRow
**
pResult
,
int64_t
tableGroupId
,
SqlFunctionCtx
*
pCtx
,
int32_t
setOutputBuf
(
SStreamState
*
pState
,
STimeWindow
*
win
,
SResultRow
**
pResult
,
int64_t
tableGroupId
,
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
,
int32_t
*
rowEntryInfoOffset
,
SAggSupporter
*
pAggSup
);
int32_t
numOfOutput
,
int32_t
*
rowEntryInfoOffset
,
SAggSupporter
*
pAggSup
);
...
...
source/libs/executor/src/executil.c
浏览文件 @
2f9aeeb5
...
@@ -1124,45 +1124,45 @@ static SColumn* createColumn(int32_t blockId, int32_t slotId, int32_t colId, SDa
...
@@ -1124,45 +1124,45 @@ static SColumn* createColumn(int32_t blockId, int32_t slotId, int32_t colId, SDa
return
pCol
;
return
pCol
;
}
}
void
createExprFrom
TargetNode
(
SExprInfo
*
pExp
,
STargetNode
*
pTargetNode
)
{
void
createExprFrom
OneNode
(
SExprInfo
*
pExp
,
SNode
*
pNode
,
int16_t
slotId
)
{
pExp
->
pExpr
=
taosMemoryCalloc
(
1
,
sizeof
(
tExprNode
));
pExp
->
pExpr
=
taosMemoryCalloc
(
1
,
sizeof
(
tExprNode
));
pExp
->
pExpr
->
_function
.
num
=
1
;
pExp
->
pExpr
->
_function
.
num
=
1
;
pExp
->
pExpr
->
_function
.
functionId
=
-
1
;
pExp
->
pExpr
->
_function
.
functionId
=
-
1
;
int32_t
type
=
nodeType
(
p
TargetNode
->
pExpr
);
int32_t
type
=
nodeType
(
p
Node
);
// it is a project query, or group by column
// it is a project query, or group by column
if
(
type
==
QUERY_NODE_COLUMN
)
{
if
(
type
==
QUERY_NODE_COLUMN
)
{
pExp
->
pExpr
->
nodeType
=
QUERY_NODE_COLUMN
;
pExp
->
pExpr
->
nodeType
=
QUERY_NODE_COLUMN
;
SColumnNode
*
pColNode
=
(
SColumnNode
*
)
p
TargetNode
->
pExpr
;
SColumnNode
*
pColNode
=
(
SColumnNode
*
)
p
Node
;
pExp
->
base
.
pParam
=
taosMemoryCalloc
(
1
,
sizeof
(
SFunctParam
));
pExp
->
base
.
pParam
=
taosMemoryCalloc
(
1
,
sizeof
(
SFunctParam
));
pExp
->
base
.
numOfParams
=
1
;
pExp
->
base
.
numOfParams
=
1
;
SDataType
*
pType
=
&
pColNode
->
node
.
resType
;
SDataType
*
pType
=
&
pColNode
->
node
.
resType
;
pExp
->
base
.
resSchema
=
createResSchema
(
pType
->
type
,
pType
->
bytes
,
pTargetNode
->
slotId
,
pType
->
scale
,
pExp
->
base
.
resSchema
=
pType
->
precision
,
pColNode
->
colName
);
createResSchema
(
pType
->
type
,
pType
->
bytes
,
slotId
,
pType
->
scale
,
pType
->
precision
,
pColNode
->
colName
);
pExp
->
base
.
pParam
[
0
].
pCol
=
pExp
->
base
.
pParam
[
0
].
pCol
=
createColumn
(
pColNode
->
dataBlockId
,
pColNode
->
slotId
,
pColNode
->
colId
,
pType
,
pColNode
->
colType
);
createColumn
(
pColNode
->
dataBlockId
,
pColNode
->
slotId
,
pColNode
->
colId
,
pType
,
pColNode
->
colType
);
pExp
->
base
.
pParam
[
0
].
type
=
FUNC_PARAM_TYPE_COLUMN
;
pExp
->
base
.
pParam
[
0
].
type
=
FUNC_PARAM_TYPE_COLUMN
;
}
else
if
(
type
==
QUERY_NODE_VALUE
)
{
}
else
if
(
type
==
QUERY_NODE_VALUE
)
{
pExp
->
pExpr
->
nodeType
=
QUERY_NODE_VALUE
;
pExp
->
pExpr
->
nodeType
=
QUERY_NODE_VALUE
;
SValueNode
*
pValNode
=
(
SValueNode
*
)
p
TargetNode
->
pExpr
;
SValueNode
*
pValNode
=
(
SValueNode
*
)
p
Node
;
pExp
->
base
.
pParam
=
taosMemoryCalloc
(
1
,
sizeof
(
SFunctParam
));
pExp
->
base
.
pParam
=
taosMemoryCalloc
(
1
,
sizeof
(
SFunctParam
));
pExp
->
base
.
numOfParams
=
1
;
pExp
->
base
.
numOfParams
=
1
;
SDataType
*
pType
=
&
pValNode
->
node
.
resType
;
SDataType
*
pType
=
&
pValNode
->
node
.
resType
;
pExp
->
base
.
resSchema
=
createResSchema
(
pType
->
type
,
pType
->
bytes
,
pTargetNode
->
slotId
,
pType
->
scale
,
pExp
->
base
.
resSchema
=
pType
->
precision
,
pValNode
->
node
.
aliasName
);
createResSchema
(
pType
->
type
,
pType
->
bytes
,
slotId
,
pType
->
scale
,
pType
->
precision
,
pValNode
->
node
.
aliasName
);
pExp
->
base
.
pParam
[
0
].
type
=
FUNC_PARAM_TYPE_VALUE
;
pExp
->
base
.
pParam
[
0
].
type
=
FUNC_PARAM_TYPE_VALUE
;
nodesValueNodeToVariant
(
pValNode
,
&
pExp
->
base
.
pParam
[
0
].
param
);
nodesValueNodeToVariant
(
pValNode
,
&
pExp
->
base
.
pParam
[
0
].
param
);
}
else
if
(
type
==
QUERY_NODE_FUNCTION
)
{
}
else
if
(
type
==
QUERY_NODE_FUNCTION
)
{
pExp
->
pExpr
->
nodeType
=
QUERY_NODE_FUNCTION
;
pExp
->
pExpr
->
nodeType
=
QUERY_NODE_FUNCTION
;
SFunctionNode
*
pFuncNode
=
(
SFunctionNode
*
)
p
TargetNode
->
pExpr
;
SFunctionNode
*
pFuncNode
=
(
SFunctionNode
*
)
p
Node
;
SDataType
*
pType
=
&
pFuncNode
->
node
.
resType
;
SDataType
*
pType
=
&
pFuncNode
->
node
.
resType
;
pExp
->
base
.
resSchema
=
createResSchema
(
pType
->
type
,
pType
->
bytes
,
pTargetNode
->
slotId
,
pType
->
scale
,
pExp
->
base
.
resSchema
=
pType
->
precision
,
pFuncNode
->
node
.
aliasName
);
createResSchema
(
pType
->
type
,
pType
->
bytes
,
slotId
,
pType
->
scale
,
pType
->
precision
,
pFuncNode
->
node
.
aliasName
);
pExp
->
pExpr
->
_function
.
functionId
=
pFuncNode
->
funcId
;
pExp
->
pExpr
->
_function
.
functionId
=
pFuncNode
->
funcId
;
pExp
->
pExpr
->
_function
.
pFunctNode
=
pFuncNode
;
pExp
->
pExpr
->
_function
.
pFunctNode
=
pFuncNode
;
...
@@ -1204,20 +1204,24 @@ void createExprFromTargetNode(SExprInfo* pExp, STargetNode* pTargetNode) {
...
@@ -1204,20 +1204,24 @@ void createExprFromTargetNode(SExprInfo* pExp, STargetNode* pTargetNode) {
}
}
}
else
if
(
type
==
QUERY_NODE_OPERATOR
)
{
}
else
if
(
type
==
QUERY_NODE_OPERATOR
)
{
pExp
->
pExpr
->
nodeType
=
QUERY_NODE_OPERATOR
;
pExp
->
pExpr
->
nodeType
=
QUERY_NODE_OPERATOR
;
SOperatorNode
*
p
Node
=
(
SOperatorNode
*
)
pTargetNode
->
pExpr
;
SOperatorNode
*
p
OpNode
=
(
SOperatorNode
*
)
pNode
;
pExp
->
base
.
pParam
=
taosMemoryCalloc
(
1
,
sizeof
(
SFunctParam
));
pExp
->
base
.
pParam
=
taosMemoryCalloc
(
1
,
sizeof
(
SFunctParam
));
pExp
->
base
.
numOfParams
=
1
;
pExp
->
base
.
numOfParams
=
1
;
SDataType
*
pType
=
&
pNode
->
node
.
resType
;
SDataType
*
pType
=
&
p
Op
Node
->
node
.
resType
;
pExp
->
base
.
resSchema
=
createResSchema
(
pType
->
type
,
pType
->
bytes
,
pTargetNode
->
slotId
,
pType
->
scale
,
pExp
->
base
.
resSchema
=
pType
->
precision
,
pNode
->
node
.
aliasName
);
createResSchema
(
pType
->
type
,
pType
->
bytes
,
slotId
,
pType
->
scale
,
pType
->
precision
,
pO
pNode
->
node
.
aliasName
);
pExp
->
pExpr
->
_optrRoot
.
pRootNode
=
p
TargetNode
->
pExpr
;
pExp
->
pExpr
->
_optrRoot
.
pRootNode
=
p
Node
;
}
else
{
}
else
{
ASSERT
(
0
);
ASSERT
(
0
);
}
}
}
}
void
createExprFromTargetNode
(
SExprInfo
*
pExp
,
STargetNode
*
pTargetNode
)
{
createExprFromOneNode
(
pExp
,
pTargetNode
->
pExpr
,
pTargetNode
->
slotId
);
}
SExprInfo
*
createExprInfo
(
SNodeList
*
pNodeList
,
SNodeList
*
pGroupKeys
,
int32_t
*
numOfExprs
)
{
SExprInfo
*
createExprInfo
(
SNodeList
*
pNodeList
,
SNodeList
*
pGroupKeys
,
int32_t
*
numOfExprs
)
{
int32_t
numOfFuncs
=
LIST_LENGTH
(
pNodeList
);
int32_t
numOfFuncs
=
LIST_LENGTH
(
pNodeList
);
int32_t
numOfGroupKeys
=
0
;
int32_t
numOfGroupKeys
=
0
;
...
...
source/libs/executor/src/executor.c
浏览文件 @
2f9aeeb5
...
@@ -49,17 +49,6 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
...
@@ -49,17 +49,6 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
SStreamScanInfo
*
pInfo
=
pOperator
->
info
;
SStreamScanInfo
*
pInfo
=
pOperator
->
info
;
#if 0
// TODO: if a block was set but not consumed,
// prevent setting a different type of block
pInfo->validBlockIndex = 0;
if (pInfo->blockType == STREAM_INPUT__DATA_BLOCK) {
taosArrayClearP(pInfo->pBlockLists, taosMemoryFree);
} else {
taosArrayClear(pInfo->pBlockLists);
}
#endif
ASSERT
(
pInfo
->
validBlockIndex
==
0
);
ASSERT
(
pInfo
->
validBlockIndex
==
0
);
ASSERT
(
taosArrayGetSize
(
pInfo
->
pBlockLists
)
==
0
);
ASSERT
(
taosArrayGetSize
(
pInfo
->
pBlockLists
)
==
0
);
...
@@ -71,30 +60,13 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
...
@@ -71,30 +60,13 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
}
}
pInfo
->
blockType
=
STREAM_INPUT__DATA_SUBMIT
;
pInfo
->
blockType
=
STREAM_INPUT__DATA_SUBMIT
;
}
else
if
(
type
==
STREAM_INPUT__DATA_SUBMIT
)
{
}
else
if
(
type
==
STREAM_INPUT__DATA_SUBMIT
)
{
/*if (tqReaderSetDataMsg(pInfo->tqReader, input, 0) < 0) {*/
/*qError("submit msg messed up when initing stream block, %s" PRIx64, id);*/
/*return TSDB_CODE_QRY_APP_ERROR;*/
/*}*/
ASSERT
(
numOfBlocks
==
1
);
ASSERT
(
numOfBlocks
==
1
);
/*if (numOfBlocks == 1) {*/
taosArrayPush
(
pInfo
->
pBlockLists
,
&
input
);
taosArrayPush
(
pInfo
->
pBlockLists
,
&
input
);
pInfo
->
blockType
=
STREAM_INPUT__DATA_SUBMIT
;
pInfo
->
blockType
=
STREAM_INPUT__DATA_SUBMIT
;
/*} else {*/
/*}*/
}
else
if
(
type
==
STREAM_INPUT__DATA_BLOCK
)
{
}
else
if
(
type
==
STREAM_INPUT__DATA_BLOCK
)
{
for
(
int32_t
i
=
0
;
i
<
numOfBlocks
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfBlocks
;
++
i
)
{
SSDataBlock
*
pDataBlock
=
&
((
SSDataBlock
*
)
input
)[
i
];
SSDataBlock
*
pDataBlock
=
&
((
SSDataBlock
*
)
input
)[
i
];
taosArrayPush
(
pInfo
->
pBlockLists
,
&
pDataBlock
);
taosArrayPush
(
pInfo
->
pBlockLists
,
&
pDataBlock
);
#if 0
// TODO optimize
SSDataBlock* p = createOneDataBlock(pDataBlock, false);
p->info = pDataBlock->info;
taosArrayClear(p->pDataBlock);
taosArrayAddAll(p->pDataBlock, pDataBlock->pDataBlock);
taosArrayPush(pInfo->pBlockLists, &p);
#endif
}
}
pInfo
->
blockType
=
STREAM_INPUT__DATA_BLOCK
;
pInfo
->
blockType
=
STREAM_INPUT__DATA_BLOCK
;
}
else
{
}
else
{
...
@@ -107,27 +79,6 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
...
@@ -107,27 +79,6 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
static
FORCE_INLINE
void
streamInputBlockDataDestory
(
void
*
pBlock
)
{
blockDataDestroy
((
SSDataBlock
*
)
pBlock
);
}
static
FORCE_INLINE
void
streamInputBlockDataDestory
(
void
*
pBlock
)
{
blockDataDestroy
((
SSDataBlock
*
)
pBlock
);
}
void
tdCleanupStreamInputDataBlock
(
qTaskInfo_t
tinfo
)
{
#if 0
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
if (!pTaskInfo || !pTaskInfo->pRoot || pTaskInfo->pRoot->numOfDownstream <= 0) {
return;
}
SOperatorInfo* pOptrInfo = pTaskInfo->pRoot->pDownstream[0];
if (pOptrInfo->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) {
SStreamScanInfo* pInfo = pOptrInfo->info;
if (pInfo->blockType == STREAM_INPUT__DATA_BLOCK) {
taosArrayClearP(pInfo->pBlockLists, streamInputBlockDataDestory);
} else {
ASSERT(0);
}
} else {
ASSERT(0);
}
#endif
}
int32_t
qSetMultiStreamInput
(
qTaskInfo_t
tinfo
,
const
void
*
pBlocks
,
size_t
numOfBlocks
,
int32_t
type
)
{
int32_t
qSetMultiStreamInput
(
qTaskInfo_t
tinfo
,
const
void
*
pBlocks
,
size_t
numOfBlocks
,
int32_t
type
)
{
if
(
tinfo
==
NULL
)
{
if
(
tinfo
==
NULL
)
{
return
TSDB_CODE_QRY_APP_ERROR
;
return
TSDB_CODE_QRY_APP_ERROR
;
...
@@ -330,8 +281,8 @@ int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bo
...
@@ -330,8 +281,8 @@ int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bo
}
}
}
}
bool
exists
=
false
;
#if 0
#if 0
bool exists = false;
for (int32_t k = 0; k < taosArrayGetSize(pListInfo->pTableList); ++k) {
for (int32_t k = 0; k < taosArrayGetSize(pListInfo->pTableList); ++k) {
STableKeyInfo* pKeyInfo = taosArrayGet(pListInfo->pTableList, k);
STableKeyInfo* pKeyInfo = taosArrayGet(pListInfo->pTableList, k);
if (pKeyInfo->uid == keyInfo.uid) {
if (pKeyInfo->uid == keyInfo.uid) {
...
@@ -339,14 +290,15 @@ int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bo
...
@@ -339,14 +290,15 @@ int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bo
exists = true;
exists = true;
}
}
}
}
#endif
if (!exists) {
if (!exists) {
taosArrayPush
(
pTaskInfo
->
tableqinfoList
.
pTableList
,
&
keyInfo
);
#endif
taosHashPut
(
pTaskInfo
->
tableqinfoList
.
map
,
uid
,
sizeof
(
uid
),
&
keyInfo
.
groupId
,
sizeof
(
keyInfo
.
groupId
)
);
taosArrayPush
(
pTaskInfo
->
tableqinfoList
.
pTableList
,
&
keyInfo
);
}
taosHashPut
(
pTaskInfo
->
tableqinfoList
.
map
,
uid
,
sizeof
(
uid
),
&
keyInfo
.
groupId
,
sizeof
(
keyInfo
.
groupId
));
}
}
/*}*/
if
(
keyBuf
!=
NULL
)
{
if
(
keyBuf
!=
NULL
)
{
taosMemoryFree
(
keyBuf
);
taosMemoryFree
(
keyBuf
);
}
}
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
2f9aeeb5
...
@@ -4214,8 +4214,9 @@ int32_t saveOutputBuf(SStreamState* pState, SWinKey* pKey, SResultRow* pResult,
...
@@ -4214,8 +4214,9 @@ int32_t saveOutputBuf(SStreamState* pState, SWinKey* pKey, SResultRow* pResult,
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
buildDataBlockFromGroupRes
(
S
ExecTaskInfo
*
pTaskInfo
,
SStreamState
*
pState
,
SSDataBlock
*
pBlock
,
SExprSupp
*
pSup
,
int32_t
buildDataBlockFromGroupRes
(
S
OperatorInfo
*
pOperator
,
SStreamState
*
pState
,
SSDataBlock
*
pBlock
,
SExprSupp
*
pSup
,
SGroupResInfo
*
pGroupResInfo
)
{
SGroupResInfo
*
pGroupResInfo
)
{
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
SExprInfo
*
pExprInfo
=
pSup
->
pExprInfo
;
SExprInfo
*
pExprInfo
=
pSup
->
pExprInfo
;
int32_t
numOfExprs
=
pSup
->
numOfExprs
;
int32_t
numOfExprs
=
pSup
->
numOfExprs
;
int32_t
*
rowEntryOffset
=
pSup
->
rowEntryInfoOffset
;
int32_t
*
rowEntryOffset
=
pSup
->
rowEntryInfoOffset
;
...
@@ -4244,6 +4245,11 @@ int32_t buildDataBlockFromGroupRes(SExecTaskInfo* pTaskInfo, SStreamState* pStat
...
@@ -4244,6 +4245,11 @@ int32_t buildDataBlockFromGroupRes(SExecTaskInfo* pTaskInfo, SStreamState* pStat
if
(
pBlock
->
info
.
groupId
==
0
)
{
if
(
pBlock
->
info
.
groupId
==
0
)
{
pBlock
->
info
.
groupId
=
pPos
->
groupId
;
pBlock
->
info
.
groupId
=
pPos
->
groupId
;
SStreamIntervalOperatorInfo
*
pInfo
=
pOperator
->
info
;
char
*
tbname
=
taosHashGet
(
pInfo
->
pGroupIdTbNameMap
,
&
pBlock
->
info
.
groupId
,
sizeof
(
int64_t
));
if
(
tbname
!=
NULL
)
{
memcpy
(
pBlock
->
info
.
parTbName
,
tbname
,
TSDB_TABLE_NAME_LEN
);
}
}
else
{
}
else
{
// current value belongs to different group, it can't be packed into one datablock
// current value belongs to different group, it can't be packed into one datablock
if
(
pBlock
->
info
.
groupId
!=
pPos
->
groupId
)
{
if
(
pBlock
->
info
.
groupId
!=
pPos
->
groupId
)
{
...
...
source/libs/executor/src/groupoperator.c
浏览文件 @
2f9aeeb5
...
@@ -873,6 +873,26 @@ static SSDataBlock* buildStreamPartitionResult(SOperatorInfo* pOperator) {
...
@@ -873,6 +873,26 @@ static SSDataBlock* buildStreamPartitionResult(SOperatorInfo* pOperator) {
colDataAppend
(
pDestCol
,
pDest
->
info
.
rows
,
pSrcData
,
isNull
);
colDataAppend
(
pDestCol
,
pDest
->
info
.
rows
,
pSrcData
,
isNull
);
}
}
pDest
->
info
.
rows
++
;
pDest
->
info
.
rows
++
;
if
(
i
==
0
)
{
SSDataBlock
*
pTmpBlock
=
blockCopyOneRow
(
pSrc
,
rowIndex
);
SSDataBlock
*
pResBlock
=
createDataBlock
();
pResBlock
->
info
.
rowSize
=
TSDB_TABLE_NAME_LEN
;
SColumnInfoData
data
=
createColumnInfoData
(
TSDB_DATA_TYPE_VARCHAR
,
TSDB_TABLE_NAME_LEN
,
0
);
taosArrayPush
(
pResBlock
->
pDataBlock
,
&
data
);
blockDataEnsureCapacity
(
pResBlock
,
1
);
projectApplyFunctions
(
pInfo
->
tbnameCalSup
.
pExprInfo
,
pResBlock
,
pTmpBlock
,
pInfo
->
tbnameCalSup
.
pCtx
,
1
,
NULL
);
ASSERT
(
pResBlock
->
info
.
rows
==
1
);
ASSERT
(
taosArrayGetSize
(
pResBlock
->
pDataBlock
)
==
1
);
SColumnInfoData
*
pCol
=
taosArrayGet
(
pResBlock
->
pDataBlock
,
0
);
ASSERT
(
pCol
->
info
.
type
==
TSDB_DATA_TYPE_VARCHAR
);
void
*
pData
=
colDataGetData
(
pCol
,
0
);
// TODO check tbname validation
if
(
pData
!=
(
void
*
)
-
1
)
{
memcpy
(
pDest
->
info
.
parTbName
,
varDataVal
(
pData
),
varDataLen
(
pData
));
}
else
{
pDest
->
info
.
parTbName
[
0
]
=
0
;
}
}
}
}
blockDataUpdateTsWindow
(
pDest
,
pInfo
->
tsColIndex
);
blockDataUpdateTsWindow
(
pDest
,
pInfo
->
tsColIndex
);
pDest
->
info
.
groupId
=
pParInfo
->
groupId
;
pDest
->
info
.
groupId
=
pParInfo
->
groupId
;
...
@@ -895,6 +915,7 @@ static void doStreamHashPartitionImpl(SStreamPartitionOperatorInfo* pInfo, SSDat
...
@@ -895,6 +915,7 @@ static void doStreamHashPartitionImpl(SStreamPartitionOperatorInfo* pInfo, SSDat
}
else
{
}
else
{
SPartitionDataInfo
newParData
=
{
0
};
SPartitionDataInfo
newParData
=
{
0
};
newParData
.
groupId
=
calcGroupId
(
pInfo
->
partitionSup
.
keyBuf
,
keyLen
);
newParData
.
groupId
=
calcGroupId
(
pInfo
->
partitionSup
.
keyBuf
,
keyLen
);
/*newParData.tbname = */
newParData
.
rowIds
=
taosArrayInit
(
64
,
sizeof
(
int32_t
));
newParData
.
rowIds
=
taosArrayInit
(
64
,
sizeof
(
int32_t
));
taosArrayPush
(
newParData
.
rowIds
,
&
i
);
taosArrayPush
(
newParData
.
rowIds
,
&
i
);
taosHashPut
(
pInfo
->
pPartitions
,
pInfo
->
partitionSup
.
keyBuf
,
keyLen
,
&
newParData
,
sizeof
(
SPartitionDataInfo
));
taosHashPut
(
pInfo
->
pPartitions
,
pInfo
->
partitionSup
.
keyBuf
,
keyLen
,
&
newParData
,
sizeof
(
SPartitionDataInfo
));
...
@@ -1000,6 +1021,20 @@ SOperatorInfo* createStreamPartitionOperatorInfo(SOperatorInfo* downstream, SStr
...
@@ -1000,6 +1021,20 @@ SOperatorInfo* createStreamPartitionOperatorInfo(SOperatorInfo* downstream, SStr
}
}
}
}
if
(
pPartNode
->
pSubtable
!=
NULL
)
{
SExprInfo
*
pSubTableExpr
=
taosMemoryCalloc
(
1
,
sizeof
(
SExprInfo
));
if
(
pSubTableExpr
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_error
;
}
pInfo
->
tbnameCalSup
.
pExprInfo
=
pSubTableExpr
;
createExprFromOneNode
(
pSubTableExpr
,
pPartNode
->
pSubtable
,
0
);
code
=
initExprSupp
(
&
pInfo
->
tbnameCalSup
,
pSubTableExpr
,
1
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
}
int32_t
keyLen
=
0
;
int32_t
keyLen
=
0
;
code
=
initGroupOptrInfo
(
&
pInfo
->
partitionSup
.
pGroupColVals
,
&
keyLen
,
&
pInfo
->
partitionSup
.
keyBuf
,
code
=
initGroupOptrInfo
(
&
pInfo
->
partitionSup
.
pGroupColVals
,
&
keyLen
,
&
pInfo
->
partitionSup
.
keyBuf
,
pInfo
->
partitionSup
.
pGroupCols
);
pInfo
->
partitionSup
.
pGroupCols
);
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
2f9aeeb5
...
@@ -924,29 +924,9 @@ _error:
...
@@ -924,29 +924,9 @@ _error:
return
NULL
;
return
NULL
;
}
}
static
void
doClearBufferedBlocks
(
SStreamScanInfo
*
pInfo
)
{
static
FORCE_INLINE
void
doClearBufferedBlocks
(
SStreamScanInfo
*
pInfo
)
{
#if 0
if (pInfo->blockType == STREAM_INPUT__DATA_BLOCK) {
size_t total = taosArrayGetSize(pInfo->pBlockLists);
for (int32_t i = 0; i < total; i++) {
SSDataBlock* p = taosArrayGetP(pInfo->pBlockLists, i);
taosArrayDestroy(p->pDataBlock);
taosMemoryFree(p);
}
}
#endif
taosArrayClear
(
pInfo
->
pBlockLists
);
taosArrayClear
(
pInfo
->
pBlockLists
);
pInfo
->
validBlockIndex
=
0
;
pInfo
->
validBlockIndex
=
0
;
#if 0
size_t total = taosArrayGetSize(pInfo->pBlockLists);
pInfo->validBlockIndex = 0;
for (int32_t i = 0; i < total; ++i) {
SSDataBlock* p = taosArrayGetP(pInfo->pBlockLists, i);
blockDataDestroy(p);
}
taosArrayClear(pInfo->pBlockLists);
#endif
}
}
static
bool
isSessionWindow
(
SStreamScanInfo
*
pInfo
)
{
static
bool
isSessionWindow
(
SStreamScanInfo
*
pInfo
)
{
...
...
source/libs/executor/src/timewindowoperator.c
浏览文件 @
2f9aeeb5
...
@@ -1536,6 +1536,7 @@ static int32_t closeStreamIntervalWindow(SSHashObj* pHashMap, STimeWindowAggSupp
...
@@ -1536,6 +1536,7 @@ static int32_t closeStreamIntervalWindow(SSHashObj* pHashMap, STimeWindowAggSupp
}
}
}
}
tSimpleHashIterateRemove
(
pHashMap
,
pWinKey
,
sizeof
(
SWinKey
),
&
pIte
,
&
iter
);
tSimpleHashIterateRemove
(
pHashMap
,
pWinKey
,
sizeof
(
SWinKey
),
&
pIte
,
&
iter
);
/*taosHashRemove(pInfo->pGroupIdTbNameMap, &pWinKey->groupId, sizeof(int64_t));*/
}
}
}
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -3045,7 +3046,7 @@ void doBuildResult(SOperatorInfo* pOperator, SStreamState* pState, SSDataBlock*
...
@@ -3045,7 +3046,7 @@ void doBuildResult(SOperatorInfo* pOperator, SStreamState* pState, SSDataBlock*
// clear the existed group id
// clear the existed group id
pBlock
->
info
.
groupId
=
0
;
pBlock
->
info
.
groupId
=
0
;
buildDataBlockFromGroupRes
(
p
TaskInfo
,
pState
,
pBlock
,
&
pOperator
->
exprSupp
,
pGroupResInfo
);
buildDataBlockFromGroupRes
(
p
Operator
,
pState
,
pBlock
,
&
pOperator
->
exprSupp
,
pGroupResInfo
);
}
}
static
void
doStreamIntervalAggImpl
(
SOperatorInfo
*
pOperatorInfo
,
SSDataBlock
*
pSDataBlock
,
uint64_t
groupId
,
static
void
doStreamIntervalAggImpl
(
SOperatorInfo
*
pOperatorInfo
,
SSDataBlock
*
pSDataBlock
,
uint64_t
groupId
,
...
@@ -3240,6 +3241,11 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
...
@@ -3240,6 +3241,11 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
}
}
printDataBlock
(
pBlock
,
IS_FINAL_OP
(
pInfo
)
?
"interval final recv"
:
"interval semi recv"
);
printDataBlock
(
pBlock
,
IS_FINAL_OP
(
pInfo
)
?
"interval final recv"
:
"interval semi recv"
);
if
(
pBlock
->
info
.
parTbName
[
0
])
{
taosHashPut
(
pInfo
->
pGroupIdTbNameMap
,
&
pBlock
->
info
.
groupId
,
sizeof
(
int64_t
),
&
pBlock
->
info
.
parTbName
,
TSDB_TABLE_NAME_LEN
);
}
ASSERT
(
pBlock
->
info
.
type
!=
STREAM_INVERT
);
ASSERT
(
pBlock
->
info
.
type
!=
STREAM_INVERT
);
if
(
pBlock
->
info
.
type
==
STREAM_NORMAL
||
pBlock
->
info
.
type
==
STREAM_PULL_DATA
)
{
if
(
pBlock
->
info
.
type
==
STREAM_NORMAL
||
pBlock
->
info
.
type
==
STREAM_PULL_DATA
)
{
pInfo
->
binfo
.
pRes
->
info
.
type
=
pBlock
->
info
.
type
;
pInfo
->
binfo
.
pRes
->
info
.
type
=
pBlock
->
info
.
type
;
...
@@ -3477,6 +3483,9 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream,
...
@@ -3477,6 +3483,9 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream,
pInfo
->
delKey
.
ts
=
INT64_MAX
;
pInfo
->
delKey
.
ts
=
INT64_MAX
;
pInfo
->
delKey
.
groupId
=
0
;
pInfo
->
delKey
.
groupId
=
0
;
pInfo
->
pGroupIdTbNameMap
=
taosHashInit
(
1024
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_UBIGINT
),
false
,
HASH_NO_LOCK
);
pOperator
->
operatorType
=
pPhyNode
->
type
;
pOperator
->
operatorType
=
pPhyNode
->
type
;
pOperator
->
blocking
=
true
;
pOperator
->
blocking
=
true
;
pOperator
->
status
=
OP_NOT_OPENED
;
pOperator
->
status
=
OP_NOT_OPENED
;
...
@@ -5659,6 +5668,11 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
...
@@ -5659,6 +5668,11 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
}
}
printDataBlock
(
pBlock
,
"single interval recv"
);
printDataBlock
(
pBlock
,
"single interval recv"
);
if
(
pBlock
->
info
.
parTbName
[
0
])
{
taosHashPut
(
pInfo
->
pGroupIdTbNameMap
,
&
pBlock
->
info
.
groupId
,
sizeof
(
int64_t
),
&
pBlock
->
info
.
parTbName
,
TSDB_TABLE_NAME_LEN
);
}
if
(
pBlock
->
info
.
type
==
STREAM_CLEAR
)
{
if
(
pBlock
->
info
.
type
==
STREAM_CLEAR
)
{
doDeleteWindows
(
pOperator
,
&
pInfo
->
interval
,
pOperator
->
exprSupp
.
numOfExprs
,
pBlock
,
NULL
,
NULL
);
doDeleteWindows
(
pOperator
,
&
pInfo
->
interval
,
pOperator
->
exprSupp
.
numOfExprs
,
pBlock
,
NULL
,
NULL
);
qDebug
(
"%s clear existed time window results for updates checked"
,
GET_TASKID
(
pTaskInfo
));
qDebug
(
"%s clear existed time window results for updates checked"
,
GET_TASKID
(
pTaskInfo
));
...
@@ -5806,6 +5820,9 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhys
...
@@ -5806,6 +5820,9 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhys
pInfo
->
delKey
.
ts
=
INT64_MAX
;
pInfo
->
delKey
.
ts
=
INT64_MAX
;
pInfo
->
delKey
.
groupId
=
0
;
pInfo
->
delKey
.
groupId
=
0
;
pInfo
->
pGroupIdTbNameMap
=
taosHashInit
(
1024
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_UBIGINT
),
false
,
HASH_NO_LOCK
);
pOperator
->
name
=
"StreamIntervalOperator"
;
pOperator
->
name
=
"StreamIntervalOperator"
;
pOperator
->
operatorType
=
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL
;
pOperator
->
operatorType
=
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL
;
pOperator
->
blocking
=
true
;
pOperator
->
blocking
=
true
;
...
...
source/libs/parser/src/parInsert.c
浏览文件 @
2f9aeeb5
...
@@ -783,7 +783,7 @@ static void buildCreateTbReq(SVCreateTbReq* pTbReq, const char* tname, STag* pTa
...
@@ -783,7 +783,7 @@ static void buildCreateTbReq(SVCreateTbReq* pTbReq, const char* tname, STag* pTa
pTbReq
->
name
=
strdup
(
tname
);
pTbReq
->
name
=
strdup
(
tname
);
pTbReq
->
ctb
.
suid
=
suid
;
pTbReq
->
ctb
.
suid
=
suid
;
pTbReq
->
ctb
.
tagNum
=
tagNum
;
pTbReq
->
ctb
.
tagNum
=
tagNum
;
if
(
sname
)
pTbReq
->
ctb
.
n
ame
=
strdup
(
sname
);
if
(
sname
)
pTbReq
->
ctb
.
stbN
ame
=
strdup
(
sname
);
pTbReq
->
ctb
.
pTag
=
(
uint8_t
*
)
pTag
;
pTbReq
->
ctb
.
pTag
=
(
uint8_t
*
)
pTag
;
pTbReq
->
ctb
.
tagName
=
taosArrayDup
(
tagName
);
pTbReq
->
ctb
.
tagName
=
taosArrayDup
(
tagName
);
pTbReq
->
ttl
=
TSDB_DEFAULT_TABLE_TTL
;
pTbReq
->
ttl
=
TSDB_DEFAULT_TABLE_TTL
;
...
@@ -2469,9 +2469,9 @@ int32_t smlBindData(void* handle, SArray* tags, SArray* colsSchema, SArray* cols
...
@@ -2469,9 +2469,9 @@ int32_t smlBindData(void* handle, SArray* tags, SArray* colsSchema, SArray* cols
pTableMeta
->
tableInfo
.
numOfTags
);
pTableMeta
->
tableInfo
.
numOfTags
);
taosArrayDestroy
(
tagName
);
taosArrayDestroy
(
tagName
);
smlHandle
->
tableExecHandle
.
createTblReq
.
ctb
.
n
ame
=
taosMemoryMalloc
(
sTableNameLen
+
1
);
smlHandle
->
tableExecHandle
.
createTblReq
.
ctb
.
stbN
ame
=
taosMemoryMalloc
(
sTableNameLen
+
1
);
memcpy
(
smlHandle
->
tableExecHandle
.
createTblReq
.
ctb
.
n
ame
,
sTableName
,
sTableNameLen
);
memcpy
(
smlHandle
->
tableExecHandle
.
createTblReq
.
ctb
.
stbN
ame
,
sTableName
,
sTableNameLen
);
smlHandle
->
tableExecHandle
.
createTblReq
.
ctb
.
n
ame
[
sTableNameLen
]
=
0
;
smlHandle
->
tableExecHandle
.
createTblReq
.
ctb
.
stbN
ame
[
sTableNameLen
]
=
0
;
STableDataBlocks
*
pDataBlock
=
NULL
;
STableDataBlocks
*
pDataBlock
=
NULL
;
ret
=
getDataBlockFromList
(
smlHandle
->
pBlockHash
,
&
pTableMeta
->
uid
,
sizeof
(
pTableMeta
->
uid
),
ret
=
getDataBlockFromList
(
smlHandle
->
pBlockHash
,
&
pTableMeta
->
uid
,
sizeof
(
pTableMeta
->
uid
),
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
2f9aeeb5
...
@@ -5381,9 +5381,9 @@ static EDealRes rewriteSubtable(SNode** pNode, void* pContext) {
...
@@ -5381,9 +5381,9 @@ static EDealRes rewriteSubtable(SNode** pNode, void* pContext) {
found
=
true
;
found
=
true
;
break
;
break
;
}
}
if
(
!
found
)
{
}
return
generateDealNodeErrMsg
(
pCxt
->
pCxt
,
TSDB_CODE_PAR_INVALID_COLUMN
,
((
SColumnNode
*
)
*
pNode
)
->
colName
);
if
(
!
found
)
{
}
return
generateDealNodeErrMsg
(
pCxt
->
pCxt
,
TSDB_CODE_PAR_INVALID_COLUMN
,
((
SColumnNode
*
)
*
pNode
)
->
colName
);
}
}
return
DEAL_RES_IGNORE_CHILD
;
return
DEAL_RES_IGNORE_CHILD
;
}
}
...
@@ -6454,7 +6454,7 @@ static void addCreateTbReqIntoVgroup(int32_t acctId, SHashObj* pVgroupHashmap, S
...
@@ -6454,7 +6454,7 @@ static void addCreateTbReqIntoVgroup(int32_t acctId, SHashObj* pVgroupHashmap, S
}
}
req
.
ctb
.
suid
=
suid
;
req
.
ctb
.
suid
=
suid
;
req
.
ctb
.
tagNum
=
tagNum
;
req
.
ctb
.
tagNum
=
tagNum
;
req
.
ctb
.
n
ame
=
strdup
(
sTableNmae
);
req
.
ctb
.
stbN
ame
=
strdup
(
sTableNmae
);
req
.
ctb
.
pTag
=
(
uint8_t
*
)
pTag
;
req
.
ctb
.
pTag
=
(
uint8_t
*
)
pTag
;
req
.
ctb
.
tagName
=
taosArrayDup
(
tagName
);
req
.
ctb
.
tagName
=
taosArrayDup
(
tagName
);
if
(
pStmt
->
ignoreExists
)
{
if
(
pStmt
->
ignoreExists
)
{
...
...
source/libs/stream/src/streamData.c
浏览文件 @
2f9aeeb5
...
@@ -35,6 +35,7 @@ int32_t streamDispatchReqToData(const SStreamDispatchReq* pReq, SStreamDataBlock
...
@@ -35,6 +35,7 @@ int32_t streamDispatchReqToData(const SStreamDispatchReq* pReq, SStreamDataBlock
pDataBlock
->
info
.
window
.
ekey
=
be64toh
(
pRetrieve
->
ekey
);
pDataBlock
->
info
.
window
.
ekey
=
be64toh
(
pRetrieve
->
ekey
);
pDataBlock
->
info
.
version
=
be64toh
(
pRetrieve
->
version
);
pDataBlock
->
info
.
version
=
be64toh
(
pRetrieve
->
version
);
pDataBlock
->
info
.
watermark
=
be64toh
(
pRetrieve
->
watermark
);
pDataBlock
->
info
.
watermark
=
be64toh
(
pRetrieve
->
watermark
);
memcpy
(
pDataBlock
->
info
.
parTbName
,
pRetrieve
->
parTbName
,
TSDB_TABLE_NAME_LEN
);
pDataBlock
->
info
.
type
=
pRetrieve
->
streamBlockType
;
pDataBlock
->
info
.
type
=
pRetrieve
->
streamBlockType
;
pDataBlock
->
info
.
childId
=
pReq
->
upstreamChildId
;
pDataBlock
->
info
.
childId
=
pReq
->
upstreamChildId
;
...
...
source/libs/stream/src/streamDispatch.c
浏览文件 @
2f9aeeb5
...
@@ -195,6 +195,7 @@ static int32_t streamAddBlockToDispatchMsg(const SSDataBlock* pBlock, SStreamDis
...
@@ -195,6 +195,7 @@ static int32_t streamAddBlockToDispatchMsg(const SSDataBlock* pBlock, SStreamDis
pRetrieve
->
ekey
=
htobe64
(
pBlock
->
info
.
window
.
ekey
);
pRetrieve
->
ekey
=
htobe64
(
pBlock
->
info
.
window
.
ekey
);
pRetrieve
->
version
=
htobe64
(
pBlock
->
info
.
version
);
pRetrieve
->
version
=
htobe64
(
pBlock
->
info
.
version
);
pRetrieve
->
watermark
=
htobe64
(
pBlock
->
info
.
watermark
);
pRetrieve
->
watermark
=
htobe64
(
pBlock
->
info
.
watermark
);
memcpy
(
pRetrieve
->
parTbName
,
pBlock
->
info
.
parTbName
,
TSDB_TABLE_NAME_LEN
);
int32_t
numOfCols
=
(
int32_t
)
taosArrayGetSize
(
pBlock
->
pDataBlock
);
int32_t
numOfCols
=
(
int32_t
)
taosArrayGetSize
(
pBlock
->
pDataBlock
);
pRetrieve
->
numOfCols
=
htonl
(
numOfCols
);
pRetrieve
->
numOfCols
=
htonl
(
numOfCols
);
...
@@ -250,7 +251,13 @@ FAIL:
...
@@ -250,7 +251,13 @@ FAIL:
int32_t
streamSearchAndAddBlock
(
SStreamTask
*
pTask
,
SStreamDispatchReq
*
pReqs
,
SSDataBlock
*
pDataBlock
,
int32_t
vgSz
,
int32_t
streamSearchAndAddBlock
(
SStreamTask
*
pTask
,
SStreamDispatchReq
*
pReqs
,
SSDataBlock
*
pDataBlock
,
int32_t
vgSz
,
int64_t
groupId
)
{
int64_t
groupId
)
{
char
*
ctbName
=
buildCtbNameByGroupId
(
pTask
->
shuffleDispatcher
.
stbFullName
,
groupId
);
char
*
ctbName
;
if
(
pDataBlock
->
info
.
parTbName
[
0
])
{
ctbName
=
taosMemoryCalloc
(
1
,
TSDB_TABLE_NAME_LEN
);
snprintf
(
ctbName
,
TSDB_TABLE_NAME_LEN
,
"%s.%s"
,
pTask
->
shuffleDispatcher
.
dbInfo
.
db
,
pDataBlock
->
info
.
parTbName
);
}
else
{
ctbName
=
buildCtbNameByGroupId
(
pTask
->
shuffleDispatcher
.
stbFullName
,
groupId
);
}
SArray
*
vgInfo
=
pTask
->
shuffleDispatcher
.
dbInfo
.
pVgroupInfos
;
SArray
*
vgInfo
=
pTask
->
shuffleDispatcher
.
dbInfo
.
pVgroupInfos
;
/*uint32_t hashValue = MurmurHash3_32(ctbName, strlen(ctbName));*/
/*uint32_t hashValue = MurmurHash3_32(ctbName, strlen(ctbName));*/
...
...
source/libs/stream/src/streamState.c
浏览文件 @
2f9aeeb5
...
@@ -60,6 +60,7 @@ SStreamState* streamStateOpen(char* path, SStreamTask* pTask, bool specPath) {
...
@@ -60,6 +60,7 @@ SStreamState* streamStateOpen(char* path, SStreamTask* pTask, bool specPath) {
if
(
!
specPath
)
{
if
(
!
specPath
)
{
sprintf
(
statePath
,
"%s/%d"
,
path
,
pTask
->
taskId
);
sprintf
(
statePath
,
"%s/%d"
,
path
,
pTask
->
taskId
);
}
else
{
}
else
{
memset
(
statePath
,
0
,
300
);
strncpy
(
statePath
,
path
,
300
);
strncpy
(
statePath
,
path
,
300
);
}
}
if
(
tdbOpen
(
statePath
,
4096
,
256
,
&
pState
->
db
)
<
0
)
{
if
(
tdbOpen
(
statePath
,
4096
,
256
,
&
pState
->
db
)
<
0
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录