Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
108b9ee1
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
108b9ee1
编写于
4月 28, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(stream): support perf schema
上级
1c8910de
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
82 addition
and
77 deletion
+82
-77
source/client/inc/clientInt.h
source/client/inc/clientInt.h
+0
-1
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+3
-2
source/dnode/mnode/impl/src/mndConsumer.c
source/dnode/mnode/impl/src/mndConsumer.c
+1
-0
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+2
-2
source/dnode/mnode/impl/src/mndDef.c
source/dnode/mnode/impl/src/mndDef.c
+2
-2
source/dnode/mnode/impl/src/mndInfoSchema.c
source/dnode/mnode/impl/src/mndInfoSchema.c
+1
-10
source/dnode/mnode/impl/src/mndPerfSchema.c
source/dnode/mnode/impl/src/mndPerfSchema.c
+12
-0
source/dnode/mnode/impl/src/mndScheduler.c
source/dnode/mnode/impl/src/mndScheduler.c
+1
-1
source/dnode/mnode/impl/src/mndSma.c
source/dnode/mnode/impl/src/mndSma.c
+11
-11
source/dnode/mnode/impl/src/mndStream.c
source/dnode/mnode/impl/src/mndStream.c
+39
-42
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+10
-5
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+0
-1
未找到文件。
source/client/inc/clientInt.h
浏览文件 @
108b9ee1
...
...
@@ -188,7 +188,6 @@ typedef struct SRequestSendRecvBody {
typedef
struct
{
int8_t
resType
;
int32_t
code
;
char
topic
[
TSDB_TOPIC_FNAME_LEN
];
int32_t
vgId
;
SSchemaWrapper
schema
;
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
108b9ee1
...
...
@@ -582,8 +582,9 @@ typedef struct {
typedef
struct
{
char
name
[
TSDB_TOPIC_FNAME_LEN
];
char
db
[
TSDB_DB_FNAME_LEN
];
char
outputSTbName
[
TSDB_TABLE_FNAME_LEN
];
char
sourceDb
[
TSDB_DB_FNAME_LEN
];
char
targetDb
[
TSDB_DB_FNAME_LEN
];
char
targetSTbName
[
TSDB_TABLE_FNAME_LEN
];
int64_t
createTime
;
int64_t
updateTime
;
int64_t
uid
;
...
...
source/dnode/mnode/impl/src/mndConsumer.c
浏览文件 @
108b9ee1
...
...
@@ -812,6 +812,7 @@ static int32_t mndRetrieveConsumer(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
status
,
false
);
// subscribed topics
// TODO: split into multiple rows
char
topics
[
TSDB_SHOW_LIST_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
char
*
showStr
=
taosShowStrArray
(
pConsumer
->
assignedTopics
);
tstrncpy
(
varDataVal
(
topics
),
showStr
,
TSDB_SHOW_LIST_LEN
);
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
108b9ee1
...
...
@@ -1501,8 +1501,8 @@ static void dumpDbInfoData(SSDataBlock *pBlock, SDbObj *pDb, SShowObj *pShow, in
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
singleSTable
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
streamMode
,
false
);
/*pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);*/
/*colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.streamMode, false);*/
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
b
,
false
);
...
...
source/dnode/mnode/impl/src/mndDef.c
浏览文件 @
108b9ee1
...
...
@@ -410,7 +410,7 @@ int32_t tEncodeSStreamObj(SCoder *pEncoder, const SStreamObj *pObj) {
int32_t
sz
=
0
;
/*int32_t outputNameSz = 0;*/
if
(
tEncodeCStr
(
pEncoder
,
pObj
->
name
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pEncoder
,
pObj
->
d
b
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pEncoder
,
pObj
->
sourceD
b
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pEncoder
,
pObj
->
createTime
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pEncoder
,
pObj
->
updateTime
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pEncoder
,
pObj
->
uid
)
<
0
)
return
-
1
;
...
...
@@ -456,7 +456,7 @@ int32_t tEncodeSStreamObj(SCoder *pEncoder, const SStreamObj *pObj) {
int32_t
tDecodeSStreamObj
(
SCoder
*
pDecoder
,
SStreamObj
*
pObj
)
{
if
(
tDecodeCStrTo
(
pDecoder
,
pObj
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
pDecoder
,
pObj
->
d
b
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
pDecoder
,
pObj
->
sourceD
b
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pObj
->
createTime
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pObj
->
updateTime
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pObj
->
uid
)
<
0
)
return
-
1
;
...
...
source/dnode/mnode/impl/src/mndInfoSchema.c
浏览文件 @
108b9ee1
...
...
@@ -89,7 +89,7 @@ static const SInfosTableSchema userDBSchema[] = {
{.
name
=
"precision"
,
.
bytes
=
2
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"ttl"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"single_stable"
,
.
bytes
=
1
,
.
type
=
TSDB_DATA_TYPE_TINYINT
},
{.
name
=
"stream_mode"
,
.
bytes
=
1
,
.
type
=
TSDB_DATA_TYPE_TINYINT
},
/*{.name = "stream_mode", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT},*/
{.
name
=
"status"
,
.
bytes
=
10
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
// {.name = "update", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, // disable update
};
...
...
@@ -124,14 +124,6 @@ static const SInfosTableSchema userStbsSchema[] = {
{.
name
=
"table_comment"
,
.
bytes
=
1024
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
};
static
const
SInfosTableSchema
userStreamsSchema
[]
=
{
{.
name
=
"stream_name"
,
.
bytes
=
SYSTABLE_SCH_DB_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"user_name"
,
.
bytes
=
23
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"dest_table"
,
.
bytes
=
SYSTABLE_SCH_DB_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
{.
name
=
"sql"
,
.
bytes
=
1024
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
};
static
const
SInfosTableSchema
userTblsSchema
[]
=
{
{.
name
=
"table_name"
,
.
bytes
=
SYSTABLE_SCH_TABLE_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"db_name"
,
.
bytes
=
SYSTABLE_SCH_DB_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
...
...
@@ -259,7 +251,6 @@ static const SInfosTableMeta infosMeta[] = {
{
TSDB_INS_TABLE_USER_FUNCTIONS
,
userFuncSchema
,
tListLen
(
userFuncSchema
)},
{
TSDB_INS_TABLE_USER_INDEXES
,
userIdxSchema
,
tListLen
(
userIdxSchema
)},
{
TSDB_INS_TABLE_USER_STABLES
,
userStbsSchema
,
tListLen
(
userStbsSchema
)},
{
TSDB_INS_TABLE_USER_STREAMS
,
userStreamsSchema
,
tListLen
(
userStreamsSchema
)},
{
TSDB_INS_TABLE_USER_TABLES
,
userTblsSchema
,
tListLen
(
userTblsSchema
)},
{
TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED
,
userTblDistSchema
,
tListLen
(
userTblDistSchema
)},
{
TSDB_INS_TABLE_USER_USERS
,
userUsersSchema
,
tListLen
(
userUsersSchema
)},
...
...
source/dnode/mnode/impl/src/mndPerfSchema.c
浏览文件 @
108b9ee1
...
...
@@ -76,6 +76,18 @@ static const SPerfsTableSchema offsetSchema[] = {
{.
name
=
"skip_log_cnt"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_BIGINT
},
};
static
const
SPerfsTableSchema
streamSchema
[]
=
{
{.
name
=
"stream_name"
,
.
bytes
=
SYSTABLE_SCH_DB_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
{.
name
=
"sql"
,
.
bytes
=
TSDB_SHOW_SQL_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"status"
,
.
bytes
=
20
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"source_db"
,
.
bytes
=
SYSTABLE_SCH_DB_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"target_db"
,
.
bytes
=
SYSTABLE_SCH_DB_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"target_table"
,
.
bytes
=
SYSTABLE_SCH_TABLE_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"watermark"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_BIGINT
},
{.
name
=
"trigger"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
};
static
const
SPerfsTableMeta
perfsMeta
[]
=
{
{
TSDB_PERFS_TABLE_CONNECTIONS
,
connectionsSchema
,
tListLen
(
connectionsSchema
)},
{
TSDB_PERFS_TABLE_QUERIES
,
queriesSchema
,
tListLen
(
queriesSchema
)},
...
...
source/dnode/mnode/impl/src/mndScheduler.c
浏览文件 @
108b9ee1
...
...
@@ -382,7 +382,7 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
pTask
->
dispatchType
=
TASK_DISPATCH__SHUFFLE
;
pTask
->
dispatchMsgType
=
TDMT_VND_TASK_WRITE_EXEC
;
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pStream
->
d
b
);
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pStream
->
sourceD
b
);
ASSERT
(
pDb
);
if
(
mndExtractDbInfo
(
pMnode
,
pDb
,
&
pTask
->
shuffleDispatcher
.
dbInfo
,
NULL
)
<
0
)
{
sdbRelease
(
pSdb
,
pDb
);
...
...
source/dnode/mnode/impl/src/mndSma.c
浏览文件 @
108b9ee1
...
...
@@ -40,7 +40,7 @@ static int32_t mndProcessMCreateSmaReq(SNodeMsg *pReq);
static
int32_t
mndProcessMDropSmaReq
(
SNodeMsg
*
pReq
);
static
int32_t
mndProcessVCreateSmaRsp
(
SNodeMsg
*
pRsp
);
static
int32_t
mndProcessVDropSmaRsp
(
SNodeMsg
*
pRsp
);
static
int32_t
mndRetrieveSma
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
int32_t
mndRetrieveSma
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextSma
(
SMnode
*
pMnode
,
void
*
pIter
);
int32_t
mndInitSma
(
SMnode
*
pMnode
)
{
...
...
@@ -406,7 +406,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SNodeMsg *pReq, SMCreateSmaReq *pCre
SStreamObj
streamObj
=
{
0
};
tstrncpy
(
streamObj
.
name
,
pCreate
->
name
,
TSDB_STREAM_FNAME_LEN
);
tstrncpy
(
streamObj
.
d
b
,
pDb
->
name
,
TSDB_DB_FNAME_LEN
);
tstrncpy
(
streamObj
.
sourceD
b
,
pDb
->
name
,
TSDB_DB_FNAME_LEN
);
streamObj
.
createTime
=
taosGetTimestampMs
();
streamObj
.
updateTime
=
streamObj
.
createTime
;
streamObj
.
uid
=
mndGenerateUid
(
pCreate
->
name
,
strlen
(
pCreate
->
name
));
...
...
@@ -686,9 +686,9 @@ _OVER:
return
code
;
}
int32_t
mndProcessGetSmaReq
(
SMnode
*
pMnode
,
SUserIndexReq
*
indexReq
,
SUserIndexRsp
*
rsp
,
bool
*
exist
)
{
int32_t
code
=
-
1
;
SSmaObj
*
pSma
=
NULL
;
int32_t
mndProcessGetSmaReq
(
SMnode
*
pMnode
,
SUserIndexReq
*
indexReq
,
SUserIndexRsp
*
rsp
,
bool
*
exist
)
{
int32_t
code
=
-
1
;
SSmaObj
*
pSma
=
NULL
;
pSma
=
mndAcquireSma
(
pMnode
,
indexReq
->
indexFName
);
if
(
pSma
==
NULL
)
{
...
...
@@ -701,13 +701,14 @@ int32_t mndProcessGetSmaReq(SMnode *pMnode, SUserIndexReq *indexReq, SUserI
strcpy
(
rsp
->
indexType
,
TSDB_INDEX_TYPE_SMA
);
SNodeList
*
pList
=
NULL
;
int32_t
extOffset
=
0
;
int32_t
extOffset
=
0
;
code
=
nodesStringToList
(
pSma
->
expr
,
&
pList
);
if
(
0
==
code
)
{
SNode
*
node
=
NULL
;
FOREACH
(
node
,
pList
)
{
SFunctionNode
*
pFunc
=
(
SFunctionNode
*
)
node
;
extOffset
+=
snprintf
(
rsp
->
indexExts
+
extOffset
,
sizeof
(
rsp
->
indexExts
)
-
extOffset
-
1
,
"%s%s"
,
(
extOffset
?
","
:
""
),
pFunc
->
functionName
);
extOffset
+=
snprintf
(
rsp
->
indexExts
+
extOffset
,
sizeof
(
rsp
->
indexExts
)
-
extOffset
-
1
,
"%s%s"
,
(
extOffset
?
","
:
""
),
pFunc
->
functionName
);
}
*
exist
=
true
;
...
...
@@ -718,13 +719,12 @@ int32_t mndProcessGetSmaReq(SMnode *pMnode, SUserIndexReq *indexReq, SUserI
return
code
;
}
static
int32_t
mndProcessVDropSmaRsp
(
SNodeMsg
*
pRsp
)
{
mndTransProcessRsp
(
pRsp
);
return
0
;
}
static
int32_t
mndRetrieveSma
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
static
int32_t
mndRetrieveSma
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
pNode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
...
...
@@ -758,8 +758,8 @@ static int32_t mndRetrieveSma(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlo
char
n1
[
TSDB_TABLE_FNAME_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_TO_VARSTR
(
n1
,
(
char
*
)
tNameGetTableName
(
&
stbName
));
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
n
,
false
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
n
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pSma
->
createdTime
,
false
);
...
...
source/dnode/mnode/impl/src/mndStream.c
浏览文件 @
108b9ee1
...
...
@@ -40,7 +40,7 @@ static int32_t mndProcessTaskDeployInternalRsp(SNodeMsg *pRsp);
/*static int32_t mndProcessDropStreamInRsp(SNodeMsg *pRsp);*/
static
int32_t
mndProcessStreamMetaReq
(
SNodeMsg
*
pReq
);
static
int32_t
mndGetStreamMeta
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
);
static
int32_t
mndRetrieveStream
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndRetrieveStream
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextStream
(
SMnode
*
pMnode
,
void
*
pIter
);
int32_t
mndInitStream
(
SMnode
*
pMnode
)
{
...
...
@@ -58,8 +58,8 @@ int32_t mndInitStream(SMnode *pMnode) {
/*mndSetMsgHandle(pMnode, TDMT_MND_DROP_STREAM, mndProcessDropStreamReq);*/
/*mndSetMsgHandle(pMnode, TDMT_MND_DROP_STREAM_RSP, mndProcessDropStreamInRsp);*/
// mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_TOPIC
S, mndRetrieveStream);
/*mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_TOPICS, mndCancelGetNextStream);*/
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_STREAM
S
,
mndRetrieveStream
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_STREAMS
,
mndCancelGetNextStream
);
return
sdbSetTable
(
pMnode
->
pSdb
,
table
);
}
...
...
@@ -294,8 +294,8 @@ static int32_t mndCreateStream(SMnode *pMnode, SNodeMsg *pReq, SCMCreateStreamRe
mDebug
(
"stream:%s to create"
,
pCreate
->
name
);
SStreamObj
streamObj
=
{
0
};
tstrncpy
(
streamObj
.
name
,
pCreate
->
name
,
TSDB_STREAM_FNAME_LEN
);
tstrncpy
(
streamObj
.
d
b
,
pDb
->
name
,
TSDB_DB_FNAME_LEN
);
tstrncpy
(
streamObj
.
outpu
tSTbName
,
pCreate
->
outputSTbName
,
TSDB_TABLE_FNAME_LEN
);
tstrncpy
(
streamObj
.
sourceD
b
,
pDb
->
name
,
TSDB_DB_FNAME_LEN
);
tstrncpy
(
streamObj
.
targe
tSTbName
,
pCreate
->
outputSTbName
,
TSDB_TABLE_FNAME_LEN
);
streamObj
.
createTime
=
taosGetTimestampMs
();
streamObj
.
updateTime
=
streamObj
.
createTime
;
streamObj
.
uid
=
mndGenerateUid
(
pCreate
->
name
,
strlen
(
pCreate
->
name
));
...
...
@@ -424,58 +424,55 @@ static int32_t mndGetNumOfStreams(SMnode *pMnode, char *dbName, int32_t *pNumOfS
return
0
;
}
static
int32_t
mndRetrieveStream
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
)
{
static
int32_t
mndRetrieveStream
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
pNode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
SStreamObj
*
pStream
=
NULL
;
int32_t
cols
=
0
;
char
*
pWrite
;
char
prefix
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pShow
->
db
);
if
(
pDb
==
NULL
)
return
0
;
tstrncpy
(
prefix
,
pShow
->
db
,
TSDB_DB_FNAME_LEN
);
strcat
(
prefix
,
TS_PATH_DELIMITER
);
int32_t
prefixLen
=
(
int32_t
)
strlen
(
prefix
);
while
(
numOfRows
<
rows
)
{
pShow
->
pIter
=
sdbFetch
(
pSdb
,
SDB_
STREAM
,
pShow
->
pIter
,
(
void
**
)
&
pStream
);
pShow
->
pIter
=
sdbFetch
(
pSdb
,
SDB_
TOPIC
,
pShow
->
pIter
,
(
void
**
)
&
pStream
);
if
(
pShow
->
pIter
==
NULL
)
break
;
if
(
pStream
->
dbUid
!=
pDb
->
uid
)
{
if
(
strncmp
(
pStream
->
name
,
prefix
,
prefixLen
)
!=
0
)
{
mError
(
"Inconsistent stream data, name:%s, db:%s, dbUid:%"
PRIu64
,
pStream
->
name
,
pDb
->
name
,
pDb
->
uid
);
}
SColumnInfoData
*
pColInfo
;
SName
n
;
int32_t
cols
=
0
;
sdbRelease
(
pSdb
,
pStream
);
continue
;
}
char
streamName
[
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
tNameFromString
(
&
n
,
pStream
->
name
,
T_NAME_ACCT
|
T_NAME_DB
);
tNameGetDbName
(
&
n
,
varDataVal
(
streamName
));
varDataSetLen
(
streamName
,
strlen
(
varDataVal
(
streamName
)));
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
streamName
,
false
);
cols
=
0
;
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pStream
->
createTime
,
false
);
char
s
treamName
[
TSDB_TABLE_NAME_LEN
]
=
{
0
};
tstrncpy
(
streamName
,
pStream
->
name
+
prefixLen
,
TSDB_TABLE_NAME
_LEN
);
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
STR_TO_VARSTR
(
pWrite
,
streamName
);
col
s
++
;
char
s
ql
[
TSDB_SHOW_SQL_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
tstrncpy
(
&
sql
[
VARSTR_HEADER_SIZE
],
pStream
->
sql
,
TSDB_SHOW_SQL
_LEN
);
varDataSetLen
(
sql
,
strlen
(
&
sql
[
VARSTR_HEADER_SIZE
]))
;
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
col
DataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
sql
,
false
)
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int64_t
*
)
pWrite
=
pStream
->
createTime
;
cols
++
;
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pStream
->
status
,
true
);
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pStream
->
sql
,
pShow
->
bytes
[
cols
]);
cols
++
;
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pStream
->
sourceDb
,
true
);
numOfRows
++
;
sdbRelease
(
pSdb
,
pStream
);
}
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pStream
->
targetDb
,
true
);
mndReleaseDb
(
pMnode
,
pDb
);
pShow
->
numOfRows
+=
numOfRows
;
return
numOfRows
;
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pStream
->
targetSTbName
,
true
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pStream
->
waterMark
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pStream
->
trigger
,
false
);
}
return
0
;
}
static
void
mndCancelGetNextStream
(
SMnode
*
pMnode
,
void
*
pIter
)
{
...
...
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
108b9ee1
...
...
@@ -309,9 +309,6 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
newConsumerEp
.
consumerId
=
consumerId
;
newConsumerEp
.
vgs
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
taosHashPut
(
pOutput
->
pSub
->
consumerHash
,
&
consumerId
,
sizeof
(
int64_t
),
&
newConsumerEp
,
sizeof
(
SMqConsumerEp
));
/*SMqConsumer* pTestNew = taosHashGet(pOutput->pSub->consumerHash, &consumerId, sizeof(int64_t));*/
/*ASSERT(pTestNew->consumerId == consumerId);*/
/*ASSERT(pTestNew->vgs == newConsumerEp.vgs);*/
taosArrayPush
(
pOutput
->
newConsumers
,
&
consumerId
);
}
}
...
...
@@ -369,7 +366,13 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
}
}
// 8. generate logs
// 8. TODO generate logs
mInfo
(
"rebalance calculation completed, rebalanced vg:"
);
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pOutput
->
rebVgs
);
i
++
)
{
SMqRebOutputVg
*
pOutputRebVg
=
taosArrayGet
(
pOutput
->
rebVgs
,
i
);
mInfo
(
"vg: %d moved from consumer %ld to consumer %ld"
,
pOutputRebVg
->
pVgEp
->
vgId
,
pOutputRebVg
->
oldConsumerId
,
pOutputRebVg
->
newConsumerId
);
}
// 9. clear
taosHashCleanup
(
pHash
);
...
...
@@ -447,7 +450,9 @@ static int32_t mndPersistRebResult(SMnode *pMnode, SNodeMsg *pMsg, const SMqRebO
goto
REB_FAIL
;
}
}
// 4. commit log: modification log
// 4. TODO commit log: modification log
// 5. execution
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
REB_FAIL
;
mndTransDrop
(
pTrans
);
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
108b9ee1
...
...
@@ -61,7 +61,6 @@ int vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRpcMsg
pReq
=
POINTER_SHIFT
(
pMsg
->
pCont
,
sizeof
(
SMsgHead
));
len
=
pMsg
->
contLen
-
sizeof
(
SMsgHead
);
// todo: change the interface here
if
(
tqPushMsg
(
pVnode
->
pTq
,
pMsg
->
pCont
,
pMsg
->
contLen
,
pMsg
->
msgType
,
version
)
<
0
)
{
vError
(
"vgId: %d failed to push msg to TQ since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
return
-
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录