Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
冷面1992
TDengine
提交
a7f44f38
TDengine
项目概览
冷面1992
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a7f44f38
编写于
4月 10, 2021
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use global uid as query id
上级
deb3ad7e
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
34 addition
and
3 deletion
+34
-3
src/common/inc/tglobal.h
src/common/inc/tglobal.h
+1
-0
src/common/src/tglobal.c
src/common/src/tglobal.c
+1
-0
src/dnode/src/dnodeCfg.c
src/dnode/src/dnodeCfg.c
+2
-0
src/inc/query.h
src/inc/query.h
+1
-0
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+26
-2
src/query/src/queryMain.c
src/query/src/queryMain.c
+1
-0
src/vnode/src/vnodeRead.c
src/vnode/src/vnodeRead.c
+2
-1
未找到文件。
src/common/inc/tglobal.h
浏览文件 @
a7f44f38
...
...
@@ -39,6 +39,7 @@ extern int8_t tsEnableTelemetryReporting;
extern
char
tsEmail
[];
extern
char
tsArbitrator
[];
extern
int8_t
tsArbOnline
;
extern
int32_t
tsDnodeId
;
// common
extern
int
tsRpcTimer
;
...
...
src/common/src/tglobal.c
浏览文件 @
a7f44f38
...
...
@@ -43,6 +43,7 @@ int8_t tsEnableVnodeBak = 1;
int8_t
tsEnableTelemetryReporting
=
1
;
int8_t
tsArbOnline
=
0
;
char
tsEmail
[
TSDB_FQDN_LEN
]
=
{
0
};
int32_t
tsDnodeId
=
0
;
// common
int32_t
tsRpcTimer
=
1000
;
...
...
src/dnode/src/dnodeCfg.c
浏览文件 @
a7f44f38
...
...
@@ -17,6 +17,7 @@
#include "os.h"
#include "cJSON.h"
#include "dnodeCfg.h"
#include "tglobal.h"
static
SDnodeCfg
tsCfg
=
{
0
};
static
pthread_mutex_t
tsCfgMutex
;
...
...
@@ -70,6 +71,7 @@ static void dnodeResetCfg(SDnodeCfg *cfg) {
pthread_mutex_lock
(
&
tsCfgMutex
);
tsCfg
.
dnodeId
=
cfg
->
dnodeId
;
tsDnodeId
=
cfg
->
dnodeId
;
tstrncpy
(
tsCfg
.
clusterId
,
cfg
->
clusterId
,
TSDB_CLUSTER_ID_LEN
);
dnodePrintCfg
(
cfg
);
dnodeWriteCfg
();
...
...
src/inc/query.h
浏览文件 @
a7f44f38
...
...
@@ -92,6 +92,7 @@ void** qRegisterQInfo(void* pMgmt, uint64_t qId, uint64_t qInfo);
void
**
qAcquireQInfo
(
void
*
pMgmt
,
uint64_t
key
);
void
**
qReleaseQInfo
(
void
*
pMgmt
,
void
*
pQInfo
,
bool
freeHandle
);
bool
checkQIdEqual
(
void
*
qHandle
,
uint64_t
qId
);
int64_t
genQueryId
(
void
);
#ifdef __cplusplus
}
...
...
src/query/src/qExecutor.c
浏览文件 @
a7f44f38
...
...
@@ -105,6 +105,30 @@ int32_t getMaximumIdleDurationSec() {
return
tsShellActivityTimer
*
2
;
}
int64_t
genQueryId
(
void
)
{
int64_t
uid
=
0
;
int64_t
did
=
tsDnodeId
;
uid
=
did
<<
54
;
int64_t
pid
=
((
int64_t
)
taosGetPId
())
&
0x3FF
;
uid
|=
pid
<<
44
;
int64_t
ts
=
taosGetTimestampMs
()
&
0x1FFFFFFFF
;
uid
|=
ts
<<
11
;
int64_t
sid
=
atomic_add_fetch_64
(
&
queryHandleId
,
1
)
&
0x7FF
;
uid
|=
sid
;
return
uid
;
}
static
void
getNextTimeWindow
(
SQuery
*
pQuery
,
STimeWindow
*
tw
)
{
int32_t
factor
=
GET_FORWARD_DIRECTION_FACTOR
(
pQuery
->
order
.
order
);
if
(
pQuery
->
interval
.
intervalUnit
!=
'n'
&&
pQuery
->
interval
.
intervalUnit
!=
'y'
)
{
...
...
@@ -6184,6 +6208,8 @@ SQInfo* createQInfoImpl(SQueryTableMsg* pQueryMsg, SSqlGroupbyExpr* pGroupbyExpr
goto
_cleanup_qinfo
;
}
pQInfo
->
qId
=
*
qId
;
// to make sure third party won't overwrite this structure
pQInfo
->
signature
=
pQInfo
;
SQuery
*
pQuery
=
&
pQInfo
->
query
;
...
...
@@ -6316,8 +6342,6 @@ SQInfo* createQInfoImpl(SQueryTableMsg* pQueryMsg, SSqlGroupbyExpr* pGroupbyExpr
// todo refactor
pQInfo
->
query
.
queryBlockDist
=
(
numOfOutput
==
1
&&
pExprs
[
0
].
base
.
colInfo
.
colId
==
TSDB_BLOCK_DIST_COLUMN_INDEX
);
pQInfo
->
qId
=
atomic_add_fetch_64
(
&
queryHandleId
,
1
);
*
qId
=
pQInfo
->
qId
;
qDebug
(
"qmsg:%p QInfo:%"
PRIu64
"-%p created"
,
pQueryMsg
,
pQInfo
->
qId
,
pQInfo
);
return
pQInfo
;
...
...
src/query/src/queryMain.c
浏览文件 @
a7f44f38
...
...
@@ -197,6 +197,7 @@ int32_t qCreateQueryInfo(void* tsdb, int32_t vgId, SQueryTableMsg* pQueryMsg, qi
return
code
;
}
bool
qTableQuery
(
qinfo_t
qinfo
,
uint64_t
*
qId
)
{
SQInfo
*
pQInfo
=
(
SQInfo
*
)
qinfo
;
assert
(
pQInfo
&&
pQInfo
->
signature
==
pQInfo
);
...
...
src/vnode/src/vnodeRead.c
浏览文件 @
a7f44f38
...
...
@@ -208,6 +208,7 @@ static void vnodeBuildNoResultQueryRsp(SRspRet *pRet) {
pRsp
->
completed
=
true
;
}
static
int32_t
vnodeProcessQueryMsg
(
SVnodeObj
*
pVnode
,
SVReadMsg
*
pRead
)
{
void
*
pCont
=
pRead
->
pCont
;
int32_t
contLen
=
pRead
->
contLen
;
...
...
@@ -226,7 +227,7 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
if
(
contLen
!=
0
)
{
qinfo_t
pQInfo
=
NULL
;
uint64_t
qId
=
0
;
uint64_t
qId
=
genQueryId
()
;
code
=
qCreateQueryInfo
(
pVnode
->
tsdb
,
pVnode
->
vgId
,
pQueryTableMsg
,
&
pQInfo
,
&
qId
);
SQueryTableRsp
*
pRsp
=
(
SQueryTableRsp
*
)
rpcMallocCont
(
sizeof
(
SQueryTableRsp
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录