Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
e0b1585e
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看板
提交
e0b1585e
编写于
11月 30, 2020
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into feature/TD-1413
上级
f429ad58
9fca318e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
68 addition
and
17 deletion
+68
-17
src/cq/src/cqMain.c
src/cq/src/cqMain.c
+15
-7
src/tsdb/src/tsdbRWHelper.c
src/tsdb/src/tsdbRWHelper.c
+5
-5
src/util/src/tfile.c
src/util/src/tfile.c
+17
-5
src/util/src/ttimer.c
src/util/src/ttimer.c
+31
-0
未找到文件。
src/cq/src/cqMain.c
浏览文件 @
e0b1585e
...
...
@@ -241,8 +241,12 @@ static void doCreateStream(void *param, TAOS_RES *result, int32_t code) {
SCqObj
*
pObj
=
(
SCqObj
*
)
param
;
SCqContext
*
pContext
=
pObj
->
pContext
;
SSqlObj
*
pSql
=
(
SSqlObj
*
)
result
;
pContext
->
dbConn
=
pSql
->
pTscObj
;
if
(
atomic_val_compare_exchange_ptr
(
&
(
pContext
->
dbConn
),
NULL
,
pSql
->
pTscObj
)
!=
NULL
)
{
taos_close
(
pSql
->
pTscObj
);
}
pthread_mutex_lock
(
&
pContext
->
mutex
);
cqCreateStream
(
pContext
,
pObj
);
pthread_mutex_unlock
(
&
pContext
->
mutex
);
}
static
void
cqProcessCreateTimer
(
void
*
param
,
void
*
tmrId
)
{
...
...
@@ -253,7 +257,9 @@ static void cqProcessCreateTimer(void *param, void *tmrId) {
cDebug
(
"vgId:%d, try connect to TDengine"
,
pContext
->
vgId
);
taos_connect_a
(
NULL
,
pContext
->
user
,
pContext
->
pass
,
pContext
->
db
,
0
,
doCreateStream
,
param
,
NULL
);
}
else
{
pthread_mutex_lock
(
&
pContext
->
mutex
);
cqCreateStream
(
pContext
,
pObj
);
pthread_mutex_unlock
(
&
pContext
->
mutex
);
}
}
...
...
@@ -267,12 +273,14 @@ static void cqCreateStream(SCqContext *pContext, SCqObj *pObj) {
}
pObj
->
tmrId
=
0
;
pObj
->
pStream
=
taos_open_stream
(
pContext
->
dbConn
,
pObj
->
sqlStr
,
cqProcessStreamRes
,
0
,
pObj
,
NULL
);
if
(
pObj
->
pStream
)
{
pContext
->
num
++
;
cInfo
(
"vgId:%d, id:%d CQ:%s is openned"
,
pContext
->
vgId
,
pObj
->
tid
,
pObj
->
sqlStr
);
}
else
{
cError
(
"vgId:%d, id:%d CQ:%s, failed to open"
,
pContext
->
vgId
,
pObj
->
tid
,
pObj
->
sqlStr
);
if
(
pObj
->
pStream
==
NULL
)
{
pObj
->
pStream
=
taos_open_stream
(
pContext
->
dbConn
,
pObj
->
sqlStr
,
cqProcessStreamRes
,
0
,
pObj
,
NULL
);
if
(
pObj
->
pStream
)
{
pContext
->
num
++
;
cInfo
(
"vgId:%d, id:%d CQ:%s is openned"
,
pContext
->
vgId
,
pObj
->
tid
,
pObj
->
sqlStr
);
}
else
{
cError
(
"vgId:%d, id:%d CQ:%s, failed to open"
,
pContext
->
vgId
,
pObj
->
tid
,
pObj
->
sqlStr
);
}
}
}
...
...
src/tsdb/src/tsdbRWHelper.c
浏览文件 @
e0b1585e
...
...
@@ -925,6 +925,8 @@ static int tsdbInsertSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int
ASSERT
(
pHelper
->
pCompInfo
->
blocks
[
0
].
keyLast
<
pHelper
->
pCompInfo
->
blocks
[
1
].
keyFirst
);
}
ASSERT
((
blkIdx
==
pIdx
->
numOfBlocks
-
1
)
||
(
!
pCompBlock
->
last
));
tsdbDebug
(
"vgId:%d tid:%d a super block is inserted at index %d"
,
REPO_ID
(
pHelper
->
pRepo
),
pHelper
->
tableInfo
.
tid
,
blkIdx
);
...
...
@@ -1050,6 +1052,8 @@ static int tsdbUpdateSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int
pIdx
->
maxKey
=
blockAtIdx
(
pHelper
,
pIdx
->
numOfBlocks
-
1
)
->
keyLast
;
pIdx
->
hasLast
=
(
uint32_t
)
blockAtIdx
(
pHelper
,
pIdx
->
numOfBlocks
-
1
)
->
last
;
ASSERT
((
blkIdx
==
pIdx
->
numOfBlocks
-
1
)
||
(
!
pCompBlock
->
last
));
tsdbDebug
(
"vgId:%d tid:%d a super block is updated at index %d"
,
REPO_ID
(
pHelper
->
pRepo
),
pHelper
->
tableInfo
.
tid
,
blkIdx
);
...
...
@@ -1630,11 +1634,7 @@ static int tsdbProcessMergeCommit(SRWHelper *pHelper, SCommitIter *pCommitIter,
pCfg
->
update
);
if
(
pDataCols
->
numOfRows
==
0
)
break
;
if
(
tblkIdx
==
pIdx
->
numOfBlocks
-
1
)
{
if
(
tsdbWriteBlockToProperFile
(
pHelper
,
pDataCols
,
&
compBlock
)
<
0
)
return
-
1
;
}
else
{
if
(
tsdbWriteBlockToFile
(
pHelper
,
helperDataF
(
pHelper
),
pDataCols
,
&
compBlock
,
false
,
true
)
<
0
)
return
-
1
;
}
if
(
tsdbWriteBlockToFile
(
pHelper
,
helperDataF
(
pHelper
),
pDataCols
,
&
compBlock
,
false
,
true
)
<
0
)
return
-
1
;
if
(
round
==
0
)
{
if
(
oBlock
.
last
&&
pHelper
->
hasOldLastBlock
)
pHelper
->
hasOldLastBlock
=
false
;
...
...
src/util/src/tfile.c
浏览文件 @
e0b1585e
...
...
@@ -93,17 +93,23 @@ int64_t tfRead(int64_t tfd, void *buf, int64_t count) {
return
ret
;
}
int
64
_t
tfFsync
(
int64_t
tfd
)
{
int
32
_t
tfFsync
(
int64_t
tfd
)
{
void
*
p
=
taosAcquireRef
(
tsFileRsetId
,
tfd
);
if
(
p
==
NULL
)
return
-
1
;
int32_t
fd
=
(
int32_t
)(
uintptr_t
)
p
;
return
fsync
(
fd
);
int32_t
code
=
fsync
(
fd
);
taosReleaseRef
(
tsFileRsetId
,
tfd
);
return
code
;
}
bool
tfValid
(
int64_t
tfd
)
{
void
*
p
=
taosAcquireRef
(
tsFileRsetId
,
tfd
);
return
p
!=
NULL
;
if
(
p
==
NULL
)
return
false
;
taosReleaseRef
(
tsFileRsetId
,
tfd
);
return
true
;
}
int64_t
tfLseek
(
int64_t
tfd
,
int64_t
offset
,
int32_t
whence
)
{
...
...
@@ -111,7 +117,10 @@ int64_t tfLseek(int64_t tfd, int64_t offset, int32_t whence) {
if
(
p
==
NULL
)
return
-
1
;
int32_t
fd
=
(
int32_t
)(
uintptr_t
)
p
;
return
taosLSeek
(
fd
,
offset
,
whence
);
int64_t
ret
=
taosLSeek
(
fd
,
offset
,
whence
);
taosReleaseRef
(
tsFileRsetId
,
tfd
);
return
ret
;
}
int32_t
tfFtruncate
(
int64_t
tfd
,
int64_t
length
)
{
...
...
@@ -119,5 +128,8 @@ int32_t tfFtruncate(int64_t tfd, int64_t length) {
if
(
p
==
NULL
)
return
-
1
;
int32_t
fd
=
(
int32_t
)(
uintptr_t
)
p
;
return
taosFtruncate
(
fd
,
length
);
int32_t
code
=
taosFtruncate
(
fd
,
length
);
taosReleaseRef
(
tsFileRsetId
,
tfd
);
return
code
;
}
src/util/src/ttimer.c
浏览文件 @
e0b1585e
...
...
@@ -560,6 +560,37 @@ void taosTmrCleanUp(void* handle) {
tmrDebug
(
"%s timer controller is cleaned up."
,
ctrl
->
label
);
ctrl
->
label
[
0
]
=
0
;
// cancel all timers of this controller
for
(
size_t
i
=
0
;
i
<
timerMap
.
size
;
i
++
)
{
timer_list_t
*
list
=
timerMap
.
slots
+
i
;
lockTimerList
(
list
);
tmr_obj_t
*
t
=
list
->
timers
;
tmr_obj_t
*
prev
=
NULL
;
while
(
t
!=
NULL
)
{
tmr_obj_t
*
next
=
t
->
mnext
;
if
(
t
->
ctrl
!=
ctrl
)
{
prev
=
t
;
t
=
next
;
continue
;
}
uint8_t
state
=
atomic_val_compare_exchange_8
(
&
t
->
state
,
TIMER_STATE_WAITING
,
TIMER_STATE_CANCELED
);
if
(
state
==
TIMER_STATE_WAITING
)
{
removeFromWheel
(
t
);
}
timerDecRef
(
t
);
if
(
prev
==
NULL
)
{
list
->
timers
=
next
;
}
else
{
prev
->
mnext
=
next
;
}
t
=
next
;
}
unlockTimerList
(
list
);
}
pthread_mutex_lock
(
&
tmrCtrlMutex
);
ctrl
->
next
=
unusedTmrCtrl
;
numOfTmrCtrl
--
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录