Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
doujutun3207
flink
提交
fc4abd7f
F
flink
项目概览
doujutun3207
/
flink
与 Fork 源项目一致
从无法访问的项目Fork
通知
24
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
flink
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fc4abd7f
编写于
6月 16, 2016
作者:
K
kl0u
提交者:
Aljoscha Krettek
6月 17, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[FLINK-4075] ContinuousFileProcessingCheckpointITCase failed on Travis
上级
ec6d9752
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
45 addition
and
23 deletion
+45
-23
flink-batch-connectors/flink-avro/src/main/java/org/apache/flink/api/java/io/AvroInputFormat.java
...in/java/org/apache/flink/api/java/io/AvroInputFormat.java
+13
-10
flink-core/src/main/java/org/apache/flink/api/common/io/BinaryInputFormat.java
...ava/org/apache/flink/api/common/io/BinaryInputFormat.java
+10
-7
flink-core/src/main/java/org/apache/flink/api/common/io/DelimitedInputFormat.java
.../org/apache/flink/api/common/io/DelimitedInputFormat.java
+9
-3
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/ContinuousFileReaderOperator.java
...ng/api/functions/source/ContinuousFileReaderOperator.java
+13
-3
未找到文件。
flink-batch-connectors/flink-avro/src/main/java/org/apache/flink/api/java/io/AvroInputFormat.java
浏览文件 @
fc4abd7f
...
...
@@ -68,7 +68,7 @@ public class AvroInputFormat<E> extends FileInputFormat<E> implements ResultType
private
transient
long
recordsReadSinceLastSync
;
private
transient
long
lastSync
=
-
1
l
;
private
long
lastSync
=
-
1
l
;
public
AvroInputFormat
(
Path
filePath
,
Class
<
E
>
type
)
{
super
(
filePath
);
...
...
@@ -186,18 +186,21 @@ public class AvroInputFormat<E> extends FileInputFormat<E> implements ResultType
Preconditions
.
checkNotNull
(
split
,
"reopen() cannot be called on a null split."
);
Preconditions
.
checkNotNull
(
state
,
"reopen() cannot be called with a null initial state."
);
this
.
open
(
split
);
if
(
state
.
f0
!=
-
1
)
{
try
{
this
.
open
(
split
);
}
finally
{
if
(
state
.
f0
!=
-
1
)
{
lastSync
=
state
.
f0
;
recordsReadSinceLastSync
=
state
.
f1
;
}
}
// go to the block we stopped
lastSync
=
state
.
f0
;
if
(
lastSync
!=
-
1
)
{
// open and read until the record we were before
// the checkpoint and discard the values
dataFileReader
.
seek
(
lastSync
);
// read until the record we were before the checkpoint and discard the values
long
recordsToDiscard
=
state
.
f1
;
for
(
int
i
=
0
;
i
<
recordsToDiscard
;
i
++)
{
for
(
int
i
=
0
;
i
<
recordsReadSinceLastSync
;
i
++)
{
dataFileReader
.
next
(
null
);
recordsReadSinceLastSync
++;
}
}
}
...
...
flink-core/src/main/java/org/apache/flink/api/common/io/BinaryInputFormat.java
浏览文件 @
fc4abd7f
...
...
@@ -390,14 +390,17 @@ public abstract class BinaryInputFormat<T> extends FileInputFormat<T>
Preconditions
.
checkNotNull
(
split
,
"reopen() cannot be called on a null split."
);
Preconditions
.
checkNotNull
(
state
,
"reopen() cannot be called with a null initial state."
);
this
.
open
(
split
);
this
.
blockInfo
=
this
.
createAndReadBlockInfo
();
try
{
this
.
open
(
split
);
}
finally
{
this
.
blockInfo
=
this
.
createAndReadBlockInfo
();
long
blockPos
=
state
.
f0
;
this
.
readRecords
=
state
.
f1
;
long
blockPos
=
state
.
f0
;
this
.
readRecords
=
state
.
f1
;
this
.
stream
.
seek
(
this
.
splitStart
+
blockPos
);
this
.
blockBasedInput
=
new
BlockBasedInput
(
this
.
stream
,
(
int
)
blockPos
,
this
.
splitLength
);
this
.
dataInputStream
=
new
DataInputViewStreamWrapper
(
blockBasedInput
);
this
.
stream
.
seek
(
this
.
splitStart
+
blockPos
);
this
.
blockBasedInput
=
new
BlockBasedInput
(
this
.
stream
,
(
int
)
blockPos
,
this
.
splitLength
);
this
.
dataInputStream
=
new
DataInputViewStreamWrapper
(
blockBasedInput
);
}
}
}
flink-core/src/main/java/org/apache/flink/api/common/io/DelimitedInputFormat.java
浏览文件 @
fc4abd7f
...
...
@@ -144,7 +144,7 @@ public abstract class DelimitedInputFormat<OT> extends FileInputFormat<OT> imple
private
transient
boolean
end
;
private
transient
long
offset
=
-
1
;
private
long
offset
=
-
1
;
// --------------------------------------------------------------------------------------------
// The configuration parameters. Configured on the instance and serialized to be shipped.
...
...
@@ -638,9 +638,15 @@ public abstract class DelimitedInputFormat<OT> extends FileInputFormat<OT> imple
public
void
reopen
(
FileInputSplit
split
,
Long
state
)
throws
IOException
{
Preconditions
.
checkNotNull
(
split
,
"reopen() cannot be called on a null split."
);
Preconditions
.
checkNotNull
(
state
,
"reopen() cannot be called with a null initial state."
);
Preconditions
.
checkArgument
(
state
==
-
1
||
state
>=
split
.
getStart
(),
" Illegal offset "
+
state
+
", smaller than the splits start="
+
split
.
getStart
());
try
{
this
.
open
(
split
);
}
finally
{
this
.
offset
=
state
;
}
this
.
open
(
split
);
this
.
offset
=
state
;
if
(
state
>
this
.
splitStart
+
split
.
getLength
())
{
this
.
end
=
true
;
}
else
if
(
state
>
split
.
getStart
())
{
...
...
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/ContinuousFileReaderOperator.java
浏览文件 @
fc4abd7f
...
...
@@ -188,6 +188,8 @@ public class ContinuousFileReaderOperator<OUT, S extends Serializable> extends A
private
S
restoredFormatState
=
null
;
private
volatile
boolean
isSplitOpen
=
false
;
SplitReader
(
FileInputFormat
<
OT
>
format
,
TypeSerializer
<
OT
>
serializer
,
TimestampedCollector
<
OT
>
collector
,
...
...
@@ -271,6 +273,7 @@ public class ContinuousFileReaderOperator<OUT, S extends Serializable> extends A
}
this
.
format
.
open
(
currentSplit
);
}
this
.
isSplitOpen
=
true
;
}
LOG
.
info
(
"Reading split: "
+
currentSplit
);
...
...
@@ -290,8 +293,11 @@ public class ContinuousFileReaderOperator<OUT, S extends Serializable> extends A
}
finally
{
// close and prepare for the next iteration
this
.
format
.
close
();
this
.
currentSplit
=
null
;
synchronized
(
checkpointLock
)
{
this
.
format
.
close
();
this
.
isSplitOpen
=
false
;
this
.
currentSplit
=
null
;
}
}
}
...
...
@@ -303,8 +309,12 @@ public class ContinuousFileReaderOperator<OUT, S extends Serializable> extends A
}
finally
{
synchronized
(
checkpointLock
)
{
LOG
.
info
(
"Reader terminated, and exiting..."
);
this
.
format
.
closeInputFormat
();
this
.
isSplitOpen
=
false
;
this
.
currentSplit
=
null
;
this
.
isRunning
=
false
;
checkpointLock
.
notifyAll
();
}
}
...
...
@@ -321,7 +331,7 @@ public class ContinuousFileReaderOperator<OUT, S extends Serializable> extends A
this
.
pendingSplits
.
remove
();
}
if
(
this
.
format
instanceof
CheckpointableInputFormat
)
{
if
(
this
.
format
instanceof
CheckpointableInputFormat
&&
this
.
isSplitOpen
)
{
S
formatState
=
(
S
)
((
CheckpointableInputFormat
)
format
).
getCurrentState
();
return
new
Tuple3
<>(
snapshot
,
currentSplit
,
currentSplit
==
null
?
null
:
formatState
);
}
else
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录