Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
c012704a
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看板
提交
c012704a
编写于
11月 10, 2019
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Submit the first version of merge import
上级
d3941fe9
变更
3
展开全部
显示空白变更内容
内联
并排
Showing
3 changed file
with
1448 addition
and
771 deletion
+1448
-771
src/system/detail/src/vnodeCache.c
src/system/detail/src/vnodeCache.c
+50
-38
src/system/detail/src/vnodeFile.c
src/system/detail/src/vnodeFile.c
+2
-2
src/system/detail/src/vnodeImport.c
src/system/detail/src/vnodeImport.c
+1396
-731
未找到文件。
src/system/detail/src/vnodeCache.c
浏览文件 @
c012704a
...
@@ -372,13 +372,60 @@ void vnodeCancelCommit(SVnodeObj *pVnode) {
...
@@ -372,13 +372,60 @@ void vnodeCancelCommit(SVnodeObj *pVnode) {
taosTmrReset
(
vnodeProcessCommitTimer
,
pVnode
->
cfg
.
commitTime
*
1000
,
pVnode
,
vnodeTmrCtrl
,
&
pVnode
->
commitTimer
);
taosTmrReset
(
vnodeProcessCommitTimer
,
pVnode
->
cfg
.
commitTime
*
1000
,
pVnode
,
vnodeTmrCtrl
,
&
pVnode
->
commitTimer
);
}
}
/* The vnode cache lock should be hold before calling this interface
*/
SCacheBlock
*
vnodeGetFreeCacheBlock
(
SVnodeObj
*
pVnode
)
{
SCachePool
*
pPool
=
(
SCachePool
*
)(
pVnode
->
pCachePool
);
SVnodeCfg
*
pCfg
=
&
(
pVnode
->
cfg
);
SCacheBlock
*
pCacheBlock
=
NULL
;
int
skipped
=
0
;
while
(
1
)
{
pCacheBlock
=
(
SCacheBlock
*
)(
pPool
->
pMem
[((
int64_t
)
pPool
->
freeSlot
)]);
if
(
pCacheBlock
->
blockId
==
0
)
break
;
if
(
pCacheBlock
->
notFree
)
{
pPool
->
freeSlot
++
;
pPool
->
freeSlot
=
pPool
->
freeSlot
%
pCfg
->
cacheNumOfBlocks
.
totalBlocks
;
skipped
++
;
if
(
skipped
>
pPool
->
threshold
)
{
vnodeCreateCommitThread
(
pVnode
);
pthread_mutex_unlock
(
&
pPool
->
vmutex
);
dError
(
"vid:%d committing process is too slow, notFreeSlots:%d...."
,
pVnode
->
vnode
,
pPool
->
notFreeSlots
);
return
NULL
;
}
}
else
{
SMeterObj
*
pRelObj
=
pCacheBlock
->
pMeterObj
;
SCacheInfo
*
pRelInfo
=
(
SCacheInfo
*
)
pRelObj
->
pCache
;
int
firstSlot
=
(
pRelInfo
->
currentSlot
-
pRelInfo
->
numOfBlocks
+
1
+
pRelInfo
->
maxBlocks
)
%
pRelInfo
->
maxBlocks
;
pCacheBlock
=
pRelInfo
->
cacheBlocks
[
firstSlot
];
if
(
pCacheBlock
)
{
pPool
->
freeSlot
=
pCacheBlock
->
index
;
vnodeFreeCacheBlock
(
pCacheBlock
);
break
;
}
else
{
pPool
->
freeSlot
=
(
pPool
->
freeSlot
+
1
)
%
pCfg
->
cacheNumOfBlocks
.
totalBlocks
;
skipped
++
;
}
}
}
pCacheBlock
=
(
SCacheBlock
*
)(
pPool
->
pMem
[
pPool
->
freeSlot
]);
pCacheBlock
->
index
=
pPool
->
freeSlot
;
pCacheBlock
->
notFree
=
1
;
pPool
->
freeSlot
=
(
pPool
->
freeSlot
+
1
)
%
pCfg
->
cacheNumOfBlocks
.
totalBlocks
;
pPool
->
notFreeSlots
++
;
return
pCacheBlock
;
}
int
vnodeAllocateCacheBlock
(
SMeterObj
*
pObj
)
{
int
vnodeAllocateCacheBlock
(
SMeterObj
*
pObj
)
{
int
index
;
int
index
;
SCachePool
*
pPool
;
SCachePool
*
pPool
;
SCacheBlock
*
pCacheBlock
;
SCacheBlock
*
pCacheBlock
;
SCacheInfo
*
pInfo
;
SCacheInfo
*
pInfo
;
SVnodeObj
*
pVnode
;
SVnodeObj
*
pVnode
;
int
skipped
=
0
,
commit
=
0
;
int
commit
=
0
;
pVnode
=
vnodeList
+
pObj
->
vnode
;
pVnode
=
vnodeList
+
pObj
->
vnode
;
pPool
=
(
SCachePool
*
)
pVnode
->
pCachePool
;
pPool
=
(
SCachePool
*
)
pVnode
->
pCachePool
;
...
@@ -406,45 +453,10 @@ int vnodeAllocateCacheBlock(SMeterObj *pObj) {
...
@@ -406,45 +453,10 @@ int vnodeAllocateCacheBlock(SMeterObj *pObj) {
return
-
1
;
return
-
1
;
}
}
while
(
1
)
{
if
((
pCacheBlock
=
vnodeGetFreeCacheBlock
(
pVnode
))
==
NULL
)
return
-
1
;
pCacheBlock
=
(
SCacheBlock
*
)(
pPool
->
pMem
[((
int64_t
)
pPool
->
freeSlot
)]);
if
(
pCacheBlock
->
blockId
==
0
)
break
;
if
(
pCacheBlock
->
notFree
)
{
pPool
->
freeSlot
++
;
pPool
->
freeSlot
=
pPool
->
freeSlot
%
pCfg
->
cacheNumOfBlocks
.
totalBlocks
;
skipped
++
;
if
(
skipped
>
pPool
->
threshold
)
{
vnodeCreateCommitThread
(
pVnode
);
pthread_mutex_unlock
(
&
pPool
->
vmutex
);
dError
(
"vid:%d sid:%d id:%s, committing process is too slow, notFreeSlots:%d...."
,
pObj
->
vnode
,
pObj
->
sid
,
pObj
->
meterId
,
pPool
->
notFreeSlots
);
return
-
1
;
}
}
else
{
SMeterObj
*
pRelObj
=
pCacheBlock
->
pMeterObj
;
SCacheInfo
*
pRelInfo
=
(
SCacheInfo
*
)
pRelObj
->
pCache
;
int
firstSlot
=
(
pRelInfo
->
currentSlot
-
pRelInfo
->
numOfBlocks
+
1
+
pRelInfo
->
maxBlocks
)
%
pRelInfo
->
maxBlocks
;
pCacheBlock
=
pRelInfo
->
cacheBlocks
[
firstSlot
];
if
(
pCacheBlock
)
{
pPool
->
freeSlot
=
pCacheBlock
->
index
;
vnodeFreeCacheBlock
(
pCacheBlock
);
break
;
}
else
{
pPool
->
freeSlot
=
(
pPool
->
freeSlot
+
1
)
%
pCfg
->
cacheNumOfBlocks
.
totalBlocks
;
skipped
++
;
}
}
}
index
=
pPool
->
freeSlot
;
pPool
->
freeSlot
++
;
pPool
->
freeSlot
=
pPool
->
freeSlot
%
pCfg
->
cacheNumOfBlocks
.
totalBlocks
;
pPool
->
notFreeSlots
++
;
index
=
pCacheBlock
->
index
;
pCacheBlock
->
pMeterObj
=
pObj
;
pCacheBlock
->
pMeterObj
=
pObj
;
pCacheBlock
->
notFree
=
1
;
pCacheBlock
->
index
=
index
;
pCacheBlock
->
offset
[
0
]
=
((
char
*
)(
pCacheBlock
))
+
sizeof
(
SCacheBlock
)
+
pObj
->
numOfColumns
*
sizeof
(
char
*
);
pCacheBlock
->
offset
[
0
]
=
((
char
*
)(
pCacheBlock
))
+
sizeof
(
SCacheBlock
)
+
pObj
->
numOfColumns
*
sizeof
(
char
*
);
for
(
int
col
=
1
;
col
<
pObj
->
numOfColumns
;
++
col
)
for
(
int
col
=
1
;
col
<
pObj
->
numOfColumns
;
++
col
)
...
...
src/system/detail/src/vnodeFile.c
浏览文件 @
c012704a
...
@@ -103,8 +103,8 @@ void vnodeGetDnameFromLname(char *lhead, char *ldata, char *llast, char *dhead,
...
@@ -103,8 +103,8 @@ void vnodeGetDnameFromLname(char *lhead, char *ldata, char *llast, char *dhead,
}
}
void
vnodeGetHeadTname
(
char
*
nHeadName
,
char
*
nLastName
,
int
vnode
,
int
fileId
)
{
void
vnodeGetHeadTname
(
char
*
nHeadName
,
char
*
nLastName
,
int
vnode
,
int
fileId
)
{
sprintf
(
nHeadName
,
"%s/vnode%d/db/v%df%d.t"
,
tsDirectory
,
vnode
,
vnode
,
fileId
);
if
(
nHeadName
!=
NULL
)
sprintf
(
nHeadName
,
"%s/vnode%d/db/v%df%d.t"
,
tsDirectory
,
vnode
,
vnode
,
fileId
);
sprintf
(
nLastName
,
"%s/vnode%d/db/v%df%d.l"
,
tsDirectory
,
vnode
,
vnode
,
fileId
);
if
(
nLastName
!=
NULL
)
sprintf
(
nLastName
,
"%s/vnode%d/db/v%df%d.l"
,
tsDirectory
,
vnode
,
vnode
,
fileId
);
}
}
void
vnodeCreateDataDirIfNeeded
(
int
vnode
,
char
*
path
)
{
void
vnodeCreateDataDirIfNeeded
(
int
vnode
,
char
*
path
)
{
...
...
src/system/detail/src/vnodeImport.c
浏览文件 @
c012704a
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录