flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject [07/12] flink git commit: [FLINK-5002] [network] Renamed getNumberOfUsedBuffers() method to bestEffortGetNumOfUsedBuffers()
Date Wed, 14 Dec 2016 12:10:14 GMT
[FLINK-5002] [network] Renamed getNumberOfUsedBuffers() method to bestEffortGetNumOfUsedBuffers()

This closes #2865


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/a5cf88f7
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/a5cf88f7
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/a5cf88f7

Branch: refs/heads/master
Commit: a5cf88f7ff1fcd46bada0cf12c517c1667b21751
Parents: 22a8204
Author: Roman Maier <roman_maier@epam.com>
Authored: Fri Nov 18 17:51:58 2016 +0400
Committer: Stephan Ewen <sewen@apache.org>
Committed: Wed Dec 14 12:43:33 2016 +0100

----------------------------------------------------------------------
 .../org/apache/flink/runtime/io/network/buffer/BufferPool.java   | 2 +-
 .../apache/flink/runtime/io/network/buffer/LocalBufferPool.java  | 4 ++--
 .../apache/flink/runtime/metrics/groups/TaskIOMetricGroup.java   | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/a5cf88f7/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/BufferPool.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/BufferPool.java
b/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/BufferPool.java
index ae21a84..8784b14 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/BufferPool.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/BufferPool.java
@@ -71,6 +71,6 @@ public interface BufferPool extends BufferProvider, BufferRecycler {
 	/**
 	 * Returns the number of used buffers of this buffer pool.
 	 */
-	int getNumberOfUsedBuffers();
+	int bestEffortGetNumOfUsedBuffers();
 
 }

http://git-wip-us.apache.org/repos/asf/flink/blob/a5cf88f7/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/LocalBufferPool.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/LocalBufferPool.java
b/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/LocalBufferPool.java
index 68c1bde..86e6870 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/LocalBufferPool.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/LocalBufferPool.java
@@ -111,8 +111,8 @@ class LocalBufferPool implements BufferPool {
 	}
 
 	@Override
-	public int getNumberOfUsedBuffers() {
-		return numberOfRequestedMemorySegments - availableMemorySegments.size();
+	public int bestEffortGetNumOfUsedBuffers() {
+		return Math.max(0, numberOfRequestedMemorySegments - availableMemorySegments.size());
 	}
 
 	@Override

http://git-wip-us.apache.org/repos/asf/flink/blob/a5cf88f7/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/TaskIOMetricGroup.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/TaskIOMetricGroup.java
b/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/TaskIOMetricGroup.java
index fcea098..38accad 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/TaskIOMetricGroup.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/TaskIOMetricGroup.java
@@ -183,7 +183,7 @@ public class TaskIOMetricGroup extends ProxyMetricGroup<TaskMetricGroup>
{
 			int bufferPoolSize = 0;
 
 			for (SingleInputGate inputGate : task.getAllInputGates()) {
-				usedBuffers += inputGate.getBufferPool().getNumberOfUsedBuffers();
+				usedBuffers += inputGate.getBufferPool().bestEffortGetNumOfUsedBuffers();
 				bufferPoolSize += inputGate.getBufferPool().getNumBuffers();
 			}
 
@@ -212,7 +212,7 @@ public class TaskIOMetricGroup extends ProxyMetricGroup<TaskMetricGroup>
{
 			int bufferPoolSize = 0;
 
 			for (ResultPartition resultPartition : task.getProducedPartitions()) {
-				usedBuffers += resultPartition.getBufferPool().getNumberOfUsedBuffers();
+				usedBuffers += resultPartition.getBufferPool().bestEffortGetNumOfUsedBuffers();
 				bufferPoolSize += resultPartition.getBufferPool().getNumBuffers();
 			}
 


Mime
View raw message