Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
doujutun3207
flink
提交
a17d4e82
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,发现更多精彩内容 >>
提交
a17d4e82
编写于
8月 10, 2015
作者:
U
Ufuk Celebi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[FLINK-2460] [runtime] Check parent state in isReleased() check of partition view
- Address PR comments This closes #1051.
上级
5a9daca4
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
64 addition
and
6 deletion
+64
-6
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/PipelinedSubpartition.java
...k/runtime/io/network/partition/PipelinedSubpartition.java
+6
-1
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/ResultSubpartition.java
...link/runtime/io/network/partition/ResultSubpartition.java
+2
-0
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/SpillableSubpartition.java
...k/runtime/io/network/partition/SpillableSubpartition.java
+6
-1
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/SpillableSubpartitionView.java
...ntime/io/network/partition/SpillableSubpartitionView.java
+2
-2
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/SpilledSubpartitionViewAsyncIO.java
.../io/network/partition/SpilledSubpartitionViewAsyncIO.java
+1
-1
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/SpilledSubpartitionViewSyncIO.java
...e/io/network/partition/SpilledSubpartitionViewSyncIO.java
+1
-1
flink-runtime/src/test/java/org/apache/flink/runtime/io/network/partition/PipelinedSubpartitionTest.java
...ntime/io/network/partition/PipelinedSubpartitionTest.java
+4
-0
flink-runtime/src/test/java/org/apache/flink/runtime/io/network/partition/SubpartitionTestBase.java
...nk/runtime/io/network/partition/SubpartitionTestBase.java
+42
-0
未找到文件。
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/PipelinedSubpartition.java
浏览文件 @
a17d4e82
...
...
@@ -41,7 +41,7 @@ class PipelinedSubpartition extends ResultSubpartition {
private
boolean
isFinished
;
/** Flag indicating whether the subpartition has been released. */
private
boolean
isReleased
;
private
volatile
boolean
isReleased
;
/**
* A data availability listener. Registered, when the consuming task is faster than the
...
...
@@ -166,6 +166,11 @@ class PipelinedSubpartition extends ResultSubpartition {
return
0
;
}
@Override
public
boolean
isReleased
()
{
return
isReleased
;
}
@Override
public
PipelinedSubpartitionView
createReadView
(
BufferProvider
bufferProvider
)
{
synchronized
(
buffers
)
{
...
...
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/ResultSubpartition.java
浏览文件 @
a17d4e82
...
...
@@ -81,4 +81,6 @@ public abstract class ResultSubpartition {
abstract
int
releaseMemory
()
throws
IOException
;
abstract
public
boolean
isReleased
();
}
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/SpillableSubpartition.java
浏览文件 @
a17d4e82
...
...
@@ -59,7 +59,7 @@ class SpillableSubpartition extends ResultSubpartition {
private
boolean
isFinished
;
/** Flag indicating whether the subpartition has been released. */
boolean
isReleased
;
private
volatile
boolean
isReleased
;
/** The read view to consume this subpartition. */
private
ResultSubpartitionView
readView
;
...
...
@@ -167,6 +167,11 @@ class SpillableSubpartition extends ResultSubpartition {
return
0
;
}
@Override
public
boolean
isReleased
()
{
return
isReleased
;
}
@Override
public
ResultSubpartitionView
createReadView
(
BufferProvider
bufferProvider
)
throws
IOException
{
synchronized
(
buffers
)
{
...
...
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/SpillableSubpartitionView.java
浏览文件 @
a17d4e82
...
...
@@ -73,7 +73,7 @@ class SpillableSubpartitionView implements ResultSubpartitionView {
// 1) In-memory
synchronized
(
parent
.
buffers
)
{
if
(
parent
.
isReleased
)
{
if
(
parent
.
isReleased
()
)
{
return
null
;
}
...
...
@@ -162,7 +162,7 @@ class SpillableSubpartitionView implements ResultSubpartitionView {
@Override
public
boolean
isReleased
()
{
return
isReleased
.
get
();
return
parent
.
isReleased
()
||
isReleased
.
get
();
}
@Override
...
...
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/SpilledSubpartitionViewAsyncIO.java
浏览文件 @
a17d4e82
...
...
@@ -187,7 +187,7 @@ class SpilledSubpartitionViewAsyncIO implements ResultSubpartitionView {
@Override
public
boolean
isReleased
()
{
return
isReleased
;
return
parent
.
isReleased
()
||
isReleased
;
}
@Override
...
...
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/SpilledSubpartitionViewSyncIO.java
浏览文件 @
a17d4e82
...
...
@@ -108,7 +108,7 @@ class SpilledSubpartitionViewSyncIO implements ResultSubpartitionView {
@Override
public
boolean
isReleased
()
{
return
isReleased
.
get
();
return
parent
.
isReleased
()
||
isReleased
.
get
();
}
@Override
...
...
flink-runtime/src/test/java/org/apache/flink/runtime/io/network/partition/PipelinedSubpartitionTest.java
浏览文件 @
a17d4e82
...
...
@@ -18,11 +18,14 @@
package
org.apache.flink.runtime.io.network.partition
;
import
org.apache.flink.api.common.JobID
;
import
org.apache.flink.core.memory.MemorySegment
;
import
org.apache.flink.runtime.event.AbstractEvent
;
import
org.apache.flink.runtime.io.disk.iomanager.IOManagerAsync
;
import
org.apache.flink.runtime.io.network.buffer.Buffer
;
import
org.apache.flink.runtime.io.network.buffer.BufferProvider
;
import
org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent
;
import
org.apache.flink.runtime.io.network.util.TestBufferFactory
;
import
org.apache.flink.runtime.io.network.util.TestConsumerCallback
;
import
org.apache.flink.runtime.io.network.util.TestNotificationListener
;
import
org.apache.flink.runtime.io.network.util.TestPooledBufferProvider
;
...
...
@@ -36,6 +39,7 @@ import java.util.concurrent.ExecutorService;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.Future
;
import
static
org
.
apache
.
flink
.
runtime
.
io
.
disk
.
iomanager
.
IOManager
.
IOMode
.
ASYNC
;
import
static
org
.
apache
.
flink
.
runtime
.
io
.
network
.
util
.
TestBufferFactory
.
createBuffer
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
...
...
flink-runtime/src/test/java/org/apache/flink/runtime/io/network/partition/SubpartitionTestBase.java
浏览文件 @
a17d4e82
...
...
@@ -19,10 +19,15 @@
package
org.apache.flink.runtime.io.network.partition
;
import
org.apache.flink.runtime.io.network.buffer.Buffer
;
import
org.apache.flink.runtime.io.network.util.TestBufferFactory
;
import
org.apache.flink.runtime.io.network.util.TestInfiniteBufferProvider
;
import
org.apache.flink.util.TestLogger
;
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
mockito
.
Mockito
.
mock
;
/**
...
...
@@ -68,4 +73,41 @@ public abstract class SubpartitionTestBase extends TestLogger {
}
}
}
@Test
public
void
testReleaseParent
()
throws
Exception
{
final
ResultSubpartition
partition
=
createSubpartition
();
verifyViewReleasedAfterParentRelease
(
partition
);
}
@Test
public
void
testReleaseParentAfterSpilled
()
throws
Exception
{
final
ResultSubpartition
partition
=
createSubpartition
();
partition
.
releaseMemory
();
verifyViewReleasedAfterParentRelease
(
partition
);
}
private
void
verifyViewReleasedAfterParentRelease
(
ResultSubpartition
partition
)
throws
Exception
{
// Add a buffer
Buffer
buffer
=
TestBufferFactory
.
createBuffer
();
partition
.
add
(
buffer
);
partition
.
finish
();
TestInfiniteBufferProvider
buffers
=
new
TestInfiniteBufferProvider
();
// Create the view
ResultSubpartitionView
view
=
partition
.
createReadView
(
buffers
);
// The added buffer and end-of-partition event
assertNotNull
(
view
.
getNextBuffer
());
assertNotNull
(
view
.
getNextBuffer
());
// Release the parent
assertFalse
(
view
.
isReleased
());
partition
.
release
();
// Verify that parent release is reflected at partition view
assertTrue
(
view
.
isReleased
());
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录