Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9ca3c242
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看板
提交
9ca3c242
编写于
8月 29, 2019
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix the issue #201
上级
f192397c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
7 addition
and
4 deletion
+7
-4
src/system/src/vnodeImport.c
src/system/src/vnodeImport.c
+7
-4
未找到文件。
src/system/src/vnodeImport.c
浏览文件 @
9ca3c242
...
@@ -169,7 +169,6 @@ int vnodeProcessLastBlock(SImportInfo *pImport, SHeadInfo *pHinfo, SData *data[]
...
@@ -169,7 +169,6 @@ int vnodeProcessLastBlock(SImportInfo *pImport, SHeadInfo *pHinfo, SData *data[]
vnodeReadLastBlockToMem
(
pObj
,
&
lastBlock
,
data
);
vnodeReadLastBlockToMem
(
pObj
,
&
lastBlock
,
data
);
pHinfo
->
compInfo
.
numOfBlocks
--
;
pHinfo
->
compInfo
.
numOfBlocks
--
;
code
=
lastBlock
.
numOfPoints
;
code
=
lastBlock
.
numOfPoints
;
pImport
->
slot
--
;
}
}
return
code
;
return
code
;
...
@@ -237,12 +236,14 @@ int vnodeOpenFileForImport(SImportInfo *pImport, char *payload, SHeadInfo *pHinf
...
@@ -237,12 +236,14 @@ int vnodeOpenFileForImport(SImportInfo *pImport, char *payload, SHeadInfo *pHinf
}
else
if
(
pVnode
->
commitFileId
==
pImport
->
fileId
)
{
}
else
if
(
pVnode
->
commitFileId
==
pImport
->
fileId
)
{
int
slots
=
pImport
->
pos
?
pImport
->
slot
+
1
:
pImport
->
slot
;
int
slots
=
pImport
->
pos
?
pImport
->
slot
+
1
:
pImport
->
slot
;
assert
(
slots
>=
0
);
pHinfo
->
leftOffset
+=
slots
*
sizeof
(
SCompBlock
);
pHinfo
->
leftOffset
+=
slots
*
sizeof
(
SCompBlock
);
// check if last block is at last file, if it is, read into memory
// check if last block is at last file, if it is, read into memory
if
(
pImport
->
pos
==
0
&&
pHinfo
->
compInfo
.
numOfBlocks
>
0
&&
pImport
->
slot
==
pHinfo
->
compInfo
.
numOfBlocks
&&
if
(
pImport
->
pos
==
0
&&
pHinfo
->
compInfo
.
numOfBlocks
>
0
&&
pImport
->
slot
==
pHinfo
->
compInfo
.
numOfBlocks
&&
pHinfo
->
compInfo
.
last
)
{
pHinfo
->
compInfo
.
last
)
{
rowsBefore
=
vnodeProcessLastBlock
(
pImport
,
pHinfo
,
data
);
rowsBefore
=
vnodeProcessLastBlock
(
pImport
,
pHinfo
,
data
);
if
(
rowsBefore
>
0
)
pImport
->
slot
--
;
}
}
// this block will be replaced by new blocks
// this block will be replaced by new blocks
...
@@ -787,6 +788,8 @@ int vnodeImportStartToFile(SImportInfo *pImport, char *payload, int rows) {
...
@@ -787,6 +788,8 @@ int vnodeImportStartToFile(SImportInfo *pImport, char *payload, int rows) {
code
=
vnodeFindKeyInFile
(
pImport
,
1
);
code
=
vnodeFindKeyInFile
(
pImport
,
1
);
if
(
code
!=
0
)
return
code
;
if
(
code
!=
0
)
return
code
;
assert
(
pImport
->
slot
>=
0
);
if
(
pImport
->
key
!=
pImport
->
firstKey
)
{
if
(
pImport
->
key
!=
pImport
->
firstKey
)
{
pImport
->
payload
=
payload
;
pImport
->
payload
=
payload
;
pImport
->
rows
=
vnodeGetImportStartPart
(
pObj
,
payload
,
rows
,
pImport
->
key
);
pImport
->
rows
=
vnodeGetImportStartPart
(
pObj
,
payload
,
rows
,
pImport
->
key
);
...
@@ -845,7 +848,7 @@ int vnodeImportWholeToCache(SImportInfo *pImport, char *payload, int rows) {
...
@@ -845,7 +848,7 @@ int vnodeImportWholeToCache(SImportInfo *pImport, char *payload, int rows) {
}
}
int
vnodeImportPoints
(
SMeterObj
*
pObj
,
char
*
cont
,
int
contLen
,
char
source
,
void
*
param
,
int
sversion
,
int
vnodeImportPoints
(
SMeterObj
*
pObj
,
char
*
cont
,
int
contLen
,
char
source
,
void
*
param
,
int
sversion
,
int
*
pNumOfPoints
)
{
int
*
pNumOfPoints
,
TSKEY
now
)
{
SSubmitMsg
*
pSubmit
=
(
SSubmitMsg
*
)
cont
;
SSubmitMsg
*
pSubmit
=
(
SSubmitMsg
*
)
cont
;
SVnodeObj
*
pVnode
=
&
vnodeList
[
pObj
->
vnode
];
SVnodeObj
*
pVnode
=
&
vnodeList
[
pObj
->
vnode
];
int
rows
;
int
rows
;
...
@@ -872,7 +875,7 @@ int vnodeImportPoints(SMeterObj *pObj, char *cont, int contLen, char source, voi
...
@@ -872,7 +875,7 @@ int vnodeImportPoints(SMeterObj *pObj, char *cont, int contLen, char source, voi
payload
=
pSubmit
->
payLoad
;
payload
=
pSubmit
->
payLoad
;
int
firstId
=
(
*
(
TSKEY
*
)
payload
)
/
pVnode
->
cfg
.
daysPerFile
/
tsMsPerDay
[
pVnode
->
cfg
.
precision
];
int
firstId
=
(
*
(
TSKEY
*
)
payload
)
/
pVnode
->
cfg
.
daysPerFile
/
tsMsPerDay
[
pVnode
->
cfg
.
precision
];
int
lastId
=
(
*
(
TSKEY
*
)(
payload
+
pObj
->
bytesPerPoint
*
(
rows
-
1
)))
/
pVnode
->
cfg
.
daysPerFile
/
tsMsPerDay
[
pVnode
->
cfg
.
precision
];
int
lastId
=
(
*
(
TSKEY
*
)(
payload
+
pObj
->
bytesPerPoint
*
(
rows
-
1
)))
/
pVnode
->
cfg
.
daysPerFile
/
tsMsPerDay
[
pVnode
->
cfg
.
precision
];
int
cfile
=
taosGetTimestamp
(
pVnode
->
cfg
.
precision
)
/
pVnode
->
cfg
.
daysPerFile
/
tsMsPerDay
[
pVnode
->
cfg
.
precision
];
int
cfile
=
now
/
pVnode
->
cfg
.
daysPerFile
/
tsMsPerDay
[
pVnode
->
cfg
.
precision
];
if
((
firstId
<=
cfile
-
pVnode
->
maxFiles
)
||
(
firstId
>
cfile
+
1
)
||
(
lastId
<=
cfile
-
pVnode
->
maxFiles
)
||
(
lastId
>
cfile
+
1
))
{
if
((
firstId
<=
cfile
-
pVnode
->
maxFiles
)
||
(
firstId
>
cfile
+
1
)
||
(
lastId
<=
cfile
-
pVnode
->
maxFiles
)
||
(
lastId
>
cfile
+
1
))
{
dError
(
"vid:%d sid:%d id:%s, invalid timestamp to import, firstKey: %ld lastKey: %ld"
,
dError
(
"vid:%d sid:%d id:%s, invalid timestamp to import, firstKey: %ld lastKey: %ld"
,
pObj
->
vnode
,
pObj
->
sid
,
pObj
->
meterId
,
*
(
TSKEY
*
)(
payload
),
*
(
TSKEY
*
)(
payload
+
pObj
->
bytesPerPoint
*
(
rows
-
1
)));
pObj
->
vnode
,
pObj
->
sid
,
pObj
->
meterId
,
*
(
TSKEY
*
)(
payload
),
*
(
TSKEY
*
)(
payload
+
pObj
->
bytesPerPoint
*
(
rows
-
1
)));
...
@@ -888,7 +891,7 @@ int vnodeImportPoints(SMeterObj *pObj, char *cont, int contLen, char source, voi
...
@@ -888,7 +891,7 @@ int vnodeImportPoints(SMeterObj *pObj, char *cont, int contLen, char source, voi
if
(
*
((
TSKEY
*
)(
pSubmit
->
payLoad
+
(
rows
-
1
)
*
pObj
->
bytesPerPoint
))
>
pObj
->
lastKey
)
{
if
(
*
((
TSKEY
*
)(
pSubmit
->
payLoad
+
(
rows
-
1
)
*
pObj
->
bytesPerPoint
))
>
pObj
->
lastKey
)
{
vnodeClearMeterState
(
pObj
,
TSDB_METER_STATE_IMPORTING
);
vnodeClearMeterState
(
pObj
,
TSDB_METER_STATE_IMPORTING
);
vnodeSetMeterState
(
pObj
,
TSDB_METER_STATE_INSERT
);
vnodeSetMeterState
(
pObj
,
TSDB_METER_STATE_INSERT
);
code
=
vnodeInsertPoints
(
pObj
,
cont
,
contLen
,
TSDB_DATA_SOURCE_LOG
,
NULL
,
pObj
->
sversion
,
&
pointsImported
);
code
=
vnodeInsertPoints
(
pObj
,
cont
,
contLen
,
TSDB_DATA_SOURCE_LOG
,
NULL
,
pObj
->
sversion
,
&
pointsImported
,
now
);
if
(
pShell
)
{
if
(
pShell
)
{
pShell
->
code
=
code
;
pShell
->
code
=
code
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录