Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
2a139821
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
2a139821
编写于
8月 06, 2019
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix issue #279
上级
169338ea
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
34 addition
and
20 deletion
+34
-20
src/client/src/tscServer.c
src/client/src/tscServer.c
+21
-7
src/client/src/tscSystem.c
src/client/src/tscSystem.c
+2
-2
src/system/inc/vnodeUtil.h
src/system/inc/vnodeUtil.h
+1
-1
src/system/src/vnodeImport.c
src/system/src/vnodeImport.c
+2
-2
src/system/src/vnodeMeter.c
src/system/src/vnodeMeter.c
+1
-1
src/system/src/vnodeShell.c
src/system/src/vnodeShell.c
+4
-4
src/system/src/vnodeStream.c
src/system/src/vnodeStream.c
+1
-1
src/system/src/vnodeUtil.c
src/system/src/vnodeUtil.c
+2
-2
未找到文件。
src/client/src/tscServer.c
浏览文件 @
2a139821
...
...
@@ -40,7 +40,7 @@ uint32_t tsServerIp;
int
(
*
tscBuildMsg
[
TSDB_SQL_MAX
])(
SSqlObj
*
pSql
);
int
(
*
tscProcessMsgRsp
[
TSDB_SQL_MAX
])(
SSqlObj
*
pSql
);
void
(
*
tscUpdateVnodeMsg
[
TSDB_SQL_MAX
])(
SSqlObj
*
pSql
);
void
(
*
tscUpdateVnodeMsg
[
TSDB_SQL_MAX
])(
SSqlObj
*
pSql
,
char
*
buf
);
void
tscProcessActivityTimer
(
void
*
handle
,
void
*
tmrId
);
int
tscKeepConn
[
TSDB_SQL_MAX
]
=
{
0
};
...
...
@@ -206,10 +206,24 @@ int tscSendMsgToServer(SSqlObj *pSql) {
}
if
(
pSql
->
thandle
)
{
/*
* the total length of message
* rpc header + actual message body + digest
*
* the pSql object may be released automatically during insert procedure, in which the access of
* message body by using "if (pHeader->msgType & 1)" may cause the segment fault.
*
*/
int32_t
totalMsgLen
=
pSql
->
cmd
.
payloadLen
+
tsRpcHeadSize
+
sizeof
(
STaosDigest
);
// the memory will be released by taosProcessResponse, so no memory leak here
char
*
buf
=
malloc
(
totalMsgLen
);
memcpy
(
buf
,
pSql
->
cmd
.
payload
,
totalMsgLen
);
tscTrace
(
"%p msg:%s is sent to server"
,
pSql
,
taosMsg
[
pSql
->
cmd
.
msgType
]);
char
*
pStart
=
taosBuildReqHeader
(
pSql
->
thandle
,
pSql
->
cmd
.
msgType
,
pSql
->
cmd
.
payload
);
char
*
pStart
=
taosBuildReqHeader
(
pSql
->
thandle
,
pSql
->
cmd
.
msgType
,
buf
);
if
(
pStart
)
{
if
(
tscUpdateVnodeMsg
[
pSql
->
cmd
.
command
])
(
*
tscUpdateVnodeMsg
[
pSql
->
cmd
.
command
])(
pSql
);
if
(
tscUpdateVnodeMsg
[
pSql
->
cmd
.
command
])
(
*
tscUpdateVnodeMsg
[
pSql
->
cmd
.
command
])(
pSql
,
buf
);
int
ret
=
taosSendMsgToPeerH
(
pSql
->
thandle
,
pStart
,
pSql
->
cmd
.
payloadLen
,
pSql
);
if
(
ret
>=
0
)
code
=
0
;
tscTrace
(
"%p send msg ret:%d code:%d sig:%p"
,
pSql
,
ret
,
code
,
pSql
->
signature
);
...
...
@@ -1007,12 +1021,12 @@ int tscBuildRetrieveMsg(SSqlObj *pSql) {
return
msgLen
;
}
void
tscUpdateVnodeInSubmitMsg
(
SSqlObj
*
pSql
)
{
void
tscUpdateVnodeInSubmitMsg
(
SSqlObj
*
pSql
,
char
*
buf
)
{
SShellSubmitMsg
*
pShellMsg
;
char
*
pMsg
;
SMeterMeta
*
pMeterMeta
=
pSql
->
cmd
.
pMeterMeta
;
pMsg
=
pSql
->
cmd
.
payload
+
tsRpcHeadSize
;
pMsg
=
buf
+
tsRpcHeadSize
;
pShellMsg
=
(
SShellSubmitMsg
*
)
pMsg
;
pShellMsg
->
vnode
=
htons
(
pMeterMeta
->
vpeerDesc
[
pSql
->
index
].
vnode
);
...
...
@@ -1042,9 +1056,9 @@ int tscBuildSubmitMsg(SSqlObj *pSql) {
return
msgLen
;
}
void
tscUpdateVnodeInQueryMsg
(
SSqlObj
*
pSql
)
{
void
tscUpdateVnodeInQueryMsg
(
SSqlObj
*
pSql
,
char
*
buf
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
char
*
pStart
=
pCmd
->
payload
+
tsRpcHeadSize
;
char
*
pStart
=
buf
+
tsRpcHeadSize
;
SQueryMeterMsg
*
pQueryMsg
=
(
SQueryMeterMsg
*
)
pStart
;
...
...
src/client/src/tscSystem.c
浏览文件 @
2a139821
...
...
@@ -110,7 +110,7 @@ void taos_init_imp() {
rpcInit
.
numOfChanns
=
tscNumOfThreads
;
rpcInit
.
sessionsPerChann
=
tsMaxVnodeConnections
/
tscNumOfThreads
;
rpcInit
.
idMgmt
=
TAOS_ID_FREE
;
rpcInit
.
noFree
=
1
;
rpcInit
.
noFree
=
0
;
rpcInit
.
connType
=
TAOS_CONN_UDP
;
rpcInit
.
qhandle
=
tscQhandle
;
pVnodeConn
=
taosOpenRpc
(
&
rpcInit
);
...
...
@@ -131,7 +131,7 @@ void taos_init_imp() {
rpcInit
.
numOfChanns
=
1
;
rpcInit
.
sessionsPerChann
=
tsMaxMgmtConnections
;
rpcInit
.
idMgmt
=
TAOS_ID_FREE
;
rpcInit
.
noFree
=
1
;
rpcInit
.
noFree
=
0
;
rpcInit
.
connType
=
TAOS_CONN_UDP
;
rpcInit
.
qhandle
=
tscQhandle
;
pTscMgmtConn
=
taosOpenRpc
(
&
rpcInit
);
...
...
src/system/inc/vnodeUtil.h
浏览文件 @
2a139821
...
...
@@ -75,7 +75,7 @@ int32_t vnodeIncQueryRefCount(SQueryMeterMsg *pQueryMsg, SMeterSidExtInfo **pSid
void
vnodeDecQueryRefCount
(
SQueryMeterMsg
*
pQueryMsg
,
SMeterObj
**
pMeterObjList
,
int32_t
numOfInc
);
int32_t
vnode
Transfer
MeterState
(
SMeterObj
*
pMeterObj
,
int32_t
state
);
int32_t
vnode
Set
MeterState
(
SMeterObj
*
pMeterObj
,
int32_t
state
);
void
vnodeClearMeterState
(
SMeterObj
*
pMeterObj
,
int32_t
state
);
bool
vnodeIsMeterState
(
SMeterObj
*
pMeterObj
,
int32_t
state
);
void
vnodeSetMeterDeleting
(
SMeterObj
*
pMeterObj
);
...
...
src/system/src/vnodeImport.c
浏览文件 @
2a139821
...
...
@@ -285,7 +285,7 @@ void vnodeProcessImportTimer(void *param, void *tmrId) {
pImport
->
retry
++
;
//slow query will block the import operation
int32_t
state
=
vnode
Transfer
MeterState
(
pObj
,
TSDB_METER_STATE_IMPORTING
);
int32_t
state
=
vnode
Set
MeterState
(
pObj
,
TSDB_METER_STATE_IMPORTING
);
if
(
state
>=
TSDB_METER_STATE_DELETING
)
{
dError
(
"vid:%d sid:%d id:%s, meter is deleted, failed to import, state:%d"
,
pObj
->
vnode
,
pObj
->
sid
,
pObj
->
meterId
,
state
);
...
...
@@ -887,7 +887,7 @@ int vnodeImportPoints(SMeterObj *pObj, char *cont, int contLen, char source, voi
if
(
*
((
TSKEY
*
)(
pSubmit
->
payLoad
+
(
rows
-
1
)
*
pObj
->
bytesPerPoint
))
>
pObj
->
lastKey
)
{
vnodeClearMeterState
(
pObj
,
TSDB_METER_STATE_IMPORTING
);
vnode
Transfer
MeterState
(
pObj
,
TSDB_METER_STATE_INSERT
);
vnode
Set
MeterState
(
pObj
,
TSDB_METER_STATE_INSERT
);
code
=
vnodeInsertPoints
(
pObj
,
cont
,
contLen
,
TSDB_DATA_SOURCE_LOG
,
NULL
,
pObj
->
sversion
,
&
pointsImported
);
if
(
pShell
)
{
...
...
src/system/src/vnodeMeter.c
浏览文件 @
2a139821
...
...
@@ -676,7 +676,7 @@ void vnodeUpdateMeter(void *param, void *tmrId) {
return
;
}
int32_t
state
=
vnode
Transfer
MeterState
(
pObj
,
TSDB_METER_STATE_UPDATING
);
int32_t
state
=
vnode
Set
MeterState
(
pObj
,
TSDB_METER_STATE_UPDATING
);
if
(
state
>=
TSDB_METER_STATE_DELETING
)
{
dError
(
"vid:%d sid:%d id:%s, meter is deleted, failed to update, state:%d"
,
pObj
->
vnode
,
pObj
->
sid
,
pObj
->
meterId
,
state
);
...
...
src/system/src/vnodeShell.c
浏览文件 @
2a139821
...
...
@@ -183,8 +183,8 @@ void vnodeCloseShellVnode(int vnode) {
* 1. The msg, as well as SRpcConn may be in the task queue, free it immediate will cause crash
* 2. Free connection may cause *(SRpcConn*)pObj->thandle to be invalid to access.
*/
dTrace
(
"vid:%d, delay 5
sec
to free resources"
,
vnode
);
taosTmrStart
(
vnodeDelayedFreeResource
,
500
0
,
v
,
vnodeTmrCtrl
);
dTrace
(
"vid:%d, delay 5
00ms
to free resources"
,
vnode
);
taosTmrStart
(
vnodeDelayedFreeResource
,
500
,
v
,
vnodeTmrCtrl
);
}
void
vnodeCleanUpShell
()
{
...
...
@@ -508,9 +508,9 @@ int vnodeProcessShellSubmitRequest(char *pMsg, int msgLen, SShellObj *pObj) {
int32_t
state
=
TSDB_METER_STATE_READY
;
if
(
pSubmit
->
import
)
{
state
=
vnode
Transfer
MeterState
(
pMeterObj
,
TSDB_METER_STATE_IMPORTING
);
state
=
vnode
Set
MeterState
(
pMeterObj
,
TSDB_METER_STATE_IMPORTING
);
}
else
{
state
=
vnode
Transfer
MeterState
(
pMeterObj
,
TSDB_METER_STATE_INSERT
);
state
=
vnode
Set
MeterState
(
pMeterObj
,
TSDB_METER_STATE_INSERT
);
}
if
(
state
==
TSDB_METER_STATE_READY
)
{
...
...
src/system/src/vnodeStream.c
浏览文件 @
2a139821
...
...
@@ -55,7 +55,7 @@ void vnodeProcessStreamRes(void *param, TAOS_RES *tres, TAOS_ROW row) {
int32_t
numOfPoints
=
0
;
int32_t
state
=
vnode
Transfer
MeterState
(
pObj
,
TSDB_METER_STATE_INSERT
);
int32_t
state
=
vnode
Set
MeterState
(
pObj
,
TSDB_METER_STATE_INSERT
);
if
(
state
==
TSDB_METER_STATE_READY
)
{
vnodeInsertPoints
(
pObj
,
(
char
*
)
pMsg
,
contLen
,
TSDB_DATA_SOURCE_SHELL
,
NULL
,
pObj
->
sversion
,
&
numOfPoints
);
vnodeClearMeterState
(
pObj
,
TSDB_METER_STATE_INSERT
);
...
...
src/system/src/vnodeUtil.c
浏览文件 @
2a139821
...
...
@@ -586,7 +586,7 @@ void vnodeUpdateQueryColumnIndex(SQuery* pQuery, SMeterObj* pMeterObj) {
}
}
int32_t
vnode
Transfer
MeterState
(
SMeterObj
*
pMeterObj
,
int32_t
state
)
{
int32_t
vnode
Set
MeterState
(
SMeterObj
*
pMeterObj
,
int32_t
state
)
{
return
__sync_val_compare_and_swap
(
&
pMeterObj
->
state
,
TSDB_METER_STATE_READY
,
state
);
}
...
...
@@ -619,7 +619,7 @@ bool vnodeIsSafeToDeleteMeter(SVnodeObj* pVnode, int32_t sid) {
return
true
;
}
int32_t
prev
=
vnode
Transfer
MeterState
(
pObj
,
TSDB_METER_STATE_DELETING
);
int32_t
prev
=
vnode
Set
MeterState
(
pObj
,
TSDB_METER_STATE_DELETING
);
/*
* if the meter is not in ready/deleting state, it must be in insert/import/update,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录