kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guozh...@apache.org
Subject kafka git commit: HOTFIX: failing to close this iterator causes leaks in rocksdb
Date Fri, 11 Nov 2016 14:36:35 GMT
Repository: kafka
Updated Branches:
  refs/heads/0.10.1 10cfc1628 -> 8deb05d56


HOTFIX: failing to close this iterator causes leaks in rocksdb

guozhangwang dguy

Author: dan norwood <norwood@confluent.io>

Reviewers: Damian Guy, Michael G. Noll, Guozhang Wang

Closes #2122 from norwood/close-call

(cherry picked from commit 0fc1898bf6b91ac5f79dbf3da7ebc90da410876d)
Signed-off-by: Guozhang Wang <wangguoz@gmail.com>


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

Branch: refs/heads/0.10.1
Commit: 8deb05d56b927c77824c10c257fe7bf22a677520
Parents: 10cfc16
Author: Dan Norwood <norwood@confluent.io>
Authored: Fri Nov 11 06:36:15 2016 -0800
Committer: Guozhang Wang <wangguoz@gmail.com>
Committed: Fri Nov 11 06:36:30 2016 -0800

----------------------------------------------------------------------
 .../kafka/streams/state/internals/CachingWindowStore.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/8deb05d5/streams/src/main/java/org/apache/kafka/streams/state/internals/CachingWindowStore.java
----------------------------------------------------------------------
diff --git a/streams/src/main/java/org/apache/kafka/streams/state/internals/CachingWindowStore.java
b/streams/src/main/java/org/apache/kafka/streams/state/internals/CachingWindowStore.java
index 7ff4044..304a206 100644
--- a/streams/src/main/java/org/apache/kafka/streams/state/internals/CachingWindowStore.java
+++ b/streams/src/main/java/org/apache/kafka/streams/state/internals/CachingWindowStore.java
@@ -160,11 +160,11 @@ class CachingWindowStore<K, V> implements WindowStore<K, V>,
CachedStateStore<Wi
     }
 
     private V fetchPrevious(final Bytes key, final long timestamp) {
-        final WindowStoreIterator<byte[]> iterator = underlying.fetch(key, timestamp,
timestamp);
-        if (!iterator.hasNext()) {
-            return null;
+        try (final WindowStoreIterator<byte[]> iterator = underlying.fetch(key, timestamp,
timestamp)) {
+            if (!iterator.hasNext()) {
+                return null;
+            }
+            return serdes.valueFrom(iterator.next().value);
         }
-        return serdes.valueFrom(iterator.next().value);
     }
-
 }


Mime
View raw message